[Genabel-commits] r1829 - in pkg/OmicABELnoMM: . examples examples/interactions libs src tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 23 10:07:07 CEST 2014


Author: afrank
Date: 2014-09-23 10:07:06 +0200 (Tue, 23 Sep 2014)
New Revision: 1829

Added:
   pkg/OmicABELnoMM/examples/dosages_1.txt
   pkg/OmicABELnoMM/examples/exclude_individuals.txt
   pkg/OmicABELnoMM/examples/interactions/
   pkg/OmicABELnoMM/examples/interactions/INT0.fvd
   pkg/OmicABELnoMM/examples/interactions/INT0.fvi
   pkg/OmicABELnoMM/examples/interactions/INT01.fvd
   pkg/OmicABELnoMM/examples/interactions/INT01.fvi
   pkg/OmicABELnoMM/examples/interactions/INT011.fvd
   pkg/OmicABELnoMM/examples/interactions/INT011.fvi
   pkg/OmicABELnoMM/examples/interactions/INT01R.fvd
   pkg/OmicABELnoMM/examples/interactions/INT01R.fvi
   pkg/OmicABELnoMM/examples/interactions/INT1.fvd
   pkg/OmicABELnoMM/examples/interactions/INT1.fvi
   pkg/OmicABELnoMM/examples/interactions/INT10.fvd
   pkg/OmicABELnoMM/examples/interactions/INT10.fvi
   pkg/OmicABELnoMM/examples/interactions/INT11.fvd
   pkg/OmicABELnoMM/examples/interactions/INT11.fvi
   pkg/OmicABELnoMM/examples/interactions/INT1RR.fvd
   pkg/OmicABELnoMM/examples/interactions/INT1RR.fvi
   pkg/OmicABELnoMM/examples/interactions/INTR.fvd
   pkg/OmicABELnoMM/examples/interactions/INTR.fvi
   pkg/OmicABELnoMM/examples/interactions/INTR0.fvd
   pkg/OmicABELnoMM/examples/interactions/INTR0.fvi
   pkg/OmicABELnoMM/examples/interactions/INTR1.fvd
   pkg/OmicABELnoMM/examples/interactions/INTR1.fvi
   pkg/OmicABELnoMM/examples/interactions/INTRR.fvd
   pkg/OmicABELnoMM/examples/interactions/INTRR.fvi
   pkg/OmicABELnoMM/examples/interactions/XL.fvd
   pkg/OmicABELnoMM/examples/interactions/XL.fvi
   pkg/OmicABELnoMM/examples/interactions/XR.fvd
   pkg/OmicABELnoMM/examples/interactions/XR.fvi
   pkg/OmicABELnoMM/examples/interactions/Y.fvd
   pkg/OmicABELnoMM/examples/interactions/Y.fvi
   pkg/OmicABELnoMM/examples/results/
   pkg/OmicABELnoMM/libs/
   pkg/OmicABELnoMM/libs/include/
   pkg/OmicABELnoMM/libs/lib/
Removed:
   pkg/OmicABELnoMM/examples/small/
Modified:
   pkg/OmicABELnoMM/ChangeLog
   pkg/OmicABELnoMM/configure.ac
   pkg/OmicABELnoMM/examples/CreateData.R
   pkg/OmicABELnoMM/src/AIOwrapper.cpp
   pkg/OmicABELnoMM/src/AIOwrapper.h
   pkg/OmicABELnoMM/src/Algorithm.cpp
   pkg/OmicABELnoMM/src/Algorithm.h
   pkg/OmicABELnoMM/src/Definitions.h
   pkg/OmicABELnoMM/src/Utility.cpp
   pkg/OmicABELnoMM/src/Utility.h
   pkg/OmicABELnoMM/src/main.cpp
   pkg/OmicABELnoMM/tests/test.cpp
Log:
Fixed countless bugs as a cause of non normal problem dimensions. Added several more dimension checks. Removed some warnings and changed comiling commands. Added over 150+ automated tests for validity checks. Broke fake files tests (re-add?). Multiple Non linear interactions added for single analysis. Single Non linear interactions added for multiple analysis. Stable user usable version.

