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

Uploaded
author stef
date Wed, 04 Mar 2015 08:42:14 -0500
parents
children 5eec30e0fcce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QDNAseq-plot.R	Wed Mar 04 08:42:14 2015 -0500
@@ -0,0 +1,51 @@
+#!/usr/bin/Rscript
+
+## --------------------
+## prints all arguments as msg
+## --------------------
+catMsg <- function( msg=c() ){	
+	cat( MAIN_NAME, paste( msg, collapse="" ), "\n", sep='')
+}
+
+
+## ==================================================
+## Start of analysis
+## ==================================================
+MAIN_NAME <- '[INFO] '
+catMsg( "Starting QDNAseq-plot wrapper" )
+catMsg( "Loading R libraries" )
+
+## supress msg to allow R to finish with non-error msg
+suppressWarnings( suppressMessages( library( QDNAseq, quietly = TRUE ) ) )
+
+## only one param: the tmp config file
+cmdLineArgs <- commandArgs(TRUE)
+config      <- cmdLineArgs[1]
+
+## sourcing the config file will load all input params
+## many variables are imported via sourced "config"
+source( config ) # outputPngPath, outputPdfPath, allOrOne, rdsFilePath
+#cat( "ALL? ", allOrOne, sep='' )
+
+## desparate tries to make png text scale well, damn you R...!
+PLOT_RES  <- min( PLOT_WIDTH, PLOT_HEIGHT ) / 6.3 
+PAR_SET   <- list( pch=22 )
+systemUser <- system("whoami",T)
+qdnaseqVersion <- packageDescription( "QDNAseq" )$Version
+rVersion <- R.version.string
+catMsg( c("QDNAseq version: ", qdnaseqVersion) )
+catMsg( c( rVersion ) )
+
+qdnaseqObject <- readRDS( rdsFilePath )
+## COPYNUMBER PLOT
+sample <- SAMPLE_INDEX
+png( outputPngPath, width=PLOT_WIDTH, height=PLOT_HEIGHT, res=PLOT_RES )
+	par( PAR_SET )
+	plot( qdnaseqObject[ ,sample ] ) 
+	#mtext( "plotted in galaxy", 3 )
+	abline( h=c(-2,-1,1,2,3,4), lty=1, lwd=0.5, col="grey" )
+dev.off()
+
+
+## all ok
+q(status=0)