xinhe-lab / ctwas

package for the causal TWAS project
https://xinhe-lab.github.io/ctwas/
MIT License
32 stars 12 forks source link

testthat test errors #29

Closed pcarbo closed 2 months ago

pcarbo commented 3 months ago

@kevinlkx I'm getting some errors when I try to run the tests with devtools::test():

Error (test-ctwas_compute_region_cor.R:23:3): get_region_cor works
Error in `get_region_cor(region_id, region_data = screened_region_data,
    LD_info = LD_info, snp_info = snp_info, weights = weights)`: all(file.exists(LD_matrix_files)) is not TRUE
Backtrace:
    ▆
 1. └─ctwas::get_region_cor(...) at test-ctwas_compute_region_cor.R:23:3
 2.   └─base::stopifnot(all(file.exists(LD_matrix_files))) at ctwas/R/ctwas_compute_region_cor.R:172:5

Error (test-ctwas_finemapping.R:21:5): finemap_regions works with LD
Error in `get_region_cor(region_id, region_data = region_data, LD_info = LD_info,
    snp_info = snp_info, weights = weights, force_compute_cor = force_compute_cor,
    save_cor = save_cor, cor_dir = cor_dir, LD_format = LD_format,
    LD_loader = LD_loader, verbose = verbose)`: all(file.exists(LD_matrix_files)) is not TRUE
Backtrace:
    ▆
 1. ├─base::suppressWarnings(...) at test-ctwas_finemapping.R:20:3
 2. │ └─base::withCallingHandlers(...)
 3. └─ctwas::finemap_regions(...) at test-ctwas_finemapping.R:21:5
 4.   └─parallel::mclapply(...) at ctwas/R/ctwas_finemapping.R:275:3
 5.     └─base::lapply(X = X, FUN = FUN, ...)
 6.       └─ctwas (local) FUN(X[[i]], ...)
 7.         └─ctwas::finemap_region(...) at ctwas/R/ctwas_finemapping.R:283:5
 8.           └─ctwas::get_region_cor(...) at ctwas/R/ctwas_finemapping.R:128:5
 9.             └─base::stopifnot(all(file.exists(LD_matrix_files))) at ctwas/R/ctwas_compute_region_cor.R:172:5
kevinlkx commented 3 months ago

thanks Peter! The reason is that the LD matrix is on RCC but not included in the package (because it is too large). So it passed when I ran devtools::test() on RCC, but would not work when you test it locally. I will change the tests using simulated data.