view readmap.xml @ 19:675033bcb79e draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_sr_readmap_and_size_histograms commit b180f674d9a5c518bb03c3b7bee3d37de1fbb2e4
author drosofff
date Wed, 20 Dec 2017 19:24:55 -0500
parents 2aa7da2eb75d
children 45df4c72a780
line wrap: on
line source

<tool id="Readmap" name="Generate readmap and histograms from alignment files" version="1.2.7.3">
    <description>from sRbowtie aligment</description>
  <requirements>
        <requirement type="package" version="1.1.2=py27_0">bowtie</requirement>
        <requirement type="package" version="1.11.2=py27_0">numpy</requirement>
        <requirement type="package" version="0.11.2.1=py27_0">pysam</requirement>
        <requirement type="package" version="1.3.2=r3.3.2_0">r-optparse</requirement>
        <requirement type="package" version="0.6_28=r3.3.2_0">r-latticeextra</requirement>
        <requirement type="package" version="2.2.1=r3.3.2_0">r-gridextra</requirement>
        <requirement type="package" version="1.4.2=r3.3.2_0">r-reshape2</requirement>
  </requirements>
  <command><![CDATA[
        python2 $__tool_directory__/readmap.py
        #if $refGenomeSource.genomeSource == "history":
            --reference_fasta
            $refGenomeSource.ownFile ## index source
        #else:
            #silent reference= filter( lambda x: str( x[0] ) == str( $refGenomeSource.series[0].input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
            --reference_bowtie_index
            $reference
        #end if
            --output_readmap
        "$readmap_dataframe"
        --output_size_distribution
        "$size_distribution_dataframe"
        --minquery $minquery
        --maxquery $maxquery
        --input
        #for $i in $refGenomeSource.series
            $i.input
        #end for
        --ext
        #for $i in $refGenomeSource.series
            $i.input.ext
        #end for
        --label
        #for $i in $refGenomeSource.series
            "$i.input.name"
        #end for
        --normalization_factor
        #for $i in $refGenomeSource.series
            $i.norm
        #end for
        #if $gff:
            --gff
            $gff
        #end if
        ; Rscript '$__tool_directory__'/plot_size_readmap.r
        --readmap_tab "$readmap_dataframe"
        --size_distribution_tab "$size_distribution_dataframe"
        --readmap_pdf "$readmap_PDF"
        --size_distribution_pdf "$size_PDF"
        --combi_pdf "$combi_PDF"
        --title "$title"
        --xlabel "$xlabel"
        --ylabel "$ylabel"
        --yrange "$yrange"
        --rows_per_page "$rows_per_page"
    ]]>
