# HG changeset patch # User drosofff # Date 1435572371 14400 # Node ID 22641bb68b916bc88bcefaaf5bc1362b339f18eb # Parent fa936e163bbd0d229880a82b28d7553a6a87ac27 planemo upload for repository https://bitbucket.org/drosofff/gedtools/ diff -r fa936e163bbd -r 22641bb68b91 BlastParser_and_hits.py --- a/BlastParser_and_hits.py Fri Jun 19 13:17:32 2015 -0400 +++ b/BlastParser_and_hits.py Mon Jun 29 06:06:11 2015 -0400 @@ -14,6 +14,9 @@ the_parser.add_argument('--tabularOutput', action="store", type=str, help="tabular output file of blast analysis") the_parser.add_argument('--flanking', action="store", type=int, help="number of flanking nucleotides added to the hit sequences") the_parser.add_argument('--mode', action="store", choices=["verbose", "short"], type=str, help="reporting (verbose) or not reporting (short) oases contigs") + the_parser.add_argument('--filter_relativeCov', action="store", type=float, default=0, help="filter out relative coverages below the specified ratio (float number)") + the_parser.add_argument('--filter_maxScore', action="store", type=float, default=0, help="filter out maximum BitScore below the specified float number") + the_parser.add_argument('--filter_meanScore', action="store", type=float, default=0, help="filter out maximum BitScore below the specified float number") args = the_parser.parse_args() if not all ( (args.sequences, args.blast, args.fastaOutput, args.tabularOutput) ): the_parser.error('argument(s) missing, call the -h option of the script') @@ -122,12 +125,14 @@ leftCoordinate = 1 return getseq (fastadict, FastaHeader, leftCoordinate, rightCoordinate, polarity) -def outputParsing (F, Fasta, results, Xblastdict, fastadict, mode="verbose"): +def outputParsing (F, Fasta, results, Xblastdict, fastadict, filter_relativeCov=0, filter_maxScore=0, filter_meanScore=0, mode="verbose"): F= open(F, "w") Fasta=open(Fasta, "w") if mode == "verbose": print >>F, "# SeqId\t%Identity\tAlignLength\tStartSubject\tEndSubject\t%QueryHitCov\tE-value\tBitScore\n" for subject in sorted (results, key=lambda x: results[x]["meanBitScores"], reverse=True): + if results[subject]["RelativeSubjectCoverage"]> F, "#\n# %s" % subject print >> F, "# Suject Length: %s" % (results[subject]["subjectLength"]) print >> F, "# Total Subject Coverage: %s" % (results[subject]["TotalCoverage"]) @@ -149,6 +154,8 @@ else: print >>F, "# subject\tsubject length\tTotal Subject Coverage\tRelative Subject Coverage\tMaximum Bit Score\tMean Bit Score" for subject in sorted (results, key=lambda x: results[x]["meanBitScores"], reverse=True): + if results[subject]["RelativeSubjectCoverage"] + for virus discovery @@ -9,6 +9,13 @@ --fastaOutput $fastaOutput --flanking $flanking --mode $mode + ## Additional parameters. + #if $additional_filters.use_filters == "yes": + --filter_relativeCov $additional_filters.filter_relativeCov + --filter_maxScore $additional_filters.filter_maxScore + --filter_meanScore $additional_filters.filter_meanScore + #end if + @@ -18,6 +25,19 @@ + + + + + + + + + + + + +