view mircounts.xml @ 8:3f62272192f9 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 0eaefbad21786cabed6791a6d06e9a0de8af10b0
author artbio
date Mon, 23 Apr 2018 13:21:16 -0400
parents 65befdc9925a
children 2a08a6eb471c
line wrap: on
line source

<tool id="mircounts" name="miRcounts" version="1.2.0">
    <description> Counts miRNA alignments from small RNA sequence data</description>
    <requirements>
        <requirement type="package" version="1.18">gnu-wget</requirement>
        <requirement type="package" version="1.2.0">bowtie</requirement>
        <requirement type="package" version="1.6.0">samtools</requirement>
        <requirement type="package" version="0.11.2.2">pysam</requirement>
        <requirement type="package" version="1.3.2=r3.3.2_0">r-optparse</requirement>
        <requirement type="package" version="0.20_34=r3.3.2_0">r-lattice</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        wget --quiet ftp://mirbase.org/pub/mirbase/${mirbase_version}/genomes/${genomeKey}.gff3 && ## download the gff3 file specified by the variable genomeKey
        python '$__tool_directory__'/mature_mir_gff_translation.py --input ${genomeKey}.gff3 --output $gff3 && ## transcode the mature miR genome coordinates into coordinates relative to the corresponding "miRNA_primary_transcript".
        wget --quiet ftp://mirbase.org/pub/mirbase/${mirbase_version}/hairpin.fa.gz &&
        sh '$__tool_directory__'/format_fasta_hairpins.sh $genomeKey &&
        #if $cutadapt.cutoption == "yes":
            python '$__tool_directory__'/yac.py --input $cutadapt.input
                                                --output clipped_input.fastq
                                                --output_format fastq
                                                --adapter_to_clip $cutadapt.clip_source.clip_sequence
                                                --min $cutadapt.min
                                                --max $cutadapt.max
                                                --Nmode $cutadapt.Nmode &&
        #else
            ln -f -s '$cutadapt.clipped_input' clipped_input.fastq &&
        #end if
        bowtie-build hairpin.fa hairpin >/dev/null &&
        bowtie -v $v -M 1 --best --strata --norc -p \${GALAXY_SLOTS:-4} --sam hairpin -q clipped_input.fastq | samtools sort -O bam -o '$output' 2>&1 &&
        samtools index $output &&
        python '$__tool_directory__'/mircounts.py -pm --alignment $output --gff $gff3 --quality_threshold 10 --pre_mirs $pre_mir_count_file --mirs $mir_count_file --lattice $coverage_dataframe;
        #if $plotting.plottingOption == 'yes':
            Rscript '$__tool_directory__'/coverage_plotting.R --dataframe $coverage_dataframe --type $plotting.display --output $latticePDF
        #end if
    ]]></command>
    <inputs>
        <conditional name="cutadapt">
            <param label="Remove adapter sequence before aligning" name="cutoption" type="select">
                <option value="no">no</option>
                <option selected="True" value="yes">yes</option>
            </param>
            <when value="yes">
                <param format="fastq,fastqsanger" label="Source file" name="input" type="data" />
                <param label="min size" name="min" size="4" type="integer" value="15" help="Minimum size of accepted clipped reads" />
                <param label="max size" name="max" size="4" type="integer" value="36" help="Maximum size of accepted clipped reads"/>
                <param label="Accept reads containing N?" name="Nmode" type="select">
                    <option selected="True" value="accept">accept</option>
                    <option value="reject">reject</option>
                </param>
                <conditional name="clip_source">
                    <param help="Built-in adapters or User-provided" label="Source" name="clip_source_list" type="select">
                        <option selected="True" value="prebuilt">Use a built-in adapter (select from the list below)</option>
                        <option value="user">Use custom sequence</option>
                    </param>
                    <when value="prebuilt">
                        <param help="if your adapter is not listed, input your own sequence" label="Select Adapter to clip" name="clip_sequence" type="select">
                            <option value="TCGTATGCCGTCTTCTGCTTG">Solexa TCGTATGCCGTCTTCTGCTTG</option>
                            <option value="ATCTCGTATGCCGTCTTCTGCTT">Illumina ATCTCGTATGCCGTCTTCTGCTT</option>
                            <option selected="True" value="TGGAATTCTCGGGTGCCAAG">Illumina TruSeq  TGGAATTCTCGGGTGCCAAG</option>
                            <option value="CTGTAGGCACCATCAATCGT">IdT CTGTAGGCACCATCAATCGT</option>
                        </param>
                    </when>
                    <when value="user">
                        <param label="Enter your Sequence" name="clip_sequence" size="35" type="text" value="GAATCC" />
                    </when>
                </conditional>
            </when>
            <when value="no">
                <param label="Select fastq files to align" name="clipped_input" type="data" format="fastq,fastqsanger" help="Note that sequences reads must be clipped from their adapter" />
            </when>
        </conditional>
        <param name="genomeKey" type="select" label="Choose Organism">
            <options from_data_table="miRbase_GenomeKeys">
                <column name="name" index="1"/>
                <column name="value" index="0"/>
            </options>
        </param>
        <param name="mirbase_version" type="select" label="Choose miRbase version">
