Add a patch for chloroplast annotation when no inverted repeats are
detected Former-commit-id: 7e3ddd41cf0d0788223382fedbf45b183974233e Former-commit-id: e5a8ceb825f78d243e37d22cd6b2e91f403c0ee8
This commit is contained in:
@ -29,35 +29,37 @@ pushTmpDir ORG.ir
|
|||||||
loginfo " --> $genome_length bp"
|
loginfo " --> $genome_length bp"
|
||||||
loginfo "Done"
|
loginfo "Done"
|
||||||
|
|
||||||
IR=( $(lookForIR ${QUERY}) )
|
IRDetected=1
|
||||||
|
IR=( $(lookForIR ${QUERY}) ) || IRDetected=0
|
||||||
posIR1=${IR[4]}
|
|
||||||
posIR2=${IR[6]}
|
|
||||||
|
|
||||||
let "lenIR= ( ${IR[5]} + ${IR[7]} ) / 2 "
|
|
||||||
|
|
||||||
let "endIR2=$posIR2 + $lenIR - 1"
|
if (( IRDetected == 1 )) ; then
|
||||||
let "endIR1=$posIR1 + $lenIR - 1"
|
posIR1=${IR[4]}
|
||||||
|
posIR2=${IR[6]}
|
||||||
beginLSC=1
|
|
||||||
let "endLSC=$posIR1-1"
|
let "lenIR= ( ${IR[5]} + ${IR[7]} ) / 2 "
|
||||||
|
|
||||||
|
let "endIR2=$posIR2 + $lenIR - 1"
|
||||||
let "beginSSC=$endIR1+1"
|
let "endIR1=$posIR1 + $lenIR - 1"
|
||||||
let "endSSC=$posIR2-1"
|
|
||||||
|
beginLSC=1
|
||||||
|
let "endLSC=$posIR1-1"
|
||||||
|
|
||||||
|
|
||||||
echo "FT misc_feature ${beginLSC}..${endLSC}"
|
let "beginSSC=$endIR1+1"
|
||||||
echo "FT /note=\"large single copy region (LSC)\""
|
let "endSSC=$posIR2-1"
|
||||||
echo "FT repeat_region ${posIR1}..${endIR1}"
|
|
||||||
echo "FT /rpt_type=INVERTED"
|
|
||||||
echo "FT /note=\"left inverted repeat B; IRB\""
|
echo "FT misc_feature ${beginLSC}..${endLSC}"
|
||||||
echo "FT misc_feature ${beginSSC}..${endSSC}"
|
echo "FT /note=\"large single copy region (LSC)\""
|
||||||
echo "FT /note=\"small single copy region (SSC)\""
|
echo "FT repeat_region ${posIR1}..${endIR1}"
|
||||||
echo "FT repeat_region ${posIR2}..${endIR2}"
|
echo "FT /rpt_type=INVERTED"
|
||||||
echo "FT /rpt_type=INVERTED"
|
echo "FT /note=\"left inverted repeat B; IRB\""
|
||||||
echo "FT /note=\"left inverted repeat A; IRA\""
|
echo "FT misc_feature ${beginSSC}..${endSSC}"
|
||||||
|
echo "FT /note=\"small single copy region (SSC)\""
|
||||||
|
echo "FT repeat_region ${posIR2}..${endIR2}"
|
||||||
|
echo "FT /rpt_type=INVERTED"
|
||||||
|
echo "FT /note=\"left inverted repeat A; IRA\""
|
||||||
|
fi
|
||||||
|
|
||||||
popTmpDir
|
popTmpDir
|
||||||
|
|
||||||
|
@ -41,128 +41,134 @@ pushTmpDir ORG.normalize
|
|||||||
loginfo " --> $genome_length bp"
|
loginfo " --> $genome_length bp"
|
||||||
loginfo "Done"
|
loginfo "Done"
|
||||||
|
|
||||||
IR=( $(lookForIR ${QUERY}) )
|
IRDetected=1
|
||||||
|
IR=( $(lookForIR ${QUERY}) ) || IRDetected=0
|
||||||
|
|
||||||
posIR1=${IR[4]}
|
if (( IRDetected == 1 )) ; then
|
||||||
posIR2=${IR[6]}
|
|
||||||
|
|
||||||
let "lenIR= ( ${IR[5]} + ${IR[7]} ) / 2 "
|
posIR1=${IR[4]}
|
||||||
|
posIR2=${IR[6]}
|
||||||
let "endIR2=$posIR2 + $lenIR - 1"
|
|
||||||
let "endIR1=$posIR1 + $lenIR - 1"
|
|
||||||
|
|
||||||
if (( "$endIR2" >= "$genome_length" )) ; then
|
|
||||||
loginfo "IRB is at the end of the original sequence"
|
|
||||||
|
|
||||||
#
|
let "lenIR= ( ${IR[5]} + ${IR[7]} ) / 2 "
|
||||||
# We just move the IRB at the begining of the sequence
|
|
||||||
#
|
|
||||||
|
|
||||||
# Extract the IRB sequence
|
|
||||||
let "posCut=($endIR1+$posIR2)/2"
|
|
||||||
cutseq ${QUERY} ${posCut} ${genome_length} > ${tmpfasta1}
|
|
||||||
|
|
||||||
# Append the remaining part of the genome
|
|
||||||
let "posCut=$posCut-1"
|
|
||||||
cutseq ${QUERY} 1 ${posCut} >> ${tmpfasta1}
|
|
||||||
|
|
||||||
# merges both the parts
|
|
||||||
joinfasta ${tmpfasta1} > ${tmpfasta2}
|
|
||||||
rm -f ${tmpfasta1}
|
|
||||||
QUERY=${tmpfasta2}
|
|
||||||
|
|
||||||
loginfo "Recomputing location of the IR..."
|
|
||||||
declare -a IR=( $(lookForIR ${QUERY}) )
|
|
||||||
loginfo "Done"
|
|
||||||
|
|
||||||
posIR1="${IR[4]}"
|
|
||||||
posIR2="${IR[6]}"
|
|
||||||
|
|
||||||
let "lenIR=(${IR[5]} + ${IR[7]}) / 2 "
|
|
||||||
|
|
||||||
let "endIR2=$posIR2 + $lenIR - 1"
|
let "endIR2=$posIR2 + $lenIR - 1"
|
||||||
let "endIR1=$posIR1 + $lenIR - 1"
|
let "endIR1=$posIR1 + $lenIR - 1"
|
||||||
|
|
||||||
fi
|
if (( "$endIR2" >= "$genome_length" )) ; then
|
||||||
|
loginfo "IRB is at the end of the original sequence"
|
||||||
|
|
||||||
|
#
|
||||||
|
# We just move the IRB at the begining of the sequence
|
||||||
|
#
|
||||||
|
|
||||||
|
# Extract the IRB sequence
|
||||||
|
let "posCut=($endIR1+$posIR2)/2"
|
||||||
|
cutseq ${QUERY} ${posCut} ${genome_length} > ${tmpfasta1}
|
||||||
|
|
||||||
tmpIR1="tmp_$$_IR1.fasta"
|
# Append the remaining part of the genome
|
||||||
tmpIR2="tmp_$$_IR2.fasta"
|
let "posCut=$posCut-1"
|
||||||
|
cutseq ${QUERY} 1 ${posCut} >> ${tmpfasta1}
|
||||||
|
|
||||||
|
# merges both the parts
|
||||||
|
joinfasta ${tmpfasta1} > ${tmpfasta2}
|
||||||
|
rm -f ${tmpfasta1}
|
||||||
|
QUERY=${tmpfasta2}
|
||||||
|
|
||||||
#enregistre les deux fragments IRa et IRb complet
|
loginfo "Recomputing location of the IR..."
|
||||||
cutseq ${QUERY} ${posIR1} ${endIR1} > ${tmpIR1}
|
declare -a IR=( $(lookForIR ${QUERY}) )
|
||||||
cutseq ${QUERY} ${posIR2} ${endIR2} > ${tmpIR2}
|
loginfo "Done"
|
||||||
|
|
||||||
let "lenSC1=$posIR1 -1 + ($genome_length - endIR2)"
|
posIR1="${IR[4]}"
|
||||||
let "lenSC2=$posIR2 - $endIR1"
|
posIR2="${IR[6]}"
|
||||||
|
|
||||||
center="${IR[0]}"
|
let "lenIR=(${IR[5]} + ${IR[7]}) / 2 "
|
||||||
|
|
||||||
tmpLSC="tmp_$$_LSC.fasta"
|
let "endIR2=$posIR2 + $lenIR - 1"
|
||||||
tmpSSC="tmp_$$_SSC.fasta"
|
let "endIR1=$posIR1 + $lenIR - 1"
|
||||||
|
|
||||||
# Extract the central SC present in between the two IRs
|
fi
|
||||||
# considering it as LSC
|
|
||||||
|
|
||||||
let "beginLSC=$endIR1+1"
|
|
||||||
let "endLSC=$posIR2-1"
|
|
||||||
cutseq ${QUERY} ${beginLSC} ${endLSC} > ${tmpLSC}
|
|
||||||
|
|
||||||
strandLSC="${IR[1]}"
|
|
||||||
|
|
||||||
|
|
||||||
# Extract the external SC present in two parts
|
|
||||||
# Considering it as SSC
|
|
||||||
|
|
||||||
let "beginSSC=$endIR2+1"
|
|
||||||
cutseq ${QUERY} ${beginSSC} ${genome_length} > ${tmpSSC}
|
|
||||||
|
|
||||||
let "endSSC=$posIR1-1"
|
|
||||||
cutseq ${QUERY} 1 ${endSSC} >> ${tmpSSC}
|
|
||||||
|
|
||||||
joinfasta ${tmpSSC} > ${tmpfasta1}
|
|
||||||
mv ${tmpfasta1} ${tmpSSC}
|
|
||||||
|
|
||||||
strandSSC="${IR[3]}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "$center" == "SSC" ]]; then
|
|
||||||
|
|
||||||
# Actually this is the oposite LSC is SSC and SSC is LSC
|
|
||||||
|
|
||||||
# Exchanges the SSC and LSC sequences
|
|
||||||
mv ${tmpSSC} ${tmpfasta1}
|
|
||||||
mv ${tmpLSC} ${tmpSSC}
|
|
||||||
mv ${tmpfasta1} ${tmpLSC}
|
|
||||||
|
|
||||||
# Exchanges the IRa and IRb sequences
|
tmpIR1="tmp_$$_IR1.fasta"
|
||||||
mv ${tmpIR1} ${tmpfasta1}
|
tmpIR2="tmp_$$_IR2.fasta"
|
||||||
mv ${tmpIR2} ${tmpIR1}
|
|
||||||
mv ${tmpfasta1} ${tmpIR2}
|
|
||||||
|
|
||||||
# Exchanges the strand of both the Single copies
|
#enregistre les deux fragments IRa et IRb complet
|
||||||
tmp=${strandSSC}
|
cutseq ${QUERY} ${posIR1} ${endIR1} > ${tmpIR1}
|
||||||
strandSSC=${strandLSC}
|
cutseq ${QUERY} ${posIR2} ${endIR2} > ${tmpIR2}
|
||||||
strandLSC=${tmp}
|
|
||||||
|
|
||||||
fi
|
let "lenSC1=$posIR1 -1 + ($genome_length - endIR2)"
|
||||||
|
let "lenSC2=$posIR2 - $endIR1"
|
||||||
|
|
||||||
|
center="${IR[0]}"
|
||||||
|
|
||||||
|
tmpLSC="tmp_$$_LSC.fasta"
|
||||||
|
tmpSSC="tmp_$$_SSC.fasta"
|
||||||
|
|
||||||
|
# Extract the central SC present in between the two IRs
|
||||||
|
# considering it as LSC
|
||||||
|
|
||||||
# Reverse complement the SSC if needed
|
let "beginLSC=$endIR1+1"
|
||||||
if [[ "${strandSSC}" == "-" ]]; then
|
let "endLSC=$posIR2-1"
|
||||||
fastarevcomp -f ${tmpSSC} > ${tmpfasta1}
|
cutseq ${QUERY} ${beginLSC} ${endLSC} > ${tmpLSC}
|
||||||
|
|
||||||
|
strandLSC="${IR[1]}"
|
||||||
|
|
||||||
|
|
||||||
|
# Extract the external SC present in two parts
|
||||||
|
# Considering it as SSC
|
||||||
|
|
||||||
|
let "beginSSC=$endIR2+1"
|
||||||
|
cutseq ${QUERY} ${beginSSC} ${genome_length} > ${tmpSSC}
|
||||||
|
|
||||||
|
let "endSSC=$posIR1-1"
|
||||||
|
cutseq ${QUERY} 1 ${endSSC} >> ${tmpSSC}
|
||||||
|
|
||||||
|
joinfasta ${tmpSSC} > ${tmpfasta1}
|
||||||
mv ${tmpfasta1} ${tmpSSC}
|
mv ${tmpfasta1} ${tmpSSC}
|
||||||
fi
|
|
||||||
|
strandSSC="${IR[3]}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Reverse complement the LSC if needed
|
if [[ "$center" == "SSC" ]]; then
|
||||||
if [[ "${strandLSC}" == "-" ]]; then
|
|
||||||
fastarevcomp -f ${tmpLSC} > ${tmpfasta1}
|
# Actually this is the oposite LSC is SSC and SSC is LSC
|
||||||
mv ${tmpfasta1} ${tmpLSC}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Merges the four parts of the genome.
|
# Exchanges the SSC and LSC sequences
|
||||||
cat ${tmpLSC} ${tmpIR2} ${tmpSSC} ${tmpIR1} | joinfasta
|
mv ${tmpSSC} ${tmpfasta1}
|
||||||
|
mv ${tmpLSC} ${tmpSSC}
|
||||||
|
mv ${tmpfasta1} ${tmpLSC}
|
||||||
|
|
||||||
|
# Exchanges the IRa and IRb sequences
|
||||||
|
mv ${tmpIR1} ${tmpfasta1}
|
||||||
|
mv ${tmpIR2} ${tmpIR1}
|
||||||
|
mv ${tmpfasta1} ${tmpIR2}
|
||||||
|
|
||||||
|
# Exchanges the strand of both the Single copies
|
||||||
|
tmp=${strandSSC}
|
||||||
|
strandSSC=${strandLSC}
|
||||||
|
strandLSC=${tmp}
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reverse complement the SSC if needed
|
||||||
|
if [[ "${strandSSC}" == "-" ]]; then
|
||||||
|
fastarevcomp -f ${tmpSSC} > ${tmpfasta1}
|
||||||
|
mv ${tmpfasta1} ${tmpSSC}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reverse complement the LSC if needed
|
||||||
|
if [[ "${strandLSC}" == "-" ]]; then
|
||||||
|
fastarevcomp -f ${tmpLSC} > ${tmpfasta1}
|
||||||
|
mv ${tmpfasta1} ${tmpLSC}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Merges the four parts of the genome.
|
||||||
|
cat ${tmpLSC} ${tmpIR2} ${tmpSSC} ${tmpIR1} | joinfasta
|
||||||
|
|
||||||
|
else
|
||||||
|
# No IR detected --> normalization has no effect
|
||||||
|
cat ${QUERY}
|
||||||
|
fi
|
||||||
popTmpDir
|
popTmpDir
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -38,9 +38,16 @@ function lookForIR {
|
|||||||
|
|
||||||
loginfo "Looking for long inverted repeats..."
|
loginfo "Looking for long inverted repeats..."
|
||||||
repseek -c -p 0.001 -i ${QUERY} 2>> /dev/null > ${REPEATS}
|
repseek -c -p 0.001 -i ${QUERY} 2>> /dev/null > ${REPEATS}
|
||||||
loginfo " --> $(wc -l ${REPEATS} | awk '{print $1}') repeats identified"
|
nrepeat="$(wc -l ${REPEATS} | awk '{print $1}')"
|
||||||
loginfo "Done"
|
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..."
|
loginfo "Marking and selecting the best inverted repeat..."
|
||||||
local IR=( $(${SELECTIR} ${MATCHES} ${REPEATS}) )
|
local IR=( $(${SELECTIR} ${MATCHES} ${REPEATS}) )
|
||||||
loginfo "Done"
|
loginfo "Done"
|
||||||
|
Reference in New Issue
Block a user