add a -l option to set a minimum length on the contig to annotate
Former-commit-id: a16feefc3a4d02c1b053e8ece340a65e966b58af Former-commit-id: 072e73cbf437c0308f287ac1b558bad269e85f94
This commit is contained in:
@ -25,6 +25,7 @@ irdetection="yes"
|
||||
organism="no"
|
||||
types="chloro"
|
||||
partial=0
|
||||
minlength=0
|
||||
|
||||
function usage {
|
||||
echo "Usage:" ;
|
||||
@ -56,6 +57,9 @@ function usage {
|
||||
echo
|
||||
echo ' -p | --partial'
|
||||
echo ' Indicates that the genome sequence is partial and therefore in several contigs'
|
||||
echo
|
||||
echo ' -l | --min-length'
|
||||
echo ' Indicates for partial mode the minimum length of contig to annotate'
|
||||
exit $2
|
||||
}
|
||||
|
||||
@ -67,7 +71,7 @@ function fastaIterator() {
|
||||
}
|
||||
|
||||
# options may be followed by one colon to indicate they have a required argument
|
||||
if ! options=$(getopt -o t:o:icrmhp -l ncbi-taxid:,organism,no-ir-detection,chloroplast,nuclear-rdna,mitochondrion,partial,help -- "$@")
|
||||
if ! options=$(getopt -o t:o:icrmhpl: -l ncbi-taxid:,organism,no-ir-detection,chloroplast,nuclear-rdna,mitochondrion,partial,min-length:,help -- "$@")
|
||||
then
|
||||
# something went wrong, getopt will put out an error message for us
|
||||
usage $0 1
|
||||
@ -85,6 +89,7 @@ do
|
||||
-r|--nuclear-rdna) types="nucrdna" ;;
|
||||
-m|--mitochondrion) types="mito" ;;
|
||||
-p|--partial) partial="1" ;;
|
||||
-l|--min-length) minlength="$2" ; shift ;;
|
||||
-h|--help) usage $0 0;;
|
||||
(--) shift; break;;
|
||||
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
|
||||
@ -97,6 +102,7 @@ loginfo "Annotating mode.....: $types"
|
||||
loginfo "IR detection mode...: $irdetection"
|
||||
loginfo "Organism............: $organism"
|
||||
loginfo "Partial mode........: $partial"
|
||||
loginfo "Minimum length......: $minlength"
|
||||
|
||||
|
||||
#############################
|
||||
@ -124,6 +130,9 @@ pushTmpDir ORG.organnot
|
||||
unset IFS
|
||||
if [[ ! -z "${sequence}" ]] ; then
|
||||
echo "${sequence}" > toannotate.fasta
|
||||
sl=$(seqlength "toannotate.fasta")
|
||||
|
||||
if (( sl >= minlength )) ; then
|
||||
|
||||
seqid=$($AwkCmd '(NR==1) {print substr($1,2,1000)}' toannotate.fasta)
|
||||
|
||||
@ -326,7 +335,8 @@ pushTmpDir ORG.organnot
|
||||
loginfo "Closing sequence part..."
|
||||
echo "//"
|
||||
loginfo "Done."
|
||||
fi
|
||||
fi # End of the minimum length condition
|
||||
fi # End of not empty sequence condition
|
||||
|
||||
IFS=$'\f'
|
||||
done # End of the loop over the sequences
|
||||
|
Reference in New Issue
Block a user