Modified: pkg/OmicABELnoMM/ChangeLog
===================================================================
--- pkg/OmicABELnoMM/ChangeLog	2014-09-12 09:09:15 UTC (rev 1828)
+++ pkg/OmicABELnoMM/ChangeLog	2014-09-23 08:07:06 UTC (rev 1829)
@@ -1,10 +1,13 @@
 
 TODO
 ---------
-Features:
+Required Features:
+-Add support for multiple files
+-Add MPI suport 
+
+Optional Features:
 -Add exclusion lists for single sets of elements of phenotypes
 -Add exclusion lists for single sets of elements of genotypes
--Add nonlinear interactions
 
 Optimizations:
 
@@ -15,6 +18,17 @@
 -------------
 -------------
 
+22-9-2014
+--------------
+Fixed countless bugs as a cause of non normal problem dimensions.
+Added several more dimension checks.
+Removed some warnings and changed comiling commands.
+Added over 150+ automated tests for validity checks.
+Broke fake files tests (re-add?).
+Multiple Non linear interactions added for single analysis.
+Single Non linear interactions added for multiple analysis.
+Stable user usable version.
+
 10-9-2014
 --------------
 Fixed bug related to naming of results.

Modified: pkg/OmicABELnoMM/configure.ac
===================================================================
--- pkg/OmicABELnoMM/configure.ac	2014-09-12 09:09:15 UTC (rev 1828)
+++ pkg/OmicABELnoMM/configure.ac	2014-09-23 08:07:06 UTC (rev 1829)
@@ -18,8 +18,13 @@
 # Set some default compile flags
 if test -z "$CXXFLAGS"; then
    # User did not set CXXFLAGS, so we can put in our own defaults
+<<<<<<< .mine
+   CXXFLAGS=" -O3 -std=c++11 -march=native -mfpmath=sse -flto -funroll-loops"
+  #CXXFLAGS="-g -ggdb -std=c++11"
+=======
    CXXFLAGS=" -O3  -march=corei7 -mfpmath=sse -mtune=corei7 -flto -funroll-loops"
    #CXXFLAGS="-g -ggdb"
+>>>>>>> .r1828
 fi
 if test -z "$CPPFLAGS"; then
    # User did not set CPPFLAGS, so we can put in our own defaults
@@ -38,7 +43,7 @@
 AC_SUBST(AM_CXXFLAGS, "$OPENMP_CFLAGS")
 
 #AM_CXXFLAGS="-static  -g -ggdb -I../libs/include -I./libs/include $AM_CXXFLAGS"