<!--            <option selected="true" value="22">22</option> # activate when gff parsing is fixed -->
            <option value="21">21</option>
            <option value="20">20</option>
            <option value="19">19</option>
        </param>
        <param help="command [ bowtie -v 0,1,2,3 -M 1 --best --strata --norc ] will be used. Specify a value for -v (number of mismatches allowed)" label="Number of mismatches allowed" name="v" type="select">
            <option value="0">0</option>
            <option selected="true" value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
        </param>
         <param help="Output mature Mir counts" label="Output mature Mir counts"
             name="output_mir_counts" type="boolean" falsevalue="0" checked="true" truevalue="1" />
         <param help="Output pre-Mir counts" label="Output pre-Mir counts"
             name="output_premir_counts" type="boolean" falsevalue="0" checked="true" truevalue="1" />
        <conditional name="plotting">
            <param label="Additional miRNA charts" name="plottingOption" type="select">
                <option value="no">no</option>
                <option value="yes" selected="True">yes</option>
            </param>
            <when value="yes">
                <param label="Display Coverage with absolute number of reads or relatively to the total number of read matching the gene or mir" name="display" type="select">
                    <option selected="True" value="relative">Relative Coverage</option>
                    <option value="absolute">Absolute Coverage</option>
                </param>
            </when>
            <when value="no">
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data format="bam" label="BAM alignment" name="output" hidden="true" />
        <data format="gff3" label="GFF3 generated by miRCounts" name="gff3" hidden="true" />
        <data format="tabular" label="Pre-mir Counts" name="pre_mir_count_file">
            <filter>output_premir_counts == True</filter>
            <actions>
                <action name="column_names" type="metadata" default="Gene,Counts" />
            </actions>
        </data>
        <data format="tabular" label="Mir Counts" name="mir_count_file">
            <filter>output_mir_counts == True</filter>
            <actions>
                <action name="column_names" type="metadata" default="Gene,Counts" />
            </actions>
        </data>
        <data format="tabular" label="Coverage Table" name="coverage_dataframe">
            <filter>plotting['plottingOption'] == "yes"</filter>
        </data>
        <data format="pdf" label="Pre-mir coverage (${plotting.display})" name="latticePDF">
            <filter>plotting['plottingOption'] == "yes"</filter>
        </data>
    </outputs>
    <tests>
         <test>
            <param name="cutoption" value="yes" />
            <param name="min" value="15"/>
            <param name="max" value="25"/>
            <param name="Nmode" value="reject"/>
            <param name="clip_sequence" value="TCGTATGCCGTCTTCTGCTTG"/>
            <param name="v" value="0"/>
            <param name="genomeKey" value="dme"/>
            <param name="mirbase_version" value="21"/>
            <param name="input" value="input.unclipped.fastqsanger" ftype="fastqsanger"/>
            <param name="plottingOption" value="no"/>
            <param name="output_premir_counts" value="True"/>
            <param name="output_mir_counts" value="True"/>
            <output name="output" file="unclipped.out.bam" ftype="bam"/>
            <output name="gff3" file="translated_dme.gff3" ftype="gff3" lines_diff="22"/>
            <output name="pre_mir_count_file" file="pre_mirs_unclipped_count.tab"/>
            <output name="mir_count_file" file="mirs_unclipped_count.tab"/>
        </test>
       <test>
            <param name="cutoption" value="yes" />
            <param name="min" value="15"/>
            <param name="max" value="25"/>
            <param name="Nmode" value="reject"/>
            <param name="clip_sequence" value="TCGTATGCCGTCTTCTGCTTG"/>
            <param name="v" value="0"/>
            <param name="genomeKey" value="dme"/>
            <param name="mirbase_version" value="21"/>
            <param name="input" value="input.unclipped.fastqsanger" ftype="fastqsanger"/>
            <param name="plottingOption" value="yes"/>
            <param name="display" value="relative"/>
            <param name="output_premir_counts" value="True"/>
            <param name="output_mir_counts" value="True"/>
            <output name="output" file="unclipped.out.bam" ftype="bam"/>
            <output name="gff3" file="translated_dme.gff3" ftype="gff3"  lines_diff="22"/>
            <output name="pre_mir_count_file" file="pre_mirs_unclipped_count.tab"/>
            <output name="mir_count_file" file="mirs_unclipped_count.tab"/>
            <output name="latticePDF" file="mir_unclipped_coverage.pdf" ftype="pdf"/>
            <output name="coverage_dataframe" file="lattice_unclipped_dataframe.tab"/>
        </test>
        <test>
            <param name="cutoption" value="no" />
            <param name="v" value="1"/>
            <param name="genomeKey" value="dme"/>
            <param name="mirbase_version" value="21"/>
            <param name="clipped_input" value="input.clipped.fastqsanger" ftype="fastqsanger"/>
            <param name="plottingOption" value="yes"/>
            <param name="display" value="absolute"/>
            <param name="output_premir_counts" value="True"/>
            <param name="output_mir_counts" value="True"/>
            <output name="output" file="clipped.out.bam" ftype="bam"/>
            <output name="gff3" file="translated_dme.gff3" ftype="gff3"  lines_diff="22"/>
            <output name="pre_mir_count_file" file="pre_mirs_clipped_count.tab"/>
            <output name="mir_count_file" file="mirs_clipped_count.tab"/>
            <output name="latticePDF" file="mir_clipped_coverage.pdf" ftype="pdf"/>
            <output name="coverage_dataframe" file="lattice_clipped_dataframe.tab"/>
        </test>
    </tests>
    <help>

