[Patchwork-commits] r72 - in pkg/patchworkCG: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 20 15:11:09 CET 2012


Author: sebastian_d
Date: 2012-01-20 15:11:09 +0100 (Fri, 20 Jan 2012)
New Revision: 72

Added:
   pkg/patchworkCG/R/zzz.R
Modified:
   pkg/patchworkCG/R/patchwork.CG.r
   pkg/patchworkCG/README
Log:
Fixed an issue with input files having varying number of lines to skip before useful data appeared. Added zzz.R for startup message generation

Modified: pkg/patchworkCG/R/patchwork.CG.r
===================================================================
--- pkg/patchworkCG/R/patchwork.CG.r	2012-01-19 16:02:59 UTC (rev 71)
+++ pkg/patchworkCG/R/patchwork.CG.r	2012-01-20 14:11:09 UTC (rev 72)
@@ -60,7 +60,30 @@
 		mastervar_ = list.files(path=path,pattern="masterVar")
 		path_segm = paste(path,"/CNV",sep="")
 		segm_ = list.files(path=path_segm,pattern="somaticCnvSegmentsNondiploid")
+		
+		skip_mv = scan(file=paste(path,"/",mastervar_,sep=""),n=1,what=character(),quiet=T)
+		i = 1
+		j = grep(">locus",skip_mv)
+		while(length(j) != 1)
+			{
+			skip_mv = scan(file=paste(path,"/",mastervar_,sep=""),n=1,skip=i,what=character(),quiet=T)
+			j = grep(">locus",skip_mv)
+			i = i + 1
+			}
+		skip_mv = i + 1
+		
+		skip_sm = scan(file=paste(path_segm,"/",segm_,sep=""),n=1,what=character(),quiet=T)
+		i = 1
+		j = grep(">chr",skip_sm)
+		while(length(j) != 1)
+			{
+			skip_sm = scan(file=paste(path_segm,"/",segm_,sep=""),n=1,skip=i,what=character(),quiet=T)
+			j = grep(">chr",skip_sm)
+			i = i + 1
+			}
+		skip_sm = i + 1
 	
+	
 		cat("\n","Reading files from ASM folder \n")
 	
 		#Read mastervarbeta file in ASM folder
@@ -69,11 +92,11 @@
 							colClasses=c("NULL","NULL","character","integer","integer",
 							"NULL","character",rep("NULL",16),"numeric","numeric",
 							rep("NULL",17),"integer","integer",rep("NULL",5)),
-							skip=21)
+							skip=skip_mv)
 	
 		#Read somaticCnvSegmentsNondiploidBeta in ASM/CNV folder
 		segm = read.table(paste(path_segm,"/",segm_,sep=""),
-					sep="\t",skip=21,
+					sep="\t",skip=skip_sm,
 					colClasses=c("character","integer","integer","numeric","numeric",
 					rep("NULL",7)))
 	

Added: pkg/patchworkCG/R/zzz.R
===================================================================
--- pkg/patchworkCG/R/zzz.R	                        (rev 0)
+++ pkg/patchworkCG/R/zzz.R	2012-01-20 14:11:09 UTC (rev 72)
@@ -0,0 +1,3 @@
+.onLoad <- function(...){
+	packageStartupMessage("Startup message \n cite us! \n How to run this \n")
+	}
\ No newline at end of file

Modified: pkg/patchworkCG/README
===================================================================
--- pkg/patchworkCG/README	2012-01-19 16:02:59 UTC (rev 71)
+++ pkg/patchworkCG/README	2012-01-20 14:11:09 UTC (rev 72)
@@ -42,6 +42,10 @@
 #Before you get started make sure you have the complete path to your ASM folder and that your masterVarBeta
 #and somaticCnvSegmentsNonDiploidBeta are unpacked.
 
+#Some helpful commands for unpacking your CompleteGenomics data:
+#To unpack .tar files:tar -zxvf filename.tar
+#To unpack .bz2 files:bunzip2 filename.bz2
+
 #Start R in your working directory. (Or use setwd() after starting R wherever you choose)
 #See ?patchwork.CG
 



More information about the Patchwork-commits mailing list