-AM_CXXFLAGS="-static -O3 -I../libs/include -I./libs/include $AM_CXXFLAGS"
+AM_CXXFLAGS="-static -std=c++11 -O3 -I../libs/include -I./libs/include $AM_CXXFLAGS"
 # Checks for libraries.
 # pthread library
 AC_SEARCH_LIBS([pthread_mutex_init], [pthread], [],

Modified: pkg/OmicABELnoMM/examples/CreateData.R
===================================================================
--- pkg/OmicABELnoMM/examples/CreateData.R	2014-09-12 09:09:15 UTC (rev 1828)
+++ pkg/OmicABELnoMM/examples/CreateData.R	2014-09-23 08:07:06 UTC (rev 1829)
@@ -2,13 +2,14 @@
 
 library(DatABEL)
 
-n = 1000 # number of individuals
-l = 4    # number of covariates+1 for intercept
+n = 4000 # number of individuals
+l = 3    # number of covariates+1 for intercept
+int = 3
 r = 2
-m = r*1000 # number of snps
-t = 1000  # number of traits
+m = r*100 # number of snps
+t = 100  # number of traits
+var=0.05
 
-
 set.seed(1001)
 runif(3)
 
@@ -23,6 +24,8 @@
 #XL[1:n,1:(l+1)]
 #XL
 
+
+
 Y <- matrix(rnorm(t*n),ncol=t)
 for(i in 1:(n*t)){ if(sample(1:100,1) > 85) {Y[i]=0/0} }
 colnames(Y) <- paste("ph",1:t,sep="")
@@ -32,107 +35,220 @@
 #Y[1:n,1:t]
 #Y
 
-#prob= TRUE or FALSE
-prob=FALSE
-if (!prob){
-	XR <- matrix(rnorm(m*n),ncol=m)
+#r=2
+XR <- matrix(rnorm(m*n),ncol=m)
 
-	
-	for(i in 1 + r*(0:((m-2)/r)) )
+for(i in 1 + r*(0:((m-2)/r)) )
+{ 
+	#print(i)
+	yIdx=ceiling(i/r)
+	#print(i)
+	#print(yIdx)
+	for(j in 1:n)
 	{ 
-		yIdx=sample(1:t, 1)
-		#print(i)
-		#print(yIdx)
-		for(j in 1:n)
-		{ 
-			XR[j,i]=Y[j,yIdx]
-			for(k in 1:l)
-			{
-				XR[j,i]=XR[j,i]-XL[j,k]*0.01
-			}
-			for(k in 1:(r-1))
-			{
-				XR[j,i]=XR[j,i]-XR[j,i+k]*0.01
-			} 
-			#XR[j,i]=XR[j,i]/2.8888
+		XR[j,i]=Y[j,yIdx]
+		for(k in 1:l)
+		{
+			XR[j,i]=XR[j,i]-XL[j,k]*0.01
 		}
+		for(k in 1:(r-1))
+		{
+			XR[j,i]=XR[j,i]-XR[j,i+k]*0.01
+		}
+		#XR[j,i]=XR[j,i]/2.8888
+		#XR[j,i] = XR[j,i]*runif(1, 1.0-var, 1.0)
+		
 	}
+}
 
-	for(i in 1:(n*m)){ if(sample(1:100,1) > 85) XR[i]=0/0}
+for(i in 1:(n*m)){ if(sample(1:100,1) > 85) XR[i]=0/0}
 
-	
+colnames(XR) <- paste("miss",1:m,sep="")
+for(i in 1:(m/r)){for(j in 1:r) {colnames(XR)[(i-1)*r+(j)] = paste0("snp",paste(i,j,sep="_")) }}
 
-	colnames(XR) <- paste("snp",1:m,sep="")
-	rownames(XR) <- paste("ind",1:n,sep="")
-	XR_db <- matrix2databel(XR,filename="XR",type="FLOAT")
-} else{
-	XR <- matrix(runif(2*m*n),ncol=2*m)
-	for(i in 1:(n*m)){ if(sample(1:100,1) > 85) {XR[i]=0/0}}
-	colnames(XR) <- paste("snp",(1:(2*m)),sep="")
-	colnames(XR)[seq(from=1,to=2*m,by=2)] <- paste("snp",1:m,"_11",sep="")
-	colnames(XR)[seq(from=2,to=2*m,by=2)] <- paste("snp",1:m,"_01",sep="")
-	rownames(XR) <- paste("ind",1:n,sep="")
-	tmp11=XR[,seq(from=1,to=2*m,by=2)]
-	tmp01_00=1-tmp11
-	tmp=matrix(runif(m*n),ncol=m)
-	tmp01=tmp01_00*tmp
-	XR[,seq(from=2,to=2*m,by=2)]=tmp01
-	XR_db <- matrix2databel(XR,filename="XR",type="FLOAT")
-}
 
-#XR[1:n,1:m]
-#XR
+rownames(XR) <- paste("ind",1:n,sep="")
+XR_db <- matrix2databel(XR,filename="XR",type="FLOAT")
 
-XR[is.nan(XR)] <- 0
-for(i in 1:r )
-{ 
-	Avg=sum(XR[,i])/(n-sum(0==XR[,i]))
-	XR[,i][ XR[,i] == 0 ] <- Avg
-}
+############Interactions INI ##########################
 
 
-b=c()
-for(k in 1:t )
-{
-	for(i in 1 + r*(0:((m-2)/r)) )
+
+int = 3
+#interactions with 1 R R
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT1RR",type="FLOAT")
+
+######################
+int = 3
+#interactions with 0 1 R
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=0}
+for(i in (n+1):(n*2)){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT01R",type="FLOAT")
+
+######################
+#interactions with 01 1
+int = 3
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=0}
+for(i in (n+1):(n*2)){ Int[i]=1}
+for(i in (n+2):(n*3)){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT011",type="FLOAT")
+
+######################
+#interactions with 1 1
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=1}
+for(i in (n+1):(n*2)){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT11",type="FLOAT")
+
+######################
+#interactions with 0 1
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=0}
+for(i in (n+1):(n*2)){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT01",type="FLOAT")
+
+######################
+#interactions with 1 0
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+for(i in 1:(n*(int))){ if(sample(1:100,1) > 97){Int[i]=0/0} }
+
+for(i in 1:n){ Int[i]=1}
+for(i in (n+1):(n*2)){ Int[i]=0}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT10",type="FLOAT")
+
+######################
+#interactions with 1
+int = 1
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+for(i in 1:n){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT1",type="FLOAT")
+
+######################
+#interactions with 0
+int = 1
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+for(i in 1:n){ Int[i]=0}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INT0",type="FLOAT")
+
+######################
+#interactions with R0
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+for(i in (n+1):(n*2)){ Int[i]=0}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INTR0",type="FLOAT")
+
+######################
+#interactions with R1
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+for(i in (n+1):(n*2)){ Int[i]=1}
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INTR1",type="FLOAT")
+
+
+######################
+#interactions with RR
+int = 2
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INTRR",type="FLOAT")
+
+######################
+#interactions with R
+int = 1
+Int <- matrix(rnorm(n*int),ncol=(int)) 
+
+
+colnames(Int) <- paste0("int",1:int)
+rownames(Int) <- paste0("ind",1:n)
+Int_db <- matrix2databel(Int,filename="INTR",type="FLOAT")
+
+############Interactions END ##########################
+
+#r=2
+XR <- matrix(rnorm(m*n),ncol=m)
+
+for(i in 1 + r*(0:((m-2)/r)) )
+{ 
+	#print(i)
+	yIdx=ceiling(i/r)
+	#print(i)
+	#print(yIdx)
+	for(j in 1:n)
 	{ 
-		Xtemp=cbind(XL,XR[,i])
-		for(j in 1:(r-1))
+		XR[j,i]=1/2*Y[j,yIdx]
+		for(k in 1:l)
 		{
-			Xtemp=cbind(Xtemp,XR[,i+j])
+			XR[j,i]=XR[j,i]-XL[j,k]*0.01
 		}
-		
-		to_remove=c()
-		idx=1
-		for(j in 1:n)
+		for(k in 1:(r-2))
 		{
-			if(sum(is.nan(XL[j,])) > 0 || is.nan(Y[j,k]))
-			{
-				to_remove[idx]=j
-				idx=idx+1
-			}
+			XR[j,i]=XR[j,i]-XR[j,i+k]*0
 		}
-		X=Xtemp[-c(to_remove),]
-		y=Y[-c(to_remove),k]
-
-		S=base::t(X)%*%X
-		Xy = base::t(X)%*%y
-
-		btemp=solve(S,Xy)
-		#print(y)
-		#print(X)
-		#print(btemp)
-		b=c(b,btemp)
+		#XR[j,i]=XR[j,i]/2.8888
+		#XR[j,i] = XR[j,i]*runif(1, 1.0-var, 1.0)
 		
-
-		
-
-	} 
+	}
 }
 
-to.write = file("bpre.fvd", "wb")
-writeBin(b, to.write,size=4)
-close(to.write)
+for(i in 1:(n*m)){ if(sample(1:100,1) > 85) XR[i]=0/0}
 
+colnames(XR) <- paste("miss",1:m,sep="")
+for(i in 1:(m/r)){for(j in 1:r) {colnames(XR)[(i-1)*r+(j)] = paste0("snp",paste(i,j,sep="_")) }}
 
 
+rownames(XR) <- paste("ind",1:n,sep="")
+XR_db <- matrix2databel(XR,filename="XRint01",type="FLOAT")

Added: pkg/OmicABELnoMM/examples/dosages_1.txt
===================================================================
--- pkg/OmicABELnoMM/examples/dosages_1.txt	                        (rev 0)
+++ pkg/OmicABELnoMM/examples/dosages_1.txt	2014-09-23 08:07:06 UTC (rev 1829)
@@ -0,0 +1 @@
+1
\ No newline at end of file

Added: pkg/OmicABELnoMM/examples/exclude_individuals.txt
===================================================================
--- pkg/OmicABELnoMM/examples/exclude_individuals.txt	                        (rev 0)
+++ pkg/OmicABELnoMM/examples/exclude_individuals.txt	2014-09-23 08:07:06 UTC (rev 1829)
@@ -0,0 +1 @@
+0 99

Added: pkg/OmicABELnoMM/examples/interactions/INT0.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT0.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT0.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT0.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT01.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT01.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT01.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT01.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT011.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT011.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT011.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT011.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT01R.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT01R.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT01R.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT01R.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT1.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT1.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT1.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT1.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT10.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT10.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT10.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT10.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT11.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT11.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT11.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT11.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT1RR.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT1RR.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INT1RR.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INT1RR.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR0.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR0.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR0.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR0.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR1.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR1.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTR1.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTR1.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTRR.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTRR.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/INTRR.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/INTRR.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/XL.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/XL.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/XL.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/XL.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/XR.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/XR.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/XR.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/XR.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/Y.fvd
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/Y.fvd
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: pkg/OmicABELnoMM/examples/interactions/Y.fvi
===================================================================
(Binary files differ)


Property changes on: pkg/OmicABELnoMM/examples/interactions/Y.fvi
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pkg/OmicABELnoMM/src/AIOwrapper.cpp
===================================================================
--- pkg/OmicABELnoMM/src/AIOwrapper.cpp	2014-09-12 09:09:15 UTC (rev 1828)
+++ pkg/OmicABELnoMM/src/AIOwrapper.cpp	2014-09-23 08:07:06 UTC (rev 1829)
@@ -36,7 +36,8 @@
     {
         cout << "Requested dosages model wihtout a valid model!" << endl;
         exit(1);
-    }
+    }
+
     Fhandler->not_done = true;
     Fhandler->model = params.model;
     Fhandler->fname_dosages = params.fname_dosages;
@@ -76,13 +77,30 @@
             exit(1);
         }
 
-        params.n = ALfvi->fvi_header.numObservations;
+        params.n = min((int)(ALfvi->fvi_header.numObservations),params.limit_n);
         Fhandler->fileN = params.n;
+
 
-        params.m = ARfvi->fvi_header.numVariables/params.r;
+        params.m = min((int)(ARfvi->fvi_header.numVariables/params.r),params.limit_m/params.r);
+
+        #ifdef DEBUG
+        cout << "calcM:" << params.m << endl;
+        #endif
+
+        if((int)(ARfvi->fvi_header.numVariables) % params.r != 0)
+        {
+            cout << "Number of elements in "<< (Fhandler->fnameAR+".fvi") <<":"<<  (int)(ARfvi->fvi_header.numVariables)
+                        << " is not consistent with the value of --ngpred (-n)" << params.r << " provided" << endl;
+            exit(1);
+        }
+
+        Fhandler->fileM = params.m;
+
+
         Fhandler->fileR = params.r;
+        Fhandler->modelR = Fhandler->fileR;
 
-        params.t = Yfvi->fvi_header.numVariables;
+        params.t = min((int)(Yfvi->fvi_header.numVariables),params.limit_t);
         params.l = ALfvi->fvi_header.numVariables;
 
         int yname_idx=0;//starting idx for names on ALfvi->data
@@ -103,10 +121,6 @@
         }
 
 