**What it does**

+ Clips adapter (optional)
+ Aligns small RNA reads to miRNA mirBase_ reference using bowtie
+ Computes pre-mir and mir counts using the pysam python package
+ Plots pre-mir read coverages using R lattice package (optional)

This tool uses a species-specific GFF3 file generated from mirBase_ to guide the parsing of a bam file of small RNA alignments.

.. _mirBase: ftp://mirbase.org/pub/mirbase/

------


**Inputs**

1. A fastq file of reads that may or may not be clipped from their adapter sequence. The tool includes a clipping option if needed.
2. Select the appropriate organism which reads originate from.
3. Choose whether you wish or not to plot the pre-mir coverages. The coverage can be expressed in absolute number of reads covering the real coordinates of the pre-mir sequences, or, as a fraction of the maximum coverage (set to 1) covering the coordinates of pre-mirs expressed as a fraction of the length of the pre-mirs.


------

Absolute :

+ .. image:: premirs_absolute.png

Relative :

+ .. image:: premirs_relative.png

-------

**Outputs**

1. A BAM alignment of input reads
2. A GFF3 file generated by the tool to compute mature mir counts
3. A table of pre-mir counts
4. A table of mature mir counts

Optional:

5. A table of pre-mir coverage
6. A PDF file with covererage plots


  </help>
  <citations>
      <citation type="doi">10.1093/bioinformatics/btp352</citation>
      <citation type="doi">10.1186/gb-2009-10-3-r25</citation>
      <citation type="bibtex">@Book{,
    title = {Lattice: Multivariate Data Visualization with R},
    author = {Deepayan Sarkar},
    publisher = {Springer},
    address = {New York},
    year = {2008},
    note = {ISBN 978-0-387-75968-5},
    url = {http://lmdvr.r-forge.r-project.org},
    }</citation>
  </citations>
</tool>