annotate bamtools-split.xml.save @ 0:8c17ddca0eee draft

Uploaded
author jjohnson
date Mon, 15 May 2017 16:27:18 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
1 <tool id="bamSplit" name="Split" version="2.4.1">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
2 <description>BAM datasets on variety of attributes</description>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
3 <macros>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
4 <xml name="macro_output_type">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
5 <param name="output_type" type="select" label="output as">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
6 <option value="history_items">history items</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
7 <option value="dataset_collection">dataset_collection</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
8 </param>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
9 </xml>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
10 </macros>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
11 <requirements>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
12 <requirement type="package" version="2.4.0">bamtools</requirement>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
13 </requirements>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
14 <command>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
15 <![CDATA[
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
16 echo "BAM" > $report &&
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
17 #for $bam_count, $input_bam in enumerate( $input_bams ):
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
18 ln -s "${input_bam}" "localbam_${bam_count}.bam" &&
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
19 ln -s "${input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" &&
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
20 #end for
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
21 bamtools
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
22 split
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
23 #if str ( $analysis_type.analysis_type_selector ) == "-tag" :
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
24 ${analysis_type.analysis_type_selector} "${analysis_type.tag_name}"
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
25 #else
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
26 ${analysis_type.analysis_type_selector}
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
27 #end if
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
28 -stub split_bam
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
29 #for $bam_count, $input_bam in enumerate( $input_bams ):
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
30 -in "localbam_${bam_count}.bam"
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
31 #end for
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
32 #if str ( $analysis_type.analysis_type_selector ) == "-reference" and $analysis_type.output_type == "dataset_collection":
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
33 #import re
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
34 #set $name = $re.sub('\W','_',$re.sub('\.bam$','',$input_bams[0].name))
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
35 #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(',')])
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
36 && (export I=0;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
37 for i in $ref_list;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
38 do I=\$((++I)); SN=`printf "split_bam.REF_%s.bam" "\$i"`;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
39 if [ -e \$SN ];
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
40 then FN=`printf "split_bam%05d%s.%s.bam" \$((I)) "$name" "\$i"`;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
41 mv \$SN \$FN;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
42 fi;
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
43 done)
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
44 #end if
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
45 ]]>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
46 </command>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
47 <inputs>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
48 <param name="input_bams" type="data" format="bam" label="BAM dataset(s) to filter" min="1" multiple="True"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
49 <conditional name="analysis_type">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
50 <param name="analysis_type_selector" type="select" label="Split BAM dataset(s) by" help="See help below for explanation of each option">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
51 <option value="-mapped">Mapping status (-mapped)</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
52 <option value="-paired">Pairing status (-paired)</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
53 <option value="-reference">Reference name (-reference)</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
54 <option value="-tag">Specific tag (-tag)</option>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
55 </param>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
56 <when value="-mapped" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
57 <when value="-paired" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
58 <when value="-reference" >
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
59 <expand macro="macro_output_type" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
60 </when>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
61 <when value="-tag">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
62 <param name="tag_name" type="text" value="NM" label="Enter tag name here" help="For example, to split on NM tag enter &quot;NM&quot;"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
63 <expand macro="macro_output_type" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
64 </when>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
65 </conditional>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
66 </inputs>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
67 <outputs>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
68 <data format="txt" name="report" label="BAMSplitter Run" hidden="true">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
69 <discover_datasets pattern="split_bam\.(?P&lt;designation&gt;.+)\.bam" ext="bam" visible="true"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
70 <filter>analysis_type['analysis_type_selector'] in ('-mapped','-paired') or analysis_type['output_type'] != 'dataset_collection'</filter>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
71 </data>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
72 <collection name="output_bams" type="list" label="${input_bams[0].name} by ${analysis_type.analysis_type_selector.replace('-','')}">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
73 <discover_datasets pattern="split_bam\d*(?P&lt;designation&gt;.+)\.bam" ext="bam" visible="false"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
74 <filter>analysis_type['analysis_type_selector'] in ('-reference','-tag') and analysis_type['output_type'] == 'dataset_collection'</filter>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
75 </collection>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
76 </outputs>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
77 <tests>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
78 <test>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
79 <param name="input_bams" ftype="bam" value="bamtools-input1.bam"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
80 <param name="analysis_type_selector" value="-mapped"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
81 <output name="report">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
82 <assert_contents>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
83 <has_line line="BAM" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
84 </assert_contents>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
85 <discovered_dataset designation="MAPPED" file="bamtools-split-test1.bam" ftype="bam"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
86 </output>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
87 </test>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
88 <test>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
89 <param name="input_bams" ftype="bam" value="bamtools-input2.bam"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
90 <param name="analysis_type_selector" value="-reference"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
91 <param name="output_type" value="dataset_collection"/>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
92 <output_collection name="output_bams" type="list">
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
93 <element name="bamtools_input2.chr1" file="bamtools_input2.chr1" compare="sim_size" delta="500" />
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
94 </output_collection>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
95 </test>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
96
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
97 </tests>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
98 <help>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
99 **What is does**
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
100
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
101 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).
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
102
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
103 -----
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
104
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
105 .. class:: warningmark
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
106
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
107 **DANGER: Multiple Outputs**
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
108
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
109 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.
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
110
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
111 -----
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
112
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
113 **How it works**
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
114
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
115 The following options can be specified via "**Split BAM dataset(s) by**" dropdown::
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
116
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
117 Mapping status (-mapped) split mapped/unmapped and generate two output files
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
118 named (MAPPED) and (UNMAPPED) containing mapped and unmapped
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
119 reads, respectively.
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
120
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
121 Pairing status (-paired) split single-end/paired-end alignments and generate two output files
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
122 named (SINGLE_END) and (PAIRED_END) containing paired and unpaired
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
123 reads, respectively.
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
124
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
125 Reference name (-reference) split alignments by reference name. In cases of unfinished genomes with
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
126 very large number of reference sequences (scaffolds) it can generate
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
127 thousands (if not millions) of output datasets.
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
128
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
129 Specific tag (-tag) split alignments based on all values of TAG encountered. Choosing this
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
130 option from the menu will allow you to enter the tag name. As was the
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
131 case with the reference splitting above, this option can produce very
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
132 large number of outputs if a tag has a large number of unique values.
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
133
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
134 -----
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
135
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
136 .. class:: infomark
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
137
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
138 **More information**
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
139
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
140 Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
141
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
142 </help>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
143 <citations>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
144 <citation type="doi">10.1093/bioinformatics/btr174</citation>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
145 </citations>
8c17ddca0eee Uploaded
jjohnson
parents:
diff changeset
146 </tool>