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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 20 16:30:07 CET 2012


Author: mayrhofer
Date: 2012-02-20 16:30:07 +0100 (Mon, 20 Feb 2012)
New Revision: 102

Modified:
   pkg/patchwork/R/patchwork.CNA.r
   pkg/patchwork/R/patchwork.smoothing.r
Log:
functional again

Modified: pkg/patchwork/R/patchwork.CNA.r
===================================================================
--- pkg/patchwork/R/patchwork.CNA.r	2012-02-16 16:38:33 UTC (rev 101)
+++ pkg/patchwork/R/patchwork.CNA.r	2012-02-20 15:30:07 UTC (rev 102)
@@ -24,24 +24,24 @@
 	chroms = as.character(unique(ideogram$chr))	
 	
 	## Read coverage data. If already done, will load "data.Rdata" instead.
-	data=NULL
+	data <- normaldata <- NULL
 	try ( load('data.Rdata'), silent=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)) {
-		cat("Initiating Read Chroms \n")
+		cat("Initiating Read Chromosomal Coverage \n")
 		data = patchwork.readChroms(BamFile,chroms)
-		cat("Read Chroms Complete \n")
+		cat("Read Chromosomal Coverage Complete \n")
 		save(data,file='data.Rdata')
 	}
 	
 	#Perform GC normalization if the amount of columns indicate that gc normalization
 	#has not already been performed.
 	if(length(data) < 7) {
-		cat("Initiating Gc Normalization \n")
+		cat("Initiating GC Content Normalization \n")
 		data = patchwork.GCNorm(data)
-		cat("GC Normalization Complete \n")
+		cat("GC Content Normalization Complete \n")
 		save(data,file='data.Rdata')
 	}
 	#after this, no further normalization was done on reference sequences.
@@ -51,14 +51,14 @@
 		normaldata=NULL
 		try ( load('normaldata.Rdata'), silent=TRUE )
 		if(is.null(normaldata)) {
-			cat("Initiating Read Chroms (matched normal) \n")
-			normaldata = patchwork.readChroms(BamFile,chroms)
-			cat("Read Chroms Complete (matched normal) \n")
+			cat("Initiating Read Chromosomal Coverage (matched normal) \n")
+			normaldata = patchwork.readChroms(normal.bam,chroms)
+			cat("Read Chromosomal Coverage Complete (matched normal) \n")
 		}	
 		if(length(normaldata) != 3) {
-			cat("Initiating Gc Normalization (matched normal) \n")
+			cat("Initiating GC Content Normalization (matched normal) \n")
 			normaldata = patchwork.GCNorm(normaldata[,1:6])
-			cat("GC Normalization Complete \n")
+			cat("GC Content Normalization Complete (matched normal) \n")
 			normaldata <- data.frame(chr=normaldata$chr,pos=normaldata$pos,normal=normaldata$norm)
 			save(normaldata,file='normaldata.Rdata')
 		}
@@ -66,7 +66,7 @@
 	} 
 
 	
-	#Apply smoothing to the data.
+	# Smooth to the data.
 	kbsegs = NULL
 	try( load("smoothed.Rdata"), silent=TRUE )	
 	if(length(kbsegs) == 0)
@@ -107,11 +107,13 @@
 	cat("Initiating Plotting \n")
 	karyotype(segs$chr,segs$start,segs$end,segs$median,segs$ai,
 			name=as.character(BamFile),
-			xlim=c(0,2.4),ylim=c(0.1,1))
+			xlim=c(0,2.4),
+			ylim=c(0.1,1))
 	karyotype_chroms(segs$chr,segs$start,segs$end,segs$median,segs$ai,
 			kbsegs$chr,kbsegs$pos,kbsegs$ratio,
 			alf$achr,alf$apos,(1-alf$amin/alf$amax),
-			name=as.character(BamFile),xlim=c(0,2.4),
+			name=as.character(BamFile),
+			xlim=c(0,2.4),
 			ylim=c(0.1,1))
 	cat("Plotting Complete \n")
 	cat("Shutting down..... \n")

Modified: pkg/patchwork/R/patchwork.smoothing.r
===================================================================
--- pkg/patchwork/R/patchwork.smoothing.r	2012-02-16 16:38:33 UTC (rev 101)
+++ pkg/patchwork/R/patchwork.smoothing.r	2012-02-20 15:30:07 UTC (rev 102)
@@ -7,8 +7,9 @@
 	#load(paste(packagepath,"/data/normaldata.RData",sep=""))
 	data(ideogram,package="patchworkData")	
 
-	reference=ifelse(length(reference)>1, reference, normaldata)
-	data <- merge(data,reference,all=T)
+	if (is.null(normaldata)) load(reference)	
+
+	data <- merge(data,normaldata,all=T)
 	data <- data[order(data$pos),]; data <- data[order(data$chr),]
 	colnames(data)[8] <- 'reference'
 



More information about the Patchwork-commits mailing list