view mircounts.xml @ 14:c163574c246f draft

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 51dc6c56c7d95fc229ffee958354211cd454fd36"
author artbio
date Sun, 09 May 2021 17:10:07 +0000
parents b045c30fb768
children ffcd42f85b61
line wrap: on
line source

<tool id="mircounts" name="miRcounts" version="1.5.1">
    <description> Counts miRNA alignments from small RNA sequence data</description>
    <requirements>
        <requirement type="package" version="1.34=ha1f6473_0">tar</requirement>
        <requirement type="package" version="1.3.0=py39h176da8b_2">bowtie</requirement>
        <requirement type="package" version="1.12=h9aed4be_1">samtools</requirement>
        <requirement type="package" version="0.16.0.1=py39h051187c_3">pysam</requirement>
        <requirement type="package" version="1.6.6=r40h6115d3f_1">r-optparse</requirement>
        <requirement type="package" version="0.20_44=r40hcfec24a_0">r-lattice</requirement>
    </requirements>
    <stdio>
        <exit_code range="1:" level="warning" description="Tool exception" />
    </stdio>
    <command detect_errors="exit_code"><![CDATA[
        tar -xf  '$__tool_directory__'/mirbase.tar.gz &&
        python '$__tool_directory__'/mature_mir_gff_translation.py
                                                --gff_path mirbase/${mirbase_version}/genomes/${genomeKey}.gff3
                                                --output $gff3 && ## transcode the mature miR genome coordinates into coordinates relative to the corresponding "miRNA_primary_transcript".
        python '$__tool_directory__'/format_fasta_hairpins.py
                                                --hairpins_path mirbase/${mirbase_version}/hairpin.fa.gz
                                                --basename ${genomeKey}
                                                --output hairpin.fa &&
        #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 &&
        bowtie -v $v -M 1 --best --strata --norc -p \${GALAXY_SLOTS:-4} --sam hairpin -q clipped_input.fastq | samtools sort -@ \${GALAXY_SLOTS:-4} -O bam -o '$output' &&
        samtools index $output &&
        python '$__tool_directory__'/mircounts.py --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>
            <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="no" />
            <param name="v" value="1"/>
            <param name="genomeKey" value="aga"/>
            <param name="mirbase_version" value="22"/>
            <param name="clipped_input" value="aga.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="aga.bam" compare="sim_size" />
            <output name="gff3" file="aga.22.gff3" lines_diff="22" ftype="gff3" />
            <output name="pre_mir_count_file" file="aga_pre_mirs_count.22.tab" ftype="tabular" />
            <output name="mir_count_file" file="aga_mirs_count.22.tab" ftype="tabular" />
            <output name="latticePDF" file="aga_mir_coverage.pdf" ftype="pdf" />
            <output name="coverage_dataframe" file="aga_lattice_dataframe.tab" ftype="tabular" />
        </test>
        <test>
            <param name="cutoption" value="yes" />
            <param name="min" value="18"/>
            <param name="max" value="32"/>
            <param name="Nmode" value="reject"/>
            <param name="clip_sequence" value="TGGAATTCTCGGGTGCCAAG"/>
            <param name="v" value="1"/>
            <param name="genomeKey" value="mmu"/>
            <param name="mirbase_version" value="19"/>
            <param name="input" value="mouse.fastq" 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="mouse.bam" compare="sim_size"/>
            <output name="gff3" file="mouse.19.gff3" lines_diff="22" ftype="gff3" />
            <output name="pre_mir_count_file" file="mouse_pre_mirs_count.29.tab" ftype="tabular" />
            <output name="mir_count_file" file="mouse_mirs_count.29.tab" ftype="tabular" />
            <output name="latticePDF" file="mouse_mir_coverage.pdf" ftype="pdf" />
            <output name="coverage_dataframe" file="mouse_lattice_dataframe.tab" ftype="tabular" />
        </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="22"/>
            <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.22.bam" compare="sim_size" />
            <output name="gff3" file="translated_dme.22.gff3" lines_diff="22" ftype="gff3" />
            <output name="pre_mir_count_file" file="pre_mirs_unclipped_count.22.tab" ftype="tabular" />
            <output name="mir_count_file" file="mirs_unclipped_count.22.tab" ftype="tabular" />
        </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="no"/>
            <param name="output_premir_counts" value="True"/>
            <param name="output_mir_counts" value="True"/>
            <output name="output" file="unclipped.out.bam" compare="sim_size" />
            <output name="gff3" file="translated_dme.gff3" lines_diff="22"  ftype="gff3" />
            <output name="pre_mir_count_file" file="pre_mirs_unclipped_count.tab" ftype="tabular" />
            <output name="mir_count_file" file="mirs_unclipped_count.tab" ftype="tabular" />
        </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" compare="sim_size" />
            <output name="gff3" file="translated_dme.gff3"  lines_diff="22" ftype="gff3" />
            <output name="pre_mir_count_file" file="pre_mirs_unclipped_count.tab" ftype="tabular" />
            <output name="mir_count_file" file="mirs_unclipped_count.tab" ftype="tabular" />
            <output name="latticePDF" file="mir_unclipped_coverage.pdf" ftype="pdf"/>
            <output name="coverage_dataframe" file="lattice_unclipped_dataframe.tab" ftype="tabular" />
        </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" compare="sim_size" />
            <output name="gff3" file="translated_dme.gff3" lines_diff="22" ftype="gff3" />
            <output name="pre_mir_count_file" file="pre_mirs_clipped_count.tab" ftype="tabular" />
            <output name="mir_count_file" file="mirs_clipped_count.tab" ftype="tabular" />
            <output name="latticePDF" file="mir_clipped_coverage.pdf" ftype="pdf" />
            <output name="coverage_dataframe" file="lattice_clipped_dataframe.tab" ftype="tabular" />
        </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>