comparison signature.xml @ 0:a2f293717ce3 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_sr_signature commit fe40dec87779c1fcfbd03330e653aa886f4a2cda
author drosofff
date Wed, 21 Oct 2015 11:35:25 -0400
parents
children 6218b518cd16
comparison
equal deleted inserted replaced
-1:000000000000 0:a2f293717ce3
1 <tool id="signature" name="Small RNA Signatures" version="2.0.5">
2 <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="3.1.2">R</requirement>
7 <requirement type="package" version="2.14">biocbasics</requirement>
8 <requirement type="package" version="1.9">numpy</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 <inputs>
32 <conditional name="refGenomeSource">
33 <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">
34 <option value="indexed">Use a built-in index</option>
35 <option value="history">Use one from the history</option>
36 </param>
37 <when value="indexed">
38 <param format="tabular,sam,bam" label="Compute signature from this bowtie standard output" name="input" type="data">
39 <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" />
40 </param>
41 </when>
42 <when value="history">
43 <param format="fasta" label="Select the fasta reference" name="ownFile" type="data" />
44 <param format="tabular,sam,bam" label="Compute signature from this bowtie standard output" name="input" type="data" />
45 </when>
46 </conditional>
47 <param help="'23' = 23 nucleotides" label="Min size of query small RNAs" name="minquery" size="3" type="integer" value="23" />
48 <param help="'29' = 29 nucleotides" label="Max size of query small RNAs" name="maxquery" size="3" type="integer" value="29" />
49 <param help="'23' = 23 nucleotides" label="Min size of target small RNAs" name="mintarget" size="3" type="integer" value="23" />
50 <param help="'29' = 29 nucleotides" label="Max size of target small RNAs" name="maxtarget" size="3" type="integer" value="29" />
51 <param help="'1' = 1 nucleotide overlap" label="Minimal relative overlap analyzed" name="minscope" size="3" type="integer" value="1" />
52 <param help="'1' = 1 nucleotide overlap" label="Maximal relative overlap analyzed" name="maxscope" size="3" type="integer" value="26" />
53 <param help="Signature can be computed globally or by item present in the alignment file" label="Graph type" name="graph_type" type="select">
54 <option selected="True" value="global">Global</option>
55 <option value="lattice">Lattice</option>
56 </param>
57 </inputs>
58 <outputs>
59 <data format="tabular" label="signature data frame" name="output" />
60 <data format="pdf" label="Overlap probabilities" name="output2" />
61 </outputs>
62 <tests>
63 <test>
64 <param name="genomeSource" value="history" />
65 <param ftype="fasta" name="ownFile" value="ensembl.fa" />
66 <param ftype="bam" name="input" value="sr_bowtie.bam" />
67 <param name="minquery" value="23" />
68 <param name="maxquery" value="29" />
69 <param name="mintarget" value="23" />
70 <param name="maxtarget" value="29" />
71 <param name="minscope" value="5" />
72 <param name="maxscope" value="15" />
73 <param name="graph_type" value="global" />
74 <output file="signature.tab" ftype="tabular" name="output" />
75 <output file="signature.pdf" ftype="pdf" name="output2" />
76 </test>
77 </tests>
78 <help>
79
80 **What it does**
81
82 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.
83 The numerical options set the min and max size of both the query small rna class and the target small rna class.
84 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.
85
86 </help>
87 <citations>
88 <citation type="doi">10.1007/978-1-4939-0931-5_12</citation>
89 </citations>
90 <configfiles>
91 <configfile name="sigplotter">
92 graph_type = "${graph_type}"
93
94 globalgraph = function () {
95 ## Setup R error handling to go to stderr
96 options( show.error.messages=F,
97 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
98 signature = read.delim("${output}", header=TRUE)
99 signaturez=data.frame(signature[,1], (signature[,2] -mean(signature[,2]))/sd(signature[,2]))
100 overlap_prob_z=data.frame(signature[,1], (signature[,3] -mean(signature[,3]))/sd(signature[,3]))
101 YLIM=max(signature[,2])
102
103
104 ## Open output2 PDF file
105 pdf( "${output2}" )
106 if (YLIM!=0) {
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 }
121 devname = dev.off()
122 ## Close the PDF file
123 }
124
125 treillisgraph = function () {
126 ## Open output2 PDF file
127 pdf( "${output2}", paper="special", height=11.69, width=8.2677 )
128 signature = read.delim("${output}", header=TRUE)
129 options( show.error.messages=F,
130 error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
131 library(lattice)
132 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",
133 par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), scales=list(cex=0.5),
134 cex.main=1, cex=.5, xlab="overlap (nt)", ylab="ping-pong signal [%]",
135 pch=19, col="darkslateblue", lwd =1.5, cex.lab=1.2, cex.axis=1.2,
136 layout=c(4,12), as.table=TRUE, newpage = T) )
137 devnname = dev.off()
138 }
139
140 if (graph_type=="global") {
141 globalgraph()
142
143 }
144 if(graph_type=="lattice") {
145 treillisgraph()
146 }
147 </configfile>
148 </configfiles>
149 </tool>