# HG changeset patch # User mvdbeek # Date 1429177519 14400 # Node ID 741cc1d168137ec35f58bb1f28f1e39944422d68 # Parent 5c5d12cbf8ed830ee51546bb638473cfe878d79e Uploaded diff -r 5c5d12cbf8ed -r 741cc1d16813 signature.xml --- a/signature.xml Sun Mar 29 12:16:14 2015 -0400 +++ b/signature.xml Thu Apr 16 05:45:19 2015 -0400 @@ -1,4 +1,4 @@ - + bowtie @@ -101,22 +101,25 @@ signaturez=data.frame(signature[,1], (signature[,2] -mean(signature[,2]))/sd(signature[,2])) overlap_prob_z=data.frame(signature[,1], (signature[,3] -mean(signature[,3]))/sd(signature[,3])) YLIM=max(signature[,2]) + ## Open output2 PDF file pdf( "${output2}" ) - par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) - - 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) + if (YLIM!=0) { + par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) - 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) + 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) - plot(signature[,1], signature[,3]*100, type = "l", main="Overlap probabilities", + 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) + + plot(signature[,1], signature[,3]*100, type = "l", main="Overlap probabilities", cex.main=1, xlab="overlap (nt)", ylab="Probability [%]", ylim=c(0,50), pch=19, col="darkslateblue", lwd=2) - 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) + 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) - mtext("Overlap Signatures of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs", outer = TRUE, cex=1) + mtext("Overlap Signatures of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs", outer = TRUE, cex=1) + } devname = dev.off() ## Close the PDF file } diff -r 5c5d12cbf8ed -r 741cc1d16813 signature.xml~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/signature.xml~ Thu Apr 16 05:45:19 2015 -0400 @@ -0,0 +1,148 @@ + + + + bowtie + samtools + pysam + biocbasics + R + numpy + scipy + + + signature.py + --input $refGenomeSource.input + --inputFormat $refGenomeSource.input.ext + --minquery $minquery + --maxquery $maxquery + --mintarget $mintarget + --maxtarget $maxtarget + --minscope $minscope + --maxscope $maxscope + --outputOverlapDataframe $output + #if $refGenomeSource.genomeSource == "history": + --referenceGenome $refGenomeSource.ownFile + #else: + #silent reference= filter( lambda x: str( x[0] ) == str( $input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1] + --referenceGenome $reference + --extract_index + #end if + --graph $graph_type + --rcode $sigplotter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +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. +The numerical options set the min and max size of both the query small rna class and the target small rna class. +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. + + + + 10.1007/978-1-4939-0931-5_12 + + + + graph_type = "${graph_type}" + + globalgraph = function () { + ## Setup R error handling to go to stderr + options( show.error.messages=F, + error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) + signature = read.delim("${output}", header=TRUE) + signaturez=data.frame(signature[,1], (signature[,2] -mean(signature[,2]))/sd(signature[,2])) + overlap_prob_z=data.frame(signature[,1], (signature[,3] -mean(signature[,3]))/sd(signature[,3])) + YLIM=max(signature[,2]) + + ## Open output2 PDF file + pdf( "${output2}" ) + par(mfrow=c(2,2),oma = c(0, 0, 3, 0)) + + 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) + + 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) + + plot(signature[,1], signature[,3]*100, type = "l", main="Overlap probabilities", + cex.main=1, xlab="overlap (nt)", ylab="Probability [%]", ylim=c(0,50), + pch=19, col="darkslateblue", lwd=2) + + 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) + + mtext("Overlap Signatures of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs", outer = TRUE, cex=1) + devname = dev.off() + ## Close the PDF file + } + + treillisgraph = function () { + ## Open output2 PDF file + pdf( "${output2}", paper="special", height=11.69, width=8.2677 ) + signature = read.delim("${output}", header=TRUE) + options( show.error.messages=F, + error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) + library(lattice) + 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", + par.strip.text=list(cex=.5), strip=strip.custom(which.given=1, bg="lightblue"), scales=list(cex=0.5), + cex.main=1, cex=.5, xlab="overlap (nt)", ylab="ping-pong signal [%]", + pch=19, col="darkslateblue", lwd =1.5, cex.lab=1.2, cex.axis=1.2, + layout=c(4,12), as.table=TRUE, newpage = T) ) + devnname = dev.off() + } + + if (graph_type=="global") { + globalgraph() + + } + if(graph_type=="lattice") { + treillisgraph() + } + + + diff -r 5c5d12cbf8ed -r 741cc1d16813 smRtools.pyc Binary file smRtools.pyc has changed