comparison macros.xml @ 0:90f2dd176d80 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/sam_to_bam commit 4d0362c336f67d05086298ab4980c1d922d71c6e"
author iuc
date Tue, 28 Sep 2021 15:10:16 +0000
parents
children ae36fab06bc2
comparison
equal deleted inserted replaced
-1:000000000000 0:90f2dd176d80
1 <macros>
2 <xml name="requirements">
3 <requirements>
4 <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>
5 <yield/>
6 </requirements>
7 </xml>
8 <token name="@TOOL_VERSION@">1.13</token>
9 <token name="@PROFILE@">20.05</token>
10 <token name="@FLAGS@"><![CDATA[
11 #set $flags = 0
12 #if $filter
13 #set $flags = sum(map(int, str($filter).split(',')))
14 #end if
15 ]]></token>
16 <token name="@PREPARE_IDX@"><![CDATA[
17 ##prepare input and indices
18 ln -s '$input' infile &&
19 #if $input.is_of_type('bam'):
20 #if str( $input.metadata.bam_index ) != "None":
21 ln -s '${input.metadata.bam_index}' infile.bai &&
22 #else:
23 samtools index infile infile.bai &&
24 #end if
25 #elif $input.is_of_type('cram'):
26 #if str( $input.metadata.cram_index ) != "None":
27 ln -s '${input.metadata.cram_index}' infile.crai &&
28 #else:
29 samtools index infile infile.crai &&
30 #end if
31 #end if
32 ]]></token>
33 <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[
34 ##prepare input and indices
35 #for $i, $bam in enumerate( $input_bams ):
36 ln -s '$bam' '${i}' &&
37 #if $bam.is_of_type('bam'):
38 #if str( $bam.metadata.bam_index ) != "None":
39 ln -s '${bam.metadata.bam_index}' '${i}.bai' &&
40 #else:
41 samtools index '${i}' '${i}.bai' &&
42 #end if
43 #elif $bam.is_of_type('cram'):
44 #if str( $bam.metadata.cram_index ) != "None":
45 ln -s '${bam.metadata.cram_index}' '${i}.crai' &&
46 #else:
47 samtools index '${i}' '${i}.crai' &&
48 #end if
49 #end if
50 #end for
51 ]]></token>
52 <token name="@PREPARE_FASTA_IDX@"><![CDATA[
53 ##checks for reference data ($addref_cond.addref_select=="history" or =="cached")
54 ##and sets the -t/-T parameters accordingly:
55 ##- in case of history a symbolic link is used because samtools (view) will generate
56 ## the index which might not be possible in the directory containing the fasta file
57 ##- in case of cached the absolute path is used which allows to read the cram file
58 ## without specifying the reference
59 #if $addref_cond.addref_select == "history":
60 ln -s '${addref_cond.ref}' reference.fa &&
61 samtools faidx reference.fa &&
62 #set reffa="reference.fa"
63 #set reffai="reference.fa.fai"
64 #elif $addref_cond.addref_select == "cached":
65 #set reffa=str($addref_cond.ref.fields.path)
66 #set reffai=str($addref_cond.ref.fields.path)+".fai"
67 #else
68 #set reffa=None
69 #set reffai=None
70 #end if
71 ]]></token>
72
73 <xml name="optional_reference">
74 <conditional name="addref_cond">
75 <param name="addref_select" type="select" label="Use a reference sequence">
76 <help>@HELP@</help>
77 <option value="no">No</option>
78 <option value="history">Use a genome/index from the history</option>
79 <option value="cached">Use a built-in genome</option>
80 </param>
81 <when value="no"/>
82 <when value="history">
83 <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
84 </when>
85 <when value="cached">
86 <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
87 <options from_data_table="fasta_indexes">
88 <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
89 </options>
90 <validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset"/>
91 </param>
92 </when>
93 </conditional>
94 </xml>
95 <xml name="mandatory_reference" token_help="" token_argument="">
96 <conditional name="addref_cond">
97 <param name="addref_select" type="select" label="Use a reference sequence">
98 <help>@HELP@</help>
99 <option value="history">Use a genome/index from the history</option>
100 <option value="cached">Use a built-in genome</option>
101 </param>
102 <when value="history">
103 <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
104 </when>
105 <when value="cached">
106 <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
107 <options from_data_table="fasta_indexes">
108 <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
109 <validator message="No reference genome is available for the build associated with the selected input dataset" type="no_options" />
110 </options>
111 </param>
112 </when>
113 </conditional>
114 </xml>
115
116
117 <token name="@ADDTHREADS@"><![CDATA[
118 ##compute the number of ADDITIONAL threads to be used by samtools (-@)
119 addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
120 ]]></token>
121 <token name="@ADDMEMORY@"><![CDATA[
122 ##compute the number of memory available to samtools sort (-m)
123 ##use only 75% of available: https://github.com/samtools/samtools/issues/831
124 addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} &&
125 ((addmemory=addmemory*75/100)) &&
126 ]]></token>
127 <xml name="seed_input">
128 <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." />
129 </xml>
130 <xml name="flag_options" token_s1="false" token_s2="false" token_s4="false" token_s8="false" token_s16="false" token_s32="false" token_s64="false" token_s128="false" token_s256="false" token_s512="false" token_s1024="false" token_s2048="false">
131 <option value="1" selected="@S1@">Read is paired</option>
132 <option value="2" selected="@S2@">Read is mapped in a proper pair</option>
133 <option value="4" selected="@S4@">Read is unmapped</option>
134 <option value="8" selected="@S8@">Mate is unmapped</option>
135 <option value="16" selected="@S16@">Read is mapped to the reverse strand of the reference</option>
136 <option value="32" selected="@S32@">Mate is mapped to the reverse strand of the reference</option>
137 <option value="64" selected="@S64@">Read is the first in a pair</option>
138 <option value="128" selected="@S128@">Read is the second in a pair</option>
139 <option value="256" selected="@S256@">Alignment of the read is not primary</option>
140 <option value="512" selected="@S512@">Read fails platform/vendor quality checks</option>
141 <option value="1024" selected="@S1024@">Read is a PCR or optical duplicate</option>
142 <option value="2048" selected="@S2048@">Alignment is supplementary</option>
143 </xml>
144
145 <!-- region specification macros and tokens for tools that allow the specification
146 of region by bed file / space separated list of regions -->
147 <token name="@REGIONS_FILE@"><![CDATA[
148 #if $cond_region.select_region == 'tab':
149 -t '$cond_region.targetregions'
150 #end if
151 ]]></token>
152 <token name="@REGIONS_MANUAL@"><![CDATA[
153 #if $cond_region.select_region == 'text':
154 #for $i, $x in enumerate($cond_region.regions_repeat):
155 '${x.region}'
156 #end for
157 #end if
158 ]]></token>
159 <xml name="regions_macro">
160 <conditional name="cond_region">
161 <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">
162 <option value="no" selected="True">No</option>
163 <option value="text">Manualy specify regions</option>
164 <option value="tab">Regions from tabular file</option>
165 </param>
166 <when value="no"/>
167 <when value="text">
168 <repeat name="regions_repeat" min="1" default="1" title="Regions">
169 <param name="region" type="text" label="region" help="format chr:from-to">
170 <validator type="regex" message="Required format: CHR[:FROM[-TO]]; where CHR: string containing any character except quotes, whitespace and colon; FROM and TO: any integer">^[^\s'\":]+(:\d+(-\d+){0,1}){0,1}$</validator>
171 </param>
172 </repeat>
173 </when>
174 <when value="tab">
175 <param name="targetregions" argument="-t/--target-regions" type="data" format="tabular" label="Target regions file" help="Do stats in these regions only. Tab-delimited file chr,from,to (1-based, inclusive)" />
176 </when>
177 </conditional>
178 </xml>
179
180 <xml name="citations">
181 <citations>
182 <citation type="bibtex">
183 @misc{SAM_def,
184 title={Definition of SAM/BAM format},
185 url = {https://samtools.github.io/hts-specs/},}
186 </citation>
187 <citation type="doi">10.1093/bioinformatics/btp352</citation>
188 <citation type="doi">10.1093/bioinformatics/btr076</citation>
189 <citation type="doi">10.1093/bioinformatics/btr509</citation>
190 <citation type="bibtex">
191 @misc{Danecek_et_al,
192 Author={Danecek, P., Schiffels, S., Durbin, R.},
193 title={Multiallelic calling model in bcftools (-m)},
194 url = {http://samtools.github.io/bcftools/call-m.pdf},}
195 </citation>
196 <citation type="bibtex">
197 @misc{Durbin_VCQC,
198 Author={Durbin, R.},
199 title={Segregation based metric for variant call QC},
200 url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
201 </citation>
202 <citation type="bibtex">
203 @misc{Li_SamMath,
204 Author={Li, H.},
205 title={Mathematical Notes on SAMtools Algorithms},
206 url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
207 </citation>
208 <citation type="bibtex">
209 @misc{SamTools_github,
210 title={SAMTools GitHub page},
211 url = {https://github.com/samtools/samtools},}
212 </citation>
213 </citations>
214 </xml>
215 <xml name="version_command">
216 <version_command><![CDATA[samtools 2>&1 | grep Version]]></version_command>
217 </xml>
218 <xml name="stdio">
219 <stdio>
220 <exit_code range="1:" level="fatal" description="Error" />
221 </stdio>
222 </xml>
223 </macros>