comparison samtools_slice_bam.xml @ 10:9a4c773fb90d draft

Uploaded
author jbrayet
date Wed, 25 Nov 2015 03:23:37 -0500
parents
children
comparison
equal deleted inserted replaced
9:96f453b29673 10:9a4c773fb90d
1 <tool id="samtools_slice_bam" name="Slice" version="2.0">
2 <description>BAM by genomic regions</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <!-- <code file="samtools_slice_options.py"/> -->
7 <expand macro="requirements"></expand>
8 <expand macro="stdio"></expand>
9 <expand macro="version_command"></expand>
10 <command>
11 <![CDATA[
12 ln -s "${input_bam}" temp_input.bam &&
13 ln -s "${input_bam.metadata.bam_index}" temp_input.bam.bai &&
14
15 #if str($slice_method.slice_method_selector) == "bed":
16
17 samtools view -@ \${GALAXY_SLOTS:-1} -b -L "${input_interval}" -o unsorted_output.bam temp_input.bam &&
18
19 #elif str($slice_method.slice_method_selector) == "chr":
20
21 samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam
22 ${ ' '.join( map( lambda x:'"%s"' % ( x ), str( $slice_method.refs ).split(",") ) ) } &&
23
24 #elif str($slice_method.slice_method_selector) == "man":
25
26 samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam
27
28 #for $region in $slice_method.regions:
29 "${region.chrom}:${region.start}-${region.end}"
30 #end for
31
32 &&
33
34 #end if
35
36 samtools sort -O bam -T sorted -@ \${GALAXY_SLOTS:-1} -o "${output_bam}" unsorted_output.bam
37 ]]>
38 </command>
39 <inputs>
40 <param name="input_bam" format="bam" label="Select BAM dataset to slice" type="data" />
41 <conditional name="slice_method">
42 <param name="slice_method_selector" type="select" label="How do you want to slice your dataset?">
43 <option value="bed">using a list of intervals from a BED dataset</option>
44 <option value="chr">by chromosomes/contigs present in the BAM dataset</option>
45 <option value="man">by chromosomes/contigs and coordinates</option>
46 </param>
47 <when value="bed">
48 <param format="bed" label="BED file" name="input_interval" type="data" help="BED datasets can be obtained using &quot;Get Data -> UCSC Main&quot; datasource."/>
49 </when>
50 <when value="chr">
51 <param name="refs" type="select" optional="False" multiple="True" label="Select references (chromosomes and contigs) you would like to restrict bam to" help="Click and type in the box above to see options. You can select multiple entries. If &quot;No options available&quot; is displayed, you need to re-detect metadata on the input dataset. See help section below.">
52
53 <!-- The options tagset below extracts reference names from bam file metadata -->
54 <!-- This will not work with bed files with old style metadata. However this -->
55 <!-- Can be easily fixed by re-deceting metadata on a bam dataset by clicking -->
56 <!-- The pencil icon and settind datatype to "bam" -->
57 <!-- This change has been commited in the following pull request: -->
58 <!-- https://github.com/galaxyproject/galaxy/pull/107 -->
59
60 <options>
61 <filter type="data_meta" ref="input_bam" key="reference_names" />
62 </options>
63 </param>
64 </when>
65 <when value="man">
66 <repeat name="regions" title="Regions" min="1">
67 <param name="chrom" type="select" optional="False" label="Select references (chromosomes and contigs) you would like to restrict bam to" help="Select chromosome/contig from the list. If &quot;No options available&quot; is displayed, you need to re-detect metadata on the input dataset. See help section below.">
68
69 <!-- See comments above -->
70
71 <options>
72 <filter type="data_meta" ref="input_bam" key="reference_names" />
73 </options>
74 </param>
75 <param name="start" type="integer" min="1" value="0" label="Enter START coordinate (1-based)"/>
76 <param name="end" type="integer" min="1" value="100" label="Enter END coordinate"/>
77 </repeat>
78
79
80 </when>
81 </conditional>
82
83 </inputs>
84 <outputs>
85 <data format="bam" name="output_bam" />
86 </outputs>
87 <tests>
88 <test>
89 <param ftype="bam" name="input_bam" value="bam-slice-input.bam" />
90 <param name="slice_method_selector" value="bed"/>
91 <param ftype="bed" name="input_interval" value="bam-slice.bed" />
92 <output file="bam-slice-test1.bam" ftype="bam" name="output_bam" />
93 </test>
94 <test>
95 <param ftype="bam" name="input_bam" value="bam-slice-input.bam" />
96 <param name="slice_method_selector" value="chr"/>
97 <param name="refs" value="chrM" />
98 <output file="bam-slice-test2.bam" ftype="bam" name="output_bam" />
99 </test>
100 <test>
101 <param ftype="bam" name="input_bam" value="bam-slice-input.bam" />
102 <param name="slice_method_selector" value="man"/>
103 <param name="chrom" value="chrM" />
104 <param name="start" value="1" />
105 <param name="end" value="1000" />
106 <output file="bam-slice-test3.bam" ftype="bam" name="output_bam" />
107 </test>
108 </tests>
109 <help>
110 <![CDATA[
111
112 **What it does**
113
114 Allows to restrict (slice) input BAM dataset to a list of intervals defined in a BED file, individual chromosomes, or manually set list of coordinates. BED datasets can be obtained from **Get Data -> UCSC Main**.
115
116 This tool is based on ``samtools view`` command.
117
118 @no-chrom-options@
119
120 ]]>
121 </help>
122 <expand macro="citations"></expand>
123 </tool>