view MirParser.xml @ 7:20b8ff9c1cb9 draft default tip

Uploaded
author drosofff
date Mon, 23 Jun 2014 05:24:28 -0400
parents 906544162710
children
line wrap: on
line source

<tool id="MirParser" name="Parse miRNAs" version="0.9.1">
  <description>from sRbowtie aligment</description>
  <requirements><requirement type='package'>bowtie-inspect</requirement></requirements>
  <parallelism method="basic"></parallelism>
<command interpreter="python">
        MirParser.py 
	          #if $refGenomeSource.genomeSource == "history":
                    $refGenomeSource.ownFile ## index source sys.arg[1]
         	    --do_not_extract_index  ## sys.argv[2]
          	  #else:
		    #silent reference= filter( lambda x: str( x[0] ) == str( $input_list.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
		    $reference   ## sys.argv[1]
		    --extract_index  ## sys.argv[2]
          	  #end if
		  $output1 ## for pre-mirs  ## sys.argv[3]
		  $output2 ## for mature mirs  ## sys.argv[4]
		  $GFF3    ## sys.argv[5]
		  #if $plotting.plottingOption == "yes":
		    $lattice_dataframe   ## sys.argv[6]
		    $plotCode   ## sys.argv[7]
		    $latticePDF ## sys.argv[8]
		  #else:
		    "dummy_dataframe_path"   ## sys.argv[6]
                    "dummy_plotCode"   ## sys.argv[7]
		    "dummy_latticePDF" ## sys.argv[8]
		  #end if
		  #for $i in $refGenomeSource.input_list
    		    $i $i.ext "$i.name" ## sys.argv[9,10,11] modulo 3
		  #end for
                  #silent plottingoption = $plotting.plottingOption
</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">
	       <param name="input_list" type="data" label="Select multiple alignments to parse" multiple="true">
                  <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>
           </when>
           <when value="history">
	       <param name="input_list" type="data" label="Select multiple alignments to parse" multiple="true"/>
               <param name="ownFile" type="data" format="fasta"  label="Select the fasta reference" />
           </when>
       </conditional>  <!-- refGenomeSource -->
       <param name="GFF3" type="data" label="miRbase GFF3 guide" />
       <conditional name="plotting">
           <param name="plottingOption" type="select" label="Additional mir coverage graphs">
               <option value="no" selected="True">No</option>
               <option value="yes">YES</option>
           </param>
           <when value="yes">
               <param name="display" type="select" label="Display Coverage with absolute number of reads or relatively to the total number of read matching the gene or mir">
                 <option value="relative" selected="True">Relative Coverage</option>
                 <option value="absolute">Absolute Coverage</option>
               </param>
           </when>
       </conditional>
   </inputs>
   <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>

   <outputs>
   <data format="tabular" name="output1" label="Premirs Count  Lists"/>
   <data format="tabular" name="output2" label="Mature Mirs Count  Lists"/>
   <data format="tabular" name="lattice_dataframe" label="Lattice Dataframe">
        <filter>plotting['plottingOption'] == "yes"</filter>
   </data>
   <data format="pdf" name="latticePDF" label="Mir coverage">
        <filter>plotting['plottingOption'] == "yes"</filter>
   </data>
   </outputs>
  <help>

**What it does**

This tool uses a specie-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>