comparison samtools_slice_bam.xml @ 2:2b474ebbfc7d draft

Uploaded
author devteam
date Tue, 21 Apr 2015 17:37:49 -0400
parents 74a8d2d60258
children a4a10c7924d1
comparison
equal deleted inserted replaced
1:74a8d2d60258 2:2b474ebbfc7d
1 <tool id="samtools_slice_bam" name="Slice BAM" version="0.0.2"> 1 <tool id="samtools_slice_bam" name="Slice" version="2.0">
2 <description>by provided regions</description> 2 <description>BAM by genomic regions</description>
3 <requirements> 3 <macros>
4 <requirement type="package" version="0.1.19">samtools</requirement> 4 <import>macros.xml</import>
5 </requirements> 5 </macros>
6 <command interpreter="python">samtools_slice_bam.py 6 <!-- <code file="samtools_slice_options.py"/> -->
7 "${input_bam}" 7 <expand macro="requirements"></expand>
8 "${input_bam.metadata.bam_index}" 8 <expand macro="stdio"></expand>
9 "${input_interval}" 9 <expand macro="version_command"></expand>
10 "${output_bam}" 10 <command>
11 </command> 11 <![CDATA[
12 <inputs> 12 ln -s "${input_bam}" temp_input.bam &&
13 <param name="input_bam" type="data" format="bam" label="BAM file" /> 13 ln -s "${input_bam.metadata.bam_index}" temp_input.bam.bai &&
14 <param name="input_interval" type="data" format="bed" label="BED file" /> 14
15 </inputs> 15 #if str($slice_method.slice_method_selector) == "bed":
16 <outputs> 16
17 <data format="bam" name="output_bam"/> 17 samtools view -@ \${GALAXY_SLOTS:-1} -b -L "${input_interval}" -o unsorted_output.bam temp_input.bam &&
18 </outputs> 18
19 <tests> 19 #elif str($slice_method.slice_method_selector) == "chr":
20 <test> 20
21 <param name="input_bam" value="gatk/fake_phiX_reads_1.bam" ftype="bam" /> 21 samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam
22 <param name="input_interval" value="gatk/fake_phiX_variant_locations.bed" ftype="bed" /> 22 ${ ' '.join( map( lambda x:'"%s"' % ( x ), str( $slice_method.refs ).split(",") ) ) } &&
23 <output name="output_bam" file="gatk/fake_phiX_reads_1.bam" ftype="bam" /> 23
24 </test> 24 #elif str($slice_method.slice_method_selector) == "man":
25 </tests> 25
26 <help> 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
27 **What it does** 112 **What it does**
28 113
29 Accepts an input BAM file and an input BED file and creates an output BAM file containing only those alignments that overlap the provided BED intervals. 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**.
30 115
31 ------ 116 This tool is based on ``samtools view`` command.
32 117
33 **Citation** 118 @no-chrom-options@
34 119
35 For the underlying tool, please cite `Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R; 1000 Genome Project Data Processing Subgroup. The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009 Aug 15;25(16):2078-9. &lt;http://www.ncbi.nlm.nih.gov/pubmed/19505943&gt;`_ 120 ]]>
36
37 If you use this tool in Galaxy, please cite Blankenberg D, et al. *In preparation.*
38
39 </help> 121 </help>
122 <expand macro="citations"></expand>
40 </tool> 123 </tool>