Files
annotate/detectors/normalize/lib/lookforIR.lib.sh
Eric Coissac 4b71fe8c4c Changes to be committed:
modified:   .gitignore
	new file:   data/cds/sp_chlorodb/parameters.sh
	deleted:    data/ir/LSC_RefDB.fasta
	deleted:    data/ir/SSC_RefDB.fasta
	modified:   detectors/cds/bin/go_cds.sh
	modified:   detectors/normalize/lib/lookforIR.lib.sh
	modified:   detectors/normalize/lib/selectIR.py
	modified:   organnot/Dockerfile
	new file:   organnot/README.md
	new file:   organnot/dorgannot
	deleted:    ports/.DS_Store
	deleted:    src/ncbiblast/binaries/.gitignore
	deleted:    src/prokov/lxpack/tests/S.fasta
	deleted:    src/prokov/lxpack/tests/St.fasta
	deleted:    src/prokov/lxpack/tests/Stt.fasta
	deleted:    src/prokov/lxpack/tests/aS.fasta
	deleted:    src/prokov/lxpack/tests/aSt.fasta
	deleted:    src/prokov/lxpack/tests/aStt.fasta
	deleted:    src/prokov/lxpack/tests/aaS.fasta
	deleted:    src/prokov/lxpack/tests/aaSt.fasta
	deleted:    src/prokov/lxpack/tests/aaStt.fasta
	new file:   src/repseek/repseek-2014.09.tgz
2025-03-05 21:56:39 +01:00

76 lines
2.0 KiB
Bash

#!/bin/bash
source "${THIS_DIR}/../../../scripts/bash_init.sh"
SELECTIR="${PROG_DIR}/../../normalize/lib/selectIR.py"
function lookForIR {
local QUERY="$1"
local MATCHES=$(basename ${QUERY})
MATCHES="${MATCHES/.*/}.matches"
local REPEATS="${MATCHES/.*/}.repseek"
# Blast columns:
# query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score
# We keep blast matches if :
# The match is longer than 1000
# The identity is higher than 80%
#
# The match file has the following format:
# LSC/SSC begin end same_strand=1/diff_strand=0
loginfo "Locating SSC and LSC by similarity..."
blastn -db ${SCDB} \
-query ${QUERY} \
-outfmt 6 \
-max_target_seqs 10000 | \
awk -v id_match=80 -v lmin=100 \
'($4+0 > lmin) && (($3+0)>id_match) {
SAME=(($7+0 < $8+0) && ($9+0 < $10+0)) || (($7+0 > $8+0) && ($9+0 > $10+0));
if ($7+0 < $8+0)
{print substr($2,1,3),$7,$8,SAME}
else
{print substr($2,1,3),$8,$7,SAME}
}' | \
sort -nk 2 > ${MATCHES}
loginfo "Done $(wc -l ${MATCHES} | awk '{print $1}') matches identified"
loginfo "Looking for long inverted repeats..."
repseek -c -p 0.001 -i ${QUERY} 2>> /dev/null > ${REPEATS}
nrepeat="$(wc -l ${REPEATS} | awk '{print $1}')"
loginfo "Done"
if (( nrepeat == 0 )) ; then
logwarning "No inverted repeat identified"
return 1
fi
loginfo " --> ${nrepeat} repeats identified"
loginfo "Marking and selecting the best inverted repeat..."
local IR=( $(${SELECTIR} ${MATCHES} ${REPEATS}) )
loginfo "Done"
loginfo " --> IR size : IRa = ${IR[5]} / IRb = ${IR[7]}"
loginfo " --> IR Score: ${IR[8]}"
deltaIR=$((IR[5] - IR[7]))
if (( deltaIR < -10 )) || (( deltaIR > 10 )); then
logwarning "Differences between IR lengths ($deltaIR) is greater than 10"
fi
echo "${IR[@]}"
}
SCDB="${IR_DATA_DIR}/SC_RefDB"
if [[ ! "$1" =~ ^/ ]]; then
QUERY="${CALL_DIR}/$1"
else
QUERY="$1"
fi