From f7bd3336deccdd623f396c9a083d9257624a42e5 Mon Sep 17 00:00:00 2001 From: Al-Murphy Date: Thu, 22 Feb 2024 09:03:48 +0000 Subject: [PATCH] longtests upstream --- DESCRIPTION | 2 +- tests/testthat/test-check_imputation_cols.R | 79 --------------------- 2 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 tests/testthat/test-check_imputation_cols.R diff --git a/DESCRIPTION b/DESCRIPTION index f673655..a531936 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: MungeSumstats Type: Package Title: Standardise summary statistics from GWAS -Version: 1.11.7 +Version: 1.11.8 Authors@R: c(person(given = "Alan", family = "Murphy", diff --git a/tests/testthat/test-check_imputation_cols.R b/tests/testthat/test-check_imputation_cols.R deleted file mode 100644 index cc901bb..0000000 --- a/tests/testthat/test-check_imputation_cols.R +++ /dev/null @@ -1,79 +0,0 @@ -test_that("Check that imputation columns added correctly", { - ## The following test uses more than 2GB of memory, which is more - ## than what 32-bit Windows can handle: - is_32bit_windows <- .Platform$OS.type == "windows" #&& - #.Platform$r_arch == "i386" - if (!is_32bit_windows) { - pth <- system.file("extdata", "eduAttainOkbay.txt", - package = "MungeSumstats" - ) - #only run not on linux to speed up linux bioc checks - if (Sys.info()["sysname"]!="Linux"){ - eduAttainOkbay <- data.table::fread(pth) - # edit to make an rs id be imputed - eduAttainOkbay[1, "MarkerName"] <- - substring( - eduAttainOkbay[1, "MarkerName"], 3, - nchar(eduAttainOkbay[1, "MarkerName"]) - ) - # write to temp dir - file <- tempfile() - data.table::fwrite(eduAttainOkbay, file) - # run - reformatted <- MungeSumstats::format_sumstats(file, - ref_genome = "GRCh37", - compute_z = TRUE, - compute_n = 1001, - save_format='LDSC', - imputation_ind = TRUE, - allele_flip_check = TRUE, - dbSNP=144 - ) - res <- data.table::fread(reformatted) - col_headers <- names(res) - imputat_cols <- c( - col_headers[grepl("^IMPUTATION_", col_headers)], - "flipped"["flipped" %in% col_headers], - col_headers[grepl("^convert_", col_headers)] - ) - # just check imputation columns exist - expect_equal(length(imputat_cols) > 0, TRUE) - # also check all have at least 1 value present - have_value <- TRUE - for (col_i in imputat_cols) { - col_i_val <- res[[col_i]] - if (length(col_i_val[!is.na(col_i_val)]) == 0) { - have_value <- FALSE - } - } - expect_equal(have_value, TRUE) - } else{ - expect_equal(isTRUE(Sys.info()["sysname"]=="Linux"), TRUE) - expect_equal(isTRUE(Sys.info()["sysname"]=="Linux"), TRUE) - } - # check other compute_n values - eduAttainOkbay <- data.table::fread(pth) - eduAttainOkbay[, N_CON := 100] - eduAttainOkbay[, N_CAS := 120] - # write to temp dir - file <- tempfile() - data.table::fwrite(eduAttainOkbay, file) - methods <- c("ldsc", "sum", "giant", "metal") - reformatted <- MungeSumstats::format_sumstats(file, - ref_genome = "GRCh37", - compute_n = methods, - on_ref_genome = FALSE, - strand_ambig_filter = FALSE, - bi_allelic_filter = FALSE, - allele_flip_check = FALSE, - dbSNP=144 - ) - res <- data.table::fread(reformatted) - expect_equal(all(paste0("Neff_", c("ldsc", "giant", "metal")) %in% - colnames(res)), TRUE) - } else { - expect_equal(is_32bit_windows, TRUE) - expect_equal(is_32bit_windows, TRUE) - expect_equal(is_32bit_windows, TRUE) - } -})