comparison MirParser.xml @ 0:035df35a257e draft

planemo upload for repository https://bitbucket.org/drosofff/gedtools/
author drosofff
date Mon, 29 Jun 2015 05:50:44 -0400
parents
children c68bfbff72d5
comparison
equal deleted inserted replaced
-1:000000000000 0:035df35a257e
1 <tool id="MirParser" name="Parse miRNAs" version="0.9.2">
2 <description>from sRbowtie aligment</description>
3 <requirements>
4 <requirement type="package" version="0.12.7">bowtie</requirement>
5 <requirement type="package" version="0.7.7">pysam</requirement>
6 <requirement type="package" version="1.9">numpy</requirement>
7 <requirement type="package" version="2.14">biocbasics</requirement>
8 </requirements>
9 <command interpreter="python">
10 MirParser.py
11 #if $refGenomeSource.genomeSource == "history":
12 $refGenomeSource.ownFile ## index source sys.arg[1]
13 --do_not_extract_index ## sys.argv[2]
14 #else:
15 #silent reference= filter( lambda x: str( x[0] ) == str( $input_list.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
16 $reference ## sys.argv[1]
17 --extract_index ## sys.argv[2]
18 #end if
19 $output1 ## for pre-mirs ## sys.argv[3]
20 $output2 ## for mature mirs ## sys.argv[4]
21 $GFF3 ## sys.argv[5]
22 #if $plotting.plottingOption == "yes":
23 $lattice_dataframe ## sys.argv[6]
24 $plotCode ## sys.argv[7]
25 $latticePDF ## sys.argv[8]
26 #else:
27 "dummy_dataframe_path" ## sys.argv[6]
28 "dummy_plotCode" ## sys.argv[7]
29 "dummy_latticePDF" ## sys.argv[8]
30 #end if
31 #for $i in $refGenomeSource.input_list
32 $i $i.ext "$i.name" ## sys.argv[9,10,11] modulo 3
33 #end for
34 #silent plottingoption = $plotting.plottingOption
35 </command>
36 <inputs>
37 <conditional name="refGenomeSource">
38 <param help="Built-ins were indexed using default options" label="Will you select a reference genome from your history or use a built-in index?" name="genomeSource" type="select">
39 <option value="indexed">Use a built-in index</option>
40 <option value="history">Use one from the history</option>
41 </param>
42 <when value="indexed">
43 <param label="Select multiple alignments to parse" multiple="true" name="input_list" type="data" format="tabular,sam,bam">
44 <validator message="database not set for this bowtie output. Select the database(=genome used for matching) manually, or select a reference fasta from your history." metadata_column="0" metadata_name="dbkey" table_name="bowtie_indexes" type="dataset_metadata_in_data_table" />
45 </param>
46 </when>
47 <when value="history">
48 <param label="Select multiple alignments to parse" multiple="true" name="input_list" type="data" format="tabular,sam,bam"/>
49 <param format="fasta" label="Select the fasta reference" name="ownFile" type="data" />
50 </when>
51 </conditional>
52 <param label="miRbase GFF3 guide" name="GFF3" type="data" format="gff,gff3"/>
53 <conditional name="plotting">
54 <param label="Additional miRNA coverage graphs" name="plottingOption" type="select">
55 <option selected="True" value="no">no</option>
56 <option value="yes">yes</option>
57 </param>
58 <when value="yes">
59 <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">
60 <option selected="True" value="relative">Relative Coverage</option>
61 <option value="absolute">Absolute Coverage</option>
62 </param>
63 </when>
64 </conditional>
65 </inputs>
66 <outputs>
67 <data format="tabular" label="Premirs Count Lists" name="output1" />
68 <data format="tabular" label="Mature Mirs Count Lists" name="output2" />
69 <data format="tabular" label="Lattice Dataframe" name="lattice_dataframe">
70 <filter>plotting['plottingOption'] == "yes"</filter>
71 </data>
72 <data format="pdf" label="Mir coverage" name="latticePDF">
73 <filter>plotting['plottingOption'] == "yes"</filter>
74 </data>
75 </outputs>
76 <tests>
77 <test>
78 <param name="genomeSource" value="history"/>
79 <param name="ownFile" value="Dmel_r5.49_short.fa" ftype="fasta"/>
80 <param name="input_list" value="input.bam" ftype="bam"/>
81 <param name="GFF3" value="dme.gff3" ftype="gff3"/>
82 <param name="plottingOption" value="yes"/>
83 <output name="output1" file="output1.tab" ftype="tabular"/>
84 <output name="output2" file="output2.tab" ftype="tabular"/>
85 <output name="lattice_dataframe" file="lattice_dataframe.tab" ftype="tabular"/>
86 <output name="latticePDF" file="latticePDF.pdf" ftype="pdf"/>
87 </test>
88 </tests>
89 <configfiles>
90 <configfile name="plotCode">
91 #if $plotting.plottingOption == "yes":
92 graph_type = "${plotting.display}" ## "relative" or "absolute"
93 ## Setup R error handling to go to stderr
94 options( show.error.messages=F,
95 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
96 library(lattice)
97 coverage = read.delim("${lattice_dataframe}", header=T)
98 Numb_of_biosamples = length(levels(coverage\$sample))
99 if (graph_type=="relative") {
100 graph = xyplot(countsNorm~offsetNorm | mir, data=coverage, groups=polarity, col=c("red", "blue"), type="l", lwd=1,
101 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")
102 } else {
103 graph = xyplot(counts~offset | mir, data=coverage, groups=polarity, col=c("red", "blue"), type="l", lwd=1,
104 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")
105 }
106 ## pdf output
107 pdf(file="${latticePDF}", paper="special", height=11.69, width=8.2677)
108 plot(graph, newpage = T)
109 dev.off()
110 #end if
111 </configfile>
112 </configfiles>
113 <help>
114
115 **What it does**
116
117 This tool uses a species-specific GFF3 file from mirBase_ to guide the parsing of an alignment file produced with the sRbowtie tool.
118
119 .. _mirBase: ftp://mirbase.org/pub/mirbase/CURRENT/genomes/
120
121 ------
122
123 .. class:: warningmark
124
125 the Guide GFF3 file must be in the following format:
126
127 2L . miRNA_primary_transcript 243035 243141 . - . ID=MI0005821;Alias=MI0005821;Name=dme-mir-965
128
129 2L . miRNA 243055 243076 . - . ID=MIMAT0005480;Alias=MIMAT0005480;Name=dme-miR-965-3p;Derives_from=MI0005821
130
131 2L . miRNA 243096 243118 . - . ID=MIMAT0020861;Alias=MIMAT0020861;Name=dme-miR-965-5p;Derives_from=MI0005821
132
133 2L . miRNA_primary_transcript 857542 857632 . + . ID=MI0005813;Alias=MI0005813;Name=dme-mir-375
134
135 2L . miRNA 857596 857617 . + . ID=MIMAT0005472;Alias=MIMAT0005472;Name=dme-miR-375-3p;Derives_from=MI0005813
136
137 2L . miRNA 857556 857579 . + . ID=MIMAT0020853;Alias=MIMAT0020853;Name=dme-miR-375-5p;Derives_from=MI0005813
138
139 2L . miRNA_primary_transcript 1831685 1831799 . - . ID=MI0011290;Alias=MI0011290;Name=dme-mir-2280
140
141 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)
142
143 ------
144
145 **Input formats**
146
147 1. One or sereral alignment files generated with sRbowtie tool and **renamed** according to the name of the biosample (avoid spaces in biosample labels)
148
149 .. class:: warningmark
150
151 Alignment datasets generated with sRbowtie must be renamed according to a biosample name
152
153 2. A GFF3 file retrieved from mirBase_
154
155 ------
156
157 **Outputs**
158
159 Two count list files for counts of reads aligned to pre-mir or mature miRNA
160
161 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.
162
163 </help>
164 </tool>