view mircounts.xml.back @ 0:10f0e4c00b13 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/mircounts commit 3a6181bd181729f642b75c4e689f063fc2821cf1
author artbio
date Tue, 18 Jul 2017 06:30:40 -0400
parents
children
line wrap: on
line source

<tool id="miRCounts" name="miRCounts" version="0.1">
    <description> Counts miRNA alignments from small RNA sequence data</description>
    <requirements>
        <requirement type="package" version="1.2">bowtie</requirement>
        <requirement type="package" version="1.4.1">samtools</requirement>
        <requirement type="package" version="0.11.2.1=py27_0">pysam</requirement>
    </requirements>
    <command detect_errors="exit_code"><![CDATA[
        ## To be refactored with guidelines in https://github.com/ARTbio/tools-artbio/issues/140
        wget ftp://mirbase.org/pub/mirbase/CURRENT/genomes/${genomeKey}.gff3 && ## download gff3 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 ftp://mirbase.org/pub/mirbase/CURRENT/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 &&
        bowtie -v $v -M 1 --best --strata --norc -p \${GALAXY_SLOTS:-4} --sam hairpin -q clipped_input.fastq 2>/dev/null | samtools sort -O bam -o '$output'
        ##samtools view -bS output.sam -o output.bam &&
        ##samtools sort output.bam output.sorted &&
        ##samtools index output.sorted &&
        ## mv output.sorted.bam $output
        ## bowtie parse :
        ##     Be careful:
        ##     Bam: 0-based; SAM: 1-based; GFF: 1-based
        ## end  refactoring
    ]]></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" label="Source file" name="input" type="data" />
                <param label="min size" name="min" size="4" type="integer" value="15" />
                <param label="max size" name="max" size="4" type="integer" value="36" />
                <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 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>
    </inputs>
    <outputs>
        <data format="bam" label="bam alignment" name="output" />
        <data format="gff3" label="GFF3 generated by miRCounts" name="gff3"/>
        <!--
        <data format="tabular" label="Premirs Count  Lists" name="output1" />
        <data format="tabular" label="Mature Mirs Count  Lists" name="output2" />
        <data format="tabular" label="Lattice Dataframe" name="lattice_dataframe">
            <filter>plotting['plottingOption'] == "yes"</filter>
        </data>
        <data format="pdf" label="Mir coverage" 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="input" value="input.unclipped.fastqsanger" ftype="fastqsanger"/>
            <output name="output" file="unclipped.out.bam" ftype="bam"/>
            <output name="gff3" file="translated_dme.gff3" ftype="gff3"/>
        </test>
        <test>
            <param name="cutoption" value="no" />
            <param name="v" value="1"/>
            <param name="genomeKey" value="dme"/>
            <param name="clipped_input" value="input.clipped.fastqsanger" ftype="fastqsanger"/>
            <output name="output" file="clipped.out.bam" ftype="bam"/>
            <output name="gff3" file="translated_dme.gff3" ftype="gff3"/>
        </test>
    </tests>
    <!--
    <configfiles>
        <configfile name="plotCode">
	#if  $plotting.plottingOption == "yes":
          graph_type = "${plotting.display}" ## "relative" or "absolute"
          ## Setup R error handling to go to stderr
          options( show.error.messages=F,
                 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
          library(lattice)
          coverage = read.delim("${lattice_dataframe}", header=T)
          Numb_of_biosamples = length(levels(coverage\$sample))
          if (graph_type=="relative") {
          graph = xyplot(countsNorm~offsetNorm | mir, data=coverage, groups=polarity, col=c("red", "blue"), type="l", lwd=1,
                        scales=list(x=list(cex=.5), y=list(cex=.5)), par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), layout=c(Numb_of_biosamples,15), as.table=TRUE, main="miRNA coverage maps")
          } else {
          graph = xyplot(counts~offset | mir, data=coverage, groups=polarity, col=c("red", "blue"), type="l", lwd=1,
                        scales=list(x=list(cex=.5), y=list(cex=.5)), par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), layout=c(Numb_of_biosamples,15), as.table=TRUE, main="miRNA coverage maps")
          }
          ## pdf output
          pdf(file="${latticePDF}", paper="special", height=11.69, width=8.2677)
          plot(graph, newpage = T)
          dev.off()
        #end if
     </configfile>
    </configfiles>
    -->
    <help>

**What it does**

This tool uses a species-specific GFF3 file from mirBase_ to guide the parsing of an alignment file produced with the sRbowtie tool.

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

------

.. class:: warningmark

the Guide GFF3 file must be in the following format:

2L	.	miRNA_primary_transcript	243035	243141	.	-	.	ID=MI0005821;Alias=MI0005821;Name=dme-mir-965

2L	.	miRNA	243055	243076	.	-	.	ID=MIMAT0005480;Alias=MIMAT0005480;Name=dme-miR-965-3p;Derives_from=MI0005821

2L	.	miRNA	243096	243118	.	-	.	ID=MIMAT0020861;Alias=MIMAT0020861;Name=dme-miR-965-5p;Derives_from=MI0005821

2L	.	miRNA_primary_transcript	857542	857632	.	+	.	ID=MI0005813;Alias=MI0005813;Name=dme-mir-375

2L	.	miRNA	857596	857617	.	+	.	ID=MIMAT0005472;Alias=MIMAT0005472;Name=dme-miR-375-3p;Derives_from=MI0005813

2L	.	miRNA	857556	857579	.	+	.	ID=MIMAT0020853;Alias=MIMAT0020853;Name=dme-miR-375-5p;Derives_from=MI0005813

2L	.	miRNA_primary_transcript	1831685	1831799	.	-	.	ID=MI0011290;Alias=MI0011290;Name=dme-mir-2280

With name for mature miRNA (3rd column = miRNA) containing either the -3p or -5p string in the attribute Name (Name=dme-miR-965-3p, for instance)

------

**Input formats**

1. One or sereral alignment files generated with sRbowtie tool and **renamed** according to the name of the biosample (avoid spaces in biosample labels)

.. class:: warningmark

Alignment datasets generated with sRbowtie must be renamed according to a biosample name

2. A GFF3 file retrieved from mirBase_

------

**Outputs**

Two count list files for counts of reads aligned to pre-mir or mature miRNA

A pdf of pre-mir coverages. Red coverages indicate that the mir gene is in the genomic up strand, blue coverages indicate that the mir gene is in the genomic down strand.

  </help>
</tool>