view sam_dump.xml @ 0:9f74a22d2060 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/sra-tools commit 70fadb7e8972b1db550d0e067584930ce1ec8673-dirty
author mvdbeek
date Wed, 04 Nov 2015 06:57:32 -0500
parents
children
line wrap: on
line source

<tool id="sam_dump" name="Extract reads" version="1.2.4">
    <description>in SAM or BAM format from NCBI SRA.</description>
    <macros>
        <import>sra_macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <command>
        <![CDATA[
        ## Need to set the home directory to the current working directory,
        ## else the tool tries to write to home/.ncbi and fails when used 
        ## with a cluster manager. 
        export HOME=\$PWD;
        vdb-config --restore-defaults;
        vdb-config -s "/repository/user/main/public/root=\$PWD";
        ## Do not use prefetch if region is specified, to avoid downloading
        ## the complete sra file.
        #if ( str( $adv.region ) == "" ):
            ASCP_PATH=`which ascp`;
            ASCP_KEY=`dirname \$ASCP_PATH`/asperaweb_id_dsa.openssh;
            prefetch --ascp-path "\$ASCP_PATH|\$ASCP_KEY" "$input.accession";
        ##Duplicate vdb-config, in case settings changed between prefetch and
        ##dump command.
        #end if
        vdb-config -s "/repository/user/main/public/root=\$PWD";
        sam-dump --log-level fatal --disable-multithreading
        #if str( $adv.region ) != "":
        --aligned-region "$adv.region"
        #end if
        #if str( $adv.matepairDist ) != "":
        --matepair-distance "$adv.matepairDist"
        #end if
        #if str( $adv.minMapq ) != "":
        --min-mapq "$adv.minMapq"
        #end if
        #if str( $adv.header ) == "yes":
        --header
        #else:
        --no-header
        #end if
        #if str( $adv.alignments ) == "both":
        --unaligned
        #end if
        #if str( $adv.alignments ) == "unaligned":
        --unaligned-spots-only
        #end if
        #if (str( $adv.primary ) == "yes") and (str ( $adv.alignments != "unaligned") ):
        --primary
        #end if
        #if $input.input_select == "file":
        "$input.file"
        #elif $input.input_select == "accession_number":
        "$input.accession"
        #end if
        #if str( $outputformat ) == "bam":
            | samtools view -Sb - 2> /dev/null
        #end if
        #if $input.input_select == "file":
        > "$output_file"
        #elif $input.input_select == "accession_number":
        > "$output_accession"
        #end if
        ]]>
    </command>
    <version_string>sam-dump --version</version_string>
    <inputs>
        <expand macro="input_conditional"/>
        <param name="outputformat" type="select" label="select output format">
            <option value="bam">bam</option>
            <option value="sam">sam</option>
        </param>
        <section name="adv" title="Advanced Options" expanded="False">
            <param name="header" type="select" value="yes">
                <label>output header</label>
                <option value="yes">Yes</option>
                <option value="no">No</option>
            </param>
            <expand macro="alignments"/>
            <expand macro="region"/>
            <expand macro="matepairDist"/>
            <param name="primary" type="select" value="no">
                <label>only primary aligments</label>
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </param>
            <expand macro="minMapq"></expand>
        </section>
    </inputs>
    <outputs>
        <data name="output_accession" format="bam" label="${input.accession}.${outputformat}">
            <filter>input['input_select'] == "accession_number"</filter>
            <change_format>
                <when input="outputformat" value="sam" format="sam"/>
            </change_format>
        </data>
        <data name="output_file" format="bam" label="${input.file.name}.${outputformat}">
            <filter>input['input_select'] == "file"</filter>
            <change_format>
                <when input="outputformat" value="sam" format="sam"/>
            </change_format>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input_select" value="accession_number"/>
            <param name="accession" value="SRR925743"/>
            <param name="outputformat" value="sam"/>
            <param name="region" value="17:41243452-41277500"/>
            <output name="output_accession" file="sam_dump_result.sam" ftype="sam"/>
        </test>
    </tests>
    <help>
        This tool extracts reads from sra archives using sam-dump.
        The sam-dump program is developed at NCBI, and is available at
        http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=software.
        @SRATOOLS_ATTRRIBUTION@
    </help>
</tool>