changeset 0:09470ab960f1 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/bamtools/bamtools_split commit 1cacd14cfb2429fefa91fdd05c82d2e36d23283a"
author iuc
date Sat, 27 Nov 2021 10:03:33 +0000
parents
children 9dbf707bebb0
files bamtools_split_ref.xml macros.xml test-data/bamtools-input-paired.bam test-data/bamtools-input-tags.bam test-data/bamtools-input1.bam test-data/bamtools-input2.bam test-data/bamtools-split-test1.bam test-data/bamtools_input2.chr1 test-data/bamtools_input_tags.TAG_XG_N.bam test-data/bamtools_input_tags.TAG_XG_V.bam test-data/split_bam.MAPPED.bam test-data/split_bam.PAIRED_END.bam test-data/split_bam.SINGLE_END.bam test-data/split_bam.UNMAPPED.bam
diffstat 14 files changed, 105 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bamtools_split_ref.xml	Sat Nov 27 10:03:33 2021 +0000
@@ -0,0 +1,89 @@
+<tool id="bamtools_split_ref" name="Split BAM by Reference" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
+    <description>into dataset list collection</description>
+    <macros>
+          <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <command>
+        <![CDATA[
+            ln -s '${input_bam}' 'localbam.bam' &&
+            ln -s '${input_bam.metadata.bam_index}' 'localbam.bam.bai' &&
+            bamtools split -reference
+            -in localbam.bam
+            -stub split_bam
+            ## Preserve order from metadata in the output collection
+            #import re
+            #set $name = $re.sub('\W','_',$re.sub('\.bam$','',$input_bam.name))
+            #if str($refs) != 'None':
+                #set $ref_list = ' '.join(str($refs).split(","))
+            #else
+                #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(',')])
+            #end if
+            && mkdir -p outputs
+            && (export I=0;
+              for i in $ref_list;
+                do I=\$((++I)); SN=`printf "split_bam.REF_%s.bam" "\$i"`;
+                  if [ -e \$SN ]; then FN=`printf "outputs/split_bam%05d%s.%s.bam" \$((I)) '$name' "\$i"`; mv \$SN \$FN; fi;
+                done)
+        ]]>
+    </command>
+    <inputs>
+        <param name="input_bam" type="data" format="bam" label="BAM dataset to split by reference"/>
+        <param name="refs" type="select" optional="True" multiple="True" label="Select references (chromosomes and contigs) you would like to restrict bam to" >
+            <help><![CDATA[Click and type in the box above to see options. You can select multiple entries.
+                  If "No options available" is displayed, you need to re-detect metadata on the input dataset.
+            ]]></help>
+            <options>
+                <filter type="data_meta" ref="input_bam" key="reference_names" />
+            </options>
+        </param>
+    </inputs>
+    <outputs>
+        <collection name="output_bams" type="list" label="${input_bam.name} Split List">
+            <discover_datasets pattern="split_bam\d*(?P&lt;designation&gt;.+)\.bam" ext="bam" directory="outputs" visible="false"/>
+        </collection>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input_bam" ftype="bam" value="bamtools-input2.bam"/>
+            <output_collection name="output_bams"  type="list">
+                <element name="bamtools_input2.chr1"  file="bamtools_input2.chr1" compare="sim_size" delta="500" />
+            </output_collection>
+        </test>
+    </tests>
+    <help>
+**What is does**
+
+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).
+
+-----
+
+.. class:: warningmark
+
+**DANGER: Multiple Outputs**
+
+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.
+
+-----
+
+**How it works**
+
+Split alignments by reference name into a dataset list collection.  The collection will be in the same order as the input BAM references.
+
+In cases of unfinished genomes with very large number of reference sequences (scaffolds)
+it can generate thousands (if not millions) of output datasets.
+
+
+-----
+
+.. class:: infomark
+
+**More information**
+
+Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki
+
+    </help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/btr174</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Sat Nov 27 10:03:33 2021 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<macros>
+    <token name="@TOOL_VERSION@">2.5.1</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">bamtools</requirement>
+            <requirement type="package" version="1.4.1">samtools</requirement>
+        </requirements>
+    </xml>
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1093/bioinformatics/btr174</citation>
+        </citations>
+    </xml>
+</macros>
\ No newline at end of file
Binary file test-data/bamtools-input-paired.bam has changed
Binary file test-data/bamtools-input-tags.bam has changed
Binary file test-data/bamtools-input1.bam has changed
Binary file test-data/bamtools-input2.bam has changed
Binary file test-data/bamtools-split-test1.bam has changed
Binary file test-data/bamtools_input2.chr1 has changed
Binary file test-data/bamtools_input_tags.TAG_XG_N.bam has changed
Binary file test-data/bamtools_input_tags.TAG_XG_V.bam has changed
Binary file test-data/split_bam.MAPPED.bam has changed
Binary file test-data/split_bam.PAIRED_END.bam has changed
Binary file test-data/split_bam.SINGLE_END.bam has changed
Binary file test-data/split_bam.UNMAPPED.bam has changed