comparison downsample.xml @ 0:20823bce09e7 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/downsample commit dd00e60bdbb1fb45d395bb59dd60795e39867624
author dave
date Tue, 24 Sep 2019 16:20:27 -0400
parents
children 03aeb837e398
comparison
equal deleted inserted replaced
-1:000000000000 0:20823bce09e7
1 <?xml version="1.0"?>
2 <tool id="dynamic_downsample" name="Dynamically downsample" version="1.0.0">
3 <description>reads to desired coverage</description>
4 <requirements>
5 <requirement type="package" version="1.9">samtools</requirement>
6 <requirement type="package" version="5.0.1">gawk</requirement>
7 </requirements>
8 <command><![CDATA[
9 if FACTOR=\$(samtools depth '$reads' | awk '{ a[i++]=\$3; } END { x=int((i+1)/2); if (x < (i+1)/2) y=(a[x-1]+a[x])/2; else y=a[x-1]; f = 1/(y/$coverage) ; if (f >= 1) exit 1 ; else print f }') ;
10 then samtools view '$reads' -s \$FACTOR -O $reads.datatype -o '$output' ;
11 else ;
12 cp '$reads' '$output'
13 fi
14 ]]>
15 </command>
16 <inputs>
17 <param name="reads" type="data" format="sam,bam" label="Reads to downsample" />
18 <param name="coverage" type="integer" value="1000" label="Target coverage" />
19 </inputs>
20 <outputs>
21 <data format="bam" name="output" label="${tool.name} on ${on_string} (Downsampled to ${coverage}x coverage)">
22 <change_format>
23 <when input="reads" value="sam" format="sam" />
24 </change_format>
25 </data>
26 </outputs>
27 <tests>
28 </tests>
29 <help>
30 </help>
31 <citations>
32 </citations>
33 </tool>