changeset 0:87398ae795c7 draft

Uploaded
author devteam
date Tue, 21 Apr 2015 16:00:31 -0400
parents
children 88b8c2916784
files macros.xml samtools_idxstats.xml test-data/phiX.bam test-data/samtools_idxstats_out.tabular tool_dependencies.xml
diffstat 5 files changed, 150 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Tue Apr 21 16:00:31 2015 -0400
@@ -0,0 +1,70 @@
+<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>samtools --version | head -n 1 | awk '{ print $2 }'</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_idxstats.xml	Tue Apr 21 16:00:31 2015 -0400
@@ -0,0 +1,72 @@
+<tool id="samtools_idxstats" name="IdxStats" version="2.0">
+    <description>tabulate mapping statistics for BAM dataset</description>
+    <macros>
+      <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"></expand>
+    <expand macro="stdio"></expand>
+    <expand macro="version_command"></expand>
+    <command><![CDATA[
+if [ ! -f "${input}.bai" ] ; then
+    ln -s "${input}" input.bam ;
+    samtools sort -o sorted.bam -O bam -T sts "${input}" ;
+    samtools index sorted.bam ;
+    samtools idxstats sorted.bam > "${output}" ;
+else
+    samtools idxstats "${input}" > "${output}" ;
+fi]]>
+    </command>
+    <inputs>
+        <param name="input" type="data" format="bam" label="BAM file" />
+    </inputs>
+    <outputs>
+        <data format="tabular" name="output" label="${tool.name} on ${on_string}" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="phiX.bam" ftype="bam" />
+            <output name="output" file="samtools_idxstats_out.tabular" compare="diff" ftype="tabular" />
+        </test>
+    </tests>
+    <help>
+<![CDATA[
+**What it does**
+
+Runs the ``samtools idxstats`` command. It retrieves and prints stats in the index file.
+
+Input is a sorted and indexed BAM file, the output is tabular with
+four columns (one row per reference sequence plus a final line for
+unmapped reads)::
+
+ Column Description
+ ------ -----------------------------
+      1 Reference sequence identifier
+      2 Reference sequence length
+      3 Number of mapped reads
+      4 Number of placed but unmapped reads
+           (typically unmapped partners of mapped reads)
+
+------
+
+**Example** output from a *de novo* assembly::
+
+ contig_1   170035  98397     0
+ contig_2   403835 199564     0
+ contig_3   553102 288189     0
+ ...           ...    ...   ...
+ contig_603    653     50     0
+ contig_604    214      6     0
+ \*              0      0 50320
+
+
+In this example there were 604 contigs, each with one line in the output table,
+plus the final row (labelled with an asterisk) representing 50320 unmapped reads.
+In this BAM file, the final column was otherwise zero.
+
+------
+
+Peter J.A. Cock (2013), `Galaxy wrapper <https://github.com/peterjc/pico_galaxy/tree/master/tools/samtools_idxstats>`_ for the samtools idxstats command
+]]>
+    </help>
+    <expand macro="citations"></expand>
+</tool>
Binary file test-data/phiX.bam has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/samtools_idxstats_out.tabular	Tue Apr 21 16:00:31 2015 -0400
@@ -0,0 +1,2 @@
+phiX174	5386	972	18
+*	0	0	10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Tue Apr 21 16:00:31 2015 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="samtools" version="1.2">
+        <repository changeset_revision="6eea04363026" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>