-
-
-
-
         int Aname_idx=params.n*ALfvi->fvi_header.namelength;
         for(int i = 0; i < params.l; i++)
         {
@@ -119,14 +133,14 @@
 
 
 
-        int opt_tb = 500;
-        int opt_mb = 500;
+        int opt_tb = 1000;
+        int opt_mb = 100;//4WONT WORK WTF?
 
         params.mb = min(params.m, opt_mb);
         params.tb = min(params.t, opt_tb);
 
-        //cout << params.m << ":" << params.mb << endl;
 
+
 
 
     }
@@ -135,68 +149,30 @@
         //other params come from outside
     }
 
-    Fhandler->use_interactions = params.use_interactions;
-    Fhandler->keep_depVar = params.keep_depVar;
-    Fhandler->expand_depVar = params.expand_depVar;
+    params.mb = min(params.m,params.mb);
+    params.tb = min(params.t,params.tb);
 
-    if(params.use_interactions && params.r != 1)
-    {
-        cout << "Interactions can be only of the form y~cov+V1*X+...+Vi*X, (only with --ngpred=1 or models excluding(--mylinear)) !" << endl;
-        exit(1);
-    }
-    else
-    {
-        if( Fhandler->use_interactions)
-        {
-            Ifvi  = load_databel_fvi( (Fhandler->fname_interactions+".fvi").c_str() );
+    Fhandler->Ar_file_blocksize = params.mb;
 
 
-            if(Ifvi->fvi_header.numObservations !=  ARfvi->fvi_header.numObservations  )
-            {
-                cout << "The number of elements/individuals from the input files do not coincide with each other! See:" << endl;
-                cout << Fhandler->fnameY << ":" <<  Ifvi->fvi_header.numObservations << endl;
-                cout << Fhandler->fnameAR << ":" << ARfvi->fvi_header.numObservations << endl;
-                exit(1);
-            }
+    //!excludeLIST
+    int excl_count = 0;
+    int Almissings = 0;
+    Fhandler->excl_List = new list< pair<int,int> >();
 
-            Fhandler->numInter = Ifvi->fvi_header.numVariables;
 
-            if(Fhandler->expand_depVar)
-            {
-                //params.m = ???
-            }
-            else
-            {
-                params.r += Fhandler->numInter;
-            }
 
-            if(Fhandler->keep_depVar)
-            {
-                params.r += 1;
-            }
-            else
-            {
 
-            }
 
-        }
-    }
+    (Fhandler->excl_List)->push_back( make_pair(0,params.n) );
 
