Mercurial > repos > stef > qdnaseq
changeset 81:5eec30e0fcce draft
Uploaded
author | stef |
---|---|
date | Thu, 28 May 2015 13:45:43 -0400 |
parents | 67cbaa54fa03 |
children | 60a73de54206 |
files | QDNAseq-plot.R QDNAseq-plot.xml QDNAseq-version.R QDNAseq.xml |
diffstat | 4 files changed, 84 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/QDNAseq-plot.R Fri May 08 05:59:20 2015 -0400 +++ b/QDNAseq-plot.R Thu May 28 13:45:43 2015 -0400 @@ -37,11 +37,36 @@ catMsg( c( rVersion ) ) qdnaseqObject <- readRDS( rdsFilePath ) +chromosomesToPlot <- unlist( strsplit( chromosomesToPlotString, ",") ) + +#cat( "CHROM: ", chromosomesToPlotString, "\n" ) +#cat( "REGION: ", regionToPlotString, "\n" ) +#cat( "What to plot: ", whatToPlot, "\n" ) + ## COPYNUMBER PLOT sample <- SAMPLE_INDEX png( outputPngPath, width=PLOT_WIDTH, height=PLOT_HEIGHT, res=PLOT_RES ) par( PAR_SET ) - plot( qdnaseqObject[ ,sample ] ) + if ( whatToPlot == 'everything' ){ + catMsg( c( "Plotting all data in object" ) ) + plot( qdnaseqObject[ ,sample ] ) + } else if( whatToPlot == 'chromosomes' ){ + catMsg( c( "Plotting subset of chromosomes" ) ) + fdata <- qdnaseqObject@featureData@data + idx_region <- which( fdata$chromosome %in% chromosomesToPlot ) + plot( qdnaseqObject[ idx_region, sample ] ) + } else if( whatToPlot == 'region' ){ + regionC <- chrName + regionS <- chrStart + regionE <- chrEnd + if ( regionS > regionE ) stop("Chosen start is > end") + catMsg( c( "Plotting genomic region (chr=", regionC, " start=", regionS, " end=", regionE, ")" ) ) + + fdata <- qdnaseqObject@featureData@data + idx_region <- which( fdata$chromosome == regionC & fdata$start > regionS & fdata$end < regionE ) + + plot( qdnaseqObject[ idx_region, sample ], doCalls=FALSE ) + } #mtext( "plotted in galaxy", 3 ) abline( h=c(-2,-1,1,2,3,4), lty=1, lwd=0.5, col="grey" ) dev.off()
--- a/QDNAseq-plot.xml Fri May 08 05:59:20 2015 -0400 +++ b/QDNAseq-plot.xml Thu May 28 13:45:43 2015 -0400 @@ -1,4 +1,4 @@ -<tool id="QDNAseq-plot" name="QDNAseq-plot" version="0.0.1" force_history_refresh="True"> +<tool id="QDNAseq-plot" name="QDNAseq-plot" version="0.0.2" force_history_refresh="True"> <requirements> @@ -16,6 +16,8 @@ $cfg </command> + <version_command interpreter="Rscript">QDNAseq-version.R</version_command> + <stdio> <!-- Anything higher than 0 means the R script didnt finish (correctly) --> <!-- Because different R packages deal with err/warn differently unable to waterproof this --> @@ -57,7 +59,53 @@ </conditional> --> - <param name="sample_index" type="integer" required="True" value="1" label="Sample-index (integer)" help="The RDS input object can contain data from multiple individuals, this number tells the script which one to plot. Plotting multiple at the same time is not supported." /> + <param name="sample_index" type="integer" required="True" value="1" label="Sample-index (integer)" help="The RDS input object can contain data from multiple samples, this index tells the script which one to plot. Plotting multiple samples at the same time is not supported." /> + + <conditional name="subset_selection"> + <param name="what_to_plot" type="select" label="What to plot" help="Instead of plotting everything in the object you can also select certain chromosomes or set a genomic region"> + <option value="all">Everything</option> + <option value="chromosomes">Selected chromosomes</option> + <option value="region">Genomic region</option> + </param> + <when value="all"> + <!-- ==================== --> + </when> + <when value="chromosomes"> + <!-- ==================== --> + <param name="chromosomes" type="select" multiple="true" optional="false" label="Select chromosomes to plot" help="To zoom in on a particular chromosome you can select one or more here"> + <option value="1">1</option><option value="2">2</option> + <option value="3">3</option><option value="4">4</option> + <option value="5">5</option><option value="6">6</option> + <option value="7">7</option><option value="8">8</option> + <option value="9">9</option><option value="10">10</option> + <option value="11">11</option><option value="12">12</option> + <option value="13">13</option><option value="14">14</option> + <option value="15">15</option><option value="16">16</option> + <option value="17">17</option><option value="18">18</option> + <option value="19">19</option><option value="20">20</option> + <option value="21">21</option><option value="22">22</option> + <!--<option value="X" selected="true">X</option>--> + <!--<option value="Y" selected="true">Y</option>--> + </param> + <param name="chr_name" type="hidden" value="NA" /> + <param name="chr_start" type="hidden" value="NA" /> + <param name="chr_end" type="hidden" value="NA" /> + </when> + <when value="region"> + <!-- ==================== --> + <!-- + <param name="genomic_region" type="text" optional="false" label="Genomic region" help="Supply a genomic region in format chr1:12345-23456" value="chr1:12345-23456" size="30"> + <validator type="regex" message="No whitespace characters allowed">^[^\s\\]*$</validator> + <validator type="regex" message="String is not of correct format">^chr\d+\:\d+\-\d+$</validator> + </param> + --> + <param name="chr_name" size="2" type="integer" optional="false" value="" label="Chromosome" /> + <param name="chr_start" size="15" type="integer" optional="false" value="" label="Start position on chromosome" /> + <param name="chr_end" size="15" type="integer" optional="false" value="" label="End position on chromosome" /> + <param name="chromosomes" type="hidden" value="NA" /> + </when> + + </conditional> <!-- ==================== --> <!-- Optional advanced options --> @@ -98,6 +146,11 @@ "${outputPng}" -> outputPngPath "${rdsFile}" -> rdsFilePath as.integer( "${sample_index}" ) -> SAMPLE_INDEX +"${subset_selection.what_to_plot}" -> whatToPlot +"${subset_selection.chromosomes}" -> chromosomesToPlotString +"${subset_selection.chr_name}" -> chrName +"${subset_selection.chr_start}" -> chrStart +"${subset_selection.chr_end}" -> chrEnd ## ----- ## extra options
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/QDNAseq-version.R Thu May 28 13:45:43 2015 -0400 @@ -0,0 +1,1 @@ +cat( packageDescription("QDNAseq", fields = "Version") ) \ No newline at end of file
--- a/QDNAseq.xml Fri May 08 05:59:20 2015 -0400 +++ b/QDNAseq.xml Thu May 28 13:45:43 2015 -0400 @@ -19,6 +19,8 @@ \$QDNASEQ_PATH </command> + <version_command interpreter="Rscript">QDNAseq-version.R</version_command> + <stdio> <!-- Anything higher than 0 means the R script didnt finish (correctly) --> <!-- Because different R packages deal with err/warn differently unable to waterproof this -->