[Genabel-commits] r1107 - in pkg/GenABEL: . R inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 22 22:37:27 CET 2013


Author: yurii
Date: 2013-02-22 22:37:26 +0100 (Fri, 22 Feb 2013)
New Revision: 1107

Modified:
   pkg/GenABEL/CHANGES.LOG
   pkg/GenABEL/DESCRIPTION
   pkg/GenABEL/R/impute2databel.R
   pkg/GenABEL/R/zzz.R
   pkg/GenABEL/inst/unitTests/runit.impute2xxx.R
Log:
messing up with the 'SNP' argument of the 'apply2dfo' function in order to avoid NOTE from CRAN upon submission; updating release date

Modified: pkg/GenABEL/CHANGES.LOG
===================================================================
--- pkg/GenABEL/CHANGES.LOG	2013-02-22 08:53:10 UTC (rev 1106)
+++ pkg/GenABEL/CHANGES.LOG	2013-02-22 21:37:26 UTC (rev 1107)
@@ -1,5 +1,9 @@
-***  v. 1.7-4 (2013.02.03)
+***  v. 1.7-4 (2013.02.22)
 
+(2013.02.22)
+replacing SNP with get("SNP") in impute2databel with option 'old' so to avoid 
+CRAN checks complains 
+
 (2013.02.03)
 Fixing bug in 'grammar': when using 'gamma', effects and s.e.s are not re-computed
 (bug reported by Xia Shen)

Modified: pkg/GenABEL/DESCRIPTION
===================================================================
--- pkg/GenABEL/DESCRIPTION	2013-02-22 08:53:10 UTC (rev 1106)
+++ pkg/GenABEL/DESCRIPTION	2013-02-22 21:37:26 UTC (rev 1107)
@@ -2,7 +2,7 @@
 Type: Package
 Title: genome-wide SNP association analysis
 Version: 1.7-4
-Date: 2013-02-03
+Date: 2013-02-22
 Author: GenABEL project developers
 Contact: GenABEL project developers <genabel.project at gmail.com>
 Maintainer: Yurii Aulchenko <yurii at bionet.nsc.ru>

Modified: pkg/GenABEL/R/impute2databel.R
===================================================================
--- pkg/GenABEL/R/impute2databel.R	2013-02-22 08:53:10 UTC (rev 1106)
+++ pkg/GenABEL/R/impute2databel.R	2013-02-22 21:37:26 UTC (rev 1107)
@@ -73,13 +73,14 @@
 	#print("before apply2dfo")
 	#print("calling apply2dfo")
 	if (old) {
+#		stop("'old' ways are no longer there...")
 		dosefile <- apply2dfo(dfodata=tmp_fv, anFUN = "makedose", 
-				MAR = 2, procFUN = "pfun",prob=SNP,
+				MAR = 2, procFUN = "pfun",prob=get("SNP"),
 				outclass="databel",
 				outfile=paste(outfile,".dose",sep=""),
 				type="FLOAT",transpose=FALSE)
 		if (makeprob) {
-			warning("makeprob is not possible with 'old' style")
+			stop("makeprob is not possible with 'old' style")
 		}
 	} else {
 		res <- .Call("iterator", tmp_fv at data, as.integer(0), as.integer(0),

Modified: pkg/GenABEL/R/zzz.R
===================================================================
--- pkg/GenABEL/R/zzz.R	2013-02-22 08:53:10 UTC (rev 1106)
+++ pkg/GenABEL/R/zzz.R	2013-02-22 21:37:26 UTC (rev 1107)
@@ -5,7 +5,7 @@
 	#pkgVersion <- pkgDescription$Version
 	#pkgDate <- pkgDescription$Date
 	pkgVersion <- "1.7-4"
-	pkgDate <- "February 03, 2013"
+	pkgDate <- "February 22, 2013"
 	welcomeMessage <- paste(pkg," v. ",pkgVersion," (",pkgDate,") loaded\n",sep="")
 	# check if CRAN version is the same as loaded
 	cranVersion <- try( checkPackageVersionOnCRAN(pkg) )

Modified: pkg/GenABEL/inst/unitTests/runit.impute2xxx.R
===================================================================
--- pkg/GenABEL/inst/unitTests/runit.impute2xxx.R	2013-02-22 08:53:10 UTC (rev 1106)
+++ pkg/GenABEL/inst/unitTests/runit.impute2xxx.R	2013-02-22 21:37:26 UTC (rev 1107)
@@ -4,6 +4,7 @@
 	## Not really needed, but can be handy when writing tests
 	library("RUnit")
 	library("GenABEL")
+	library("DatABEL")
 }
 
 ### do not run
@@ -115,3 +116,58 @@
 	
 }
 
+# fixing CRAN NOTE
+#
+test.SNPquoted <- function() {	
+	#library("RUnit")
+	#library("GenABEL")
+	require(DatABEL)
+# generate some random data in "prob" format
+	Nids <- 10
+	Nsnps <- 3
+	q <- runif(Nsnps,min=0.2,max=0.8)
+	PROB0 <- apply(matrix(q,ncol=1),MARGIN=1,FUN=function(x){
+				cBB <- rnorm(Nids,mean=x^2,sd=0.01)
+				cAB <- rnorm(Nids,mean=2*x*(1-x),sd=0.01)
+				cAA <- 1-cBB-cAB
+				cAA <- matrix(cAA,ncol=1)
+				return(c(cAA,cAB,cBB))
+			})
+	PROB <- matrix(NA,ncol=3*Nsnps,nrow=Nids)
+	for (i in 1:Nsnps) {
+		for (j in 1:3) {
+			PROB[,(i-1)*3+j] <- PROB0[c(((j-1)*Nids+1):(j*Nids)),i]
+		}
+	}
+	daProb <- matrix2databel(t(PROB),filename="temp_daProb")
+	
+# conversion functions
+	makedose <- function(prob) {
+		dose <- 2*prob[c(F,F,T)]+prob[c(F,T,F)]
+		bp <- prob[c(T,F,F)]
+		miss <- which(abs(bp)<1e-16 & abs(dose)<1e-16)
+		if (length(miss) > 0 ) dose[miss] <- NA
+		return(dose)
+	}
+	pfun <- function(a) return(a)
+
+	dosefile <- apply2dfo(dfodata=daProb, anFUN = "makedose", 
+			MAR = 2, procFUN = "pfun",prob=get("SNP"),
+			outclass="databel",
+			outfile="temp_myTestDose",
+			type="DOUBLE",transpose=FALSE)
+	
+# check equality
+	DOSE <- matrix(NA,ncol=Nids,nrow=Nsnps)
+	for (i in 1:Nids) for (j in 1:Nsnps) {
+			DOSE[j,i] <- 2*PROB[i,j*3]+PROB[i,j*3-1]
+		}
+	
+	checkEqualsNumeric(DOSE,as(dosefile,"matrix"))
+	
+	rm(dosefile); gc()
+	unlink("temp_myTestDose.fv?")
+	
+	rm(daProb); gc()
+	unlink("temp_daProb.fv?")
+}



More information about the Genabel-commits mailing list