</command>
    <inputs>
        <conditional name="refGenomeSource">
            <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
                <option value="indexed">Use a built-in index</option>
                <option value="history">Use one from the history</option>
            </param>
            <when value="indexed">
                <repeat name="series" title="Add alignment files">
                    <param name="input" type="data" label="Select multiple alignments to parse" format="tabular,sam,bam">
                        <validator type="dataset_metadata_in_data_table" table_name="bowtie_indexes" metadata_name="dbkey" metadata_column="0" message="database not set for this bowtie output. Select the database(=genome used for matching) manually, or select a reference fasta from your history."/>
                    </param>
                    <param name="norm" type="float" value="1" label="Indicate a normalization factor to compare multiple aligments"/>
                </repeat>
            </when>
            <when value="history">
                <param name="ownFile" type="data" format="fasta" label="Select a fasta file, that served as the reference index for the alignments" />
                <repeat name="series" title="Add alignment files">
                    <param name="input" type="data" label="Select multiple alignments to parse" format="tabular,sam,bam"/>
                    <param name="norm" type="float" value="1" label="Indicate a normalization factor to compare multiple aligments"/>
                </repeat>
            </when>
        </conditional>
        <param name="gff" type="data" format="gff3" optional="true" label="Optional: select a GFF to investigate regions of interest" help="GFF must match genome build"/>
        <!-- <validator type="dataset_metadata_in_data_table" table_name="bowtie_indexes" metadata_name="dbkey" metadata_column="0" message="GFF database and alignment file databse do not match!"/> -->
        <param name="minquery" type="integer" size="3" value="18" label="Min size of query small RNAs" help="'18' = 18 nucleotides"/>
        <param name="maxquery" type="integer" size="3" value="28" label="Max size of query small RNAs" help="'28' = 28 nucleotides"/>
        <param name="title" type="text" size="15" value= "Readmaps and size distributions" label="Main Titles"/>
        <param name="xlabel" type="text" size="15" value="Coordinates/read size" label="x axis label"/>
        <param name="ylabel" type="text" size="15" value="Number of reads" label="y axis label"/>
        <param name="yrange" type="integer" size="3" value="0" label="y axis range for readmaps. 0 means auto-scaling."/>
        <param name="rows_per_page" type="text" size="9" value="8" label="How many items to display per page?">
            <validator type="in_range" min="6" max="20" message="Select between 6 and 20 rows, as the readability will suffer otherwise."/>
        </param>
    </inputs>
    <outputs>
        <data format="tabular" name="readmap_dataframe" label="Readmap dataframe"/>
        <data format="tabular" name="size_distribution_dataframe" label="Size distribution dataframe"/>
        <data format="pdf" name="readmap_PDF" label="Readmaps"/>
        <data format="pdf" name="size_PDF" label="Size distribution"/>
        <data format="pdf" name="combi_PDF" label="Size distribution and Readmaps"/>
    </outputs>
    <help>

**What it does**

Takes one or more alignment files (BAM, SAM or tabular bowtie output) as input and produces a "Readmap",
where by default for each "chromosome" the position of the read is recorded on the x-axis, and the y-axis indicates
the number of reads per position. Reads that map in sense are on the top, reads that map antisense are on the bottom.


.. class:: warningmark

'''TIP''' The input data can be produced using the sRbowtie tool.

----

'''Example'''

Query sequence::
For a SAM file as the following:

5	16	2L_79	24393	255	17M	*	0	0	CCTTCATCTTTTTTTTT	IIIIIIIIIIIIIIIII	XA:i:0	MD:Z:17	NM:i:0

11	0	2R_1	12675	255	21M	*	0	0	AAAAAAAACGCGTCCTTGTGC	IIIIIIIIIIIIIIIIIIIII	XA:i:0	MD:Z:21	NM:i:0

2	16	2L_5	669	255	23M	*	0	0	TGTTGCTGCATTTCTTTTTTTTT	IIIIIIIIIIIIIIIIIIIIIII	XA:i:0	MD:Z:23	NM:i:0

produce a plot like this:

----

.. image:: static/images/readmap.png
:height: 800
:width: 500
    </help>
    <tests>
        <test>
            <param name="genomeSource" value="history" />
            <param name="ownFile" value ="transposons.fasta" ftype="fasta" />
            <param name="series_0|input" value="sample1.srbowtie_out" ftype="tabular"/>
            <param name="series_0|norm" value="1" />
            <param name="series_1|input" value="sample2.srbowtie_out" ftype="tabular"/>
            <param name="series_1|norm" value="1" />
            <param name="series_2|input" value="sample3.srbowtie_out" ftype="tabular"/>
            <param name="series_2|norm" value="1" />
            <param name="minquery" value="20" />
            <param name="maxquery" value="30" />
            <param name="title" value="Readmaps and size distributions" />
            <param name="xlabel" value="Coordinates/read size" />
            <param name="ylabel" value="Number of reads" />
            <param name="rows_per_page" value="8" />
            <output name="readmap_dataframe" ftype="tabular" file="Readmap_dataframe.tab" />
            <output name="size_distribution_dataframe" ftype="tabular" file="Size_distribution_dataframe.tab" />
        </test>
    </tests>
</tool>