annotate bamtools_split_ref.xml @ 0:a83b275f7c41 draft default tip

Uploaded
author jjohnson
date Mon, 19 Jun 2017 12:56:32 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
1 <tool id="bamtools_split_ref" name="Split BAM by Reference" version="2.4.0">
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
2 <description>into dataset list collection</description>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
3 <requirements>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
4 <requirement type="package" version="2.4.0">bamtools</requirement>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
5 </requirements>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
6 <command>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
7 <![CDATA[
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
8 ln -s '${input_bam}' 'localbam.bam' &&
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
9 ln -s '${input_bam.metadata.bam_index}' 'localbam.bam.bai' &&
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
10 bamtools split -reference
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
11 -in localbam.bam
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
12 -stub split_bam
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
13 ## Preserve order from metadata in the output collection
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
14 #import re
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
15 #set $name = $re.sub('\W','_',$re.sub('\.bam$','',$input_bam.name))
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
16 #if str($refs) != 'None':
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
17 #set $ref_list = ' '.join(str($refs).split(","))
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
18 #else
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
19 #set $ref_list = ' '.join([$re.sub('^.*__sq__(.+)__sq__.*$','\\1',n) if n.find('__sq__') >= 0 else n for n in str($input_bam.metadata.reference_names).split(',')])
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
20 #end if
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
21 && mkdir -p outputs
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
22 && (export I=0;
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
23 for i in $ref_list;
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
24 do I=\$((++I)); SN=`printf "split_bam.REF_%s.bam" "\$i"`;
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
25 if [ -e \$SN ]; then FN=`printf "outputs/split_bam%05d%s.%s.bam" \$((I)) '$name' "\$i"`; mv \$SN \$FN; fi;
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
26 done)
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
27 ]]>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
28 </command>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
29 <inputs>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
30 <param name="input_bam" type="data" format="bam" label="BAM dataset to split by reference"/>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
31 <param name="refs" type="select" optional="True" multiple="True" label="Select references (chromosomes and contigs) you would like to restrict bam to" >
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
32 <help><![CDATA[Click and type in the box above to see options. You can select multiple entries.
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
33 If "No options available" is displayed, you need to re-detect metadata on the input dataset.
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
34 ]]></help>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
35 <options>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
36 <filter type="data_meta" ref="input_bam" key="reference_names" />
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
37 </options>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
38 </param>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
39 </inputs>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
40 <outputs>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
41 <collection name="output_bams" type="list" label="${input_bam.name} Split List">
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
42 <discover_datasets pattern="split_bam\d*(?P&lt;designation&gt;.+)\.bam" ext="bam" directory="outputs" visible="false"/>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
43 </collection>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
44 </outputs>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
45 <tests>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
46 <test>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
47 <param name="input_bam" ftype="bam" value="bamtools-input2.bam"/>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
48 <output_collection name="output_bams" type="list">
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
49 <element name="bamtools_input2.chr1" file="bamtools_input2.chr1" compare="sim_size" delta="500" />
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
50 </output_collection>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
51 </test>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
52 </tests>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
53 <help>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
54 **What is does**
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
55
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
56 BAMTools split is a utility for splitting BAM files. It is based on BAMtools suite of tools by Derek Barnett (https://github.com/pezmaster31/bamtools).
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
57
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
58 -----
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
59
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
60 .. class:: warningmark
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
61
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
62 **DANGER: Multiple Outputs**
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
63
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
64 As described below, splitting a BAM dataset(s) on reference name or a tag value can produce very large numbers of outputs. Read below and know what you are doing.
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
65
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
66 -----
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
67
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
68 **How it works**
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
69
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
70 Split alignments by reference name into a dataset list collection. The collection will be in the same order as the input BAM references.
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
71
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
72 In cases of unfinished genomes with very large number of reference sequences (scaffolds)
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
73 it can generate thousands (if not millions) of output datasets.
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
74
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
75
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
76 -----
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
77
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
78 .. class:: infomark
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
79
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
80 **More information**
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
81
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
82 Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
83
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
84 </help>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
85 <citations>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
86 <citation type="doi">10.1093/bioinformatics/btr174</citation>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
87 </citations>
a83b275f7c41 Uploaded
jjohnson
parents:
diff changeset
88 </tool>