0
|
1 <tool id="piRNAsignature" name="piRNA Signatures" version="1.0.1">
|
|
2 <description></description>
|
|
3 <command interpreter="python">
|
|
4 piRNAsignature.py $refGenomeSource.input $refGenomeSource.input.ext $minquery $maxquery $mintarget $maxtarget $minscope $maxscope $output
|
|
5 #if $refGenomeSource.genomeSource == "history":
|
|
6 $refGenomeSource.ownFile
|
|
7 --do_not_extract_index
|
|
8 #else:
|
|
9 #silent reference= filter( lambda x: str( x[0] ) == str( $input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
|
|
10 $reference
|
|
11 --extract_index
|
|
12 #end if
|
|
13 $graph_type
|
|
14 $sigplotter
|
|
15 </command>
|
|
16
|
|
17 <inputs>
|
|
18 <conditional name="refGenomeSource">
|
|
19 <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">
|
|
20 <option value="indexed">Use a built-in index</option>
|
|
21 <option value="history">Use one from the history</option>
|
|
22 </param>
|
|
23 <when value="indexed">
|
|
24 <param name="input" type="data" format="tabular,sam,bam" label="Compute signature from this bowtie standard output">
|
|
25 <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."/>
|
|
26 </param>
|
|
27 </when>
|
|
28 <when value="history">
|
|
29 <param name="ownFile" type="data" format="fasta" label="Select the fasta reference" />
|
|
30 <param name="input" type="data" format="tabular,sam,bam" label="Compute signature from this bowtie standard output"/>
|
|
31 </when>
|
|
32 </conditional> <!-- refGenomeSource -->
|
|
33 <param name="minquery" type="integer" size="3" value="23" label="Min size of query small RNAs" help="'23' = 23 nucleotides"/>
|
|
34 <param name="maxquery" type="integer" size="3" value="29" label="Max size of query small RNAs" help="'29' = 29 nucleotides"/>
|
|
35 <param name="mintarget" type="integer" size="3" value="23" label="Min size of target small RNAs" help="'23' = 23 nucleotides"/>
|
|
36 <param name="maxtarget" type="integer" size="3" value="29" label="Max size of target small RNAs" help="'29' = 29 nucleotides"/>
|
|
37 <param name="minscope" type="integer" size="3" value="1" label="Minimal relative overlap analyzed" help="'1' = 1 nucleotide overlap"/>
|
|
38 <param name="maxscope" type="integer" size="3" value="26" label="Maximal relative overlap analyzed" help="'1' = 1 nucleotide overlap"/>
|
|
39 <param name="graph_type" type="select" label="Graph type" help="Signature can be computed globally or by item present in the alignment file">
|
|
40 <option value="global" selected="True">Global</option>
|
|
41 <option value="lattice">Lattice</option>
|
|
42 </param>
|
|
43 </inputs>
|
|
44
|
|
45 <configfiles>
|
|
46 <configfile name="sigplotter">
|
|
47 graph_type = "${graph_type}"
|
|
48
|
|
49 globalgraph = function () {
|
|
50 ## Setup R error handling to go to stderr
|
|
51 options( show.error.messages=F,
|
|
52 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
|
|
53 signature = read.delim("${output}", header=TRUE)
|
|
54 ## Open output1 PDF file
|
|
55 pdf( "${output1}" )
|
|
56 signaturez=(signature[,2] -mean(signature[,2]))/sd(signature[,2])
|
|
57 plot(signaturez, type = "b", main="signature", cex.main=2, xlab="overlap (nt)", ylab="z-score", pch=19, cex=0.8, col="darkslateblue", lwd=3, cex.lab=1.5, cex.axis=1.4, xaxt="n")
|
|
58 axis(1, at=seq(from=1, to=length(signature[,1]), by=3) )
|
|
59 devname = dev.off()
|
|
60 ## Close the PDF file
|
|
61 ## Open output2 PDF file
|
|
62 pdf( "${output2}" )
|
|
63 YLIM=max(signature[,2])
|
|
64 plot(signature[,1:2], type = "h", xlab="overlap (nt)", ylim=c(0,YLIM), ylab="number of pairs", col="darkslateblue", lwd=7)
|
|
65 devname = dev.off()
|
|
66 ## Close the PDF file
|
|
67 ## Open output3 PDF file
|
|
68 pdf( "${output3}" )
|
|
69 plot(signature[,1], signature[,3]*100, type = "l", main="ping-pong Signature of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs",
|
|
70 cex.main=1, xlab="overlap (nt)", ylab="ping-pong signal [%]", ylim=c(0,50),
|
|
71 pch=19, col="darkslateblue", lwd =4, cex.lab=1.2, cex.axis=1, xaxt="n")
|
|
72 axis(1, at=seq(from=1, to=length(signature[,1]), by=3) )
|
|
73 devname = dev.off()
|
|
74 ## Close the PDF file
|
|
75 }
|
|
76
|
|
77 treillisgraph = function () {
|
|
78 ## Open output3 PDF file
|
|
79 pdf( "${output3}", paper="special", height=11.69, width=8.2677 )
|
|
80 signature = read.delim("${output}", header=TRUE)
|
|
81 options( show.error.messages=F,
|
|
82 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
|
|
83 library(lattice)
|
|
84 print (xyplot(signature[,3]*100~signature[,1]|signature[,4], type = "l", xlim=c(1,26), main="ping-pong Signature of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs",
|
|
85 par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), scales=list(cex=0.5),
|
|
86 cex.main=1, cex=.5, xlab="overlap (nt)", ylab="ping-pong signal [%]",
|
|
87 pch=19, col="darkslateblue", lwd =1.5, cex.lab=1.2, cex.axis=1.2,
|
|
88 layout=c(4,12), as.table=TRUE, newpage = T) )
|
|
89 devnname = dev.off()
|
|
90 }
|
|
91
|
|
92 if (graph_type=="global") {
|
|
93 globalgraph()
|
|
94
|
|
95 }
|
|
96 if(graph_type=="lattice") {
|
|
97 treillisgraph()
|
|
98 }
|
|
99 </configfile>
|
|
100 </configfiles>
|
|
101
|
|
102 <outputs>
|
|
103 <data name="output" format="tabular" label = "signature data frame"/>
|
|
104 <data name="output2" format="pdf" label="number of pairs signature">
|
|
105 <filter>(graph_type == "global")</filter>
|
|
106 </data>
|
|
107 <data name="output1" format="pdf" label="z-score signature">
|
|
108 <filter>(graph_type == "global")</filter>
|
|
109 </data>
|
|
110 <data name="output3" format="pdf" label="ping-pong signal (hannon algo.)"/>
|
|
111 </outputs>
|
|
112
|
|
113 <help>
|
|
114
|
|
115 **What it does**
|
|
116
|
|
117 This tool computes the number of pairs by overlap classes (in nt) from a bowtie output file, the z-score calculated from these numbers of pairs, and the ping-pong signal as described in Brennecke et al (2009) Science.
|
|
118 The numerical options set the min and max size of both the query small rna class and the target small rna class
|
|
119 Three type of signals are plotted in separate pdf files, the number of pairs founds, the z-score calculated from these numbers of pairs, and the ping-pong signal as described in Brennecke et al (2009) Science.
|
|
120
|
|
121 </help>
|
|
122 </tool>
|