view bamparse.xml @ 3:120eb76aa500 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/bamparse commit e8a19ac6ada887e6daa0a2e2abc9ba69392cdb8a
author artbio
date Mon, 17 Jul 2023 01:02:17 +0000
parents 8ea06787c08a
children 1997af8f4648
line wrap: on
line source

<tool id="bamparse" name="Count alignments" version="4.0.0">
    <description>in a BAM file</description>
    <requirements>
            <requirement type="package" version="0.21.0=py310h41dec4a_1">pysam</requirement>
            <requirement type="package" version="1.0=h98b6b92_0">sambamba</requirement>
            <requirement type="package" version="1.17=hd87286a_1">samtools</requirement>
    </requirements>
    <stdio>
        <exit_code range="1:" level="fatal" description="Tool exception" />
    </stdio>
    <command detect_errors="exit_code"><![CDATA[
        mkdir outputdir &&
        #if $polarity == 'sense':
            #set pol=' and not reverse_strand'
        #else if $polarity == 'antisense':
            #set pol=' and reverse_strand'
        #else:
            #set pol=''
        #end if
        #for $file in $input_list
           sambamba view -t \$GALAXY_SLOTS -F "not unmapped$pol" -f bam '$file' -o '$file.element_identifier' &&
           samtools index '$file.element_identifier' &&
        #end for
        python $__tool_directory__/bamparse.py
        --alignments
        #for $file in $input_list
            '$file.element_identifier'
        #end for
        --labels
        #for $file in $input_list
            '$file.element_identifier'
        #end for
        --number '$output_option'
 ]]></command>
    <inputs>
        <param name="input_list" type="data" format="bam" label="Select multiple alignments to parse" multiple="true"/>
        <param name="polarity" type="select" label="how to count sense and antisense reads">
            <option value="both">count both sense and antisense reads</option>
            <option value="sense">count only sense reads</option>
            <option value="antisense">count only antisense reads</option>
        </param>
        <param name="output_option" type="select" display="radio" label="Select the number of files for results"
               help="Results can be returned either as a single multi-column table or in separate two-column
               datasets (useful for DESeq subsequent analysis)">
                <option value="unique">A multi-column table</option> 
                <option value="multiple">One separate two-columns dataset per input bam alignment</option> 
        </param>
    </inputs>
    <outputs>
        <data name="output" format="tabular" label="Counts">
            <discover_datasets pattern="(?P&lt;designation&gt;.*)\.tabular" ext="tabular" visible="true" assign_primary_output="true" directory="outputdir"/>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input_list" value="alignment1.bam,alignment2.bam" ftype="bam" />
            <param name="polarity" value="both" />
            <param name="output_option" value="unique" />
            <output name="output" ftype="tabular" file="table.tabular" count="1"/>
        </test>
        <test>
            <param name="input_list" value="alignment1.bam,alignment2.bam" ftype="bam" />
            <param name="polarity" value="both" />
            <param name="output_option" value="multiple" />
            <output name="output" ftype="tabular" file="table0.tabular">
                <discovered_dataset designation="table1" ftype="tabular" file="table1.tabular" />
            </output>
        </test>
        <test>
            <param name="input_list" value="alignment1.bam,alignment2.bam" ftype="bam" />
            <param name="polarity" value="sense" />
            <param name="output_option" value="unique" />
            <output name="output" ftype="tabular" file="table.tabular" count="1"/>
        </test>
        <test>
            <param name="input_list" value="alignment1.bam,alignment2.bam" ftype="bam" />
            <param name="polarity" value="antisense" />
            <param name="output_option" value="unique" />
            <output name="output" ftype="tabular" file="table_antisense.tabular" count="1"/>
        </test>

        <test>
            <param name="input_list" value="input1.bam,input2.bam,input_new2.bam" ftype="bam" />
            <param name="polarity" value="both" />
            <param name="output_option" value="multiple" />
            <output name="output" ftype="tabular" file="more_table0.tabular">
                <discovered_dataset designation="table1" ftype="tabular" file="more_table1.tabular" />
                <discovered_dataset designation="table2" ftype="tabular" file="more_table2.tabular" />
            </output>
        </test>
        <test>
            <param name="input_list" value="input1.bam,input2.bam,input_new2.bam" ftype="bam" />
            <param name="polarity" value="sense" />
            <param name="output_option" value="unique" />
            <output name="output" ftype="tabular" file="more_sense_table.tabular" count="1"/>
        </test>
        <test>
            <param name="input_list" value="input1.bam,input2.bam,input_new2.bam" ftype="bam" />
            <param name="polarity" value="antisense" />
            <param name="output_option" value="unique" />
            <output name="output" ftype="tabular" file="more_antisense_table.tabular" count="1"/>
        </test>


    </tests>
    <help>

**What it does**

Counts the number of reads aligned to each reference (@SN, reference NAME) in one or
several BAM alignments.

Sense, antisense or both sense and antisense alignments can be counted

The library labels in the returned count table are taken from the input bam datasets
names in the Galaxy history.
    </help>
</tool>