CRAN Package Check Results for Package GMMAT

Last updated on 2026-10-15 13:56:17 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.5.0 43.06 240.59 283.65 OK
r-devel-linux-x86_64-debian-gcc 1.5.0 39.48 210.26 249.74 OK
r-devel-linux-x86_64-fedora-clang 1.5.0 29.00 158.92 187.92 OK
r-devel-linux-x86_64-fedora-gcc 1.5.0 42.00 168.79 210.79 OK
r-devel-windows-x86_64 1.5.0 73.00 393.00 466.00 OK
r-patched-linux-x86_64 1.5.0 51.56 239.28 290.84 OK
r-release-linux-x86_64 1.5.0 50.71 234.78 285.49 OK
r-release-macos-arm64 1.5.0 12.00 90.00 102.00 OK
r-release-macos-x86_64 1.5.0 38.00 405.00 443.00 OK
r-release-windows-x86_64 1.5.0 70.00 314.00 384.00 OK
r-oldrel-macos-arm64 1.5.0 16.00 79.00 95.00 ERROR
r-oldrel-macos-x86_64 1.5.0 41.00 551.00 592.00 OK
r-oldrel-windows-x86_64 1.5.0 90.00 398.00 488.00 OK

Check Details

Version: 1.5.0
Check: tests
Result: ERROR Running ‘testthat.R’ [2s/2s] Running the tests in ‘tests/testthat.R’ failed. Complete output: > library(testthat) > library(GMMAT) > Sys.setenv(MKL_NUM_THREADS = 1) > > test_check("GMMAT") *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: eval(c.expr, envir = args, enclos = envir) 2: eval(c.expr, envir = args, enclos = envir) 3: doTryCatch(return(expr), name, parentenv, handler) 4: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 5: tryCatchList(expr, classes, parentenv, handlers) 6: tryCatch(eval(c.expr, envir = args, enclos = envir), error = function(e) e) 7: FUN(X[[i]], ...) 8: lapply(X = S, FUN = FUN, ...) 9: doTryCatch(return(expr), name, parentenv, handler) 10: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 11: tryCatchList(expr, classes, parentenv, handlers) 12: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 13: try(lapply(X = S, FUN = FUN, ...), silent = TRUE) 14: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) 15: FUN(X[[i]], ...) 16: lapply(seq_len(cores), inner.do) 17: mclapply(argsList, FUN, mc.preschedule = preschedule, mc.set.seed = set.seed, mc.silent = silent, mc.cores = cores) 18: e$fun(obj, substitute(ex), parent.frame(), e$data) 19: foreach(i = 1:ncores) %dopar% { if (!is.null(obj$P)) { if (bgenInfo$LayoutFlag == 2) { .Call(C_glmm_score_bgen13, as.numeric(res), obj$P, infile, paste0(outfile, "_tmp.", i), center2, MAF.range[1], MAF.range[2], miss.cutoff, miss.method, nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, 1) } else { .Call(C_glmm_score_bgen11, as.numeric(res), obj$P, infile, paste0(outfile, "_tmp.", i), center2, MAF.range[1], MAF.range[2], miss.cutoff, miss.method, nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, 1) } } else { if (bgenInfo$LayoutFlag == 2) { .Call(C_glmm_score_bgen13_sp, as.numeric(res), obj$Sigma_i, obj$Sigma_iX, obj$cov, infile, paste0(outfile, "_tmp.", i), center2, MAF.range[1], MAF.range[2], miss.cutoff, miss.method, nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, 1) } else { .Call(C_glmm_score_bgen11_sp, as.numeric(res), obj$Sigma_i, obj$Sigma_iX, obj$cov, infile, paste0(outfile, "_tmp.", i), center2, MAF.range[1], MAF.range[2], miss.cutoff, miss.method, nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, 1) } }} 20: glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, outfile = obj1.outfile.bgen.noselect.1.tmp, ncores = 2) 21: eval(code, test_env) 22: eval(code, test_env) 23: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 24: doTryCatch(return(expr), name, parentenv, handler) 25: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 26: tryCatchList(expr, classes, parentenv, handlers) 27: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 28: doWithOneRestart(return(expr), restart) 29: withOneRestart(expr, restarts[[1L]]) 30: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 31: test_code(code, parent.frame()) 32: test_that("cross-sectional id le 400 binomial", { plinkfiles <- strsplit(system.file("extdata", "geno.bed", package = "GMMAT"), ".bed", fixed = TRUE)[[1]] bgenfile <- system.file("extdata", "geno.bgen", package = "GMMAT") samplefile <- system.file("extdata", "geno.sample", package = "GMMAT") gdsfile <- system.file("extdata", "geno.gds", package = "GMMAT") txtfile <- system.file("extdata", "geno.txt", package = "GMMAT") txtfile1 <- system.file("extdata", "geno.txt.gz", package = "GMMAT") txtfile2 <- system.file("extdata", "geno.txt.bz2", package = "GMMAT") data(example) suppressWarnings(RNGversion("3.5.0")) set.seed(123) pheno <- rbind(example$pheno, example$pheno[1:100, ]) pheno$id <- 1:500 pheno$disease[sample(1:500, 20)] <- NA pheno$age[sample(1:500, 20)] <- NA pheno$sex[sample(1:500, 20)] <- NA pheno <- pheno[sample(1:500, 450), ] pheno <- pheno[pheno$id <= 400, ] kins <- example$GRM obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, id = "id", family = binomial(link = "logit"), method = "REML", method.optim = "AI") select <- match(1:400, unique(obj1$id_include)) select[is.na(select)] <- 0 obj1.outfile.bed.noselect.1 <- tempfile() glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.1) obj1.bed.noselect.1 <- read.table(obj1.outfile.bed.noselect.1, header = TRUE, as.is = TRUE) obj1.outfile.bed.noselect.1.tmp <- tempfile() expect_error(glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.1.tmp, ncores = 2), "Error: parallel computing currently not implemented for PLINK binary format genotypes.") unlink(obj1.outfile.bed.noselect.1.tmp) obj1.outfile.bed.select.1 <- tempfile() glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.1) obj1.bed.select.1 <- read.table(obj1.outfile.bed.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.bed.noselect.1, obj1.bed.select.1) obj1.outfile.bgen.noselect.1 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, outfile = obj1.outfile.bgen.noselect.1) obj1.bgen.noselect.1 <- read.table(obj1.outfile.bgen.noselect.1, header = TRUE, as.is = TRUE) obj1.outfile.bgen.noselect.1.tmp <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, outfile = obj1.outfile.bgen.noselect.1.tmp, ncores = 2) obj1.bgen.noselect.1.tmp <- read.table(obj1.outfile.bgen.noselect.1.tmp, header = TRUE, as.is = TRUE) expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.1.tmp) unlink(obj1.outfile.bgen.noselect.1.tmp) obj1.outfile.bgen.select.1 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, select = select, outfile = obj1.outfile.bgen.select.1) obj1.bgen.select.1 <- read.table(obj1.outfile.bgen.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.bgen.noselect.1, obj1.bgen.select.1) expect_equal(obj1.bed.select.1[, c("SNP", "CHR", "POS", "A1", "A2", "N", "AF", "SCORE", "VAR", "PVAL")], obj1.bgen.select.1[, c("SNP", "CHR", "POS", "A1", "A2", "N", "AF", "SCORE", "VAR", "PVAL")]) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", quietly = TRUE)) { obj1.outfile.gds.noselect.1 <- tempfile() glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.1) obj1.gds.noselect.1 <- read.table(obj1.outfile.gds.noselect.1, header = TRUE, as.is = TRUE) obj1.outfile.gds.noselect.1.tmp <- tempfile() glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.1.tmp, ncores = 2) obj1.gds.noselect.1.tmp <- read.table(obj1.outfile.gds.noselect.1.tmp, header = TRUE, as.is = TRUE) expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.1.tmp) unlink(obj1.outfile.gds.noselect.1.tmp) obj1.outfile.gds.select.1 <- tempfile() glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.1) obj1.gds.select.1 <- read.table(obj1.outfile.gds.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.gds.noselect.1, obj1.gds.select.1) expect_equal(obj1.bed.select.1$PVAL, signif(obj1.gds.select.1$PVAL)) expect_equal(signif(range(obj1.gds.select.1$PVAL)), signif(c(0.003804942, 0.986534857))) unlink(c(obj1.outfile.gds.noselect.1, obj1.outfile.gds.select.1)) } obj1.outfile.txt.select.1 <- tempfile() glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.1, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt.select.1 <- read.table(obj1.outfile.txt.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.bed.select.1$PVAL, obj1.txt.select.1$PVAL) obj1.outfile.txt.select.1.tmp <- tempfile() expect_error(glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.1.tmp, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2"), ncores = 2), "Error: parallel computing currently not implemented for plain text format genotypes.") unlink(obj1.outfile.txt.select.1.tmp) obj1.outfile.txt1.select.1 <- tempfile() glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.1, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt1.select.1 <- read.table(obj1.outfile.txt1.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.txt.select.1, obj1.txt1.select.1) obj1.outfile.txt2.select.1 <- tempfile() glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.1, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt2.select.1 <- read.table(obj1.outfile.txt2.select.1, header = TRUE, as.is = TRUE) expect_equal(obj1.txt.select.1, obj1.txt2.select.1) unlink(c(obj1.outfile.bed.noselect.1, obj1.outfile.bed.select.1, obj1.outfile.bgen.noselect.1, obj1.outfile.bgen.select.1, obj1.outfile.txt.select.1, obj1.outfile.txt1.select.1, obj1.outfile.txt2.select.1)) skip_on_cran() obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, Traceback: id = "id", family = binomial(link = "logit"), method = "REML", 1: method.optim = "AI")eval(c.expr, envir = args, enclos = envir) select <- match(1:400, unique(obj2$id_include)) select[is.na(select)] <- 0 2: obj2.outfile.bed.noselect.1 <- tempfile()eval(c.expr, envir = args, enclos = envir) glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.1) obj2.bed.noselect.1 <- read.table(obj2.outfile.bed.noselect.1, 3: header = TRUE, as.is = TRUE)doTryCatch(return(expr), name, parentenv, handler) obj2.outfile.bed.select.1 <- tempfile() glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.1) obj2.bed.select.1 <- read.table(obj2.outfile.bed.select.1, 4: header = TRUE, as.is = TRUE)tryCatchOne(expr, names, parentenv, handlers[[1L]]) expect_equal(obj2.bed.noselect.1, obj2.bed.select.1) obj2.outfile.bgen.noselect.1 <- tempfile() 5: glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, tryCatchList(expr, classes, parentenv, handlers) outfile = obj2.outfile.bgen.noselect.1) obj2.bgen.noselect.1 <- read.table(obj2.outfile.bgen.noselect.1, 6: header = TRUE, as.is = TRUE) obj2.outfile.bgen.select.1 <- tempfile()tryCatch(eval(c.expr, envir = args, enclos = envir), error = function(e) e) glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, select = select, outfile = obj2.outfile.bgen.select.1) 7: obj2.bgen.select.1 <- read.table(obj2.outfile.bgen.select.1, FUN(X[[i]], ...) header = TRUE, as.is = TRUE) expect_equal(obj2.bgen.noselect.1, obj2.bgen.select.1) 8: expect_equal(obj2.bed.select.1[, c("SNP", "CHR", "POS", "A1", lapply(X = S, FUN = FUN, ...) "A2", "N", "AF", "SCORE", "VAR", "PVAL")], obj2.bgen.select.1[, c("SNP", "CHR", "POS", "A1", "A2", "N", "AF", "SCORE", 9: doTryCatch(return(expr), name, parentenv, handler) "VAR", "PVAL")]) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", 10: quietly = TRUE)) {tryCatchOne(expr, names, parentenv, handlers[[1L]]) obj2.outfile.gds.noselect.1 <- tempfile() glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.1)11: tryCatchList(expr, classes, parentenv, handlers) obj2.gds.noselect.1 <- read.table(obj2.outfile.gds.noselect.1, 12: header = TRUE, as.is = TRUE)tryCatch(expr, error = function(e) { call <- conditionCall(e) obj2.outfile.gds.select.1 <- tempfile() if (!is.null(call)) { glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.1) obj2.gds.select.1 <- read.table(obj2.outfile.gds.select.1, header = TRUE, as.is = TRUE) expect_equal(obj2.gds.noselect.1, obj2.gds.select.1) if (identical(call[[1L]], quote(doTryCatch))) expect_equal(obj2.bed.select.1$PVAL, signif(obj2.gds.select.1$PVAL)) call <- sys.call(-4L) expect_equal(signif(range(obj2.gds.select.1$PVAL)), signif(c(0.003738918, 0.996996766))) dcall <- deparse(call, nlines = 1L) } prefix <- paste("Error in", dcall, ": ") obj2.outfile.txt.select.1 <- tempfile() glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.1, LONG <- 75L infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, sm <- strsplit(conditionMessage(e), "\n")[[1L]] select = select, infile.header.print = c("SNP", "Allele1", w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") "Allele2")) if (is.na(w)) obj2.txt.select.1 <- read.table(obj2.outfile.txt.select.1, w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], header = TRUE, as.is = TRUE) type = "b") expect_equal(obj2.bed.select.1$PVAL, obj2.txt.select.1$PVAL) if (w > LONG) obj2.outfile.txt1.select.1 <- tempfile() prefix <- paste0(prefix, "\n ") glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.1, } infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, else prefix <- "Error : " select = select, infile.header.print = c("SNP", "Allele1", msg <- paste0(prefix, conditionMessage(e), "\n") "Allele2")) .Internal(seterrmessage(msg[1L])) obj2.txt1.select.1 <- read.table(obj2.outfile.txt1.select.1, if (!silent && isTRUE(getOption("show.error.messages"))) { header = TRUE, as.is = TRUE) cat(msg, file = outFile) expect_equal(obj2.txt.select.1, obj2.txt1.select.1) .Internal(printDeferredWarnings()) obj2.outfile.txt2.select.1 <- tempfile() } glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.1, invisible(structure(msg, class = "try-error", condition = e)) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, }) select = select, infile.header.print = c("SNP", "Allele1", 13: "Allele2"))try(lapply(X = S, FUN = FUN, ...), silent = TRUE) obj2.txt2.select.1 <- read.table(obj2.outfile.txt2.select.1, header = TRUE, as.is = TRUE) expect_equal(obj2.txt.select.1, obj2.txt2.select.1)14: idx <- sample(nrow(pheno)) pheno <- pheno[idx, ]sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, id = "id", family = binomial(link = "logit"), method = "REML", 15: method.optim = "AI")FUN(X[[i]], ...) select <- match(1:400, unique(obj1$id_include)) select[is.na(select)] <- 016: obj1.outfile.bed.noselect.2 <- tempfile()lapply(seq_len(cores), inner.do) glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.2) obj1.bed.noselect.2 <- read.table(obj1.outfile.bed.noselect.2, header = TRUE, as.is = TRUE)17: expect_equal(obj1.bed.noselect.1, obj1.bed.noselect.2)mclapply(argsList, FUN, mc.preschedule = preschedule, mc.set.seed = set.seed, obj1.outfile.bed.select.2 <- tempfile() glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.2) mc.silent = silent, mc.cores = cores) obj1.bed.select.2 <- read.table(obj1.outfile.bed.select.2, header = TRUE, as.is = TRUE) expect_equal(obj1.bed.select.1, obj1.bed.select.2)18: obj1.outfile.bgen.noselect.2 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, e$fun(obj, substitute(ex), parent.frame(), e$data) outfile = obj1.outfile.bgen.noselect.2) obj1.bgen.noselect.2 <- read.table(obj1.outfile.bgen.noselect.2, 19: foreach(i = 1:ncores) %dopar% { header = TRUE, as.is = TRUE) if (!is.null(obj$P)) { expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.2) obj1.outfile.bgen.select.2 <- tempfile() if (bgenInfo$LayoutFlag == 2) { glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, .Call(C_glmm_score_bgen13, as.numeric(res), obj$P, infile, paste0(outfile, "_tmp.", i), center2, select = select, outfile = obj1.outfile.bgen.select.2) MAF.range[1], MAF.range[2], miss.cutoff, miss.method, obj1.bgen.select.2 <- read.table(obj1.outfile.bgen.select.2, nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, header = TRUE, as.is = TRUE) expect_equal(obj1.bgen.select.1, obj1.bgen.select.2) 1) } if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", else { quietly = TRUE)) { .Call(C_glmm_score_bgen11, as.numeric(res), obj$P, infile, paste0(outfile, "_tmp.", i), center2, obj1.outfile.gds.noselect.2 <- tempfile() MAF.range[1], MAF.range[2], miss.cutoff, miss.method, glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.2) nperbatch, select, threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, obj1.gds.noselect.2 <- read.table(obj1.outfile.gds.noselect.2, 1) header = TRUE, as.is = TRUE) } expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.2) obj1.outfile.gds.select.2 <- tempfile() } else { glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.2) obj1.gds.select.2 <- read.table(obj1.outfile.gds.select.2, if (bgenInfo$LayoutFlag == 2) { .Call(C_glmm_score_bgen13_sp, as.numeric(res), obj$Sigma_i, header = TRUE, as.is = TRUE) expect_equal(obj1.gds.select.1, obj1.gds.select.2) obj$Sigma_iX, obj$cov, infile, paste0(outfile, "_tmp.", i), center2, MAF.range[1], MAF.range[2], } miss.cutoff, miss.method, nperbatch, select, obj1.outfile.txt.select.2 <- tempfile() threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], bgenInfo$N, bgenInfo$CompressionFlag, 1) glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.2, } infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", else { "Allele2")) .Call(C_glmm_score_bgen11_sp, as.numeric(res), obj$Sigma_i, obj1.txt.select.2 <- read.table(obj1.outfile.txt.select.2, obj$Sigma_iX, obj$cov, infile, paste0(outfile, header = TRUE, as.is = TRUE) "_tmp.", i), center2, MAF.range[1], MAF.range[2], expect_equal(obj1.txt.select.1, obj1.txt.select.2) miss.cutoff, miss.method, nperbatch, select, obj1.outfile.txt1.select.2 <- tempfile() threadInfo$begin[i], threadInfo$end[i], threadInfo$pos[i], glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.2, bgenInfo$N, bgenInfo$CompressionFlag, 1) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, } select = select, infile.header.print = c("SNP", "Allele1", } "Allele2"))} obj1.txt1.select.2 <- read.table(obj1.outfile.txt1.select.2, header = TRUE, as.is = TRUE)20: expect_equal(obj1.txt1.select.1, obj1.txt1.select.2)glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, obj1.outfile.txt2.select.2 <- tempfile() outfile = obj1.outfile.bgen.noselect.1.tmp, ncores = 2) glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.2, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, 21: select = select, infile.header.print = c("SNP", "Allele1", eval(code, test_env) "Allele2")) obj1.txt2.select.2 <- read.table(obj1.outfile.txt2.select.2, header = TRUE, as.is = TRUE)22: expect_equal(obj1.txt2.select.1, obj1.txt2.select.2)eval(code, test_env) obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, id = "id", family = binomial(link = "logit"), method = "REML", 23: method.optim = "AI")withCallingHandlers({ select <- match(1:400, unique(obj2$id_include)) eval(code, test_env) select[is.na(select)] <- 0 new_expectations <- the$test_expectations > starting_expectations obj2.outfile.bed.noselect.2 <- tempfile() if (snapshot_skipped) { glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.2) skip("On CRAN") obj2.bed.noselect.2 <- read.table(obj2.outfile.bed.noselect.2, } header = TRUE, as.is = TRUE) else if (!new_expectations && skip_on_empty) { expect_equal(obj2.bed.noselect.1, obj2.bed.noselect.2) skip_empty() obj2.outfile.bed.select.2 <- tempfile() } glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.2)}, expectation = handle_expectation, packageNotFoundError = function(e) { obj2.bed.select.2 <- read.table(obj2.outfile.bed.select.2, if (on_cran()) { header = TRUE, as.is = TRUE) skip(paste0("{", e$package, "} is not installed.")) expect_equal(obj2.bed.select.1, obj2.bed.select.2) } obj2.outfile.bgen.noselect.2 <- tempfile()}, snapshot_on_cran = function(cnd) { glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, snapshot_skipped <<- TRUE outfile = obj2.outfile.bgen.noselect.2) invokeRestart("muffle_cran_snapshot") obj2.bgen.noselect.2 <- read.table(obj2.outfile.bgen.noselect.2, }, skip = handle_skip, warning = handle_warning, message = handle_message, header = TRUE, as.is = TRUE) error = handle_error, interrupt = handle_interrupt) expect_equal(obj2.bgen.noselect.1, obj2.bgen.noselect.2) obj2.outfile.bgen.select.2 <- tempfile()24: glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, doTryCatch(return(expr), name, parentenv, handler) select = select, outfile = obj2.outfile.bgen.select.2)25: obj2.bgen.select.2 <- read.table(obj2.outfile.bgen.select.2, tryCatchOne(expr, names, parentenv, handlers[[1L]]) header = TRUE, as.is = TRUE) expect_equal(obj2.bgen.select.1, obj2.bgen.select.2)26: if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", tryCatchList(expr, classes, parentenv, handlers) quietly = TRUE)) { obj2.outfile.gds.noselect.2 <- tempfile()27: glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.2)tryCatch(withCallingHandlers({ obj2.gds.noselect.2 <- read.table(obj2.outfile.gds.noselect.2, eval(code, test_env) header = TRUE, as.is = TRUE) new_expectations <- the$test_expectations > starting_expectations expect_equal(obj2.gds.noselect.1, obj2.gds.noselect.2) if (snapshot_skipped) { obj2.outfile.gds.select.2 <- tempfile() skip("On CRAN") glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.2) } obj2.gds.select.2 <- read.table(obj2.outfile.gds.select.2, else if (!new_expectations && skip_on_empty) { header = TRUE, as.is = TRUE) skip_empty() expect_equal(obj2.gds.select.1, obj2.gds.select.2) } }}, expectation = handle_expectation, packageNotFoundError = function(e) { obj2.outfile.txt.select.2 <- tempfile() if (on_cran()) { glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.2, skip(paste0("{", e$package, "} is not installed.")) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, } select = select, infile.header.print = c("SNP", "Allele1", }, snapshot_on_cran = function(cnd) { "Allele2")) snapshot_skipped <<- TRUE obj2.txt.select.2 <- read.table(obj2.outfile.txt.select.2, invokeRestart("muffle_cran_snapshot") header = TRUE, as.is = TRUE)}, skip = handle_skip, warning = handle_warning, message = handle_message, expect_equal(obj2.txt.select.1, obj2.txt.select.2) error = handle_error, interrupt = handle_interrupt), error = handle_fatal) obj2.outfile.txt1.select.2 <- tempfile() glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.2, 28: infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, doWithOneRestart(return(expr), restart) select = select, infile.header.print = c("SNP", "Allele1", "Allele2"))29: obj2.txt1.select.2 <- read.table(obj2.outfile.txt1.select.2, withOneRestart(expr, restarts[[1L]]) header = TRUE, as.is = TRUE) expect_equal(obj2.txt1.select.1, obj2.txt1.select.2)30: obj2.outfile.txt2.select.2 <- tempfile()withRestarts(tryCatch(withCallingHandlers({ glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.2, eval(code, test_env) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, new_expectations <- the$test_expectations > starting_expectations select = select, infile.header.print = c("SNP", "Allele1", if (snapshot_skipped) { "Allele2")) skip("On CRAN") } obj2.txt2.select.2 <- read.table(obj2.outfile.txt2.select.2, else if (!new_expectations && skip_on_empty) { header = TRUE, as.is = TRUE) skip_empty() expect_equal(obj2.txt2.select.1, obj2.txt2.select.2) } idx <- sample(nrow(kins))}, expectation = handle_expectation, packageNotFoundError = function(e) { kins <- kins[idx, idx] if (on_cran()) { obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, skip(paste0("{", e$package, "} is not installed.")) id = "id", family = binomial(link = "logit"), method = "REML", } method.optim = "AI")}, snapshot_on_cran = function(cnd) { select <- match(1:400, unique(obj1$id_include)) snapshot_skipped <<- TRUE select[is.na(select)] <- 0 invokeRestart("muffle_cran_snapshot") obj1.outfile.bed.noselect.3 <- tempfile()}, skip = handle_skip, warning = handle_warning, message = handle_message, glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.3) error = handle_error, interrupt = handle_interrupt), error = handle_fatal), obj1.bed.noselect.3 <- read.table(obj1.outfile.bed.noselect.3, end_test = function() { header = TRUE, as.is = TRUE) }) expect_equal(obj1.bed.noselect.1, obj1.bed.noselect.3) obj1.outfile.bed.select.3 <- tempfile()31: glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.3)test_code(code, parent.frame()) obj1.bed.select.3 <- read.table(obj1.outfile.bed.select.3, header = TRUE, as.is = TRUE)32: expect_equal(obj1.bed.select.1, obj1.bed.select.3)test_that("cross-sectional id le 400 binomial", { obj1.outfile.bgen.noselect.3 <- tempfile() plinkfiles <- strsplit(system.file("extdata", "geno.bed", glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, package = "GMMAT"), ".bed", fixed = TRUE)[[1]] outfile = obj1.outfile.bgen.noselect.3) bgenfile <- system.file("extdata", "geno.bgen", package = "GMMAT") obj1.bgen.noselect.3 <- read.table(obj1.outfile.bgen.noselect.3, samplefile <- system.file("extdata", "geno.sample", package = "GMMAT") header = TRUE, as.is = TRUE) gdsfile <- system.file("extdata", "geno.gds", package = "GMMAT") expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.3) txtfile <- system.file("extdata", "geno.txt", package = "GMMAT") obj1.outfile.bgen.select.3 <- tempfile() txtfile1 <- system.file("extdata", "geno.txt.gz", package = "GMMAT") glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, txtfile2 <- system.file("extdata", "geno.txt.bz2", package = "GMMAT") data(example) select = select, outfile = obj1.outfile.bgen.select.3) suppressWarnings(RNGversion("3.5.0")) obj1.bgen.select.3 <- read.table(obj1.outfile.bgen.select.3, set.seed(123) header = TRUE, as.is = TRUE) pheno <- rbind(example$pheno, example$pheno[1:100, ]) expect_equal(obj1.bgen.select.1, obj1.bgen.select.3) pheno$id <- 1:500 if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", pheno$disease[sample(1:500, 20)] <- NA quietly = TRUE)) { pheno$age[sample(1:500, 20)] <- NA obj1.outfile.gds.noselect.3 <- tempfile() pheno$sex[sample(1:500, 20)] <- NA glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.3) pheno <- pheno[sample(1:500, 450), ] obj1.gds.noselect.3 <- read.table(obj1.outfile.gds.noselect.3, pheno <- pheno[pheno$id <= 400, ] header = TRUE, as.is = TRUE) kins <- example$GRM expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.3) obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, id = "id", family = binomial(link = "logit"), method = "REML", obj1.outfile.gds.select.3 <- tempfile() method.optim = "AI") glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.3) select <- match(1:400, unique(obj1$id_include)) obj1.gds.select.3 <- read.table(obj1.outfile.gds.select.3, select[is.na(select)] <- 0 header = TRUE, as.is = TRUE) obj1.outfile.bed.noselect.1 <- tempfile() expect_equal(obj1.gds.select.1, obj1.gds.select.3) glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.1) } obj1.bed.noselect.1 <- read.table(obj1.outfile.bed.noselect.1, obj1.outfile.txt.select.3 <- tempfile() header = TRUE, as.is = TRUE) glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.3, obj1.outfile.bed.noselect.1.tmp <- tempfile() infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, expect_error(glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.1.tmp, select = select, infile.header.print = c("SNP", "Allele1", ncores = 2), "Error: parallel computing currently not implemented for PLINK binary format genotypes.") "Allele2")) unlink(obj1.outfile.bed.noselect.1.tmp) obj1.txt.select.3 <- read.table(obj1.outfile.txt.select.3, obj1.outfile.bed.select.1 <- tempfile() header = TRUE, as.is = TRUE) glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.1) expect_equal(obj1.txt.select.1, obj1.txt.select.3) obj1.bed.select.1 <- read.table(obj1.outfile.bed.select.1, obj1.outfile.txt1.select.3 <- tempfile() header = TRUE, as.is = TRUE) glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.3, expect_equal(obj1.bed.noselect.1, obj1.bed.select.1) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, obj1.outfile.bgen.noselect.1 <- tempfile() select = select, infile.header.print = c("SNP", "Allele1", glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, "Allele2")) outfile = obj1.outfile.bgen.noselect.1) obj1.txt1.select.3 <- read.table(obj1.outfile.txt1.select.3, obj1.bgen.noselect.1 <- read.table(obj1.outfile.bgen.noselect.1, header = TRUE, as.is = TRUE) header = TRUE, as.is = TRUE) expect_equal(obj1.txt1.select.1, obj1.txt1.select.3) obj1.outfile.bgen.noselect.1.tmp <- tempfile() obj1.outfile.txt2.select.3 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.3, outfile = obj1.outfile.bgen.noselect.1.tmp, ncores = 2) infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, obj1.bgen.noselect.1.tmp <- read.table(obj1.outfile.bgen.noselect.1.tmp, select = select, infile.header.print = c("SNP", "Allele1", header = TRUE, as.is = TRUE) "Allele2")) expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.1.tmp) obj1.txt2.select.3 <- read.table(obj1.outfile.txt2.select.3, unlink(obj1.outfile.bgen.noselect.1.tmp) header = TRUE, as.is = TRUE) obj1.outfile.bgen.select.1 <- tempfile() expect_equal(obj1.txt2.select.1, obj1.txt2.select.3) glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, select = select, outfile = obj1.outfile.bgen.select.1) id = "id", family = binomial(link = "logit"), method = "REML", obj1.bgen.select.1 <- read.table(obj1.outfile.bgen.select.1, method.optim = "AI") header = TRUE, as.is = TRUE) select <- match(1:400, unique(obj2$id_include)) expect_equal(obj1.bgen.noselect.1, obj1.bgen.select.1) select[is.na(select)] <- 0 expect_equal(obj1.bed.select.1[, c("SNP", "CHR", "POS", "A1", obj2.outfile.bed.noselect.3 <- tempfile() "A2", "N", "AF", "SCORE", "VAR", "PVAL")], obj1.bgen.select.1[, glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.3) c("SNP", "CHR", "POS", "A1", "A2", "N", "AF", "SCORE", obj2.bed.noselect.3 <- read.table(obj2.outfile.bed.noselect.3, "VAR", "PVAL")]) header = TRUE, as.is = TRUE) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", expect_equal(obj2.bed.noselect.1, obj2.bed.noselect.3) quietly = TRUE)) { obj2.outfile.bed.select.3 <- tempfile() obj1.outfile.gds.noselect.1 <- tempfile() glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.3) glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.1) obj2.bed.select.3 <- read.table(obj2.outfile.bed.select.3, obj1.gds.noselect.1 <- read.table(obj1.outfile.gds.noselect.1, header = TRUE, as.is = TRUE) header = TRUE, as.is = TRUE) expect_equal(obj2.bed.select.1, obj2.bed.select.3) obj1.outfile.gds.noselect.1.tmp <- tempfile() obj2.outfile.bgen.noselect.3 <- tempfile() glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.1.tmp, glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, ncores = 2) outfile = obj2.outfile.bgen.noselect.3) obj1.gds.noselect.1.tmp <- read.table(obj1.outfile.gds.noselect.1.tmp, obj2.bgen.noselect.3 <- read.table(obj2.outfile.bgen.noselect.3, header = TRUE, as.is = TRUE) header = TRUE, as.is = TRUE) expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.1.tmp) expect_equal(obj2.bgen.noselect.1, obj2.bgen.noselect.3) unlink(obj1.outfile.gds.noselect.1.tmp) obj2.outfile.bgen.select.3 <- tempfile() obj1.outfile.gds.select.1 <- tempfile() glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.1) select = select, outfile = obj2.outfile.bgen.select.3) obj1.gds.select.1 <- read.table(obj1.outfile.gds.select.1, obj2.bgen.select.3 <- read.table(obj2.outfile.bgen.select.3, header = TRUE, as.is = TRUE) header = TRUE, as.is = TRUE) expect_equal(obj1.gds.noselect.1, obj1.gds.select.1) expect_equal(obj2.bgen.select.1, obj2.bgen.select.3) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", expect_equal(obj1.bed.select.1$PVAL, signif(obj1.gds.select.1$PVAL)) quietly = TRUE)) { expect_equal(signif(range(obj1.gds.select.1$PVAL)), signif(c(0.003804942, obj2.outfile.gds.noselect.3 <- tempfile() 0.986534857))) glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.3) unlink(c(obj1.outfile.gds.noselect.1, obj1.outfile.gds.select.1)) obj2.gds.noselect.3 <- read.table(obj2.outfile.gds.noselect.3, } header = TRUE, as.is = TRUE) obj1.outfile.txt.select.1 <- tempfile() expect_equal(obj2.gds.noselect.1, obj2.gds.noselect.3) glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.1, obj2.outfile.gds.select.3 <- tempfile() infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.3) select = select, infile.header.print = c("SNP", "Allele1", obj2.gds.select.3 <- read.table(obj2.outfile.gds.select.3, "Allele2")) header = TRUE, as.is = TRUE) obj1.txt.select.1 <- read.table(obj1.outfile.txt.select.1, expect_equal(obj2.gds.select.1, obj2.gds.select.3) header = TRUE, as.is = TRUE) } expect_equal(obj1.bed.select.1$PVAL, obj1.txt.select.1$PVAL) obj2.outfile.txt.select.3 <- tempfile() obj1.outfile.txt.select.1.tmp <- tempfile() glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.3, expect_error(glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.1.tmp, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) "Allele2"), ncores = 2), "Error: parallel computing currently not implemented for plain text format genotypes.") obj2.txt.select.3 <- read.table(obj2.outfile.txt.select.3, unlink(obj1.outfile.txt.select.1.tmp) header = TRUE, as.is = TRUE) obj1.outfile.txt1.select.1 <- tempfile() expect_equal(obj2.txt.select.1, obj2.txt.select.3) glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.1, obj2.outfile.txt1.select.3 <- tempfile() infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.3, select = select, infile.header.print = c("SNP", "Allele1", infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, "Allele2")) select = select, infile.header.print = c("SNP", "Allele1", obj1.txt1.select.1 <- read.table(obj1.outfile.txt1.select.1, "Allele2")) header = TRUE, as.is = TRUE) obj2.txt1.select.3 <- read.table(obj2.outfile.txt1.select.3, expect_equal(obj1.txt.select.1, obj1.txt1.select.1) header = TRUE, as.is = TRUE) obj1.outfile.txt2.select.1 <- tempfile() expect_equal(obj2.txt1.select.1, obj2.txt1.select.3) glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.1, obj2.outfile.txt2.select.3 <- tempfile() infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.3, select = select, infile.header.print = c("SNP", "Allele1", infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, "Allele2")) select = select, infile.header.print = c("SNP", "Allele1", obj1.txt2.select.1 <- read.table(obj1.outfile.txt2.select.1, "Allele2")) header = TRUE, as.is = TRUE) obj2.txt2.select.3 <- read.table(obj2.outfile.txt2.select.3, expect_equal(obj1.txt.select.1, obj1.txt2.select.1) header = TRUE, as.is = TRUE) unlink(c(obj1.outfile.bed.noselect.1, obj1.outfile.bed.select.1, expect_equal(obj2.txt2.select.1, obj2.txt2.select.3) obj1.outfile.bgen.noselect.1, obj1.outfile.bgen.select.1, unlink(c(obj2.outfile.bed.noselect.1, obj2.outfile.bed.select.1, obj1.outfile.txt.select.1, obj1.outfile.txt1.select.1, obj2.outfile.bgen.noselect.1, obj2.outfile.bgen.select.1, obj1.outfile.txt2.select.1)) obj2.outfile.txt.select.1, obj2.outfile.txt1.select.1, skip_on_cran() obj2.outfile.txt2.select.1)) obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, unlink(c(obj1.outfile.bed.noselect.2, obj1.outfile.bed.select.2, id = "id", family = binomial(link = "logit"), method = "REML", obj1.outfile.bgen.noselect.2, obj1.outfile.bgen.select.2, method.optim = "AI") obj1.outfile.txt.select.2, obj1.outfile.txt1.select.2, select <- match(1:400, unique(obj2$id_include)) obj1.outfile.txt2.select.2)) select[is.na(select)] <- 0 unlink(c(obj2.outfile.bed.noselect.2, obj2.outfile.bed.select.2, obj2.outfile.bed.noselect.1 <- tempfile() obj2.outfile.bgen.noselect.2, obj2.outfile.bgen.select.2, glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.1) obj2.outfile.txt.select.2, obj2.outfile.txt1.select.2, obj2.bed.noselect.1 <- read.table(obj2.outfile.bed.noselect.1, obj2.outfile.txt2.select.2)) header = TRUE, as.is = TRUE) unlink(c(obj1.outfile.bed.noselect.3, obj1.outfile.bed.select.3, obj2.outfile.bed.select.1 <- tempfile() obj1.outfile.bgen.noselect.3, obj1.outfile.bgen.select.3, glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.1) obj1.outfile.txt.select.3, obj1.outfile.txt1.select.3, obj2.bed.select.1 <- read.table(obj2.outfile.bed.select.1, obj1.outfile.txt2.select.3)) header = TRUE, as.is = TRUE) unlink(c(obj2.outfile.bed.noselect.3, obj2.outfile.bed.select.3, expect_equal(obj2.bed.noselect.1, obj2.bed.select.1) obj2.outfile.bgen.noselect.3, obj2.outfile.bgen.select.3, obj2.outfile.bgen.noselect.1 <- tempfile() obj2.outfile.txt.select.3, obj2.outfile.txt1.select.3, glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, obj2.outfile.txt2.select.3)) outfile = obj2.outfile.bgen.noselect.1) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", obj2.bgen.noselect.1 <- read.table(obj2.outfile.bgen.noselect.1, quietly = TRUE)) header = TRUE, as.is = TRUE) unlink(c(obj2.outfile.gds.noselect.1, obj2.outfile.gds.select.1, obj2.outfile.bgen.select.1 <- tempfile() obj1.outfile.gds.noselect.2, obj1.outfile.gds.select.2, glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, obj2.outfile.gds.noselect.2, obj2.outfile.gds.select.2, select = select, outfile = obj2.outfile.bgen.select.1) obj1.outfile.gds.noselect.3, obj1.outfile.gds.select.3, obj2.bgen.select.1 <- read.table(obj2.outfile.bgen.select.1, obj2.outfile.gds.noselect.3, obj2.outfile.gds.select.3)) header = TRUE, as.is = TRUE)}) expect_equal(obj2.bgen.noselect.1, obj2.bgen.select.1) expect_equal(obj2.bed.select.1[, c("SNP", "CHR", "POS", "A1", 33: "A2", "N", "AF", "SCORE", "VAR", "PVAL")], obj2.bgen.select.1[, eval(code, test_env) c("SNP", "CHR", "POS", "A1", "A2", "N", "AF", "SCORE", "VAR", "PVAL")])34: if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", eval(code, test_env) quietly = TRUE)) { obj2.outfile.gds.noselect.1 <- tempfile()35: glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.1)withCallingHandlers({ obj2.gds.noselect.1 <- read.table(obj2.outfile.gds.noselect.1, eval(code, test_env) header = TRUE, as.is = TRUE) new_expectations <- the$test_expectations > starting_expectations obj2.outfile.gds.select.1 <- tempfile() if (snapshot_skipped) { glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.1) skip("On CRAN") obj2.gds.select.1 <- read.table(obj2.outfile.gds.select.1, } header = TRUE, as.is = TRUE) else if (!new_expectations && skip_on_empty) { expect_equal(obj2.gds.noselect.1, obj2.gds.select.1) skip_empty() expect_equal(obj2.bed.select.1$PVAL, signif(obj2.gds.select.1$PVAL)) } expect_equal(signif(range(obj2.gds.select.1$PVAL)), signif(c(0.003738918, }, expectation = handle_expectation, packageNotFoundError = function(e) { 0.996996766))) if (on_cran()) { } skip(paste0("{", e$package, "} is not installed.")) obj2.outfile.txt.select.1 <- tempfile() } glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.1, }, snapshot_on_cran = function(cnd) { infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, snapshot_skipped <<- TRUE select = select, infile.header.print = c("SNP", "Allele1", invokeRestart("muffle_cran_snapshot") "Allele2"))}, skip = handle_skip, warning = handle_warning, message = handle_message, obj2.txt.select.1 <- read.table(obj2.outfile.txt.select.1, error = handle_error, interrupt = handle_interrupt) header = TRUE, as.is = TRUE) expect_equal(obj2.bed.select.1$PVAL, obj2.txt.select.1$PVAL)36: obj2.outfile.txt1.select.1 <- tempfile()doTryCatch(return(expr), name, parentenv, handler) glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.1, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, 37: select = select, infile.header.print = c("SNP", "Allele1", tryCatchOne(expr, names, parentenv, handlers[[1L]]) "Allele2")) obj2.txt1.select.1 <- read.table(obj2.outfile.txt1.select.1, 38: header = TRUE, as.is = TRUE)tryCatchList(expr, classes, parentenv, handlers) expect_equal(obj2.txt.select.1, obj2.txt1.select.1) obj2.outfile.txt2.select.1 <- tempfile()39: glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.1, tryCatch(withCallingHandlers({ infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, eval(code, test_env) select = select, infile.header.print = c("SNP", "Allele1", new_expectations <- the$test_expectations > starting_expectations "Allele2")) if (snapshot_skipped) { obj2.txt2.select.1 <- read.table(obj2.outfile.txt2.select.1, skip("On CRAN") header = TRUE, as.is = TRUE) } expect_equal(obj2.txt.select.1, obj2.txt2.select.1) else if (!new_expectations && skip_on_empty) { idx <- sample(nrow(pheno)) skip_empty() pheno <- pheno[idx, ] } obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, }, expectation = handle_expectation, packageNotFoundError = function(e) { id = "id", family = binomial(link = "logit"), method = "REML", if (on_cran()) { method.optim = "AI") skip(paste0("{", e$package, "} is not installed.")) select <- match(1:400, unique(obj1$id_include)) } select[is.na(select)] <- 0}, snapshot_on_cran = function(cnd) { obj1.outfile.bed.noselect.2 <- tempfile() snapshot_skipped <<- TRUE glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.2) invokeRestart("muffle_cran_snapshot") obj1.bed.noselect.2 <- read.table(obj1.outfile.bed.noselect.2, }, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) header = TRUE, as.is = TRUE) expect_equal(obj1.bed.noselect.1, obj1.bed.noselect.2)40: obj1.outfile.bed.select.2 <- tempfile()doWithOneRestart(return(expr), restart) glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.2) obj1.bed.select.2 <- read.table(obj1.outfile.bed.select.2, 41: header = TRUE, as.is = TRUE)withOneRestart(expr, restarts[[1L]]) expect_equal(obj1.bed.select.1, obj1.bed.select.2) obj1.outfile.bgen.noselect.2 <- tempfile()42: glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, withRestarts(tryCatch(withCallingHandlers({ outfile = obj1.outfile.bgen.noselect.2) eval(code, test_env) obj1.bgen.noselect.2 <- read.table(obj1.outfile.bgen.noselect.2, new_expectations <- the$test_expectations > starting_expectations header = TRUE, as.is = TRUE) if (snapshot_skipped) { expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.2) skip("On CRAN") obj1.outfile.bgen.select.2 <- tempfile() } glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, else if (!new_expectations && skip_on_empty) { select = select, outfile = obj1.outfile.bgen.select.2) skip_empty() obj1.bgen.select.2 <- read.table(obj1.outfile.bgen.select.2, } header = TRUE, as.is = TRUE)}, expectation = handle_expectation, packageNotFoundError = function(e) { expect_equal(obj1.bgen.select.1, obj1.bgen.select.2) if (on_cran()) { if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", skip(paste0("{", e$package, "} is not installed.")) quietly = TRUE)) { } obj1.outfile.gds.noselect.2 <- tempfile()}, snapshot_on_cran = function(cnd) { glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.2) snapshot_skipped <<- TRUE obj1.gds.noselect.2 <- read.table(obj1.outfile.gds.noselect.2, invokeRestart("muffle_cran_snapshot") header = TRUE, as.is = TRUE)}, skip = handle_skip, warning = handle_warning, message = handle_message, expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.2) error = handle_error, interrupt = handle_interrupt), error = handle_fatal), obj1.outfile.gds.select.2 <- tempfile() end_test = function() { glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.2) }) obj1.gds.select.2 <- read.table(obj1.outfile.gds.select.2, header = TRUE, as.is = TRUE)43: expect_equal(obj1.gds.select.1, obj1.gds.select.2)test_code(code = exprs, env = env, reporter = get_reporter() %||% } StopReporter$new()) obj1.outfile.txt.select.2 <- tempfile() glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.2, 44: infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, source_file(path, env = env(env), desc = desc, shuffle = shuffle, select = select, infile.header.print = c("SNP", "Allele1", error_call = error_call) "Allele2")) obj1.txt.select.2 <- read.table(obj1.outfile.txt.select.2, 45: header = TRUE, as.is = TRUE)FUN(X[[i]], ...) expect_equal(obj1.txt.select.1, obj1.txt.select.2) obj1.outfile.txt1.select.2 <- tempfile()46: glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.2, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, error_call = error_call) select = select, infile.header.print = c("SNP", "Allele1", "Allele2"))47: obj1.txt1.select.2 <- read.table(obj1.outfile.txt1.select.2, doTryCatch(return(expr), name, parentenv, handler) header = TRUE, as.is = TRUE) expect_equal(obj1.txt1.select.1, obj1.txt1.select.2)48: obj1.outfile.txt2.select.2 <- tempfile()tryCatchOne(expr, names, parentenv, handlers[[1L]]) glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.2, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, 49: select = select, infile.header.print = c("SNP", "Allele1", tryCatchList(expr, classes, parentenv, handlers) "Allele2")) obj1.txt2.select.2 <- read.table(obj1.outfile.txt2.select.2, 50: header = TRUE, as.is = TRUE)tryCatch(code, testthat_abort_reporter = function(cnd) { expect_equal(obj1.txt2.select.1, obj1.txt2.select.2) cat(conditionMessage(cnd), "\n") obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, NULL id = "id", family = binomial(link = "logit"), method = "REML", }) method.optim = "AI") select <- match(1:400, unique(obj2$id_include))51: select[is.na(select)] <- 0with_reporter(reporters$multi, lapply(test_paths, test_one_file, obj2.outfile.bed.noselect.2 <- tempfile() env = env, desc = desc, shuffle = shuffle, error_call = error_call)) glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.2) obj2.bed.noselect.2 <- read.table(obj2.outfile.bed.noselect.2, 52: header = TRUE, as.is = TRUE)test_files_serial(test_dir = test_dir, test_package = test_package, expect_equal(obj2.bed.noselect.1, obj2.bed.noselect.2) test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, obj2.outfile.bed.select.2 <- tempfile() env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.2) desc = desc, load_package = load_package, shuffle = shuffle, obj2.bed.select.2 <- read.table(obj2.outfile.bed.select.2, error_call = error_call) header = TRUE, as.is = TRUE) expect_equal(obj2.bed.select.1, obj2.bed.select.2)53: obj2.outfile.bgen.noselect.2 <- tempfile()test_files(test_dir = path, test_paths = test_paths, test_package = package, glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, reporter = reporter, load_helpers = load_helpers, env = env, outfile = obj2.outfile.bgen.noselect.2) stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, obj2.bgen.noselect.2 <- read.table(obj2.outfile.bgen.noselect.2, load_package = load_package, parallel = parallel, shuffle = shuffle) header = TRUE, as.is = TRUE) expect_equal(obj2.bgen.noselect.1, obj2.bgen.noselect.2)54: obj2.outfile.bgen.select.2 <- tempfile()test_dir("testthat", package = package, reporter = reporter, glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, ..., load_package = "installed") select = select, outfile = obj2.outfile.bgen.select.2) obj2.bgen.select.2 <- read.table(obj2.outfile.bgen.select.2, 55: header = TRUE, as.is = TRUE)test_check("GMMAT") expect_equal(obj2.bgen.select.1, obj2.bgen.select.2) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", An irrecoverable exception occurred. R is aborting now ... quietly = TRUE)) { obj2.outfile.gds.noselect.2 <- tempfile() glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.2) obj2.gds.noselect.2 <- read.table(obj2.outfile.gds.noselect.2, header = TRUE, as.is = TRUE) expect_equal(obj2.gds.noselect.1, obj2.gds.noselect.2) obj2.outfile.gds.select.2 <- tempfile() glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.2) obj2.gds.select.2 <- read.table(obj2.outfile.gds.select.2, header = TRUE, as.is = TRUE) expect_equal(obj2.gds.select.1, obj2.gds.select.2) } obj2.outfile.txt.select.2 <- tempfile() glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.2, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt.select.2 <- read.table(obj2.outfile.txt.select.2, header = TRUE, as.is = TRUE) expect_equal(obj2.txt.select.1, obj2.txt.select.2) obj2.outfile.txt1.select.2 <- tempfile() glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.2, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt1.select.2 <- read.table(obj2.outfile.txt1.select.2, header = TRUE, as.is = TRUE) expect_equal(obj2.txt1.select.1, obj2.txt1.select.2) obj2.outfile.txt2.select.2 <- tempfile() glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.2, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt2.select.2 <- read.table(obj2.outfile.txt2.select.2, header = TRUE, as.is = TRUE) expect_equal(obj2.txt2.select.1, obj2.txt2.select.2) idx <- sample(nrow(kins)) kins <- kins[idx, idx] obj1 <- glmmkin(disease ~ age + sex, data = pheno, kins = kins, id = "id", family = binomial(link = "logit"), method = "REML", method.optim = "AI") select <- match(1:400, unique(obj1$id_include)) select[is.na(select)] <- 0 obj1.outfile.bed.noselect.3 <- tempfile() glmm.score(obj1, infile = plinkfiles, outfile = obj1.outfile.bed.noselect.3) obj1.bed.noselect.3 <- read.table(obj1.outfile.bed.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj1.bed.noselect.1, obj1.bed.noselect.3) obj1.outfile.bed.select.3 <- tempfile() glmm.score(obj1, infile = plinkfiles, select = select, outfile = obj1.outfile.bed.select.3) obj1.bed.select.3 <- read.table(obj1.outfile.bed.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.bed.select.1, obj1.bed.select.3) obj1.outfile.bgen.noselect.3 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, outfile = obj1.outfile.bgen.noselect.3) obj1.bgen.noselect.3 <- read.table(obj1.outfile.bgen.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj1.bgen.noselect.1, obj1.bgen.noselect.3) obj1.outfile.bgen.select.3 <- tempfile() glmm.score(obj1, infile = bgenfile, BGEN.samplefile = samplefile, select = select, outfile = obj1.outfile.bgen.select.3) obj1.bgen.select.3 <- read.table(obj1.outfile.bgen.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.bgen.select.1, obj1.bgen.select.3) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", quietly = TRUE)) { obj1.outfile.gds.noselect.3 <- tempfile() glmm.score(obj1, infile = gdsfile, outfile = obj1.outfile.gds.noselect.3) obj1.gds.noselect.3 <- read.table(obj1.outfile.gds.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj1.gds.noselect.1, obj1.gds.noselect.3) obj1.outfile.gds.select.3 <- tempfile() glmm.score(obj1, infile = gdsfile, select = select, outfile = obj1.outfile.gds.select.3) obj1.gds.select.3 <- read.table(obj1.outfile.gds.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.gds.select.1, obj1.gds.select.3) } obj1.outfile.txt.select.3 <- tempfile() glmm.score(obj1, infile = txtfile, outfile = obj1.outfile.txt.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt.select.3 <- read.table(obj1.outfile.txt.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.txt.select.1, obj1.txt.select.3) obj1.outfile.txt1.select.3 <- tempfile() glmm.score(obj1, infile = txtfile1, outfile = obj1.outfile.txt1.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt1.select.3 <- read.table(obj1.outfile.txt1.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.txt1.select.1, obj1.txt1.select.3) obj1.outfile.txt2.select.3 <- tempfile() glmm.score(obj1, infile = txtfile2, outfile = obj1.outfile.txt2.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj1.txt2.select.3 <- read.table(obj1.outfile.txt2.select.3, header = TRUE, as.is = TRUE) expect_equal(obj1.txt2.select.1, obj1.txt2.select.3) obj2 <- glmmkin(disease ~ age + sex, data = pheno, kins = NULL, id = "id", family = binomial(link = "logit"), method = "REML", method.optim = "AI") select <- match(1:400, unique(obj2$id_include)) select[is.na(select)] <- 0 obj2.outfile.bed.noselect.3 <- tempfile() glmm.score(obj2, infile = plinkfiles, outfile = obj2.outfile.bed.noselect.3) obj2.bed.noselect.3 <- read.table(obj2.outfile.bed.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj2.bed.noselect.1, obj2.bed.noselect.3) obj2.outfile.bed.select.3 <- tempfile() glmm.score(obj2, infile = plinkfiles, select = select, outfile = obj2.outfile.bed.select.3) obj2.bed.select.3 <- read.table(obj2.outfile.bed.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.bed.select.1, obj2.bed.select.3) obj2.outfile.bgen.noselect.3 <- tempfile() glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, outfile = obj2.outfile.bgen.noselect.3) obj2.bgen.noselect.3 <- read.table(obj2.outfile.bgen.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj2.bgen.noselect.1, obj2.bgen.noselect.3) obj2.outfile.bgen.select.3 <- tempfile() glmm.score(obj2, infile = bgenfile, BGEN.samplefile = samplefile, select = select, outfile = obj2.outfile.bgen.select.3) obj2.bgen.select.3 <- read.table(obj2.outfile.bgen.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.bgen.select.1, obj2.bgen.select.3) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", quietly = TRUE)) { obj2.outfile.gds.noselect.3 <- tempfile() glmm.score(obj2, infile = gdsfile, outfile = obj2.outfile.gds.noselect.3) obj2.gds.noselect.3 <- read.table(obj2.outfile.gds.noselect.3, header = TRUE, as.is = TRUE) expect_equal(obj2.gds.noselect.1, obj2.gds.noselect.3) obj2.outfile.gds.select.3 <- tempfile() glmm.score(obj2, infile = gdsfile, select = select, outfile = obj2.outfile.gds.select.3) obj2.gds.select.3 <- read.table(obj2.outfile.gds.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.gds.select.1, obj2.gds.select.3) } obj2.outfile.txt.select.3 <- tempfile() glmm.score(obj2, infile = txtfile, outfile = obj2.outfile.txt.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt.select.3 <- read.table(obj2.outfile.txt.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.txt.select.1, obj2.txt.select.3) obj2.outfile.txt1.select.3 <- tempfile() glmm.score(obj2, infile = txtfile1, outfile = obj2.outfile.txt1.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt1.select.3 <- read.table(obj2.outfile.txt1.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.txt1.select.1, obj2.txt1.select.3) obj2.outfile.txt2.select.3 <- tempfile() glmm.score(obj2, infile = txtfile2, outfile = obj2.outfile.txt2.select.3, infile.nrow.skip = 5, infile.ncol.skip = 3, infile.ncol.print = 1:3, select = select, infile.header.print = c("SNP", "Allele1", "Allele2")) obj2.txt2.select.3 <- read.table(obj2.outfile.txt2.select.3, header = TRUE, as.is = TRUE) expect_equal(obj2.txt2.select.1, obj2.txt2.select.3) unlink(c(obj2.outfile.bed.noselect.1, obj2.outfile.bed.select.1, obj2.outfile.bgen.noselect.1, obj2.outfile.bgen.select.1, obj2.outfile.txt.select.1, obj2.outfile.txt1.select.1, obj2.outfile.txt2.select.1)) unlink(c(obj1.outfile.bed.noselect.2, obj1.outfile.bed.select.2, obj1.outfile.bgen.noselect.2, obj1.outfile.bgen.select.2, obj1.outfile.txt.select.2, obj1.outfile.txt1.select.2, obj1.outfile.txt2.select.2)) unlink(c(obj2.outfile.bed.noselect.2, obj2.outfile.bed.select.2, obj2.outfile.bgen.noselect.2, obj2.outfile.bgen.select.2, obj2.outfile.txt.select.2, obj2.outfile.txt1.select.2, obj2.outfile.txt2.select.2)) unlink(c(obj1.outfile.bed.noselect.3, obj1.outfile.bed.select.3, obj1.outfile.bgen.noselect.3, obj1.outfile.bgen.select.3, obj1.outfile.txt.select.3, obj1.outfile.txt1.select.3, obj1.outfile.txt2.select.3)) unlink(c(obj2.outfile.bed.noselect.3, obj2.outfile.bed.select.3, obj2.outfile.bgen.noselect.3, obj2.outfile.bgen.select.3, obj2.outfile.txt.select.3, obj2.outfile.txt1.select.3, obj2.outfile.txt2.select.3)) if (requireNamespace("SeqArray", quietly = TRUE) && requireNamespace("SeqVarTools", quietly = TRUE)) unlink(c(obj2.outfile.gds.noselect.1, obj2.outfile.gds.select.1, obj1.outfile.gds.noselect.2, obj1.outfile.gds.select.2, obj2.outfile.gds.noselect.2, obj2.outfile.gds.select.2, obj1.outfile.gds.noselect.3, obj1.outfile.gds.select.3, obj2.outfile.gds.noselect.3, obj2.outfile.gds.select.3))}) 33: eval(code, test_env) 34: eval(code, test_env) 35: withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt) 36: doTryCatch(return(expr), name, parentenv, handler) 37: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 38: tryCatchList(expr, classes, parentenv, handlers) 39: tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal) 40: doWithOneRestart(return(expr), restart) 41: withOneRestart(expr, restarts[[1L]]) 42: withRestarts(tryCatch(withCallingHandlers({ eval(code, test_env) new_expectations <- the$test_expectations > starting_expectations if (snapshot_skipped) { skip("On CRAN") } else if (!new_expectations && skip_on_empty) { skip_empty() }}, expectation = handle_expectation, packageNotFoundError = function(e) { if (on_cran()) { skip(paste0("{", e$package, "} is not installed.")) }}, snapshot_on_cran = function(cnd) { snapshot_skipped <<- TRUE invokeRestart("muffle_cran_snapshot")}, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error, interrupt = handle_interrupt), error = handle_fatal), end_test = function() { }) 43: test_code(code = exprs, env = env, reporter = get_reporter() %||% StopReporter$new()) 44: source_file(path, env = env(env), desc = desc, shuffle = shuffle, error_call = error_call) 45: FUN(X[[i]], ...) 46: lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call) 47: doTryCatch(return(expr), name, parentenv, handler) 48: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 49: tryCatchList(expr, classes, parentenv, handlers) 50: tryCatch(code, testthat_abort_reporter = function(cnd) { cat(conditionMessage(cnd), "\n") NULL}) 51: with_reporter(reporters$multi, lapply(test_paths, test_one_file, env = env, desc = desc, shuffle = shuffle, error_call = error_call)) 52: test_files_serial(test_dir = test_dir, test_package = test_package, test_paths = test_paths, load_helpers = load_helpers, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, desc = desc, load_package = load_package, shuffle = shuffle, error_call = error_call) 53: test_files(test_dir = path, test_paths = test_paths, test_package = package, reporter = reporter, load_helpers = load_helpers, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, load_package = load_package, parallel = parallel, shuffle = shuffle) 54: test_dir("testthat", package = package, reporter = reporter, ..., load_package = "installed") 55: test_check("GMMAT") An irrecoverable exception occurred. R is aborting now ... Saving _problems/test_glmm.score-37.R The following SNPs have been removed due to inconsistent alleles across studies: [1] "L10" "L12" "L15" [ FAIL 1 | WARN 2 | SKIP 30 | PASS 3 ] ══ Skipped tests (30) ══════════════════════════════════════════════════════════ • On CRAN (28): 'test_SMMAT.R:56:2', 'test_SMMAT.R:103:2', 'test_SMMAT.R:149:2', 'test_SMMAT.R:196:2', 'test_SMMAT.R:236:2', 'test_SMMAT.R:276:2', 'test_SMMAT.meta.R:45:2', 'test_SMMAT.meta.R:77:2', 'test_SMMAT.meta.R:108:2', 'test_SMMAT.meta.R:140:2', 'test_SMMAT.meta.R:165:2', 'test_glmm.score.R:317:2', 'test_glmm.score.R:616:2', 'test_glmm.score.R:914:2', 'test_glmm.score.R:1213:2', 'test_glmm.score.R:1505:2', 'test_glmm.score.R:1797:2', 'test_glmm.wald.R:2:2', 'test_glmm.wald.R:805:2', 'test_glmm.wald.R:1609:2', 'test_glmm.wald.R:1761:2', 'test_glmmkin.R:2:2', 'test_glmmkin.R:82:2', 'test_glmmkin.R:163:2', 'test_glmmkin.R:245:2', 'test_glmmkin.R:328:2', 'test_glmmkin.R:362:2', 'test_glmmkin.R:396:2' • {SeqArray} is not installed (2): 'test_SMMAT.R:2:9', 'test_SMMAT.meta.R:2:2' ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test_glmm.score.R:37:2'): cross-sectional id le 400 binomial ──────── Error in `file(outfile, "w")`: cannot open the connection Backtrace: ▆ 1. └─GMMAT::glmm.score(...) at test_glmm.score.R:37:9 2. └─base::file(outfile, "w") [ FAIL 1 | WARN 2 | SKIP 30 | PASS 3 ] Error: ! Test failures. Execution halted Flavor: r-oldrel-macos-arm64