view macros.xml @ 2:02afb5ea2fce draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit 1047dc0e36a1c28492d7cd1e860c89ecf3ba30c8
author iuc
date Thu, 27 Sep 2018 08:51:16 -0400
parents 6ade12d94f9a
children b91e0f76afe9
line wrap: on
line source

<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=str($addref_cond.ref)
            #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)
        #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>
    <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>