[adegenet-commits] r794 - in pkg: R src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Feb 8 19:52:34 CET 2011
Author: jombart
Date: 2011-02-08 19:52:34 +0100 (Tue, 08 Feb 2011)
New Revision: 794
Modified:
pkg/R/glFunctions.R
pkg/src/SNPbin.c
Log:
need to test this
Modified: pkg/R/glFunctions.R
===================================================================
--- pkg/R/glFunctions.R 2011-02-08 17:24:34 UTC (rev 793)
+++ pkg/R/glFunctions.R 2011-02-08 18:52:34 UTC (rev 794)
@@ -175,7 +175,7 @@
resSize <- lowerTriSize + nInd(x)
## CALL C FUNCTION ##
- temp <- .C("GLdotProd", vecbyte, nbVec, length(x at gen[[1]]@snp), nbNa, naPosi, nInd(x), nLoc(x), as.double(mu), as.double(s), double(resSize), PACKAGE="adegenet")[[10]]
+ temp <- .C("GLdotProd", vecbyte, nbVec, length(x at gen[[1]]@snp[[1]]), nbNa, naPosi, nInd(x), nLoc(x), as.double(mu), as.double(s), double(resSize), PACKAGE="adegenet")[[10]]
res <- temp[1:lowerTriSize]
attr(res,"Size") <- nInd(x)
Modified: pkg/src/SNPbin.c
===================================================================
--- pkg/src/SNPbin.c 2011-02-08 17:24:34 UTC (rev 793)
+++ pkg/src/SNPbin.c 2011-02-08 18:52:34 UTC (rev 794)
@@ -238,6 +238,9 @@
/* transform a snpbin into a vector of integers */
void snpbin2intvec(struct snpbin *x, int *out){
bytesToInt(x->bytevec, x->byteveclength, x->bytevecnb, out);
+/*reminders:
+-void bytesToInt(unsigned char *vecbytes, int *veclength, int *nbvec, int *vecres){
+- snpbin: unsigned char *bytevec; int *byteveclength, *bytevecnb, *nloc, *nanb, *naposi; */
}
@@ -246,6 +249,12 @@
int i, *temp;
temp = (int *) calloc(nLoc(x), sizeof(int));
snpbin2intvec(x, temp);
+
+
+ for(i=0;i< *(x->byteveclength);i++){
+ printf("%i ", (int) (x->bytevec)[i]);
+ }
+ printf(" ");
for(i=0;i<nLoc(x);i++){
printf("%i ", temp[i]);
}
@@ -439,6 +448,12 @@
res2 <- as.matrix(x) %*% t(as.matrix(x))
res2
+## DATA > 8 SNPs
+dat <- rbind(rep(c(1,0,1), c(8,10,5)))
+x <- new("genlight",dat)
+glDotProd(x)
+
+
## RANDOM DATA
dat <- matrix(sample(0:1, 5*8, replace=TRUE), nrow=5)
x <- new("genlight",dat)
More information about the adegenet-commits
mailing list