[Patchwork-commits] r44 - pkg/patchwork/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 9 11:30:21 CET 2011


Author: sebastian_d
Date: 2011-12-09 11:30:19 +0100 (Fri, 09 Dec 2011)
New Revision: 44

Modified:
   pkg/patchwork/R/patchwork.CNA.r
   pkg/patchwork/R/patchwork.readChroms.r
Log:
Added suppression of error messages for missing datafiles in working directory

Modified: pkg/patchwork/R/patchwork.CNA.r
===================================================================
--- pkg/patchwork/R/patchwork.CNA.r	2011-12-08 16:21:20 UTC (rev 43)
+++ pkg/patchwork/R/patchwork.CNA.r	2011-12-09 10:30:19 UTC (rev 44)
@@ -10,10 +10,15 @@
 	#load(paste(packagepath,"/data/ideogram.RData",sep=""))
 	#load(paste(packagepath,"/data/normaldata.RData",sep=""))
 	
+	#Inhibit error message from try.
+	options(show.error.messages=FALSE)
+	
 	#Attempt to read file pile.alleles, incase its already been created.
 	alf = NULL
 	try( load("pile.alleles.Rdata"), silent=TRUE )
 	
+	options(show.error.messages=TRUE)
+	
 	#If it wasnt created, create it using the perl script pile2alleles.pl
 	#which is included in the package. Creates pile.alleles in whichever folder
 	#you are running R from. (getwd())
@@ -31,14 +36,15 @@
 	
 	chroms = as.character(unique(ideogram$chr))	
 		
-		
-	#relic from using alf as chrom generator.
-	#chroms = chroms[chroms != chroms[grep("M",chroms)]]
+	#Inhibit error message from try.
+	options(show.error.messages=FALSE)
 	
 	## Read coverage data. If already done, will load "data.Rdata" instead.
 	data=NULL
 	try ( load('data.Rdata'), silent=TRUE )
 	
+	options(show.error.messages=TRUE)
+	
 	#If data object does not exist, IE it was not loaded in the previous line
 	#perform the function on the chromosomes to create the object.
 	if(is.null(data))
@@ -70,10 +76,15 @@
 		cat("Application of Reference Complete \n")
 		save(data,file='data.Rdata')
 		}
+	
+	#Inhibit error message from try.
+	options(show.error.messages=FALSE)
 
 	kbsegs = NULL
 	try( load("smoothed.Rdata"), silent=TRUE )
 	
+	options(show.error.messages=TRUE)
+	
 	if(length(kbsegs) == 0)
 		{
 		#Apply smoothing to the data.
@@ -83,13 +94,20 @@
 		cat("Smoothing Complete \n")
 		}
 	
+	#Inhibit error message from try.
+	options(show.error.messages=FALSE)
+	
 	segs = NULL
 	try( load("Segments.Rdata"), silent=TRUE )
 	
+	options(show.error.messages=TRUE)
+	
 	if(length(segs) == 0)
 		{
 		#Segment the data.
 		cat("Initiating Segmentation \n")
+		cat("Note: If segmentation fails to initiate the probable reason is that you have not ")
+		cat("installed the R package DNAcopy. See patchwork's README for installation instructions. \n")
 		segs = patchwork.segment(kbsegs,chroms,Alpha,SD)
 		save(segs,file="Segments.Rdata")
 		cat("Segmentation Complete \n")

Modified: pkg/patchwork/R/patchwork.readChroms.r
===================================================================
--- pkg/patchwork/R/patchwork.readChroms.r	2011-12-08 16:21:20 UTC (rev 43)
+++ pkg/patchwork/R/patchwork.readChroms.r	2011-12-09 10:30:19 UTC (rev 44)
@@ -25,7 +25,8 @@
 	#copy python folder
 	system(paste("cp -r ",packagepath,"/python .python",sep=""))
 	
-	#if .python folder exists, delete it.
+	#Inhibit error message from try.
+	options(show.error.messages=FALSE)
 	
 	#If import pysam doesnt work, ie pysam isnt installed yet, we install pysam.
 	if (system(paste("python ",getwd(),"/.python/Check.py",sep=""),intern=T) == "Pysam Not Available")
@@ -37,6 +38,8 @@
 			system("python setup.py install --user",invisible=F)
 			setwd("..")
 			}
+	
+	options(show.error.messages=TRUE)
 
 
 	readlength=80 # this is currently hard coded and may be adjusted.



More information about the Patchwork-commits mailing list