3
|
1 <tool id="vsnp_sample_names" name="vSNP: sample names" version="@WRAPPER_VERSION@.1" profile="@PROFILE@">
|
0
|
2 <description></description>
|
3
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
0
|
6 <command detect_errors="exit_code"><![CDATA[
|
|
7 #import os
|
|
8 #import re
|
3
|
9
|
|
10 #set sample_name_read2 = None
|
|
11
|
|
12 #if $input_type_cond.input_type in ['single', 'pair']:
|
|
13 #set read1 = $input_type_cond.read1
|
|
14 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1.element_identifier))
|
|
15 #else:
|
|
16 #set read1_filename = $input_type_cond.reads_collection['forward'].name
|
|
17 #set sample_name = re.sub('[^\s\w\-]', '_', str($read1_filename))
|
|
18 #end if
|
|
19
|
|
20 #if $sample_name.find('_R1') >0:
|
|
21 ## Something like CMC_20E1_R1.fastq.gz
|
|
22 #set sample_name = $sample_name.split('_R1')[0]
|
|
23 #else if $sample_name.find(".") > 0:
|
|
24 #if $read1.is_of_type('fastqsanger.gz'):
|
|
25 ## Something like my_sample.fastq.gz
|
|
26 #set sample_name = '.'.join($sample_name.split('.')[0:-2])
|
|
27 #else:
|
|
28 ## Something like my_sample.fastq
|
|
29 #set sample_name = $os.path.splitext($sample_name)[0]
|
0
|
30 #end if
|
3
|
31 #else if $sample_name.find("_") > 0:
|
|
32 #if $read1.is_of_type('fastqsanger.gz'):
|
|
33 ## Something like my_sample_fastq_gz
|
|
34 #set sample_name = '_'.join($sample_name.split('_')[0:-2])
|
|
35 #else:
|
|
36 ## Something like my_sample_fastq
|
|
37 #set sample_name = "_".join($sample_name.split("_")[0:-1])
|
|
38 #end if
|
0
|
39 #end if
|
3
|
40 echo '$sample_name' > '$output'
|
0
|
41 ]]></command>
|
|
42 <inputs>
|
|
43 <conditional name="input_type_cond">
|
|
44 <param name="input_type" type="select" label="Choose the category of the files to be analyzed">
|
3
|
45 <option value="single" selected="true">Single dataset</option>
|
|
46 <option value="pair">Dataset pair</option>
|
|
47 <option value="paired">List of dataset pairs</option>
|
0
|
48 </param>
|
|
49 <when value="single">
|
3
|
50 <param name="read1" type="data" format="fastqsanger.gz,fastqsanger" label="Read1 fastq file"/>
|
0
|
51 </when>
|
3
|
52 <when value="paired">
|
|
53 <param name="reads_collection" type="data_collection" format="fastqsanger,fastqsanger.gz" collection_type="paired" label="Collection of fastqsanger paired read files"/>
|
|
54 </when>
|
|
55 <when value="pair">
|
|
56 <param name="read1" type="data" format="fastqsanger.gz,fastqsanger" label="Read1 fastq file"/>
|
|
57 <param name="read2" type="data" format="fastqsanger.gz,fastqsanger" label="Read2 fastq file"/>
|
0
|
58 </when>
|
|
59 </conditional>
|
|
60 </inputs>
|
|
61 <outputs>
|
3
|
62 <data name="output" format="txt"/>
|
0
|
63 </outputs>
|
|
64 <tests>
|
3
|
65 <!-- Single files -->
|
0
|
66 <test>
|
3
|
67 <param name="input_type" value="single"/>
|
|
68 <param name="read1" value="CMC_20E1_R1.fastq.gz" dbkey="89"/>
|
|
69 <output name="output" file="sample_names.txt" ftype="txt"/>
|
|
70 </test>
|
|
71 <!-- Paired reads -->
|
|
72 <test>
|
|
73 <param name="input_type" value="paired"/>
|
0
|
74 <param name="reads_collection">
|
3
|
75 <collection type="paired">
|
|
76 <element name="forward" value="CMC_20E1_R1.fastq.gz"/>
|
|
77 <element name="reverse" value="CMC_20E1_R2.fastq.gz"/>
|
0
|
78 </collection>
|
|
79 </param>
|
3
|
80 <output name="output" file="sample_names.txt" ftype="txt"/>
|
|
81 </test>
|
|
82 <!-- Paired reads in separate datasets -->
|
|
83 <test>
|
|
84 <param name="input_type" value="pair"/>
|
|
85 <param name="read1" value="CMC_20E1_R1.fastq.gz" dbkey="89"/>
|
|
86 <param name="read2" value="CMC_20E1_R2.fastq.gz" dbkey="89"/>
|
|
87 <output name="output" file="sample_names.txt" ftype="txt"/>
|
0
|
88 </test>
|
|
89 </tests>
|
|
90 <help>
|
|
91 **What it does**
|
|
92
|
3
|
93 Accepts fastqsanger sample files, extracts a unique portion of the file name as the sample name, and writes it to
|
|
94 the output. The output text file can be consumed by the **Parse parameter value** expression tool to provide workflow
|
|
95 parameter values to the **Read group identifier (ID)** and the **Sample name identifier (SM)** parameters in the
|
|
96 **Map with BWA-MEM** tool.
|
0
|
97 </help>
|
3
|
98 <expand macro="citations"/>
|
0
|
99 </tool>
|
|
100
|