-
-    //params.fname_excludelist = "exclfile.txt";
-    int excl_count = 0;
-    int Almissings = 0;
-    Fhandler->excl_List = new list< pair<int,int> >();
-
-
-
-    if(params.fname_excludelist.size()==0)
+    if(params.fname_excludelist.size()!=0)
     {
-        (Fhandler->excl_List)->push_back( make_pair(0,params.n) );
-    }
-    else
-    {
         read_excludeList( Fhandler->excl_List,excl_count,params.n,params.fname_excludelist);
+//         for (list<  pair<int,int>  >::iterator it= (Fhandler->excl_List)->begin(); it !=  (Fhandler->excl_List)->end(); ++it)
+//         {
+//            cout << it->first << "-" << it->second << " | ";
+//         }
     }
 
     if(!Fhandler->fakefiles)
@@ -206,13 +182,14 @@
 
     }
 
-    params.n -= (excl_count + Almissings);
 
+    //!DOSAGES
     if(params.dosages)
     {
 
         Fhandler->ArDosage = new float[Fhandler->fileR*params.n];
         Fhandler->dosages = new float[Fhandler->fileR];
+        Fhandler->modelR = 1;
 
 
         switch (Fhandler->model)
@@ -262,6 +239,7 @@
             read_dosages(params.fname_dosages,Fhandler->fileR,Fhandler->dosages);
             Fhandler->add_dosages = false;
             Fhandler->dosage_skip = 0 ;
+            Fhandler->modelR = params.r;
         break;
         case 4://additive
             read_dosages(params.fname_dosages,Fhandler->fileR,Fhandler->dosages);
@@ -271,80 +249,327 @@
         }
     }
 
