Mercurial > repos > stef > qdnaseq
diff QDNAseq-plot.R @ 81:5eec30e0fcce draft
Uploaded
author | stef |
---|---|
date | Thu, 28 May 2015 13:45:43 -0400 |
parents | 81ba2f857fe2 |
children | 8391cdb7479c |
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()