changeset 0:a30dd3c77b30 draft

planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
author jjohnson
date Wed, 30 Nov 2016 16:46:40 -0500
parents
children 6fb39843d37d
files macros.xml samtools_split_by_chrom.xml tool_dependencies.xml
diffstat 3 files changed, 138 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Wed Nov 30 16:46:40 2016 -0500
@@ -0,0 +1,71 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="1.2">samtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @misc{SAM_def,
+                title={Definition of SAM/BAM format},
+                url = {https://samtools.github.io/hts-specs/SAMv1.pdf},}
+            </citation>
+            <citation type="doi">10.1093/bioinformatics/btp352</citation>
+            <citation type="doi">10.1093/bioinformatics/btr076</citation>
+            <citation type="doi">10.1093/bioinformatics/btr509</citation>
+            <citation type="bibtex">
+                @misc{Danecek_et_al,
+                Author={Danecek, P., Schiffels, S., Durbin, R.},
+                title={Multiallelic calling model in bcftools (-m)},
+                url = {http://samtools.github.io/bcftools/call-m.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Durbin_VCQC,
+                Author={Durbin, R.},
+                title={Segregation based metric for variant call QC},
+                url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{Li_SamMath,
+                Author={Li, H.},
+                title={Mathematical Notes on SAMtools Algorithms},
+                url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
+            </citation>
+            <citation type="bibtex">
+                @misc{SamTools_github,
+                title={SAMTools GitHub page},
+                url = {https://github.com/samtools/samtools},}
+            </citation>
+        </citations>
+    </xml>
+    <xml name="version_command">
+        <version_command>echo $(samtools --version | head -n 1)", "$(samtools --version | grep -o -E "htslib.*?")</version_command>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error" />
+        </stdio>
+    </xml>
+    <token name="@no-chrom-options@">
+-----
+
+.. class:: warningmark
+
+**No options available? How to re-detect metadata**
+
+If you see a &quot;No options available&quot; within the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop down, you need to re-detect metadata for the dataset you are trying to process. To do this follow these steps:
+
+1. Click on the **pencil** icon adjacent to the dataset in the history
+2. A new menu will appear in the center pane of the interface
+3. Click **Datatype** tab
+4. Set **New Type** to **BAM**
+5. Click **Save**
+
+The medatada will be re-detected and you will be able to see the list of reference sequences in the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop-down.
+
+    </token>
+
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools_split_by_chrom.xml	Wed Nov 30 16:46:40 2016 -0500
@@ -0,0 +1,61 @@
+<tool id="samtools_split_by_chrom" name="Split BAM by Chromosome" version="2.0">
+  <description>into collection</description>
+  <macros>
+    <import>macros.xml</import>
+  </macros>
+  <!-- <code file="samtools_slice_options.py"/> -->
+  <expand macro="requirements"></expand>
+  <expand macro="stdio"></expand>
+  <expand macro="version_command"></expand>
+    <command>
+<![CDATA[
+    mkdir -p outputs &&
+    ln -s "${input_bam}" temp_input.bam &&
+    ln -s "${input_bam.metadata.bam_index}" temp_input.bam.bai 
+    #for $ref in str( $refs ).split(","):
+        && samtools view -@ \${GALAXY_SLOTS:-1} -bh inputs/temp_input.bam ${ref} |  
+        samtools sort -O bam -T sorted -@ \${GALAXY_SLOTS:-1} -o "outputs/${input_bam.name}.${ref}.bam" - 
+    #end for
+]]>
+    </command>
+    <inputs>
+        <param name="input_bam" format="bam" label="Select BAM dataset to slice" type="data" />
+        <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.">
+            <!-- The options tagset below extracts reference names from bam file metadata -->
+            <!-- This will not work with bed files with old style metadata. However this  -->
+            <!-- Can be easily fixed by re-deceting metadata on a bam dataset by clicking -->
+            <!-- The pencil icon and settind datatype to "bam"                            -->
+            <!-- This change has been commited in the following pull request:             -->
+            <!-- https://github.com/galaxyproject/galaxy/pull/107                         -->
+            <options>
+                <filter type="data_meta" ref="input_bam" key="reference_names" />
+            </options>
+        </param>
+    </inputs>
+    <outputs>
+        <collection name="output_collection" type='list' label="${input_bam.name} by chrom">
+          <discover_datasets pattern="(?P&lt;designation&gt;.+)\.bam" directory="outputs" ext='bam'/>
+        </collection>
+    </outputs>
+    <tests>
+        <test>
+            <param ftype="bam" name="input_bam" value="bam-slice-input.bam" />
+            <param name="refs" value="chrM" />
+            <output file="bam-slice-test2.bam" ftype="bam" name="output_bam" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+
+**What it does**
+
+Creates a dataset collection of BAM files, one per selected chromosome.
+
+This tool is based on ``samtools view`` command. 
+
+@no-chrom-options@
+
+]]>
+  </help>
+    <expand macro="citations"></expand>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Wed Nov 30 16:46:40 2016 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="samtools" version="1.2">
+        <repository changeset_revision="5b7172f9b230" name="package_samtools_1_2" owner="iuc" toolshed="https://testtoolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>