comparison QDNAseq-plot.R @ 78:81ba2f857fe2 draft

Uploaded
author stef
date Wed, 04 Mar 2015 08:42:14 -0500
parents
children 5eec30e0fcce
comparison
equal deleted inserted replaced
77:acf62630e4b5 78:81ba2f857fe2
1 #!/usr/bin/Rscript
2
3 ## --------------------
4 ## prints all arguments as msg
5 ## --------------------
6 catMsg <- function( msg=c() ){
7 cat( MAIN_NAME, paste( msg, collapse="" ), "\n", sep='')
8 }
9
10
11 ## ==================================================
12 ## Start of analysis
13 ## ==================================================
14 MAIN_NAME <- '[INFO] '
15 catMsg( "Starting QDNAseq-plot wrapper" )
16 catMsg( "Loading R libraries" )
17
18 ## supress msg to allow R to finish with non-error msg
19 suppressWarnings( suppressMessages( library( QDNAseq, quietly = TRUE ) ) )
20
21 ## only one param: the tmp config file
22 cmdLineArgs <- commandArgs(TRUE)
23 config <- cmdLineArgs[1]
24
25 ## sourcing the config file will load all input params
26 ## many variables are imported via sourced "config"
27 source( config ) # outputPngPath, outputPdfPath, allOrOne, rdsFilePath
28 #cat( "ALL? ", allOrOne, sep='' )
29
30 ## desparate tries to make png text scale well, damn you R...!
31 PLOT_RES <- min( PLOT_WIDTH, PLOT_HEIGHT ) / 6.3
32 PAR_SET <- list( pch=22 )
33 systemUser <- system("whoami",T)
34 qdnaseqVersion <- packageDescription( "QDNAseq" )$Version
35 rVersion <- R.version.string
36 catMsg( c("QDNAseq version: ", qdnaseqVersion) )
37 catMsg( c( rVersion ) )
38
39 qdnaseqObject <- readRDS( rdsFilePath )
40 ## COPYNUMBER PLOT
41 sample <- SAMPLE_INDEX
42 png( outputPngPath, width=PLOT_WIDTH, height=PLOT_HEIGHT, res=PLOT_RES )
43 par( PAR_SET )
44 plot( qdnaseqObject[ ,sample ] )
45 #mtext( "plotted in galaxy", 3 )
46 abline( h=c(-2,-1,1,2,3,4), lty=1, lwd=0.5, col="grey" )
47 dev.off()
48
49
50 ## all ok
51 q(status=0)