Mercurial > repos > drosofff > pirna_signatures
changeset 0:a8844a18de0d draft
Uploaded
author | drosofff |
---|---|
date | Mon, 23 Jun 2014 04:09:27 -0400 |
parents | |
children | d1b99ef50f79 |
files | piRNAsignature.xml |
diffstat | 1 files changed, 122 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piRNAsignature.xml Mon Jun 23 04:09:27 2014 -0400 @@ -0,0 +1,122 @@ +<tool id="piRNAsignature" name="piRNA Signatures" version="1.0.1"> + <description></description> + <command interpreter="python"> + piRNAsignature.py $refGenomeSource.input $refGenomeSource.input.ext $minquery $maxquery $mintarget $maxtarget $minscope $maxscope $output + #if $refGenomeSource.genomeSource == "history": + $refGenomeSource.ownFile + --do_not_extract_index + #else: + #silent reference= filter( lambda x: str( x[0] ) == str( $input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1] + $reference + --extract_index + #end if + $graph_type + $sigplotter + </command> + + <inputs> + <conditional name="refGenomeSource"> + <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"> + <option value="indexed">Use a built-in index</option> + <option value="history">Use one from the history</option> + </param> + <when value="indexed"> + <param name="input" type="data" format="tabular,sam,bam" label="Compute signature from this bowtie standard output"> + <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."/> + </param> + </when> + <when value="history"> + <param name="ownFile" type="data" format="fasta" label="Select the fasta reference" /> + <param name="input" type="data" format="tabular,sam,bam" label="Compute signature from this bowtie standard output"/> + </when> + </conditional> <!-- refGenomeSource --> + <param name="minquery" type="integer" size="3" value="23" label="Min size of query small RNAs" help="'23' = 23 nucleotides"/> + <param name="maxquery" type="integer" size="3" value="29" label="Max size of query small RNAs" help="'29' = 29 nucleotides"/> + <param name="mintarget" type="integer" size="3" value="23" label="Min size of target small RNAs" help="'23' = 23 nucleotides"/> + <param name="maxtarget" type="integer" size="3" value="29" label="Max size of target small RNAs" help="'29' = 29 nucleotides"/> + <param name="minscope" type="integer" size="3" value="1" label="Minimal relative overlap analyzed" help="'1' = 1 nucleotide overlap"/> + <param name="maxscope" type="integer" size="3" value="26" label="Maximal relative overlap analyzed" help="'1' = 1 nucleotide overlap"/> + <param name="graph_type" type="select" label="Graph type" help="Signature can be computed globally or by item present in the alignment file"> + <option value="global" selected="True">Global</option> + <option value="lattice">Lattice</option> + </param> + </inputs> + + <configfiles> + <configfile name="sigplotter"> + 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) + ## Open output1 PDF file + pdf( "${output1}" ) + signaturez=(signature[,2] -mean(signature[,2]))/sd(signature[,2]) + 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") + axis(1, at=seq(from=1, to=length(signature[,1]), by=3) ) + devname = dev.off() + ## Close the PDF file + ## Open output2 PDF file + pdf( "${output2}" ) + YLIM=max(signature[,2]) + plot(signature[,1:2], type = "h", xlab="overlap (nt)", ylim=c(0,YLIM), ylab="number of pairs", col="darkslateblue", lwd=7) + devname = dev.off() + ## Close the PDF file + ## Open output3 PDF file + pdf( "${output3}" ) + plot(signature[,1], signature[,3]*100, type = "l", main="ping-pong Signature of ${minquery}-${maxquery} against ${mintarget}-${maxtarget}nt small RNAs", + cex.main=1, xlab="overlap (nt)", ylab="ping-pong signal [%]", ylim=c(0,50), + pch=19, col="darkslateblue", lwd =4, cex.lab=1.2, cex.axis=1, xaxt="n") + axis(1, at=seq(from=1, to=length(signature[,1]), by=3) ) + devname = dev.off() + ## Close the PDF file + } + + treillisgraph = function () { + ## Open output3 PDF file + pdf( "${output3}", 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(1,26), 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() + } + </configfile> + </configfiles> + + <outputs> + <data name="output" format="tabular" label = "signature data frame"/> + <data name="output2" format="pdf" label="number of pairs signature"> + <filter>(graph_type == "global")</filter> + </data> + <data name="output1" format="pdf" label="z-score signature"> + <filter>(graph_type == "global")</filter> + </data> + <data name="output3" format="pdf" label="ping-pong signal (hannon algo.)"/> + </outputs> + + <help> + +**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. + + </help> +</tool>