diff spades.xml @ 6:65c2d63fcbe6 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 6704655441902c44ee5c782578fe4c487cff6340
author iuc
date Sat, 13 May 2017 15:51:58 -0400
parents 909c315b656d
children 9006e5836729
line wrap: on
line diff
--- a/spades.xml	Wed Mar 01 15:33:26 2017 -0500
+++ b/spades.xml	Sat May 13 15:51:58 2017 -0400
@@ -70,6 +70,8 @@
             --untrusted-contigs $contig.extension:$contig
         #end if
     #end for
+    && cat contigs.fasta | python '$write_tsv_script' > '$out_contig_stats'
+    && cat scaffolds.fasta | python '$write_tsv_script' > '$out_scaffold_stats'
     ]]>
     </command>
     <inputs>
@@ -141,7 +143,31 @@
         <param optional="true" format="fasta,fastq" label="Trusted contigs" multiple="true" name="trusted_contigs" type="data" />
         <param optional="true" format="fasta,fastq" label="Untrusted contigs" multiple="true" name="untrusted_contigs" type="data" />
     </inputs>
+    <configfiles>
+        <configfile name="write_tsv_script"><![CDATA[#!/usr/bin/env python
+import sys,re
+search_str = r'^>(NODE|\S+)_(\d+)(?:_|\s)length_(\d+)_cov_(\d+\.*\d*).*\$'
+replace_str = r'\1_\2\t\3\t\4'
+cmd = re.compile(search_str)
+sys.stdout.write('#name\tlength\tcoverage\n')
+for i,line in enumerate(sys.stdin):
+    if cmd.match(line):
+        sys.stdout.write(cmd.sub(replace_str,line))
+]]>
+         </configfile>
+    </configfiles>
+
     <outputs>
+        <data format="tabular" label="SPAdes contig stats" name="out_contig_stats" >
+            <actions>
+                <action name="column_names" type="metadata" default="name,length,coverage"/>
+            </actions>
+        </data>
+        <data format="tabular" label="SPAdes scaffold stats" name="out_scaffold_stats" >
+            <actions>
+                <action name="column_names" type="metadata" default="name,length,coverage"/>
+            </actions>
+        </data>
         <data format="fasta" from_work_dir="contigs.fasta" label="SPAdes contigs (fasta)" name="out_contigs" />
         <data format="fasta" from_work_dir="scaffolds.fasta" label="SPAdes scaffolds (fasta)" name="out_scaffolds" />
         <data format="txt" from_work_dir="spades.log" label="SPAdes log" name="out_log" />
@@ -155,6 +181,11 @@
             <param ftype="fastq" name="fwd_reads" value="ecoli_1K_1.fq" />
             <param ftype="fastq" name="rev_reads" value="ecoli_1K_2.fq" />
             <output compare="re_match" file="kmer_33_output.fa" ftype="fasta" lines_diff="1" name="out_contigs" />
+            <output name="out_contig_stats">
+                <assert_contents>
+                    <has_text_matching expression="NODE_1\t1000\t225"/>
+                </assert_contents>
+            </output>
         </test>
         <test>
             <param name="sc" value="false" />