Repository 'msp_blastparser_and_hits'
hg clone https://toolshed.g2.bx.psu.edu/repos/drosofff/msp_blastparser_and_hits

Changeset 6:78c34df2dd8d (2016-02-02)
Previous changeset 5:a0dec1a0f2ef (2016-01-15) Next changeset 7:ccffd39695ae (2016-02-03)
Commit message:
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_blastparser_and_hits commit 3048cdbea989bc7d28326bf9479fc3010ff8b33c
modified:
BlastParser_and_hits.py
BlastParser_and_hits.xml
test-data/output.tab
b
diff -r a0dec1a0f2ef -r 78c34df2dd8d BlastParser_and_hits.py
--- a/BlastParser_and_hits.py Fri Jan 15 12:51:19 2016 -0500
+++ b/BlastParser_and_hits.py Tue Feb 02 11:38:51 2016 -0500
[
@@ -21,6 +21,7 @@
     the_parser.add_argument('--filter_term_out', action="store", type=str, default="", help="exclude the specified term from the subject list")
     the_parser.add_argument('--al_sequences', action="store", type=str, help="sequences that have been blast aligned")
     the_parser.add_argument('--un_sequences', action="store", type=str, help="sequences that have not been blast aligned")
+    the_parser.add_argument('--dataset_name', action="store", type=str, default="", help="the name of the dataset that has been parsed, to be reported in the output")
     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')
@@ -129,7 +130,7 @@
         leftCoordinate = 1
     return getseq (fastadict, FastaHeader, leftCoordinate, rightCoordinate, polarity)
     
-def outputParsing (F, Fasta, results, Xblastdict, fastadict, filter_relativeCov=0, filter_maxScore=0, filter_meanScore=0, filter_term_in="", filter_term_out="", mode="verbose"):
+def outputParsing (dataset_name, F, Fasta, results, Xblastdict, fastadict, filter_relativeCov=0, filter_maxScore=0, filter_meanScore=0, filter_term_in="", filter_term_out="", mode="verbose"):
     def filter_results (results, filter_relativeCov=0, filter_maxScore=0, filter_meanScore=0, filter_term_in="", filter_term_out=""):
         for subject in results.keys():
             if results[subject]["RelativeSubjectCoverage"]<filter_relativeCov:
@@ -160,9 +161,10 @@
             blasted_transcripts.append(transcript)
     blasted_transcripts = list( set( blasted_transcripts))
     if mode == "verbose":
-        print >>F, "# SeqId\t%Identity\tAlignLength\tStartSubject\tEndSubject\t%QueryHitCov\tE-value\tBitScore\n"
+        print >>F, "--- %s ---" % (dataset_name)
+        print >>F, "# SeqId\t%Identity\tAlignLength\tStartSubject\tEndSubject\t%QueryHitCov\tE-value\tBitScore"
         for subject in sorted (results, key=lambda x: results[x]["meanBitScores"], reverse=True):
-            print >> F, "#\n# %s" % subject
+            print >> F, " \n# %s" % subject
             print >> F, "# Suject Length: %s" % (results[subject]["subjectLength"])
             print >> F, "# Total Subject Coverage: %s" % (results[subject]["TotalCoverage"])
             print >> F, "# Relative Subject Coverage: %s" % (results[subject]["RelativeSubjectCoverage"])
@@ -181,6 +183,7 @@
                     info = "\t".join(info)
                     print >> F, info
     else:
+        print >>F, "--- %s ---" % (dataset_name)
         print >>F, "# subject\tsubject length\tTotal Subject Coverage\tRelative Subject Coverage\tBest Bit Score\tMean Bit Score"
         for subject in sorted (results, key=lambda x: results[x]["meanBitScores"], reverse=True):
             line = []
@@ -219,7 +222,7 @@
     results = defaultdict(dict)
     for subject in Xblastdict:
         results[subject]["HitDic"], results[subject]["subjectLength"], results[subject]["TotalCoverage"], results[subject]["RelativeSubjectCoverage"], results[subject]["maxBitScores"], results[subject]["meanBitScores"]  = subjectCoverage(fastadict, Xblastdict, subject, args.flanking)
-    blasted_transcripts = outputParsing (args.tabularOutput, args.fastaOutput, results, Xblastdict, fastadict,
+    blasted_transcripts = outputParsing (args.dataset_name, args.tabularOutput, args.fastaOutput, results, Xblastdict, fastadict,
                                         filter_relativeCov=args.filter_relativeCov, filter_maxScore=args.filter_maxScore,
                                         filter_meanScore=args.filter_meanScore, filter_term_in=args.filter_term_in,
                                         filter_term_out=args.filter_term_out, mode=args.mode)
b
diff -r a0dec1a0f2ef -r 78c34df2dd8d BlastParser_and_hits.xml
--- a/BlastParser_and_hits.xml Fri Jan 15 12:51:19 2016 -0500
+++ b/BlastParser_and_hits.xml Tue Feb 02 11:38:51 2016 -0500
b
@@ -1,4 +1,4 @@
-<tool id="BlastParser_and_hits" name="Parse blast output and compile hits" version="2.3.3">
+<tool id="BlastParser_and_hits" name="Parse blast output and compile hits" version="2.4.0">
 <description>for virus discovery</description>
 <requirements></requirements>
 <command interpreter="python">
@@ -19,6 +19,7 @@
     #end if
     --al_sequences $al_sequences
     --un_sequences $un_sequences
+    --dataset_name $blast.name
 
 </command>
 <inputs>
b
diff -r a0dec1a0f2ef -r 78c34df2dd8d test-data/output.tab
--- a/test-data/output.tab Fri Jan 15 12:51:19 2016 -0500
+++ b/test-data/output.tab Tue Feb 02 11:38:51 2016 -0500
b
b'@@ -1,6 +1,6 @@\n+--- blast.tab ---\n # SeqId\t%Identity\tAlignLength\tStartSubject\tEndSubject\t%QueryHitCov\tE-value\tBitScore\n-\n-#\n+ \n # gi|262225307|gb|GQ342964.1|_Drosophila_melanogaster_tetravirus_SW-2009a_strain_DTRV_putative_RNA-de\n # Suject Length: 3005\n # Total Subject Coverage: 3001\n@@ -9,7 +9,7 @@\n # Mean Bit Score: 3241.5\n Locus_42_Transcript_2/2_Confidence_0.333_Length_597\t100.0\t593\t2409\t3001\t99.2\t0.0\t1070.0\n Locus_42_Transcript_1/2_Confidence_0.333_Length_3138\t100.0\t3001\t1\t3001\t95.6\t0.0\t5413.0\n-#\n+ \n # gi|268053723|ref|NC_013499.1|_Drosophila_melanogaster_totivirus_SW-2009a,_complete_genome\n # Suject Length: 6780\n # Total Subject Coverage: 6765\n@@ -38,7 +38,7 @@\n Locus_10_Transcript_2/8_Confidence_0.111_Length_1023\t99.9\t1023\t6163\t5141\t99.9\t0.0\t1840.0\n Locus_7_Transcript_2/11_Confidence_0.077_Length_1069\t99.06\t1069\t679\t1741\t99.9\t0.0\t1884.0\n Locus_7_Transcript_3/11_Confidence_0.154_Length_1743\t99.89\t1742\t1716\t3457\t99.9\t0.0\t3133.0\n-#\n+ \n # gi|262225299|gb|GQ342961.1|_Drosophila_melanogaster_totivirus_SW-2009a_strain_DTV,_complete_genome\n # Suject Length: 6780\n # Total Subject Coverage: 6765\n@@ -67,7 +67,7 @@\n Locus_10_Transcript_2/8_Confidence_0.111_Length_1023\t99.9\t1023\t6163\t5141\t99.9\t0.0\t1840.0\n Locus_7_Transcript_2/11_Confidence_0.077_Length_1069\t99.06\t1069\t679\t1741\t99.9\t0.0\t1884.0\n Locus_7_Transcript_3/11_Confidence_0.154_Length_1743\t99.89\t1742\t1716\t3457\t99.9\t0.0\t3133.0\n-#\n+ \n # gi|253761971|ref|NC_012958.1|_Drosophila_A_virus,_complete_genome\n # Suject Length: 4806\n # Total Subject Coverage: 4708\n@@ -79,7 +79,7 @@\n Locus_40_Transcript_1/1_Confidence_0.000_Length_1029\t97.47\t1028\t3779\t4806\t99.8\t0.0\t1737.0\n Locus_20_Transcript_1/1_Confidence_0.000_Length_191\t97.86\t187\t43\t229\t97.4\t7e-86\t320.0\n Locus_42_Transcript_1/2_Confidence_0.333_Length_3138\t97.61\t3136\t219\t3354\t99.9\t0.0\t5317.0\n-#\n+ \n # gi|225356593|gb|FJ150422.1|_Drosophila_A_virus_isolate_HD,_complete_genome\n # Suject Length: 4806\n # Total Subject Coverage: 4708\n@@ -91,7 +91,7 @@\n Locus_40_Transcript_1/1_Confidence_0.000_Length_1029\t97.47\t1028\t3779\t4806\t99.8\t0.0\t1737.0\n Locus_20_Transcript_1/1_Confidence_0.000_Length_191\t97.86\t187\t43\t229\t97.4\t7e-86\t320.0\n Locus_42_Transcript_1/2_Confidence_0.333_Length_3138\t97.61\t3136\t219\t3354\t99.9\t0.0\t5317.0\n-#\n+ \n # gi|262225305|gb|GQ342963.1|_Drosophila_melanogaster_birnavirus_SW-2009a_strain_DBV_segment_B,_compl\n # Suject Length: 3014\n # Total Subject Coverage: 3004\n@@ -102,7 +102,7 @@\n Locus_12_Transcript_1/1_Confidence_0.000_Length_1279\t100.0\t1273\t3014\t1742\t99.5\t0.0\t2296.0\n Locus_3_Transcript_5/5_Confidence_0.250_Length_1016\t100.0\t825\t825\t1\t81.1\t0.0\t1489.0\n Locus_3_Transcript_4/5_Confidence_0.250_Length_926\t100.0\t825\t825\t1\t89.0\t0.0\t1489.0\n-#\n+ \n # gi|262225302|gb|GQ342962.1|_Drosophila_melanogaster_birnavirus_SW-2009a_strain_DBV_segment_A,_compl\n # Suject Length: 3260\n # Total Subject Coverage: 3150\n@@ -115,7 +115,7 @@\n Locus_9_Transcript_3/3_Confidence_0.000_Length_1571\t99.43\t1572\t1617\t3186\t99.9\t0.0\t2789.0\n Locus_9_Transcript_1/3_Confidence_0.667_Length_681\t100.0\t681\t972\t1652\t99.9\t0.0\t1229.0\n Locus_16_Transcript_1/1_Confidence_0.000_Length_152\t100.0\t152\t458\t609\t99.3\t2e-72\t275.0\n-#\n+ \n # gi|18254451|gb|AF196645.2|_Drosophila_x_virus_segment_B_putative_RNA-dependent_RNA_polymerase_VP1_(\n # Suject Length: 3243\n # Total Subject Coverage: 3016\n@@ -127,7 +127,7 @@\n Locus_45_Transcript_1/1_Confidence_0.000_Length_631\t98.73\t631\t57\t687\t99.8\t0.0\t1103.0\n Locus_17_Transcript_2/3_Confidence_0.400_Length_2274\t99.03\t414\t1694\t2107\t18.2\t0.0\t729.0\n Locus_47_Transcript_1/1_Confidence_0.000_Length_940\t99.26\t940\t674\t1613\t99.9\t0.0\t1663.0\n-#\n+ \n # gi|22855185|ref|NC_004169.1|_Drosophila_x_virus_segment_B,_complete_sequence\n # Suject Length: 3243\n # Total Subject Coverage: 3016\n@@ -139,7 +139,7 @@\n Locus_45_Transcript_1/1_Confidence_0.000_Length_631\t98.73\t631\t57\t687\t99.8\t0.0\t1103.0\n Locus_17_Transcript_2/3_Confidence_0.400_Length_2274\t99.03\t414\t1694\t2107\t18.2\t0.0\t729.0\n Locus_47_Transcript_1/1_Confidence_0.000_Length_940\t99.26\t940\t674\t1613\t99.9\t0.0\t1'..b'\t328\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|350543519|gb|JF907703.1|_Infectious_bursal_disease_virus_isolate_2009CAH495-SESW_polyprotein_gen\n # Suject Length: 3193\n # Total Subject Coverage: 82\n@@ -1712,7 +1712,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t539\t458\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|157886466|emb|AM111353.1|_Infectious_bursal_disease_virus_segment_A,_complete_sequence,_genomic_\n # Suject Length: 3262\n # Total Subject Coverage: 82\n@@ -1720,7 +1720,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t538\t457\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|667756318|gb|KF569805.1|_Infectious_bursal_disease_virus_isolate_HuB-1_segment_A,_complete_seque\n # Suject Length: 3260\n # Total Subject Coverage: 82\n@@ -1728,7 +1728,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t538\t457\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|89112096|gb|AY444873.3|_Infectious_bursal_disease_virus_VP5_protein_and_structural_polyprotein_g\n # Suject Length: 3260\n # Total Subject Coverage: 82\n@@ -1736,7 +1736,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t538\t457\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|395863892|gb|JN982256.1|_Infectious_bursal_disease_virus_isolate_SP33_VP2_protein_gene,_complete\n # Suject Length: 1356\n # Total Subject Coverage: 82\n@@ -1744,7 +1744,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t408\t327\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|630375502|gb|KJ547673.1|_Infectious_bursal_disease_virus_isolate_VRDC-IBDV-WZ_polyprotein_mRNA,_\n # Suject Length: 3084\n # Total Subject Coverage: 82\n@@ -1752,7 +1752,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t446\t365\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|452029935|gb|KC189836.1|_Infectious_bursal_disease_virus_strain_3529/92_polyprotein_mRNA,_comple\n # Suject Length: 3039\n # Total Subject Coverage: 82\n@@ -1760,7 +1760,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t408\t327\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|630375496|gb|KJ547670.1|_Infectious_bursal_disease_virus_isolate_Ventri-IBDV-Plus_polyprotein_mR\n # Suject Length: 3040\n # Total Subject Coverage: 82\n@@ -1768,7 +1768,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t409\t328\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|395863906|gb|JN982263.1|_Infectious_bursal_disease_virus_isolate_SC6_VP2_protein_gene,_complete_\n # Suject Length: 1356\n # Total Subject Coverage: 82\n@@ -1776,7 +1776,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t408\t327\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|395863910|gb|JN982265.1|_Infectious_bursal_disease_virus_isolate_SP21_VP2_protein_gene,_complete\n # Suject Length: 1356\n # Total Subject Coverage: 82\n@@ -1784,7 +1784,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t408\t327\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|367057603|gb|JN585293.1|_Infectious_bursal_disease_virus_isolate_CAHFS_K669_segment_A,_complete_\n # Suject Length: 3184\n # Total Subject Coverage: 82\n@@ -1792,7 +1792,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t532\t451\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|395863918|gb|JN982269.1|_Infectious_bursal_disease_virus_isolate_SC12_VP2_protein_gene,_complete\n # Suject Length: 1356\n # Total Subject Coverage: 82\n@@ -1800,7 +1800,7 @@\n # Best Bit Score: 50.0\n # Mean Bit Score: 50.0\n Locus_69_Transcript_1/1_Confidence_0.000_Length_164\t73.17\t82\t408\t327\t49.4\t2e-04\t50.0\n-#\n+ \n # gi|24306007|gb|AF322444.1|_Infectious_bursal_disease_virus_segment_A_VP5_protein_and_polyprotein_ge\n # Suject Length: 3085\n # Total Subject Coverage: 82\n'