comparison vsnp_sample_names.xml @ 0:f75e2ac7b6cd draft

Uploaded
author greg
date Tue, 21 Apr 2020 10:17:20 -0400
parents
children 895d18fcfebe
comparison
equal deleted inserted replaced
-1:000000000000 0:f75e2ac7b6cd
1 <tool id="vsnp_sample_names" name="vSNP: sample names" version="1.0.0">
2 <description></description>
3 <command detect_errors="exit_code"><![CDATA[
4 #import os
5 #import re
6 #set output_dir = 'output'
7 mkdir -p $output_dir
8 #if str($input_type_cond.input_type) == "single":
9 ## We may have a single read or a pair, but in
10 ## either case we want the same base file name.
11 #set sample_name = $os.path.basename($input_type_cond.read.element_identifier)
12 #if $sample_name.find(".") > 0:
13 #set sample_name = $sample_name.split(".")[0]
14 #end if
15 #if $sample_name.find("_") > 0:
16 #set sample_name = $sample_name.split("_")[0]
17 #end if
18 echo $sample_name > $output
19 #else:
20 #for $i in $input_type_cond.reads_collection:
21 #set sample_name = $os.path.basename($i.element_identifier)
22 #if $sample_name.find(".") > 0:
23 #set sample_name = $sample_name.split(".")[0]
24 #end if
25 #set output_file = $os.path.join($output_dir, $sample_name)
26 && echo $sample_name > $output_file
27 #end for
28 #end if
29 ]]></command>
30 <inputs>
31 <conditional name="input_type_cond">
32 <param name="input_type" type="select" label="Choose the category of the files to be analyzed">
33 <option value="single" selected="true">Single files</option>
34 <option value="collection">Collections of files</option>
35 </param>
36 <when value="single">
37 <param name="read" type="data" format="fastqsanger.gz,fastqsanger" label="Sample file"/>
38 </when>
39 <when value="collection">
40 <param name="reads_collection" type="data_collection" format="fastqsanger,fastqsanger.gz" collection_type="list" label="Collection of sample files"/>
41 </when>
42 </conditional>
43 </inputs>
44 <outputs>
45 <data name="output" format="txt">
46 <filter>input_type_cond['input_type'] == 'single'</filter>
47 </data>
48 <collection name="output__collection" type="list">
49 <discover_datasets pattern="__name__" directory="output" format="txt" />
50 <filter>input_type_cond['input_type'] == 'collection'</filter>
51 </collection>
52 </outputs>
53 <tests>
54 <test>
55 <param name="input_type" value="collection"/>
56 <param name="reads_collection">
57 <collection type="list">
58 <element name="BCG_Danish_Human_UK_SRR9596061.fastq" value="BCG_Danish_Human_UK_SRR9596061.fastq" dbkey="89"/>
59 <element name="Dassie_Dassie_ZA_SRR3745455.fastq" value="Dassie_Dassie_ZA_SRR3745455.fastq" dbkey="89"/>
60 <element name="Mbov_Cattle_NI_SRR10993937.fastq" value="Mbov_Cattle_NI_SRR10993937.fastq" dbkey="89"/>
61 </collection>
62 </param>
63 <output_collection name="output__collection" type="list">
64 <element name="BCG_Danish_Human_UK_SRR9596061" file="BCG_Danish_Human_UK_SRR9596061" ftype="txt"/>
65 <element name="Dassie_Dassie_ZA_SRR3745455" file="Dassie_Dassie_ZA_SRR3745455" ftype="txt"/>
66 <element name="Mbov_Cattle_NI_SRR10993937" file="Mbov_Cattle_NI_SRR10993937" ftype="txt"/>
67 </output_collection>
68 </test>
69 </tests>
70 <help>
71 **What it does**
72
73 Accepts one or more sample files and extracts a unique portion of the file name as the content of the output file(s). These
74 text files are then used as workflow parameter values for the Read Group Identifier parameter in the bwa-mem tool.
75
76 **Required Options**
77
78 * **Choose the category of the files to be analyzed** - select "Single files" or "Collections of files", then select the appropriate history items (single or paired fastqsanger reads or collections of fastqsanger reads) based on the selected option.
79 </help>
80 <citations>
81 <citation type="bibtex">
82 @misc{None,
83 journal = {None},
84 author = {1. Stuber T},
85 title = {Manuscript in preparation},
86 year = {None},
87 url = {https://github.com/USDA-VS/vSNP},}
88 </citation>
89 </citations>
90 </tool>
91