-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_profiler_profile.xml
162 lines (159 loc) · 7.98 KB
/
tb_profiler_profile.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<tool id="tb_profiler_profile" name="TB-Profiler" version="@TOOL_VERSION@+galaxy0">
<description>Profiling tool for Mycobacterium tuberculosis to detect resistance and strain type from WGS data</description>
<macros>
<import>macros.xml</import>
</macros>
<expand macro="requirements" />
<command detect_errors="exit_code"><![CDATA[
#if str($input.selector) in ("paired_fastq", "paired_collection_fastq", "single_fastq")
#if str($input.selector) == "paired_fastq"
#set r1_ext = $input.fastq1.extension
#set r2_ext = $input.fastq2.extension
ln -s '$input.fastq1' fastq_r1.'$r1_ext' &&
ln -s '$input.fastq2' fastq_r2.'$r2_ext' &&
#else if str($input.selector) == "single_fastq"
#set r1_ext = $input.fastq.extension
ln -s '$input.fastq' fastq_r1.'$r1_ext' &&
#else if str($input.selector) == "paired_collection_fastq"
#set r1_ext = $input.fastq_collection.forward.extension
#set r2_ext = $input.fastq_collection.reverse.extension
ln -s '$input.fastq_collection.forward' fastq_r1.'$r1_ext' &&
ln -s '$input.fastq_collection.reverse' fastq_r2.'$r2_ext' &&
#end if
#else if str($input.selector) == "bam"
ln -s '$input.bam' input.bam &&
#end if
tb-profiler profile
--platform $platform
#if str($input.selector) in ("paired_fastq", "paired_collection_fastq", "single_fastq")
-1 fastq_r1.'$r1_ext'
#end if
#if str($input.selector) in ("paired_fastq", "paired_collection_fastq")
-2 fastq_r2.'$r1_ext'
#else if str($input.selector) == "bam"
--bam input.bam
#end if
#if $output_format == "pdf"
--pdf
#else if $output_format == "txt"
--txt
#end if
#if $advanced.options == 'yes'
$advanced.call_method
$advanced.min_gene_frac
#end if
&& mv results/tbprofiler.results.json $tbprofile_json
#if str($input.selector) != "bam"
&& mv bam/tbprofiler.bam $output_bam
#end if
&& bcftools view -Ov -o$output_vcf vcf/tbprofiler.targets.csq.bcf
#if $output_format == "pdf"
&& mv results/tbprofiler.results.pdf $output_pdf
#else if $output_format == "txt"
&& mv results/tbprofiler.results.txt $output_txt
#end if
]]></command>
<inputs>
<conditional label="Input type" name="input">
<param label="Input format" name="selector" type="select">
<option value="paired_fastq">Paired Fastq</option>
<option value="paired_collection_fastq">Paired Collection Fastq</option>
<option value="single_fastq">Single Fastq</option>
<option value="bam">BAM</option>
</param>
<when value="paired_fastq">
<param label="Reads1" type="data" name="fastq1" format="fastq,fastq.gz,fastqsanger,fastqsanger.gz" />
<param label="Reads2" type="data" name="fastq2" format="fastq,fastq.gz,fastqsanger,fastqsanger.gz" />
</when>
<when value="paired_collection_fastq">
<param label="Reads (collection)" name="fastq_collection" type="data_collection" collection_type="paired" format="fastq,fastq.gz,fastqsanger,fastqsanger.gz" />
</when>
<when value="single_fastq">
<param label="Reads" name="fastq" type="data" format="fastq,fastq.gz,fastqsanger,fastqsanger.gz" />
</when>
<when value="bam">
<param label="Input BAM" name="bam" type="data" format="bam" help="Aligned reads in BAM format, must be aligned to the Ensembl H37Rv reference sequence" />
</when>
</conditional>
<param name="output_format" label="Output format" type="select">
<option value="txt">Text</option>
<option value="pdf">PDF</option>
</param>
<param argument="--platform" type="select" label="Sequencing platform">
<option value="Illumina">Illumina</option>
<option value="minION">MinION</option>
</param>
<conditional name="advanced">
<param label="Select advanced options" type="select" name="options">
<option value="yes">Yes</option>
<option value="no" selected="true">No</option>
</param>
<when value="no">
</when>
<when value="yes">
<param label="Quality required for calls to be accepted" type="select" argument="--call_method">
<option value="low" selected="true">Low</option>
<option value="high">High</option>
<option value="optimise">Optimise</option>
</param>
<param label="Minimum coverage fraction to infer deletion" type="float"
help="Used to infer a deletion if the fraction of a gene covered falls below this value."
argument="--min_gene_frac" value="0.9" />
</when>
</conditional>
</inputs>
<outputs>
<data format="json" name="tbprofile_json" label="${tool.name} JSON on ${on_string}" />
<data format="vcf" name="output_vcf" label="${tool.name} VCF on ${on_string}" />
<data format="bam" name="output_bam" label="${tool.name} BAM on ${on_string}">
<filter>input['selector'] != 'bam'</filter>
</data>
<data format="pdf" name="output_pdf" label="${tool.name} PDF report on ${on_string}">
<filter>output_format == 'pdf'</filter>
</data>
<data format="txt" name="output_txt" label="${tool.name} report on ${on_string}">
<filter>output_format == 'txt'</filter>
</data>
</outputs>
<tests>
<test>
<param name="selector" value="single_fastq"/>
<param name="fastq" ftype="fastq.gz" value="rif_resistant.fastq.gz" />
<param name="output_format" value="txt" />
<param name="platform" value="Illumina" />
<param name="options" value="no" />
<output name="output_txt">
<assert_contents>
<has_line line="Drug-resistance: Drug-resistant" />
<has_line line="lineage2.2.2	1.000	East-Asian (Beijing)	Beijing-RD105/RD207	RD105;RD207" />
<has_line line="rifampicin	R	rpoB p.Asp435Val (1.00)" />
<has_line line="763031	Rv0667	c.3225T>C	1.000" />
</assert_contents>
</output>
</test>
<test>
<param name="selector" value="bam"/>
<param name="bam" ftype="bam" value="rif_resistant.bam" />
<param name="output_format" value="txt" />
<param name="platform" value="Illumina" />
<param name="options" value="no" />
<output name="output_txt">
<assert_contents>
<has_line line="Drug-resistance: Drug-resistant" />
<has_line line="lineage2.2.2	1.000	East-Asian (Beijing)	Beijing-RD105/RD207	RD105;RD207" />
<has_line line="rifampicin	R	rpoB p.Asp435Val (1.00)" />
<has_line line="763031	Rv0667	c.3225T>C	1.000" />
</assert_contents>
</output>
</test>
</tests>
<help><![CDATA[
This tool implements the TBProfiler_ pipeline.
The TBProfiler pipeline aligns reads to the H37Rv reference using BWA (for Illumina data) or
minimap2 (for MinION data) and then calls variants using BCFtools. These variants are then compared
to a drug-resistance database. We also predict the number of reads supporting drug resistance
variants as an insight into hetero-resistance (not applicable for MinION data).
.. _TBProfiler: https://github.com/jodyphelan/TBProfiler
]]></help>
<expand macro="citations" />
</tool>