Add management of partial sequences
Former-commit-id: abd6112ac558592616c197f2fe761880a847b031 Former-commit-id: d2ea2e7e306512bf8ef92d3497a0302919b81010
This commit is contained in:
@ -24,6 +24,7 @@ normalization="yes"
|
|||||||
irdetection="yes"
|
irdetection="yes"
|
||||||
organism="no"
|
organism="no"
|
||||||
types="chloro"
|
types="chloro"
|
||||||
|
partial=0
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
echo "Usage:" ;
|
echo "Usage:" ;
|
||||||
@ -52,12 +53,21 @@ function usage {
|
|||||||
echo
|
echo
|
||||||
echo ' -m | --mitochondrion'
|
echo ' -m | --mitochondrion'
|
||||||
echo ' Selects for the annotation of an animal mitochondrion genome'
|
echo ' Selects for the annotation of an animal mitochondrion genome'
|
||||||
|
echo
|
||||||
|
echo ' -p | --partial'
|
||||||
|
echo ' Indicates that the genome sequence is partial and therefore in several contigs'
|
||||||
exit $2
|
exit $2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function fastaIterator() {
|
||||||
|
awk '/^>/ {if (seq) printf("%s\f",seq); seq=""} \
|
||||||
|
{if (seq) seq=seq"\n"; seq=seq $1} \
|
||||||
|
END {print seq}' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
# options may be followed by one colon to indicate they have a required argument
|
# options may be followed by one colon to indicate they have a required argument
|
||||||
if ! options=$(getopt -o t:o:icrmh -l ncbi-taxid:,organism,no-ir-detection,chloroplast,nuclear-rdna,mitochondrion,help -- "$@")
|
if ! options=$(getopt -o t:o:icrmhp -l ncbi-taxid:,organism,no-ir-detection,chloroplast,nuclear-rdna,mitochondrion,partial,help -- "$@")
|
||||||
then
|
then
|
||||||
# something went wrong, getopt will put out an error message for us
|
# something went wrong, getopt will put out an error message for us
|
||||||
usage $0 1
|
usage $0 1
|
||||||
@ -74,6 +84,7 @@ do
|
|||||||
-c|--chloroplast) types="chloro" ;;
|
-c|--chloroplast) types="chloro" ;;
|
||||||
-r|--nuclear-rdna) types="nucrdna" ;;
|
-r|--nuclear-rdna) types="nucrdna" ;;
|
||||||
-m|--mitochondrion) types="mito" ;;
|
-m|--mitochondrion) types="mito" ;;
|
||||||
|
-p|--partial) partial="1" ;;
|
||||||
-h|--help) usage $0 0;;
|
-h|--help) usage $0 0;;
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
||||||
@ -101,22 +112,34 @@ pushTmpDir ORG.organnot
|
|||||||
rm -f ${LOG}
|
rm -f ${LOG}
|
||||||
openLogFile ${LOG}
|
openLogFile ${LOG}
|
||||||
|
|
||||||
|
IFS=$'\f'
|
||||||
|
|
||||||
|
for sequence in $(fastaIterator "${QUERY}") ; do
|
||||||
|
unset IFS
|
||||||
|
if [[ ! -z "${sequence}" ]] ; then
|
||||||
|
echo "${sequence}" > toannotate.fasta
|
||||||
|
|
||||||
|
seqid=$(awk '(NR==1) {print substr($1,2,1000)}' toannotate.fasta)
|
||||||
|
|
||||||
case "$types" in
|
case "$types" in
|
||||||
chloro)
|
chloro)
|
||||||
loginfo "Annotating a plant chloroplast genome..."
|
loginfo "Annotating a plant chloroplast genome..."
|
||||||
|
|
||||||
if [ "$irdetection"=="yes" ]; then
|
if [[ "$irdetection"=="yes" ]] && (( partial == 0 )) ; then
|
||||||
|
|
||||||
loginfo "Normalizing the structure of the Chloroplast sequence..."
|
loginfo "Normalizing the structure of the Chloroplast sequence..."
|
||||||
loginfo " LSC + IRB + SSC + IRA"
|
loginfo " LSC + IRB + SSC + IRA"
|
||||||
${PROG_DIR}/detectors/normalize/bin/go_normalize.sh ${QUERY} > "${RESULTS}.norm.fasta"
|
${PROG_DIR}/detectors/normalize/bin/go_normalize.sh toannotate.fasta > "${RESULTS}.norm.fasta"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
loginfo "Annotating the Inverted repeats and Single copies (LSC and SSC)..."
|
loginfo "Annotating the Inverted repeats and Single copies (LSC and SSC)..."
|
||||||
${PROG_DIR}/detectors/ir/bin/go_ir.sh "${RESULTS}.norm.fasta" > "${RESULTS}.annot"
|
${PROG_DIR}/detectors/ir/bin/go_ir.sh "${RESULTS}.norm.fasta" > "${RESULTS}.annot"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
|
else
|
||||||
|
cat toannotate.fasta > "${RESULTS}.norm.fasta"
|
||||||
|
rm -f "${RESULTS}.annot"
|
||||||
|
touch "${RESULTS}.annot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
loginfo "Annotating the tRNA..."
|
loginfo "Annotating the tRNA..."
|
||||||
@ -131,14 +154,20 @@ pushTmpDir ORG.organnot
|
|||||||
tcsh -f ${PROG_DIR}/detectors/cds/bin/go_cds.sh "${RESULTS}.norm.fasta" >> "${RESULTS}.annot"
|
tcsh -f ${PROG_DIR}/detectors/cds/bin/go_cds.sh "${RESULTS}.norm.fasta" >> "${RESULTS}.annot"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
|
if (( partial == 0 )) ; then
|
||||||
topology="circular"
|
topology="circular"
|
||||||
defline="plastid, complete genome"
|
defline="plastid, complete genome"
|
||||||
|
else
|
||||||
|
topology="linear"
|
||||||
|
defline="plastid, partial sequence"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
nucrdna)
|
nucrdna)
|
||||||
loginfo "Annotating a plant rDNA cistron..."
|
loginfo "Annotating a plant rDNA cistron..."
|
||||||
|
|
||||||
loginfo "Normalizing the structure of the cistron sequence..."
|
loginfo "Normalizing the structure of the cistron sequence..."
|
||||||
${PROG_DIR}/detectors/normalizerdna/bin/go_normalizerdna.sh ${QUERY} > "${RESULTS}.norm.fasta"
|
${PROG_DIR}/detectors/normalizerdna/bin/go_normalizerdna.sh toannotate.fasta > "${RESULTS}.norm.fasta"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
loginfo "Annotating the rRNA genes..."
|
loginfo "Annotating the rRNA genes..."
|
||||||
@ -148,15 +177,22 @@ pushTmpDir ORG.organnot
|
|||||||
topology="linear"
|
topology="linear"
|
||||||
defline="18S rRNA gene, ITS1, 5.8S rRNA gene, ITS2 and 28S rRNA gene"
|
defline="18S rRNA gene, ITS1, 5.8S rRNA gene, ITS2 and 28S rRNA gene"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
mito)
|
mito)
|
||||||
loginfo "Annotating an animal mitochondrial genome..."
|
loginfo "Annotating an animal mitochondrial genome..."
|
||||||
logerror "Not yet implemented"
|
logerror "Not yet implemented"
|
||||||
|
|
||||||
|
if (( partial == 0 )) ; then
|
||||||
topology="circular"
|
topology="circular"
|
||||||
defline="mitochondrion, complete genome"
|
defline="mitochondrion, complete genome"
|
||||||
|
else
|
||||||
|
topology="linear"
|
||||||
|
defline="mitochondrion, partial sequence"
|
||||||
|
fi
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
usage $0 1;;
|
usage $0 1;;
|
||||||
esac
|
esac
|
||||||
@ -167,10 +203,12 @@ pushTmpDir ORG.organnot
|
|||||||
organism="$(echo ${organism} | tr '_' ' ')"
|
organism="$(echo ${organism} | tr '_' ' ')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sl=$(seqlength "${RESULTS}.norm.fasta")
|
||||||
|
|
||||||
loginfo "Printing minimal header..."
|
loginfo "Printing minimal header..."
|
||||||
echo "ID XXX; XXX; ${topology}; genomic DNA; XXX; XXX; $(seqlength ${RESULTS}.norm.fasta) BP."
|
echo "ID ${seqid}; ${seqid}; ${topology}; genomic DNA; XXX; XXX; ${sl} BP."
|
||||||
echo "XX"
|
echo "XX"
|
||||||
echo "AC XXX;"
|
echo "AC ${seqid};"
|
||||||
echo "DE ${organism} ${defline}."
|
echo "DE ${organism} ${defline}."
|
||||||
echo "XX"
|
echo "XX"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
@ -179,8 +217,36 @@ pushTmpDir ORG.organnot
|
|||||||
echo "FH Key Location/Qualifiers"
|
echo "FH Key Location/Qualifiers"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
|
loginfo "Printing the source feature"
|
||||||
|
echo "FT source 1..${sl}" >> "${RESULTS}.annot"
|
||||||
|
|
||||||
|
if [[ "${organism}" != "{organism}" ]] ; then
|
||||||
|
echo "FT /organism=\"${organism}\"" >> "${RESULTS}.annot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${types}" in
|
||||||
|
chloro)
|
||||||
|
echo "FT /organelle=\"plastid:chloroplast\"" >> "${RESULTS}.annot"
|
||||||
|
;;
|
||||||
|
mito)
|
||||||
|
echo "FT /organelle=\"mitochondrion\"" >> "${RESULTS}.annot"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
loginfo "Nuclear sequence"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "FT /mol_type=\"genomic DNA\"" >> "${RESULTS}.annot"
|
||||||
|
|
||||||
|
if [[ "${taxid}" != "no" ]] ; then
|
||||||
|
echo "FT /db_xref=\"taxon:${taxid}\"" >> "${RESULTS}.annot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# echo "FT /country=\"Poland: Bialowieza Forest\"" >> "${RESULTS}.annot"
|
||||||
|
loginfo "Done."
|
||||||
|
|
||||||
loginfo "Ordering annotations..."
|
loginfo "Ordering annotations..."
|
||||||
awk '/^.....(misc|repeat|rRNA|tRNA|gene)/ { \
|
awk '/^.....(misc|repeat|rRNA|tRNA|gene|source)/ { \
|
||||||
match($3,"[0-9][0-9]*"); \
|
match($3,"[0-9][0-9]*"); \
|
||||||
pos=substr($3,RSTART,RLENGTH)*1000 + 1; \
|
pos=substr($3,RSTART,RLENGTH)*1000 + 1; \
|
||||||
print pos,$0; \
|
print pos,$0; \
|
||||||
@ -194,6 +260,8 @@ pushTmpDir ORG.organnot
|
|||||||
print line}'
|
print line}'
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loginfo "Closing annotations table..."
|
loginfo "Closing annotations table..."
|
||||||
echo "XX"
|
echo "XX"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
@ -246,6 +314,9 @@ pushTmpDir ORG.organnot
|
|||||||
loginfo "Closing sequence part..."
|
loginfo "Closing sequence part..."
|
||||||
echo "//"
|
echo "//"
|
||||||
loginfo "Done."
|
loginfo "Done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$'\f'
|
||||||
|
done # End of the loop over the sequences
|
||||||
popTmpDir
|
popTmpDir
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user