comparison signature.xml~ @ 4:741cc1d16813 draft

Uploaded
author mvdbeek
date Thu, 16 Apr 2015 05:45:19 -0400
parents
children
comparison
equal deleted inserted replaced
3:5c5d12cbf8ed 4:741cc1d16813
1 <tool id="signature" name="Small RNA Signatures" version="2.0.1">
2 <description />
3 <requirements>
4 <requirement type="package" version="0.12.7">bowtie</requirement>
5 <requirement type="package" version="0.1.18">samtools</requirement>
6 <requirement type="package" version="0.7.7">pysam</requirement>
7 <requirement type="package" version="2.14">biocbasics</requirement>
8 <requirement type="package" version="3.0.3">R</requirement>
9 <requirement type="package" version="1.9">numpy</requirement>
10 <requirement type="package" version="0.14">scipy</requirement>
11 </requirements>
12 <command interpreter="python">
13 signature.py
14 --input $refGenomeSource.input
15 --inputFormat $refGenomeSource.input.ext
16 --minquery $minquery
17 --maxquery $maxquery
18 --mintarget $mintarget
19 --maxtarget $maxtarget
20 --minscope $minscope
21 --maxscope $maxscope
22 --outputOverlapDataframe $output
23 #if $refGenomeSource.genomeSource == "history":
24 --referenceGenome $refGenomeSource.ownFile
25 #else:
26 #silent reference= filter( lambda x: str( x[0] ) == str( $input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
27 --referenceGenome $reference
28 --extract_index
29 #end if
30 --graph $graph_type
31 --rcode $sigplotter
32 </command>
33 <inputs>
34 <conditional name="refGenomeSource">
35 <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">
36 <option value="indexed">Use a built-in index</option>
37 <option value="history">Use one from the history</option>
38 </param>
39 <when value="indexed">
40 <param format="tabular,sam,bam" label="Compute signature from this bowtie standard output" name="input" type="data">
41 <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" />
42 </param>
43 </when>
44 <when value="history">
45 <param format="fasta" label="Select the fasta reference" name="ownFile" type="data" />
46 <param format="tabular,sam,bam" label="Compute signature from this bowtie standard output" name="input" type="data" />
47 </when>
48 </conditional>
49 <param help="'23' = 23 nucleotides" label="Min size of query small RNAs" name="minquery" size="3" type="integer" value="23" />
50 <param help="'29' = 29 nucleotides" label="Max size of query small RNAs" name="maxquery" size="3" type="integer" value="29" />
51 <param help="'23' = 23 nucleotides" label="Min size of target small RNAs" name="mintarget" size="3" type="integer" value="23" />
52 <param help="'29' = 29 nucleotides" label="Max size of target small RNAs" name="maxtarget" size="3" type="integer" value="29" />
53 <param help="'1' = 1 nucleotide overlap" label="Minimal relative overlap analyzed" name="minscope" size="3" type="integer" value="1" />
54 <param help="'1' = 1 nucleotide overlap" label="Maximal relative overlap analyzed" name="maxscope" size="3" type="integer" value="26" />
55 <param help="Signature can be computed globally or by item present in the alignment file" label="Graph type" name="graph_type" type="select">
56 <option selected="True" value="global">Global</option>
57 <option value="lattice">Lattice</option>
58 </param>
59 </inputs>
60 <outputs>
61 <data format="tabular" label="signature data frame" name="output" />
62 <data format="pdf" label="Overlap probabilities" name="output2" />
63 </outputs>
64 <tests>
65 <test>
66 <param name="genomeSource" value="history" />
67 <param ftype="fasta" name="ownFile" value="ensembl.fa" />
68 <param ftype="bam" name="input" value="sr_bowtie.bam" />
69 <param name="minquery" value="23" />
70 <param name="maxquery" value="29" />
71 <param name="mintarget" value="23" />
72 <param name="maxtarget" value="29" />
73 <param name="minscope" value="5" />
74 <param name="maxscope" value="15" />
75 <param name="graph_type" value="global" />
76 <output file="signature.tab" ftype="tabular" name="output" />
77 <output file="signature.pdf" ftype="pdf" name="output2" />
78 </test>
79 </tests>
80 <help>
81
82 **What it does**
83
84 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.
85 The numerical options set the min and max size of both the query small rna class and the target small rna class.
86 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.
87
88 </help>
89 <citations>
90 <citation type="doi">10.1007/978-1-4939-0931-5_12</citation>
91 </citations>
92 <configfiles>
93 <configfile name="sigplotter">
94 graph_type = "${graph_type}"
95
96 globalgraph = function () {
97 ## Setup R error handling to go to stderr
98 options( show.error.messages=F,
99 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
100 signature = read.delim("${output}", header=TRUE)
101 signaturez=data.frame(signature[,1], (signature[,2] -mean(signature[,2]))/sd(signature[,2]))
102 overlap_prob_z=data.frame(signature[,1], (signature[,3] -mean(signature[,3]))/sd(signature[,3]))
103 YLIM=max(signature[,2])
104
105 ## Open output2 PDF file
106 pdf( "${output2}" )
107 par(mfrow=c(2,2),oma = c(0, 0, 3, 0))
108
109 plot(signature[,1:2], type = "h", main="Numbers of pairs", cex.main=1, xlab="overlap (nt)", ylim=c(0,YLIM), ylab="Numbers of pairs", col="darkslateblue", lwd=4)
110
111 plot(signaturez, type = "l", main="Number of pairs Z-scores", cex.main=1, xlab="overlap (nt)", ylab="z-score", pch=19, cex=0.2, col="darkslateblue", lwd=2)
112
113 plot(signature[,1], signature[,3]*100, type = "l", main="Overlap probabilities",
114 cex.main=1, xlab="overlap (nt)", ylab="Probability [%]", ylim=c(0,50),
115 pch=19, col="darkslateblue", lwd=2)
116
117 plot(overlap_prob_z, type = "l", main="Overlap Probability Z-scores", cex.main=1, xlab="overlap (nt)", ylab="z-score", pch=19, cex=0.2, col="darkslateblue", lwd=2)
118
119 mtext("Overlap Signatures of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs", outer = TRUE, cex=1)
120 devname = dev.off()
121 ## Close the PDF file
122 }
123
124 treillisgraph = function () {
125 ## Open output2 PDF file
126 pdf( "${output2}", paper="special", height=11.69, width=8.2677 )
127 signature = read.delim("${output}", header=TRUE)
128 options( show.error.messages=F,
129 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
130 library(lattice)
131 print (xyplot(signature[,3]*100~signature[,1]|signature[,4], type = "l", xlim=c(${minscope},${maxscope}), main="ping-pong Signature of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs",
132 par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), scales=list(cex=0.5),
133 cex.main=1, cex=.5, xlab="overlap (nt)", ylab="ping-pong signal [%]",
134 pch=19, col="darkslateblue", lwd =1.5, cex.lab=1.2, cex.axis=1.2,
135 layout=c(4,12), as.table=TRUE, newpage = T) )
136 devnname = dev.off()
137 }
138
139 if (graph_type=="global") {
140 globalgraph()
141
142 }
143 if(graph_type=="lattice") {
144 treillisgraph()
145 }
146 </configfile>
147 </configfiles>
148 </tool>