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