Skip to content

Commit 89ed77e

Browse files
bschilderclaude
andcommitted
Fix COJO test: add GCTA skip guard and namespace calls
COJO tests fail when GCTA binary is not available — the function silently returns input data without the expected result columns. Added skip guard for missing gcta/gcta64. Also added echofinemap:: namespace to COJO() calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent de6c833 commit 89ed77e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/testthat/test-COJO.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ test_that("COJO works", {
22

33
testthat::skip_if_not_installed("genetics.binaRies")
44
testthat::skip_if_not_installed("echoLD")
5+
testthat::skip_if(
6+
!nzchar(Sys.which("gcta64")) && !nzchar(Sys.which("gcta")),
7+
message = "GCTA not available"
8+
)
59

610
vcf <- system.file("extdata", "BST1.1KGphase3.vcf.bgz",
711
package = "echodata")
@@ -23,7 +27,7 @@ test_that("COJO works", {
2327
#### All 3 modes at once: BEFORE running other functions ####
2428
## The flag
2529
testthat::expect_warning(
26-
cojo_DT <- COJO(dat = dat,
30+
cojo_DT <- echofinemap::COJO(dat = dat,
2731
locus_dir = locus_dir,
2832
fullSS_path = fullSS_path,
2933
bfile = bfile,
@@ -36,7 +40,7 @@ test_that("COJO works", {
3640
all(step_cols %in% names(cojo_DT))
3741
)
3842
#### mode: stepwise: locus-specific ####
39-
cojo_DT <- COJO(dat = dat,
43+
cojo_DT <- echofinemap::COJO(dat = dat,
4044
locus_dir = locus_dir,
4145
fullSS_path = fullSS_path,
4246
bfile = bfile,
@@ -47,7 +51,7 @@ test_that("COJO works", {
4751
all(step_cols %in% names(cojo_DT))
4852
)
4953
#### mode: stepwise: genome-wide ####
50-
cojo_DT <- COJO(dat = dat,
54+
cojo_DT <- echofinemap::COJO(dat = dat,
5155
locus_dir = locus_dir,
5256
fullSS_path = fullSS_path,
5357
bfile = bfile,
@@ -59,7 +63,7 @@ test_that("COJO works", {
5963
all(step_cols %in% names(cojo_DT))
6064
)
6165
#### mode: conditional ####
62-
cojo_DT <- COJO(dat = dat,
66+
cojo_DT <- echofinemap::COJO(dat = dat,
6367
locus_dir = locus_dir,
6468
fullSS_path = fullSS_path,
6569
bfile = bfile,

0 commit comments

Comments
 (0)