+    //!INTERACTIONS
 
+    Fhandler->use_interactions = params.use_interactions;
+    Fhandler->keep_depVar = params.keep_depVar;
+    Fhandler->use_multiple_interaction_sets = params.use_multiple_interaction_sets;
+    Fhandler->fname_interactions = params.fname_interactions;
 
+    if(Fhandler->use_interactions && Fhandler->modelR > 1)
+    {
+        if(Fhandler->use_dosages)
+        {
+            cout << "Cannot use Interactions with the current dosage model! #Of factors can be at most 1!" << endl;
+        }
+
+        {
+            cout << "Cannot use Interactions with --ngpred set to: " << params.r << ". Required is 1!" <<  endl;
+            cout << "Interactions can be only of the form y~cov+V1*X+...+Vi*X, (only with --ngpred=1 or models excluding(--mylinear)) !" << endl;
+        }
+        exit(1);
+    }
+
+
+    int interaction_missings = 0;
+    if( Fhandler->use_interactions)
+    {
+
+        //cout << Fhandler->fname_interactions;
+        Ifvi  = load_databel_fvi( (Fhandler->fname_interactions+".fvi").c_str() );
+
+        if(Ifvi->fvi_header.numObservations !=  ARfvi->fvi_header.numObservations  )
+        {
+            cout << "The number of elements/individuals from the input files do not coincide with each other! See:" << endl;
+            cout << Fhandler->fnameY << ":" <<  Ifvi->fvi_header.numObservations << endl;
+            cout << Fhandler->fnameAR << ":" << ARfvi->fvi_header.numObservations << endl;
+            exit(1);
+        }
+
+        if(params.end_IDX_interactions != -1 || params.ini_IDX_interactions != -1)
+        {
+            Fhandler->numInter = params.end_IDX_interactions - params.ini_IDX_interactions+1;
+            Fhandler->ini_IDX_interactions =  params.ini_IDX_interactions;
+            Fhandler->end_IDX_interactions = params.end_IDX_interactions;
+        }
+        else
+        {
+            Fhandler->numInter = Ifvi->fvi_header.numVariables;
+            Fhandler->ini_IDX_interactions = 0;
+            Fhandler->end_IDX_interactions = Fhandler->numInter;
+        }
+
+        if((unsigned int)(Fhandler->numInter) > Ifvi->fvi_header.numVariables)
+        {
+            cout << "Amount of data requested to be read from the Interactions file exceeds its contents!" << endl;
+            exit(1);
+        }
+
+        if((unsigned int)Fhandler->ini_IDX_interactions > Ifvi->fvi_header.numVariables || (unsigned int)Fhandler->end_IDX_interactions > Ifvi->fvi_header.numVariables)
+        {
+            cout << "The specified range for data to be read from the Interactions file exceeds its content dimensions!" << endl;
+            exit(1);
+        }
+
+        if(Fhandler->use_multiple_interaction_sets)
+        {
+            cout << "rm:"<< params.m<<  " rmb:" << params.mb << endl;
+
+            params.m *= Fhandler->numInter;
+            Fhandler->Ar_file_blocksize = params.mb/Fhandler->numInter;
+
+            if(Fhandler->Ar_file_blocksize < 1)
+                Fhandler->Ar_file_blocksize = 1;
+
+            params.mb = (Fhandler->Ar_file_blocksize*Fhandler->numInter);
+            #ifdef DEBUG
+            cout << " lmb:"<< params.mb << " fmb:" << Fhandler->Ar_file_blocksize << " lr:" << params.r << " fr:" << Fhandler->fileR << endl << flush;
+            #endif
+        }
+        else
+        {
+            params.r = Fhandler->numInter;
+            Fhandler->Ar_file_blocksize = params.mb;
+            #ifdef DEBUG
+            cout << " lmb:"<< params.mb << " fmb:" << Fhandler->Ar_file_blocksize << " lr:" << params.r << " fr:" << Fhandler->fileR << endl << flush;
+            #endif
+        }
+
+        if(Fhandler->keep_depVar)
+        {
+            params.r += 1;
+        }
+        #ifdef DEBUG
+        cout << Fhandler->Ar_file_blocksize << "!" << endl << flush;
+        #endif
+
+
+
+
+        ifstream fp_I;
+        fp_I.open ((Fhandler->fname_interactions+".fvd").c_str(), ios::in | ios::binary);
+        if(!fp_I.is_open())
+        {
+            cout << "Error opening Interactions File " << Fhandler->fname_interactions << endl;
+            exit(1);
+        }
+
+
+        Fhandler->interaction_data = new float[Fhandler->numInter*Fhandler->fileN];
+
+        int ini_filepos = Fhandler->ini_IDX_interactions*Fhandler->fileN;
+        fp_I.seekg(  ini_filepos*sizeof(type_precision) , ios::beg );
+        if(fp_I.fail())
+        {
+            cout << "Error reading Interactions File while positioning! " <<  ini_filepos << endl;
+            exit(1);
+        }
+
+        //!read interactions
+        list< pair<int,int> >* excl_List = Fhandler->excl_List;
+
+
+
+        int chunk_size_buff = Fhandler->numInter*Fhandler->fileN;
+
+        fp_I.read ((char*)(Fhandler->interaction_data),sizeof(type_precision)*chunk_size_buff);
+
+
+
+        for (int i=0; i < Fhandler->numInter; i++)
+        {
+            for (int j=0; j < Fhandler->fileN; j++)
+            {
+                if(isnan(Fhandler->interaction_data[i*Fhandler->fileN+j]))
+                {
+                    //cout << "fmi"<<" ";
+                    bool removed  = splitpair(j,excl_List,Fhandler->fileN );
+                    if(removed)
+                    {
+                        interaction_missings++;
+                    }
+
+                }
+            }
+        }
+        if(interaction_missings)
+            cout << "Excluding " << interaction_missings << " from Interaction missings" << endl;
+        #ifdef DEBUG
+        cout << params.mb << " " << params.r << " " << params.m << endl;
+        #endif
+
+    }
+
+
+//    for (list<  pair<int,int>  >::iterator it=Fhandler->excl_List->begin(); it != Fhandler->excl_List->end(); ++it)
+//    {
+//        cout << it->first <<":" << it->second <<" ";
+//    }
+    #ifdef DEBUG
+    cout << Fhandler->excl_List->size() << endl;
+    #endif
+
+
+
+    params.n -= (excl_count + Almissings + interaction_missings);
 
