comparison jvarkit_wgscoverageplotter.xml @ 0:859e0611960c draft

"planemo upload for repository https://github.com/galaxyproject/iuc/tree/master/tools/jvarkit commit ee258cf884aa478b4ce4f978c4239f237c813701"
author iuc
date Thu, 11 Feb 2021 08:00:58 +0000
parents
children ac048a34cac3
comparison
equal deleted inserted replaced
-1:000000000000 0:859e0611960c
1 <tool id="jvarkit_wgscoverageplotter" name="BAM Coverage Plotter" version="@TOOL_VERSION@+galaxy0">
2 <description>Plot read coverage across a genomic contig</description>
3 <macros>
4 <token name="@TOOL_VERSION@">20201223</token>
5 </macros>
6 <requirements>
7 <requirement type="package" version="@TOOL_VERSION@">jvarkit-wgscoverageplotter</requirement>
8 <requirement type="package" version="1.11">samtools</requirement>
9 <requirement type="package" version="7.0.10_62">imagemagick</requirement>
10 </requirements>
11 <command detect_errors="exit_code"><![CDATA[
12 #set include_regex = str($adv.include_contig_regex).strip()
13 #set exclude_regex = str($adv.skip_contig_regex).strip()
14 #set alignment_name = str($alignment_file.element_identifier)
15 #if str($reference.source) == "history"
16 ln -s '$reference.hist_genome' reference.fasta &&
17 samtools faidx reference.fasta &&
18 #else
19 #set ref_path = str($reference.cached_genome.fields.path)
20 #set ref_index_path = str($reference.cached_genome.fields.path) + '.fai'
21 ln -s '$ref_path' reference.fasta &&
22 ln -s '$ref_index_path' reference.fasta.fai &&
23 #end if
24 samtools view -H '$alignment_file' |grep -E '^(@HD|@SQ)' >reference.dict &&
25 cat reference.dict &&
26 ln -s '$alignment_file' '$alignment_name' &&
27 ln -s '${alignment_file.metadata.bam_index}' '${alignment_name}.bai' &&
28 wgscoverageplotter.sh
29 --reference reference.fasta
30 --dimension '$dimension'
31 --output plot.svg
32 $adv.disable_paired_overlap
33 #if $include_regex
34 -I '$include_regex'
35 #end if
36 #if $exclude_regex
37 -X '$exclude_regex'
38 #end if
39 --mapq $adv.min_mapq
40 --max-depth $adv.max_depth
41 $adv.clip
42 --min-contig-length '$adv.min_contig_length'
43 --percentile $adv.percentile
44 $adv.points
45 #if str($adv.sample_filter.filter_by_sample) == "true"
46 --samples '$adv.sample_filter.samples'
47 --partition '$adv.sample_filter.partition'
48 #end if
49 '$alignment_name' &&
50 #if str($format) == "SVG"
51 mv plot.svg '$plot_output'
52 #else
53 convert plot.svg '$format:$plot_output'
54 #end if
55 ]]>
56 </command>
57 <inputs>
58 <conditional name="reference">
59 <param name="source" type="select"
60 label="Will you select a reference genome from your history or use a built-in genome?">
61 <option value="cached">Use a built-in genome</option>
62 <option value="history" selected="true">Use a genome from my history</option>
63 </param>
64 <when value="cached">
65 <!-- NOTE: wgscoverageplotter requires the genome to be both indexed (with samtools index)
66 and also have a dictionary (from picard CreateSequenceDictionary). since there is no
67 way to specify both of these requirements, we take the indexed genome and build a dictionary -->
68 <param name="cached_genome" type="select"
69 label="Reference genome"
70 help="The FASTA reference genome that reads were mapped against.">
71 <options from_data_table="fasta_indexes" />
72 </param>
73 </when>
74 <when value="history">
75 <param name="hist_genome" type="data" format="fasta"
76 label="Reference genome"
77 help="The FASTA reference genome that reads were mapped against."/>
78 </when>
79 </conditional>
80 <param name="alignment_file" type="data" format="bam" label="BAM alignment" />
81 <param argument="--dimension" value="1000x500" type="text" label="Image dimensions" />
82 <param name="format" type="select" label="Output format" help="Note that SVG might not display correctly on all Galaxy servers">
83 <option value="PNG" selected="true">PNG</option>
84 <option value="SVG">SVG</option>
85 </param>
86 <section name="adv" title="Advanced options" expanded="false">
87 <param argument="--disable-paired-overlap"
88 name="disable_paired_overlap"
89 type="boolean" truevalue="--disable-paired-overlap"
90 falsevalue="" label="Count overlapping bases with mate for paired-end" />
91 <param argument="--include-contig-regex" name="include_contig_regex" type="text" label="Only keep chromosomes matching this regular expression." />
92 <param argument="--mapq" name="min_mapq" type="integer" value="1" label="Minimum mapping quality" />
93 <param argument="--max-depth"
94 name="max_depth"
95 type="integer"
96 label="y-axis (depth) limit of the plot"
97 value="-1"
98 help="The special value '-1' will first compute the average depth and the set the max depth to 2*average" />
99 <param argument="--clip"
100 type="boolean"
101 label="Clip the plot at the y-axis limit"
102 help="Default is to let the coverage plot exceed the y-axis limit"
103 truevalue="--clip"
104 falsevalue="" />
105 <param argument="--min-contig-length"
106 name="min_contig_length"
107 type="text"
108 label="Skip chromosomes shorter than"
109 value="0"
110 help="A distance specified as a positive integer.">
111 <validator type="regex" message="A positive integer optionally followed by the suffixes b,bp,k,kb,m,mb is required">[0-9,]+(bp|b|kb|k|mb|m)?$</validator>
112 </param>
113 <param argument="--percentile" type="select" label="How to bin the coverage under one pixel">
114 <option value="median" selected="true">median</option>
115 <option value="average">average</option>
116 <option value="min">min</option>
117 <option value="max">max</option>
118 </param>
119 <param argument="--points"
120 type="boolean"
121 label="Plot coverage using points instead of areas"
122 truevalue="--points"
123 falsevalue=""
124 />
125 <param argument="--skip-contig-regex"
126 name="skip_contig_regex"
127 type="text"
128 label="Skip chromosomes matching this regular expression" />
129 <conditional name="sample_filter">
130 <param name="filter_by_sample" type="select" label="Filter by sample">
131 <option value="true">Yes</option>
132 <option value="false" selected="true">No</option>
133 </param>
134 <when value="true">
135 <param argument="--samples"
136 type="text"
137 label="Limit to these read groups"
138 help="See also --partition. Multiple read groups can be separated with commas.">
139 <validator type="expression" message="If a filter is being used, this field cannot be blank">len(str(value).strip()) > 0</validator>
140 </param>
141 <param argument="--partition" type="select" label="How to interpret identifiers in --samples" help="Partitions are modelled on the GATK logic as described here: https://gatk.broadinstitute.org/hc/en-us/articles/360051307491-DepthOfCoverage-BETA-#--partition-type">
142 <option value="sample" selected="true">sample</option>
143 <option value="readgroup">readgroup</option>
144 <option value="library">library</option>
145 <option value="platform">platform</option>
146 <option value="sample_by_platform">sample_by_platform</option>
147 <option value="sample_by_platform_by_center">sample_by_platform_by_center</option>
148 <option value="any">any</option>
149 </param>
150 </when>
151 <when value="false">
152 </when>
153 </conditional>
154 </section>
155 </inputs>
156 <outputs>
157 <data format="png" name="plot_output">
158 <change_format>
159 <when input="format" value="SVG" format="svg" />
160 </change_format>
161 </data>
162 </outputs>
163 <tests>
164 <test>
165 <conditional name="reference">
166 <param name="source" value="history" />
167 <param name="hist_genome" ftype="fasta" value="reference.fasta" />
168 </conditional>
169 <param name="alignment_file" ftype="bam" value="sars_cov2_trimmed_cut.bam" />
170 <output name="plot_output">
171 <assert_contents>
172 <has_size value="26303" delta="15000" />
173 </assert_contents>
174 </output>
175 </test>
176 <test>
177 <conditional name="reference">
178 <param name="source" value="history" />
179 <param name="hist_genome" ftype="fasta" value="reference.fasta" />
180 </conditional>
181 <param name="alignment_file" ftype="bam" value="sars_cov2_trimmed_cut.bam" />
182 <param name="format" value="SVG" />
183 <output name="plot_output">
184 <assert_contents>
185 <has_size value="7805" delta="2000"/>
186 </assert_contents>
187 </output>
188 </test>
189 <test>
190 <conditional name="reference">
191 <param name="source" value="history" />
192 <param name="hist_genome" ftype="fasta" value="reference.fasta" />
193 </conditional>
194 <param name="alignment_file" ftype="bam" value="sars_cov2_trimmed_cut.bam" />
195 <section name="adv">
196 <param name="max_depth" value="50" />
197 </section>
198 <output name="plot_output">
199 <assert_contents>
200 <has_size value="25410" delta="15000" />
201 </assert_contents>
202 </output>
203 </test>
204 <test>
205 <conditional name="reference">
206 <param name="source" value="cached" />
207 <param name="cached_genome" value="sars-cov-2-fragment" />
208 </conditional>
209 <param name="alignment_file" ftype="bam" value="sars_cov2_trimmed_cut.bam" />
210 <output name="plot_output">
211 <assert_contents>
212 <has_size value="26303" delta="15000" />
213 </assert_contents>
214 </output>
215 </test>
216
217 </tests>
218 <help><![CDATA[
219
220 **WGSCoveragePlotter from the jvarkit toolkit**
221
222 WGSCoveragePlotter_ is a tool to plot the coverage of aligned reads across a genomic contig. It takes
223 as input a BAM file and a genomic contig in FASTA format and produces an image in either PNG or SVG format
224 showing the depth of read coverage across the contig.
225
226 .. _WGSCoveragePlotter: http://lindenb.github.io/jvarkit/WGSCoveragePlotter.html
227 ]]>
228 </help>
229 <citations>
230 <citation type="doi">10.6084/m9.figshare.1425030</citation>
231 </citations>
232 </tool>