Skip to content

Commit

Permalink
more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxwen committed Sep 29, 2018
1 parent ac01cba commit f5a0568
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions inst/unitTests/test_rel.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ test.IBS <- function()
num.thread=1, verbose=FALSE)
checkEquals(ibs.1, valid.dta, "IBS (one core)")

ibs.1 <- snpgdsIBS(genofile, sample.id=samp.id[1:90],
num.thread=1, useMatrix=TRUE, verbose=FALSE)
z <- as.matrix(ibs.1$ibs)
dimnames(z) <- NULL
checkEquals(z, valid.dta$ibs, "IBS (one core, Matrix)")

# run on two cores
ibs.2 <- snpgdsIBS(genofile, sample.id=samp.id[1:90],
num.thread=2, verbose=FALSE)
Expand Down Expand Up @@ -229,10 +235,26 @@ test.KING <- function()
type="KING-robust", num.thread=1L, verbose=FALSE)
checkEquals(king.1, valid.dta[[1L]], "KING robust MoM (one core)")

king.1 <- snpgdsIBDKING(genofile, sample.id=samp.id[1:60],
type="KING-robust", num.thread=1L, useMatrix=TRUE, verbose=FALSE)
king.1$IBS0 <- as.matrix(king.1$IBS0)
dimnames(king.1$IBS0) <- NULL
king.1$kinship <- as.matrix(king.1$kinship)
dimnames(king.1$kinship) <- NULL
checkEquals(king.1, valid.dta[[1L]], "KING robust MoM (one core, Matrix)")

king.2 <- snpgdsIBDKING(genofile, sample.id=samp.id[1:60],
type="KING-homo", num.thread=1L, verbose=FALSE)
checkEquals(king.2, valid.dta[[2L]], "KING homo MoM (one core)")

king.2 <- snpgdsIBDKING(genofile, sample.id=samp.id[1:60],
type="KING-homo", num.thread=1L, verbose=FALSE)
king.2$k0 <- as.matrix(king.2$k0)
dimnames(king.2$k0) <- NULL
king.2$k1 <- as.matrix(king.2$k1)
dimnames(king.2$k1) <- NULL
checkEquals(king.2, valid.dta[[2L]], "KING homo MoM (one core, Matrix)")

# run on two cores
king.1 <- snpgdsIBDKING(genofile, sample.id=samp.id[1:60],
type="KING-robust", num.thread=2L, verbose=FALSE)
Expand Down

0 comments on commit f5a0568

Please sign in to comment.