Mercurial > repos > iuc > samtools_view
comparison samtools_view.xml @ 2:02afb5ea2fce draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit 1047dc0e36a1c28492d7cd1e860c89ecf3ba30c8
author | iuc |
---|---|
date | Thu, 27 Sep 2018 08:51:16 -0400 |
parents | 6ade12d94f9a |
children | fdc58a0cc1d4 |
comparison
equal
deleted
inserted
replaced
1:6ade12d94f9a | 2:02afb5ea2fce |
---|---|
1 <tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@"> | 1 <tool id="samtools_view" name="Samtools view" version="@TOOL_VERSION@"> |
2 <description>reformat, filter, or subsample</description> | 2 <description>reformat, filter, or subsample</description> |
3 <macros> | 3 <macros> |
4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
5 </macros> | 5 </macros> |
6 <expand macro="requirements"/> | 6 <expand macro="requirements"> |
7 <requirement type="package">gawk</requirement> | |
8 </expand> | |
7 <expand macro="stdio"/> | 9 <expand macro="stdio"/> |
8 <expand macro="version_command"/> | 10 <expand macro="version_command"/> |
9 <command><![CDATA[ | 11 <command><![CDATA[ |
10 @ADDTHREADS@ | 12 @ADDTHREADS@ |
11 ## prepare reference data | 13 ## prepare reference data |
12 @PREPARE_FASTA_IDX@ | 14 @PREPARE_FASTA_IDX@ |
13 @PREPARE_IDX@ | 15 @PREPARE_IDX@ |
14 | 16 #if $cond_subsample.select_subsample == 'target': |
17 ##this must be done before the main command because we don't know the total # reads until execution time | |
18 #if str($cond_subsample.seed) == '': | |
19 #set seed_expr="int(rand() * 32768)" | |
20 #else | |
21 #set seed_expr=$cond_subsample.seed | |
22 #end if | |
23 #if $input.is_of_type('sam'): | |
24 sample_fragment=`samtools view -c infile | awk '{s=\$1} END {frac=$cond_subsample.target/s; print(frac < 1 ? "-s " $seed_expr+frac : "")}'` && | |
25 #else | |
26 sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=$cond_subsample.target/s; print(frac < 1 ? "-s " $seed_expr+frac : "")}'` && | |
27 #end if | |
28 #end if | |
15 ##call samtools view | 29 ##call samtools view |
16 samtools view | 30 samtools view |
17 -@ \$addthreads | 31 -@ \$addthreads |
18 | 32 |
19 #if $outtype == 'count': | 33 #if $outtype == 'count': |
60 #end if | 74 #end if |
61 #for $i, $s in enumerate($cond_filter.readtags) | 75 #for $i, $s in enumerate($cond_filter.readtags) |
62 -x '${s.readtag}' | 76 -x '${s.readtag}' |
63 #end for | 77 #end for |
64 #end if | 78 #end if |
65 #if $cond_subsample.select_subsample == 'yes': | 79 #if $cond_subsample.select_subsample != 'no': |
66 #set fraction=str($cond_subsample.subsample).split('.')[1] | 80 #if $cond_subsample.select_subsample == "target": |
67 #if str($cond_subsample.seed) == '': | 81 ##this is calculated at execution time before the main samtools command |
68 -s "\${RANDOM}".$fraction | 82 "\${sample_fragment}" |
69 #else | 83 #else |
70 -s $cond_subsample.seed.$fraction | 84 #set fraction=str($cond_subsample.fraction).split('.')[1] |
85 #if str($cond_subsample.seed) == '': | |
86 -s "\${RANDOM}".$fraction | |
87 #else | |
88 -s $cond_subsample.seed.$fraction | |
89 #end if | |
71 #end if | 90 #end if |
72 #end if | 91 #end if |
73 | 92 |
74 ## output options | 93 ## output options |
75 $adv_output.header | 94 $adv_output.header |
179 </when> | 198 </when> |
180 <when value="no"/> | 199 <when value="no"/> |
181 </conditional> | 200 </conditional> |
182 <conditional name="cond_subsample"> | 201 <conditional name="cond_subsample"> |
183 <param name="select_subsample" type="select" argument="-s" label="Subsample alignment"> | 202 <param name="select_subsample" type="select" argument="-s" label="Subsample alignment"> |
184 <option value="yes">Yes</option> | 203 <option value="fraction">Specify a fraction to keep</option> |
185 <option value="no" selected="True">No</option> | 204 <option value="target">Specify a target # of reads</option> |
205 <option value="no" selected="True">No downsampling</option> | |
186 </param> | 206 </param> |
187 <when value="yes"> | 207 <when value="fraction"> |
188 <param name="subsample" type="float" optional="False" value="0.5" min="0" max="1" label="Subsampling fraction" help="sets the fraction of templates/pairs to subsample." /> | 208 <param name="fraction" type="float" optional="False" value="0.5" min="0" max="1" label="Subsampling fraction" help="sets the fraction of templates/pairs to subsample." /> |
189 <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." /> | 209 <expand macro="seed_input" /> |
210 </when> | |
211 <when value='target'> | |
212 <param name="target" type="integer" optional="False" value="" min="0" label="Target # of reads" help="sets the target number of reads to subsample." /> | |
213 <expand macro="seed_input" /> | |
190 </when> | 214 </when> |
191 <when value="no"/> | 215 <when value="no"/> |
192 </conditional> | 216 </conditional> |
193 <conditional name="addref_cond"> | 217 <conditional name="addref_cond"> |
194 <param name="addref_select" type="select" label="Reference data"> | 218 <param name="addref_select" type="select" label="Reference data"> |
381 <conditional name="cond_region"> | 405 <conditional name="cond_region"> |
382 <param name="select_region" value="no"/> | 406 <param name="select_region" value="no"/> |
383 </conditional> | 407 </conditional> |
384 <output name="outputsam" file="sam_to_bam_out2.bam" ftype="bam" /> | 408 <output name="outputsam" file="sam_to_bam_out2.bam" ftype="bam" /> |
385 </test> | 409 </test> |
410 <!-- sampling options--> | |
411 <test> | |
412 <param name="input" value="test.sam" ftype="sam" /> | |
413 <param name="outtype" value="sam" /> | |
414 <conditional name="cond_subsample"> | |
415 <param name="select_subsample" value="target" /> | |
416 <param name="target" value="2" /> | |
417 </conditional> | |
418 <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="6" /> | |
419 </test> | |
420 <test> | |
421 <param name="input" value="test.sam" ftype="sam" /> | |
422 <param name="outtype" value="sam" /> | |
423 <conditional name="cond_subsample"> | |
424 <param name="select_subsample" value="target" /> | |
425 <param name="seed" value="7" /> | |
426 <param name="target" value="2" /> | |
427 </conditional> | |
428 <output name="outputsam" file="test_ds.sam" ftype="sam" compare="diff" lines_diff="4" /> | |
429 </test> | |
430 <test> | |
431 <param name="input" value="test.bam" ftype="bam" /> | |
432 <param name="outtype" value="bam" /> | |
433 <conditional name="cond_subsample"> | |
434 <param name="select_subsample" value="target" /> | |
435 <param name="seed" value="7" /> | |
436 <param name="target" value="2" /> | |
437 </conditional> | |
438 <output name="outputsam" file="test_ds.bam" ftype="bam" /> | |
439 </test> | |
440 <test> | |
441 <param name="input" value="test.bam" ftype="bam" /> | |
442 <param name="outtype" value="bam" /> | |
443 <conditional name="cond_subsample"> | |
444 <param name="select_subsample" value="fraction" /> | |
445 <param name="seed" value="7" /> | |
446 <param name="fraction" value=".2" /> | |
447 </conditional> | |
448 <output name="outputsam" file="test_ds.bam" ftype="bam" /> | |
449 </test> | |
386 </tests> | 450 </tests> |
387 <help> | 451 <help> |
388 **What it does** | 452 **What it does** |
389 | 453 |
390 Samtools view can: | 454 Samtools view can: |