changeset 29:9eee08ea613b draft

Uploaded
author scisjnu123
date Thu, 03 Oct 2019 12:17:38 -0400
parents 060c2129612f
children d1c6155aaf9e
files samtools/package_ncurses_5_9/tool_dependencies.xml samtools/package_samtools_1_2/tool_dependencies.xml samtools/package_zlib_1_2_8/tool_dependencies.xml samtools/samtools-sort/macros.xml samtools/samtools-sort/samtools_sort.xml samtools/samtools_sort/macros.xml samtools/samtools_sort/samtools_sort.xml
diffstat 7 files changed, 486 insertions(+), 110 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools/package_ncurses_5_9/tool_dependencies.xml	Thu Oct 03 12:17:38 2019 -0400
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="ncurses" version="5.9">
+        <install version="1.0">
+            <actions_group>
+                <actions os="linux" architecture="x86_64">
+                    <action type="download_by_url" sha256sum="9046298fb440324c9d4135ecea7879ffed8546dd1b58e59430ea07a4633f563b">http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz</action>
+                    <action type="download_file" sha256sum="c9033021022979a02621af43883e6ca5a4df14d2c3a5a821e4c67923d13d5e78">https://depot.galaxyproject.org/software/ncurses_patch/ncurses_patch_5.9p_src_all.patch</action>
+                    <action type="shell_command">
+                        patch ncurses/base/MKlib_gen.sh ncurses_patch_5.9p_src_all.patch
+                    </action>
+                    <action type="autoconf">--with-shared --enable-symlinks</action>
+                </actions>
+                <actions os="darwin" architecture="x86_64">
+                    <action type="download_by_url" sha256sum="9046298fb440324c9d4135ecea7879ffed8546dd1b58e59430ea07a4633f563b">http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz</action>
+                    <action type="download_file" sha256sum="c9033021022979a02621af43883e6ca5a4df14d2c3a5a821e4c67923d13d5e78">https://depot.galaxyproject.org/software/ncurses_patch/ncurses_patch_5.9p_src_all.patch</action>
+                    <action type="shell_command">
+                        patch ncurses/base/MKlib_gen.sh ncurses_patch_5.9p_src_all.patch
+                    </action>
+                    <action type="autoconf">--with-shared --enable-symlinks --without-cxx --without-cxx-binding --without-ada --without-progs --without-curses-h --without-debug --enable-widec --enable-const --enable-ext-colors --enable-sigwinch --enable-wgetch-events</action>
+                </actions>
+                <action type="set_environment">
+                    <environment_variable action="set_to" name="NCURSES_INCLUDE_PATH">$INSTALL_DIR/include</environment_variable>
+                    <environment_variable action="set_to" name="NCURSES_LIB_PATH">$INSTALL_DIR/lib/</environment_variable>
+                    <environment_variable action="set_to" name="NCURSES_ROOT_PATH">$INSTALL_DIR</environment_variable>
+                    <environment_variable action="prepend_to" name="LD_LIBRARY_PATH">$INSTALL_DIR/lib</environment_variable>
+                    <environment_variable action="prepend_to" name="DYLD_LIBRARY_PATH">$INSTALL_DIR/lib</environment_variable>
+                    <environment_variable action="prepend_to" name="LIBRARY_PATH">$INSTALL_DIR/lib</environment_variable>
+                    <environment_variable name="C_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include</environment_variable>
+                    <environment_variable name="CPLUS_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include</environment_variable>
+                    <environment_variable name="C_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include/ncurses</environment_variable>
+                    <environment_variable name="CPLUS_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include/ncurses</environment_variable>
+                </action>
+            </actions_group>
+        </install>
+        <readme>
+            ncurses (new curses) is a programming library that provides an API which allows the programmer
+            to write text-based user interfaces in a terminal-independent manner
+        </readme>
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools/package_samtools_1_2/tool_dependencies.xml	Thu Oct 03 12:17:38 2019 -0400
@@ -0,0 +1,81 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="ncurses" version="5.9">
+        <repository changeset_revision="5e1760c773ba" name="package_ncurses_5_9" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="zlib" version="1.2.8">
+        <repository changeset_revision="63a4a902cda2" name="package_zlib_1_2_8" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="samtools" version="1.2">
+        <install version="1.0">
+            <actions_group>
+                <actions architecture="x86_64" os="linux">
+                    <action type="download_by_url">http://depot.galaxyproject.org/package/linux/x86_64/samtools/samtools-1.2-Linux-x86_64.tgz</action>
+                    <action type="move_directory_files">
+                        <source_directory>.</source_directory>
+                        <destination_directory>$INSTALL_DIR</destination_directory>
+                    </action>
+                </actions>
+                <actions>
+                    <action type="download_by_url">https://github.com/samtools/samtools/releases/download/1.2/samtools-1.2.tar.bz2</action>
+                    <action type="set_environment_for_install">
+                        <repository changeset_revision="5e1760c773ba" name="package_ncurses_5_9" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu">
+                            <package name="ncurses" version="5.9" />
+                        </repository>
+                        <repository changeset_revision="63a4a902cda2" name="package_zlib_1_2_8" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu">
+                            <package name="zlib" version="1.2.8" />
+                        </repository>
+                    </action>
+                    <action type="shell_command">sed -i.bak 's#/usr/local#$INSTALL_DIR#' Makefile</action>
+                    <action type="shell_command">sed -i.bak -e 's/-lcurses/-lncurses/' Makefile</action>
+                    <action type="shell_command">sed -i.bak -e "s|CFLAGS=\s*-g\s*-Wall\s*-O2\s*|CFLAGS= -g -Wall -O2 -I$NCURSES_INCLUDE_PATH/ncurses/ -I$NCURSES_INCLUDE_PATH -L$NCURSES_LIB_PATH|g" Makefile</action>
+                    <action type="make_install" />
+                    <action type="move_file">
+                        <source>samtools</source>
+                        <destination>$INSTALL_DIR/bin</destination>
+                    </action>
+                </actions>
+                <action type="set_environment">
+                    <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
+                    <environment_variable action="set_to" name="SAMTOOLS_ROOT_PATH">$INSTALL_DIR</environment_variable>
+                </action>
+            </actions_group>
+        </install>
+        <readme>
+Program: samtools (Tools for alignments in the SAM format)
+Version: 1.2
+
+Usage:   samtools &lt;command&gt; [options]
+
+Commands:
+  -- indexing
+         faidx       index/extract FASTA
+         index       index alignment
+  -- editing
+         calmd       recalculate MD/NM tags and '=' bases
+         fixmate     fix mate information
+         reheader    replace BAM header
+         rmdup       remove PCR duplicates
+         targetcut   cut fosmid regions (for fosmid pool only)
+  -- file operations
+         bamshuf     shuffle and group alignments by name
+         cat         concatenate BAMs
+         merge       merge sorted alignments
+         mpileup     multi-way pileup
+         sort        sort alignment file
+         split       splits a file by read group
+         bam2fq      converts a BAM to a FASTQ
+  -- stats
+         bedcov      read depth per BED region
+         depth       compute the depth
+         flagstat    simple stats
+         idxstats    BAM index stats
+         phase       phase heterozygotes
+         stats       generate stats (former bamcheck)
+  -- viewing
+         flags       explain BAM flags
+         tview       text alignment viewer
+         view        SAM&lt;-&gt;BAM&lt;-&gt;CRAM conversion
+        </readme>
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools/package_zlib_1_2_8/tool_dependencies.xml	Thu Oct 03 12:17:38 2019 -0400
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="zlib" version="1.2.8">
+        <install version="1.0">
+            <actions>
+                <action type="download_by_url" sha256sum="36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d">https://depot.galaxyproject.org/software/zlib/zlib_1.2.8_src_all.tar.gz</action>
+                <action type="autoconf" />
+                <action type="set_environment">
+                    <environment_variable name="ZLIB_ROOT_PATH" action="set_to">$INSTALL_DIR</environment_variable>
+                    <environment_variable name="PKG_CONFIG_PATH" action="prepend_to">$INSTALL_DIR/lib/pkgconfig</environment_variable>
+                    <environment_variable name="LD_LIBRARY_PATH" action="prepend_to">$INSTALL_DIR/lib</environment_variable>
+                    <environment_variable name="LIBRARY_PATH" action="prepend_to">$INSTALL_DIR/lib</environment_variable>
+                    <environment_variable name="C_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include</environment_variable>
+                    <environment_variable name="CPLUS_INCLUDE_PATH" action="prepend_to">$INSTALL_DIR/include</environment_variable>
+                </action>
+            </actions>
+        </install>
+        <readme>
+            A Massively Spiffy Yet Delicately Unobtrusive Compression Library.
+            http://www.zlib.net/
+        </readme>
+    </package>
+</tool_dependency>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools/samtools-sort/macros.xml	Thu Oct 03 12:17:38 2019 -0400
@@ -0,0 +1,172 @@
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <token name="@TOOL_VERSION@">1.9</token>
+    <token name="@FLAGS@">#set $flags = sum(map(int, str($filter).split(',')))</token>
+    <token name="@PREPARE_IDX@"><![CDATA[
+        ##prepare input and indices 
+        ln -s '$input' infile &&
+        #if $input.is_of_type('bam'):
+            #if str( $input.metadata.bam_index ) != "None":
+                ln -s '${input.metadata.bam_index}' infile.bai &&
+            #else:
+                samtools index infile infile.bai &&
+            #end if
+        #elif $input.is_of_type('cram'):
+            #if str( $input.metadata.cram_index ) != "None":
+                ln -s '${input.metadata.cram_index}' infile.crai &&
+            #else:
+                samtools index infile infile.crai &&
+            #end if
+        #end if
+    ]]></token>
+    <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[
+        ##prepare input and indices 
+        #for $i, $bam in enumerate( $input_bams ):
+            ln -s '$bam' '${i}' &&
+            #if $bam.is_of_type('bam'):
+                #if str( $bam.metadata.bam_index ) != "None":
+                    ln -s '${bam.metadata.bam_index}' '${i}.bai' &&
+                #else:
+                    samtools index '${i}' '${i}.bai' &&
+                #end if
+            #elif $bam.is_of_type('cram'):
+                #if str( $bam.metadata.cram_index ) != "None":
+                    ln -s '${bam.metadata.cram_index}' '${i}.crai' &&
+                #else:
+                    samtools index '${i}' '${i}.crai' &&
+                #end if
+            #end if
+        #end for
+    ]]></token>
+    <token name="@PREPARE_FASTA_IDX@"><![CDATA[
+        ##checks for reference data ($addref_cond.addref_select=="history" or =="cached")
+        ##and sets the -t/-T parameters accordingly:
+        ##- in case of history a symbolic link is used because samtools (view) will generate
+        ##  the index which might not be possible in the directory containing the fasta file
+        ##- in case of cached the absolute path is used which allows to read the cram file
+        ##  without specifying the reference
+        #if $addref_cond.addref_select == "history":
+            ln -s '${addref_cond.ref}' reference.fa &&
+            samtools faidx reference.fa &&
+            #set reffa="reference.fa"
+            #set reffai="reference.fa.fai"
+        #elif $addref_cond.addref_select == "cached":
+            #set reffa=str($addref_cond.ref.fields.path)
+            #set reffai=str($addref_cond.ref.fields.path)+".fai"
+        #else
+            #set reffa=None
+            #set reffai=None
+        #end if
+    ]]></token>
+    <token name="@ADDTHREADS@"><![CDATA[
+        ##compute the number of ADDITIONAL threads to be used by samtools (-@)
+        addthreads=\${GALAXY_SLOTS:-1} && (( addthreads-- )) &&
+    ]]></token>
+    <token name="@ADDMEMORY@"><![CDATA[
+        ##compute the number of memory available to samtools sort (-m)
+        ##use only 75% of available: https://github.com/samtools/samtools/issues/831
+        addmemory=\${GALAXY_MEMORY_MB_PER_SLOT:-768} && 
+        ((addmemory=addmemory*75/100)) &&
+    ]]></token>
+    <xml name="seed_input">
+       <param name="seed" type="integer" optional="True" label="Seed for random number generator" help="If empty a random seed is used." /> 
+    </xml>
+    <xml name="flag_options">
+        <option value="1">read is paired</option>
+        <option value="2">read is mapped in a proper pair</option>
+        <option value="4">read is unmapped</option>
+        <option value="8">mate is unmapped</option>
+        <option value="16">read reverse strand</option>
+        <option value="32">mate reverse strand</option>
+        <option value="64">read is the first in a pair</option>
+        <option value="128">read is the second in a pair</option>
+        <option value="256">alignment or read is not primary</option>
+        <option value="512">read fails platform/vendor quality checks</option>
+        <option value="1024">read is a PCR or optical duplicate</option>
+        <option value="2048">supplementary alignment</option>
+    </xml>
+
+    <!-- region specification macros and tokens for tools that allow the specification 
+         of region by bed file / space separated list of regions -->
+    <token name="@REGIONS_FILE@"><![CDATA[
+        #if $cond_region.select_region == 'tab':
+            -t '$cond_region.targetregions'
+        #end if
+    ]]></token>
+    <token name="@REGIONS_MANUAL@"><![CDATA[
+        #if $cond_region.select_region == 'text':
+            #for $i, $x in enumerate($cond_region.regions_repeat):
+               '${x.region}'
+            #end for
+        #end if
+    ]]></token>
+    <xml name="regions_macro">
+        <conditional name="cond_region">
+            <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">
+                <option value="no" selected="True">No</option>
+                <option value="text">Manualy specify regions</option>
+                <option value="tab">Regions from tabular file</option>
+            </param>
+            <when value="no"/>
+            <when value="text">
+                <repeat name="regions_repeat" min="1" default="1" title="Regions">
+                    <param name="region" type="text" label="region" help="format chr:from-to">
+                        <validator type="regex" message="Required format: CHR[:FROM[-TO]]; where CHR: string containing any character except quotes, whitespace and colon; FROM and TO: any integer">^[^\s'\":]+(:\d+(-\d+){0,1}){0,1}$</validator>
+                    </param>
+                </repeat>
+            </when>
+            <when value="tab">
+                <param name="targetregions" argument="-t/--target-regions" type="data" format="tabular" label="Target regions file" help="Do stats in these regions only. Tab-delimited file chr,from,to (1-based, inclusive)" />
+            </when>
+        </conditional>
+    </xml>
+
+    <xml name="citations">
+        <citations>
+            <citation type="bibtex">
+                @misc{SAM_def,
+                title={Definition of SAM/BAM format},
+                url = {https://samtools.github.io/hts-specs/},}
+            </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><![CDATA[samtools 2>&1 | grep Version]]></version_command>
+    </xml>
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:" level="fatal" description="Error" />
+        </stdio>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samtools/samtools-sort/samtools_sort.xml	Thu Oct 03 12:17:38 2019 -0400
@@ -0,0 +1,169 @@
+<tool id="samtools_sort" name="Samtools sort" profile="18.01" version="2.0.3">
+    <description>order of storing aligned sequences</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"/>
+    <expand macro="stdio"/>
+    <expand macro="version_command"/>
+    <command><![CDATA[
+        @ADDTHREADS@
+	@ADDMEMORY@
+        samtools sort
+            -@ \$addthreads
+            -m \$addmemory"M"
+            ###if str(compression):
+            ##    -l '$compression'
+            ###end if
+            $prim_key_cond.prim_key_select
+            #if $prim_key_cond.prim_key_select == '-t':
+                $prim_key_cond.tag
+                $prim_key_cond.sec_key_select
+            #end if
+            -O bam
+            -T "\${TMPDIR:-.}"
+            '${input1}'
+             > '${output1}'
+    ]]></command>
+    <inputs>
+        <param name="input1" type="data" format="sam,unsorted.bam,cram" label="BAM File" />
+        <conditional name="prim_key_cond">
+            <param name="prim_key_select" type="select" label="Primary sort key">
+                <option value="">coordinate</option>
+                <option value="-n">name (-n)</option>
+                <option value="-t">tag (-t)</option>
+            </param>
+            <when value=""/>
+            <when value="-n"/>
+            <when value="-t">
+                <param name="tag" type="text" optional="false" argument="-t" label="Alignment tag"/>
+                <param name="sec_key_select" type="select" label="Secondary sort key">
+                    <option value="">coordinate</option>
+                    <option value="-n">name (-n)</option>
+                </param>
+           </when>
+        </conditional>
+        <!--<param name="compression" type="integer" argument="-l" optional="True" min="0" max="9" label="compression level" help="0 (uncompressed) to 9 (best)"/>-->
+    </inputs>
+    <outputs>
+       <data name="output1" format="bam">
+            <change_format>
+                <when input="prim_key_cond.prim_key_select" value="" format="bam" />
+                <when input="prim_key_cond.prim_key_select" value="-n" format="qname_sorted.bam" />
+                <when input="prim_key_cond.prim_key_select" value="-t" format="unsorted.bam" />
+            </change_format>
+        </data>
+    </outputs>
+    <tests>
+        <!-- tests from https://github.com/samtools/samtools/blob/9ce8c64493f7ea3fa69bc5c1ac980b1a8e3dcf1f/test/test.pl#L2464 -->
+        <!-- # Pos sort -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <output name="output1" file="pos.sort.expected.bam" ftype="bam"/>
+        </test>
+    	<!-- test_cmd($opts, out=>"sort/pos.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads}  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -"); -->
+
+        <!-- # Name sort -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="name.sort.expected.bam" ftype="qname_sorted.bam"/>
+        </test>
+	<!--    test_cmd($opts, out=>"sort/name.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (RG) (considers output and name sorted) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="RG"/>
+            </conditional>
+            <output name="output1" file="tag.rg.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.rg.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t RG  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (RG); secondary by name -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="RG"/>
+                <param name="sec_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="tag.rg.n.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.rg.n.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -n -t RG  $$opts{path}/dat/test_input_1_a.bam -O SAM -o -");-->
+
+        <!-- # Tag sort (AS) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="AS"/>
+                <param name="sec_key_select" value=""/>
+            </conditional>
+            <output name="output1" file="tag.as.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.as.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t AS $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
+
+        <!-- # Tag sort (FI) -->
+        <test>
+            <param name="input1" value="test_input_1_a.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-t"/>
+                <param name="tag" value="FI"/>
+            </conditional>
+            <output name="output1" file="tag.fi.sort.expected.bam" ftype="unsorted.bam"/>
+        </test>
+    <!--test_cmd($opts, out=>"sort/tag.fi.sort.expected.sam", cmd=>"$$opts{bin}/samtools sort${threads} -t FI $$opts{path}/dat/test_input_1_d.sam -O SAM -o -");-->
+
+        <!-- tests from old version -->
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <output name="output1" file="1_sort.bam" ftype="bam" sort="True"/>
+        </test>
+        <test>
+            <param name="input1" value="1.bam" ftype="bam" />
+            <conditional name="prim_key_cond">
+                <param name="prim_key_select" value="-n"/>
+            </conditional>
+            <output name="output1" file="1_sort_read_names.bam" ftype="qname_sorted.bam"/>
+        </test>
+    </tests>
+    <help>
+**What it does**
+
+Sort alignments by leftmost coordinates, or by read name when -n is used. 
+An appropriate @HD-SO sort order header tag will be added or an existing 
+one updated if necessary. 
+
+**Ordering Rules**
+
+The following rules are used for ordering records.
+
+If option -t is in use, records are first sorted by the value of the given
+alignment tag, and then by position or name (if using -n). For example, “-t RG”
+will make read group the primary sort key. The rules for ordering by tag are:
+
+- Records that do not have the tag are sorted before ones that do.
+- If the types of the tags are different, they will be sorted so that single
+  character tags (type A) come before array tags (type B), then string tags
+  (types H and Z), then numeric tags (types f and i).
+- Numeric tags (types f and i) are compared by value. Note that comparisons of
+  floating-point values are subject to issues of rounding and precision.
+- String tags (types H and Z) are compared based on the binary contents of the
+  tag using the C strcmp(3) function.
+- Character tags (type A) are compared by binary character value.
+- No attempt is made to compare tags of other types — notably type B array values will not be compared. 
+
+When the -n option is present, records are sorted by name. Names are compared so as to give a “natural” ordering — i.e. sections consisting of digits are compared numerically while all other sections are compared based on their binary representation. This means “a1” will come before “b1” and “a9” will come before “a10”. Records with the same name will be ordered according to the values of the READ1 and READ2 flags (see flags).
+
+When the -n option is not present, reads are sorted by reference (according to the order of the @SQ header records), then by position in the reference, and then by the REVERSE flag.
+
+This has now been removed. The previous out.prefix argument (and -f option, if any) should be changed to an appropriate combination of -T PREFIX and -o FILE. The previous -o option should be removed, as output defaults to standard output. 
+
+    </help>
+    <expand macro="citations"/>
+</tool>
--- a/samtools/samtools_sort/macros.xml	Thu Oct 03 11:27:47 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-<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>
--- a/samtools/samtools_sort/samtools_sort.xml	Thu Oct 03 11:27:47 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-<tool id="samtools_sort" name="Sort" version="2.0">
-    <description>BAM dataset</description>
-    <macros>
-    <import>macros.xml</import>
-  </macros>
-  <expand macro="requirements"></expand>
-    <expand macro="stdio"></expand>
-    <expand macro="version_command"></expand>
-    <command>samtools sort $sort_mode -@ \${GALAXY_SLOTS:-1} -o "${output1}" -O bam -T dataset "${input1}"</command>
-    <inputs>
-        <param name="input1" type="data" format="bam" label="BAM File" />
-        <param name="sort_mode" type="select" label="Sort by ">
-            <option value="" selected="True">Chromosomal coordinates</option>
-            <option value="-n">Read names (-n)</option>
-        </param>
-    </inputs>
-    <outputs>
-        <data name="output1" format="bam" />
-    </outputs>
-    <tests>
-        <test>
-            <param name="input1" value="1.bam" ftype="bam" />
-            <output name="output1" file="1_sort.bam" ftype="bam" sort="True"/>
-        </test>
-        <test>
-            <param name="input1" value="1.bam" ftype="bam" />
-            <param name="sort_mode" value="-n"/>
-            <output name="output1" file="1_sort_read_names.bam" ftype="bam" sort="True"/>
-        </test>
-    </tests>
-    <help>
-
-**What it does**
-
-This tool uses ``samtools sort`` command to sort BAM datasets in coordinate or read name order.
-
-
-    </help>
-    <expand macro="citations"></expand>
-</tool>