view sam_dump.xml @ 40:8848455c0270 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sra-tools commit 7632986831e24fcd189a57d824b9e6b1d5dc5c4c
author iuc
date Mon, 26 Aug 2024 14:59:28 +0000
parents 9a776b080193
children
line wrap: on
line source

<tool id="sam_dump" name="Download and Extract Reads in BAM" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>format from NCBI SRA</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="edam_ontology"/>
    <expand macro="bio_tools"/>
    <expand macro="requirements"/>
    <version_command>sam-dump --version | tr -d $'\n'</version_command>
    <command detect_errors="exit_code"><![CDATA[
        @COPY_CONFIGFILE@
        @SET_ACCESSIONS@

        ## Do not use prefetch if region is specified, to avoid downloading
        ## the complete sra file.

        #if $input.input_select == "sra_file":
            sam-dump --log-level fatal  --accession '\$acc'
        #else:
            #if ( str( $adv.region ) == "" ):
                prefetch -X 200000000 "\$acc" &&
            #end if
            sam-dump --log-level fatal --disable-multithreading
        #end if

        #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
        --header
        #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
        "\$acc"

        #if str( $outputformat ) == "bam":
            | samtools view -Sb - 2> /dev/null > "\$acc.bam"
        #elif str( $outputformat ) == "sam":
            > "\$acc.sam"
        #end if
        
        #if $input.input_select != "sra_file":
            ); done;
        #end if
        echo "Done with all accessions."
        ]]>
    </command>
    <expand macro="configfile_hack"/>
    <inputs>
        <expand macro="input_conditional"/>
        <param name="outputformat" type="select" display="radio" label="select output format" help="In vast majority of cases you want to download data in bam format. It is more compact and is accepted by all downstream tools.">
            <option value="bam">bam</option>
            <option value="sam">sam</option>
        </param>
        <section name="adv" title="Advanced Options" expanded="False">
            <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>
        <collection name="output_collection" type="list" label="sam-dump: Downloaded SAM/BAM data">
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.bam" directory="." ext='bam'/>
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.sam" directory="." ext='sam'/>
        </collection>
    </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_collection name="output_collection" type="list" count="1">
                <element name="SRR925743" file="SRR925743_sam_dump_result.sam" compare="contains" ftype="sam"/>
            </output_collection>
        </test>
        <test>
            <param name="input_select" value="accession_number"/>
            <param name="accession" value="SRR925743,SRR522874"/>
            <param name="outputformat" value="sam"/>
            <param name="region" value="17:41243452-41277500"/>
            <output_collection name="output_collection" type="list" count="2">
                <element name="SRR522874" file="SRR522874_sam_dump_result.sam" compare="contains" ftype="sam"/>
                <element name="SRR925743" file="SRR925743_sam_dump_result.sam" compare="contains" ftype="sam"/>
            </output_collection>
        </test>
    </tests>
    <help><![CDATA[

**What it does?**

This tool extracts data (in BAM_ format) from the Short Read Archive (SRA) at the National Center for Biotechnology Information (NCBI). It is based on the sam-dump_ utility of the SRA Toolkit and returns a collection of NGS data containing one file for each accession number provided.


@HOW_TO_USE_IT@

@ACCESSION_LIST_HOWTO@

-----

.. _sam-dump: https://github.com/ncbi/sra-tools
.. _BAM: https://samtools.github.io/hts-specs/SAMv1.pdf
.. _collection: https://galaxyproject.org/tutorials/collections/
.. _link: https://trace.ncbi.nlm.nih.gov/Traces/index.html?view=run_browser&display=reads

@SRATOOLS_ATTRRIBUTION@
    ]]></help>
    <expand macro="citation"/>
</tool>