-
     params.p = params.l + params.r;
 
     if(!Fhandler->fakefiles)
     {
 
+        //!******nameGATHER****************
+
         int Aname_idx=Fhandler->fileN*ARfvi->fvi_header.namelength;//skip the names of the rows
         if(Fhandler->use_dosages && Fhandler->add_dosages)
         {
-            for(int i = 0; i < params.m; i++)
+            for(int i = 0; i < Fhandler->fileM; i++)
             {
-                Fhandler->ARnames.push_back(string(&(ARfvi->fvi_data[Aname_idx])));
+                if(Fhandler->use_interactions && !Fhandler->use_multiple_interaction_sets)
+                {
+                    for(int ii = 0; ii < Fhandler->numInter; ii++)
+                    {
+
+                        string interaction_name = "I";
+                        interaction_name += std::to_string(ii+1);
+                        interaction_name += "x";
+                        interaction_name += string(&(ARfvi->fvi_data[Aname_idx]));
+                        Fhandler->ARnames.push_back(interaction_name);
+                    }
+                }
+                if( !Fhandler->use_interactions || Fhandler->keep_depVar ||  Fhandler->use_multiple_interaction_sets)
+                {
+                    Fhandler->ARnames.push_back(string(&(ARfvi->fvi_data[Aname_idx])));
+                }
+
                 Aname_idx += ARfvi->fvi_header.namelength*Fhandler->fileR;
             }
         }
         else
         {
-            for(int i = 0; i < params.m*params.r; i++)
+            for(int i = 0; i < Fhandler->fileM*Fhandler->fileR; i++)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/genabel -r 1829


More information about the Genabel-commits mailing list