Mercurial > repos > stef > qdnaseq
comparison QDNAseq-plot.R @ 81:5eec30e0fcce draft
Uploaded
author | stef |
---|---|
date | Thu, 28 May 2015 13:45:43 -0400 |
parents | 81ba2f857fe2 |
children | 8391cdb7479c |
comparison
equal
deleted
inserted
replaced
80:67cbaa54fa03 | 81:5eec30e0fcce |
---|---|
35 rVersion <- R.version.string | 35 rVersion <- R.version.string |
36 catMsg( c("QDNAseq version: ", qdnaseqVersion) ) | 36 catMsg( c("QDNAseq version: ", qdnaseqVersion) ) |
37 catMsg( c( rVersion ) ) | 37 catMsg( c( rVersion ) ) |
38 | 38 |
39 qdnaseqObject <- readRDS( rdsFilePath ) | 39 qdnaseqObject <- readRDS( rdsFilePath ) |
40 chromosomesToPlot <- unlist( strsplit( chromosomesToPlotString, ",") ) | |
41 | |
42 #cat( "CHROM: ", chromosomesToPlotString, "\n" ) | |
43 #cat( "REGION: ", regionToPlotString, "\n" ) | |
44 #cat( "What to plot: ", whatToPlot, "\n" ) | |
45 | |
40 ## COPYNUMBER PLOT | 46 ## COPYNUMBER PLOT |
41 sample <- SAMPLE_INDEX | 47 sample <- SAMPLE_INDEX |
42 png( outputPngPath, width=PLOT_WIDTH, height=PLOT_HEIGHT, res=PLOT_RES ) | 48 png( outputPngPath, width=PLOT_WIDTH, height=PLOT_HEIGHT, res=PLOT_RES ) |
43 par( PAR_SET ) | 49 par( PAR_SET ) |
44 plot( qdnaseqObject[ ,sample ] ) | 50 if ( whatToPlot == 'everything' ){ |
51 catMsg( c( "Plotting all data in object" ) ) | |
52 plot( qdnaseqObject[ ,sample ] ) | |
53 } else if( whatToPlot == 'chromosomes' ){ | |
54 catMsg( c( "Plotting subset of chromosomes" ) ) | |
55 fdata <- qdnaseqObject@featureData@data | |
56 idx_region <- which( fdata$chromosome %in% chromosomesToPlot ) | |
57 plot( qdnaseqObject[ idx_region, sample ] ) | |
58 } else if( whatToPlot == 'region' ){ | |
59 regionC <- chrName | |
60 regionS <- chrStart | |
61 regionE <- chrEnd | |
62 if ( regionS > regionE ) stop("Chosen start is > end") | |
63 catMsg( c( "Plotting genomic region (chr=", regionC, " start=", regionS, " end=", regionE, ")" ) ) | |
64 | |
65 fdata <- qdnaseqObject@featureData@data | |
66 idx_region <- which( fdata$chromosome == regionC & fdata$start > regionS & fdata$end < regionE ) | |
67 | |
68 plot( qdnaseqObject[ idx_region, sample ], doCalls=FALSE ) | |
69 } | |
45 #mtext( "plotted in galaxy", 3 ) | 70 #mtext( "plotted in galaxy", 3 ) |
46 abline( h=c(-2,-1,1,2,3,4), lty=1, lwd=0.5, col="grey" ) | 71 abline( h=c(-2,-1,1,2,3,4), lty=1, lwd=0.5, col="grey" ) |
47 dev.off() | 72 dev.off() |
48 | 73 |
49 | 74 |