comparison macros.xml @ 0:65edd5a6002e draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tool_collections/samtools/samtools_consensus commit 8d2369dc1bdafc743920a155c508c20114ebe655
author iuc
date Mon, 17 Nov 2025 07:30:30 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:65edd5a6002e
1 <macros>
2 <xml name="requirements">
3 <requirements>
4 <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>
5 <yield/>
6 </requirements>
7 </xml>
8 <!-- NOTE: for some tools only the version of the requirement but not the
9 tool's version is controlled by the TOOL_VERSION token
10 (because their version is ahead of the requirement version ..
11 please only bump the minor version in order to let the requirement
12 version catch up eventually). To find the tools check:
13 `grep "<tool" . -r | grep -v VERSION_SUFFIX | cut -d":" -f 1` -->
14 <token name="@TOOL_VERSION@">1.22</token>
15 <token name="@VERSION_SUFFIX@">1</token>
16 <token name="@PROFILE@">24.0</token>
17 <token name="@FLAGS@"><![CDATA[
18 #set $flags = 0
19 #if $filter
20 #set $flags = sum(map(int, str($filter).split(',')))
21 #end if
22 ]]></token>
23 <token name="@PREPARE_IDX@"><![CDATA[
24 ##prepare input and indices
25 ln -s '$input' infile &&
26 #if $input.is_of_type('bam'):
27 #if str( $input.metadata.bam_index ) != "None":
28 ln -s '${input.metadata.bam_index}' infile.bai &&
29 #else:
30 samtools index infile infile.bai &&
31 #end if
32 #elif $input.is_of_type('cram'):
33 #if str( $input.metadata.cram_index ) != "None":
34 ln -s '${input.metadata.cram_index}' infile.crai &&
35 #else:
36 samtools index infile infile.crai &&
37 #end if
38 #end if
39 ]]></token>
40 <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[
41 ##prepare input and indices
42 #for $i, $bam in enumerate( $input_bams ):
43 ln -s '$bam' '${i}' &&
44 #if $bam.is_of_type('bam'):
45 #if str( $bam.metadata.bam_index ) != "None":
46 ln -s '${bam.metadata.bam_index}' '${i}.bai' &&
47 #else:
48 samtools index '${i}' '${i}.bai' &&
49 #end if
50 #elif $bam.is_of_type('cram'):
51 #if str( $bam.metadata.cram_index ) != "None":
52 ln -s '${bam.metadata.cram_index}' '${i}.crai' &&
53 #else:
54 samtools index '${i}' '${i}.crai' &&
55 #end if
56 #end if
57 #end for
58 ]]></token>
59 <token name="@PREPARE_FASTA_IDX@"><![CDATA[
60 ## Make the user-selected reference genome, if any, accessible through
61 ## a shell variable $reffa, index the reference if necessary, and make
62 ## the fai-index file available through a shell variable $reffai.
63
64 ## For a cached genome simply sets the shell variables to point to the
65 ## genome file and its precalculated index.
66 ## For a genome from the user's history, if that genome is a plain
67 ## fasta file, the code creates a symlink in the pwd, creates the fai
68 ## index file next to it, then sets the shell variables to point to the
69 ## symlink and its index.
70 ## For a fasta.gz dataset from the user's history, it tries the same,
71 ## but this will only succeed if the file got compressed with bgzip.
72 ## For a regular gzipped file samtools faidx will fail, in which case
73 ## the code falls back to decompressing to plain fasta before
74 ## reattempting the indexing.
75 ## Indexing of a bgzipped file produces a regular fai index file *and*
76 ## a compressed gzi file. The former is identical to the fai index of
77 ## the uncompressed fasta.
78
79 ## If the user has not selected a reference (it's an optional parameter
80 ## in some samtools wrappers), a cheetah boolean use_ref is set to
81 ## False to encode that fact.
82
83 #set use_ref=True
84 #if $addref_cond.addref_select == "history":
85 #if $addref_cond.ref.is_of_type('fasta'):
86 reffa="reference.fa" &&
87 ln -s '${addref_cond.ref}' \$reffa &&
88 samtools faidx \$reffa &&
89 #else:
90 reffa="reference.fa.gz" &&
91 ln -s '${addref_cond.ref}' \$reffa &&
92 {
93 samtools faidx \$reffa ||
94 {
95 echo "Failed to index compressed reference. Trying decompressed ..." 1>&2 &&
96 gzip -dc \$reffa > reference.fa &&
97 reffa="reference.fa" &&
98 samtools faidx \$reffa;
99 }
100 } &&
101 #end if
102 reffai=\$reffa.fai &&
103 #elif $addref_cond.addref_select == "cached":
104 ## in case of cached the absolute path is used which allows to read
105 ## a cram file without specifying the reference
106 reffa='${addref_cond.ref.fields.path}' &&
107 reffai=\$reffa.fai &&
108 #else
109 #set use_ref=False
110 #end if
111 ]]></token>
112
113 <xml name="optional_reference" token_help="" token_argument="">
114 <conditional name="addref_cond">
115 <param name="addref_select" type="select" label="Use a reference sequence">
116 <help>@HELP@</help>
117 <option value="no">No</option>
118 <option value="history">Use a genome/index from the history</option>
119 <option value="cached">Use a built-in genome</option>
120 </param>
121 <when value="no"/>
122 <when value="history">
123 <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
124 </when>
125 <when value="cached">
126 <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
127 <options from_data_table="fasta_indexes">
128 <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
129 </options>
130 <validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset"/>
131 </param>
132 </when>
133 </conditional>
134 </xml>
135 <xml name="mandatory_reference" token_help="" token_argument="">
136 <conditional name="addref_cond">
137 <param name="addref_select" type="select" label="Use a reference sequence">
138 <help>@HELP@</help>
139 <option value="history">Use a genome/index from the history</option>
140 <option value="cached">Use a built-in genome</option>
141 </param>
142 <when value="history">
143 <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>
144 </when>
145 <when value="cached">
146 <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">
147 <options from_data_table="fasta_indexes">
148 <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>
149 <validator message="No reference genome is available for the build associated with the selected input dataset" type="no_options" />
150 </options>
151 </param>
152 </when>
153 </conditional>
154 </xml>
155
156
157 <token name="@ADDTHREADS@"><![CDATA[
158 ##compute the number of ADDITIONAL threads to be used by samtools (-@)
159 addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
160 ]]></token>
161 <token name="@ADDMEMORY@"><![CDATA[
162 ##compute the number of memory available to samtools sort (-m)
163 ##use only 75% of available: https://github.com/samtools/samtools/issues/831
164 addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} &&
165 ((addmemory=addmemory*75/100)) &&
166 ]]></token>
167 <xml name="seed_input">
168 <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." />
169 </xml>
170
171 <!-- Include/exclude by flags + flag options -->
172 <xml name="inclusive_filter_macro" token_argument="">
173 <param name="inclusive_filter" argument="@ARGUMENT@" type="select" multiple="True" label="Require that these flags are set">
174 <expand macro="flag_options" />
175 </param>
176 </xml>
177 <xml name="exclusive_filter_macro" token_argument="">
178 <param name="exclusive_filter" argument="@ARGUMENT@" type="select" multiple="True" label="Exclude reads with any of the following flags set">
179 <expand macro="flag_options" />
180 </param>
181 </xml>
182 <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">
183 <option value="1" selected="@S1@">Read is paired</option>
184 <option value="2" selected="@S2@">Read is mapped in a proper pair</option>
185 <option value="4" selected="@S4@">Read is unmapped</option>
186 <option value="8" selected="@S8@">Mate is unmapped</option>
187 <option value="16" selected="@S16@">Read is mapped to the reverse strand of the reference</option>
188 <option value="32" selected="@S32@">Mate is mapped to the reverse strand of the reference</option>
189 <option value="64" selected="@S64@">Read is the first in a pair</option>
190 <option value="128" selected="@S128@">Read is the second in a pair</option>
191 <option value="256" selected="@S256@">Alignment of the read is not primary</option>
192 <option value="512" selected="@S512@">Read fails platform/vendor quality checks</option>
193 <option value="1024" selected="@S1024@">Read is a PCR or optical duplicate</option>
194 <option value="2048" selected="@S2048@">Alignment is supplementary</option>
195 </xml>
196
197 <!-- region specification macros and tokens for tools that allow the specification
198 of region by bed file / space separated list of regions -->
199 <token name="@REGIONS_FILE@"><![CDATA[
200 #if $cond_region.select_region == 'tab':
201 -t '$cond_region.targetregions'
202 #end if
203 ]]></token>
204 <token name="@REGIONS_MANUAL@"><![CDATA[
205 #if $cond_region.select_region == 'text':
206 #for $i, $x in enumerate($cond_region.regions_repeat):
207 '${x.region}'
208 #end for
209 #end if
210 ]]></token>
211 <xml name="regions_macro">
212 <conditional name="cond_region">
213 <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">
214 <option value="no" selected="True">No</option>
215 <option value="text">Manualy specify regions</option>
216 <option value="tab">Regions from tabular file</option>
217 </param>
218 <when value="no"/>
219 <when value="text">
220 <repeat name="regions_repeat" min="1" default="1" title="Regions">
221 <param name="region" type="text" label="region" help="format chr:from-to">
222 <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>
223 </param>
224 </repeat>
225 </when>
226 <when value="tab">
227 <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)" />
228 </when>
229 </conditional>
230 </xml>
231
232 <xml name="citations">
233 <citations>
234 <citation type="doi">10.1093/gigascience/giab008</citation>
235 <citation type="doi">10.1093/bioinformatics/btr076</citation>
236 </citations>
237 </xml>
238 <xml name="version_command">
239 <version_command><![CDATA[samtools 2>&1 | grep Version]]></version_command>
240 </xml>
241 <xml name="stdio">
242 <stdio>
243 <exit_code range="1:" level="fatal" description="Error" />
244 </stdio>
245 </xml>
246 </macros>