view samtools_split_by_chrom.xml @ 0:a30dd3c77b30 draft

planemo upload commit 7491208ca0c917a053798a48c3e54c3e30e95d92
author jjohnson
date Wed, 30 Nov 2016 16:46:40 -0500
parents
children 6fb39843d37d
line wrap: on
line source

<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>