annotate samtools_split_by_chrom.xml @ 1:6fb39843d37d draft default tip

planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
author jjohnson
date Wed, 22 Mar 2017 17:22:35 -0400
parents a30dd3c77b30
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
1 <tool id="samtools_split_by_chrom" name="Split BAM by Chromosome" version="2.0">
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
2 <description>into collection</description>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
3 <macros>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
4 <import>macros.xml</import>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
5 </macros>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
6 <!-- <code file="samtools_slice_options.py"/> -->
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
7 <expand macro="requirements"></expand>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
8 <expand macro="stdio"></expand>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
9 <expand macro="version_command"></expand>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
10 <command>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
11 <![CDATA[
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
12 #import re
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
13 #set $name = $re.sub('\.bam$','',$input_bam.name)
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
14 #if str($refs) != 'None':
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
15 #set ref_list = str($refs).split(",")
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
16 #else
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
17 #set ref_list = [$re.sub('^.*__sq__(.+)__sq__.*$','\\1',n) if n.find('__sq__') >= 0 else n for n in str($input_bam.metadata.reference_names).split(',')]
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
18 #end if
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
19 mkdir -p outputs &&
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
20 ln -s "${input_bam}" temp_input.bam &&
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
21 ln -s "${input_bam.metadata.bam_index}" temp_input.bam.bai
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
22 #for $i,$ref in enumerate($ref_list):
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
23 #set $idx = "%04d" % $i
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
24 && samtools view -@ \${GALAXY_SLOTS:-1} -bh temp_input.bam ${ref} |
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
25 samtools sort -O bam -T sorted -@ \${GALAXY_SLOTS:-1} -o "outputs/${idx}-${name}.${ref}.bam" -
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
26 #end for
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
27 && ls -l outputs | awk '/bam/{fname = substr(\$NF,6); printf("%s\t%d\n", fname, \$5)}' > "ls_split_files"
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
28 ]]>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
29 </command>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
30 <inputs>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
31 <param name="input_bam" format="bam" label="Select BAM dataset to slice" type="data" />
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
32 <param name="refs" type="select" optional="True" 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.">
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
33 <options>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
34 <filter type="data_meta" ref="input_bam" key="reference_names" />
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
35 </options>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
36 </param>
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
37 <param name="show_listing" type="boolean" truevalue="yes" falsevalue="no" checked="false" label="show listing"/>
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
38 </inputs>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
39 <outputs>
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
40 <data format="tabular" name="listing" from_work_dir="ls_split_files">
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
41 <filter>show_listing</filter>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
42 <actions>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
43 <action name="column_names" type="metadata" default="name,size" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
44 </actions>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
45 </data>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
46 <collection name="output_collection" type="list" label="${input_bam.name} by chrom">
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
47 <discover_datasets pattern="\d+-(?P&lt;designation&gt;.*\.bam)" directory="outputs" format="bam" ext="bam" visible="false"/>
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
48 </collection>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
49 </outputs>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
50 <tests>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
51 <test>
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
52 <param ftype="bam" name="input_bam" value="test.bam" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
53 <param name="show_listing" value="True" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
54 <output file="listing">
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
55 <assert_contents>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
56 <has_text expression="chr1" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
57 <has_text expression="chr2" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
58 </assert_contents>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
59 </output>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
60 </test>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
61 <test>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
62 <param ftype="bam" name="input_bam" value="test.bam" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
63 <param name="refs" value="chr1,chr3" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
64 <param name="show_listing" value="True" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
65 <output file="listing">
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
66 <assert_contents>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
67 <has_text expression="chr1" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
68 <not_has_text expression="chr2" />
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
69 </assert_contents>
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
70 </output>
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
71 </test>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
72 </tests>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
73 <help>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
74 <![CDATA[
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
75
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
76 **What it does**
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
77
1
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
78 Splits an input BAM dataset to a dataset collection of individual chromosome bam files.
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
79
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
80 This dataset collection can be passed to a galaxy tool that takes a single bam input
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
81 in order to split the bam processing across multiple jobs.
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
82
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
83 A suggested use case:
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
84
6fb39843d37d planemo upload commit f3f0bef4a450aafab3c6b05a27647471f93b22f3
jjohnson
parents: 0
diff changeset
85 hisat -> samtools_split_by_chrom => bcftools_mpileup => bcftools_call => bcftools_merge -> snpEff
0
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
86
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
87 This tool is based on ``samtools view`` command.
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
88
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
89 ]]>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
90 </help>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
91 <expand macro="citations"></expand>
a30dd3c77b30 planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
jjohnson
parents:
diff changeset
92 </tool>