diff --git a/.github/environment/pixi.toml b/.github/environment/pixi.toml index a3d0b7fd3..fbd2e2fe2 100644 --- a/.github/environment/pixi.toml +++ b/.github/environment/pixi.toml @@ -1,4 +1,4 @@ -[project] +[workspace] name = "r-pecotmr" channels = ["dnachun", "conda-forge", "bioconda"] platforms = ["linux-64", "osx-arm64"] diff --git a/.github/recipe/recipe.yaml b/.github/recipe/recipe.yaml index 4bf2dd7fe..a8095d4fd 100644 --- a/.github/recipe/recipe.yaml +++ b/.github/recipe/recipe.yaml @@ -27,13 +27,19 @@ requirements: - bioconductor-iranges - bioconductor-qvalue - bioconductor-s4vectors + - bioconductor-snprelate - bioconductor-snpstats + - bioconductor-mungesumstats + - bioconductor-rsamtools - r-base - r-bglr - r-bigsnpr - r-coda - r-coloc - r-colocboost + - r-cpp11 + - r-cpp11armadillo + - r-decor - r-dofuture - r-dplyr - r-flashier @@ -54,8 +60,6 @@ requirements: - r-pgenlibr - r-purrr - r-qgg - - r-rcpp - - r-rcpparmadillo - r-rcppdpr - r-readr - r-rfast diff --git a/DESCRIPTION b/DESCRIPTION index c44b92547..04200fa59 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,8 +15,10 @@ Authors@R: c(person("Gao Wang",role = c("cre","aut"), License: MIT + file LICENSE Imports: Biostrings, + GenomicRanges, IRanges, - Rcpp, + MungeSumstats, + Rsamtools, S4Vectors, coloc, doFuture, @@ -58,15 +60,18 @@ Suggests: qgg, qvalue, rmarkdown, + gdsfmt, + SNPRelate, snpStats, - testthat + testthat, + VariantAnnotation Remotes: stephenslab/fsusieR, stephenslab/mvsusieR, stephenslab/susieR, LinkingTo: - Rcpp, - RcppArmadillo + cpp11, + cpp11armadillo NeedsCompilation: yes VignetteBuilder: knitr RoxygenNote: 7.3.3 diff --git a/NAMESPACE b/NAMESPACE index 9135a0086..d7b1baaa1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -69,6 +69,7 @@ export(load_tsv_region) export(load_twas_weights) export(mash_pipeline) export(mash_rand_null_sample) +export(match_ref_panel) export(mcp_weights) export(merge_mash_data) export(merge_sumstats_matrices) @@ -97,6 +98,7 @@ export(scad_weights) export(sdpr) export(sdpr_weights) export(slalom) +export(standardise_sumstats_columns) export(summary_stats_qc) export(susie_ash_weights) export(susie_inf_weights) @@ -211,4 +213,4 @@ importFrom(utils,read.table) importFrom(utils,tail) importFrom(vctrs,vec_duplicate_detect) importFrom(vroom,vroom) -useDynLib(pecotmr) +useDynLib(pecotmr, .registration = TRUE) diff --git a/R/LD.R b/R/LD.R index 5269e7810..d1a608ddf 100644 --- a/R/LD.R +++ b/R/LD.R @@ -152,9 +152,9 @@ process_LD_matrix <- function(LD_file_path, snp_file_path = NULL) { } if (is_pvar) { - # PLINK2 .pvar format: read via existing read_pvar_text() - LD_variants <- read_pvar_text(snp_file_path) - # read_pvar_text returns: chrom, id, pos, A2 (REF), A1 (ALT) + # PLINK2 .pvar format: read via existing read_pvar() + LD_variants <- read_pvar(snp_file_path) + # read_pvar returns: chrom, id, pos, A2 (REF), A1 (ALT) LD_variants <- LD_variants %>% mutate(chrom = as.character(as.integer(strip_chr_prefix(chrom))), variants = normalize_variant_id(id)) %>% @@ -286,21 +286,21 @@ create_LD_matrix <- function(LD_matrices, variants) { load_LD_matrix <- function(LD_meta_file_path, region, extract_coordinates = NULL, return_genotype = FALSE, n_sample = NULL) { source <- resolve_ld_source(LD_meta_file_path) - is_plink <- source$type %in% c("plink2", "plink1") + is_geno <- source$type %in% c("plink2", "plink1", "vcf", "gds") - # "auto": return X for PLINK, R for pre-computed - if (identical(return_genotype, "auto")) return_genotype <- is_plink + # "auto": return X for genotype sources, R for pre-computed + if (identical(return_genotype, "auto")) return_genotype <- is_geno - if (is_plink) { - prefix <- resolve_plink_prefix_for_region(source$meta_path, region, source$type) - return(load_LD_from_genotype(prefix, region, source$type, + if (is_geno) { + geno_path <- resolve_genotype_path_for_region(source$meta_path, region) + return(load_LD_from_genotype(geno_path, region, return_genotype = return_genotype, n_sample = n_sample)) } # Pre-computed LD blocks (.cor.xz) if (return_genotype) { - stop("return_genotype=TRUE requires PLINK genotype files, not pre-computed LD matrices.") + stop("return_genotype=TRUE requires genotype files, not pre-computed LD matrices.") } load_LD_from_blocks(source$meta_path, region, extract_coordinates, n_sample = n_sample) } @@ -321,26 +321,43 @@ has_plink1_files <- function(prefix) { file.exists(paste0(prefix, ".fam")) } +#' @noRd +is_vcf_path <- function(path) { + grepl("\\.(vcf|vcf\\.gz|bcf)$", path) && file.exists(path) +} + +#' @noRd +is_gds_path <- function(path) { + grepl("\\.gds$", path) && file.exists(path) +} + +#' Check whether a path points to a genotype source (PLINK, VCF, or GDS). +#' @noRd +is_genotype_source <- function(path) { + has_plink2_files(path) || has_plink1_files(path) || is_vcf_path(path) || is_gds_path(path) +} + #' Resolve an LD source metadata TSV to its actual data type. #' -#' The metadata TSV has columns: chrom, start, end, path. Two formats are supported: +#' The metadata TSV has columns: chrom, start, end, path. Three categories are +#' supported: #' \itemize{ #' \item Pre-computed LD blocks (.cor.xz): many rows per chromosome, each with #' specific start/end block boundaries and path pointing to .cor.xz files. -#' \item PLINK genotype files: one row per chromosome with start=0, end=0, -#' and path pointing to a per-chromosome PLINK prefix. The actual region -#' filter is applied by the PLINK loader, not by block boundaries. +#' \item Genotype files (PLINK2, PLINK1, VCF, or GDS): one row per chromosome +#' with start=0, end=0, and path pointing to a per-chromosome genotype file +#' or prefix. The actual region filter is applied by the genotype loader. #' } #' #' This function peeks at the first row to determine the data type. -#' The actual per-chromosome PLINK prefix is resolved later by -#' \code{resolve_plink_prefix_for_region()} at load time. +#' The actual per-chromosome path is resolved later by +#' \code{resolve_genotype_path_for_region()} at load time. #' #' @param path Path to a metadata TSV file with columns chrom, start, end, path. #' @return A list with: -#' \item{type}{"plink2", "plink1", or "precomputed"} -#' \item{data_path}{PLINK prefix from first row (for type detection only; actual -#' per-chromosome prefix is resolved at load time)} +#' \item{type}{"plink2", "plink1", "vcf", "gds", or "precomputed"} +#' \item{data_path}{Genotype path from first row (for type detection only; actual +#' per-chromosome path is resolved at load time)} #' \item{meta_path}{The metadata TSV path (always set)} #' @importFrom vroom vroom #' @noRd @@ -359,22 +376,24 @@ resolve_ld_source <- function(path) { if (has_plink2_files(resolved)) return(list(type = "plink2", data_path = resolved, meta_path = path)) if (has_plink1_files(resolved)) return(list(type = "plink1", data_path = resolved, meta_path = path)) + if (is_vcf_path(resolved)) return(list(type = "vcf", data_path = resolved, meta_path = path)) + if (is_gds_path(resolved)) return(list(type = "gds", data_path = resolved, meta_path = path)) # Pre-computed .cor.xz blocks — verify not using 0:0 sentinel if (!is.na(meta$start) && !is.na(meta$end) && meta$start == 0 && meta$end == 0) { - stop("Metadata has start=0, end=0 but path does not resolve to PLINK files: ", resolved, - "\n The 0:0 sentinel is only valid for whole-chromosome PLINK genotype files.") + stop("Metadata has start=0, end=0 but path does not resolve to genotype files: ", resolved, + "\n The 0:0 sentinel is only valid for whole-chromosome genotype files.") } list(type = "precomputed", meta_path = path) } -#' Resolve the correct PLINK prefix for a given region from a metadata TSV. +#' Resolve the correct genotype path for a given region from a metadata TSV. #' Reads the TSV, finds the row matching the query region's chromosome, -#' and returns the resolved PLINK prefix path. +#' and returns the resolved genotype file path or prefix. #' @importFrom vroom vroom #' @noRd -resolve_plink_prefix_for_region <- function(meta_path, region, source_type) { +resolve_genotype_path_for_region <- function(meta_path, region) { parsed <- parse_region(region) meta <- as.data.frame(vroom(meta_path, show_col_types = FALSE)) colnames(meta) <- c("chrom", "start", "end", "path") @@ -391,17 +410,13 @@ resolve_plink_prefix_for_region <- function(meta_path, region, source_type) { # ---------- Internal: load LD from genotype files ---------- -#' Load genotype data from PLINK files and compute LD or return genotype matrix. -#' @param source_type Character, "plink1" or "plink2" (from resolve_ld_source). +#' Load genotype data and compute LD or return genotype matrix. #' @noRd -load_LD_from_genotype <- function(prefix, region, source_type, +load_LD_from_genotype <- function(genotype_path, region, return_genotype = FALSE, n_sample = NULL) { - # Load genotype matrix and variant info - result <- if (source_type == "plink2") { - load_plink2_data(prefix, region = region) - } else { - load_plink1_data(prefix, region = region) - } + # Load genotype matrix and variant info via the unified loader + result <- load_genotype_region(genotype_path, region = region, + return_variant_info = TRUE) X <- result$X variant_info <- result$variant_info @@ -415,19 +430,20 @@ load_LD_from_genotype <- function(prefix, region, source_type, ref_panel <- parse_variant_id(variant_ids) ref_panel$variant_id <- variant_ids - # Load allele frequency from .afreq file (required for PLINK sources) - afreq <- read_afreq(prefix) - if (is.null(afreq)) { - stop("Allele frequency file (.afreq or .afreq.zst) not found at prefix: ", prefix, - "\n The .afreq file is required for PLINK genotype LD sources.") - } - freq_match <- match(variant_info$id, afreq$id) - n_unmatched <- sum(is.na(freq_match)) - if (n_unmatched > 0) { - warning(n_unmatched, " out of ", length(freq_match), - " variants have no allele frequency in .afreq file.") + # Load allele frequency from .afreq file if available, otherwise compute from genotypes + afreq <- read_afreq(genotype_path) + if (!is.null(afreq)) { + freq_match <- match(variant_info$id, afreq$id) + n_unmatched <- sum(is.na(freq_match)) + if (n_unmatched > 0) { + warning(n_unmatched, " out of ", length(freq_match), + " variants have no allele frequency in .afreq file.") + } + ref_panel$allele_freq <- afreq$alt_freq[freq_match] + } else { + # Compute ALT allele frequency directly from the dosage matrix + ref_panel$allele_freq <- colMeans(X, na.rm = TRUE) / 2 } - ref_panel$allele_freq <- afreq$alt_freq[freq_match] # Compute variance if sample size provided if (!is.null(n_sample)) { diff --git a/R/RcppExports.R b/R/RcppExports.R deleted file mode 100644 index 5a0bbd5ed..000000000 --- a/R/RcppExports.R +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by using Rcpp::compileAttributes() -> do not edit by hand -# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -dentist_iterative_impute <- function(LD_mat, nSample, zScore, pValueThreshold, propSVD, gcControl, nIter, gPvalueThreshold, ncpus, correct_chen_et_al_bug, verbose = FALSE) { - .Call('_pecotmr_dentist_iterative_impute', PACKAGE = 'pecotmr', LD_mat, nSample, zScore, pValueThreshold, propSVD, gcControl, nIter, gPvalueThreshold, ncpus, correct_chen_et_al_bug, verbose) -} - -lassosum_rss_rcpp <- function(z, LD, lambda, thr, maxiter) { - .Call('_pecotmr_lassosum_rss_rcpp', PACKAGE = 'pecotmr', z, LD, lambda, thr, maxiter) -} - -prs_cs_rcpp <- function(a, b, phi, bhat, maf, n, ld_blk, n_iter, n_burnin, thin, verbose, seed) { - .Call('_pecotmr_prs_cs_rcpp', PACKAGE = 'pecotmr', a, b, phi, bhat, maf, n, ld_blk, n_iter, n_burnin, thin, verbose, seed) -} - -qtl_enrichment_rcpp <- function(r_gwas_pip, r_qtl_susie_fit, pi_gwas = 0, pi_qtl = 0, ImpN = 25L, shrinkage_lambda = 1.0, num_threads = 1L) { - .Call('_pecotmr_qtl_enrichment_rcpp', PACKAGE = 'pecotmr', r_gwas_pip, r_qtl_susie_fit, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, num_threads) -} - -sdpr_rcpp <- function(bhat, LD, n, per_variant_sample_size = NULL, array = NULL, a = 0.1, c = 1.0, M = 1000L, a0k = 0.5, b0k = 0.5, iter = 1000L, burn = 200L, thin = 5L, n_threads = 1L, opt_llk = 1L, verbose = TRUE, seed = NULL) { - .Call('_pecotmr_sdpr_rcpp', PACKAGE = 'pecotmr', bhat, LD, n, per_variant_sample_size, array, a, c, M, a0k, b0k, iter, burn, thin, n_threads, opt_llk, verbose, seed) -} - diff --git a/R/allele_qc.R b/R/allele_qc.R index 4d5f1c69d..40949f33f 100644 --- a/R/allele_qc.R +++ b/R/allele_qc.R @@ -1,7 +1,8 @@ -#' Match alleles between target data and reference variants +#' Match target data alleles against a reference panel #' #' Match by ("chrom", "A1", "A2" and "pos"), accounting for possible #' strand flips and major/minor allele flips (opposite effects and zscores). +#' Flips specified columns when alleles are swapped relative to the reference. #' #' @param target_data A data frame with columns "chrom", "pos", "A2", "A1" (and optionally other columns like "beta" or "z"), #' or a vector of strings in the format of "chr:pos:A2:A1"/"chr:pos_A2_A1". Can be automatically converted to a data frame if a vector. @@ -22,7 +23,7 @@ #' @importFrom vctrs vec_duplicate_detect #' @importFrom tidyr separate #' @export -allele_qc <- function(target_data, ref_variants, col_to_flip = NULL, +match_ref_panel <- function(target_data, ref_variants, col_to_flip = NULL, match_min_prop = 0.2, remove_dups = TRUE, remove_indels = FALSE, remove_strand_ambiguous = TRUE, flip_strand = FALSE, remove_unmatched = TRUE, ...) { @@ -183,6 +184,10 @@ allele_qc <- function(target_data, ref_variants, col_to_flip = NULL, return(list(target_data_qced = result, qc_summary = match_result)) } +#' @rdname match_ref_panel +#' @export +allele_qc <- match_ref_panel + #' Align Variant Names #' #' This function aligns variant names from two strings containing variant names in the format of @@ -228,7 +233,7 @@ align_variant_names <- function(source, reference, remove_indels = FALSE, remove source_df <- parse_variant_id(source) reference_df <- parse_variant_id(reference) - qc_result <- allele_qc( + qc_result <- match_ref_panel( target_data = source_df, ref_variants = reference_df, col_to_flip = NULL, diff --git a/R/compute_qtl_enrichment.R b/R/compute_qtl_enrichment.R index e8296e1f7..4b4d5b5fe 100644 --- a/R/compute_qtl_enrichment.R +++ b/R/compute_qtl_enrichment.R @@ -52,12 +52,14 @@ #' en <- compute_qtl_enrichment(gwas_fit, susie_fits, lambda = lambda, ImpN = ImpN, num_threads = num_threads) #' #' @seealso \code{\link[susieR]{susie}} -#' @useDynLib pecotmr +#' @useDynLib pecotmr, .registration = TRUE #' @export #' compute_qtl_enrichment <- function(gwas_pip, susie_qtl_regions, num_gwas = NULL, pi_qtl = NULL, lambda = 1.0, ImpN = 25, + double_shrinkage = FALSE, + bessel_correction = TRUE, num_threads = 1, verbose = TRUE) { if (is.null(num_gwas)) { warning("num_gwas is not provided. Estimating pi_gwas from the data. Note that this estimate may be biased if the input gwas_pip does not contain genome-wide variants.") @@ -111,14 +113,17 @@ compute_qtl_enrichment <- function(gwas_pip, susie_qtl_regions, x }) + # cpp11 requires exact integer types for int parameters en <- qtl_enrichment_rcpp( r_gwas_pip = gwas_pip, r_qtl_susie_fit = susie_qtl_regions, pi_gwas = pi_gwas, pi_qtl = pi_qtl, - ImpN = ImpN, + ImpN = as.integer(ImpN), shrinkage_lambda = lambda, - num_threads = num_threads + double_shrinkage = double_shrinkage, + bessel_correction = bessel_correction, + num_threads = as.integer(num_threads) ) # Add the unmatched variants to the output diff --git a/R/cpp11.R b/R/cpp11.R new file mode 100644 index 000000000..8889b7a48 --- /dev/null +++ b/R/cpp11.R @@ -0,0 +1,21 @@ +# Generated by cpp11: do not edit by hand + +dentist_iterative_impute <- function(LD_mat_r, nSample, zScore_r, pValueThreshold, propSVD, gcControl, nIter, gPvalueThreshold, ncpus, correct_chen_et_al_bug, verbose) { + .Call(`_pecotmr_dentist_iterative_impute`, LD_mat_r, nSample, zScore_r, pValueThreshold, propSVD, gcControl, nIter, gPvalueThreshold, ncpus, correct_chen_et_al_bug, verbose) +} + +lassosum_rss_rcpp <- function(z_r, LD, lambda_r, thr, maxiter) { + .Call(`_pecotmr_lassosum_rss_rcpp`, z_r, LD, lambda_r, thr, maxiter) +} + +prs_cs_rcpp <- function(a, b, phi, bhat, maf, n, ld_blk, n_iter, n_burnin, thin, verbose, seed) { + .Call(`_pecotmr_prs_cs_rcpp`, a, b, phi, bhat, maf, n, ld_blk, n_iter, n_burnin, thin, verbose, seed) +} + +qtl_enrichment_rcpp <- function(r_gwas_pip, r_qtl_susie_fit, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, double_shrinkage, bessel_correction, num_threads) { + .Call(`_pecotmr_qtl_enrichment_rcpp`, r_gwas_pip, r_qtl_susie_fit, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, double_shrinkage, bessel_correction, num_threads) +} + +sdpr_rcpp <- function(bhat_r, LD, n, per_variant_sample_size, array, a, c, M, a0k, b0k, iter, burn, thin, n_threads, opt_llk, verbose, seed) { + .Call(`_pecotmr_sdpr_rcpp`, bhat_r, LD, n, per_variant_sample_size, array, a, c, M, a0k, b0k, iter, burn, thin, n_threads, opt_llk, verbose, seed) +} diff --git a/R/dentist_qc.R b/R/dentist_qc.R index a47f25437..ebf24d586 100644 --- a/R/dentist_qc.R +++ b/R/dentist_qc.R @@ -254,10 +254,11 @@ dentist_single_window <- function(zScore, R = NULL, X = NULL, nSample = NULL, } verbose_iter <- getOption("pecotmr.dentist.verbose", FALSE) res <- withCallingHandlers( + # cpp11 requires exact integer types for int parameters dentist_iterative_impute( - LD_mat, nSample, zScore, - pValueThreshold, propSVD, gcControl, nIter, - gPvalueThreshold, ncpus, correct_chen_et_al_bug, + LD_mat, as.integer(nSample), zScore, + pValueThreshold, propSVD, gcControl, as.integer(nIter), + gPvalueThreshold, as.integer(ncpus), correct_chen_et_al_bug, verbose_iter ), warning = warning_handler diff --git a/R/encoloc.R b/R/encoloc.R index 0a6a75f53..3a2461072 100644 --- a/R/encoloc.R +++ b/R/encoloc.R @@ -26,6 +26,8 @@ xqtl_enrichment_wrapper <- function(xqtl_files, gwas_files, xqtl_varname_obj = NULL, gwas_varname_obj = NULL, num_gwas = NULL, pi_qtl = NULL, lambda = 1.0, ImpN = 25, + double_shrinkage = FALSE, + bessel_correction = TRUE, num_threads = 1) { process_finemapped_data <- function(xqtl_files, gwas_files, xqtl_finemapping_obj = NULL, gwas_finemapping_obj = NULL, @@ -79,6 +81,8 @@ xqtl_enrichment_wrapper <- function(xqtl_files, gwas_files, gwas_pip = dat$gwas_pip, susie_qtl_regions = dat$xqtl_data, num_gwas = num_gwas, pi_qtl = pi_qtl, lambda = lambda, ImpN = ImpN, + double_shrinkage = double_shrinkage, + bessel_correction = bessel_correction, num_threads = num_threads )) } diff --git a/R/file_utils.R b/R/file_utils.R index e58df3ecf..59ce7162b 100644 --- a/R/file_utils.R +++ b/R/file_utils.R @@ -61,6 +61,74 @@ read_afreq <- function(prefix) { return(af) } +#' Read stochastic genotype sidecar metadata (U_MIN/U_MAX). +#' +#' Reads per-variant min/max values used to invert min-max [0,2] scaling +#' of stochastic genotype data. Supports two formats: +#' \itemize{ +#' \item \strong{afreq}: PLINK2 .afreq/.afreq.zst with U_MIN/U_MAX columns +#' (read via \code{read_afreq}, which also returns allele frequencies). +#' \item \strong{generic}: Tab-delimited file with columns id, u_min, u_max. +#' } +#' +#' @param path Path to the sidecar metadata file. +#' @param format One of \code{NULL} (auto-detect from extension), \code{"afreq"}, +#' or \code{"generic"}. When \code{NULL}, files ending in \code{.afreq} or +#' \code{.afreq.zst} are parsed as afreq; all others as generic. +#' @return A data.frame with columns \code{id}, \code{u_min}, \code{u_max}, +#' or \code{NULL} if the file lacks U_MIN/U_MAX columns (afreq format) or +#' doesn't exist. +#' @importFrom vroom vroom +#' @noRd +read_stochastic_meta <- function(path, format = NULL) { + if (!file.exists(path)) return(NULL) + + if (is.null(format)) { + format <- if (grepl("\\.afreq(\\.zst)?$", path)) "afreq" else "generic" + } + format <- match.arg(format, c("afreq", "generic")) + + if (format == "afreq") { + # read_afreq expects a prefix, not a full path — strip the .afreq[.zst] suffix + prefix <- sub("\\.afreq(\\.zst)?$", "", path) + af <- read_afreq(prefix) + if (is.null(af) || !all(c("u_min", "u_max") %in% colnames(af))) return(NULL) + return(af[, c("id", "u_min", "u_max"), drop = FALSE]) + } + + # Generic: expect tab-delimited with columns id, u_min, u_max + meta <- as.data.frame(vroom(path, delim = "\t", show_col_types = FALSE)) + required <- c("id", "u_min", "u_max") + if (!all(required %in% colnames(meta))) { + stop("Stochastic metadata file '", path, "' must contain columns: ", + paste(required, collapse = ", ")) + } + meta[, required, drop = FALSE] +} + +#' Search for a stochastic genotype sidecar file alongside a genotype path. +#' +#' Looks for \code{.afreq}, \code{.afreq.zst}, and +#' \code{.stochastic_meta.tsv} files next to the given genotype path. +#' For extension-based paths (VCF, GDS), the extension is stripped first. +#' For prefix-based paths (PLINK1/2), the prefix is used directly. +#' +#' @param genotype_path Path to the genotype data (prefix or file path). +#' @return Path to the first sidecar file found, or \code{NULL}. +#' @noRd +find_stochastic_meta <- function(genotype_path) { + # Strip known genotype extensions to get the stem + stem <- sub("\\.(vcf|vcf\\.gz|bcf|gds|bed|bim|fam|pgen|pvar|psam)$", "", + genotype_path) + candidates <- c( + paste0(stem, ".afreq"), + paste0(stem, ".afreq.zst"), + paste0(stem, ".stochastic_meta.tsv") + ) + found <- candidates[file.exists(candidates)] + if (length(found) > 0) found[1] else NULL +} + #' Load PLINK2 genotype data via pgenlibr #' #' Loads genotype data from PLINK2 format files using pgenlibr directly @@ -97,7 +165,7 @@ load_plink2_data <- function(prefix, region = NULL, keep_indel = TRUE, keep_vari paths <- resolve_plink2_paths(prefix) # --- Read variant info from .pvar as text (pgenlibr::NewPvar is unreliable) --- - all_variant_info <- read_pvar_text(paths$pvar) + all_variant_info <- read_pvar(paths$pvar) variant_idx <- seq_len(nrow(all_variant_info)) if (!is.null(region)) { @@ -123,27 +191,13 @@ load_plink2_data <- function(prefix, region = NULL, keep_indel = TRUE, keep_vari rownames(X) <- psam$IID colnames(X) <- variant_info$id - # --- Attach allele frequency and rescale stochastic genotypes --- + # --- Attach allele frequency from .afreq sidecar --- afreq <- read_afreq(prefix) if (!is.null(afreq)) { - afreq_cols <- intersect(c("id", "alt_freq", "obs_ct", "u_min", "u_max"), colnames(afreq)) + afreq_cols <- intersect(c("id", "alt_freq", "obs_ct"), colnames(afreq)) variant_info <- merge(variant_info, afreq[, afreq_cols, drop = FALSE], by = "id", all.x = TRUE, sort = FALSE) } - # Detect stochastic genotype (non-integer dosage, e.g., from rss_ld_sketch). - # If U_MIN/U_MAX are in .afreq, invert the [0,2] min-max scaling exactly. - is_stochastic <- !all(X == round(X), na.rm = TRUE) - if (is_stochastic) { - if ("u_min" %in% colnames(variant_info) && "u_max" %in% colnames(variant_info)) { - idx <- match(colnames(X), variant_info$id) - X <- invert_minmax_scaling(X, variant_info$u_min[idx], variant_info$u_max[idx]) - message("Stochastic genotype detected: restored original scale via U_MIN/U_MAX from .afreq") - } else { - warning("Non-integer genotype values detected (possible stochastic genotype from rss_ld_sketch). ", - "Provide a .afreq file with U_MIN/U_MAX columns to restore original scale. ", - "Without inversion, correlation structure is preserved but U'U/B may not approximate R.") - } - } # --- Post-filters: indels and variant whitelist --- if (!keep_indel) { @@ -162,10 +216,11 @@ load_plink2_data <- function(prefix, region = NULL, keep_indel = TRUE, keep_vari #' Invert min-max [0,2] scaling to recover the original U matrix. #' -#' Stochastic genotype data (from rss_ld_sketch) is stored in PLINK2 pgen -#' format after min-max scaling: U_scaled = 2 * (U - u_min) / (u_max - u_min). +#' Stochastic genotype data is stored after min-max scaling: +#' U_scaled = 2 * (U - u_min) / (u_max - u_min). #' This function exactly inverts that transform using the stored per-variant -#' u_min and u_max values from the companion .afreq file. +#' u_min and u_max values from a companion sidecar file (.afreq or +#' .stochastic_meta.tsv). #' #' The recovered U satisfies U'U/B ~ Wishart(B, R)/B, the correct distributional #' property for LD-based fine-mapping with dynamic variance tracking. @@ -212,47 +267,40 @@ resolve_plink2_paths <- function(prefix) { list(pgen = pgen, pvar = pvar, psam = psam) } -#' Read .pvar or .pvar.zst as text into a data.frame. +#' Read .pvar or .pvar.zst into a data.frame via pgenlibr. #' -#' Note: pgenlibr::NewPvar is unreliable (empty error messages in v0.5.4-0.6.0 -#' due to an errbuf offset bug in the C++ wrapper). This text-based reader is -#' used instead. It handles both plain text and zstd-compressed pvar files. -#' Performance is comparable (~0.03s for 200K variants via vroom). -#' -#' For .pvar.zst without the archive R package, falls back to zstd CLI. +#' Uses pgenlibr::NewPvar() to parse the file (handles both plain .pvar and +#' zstd-compressed .pvar.zst natively, no external CLI required). #' #' @param pvar_path Path to .pvar or .pvar.zst file. #' @return data.frame with columns: chrom, id, pos, A2 (REF), A1 (ALT). -#' @importFrom vroom vroom #' @noRd -read_pvar_text <- function(pvar_path) { - # For .zst files, decompress to temp if archive package unavailable - if (grepl("\\.zst$", pvar_path) && !requireNamespace("archive", quietly = TRUE)) { - tmp <- tempfile(fileext = ".pvar") - on.exit(unlink(tmp), add = TRUE) - ret <- system2("zstd", c("-dq", shQuote(pvar_path), "-o", shQuote(tmp))) - if (ret != 0) stop("Failed to decompress ", pvar_path, ". Install the 'archive' R package or 'zstd' CLI.") - pvar_path <- tmp - } - df <- as.data.frame(vroom(pvar_path, comment = "##", show_col_types = FALSE)) - colnames(df)[1] <- "chrom" +read_pvar <- function(pvar_path) { + if (!requireNamespace("pgenlibr", quietly = TRUE)) { + stop("pgenlibr is required. Install from https://cran.r-project.org/web/packages/pgenlibr/index.html") + } + pvar <- pgenlibr::NewPvar(pvar_path) + on.exit(pgenlibr::ClosePvar(pvar), add = TRUE) + n <- pgenlibr::GetVariantCt(pvar) + idx <- seq_len(n) data.frame( - chrom = as.character(df$chrom), - id = as.character(df$ID), - pos = as.integer(df$POS), - A2 = as.character(df$REF), - A1 = as.character(df$ALT), + chrom = vapply(idx, function(i) pgenlibr::GetVariantChrom(pvar, i), character(1)), + id = vapply(idx, function(i) pgenlibr::GetVariantId(pvar, i), character(1)), + pos = vapply(idx, function(i) pgenlibr::GetVariantPos(pvar, i), integer(1)), + A2 = vapply(idx, function(i) pgenlibr::GetAlleleCode(pvar, i, 1L), character(1)), + A1 = vapply(idx, function(i) pgenlibr::GetAlleleCode(pvar, i, 2L), character(1)), stringsAsFactors = FALSE ) } -#' Get variant information from any LD reference source without loading genotypes. +#' Get variant information from any LD reference source. #' -#' Auto-detects the source type (PLINK2, PLINK1, or pre-computed LD metadata) -#' and returns variant metadata. For PLINK2, opens only the .pvar file. -#' For PLINK1, reads only the .bim file. No genotype data is loaded. +#' Auto-detects the source type (PLINK2, PLINK1, VCF, GDS, or pre-computed +#' LD metadata) and returns variant metadata. For PLINK2, opens only the +#' .pvar file. For PLINK1, reads only the .bim file. For VCF and GDS, +#' loads the full file and extracts variant info. #' -#' @param source PLINK prefix or LD metadata file path. +#' @param source Genotype file path/prefix or LD metadata file path. #' @param region Region of interest: "chr:start-end" string or data.frame with #' chrom/start/end. If NULL, returns all variants. #' @return A data.frame with columns: chrom, id, pos, A2, A1. @@ -263,16 +311,16 @@ read_pvar_text <- function(pvar_path) { get_ref_variant_info <- function(source, region = NULL) { resolved <- resolve_ld_source(source) - # For PLINK via metadata, resolve per-chromosome prefix - if (resolved$type %in% c("plink2", "plink1") && !is.null(resolved$meta_path) && !is.null(region)) { - data_path <- resolve_plink_prefix_for_region(resolved$meta_path, region, resolved$type) + # For genotype sources via metadata, resolve per-chromosome path + if (resolved$type %in% c("plink2", "plink1", "vcf", "gds") && !is.null(resolved$meta_path) && !is.null(region)) { + data_path <- resolve_genotype_path_for_region(resolved$meta_path, region) } else { data_path <- resolved$data_path } if (resolved$type == "plink2") { paths <- resolve_plink2_paths(data_path) - info <- read_pvar_text(paths$pvar) + info <- read_pvar(paths$pvar) afreq <- read_afreq(data_path) if (!is.null(afreq)) { info$allele_freq <- afreq$alt_freq[match(info$id, afreq$id)] @@ -284,6 +332,14 @@ get_ref_variant_info <- function(source, region = NULL) { A2 = bim$a0, A1 = bim$a1, stringsAsFactors = FALSE ) + } else if (resolved$type %in% c("vcf", "gds")) { + # VCF/GDS: load via the genotype loader and extract variant_info + result <- load_genotype_region(data_path, region = region, + return_variant_info = TRUE) + info <- result$variant_info + # Compute allele frequency from the genotype matrix + info$allele_freq <- colMeans(result$X, na.rm = TRUE) / 2 + return(info) # Already region-filtered by the loader } else { # Pre-computed LD: read bim files via metadata bim_paths <- get_regional_ld_meta(resolved$meta_path, region)$intersections$bim_file_paths @@ -343,16 +399,53 @@ match_variants_to_keep <- function(variant_info, keep_variants_path) { #' @importFrom magrittr %>% #' @importFrom stringr str_detect +# Internal helper: read a region from a tabix-indexed file via Rsamtools +read_tabix_region <- function(file, region, use_col_names) { + tbx <- Rsamtools::TabixFile(file) + parsed <- parse_region(region) + # Match chromosome naming convention in the tabix index + chrom <- as.character(parsed$chrom) + tbx_seqnames <- Rsamtools::seqnamesTabix(tbx) + if (any(grepl("^chr", tbx_seqnames))) { + chrom <- paste0("chr", chrom) + } + gr <- GenomicRanges::GRanges( + seqnames = chrom, + ranges = IRanges::IRanges(start = parsed$start, end = parsed$end) + ) + lines <- Rsamtools::scanTabix(tbx, param = gr)[[1]] + if (length(lines) == 0) return(NULL) + + # Get header for column names + col_names_vec <- NULL + if (use_col_names) { + hdr <- Rsamtools::headerTabix(tbx)$header + if (length(hdr) > 0) { + last_hdr <- hdr[length(hdr)] + col_names_vec <- strsplit(sub("^#", "", last_hdr), "\t")[[1]] + } + } + + # Parse tab-delimited lines + txt <- paste(lines, collapse = "\n") + if (!is.null(col_names_vec)) { + as.data.frame(vroom::vroom(I(txt), delim = "\t", col_names = col_names_vec, + show_col_types = FALSE)) + } else { + as.data.frame(vroom::vroom(I(txt), delim = "\t", col_names = use_col_names, + show_col_types = FALSE)) + } +} + tabix_region <- function(file, region, tabix_header = "auto", target = "", target_column_index = "") { if (!file.exists(file)) { stop("Input file does not exist: ", file) } + + use_col_names <- if (identical(tabix_header, FALSE)) FALSE else TRUE + cmd_output <- tryCatch( - { - use_col_names <- if (identical(tabix_header, FALSE)) FALSE else TRUE - as.data.frame(vroom(pipe(paste0("tabix -h ", file, " ", region)), - delim = "\t", col_names = use_col_names, show_col_types = FALSE)) - }, + read_tabix_region(file, region, use_col_names), error = function(e) NULL ) @@ -465,30 +558,249 @@ load_plink1_data <- function(prefix, region = NULL, keep_indel = TRUE, keep_vari return(list(X = X, variant_info = variant_info)) } +#' Load genotype data from a VCF file via VariantAnnotation +#' +#' Reads biallelic SNP genotypes from a VCF (or VCF.gz/BCF) file using +#' VariantAnnotation::readVcf(). Extracts GT field and converts to 0/1/2 +#' ALT dosage. Returns the same structure as load_plink2_data(). +#' +#' @param path Path to VCF file (.vcf, .vcf.gz, or .bcf). +#' @param region Target region in format "chr:start-end". If NULL, loads all. +#' @param keep_indel Whether to keep indel variants. Default TRUE. +#' @param keep_variants_path Path to a file listing variants to keep. +#' @return A list with X (dosage matrix) and variant_info (data.frame). +#' @noRd +load_vcf_data <- function(path, region = NULL, keep_indel = TRUE, + keep_variants_path = NULL) { + if (!requireNamespace("VariantAnnotation", quietly = TRUE)) { + stop("VariantAnnotation is required for VCF loading. ", + "Install from Bioconductor: BiocManager::install('VariantAnnotation')") + } + + # Build scan parameters + param <- if (!is.null(region)) { + parsed <- parse_region(region) + chrom_name <- as.character(parsed$chrom) + # Match chromosome naming convention in the VCF header + vcf_seqnames <- Rsamtools::seqnamesTabix(Rsamtools::TabixFile(path)) + if (any(grepl("^chr", vcf_seqnames))) { + chrom_name <- paste0("chr", chrom_name) + } + gr <- GenomicRanges::GRanges( + seqnames = chrom_name, + ranges = IRanges::IRanges(start = parsed$start, end = parsed$end) + ) + VariantAnnotation::ScanVcfParam(which = gr, geno = "GT") + } else { + VariantAnnotation::ScanVcfParam(geno = "GT") + } + + # Read VCF + vcf <- VariantAnnotation::readVcf(path, param = param) + if (length(vcf) == 0) { + stop(NoSNPsError(paste("No variants found in VCF", path, + if (!is.null(region)) paste("for region", region)))) + } + + # Extract GT matrix and convert to ALT dosage (0/1/2) + gt <- VariantAnnotation::geno(vcf)$GT + # GT is a character matrix: "0/0", "0/1", "1/1", "0|0", "0|1", "1|0", "1|1" + dosage <- matrix(NA_real_, nrow = ncol(gt), ncol = nrow(gt)) + rownames(dosage) <- colnames(gt) + for (j in seq_len(nrow(gt))) { + g <- gt[j, ] + alleles <- strsplit(g, "[/|]") + dosage[, j] <- vapply(alleles, function(a) { + a <- as.integer(a) + if (any(is.na(a))) NA_real_ else sum(a) + }, numeric(1)) + } + + # Build variant_info from rowRanges + rr <- SummarizedExperiment::rowRanges(vcf) + variant_info <- data.frame( + chrom = as.character(GenomicRanges::seqnames(rr)), + id = names(rr), + pos = as.integer(GenomicRanges::start(rr)), + A2 = as.character(VariantAnnotation::ref(vcf)), + A1 = vapply(VariantAnnotation::alt(vcf), + function(x) as.character(x)[1], character(1)), + stringsAsFactors = FALSE + ) + colnames(dosage) <- variant_info$id + + # Post-filters + if (!keep_indel) { + snp_mask <- is_snp_alleles(variant_info$A1, variant_info$A2) + dosage <- dosage[, snp_mask, drop = FALSE] + variant_info <- variant_info[snp_mask, , drop = FALSE] + } + if (!is.null(keep_variants_path)) { + keep_idx <- match_variants_to_keep(variant_info, keep_variants_path) + dosage <- dosage[, keep_idx, drop = FALSE] + variant_info <- variant_info[keep_idx, , drop = FALSE] + } + + list(X = dosage, variant_info = variant_info) +} + +#' Load genotype data from a GDS file via SNPRelate +#' +#' Reads genotype data from a CoreArray GDS file using SNPRelate. +#' Returns the same structure as load_plink2_data(). +#' +#' @param path Path to GDS file (.gds). +#' @param region Target region in format "chr:start-end". If NULL, loads all. +#' @param keep_indel Whether to keep indel variants. Default TRUE. +#' @param keep_variants_path Path to a file listing variants to keep. +#' @return A list with X (dosage matrix) and variant_info (data.frame). +#' @noRd +load_gds_data <- function(path, region = NULL, keep_indel = TRUE, + keep_variants_path = NULL) { + if (!requireNamespace("SNPRelate", quietly = TRUE)) { + stop("SNPRelate is required for GDS loading. ", + "Install from Bioconductor: BiocManager::install('SNPRelate')") + } + + gds <- SNPRelate::snpgdsOpen(path, readonly = TRUE, allow.duplicate = TRUE) + on.exit(SNPRelate::snpgdsClose(gds), add = TRUE) + + # Read variant metadata + snp_chrom <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(gds, "snp.chromosome")) + snp_pos <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(gds, "snp.position")) + snp_id <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(gds, "snp.id")) + snp_allele <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(gds, "snp.allele")) + + # Parse alleles: "REF/ALT" format + allele_split <- strsplit(snp_allele, "/") + a2 <- vapply(allele_split, `[`, character(1), 1L) # REF + a1 <- vapply(allele_split, `[`, character(1), 2L) # ALT + + # Region filter + snp_subset <- NULL + if (!is.null(region)) { + parsed <- parse_region(region) + in_region <- strip_chr_prefix(as.character(snp_chrom)) == parsed$chrom & + snp_pos >= parsed$start & snp_pos <= parsed$end + if (!any(in_region)) { + stop(NoSNPsError(paste("No variants found in region", region))) + } + snp_subset <- snp_id[in_region] + } + + # Read genotype matrix (samples × variants, ALT dosage 0/1/2) + geno <- SNPRelate::snpgdsGetGeno(gds, snp.id = snp_subset, + with.id = TRUE, verbose = FALSE) + X <- geno$genotype + rownames(X) <- geno$sample.id + + # Build variant_info for the subset + if (!is.null(snp_subset)) { + idx <- match(geno$snp.id, snp_id) + } else { + idx <- seq_along(snp_id) + } + variant_info <- data.frame( + chrom = as.character(snp_chrom[idx]), + id = as.character(snp_id[idx]), + pos = as.integer(snp_pos[idx]), + A2 = a2[idx], + A1 = a1[idx], + stringsAsFactors = FALSE + ) + colnames(X) <- variant_info$id + + # Post-filters + if (!keep_indel) { + snp_mask <- is_snp_alleles(variant_info$A1, variant_info$A2) + X <- X[, snp_mask, drop = FALSE] + variant_info <- variant_info[snp_mask, , drop = FALSE] + } + if (!is.null(keep_variants_path)) { + keep_idx <- match_variants_to_keep(variant_info, keep_variants_path) + X <- X[, keep_idx, drop = FALSE] + variant_info <- variant_info[keep_idx, , drop = FALSE] + } + + list(X = X, variant_info = variant_info) +} + #' Load genotype data for a specific region #' -#' Auto-detects PLINK2 (.pgen/.pvar[.zst]/.psam) or PLINK1 (.bed/.bim/.fam) format -#' and loads genotype data accordingly. Returns a numeric dosage matrix. +#' Auto-detects PLINK2 (.pgen/.pvar[.zst]/.psam), PLINK1 (.bed/.bim/.fam), +#' VCF (.vcf/.vcf.gz/.bcf), or GDS (.gds) format and loads genotype data +#' accordingly. If a stochastic genotype sidecar file (.afreq or +#' .stochastic_meta.tsv) is found alongside the genotype file, non-integer +#' dosages are automatically rescaled using the stored U_MIN/U_MAX values. #' #' @param genotype Path to the genotype data file (without extension). #' @param region The target region in the format "chr:start-end". #' @param keep_indel Whether to keep indel SNPs. #' @param keep_variants_path Path to a file listing variants to keep. -#' @return A numeric dosage matrix (rows=samples, cols=variants). +#' @param return_variant_info If TRUE, return a list with X (dosage matrix) and +#' variant_info (data.frame). If FALSE (default), return only the dosage matrix. +#' @param stochastic_meta_path Optional explicit path to a stochastic genotype +#' sidecar file. If NULL (default), auto-detected via \code{find_stochastic_meta}. +#' @param stochastic_meta_format Optional format override for the sidecar file: +#' \code{"afreq"} or \code{"generic"}. If NULL (default), auto-detected from +#' file extension. +#' @return If return_variant_info is FALSE, a numeric dosage matrix (rows=samples, +#' cols=variants). If TRUE, a list with elements X and variant_info. #' #' @export -load_genotype_region <- function(genotype, region = NULL, keep_indel = TRUE, keep_variants_path = NULL) { - # Direct PLINK prefix detection (no metadata TSV required) - if (has_plink2_files(genotype)) { - return(load_plink2_data(genotype, region = region, keep_indel = keep_indel, - keep_variants_path = keep_variants_path)$X) - } - if (has_plink1_files(genotype)) { - return(load_plink1_data(genotype, region = region, keep_indel = keep_indel, - keep_variants_path = keep_variants_path)$X) - } - stop("Genotype files not found at prefix: ", genotype, - "\n Expected: .pgen/.pvar[.zst]/.psam or .bed/.bim/.fam") +load_genotype_region <- function(genotype, region = NULL, keep_indel = TRUE, + keep_variants_path = NULL, + return_variant_info = FALSE, + stochastic_meta_path = NULL, + stochastic_meta_format = NULL) { + result <- NULL + # VCF and GDS: detect by file extension on the path itself + if (grepl("\\.(vcf|vcf\\.gz|bcf)$", genotype)) { + result <- load_vcf_data(genotype, region = region, keep_indel = keep_indel, + keep_variants_path = keep_variants_path) + } else if (grepl("\\.gds$", genotype)) { + result <- load_gds_data(genotype, region = region, keep_indel = keep_indel, + keep_variants_path = keep_variants_path) + } else if (has_plink2_files(genotype)) { + # PLINK prefix detection (no extension on the path) + result <- load_plink2_data(genotype, region = region, keep_indel = keep_indel, + keep_variants_path = keep_variants_path) + } else if (has_plink1_files(genotype)) { + result <- load_plink1_data(genotype, region = region, keep_indel = keep_indel, + keep_variants_path = keep_variants_path) + } else { + stop("Genotype files not found at: ", genotype, + "\n Expected: .vcf/.vcf.gz/.bcf, .gds, or PLINK prefix (.pgen/.pvar[.zst]/.psam or .bed/.bim/.fam)") + } + + # --- Detect and invert stochastic genotype scaling --- + meta_path <- stochastic_meta_path %||% find_stochastic_meta(genotype) + if (!is.null(meta_path)) { + smeta <- read_stochastic_meta(meta_path, format = stochastic_meta_format) + if (!is.null(smeta)) { + idx <- match(colnames(result$X), smeta$id) + matched <- !is.na(idx) + if (any(matched)) { + result$X[, matched] <- invert_minmax_scaling( + result$X[, matched, drop = FALSE], + smeta$u_min[idx[matched]], + smeta$u_max[idx[matched]] + ) + result$variant_info$u_min <- smeta$u_min[idx] + result$variant_info$u_max <- smeta$u_max[idx] + message("Stochastic genotype detected: restored original scale via ", basename(meta_path)) + } + } + } else { + is_stochastic <- !all(result$X == round(result$X), na.rm = TRUE) + if (is_stochastic) { + warning("Non-integer genotype values detected but no stochastic metadata sidecar found. ", + "Place a .afreq or .stochastic_meta.tsv file with u_min/u_max columns ", + "alongside the genotype files to restore the original scale.") + } + } + + if (return_variant_info) result else result$X } #' @importFrom purrr map @@ -1119,15 +1431,73 @@ load_twas_weights <- function(weight_db_files, conditions = NULL, ) } +#' Standardize GWAS summary statistics column names +#' +#' Uses MungeSumstats' comprehensive column name mapping to standardize +#' column names from various GWAS formats, then renames to pecotmr conventions. +#' Optionally applies an additional custom column mapping file. +#' +#' @param sumstats A data frame of summary statistics. +#' @param column_file_path Optional file path to a custom column mapping file +#' (format: standard_name:original_name, one per line). Applied after +#' MungeSumstats standardization. +#' @param comment_string Comment character in column_file_path. Default is "#". +#' @return A data frame with standardized column names. +#' @export +standardise_sumstats_columns <- function(sumstats, column_file_path = NULL, comment_string = "#") { + # MungeSumstats standard names -> pecotmr conventions + ms_to_pecotmr <- c( + CHR = "chrom", BP = "pos", SNP = "variant_id", + BETA = "beta", SE = "se", Z = "z", P = "p", + N = "n_sample", N_CAS = "n_case", N_CON = "n_control", + FRQ = "maf" + ) + # Make a copy to avoid in-place modification by MungeSumstats + sumstats_copy <- data.frame(sumstats, check.names = FALSE) + # Use MungeSumstats for comprehensive column standardization + sumstats_copy <- MungeSumstats::standardise_header( + sumstats_copy, return_list = FALSE, uppercase_unmapped = FALSE + ) + # Rename MungeSumstats standard names to pecotmr conventions + for (ms_name in names(ms_to_pecotmr)) { + idx <- which(colnames(sumstats_copy) == ms_name) + if (length(idx) > 0) { + colnames(sumstats_copy)[idx] <- ms_to_pecotmr[ms_name] + } + } + # Apply additional custom column mapping if provided + if (!is.null(column_file_path)) { + if (!file.exists(column_file_path)) { + stop("Column mapping file not found: ", column_file_path) + } + column_data <- read.table(column_file_path, + header = FALSE, sep = ":", + comment.char = if (is.null(comment_string)) "" else comment_string, + stringsAsFactors = FALSE + ) + colnames(column_data) <- c("standard", "original") + for (i in seq_len(nrow(column_data))) { + idx <- which(colnames(sumstats_copy) == column_data$original[i]) + if (length(idx) > 0) { + colnames(sumstats_copy)[idx] <- column_data$standard[i] + } + } + } + as.data.frame(sumstats_copy) +} + #' Load summary statistic data #' #' This function formats the input summary statistics dataframe with uniform column names -#' to fit into the SuSiE pipeline. The mapping is performed through the specified column file. +#' to fit into the SuSiE pipeline. Column standardization is performed via +#' MungeSumstats::standardise_header(), with an optional custom column mapping file +#' for additional non-standard names. #' Additionally, it extracts sample size, case number, control number, and variance of Y. #' Missing values in n_sample, n_case, and n_control are backfilled with median values. #' #' @param sumstat_path File path to the summary statistics. -#' @param column_file_path File path to the column file for mapping. +#' @param column_file_path Optional file path to a custom column mapping file for +#' non-standard column names not recognized by MungeSumstats. #' @param n_sample User-specified sample size. If unknown, set as 0 to retrieve from the sumstat file. #' @param n_case User-specified number of cases. #' @param n_control User-specified number of controls. @@ -1141,52 +1511,29 @@ load_twas_weights <- function(weight_db_files, conditions = NULL, #' @importFrom dplyr mutate group_by summarise #' @importFrom magrittr %>% #' @export -load_rss_data <- function(sumstat_path, column_file_path, n_sample = 0, n_case = 0, n_control = 0, region = NULL, +load_rss_data <- function(sumstat_path, column_file_path = NULL, n_sample = 0, n_case = 0, n_control = 0, region = NULL, extract_region_name = NULL, region_name_col = NULL, comment_string = "#") { # Validate input files exist if (!file.exists(sumstat_path)) { stop("Summary statistics file not found: ", sumstat_path) } - if (!file.exists(column_file_path)) { + if (!is.null(column_file_path) && !file.exists(column_file_path)) { stop("Column mapping file not found: ", column_file_path) } - # Read and preprocess column mapping - if (is.null(comment_string)) { - column_data <- read.table(column_file_path, - header = FALSE, sep = ":", - comment.char = "", # This tells R not to treat any character as comment - stringsAsFactors = FALSE - ) %>% - rename(standard = V1, original = V2) - } else { - column_data <- read.table(column_file_path, - header = FALSE, sep = ":", - comment.char = comment_string, - stringsAsFactors = FALSE - ) %>% - rename(standard = V1, original = V2) - } - # Initialize sumstats variable - sumstats <- NULL var_y <- NULL sumstats <- load_tsv_region(file_path = sumstat_path, region = region, extract_region_name = extract_region_name, region_name_col = region_name_col) - + # To keep a log message n_variants <- nrow(sumstats) - if (n_variants == 0){ - message(paste0("No variants in region ", region, ".")) - return(list(sumstats = sumstats, n = NULL, var_y = NULL)) + if (n_variants == 0) { + message(paste0("No variants in region ", region, ".")) + return(list(sumstats = sumstats, n = NULL, var_y = NULL)) } else { - message(paste0("Region ", region, " include ", n_variants, " in input sumstats.")) - } - - # Standardize column names based on mapping - for (name in colnames(sumstats)) { - if (name %in% column_data$original) { - index <- which(column_data$original == name) - colnames(sumstats)[colnames(sumstats) == name] <- column_data$standard[index] - } + message(paste0("Region ", region, " include ", n_variants, " in input sumstats.")) } + + # Standardize column names via MungeSumstats + optional custom mapping + sumstats <- standardise_sumstats_columns(sumstats, column_file_path, comment_string) if (!"z" %in% colnames(sumstats) && all(c("beta", "se") %in% colnames(sumstats))) { sumstats$z <- sumstats$beta / sumstats$se @@ -1443,55 +1790,58 @@ load_multitask_regional_data <- function(region, # a string of chr:start-end for #' @export load_tsv_region <- function(file_path, region = NULL, extract_region_name = NULL, region_name_col = NULL) { sumstats <- NULL - cmd <- NULL - - if (!is.null(region)) { - if (grepl("^chr", region)) { - region <- strip_chr_prefix(region) - } - } if (grepl("\\.gz$", file_path)) { - if (is.null(sumstats) || nrow(sumstats) == 0) { - # Determine the appropriate command based on provided parameters - if (!is.null(extract_region_name) && !is.null(region) && !is.null(region_name_col)) { - # Both region and filter specified - cmd <- paste0( - "zcat ", file_path, " | head -1 && tabix ", file_path, " ", region, - " | awk '$", region_name_col, " ~ /", extract_region_name, "/'" + if (!is.null(region)) { + # Use Rsamtools to query the tabix-indexed file by region + sumstats <- tryCatch({ + tbx <- Rsamtools::TabixFile(file_path) + parsed <- parse_region(region) + # Match chromosome naming convention in the tabix index + chrom <- as.character(parsed$chrom) + tbx_seqnames <- Rsamtools::seqnamesTabix(tbx) + if (any(grepl("^chr", tbx_seqnames))) { + chrom <- paste0("chr", chrom) + } + gr <- GenomicRanges::GRanges( + seqnames = chrom, + ranges = IRanges::IRanges(start = parsed$start, end = parsed$end) ) - } else if (!is.null(extract_region_name) && is.null(region) && !is.null(region_name_col)) { - # Only filter specified, no region - cmd <- paste0("zcat ", file_path, " | awk '$", region_name_col, " ~ /", extract_region_name, "/'") - } else if (!is.null(region) && (is.null(region_name_col) || is.null(extract_region_name))) { - # Only region specified, no filter - cmd <- paste0("zcat ", file_path, " | head -1 && tabix ", file_path, " ", region) - } else { - # Neither region nor filter specified - read gz directly - cmd <- NULL - } + lines <- Rsamtools::scanTabix(tbx, param = gr)[[1]] + if (length(lines) == 0) return(NULL) + + # Get header for column names + hdr <- Rsamtools::headerTabix(tbx)$header + col_names_vec <- NULL + if (length(hdr) > 0) { + last_hdr <- hdr[length(hdr)] + col_names_vec <- strsplit(sub("^#", "", last_hdr), "\t")[[1]] + } - sumstats <- tryCatch( - { - if (is.null(cmd)) { - as.data.frame(vroom(file_path, show_col_types = FALSE)) - } else { - as.data.frame(vroom(pipe(cmd), delim = "\t", show_col_types = FALSE)) - } - }, - error = function(e) { - stop("Data read error. Please make sure this gz file is tabix-indexed and the specified filter column exists.") + txt <- paste(lines, collapse = "\n") + if (!is.null(col_names_vec)) { + as.data.frame(vroom::vroom(I(txt), delim = "\t", col_names = col_names_vec, + show_col_types = FALSE)) + } else { + as.data.frame(vroom::vroom(I(txt), delim = "\t", col_names = TRUE, + show_col_types = FALSE)) } - ) + }, error = function(e) { + stop("Data read error. Please make sure this gz file is tabix-indexed and the specified filter column exists.") + }) + } else { + # No region specified - read the whole gz file + sumstats <- as.data.frame(vroom::vroom(file_path, show_col_types = FALSE)) } } else { warning("Not a tabix-indexed gz file, loading the entire dataset.") - sumstats <- as.data.frame(vroom(file_path, show_col_types = FALSE)) - # Apply filter if specified - if (!is.null(extract_region_name) && !is.null(region_name_col)) { - keep_index <- which(str_detect(sumstats[[region_name_col]], extract_region_name)) - sumstats <- sumstats[keep_index, ] - } + sumstats <- as.data.frame(vroom::vroom(file_path, show_col_types = FALSE)) + } + + # Apply name-based filter if specified + if (!is.null(sumstats) && !is.null(extract_region_name) && !is.null(region_name_col)) { + keep_index <- which(str_detect(sumstats[[region_name_col]], extract_region_name)) + sumstats <- sumstats[keep_index, ] } return(sumstats) diff --git a/R/ld_loader.R b/R/ld_loader.R index 21b56facd..94910efdc 100644 --- a/R/ld_loader.R +++ b/R/ld_loader.R @@ -27,10 +27,11 @@ #' \code{"chr22:17238266-19744294"}). Required when \code{ld_meta_path} #' is used. #' @param LD_info A data.frame with column \code{LD_file} (paths to -#' \code{.cor.xz} LD matrix files) and optionally \code{SNP_file} -#' (paths to companion \code{.bim} files; defaults to -#' \code{paste0(LD_file, ".bim")} if absent). As returned by -#' cTWAS meta-data utilities. +#' genotype files or \code{.cor.xz} LD matrix files) and optionally +#' \code{SNP_file} (paths to companion \code{.bim} files for pre-computed +#' blocks; defaults to \code{paste0(LD_file, ".bim")} if absent). +#' Genotype paths can be PLINK2 prefixes, PLINK1 prefixes, VCF files, +#' or GDS files. As returned by cTWAS meta-data utilities. #' @param return_genotype Logical. When using region mode, return the #' genotype matrix X (\code{TRUE}) or LD correlation R (\code{FALSE}, #' default). @@ -106,23 +107,16 @@ ld_loader <- function(R_list = NULL, X_list = NULL, } } else { # LD_info mode: load LD blocks by index from file paths - # Supports all three formats: - # 1. Pre-computed .cor.xz + .bim/.pvar (custom block format) - # 2. PLINK1 prefix (.bed/.bim/.fam) — LD computed on the fly - # 3. PLINK2 prefix (.pgen/.pvar/.psam) — LD computed on the fly + # Supports all genotype formats (PLINK2, PLINK1, VCF, GDS) and + # pre-computed .cor.xz + .bim/.pvar blocks if (!is.data.frame(LD_info) || !"LD_file" %in% colnames(LD_info)) stop("LD_info must be a data.frame with column 'LD_file'.") loader <- function(g) { ld_path <- LD_info$LD_file[g] - # Auto-detect format by checking what files exist - if (has_plink2_files(ld_path)) { - # PLINK2: load genotypes and compute LD - geno <- load_genotype_region(ld_path) - mat <- compute_LD(geno) - } else if (has_plink1_files(ld_path)) { - # PLINK1: load genotypes and compute LD + # Auto-detect format: genotype source or pre-computed block + if (is_genotype_source(ld_path)) { geno <- load_genotype_region(ld_path) mat <- compute_LD(geno) } else { diff --git a/R/mash_wrapper.R b/R/mash_wrapper.R index 55c5c5d2e..41a29f9a1 100644 --- a/R/mash_wrapper.R +++ b/R/mash_wrapper.R @@ -767,7 +767,7 @@ merge_sumstats_matrices <- function(matrix_list, value_column, ref_panel = NULL, ld_bim_file <- vroom(bim_file_path) # Perform allele quality control - flipped_data <- allele_qc(data, ld_bim_file$V2, + flipped_data <- match_ref_panel(data, ld_bim_file$V2, col_to_flip = c(value_column), match_min_prop = 0, remove_dups = FALSE, remove_indels = FALSE, remove_strand_ambiguous = FALSE, @@ -790,7 +790,7 @@ merge_sumstats_matrices <- function(matrix_list, value_column, ref_panel = NULL, # Step 3: Combine extracted chromosomal info with value column cohort_df <- cbind(cohort_variants_df, value = df2[, value_column, drop = FALSE]) - flipped_data <- allele_qc(cohort_df, ref_panel, col_to_flip = c(value_column), + flipped_data <- match_ref_panel(cohort_df, ref_panel, col_to_flip = c(value_column), match_min_prop = 0, remove_dups = FALSE, remove_indels = FALSE, remove_strand_ambiguous = FALSE, flip_strand = FALSE, remove_unmatched = TRUE, remove_same_vars = FALSE)$target_data_qced diff --git a/R/mr.R b/R/mr.R index 7d4c04824..5670b5f89 100644 --- a/R/mr.R +++ b/R/mr.R @@ -77,7 +77,7 @@ mr_format <- function(susie_result, condition, gwas_sumstats_db, coverage = "cs_ gwas_beta_se <- z_to_beta_se(gwas_sumstats_db_extracted$z, gwas_sumstats_db_extracted$effect_allele_frequency, gwas_sumstats_db_extracted$n_sample) gwas_sumstats_db_extracted <- gwas_sumstats_db_extracted %>% mutate(beta = gwas_beta_se$beta, se = gwas_beta_se$se) if (run_allele_qc) { - susie_cs_result_formatted <- allele_qc(cbind(variant_id_to_df(susie_cs_result_formatted$variant), susie_cs_result_formatted), + susie_cs_result_formatted <- match_ref_panel(cbind(variant_id_to_df(susie_cs_result_formatted$variant), susie_cs_result_formatted), gwas_sumstats_db_extracted$variant_id, c("bhat_x"), match_min_prop = 0 ) diff --git a/R/regularized_regression.R b/R/regularized_regression.R index 2eda33a92..2ff27b01a 100644 --- a/R/regularized_regression.R +++ b/R/regularized_regression.R @@ -102,10 +102,11 @@ prs_cs <- function(bhat, LD, n, } # Run PRS-CS + # cpp11 requires exact integer types for int parameters result <- prs_cs_rcpp( a = a, b = b, phi = phi, bhat, maf, - n = n, ld_blk = LD, - n_iter = n_iter, n_burnin = n_burnin, thin = thin, + n = as.integer(n), ld_blk = LD, + n_iter = as.integer(n_iter), n_burnin = as.integer(n_burnin), thin = as.integer(thin), verbose = verbose, seed = seed ) @@ -229,10 +230,13 @@ sdpr <- function(bhat, LD, n, per_variant_sample_size = NULL, array = NULL, a = stop("The 'array' vector must contain only 0, 1, or 2.") } + # cpp11 requires exact integer types for int parameters and sexp-wrapped vectors + if (!is.null(array)) array <- as.integer(array) # Call the sdpr_rcpp function result <- sdpr_rcpp( - bhat, LD, n, per_variant_sample_size, array, a, c, M, a0k, b0k, iter, burn, thin, - n_threads, opt_llk, verbose, seed + bhat, LD, as.integer(n), per_variant_sample_size, array, a, c, as.integer(M), + a0k, b0k, as.integer(iter), as.integer(burn), as.integer(thin), + as.integer(n_threads), as.integer(opt_llk), verbose, seed ) return(result) @@ -844,7 +848,8 @@ lassosum_rss <- function(bhat, LD, n, z <- bhat / sqrt(n) order <- order(lambda, decreasing = TRUE) - result <- lassosum_rss_rcpp(z, LD, lambda[order], thr, maxiter) + # cpp11 requires exact integer types for int parameters + result <- lassosum_rss_rcpp(z, LD, lambda[order], thr, as.integer(maxiter)) # Reorder back to original lambda order. # Must use inverse permutation to unsort: if order[i]=j, then diff --git a/R/sumstats_qc.R b/R/sumstats_qc.R index 263be459b..22e73066f 100644 --- a/R/sumstats_qc.R +++ b/R/sumstats_qc.R @@ -36,7 +36,7 @@ rss_basic_qc <- function(sumstats, LD_data, skip_region = NULL, keep_indel = TRU ref_variants <- LD_data$LD_variants - allele_flip <- allele_qc(sumstats, ref_variants, + allele_flip <- match_ref_panel(sumstats, ref_variants, col_to_flip = col_to_flip, match_min_prop = 0, remove_dups = TRUE, remove_indels = !keep_indel, remove_strand_ambiguous = TRUE diff --git a/R/susie_wrapper.R b/R/susie_wrapper.R index 86cc3c684..0bd5b4ca7 100644 --- a/R/susie_wrapper.R +++ b/R/susie_wrapper.R @@ -77,11 +77,11 @@ adjust_susie_weights <- function(twas_weights_results, keep_variants, run_allele if (!all(c("chrom", "pos", "A2", "A1") %in% colnames(weights_matrix))) { weights_matrix <- cbind(parse_variant_id(twas_weights_variants), weights_matrix) } - weights_matrix_qced <- allele_qc(weights_matrix, LD_variants, colnames(weights_matrix)[!colnames(weights_matrix) %in% c( + weights_matrix_qced <- match_ref_panel(weights_matrix, LD_variants, colnames(weights_matrix)[!colnames(weights_matrix) %in% c( "chrom", "pos", "A2", "A1" )], match_min_prop = match_min_prop) - # allele_qc now outputs canonical variant_ids (with chr prefix) + # match_ref_panel outputs canonical variant_ids (with chr prefix) original_idx <- match(weights_matrix_qced$qc_summary$variants_id_original, twas_weights_variants) intersected_indices <- original_idx[weights_matrix_qced$qc_summary$keep == TRUE] } else { diff --git a/R/twas.R b/R/twas.R index 595f0b4a8..77257b2d2 100644 --- a/R/twas.R +++ b/R/twas.R @@ -144,7 +144,7 @@ harmonize_twas <- function(twas_weights_data, ld_meta_file_path, gwas_meta_file, # Step 4: harmonize weights, flip allele weights_matrix <- cbind(variant_id_to_df(rownames(weights_matrix)), weights_matrix) - weights_matrix_qced <- allele_qc(weights_matrix, LD_list$LD_variants, + weights_matrix_qced <- match_ref_panel(weights_matrix, LD_list$LD_variants, colnames(weights_matrix)[!colnames(weights_matrix) %in% c("chrom", "pos", "A2", "A1")], match_min_prop = 0 ) @@ -175,11 +175,11 @@ harmonize_twas <- function(twas_weights_data, ld_meta_file_path, gwas_meta_file, susie_intermediate <- mol_data$susie_results[[context]][c("pip", "cs_variants", "cs_purity")] names(susie_intermediate[["pip"]]) <- rownames(weights_matrix) # original variants that is not qced yet pip <- susie_intermediate[["pip"]] - pip_qced <- allele_qc(cbind(parse_variant_id(names(pip)), pip), LD_list$LD_variants, "pip", match_min_prop = 0) + pip_qced <- match_ref_panel(cbind(parse_variant_id(names(pip)), pip), LD_list$LD_variants, "pip", match_min_prop = 0) susie_intermediate[["pip"]] <- abs(pip_qced$target_data_qced$pip) names(susie_intermediate[["pip"]]) <- pip_qced$target_data_qced$variant_id susie_intermediate[["cs_variants"]] <- lapply(susie_intermediate[["cs_variants"]], function(x) { - variant_qc <- allele_qc(x, LD_list$LD_variants, match_min_prop = 0) + variant_qc <- match_ref_panel(x, LD_list$LD_variants, match_min_prop = 0) variant_qc$target_data_qced$variant_id[variant_qc$target_data_qced$variant_id %in% postqc_weight_variants] }) mol_res[["susie_weights_intermediate_qced"]][[context]] <- susie_intermediate @@ -228,35 +228,36 @@ harmonize_twas <- function(twas_weights_data, ld_meta_file_path, gwas_meta_file, #' @export harmonize_gwas <- function(gwas_file, query_region, ld_variants, col_to_flip=NULL, match_min_prop=0, column_file_path=NULL, comment_string="#"){ if(is.null(gwas_file)| is.na(gwas_file)) stop("No GWAS file path provided. ") - if (!is.null(column_file_path)) { - rss_result <- load_rss_data( - sumstat_path = gwas_file, - column_file_path = column_file_path, + if (!is.null(column_file_path)) { + rss_result <- load_rss_data( + sumstat_path = gwas_file, + column_file_path = column_file_path, region = query_region, comment_string = comment_string - ) - gwas_data_sumstats <- rss_result$sumstats - } else { - gwas_data_sumstats <- as.data.frame(tabix_region(gwas_file, query_region)) + ) + gwas_data_sumstats <- rss_result$sumstats + } else { + gwas_data_sumstats <- as.data.frame(tabix_region(gwas_file, query_region)) + if (nrow(gwas_data_sumstats) > 0) { + gwas_data_sumstats <- standardise_sumstats_columns(gwas_data_sumstats) + } } if (nrow(gwas_data_sumstats) == 0) { if (length(names(gwas_file))==0) names(gwas_file) <- gwas_file warning(paste0("No GWAS summary statistics found for the region of ", query_region, " in ", names(gwas_file), ". ")) return(NULL) } - if (colnames(gwas_data_sumstats)[1] == "#chrom") colnames(gwas_data_sumstats)[1] <- "chrom" # colname update for tabix - # Check if sumstats has z-scores or (beta and se) if (!is.null(gwas_data_sumstats$z)) { # z-scores already present, nothing to do - } else if (!is.null(gwas_data_sumstats$beta) && !is.null(gwas_data_sumstats$se)) { - gwas_data_sumstats$z <- gwas_data_sumstats$beta / gwas_data_sumstats$se - } else { - stop("gwas_data_sumstats should have 'z' or ('beta' and 'se') columns") + } else if (!is.null(gwas_data_sumstats$beta) && !is.null(gwas_data_sumstats$se)) { + gwas_data_sumstats$z <- gwas_data_sumstats$beta / gwas_data_sumstats$se + } else { + stop("gwas_data_sumstats should have 'z' or ('beta' and 'se') columns") } # check for overlapping variants if (!any(gwas_data_sumstats$pos %in% gsub("\\:.*$", "", sub("^.*?\\:", "", ld_variants)))) return(NULL) - gwas_allele_flip <- allele_qc(gwas_data_sumstats, ld_variants, col_to_flip=col_to_flip, match_min_prop = match_min_prop) + gwas_allele_flip <- match_ref_panel(gwas_data_sumstats, ld_variants, col_to_flip=col_to_flip, match_min_prop = match_min_prop) gwas_data_sumstats <- gwas_allele_flip$target_data_qced # post-qc gwas data that is flipped and corrected - gwas study level gwas_data_sumstats <- gwas_data_sumstats[!is.na(gwas_data_sumstats$z) & !is.infinite(gwas_data_sumstats$z), ] return(gwas_data_sumstats) diff --git a/man/compute_qtl_enrichment.Rd b/man/compute_qtl_enrichment.Rd index ff0359352..22e4de566 100644 --- a/man/compute_qtl_enrichment.Rd +++ b/man/compute_qtl_enrichment.Rd @@ -11,6 +11,8 @@ compute_qtl_enrichment( pi_qtl = NULL, lambda = 1, ImpN = 25, + double_shrinkage = FALSE, + bessel_correction = TRUE, num_threads = 1, verbose = TRUE ) diff --git a/man/get_ref_variant_info.Rd b/man/get_ref_variant_info.Rd index 68f566805..a9433edc9 100644 --- a/man/get_ref_variant_info.Rd +++ b/man/get_ref_variant_info.Rd @@ -2,12 +2,12 @@ % Please edit documentation in R/file_utils.R \name{get_ref_variant_info} \alias{get_ref_variant_info} -\title{Get variant information from any LD reference source without loading genotypes.} +\title{Get variant information from any LD reference source.} \usage{ get_ref_variant_info(source, region = NULL) } \arguments{ -\item{source}{PLINK prefix or LD metadata file path.} +\item{source}{Genotype file path/prefix or LD metadata file path.} \item{region}{Region of interest: "chr:start-end" string or data.frame with chrom/start/end. If NULL, returns all variants.} @@ -17,7 +17,8 @@ A data.frame with columns: chrom, id, pos, A2, A1. May also include allele_freq, variance, n_nomiss depending on source. } \description{ -Auto-detects the source type (PLINK2, PLINK1, or pre-computed LD metadata) -and returns variant metadata. For PLINK2, opens only the .pvar file. -For PLINK1, reads only the .bim file. No genotype data is loaded. +Auto-detects the source type (PLINK2, PLINK1, VCF, GDS, or pre-computed +LD metadata) and returns variant metadata. For PLINK2, opens only the +.pvar file. For PLINK1, reads only the .bim file. For VCF and GDS, +loads the full file and extracts variant info. } diff --git a/man/invert_minmax_scaling.Rd b/man/invert_minmax_scaling.Rd index 616feed5c..2ef2957b9 100644 --- a/man/invert_minmax_scaling.Rd +++ b/man/invert_minmax_scaling.Rd @@ -17,10 +17,11 @@ invert_minmax_scaling(X, u_min, u_max) Matrix of original U values with same dimensions. } \description{ -Stochastic genotype data (from rss_ld_sketch) is stored in PLINK2 pgen -format after min-max scaling: U_scaled = 2 * (U - u_min) / (u_max - u_min). +Stochastic genotype data is stored after min-max scaling: +U_scaled = 2 * (U - u_min) / (u_max - u_min). This function exactly inverts that transform using the stored per-variant -u_min and u_max values from the companion .afreq file. +u_min and u_max values from a companion sidecar file (.afreq or +.stochastic_meta.tsv). } \details{ The recovered U satisfies U'U/B ~ Wishart(B, R)/B, the correct distributional diff --git a/man/ld_loader.Rd b/man/ld_loader.Rd index 61b02b560..2e4c90ad6 100644 --- a/man/ld_loader.Rd +++ b/man/ld_loader.Rd @@ -27,10 +27,11 @@ ld_loader( is used.} \item{LD_info}{A data.frame with column \code{LD_file} (paths to -\code{.cor.xz} LD matrix files) and optionally \code{SNP_file} -(paths to companion \code{.bim} files; defaults to -\code{paste0(LD_file, ".bim")} if absent). As returned by -cTWAS meta-data utilities.} +genotype files or \code{.cor.xz} LD matrix files) and optionally +\code{SNP_file} (paths to companion \code{.bim} files for pre-computed +blocks; defaults to \code{paste0(LD_file, ".bim")} if absent). +Genotype paths can be PLINK2 prefixes, PLINK1 prefixes, VCF files, +or GDS files. As returned by cTWAS meta-data utilities.} \item{return_genotype}{Logical. When using region mode, return the genotype matrix X (\code{TRUE}) or LD correlation R (\code{FALSE}, diff --git a/man/load_genotype_region.Rd b/man/load_genotype_region.Rd index 13033ddf9..4bbce054f 100644 --- a/man/load_genotype_region.Rd +++ b/man/load_genotype_region.Rd @@ -8,7 +8,10 @@ load_genotype_region( genotype, region = NULL, keep_indel = TRUE, - keep_variants_path = NULL + keep_variants_path = NULL, + return_variant_info = FALSE, + stochastic_meta_path = NULL, + stochastic_meta_format = NULL ) } \arguments{ @@ -19,11 +22,25 @@ load_genotype_region( \item{keep_indel}{Whether to keep indel SNPs.} \item{keep_variants_path}{Path to a file listing variants to keep.} + +\item{return_variant_info}{If TRUE, return a list with X (dosage matrix) and +variant_info (data.frame). If FALSE (default), return only the dosage matrix.} + +\item{stochastic_meta_path}{Optional explicit path to a stochastic genotype +sidecar file. If NULL (default), auto-detected via \code{find_stochastic_meta}.} + +\item{stochastic_meta_format}{Optional format override for the sidecar file: +\code{"afreq"} or \code{"generic"}. If NULL (default), auto-detected from +file extension.} } \value{ -A numeric dosage matrix (rows=samples, cols=variants). +If return_variant_info is FALSE, a numeric dosage matrix (rows=samples, + cols=variants). If TRUE, a list with elements X and variant_info. } \description{ -Auto-detects PLINK2 (.pgen/.pvar[.zst]/.psam) or PLINK1 (.bed/.bim/.fam) format -and loads genotype data accordingly. Returns a numeric dosage matrix. +Auto-detects PLINK2 (.pgen/.pvar[.zst]/.psam), PLINK1 (.bed/.bim/.fam), +VCF (.vcf/.vcf.gz/.bcf), or GDS (.gds) format and loads genotype data +accordingly. If a stochastic genotype sidecar file (.afreq or +.stochastic_meta.tsv) is found alongside the genotype file, non-integer +dosages are automatically rescaled using the stored U_MIN/U_MAX values. } diff --git a/man/load_rss_data.Rd b/man/load_rss_data.Rd index 2dd95a5f9..3d501950b 100644 --- a/man/load_rss_data.Rd +++ b/man/load_rss_data.Rd @@ -6,7 +6,7 @@ \usage{ load_rss_data( sumstat_path, - column_file_path, + column_file_path = NULL, n_sample = 0, n_case = 0, n_control = 0, @@ -19,7 +19,8 @@ load_rss_data( \arguments{ \item{sumstat_path}{File path to the summary statistics.} -\item{column_file_path}{File path to the column file for mapping.} +\item{column_file_path}{Optional file path to a custom column mapping file for +non-standard column names not recognized by MungeSumstats.} \item{n_sample}{User-specified sample size. If unknown, set as 0 to retrieve from the sumstat file.} @@ -41,7 +42,9 @@ sample size (n), and var_y. } \description{ This function formats the input summary statistics dataframe with uniform column names -to fit into the SuSiE pipeline. The mapping is performed through the specified column file. +to fit into the SuSiE pipeline. Column standardization is performed via +MungeSumstats::standardise_header(), with an optional custom column mapping file +for additional non-standard names. Additionally, it extracts sample size, case number, control number, and variance of Y. Missing values in n_sample, n_case, and n_control are backfilled with median values. } diff --git a/man/allele_qc.Rd b/man/match_ref_panel.Rd similarity index 80% rename from man/allele_qc.Rd rename to man/match_ref_panel.Rd index 99efa08b0..05dbe539c 100644 --- a/man/allele_qc.Rd +++ b/man/match_ref_panel.Rd @@ -1,9 +1,23 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/allele_qc.R -\name{allele_qc} +\name{match_ref_panel} +\alias{match_ref_panel} \alias{allele_qc} -\title{Match alleles between target data and reference variants} +\title{Match target data alleles against a reference panel} \usage{ +match_ref_panel( + target_data, + ref_variants, + col_to_flip = NULL, + match_min_prop = 0.2, + remove_dups = TRUE, + remove_indels = FALSE, + remove_strand_ambiguous = TRUE, + flip_strand = FALSE, + remove_unmatched = TRUE, + ... +) + allele_qc( target_data, ref_variants, @@ -47,4 +61,5 @@ A single data frame with matched variants. \description{ Match by ("chrom", "A1", "A2" and "pos"), accounting for possible strand flips and major/minor allele flips (opposite effects and zscores). +Flips specified columns when alleles are swapped relative to the reference. } diff --git a/man/standardise_sumstats_columns.Rd b/man/standardise_sumstats_columns.Rd new file mode 100644 index 000000000..860a192eb --- /dev/null +++ b/man/standardise_sumstats_columns.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/file_utils.R +\name{standardise_sumstats_columns} +\alias{standardise_sumstats_columns} +\title{Standardize GWAS summary statistics column names} +\usage{ +standardise_sumstats_columns( + sumstats, + column_file_path = NULL, + comment_string = "#" +) +} +\arguments{ +\item{sumstats}{A data frame of summary statistics.} + +\item{column_file_path}{Optional file path to a custom column mapping file +(format: standard_name:original_name, one per line). Applied after +MungeSumstats standardization.} + +\item{comment_string}{Comment character in column_file_path. Default is "#".} +} +\value{ +A data frame with standardized column names. +} +\description{ +Uses MungeSumstats' comprehensive column name mapping to standardize +column names from various GWAS formats, then renames to pecotmr conventions. +Optionally applies an additional custom column mapping file. +} diff --git a/man/xqtl_enrichment_wrapper.Rd b/man/xqtl_enrichment_wrapper.Rd index 4eaa1102f..d8afaaca2 100644 --- a/man/xqtl_enrichment_wrapper.Rd +++ b/man/xqtl_enrichment_wrapper.Rd @@ -15,6 +15,8 @@ xqtl_enrichment_wrapper( pi_qtl = NULL, lambda = 1, ImpN = 25, + double_shrinkage = FALSE, + bessel_correction = TRUE, num_threads = 1 ) } diff --git a/pixi.toml b/pixi.toml index 5e92dfd25..7f054c682 100644 --- a/pixi.toml +++ b/pixi.toml @@ -1,4 +1,4 @@ -[project] +[workspace] name = "r-pecotmr" channels = ["dnachun", "conda-forge", "bioconda"] platforms = ["linux-64", "osx-arm64"] @@ -45,13 +45,19 @@ r45 = {features = ["r45"]} "bioconductor-iranges" = "*" "bioconductor-qvalue" = "*" "bioconductor-s4vectors" = "*" +"bioconductor-snprelate" = "*" "bioconductor-snpstats" = "*" +"bioconductor-mungesumstats" = "*" +"bioconductor-rsamtools" = "*" "r-base" = "*" "r-bglr" = "*" "r-bigsnpr" = "*" "r-coda" = "*" "r-coloc" = "*" "r-colocboost" = "*" +"r-cpp11" = "*" +"r-cpp11armadillo" = "*" +"r-decor" = "*" "r-dofuture" = "*" "r-dplyr" = "*" "r-flashier" = "*" @@ -72,8 +78,6 @@ r45 = {features = ["r45"]} "r-pgenlibr" = "*" "r-purrr" = "*" "r-qgg" = "*" -"r-rcpp" = "*" -"r-rcpparmadillo" = "*" "r-rcppdpr" = "*" "r-readr" = "*" "r-rfast" = "*" diff --git a/plink2.log b/plink2.log new file mode 100644 index 000000000..86dc0b4d2 --- /dev/null +++ b/plink2.log @@ -0,0 +1,15 @@ +PLINK v2.00a6 M1 (18 Mar 2024) +Options in effect: + --freq + --pfile test_variants + +Hostname: Daniels-MacBook-Pro.local +Working directory: /Users/danielnachun/ghq/github.com/StatFunGen/pecotmr +Start time: Tue Apr 21 09:40:58 2026 + +Random number seed: 1776782458 +65536 MiB RAM detected; reserving 32768 MiB for main workspace. +Using up to 16 threads (change this with --threads). +Error: Failed to open test_variants.psam : No such file or directory. + +End time: Tue Apr 21 09:40:58 2026 diff --git a/src/Makevars.in b/src/Makevars.in index 02b6ef269..7b4e950a2 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,4 +1,3 @@ -CXX_STD = CXX14 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DARMA_64BIT_WORD=1 PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) \ $(FLIBS) $(LDFLAGS) diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp deleted file mode 100644 index ee17c49ab..000000000 --- a/src/RcppExports.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Generated by using Rcpp::compileAttributes() -> do not edit by hand -// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 - -#include -#include - -using namespace Rcpp; - -#ifdef RCPP_USE_GLOBAL_ROSTREAM -Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); -Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); -#endif - -// dentist_iterative_impute -List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arma::vec& zScore, double pValueThreshold, float propSVD, bool gcControl, int nIter, double gPvalueThreshold, int ncpus, bool correct_chen_et_al_bug, bool verbose); -RcppExport SEXP _pecotmr_dentist_iterative_impute(SEXP LD_matSEXP, SEXP nSampleSEXP, SEXP zScoreSEXP, SEXP pValueThresholdSEXP, SEXP propSVDSEXP, SEXP gcControlSEXP, SEXP nIterSEXP, SEXP gPvalueThresholdSEXP, SEXP ncpusSEXP, SEXP correct_chen_et_al_bugSEXP, SEXP verboseSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const arma::mat& >::type LD_mat(LD_matSEXP); - Rcpp::traits::input_parameter< size_t >::type nSample(nSampleSEXP); - Rcpp::traits::input_parameter< const arma::vec& >::type zScore(zScoreSEXP); - Rcpp::traits::input_parameter< double >::type pValueThreshold(pValueThresholdSEXP); - Rcpp::traits::input_parameter< float >::type propSVD(propSVDSEXP); - Rcpp::traits::input_parameter< bool >::type gcControl(gcControlSEXP); - Rcpp::traits::input_parameter< int >::type nIter(nIterSEXP); - Rcpp::traits::input_parameter< double >::type gPvalueThreshold(gPvalueThresholdSEXP); - Rcpp::traits::input_parameter< int >::type ncpus(ncpusSEXP); - Rcpp::traits::input_parameter< bool >::type correct_chen_et_al_bug(correct_chen_et_al_bugSEXP); - Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP); - rcpp_result_gen = Rcpp::wrap(dentist_iterative_impute(LD_mat, nSample, zScore, pValueThreshold, propSVD, gcControl, nIter, gPvalueThreshold, ncpus, correct_chen_et_al_bug, verbose)); - return rcpp_result_gen; -END_RCPP -} -// lassosum_rss_rcpp -Rcpp::List lassosum_rss_rcpp(const arma::vec& z, const Rcpp::List& LD, const arma::vec& lambda, double thr, int maxiter); -RcppExport SEXP _pecotmr_lassosum_rss_rcpp(SEXP zSEXP, SEXP LDSEXP, SEXP lambdaSEXP, SEXP thrSEXP, SEXP maxiterSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const arma::vec& >::type z(zSEXP); - Rcpp::traits::input_parameter< const Rcpp::List& >::type LD(LDSEXP); - Rcpp::traits::input_parameter< const arma::vec& >::type lambda(lambdaSEXP); - Rcpp::traits::input_parameter< double >::type thr(thrSEXP); - Rcpp::traits::input_parameter< int >::type maxiter(maxiterSEXP); - rcpp_result_gen = Rcpp::wrap(lassosum_rss_rcpp(z, LD, lambda, thr, maxiter)); - return rcpp_result_gen; -END_RCPP -} -// prs_cs_rcpp -Rcpp::List prs_cs_rcpp(double a, double b, Rcpp::Nullable phi, Rcpp::NumericVector bhat, Rcpp::Nullable maf, int n, Rcpp::List ld_blk, int n_iter, int n_burnin, int thin, bool verbose, Rcpp::Nullable seed); -RcppExport SEXP _pecotmr_prs_cs_rcpp(SEXP aSEXP, SEXP bSEXP, SEXP phiSEXP, SEXP bhatSEXP, SEXP mafSEXP, SEXP nSEXP, SEXP ld_blkSEXP, SEXP n_iterSEXP, SEXP n_burninSEXP, SEXP thinSEXP, SEXP verboseSEXP, SEXP seedSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< double >::type a(aSEXP); - Rcpp::traits::input_parameter< double >::type b(bSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type phi(phiSEXP); - Rcpp::traits::input_parameter< Rcpp::NumericVector >::type bhat(bhatSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type maf(mafSEXP); - Rcpp::traits::input_parameter< int >::type n(nSEXP); - Rcpp::traits::input_parameter< Rcpp::List >::type ld_blk(ld_blkSEXP); - Rcpp::traits::input_parameter< int >::type n_iter(n_iterSEXP); - Rcpp::traits::input_parameter< int >::type n_burnin(n_burninSEXP); - Rcpp::traits::input_parameter< int >::type thin(thinSEXP); - Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type seed(seedSEXP); - rcpp_result_gen = Rcpp::wrap(prs_cs_rcpp(a, b, phi, bhat, maf, n, ld_blk, n_iter, n_burnin, thin, verbose, seed)); - return rcpp_result_gen; -END_RCPP -} -// qtl_enrichment_rcpp -Rcpp::List qtl_enrichment_rcpp(SEXP r_gwas_pip, SEXP r_qtl_susie_fit, double pi_gwas, double pi_qtl, int ImpN, double shrinkage_lambda, int num_threads); -RcppExport SEXP _pecotmr_qtl_enrichment_rcpp(SEXP r_gwas_pipSEXP, SEXP r_qtl_susie_fitSEXP, SEXP pi_gwasSEXP, SEXP pi_qtlSEXP, SEXP ImpNSEXP, SEXP shrinkage_lambdaSEXP, SEXP num_threadsSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< SEXP >::type r_gwas_pip(r_gwas_pipSEXP); - Rcpp::traits::input_parameter< SEXP >::type r_qtl_susie_fit(r_qtl_susie_fitSEXP); - Rcpp::traits::input_parameter< double >::type pi_gwas(pi_gwasSEXP); - Rcpp::traits::input_parameter< double >::type pi_qtl(pi_qtlSEXP); - Rcpp::traits::input_parameter< int >::type ImpN(ImpNSEXP); - Rcpp::traits::input_parameter< double >::type shrinkage_lambda(shrinkage_lambdaSEXP); - Rcpp::traits::input_parameter< int >::type num_threads(num_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(qtl_enrichment_rcpp(r_gwas_pip, r_qtl_susie_fit, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, num_threads)); - return rcpp_result_gen; -END_RCPP -} -// sdpr_rcpp -Rcpp::List sdpr_rcpp(const std::vector& bhat, const Rcpp::List& LD, int n, Rcpp::Nullable per_variant_sample_size, Rcpp::Nullable array, double a, double c, size_t M, double a0k, double b0k, int iter, int burn, int thin, unsigned n_threads, int opt_llk, bool verbose, Rcpp::Nullable seed); -RcppExport SEXP _pecotmr_sdpr_rcpp(SEXP bhatSEXP, SEXP LDSEXP, SEXP nSEXP, SEXP per_variant_sample_sizeSEXP, SEXP arraySEXP, SEXP aSEXP, SEXP cSEXP, SEXP MSEXP, SEXP a0kSEXP, SEXP b0kSEXP, SEXP iterSEXP, SEXP burnSEXP, SEXP thinSEXP, SEXP n_threadsSEXP, SEXP opt_llkSEXP, SEXP verboseSEXP, SEXP seedSEXP) { -BEGIN_RCPP - Rcpp::RObject rcpp_result_gen; - Rcpp::RNGScope rcpp_rngScope_gen; - Rcpp::traits::input_parameter< const std::vector& >::type bhat(bhatSEXP); - Rcpp::traits::input_parameter< const Rcpp::List& >::type LD(LDSEXP); - Rcpp::traits::input_parameter< int >::type n(nSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type per_variant_sample_size(per_variant_sample_sizeSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type array(arraySEXP); - Rcpp::traits::input_parameter< double >::type a(aSEXP); - Rcpp::traits::input_parameter< double >::type c(cSEXP); - Rcpp::traits::input_parameter< size_t >::type M(MSEXP); - Rcpp::traits::input_parameter< double >::type a0k(a0kSEXP); - Rcpp::traits::input_parameter< double >::type b0k(b0kSEXP); - Rcpp::traits::input_parameter< int >::type iter(iterSEXP); - Rcpp::traits::input_parameter< int >::type burn(burnSEXP); - Rcpp::traits::input_parameter< int >::type thin(thinSEXP); - Rcpp::traits::input_parameter< unsigned >::type n_threads(n_threadsSEXP); - Rcpp::traits::input_parameter< int >::type opt_llk(opt_llkSEXP); - Rcpp::traits::input_parameter< bool >::type verbose(verboseSEXP); - Rcpp::traits::input_parameter< Rcpp::Nullable >::type seed(seedSEXP); - rcpp_result_gen = Rcpp::wrap(sdpr_rcpp(bhat, LD, n, per_variant_sample_size, array, a, c, M, a0k, b0k, iter, burn, thin, n_threads, opt_llk, verbose, seed)); - return rcpp_result_gen; -END_RCPP -} - -static const R_CallMethodDef CallEntries[] = { - {"_pecotmr_dentist_iterative_impute", (DL_FUNC) &_pecotmr_dentist_iterative_impute, 11}, - {"_pecotmr_lassosum_rss_rcpp", (DL_FUNC) &_pecotmr_lassosum_rss_rcpp, 5}, - {"_pecotmr_prs_cs_rcpp", (DL_FUNC) &_pecotmr_prs_cs_rcpp, 12}, - {"_pecotmr_qtl_enrichment_rcpp", (DL_FUNC) &_pecotmr_qtl_enrichment_rcpp, 7}, - {"_pecotmr_sdpr_rcpp", (DL_FUNC) &_pecotmr_sdpr_rcpp, 17}, - {NULL, NULL, 0} -}; - -RcppExport void R_init_pecotmr(DllInfo *dll) { - R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); - R_useDynamicSymbols(dll, FALSE); -} diff --git a/src/cpp11.cpp b/src/cpp11.cpp new file mode 100644 index 000000000..568ae02d0 --- /dev/null +++ b/src/cpp11.cpp @@ -0,0 +1,59 @@ +// Generated by cpp11: do not edit by hand +// clang-format off + + +#include "cpp11/declarations.hpp" +#include + +// dentist_iterative_impute.cpp +cpp11::writable::list dentist_iterative_impute(const doubles_matrix<>& LD_mat_r, int nSample, const doubles& zScore_r, double pValueThreshold, double propSVD, bool gcControl, int nIter, double gPvalueThreshold, int ncpus, bool correct_chen_et_al_bug, bool verbose); +extern "C" SEXP _pecotmr_dentist_iterative_impute(SEXP LD_mat_r, SEXP nSample, SEXP zScore_r, SEXP pValueThreshold, SEXP propSVD, SEXP gcControl, SEXP nIter, SEXP gPvalueThreshold, SEXP ncpus, SEXP correct_chen_et_al_bug, SEXP verbose) { + BEGIN_CPP11 + return cpp11::as_sexp(dentist_iterative_impute(cpp11::as_cpp&>>(LD_mat_r), cpp11::as_cpp>(nSample), cpp11::as_cpp>(zScore_r), cpp11::as_cpp>(pValueThreshold), cpp11::as_cpp>(propSVD), cpp11::as_cpp>(gcControl), cpp11::as_cpp>(nIter), cpp11::as_cpp>(gPvalueThreshold), cpp11::as_cpp>(ncpus), cpp11::as_cpp>(correct_chen_et_al_bug), cpp11::as_cpp>(verbose))); + END_CPP11 +} +// lassosum_rss.cpp +cpp11::writable::list lassosum_rss_rcpp(const doubles& z_r, const list& LD, const doubles& lambda_r, double thr, int maxiter); +extern "C" SEXP _pecotmr_lassosum_rss_rcpp(SEXP z_r, SEXP LD, SEXP lambda_r, SEXP thr, SEXP maxiter) { + BEGIN_CPP11 + return cpp11::as_sexp(lassosum_rss_rcpp(cpp11::as_cpp>(z_r), cpp11::as_cpp>(LD), cpp11::as_cpp>(lambda_r), cpp11::as_cpp>(thr), cpp11::as_cpp>(maxiter))); + END_CPP11 +} +// prscs_mcmc.cpp +cpp11::writable::list prs_cs_rcpp(double a, double b, sexp phi, doubles bhat, sexp maf, int n, list ld_blk, int n_iter, int n_burnin, int thin, bool verbose, sexp seed); +extern "C" SEXP _pecotmr_prs_cs_rcpp(SEXP a, SEXP b, SEXP phi, SEXP bhat, SEXP maf, SEXP n, SEXP ld_blk, SEXP n_iter, SEXP n_burnin, SEXP thin, SEXP verbose, SEXP seed) { + BEGIN_CPP11 + return cpp11::as_sexp(prs_cs_rcpp(cpp11::as_cpp>(a), cpp11::as_cpp>(b), cpp11::as_cpp>(phi), cpp11::as_cpp>(bhat), cpp11::as_cpp>(maf), cpp11::as_cpp>(n), cpp11::as_cpp>(ld_blk), cpp11::as_cpp>(n_iter), cpp11::as_cpp>(n_burnin), cpp11::as_cpp>(thin), cpp11::as_cpp>(verbose), cpp11::as_cpp>(seed))); + END_CPP11 +} +// qtl_enrichment.cpp +cpp11::writable::list qtl_enrichment_rcpp(SEXP r_gwas_pip, SEXP r_qtl_susie_fit, double pi_gwas, double pi_qtl, int ImpN, double shrinkage_lambda, bool double_shrinkage, bool bessel_correction, int num_threads); +extern "C" SEXP _pecotmr_qtl_enrichment_rcpp(SEXP r_gwas_pip, SEXP r_qtl_susie_fit, SEXP pi_gwas, SEXP pi_qtl, SEXP ImpN, SEXP shrinkage_lambda, SEXP double_shrinkage, SEXP bessel_correction, SEXP num_threads) { + BEGIN_CPP11 + return cpp11::as_sexp(qtl_enrichment_rcpp(cpp11::as_cpp>(r_gwas_pip), cpp11::as_cpp>(r_qtl_susie_fit), cpp11::as_cpp>(pi_gwas), cpp11::as_cpp>(pi_qtl), cpp11::as_cpp>(ImpN), cpp11::as_cpp>(shrinkage_lambda), cpp11::as_cpp>(double_shrinkage), cpp11::as_cpp>(bessel_correction), cpp11::as_cpp>(num_threads))); + END_CPP11 +} +// sdpr.cpp +cpp11::writable::list sdpr_rcpp(const doubles& bhat_r, const list& LD, int n, sexp per_variant_sample_size, sexp array, double a, double c, int M, double a0k, double b0k, int iter, int burn, int thin, int n_threads, int opt_llk, bool verbose, sexp seed); +extern "C" SEXP _pecotmr_sdpr_rcpp(SEXP bhat_r, SEXP LD, SEXP n, SEXP per_variant_sample_size, SEXP array, SEXP a, SEXP c, SEXP M, SEXP a0k, SEXP b0k, SEXP iter, SEXP burn, SEXP thin, SEXP n_threads, SEXP opt_llk, SEXP verbose, SEXP seed) { + BEGIN_CPP11 + return cpp11::as_sexp(sdpr_rcpp(cpp11::as_cpp>(bhat_r), cpp11::as_cpp>(LD), cpp11::as_cpp>(n), cpp11::as_cpp>(per_variant_sample_size), cpp11::as_cpp>(array), cpp11::as_cpp>(a), cpp11::as_cpp>(c), cpp11::as_cpp>(M), cpp11::as_cpp>(a0k), cpp11::as_cpp>(b0k), cpp11::as_cpp>(iter), cpp11::as_cpp>(burn), cpp11::as_cpp>(thin), cpp11::as_cpp>(n_threads), cpp11::as_cpp>(opt_llk), cpp11::as_cpp>(verbose), cpp11::as_cpp>(seed))); + END_CPP11 +} + +extern "C" { +static const R_CallMethodDef CallEntries[] = { + {"_pecotmr_dentist_iterative_impute", (DL_FUNC) &_pecotmr_dentist_iterative_impute, 11}, + {"_pecotmr_lassosum_rss_rcpp", (DL_FUNC) &_pecotmr_lassosum_rss_rcpp, 5}, + {"_pecotmr_prs_cs_rcpp", (DL_FUNC) &_pecotmr_prs_cs_rcpp, 12}, + {"_pecotmr_qtl_enrichment_rcpp", (DL_FUNC) &_pecotmr_qtl_enrichment_rcpp, 9}, + {"_pecotmr_sdpr_rcpp", (DL_FUNC) &_pecotmr_sdpr_rcpp, 17}, + {NULL, NULL, 0} +}; +} + +extern "C" attribute_visible void R_init_pecotmr(DllInfo* dll){ + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); + R_forceSymbols(dll, TRUE); +} diff --git a/src/dentist_iterative_impute.cpp b/src/dentist_iterative_impute.cpp index a34785941..1d16547bf 100644 --- a/src/dentist_iterative_impute.cpp +++ b/src/dentist_iterative_impute.cpp @@ -1,20 +1,17 @@ -// Rcpp implementation of the DENTIST method (Chen et al.) +// cpp11 implementation of the DENTIST method (Chen et al.) // https://github.com/Yves-CHEN/DENTIST/tree/master#Citations // // This code reproduces the original DENTIST binary's algorithm and logic, // using Armadillo (LAPACK) for eigendecomposition and GCTA-style LD computation. -#include +#include +#include #include #include #include #include #include -// [[Rcpp::depends(RcppArmadillo)]] -// [[Rcpp::plugins(cpp11)]] -// [[Rcpp::plugins(openmp)]] - -using namespace Rcpp; +using namespace cpp11; using namespace arma; // DENTIST RNG: uses srand/rand + sort-by-random-values to produce a permutation. @@ -94,19 +91,20 @@ double getQuantile2_chen_et_al(const std::vector &dat, std::vector& idx, const std::vector& idx2, - const arma::vec& zScore, arma::vec& imputedZ, arma::vec& rsqList, arma::vec& zScore_e, +void oneIteration(const mat& LD_mat, const std::vector& idx, const std::vector& idx2, + const vec& zScore, vec& imputedZ, vec& rsqList, vec& zScore_e, size_t nSample, float probSVD, int ncpus, bool verbose) { if (verbose) { - Rcpp::Rcout << "LD_mat: " << LD_mat.n_rows << "x" << LD_mat.n_cols - << " idx: " << idx.size() << " idx2: " << idx2.size() << std::endl; + Rprintf("LD_mat: %lux%lu idx: %lu idx2: %lu\n", + (unsigned long)LD_mat.n_rows, (unsigned long)LD_mat.n_cols, + (unsigned long)idx.size(), (unsigned long)idx2.size()); } int nProcessors = omp_get_max_threads(); @@ -117,28 +115,28 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const // Validate dimensions if (idx2.size() > LD_mat.n_rows || idx.size() > LD_mat.n_cols) - Rcpp::stop("Inconsistent dimensions between LD_mat and idx2/idx in oneIteration()"); + cpp11::stop("Inconsistent dimensions between LD_mat and idx2/idx in oneIteration()"); for (size_t i = 0; i < idx.size(); ++i) if (idx[i] >= zScore.size()) - Rcpp::stop("Invalid index in idx: " + std::to_string(idx[i])); + cpp11::stop("Invalid index in idx: %d", (int)idx[i]); for (size_t i = 0; i < idx2.size(); ++i) if (idx2[i] >= zScore.size()) - Rcpp::stop("Invalid index in idx2: " + std::to_string(idx2[i])); + cpp11::stop("Invalid index in idx2: %d", (int)idx2[i]); // Convert to arma::uvec for idiomatic submatrix extraction - arma::uvec aidx(idx.size()), aidx2(idx2.size()); + uvec aidx(idx.size()), aidx2(idx2.size()); for (size_t i = 0; i < idx.size(); i++) aidx(i) = idx[i]; for (size_t i = 0; i < idx2.size(); i++) aidx2(i) = idx2[i]; // Extract submatrices and z-score subset - arma::mat LD_it = LD_mat(aidx2, aidx); - arma::mat VV = LD_mat(aidx, aidx); - arma::vec zScore_sub = zScore(aidx); + mat LD_it = LD_mat(aidx2, aidx); + mat VV = LD_mat(aidx, aidx); + vec zScore_sub = zScore(aidx); // Eigendecomposition (ascending order, same as Eigen's SelfAdjointEigenSolver) - arma::vec eigval; - arma::mat eigvec; - arma::eig_sym(eigval, eigvec, VV); + vec eigval; + mat eigvec; + eig_sym(eigval, eigvec, VV); // Determine effective rank (eigenvalues >= 0.0001) int n_eig = eigval.n_elem; @@ -149,10 +147,10 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const if (K > static_cast(nRank)) K = nRank; if (verbose) - Rcpp::Rcout << "Rank: " << nRank << ", Zeros: " << nZeros << ", K: " << K << std::endl; + Rprintf("Rank: %d, Zeros: %d, K: %lu\n", nRank, nZeros, (unsigned long)K); if (K <= 1) { - Rcpp::warning("Rank of eigen matrix <= 1, skipping imputation for this partition"); + cpp11::warning("Rank of eigen matrix <= 1, skipping imputation for this partition"); for (size_t i = 0; i < idx2.size(); ++i) { imputedZ[idx2[i]] = 0.0; rsqList[idx2[i]] = 0.0; @@ -162,8 +160,8 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const } // Build ui (top K eigenvectors, largest first) and wi (inverse eigenvalues) - arma::mat ui(n_eig, K); - arma::vec wi(K); + mat ui(n_eig, K); + vec wi(K); for (size_t m = 0; m < K; m++) { int j = n_eig - m - 1; // from largest eigenvalue ui.col(m) = eigvec.col(j); @@ -171,9 +169,9 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const } // Imputation: beta = LD_it * ui * diag(wi), then imputed_z = beta * ui' * z - arma::mat beta = LD_it * (ui.each_row() % wi.t()); - arma::vec zScore_imp = beta * (ui.t() * zScore_sub); - arma::vec rsq_vec = arma::diagvec(beta * (ui.t() * LD_it.t())); + mat beta = LD_it * (ui.each_row() % wi.t()); + vec zScore_imp = beta * (ui.t() * zScore_sub); + vec rsq_vec = diagvec(beta * (ui.t() * LD_it.t())); // Store results for (size_t i = 0; i < idx2.size(); ++i) { @@ -181,7 +179,7 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const rsqList[idx2[i]] = rsq_vec(i); if (rsq_vec(i) >= 1) { rsqList[idx2[i]] = std::min(rsq_vec(i), 1.0); - Rcpp::warning("Adjusted rsq value exceeding 1: " + std::to_string(rsq_vec(i))); + cpp11::warning("Adjusted rsq value exceeding 1: %g", rsq_vec(i)); } size_t j = idx2[i]; double denom_sq = LD_mat(j, j) - rsqList[j]; @@ -198,15 +196,16 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const * information from a reference panel. It helps detect genotyping/imputation errors, allelic errors, and heterogeneity * between GWAS and LD reference samples, improving the reliability of subsequent analyses. * - * @param LD_mat The linkage disequilibrium (LD) matrix from a reference panel, as an arma::mat object. + * @param LD_mat_r The linkage disequilibrium (LD) matrix from a reference panel. * @param nSample The sample size used in the GWAS whose summary statistics are being analyzed. - * @param zScore A vector of Z-scores from GWAS summary statistics. + * @param zScore_r A vector of Z-scores from GWAS summary statistics. * @param pValueThreshold Threshold for the p-value below which variants are considered for quality control. * @param propSVD Proportion of singular value decomposition (SVD) components retained in the analysis. * @param gcControl A boolean flag to apply genetic control corrections. * @param nIter The number of iterations to run the DENTIST algorithm. * @param gPvalueThreshold P-value threshold for grouping variants into significant and null categories. * @param ncpus The number of CPU cores to use for parallel processing. + * @param correct_chen_et_al_bug Whether to correct the original DENTIST bug. * @param verbose A boolean flag to enable verbose output for debugging. * * @return A List object containing: @@ -215,26 +214,27 @@ void oneIteration(const arma::mat& LD_mat, const std::vector& idx, const * - z_diff: A vector of outlier test z-scores * - rsq: A vector of R-squared values for each marker, indicating goodness of fit. * - iter_to_correct: An integer vector indicating the iteration in which each marker passed the quality control. - * - * @note The function is designed for use in Rcpp and requires Armadillo for matrix operations and OpenMP for parallel processing. */ -// [[Rcpp::export]] -List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arma::vec& zScore, - double pValueThreshold, float propSVD, bool gcControl, int nIter, +[[cpp11::register]] +cpp11::writable::list dentist_iterative_impute(const doubles_matrix<>& LD_mat_r, int nSample, const doubles& zScore_r, + double pValueThreshold, double propSVD, bool gcControl, int nIter, double gPvalueThreshold, int ncpus, bool correct_chen_et_al_bug, - bool verbose = false) { + bool verbose) { + mat LD_mat = as_Mat(LD_mat_r); + vec zScore = as_Col(zScore_r); + if (verbose) { - Rcpp::Rcout << "LD_mat dimensions: " << LD_mat.n_rows << " x " << LD_mat.n_cols << std::endl; - Rcpp::Rcout << "nSample: " << nSample << std::endl; - Rcpp::Rcout << "zScore size: " << zScore.size() << std::endl; - Rcpp::Rcout << "pValueThreshold: " << pValueThreshold << std::endl; - Rcpp::Rcout << "propSVD: " << propSVD << std::endl; - Rcpp::Rcout << "gcControl: " << gcControl << std::endl; - Rcpp::Rcout << "nIter: " << nIter << std::endl; - Rcpp::Rcout << "gPvalueThreshold: " << gPvalueThreshold << std::endl; - Rcpp::Rcout << "ncpus: " << ncpus << std::endl; - Rcpp::Rcout << "correct_chen_et_al_bug: " << correct_chen_et_al_bug << std::endl; + Rprintf("LD_mat dimensions: %lu x %lu\n", (unsigned long)LD_mat.n_rows, (unsigned long)LD_mat.n_cols); + Rprintf("nSample: %d\n", nSample); + Rprintf("zScore size: %lu\n", (unsigned long)zScore.size()); + Rprintf("pValueThreshold: %g\n", pValueThreshold); + Rprintf("propSVD: %g\n", propSVD); + Rprintf("gcControl: %d\n", gcControl); + Rprintf("nIter: %d\n", nIter); + Rprintf("gPvalueThreshold: %g\n", gPvalueThreshold); + Rprintf("ncpus: %d\n", ncpus); + Rprintf("correct_chen_et_al_bug: %d\n", correct_chen_et_al_bug); } // Set number of threads for parallel processing @@ -257,7 +257,7 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Indices partitioned" << std::endl; + Rprintf("Indices partitioned\n"); } std::vector groupingGWAS(markerSize, 0); @@ -268,13 +268,13 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Grouping GWAS finished" << std::endl; + Rprintf("Grouping GWAS finished\n"); } - arma::vec imputedZ = arma::zeros(markerSize); - arma::vec rsq = arma::zeros(markerSize); - arma::vec zScore_e = arma::zeros(markerSize); - arma::ivec iterID = arma::zeros(markerSize); + vec imputedZ = zeros(markerSize); + vec rsq = zeros(markerSize); + vec zScore_e = zeros(markerSize); + Col iterID = zeros>(markerSize); std::vector diff(idx2.size()); std::vector grouping_tmp(idx2.size()); @@ -282,10 +282,10 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm for (int t = 0; t < nIter; ++t) { // Perform iteration with current subsets if (verbose) { - Rcpp::Rcout << "\n=== Iteration " << t << " ===" << std::endl; - Rcpp::Rcout << "idx.size()=" << idx.size() << " idx2.size()=" << idx2.size() - << " fullIdx.size()=" << fullIdx.size() << std::endl; - Rcpp::Rcout << "Performing oneIteration()" << std::endl; + Rprintf("\n=== Iteration %d ===\n", t); + Rprintf("idx.size()=%lu idx2.size()=%lu fullIdx.size()=%lu\n", + (unsigned long)idx.size(), (unsigned long)idx2.size(), (unsigned long)fullIdx.size()); + Rprintf("Performing oneIteration()\n"); } oneIteration(LD_mat, idx, idx2, zScore, imputedZ, rsq, zScore_e, nSample, propSVD, ncpus, verbose); @@ -300,7 +300,7 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Assessing differences and grouping for thresholding" << std::endl; + Rprintf("Assessing differences and grouping for thresholding\n"); } double threshold = getQuantile(diff, 0.995); @@ -338,7 +338,7 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm and it will treat t (which is 0) no larger than nIter-2 (which is -1) which is wrong Thus if we correct the original DENTIST code, i.e., correct_chen_et_al_bug = TRUE, or when nIter - 2 >=0, it will compare t and nIter as we expect. - and if we want to keep the original DENTIST code, i.e., correct_chen_et_al_bug = FALSE, then it will skip this if condition for t > nIter - 2 + and if we want to keep the original DENTIST code, i.e., correct_chen_et_al_bug = TRUE, then it will skip this if condition for t > nIter - 2 */ if (t > nIter - 2) { threshold0 = threshold; @@ -347,8 +347,8 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Thresholds calculated: " << threshold << ", " << threshold1 << ", " << threshold0 << std::endl; - Rcpp::Rcout << "Applying threshold-based filtering for QC" << std::endl; + Rprintf("Thresholds calculated: %g, %g, %g\n", threshold, threshold1, threshold0); + Rprintf("Applying threshold-based filtering for QC\n"); } // Apply threshold-based filtering for QC @@ -362,14 +362,14 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm // Perform another iteration with updated sets of indices (idx and idx2_QCed) if (verbose) { - Rcpp::Rcout << "idx2_QCed.size()=" << idx2_QCed.size() << std::endl; - Rcpp::Rcout << "Performing oneIteration() with updated sets of indices" << std::endl; + Rprintf("idx2_QCed.size()=%lu\n", (unsigned long)idx2_QCed.size()); + Rprintf("Performing oneIteration() with updated sets of indices\n"); } oneIteration(LD_mat, idx2_QCed, idx, zScore, imputedZ, rsq, zScore_e, nSample, propSVD, ncpus, verbose); if (verbose) { - Rcpp::Rcout << "Recalculating differences and groupings after the iteration" << std::endl; + Rprintf("Recalculating differences and groupings after the iteration\n"); } // Recalculate differences and groupings after the iteration @@ -382,7 +382,7 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Re-determining thresholds based on the recalculated differences and groupings" << std::endl; + Rprintf("Re-determining thresholds based on the recalculated differences and groupings\n"); } // Re-determine thresholds based on the recalculated differences and groupings @@ -412,8 +412,8 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } if (verbose) { - Rcpp::Rcout << "Phase2 thresholds: " << threshold << ", " << threshold1 << ", " << threshold0 << std::endl; - Rcpp::Rcout << "Adjusting for genetic control and inflation factor if necessary" << std::endl; + Rprintf("Phase2 thresholds: %g, %g, %g\n", threshold, threshold1, threshold0); + Rprintf("Adjusting for genetic control and inflation factor if necessary\n"); } // Adjust for genetic control and inflation factor if necessary @@ -426,7 +426,7 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm // We only need to guard against empty vectors to avoid undefined behavior. if (chisq.empty()) { if (verbose) { - Rcpp::Rcout << "chisq is empty, breaking out of iteration loop." << std::endl; + Rprintf("chisq is empty, breaking out of iteration loop.\n"); } break; } @@ -466,15 +466,13 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm // Update the indices for the next iteration based on filtering criteria fullIdx = fullIdx_tmp; if (verbose) { - Rcpp::Rcout << "Iter " << t << ": fullIdx=" << fullIdx.size() - << " threshold=" << threshold - << " threshold1=" << threshold1 - << " threshold0=" << threshold0 << std::endl; + Rprintf("Iter %d: fullIdx=%lu threshold=%g threshold1=%g threshold0=%g\n", + t, (unsigned long)fullIdx.size(), threshold, threshold1, threshold0); } // Early exit if all variants were filtered out if (fullIdx.empty()) { if (verbose) { - Rcpp::Rcout << "All variants filtered out at iteration " << t << ", stopping early." << std::endl; + Rprintf("All variants filtered out at iteration %d, stopping early.\n", t); } break; } @@ -488,9 +486,14 @@ List dentist_iterative_impute(const arma::mat& LD_mat, size_t nSample, const arm } } - return List::create(Named("original_z") = zScore, - Named("imputed_z") = imputedZ, - Named("rsq") = rsq, - Named("z_diff") = zScore_e, - Named("iter_to_correct") = iterID); + using namespace cpp11::literals; + writable::list result({ + "original_z"_nm = as_doubles(zScore), + "imputed_z"_nm = as_doubles(imputedZ), + "rsq"_nm = as_doubles(rsq), + "z_diff"_nm = as_doubles(zScore_e), + "iter_to_correct"_nm = as_integers(iterID) + }); + + return result; } diff --git a/src/lassosum_rss.cpp b/src/lassosum_rss.cpp index 0f377b203..220b62eda 100644 --- a/src/lassosum_rss.cpp +++ b/src/lassosum_rss.cpp @@ -4,18 +4,19 @@ // Objective: min_beta beta'R beta - 2 beta'z + 2 lambda ||beta||_1 // where R is a (possibly pre-shrunk) LD matrix and z = bhat / sqrt(n). -#include -// [[Rcpp::depends(RcppArmadillo)]] +#include +#include -using namespace Rcpp; +using namespace cpp11; +using namespace arma; // Single-block coordinate descent — mirrors lassosum elnet() // Tracks Rbeta = R * beta as a running sum (analogous to yhat = X * beta // in the genotype version). This avoids recomputing the full dot product // each iteration and matches the original algorithm exactly. -static int elnet_rss(double lambda1, const arma::vec& diag_R, - const arma::mat& R, const arma::vec& z, - double thr, arma::vec& beta, arma::vec& Rbeta, +static int elnet_rss(double lambda1, const vec& diag_R, + const mat& R, const vec& z, + double thr, vec& beta, vec& Rbeta, int maxiter) { int p = z.n_elem; double dlx, del, t, bj; @@ -38,7 +39,7 @@ static int elnet_rss(double lambda1, const arma::vec& diag_R, // Update running Rbeta (analogous to yhat += del * X.col(j)) Rbeta += del * R.col(j); } - Rcpp::checkUserInterrupt(); + cpp11::check_user_interrupt(); if (dlx < thr) { conv = 1; break; @@ -47,47 +48,50 @@ static int elnet_rss(double lambda1, const arma::vec& diag_R, return conv; } -// [[Rcpp::export]] -Rcpp::List lassosum_rss_rcpp(const arma::vec& z, - const Rcpp::List& LD, - const arma::vec& lambda, - double thr, - int maxiter) { +[[cpp11::register]] +cpp11::writable::list lassosum_rss_rcpp(const doubles& z_r, + const list& LD, + const doubles& lambda_r, + double thr, + int maxiter) { + vec z = as_Col(z_r); + vec lambda = as_Col(lambda_r); + // Cache LD blocks once (avoid re-copying from R on every lambda iteration) int n_blocks = LD.size(); - std::vector ld_blocks(n_blocks); + std::vector ld_blocks(n_blocks); std::vector block_start(n_blocks), block_end(n_blocks); int p = 0; for (int b = 0; b < n_blocks; b++) { - ld_blocks[b] = Rcpp::as(LD[b]); + ld_blocks[b] = as_Mat(doubles_matrix<>(LD[b])); block_start[b] = p; p += ld_blocks[b].n_rows; block_end[b] = p - 1; } if ((int)z.n_elem != p) - Rcpp::stop("Length of z must equal total rows across all LD blocks."); + cpp11::stop("Length of z must equal total rows across all LD blocks."); int nlambda = lambda.n_elem; - arma::mat beta_mat(p, nlambda, arma::fill::zeros); - arma::ivec conv_vec(nlambda, arma::fill::zeros); - arma::vec loss_vec(nlambda, arma::fill::zeros); - arma::vec fbeta_vec(nlambda, arma::fill::zeros); + mat beta_mat(p, nlambda, fill::zeros); + Col conv_vec(nlambda, fill::zeros); + vec loss_vec(nlambda, fill::zeros); + vec fbeta_vec(nlambda, fill::zeros); // Working beta vector — warm-started across lambda path - arma::vec beta(p, arma::fill::zeros); + vec beta(p, fill::zeros); for (int i = 0; i < nlambda; i++) { // Block-wise coordinate descent — mirrors lassosum repelnet() int out = 1; for (int b = 0; b < n_blocks; b++) { - const arma::mat& Rb = ld_blocks[b]; + const mat& Rb = ld_blocks[b]; int s = block_start[b]; int e = block_end[b]; - arma::vec diag_R = Rb.diag(); - arma::vec z_blk = z.subvec(s, e); - arma::vec beta_blk = beta.subvec(s, e); - arma::vec Rbeta_blk = Rb * beta_blk; + vec diag_R = Rb.diag(); + vec z_blk = z.subvec(s, e); + vec beta_blk = beta.subvec(s, e); + vec Rbeta_blk = Rb * beta_blk; int conv_blk = elnet_rss(lambda(i), diag_R, Rb, z_blk, thr, beta_blk, Rbeta_blk, maxiter); @@ -99,23 +103,26 @@ Rcpp::List lassosum_rss_rcpp(const arma::vec& z, conv_vec(i) = out; // Compute loss = beta'R beta - 2 z'beta (block-wise) - double loss = -2.0 * arma::dot(z, beta); + double loss = -2.0 * dot(z, beta); for (int b = 0; b < n_blocks; b++) { - const arma::mat& Rb = ld_blocks[b]; + const mat& Rb = ld_blocks[b]; int s = block_start[b]; int e = block_end[b]; - arma::vec beta_blk = beta.subvec(s, e); - loss += arma::as_scalar(beta_blk.t() * Rb * beta_blk); + vec beta_blk = beta.subvec(s, e); + loss += as_scalar(beta_blk.t() * Rb * beta_blk); } loss_vec(i) = loss; - fbeta_vec(i) = loss + 2.0 * lambda(i) * arma::sum(arma::abs(beta)); + fbeta_vec(i) = loss + 2.0 * lambda(i) * sum(abs(beta)); } - return List::create( - Named("beta") = beta_mat, - Named("lambda") = lambda, - Named("conv") = conv_vec, - Named("loss") = loss_vec, - Named("fbeta") = fbeta_vec - ); + using namespace cpp11::literals; + writable::list result({ + "beta"_nm = as_doubles_matrix(beta_mat), + "lambda"_nm = as_doubles(lambda), + "conv"_nm = as_integers(conv_vec), + "loss"_nm = as_doubles(loss_vec), + "fbeta"_nm = as_doubles(fbeta_vec) + }); + + return result; } diff --git a/src/prscs_mcmc.cpp b/src/prscs_mcmc.cpp index 88f3f5934..61be78f80 100644 --- a/src/prscs_mcmc.cpp +++ b/src/prscs_mcmc.cpp @@ -1,73 +1,78 @@ /** * @file prs_cs_wrapper.cpp - * @brief Rcpp wrapper for the prs_cs function. + * @brief cpp11 wrapper for the prs_cs function. */ -#include +#include +#include #include "prscs_mcmc.h" -// [[Rcpp::depends(RcppArmadillo)]] +using namespace cpp11; +using namespace arma; + /** - * @brief Rcpp wrapper for the prs_cs function. + * @brief cpp11 wrapper for the prs_cs function. * * @param a Shape parameter for the prior distribution of psi. * @param b Scale parameter for the prior distribution of psi. - * @param phi Global shrinkage parameter. If nullptr, it will be estimated automatically. + * @param phi Global shrinkage parameter. If NULL, it will be estimated automatically. * @param bhat Vector of effect sizes. - * @param maf Vector of minor allele frequencies. If nullptr, it is assumed to be a vector of zeros. + * @param maf Vector of minor allele frequencies. If NULL, it is assumed to be a vector of zeros. * @param n Sample size. * @param ld_blk List of LD blocks. * @param n_iter Number of MCMC iterations. * @param n_burnin Number of burn-in iterations. * @param thin Thinning interval. * @param verbose Whether to print verbose output. - * @param seed Random seed. If nullptr, no seed is set. + * @param seed Random seed. If NULL, no seed is set. * @return A list containing the posterior estimates. */ -// [[Rcpp::export]] -Rcpp::List prs_cs_rcpp(double a, double b, Rcpp::Nullable phi, - Rcpp::NumericVector bhat, Rcpp::Nullable maf, - int n, Rcpp::List ld_blk, +[[cpp11::register]] +cpp11::writable::list prs_cs_rcpp(double a, double b, sexp phi, + doubles bhat, sexp maf, + int n, list ld_blk, int n_iter, int n_burnin, int thin, - bool verbose, Rcpp::Nullable seed) { - // Convert Rcpp types to C++ types - std::vector bhat_vec = Rcpp::as >(bhat); + bool verbose, sexp seed) { + // Convert cpp11 types to C++ types + std::vector bhat_vec = cpp11::as_cpp>(bhat); std::vector maf_vec; - if (maf.isNotNull()) { - maf_vec = Rcpp::as >(maf.get()); + if (maf != R_NilValue) { + maf_vec = cpp11::as_cpp>(maf); } else { maf_vec = std::vector(bhat_vec.size(), 0.0); // Populate with zeros if maf is NULL } - std::vector ld_blk_vec; + std::vector ld_blk_vec; for (int i = 0; i < ld_blk.size(); ++i) { - ld_blk_vec.push_back(Rcpp::as(ld_blk[i])); + ld_blk_vec.push_back(as_Mat(doubles_matrix<>(ld_blk[i]))); } // Use stack variable to avoid heap allocation and memory leak risk. double phi_val = 0.0; double* phi_ptr = nullptr; - if (phi.isNotNull()) { - phi_val = Rcpp::as(phi); + if (phi != R_NilValue) { + phi_val = cpp11::as_cpp(phi); phi_ptr = &phi_val; } unsigned int seed_val = 0; - if (seed.isNotNull()) { - seed_val = Rcpp::as(seed); + if (seed != R_NilValue) { + seed_val = cpp11::as_cpp(seed); } else { seed_val = std::random_device{}(); } - std::map output = prs_cs_mcmc(a, b, phi_ptr, bhat_vec, maf_vec, n, ld_blk_vec, + std::map output = prs_cs_mcmc(a, b, phi_ptr, bhat_vec, maf_vec, n, ld_blk_vec, n_iter, n_burnin, thin, verbose, seed_val); - // Convert the output to an Rcpp::List - Rcpp::List result; - result["beta_est"] = output["beta_est"]; - result["psi_est"] = output["psi_est"]; - result["sigma_est"] = output["sigma_est"](0); - result["phi_est"] = output["phi_est"](0); + // Convert the output to a list + using namespace cpp11::literals; + writable::list result({ + "beta_est"_nm = as_doubles(output["beta_est"]), + "psi_est"_nm = as_doubles(output["psi_est"]), + "sigma_est"_nm = cpp11::as_sexp(output["sigma_est"](0)), + "phi_est"_nm = cpp11::as_sexp(output["phi_est"](0)) + }); return result; } diff --git a/src/prscs_mcmc.h b/src/prscs_mcmc.h index ac8b9f8f3..70e9c9ad5 100644 --- a/src/prscs_mcmc.h +++ b/src/prscs_mcmc.h @@ -6,12 +6,11 @@ #ifndef MCMC_HPP #define MCMC_HPP -#include +#include #include #include #include #include -#include #include /** @@ -195,7 +194,7 @@ std::map prs_cs_mcmc(double a, double b, double* phi, int n_iter, int n_burnin, int thin, bool verbose, unsigned int seed) { if (verbose) { - std::cout << "Running Markov Chain Monte Carlo (MCMC) sampler..." << std::endl; + Rprintf("Running Markov Chain Monte Carlo (MCMC) sampler...\n"); } // Derived statistics @@ -229,7 +228,7 @@ std::map prs_cs_mcmc(double a, double b, double* phi, // MCMC for (int itr = 1; itr <= n_iter; ++itr) { if (verbose && itr % 100 == 0) { - std::cout << "Iteration " << std::setw(4) << itr << " of " << n_iter << std::endl; + Rprintf("Iteration %4d of %d\n", itr, n_iter); } int mm = 0; @@ -313,11 +312,11 @@ std::map prs_cs_mcmc(double a, double b, double* phi, // Print estimated phi if (verbose && phi_updt) { - std::cout << "Estimated global shrinkage parameter: " << phi_est << std::endl; + Rprintf("Estimated global shrinkage parameter: %g\n", phi_est); } if (verbose) { - std::cout << "MCMC sampling completed." << std::endl; + Rprintf("MCMC sampling completed.\n"); } return output; diff --git a/src/qtl_enrichment.cpp b/src/qtl_enrichment.cpp index 99a2027cc..6f59377de 100644 --- a/src/qtl_enrichment.cpp +++ b/src/qtl_enrichment.cpp @@ -1,33 +1,44 @@ #include "qtl_enrichment.hpp" -// [[Rcpp::export]] -Rcpp::List qtl_enrichment_rcpp( +[[cpp11::register]] +cpp11::writable::list qtl_enrichment_rcpp( SEXP r_gwas_pip, SEXP r_qtl_susie_fit, double pi_gwas = 0, double pi_qtl = 0, int ImpN = 25, double shrinkage_lambda = 1.0, + bool double_shrinkage = false, + bool bessel_correction = true, int num_threads = 1) { // Convert r_gwas_pip to C++ type - Rcpp::NumericVector gwas_pip_vec = Rcpp::as(r_gwas_pip); - std::vector gwas_pip = Rcpp::as >(gwas_pip_vec); - std::vector gwas_pip_names = Rcpp::as >(gwas_pip_vec.names()); + doubles gwas_pip_vec(r_gwas_pip); + std::vector gwas_pip = cpp11::as_cpp>(gwas_pip_vec); + cpp11::strings pip_names(gwas_pip_vec.attr("names")); + std::vector gwas_pip_names; + gwas_pip_names.reserve(pip_names.size()); + for (int i = 0; i < pip_names.size(); ++i) { + gwas_pip_names.push_back(std::string(pip_names[i])); + } // Convert r_qtl_susie_fit to C++ type - Rcpp::List susie_fit_list(r_qtl_susie_fit); + list susie_fit_list(r_qtl_susie_fit); std::vector susie_fits; for (int i = 0; i < susie_fit_list.size(); ++i) { - SuSiEFit susie_fit(Rcpp::wrap(susie_fit_list[i])); + SuSiEFit susie_fit(susie_fit_list[i]); susie_fits.push_back(susie_fit); } - std::map output = qtl_enrichment_workhorse(susie_fits, gwas_pip, gwas_pip_names, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, num_threads); + std::map output = qtl_enrichment_workhorse(susie_fits, gwas_pip, gwas_pip_names, pi_gwas, pi_qtl, ImpN, shrinkage_lambda, double_shrinkage, bessel_correction, num_threads); - // Convert std::map to Rcpp::List - Rcpp::List output_list; + // Convert std::map to list + using namespace cpp11::literals; + writable::list output_list; + writable::strings names; for (auto const& element : output) { - output_list[element.first] = element.second; + output_list.push_back(cpp11::as_sexp(element.second)); + names.push_back(element.first); } + output_list.attr("names") = names; return output_list; } diff --git a/src/qtl_enrichment.hpp b/src/qtl_enrichment.hpp index 57a0c1380..7eb092c12 100644 --- a/src/qtl_enrichment.hpp +++ b/src/qtl_enrichment.hpp @@ -1,6 +1,7 @@ #ifndef QTL_ENRICHMENT_HPP #define QTL_ENRICHMENT_HPP -#include +#include +#include #include #include #include @@ -10,54 +11,56 @@ #include #include -// Enable C++11 -// [[Rcpp::plugins(cpp11)]] -// Enable openmp -// [[Rcpp::plugins(openmp)]] -// Import Armadillo -// [[Rcpp::depends(RcppArmadillo)]] +using namespace cpp11; +using namespace arma; class SuSiEFit { public: std::vector variable_names; -arma::mat alpha; +mat alpha; std::vector prior_variance; SuSiEFit(SEXP r_susie_fit) { - Rcpp::List susie_fit(r_susie_fit); + list susie_fit(r_susie_fit); + + doubles pip_vec(susie_fit["pip"]); + // Get names from the pip vector + cpp11::strings pip_names(pip_vec.attr("names")); + variable_names.reserve(pip_names.size()); + for (int i = 0; i < pip_names.size(); ++i) { + variable_names.push_back(std::string(pip_names[i])); + } - Rcpp::NumericVector pip_vec = Rcpp::as(susie_fit["pip"]); - // std::vector pip = Rcpp::as >(pip_vec); - variable_names = Rcpp::as >(pip_vec.names()); - alpha = Rcpp::as(susie_fit["alpha"]); - prior_variance = Rcpp::as >(susie_fit["prior_variance"]); + alpha = as_Mat(doubles_matrix<>(susie_fit["alpha"])); + prior_variance = cpp11::as_cpp>(susie_fit["prior_variance"]); if (alpha.n_rows != prior_variance.size()) { - Rcpp::stop("The number of rows in alpha must match the length of prior_variance."); + cpp11::stop("The number of rows in alpha must match the length of prior_variance."); } // Check if all elements in prior_variance are not greater than 0 if (std::all_of(prior_variance.begin(), prior_variance.end(), [](double x) { return x <= 0; })) { - Rcpp::stop("At least one element in prior_variance must be greater than 0."); + cpp11::stop("At least one element in prior_variance must be greater than 0."); } // Filter out rows with prior_variance = 0 - std::vector valid_rows; + std::vector valid_rows; for (size_t i = 0; i < prior_variance.size(); ++i) { if (prior_variance[i] > 0) { valid_rows.push_back(i); } } - alpha = alpha.rows(arma::uvec(valid_rows)); + alpha = alpha.rows(uvec(valid_rows)); prior_variance.erase(std::remove(prior_variance.begin(), prior_variance.end(), 0), prior_variance.end()); // Add a check to make sure each row of alpha sums to 1 - for (arma::uword i = 0; i < alpha.n_rows; ++i) { - double row_sum = arma::sum(alpha.row(i)); + for (uword i = 0; i < alpha.n_rows; ++i) { + double row_sum = sum(alpha.row(i)); if (std::abs(row_sum - 1.0) > 1e-6) { - Rcpp::stop("Row " + std::to_string(i + 1) + " of single effect PIP matrix (alpha) does not sum to 1. It is: " + std::to_string(row_sum)); + cpp11::stop("Row %d of single effect PIP matrix (alpha) does not sum to 1. It is: %g", + (int)(i + 1), row_sum); } } } @@ -65,8 +68,9 @@ SuSiEFit(SEXP r_susie_fit) { std::vector impute_qtn(std::mt19937 &gen) const { std::vector qtn_names; - for (arma::uword i = 0; i < alpha.n_rows; ++i) { - std::vector alpha_row(alpha.colptr(i), alpha.colptr(i) + alpha.n_cols); + for (uword i = 0; i < alpha.n_rows; ++i) { + arma::rowvec row_i = alpha.row(i); + std::vector alpha_row(row_i.begin(), row_i.end()); std::discrete_distribution<> dist(alpha_row.begin(), alpha_row.end()); int random_index = dist(gen); qtn_names.push_back(variable_names[random_index]); @@ -76,40 +80,43 @@ std::vector impute_qtn(std::mt19937 &gen) const { } }; -std::vector filter_outliers( +std::vector filter_outlier_indices( const std::vector& estimates, const std::vector& variances, double prior_variance, - double threshold = 3.0) + bool bessel_correction = true, + double threshold = 3.0) { + size_t n = estimates.size(); double mean = 0.0; double sd = 0.0; std::vector shrinkage_ests; // Calculate shrinkage estimates and mean - for(size_t i = 0; i < estimates.size(); ++i) { - double shrinkage = (estimates[i] * prior_variance) / + for(size_t i = 0; i < n; ++i) { + double shrinkage = (estimates[i] * prior_variance) / (prior_variance + variances[i]); shrinkage_ests.push_back(shrinkage); mean += shrinkage; } - mean /= estimates.size(); + mean /= n; // Calculate standard deviation - for(size_t i = 0; i < shrinkage_ests.size(); ++i) { + for(size_t i = 0; i < n; ++i) { sd += pow(shrinkage_ests[i] - mean, 2); } - sd = sqrt(sd / (shrinkage_ests.size() - 1)); + double denom = bessel_correction ? (n - 1) : n; + sd = sqrt(sd / denom); - // Filter outliers - std::vector filtered; - for(size_t i = 0; i < estimates.size(); ++i) { + // Return indices of non-outlier elements + std::vector kept; + for(size_t i = 0; i < n; ++i) { if(fabs(shrinkage_ests[i] - mean) <= threshold * sd) { - filtered.push_back(estimates[i]); + kept.push_back(i); } } - return filtered; + return kept; } std::vector run_EM( @@ -166,22 +173,26 @@ std::vector run_EM( e0g0 += total_snp - (e0g0 + e0g1 + e1g0 + e1g1); double a1_new = log(e1g1 * e0g0 / (e1g0 * e0g1)); - a1 = a1_new; - a0 = log(e0g1 / e0g0); // a0 = log((e0g1+1)/(e0g0+1)); - r0 = exp(a0); - r1 = exp(a0 + a1); - var1 = (1.0 / e0g0 + 1.0 / e1g0 + 1.0 / e1g1 + 1.0 / e0g1); - var0 = (1.0 / e0g1 + 1.0 / e0g0); if (fabs(a1_new - a1) < a1_tol || iter >= max_iter) { + a1 = a1_new; + a0 = log(e0g1 / e0g0); + var1 = (1.0 / e0g0 + 1.0 / e1g0 + 1.0 / e1g1 + 1.0 / e0g1); + var0 = (1.0 / e0g1 + 1.0 / e0g0); break; } + + a1 = a1_new; + a0 = log(e0g1 / e0g0); + r0 = exp(a0); + r1 = exp(a0 + a1); + if (iter % 100 == 0) { - Rcpp::Rcout << "EM Iteration " << iter << ": a0 = " << a0 << ", a1 = " << a1 << std::endl; + Rprintf("EM Iteration %d: a0 = %g, a1 = %g\n", iter, a0, a1); } } if (iter == max_iter) { - Rcpp::Rcout << "WARNING: EM algorithm did not converge after " << iter << "iterations!" << std::endl; + Rprintf("WARNING: EM algorithm did not converge after %d iterations!\n", iter); } std::vector av; @@ -201,6 +212,8 @@ std::map qtl_enrichment_workhorse( double pi_qtl, int ImpN, double shrinkage_lambda, + bool double_shrinkage = false, + bool bessel_correction = true, int num_threads = 4) { @@ -218,7 +231,7 @@ std::map qtl_enrichment_workhorse( // pi_gwas = sum(gwas_pip) / total_snp double total_snp = std::accumulate(gwas_pip.begin(), gwas_pip.end(), 0.0) / pi_gwas; - Rcpp::Rcout << "Fine-mapped GWAS and QTL data loaded successfully for enrichment analysis!" << std::endl; + Rprintf("Fine-mapped GWAS and QTL data loaded successfully for enrichment analysis!\n"); #pragma omp parallel for num_threads(num_threads) for (int k = 0; k < ImpN; k++) { @@ -228,7 +241,7 @@ std::map qtl_enrichment_workhorse( // Use QTL to annotate GWAS variants std::vector annotation_vector(gwas_pip.size(), 0); - int missing_qtl_count = 0; // Counter for xQTL not in gwas_variant_index + int missing_qtl_count = 0; int total_qtl_count = 0; for (size_t i = 0; i < qtl_susie_fits.size(); i++) { @@ -236,7 +249,6 @@ std::map qtl_enrichment_workhorse( for (const auto &variant : variants) { auto it = gwas_variant_index.find(variant); if (it != gwas_variant_index.end()) { - // Update annotation_vector only if variant is found annotation_vector[it->second] = 1; } else { ++missing_qtl_count; @@ -244,7 +256,6 @@ std::map qtl_enrichment_workhorse( } total_qtl_count += variants.size(); } - // Calculate the proportion of missing variants double missing_variant_proportion = static_cast(missing_qtl_count) / total_qtl_count; std::vector rst = run_EM(gwas_pip, annotation_vector, pi_gwas, pi_qtl, total_snp); @@ -254,63 +265,98 @@ std::map qtl_enrichment_workhorse( a1_vec[k] = rst[1]; v0_vec[k] = rst[2]; v1_vec[k] = rst[3]; - Rcpp::Rcout << "Proportion of xQTL missing from GWAS variants: " << missing_variant_proportion << " in MI round " << k << std::endl; + Rprintf("Proportion of xQTL missing from GWAS variants: %g in MI round %d\n", + missing_variant_proportion, k); } } - Rcpp::Rcout << "EM updates completed!" << std::endl; - - // Apply outlier filtering if shrinkage is specified - std::vector filtered_a1; - std::vector filtered_v1; - if (shrinkage_lambda > 0) { - filtered_a1 = filter_outliers(a1_vec, v1_vec, 1.0/shrinkage_lambda); - filtered_v1.reserve(filtered_a1.size()); - for(size_t i = 0; i < a1_vec.size(); ++i) { - if(std::find(filtered_a1.begin(), filtered_a1.end(), a1_vec[i]) != filtered_a1.end()) { - filtered_v1.push_back(v1_vec[i]); - } + Rprintf("EM updates completed!\n"); + + // Apply outlier filtering if shrinkage is specified. + // Use index-based filtering to keep all four vectors aligned. + double pv = (shrinkage_lambda == 0) ? -1.0 : 1.0 / shrinkage_lambda; + std::vector kept_indices; + if (pv > 0) { + kept_indices = filter_outlier_indices(a1_vec, v1_vec, pv, bessel_correction); + if (kept_indices.size() < static_cast(ImpN)) { + Rprintf("Outlier filtering removed %d MI round(s)\n", + ImpN - static_cast(kept_indices.size())); } } else { - filtered_a1 = a1_vec; - filtered_v1 = v1_vec; + kept_indices.resize(ImpN); + std::iota(kept_indices.begin(), kept_indices.end(), 0); } + size_t m = kept_indices.size(); + + // MI combining using only surviving rounds double a0_est = 0; double a1_est = 0; double var0 = 0; double var1 = 0; - for (size_t k = 0; k < filtered_a1.size(); k++) { + for (size_t i = 0; i < m; i++) { + size_t k = kept_indices[i]; a0_est += a0_vec[k]; - a1_est += filtered_a1[k]; + a1_est += a1_vec[k]; var0 += v0_vec[k]; - var1 += filtered_v1[k]; + var1 += v1_vec[k]; } - a0_est /= filtered_a1.size(); - a1_est /= filtered_a1.size(); + a0_est /= m; + a1_est /= m; double bv0 = 0; double bv1 = 0; - for (size_t k = 0; k < filtered_a1.size(); k++) { + for (size_t i = 0; i < m; i++) { + size_t k = kept_indices[i]; bv0 += pow(a0_vec[k] - a0_est, 2.0); - bv1 += pow(filtered_a1[k] - a1_est, 2.0); + bv1 += pow(a1_vec[k] - a1_est, 2.0); } - bv0 /= (filtered_a1.size() - 1); - bv1 /= (filtered_a1.size() - 1); - var0 /= filtered_a1.size(); - var1 /= filtered_a1.size(); + bv0 /= (m - 1); + bv1 /= (m - 1); + var0 /= m; + var1 /= m; - double sd0 = sqrt(var0 + bv0 * (filtered_a1.size() + 1) / filtered_a1.size()); - double sd1 = sqrt(var1 + bv1 * (filtered_a1.size() + 1) / filtered_a1.size()); + double sd0 = sqrt(var0 + bv0 * (m + 1.0) / m); + double sd1 = sqrt(var1 + bv1 * (m + 1.0) / m); double a1_est_ns = a1_est; double sd1_ns = sd1; // Apply shrinkage - double pv = (shrinkage_lambda == 0) ? -1.0 : 1.0/shrinkage_lambda; if (pv > 0) { - a1_est = (a1_est_ns * pv) / (pv + sd1_ns * sd1_ns); - sd1 = sqrt( 1.0 / (1.0 / pv + 1 / (sd1_ns * sd1_ns)) ); + if (double_shrinkage) { + // Double shrinkage (matches upstream fastenloc): + // 1. Shrink each MI estimate individually + double a1_shrink_est = 0; + double var1_shrink = 0; + std::vector a1_shrink_vec; + for (size_t i = 0; i < m; i++) { + size_t k = kept_indices[i]; + double post_a1 = (a1_vec[k] * pv) / (pv + v1_vec[k]); + double post_var = 1.0 / (1.0 / pv + 1.0 / v1_vec[k]); + a1_shrink_vec.push_back(post_a1); + a1_shrink_est += post_a1; + var1_shrink += post_var; + } + a1_shrink_est /= m; + var1_shrink /= m; + + // Between-imputation variance of shrunk estimates + double bv1_shrink = 0; + for (size_t i = 0; i < m; i++) { + bv1_shrink += pow(a1_shrink_vec[i] - a1_shrink_est, 2.0); + } + bv1_shrink /= (m - 1); + double sd1_shrink = sqrt(var1_shrink + bv1_shrink * (m + 1.0) / m); + + // 2. Shrink the combined estimate again + a1_est = (a1_shrink_est * pv) / (pv + sd1_shrink * sd1_shrink); + sd1 = sqrt(1.0 / (1.0 / pv + 1.0 / (sd1_shrink * sd1_shrink))); + } else { + // Single shrinkage: shrink the MI-combined estimate once + a1_est = (a1_est_ns * pv) / (pv + sd1_ns * sd1_ns); + sd1 = sqrt(1.0 / (1.0 / pv + 1.0 / (sd1_ns * sd1_ns))); + } } a0_est = log(pi_gwas / (1 + pi_qtl * exp(a1_est) - pi_qtl - pi_gwas)); @@ -333,7 +379,7 @@ std::map qtl_enrichment_workhorse( output_map["Alternative (coloc) p1"] = p1; output_map["Alternative (coloc) p2"] = p2; output_map["Alternative (coloc) p12"] = p12; - output_map["Effective MI rounds"] = static_cast(filtered_a1.size()); + output_map["Effective MI rounds"] = static_cast(m); return output_map; } diff --git a/src/sdpr.cpp b/src/sdpr.cpp index 3670d5e90..090561a34 100644 --- a/src/sdpr.cpp +++ b/src/sdpr.cpp @@ -1,53 +1,60 @@ -#include +#include +#include #include #include #include "sdpr_mcmc.h" -// Rcpp interface function -// [[Rcpp::export]] -Rcpp::List sdpr_rcpp( - const std::vector& bhat, - const Rcpp::List& LD, - int n, - Rcpp::Nullable per_variant_sample_size = R_NilValue, - Rcpp::Nullable array = R_NilValue, - double a = 0.1, - double c = 1.0, - size_t M = 1000, - double a0k = 0.5, - double b0k = 0.5, - int iter = 1000, - int burn = 200, - int thin = 5, - unsigned n_threads = 1, - int opt_llk = 1, - bool verbose = true, - Rcpp::Nullable seed = R_NilValue +using namespace cpp11; +using namespace arma; + +// cpp11 interface function +[[cpp11::register]] +cpp11::writable::list sdpr_rcpp( + const doubles& bhat_r, + const list& LD, + int n, + sexp per_variant_sample_size = R_NilValue, + sexp array = R_NilValue, + double a = 0.1, + double c = 1.0, + int M = 1000, + double a0k = 0.5, + double b0k = 0.5, + int iter = 1000, + int burn = 200, + int thin = 5, + int n_threads = 1, + int opt_llk = 1, + bool verbose = true, + sexp seed = R_NilValue ) { - // Convert Rcpp::List to std::vector - std::vector ref_ld_mat; + // Convert inputs to C++ types + std::vector bhat = cpp11::as_cpp>(bhat_r); + + // Convert list to std::vector + std::vector ref_ld_mat; for (int i = 0; i < LD.size(); i++) { - ref_ld_mat.push_back(Rcpp::as(LD[i])); + ref_ld_mat.push_back(as_Mat(doubles_matrix<>(LD[i]))); } // Initialize per_variant_sample_size and array if NULL std::vector sz; std::vector arr; - if (per_variant_sample_size.isNotNull()) { - sz = Rcpp::as >(per_variant_sample_size); + if (per_variant_sample_size != R_NilValue) { + sz = cpp11::as_cpp>(per_variant_sample_size); } else { sz = std::vector(bhat.size(), n); } - if (array.isNotNull()) { - arr = Rcpp::as >(array); + if (array != R_NilValue) { + arr = cpp11::as_cpp>(array); } else { arr = std::vector(bhat.size(), 1); } // Resolve seed unsigned int seed_val = 0; - if (seed.isNotNull()) { - seed_val = Rcpp::as(seed); + if (seed != R_NilValue) { + seed_val = cpp11::as_cpp(seed); } else { seed_val = std::random_device{}(); } @@ -56,15 +63,16 @@ Rcpp::List sdpr_rcpp( mcmc_data data(bhat, ref_ld_mat, sz, arr); // Call the mcmc function - std::unordered_map results = mcmc( + std::unordered_map results = mcmc( data, n, a, c, M, a0k, b0k, iter, burn, thin, n_threads, opt_llk, verbose, seed_val ); - // Convert results to Rcpp::List - Rcpp::List output = Rcpp::List::create( - Rcpp::Named("beta_est") = results["beta"], - Rcpp::Named("h2") = results["h2"] - ); + // Convert results to list + using namespace cpp11::literals; + writable::list output({ + "beta_est"_nm = as_doubles(results["beta"]), + "h2"_nm = as_doubles(results["h2"]) + }); return output; } diff --git a/src/sdpr_mcmc.cpp b/src/sdpr_mcmc.cpp index f1d072025..0abd42bc2 100644 --- a/src/sdpr_mcmc.cpp +++ b/src/sdpr_mcmc.cpp @@ -23,7 +23,8 @@ // platform-optimal SIMD (NEON on ARM, SSE/AVX on x86) through the // underlying BLAS/compiler auto-vectorization. -#include +#include +#include #include #include #include @@ -55,11 +56,11 @@ void MCMC_state::sample_sigma2() { cluster_var[i] = 1.0 / dist(r); if (std::isinf(cluster_var[i])) { cluster_var[i] = 1e5; - Rcpp::Rcerr << "Cluster variance is infinite." << std::endl; + REprintf("Cluster variance is infinite.\n"); } else if (cluster_var[i] == 0) { cluster_var[i] = 1e-10; - Rcpp::Rcerr << "Cluster variance is zero." << std::endl; + REprintf("Cluster variance is zero.\n"); } } } @@ -569,16 +570,14 @@ std::unordered_map mcmc( if (verbose && j % 100 == 0) { state.compute_h2(data); - Rcpp::Rcout << j << " iter. h2: " - << state.h2 * square(state.eta) - << " max beta: " - << arma::max(state.beta) * state.eta << endl; + Rprintf("%d iter. h2: %g max beta: %g\n", + j, state.h2 * square(state.eta), + arma::max(state.beta) * state.eta); } } if (verbose) { - Rcpp::Rcout << "h2: " << samples.h2 - << " max: " << arma::max(samples.beta) << endl; + Rprintf("h2: %g max: %g\n", samples.h2, arma::max(samples.beta)); } std::unordered_map results; diff --git a/src/sdpr_mcmc.h b/src/sdpr_mcmc.h index 1c7233544..46f0ddd42 100644 --- a/src/sdpr_mcmc.h +++ b/src/sdpr_mcmc.h @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/tests/testthat/_problems/test_LD-1246.R b/tests/testthat/_problems/test_LD-1246.R new file mode 100644 index 000000000..aad8db313 --- /dev/null +++ b/tests/testthat/_problems/test_LD-1246.R @@ -0,0 +1,55 @@ +# Extracted from test_LD.R:1246 + +# prequel ---------------------------------------------------------------------- +context("LD") +library(tidyverse) +generate_dummy_data <- function() { + region <- data.frame( + chrom = "chr1", + start = c(1000), + end = c(1190) + ) + meta_df <- data.frame( + chrom = "chr1", + start = c(1000, 1200, 1400, 1600, 1800), + end = c(1200, 1400, 1600, 1800, 2000), + path = c( + "./test_data/LD_block_1.chr1_1000_1200.float16.txt.xz,./test_data/LD_block_1.chr1_1000_1200.float16.bim", + "./test_data/LD_block_2.chr1_1200_1400.float16.txt.xz,./test_data/LD_block_2.chr1_1200_1400.float16.bim", + "./test_data/LD_block_3.chr1_1400_1600.float16.txt.xz,./test_data/LD_block_3.chr1_1400_1600.float16.bim", + "./test_data/LD_block_4.chr1_1600_1800.float16.txt.xz,./test_data/LD_block_4.chr1_1600_1800.float16.bim", + "./test_data/LD_block_5.chr1_1800_2000.float16.txt.xz,./test_data/LD_block_5.chr1_1800_2000.float16.bim" + )) + return(list(region = region, meta = meta_df)) +} +generate_multi_block_data <- function() { + region <- data.frame( + chrom = "chr1", + start = c(1000), + end = c(1500) + ) + meta_df <- data.frame( + chrom = "chr1", + start = c(1000, 1200, 1400, 1600, 1800), + end = c(1200, 1400, 1600, 1800, 2000), + path = c( + "./test_data/LD_block_1.chr1_1000_1200.float16.txt.xz,./test_data/LD_block_1.chr1_1000_1200.float16.bim", + "./test_data/LD_block_2.chr1_1200_1400.float16.txt.xz,./test_data/LD_block_2.chr1_1200_1400.float16.bim", + "./test_data/LD_block_3.chr1_1400_1600.float16.txt.xz,./test_data/LD_block_3.chr1_1400_1600.float16.bim", + "./test_data/LD_block_4.chr1_1600_1800.float16.txt.xz,./test_data/LD_block_4.chr1_1600_1800.float16.bim", + "./test_data/LD_block_5.chr1_1800_2000.float16.txt.xz,./test_data/LD_block_5.chr1_1800_2000.float16.bim" + )) + return(list(region = region, meta = meta_df)) +} +geno_test_data_dir <- test_path("test_data") +geno_region_all <- "chr21:17513228-17592874" + +# test ------------------------------------------------------------------------- +meta_file <- file.path(geno_test_data_dir, "ld_meta_precomp_nsamp_tmp.tsv") +on.exit(unlink(meta_file), add = TRUE) +writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) +cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) +result <- load_LD_matrix(meta_file, "chr1:1000-1190", n_sample = 500L) +expect_true("allele_freq" %in% names(result$ref_panel)) diff --git a/tests/testthat/test_LD.R b/tests/testthat/test_LD.R index 24a72aed4..203e7c368 100644 --- a/tests/testthat/test_LD.R +++ b/tests/testthat/test_LD.R @@ -928,3 +928,600 @@ test_that("extract_block_matrices warns and skips out-of-range blocks", { expect_equal(length(valid_blocks), 1) expect_equal(nrow(valid_blocks[[1]]), 2) }) + +# =========================================================================== +# resolve_ld_source: type detection with real fixtures +# =========================================================================== + +geno_test_data_dir <- test_path("test_data") +geno_region_all <- "chr21:17513228-17592874" + +test_that("resolve_ld_source detects PLINK2 from metadata", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_p2_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- pecotmr:::resolve_ld_source(meta_file) + expect_equal(result$type, "plink2") + expect_equal(result$meta_path, meta_file) +}) + +test_that("resolve_ld_source detects VCF from metadata", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_vcf_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.vcf.gz", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- pecotmr:::resolve_ld_source(meta_file) + expect_equal(result$type, "vcf") +}) + +test_that("resolve_ld_source detects GDS from metadata", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_gds_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.gds", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- pecotmr:::resolve_ld_source(meta_file) + expect_equal(result$type, "gds") +}) + +test_that("resolve_ld_source detects precomputed from metadata", { + # Existing LD block metadata with non-zero start/end + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_pre_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("chr1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- pecotmr:::resolve_ld_source(meta_file) + expect_equal(result$type, "precomputed") +}) + +test_that("resolve_ld_source errors on missing file", { + expect_error(pecotmr:::resolve_ld_source("/nonexistent/file.tsv"), "not found") +}) + +test_that("resolve_ld_source errors on 0:0 sentinel with non-genotype path", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_bad_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "nonexistent_prefix", sep = "\t"), "\n", + file = meta_file, append = TRUE) + expect_error(pecotmr:::resolve_ld_source(meta_file), "0:0 sentinel") +}) + +# =========================================================================== +# resolve_genotype_path_for_region +# =========================================================================== + +test_that("resolve_genotype_path_for_region resolves correct chromosome path", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_path_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- pecotmr:::resolve_genotype_path_for_region(meta_file, geno_region_all) + expect_equal(result, file.path(geno_test_data_dir, "test_variants")) +}) + +test_that("resolve_genotype_path_for_region errors on missing chromosome", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_nochr_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + expect_error( + pecotmr:::resolve_genotype_path_for_region(meta_file, geno_region_all), + "No entry for chromosome" + ) +}) + +# =========================================================================== +# load_LD_from_genotype with real fixtures +# =========================================================================== + +test_that("load_LD_from_genotype returns LD matrix with .afreq", { + skip_if_not_installed("pgenlibr") + plink_prefix <- file.path(geno_test_data_dir, "test_variants") + result <- pecotmr:::load_LD_from_genotype(plink_prefix, geno_region_all) + expect_true(is.list(result)) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) + expect_true(isSymmetric(result$LD_matrix)) + expect_false(result$is_genotype) + # ref_panel should have allele_freq from .afreq file + expect_true("allele_freq" %in% names(result$ref_panel)) + expect_true(all(result$ref_panel$allele_freq > 0)) + expect_true(all(result$ref_panel$allele_freq < 1)) + # block_metadata + expect_true(is.data.frame(result$block_metadata)) + expect_equal(nrow(result$block_metadata), 1L) +}) + +test_that("load_LD_from_genotype returns genotype matrix when requested", { + skip_if_not_installed("pgenlibr") + plink_prefix <- file.path(geno_test_data_dir, "test_variants") + result <- pecotmr:::load_LD_from_genotype(plink_prefix, geno_region_all, + return_genotype = TRUE) + expect_true(result$is_genotype) + expect_equal(nrow(result$LD_matrix), 100L) # samples + expect_equal(ncol(result$LD_matrix), 349L) # variants +}) + +test_that("load_LD_from_genotype computes variance with n_sample", { + skip_if_not_installed("pgenlibr") + plink_prefix <- file.path(geno_test_data_dir, "test_variants") + result <- pecotmr:::load_LD_from_genotype(plink_prefix, geno_region_all, + n_sample = 100L) + expect_true("variance" %in% names(result$ref_panel)) + expect_true("n_nomiss" %in% names(result$ref_panel)) + expect_equal(result$ref_panel$n_nomiss[1], 100L) + expect_true(all(result$ref_panel$variance > 0)) +}) + +test_that("load_LD_from_genotype falls back to computed AF without .afreq", { + skip_if_not_installed("VariantAnnotation") + vcf_path <- file.path(geno_test_data_dir, "test_variants.vcf.gz") + result <- suppressWarnings( + pecotmr:::load_LD_from_genotype(vcf_path, geno_region_all) + ) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) + expect_true(isSymmetric(result$LD_matrix)) + # Allele frequencies computed from genotypes + expect_true("allele_freq" %in% names(result$ref_panel)) + expect_true(all(result$ref_panel$allele_freq > 0)) + expect_true(all(result$ref_panel$allele_freq < 1)) +}) + +test_that("load_LD_from_genotype works with GDS files", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + gds_path <- file.path(geno_test_data_dir, "test_variants.gds") + result <- pecotmr:::load_LD_from_genotype(gds_path, geno_region_all) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) + expect_true(isSymmetric(result$LD_matrix)) +}) + +test_that("load_LD_from_genotype .afreq and computed AF are consistent", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + plink_prefix <- file.path(geno_test_data_dir, "test_variants") + gds_path <- file.path(geno_test_data_dir, "test_variants.gds") + res_afreq <- pecotmr:::load_LD_from_genotype(plink_prefix, geno_region_all) + res_computed <- pecotmr:::load_LD_from_genotype(gds_path, geno_region_all) + # Allele frequencies should be close (same data, different source) + expect_true(max(abs(res_afreq$ref_panel$allele_freq - res_computed$ref_panel$allele_freq)) < 0.01) +}) + +# =========================================================================== +# load_LD_matrix with real genotype fixtures via metadata +# =========================================================================== + +test_that("load_LD_matrix dispatches to PLINK2 genotype source", { + skip_if_not_installed("pgenlibr") + meta_file <- file.path(geno_test_data_dir, "ld_meta_ldmat_p2_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, geno_region_all) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) + expect_false(result$is_genotype) +}) + +test_that("load_LD_matrix dispatches to VCF genotype source", { + skip_if_not_installed("VariantAnnotation") + meta_file <- file.path(geno_test_data_dir, "ld_meta_ldmat_vcf_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.vcf.gz", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- suppressWarnings(load_LD_matrix(meta_file, geno_region_all)) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) +}) + +test_that("load_LD_matrix dispatches to GDS genotype source", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + meta_file <- file.path(geno_test_data_dir, "ld_meta_ldmat_gds_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.gds", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, geno_region_all) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 349L) +}) + +test_that("load_LD_matrix return_genotype='auto' returns X for genotype source", { + skip_if_not_installed("pgenlibr") + meta_file <- file.path(geno_test_data_dir, "ld_meta_ldmat_auto_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, geno_region_all, return_genotype = "auto") + expect_true(result$is_genotype) + expect_equal(nrow(result$LD_matrix), 100L) # samples + expect_equal(ncol(result$LD_matrix), 349L) # variants +}) + +test_that("load_LD_matrix return_genotype=TRUE errors for precomputed", { + meta_file <- gsub("//", "/", tempfile(pattern = "ld_meta_file", tmpdir = tempdir(), fileext = ".tsv")) + on.exit(unlink(meta_file), add = TRUE) + meta_df <- data.frame( + chrom = "chr1", start = 1000, end = 1200, + path = paste0( + "./test_data/LD_block_1.chr1_1000_1200.float16.txt.xz,", + "./test_data/LD_block_1.chr1_1000_1200.float16.bim" + ) + ) + write_delim(meta_df, meta_file, delim = "\t") + region <- data.frame(chrom = "chr1", start = 1000, end = 1190) + expect_error( + load_LD_matrix(meta_file, region, return_genotype = TRUE), + "genotype files" + ) +}) + +# =========================================================================== +# resolve_ld_source: PLINK1 detection +# =========================================================================== + +test_that("resolve_ld_source detects PLINK1 from metadata", { + skip_if_not_installed("snpStats") + meta_file <- file.path(geno_test_data_dir, "ld_meta_resolve_p1_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("22", "0", "0", "protocol_example.genotype", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- pecotmr:::resolve_ld_source(meta_file) + expect_equal(result$type, "plink1") +}) + +# =========================================================================== +# load_LD_matrix: precomputed blocks via real .cor.xz fixtures +# =========================================================================== + +test_that("load_LD_matrix loads single precomputed block", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_precomp_single_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, "chr1:1000-1190") + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 5L) + expect_true(isSymmetric(result$LD_matrix)) + expect_equal(length(result$LD_variants), 5L) + expect_true(all(grepl("^chr1:", result$LD_variants))) + expect_false(result$is_genotype) + # block_metadata should have one block + expect_equal(nrow(result$block_metadata), 1L) + # ref_panel should have variant info + expect_true("chrom" %in% names(result$ref_panel)) + expect_true("pos" %in% names(result$ref_panel)) +}) + +test_that("load_LD_matrix loads multiple precomputed blocks", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_precomp_multi_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + lines <- c( + paste("chrom", "start", "end", "path", sep = "\t"), + paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), + paste("1", "1200", "1400", + "LD_block_2.chr1_1200_1400.float16.txt.xz,LD_block_2.chr1_1200_1400.float16.bim", + sep = "\t"), + paste("1", "1400", "1600", + "LD_block_3.chr1_1400_1600.float16.txt.xz,LD_block_3.chr1_1400_1600.float16.bim", + sep = "\t") + ) + writeLines(lines, meta_file) + result <- load_LD_matrix(meta_file, "chr1:1000-1500") + expect_true(is.matrix(result$LD_matrix)) + # Should span blocks 1-3: 5 + 5 + 5 = 15 unique variants (no overlap in variant IDs) + expect_true(nrow(result$LD_matrix) >= 10) + expect_true(isSymmetric(result$LD_matrix)) + expect_true(nrow(result$block_metadata) >= 2) +}) + +test_that("load_LD_matrix with n_sample for precomputed blocks with freq data", { + # The 9-column bim format includes allele_freq, variance, n_nomiss; + # the 6-column bim does not. With 6-col bim and no allele_freq, + # n_sample cannot compute variance — ref_panel has base columns only. + meta_file <- file.path(geno_test_data_dir, "ld_meta_precomp_nsamp_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, "chr1:1000-1190", n_sample = 500L) + # ref_panel should always have basic variant info + expect_true(all(c("chrom", "pos", "A2", "A1", "variant_id") %in% names(result$ref_panel))) + # 6-col bim lacks allele_freq so variance computation is skipped + expect_false("variance" %in% names(result$ref_panel)) +}) + +# =========================================================================== +# process_LD_matrix: real .cor.xz fixtures +# =========================================================================== + +test_that("process_LD_matrix reads .cor.xz with explicit bim path", { + ld_file <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.txt.xz") + bim_file <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.bim") + result <- pecotmr:::process_LD_matrix(ld_file, bim_file) + expect_true(is.list(result)) + expect_true(is.matrix(result$LD_matrix)) + expect_equal(nrow(result$LD_matrix), 5L) + expect_equal(ncol(result$LD_matrix), 5L) + expect_true(isSymmetric(result$LD_matrix)) + # Diagonal should be 1 + expect_true(all(abs(diag(result$LD_matrix) - 1) < 1e-4)) + # Variant names should be chr:pos:A2:A1 format + expect_true(all(grepl("^chr1:", rownames(result$LD_matrix)))) + # LD_variants data frame + expect_true(is.data.frame(result$LD_variants)) + expect_true("variants" %in% names(result$LD_variants)) + expect_equal(nrow(result$LD_variants), 5L) +}) + +test_that("process_LD_matrix reads different blocks consistently", { + bim1 <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.bim") + bim2 <- file.path(geno_test_data_dir, "LD_block_2.chr1_1200_1400.float16.bim") + ld1 <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.txt.xz") + ld2 <- file.path(geno_test_data_dir, "LD_block_2.chr1_1200_1400.float16.txt.xz") + r1 <- pecotmr:::process_LD_matrix(ld1, bim1) + r2 <- pecotmr:::process_LD_matrix(ld2, bim2) + # Different blocks should have different variant positions + expect_false(any(rownames(r1$LD_matrix) %in% rownames(r2$LD_matrix))) +}) + +test_that("process_LD_matrix reads 9-column bim with allele_freq/variance/n_nomiss", { + ld_file <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.txt.xz") + bim_file <- file.path(geno_test_data_dir, "LD_block_1.chr1_1000_1200.float16.9col.bim") + result <- pecotmr:::process_LD_matrix(ld_file, bim_file) + expect_equal(nrow(result$LD_matrix), 5L) + expect_true(isSymmetric(result$LD_matrix)) + # 9-column bim should include extra columns + expect_true("allele_freq" %in% names(result$LD_variants)) + expect_true("variance" %in% names(result$LD_variants)) + expect_true("n_nomiss" %in% names(result$LD_variants)) + expect_equal(result$LD_variants$allele_freq, c(0.3, 0.4, 0.2, 0.5, 0.15)) + expect_equal(result$LD_variants$n_nomiss, rep(500, 5)) +}) + +test_that("load_LD_matrix propagates allele_freq/variance/n_nomiss from 9-col bim", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_precomp_9col_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.9col.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- load_LD_matrix(meta_file, "chr1:1000-1190") + # ref_panel should carry the extra columns from the 9-col bim + expect_true("allele_freq" %in% names(result$ref_panel)) + expect_true("variance" %in% names(result$ref_panel)) + expect_true("n_nomiss" %in% names(result$ref_panel)) + expect_equal(result$ref_panel$allele_freq, c(0.3, 0.4, 0.2, 0.5, 0.15)) + expect_equal(result$ref_panel$n_nomiss, rep(500, 5)) +}) + +# =========================================================================== +# get_regional_ld_meta: real .cor.xz fixtures +# =========================================================================== + +test_that("get_regional_ld_meta returns correct file paths for single block", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_regional_single_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + lines <- c( + paste("chrom", "start", "end", "path", sep = "\t"), + paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), + paste("1", "1200", "1400", + "LD_block_2.chr1_1200_1400.float16.txt.xz,LD_block_2.chr1_1200_1400.float16.bim", + sep = "\t") + ) + writeLines(lines, meta_file) + result <- pecotmr:::get_regional_ld_meta(meta_file, "chr1:1050-1150") + expect_true(is.list(result)) + expect_true(length(result$intersections$LD_file_paths) >= 1) + # All returned paths should exist + expect_true(all(file.exists(result$intersections$LD_file_paths))) + expect_true(all(file.exists(result$intersections$bim_file_paths))) +}) + +test_that("get_regional_ld_meta spans multiple blocks for wide region", { + meta_file <- file.path(geno_test_data_dir, "ld_meta_regional_multi_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + lines <- c( + paste("chrom", "start", "end", "path", sep = "\t"), + paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), + paste("1", "1200", "1400", + "LD_block_2.chr1_1200_1400.float16.txt.xz,LD_block_2.chr1_1200_1400.float16.bim", + sep = "\t"), + paste("1", "1400", "1600", + "LD_block_3.chr1_1400_1600.float16.txt.xz,LD_block_3.chr1_1400_1600.float16.bim", + sep = "\t") + ) + writeLines(lines, meta_file) + result <- pecotmr:::get_regional_ld_meta(meta_file, "chr1:1000-1500") + expect_true(length(result$intersections$LD_file_paths) >= 2) +}) + +# =========================================================================== +# drop_collinear_columns: strategy variants +# =========================================================================== + +test_that("drop_collinear_columns variance strategy removes lowest-variance column", { + set.seed(42) + X <- matrix(rnorm(100 * 4), 100, 4) + colnames(X) <- c("a", "b", "c", "d") + # Make column "c" have near-zero variance + X[, "c"] <- X[1, "c"] + result <- pecotmr:::drop_collinear_columns( + X, c("b", "c", "d"), strategy = "variance" + ) + expect_false("c" %in% colnames(result)) + expect_equal(ncol(result), 3L) +}) + +test_that("drop_collinear_columns response_correlation strategy works", { + set.seed(42) + X <- matrix(rnorm(100 * 3), 100, 3) + colnames(X) <- c("a", "b", "c") + y <- X[, "a"] + rnorm(100, sd = 0.1) # y correlates strongly with "a" + result <- pecotmr:::drop_collinear_columns( + X, c("a", "b", "c"), strategy = "response_correlation", response = y + ) + # Should keep "a" (highest |cor| with response) and remove one of b/c + expect_true("a" %in% colnames(result)) + expect_equal(ncol(result), 2L) +}) + +test_that("drop_collinear_columns response_correlation errors without response", { + X <- matrix(1:12, 4, 3) + colnames(X) <- c("a", "b", "c") + expect_error( + pecotmr:::drop_collinear_columns(X, c("a", "b"), strategy = "response_correlation"), + "response must be supplied" + ) +}) + +test_that("drop_collinear_columns with single problematic column removes it", { + X <- matrix(rnorm(40), 10, 4) + colnames(X) <- c("a", "b", "c", "d") + result <- pecotmr:::drop_collinear_columns(X, "b", strategy = "correlation") + expect_false("b" %in% colnames(result)) + expect_equal(ncol(result), 3L) +}) + +# =========================================================================== +# enforce_design_full_rank: additional strategies and fallback paths +# =========================================================================== + +test_that("enforce_design_full_rank variance strategy produces full rank", { + set.seed(42) + X <- matrix(rnorm(100 * 4), 100, 4) + X[, 4] <- X[, 1] + X[, 2] # rank deficient + colnames(X) <- c("a", "b", "c", "d") + C <- matrix(rnorm(100), 100, 1) + result <- enforce_design_full_rank(X, C, strategy = "variance") + full_design <- cbind(1, result, C) + expect_equal(qr(full_design)$rank, ncol(full_design)) + expect_true(ncol(result) < ncol(X)) +}) + +test_that("enforce_design_full_rank response_correlation strategy works", { + set.seed(42) + X <- matrix(rnorm(100 * 4), 100, 4) + X[, 4] <- X[, 1] + X[, 2] + colnames(X) <- c("a", "b", "c", "d") + C <- matrix(rnorm(100), 100, 1) + y <- X[, "a"] + rnorm(100, sd = 0.1) + result <- enforce_design_full_rank(X, C, strategy = "response_correlation", response = y) + full_design <- cbind(1, result, C) + expect_equal(qr(full_design)$rank, ncol(full_design)) +}) + +test_that("enforce_design_full_rank returns unchanged X when already full rank", { + set.seed(42) + X <- matrix(rnorm(100 * 3), 100, 3) + colnames(X) <- c("a", "b", "c") + C <- matrix(rnorm(100), 100, 1) + result <- enforce_design_full_rank(X, C, strategy = "correlation") + expect_equal(ncol(result), ncol(X)) +}) + +test_that("enforce_design_full_rank fallback to correlation pruning works", { + set.seed(42) + n <- 50 + p <- 10 + X <- matrix(rnorm(n * 3), n, 3) + # Create highly collinear columns that are hard for iterative removal + X <- cbind(X, X[, 1] + rnorm(n, sd = 1e-10), + X[, 2] + rnorm(n, sd = 1e-10), + X[, 3] + rnorm(n, sd = 1e-10), + X[, 1] + X[, 2] + rnorm(n, sd = 1e-10)) + colnames(X) <- paste0("v", seq_len(ncol(X))) + C <- matrix(rnorm(n), n, 1) + result <- enforce_design_full_rank(X, C, strategy = "correlation", + max_iterations = 2L) + full_design <- cbind(1, result, C) + expect_equal(qr(full_design)$rank, ncol(full_design)) +}) + +# =========================================================================== +# ld_clump_by_score: edge cases +# =========================================================================== + +test_that("ld_clump_by_score errors on empty matrix", { + skip_if_not_installed("bigsnpr") + skip_if_not_installed("bigstatsr") + X <- matrix(numeric(0), nrow = 10, ncol = 0) + expect_error(ld_clump_by_score(X, score = numeric(0), chr = integer(0), pos = integer(0)), + "at least one column") +}) + +test_that("ld_clump_by_score returns 1L for single variant", { + skip_if_not_installed("bigsnpr") + skip_if_not_installed("bigstatsr") + X <- matrix(c(0, 1, 2, 1, 0), ncol = 1) + result <- ld_clump_by_score(X, score = 1.0, chr = 1L, pos = 100L) + expect_equal(result, 1L) +}) + +test_that("ld_clump_by_score errors on mismatched score length", { + skip_if_not_installed("bigsnpr") + skip_if_not_installed("bigstatsr") + X <- matrix(rnorm(20), 5, 4) + expect_error(ld_clump_by_score(X, score = c(1, 2), chr = rep(1L, 4), pos = 1:4), + "length\\(score\\)") +}) + +test_that("ld_clump_by_score errors on mismatched chr/pos length", { + skip_if_not_installed("bigsnpr") + skip_if_not_installed("bigstatsr") + X <- matrix(rnorm(20), 5, 4) + expect_error(ld_clump_by_score(X, score = runif(4), chr = rep(1L, 2), pos = 1:4), + "chr and pos") +}) + +# =========================================================================== +# ld_prune_by_correlation: verbose paths +# =========================================================================== + +test_that("ld_prune_by_correlation verbose reports pruning", { + # Create matrix with correlated columns + set.seed(42) + base <- rnorm(100) + X <- cbind(base, base + rnorm(100, sd = 0.1), rnorm(100), rnorm(100), rnorm(100)) + colnames(X) <- paste0("v", 1:5) + expect_message( + ld_prune_by_correlation(X, cor_thres = 0.5, verbose = TRUE), + "pruned" + ) +}) + +test_that("ld_prune_by_correlation verbose reports no pruning", { + # Create a small matrix with no correlated columns + set.seed(42) + X <- matrix(rnorm(500), 100, 5) + colnames(X) <- paste0("v", 1:5) + expect_message( + ld_prune_by_correlation(X, cor_thres = 0.999, verbose = TRUE), + "no columns pruned" + ) +}) diff --git a/tests/testthat/test_data/LD_block_1.chr1_1000_1200.float16.9col.bim b/tests/testthat/test_data/LD_block_1.chr1_1000_1200.float16.9col.bim new file mode 100644 index 000000000..f90fbbbbd --- /dev/null +++ b/tests/testthat/test_data/LD_block_1.chr1_1000_1200.float16.9col.bim @@ -0,0 +1,5 @@ +1 chr1:1000_A_G 0 1000 A G 0.42 0.3 500 +1 chr1:1040_A_G 0 1040 A G 0.48 0.4 500 +1 chr1:1080_A_G 0 1080 A G 0.36 0.2 500 +1 chr1:1120_A_G 0 1120 A G 0.50 0.5 500 +1 chr1:1160_A_G 0 1160 A G 0.32 0.15 500 diff --git a/tests/testthat/test_data/test_covariates.tsv b/tests/testthat/test_data/test_covariates.tsv new file mode 100644 index 000000000..d8892dc32 --- /dev/null +++ b/tests/testthat/test_data/test_covariates.tsv @@ -0,0 +1,9 @@ +variable HG02461 HG02462 HG02464 HG02465 HG02561 HG02562 HG02568 HG02570 HG02571 HG02573 HG02574 HG02582 HG02583 HG02585 HG02586 HG02588 HG02589 HG02594 HG02595 HG02610 HG02611 HG02613 HG02614 HG02620 HG02621 HG02623 HG02624 HG02628 HG02629 HG02634 HG02635 HG02642 HG02643 HG02645 HG02646 HG02666 HG02667 HG02675 HG02676 HG02678 HG02679 HG02702 HG02703 HG02715 HG02716 HG02721 HG02722 HG02757 HG02759 HG02760 HG02763 HG02768 HG02769 HG02771 HG02772 HG02798 HG02799 HG02804 HG02805 HG02807 HG02808 HG02810 HG02811 HG02813 HG02814 HG02816 HG02817 HG02819 HG02820 HG02836 HG02837 HG02839 HG02840 HG02851 HG02852 HG02854 HG02855 HG02860 HG02861 HG02870 HG02878 HG02879 HG02881 HG02882 HG02884 HG02885 HG02887 HG02888 HG02890 HG02891 HG02895 HG02896 HG02922 HG02923 HG02938 HG02941 HG02943 HG02944 HG02946 HG02947 +PC1 -71.1089998670199 -48.7071428014871 -41.41724763476684 -60.52709270115074 -70.34350984182632 -58.42661625633345 -62.529369471979244 -61.47283811361393 -65.83188227447484 -58.88575787362738 -57.921703194045236 -73.19213251636852 -45.42955941954107 -53.962648897072604 -50.26991079556599 -60.46397323470066 -67.41723751665427 -74.20819763367928 -39.98731044510651 30.19731383400309 29.743348230043658 25.894825310390097 34.81111116932545 67.49470171696983 38.74743209626415 33.23221499155367 25.809649904132883 44.14391993719127 39.79695013994492 27.965281460783714 40.291496754160804 15.396438104374438 50.788313460745584 33.23681191058306 42.7466663286584 54.98078862557297 56.680427341882314 23.020527846883102 14.43057469160597 35.06780328084778 14.114662346473892 8.225083498414266 31.885002419494953 17.896568784911224 17.36760774500313 19.969091696434166 15.326394686339386 14.270213337145547 27.973329267654307 29.530292055448655 39.57398137059297 29.79611285379524 6.072241253765604 15.074852959895269 20.2203076743551 13.7422469129761 32.607344335390884 -70.6219527866923 29.549606488705614 -85.60768392339244 39.60727513874872 39.80519922722697 27.377684544037585 50.62895560984404 34.45298541246849 44.987881548982074 23.44152698658134 20.621452674740077 21.38261602723689 32.83324067415548 39.988730759597686 27.56898498271851 45.14446876243338 29.672832532112622 -83.22653464435602 36.46709233675554 -4.676250188960305 -17.99923729406466 5.112200230592233 9.517949541916503 38.55536117749737 29.79266281120034 -9.192383037597477 15.132026445096184 5.36743946783337 32.41735762782832 17.21189612647694 -6.384147249555953 -1.508510562850157 -18.46922843409644 -8.139383099903002 7.097788203808322 -64.6396070011274 -48.220852953421975 -63.88129073701509 -44.54276174075898 -42.8986691938169 -48.14232313771856 -56.18701808781295 -25.41618111044776 +PC2 6.922450578061993 11.503462311569434 1.165426854548868 -28.35421390846572 -2.994660583472838 21.2412350629899 -36.67391029540779 -17.827648751467926 -8.265452894940491 -4.659126182453915 9.971375291275999 17.85962624398964 8.247806517340486 19.13733487627525 7.682911025072778 -16.64657297017985 2.168350459469112 15.167708960290087 6.982031186832214 34.61339331984772 28.04450374643433 -56.09365739987396 34.543986291461685 15.218587012714291 21.143115411350948 46.07055611741021 37.83248793393217 -20.56499155203483 -16.47127144885554 16.388818914158758 13.991695232957099 -4.869032809965171 3.5490855804770143 25.47581516053749 -12.689912525084024 -17.465755232238376 -3.254515299789201 29.019760567109177 13.968028262558871 -23.89050811053974 15.433943504014895 26.346882426857295 -23.128539360795664 17.77775541532218 18.615150503133933 5.787467712455156 -1.3296672070612914 9.480102311985856 -16.894541001077982 18.35960191462575 -20.669174525121264 40.493790598490705 35.83453209721862 42.23623619937905 0.35979461902418153 12.90901565532876 33.056973829469555 21.308006194128872 -1.520565330529054 -10.802587992385016 -18.83332903850194 13.426523565789783 1.499333914593898 15.68961456680009 -9.480651269758374 8.683681383513937 4.935765243764978 16.23372354542272 13.632588100712656 30.76073961765991 38.90929494693567 47.352934157521744 -28.45347592539892 24.61016722059807 35.56530493343417 9.330457497817477 -35.15609482389649 -6.708609394717476 -44.55474227289764 -62.54550542766538 -53.29153819476417 -69.99433183676588 -51.280071531596235 -33.808285719883294 -40.35600684067456 -35.23177005625185 5.674163525765152 -69.2907496930874 -23.587337786288266 -5.220919165083801 -88.2291175431722 -79.81938498724097 -17.612246208299442 1.6412611653058602 -5.0140341950258795 25.738619847321253 10.95127134180427 41.00054716798823 22.034350629298245 9.955359020561158 +PC3 48.808036582434426 -24.439281751459244 4.460612425002515 27.40447709612694 8.388396980938007 -17.710201509944504 50.164572728409766 31.70167127313411 25.102597982035736 43.298387925957904 19.31495381442929 -15.80909848604841 3.1019854884672804 4.394836562602626 25.732742620928256 6.166526206925269 15.635048903856552 -18.635818109608294 28.327982222064744 15.374618337027627 -29.784712855260555 17.763677387567306 18.908675071007295 28.018975703983408 74.28807688917428 -22.68900533392051 -31.16519805160639 -59.162982478755254 -29.873417728331606 -3.4214801793631247 5.7736620856938705 -56.88158012670445 -51.144782070904924 28.710511055224448 11.576778144874867 40.96700579054565 24.583592299763822 -15.93334931843727 25.47104649098736 -4.39582714424289 -18.455028247383066 -24.328119601381406 14.637304136349055 -5.994281884812609 2.9433535201593486 18.689528647499525 -3.342185190639426 -25.091168431394973 -11.494075916984848 14.132843770016079 17.930979413387636 46.28776589222673 0.9065714214970013 -6.9985881957179705 8.557831140453303 -3.3750135052201014 9.579120936154622 -25.41634387639483 -31.316197416751795 -9.545254014946472 14.474919312773098 -3.6060423901369223 -47.37589685096412 8.843953711718902 29.62568063810674 25.445620196240547 33.779062999195496 -15.927094104890308 -30.454375026842012 -5.691146955596925 10.29526992071717 25.42769741530306 -10.768902150750169 -0.8442525518157374 -20.49011203153312 28.507797951573984 -30.979180979621237 -41.81269339512674 -29.366901349460786 16.499779779776663 20.906813011941342 6.45971345995839 -58.98686021704148 -20.465588211742453 -26.101832205459825 30.672237381896707 -9.53812055840776 -18.446824589301443 -10.883931759457976 -28.135197423509986 -29.027531383774242 20.29658669180192 21.742745073530173 32.71306621067018 8.421540228610068 -26.876513422366155 -32.89081537511487 -66.40237335187476 21.46059612940727 -11.202649349124526 +PC4 25.470663769835404 -49.1186668720238 -29.364839457255243 -34.99002589409128 26.54769511442644 3.591721092268423 -4.431478371495341 -9.796008741464549 -20.560794909029354 7.881113741788029 28.148550211942485 6.020968672625829 7.1842451113275825 25.300523967492385 21.413107892079598 -21.312764864984445 8.663818175880508 -4.9154683249737 -4.638696007113823 -17.84818850033436 -3.1479820419779334 29.675864158326245 4.128860450880204 -45.5706944200688 15.846235204227565 3.207096479835518 24.421667005775333 -32.57693955666741 -0.578273943982289 -30.433422660086716 23.87979229512956 -3.7791106154946976 -8.79435442159487 12.776343436816115 -43.69949727189595 -19.38965655226459 -15.94598943311383 31.01663451280205 24.198318281356634 -39.32492421915402 -20.38763469287827 25.03508628145005 9.196144033573649 -4.451154759793242 -21.42202857431443 -4.316889696454426 0.6827280069355007 -14.697323328403959 -49.546617942529856 -18.991474368403598 -48.17425198636524 -18.962129486036442 27.503578580304886 -3.7485241456787595 1.3844182807051164 -2.830251456408233 -38.83497319938749 5.207304668676424 -15.736693790660784 -40.4991264716963 -18.04392025739888 4.588033393016647 47.16234087608407 -10.046701844619124 37.35286489133 -21.172301570920393 47.788847720387786 40.671373102376826 16.507277497649646 36.96958079910385 0.36862321677649185 29.125217674376067 -17.553196037659063 12.938463205508413 13.485730225799005 0.3646051015079127 25.869816052659573 28.881962590966214 13.393415780830754 43.96858612860449 -20.151108811667008 -3.516249785414116 8.552871596075457 -0.940887938908087 37.6957882118965 31.97109046089689 8.032936257198832 18.431073613780452 35.14123723969103 46.1655525129067 -5.4447509683717366 17.455086838379874 -33.17831129948295 -10.514674427920623 -40.41128674403465 -17.268200558298677 -48.02610621348694 -18.094680386084818 35.888314318342694 -29.97394091026256 +PC5 -22.028231069232557 24.10173008442463 11.656325459229448 3.784891369996491 -2.2426162595293393 -2.999543172095124 -0.010616673535402122 17.868493011525324 -5.733394776913856 -13.098075141768664 17.28867507067882 3.755478655754393 37.82433016990604 23.320285856111177 17.29748495382541 23.694262638120428 5.704270511430274 -27.42872825941089 0.5313424239308384 -1.629592363051632 -16.12772012565067 -1.730784728837945 12.369781740773906 -7.059050837039386 -13.676616694230718 13.770270208998868 -13.132976621912842 -26.76650180149969 -29.872828433814213 -10.553435293870276 20.689697412835326 -16.315989593102483 -3.4255146234496396 -11.095282061121596 -10.020049799357018 1.7005207190041642 -12.232023606268225 19.815725945667303 -23.352365887389734 2.970360608944501 27.627940187591474 0.17068904275280486 43.32696189261961 31.647860530297223 18.449612104418897 20.425617006368846 3.45086999000232 -3.3371722612327597 -3.2711278014477694 -3.855651804676428 -0.7236212896066748 -33.773846306562696 14.139248908220925 22.708419655757453 41.142800557158736 39.51058063428936 19.320559724603022 19.766524871013495 19.349630746012934 -27.50314075507131 14.116124562269768 -3.314854804354721 -17.993462601451085 -44.398457046761635 -22.42050035911451 -32.49332764190582 -16.108586331562037 5.988048792030175 10.911859818845505 3.519461714886179 14.915408345449558 -4.980766196553985 0.35407093192376804 -20.13433645668704 -34.582576065839255 -32.34260088481989 -7.708886617899121 -41.50046599496984 -8.604891837618352 -16.98856872238544 -3.0711644977267594 9.976140507771854 21.830223765151764 32.42017724294338 21.8304940074207 21.336366104482043 0.5596887237839585 0.8108657112417864 7.070515210002242 -13.71369342206856 -31.069860945407598 8.01455423476475 -17.892559623966967 8.780119031816128 -30.982241165984732 26.125046744426793 2.013165777590075 -32.304309126989985 -19.959030000465614 5.8080644671478945 +PC6 4.867032719838234 10.998930991893412 -15.025623341074843 15.884686608283683 39.2758046776292 4.603348881902974 -41.08149292961037 3.1636301621903713 -3.6992897140402663 3.4092231505970605 1.9020113612360454 13.71309965862845 10.906333491148217 -20.801403655489185 -1.0116398716219597 1.536952484280214 -0.8664717325269814 -10.498543115326367 -28.703696911755 9.999828337490905 -18.896194776679604 16.433653761902708 -20.745109023175445 25.545936260351926 19.832108326264297 0.4610477004193624 -5.7006108489235405 4.951250015193395 -4.754990081262685 -31.626678171589493 34.276824708228695 -21.076231424469558 37.200101894847045 25.057985430736416 -14.92948327422696 37.858654544263615 23.56367006773771 25.22145462467903 21.464421555764968 14.745710206764178 -6.8838018089373625 -0.3276460593219578 33.48836210951987 -14.754442289477259 -18.91170315624182 -14.00107629106228 13.406769707412714 18.473797543681755 17.064846170259802 15.147660106291127 2.1690665151866493 -39.39560511048931 3.46141911699481 -26.378449547872908 -1.2816346661110225 -16.53692556957272 -27.83685746563147 22.06057044893331 16.41012285214453 15.545783737512977 -0.7719668636574119 24.421366474603587 13.533420623238595 -11.236261747101338 26.6945715846477 -13.790580211784587 6.672972975316038 -22.42136223130916 -9.942347157071016 -16.285987672629822 -10.272223223717026 -34.729710858285806 6.90182313660329 0.3483077859911339 18.321015033846447 -10.028483170202891 -6.596650328864642 -9.181004696469715 -24.714519506596847 -7.494478351154805 -14.663304971944 4.556929267232622 -6.677434848618189 -11.925715808688683 1.8083491387425286 -15.013901325934505 0.1278937580125043 -3.6022842632095133 -0.9232307428169264 -14.0667278073664 -25.532387994283656 -10.560336580388045 5.597919655093142 -18.37646634816216 20.014575397072115 10.410891683924635 -7.74348579986947 8.205238064108237 4.695796584362948 -4.136717746387787 +PC7 -6.710997596174597 6.5370436116233614 51.610474343918426 -4.2698437516924805 -24.52215614444354 5.227522037194951 34.87711263561262 -10.492078343066272 -8.267200762649322 6.476726486658332 -11.47450242038784 -10.14857481459838 -7.501450280066656 12.893176189895668 -3.114763812707652 -6.305160632922017 -17.973413298260294 -2.96786900630381 16.76209325774374 32.26027245520103 18.663836291270623 33.4848334163656 31.56642128978768 -3.3194426616217454 2.87123257995903 21.924705801595643 0.5179956808476325 6.549019828606791 9.54988904374709 -8.394322280379477 19.285683557599228 -4.4524070822323525 23.541964207456573 31.262210094327006 -15.704137871895908 19.00560702878684 26.139355088544804 25.6989754695371 -30.87920594646273 -28.492646145375463 -8.942142762359483 -15.005681787468683 27.155578167317664 -11.591866993746939 -4.857348683395143 -18.56163517283135 -22.1449349531436 -20.107808439710904 -29.319440048420777 -45.83967129674905 -22.204642227720818 -13.075628919506533 -16.66780897147475 6.610546584483473 -15.944559999977391 -1.8171978163302993 -2.840601235775483 19.361533125008354 3.7228969373413863 39.06968865978663 10.316611802949637 -22.733354207799813 5.608253058823356 -8.639866624119064 3.974150207367798 14.761055071856983 -11.969005933728067 11.521277805004146 8.157228971404917 -4.998024136927628 4.702105324107881 -2.249885703768709 14.04551911029729 -5.073776803850292 12.228031068584286 6.656977793423158 -8.325922939363052 -0.2655504764376564 9.415049476406145 8.108502822756295 -10.999904963838437 -8.131306832512642 8.330403994357713 -4.8694947396292845 -1.4684721478141056 -10.219503309629369 -24.17030144513657 -7.291610424140624 -14.649046337718092 -15.990498892209265 6.932005256193864 -7.4686708610558075 8.625545837922669 4.36834131579767 -1.9557598300961965 -9.572248046811536 4.334245752760176 -9.644143947214705 -15.425797835035981 -14.68840994154254 +PC8 40.29357490295516 32.12498419089558 7.03389135876838 -6.558095280677765 -7.994893869228815 -14.54872286703653 9.517880771750747 -1.9986987146421091 -11.346431856289255 -13.377956521397381 1.0119000303844405 0.21546799120563143 -19.046874271799844 11.446172022295313 -12.169745607501074 0.34912303223977903 -18.26387443365331 -2.849333762216356 -20.584178249534993 -20.293589161620005 -10.905510959905449 14.825675970379184 -9.9877400833948 -0.3873287634934373 4.248117859019546 -2.0448496264555596 -2.685534625548198 52.50031203744958 39.623263062248434 32.0183065301777 2.8683782417841925 -24.675610952139266 -1.4910286641289434 -11.124019057103384 8.53282820115262 -9.11856244710332 -4.798300770828844 2.7655354872374405 10.909980686298244 8.555443312085744 -3.6724529976234344 -3.879560012607262 18.7136676287005 7.91030670891601 14.885216345625695 1.3050173097838986 -12.896650936581185 -7.767654901131095 2.078599306349287 8.35987690353301 -6.458151186838513 -0.32033756613135395 10.528013760319014 -0.9229588736952216 3.6109704290824305 6.336054310499221 5.6288736806056745 -7.736357409655446 7.4938449150757345 3.6946729605389788 -13.33206808495432 -22.296031972220785 -18.338995593004142 0.6346628314974465 4.116613785883521 -21.456192743294874 14.700508360369248 12.519057403656316 -15.552565210022836 19.520641594542262 10.775606759046143 -5.419936759083988 8.306260721255242 -16.450394512009648 -12.781769112792865 -17.18684847559528 -24.49771606379851 -5.64867640671707 -1.5155814928401627 3.0039500706209132 -35.324864656276006 -18.10526747436012 11.594692511019518 -2.614354236860649 -4.233361781861728 19.243301512115075 -12.281117857122018 -1.4141680129045924 -12.064047644727221 -1.0320120117183653 -0.8407438167567544 8.637328490372878 0.016869007935050084 -19.665810990906444 15.761055812267946 6.890969122503823 7.7493214214555515 -7.357832453649003 63.84184741649625 -17.383274974955068 diff --git a/tests/testthat/test_data/test_harmonize_regions.afreq b/tests/testthat/test_data/test_harmonize_regions.afreq new file mode 100644 index 000000000..31b29f4de --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.afreq @@ -0,0 +1,9 @@ +#CHROM ID REF ALT ALT_FREQS OBS_CT U_MIN U_MAX +21 chr21_17014042_A_G A G 0.35 100 -1.5 1.8 +21 chr21_18759786_C_T C T 0.22 100 -1.2 1.6 +21 chr21_20303703_A_T A T 0.41 100 -1.8 2.0 +21 chr21_22660796_C_T C T 0.18 100 -1.0 1.5 +21 chr21_24189782_C_T C T 0.30 100 -1.3 1.7 +21 chr21_36463203_C_T T C 0.45 100 -1.6 1.9 +21 chr21_39786927_A_G A G 0.27 100 -1.1 1.4 +21 chr21_45433269_C_T C T 0.33 100 -1.4 1.8 diff --git a/tests/testthat/test_data/test_harmonize_regions.afreq.zst b/tests/testthat/test_data/test_harmonize_regions.afreq.zst new file mode 100644 index 000000000..637659cff Binary files /dev/null and b/tests/testthat/test_data/test_harmonize_regions.afreq.zst differ diff --git a/tests/testthat/test_data/test_harmonize_regions.bed b/tests/testthat/test_data/test_harmonize_regions.bed new file mode 100644 index 000000000..a7a68d4e8 --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.bed @@ -0,0 +1 @@ +l+/0(芏.>?/3<뻯",Œ.ʮ￯ \ No newline at end of file diff --git a/tests/testthat/test_data/test_harmonize_regions.bim b/tests/testthat/test_data/test_harmonize_regions.bim new file mode 100644 index 000000000..d938fb369 --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.bim @@ -0,0 +1,8 @@ +21 chr21_17014042_A_G 0 17014042 G A +21 chr21_18759786_C_T 0 18759786 T C +21 chr21_20303703_A_T 0 20303703 T A +21 chr21_22660796_C_T 0 22660796 T C +21 chr21_24189782_C_T 0 24189782 T C +21 chr21_36463203_C_T 0 36463203 C T +21 chr21_39786927_A_G 0 39786927 G A +21 chr21_45433269_C_T 0 45433269 T C diff --git a/tests/testthat/test_data/test_harmonize_regions.fam b/tests/testthat/test_data/test_harmonize_regions.fam new file mode 100644 index 000000000..fcc168c80 --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.fam @@ -0,0 +1,100 @@ +HG02461 HG02461 0 0 0 -9 +HG02462 HG02462 0 0 0 -9 +HG02464 HG02464 0 0 0 -9 +HG02465 HG02465 0 0 0 -9 +HG02561 HG02561 0 0 0 -9 +HG02562 HG02562 0 0 0 -9 +HG02568 HG02568 0 0 0 -9 +HG02570 HG02570 0 0 0 -9 +HG02571 HG02571 0 0 0 -9 +HG02573 HG02573 0 0 0 -9 +HG02574 HG02574 0 0 0 -9 +HG02582 HG02582 0 0 0 -9 +HG02583 HG02583 0 0 0 -9 +HG02585 HG02585 0 0 0 -9 +HG02586 HG02586 0 0 0 -9 +HG02588 HG02588 0 0 0 -9 +HG02589 HG02589 0 0 0 -9 +HG02594 HG02594 0 0 0 -9 +HG02595 HG02595 0 0 0 -9 +HG02610 HG02610 0 0 0 -9 +HG02611 HG02611 0 0 0 -9 +HG02613 HG02613 0 0 0 -9 +HG02614 HG02614 0 0 0 -9 +HG02620 HG02620 0 0 0 -9 +HG02621 HG02621 0 0 0 -9 +HG02623 HG02623 0 0 0 -9 +HG02624 HG02624 0 0 0 -9 +HG02628 HG02628 0 0 0 -9 +HG02629 HG02629 0 0 0 -9 +HG02634 HG02634 0 0 0 -9 +HG02635 HG02635 0 0 0 -9 +HG02642 HG02642 0 0 0 -9 +HG02643 HG02643 0 0 0 -9 +HG02645 HG02645 0 0 0 -9 +HG02646 HG02646 0 0 0 -9 +HG02666 HG02666 0 0 0 -9 +HG02667 HG02667 0 0 0 -9 +HG02675 HG02675 0 0 0 -9 +HG02676 HG02676 0 0 0 -9 +HG02678 HG02678 0 0 0 -9 +HG02679 HG02679 0 0 0 -9 +HG02702 HG02702 0 0 0 -9 +HG02703 HG02703 0 0 0 -9 +HG02715 HG02715 0 0 0 -9 +HG02716 HG02716 0 0 0 -9 +HG02721 HG02721 0 0 0 -9 +HG02722 HG02722 0 0 0 -9 +HG02757 HG02757 0 0 0 -9 +HG02759 HG02759 0 0 0 -9 +HG02760 HG02760 0 0 0 -9 +HG02763 HG02763 0 0 0 -9 +HG02768 HG02768 0 0 0 -9 +HG02769 HG02769 0 0 0 -9 +HG02771 HG02771 0 0 0 -9 +HG02772 HG02772 0 0 0 -9 +HG02798 HG02798 0 0 0 -9 +HG02799 HG02799 0 0 0 -9 +HG02804 HG02804 0 0 0 -9 +HG02805 HG02805 0 0 0 -9 +HG02807 HG02807 0 0 0 -9 +HG02808 HG02808 0 0 0 -9 +HG02810 HG02810 0 0 0 -9 +HG02811 HG02811 0 0 0 -9 +HG02813 HG02813 0 0 0 -9 +HG02814 HG02814 0 0 0 -9 +HG02816 HG02816 0 0 0 -9 +HG02817 HG02817 0 0 0 -9 +HG02819 HG02819 0 0 0 -9 +HG02820 HG02820 0 0 0 -9 +HG02836 HG02836 0 0 0 -9 +HG02837 HG02837 0 0 0 -9 +HG02839 HG02839 0 0 0 -9 +HG02840 HG02840 0 0 0 -9 +HG02851 HG02851 0 0 0 -9 +HG02852 HG02852 0 0 0 -9 +HG02854 HG02854 0 0 0 -9 +HG02855 HG02855 0 0 0 -9 +HG02860 HG02860 0 0 0 -9 +HG02861 HG02861 0 0 0 -9 +HG02870 HG02870 0 0 0 -9 +HG02878 HG02878 0 0 0 -9 +HG02879 HG02879 0 0 0 -9 +HG02881 HG02881 0 0 0 -9 +HG02882 HG02882 0 0 0 -9 +HG02884 HG02884 0 0 0 -9 +HG02885 HG02885 0 0 0 -9 +HG02887 HG02887 0 0 0 -9 +HG02888 HG02888 0 0 0 -9 +HG02890 HG02890 0 0 0 -9 +HG02891 HG02891 0 0 0 -9 +HG02895 HG02895 0 0 0 -9 +HG02896 HG02896 0 0 0 -9 +HG02922 HG02922 0 0 0 -9 +HG02923 HG02923 0 0 0 -9 +HG02938 HG02938 0 0 0 -9 +HG02941 HG02941 0 0 0 -9 +HG02943 HG02943 0 0 0 -9 +HG02944 HG02944 0 0 0 -9 +HG02946 HG02946 0 0 0 -9 +HG02947 HG02947 0 0 0 -9 diff --git a/tests/testthat/test_data/test_harmonize_regions.gds b/tests/testthat/test_data/test_harmonize_regions.gds new file mode 100644 index 000000000..181f1baed Binary files /dev/null and b/tests/testthat/test_data/test_harmonize_regions.gds differ diff --git a/tests/testthat/test_data/test_harmonize_regions.pgen b/tests/testthat/test_data/test_harmonize_regions.pgen new file mode 100644 index 000000000..e3ac10ad2 Binary files /dev/null and b/tests/testthat/test_data/test_harmonize_regions.pgen differ diff --git a/tests/testthat/test_data/test_harmonize_regions.psam b/tests/testthat/test_data/test_harmonize_regions.psam new file mode 100644 index 000000000..632f941a7 --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.psam @@ -0,0 +1,101 @@ +#FID IID SEX +HG02461 HG02461 NA +HG02462 HG02462 NA +HG02464 HG02464 NA +HG02465 HG02465 NA +HG02561 HG02561 NA +HG02562 HG02562 NA +HG02568 HG02568 NA +HG02570 HG02570 NA +HG02571 HG02571 NA +HG02573 HG02573 NA +HG02574 HG02574 NA +HG02582 HG02582 NA +HG02583 HG02583 NA +HG02585 HG02585 NA +HG02586 HG02586 NA +HG02588 HG02588 NA +HG02589 HG02589 NA +HG02594 HG02594 NA +HG02595 HG02595 NA +HG02610 HG02610 NA +HG02611 HG02611 NA +HG02613 HG02613 NA +HG02614 HG02614 NA +HG02620 HG02620 NA +HG02621 HG02621 NA +HG02623 HG02623 NA +HG02624 HG02624 NA +HG02628 HG02628 NA +HG02629 HG02629 NA +HG02634 HG02634 NA +HG02635 HG02635 NA +HG02642 HG02642 NA +HG02643 HG02643 NA +HG02645 HG02645 NA +HG02646 HG02646 NA +HG02666 HG02666 NA +HG02667 HG02667 NA +HG02675 HG02675 NA +HG02676 HG02676 NA +HG02678 HG02678 NA +HG02679 HG02679 NA +HG02702 HG02702 NA +HG02703 HG02703 NA +HG02715 HG02715 NA +HG02716 HG02716 NA +HG02721 HG02721 NA +HG02722 HG02722 NA +HG02757 HG02757 NA +HG02759 HG02759 NA +HG02760 HG02760 NA +HG02763 HG02763 NA +HG02768 HG02768 NA +HG02769 HG02769 NA +HG02771 HG02771 NA +HG02772 HG02772 NA +HG02798 HG02798 NA +HG02799 HG02799 NA +HG02804 HG02804 NA +HG02805 HG02805 NA +HG02807 HG02807 NA +HG02808 HG02808 NA +HG02810 HG02810 NA +HG02811 HG02811 NA +HG02813 HG02813 NA +HG02814 HG02814 NA +HG02816 HG02816 NA +HG02817 HG02817 NA +HG02819 HG02819 NA +HG02820 HG02820 NA +HG02836 HG02836 NA +HG02837 HG02837 NA +HG02839 HG02839 NA +HG02840 HG02840 NA +HG02851 HG02851 NA +HG02852 HG02852 NA +HG02854 HG02854 NA +HG02855 HG02855 NA +HG02860 HG02860 NA +HG02861 HG02861 NA +HG02870 HG02870 NA +HG02878 HG02878 NA +HG02879 HG02879 NA +HG02881 HG02881 NA +HG02882 HG02882 NA +HG02884 HG02884 NA +HG02885 HG02885 NA +HG02887 HG02887 NA +HG02888 HG02888 NA +HG02890 HG02890 NA +HG02891 HG02891 NA +HG02895 HG02895 NA +HG02896 HG02896 NA +HG02922 HG02922 NA +HG02923 HG02923 NA +HG02938 HG02938 NA +HG02941 HG02941 NA +HG02943 HG02943 NA +HG02944 HG02944 NA +HG02946 HG02946 NA +HG02947 HG02947 NA diff --git a/tests/testthat/test_data/test_harmonize_regions.pvar b/tests/testthat/test_data/test_harmonize_regions.pvar new file mode 100644 index 000000000..15211700f --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.pvar @@ -0,0 +1,9 @@ +#CHROM POS ID REF ALT +21 17014042 chr21_17014042_A_G A G +21 18759786 chr21_18759786_C_T C T +21 20303703 chr21_20303703_A_T A T +21 22660796 chr21_22660796_C_T C T +21 24189782 chr21_24189782_C_T C T +21 36463203 chr21_36463203_C_T T C +21 39786927 chr21_39786927_A_G A G +21 45433269 chr21_45433269_C_T C T diff --git a/tests/testthat/test_data/test_harmonize_regions.stochastic_meta.tsv b/tests/testthat/test_data/test_harmonize_regions.stochastic_meta.tsv new file mode 100644 index 000000000..f2470ea2f --- /dev/null +++ b/tests/testthat/test_data/test_harmonize_regions.stochastic_meta.tsv @@ -0,0 +1,9 @@ +id u_min u_max +chr21_17014042_A_G -1.5 1.8 +chr21_18759786_C_T -1.2 1.6 +chr21_20303703_A_T -1.8 2.0 +chr21_22660796_C_T -1.0 1.5 +chr21_24189782_C_T -1.3 1.7 +chr21_36463203_C_T -1.6 1.9 +chr21_39786927_A_G -1.1 1.4 +chr21_45433269_C_T -1.4 1.8 diff --git a/tests/testthat/test_data/test_harmonize_regions.vcf.gz b/tests/testthat/test_data/test_harmonize_regions.vcf.gz new file mode 100644 index 000000000..1c0659566 Binary files /dev/null and b/tests/testthat/test_data/test_harmonize_regions.vcf.gz differ diff --git a/tests/testthat/test_data/test_harmonize_regions.vcf.gz.tbi b/tests/testthat/test_data/test_harmonize_regions.vcf.gz.tbi new file mode 100644 index 000000000..a805ba7c1 Binary files /dev/null and b/tests/testthat/test_data/test_harmonize_regions.vcf.gz.tbi differ diff --git a/tests/testthat/test_data/test_phenotypes.tsv b/tests/testthat/test_data/test_phenotypes.tsv new file mode 100644 index 000000000..6fef57744 --- /dev/null +++ b/tests/testthat/test_data/test_phenotypes.tsv @@ -0,0 +1,94 @@ +#seqid start end gene_id HG02461 HG02462 HG02464 HG02465 HG02561 HG02562 HG02568 HG02570 HG02571 HG02573 HG02574 HG02582 HG02583 HG02585 HG02586 HG02588 HG02589 HG02594 HG02595 HG02610 HG02611 HG02613 HG02614 HG02620 HG02621 HG02623 HG02624 HG02628 HG02629 HG02634 HG02635 HG02642 HG02643 HG02645 HG02646 HG02666 HG02667 HG02675 HG02676 HG02678 HG02679 HG02702 HG02703 HG02715 HG02716 HG02721 HG02722 HG02757 HG02759 HG02760 HG02763 HG02768 HG02769 HG02771 HG02772 HG02798 HG02799 HG02804 HG02805 HG02807 HG02808 HG02810 HG02811 HG02813 HG02814 HG02816 HG02817 HG02819 HG02820 HG02836 HG02837 HG02839 HG02840 HG02851 HG02852 HG02854 HG02855 HG02860 HG02861 HG02870 HG02878 HG02879 HG02881 HG02882 HG02884 HG02885 HG02887 HG02888 HG02890 HG02891 HG02895 HG02896 HG02922 HG02923 HG02938 HG02941 HG02943 HG02944 HG02946 HG02947 +21 14216130 14228372 ENSG00000185272 -0.39780617203394536 -1.505601216304423 2.139206442985977 0.6262178361515812 1.5882958682169486 0.9707539424317222 -0.18864116776152437 0.13795711049811363 0.16324671084032097 0.08762521122251538 -0.7203302308575226 0.7203302308575226 -0.4525499884018013 1.9400873318827656 1.2481665394580725 0.012502212342580959 -0.5664729456325054 -0.26563063350790206 0.29162472875305195 -0.03751445734407257 0.2141578810056186 -1.0542454124924512 -0.9707539424317223 -1.7971034256260587 -0.5373549665979251 -0.8568619257010015 -0.5960793860276631 -1.3655831908785105 -1.1954271085021426 0.23981482260806397 -2.1392064429859774 -0.06255019758103977 -0.1632467108403211 2.498590560962256 -0.4250188373912558 -0.8935343746060127 -1.68354659767802 0.5664729456325049 0.3178174129491543 -1.5882958682169486 1.145818341997217 -0.8213071752056109 -0.3442300078704089 -1.9400873318827652 1.1954271085021424 -0.5086856698276004 -0.11275544983055917 0.34423000787040914 -0.3708849944820911 -0.6569361927965854 -1.43208428708654 0.4525499884018013 -0.7867615829230669 0.5373549665979254 0.03751445734407243 0.9314497863026412 -0.9314497863026412 1.7971034256260585 -0.6882873909026717 -0.21415788100561842 0.06255019758103977 0.3978061720339455 0.18864116776152437 1.3655831908785105 0.8935343746060127 0.8213071752056109 1.5056012163044221 0.4250188373912557 0.6569361927965854 -1.2481665394580725 -0.3178174129491543 -0.7531303783884556 -1.3046268229653297 0.11275544983055917 0.6882873909026717 0.7531303783884556 0.7867615829230666 1.6835465976780204 0.48042855588587824 -0.012502212342580959 -1.145818341997217 1.3046268229653302 0.3708849944820911 1.0988799140705434 1.0542454124924512 -0.29162472875305206 0.26563063350790206 -1.0116180790824516 -0.08762521122251522 -0.23981482260806397 1.0116180790824516 0.8568619257010015 -0.13795711049811363 0.5960793860276631 1.43208428708654 -0.6262178361515811 -1.0988799140705434 0.5086856698276004 -0.48042855588587813 -2.498590560962256 +21 14371115 14383484 ENSG00000155304 -0.7531303783884556 -1.0542454124924512 0.4525499884018013 0.08762521122251538 0.03751445734407243 0.6882873909026717 1.9400873318827656 0.5960793860276631 1.1954271085021424 1.43208428708654 0.6569361927965854 -1.9400873318827652 -0.9314497863026412 1.3046268229653302 1.6835465976780204 -0.03751445734407257 0.13795711049811363 0.7867615829230666 2.498590560962256 0.9314497863026412 -0.11275544983055917 0.8213071752056109 -0.06255019758103977 -0.8213071752056109 0.3978061720339455 -1.68354659767802 -0.9707539424317223 -1.2481665394580725 -0.6262178361515811 -0.39780617203394536 -0.29162472875305206 0.48042855588587824 -0.26563063350790206 0.23981482260806397 -0.7867615829230669 0.2141578810056186 0.16324671084032097 -1.3046268229653297 -0.7203302308575226 -0.012502212342580959 -1.1954271085021426 -0.1632467108403211 -0.18864116776152437 0.18864116776152437 0.012502212342580959 0.6262178361515812 -0.4250188373912558 -0.8568619257010015 -1.505601216304423 -1.5882958682169486 -0.5664729456325054 0.34423000787040914 -1.43208428708654 -0.5086856698276004 -0.23981482260806397 -0.13795711049811363 -0.4525499884018013 -1.3655831908785105 -1.7971034256260587 -0.6882873909026717 0.29162472875305195 -0.8935343746060127 -0.3178174129491543 0.11275544983055917 0.06255019758103977 1.2481665394580725 0.4250188373912557 1.3655831908785105 -0.6569361927965854 -1.0116180790824516 -1.145818341997217 0.7203302308575226 1.0988799140705434 -0.3708849944820911 -0.21415788100561842 0.5664729456325049 0.26563063350790206 0.7531303783884556 1.5056012163044221 2.139206442985977 0.3178174129491543 1.0116180790824516 -0.5373549665979251 -1.0988799140705434 0.3708849944820911 0.8935343746060127 -0.3442300078704089 1.0542454124924512 1.145818341997217 0.8568619257010015 1.5882958682169486 1.7971034256260585 0.9707539424317222 0.5086856698276004 -0.5960793860276631 -2.1392064429859774 -0.08762521122251522 -2.498590560962256 -0.48042855588587813 0.5373549665979254 +21 14485228 14658821 ENSG00000155307 -0.012502212342580959 -1.505601216304423 1.6835465976780204 0.26563063350790206 1.3046268229653302 0.9314497863026412 2.498590560962256 -0.18864116776152437 0.6882873909026717 0.48042855588587824 1.3655831908785105 -1.0542454124924512 0.9707539424317222 -0.8568619257010015 0.08762521122251538 0.13795711049811363 -0.08762521122251522 -0.4525499884018013 0.03751445734407243 1.0988799140705434 -0.06255019758103977 1.7971034256260585 -1.9400873318827652 -1.5882958682169486 0.8935343746060127 -0.7531303783884556 -0.6882873909026717 -0.03751445734407257 0.06255019758103977 -1.3046268229653297 -0.11275544983055917 -0.3442300078704089 0.012502212342580959 0.23981482260806397 -1.145818341997217 0.3178174129491543 -2.1392064429859774 -0.26563063350790206 1.2481665394580725 -0.8213071752056109 -0.39780617203394536 -0.3178174129491543 0.6262178361515812 -0.7867615829230669 0.2141578810056186 -1.2481665394580725 0.5373549665979254 -0.5086856698276004 -1.1954271085021426 -0.9314497863026412 -1.68354659767802 -0.5664729456325054 0.4525499884018013 -1.0988799140705434 -1.7971034256260587 -0.6569361927965854 0.29162472875305195 1.1954271085021424 -0.8935343746060127 2.139206442985977 -1.0116180790824516 -0.6262178361515811 0.5960793860276631 -1.43208428708654 0.18864116776152437 0.6569361927965854 0.7867615829230666 -0.13795711049811363 -0.5373549665979251 -0.29162472875305206 -0.48042855588587813 -2.498590560962256 0.8568619257010015 -0.21415788100561842 0.4250188373912557 0.11275544983055917 0.34423000787040914 0.5086856698276004 0.3708849944820911 1.43208428708654 -0.7203302308575226 1.145818341997217 -0.5960793860276631 -0.9707539424317223 0.3978061720339455 0.7531303783884556 -0.1632467108403211 -0.23981482260806397 0.5664729456325049 1.5056012163044221 -0.4250188373912558 -0.3708849944820911 0.7203302308575226 1.9400873318827656 0.8213071752056109 1.0116180790824516 0.16324671084032097 1.5882958682169486 1.0542454124924512 -1.3655831908785105 +21 14961235 15065936 ENSG00000180530 0.5960793860276631 -1.505601216304423 -0.5664729456325054 0.08762521122251538 1.1954271085021424 0.11275544983055917 -1.7971034256260587 -0.4525499884018013 -0.5373549665979251 1.3655831908785105 -1.43208428708654 0.48042855588587824 0.2141578810056186 -0.39780617203394536 -0.8935343746060127 -0.7531303783884556 -0.06255019758103977 -0.08762521122251522 -0.9707539424317223 1.5056012163044221 1.3046268229653302 1.145818341997217 -1.9400873318827652 -0.29162472875305206 -0.4250188373912558 0.4525499884018013 0.5373549665979254 -0.26563063350790206 0.6569361927965854 -0.03751445734407257 -1.2481665394580725 0.26563063350790206 1.43208428708654 2.498590560962256 -0.1632467108403211 0.5086856698276004 -0.3708849944820911 0.34423000787040914 1.2481665394580725 0.18864116776152437 -0.6569361927965854 0.3708849944820911 -1.0988799140705434 -1.5882958682169486 -0.8213071752056109 -0.8568619257010015 -0.21415788100561842 0.23981482260806397 -1.68354659767802 -0.7867615829230669 -1.145818341997217 -0.6882873909026717 -0.012502212342580959 -0.18864116776152437 -0.9314497863026412 -0.48042855588587813 -0.13795711049811363 1.0116180790824516 0.7531303783884556 1.6835465976780204 0.16324671084032097 0.9707539424317222 0.06255019758103977 0.03751445734407243 0.8213071752056109 0.4250188373912557 -1.0542454124924512 -0.5960793860276631 0.5664729456325049 -2.1392064429859774 0.9314497863026412 -2.498590560962256 0.7203302308575226 0.012502212342580959 0.8568619257010015 1.7971034256260585 -0.23981482260806397 1.0988799140705434 0.6882873909026717 1.5882958682169486 -0.3178174129491543 1.9400873318827656 -0.3442300078704089 -1.0116180790824516 1.0542454124924512 -1.1954271085021426 2.139206442985977 -0.5086856698276004 0.8935343746060127 -1.3046268229653297 0.6262178361515812 0.7867615829230666 -0.11275544983055917 -0.7203302308575226 0.3178174129491543 0.13795711049811363 0.3978061720339455 -0.6262178361515811 -1.3655831908785105 0.29162472875305195 +21 15729982 15880064 ENSG00000155313 -2.498590560962256 -1.2481665394580725 -0.3708849944820911 -0.7203302308575226 -1.68354659767802 -0.5373549665979251 -1.1954271085021426 -1.7971034256260587 -0.6569361927965854 -0.7867615829230669 -1.9400873318827652 -0.8935343746060127 -0.9707539424317223 -1.0542454124924512 -1.43208428708654 -1.505601216304423 -1.0116180790824516 0.6882873909026717 -0.6262178361515811 0.8568619257010015 1.43208428708654 -0.18864116776152437 0.5373549665979254 0.9707539424317222 -1.145818341997217 0.7531303783884556 0.3978061720339455 1.3655831908785105 0.9314497863026412 -0.4525499884018013 -0.29162472875305206 1.7971034256260585 2.498590560962256 -0.012502212342580959 0.29162472875305195 1.145818341997217 1.0988799140705434 -0.08762521122251522 -0.9314497863026412 -0.13795711049811363 0.16324671084032097 0.06255019758103977 -0.26563063350790206 -0.48042855588587813 -0.39780617203394536 -0.4250188373912558 -0.23981482260806397 -0.5664729456325054 1.0116180790824516 -1.3655831908785105 -0.06255019758103977 -0.8213071752056109 -1.3046268229653297 -0.21415788100561842 -1.0988799140705434 -0.5960793860276631 -0.3442300078704089 0.5960793860276631 0.48042855588587824 1.2481665394580725 0.8213071752056109 0.3708849944820911 1.5056012163044221 1.5882958682169486 0.13795711049811363 0.8935343746060127 -0.7531303783884556 0.012502212342580959 0.6262178361515812 0.08762521122251538 0.03751445734407243 -0.03751445734407257 1.0542454124924512 0.5664729456325049 1.6835465976780204 0.4525499884018013 0.7867615829230666 1.3046268229653302 1.1954271085021424 0.4250188373912557 1.9400873318827656 0.7203302308575226 0.6569361927965854 0.34423000787040914 0.5086856698276004 0.26563063350790206 -0.3178174129491543 0.23981482260806397 -0.8568619257010015 0.11275544983055917 2.139206442985977 -0.11275544983055917 -0.6882873909026717 -0.5086856698276004 -1.5882958682169486 0.2141578810056186 0.18864116776152437 0.3178174129491543 -2.1392064429859774 -0.1632467108403211 +21 17513043 17593579 ENSG00000154639 -1.0542454124924512 -1.43208428708654 -1.145818341997217 -1.3046268229653297 0.6882873909026717 -0.7867615829230669 -0.9707539424317223 1.0542454124924512 0.11275544983055917 -0.6569361927965854 0.012502212342580959 1.2481665394580725 -1.7971034256260587 0.3978061720339455 -0.3708849944820911 -0.5373549665979251 -1.9400873318827652 -0.012502212342580959 -0.7531303783884556 -0.4525499884018013 1.9400873318827656 0.5664729456325049 -2.498590560962256 -0.5086856698276004 -0.06255019758103977 0.03751445734407243 0.7531303783884556 -1.1954271085021426 0.4250188373912557 0.16324671084032097 0.7203302308575226 -0.23981482260806397 -1.2481665394580725 0.4525499884018013 -0.13795711049811363 -2.1392064429859774 -0.08762521122251522 0.8568619257010015 2.139206442985977 -0.3442300078704089 0.08762521122251538 0.23981482260806397 0.5960793860276631 -0.1632467108403211 -1.3655831908785105 1.5882958682169486 -0.29162472875305206 1.43208428708654 -1.505601216304423 -0.48042855588587813 -0.9314497863026412 0.34423000787040914 0.8935343746060127 0.18864116776152437 -0.39780617203394536 0.5086856698276004 -0.21415788100561842 -0.5664729456325054 -0.11275544983055917 -0.6262178361515811 -0.6882873909026717 0.5373549665979254 1.3655831908785105 1.1954271085021424 1.0116180790824516 0.8213071752056109 2.498590560962256 -0.3178174129491543 0.06255019758103977 1.6835465976780204 0.6569361927965854 0.9314497863026412 -1.5882958682169486 0.3708849944820911 0.9707539424317222 1.5056012163044221 0.7867615829230666 -0.4250188373912558 -1.0116180790824516 0.29162472875305195 0.48042855588587824 -0.7203302308575226 0.3178174129491543 1.7971034256260585 -0.18864116776152437 1.145818341997217 1.3046268229653302 -1.0988799140705434 1.0988799140705434 0.2141578810056186 0.13795711049811363 0.6262178361515812 -0.8568619257010015 -0.8213071752056109 -1.68354659767802 -0.03751445734407257 -0.8935343746060127 -0.26563063350790206 0.26563063350790206 -0.5960793860276631 +21 17788974 17819386 ENSG00000154642 -1.505601216304423 -2.1392064429859774 1.3655831908785105 0.5373549665979254 -0.3442300078704089 1.5056012163044221 1.5882958682169486 -0.18864116776152437 1.1954271085021424 1.2481665394580725 -0.9314497863026412 -0.29162472875305206 0.3978061720339455 -0.7203302308575226 0.34423000787040914 -0.5960793860276631 0.8213071752056109 0.7531303783884556 2.498590560962256 0.7867615829230666 0.5960793860276631 -1.1954271085021426 -0.3708849944820911 -1.145818341997217 -1.3655831908785105 -0.5664729456325054 -0.06255019758103977 -1.2481665394580725 -0.4250188373912558 0.7203302308575226 -1.5882958682169486 1.43208428708654 -0.7867615829230669 0.6262178361515812 0.26563063350790206 -0.8213071752056109 -0.48042855588587813 -1.9400873318827652 -1.7971034256260587 -0.6569361927965854 0.18864116776152437 -0.5373549665979251 -2.498590560962256 -0.9707539424317223 0.29162472875305195 -0.11275544983055917 0.13795711049811363 0.08762521122251538 0.2141578810056186 -0.7531303783884556 -0.13795711049811363 1.9400873318827656 -1.3046268229653297 0.5664729456325049 -1.0542454124924512 -0.5086856698276004 -0.23981482260806397 -0.1632467108403211 -1.68354659767802 1.145818341997217 -0.26563063350790206 -0.8935343746060127 -0.39780617203394536 -0.4525499884018013 -0.8568619257010015 0.4525499884018013 0.03751445734407243 0.4250188373912557 0.3708849944820911 -1.0988799140705434 -0.3178174129491543 0.012502212342580959 -1.43208428708654 0.48042855588587824 0.23981482260806397 1.6835465976780204 0.9314497863026412 1.3046268229653302 0.8568619257010015 0.11275544983055917 0.9707539424317222 1.0542454124924512 -0.03751445734407257 -0.6262178361515811 -0.21415788100561842 1.0988799140705434 -0.08762521122251522 0.16324671084032097 -0.012502212342580959 1.0116180790824516 1.7971034256260585 0.8935343746060127 0.5086856698276004 2.139206442985977 0.3178174129491543 0.06255019758103977 -1.0116180790824516 0.6569361927965854 -0.6882873909026717 0.6882873909026717 +21 17901263 18267373 ENSG00000154645 -1.9400873318827652 -1.43208428708654 0.7531303783884556 -1.505601216304423 -2.1392064429859774 0.3708849944820911 -0.012502212342580959 -1.3046268229653297 -1.3655831908785105 0.5664729456325049 -0.8935343746060127 -1.68354659767802 -0.5960793860276631 -0.4525499884018013 -0.6569361927965854 -0.9314497863026412 -1.145818341997217 -1.7971034256260587 1.9400873318827656 0.18864116776152437 2.498590560962256 0.8568619257010015 0.6569361927965854 0.13795711049811363 1.3655831908785105 1.43208428708654 0.08762521122251538 -0.13795711049811363 -0.26563063350790206 0.5086856698276004 1.6835465976780204 -0.11275544983055917 1.0116180790824516 2.139206442985977 -0.18864116776152437 1.145818341997217 1.2481665394580725 0.26563063350790206 -0.7531303783884556 -0.29162472875305206 0.9314497863026412 -0.48042855588587813 0.4525499884018013 -0.3442300078704089 0.8213071752056109 0.7203302308575226 0.06255019758103977 0.2141578810056186 0.11275544983055917 -1.2481665394580725 0.34423000787040914 1.1954271085021424 -0.39780617203394536 1.5056012163044221 0.3978061720339455 0.48042855588587824 0.7867615829230666 -0.5664729456325054 -0.03751445734407257 -1.0988799140705434 0.6882873909026717 -0.5086856698276004 -0.23981482260806397 0.6262178361515812 0.4250188373912557 1.5882958682169486 -0.5373549665979251 0.9707539424317222 -0.3178174129491543 0.16324671084032097 0.8935343746060127 1.0988799140705434 -0.1632467108403211 0.03751445734407243 -1.0116180790824516 1.7971034256260585 0.23981482260806397 0.29162472875305195 0.5960793860276631 -0.4250188373912558 1.3046268229653302 1.0542454124924512 -1.0542454124924512 -0.21415788100561842 -0.3708849944820911 0.5373549665979254 -0.8213071752056109 -0.9707539424317223 -0.7203302308575226 -0.08762521122251522 -0.06255019758103977 0.3178174129491543 -0.8568619257010015 0.012502212342580959 -1.1954271085021426 -0.7867615829230669 -1.5882958682169486 -2.498590560962256 -0.6882873909026717 -0.6262178361515811 +21 20998409 21543329 ENSG00000154654 -0.1632467108403211 -1.3655831908785105 -0.21415788100561842 -1.0988799140705434 -0.5373549665979251 -1.0116180790824516 -1.68354659767802 -0.6882873909026717 0.3178174129491543 -0.8935343746060127 -0.4525499884018013 -0.7203302308575226 -0.3442300078704089 -0.7867615829230669 0.26563063350790206 0.16324671084032097 -0.5664729456325054 -1.43208428708654 -0.9707539424317223 -0.6569361927965854 0.06255019758103977 0.03751445734407243 -1.145818341997217 1.0542454124924512 -1.9400873318827652 0.9314497863026412 0.08762521122251538 2.498590560962256 -0.26563063350790206 -2.1392064429859774 0.13795711049811363 1.3046268229653302 0.7203302308575226 0.48042855588587824 1.3655831908785105 -1.0542454124924512 -0.06255019758103977 -0.48042855588587813 -0.012502212342580959 0.8213071752056109 1.7971034256260585 0.5086856698276004 -0.5086856698276004 -0.39780617203394536 0.9707539424317222 1.9400873318827656 -0.7531303783884556 -0.29162472875305206 0.7531303783884556 -0.18864116776152437 0.5664729456325049 0.4250188373912557 -0.5960793860276631 0.18864116776152437 -0.3708849944820911 0.3978061720339455 1.0988799140705434 -0.4250188373912558 1.5056012163044221 -0.23981482260806397 0.11275544983055917 0.7867615829230666 -0.9314497863026412 1.6835465976780204 -1.7971034256260587 2.139206442985977 -1.1954271085021426 -1.3046268229653297 1.43208428708654 -0.8568619257010015 0.3708849944820911 0.4525499884018013 0.8935343746060127 -0.8213071752056109 -0.08762521122251522 -0.11275544983055917 0.6882873909026717 -0.03751445734407257 1.2481665394580725 -1.5882958682169486 1.1954271085021424 0.6569361927965854 -0.6262178361515811 0.23981482260806397 0.34423000787040914 -1.505601216304423 0.6262178361515812 0.8568619257010015 0.29162472875305195 -1.2481665394580725 1.5882958682169486 0.012502212342580959 -0.3178174129491543 0.2141578810056186 0.5960793860276631 1.145818341997217 1.0116180790824516 -0.13795711049811363 -2.498590560962256 0.5373549665979254 +21 25639258 25717562 ENSG00000154721 -1.5882958682169486 -0.1632467108403211 0.4250188373912557 0.3178174129491543 2.139206442985977 0.3708849944820911 -0.29162472875305206 -0.9707539424317223 0.29162472875305195 0.11275544983055917 0.7867615829230666 -0.06255019758103977 -0.26563063350790206 -0.8568619257010015 0.6882873909026717 -0.7867615829230669 0.012502212342580959 -0.6262178361515811 -1.0116180790824516 -0.5664729456325054 0.08762521122251538 -0.3178174129491543 0.13795711049811363 -0.7531303783884556 0.5960793860276631 0.26563063350790206 1.0988799140705434 -0.012502212342580959 0.5086856698276004 0.8213071752056109 1.5056012163044221 -0.4250188373912558 -0.39780617203394536 -1.2481665394580725 -1.7971034256260587 -1.505601216304423 -1.145818341997217 0.3978061720339455 1.2481665394580725 -0.5373549665979251 -0.3442300078704089 -0.8935343746060127 0.16324671084032097 -1.0542454124924512 -1.0988799140705434 0.5373549665979254 0.48042855588587824 0.03751445734407243 -1.68354659767802 -0.3708849944820911 -1.1954271085021426 -1.3046268229653297 0.2141578810056186 0.23981482260806397 -0.03751445734407257 -0.8213071752056109 -1.9400873318827652 0.18864116776152437 -0.13795711049811363 0.4525499884018013 0.34423000787040914 -0.08762521122251522 0.9707539424317222 -2.1392064429859774 1.145818341997217 -0.18864116776152437 2.498590560962256 -0.9314497863026412 0.9314497863026412 -0.5086856698276004 -0.48042855588587813 0.7203302308575226 -0.21415788100561842 1.9400873318827656 1.43208428708654 -0.11275544983055917 0.8935343746060127 0.5664729456325049 0.6569361927965854 1.7971034256260585 -0.6882873909026717 0.7531303783884556 -0.4525499884018013 -0.6569361927965854 1.1954271085021424 1.3046268229653302 0.8568619257010015 1.3655831908785105 1.0116180790824516 0.06255019758103977 -0.5960793860276631 0.6262178361515812 1.6835465976780204 -0.23981482260806397 -1.43208428708654 1.0542454124924512 -0.7203302308575226 -2.498590560962256 1.5882958682169486 -1.3655831908785105 +21 25880535 26171128 ENSG00000142192 0.5086856698276004 -0.7531303783884556 -0.7203302308575226 -0.03751445734407257 0.012502212342580959 -0.11275544983055917 -0.13795711049811363 0.3978061720339455 0.29162472875305195 -0.39780617203394536 -0.6262178361515811 -1.68354659767802 0.5664729456325049 -1.3046268229653297 0.08762521122251538 -0.3442300078704089 -0.26563063350790206 0.03751445734407243 -1.505601216304423 1.3655831908785105 -0.8568619257010015 1.5056012163044221 -1.43208428708654 0.6569361927965854 -0.9707539424317223 0.9314497863026412 0.16324671084032097 -1.0116180790824516 1.2481665394580725 2.139206442985977 -0.5960793860276631 -0.48042855588587813 1.7971034256260585 -1.3655831908785105 -0.8935343746060127 1.145818341997217 -0.08762521122251522 -1.0542454124924512 -1.9400873318827652 0.8935343746060127 0.3178174129491543 0.2141578810056186 1.5882958682169486 -0.6569361927965854 0.13795711049811363 0.6882873909026717 -0.1632467108403211 0.8213071752056109 0.9707539424317222 0.7531303783884556 0.5960793860276631 1.1954271085021424 0.23981482260806397 0.34423000787040914 0.18864116776152437 -0.3178174129491543 -1.0988799140705434 -0.06255019758103977 -0.21415788100561842 -0.012502212342580959 0.4525499884018013 -0.4525499884018013 0.11275544983055917 -1.145818341997217 -0.5086856698276004 1.43208428708654 2.498590560962256 -2.498590560962256 1.0988799140705434 0.3708849944820911 1.3046268229653302 -1.7971034256260587 -0.5664729456325054 -0.8213071752056109 -0.23981482260806397 0.8568619257010015 -0.29162472875305206 0.7203302308575226 1.6835465976780204 -2.1392064429859774 -0.4250188373912558 0.48042855588587824 1.0116180790824516 -0.6882873909026717 1.9400873318827656 -1.2481665394580725 -0.5373549665979251 0.26563063350790206 0.6262178361515812 0.5373549665979254 0.06255019758103977 1.0542454124924512 -0.3708849944820911 -0.18864116776152437 -1.1954271085021426 0.7867615829230666 -0.7867615829230669 0.4250188373912557 -1.5882958682169486 -0.9314497863026412 +21 28872191 28885371 ENSG00000156239 1.0542454124924512 0.8213071752056109 1.6835465976780204 1.7971034256260585 1.2481665394580725 0.48042855588587824 1.43208428708654 2.498590560962256 1.9400873318827656 1.145818341997217 0.8935343746060127 0.4525499884018013 0.6262178361515812 0.5664729456325049 0.16324671084032097 1.0116180790824516 0.9314497863026412 1.5882958682169486 0.7203302308575226 -0.08762521122251522 -0.8568619257010015 -1.5882958682169486 -0.06255019758103977 0.3978061720339455 0.6882873909026717 -0.5086856698276004 -1.9400873318827652 -1.145818341997217 -1.3655831908785105 -0.21415788100561842 -0.9707539424317223 -1.1954271085021426 -1.505601216304423 -0.7867615829230669 -0.29162472875305206 0.34423000787040914 0.012502212342580959 -1.0116180790824516 -0.3708849944820911 0.08762521122251538 0.29162472875305195 -2.498590560962256 -0.1632467108403211 -0.18864116776152437 0.06255019758103977 0.4250188373912557 0.11275544983055917 0.23981482260806397 0.3178174129491543 0.3708849944820911 0.5086856698276004 0.5960793860276631 -0.3442300078704089 0.2141578810056186 0.26563063350790206 -0.26563063350790206 0.6569361927965854 0.7867615829230666 -0.5664729456325054 1.5056012163044221 0.13795711049811363 -2.1392064429859774 -1.43208428708654 -0.7531303783884556 -0.012502212342580959 0.03751445734407243 0.18864116776152437 -0.5960793860276631 -1.0542454124924512 -0.8935343746060127 -0.03751445734407257 -0.4525499884018013 -0.5373549665979251 -0.23981482260806397 1.0988799140705434 -0.11275544983055917 -1.0988799140705434 -0.39780617203394536 -0.6569361927965854 -0.6262178361515811 -0.6882873909026717 -0.7203302308575226 -1.68354659767802 -1.7971034256260587 -0.9314497863026412 -0.4250188373912558 -1.3046268229653297 -1.2481665394580725 -0.13795711049811363 -0.8213071752056109 -0.3178174129491543 -0.48042855588587813 2.139206442985977 1.3046268229653302 1.3655831908785105 0.8568619257010015 0.7531303783884556 1.1954271085021424 0.5373549665979254 0.9707539424317222 +21 29004384 29019360 ENSG00000156253 -2.498590560962256 -0.5373549665979251 -0.23981482260806397 -0.3708849944820911 -0.8568619257010015 -0.8213071752056109 -1.0542454124924512 -1.3655831908785105 -1.145818341997217 -0.5086856698276004 -0.6262178361515811 -1.3046268229653297 -0.48042855588587813 -1.43208428708654 -1.0988799140705434 -1.1954271085021426 -1.5882958682169486 -1.505601216304423 -0.4525499884018013 1.43208428708654 0.6882873909026717 0.7867615829230666 -0.1632467108403211 1.3655831908785105 2.139206442985977 0.8935343746060127 -0.7531303783884556 -0.21415788100561842 -0.29162472875305206 1.0988799140705434 0.6569361927965854 -0.39780617203394536 -0.06255019758103977 1.9400873318827656 1.0116180790824516 1.7971034256260585 1.5056012163044221 0.34423000787040914 1.3046268229653302 0.3978061720339455 0.26563063350790206 0.5373549665979254 0.012502212342580959 -0.13795711049811363 0.8213071752056109 0.5960793860276631 -0.11275544983055917 -0.18864116776152437 0.03751445734407243 0.29162472875305195 0.6262178361515812 1.145818341997217 0.7203302308575226 0.4250188373912557 0.3178174129491543 -0.03751445734407257 0.18864116776152437 -0.9314497863026412 -0.6882873909026717 -1.9400873318827652 0.3708849944820911 0.7531303783884556 0.06255019758103977 1.0542454124924512 2.498590560962256 1.2481665394580725 0.9314497863026412 0.16324671084032097 0.08762521122251538 0.4525499884018013 0.8568619257010015 1.1954271085021424 0.5086856698276004 1.5882958682169486 -1.7971034256260587 1.6835465976780204 -0.3442300078704089 -0.012502212342580959 -0.4250188373912558 0.48042855588587824 0.11275544983055917 0.5664729456325049 -1.2481665394580725 -0.3178174129491543 -0.26563063350790206 0.23981482260806397 0.9707539424317222 -0.9707539424317223 0.2141578810056186 -0.08762521122251522 -2.1392064429859774 0.13795711049811363 -1.0116180790824516 -0.7203302308575226 -0.6569361927965854 -0.5664729456325054 -0.8935343746060127 -1.68354659767802 -0.7867615829230669 -0.5960793860276631 +21 29077221 29175889 ENSG00000156265 1.0542454124924512 0.5373549665979254 -1.0988799140705434 -0.7203302308575226 1.145818341997217 0.23981482260806397 -2.1392064429859774 -1.5882958682169486 0.29162472875305195 -1.3046268229653297 1.0116180790824516 0.6882873909026717 -0.26563063350790206 -0.6569361927965854 0.3978061720339455 -1.2481665394580725 -0.012502212342580959 -0.06255019758103977 0.4250188373912557 -0.7867615829230669 -0.7531303783884556 -1.3655831908785105 0.16324671084032097 -0.8213071752056109 -0.48042855588587813 -0.13795711049811363 0.3708849944820911 -0.6262178361515811 -0.23981482260806397 -0.9314497863026412 0.5086856698276004 -0.08762521122251522 0.11275544983055917 0.03751445734407243 1.7971034256260585 -0.8568619257010015 1.6835465976780204 -1.1954271085021426 -1.505601216304423 0.26563063350790206 -0.3178174129491543 0.34423000787040914 1.3655831908785105 0.2141578810056186 -1.0542454124924512 0.13795711049811363 0.06255019758103977 0.18864116776152437 0.012502212342580959 1.3046268229653302 -0.3442300078704089 -0.5664729456325054 0.3178174129491543 -0.29162472875305206 0.5960793860276631 -0.39780617203394536 0.8935343746060127 -2.498590560962256 0.4525499884018013 -0.18864116776152437 -0.6882873909026717 -0.5086856698276004 0.9707539424317222 0.6569361927965854 2.498590560962256 1.0988799140705434 1.5882958682169486 -0.1632467108403211 -1.0116180790824516 -0.03751445734407257 -1.9400873318827652 1.1954271085021424 1.43208428708654 0.48042855588587824 0.08762521122251538 0.9314497863026412 1.5056012163044221 -1.145818341997217 0.7531303783884556 2.139206442985977 1.9400873318827656 0.5664729456325049 -0.21415788100561842 -0.4525499884018013 -0.4250188373912558 0.7203302308575226 -0.5373549665979251 1.2481665394580725 -0.5960793860276631 0.8213071752056109 0.6262178361515812 0.7867615829230666 -0.8935343746060127 -0.9707539424317223 -1.68354659767802 -1.43208428708654 0.8568619257010015 -0.11275544983055917 -0.3708849944820911 -1.7971034256260587 +21 29194071 29630751 ENSG00000156273 0.012502212342580959 -0.29162472875305206 -0.23981482260806397 0.11275544983055917 -0.08762521122251522 -0.1632467108403211 0.6882873909026717 -0.3708849944820911 -0.012502212342580959 0.2141578810056186 -0.06255019758103977 -0.5373549665979251 -0.3178174129491543 -0.26563063350790206 0.06255019758103977 -0.03751445734407257 -0.13795711049811363 0.5960793860276631 0.26563063350790206 -1.9400873318827652 0.5664729456325049 1.6835465976780204 -1.0988799140705434 -2.498590560962256 -1.5882958682169486 -1.2481665394580725 0.4525499884018013 0.23981482260806397 0.3178174129491543 -0.5086856698276004 -1.68354659767802 0.6262178361515812 -0.21415788100561842 -0.6882873909026717 -0.4525499884018013 -1.0542454124924512 -0.6569361927965854 -0.8213071752056109 -0.8935343746060127 -0.8568619257010015 -1.3655831908785105 -0.4250188373912558 -0.5960793860276631 -0.48042855588587813 -1.43208428708654 -0.9707539424317223 -1.0116180790824516 -0.9314497863026412 -0.39780617203394536 -2.1392064429859774 -0.6262178361515811 -1.3046268229653297 -1.145818341997217 -1.505601216304423 -1.1954271085021426 -0.7867615829230669 -1.7971034256260587 -0.7203302308575226 0.6569361927965854 0.5373549665979254 1.43208428708654 1.0988799140705434 2.139206442985977 1.1954271085021424 1.5056012163044221 1.5882958682169486 2.498590560962256 0.8568619257010015 0.9707539424317222 1.0542454124924512 0.03751445734407243 0.7203302308575226 1.7971034256260585 0.3978061720339455 0.13795711049811363 0.7531303783884556 0.7867615829230666 0.8213071752056109 1.3655831908785105 1.9400873318827656 1.2481665394580725 1.0116180790824516 0.9314497863026412 0.4250188373912557 0.48042855588587824 0.5086856698276004 -0.18864116776152437 0.8935343746060127 0.29162472875305195 0.3708849944820911 1.3046268229653302 1.145818341997217 0.16324671084032097 0.18864116776152437 0.08762521122251538 -0.7531303783884556 0.34423000787040914 -0.11275544983055917 -0.3442300078704089 -0.5664729456325054 +21 30430220 30431026 ENSG00000186971 1.7971034256260585 1.43208428708654 -1.5882958682169486 1.5056012163044221 0.6262178361515812 1.5882958682169486 -0.7531303783884556 2.498590560962256 -0.03751445734407257 0.11275544983055917 0.7867615829230666 0.4250188373912557 1.2481665394580725 0.34423000787040914 0.8568619257010015 1.9400873318827656 2.139206442985977 -0.6569361927965854 -0.11275544983055917 0.48042855588587824 -0.3708849944820911 -0.39780617203394536 -0.26563063350790206 -1.3655831908785105 -0.9314497863026412 0.2141578810056186 -0.18864116776152437 -2.1392064429859774 -1.9400873318827652 -0.9707539424317223 0.29162472875305195 0.4525499884018013 0.08762521122251538 -0.23981482260806397 -1.43208428708654 -0.13795711049811363 -1.0116180790824516 0.7203302308575226 -0.6262178361515811 -0.5960793860276631 0.9707539424317222 0.23981482260806397 0.6882873909026717 1.145818341997217 -0.3178174129491543 1.6835465976780204 0.3708849944820911 0.03751445734407243 -1.0542454124924512 -1.3046268229653297 -0.5664729456325054 -0.8935343746060127 0.5664729456325049 0.5960793860276631 1.1954271085021424 1.0116180790824516 -0.1632467108403211 1.0542454124924512 0.3978061720339455 -1.7971034256260587 -0.06255019758103977 0.18864116776152437 -0.012502212342580959 -1.68354659767802 -0.8568619257010015 -1.2481665394580725 -0.3442300078704089 -0.5086856698276004 0.8935343746060127 0.16324671084032097 0.13795711049811363 0.6569361927965854 0.012502212342580959 0.3178174129491543 -1.0988799140705434 -1.145818341997217 0.06255019758103977 -0.8213071752056109 -0.7867615829230669 -0.7203302308575226 -0.5373549665979251 -0.08762521122251522 0.5373549665979254 0.8213071752056109 1.0988799140705434 -0.6882873909026717 -0.21415788100561842 -0.29162472875305206 0.9314497863026412 -0.4250188373912558 1.3046268229653302 -0.48042855588587813 1.3655831908785105 0.7531303783884556 -2.498590560962256 0.5086856698276004 -0.4525499884018013 -1.1954271085021426 -1.505601216304423 0.26563063350790206 +21 31118416 31559977 ENSG00000156299 -2.498590560962256 1.5882958682169486 2.498590560962256 -0.7203302308575226 -0.18864116776152437 1.9400873318827656 1.7971034256260585 0.26563063350790206 0.6262178361515812 0.7203302308575226 -0.5086856698276004 0.34423000787040914 0.06255019758103977 0.29162472875305195 -0.26563063350790206 0.5373549665979254 -0.29162472875305206 -1.505601216304423 -0.6262178361515811 -0.9707539424317223 0.7867615829230666 -1.3655831908785105 -1.0542454124924512 0.8935343746060127 -1.0988799140705434 0.6569361927965854 -0.11275544983055917 1.1954271085021424 -0.9314497863026412 0.7531303783884556 0.8568619257010015 -0.3442300078704089 0.03751445734407243 -0.8568619257010015 0.5086856698276004 -1.145818341997217 -0.1632467108403211 -0.3708849944820911 -1.9400873318827652 0.4250188373912557 -0.03751445734407257 -0.08762521122251522 1.0988799140705434 -0.7531303783884556 0.3708849944820911 0.4525499884018013 0.9314497863026412 1.145818341997217 -0.4525499884018013 -0.5373549665979251 -0.6569361927965854 -0.06255019758103977 -1.0116180790824516 0.48042855588587824 -0.3178174129491543 1.3046268229653302 0.18864116776152437 0.8213071752056109 0.2141578810056186 1.2481665394580725 -0.8213071752056109 -0.012502212342580959 0.012502212342580959 -1.3046268229653297 -1.5882958682169486 1.43208428708654 -0.7867615829230669 1.0116180790824516 0.6882873909026717 -1.43208428708654 0.5664729456325049 -2.1392064429859774 -0.8935343746060127 -0.23981482260806397 0.08762521122251538 -0.39780617203394536 0.3978061720339455 0.5960793860276631 0.23981482260806397 -1.7971034256260587 -1.68354659767802 -0.5960793860276631 -0.48042855588587813 -0.6882873909026717 -0.4250188373912558 -0.13795711049811363 -1.1954271085021426 -1.2481665394580725 -0.21415788100561842 1.5056012163044221 0.16324671084032097 0.13795711049811363 1.6835465976780204 0.11275544983055917 1.0542454124924512 1.3655831908785105 -0.5664729456325054 0.9707539424317222 2.139206442985977 0.3178174129491543 +21 31873020 32044633 ENSG00000142149 2.139206442985977 -0.26563063350790206 0.3178174129491543 -0.1632467108403211 0.3708849944820911 1.2481665394580725 0.9314497863026412 0.9707539424317222 0.48042855588587824 0.7531303783884556 0.6882873909026717 0.012502212342580959 1.5882958682169486 0.5373549665979254 0.8935343746060127 1.1954271085021424 0.11275544983055917 1.9400873318827656 0.7203302308575226 0.03751445734407243 -1.145818341997217 -0.23981482260806397 -0.18864116776152437 -2.1392064429859774 0.6569361927965854 -0.8213071752056109 -0.4525499884018013 0.26563063350790206 0.29162472875305195 -0.3178174129491543 -0.7867615829230669 0.5664729456325049 -0.06255019758103977 -1.0988799140705434 -0.39780617203394536 -0.13795711049811363 -1.68354659767802 0.13795711049811363 0.4250188373912557 -1.3655831908785105 -0.5664729456325054 0.7867615829230666 0.5960793860276631 0.23981482260806397 -0.21415788100561842 -0.08762521122251522 -0.7203302308575226 -0.11275544983055917 0.6262178361515812 0.34423000787040914 -1.3046268229653297 -1.5882958682169486 0.08762521122251538 -0.6569361927965854 -0.5086856698276004 -0.5373549665979251 -1.0116180790824516 1.43208428708654 -0.6882873909026717 -2.498590560962256 -0.9707539424317223 -0.012502212342580959 1.3046268229653302 -0.4250188373912558 0.3978061720339455 -1.9400873318827652 1.0542454124924512 1.3655831908785105 1.145818341997217 -0.8568619257010015 -0.03751445734407257 -0.6262178361515811 -0.9314497863026412 -0.7531303783884556 2.498590560962256 -1.7971034256260587 -0.8935343746060127 -0.48042855588587813 -0.29162472875305206 -1.505601216304423 -1.2481665394580725 0.4525499884018013 0.8213071752056109 -0.5960793860276631 0.2141578810056186 -1.43208428708654 -1.0542454124924512 1.6835465976780204 0.18864116776152437 1.5056012163044221 1.0988799140705434 -1.1954271085021426 -0.3708849944820911 0.16324671084032097 0.8568619257010015 0.06255019758103977 1.0116180790824516 -0.3442300078704089 1.7971034256260585 0.5086856698276004 +21 32268228 32279049 ENSG00000159055 -1.0988799140705434 -0.6569361927965854 -1.3655831908785105 -1.505601216304423 -1.7971034256260587 -0.7867615829230669 -1.9400873318827652 -0.9707539424317223 -1.145818341997217 -1.1954271085021426 -0.6882873909026717 -1.43208428708654 -0.7203302308575226 -1.0542454124924512 -0.8213071752056109 -0.9314497863026412 -1.0116180790824516 -1.3046268229653297 -0.8568619257010015 0.2141578810056186 0.4250188373912557 -0.48042855588587813 0.26563063350790206 1.0988799140705434 1.0116180790824516 0.16324671084032097 0.29162472875305195 0.34423000787040914 0.48042855588587824 2.139206442985977 0.5960793860276631 0.5664729456325049 0.8568619257010015 0.23981482260806397 0.9314497863026412 0.9707539424317222 0.8935343746060127 -0.06255019758103977 0.6262178361515812 1.6835465976780204 0.13795711049811363 0.5086856698276004 -0.13795711049811363 0.3978061720339455 0.3178174129491543 1.1954271085021424 0.6882873909026717 0.5373549665979254 1.9400873318827656 1.7971034256260585 1.5882958682169486 2.498590560962256 0.11275544983055917 0.03751445734407243 0.3708849944820911 0.18864116776152437 1.0542454124924512 -1.68354659767802 0.06255019758103977 -2.498590560962256 -0.03751445734407257 1.5056012163044221 -0.012502212342580959 1.43208428708654 0.4525499884018013 0.7531303783884556 1.3655831908785105 0.08762521122251538 0.012502212342580959 1.2481665394580725 0.7867615829230666 1.145818341997217 0.7203302308575226 1.3046268229653302 -2.1392064429859774 0.6569361927965854 -0.4525499884018013 -0.3442300078704089 -0.1632467108403211 -0.3708849944820911 -0.18864116776152437 -0.21415788100561842 -0.5960793860276631 -0.23981482260806397 -0.29162472875305206 -0.08762521122251522 0.8213071752056109 -0.5373549665979251 -0.26563063350790206 -0.39780617203394536 -0.5086856698276004 -0.3178174129491543 -1.5882958682169486 -0.8935343746060127 -1.2481665394580725 -0.4250188373912558 -0.6262178361515811 -0.7531303783884556 -0.5664729456325054 -0.11275544983055917 +21 32311018 32393012 ENSG00000142207 1.9400873318827656 0.7531303783884556 0.4250188373912557 -0.5664729456325054 -0.21415788100561842 -0.08762521122251522 -0.5086856698276004 -0.29162472875305206 0.6262178361515812 -0.4250188373912558 0.5664729456325049 1.3655831908785105 0.34423000787040914 2.139206442985977 -0.4525499884018013 -0.5960793860276631 -0.48042855588587813 0.9314497863026412 -0.13795711049811363 0.7867615829230666 0.3708849944820911 -1.43208428708654 0.03751445734407243 1.0116180790824516 1.1954271085021424 1.145818341997217 1.5882958682169486 0.06255019758103977 0.6569361927965854 -0.012502212342580959 -0.23981482260806397 -0.9707539424317223 -0.3708849944820911 1.0542454124924512 -1.3655831908785105 -0.26563063350790206 -0.03751445734407257 0.7203302308575226 0.012502212342580959 -1.0116180790824516 -0.3442300078704089 0.5960793860276631 -0.9314497863026412 0.23981482260806397 0.18864116776152437 -0.6882873909026717 -0.5373549665979251 -0.6262178361515811 -1.2481665394580725 0.11275544983055917 -0.8568619257010015 0.3178174129491543 -0.6569361927965854 1.0988799140705434 -0.8935343746060127 -0.18864116776152437 -0.7867615829230669 1.5056012163044221 0.5373549665979254 0.29162472875305195 -1.3046268229653297 -0.06255019758103977 -0.7531303783884556 0.8935343746060127 0.13795711049811363 0.9707539424317222 1.3046268229653302 0.48042855588587824 -0.11275544983055917 1.43208428708654 1.7971034256260585 1.6835465976780204 -1.1954271085021426 0.16324671084032097 1.2481665394580725 0.4525499884018013 -1.0542454124924512 0.5086856698276004 -1.5882958682169486 -1.9400873318827652 -1.7971034256260587 -1.68354659767802 -1.145818341997217 -1.0988799140705434 -0.7203302308575226 -0.39780617203394536 0.2141578810056186 -1.505601216304423 -0.8213071752056109 -0.3178174129491543 -2.498590560962256 -2.1392064429859774 0.6882873909026717 0.08762521122251538 0.8213071752056109 0.8568619257010015 0.26563063350790206 0.3978061720339455 2.498590560962256 -0.1632467108403211 +21 32628759 32728040 ENSG00000159082 -0.26563063350790206 -0.18864116776152437 1.0988799140705434 -1.5882958682169486 -0.9314497863026412 0.8935343746060127 -0.6882873909026717 -1.3655831908785105 -0.48042855588587813 -0.29162472875305206 -0.6569361927965854 0.29162472875305195 -0.3708849944820911 0.2141578810056186 0.3708849944820911 -1.0542454124924512 -0.39780617203394536 0.08762521122251538 0.34423000787040914 0.4525499884018013 0.3978061720339455 -1.0988799140705434 0.8213071752056109 -0.5373549665979251 0.16324671084032097 1.1954271085021424 -0.13795711049811363 -0.4250188373912558 -0.3442300078704089 -0.8568619257010015 0.3178174129491543 1.145818341997217 1.9400873318827656 1.6835465976780204 -1.7971034256260587 -0.6262178361515811 0.9707539424317222 1.2481665394580725 0.9314497863026412 1.5056012163044221 0.4250188373912557 2.498590560962256 -0.8213071752056109 0.6882873909026717 0.5960793860276631 0.7203302308575226 1.0542454124924512 1.43208428708654 0.11275544983055917 -0.23981482260806397 0.13795711049811363 1.3655831908785105 1.3046268229653302 0.7867615829230666 -0.06255019758103977 0.8568619257010015 0.5086856698276004 0.6569361927965854 -0.7203302308575226 -0.9707539424317223 -1.3046268229653297 -0.21415788100561842 2.139206442985977 0.5373549665979254 0.06255019758103977 -0.03751445734407257 -0.3178174129491543 1.0116180790824516 0.012502212342580959 1.5882958682169486 -0.5664729456325054 0.6262178361515812 -0.08762521122251522 -0.1632467108403211 0.7531303783884556 -0.7867615829230669 -0.012502212342580959 0.23981482260806397 -0.5960793860276631 -1.505601216304423 -2.498590560962256 -2.1392064429859774 -0.5086856698276004 -1.43208428708654 -1.145818341997217 -1.68354659767802 -1.1954271085021426 -1.2481665394580725 -0.11275544983055917 0.26563063350790206 -0.4525499884018013 -1.9400873318827652 -0.8935343746060127 0.18864116776152437 -0.7531303783884556 -1.0116180790824516 0.03751445734407243 1.7971034256260585 0.5664729456325049 0.48042855588587824 +21 32733899 32771792 ENSG00000159086 1.3046268229653302 0.18864116776152437 -0.26563063350790206 0.3978061720339455 1.5056012163044221 0.8935343746060127 -0.03751445734407257 0.8213071752056109 1.7971034256260585 1.0542454124924512 0.5960793860276631 1.145818341997217 0.5373549665979254 -0.1632467108403211 0.6569361927965854 0.4250188373912557 1.43208428708654 1.9400873318827656 0.26563063350790206 0.29162472875305195 -0.13795711049811363 -2.498590560962256 -0.9707539424317223 -0.3178174129491543 0.08762521122251538 -0.012502212342580959 0.4525499884018013 -0.6882873909026717 -0.7531303783884556 -0.7867615829230669 -1.0116180790824516 1.5882958682169486 0.13795711049811363 -0.5960793860276631 -1.1954271085021426 -1.3046268229653297 -0.6262178361515811 -0.5664729456325054 0.7867615829230666 0.3178174129491543 -0.5086856698276004 1.2481665394580725 -1.68354659767802 0.2141578810056186 -0.6569361927965854 0.5086856698276004 0.3708849944820911 -0.3442300078704089 -0.29162472875305206 0.23981482260806397 0.012502212342580959 1.6835465976780204 -0.08762521122251522 0.34423000787040914 -0.23981482260806397 -0.4250188373912558 -0.18864116776152437 1.0988799140705434 -1.145818341997217 1.1954271085021424 -1.0542454124924512 0.03751445734407243 0.5664729456325049 0.16324671084032097 -0.9314497863026412 -0.48042855588587813 -0.4525499884018013 -0.39780617203394536 -0.5373549665979251 -0.06255019758103977 -0.3708849944820911 0.48042855588587824 -0.8568619257010015 -0.11275544983055917 2.139206442985977 -0.8213071752056109 0.11275544983055917 0.6882873909026717 -1.2481665394580725 -1.43208428708654 -2.1392064429859774 -1.9400873318827652 -1.0988799140705434 -1.7971034256260587 -1.3655831908785105 -1.5882958682169486 -0.7203302308575226 -0.8935343746060127 -0.21415788100561842 0.7531303783884556 0.06255019758103977 -1.505601216304423 0.9314497863026412 1.0116180790824516 0.7203302308575226 0.8568619257010015 0.6262178361515812 2.498590560962256 1.3655831908785105 0.9707539424317222 +21 33070141 33072413 ENSG00000184221 -1.68354659767802 0.16324671084032097 -2.1392064429859774 -0.3178174129491543 -0.9707539424317223 -0.6882873909026717 -1.43208428708654 -1.0988799140705434 0.012502212342580959 0.03751445734407243 -0.8935343746060127 -1.145818341997217 -0.8213071752056109 -0.5664729456325054 -0.8568619257010015 -0.18864116776152437 -1.0116180790824516 -1.3655831908785105 -0.5086856698276004 -1.0542454124924512 1.3655831908785105 -0.7203302308575226 0.23981482260806397 0.8935343746060127 -1.505601216304423 0.5960793860276631 -0.012502212342580959 0.6882873909026717 1.0116180790824516 0.6262178361515812 -0.08762521122251522 1.6835465976780204 1.2481665394580725 -0.06255019758103977 0.7203302308575226 -0.29162472875305206 1.7971034256260585 -0.13795711049811363 -0.11275544983055917 2.139206442985977 1.3046268229653302 -1.1954271085021426 0.8568619257010015 1.0988799140705434 0.7531303783884556 0.3708849944820911 0.7867615829230666 0.26563063350790206 0.5664729456325049 0.4250188373912557 1.43208428708654 0.18864116776152437 -0.4250188373912558 1.5882958682169486 0.13795711049811363 -0.48042855588587813 0.8213071752056109 -0.4525499884018013 0.9314497863026412 -2.498590560962256 1.5056012163044221 -0.6262178361515811 -0.6569361927965854 0.3178174129491543 -0.7867615829230669 0.08762521122251538 -1.2481665394580725 -1.3046268229653297 -0.3708849944820911 -0.1632467108403211 0.06255019758103977 -0.7531303783884556 1.145818341997217 0.2141578810056186 -1.5882958682169486 -0.39780617203394536 0.3978061720339455 -0.26563063350790206 2.498590560962256 -0.23981482260806397 1.1954271085021424 0.48042855588587824 1.9400873318827656 1.0542454124924512 0.5086856698276004 0.34423000787040914 -0.03751445734407257 0.5373549665979254 0.11275544983055917 -0.3442300078704089 0.6569361927965854 0.29162472875305195 -1.7971034256260587 -0.9314497863026412 -0.5960793860276631 -0.5373549665979251 0.9707539424317222 -0.21415788100561842 -1.9400873318827652 0.4525499884018013 +21 33205282 33265675 ENSG00000159110 0.012502212342580959 -0.8935343746060127 -1.9400873318827652 -0.6882873909026717 -0.13795711049811363 -0.012502212342580959 -0.6569361927965854 -0.4250188373912558 -1.68354659767802 1.7971034256260585 0.34423000787040914 -1.43208428708654 -1.505601216304423 1.5882958682169486 -0.18864116776152437 -1.5882958682169486 -0.08762521122251522 -0.5960793860276631 -0.3442300078704089 -0.3178174129491543 0.9314497863026412 0.5960793860276631 1.5056012163044221 -0.29162472875305206 0.7867615829230666 0.13795711049811363 -0.6262178361515811 -0.21415788100561842 -0.39780617203394536 -0.5664729456325054 0.23981482260806397 0.4250188373912557 1.0542454124924512 -0.4525499884018013 -1.2481665394580725 1.0116180790824516 1.2481665394580725 1.6835465976780204 0.48042855588587824 1.3655831908785105 0.03751445734407243 0.8213071752056109 0.6569361927965854 0.4525499884018013 0.5664729456325049 0.9707539424317222 0.26563063350790206 -0.9314497863026412 -1.1954271085021426 -1.0542454124924512 -0.03751445734407257 0.11275544983055917 -0.7531303783884556 -0.23981482260806397 0.8935343746060127 0.8568619257010015 0.08762521122251538 -1.145818341997217 -0.06255019758103977 -2.498590560962256 0.5373549665979254 0.5086856698276004 0.29162472875305195 -0.7203302308575226 -0.1632467108403211 -1.3046268229653297 -1.0988799140705434 -0.3708849944820911 0.16324671084032097 -0.9707539424317223 -0.5373549665979251 1.1954271085021424 -1.0116180790824516 -0.8568619257010015 -2.1392064429859774 -0.5086856698276004 0.3708849944820911 0.2141578810056186 1.9400873318827656 1.3046268229653302 0.06255019758103977 0.18864116776152437 0.7203302308575226 0.7531303783884556 0.6262178361515812 1.0988799140705434 -0.26563063350790206 2.139206442985977 1.43208428708654 0.3978061720339455 1.145818341997217 2.498590560962256 -0.11275544983055917 -0.48042855588587813 0.3178174129491543 -1.3655831908785105 0.6882873909026717 -1.7971034256260587 -0.7867615829230669 -0.8213071752056109 +21 33266367 33311420 ENSG00000243646 -0.7203302308575226 -1.3655831908785105 0.29162472875305195 -0.1632467108403211 -0.8935343746060127 -0.5960793860276631 0.5664729456325049 0.3708849944820911 -1.43208428708654 0.11275544983055917 -0.6569361927965854 -1.145818341997217 -0.39780617203394536 -0.4525499884018013 -0.26563063350790206 -0.6262178361515811 -0.29162472875305206 -0.9314497863026412 -1.5882958682169486 0.18864116776152437 -0.11275544983055917 1.5882958682169486 0.6569361927965854 -0.012502212342580959 -0.08762521122251522 -1.68354659767802 -1.9400873318827652 0.012502212342580959 -0.03751445734407257 -1.0116180790824516 0.7531303783884556 -0.13795711049811363 -0.21415788100561842 0.34423000787040914 -0.3708849944820911 1.43208428708654 1.0988799140705434 0.2141578810056186 -0.48042855588587813 0.26563063350790206 -0.06255019758103977 -0.3178174129491543 1.3046268229653302 0.5373549665979254 -0.23981482260806397 0.4250188373912557 0.3978061720339455 -0.5664729456325054 0.16324671084032097 -0.9707539424317223 0.06255019758103977 -1.1954271085021426 -0.5086856698276004 0.7203302308575226 0.8213071752056109 0.8568619257010015 -0.5373549665979251 -0.8568619257010015 0.6262178361515812 -1.2481665394580725 1.2481665394580725 0.5086856698276004 0.7867615829230666 0.6882873909026717 1.5056012163044221 0.9707539424317222 0.5960793860276631 0.03751445734407243 0.4525499884018013 0.48042855588587824 0.8935343746060127 0.23981482260806397 1.145818341997217 -0.7867615829230669 -1.505601216304423 -0.4250188373912558 -0.18864116776152437 0.13795711049811363 1.3655831908785105 2.498590560962256 1.1954271085021424 1.0116180790824516 0.3178174129491543 0.08762521122251538 1.6835465976780204 0.9314497863026412 -1.0988799140705434 2.139206442985977 1.0542454124924512 -0.7531303783884556 1.9400873318827656 1.7971034256260585 -0.3442300078704089 -1.0542454124924512 -2.1392064429859774 -1.7971034256260587 -1.3046268229653297 -2.498590560962256 -0.8213071752056109 -0.6882873909026717 +21 33403413 33479348 ENSG00000159128 2.498590560962256 1.7971034256260585 -1.2481665394580725 0.9314497863026412 1.9400873318827656 -0.03751445734407257 -1.68354659767802 1.3655831908785105 1.0542454124924512 1.145818341997217 1.43208428708654 0.8568619257010015 0.18864116776152437 0.6569361927965854 0.3978061720339455 0.8213071752056109 0.6882873909026717 1.0116180790824516 0.5664729456325049 -0.7531303783884556 -1.0988799140705434 0.08762521122251538 -1.0542454124924512 -0.6262178361515811 -0.7867615829230669 -1.43208428708654 -1.145818341997217 -0.012502212342580959 -0.13795711049811363 -1.7971034256260587 -0.5086856698276004 0.16324671084032097 0.48042855588587824 -0.5664729456325054 -0.6569361927965854 0.7203302308575226 0.7867615829230666 -0.3708849944820911 -0.4525499884018013 0.4525499884018013 -0.8213071752056109 -0.18864116776152437 0.5373549665979254 -0.29162472875305206 -1.3046268229653297 -0.06255019758103977 0.03751445734407243 -0.48042855588587813 -0.1632467108403211 -0.3178174129491543 -0.26563063350790206 -2.1392064429859774 -0.5960793860276631 -2.498590560962256 -0.39780617203394536 -1.505601216304423 -1.9400873318827652 0.5960793860276631 0.012502212342580959 1.6835465976780204 0.06255019758103977 -0.23981482260806397 0.34423000787040914 -0.8568619257010015 0.29162472875305195 -0.9314497863026412 -1.0116180790824516 -0.4250188373912558 -0.6882873909026717 -1.3655831908785105 -1.5882958682169486 -0.8935343746060127 1.2481665394580725 -0.3442300078704089 1.0988799140705434 -0.9707539424317223 0.9707539424317222 1.5882958682169486 0.2141578810056186 0.26563063350790206 -0.7203302308575226 -0.21415788100561842 0.5086856698276004 -0.08762521122251522 0.11275544983055917 -1.1954271085021426 -0.5373549665979251 2.139206442985977 0.4250188373912557 0.6262178361515812 1.5056012163044221 0.23981482260806397 1.3046268229653302 -0.11275544983055917 0.8935343746060127 0.13795711049811363 1.1954271085021424 0.7531303783884556 0.3708849944820911 0.3178174129491543 +21 33559542 33588706 ENSG00000159147 -1.7971034256260587 -0.8935343746060127 -1.68354659767802 -1.0116180790824516 -1.1954271085021426 -1.0988799140705434 -0.9314497863026412 -0.1632467108403211 -0.11275544983055917 -2.1392064429859774 -0.3708849944820911 -1.2481665394580725 -0.4525499884018013 -0.6882873909026717 -0.8568619257010015 -0.7531303783884556 -0.29162472875305206 -0.8213071752056109 -0.7867615829230669 0.9314497863026412 0.5086856698276004 -0.5373549665979251 0.8213071752056109 1.5882958682169486 2.498590560962256 0.5960793860276631 1.0542454124924512 -0.03751445734407257 0.7203302308575226 1.1954271085021424 0.3708849944820911 0.8935343746060127 0.18864116776152437 0.7531303783884556 0.6882873909026717 0.3178174129491543 0.26563063350790206 -0.08762521122251522 0.6262178361515812 0.2141578810056186 -0.012502212342580959 0.23981482260806397 0.11275544983055917 0.5664729456325049 -0.06255019758103977 1.0116180790824516 0.03751445734407243 0.13795711049811363 -0.13795711049811363 1.145818341997217 0.08762521122251538 2.139206442985977 0.8568619257010015 0.48042855588587824 0.012502212342580959 0.06255019758103977 1.3655831908785105 -1.5882958682169486 0.4250188373912557 -2.498590560962256 1.0988799140705434 1.7971034256260585 0.5373549665979254 1.43208428708654 0.29162472875305195 0.9707539424317222 1.5056012163044221 0.6569361927965854 0.16324671084032097 1.2481665394580725 1.9400873318827656 1.6835465976780204 0.4525499884018013 1.3046268229653302 -1.43208428708654 0.7867615829230666 -0.6569361927965854 -0.26563063350790206 -0.7203302308575226 -0.5664729456325054 -0.3178174129491543 -0.39780617203394536 -1.9400873318827652 -1.0542454124924512 -0.5960793860276631 0.3978061720339455 0.34423000787040914 -0.9707539424317223 -0.5086856698276004 -0.23981482260806397 -1.3655831908785105 -0.3442300078704089 -0.48042855588587813 -1.145818341997217 -1.505601216304423 -0.6262178361515811 -0.4250188373912558 -0.18864116776152437 -1.3046268229653297 -0.21415788100561842 +21 33642400 33899861 ENSG00000205726 0.4250188373912557 -1.3046268229653297 2.139206442985977 -1.9400873318827652 2.498590560962256 0.11275544983055917 -2.498590560962256 -0.8213071752056109 -1.0988799140705434 -0.9707539424317223 -0.21415788100561842 -0.4525499884018013 0.16324671084032097 0.18864116776152437 -1.0116180790824516 -1.1954271085021426 -0.5086856698276004 -1.505601216304423 -1.43208428708654 -1.68354659767802 0.29162472875305195 -0.08762521122251522 0.5373549665979254 0.3978061720339455 0.9707539424317222 1.1954271085021424 1.5056012163044221 0.012502212342580959 0.3178174129491543 -0.03751445734407257 1.5882958682169486 1.3046268229653302 0.03751445734407243 0.8935343746060127 -0.18864116776152437 -0.4250188373912558 -0.29162472875305206 -0.3178174129491543 1.6835465976780204 -0.11275544983055917 -0.6262178361515811 0.7867615829230666 0.5086856698276004 -0.8568619257010015 -0.3442300078704089 -0.39780617203394536 0.13795711049811363 -0.06255019758103977 0.06255019758103977 0.34423000787040914 -0.6569361927965854 0.6882873909026717 0.7203302308575226 -0.7203302308575226 -0.5960793860276631 -0.012502212342580959 -0.6882873909026717 -0.8935343746060127 -0.1632467108403211 -1.3655831908785105 -0.13795711049811363 1.9400873318827656 1.0542454124924512 0.48042855588587824 0.5664729456325049 0.7531303783884556 1.43208428708654 1.0988799140705434 1.0116180790824516 1.7971034256260585 1.145818341997217 0.6262178361515812 -0.26563063350790206 0.5960793860276631 0.4525499884018013 0.26563063350790206 1.3655831908785105 0.3708849944820911 -0.5664729456325054 -1.0542454124924512 -0.23981482260806397 -1.7971034256260587 0.08762521122251538 0.23981482260806397 -0.3708849944820911 1.2481665394580725 0.6569361927965854 -1.5882958682169486 0.8568619257010015 0.9314497863026412 -0.7867615829230669 -1.2481665394580725 -0.48042855588587813 -0.5373549665979251 -1.145818341997217 0.2141578810056186 -2.1392064429859774 -0.7531303783884556 0.8213071752056109 -0.9314497863026412 +21 34073578 34106260 ENSG00000198743 0.16324671084032097 0.7203302308575226 0.8935343746060127 0.3978061720339455 1.0116180790824516 0.5373549665979254 2.139206442985977 -0.08762521122251522 1.0988799140705434 1.9400873318827656 0.48042855588587824 0.3178174129491543 0.13795711049811363 0.4250188373912557 1.6835465976780204 0.012502212342580959 0.6262178361515812 0.8568619257010015 0.3708849944820911 0.03751445734407243 -0.5960793860276631 -2.1392064429859774 0.18864116776152437 0.11275544983055917 0.34423000787040914 -0.6882873909026717 -1.3655831908785105 -1.3046268229653297 0.06255019758103977 -0.8568619257010015 -0.3178174129491543 -0.26563063350790206 1.3046268229653302 -1.2481665394580725 -2.498590560962256 -0.03751445734407257 0.8213071752056109 -1.145818341997217 0.7531303783884556 0.5960793860276631 -1.0116180790824516 0.23981482260806397 -0.012502212342580959 0.7867615829230666 -0.8213071752056109 -0.7867615829230669 1.1954271085021424 0.6882873909026717 0.08762521122251538 -0.5086856698276004 0.5664729456325049 1.3655831908785105 -0.6569361927965854 0.5086856698276004 -1.0542454124924512 -0.13795711049811363 -0.06255019758103977 -0.39780617203394536 -0.7203302308575226 1.5882958682169486 0.9707539424317222 -0.8935343746060127 -0.5664729456325054 0.9314497863026412 -0.4250188373912558 1.145818341997217 0.29162472875305195 -1.68354659767802 -0.23981482260806397 -0.5373549665979251 -0.4525499884018013 0.2141578810056186 -1.7971034256260587 -1.505601216304423 0.4525499884018013 -1.1954271085021426 -0.1632467108403211 -1.5882958682169486 -0.3442300078704089 -0.29162472875305206 0.26563063350790206 -0.21415788100561842 -0.9314497863026412 -0.9707539424317223 -0.6262178361515811 -0.7531303783884556 -1.9400873318827652 -0.3708849944820911 -0.11275544983055917 -0.48042855588587813 -0.18864116776152437 -1.43208428708654 1.7971034256260585 1.2481665394580725 1.43208428708654 -1.0988799140705434 2.498590560962256 1.5056012163044221 1.0542454124924512 0.6569361927965854 +21 34513142 34615113 ENSG00000159200 1.0988799140705434 -0.5373549665979251 0.7203302308575226 -0.3708849944820911 2.498590560962256 -0.03751445734407257 -0.6262178361515811 0.2141578810056186 0.012502212342580959 1.3046268229653302 0.8568619257010015 1.145818341997217 1.5882958682169486 0.18864116776152437 0.9707539424317222 -0.6882873909026717 0.5373549665979254 0.4525499884018013 0.16324671084032097 0.6569361927965854 0.5960793860276631 -1.0116180790824516 -0.26563063350790206 0.34423000787040914 1.3655831908785105 -0.18864116776152437 0.8213071752056109 -2.498590560962256 -1.3655831908785105 -1.2481665394580725 0.5664729456325049 -0.8935343746060127 -0.9707539424317223 -0.3442300078704089 -1.68354659767802 -1.505601216304423 -0.48042855588587813 -0.13795711049811363 1.9400873318827656 -0.8568619257010015 -0.7203302308575226 1.0542454124924512 -1.7971034256260587 -0.7867615829230669 -1.0542454124924512 -0.21415788100561842 -0.06255019758103977 -0.29162472875305206 -0.9314497863026412 1.0116180790824516 -1.3046268229653297 0.23981482260806397 0.7867615829230666 -0.11275544983055917 -0.4525499884018013 -0.08762521122251522 -0.6569361927965854 0.3708849944820911 -0.8213071752056109 -0.39780617203394536 0.03751445734407243 1.1954271085021424 0.11275544983055917 0.6882873909026717 0.7531303783884556 0.08762521122251538 1.2481665394580725 -0.23981482260806397 0.4250188373912557 0.06255019758103977 0.26563063350790206 1.5056012163044221 -1.145818341997217 1.43208428708654 0.8935343746060127 1.6835465976780204 -0.5086856698276004 0.3978061720339455 -0.5664729456325054 -0.5960793860276631 -1.43208428708654 -1.1954271085021426 -1.9400873318827652 -0.7531303783884556 -0.3178174129491543 -0.1632467108403211 2.139206442985977 -1.0988799140705434 -0.012502212342580959 0.5086856698276004 -2.1392064429859774 -1.5882958682169486 0.6262178361515812 0.48042855588587824 0.3178174129491543 0.13795711049811363 -0.4250188373912558 0.29162472875305195 1.7971034256260585 0.9314497863026412 +21 34668994 34718227 ENSG00000159212 1.1954271085021424 -0.7867615829230669 0.06255019758103977 -0.9707539424317223 2.139206442985977 0.34423000787040914 -1.3655831908785105 -0.5960793860276631 -0.29162472875305206 0.9707539424317222 0.8213071752056109 0.6262178361515812 0.5664729456325049 -1.43208428708654 0.5960793860276631 -0.3178174129491543 -0.08762521122251522 -0.012502212342580959 -0.6262178361515811 0.23981482260806397 0.26563063350790206 -0.8213071752056109 -1.68354659767802 -0.03751445734407257 0.7531303783884556 -0.11275544983055917 0.5086856698276004 -2.1392064429859774 -0.7203302308575226 -1.0542454124924512 0.8935343746060127 -0.4250188373912558 -0.1632467108403211 -0.06255019758103977 -1.7971034256260587 -1.505601216304423 -0.7531303783884556 1.0116180790824516 1.9400873318827656 0.03751445734407243 -0.18864116776152437 1.0988799140705434 -2.498590560962256 -0.48042855588587813 -1.2481665394580725 -0.39780617203394536 0.6569361927965854 0.4250188373912557 -1.145818341997217 0.7203302308575226 -0.8935343746060127 -1.3046268229653297 0.9314497863026412 -0.6882873909026717 0.08762521122251538 1.145818341997217 -1.9400873318827652 -0.13795711049811363 -0.6569361927965854 -1.1954271085021426 0.11275544983055917 1.5882958682169486 0.48042855588587824 0.4525499884018013 1.3655831908785105 -0.5664729456325054 1.2481665394580725 -0.23981482260806397 0.13795711049811363 -0.3708849944820911 0.18864116776152437 1.3046268229653302 -0.9314497863026412 1.43208428708654 0.3178174129491543 0.7867615829230666 0.5373549665979254 1.5056012163044221 -0.26563063350790206 0.16324671084032097 -1.0116180790824516 0.2141578810056186 0.3978061720339455 -0.5086856698276004 0.29162472875305195 0.3708849944820911 1.0542454124924512 -0.21415788100561842 1.6835465976780204 1.7971034256260585 -1.5882958682169486 -0.8568619257010015 -0.5373549665979251 -0.4525499884018013 0.012502212342580959 -0.3442300078704089 -1.0988799140705434 0.8568619257010015 2.498590560962256 0.6882873909026717 +21 34787801 36004667 ENSG00000159216 -2.498590560962256 -1.9400873318827652 1.5882958682169486 -0.8568619257010015 -0.48042855588587813 -0.3178174129491543 0.3178174129491543 -0.7867615829230669 -1.505601216304423 -0.6882873909026717 -1.145818341997217 0.26563063350790206 1.0988799140705434 -1.68354659767802 -0.7531303783884556 -0.5664729456325054 -0.5086856698276004 -0.7203302308575226 -0.9707539424317223 -0.11275544983055917 0.6569361927965854 0.8935343746060127 0.5373549665979254 0.11275544983055917 -0.39780617203394536 0.8568619257010015 1.2481665394580725 0.9314497863026412 1.43208428708654 1.7971034256260585 0.6262178361515812 1.145818341997217 0.06255019758103977 0.5960793860276631 0.7203302308575226 -1.3046268229653297 -0.13795711049811363 2.498590560962256 0.5664729456325049 -0.5960793860276631 0.7867615829230666 0.3978061720339455 -0.23981482260806397 -0.012502212342580959 -1.0988799140705434 -0.03751445734407257 0.3708849944820911 -0.08762521122251522 0.34423000787040914 0.7531303783884556 -0.29162472875305206 -1.1954271085021426 1.1954271085021424 1.0116180790824516 -0.4250188373912558 -0.26563063350790206 -0.1632467108403211 1.3046268229653302 -0.6262178361515811 0.012502212342580959 -0.8213071752056109 1.6835465976780204 1.0542454124924512 0.2141578810056186 -1.5882958682169486 -0.3708849944820911 1.5056012163044221 -1.7971034256260587 0.9707539424317222 -0.18864116776152437 0.6882873909026717 2.139206442985977 -0.3442300078704089 -0.06255019758103977 0.48042855588587824 1.3655831908785105 0.8213071752056109 -1.0116180790824516 0.13795711049811363 -0.5373549665979251 -1.2481665394580725 0.08762521122251538 0.18864116776152437 0.23981482260806397 0.4525499884018013 -0.4525499884018013 1.9400873318827656 -0.6569361927965854 -0.21415788100561842 0.16324671084032097 0.4250188373912557 -0.9314497863026412 0.03751445734407243 0.29162472875305195 -0.8935343746060127 -1.0542454124924512 -1.43208428708654 -2.1392064429859774 -1.3655831908785105 0.5086856698276004 +21 36069941 36073166 ENSG00000159228 -0.6262178361515811 -0.48042855588587813 0.29162472875305195 0.012502212342580959 0.6262178361515812 -1.145818341997217 0.13795711049811363 0.4525499884018013 -0.9707539424317223 -0.11275544983055917 1.6835465976780204 -1.505601216304423 -0.7531303783884556 -1.68354659767802 0.4250188373912557 0.23981482260806397 0.06255019758103977 0.03751445734407243 -2.498590560962256 0.5960793860276631 -0.06255019758103977 -1.3046268229653297 -0.23981482260806397 1.5056012163044221 2.498590560962256 -0.012502212342580959 0.16324671084032097 -0.8568619257010015 -1.7971034256260587 0.9314497863026412 0.7867615829230666 -1.0542454124924512 -0.4250188373912558 0.3178174129491543 1.0116180790824516 1.2481665394580725 -0.6882873909026717 -0.03751445734407257 2.139206442985977 0.8568619257010015 -0.13795711049811363 -0.21415788100561842 -1.43208428708654 0.48042855588587824 -1.5882958682169486 0.9707539424317222 0.18864116776152437 0.08762521122251538 0.7203302308575226 1.0988799140705434 -0.26563063350790206 -0.6569361927965854 0.7531303783884556 -0.39780617203394536 1.0542454124924512 -0.8213071752056109 0.6569361927965854 -0.7203302308575226 -0.5086856698276004 -0.08762521122251522 0.5664729456325049 1.3046268229653302 -0.5960793860276631 1.5882958682169486 1.3655831908785105 1.1954271085021424 1.9400873318827656 0.5373549665979254 -0.29162472875305206 -2.1392064429859774 1.7971034256260585 0.26563063350790206 0.6882873909026717 1.145818341997217 -0.3442300078704089 1.43208428708654 -1.2481665394580725 -0.5664729456325054 -1.0116180790824516 -0.3708849944820911 0.8935343746060127 0.3978061720339455 -0.9314497863026412 -0.3178174129491543 -0.7867615829230669 -0.5373549665979251 0.8213071752056109 -1.1954271085021426 -0.1632467108403211 -0.18864116776152437 -1.9400873318827652 0.11275544983055917 0.3708849944820911 0.5086856698276004 0.2141578810056186 -1.3655831908785105 -0.8935343746060127 -0.4525499884018013 0.34423000787040914 -1.0988799140705434 +21 36135079 36146562 ENSG00000159231 -0.4525499884018013 -1.9400873318827652 0.11275544983055917 0.16324671084032097 0.9707539424317222 -0.5086856698276004 -0.3708849944820911 -0.1632467108403211 -0.48042855588587813 -0.7531303783884556 2.498590560962256 -1.68354659767802 1.43208428708654 1.9400873318827656 0.2141578810056186 0.8213071752056109 0.6882873909026717 -0.9314497863026412 -0.29162472875305206 -1.5882958682169486 -0.8935343746060127 1.0116180790824516 -0.5960793860276631 -0.012502212342580959 0.9314497863026412 -1.7971034256260587 -1.3046268229653297 -1.2481665394580725 1.145818341997217 -1.43208428708654 -0.23981482260806397 -0.11275544983055917 -0.4250188373912558 0.29162472875305195 -0.7867615829230669 -0.3178174129491543 0.34423000787040914 -0.6569361927965854 1.6835465976780204 0.7203302308575226 -1.505601216304423 0.23981482260806397 0.03751445734407243 -0.18864116776152437 -0.08762521122251522 1.3046268229653302 0.26563063350790206 0.08762521122251538 0.3178174129491543 0.7531303783884556 2.139206442985977 -2.1392064429859774 0.5664729456325049 -0.9707539424317223 -0.3442300078704089 -0.8568619257010015 0.012502212342580959 0.13795711049811363 -0.21415788100561842 -1.1954271085021426 -0.06255019758103977 -0.39780617203394536 0.5960793860276631 -1.145818341997217 0.7867615829230666 -1.0542454124924512 1.0542454124924512 -0.13795711049811363 -0.26563063350790206 0.8935343746060127 -1.0988799140705434 0.8568619257010015 0.3708849944820911 -1.3655831908785105 0.18864116776152437 0.6262178361515812 0.4250188373912557 1.1954271085021424 1.2481665394580725 -0.6882873909026717 -0.03751445734407257 -0.8213071752056109 1.5056012163044221 0.06255019758103977 1.0988799140705434 1.5882958682169486 -0.5664729456325054 0.6569361927965854 1.3655831908785105 0.5373549665979254 0.4525499884018013 0.5086856698276004 -0.5373549665979251 1.7971034256260585 0.48042855588587824 -1.0116180790824516 -0.6262178361515811 -2.498590560962256 0.3978061720339455 -0.7203302308575226 +21 36156782 36294274 ENSG00000142197 0.5664729456325049 -1.68354659767802 -0.3178174129491543 -0.6262178361515811 1.43208428708654 0.9314497863026412 -2.498590560962256 -1.43208428708654 -1.0542454124924512 -0.6882873909026717 -0.5373549665979251 2.139206442985977 2.498590560962256 0.16324671084032097 -0.29162472875305206 -1.2481665394580725 -0.4525499884018013 -0.26563063350790206 -1.145818341997217 -0.03751445734407257 -1.3046268229653297 0.11275544983055917 0.7203302308575226 1.0988799140705434 0.8935343746060127 0.7867615829230666 1.1954271085021424 -0.9314497863026412 -0.012502212342580959 -1.5882958682169486 0.5373549665979254 -0.21415788100561842 -0.08762521122251522 0.6262178361515812 -0.5960793860276631 0.08762521122251538 0.23981482260806397 0.4525499884018013 1.5056012163044221 -0.5086856698276004 0.5960793860276631 1.5882958682169486 0.34423000787040914 -0.7867615829230669 0.18864116776152437 -0.11275544983055917 -0.3708849944820911 -0.8568619257010015 -0.06255019758103977 0.8568619257010015 -0.6569361927965854 -0.7203302308575226 1.7971034256260585 -0.8213071752056109 0.13795711049811363 -1.505601216304423 -0.18864116776152437 0.3978061720339455 0.2141578810056186 -0.3442300078704089 -1.0988799140705434 1.0542454124924512 1.0116180790824516 0.7531303783884556 1.3655831908785105 -0.48042855588587813 1.145818341997217 1.3046268229653302 0.03751445734407243 1.2481665394580725 0.9707539424317222 -0.39780617203394536 -1.3655831908785105 0.48042855588587824 0.8213071752056109 -0.7531303783884556 -0.1632467108403211 0.3708849944820911 -0.4250188373912558 -1.1954271085021426 0.5086856698276004 -0.8935343746060127 -0.13795711049811363 0.29162472875305195 0.012502212342580959 0.26563063350790206 0.6882873909026717 -0.9707539424317223 0.4250188373912557 1.6835465976780204 -2.1392064429859774 -1.9400873318827652 -1.7971034256260587 -1.0116180790824516 0.6569361927965854 -0.23981482260806397 -0.5664729456325054 0.06255019758103977 1.9400873318827656 0.3178174129491543 +21 36385392 36419015 ENSG00000159259 -1.1954271085021426 -0.6569361927965854 -1.5882958682169486 -1.2481665394580725 -1.0542454124924512 -0.6882873909026717 -1.9400873318827652 -0.5086856698276004 -0.5960793860276631 -1.68354659767802 -0.13795711049811363 -0.8213071752056109 -0.39780617203394536 -0.7203302308575226 -0.9314497863026412 -0.4250188373912558 -0.7531303783884556 -0.9707539424317223 -1.505601216304423 0.2141578810056186 0.5960793860276631 -0.4525499884018013 0.3978061720339455 1.2481665394580725 1.1954271085021424 0.8568619257010015 0.7203302308575226 0.26563063350790206 0.6882873909026717 1.5882958682169486 0.29162472875305195 0.13795711049811363 0.18864116776152437 -0.03751445734407257 1.0542454124924512 -0.18864116776152437 0.06255019758103977 -0.1632467108403211 0.5664729456325049 0.3178174129491543 0.7867615829230666 0.6569361927965854 0.012502212342580959 1.0988799140705434 0.8213071752056109 1.0116180790824516 0.08762521122251538 0.16324671084032097 0.48042855588587824 2.139206442985977 -0.08762521122251522 2.498590560962256 0.9707539424317222 1.6835465976780204 0.5086856698276004 0.5373549665979254 1.9400873318827656 -0.8935343746060127 0.8935343746060127 -2.498590560962256 -0.11275544983055917 1.145818341997217 0.23981482260806397 0.9314497863026412 0.03751445734407243 0.4525499884018013 1.43208428708654 1.5056012163044221 0.4250188373912557 0.7531303783884556 1.7971034256260585 1.3046268229653302 0.3708849944820911 1.3655831908785105 -1.145818341997217 0.34423000787040914 -0.3708849944820911 -0.21415788100561842 -0.48042855588587813 -0.7867615829230669 -0.3442300078704089 -1.3046268229653297 -1.0116180790824516 -0.29162472875305206 -0.5373549665979251 0.11275544983055917 0.6262178361515812 -1.3655831908785105 -0.3178174129491543 -0.012502212342580959 -1.7971034256260587 -1.0988799140705434 -1.43208428708654 -0.8568619257010015 -2.1392064429859774 -0.26563063350790206 -0.5664729456325054 -0.6262178361515811 -0.23981482260806397 -0.06255019758103977 +21 36460621 36576569 ENSG00000159261 0.3708849944820911 1.5882958682169486 0.9314497863026412 -0.6569361927965854 2.498590560962256 0.8568619257010015 0.6882873909026717 -0.8935343746060127 0.3178174129491543 0.29162472875305195 0.5960793860276631 1.9400873318827656 -0.06255019758103977 -1.3655831908785105 0.4525499884018013 0.4250188373912557 0.03751445734407243 1.7971034256260585 -0.1632467108403211 -1.7971034256260587 -0.3708849944820911 0.8935343746060127 0.7203302308575226 -0.8568619257010015 1.43208428708654 -0.48042855588587813 -0.13795711049811363 1.1954271085021424 -0.3178174129491543 -1.1954271085021426 1.0988799140705434 -1.68354659767802 0.012502212342580959 1.3655831908785105 -0.9314497863026412 0.5373549665979254 -0.5086856698276004 0.26563063350790206 0.6262178361515812 -0.23981482260806397 -0.5664729456325054 -2.1392064429859774 0.18864116776152437 -0.21415788100561842 -0.012502212342580959 0.16324671084032097 -1.0988799140705434 -0.9707539424317223 0.48042855588587824 -0.29162472875305206 -1.2481665394580725 -2.498590560962256 -1.5882958682169486 -0.7867615829230669 0.2141578810056186 0.5086856698276004 -0.7531303783884556 0.6569361927965854 0.3978061720339455 1.5056012163044221 -0.6262178361515811 -1.43208428708654 -0.7203302308575226 -1.0542454124924512 0.7867615829230666 1.0542454124924512 0.7531303783884556 -0.18864116776152437 -0.5960793860276631 -0.8213071752056109 -1.9400873318827652 -0.39780617203394536 0.08762521122251538 -0.26563063350790206 0.8213071752056109 -0.6882873909026717 -0.08762521122251522 -1.145818341997217 1.2481665394580725 1.3046268229653302 -0.11275544983055917 -0.03751445734407257 1.0116180790824516 -0.5373549665979251 -0.3442300078704089 -0.4525499884018013 -1.0116180790824516 0.9707539424317222 -0.4250188373912558 0.34423000787040914 0.23981482260806397 0.11275544983055917 0.06255019758103977 -1.3046268229653297 2.139206442985977 0.13795711049811363 1.6835465976780204 -1.505601216304423 1.145818341997217 0.5664729456325049 +21 37006150 37019662 ENSG00000183145 -2.498590560962256 1.3046268229653302 -0.06255019758103977 -0.11275544983055917 -1.1954271085021426 -0.3708849944820911 -0.8935343746060127 -1.2481665394580725 -0.7531303783884556 -1.505601216304423 -0.21415788100561842 -0.012502212342580959 -0.9707539424317223 -1.3046268229653297 -1.145818341997217 0.4525499884018013 -0.26563063350790206 0.23981482260806397 -1.68354659767802 0.012502212342580959 0.7531303783884556 -0.4525499884018013 -0.4250188373912558 1.1954271085021424 -0.9314497863026412 -1.43208428708654 -0.39780617203394536 2.139206442985977 0.9314497863026412 0.03751445734407243 -1.3655831908785105 0.5086856698276004 1.9400873318827656 -0.8213071752056109 1.43208428708654 -0.08762521122251522 0.6262178361515812 -0.5664729456325054 -0.48042855588587813 0.8935343746060127 -0.03751445734407257 -0.3442300078704089 0.6882873909026717 0.9707539424317222 1.145818341997217 -0.18864116776152437 0.7203302308575226 0.08762521122251538 0.5664729456325049 0.6569361927965854 1.0542454124924512 0.3178174129491543 -0.6262178361515811 0.16324671084032097 0.3708849944820911 -0.1632467108403211 1.0116180790824516 -1.0542454124924512 2.498590560962256 0.8568619257010015 0.06255019758103977 0.29162472875305195 -1.5882958682169486 0.8213071752056109 -2.1392064429859774 1.5882958682169486 -1.7971034256260587 -1.9400873318827652 0.48042855588587824 -0.6882873909026717 -0.7203302308575226 -0.5960793860276631 1.3655831908785105 -0.6569361927965854 -0.5086856698276004 -0.23981482260806397 0.26563063350790206 0.4250188373912557 1.0988799140705434 -0.8568619257010015 0.5960793860276631 0.2141578810056186 1.7971034256260585 1.6835465976780204 -1.0116180790824516 0.13795711049811363 -0.7867615829230669 0.18864116776152437 -1.0988799140705434 -0.29162472875305206 0.7867615829230666 -0.3178174129491543 0.34423000787040914 0.3978061720339455 -0.13795711049811363 0.5373549665979254 1.5056012163044221 1.2481665394580725 -0.5373549665979251 0.11275544983055917 +21 37073226 37203112 ENSG00000182670 -0.9314497863026412 -1.5882958682169486 -0.21415788100561842 -1.7971034256260587 0.9707539424317222 -0.03751445734407257 -0.29162472875305206 -1.0116180790824516 0.06255019758103977 -0.06255019758103977 0.11275544983055917 -0.6262178361515811 -0.6882873909026717 0.3178174129491543 0.34423000787040914 -1.3655831908785105 -0.23981482260806397 0.2141578810056186 -0.9707539424317223 -1.2481665394580725 1.0542454124924512 0.03751445734407243 -0.8213071752056109 -0.6569361927965854 -0.4250188373912558 0.6882873909026717 1.43208428708654 0.48042855588587824 0.9314497863026412 -0.3442300078704089 0.6262178361515812 0.29162472875305195 2.498590560962256 0.13795711049811363 -2.498590560962256 0.23981482260806397 0.7531303783884556 1.0988799140705434 1.5882958682169486 0.08762521122251538 -0.7203302308575226 1.0116180790824516 0.6569361927965854 -0.11275544983055917 -0.8935343746060127 -0.4525499884018013 0.8568619257010015 0.7867615829230666 -0.3708849944820911 -1.1954271085021426 -1.68354659767802 -1.0542454124924512 0.3708849944820911 -0.1632467108403211 -1.0988799140705434 -0.08762521122251522 -1.3046268229653297 -0.39780617203394536 -0.5664729456325054 -0.8568619257010015 -1.9400873318827652 -0.18864116776152437 1.9400873318827656 0.18864116776152437 1.1954271085021424 0.5960793860276631 1.145818341997217 1.7971034256260585 0.5373549665979254 1.3046268229653302 -0.26563063350790206 -0.5086856698276004 -0.3178174129491543 0.4525499884018013 0.16324671084032097 0.26563063350790206 0.3978061720339455 1.5056012163044221 0.8213071752056109 2.139206442985977 -1.505601216304423 -0.5373549665979251 0.5664729456325049 -1.145818341997217 0.7203302308575226 0.012502212342580959 1.6835465976780204 0.5086856698276004 0.4250188373912557 1.2481665394580725 -0.13795711049811363 -0.48042855588587813 -0.7867615829230669 -0.012502212342580959 -0.7531303783884556 -0.5960793860276631 -2.1392064429859774 0.8935343746060127 1.3655831908785105 -1.43208428708654 +21 37365573 37526358 ENSG00000157540 -0.6882873909026717 -0.7203302308575226 -0.6262178361515811 -1.3046268229653297 0.11275544983055917 0.5373549665979254 -0.9707539424317223 -0.7531303783884556 -0.08762521122251522 -0.5960793860276631 0.2141578810056186 0.6569361927965854 -0.11275544983055917 -0.3708849944820911 -0.3178174129491543 0.03751445734407243 0.3978061720339455 0.8935343746060127 -0.6569361927965854 -1.5882958682169486 0.48042855588587824 -0.18864116776152437 -1.505601216304423 -1.9400873318827652 -2.498590560962256 -1.1954271085021426 1.0116180790824516 0.9707539424317222 1.0988799140705434 0.8213071752056109 -1.68354659767802 1.5882958682169486 -0.5373549665979251 -1.43208428708654 0.7203302308575226 -2.1392064429859774 -1.3655831908785105 -1.0542454124924512 -0.29162472875305206 -0.48042855588587813 -0.06255019758103977 0.4525499884018013 -1.7971034256260587 0.08762521122251538 -0.5086856698276004 -0.8213071752056109 0.13795711049811363 0.5664729456325049 0.3708849944820911 -0.8935343746060127 -0.7867615829230669 -1.0988799140705434 -0.1632467108403211 0.18864116776152437 -1.0116180790824516 -0.4250188373912558 -0.9314497863026412 -0.39780617203394536 0.06255019758103977 -0.4525499884018013 -1.145818341997217 -0.012502212342580959 0.7867615829230666 -0.23981482260806397 -0.8568619257010015 -0.21415788100561842 0.3178174129491543 0.23981482260806397 0.8568619257010015 -0.13795711049811363 -1.2481665394580725 0.4250188373912557 0.16324671084032097 0.6882873909026717 0.26563063350790206 0.29162472875305195 1.6835465976780204 2.139206442985977 1.9400873318827656 1.1954271085021424 0.6262178361515812 1.0542454124924512 1.5056012163044221 1.145818341997217 1.3655831908785105 0.34423000787040914 1.43208428708654 1.3046268229653302 1.2481665394580725 1.7971034256260585 2.498590560962256 0.9314497863026412 -0.5664729456325054 0.012502212342580959 -0.26563063350790206 -0.3442300078704089 0.5960793860276631 0.7531303783884556 -0.03751445734407257 0.5086856698276004 +21 38155549 38307357 ENSG00000157551 -0.9314497863026412 2.139206442985977 2.498590560962256 1.0542454124924512 -1.0542454124924512 0.7203302308575226 -0.8935343746060127 1.5056012163044221 -0.6882873909026717 -0.26563063350790206 0.13795711049811363 0.23981482260806397 1.145818341997217 -0.18864116776152437 0.16324671084032097 0.9707539424317222 0.6262178361515812 0.06255019758103977 1.1954271085021424 -1.145818341997217 0.2141578810056186 -0.8568619257010015 0.8935343746060127 1.6835465976780204 -1.9400873318827652 0.3978061720339455 -0.7531303783884556 0.29162472875305195 -2.498590560962256 0.8213071752056109 1.43208428708654 -0.1632467108403211 -0.012502212342580959 -0.7867615829230669 0.7531303783884556 -0.3442300078704089 0.4250188373912557 -0.48042855588587813 0.3178174129491543 0.34423000787040914 0.5664729456325049 -1.1954271085021426 0.48042855588587824 0.08762521122251538 1.3046268229653302 -1.3046268229653297 0.03751445734407243 -0.3178174129491543 1.9400873318827656 0.7867615829230666 0.9314497863026412 -0.5086856698276004 -0.29162472875305206 -0.11275544983055917 0.3708849944820911 1.2481665394580725 0.4525499884018013 0.18864116776152437 1.3655831908785105 0.6569361927965854 1.7971034256260585 -0.6262178361515811 -1.3655831908785105 -0.7203302308575226 -1.7971034256260587 0.26563063350790206 -0.39780617203394536 -0.4525499884018013 -0.03751445734407257 -1.2481665394580725 0.5373549665979254 -1.0116180790824516 -0.6569361927965854 -0.5960793860276631 -0.5373549665979251 -0.06255019758103977 0.5086856698276004 -1.68354659767802 -1.5882958682169486 -1.505601216304423 1.0988799140705434 0.8568619257010015 -1.0988799140705434 -0.21415788100561842 -0.23981482260806397 -1.43208428708654 -0.08762521122251522 -0.8213071752056109 -0.3708849944820911 -0.4250188373912558 -0.9707539424317223 -0.13795711049811363 0.11275544983055917 1.5882958682169486 0.6882873909026717 0.5960793860276631 -0.5664729456325054 0.012502212342580959 -2.1392064429859774 1.0116180790824516 +21 38805183 38824955 ENSG00000157557 0.3708849944820911 0.48042855588587824 -0.39780617203394536 -0.6262178361515811 1.145818341997217 -0.3178174129491543 -2.498590560962256 -0.012502212342580959 0.08762521122251538 -0.21415788100561842 0.3978061720339455 1.0116180790824516 0.7531303783884556 -1.0988799140705434 -0.8568619257010015 -0.29162472875305206 0.4525499884018013 0.34423000787040914 -1.7971034256260587 -1.43208428708654 -0.7203302308575226 1.3046268229653302 -1.9400873318827652 -1.5882958682169486 -1.68354659767802 -1.145818341997217 1.2481665394580725 1.9400873318827656 0.5664729456325049 -0.6882873909026717 -1.0116180790824516 -0.6569361927965854 0.8213071752056109 -0.5086856698276004 0.9707539424317222 -0.5960793860276631 -0.8935343746060127 -0.11275544983055917 0.4250188373912557 0.2141578810056186 -0.4250188373912558 -0.3442300078704089 -2.1392064429859774 -0.18864116776152437 -1.0542454124924512 -0.1632467108403211 0.5086856698276004 -1.2481665394580725 -0.5373549665979251 0.6882873909026717 -0.26563063350790206 -1.3655831908785105 -0.9314497863026412 -1.1954271085021426 -0.7867615829230669 -1.505601216304423 -0.23981482260806397 0.3178174129491543 -0.08762521122251522 1.43208428708654 -0.9707539424317223 2.139206442985977 1.6835465976780204 0.8935343746060127 0.6569361927965854 0.16324671084032097 0.29162472875305195 -0.4525499884018013 1.0988799140705434 0.26563063350790206 -0.06255019758103977 -0.7531303783884556 2.498590560962256 1.5882958682169486 0.6262178361515812 1.5056012163044221 0.13795711049811363 1.1954271085021424 1.7971034256260585 -0.5664729456325054 -0.13795711049811363 0.5373549665979254 -0.48042855588587813 0.03751445734407243 1.3655831908785105 0.5960793860276631 0.9314497863026412 0.8568619257010015 0.7203302308575226 -0.8213071752056109 1.0542454124924512 -0.03751445734407257 0.7867615829230666 0.012502212342580959 0.06255019758103977 0.23981482260806397 -1.3046268229653297 0.11275544983055917 0.18864116776152437 -0.3708849944820911 +21 39184176 39321559 ENSG00000185658 -1.7971034256260587 -0.8935343746060127 0.5960793860276631 -0.4250188373912558 -1.1954271085021426 0.7531303783884556 0.3708849944820911 -1.145818341997217 0.18864116776152437 1.0542454124924512 -0.03751445734407257 -0.6569361927965854 -0.21415788100561842 -0.3442300078704089 -0.23981482260806397 -0.8568619257010015 -0.3178174129491543 1.0988799140705434 0.9707539424317222 -2.1392064429859774 0.3178174129491543 0.012502212342580959 -0.3708849944820911 -1.3046268229653297 -1.0542454124924512 -0.7867615829230669 -0.5373549665979251 -0.5086856698276004 0.13795711049811363 -1.9400873318827652 -0.18864116776152437 0.8213071752056109 1.5882958682169486 -0.11275544983055917 -2.498590560962256 -0.48042855588587813 0.4525499884018013 0.06255019758103977 0.48042855588587824 0.16324671084032097 -0.8213071752056109 0.5664729456325049 0.26563063350790206 -1.0116180790824516 -1.43208428708654 -0.9314497863026412 0.34423000787040914 0.29162472875305195 0.23981482260806397 -1.5882958682169486 -0.012502212342580959 -0.39780617203394536 -0.5960793860276631 -0.7531303783884556 -1.3655831908785105 -0.6262178361515811 -1.68354659767802 -0.4525499884018013 -0.5664729456325054 -0.06255019758103977 -0.29162472875305206 -1.2481665394580725 1.6835465976780204 0.6262178361515812 -0.13795711049811363 0.8935343746060127 0.7203302308575226 0.08762521122251538 0.8568619257010015 0.5373549665979254 -1.505601216304423 0.11275544983055917 0.7867615829230666 -1.0988799140705434 1.43208428708654 -0.6882873909026717 0.6569361927965854 1.1954271085021424 1.2481665394580725 1.3046268229653302 2.139206442985977 1.9400873318827656 1.5056012163044221 0.2141578810056186 0.3978061720339455 -0.1632467108403211 -0.7203302308575226 1.3655831908785105 0.9314497863026412 1.0116180790824516 1.7971034256260585 1.145818341997217 -0.9707539424317223 -0.08762521122251522 0.4250188373912557 0.5086856698276004 0.6882873909026717 2.498590560962256 0.03751445734407243 -0.26563063350790206 +21 39377698 39428528 ENSG00000182093 -1.3655831908785105 -2.498590560962256 -1.43208428708654 -0.4525499884018013 0.6569361927965854 -0.6569361927965854 -0.11275544983055917 -1.2481665394580725 -0.3178174129491543 -0.3708849944820911 -0.012502212342580959 -2.1392064429859774 -0.9707539424317223 -0.8935343746060127 -0.7203302308575226 -1.3046268229653297 0.13795711049811363 0.29162472875305195 -0.03751445734407257 -0.5664729456325054 1.7971034256260585 -0.6262178361515811 -0.29162472875305206 1.0542454124924512 0.26563063350790206 -0.23981482260806397 0.08762521122251538 0.9314497863026412 -0.1632467108403211 1.1954271085021424 0.2141578810056186 1.43208428708654 0.23981482260806397 0.7531303783884556 0.3178174129491543 0.4525499884018013 0.5664729456325049 -0.4250188373912558 0.8568619257010015 0.5086856698276004 -0.39780617203394536 0.48042855588587824 -0.6882873909026717 -1.505601216304423 -0.8213071752056109 0.7867615829230666 1.0988799140705434 0.8213071752056109 1.0116180790824516 0.012502212342580959 1.2481665394580725 1.5882958682169486 0.11275544983055917 -1.145818341997217 -0.18864116776152437 0.3708849944820911 -0.48042855588587813 -1.9400873318827652 -0.5086856698276004 -1.7971034256260587 -0.06255019758103977 0.6262178361515812 1.6835465976780204 2.498590560962256 2.139206442985977 1.145818341997217 1.5056012163044221 0.18864116776152437 -0.26563063350790206 0.8935343746060127 0.7203302308575226 1.3046268229653302 0.4250188373912557 1.3655831908785105 -1.5882958682169486 1.9400873318827656 0.03751445734407243 0.9707539424317222 0.5373549665979254 0.16324671084032097 0.5960793860276631 -0.5960793860276631 -1.0116180790824516 -1.0542454124924512 -0.7531303783884556 0.3978061720339455 -0.7867615829230669 -0.21415788100561842 0.6882873909026717 0.34423000787040914 -0.3442300078704089 0.06255019758103977 -0.8568619257010015 -1.1954271085021426 -0.13795711049811363 -0.9314497863026412 -1.68354659767802 -0.08762521122251522 -1.0988799140705434 -0.5373549665979251 +21 39556442 39673137 ENSG00000183778 -1.43208428708654 2.139206442985977 2.498590560962256 0.7867615829230666 0.23981482260806397 -0.3178174129491543 1.43208428708654 0.11275544983055917 -0.23981482260806397 -0.11275544983055917 1.145818341997217 0.06255019758103977 0.6262178361515812 1.0116180790824516 0.3978061720339455 0.08762521122251538 0.18864116776152437 1.5056012163044221 -0.29162472875305206 0.6882873909026717 1.5882958682169486 -0.5960793860276631 -0.48042855588587813 1.3655831908785105 -1.0542454124924512 0.9707539424317222 -0.39780617203394536 1.7971034256260585 -2.1392064429859774 -1.0988799140705434 -0.012502212342580959 0.13795711049811363 -0.13795711049811363 -0.4525499884018013 1.3046268229653302 -0.3442300078704089 -1.145818341997217 0.3178174129491543 -0.8213071752056109 -0.7867615829230669 0.48042855588587824 -0.06255019758103977 0.29162472875305195 0.5664729456325049 -0.5373549665979251 -0.1632467108403211 0.03751445734407243 0.8568619257010015 -1.1954271085021426 -1.505601216304423 -0.7531303783884556 -1.0116180790824516 1.0988799140705434 0.2141578810056186 0.5960793860276631 1.9400873318827656 -0.3708849944820911 0.5086856698276004 1.6835465976780204 1.2481665394580725 0.8213071752056109 -0.08762521122251522 -0.21415788100561842 -1.9400873318827652 0.7531303783884556 -1.3655831908785105 -0.5664729456325054 -0.6882873909026717 0.4250188373912557 0.9314497863026412 0.8935343746060127 0.26563063350790206 -0.18864116776152437 0.012502212342580959 -1.2481665394580725 -1.3046268229653297 0.6569361927965854 -0.9707539424317223 -0.9314497863026412 -0.8935343746060127 -0.7203302308575226 -0.26563063350790206 0.16324671084032097 0.3708849944820911 0.5373549665979254 -0.8568619257010015 -0.4250188373912558 -0.5086856698276004 0.4525499884018013 1.1954271085021424 -1.68354659767802 -0.6569361927965854 -1.5882958682169486 0.34423000787040914 -2.498590560962256 1.0542454124924512 -0.6262178361515811 0.7203302308575226 -1.7971034256260587 -0.03751445734407257 +21 41167801 41282530 ENSG00000182240 0.012502212342580959 0.7531303783884556 0.7203302308575226 0.48042855588587824 1.6835465976780204 1.145818341997217 -0.23981482260806397 -0.9314497863026412 0.6882873909026717 1.0988799140705434 -0.6882873909026717 -0.5960793860276631 -0.21415788100561842 -1.505601216304423 1.0116180790824516 1.1954271085021424 0.18864116776152437 0.03751445734407243 -2.1392064429859774 -0.29162472875305206 0.13795711049811363 -1.3655831908785105 -1.3046268229653297 0.7867615829230666 1.5056012163044221 0.5086856698276004 -0.8568619257010015 -1.145818341997217 -0.5086856698276004 0.16324671084032097 0.5664729456325049 -1.5882958682169486 -1.0988799140705434 -0.4250188373912558 -0.3178174129491543 -0.11275544983055917 -0.3708849944820911 0.3178174129491543 -2.498590560962256 1.43208428708654 0.6569361927965854 -0.13795711049811363 0.6262178361515812 -0.06255019758103977 -0.5664729456325054 0.26563063350790206 0.8935343746060127 0.3708849944820911 -1.7971034256260587 0.34423000787040914 -1.2481665394580725 -0.7531303783884556 -0.7203302308575226 0.3978061720339455 0.23981482260806397 1.3655831908785105 -0.9707539424317223 0.08762521122251538 -0.6569361927965854 0.8568619257010015 -0.012502212342580959 -0.8935343746060127 1.0542454124924512 -0.18864116776152437 -0.08762521122251522 -0.8213071752056109 -1.68354659767802 0.9314497863026412 -1.43208428708654 -0.26563063350790206 -1.0542454124924512 -0.6262178361515811 -0.3442300078704089 -0.1632467108403211 -1.0116180790824516 0.4525499884018013 0.5373549665979254 -0.48042855588587813 -0.39780617203394536 2.498590560962256 -0.03751445734407257 0.06255019758103977 0.9707539424317222 -0.7867615829230669 1.2481665394580725 -0.5373549665979251 0.2141578810056186 2.139206442985977 0.4250188373912557 -1.1954271085021426 0.8213071752056109 -0.4525499884018013 1.5882958682169486 -1.9400873318827652 0.5960793860276631 0.29162472875305195 1.9400873318827656 1.3046268229653302 0.11275544983055917 1.7971034256260585 +21 41304212 41357727 ENSG00000183844 -0.1632467108403211 1.0542454124924512 1.2481665394580725 0.8568619257010015 0.3708849944820911 2.498590560962256 -0.03751445734407257 1.3046268229653302 0.11275544983055917 0.2141578810056186 -0.29162472875305206 -0.7867615829230669 0.5960793860276631 -0.8213071752056109 1.0116180790824516 0.29162472875305195 -0.6569361927965854 -1.43208428708654 0.08762521122251538 0.3178174129491543 0.03751445734407243 -1.145818341997217 -0.39780617203394536 -0.18864116776152437 0.7531303783884556 -0.8935343746060127 -0.3708849944820911 -0.26563063350790206 -2.498590560962256 -0.08762521122251522 1.43208428708654 -0.7531303783884556 -0.9314497863026412 0.8213071752056109 -0.23981482260806397 1.145818341997217 1.5056012163044221 0.9314497863026412 -1.3655831908785105 -0.012502212342580959 0.48042855588587824 -0.8568619257010015 0.3978061720339455 -0.5086856698276004 -0.4250188373912558 -0.9707539424317223 1.6835465976780204 -1.0116180790824516 -1.7971034256260587 0.9707539424317222 -1.3046268229653297 -1.68354659767802 -0.6882873909026717 0.34423000787040914 0.5664729456325049 -0.5664729456325054 -1.0988799140705434 0.5086856698276004 -0.3442300078704089 1.9400873318827656 0.8935343746060127 1.5882958682169486 0.13795711049811363 -2.1392064429859774 -1.5882958682169486 -0.13795711049811363 0.06255019758103977 -1.1954271085021426 0.4525499884018013 0.6569361927965854 0.23981482260806397 -0.6262178361515811 0.16324671084032097 0.26563063350790206 -0.11275544983055917 -1.9400873318827652 0.18864116776152437 -0.06255019758103977 0.7867615829230666 -1.505601216304423 -1.2481665394580725 -1.0542454124924512 -0.7203302308575226 -0.5960793860276631 -0.5373549665979251 -0.4525499884018013 1.3655831908785105 1.0988799140705434 0.7203302308575226 0.6262178361515812 0.6882873909026717 0.012502212342580959 -0.21415788100561842 0.4250188373912557 -0.48042855588587813 -0.3178174129491543 1.7971034256260585 0.5373549665979254 2.139206442985977 1.1954271085021424 +21 41361999 41409393 ENSG00000183486 -0.6262178361515811 1.3655831908785105 1.3046268229653302 1.43208428708654 1.0542454124924512 0.34423000787040914 -0.18864116776152437 1.6835465976780204 0.2141578810056186 0.3178174129491543 -0.6882873909026717 2.139206442985977 0.29162472875305195 -0.6569361927965854 -0.23981482260806397 0.3978061720339455 0.7531303783884556 0.6262178361515812 0.26563063350790206 0.06255019758103977 -0.39780617203394536 -0.9314497863026412 -0.7203302308575226 -0.13795711049811363 -1.9400873318827652 -0.8935343746060127 -0.4525499884018013 0.48042855588587824 -0.21415788100561842 -1.5882958682169486 -0.5664729456325054 0.7203302308575226 0.13795711049811363 -1.505601216304423 0.6569361927965854 -0.06255019758103977 -0.4250188373912558 -1.3655831908785105 -1.7971034256260587 0.4525499884018013 -0.11275544983055917 -0.29162472875305206 -0.3178174129491543 -0.9707539424317223 -1.1954271085021426 -1.3046268229653297 0.9314497863026412 0.6882873909026717 0.5373549665979254 -0.48042855588587813 -0.5373549665979251 -0.8568619257010015 -1.2481665394580725 -1.145818341997217 -0.26563063350790206 -1.0988799140705434 -1.0116180790824516 1.2481665394580725 0.08762521122251538 2.498590560962256 -0.012502212342580959 0.3708849944820911 0.11275544983055917 -0.1632467108403211 -0.08762521122251522 -0.7531303783884556 -2.1392064429859774 -1.68354659767802 0.012502212342580959 -2.498590560962256 -0.8213071752056109 -0.7867615829230669 -0.5960793860276631 -0.3442300078704089 1.145818341997217 -0.5086856698276004 1.0988799140705434 0.9707539424317222 0.8213071752056109 -1.0542454124924512 1.7971034256260585 0.5960793860276631 1.5056012163044221 1.0116180790824516 0.03751445734407243 -1.43208428708654 -0.03751445734407257 0.4250188373912557 0.16324671084032097 0.23981482260806397 1.5882958682169486 -0.3708849944820911 0.8568619257010015 0.8935343746060127 0.7867615829230666 0.5664729456325049 1.9400873318827656 0.5086856698276004 0.18864116776152437 1.1954271085021424 +21 41420020 41470071 ENSG00000157601 -0.8213071752056109 1.6835465976780204 0.08762521122251538 1.5056012163044221 0.3978061720339455 0.6569361927965854 0.9314497863026412 0.29162472875305195 -0.23981482260806397 0.4250188373912557 -0.4250188373912558 1.7971034256260585 0.8935343746060127 0.11275544983055917 -0.5086856698276004 -0.39780617203394536 -0.06255019758103977 0.6262178361515812 1.3655831908785105 1.43208428708654 -0.1632467108403211 -0.8568619257010015 0.26563063350790206 -0.3178174129491543 -1.3655831908785105 -0.7867615829230669 0.012502212342580959 -0.11275544983055917 -0.012502212342580959 -0.3442300078704089 -1.43208428708654 0.5086856698276004 -1.2481665394580725 -1.9400873318827652 0.8213071752056109 -1.145818341997217 -1.0116180790824516 -1.68354659767802 -1.0542454124924512 -0.4525499884018013 1.0988799140705434 -0.29162472875305206 -1.5882958682169486 -0.18864116776152437 -0.6569361927965854 -0.7531303783884556 0.18864116776152437 0.5664729456325049 -0.08762521122251522 -0.5373549665979251 -0.03751445734407257 -1.505601216304423 -1.3046268229653297 -0.26563063350790206 0.03751445734407243 -0.9707539424317223 -0.13795711049811363 1.0116180790824516 0.7203302308575226 2.139206442985977 1.145818341997217 -0.6262178361515811 -0.48042855588587813 0.2141578810056186 -1.0988799140705434 0.34423000787040914 -2.498590560962256 -1.7971034256260587 0.7867615829230666 -2.1392064429859774 -0.5664729456325054 -0.5960793860276631 -0.6882873909026717 0.16324671084032097 0.23981482260806397 -0.7203302308575226 1.1954271085021424 0.5960793860276631 0.3708849944820911 -0.9314497863026412 1.5882958682169486 0.4525499884018013 1.0542454124924512 1.3046268229653302 0.8568619257010015 -1.1954271085021426 -0.21415788100561842 0.3178174129491543 0.06255019758103977 0.9707539424317222 0.6882873909026717 -0.3708849944820911 1.2481665394580725 0.48042855588587824 0.13795711049811363 0.5373549665979254 2.498590560962256 0.7531303783884556 -0.8935343746060127 1.9400873318827656 +21 41739369 41767089 ENSG00000183421 -1.5882958682169486 0.7531303783884556 0.7203302308575226 0.9707539424317222 0.18864116776152437 1.145818341997217 -0.13795711049811363 0.26563063350790206 -0.7531303783884556 -0.21415788100561842 0.2141578810056186 0.8935343746060127 0.48042855588587824 -0.5373549665979251 -0.4525499884018013 1.0542454124924512 1.2481665394580725 0.11275544983055917 -1.505601216304423 -0.5960793860276631 -0.06255019758103977 0.4525499884018013 -1.1954271085021426 1.5882958682169486 -1.145818341997217 -1.0542454124924512 -0.8568619257010015 2.498590560962256 -0.3708849944820911 2.139206442985977 -1.68354659767802 0.4250188373912557 0.34423000787040914 -1.9400873318827652 -0.5664729456325054 -1.43208428708654 -1.2481665394580725 -0.6262178361515811 -2.498590560962256 0.3978061720339455 -0.48042855588587813 -0.6882873909026717 0.29162472875305195 -0.9314497863026412 -0.29162472875305206 -0.26563063350790206 -0.5086856698276004 -0.11275544983055917 1.7971034256260585 0.6569361927965854 0.5373549665979254 -1.7971034256260587 -1.3655831908785105 -0.7203302308575226 0.06255019758103977 0.9314497863026412 -0.8213071752056109 0.6882873909026717 0.7867615829230666 -1.0116180790824516 0.6262178361515812 1.43208428708654 -0.4250188373912558 -0.23981482260806397 0.13795711049811363 -0.39780617203394536 -0.7867615829230669 -0.9707539424317223 -0.3178174129491543 -0.8935343746060127 -0.012502212342580959 -2.1392064429859774 -0.6569361927965854 0.03751445734407243 -0.18864116776152437 -1.3046268229653297 1.3046268229653302 0.8568619257010015 0.23981482260806397 -0.3442300078704089 -0.03751445734407257 0.5664729456325049 1.6835465976780204 0.5086856698276004 0.8213071752056109 -1.0988799140705434 0.3178174129491543 1.0116180790824516 0.012502212342580959 0.08762521122251538 1.5056012163044221 0.3708849944820911 0.5960793860276631 -0.08762521122251522 1.0988799140705434 1.1954271085021424 1.3655831908785105 -0.1632467108403211 0.16324671084032097 1.9400873318827656 +21 41798225 41879482 ENSG00000141956 0.48042855588587824 0.3708849944820911 -0.48042855588587813 0.11275544983055917 -0.08762521122251522 1.7971034256260585 0.26563063350790206 -0.6569361927965854 0.4525499884018013 -0.3178174129491543 0.5373549665979254 1.1954271085021424 0.7203302308575226 1.5882958682169486 0.5664729456325049 0.3178174129491543 0.8213071752056109 2.139206442985977 0.6569361927965854 -0.18864116776152437 -0.5373549665979251 -1.68354659767802 0.03751445734407243 -0.5664729456325054 -0.5086856698276004 1.2481665394580725 0.34423000787040914 -0.6262178361515811 -1.0542454124924512 -0.8935343746060127 -0.06255019758103977 0.8568619257010015 0.16324671084032097 -0.012502212342580959 -1.3655831908785105 -1.9400873318827652 -1.145818341997217 1.5056012163044221 -0.5960793860276631 -1.0988799140705434 0.7531303783884556 0.9707539424317222 0.012502212342580959 0.2141578810056186 1.3655831908785105 0.13795711049811363 0.06255019758103977 -0.03751445734407257 -0.21415788100561842 0.29162472875305195 -1.505601216304423 -0.23981482260806397 0.5960793860276631 1.3046268229653302 -0.4525499884018013 1.0542454124924512 1.43208428708654 1.9400873318827656 -0.7867615829230669 0.23981482260806397 -1.3046268229653297 -0.1632467108403211 0.7867615829230666 -0.7203302308575226 -1.1954271085021426 -1.43208428708654 -0.8568619257010015 0.8935343746060127 0.6262178361515812 0.08762521122251538 -0.3442300078704089 0.6882873909026717 -0.9707539424317223 -0.3708849944820911 1.6835465976780204 -1.0116180790824516 0.4250188373912557 0.18864116776152437 -0.4250188373912558 -1.7971034256260587 -2.498590560962256 -0.6882873909026717 -0.39780617203394536 -1.2481665394580725 -0.9314497863026412 -2.1392064429859774 -0.7531303783884556 -0.8213071752056109 -0.13795711049811363 0.3978061720339455 -0.26563063350790206 -1.5882958682169486 -0.29162472875305206 -0.11275544983055917 0.9314497863026412 1.145818341997217 0.5086856698276004 2.498590560962256 1.0116180790824516 1.0988799140705434 +21 41885112 41954018 ENSG00000157617 1.6835465976780204 0.4250188373912557 -2.498590560962256 0.7203302308575226 0.9707539424317222 1.1954271085021424 -0.1632467108403211 0.7531303783884556 0.18864116776152437 1.3655831908785105 0.012502212342580959 1.9400873318827656 1.7971034256260585 1.2481665394580725 -0.06255019758103977 -0.4525499884018013 1.3046268229653302 1.5882958682169486 1.0988799140705434 -0.39780617203394536 -0.5960793860276631 -0.18864116776152437 -1.68354659767802 -0.5373549665979251 0.06255019758103977 0.5960793860276631 -0.9707539424317223 0.48042855588587824 0.3708849944820911 -1.1954271085021426 -1.3046268229653297 0.26563063350790206 0.9314497863026412 -1.2481665394580725 -1.9400873318827652 -0.7531303783884556 -0.6569361927965854 0.13795711049811363 -0.5664729456325054 -0.5086856698276004 -1.0116180790824516 0.5664729456325049 -0.8935343746060127 -0.8568619257010015 -0.48042855588587813 -1.145818341997217 0.3978061720339455 -0.26563063350790206 -0.6262178361515811 0.03751445734407243 -1.5882958682169486 -1.3655831908785105 -0.6882873909026717 -0.21415788100561842 -0.23981482260806397 -0.7867615829230669 -0.11275544983055917 2.498590560962256 0.08762521122251538 0.8568619257010015 -0.4250188373912558 0.6569361927965854 1.5056012163044221 0.29162472875305195 0.2141578810056186 -0.7203302308575226 -1.505601216304423 0.5373549665979254 0.11275544983055917 0.16324671084032097 -0.3708849944820911 -1.7971034256260587 0.4525499884018013 -1.0988799140705434 2.139206442985977 0.34423000787040914 1.0116180790824516 0.7867615829230666 0.5086856698276004 -0.08762521122251522 -2.1392064429859774 -0.9314497863026412 0.8935343746060127 -0.3178174129491543 0.6882873909026717 -1.0542454124924512 -0.8213071752056109 0.6262178361515812 -0.13795711049811363 0.3178174129491543 -0.29162472875305206 -0.03751445734407257 -0.3442300078704089 -1.43208428708654 0.23981482260806397 1.145818341997217 -0.012502212342580959 1.43208428708654 0.8213071752056109 1.0542454124924512 +21 41986831 42010387 ENSG00000173276 0.6262178361515812 -0.11275544983055917 0.18864116776152437 0.7867615829230666 1.3046268229653302 1.2481665394580725 0.5373549665979254 0.3708849944820911 0.8935343746060127 1.5882958682169486 -0.13795711049811363 0.9314497863026412 0.5664729456325049 0.5086856698276004 0.13795711049811363 -0.08762521122251522 0.8213071752056109 1.0988799140705434 0.7531303783884556 -1.145818341997217 -0.5373549665979251 0.3978061720339455 -1.5882958682169486 -1.9400873318827652 -0.9707539424317223 -2.1392064429859774 -0.5960793860276631 0.08762521122251538 0.16324671084032097 -0.7531303783884556 -1.68354659767802 0.4250188373912557 -1.1954271085021426 -2.498590560962256 -0.7203302308575226 -1.3046268229653297 -1.2481665394580725 -1.7971034256260587 -0.06255019758103977 -0.012502212342580959 -0.6262178361515811 0.06255019758103977 -1.505601216304423 -0.8935343746060127 -1.0542454124924512 -0.6882873909026717 0.03751445734407243 -0.18864116776152437 -0.5086856698276004 -0.7867615829230669 -0.4250188373912558 -0.6569361927965854 -1.0116180790824516 -0.5664729456325054 -0.8213071752056109 -0.3442300078704089 -1.43208428708654 1.9400873318827656 -0.23981482260806397 1.1954271085021424 -0.48042855588587813 -0.39780617203394536 0.48042855588587824 -0.9314497863026412 -0.3708849944820911 -0.4525499884018013 -0.26563063350790206 -0.3178174129491543 0.11275544983055917 -0.8568619257010015 -1.3655831908785105 -1.0988799140705434 0.23981482260806397 -0.21415788100561842 1.43208428708654 -0.03751445734407257 1.7971034256260585 1.6835465976780204 2.139206442985977 1.0116180790824516 0.5960793860276631 0.7203302308575226 1.3655831908785105 0.3178174129491543 1.0542454124924512 -0.1632467108403211 0.2141578810056186 1.145818341997217 0.6569361927965854 0.8568619257010015 2.498590560962256 1.5056012163044221 0.26563063350790206 0.29162472875305195 0.6882873909026717 0.012502212342580959 -0.29162472875305206 0.34423000787040914 0.4525499884018013 0.9707539424317222 +21 42062959 42143453 ENSG00000177398 0.16324671084032097 -2.1392064429859774 -2.498590560962256 0.9707539424317222 -1.2481665394580725 1.0542454124924512 0.6262178361515812 -0.8935343746060127 -0.1632467108403211 1.3046268229653302 0.3978061720339455 -0.012502212342580959 1.5882958682169486 0.9314497863026412 1.0988799140705434 1.43208428708654 1.7971034256260585 0.5373549665979254 1.6835465976780204 0.06255019758103977 0.012502212342580959 1.5056012163044221 0.4525499884018013 -0.9707539424317223 0.48042855588587824 1.145818341997217 -1.0542454124924512 -1.1954271085021426 0.8935343746060127 -1.68354659767802 -0.5373549665979251 -0.8568619257010015 -0.11275544983055917 -0.23981482260806397 -0.6882873909026717 -0.7203302308575226 -0.5960793860276631 -0.21415788100561842 -1.5882958682169486 -0.5086856698276004 -0.08762521122251522 0.4250188373912557 0.5086856698276004 0.03751445734407243 -0.48042855588587813 0.8568619257010015 -0.06255019758103977 -0.13795711049811363 1.0116180790824516 0.5664729456325049 -1.505601216304423 0.23981482260806397 0.3708849944820911 0.26563063350790206 0.34423000787040914 -0.6569361927965854 -0.4525499884018013 2.498590560962256 -0.3178174129491543 1.9400873318827656 -1.0116180790824516 -1.9400873318827652 0.8213071752056109 -1.0988799140705434 -0.5664729456325054 0.08762521122251538 0.18864116776152437 -0.29162472875305206 -0.39780617203394536 0.7203302308575226 -1.3655831908785105 -0.8213071752056109 -1.43208428708654 -0.9314497863026412 2.139206442985977 0.7867615829230666 -0.6262178361515811 0.11275544983055917 0.6569361927965854 -0.3442300078704089 -0.7867615829230669 -0.18864116776152437 -0.26563063350790206 0.29162472875305195 1.1954271085021424 0.13795711049811363 0.2141578810056186 -1.145818341997217 -0.3708849944820911 -0.7531303783884556 -1.3046268229653297 -0.03751445734407257 1.2481665394580725 0.7531303783884556 0.6882873909026717 1.3655831908785105 0.5960793860276631 -0.4250188373912558 0.3178174129491543 -1.7971034256260587 +21 42199689 42297244 ENSG00000160179 -1.9400873318827652 -0.5086856698276004 -1.0542454124924512 -0.13795711049811363 -1.3046268229653297 -0.7203302308575226 0.9707539424317222 -0.7867615829230669 -1.7971034256260587 -1.0116180790824516 -1.2481665394580725 -0.6569361927965854 -0.5373549665979251 0.06255019758103977 -1.0988799140705434 -1.1954271085021426 -1.43208428708654 -0.8213071752056109 -1.145818341997217 -0.3178174129491543 1.3655831908785105 1.0542454124924512 0.5373549665979254 -0.3442300078704089 0.012502212342580959 0.5960793860276631 -0.06255019758103977 -0.1632467108403211 0.3708849944820911 -0.23981482260806397 0.4525499884018013 0.4250188373912557 -0.03751445734407257 -0.39780617203394536 0.3178174129491543 0.7531303783884556 1.5056012163044221 -0.6882873909026717 -0.4525499884018013 1.2481665394580725 0.08762521122251538 -0.012502212342580959 0.26563063350790206 -0.3708849944820911 -0.11275544983055917 0.6262178361515812 0.11275544983055917 0.34423000787040914 -0.48042855588587813 -0.9314497863026412 -0.18864116776152437 -0.29162472875305206 -0.5664729456325054 0.03751445734407243 -0.5960793860276631 0.16324671084032097 -0.21415788100561842 -0.26563063350790206 1.7971034256260585 -0.08762521122251522 2.498590560962256 0.3978061720339455 0.6882873909026717 0.48042855588587824 1.43208428708654 1.0116180790824516 -2.1392064429859774 -1.68354659767802 0.5086856698276004 0.5664729456325049 1.145818341997217 -0.6262178361515811 1.9400873318827656 0.23981482260806397 -1.3655831908785105 1.6835465976780204 0.9314497863026412 0.8213071752056109 2.139206442985977 0.8935343746060127 0.2141578810056186 1.3046268229653302 0.13795711049811363 1.5882958682169486 1.0988799140705434 0.7203302308575226 0.18864116776152437 0.7867615829230666 0.29162472875305195 0.6569361927965854 1.1954271085021424 0.8568619257010015 -0.7531303783884556 -0.8935343746060127 -1.5882958682169486 -0.8568619257010015 -1.505601216304423 -0.9707539424317223 -2.498590560962256 -0.4250188373912558 +21 42311667 42315409 ENSG00000160180 0.6569361927965854 -0.6882873909026717 -1.68354659767802 1.3046268229653302 0.34423000787040914 1.7971034256260585 -0.8568619257010015 0.16324671084032097 0.8213071752056109 1.43208428708654 1.0116180790824516 0.11275544983055917 2.498590560962256 1.5056012163044221 0.4250188373912557 0.13795711049811363 0.9707539424317222 -0.7867615829230669 -0.23981482260806397 0.2141578810056186 -0.5086856698276004 -0.5373549665979251 -0.39780617203394536 -1.3655831908785105 0.7203302308575226 0.012502212342580959 -0.3178174129491543 -2.1392064429859774 -1.9400873318827652 -1.0542454124924512 0.06255019758103977 0.18864116776152437 -0.08762521122251522 -0.3708849944820911 -1.505601216304423 -0.26563063350790206 -1.0988799140705434 0.3978061720339455 -0.7531303783884556 -0.7203302308575226 0.4525499884018013 0.8568619257010015 2.139206442985977 0.5664729456325049 -0.4525499884018013 -0.13795711049811363 0.08762521122251538 1.3655831908785105 -1.145818341997217 -1.3046268229653297 -0.6569361927965854 -1.0116180790824516 0.29162472875305195 0.3178174129491543 0.5960793860276631 0.48042855588587824 -0.29162472875305206 0.5086856698276004 0.9314497863026412 -1.7971034256260587 -0.21415788100561842 -0.012502212342580959 -0.18864116776152437 0.6262178361515812 -0.9707539424317223 1.2481665394580725 -0.48042855588587813 -0.5960793860276631 1.0988799140705434 -0.03751445734407257 -0.06255019758103977 0.3708849944820911 -0.1632467108403211 0.8935343746060127 0.6882873909026717 -1.1954271085021426 -0.11275544983055917 -0.9314497863026412 -0.8935343746060127 1.6835465976780204 -0.6262178361515811 1.9400873318827656 0.26563063350790206 1.0542454124924512 0.5373549665979254 -0.8213071752056109 -0.3442300078704089 -0.4250188373912558 1.145818341997217 0.7867615829230666 1.5882958682169486 0.7531303783884556 -1.43208428708654 1.1954271085021424 -2.498590560962256 0.23981482260806397 -0.5664729456325054 -1.2481665394580725 -1.5882958682169486 0.03751445734407243 +21 42346357 42350997 ENSG00000160181 -1.2481665394580725 -0.5373549665979251 2.498590560962256 1.5882958682169486 0.7203302308575226 -0.11275544983055917 -0.7203302308575226 1.7971034256260585 -0.012502212342580959 0.16324671084032097 0.8213071752056109 0.48042855588587824 1.2481665394580725 0.3978061720339455 1.6835465976780204 2.139206442985977 0.6569361927965854 -0.6262178361515811 -0.08762521122251522 0.5373549665979254 -0.3442300078704089 -0.3708849944820911 -0.26563063350790206 -1.3655831908785105 -0.8935343746060127 0.26563063350790206 -0.18864116776152437 -2.1392064429859774 -1.9400873318827652 -0.9314497863026412 0.34423000787040914 0.5086856698276004 0.13795711049811363 -0.23981482260806397 -1.505601216304423 -0.13795711049811363 -0.9707539424317223 1.43208428708654 -0.5960793860276631 -0.5664729456325054 0.9707539424317222 0.29162472875305195 1.9400873318827656 1.145818341997217 -0.29162472875305206 0.08762521122251538 0.4250188373912557 0.06255019758103977 -1.0116180790824516 -1.3046268229653297 -0.5086856698276004 -0.8568619257010015 0.6262178361515812 0.6882873909026717 1.1954271085021424 1.0116180790824516 -0.1632467108403211 1.0542454124924512 0.4525499884018013 1.3046268229653302 -0.03751445734407257 0.23981482260806397 0.012502212342580959 -1.7971034256260587 -0.8213071752056109 -1.1954271085021426 -0.3178174129491543 1.3655831908785105 0.8935343746060127 0.2141578810056186 0.18864116776152437 0.7531303783884556 0.03751445734407243 0.3708849944820911 -1.0542454124924512 -1.0988799140705434 0.11275544983055917 -0.7867615829230669 -0.7531303783884556 -0.6882873909026717 -0.48042855588587813 -0.06255019758103977 0.5960793860276631 0.8568619257010015 1.0988799140705434 -0.6569361927965854 -0.21415788100561842 1.5056012163044221 0.9314497863026412 -0.39780617203394536 -1.5882958682169486 -0.4525499884018013 -1.43208428708654 0.7867615829230666 -2.498590560962256 0.5664729456325049 -0.4250188373912558 -1.145818341997217 -1.68354659767802 0.3178174129491543 +21 42371887 42396091 ENSG00000160183 0.7203302308575226 -1.505601216304423 0.5373549665979254 -0.3442300078704089 0.5086856698276004 -0.08762521122251522 1.145818341997217 -0.4250188373912558 0.012502212342580959 1.7971034256260585 -0.03751445734407257 0.13795711049811363 -0.5664729456325054 -0.3178174129491543 -0.18864116776152437 -0.26563063350790206 0.3978061720339455 -1.2481665394580725 -0.9314497863026412 0.5960793860276631 0.3178174129491543 -0.6882873909026717 -1.5882958682169486 -0.7867615829230669 -1.145818341997217 0.08762521122251538 -0.7203302308575226 -0.06255019758103977 -0.39780617203394536 0.9707539424317222 1.5882958682169486 -0.23981482260806397 0.11275544983055917 -2.498590560962256 -1.0116180790824516 -1.0988799140705434 1.5056012163044221 -0.012502212342580959 -0.13795711049811363 1.2481665394580725 0.5664729456325049 0.29162472875305195 0.03751445734407243 -0.11275544983055917 -0.5373549665979251 0.8213071752056109 1.0542454124924512 0.6262178361515812 -1.3046268229653297 -1.9400873318827652 0.3708849944820911 -1.3655831908785105 0.2141578810056186 -0.1632467108403211 0.9314497863026412 0.7867615829230666 -0.8935343746060127 1.1954271085021424 0.6569361927965854 -1.0542454124924512 1.0116180790824516 -0.48042855588587813 1.3046268229653302 -1.1954271085021426 0.8935343746060127 -0.5086856698276004 -2.1392064429859774 -1.68354659767802 -0.4525499884018013 -1.43208428708654 -0.3708849944820911 -1.7971034256260587 0.4525499884018013 0.6882873909026717 0.23981482260806397 1.3655831908785105 -0.21415788100561842 0.26563063350790206 1.6835465976780204 -0.8568619257010015 0.34423000787040914 -0.5960793860276631 0.4250188373912557 -0.6569361927965854 -0.29162472875305206 -0.7531303783884556 0.16324671084032097 1.43208428708654 1.0988799140705434 -0.8213071752056109 0.8568619257010015 1.9400873318827656 2.139206442985977 0.18864116776152437 0.06255019758103977 -0.6262178361515811 0.48042855588587824 0.7531303783884556 2.498590560962256 -0.9707539424317223 +21 42403447 42447684 ENSG00000160185 1.145818341997217 0.4250188373912557 -0.8935343746060127 0.7867615829230666 2.498590560962256 1.2481665394580725 0.2141578810056186 1.43208428708654 0.7203302308575226 1.5882958682169486 0.5086856698276004 1.0542454124924512 0.9314497863026412 0.11275544983055917 -0.11275544983055917 0.8935343746060127 -0.39780617203394536 1.0116180790824516 0.16324671084032097 -0.7203302308575226 0.23981482260806397 -1.0542454124924512 -2.1392064429859774 -0.9707539424317223 -0.3442300078704089 -0.21415788100561842 -0.4250188373912558 -0.06255019758103977 -0.3708849944820911 0.8213071752056109 0.9707539424317222 -0.8568619257010015 -0.3178174129491543 -2.498590560962256 -1.505601216304423 -0.26563063350790206 0.48042855588587824 0.3978061720339455 0.8568619257010015 0.18864116776152437 0.34423000787040914 -0.23981482260806397 0.4525499884018013 -0.18864116776152437 -0.5086856698276004 -0.5664729456325054 0.5373549665979254 0.5664729456325049 -0.9314497863026412 -1.3655831908785105 0.012502212342580959 -1.0116180790824516 0.6569361927965854 -1.3046268229653297 -1.68354659767802 -0.03751445734407257 0.5960793860276631 2.139206442985977 0.7531303783884556 1.7971034256260585 -0.29162472875305206 -0.08762521122251522 0.6262178361515812 -1.9400873318827652 0.08762521122251538 -1.0988799140705434 -0.5373549665979251 0.26563063350790206 -0.7867615829230669 -1.7971034256260587 -0.8213071752056109 -0.48042855588587813 -1.145818341997217 -0.012502212342580959 1.5056012163044221 0.3178174129491543 -0.6882873909026717 0.3708849944820911 -0.7531303783884556 -0.5960793860276631 -1.43208428708654 -1.1954271085021426 0.13795711049811363 -1.5882958682169486 -0.6569361927965854 -0.6262178361515811 0.03751445734407243 0.06255019758103977 -0.4525499884018013 -0.1632467108403211 -1.2481665394580725 1.3046268229653302 1.6835465976780204 1.0988799140705434 1.3655831908785105 1.1954271085021424 0.6882873909026717 1.9400873318827656 -0.13795711049811363 0.29162472875305195 +21 42472486 42496246 ENSG00000160188 -0.5086856698276004 1.0542454124924512 1.3046268229653302 -0.26563063350790206 0.012502212342580959 -0.7867615829230669 0.23981482260806397 0.4525499884018013 1.0988799140705434 -1.3046268229653297 0.11275544983055917 1.43208428708654 -0.5373549665979251 1.5882958682169486 -1.9400873318827652 0.8568619257010015 1.7971034256260585 1.1954271085021424 1.2481665394580725 1.0116180790824516 0.03751445734407243 0.29162472875305195 -0.03751445734407257 0.5664729456325049 -0.4525499884018013 1.5056012163044221 -0.13795711049811363 -0.8213071752056109 -0.23981482260806397 1.6835465976780204 -1.0116180790824516 0.7531303783884556 -1.5882958682169486 0.9314497863026412 0.5373549665979254 -0.6262178361515811 0.3178174129491543 -0.8568619257010015 -1.7971034256260587 1.3655831908785105 0.3708849944820911 -0.9314497863026412 0.6569361927965854 0.06255019758103977 0.6262178361515812 -0.21415788100561842 -1.1954271085021426 0.3978061720339455 -1.2481665394580725 -0.6882873909026717 -1.0542454124924512 0.6882873909026717 -1.145818341997217 0.18864116776152437 -0.08762521122251522 -0.3178174129491543 -0.11275544983055917 0.7867615829230666 0.48042855588587824 2.498590560962256 -0.7531303783884556 -0.012502212342580959 0.9707539424317222 -0.3708849944820911 0.8935343746060127 -0.5960793860276631 -1.68354659767802 -0.29162472875305206 -0.48042855588587813 -0.3442300078704089 -0.1632467108403211 -0.8935343746060127 -1.3655831908785105 0.26563063350790206 -0.7203302308575226 0.2141578810056186 0.5086856698276004 2.139206442985977 0.5960793860276631 0.13795711049811363 0.16324671084032097 -1.0988799140705434 0.08762521122251538 -0.06255019758103977 -0.5664729456325054 -2.498590560962256 0.34423000787040914 -0.18864116776152437 0.4250188373912557 -0.6569361927965854 0.8213071752056109 -1.505601216304423 -0.4250188373912558 0.7203302308575226 1.145818341997217 1.9400873318827656 -2.1392064429859774 -0.39780617203394536 -1.43208428708654 -0.9707539424317223 +21 42496008 42581440 ENSG00000160190 -1.505601216304423 0.18864116776152437 1.1954271085021424 -1.2481665394580725 -1.43208428708654 -0.9314497863026412 2.139206442985977 -0.7203302308575226 -0.06255019758103977 -0.39780617203394536 -1.3655831908785105 -0.23981482260806397 -0.3708849944820911 1.5056012163044221 -0.7867615829230669 0.34423000787040914 -0.08762521122251522 1.0116180790824516 0.9707539424317222 0.06255019758103977 -0.29162472875305206 0.16324671084032097 1.0988799140705434 -1.0542454124924512 -2.1392064429859774 0.8568619257010015 -0.03751445734407257 -0.18864116776152437 0.7203302308575226 -0.1632467108403211 0.3978061720339455 0.8213071752056109 -0.4250188373912558 -0.21415788100561842 -0.8213071752056109 0.3178174129491543 1.0542454124924512 0.3708849944820911 -1.0988799140705434 0.6262178361515812 0.13795711049811363 0.03751445734407243 -0.48042855588587813 -0.3178174129491543 -1.0116180790824516 0.2141578810056186 0.4525499884018013 -0.6569361927965854 0.26563063350790206 -0.5960793860276631 -0.6882873909026717 -1.145818341997217 -0.7531303783884556 0.08762521122251538 0.5086856698276004 0.5960793860276631 -0.5373549665979251 0.29162472875305195 -0.6262178361515811 1.2481665394580725 -0.012502212342580959 -0.4525499884018013 0.8935343746060127 -0.9707539424317223 1.3046268229653302 0.012502212342580959 -1.68354659767802 0.11275544983055917 0.6882873909026717 -1.7971034256260587 -0.5086856698276004 -0.26563063350790206 0.7531303783884556 -1.5882958682169486 -1.9400873318827652 0.9314497863026412 1.6835465976780204 1.3655831908785105 1.5882958682169486 1.43208428708654 -0.13795711049811363 0.23981482260806397 1.7971034256260585 0.5373549665979254 1.145818341997217 0.48042855588587824 -0.8935343746060127 0.7867615829230666 0.4250188373912557 0.5664729456325049 2.498590560962256 1.9400873318827656 -0.11275544983055917 -0.5664729456325054 -1.1954271085021426 0.6569361927965854 -0.3442300078704089 -1.3046268229653297 -2.498590560962256 -0.8568619257010015 +21 42653621 42775509 ENSG00000160191 -0.6569361927965854 -0.7203302308575226 -0.7531303783884556 1.0542454124924512 0.012502212342580959 0.18864116776152437 -0.13795711049811363 0.4525499884018013 0.9314497863026412 0.7203302308575226 -0.3442300078704089 1.5056012163044221 0.5664729456325049 0.4250188373912557 -0.26563063350790206 1.145818341997217 0.8568619257010015 -0.18864116776152437 0.06255019758103977 1.0988799140705434 -1.505601216304423 1.2481665394580725 -1.145818341997217 -1.68354659767802 0.11275544983055917 0.5086856698276004 -0.5373549665979251 -0.11275544983055917 -0.1632467108403211 -0.21415788100561842 0.7531303783884556 0.29162472875305195 1.3655831908785105 0.16324671084032097 -1.3655831908785105 -0.5664729456325054 0.6262178361515812 -0.5086856698276004 -1.7971034256260587 1.0116180790824516 -0.08762521122251522 -0.48042855588587813 0.8213071752056109 -1.0542454124924512 -1.5882958682169486 0.3178174129491543 0.7867615829230666 0.6569361927965854 1.9400873318827656 1.6835465976780204 2.498590560962256 -2.498590560962256 -0.6262178361515811 -0.4525499884018013 0.5373549665979254 -0.6882873909026717 -1.3046268229653297 1.5882958682169486 1.7971034256260585 2.139206442985977 -1.2481665394580725 -1.0988799140705434 0.13795711049811363 -1.1954271085021426 0.34423000787040914 -1.0116180790824516 -1.43208428708654 0.6882873909026717 0.26563063350790206 -0.8935343746060127 -0.012502212342580959 -2.1392064429859774 0.3708849944820911 -0.7867615829230669 1.3046268229653302 -0.3708849944820911 -0.5960793860276631 -0.06255019758103977 -0.23981482260806397 -0.29162472875305206 -0.8568619257010015 1.1954271085021424 1.43208428708654 0.48042855588587824 0.5960793860276631 -1.9400873318827652 -0.8213071752056109 0.3978061720339455 -0.3178174129491543 0.2141578810056186 0.03751445734407243 -0.39780617203394536 0.8935343746060127 0.23981482260806397 0.08762521122251538 0.9707539424317222 -0.9314497863026412 -0.03751445734407257 -0.4250188373912558 -0.9707539424317223 +21 42843094 42879568 ENSG00000160193 1.1954271085021424 1.3655831908785105 -0.9314497863026412 -0.13795711049811363 -0.6262178361515811 0.18864116776152437 -0.8935343746060127 0.012502212342580959 0.6569361927965854 0.13795711049811363 0.6262178361515812 1.3046268229653302 0.03751445734407243 0.5664729456325049 0.3708849944820911 0.3978061720339455 0.5373549665979254 0.26563063350790206 0.6882873909026717 0.3178174129491543 -0.4250188373912558 -1.9400873318827652 -0.39780617203394536 1.145818341997217 1.6835465976780204 0.29162472875305195 1.0988799140705434 -0.6569361927965854 -0.8568619257010015 1.7971034256260585 -0.23981482260806397 -0.8213071752056109 -0.9707539424317223 -0.3708849944820911 1.2481665394580725 -0.29162472875305206 -0.26563063350790206 -0.48042855588587813 -0.3178174129491543 -0.7867615829230669 0.4250188373912557 -0.21415788100561842 -0.7203302308575226 0.9314497863026412 0.06255019758103977 0.08762521122251538 -0.5086856698276004 -1.0988799140705434 -0.4525499884018013 1.5056012163044221 -0.7531303783884556 2.139206442985977 0.7203302308575226 0.23981482260806397 0.16324671084032097 -0.08762521122251522 0.48042855588587824 0.7531303783884556 -0.5373549665979251 -0.06255019758103977 0.9707539424317222 -0.1632467108403211 -1.505601216304423 0.34423000787040914 -1.0542454124924512 0.8935343746060127 -0.03751445734407257 -0.18864116776152437 -0.5960793860276631 1.0542454124924512 0.2141578810056186 2.498590560962256 0.5960793860276631 0.5086856698276004 1.43208428708654 0.4525499884018013 -1.5882958682169486 -0.5664729456325054 -1.3046268229653297 -1.43208428708654 -1.0116180790824516 -1.145818341997217 -1.7971034256260587 -0.6882873909026717 -1.3655831908785105 -0.012502212342580959 0.8568619257010015 -2.1392064429859774 -1.2481665394580725 -1.1954271085021426 -2.498590560962256 -1.68354659767802 -0.3442300078704089 0.11275544983055917 -0.11275544983055917 1.5882958682169486 0.7867615829230666 1.9400873318827656 0.8213071752056109 1.0116180790824516 +21 43053191 43076943 ENSG00000160200 1.145818341997217 -1.505601216304423 -0.9707539424317223 -0.6262178361515811 0.4250188373912557 -0.8935343746060127 -1.3046268229653297 0.6569361927965854 -0.26563063350790206 -0.4525499884018013 -0.3708849944820911 -0.29162472875305206 1.5882958682169486 -0.5373549665979251 0.5373549665979254 -0.48042855588587813 -1.68354659767802 -1.0988799140705434 -0.3178174129491543 -0.23981482260806397 -0.21415788100561842 1.2481665394580725 -1.1954271085021426 0.11275544983055917 1.0542454124924512 0.7531303783884556 0.7867615829230666 0.9314497863026412 0.6262178361515812 0.16324671084032097 -0.08762521122251522 1.3655831908785105 0.5664729456325049 0.34423000787040914 0.29162472875305195 0.5086856698276004 -0.8213071752056109 -0.1632467108403211 2.139206442985977 0.2141578810056186 -0.9314497863026412 0.8568619257010015 0.8213071752056109 -2.498590560962256 -1.0116180790824516 0.3978061720339455 0.08762521122251538 -1.145818341997217 -1.7971034256260587 -0.3442300078704089 -1.0542454124924512 -0.7203302308575226 0.23981482260806397 -0.7531303783884556 0.3708849944820911 -0.4250188373912558 -2.1392064429859774 0.8935343746060127 -0.03751445734407257 1.0988799140705434 0.18864116776152437 1.5056012163044221 0.13795711049811363 -0.13795711049811363 1.3046268229653302 2.498590560962256 1.9400873318827656 0.7203302308575226 -1.2481665394580725 0.48042855588587824 -0.7867615829230669 0.6882873909026717 0.9707539424317222 1.7971034256260585 1.6835465976780204 0.3178174129491543 -0.5960793860276631 -0.012502212342580959 0.012502212342580959 -0.5086856698276004 -0.5664729456325054 -0.06255019758103977 0.06255019758103977 -0.6882873909026717 1.1954271085021424 1.43208428708654 -0.18864116776152437 0.03751445734407243 1.0116180790824516 0.26563063350790206 -1.5882958682169486 0.5960793860276631 -1.9400873318827652 0.4525499884018013 -0.6569361927965854 -1.43208428708654 -0.8568619257010015 -1.3655831908785105 -0.39780617203394536 -0.11275544983055917 +21 43092956 43107570 ENSG00000160201 0.29162472875305195 0.06255019758103977 0.5086856698276004 1.5056012163044221 0.2141578810056186 -1.3046268229653297 1.1954271085021424 -0.7531303783884556 -0.11275544983055917 -0.5373549665979251 0.8213071752056109 0.03751445734407243 1.3046268229653302 0.3708849944820911 -0.6882873909026717 -1.0542454124924512 0.5960793860276631 0.5373549665979254 -0.06255019758103977 -1.0116180790824516 1.43208428708654 -1.5882958682169486 -1.505601216304423 -0.03751445734407257 0.7867615829230666 1.5882958682169486 -1.3655831908785105 0.16324671084032097 -0.18864116776152437 -0.5960793860276631 0.48042855588587824 -0.7203302308575226 1.9400873318827656 1.3655831908785105 -1.9400873318827652 -0.26563063350790206 -1.7971034256260587 1.0116180790824516 -0.3708849944820911 -0.5664729456325054 0.9707539424317222 0.6262178361515812 0.11275544983055917 1.2481665394580725 1.6835465976780204 -0.8935343746060127 -0.3178174129491543 -1.1954271085021426 0.7531303783884556 0.9314497863026412 -1.68354659767802 1.0988799140705434 1.145818341997217 0.08762521122251538 0.3178174129491543 -0.6569361927965854 -0.6262178361515811 0.012502212342580959 0.7203302308575226 -2.1392064429859774 -0.39780617203394536 -1.145818341997217 -1.2481665394580725 0.3978061720339455 -0.1632467108403211 -0.4525499884018013 -0.3442300078704089 -0.21415788100561842 -0.8213071752056109 -0.7867615829230669 1.0542454124924512 1.7971034256260585 0.5664729456325049 -1.0988799140705434 2.498590560962256 -0.012502212342580959 0.26563063350790206 0.8568619257010015 0.8935343746060127 -0.13795711049811363 -0.5086856698276004 0.13795711049811363 -0.23981482260806397 -0.9314497863026412 -0.08762521122251522 0.18864116776152437 -1.43208428708654 -0.4250188373912558 -0.29162472875305206 -0.48042855588587813 -0.8568619257010015 0.4250188373912557 0.4525499884018013 0.34423000787040914 -2.498590560962256 -0.9707539424317223 0.6882873909026717 2.139206442985977 0.6569361927965854 0.23981482260806397 +21 43414483 43427131 ENSG00000142178 -2.498590560962256 -1.3046268229653297 1.5882958682169486 0.3708849944820911 -0.39780617203394536 -1.0542454124924512 0.4525499884018013 0.5664729456325049 0.08762521122251538 1.0116180790824516 0.5960793860276631 2.498590560962256 -0.7531303783884556 -0.6569361927965854 -0.48042855588587813 0.06255019758103977 0.9707539424317222 0.7867615829230666 1.0988799140705434 -0.3442300078704089 1.0542454124924512 -0.11275544983055917 -0.08762521122251522 -1.68354659767802 -0.6882873909026717 0.26563063350790206 -0.5960793860276631 -0.26563063350790206 -0.23981482260806397 0.5373549665979254 -0.18864116776152437 -0.5373549665979251 0.34423000787040914 -0.7203302308575226 -0.9707539424317223 -0.29162472875305206 0.2141578810056186 -1.0116180790824516 -1.1954271085021426 -1.3655831908785105 0.29162472875305195 -0.8568619257010015 -0.03751445734407257 0.7203302308575226 -0.1632467108403211 -0.21415788100561842 0.3978061720339455 0.012502212342580959 -1.505601216304423 -0.4250188373912558 -0.7867615829230669 0.7531303783884556 -1.0988799140705434 -1.43208428708654 -0.012502212342580959 -0.4525499884018013 -0.3178174129491543 1.2481665394580725 0.3178174129491543 1.9400873318827656 1.43208428708654 -1.7971034256260587 1.6835465976780204 0.6882873909026717 -0.9314497863026412 0.8935343746060127 1.145818341997217 2.139206442985977 0.9314497863026412 -1.9400873318827652 0.6569361927965854 1.7971034256260585 1.3655831908785105 -0.5664729456325054 0.8568619257010015 0.18864116776152437 -2.1392064429859774 -0.8213071752056109 0.4250188373912557 0.16324671084032097 -0.06255019758103977 -1.2481665394580725 -1.145818341997217 1.3046268229653302 -0.8935343746060127 0.03751445734407243 -0.6262178361515811 -0.3708849944820911 0.11275544983055917 1.5056012163044221 0.5086856698276004 0.8213071752056109 1.1954271085021424 0.23981482260806397 -1.5882958682169486 -0.5086856698276004 0.6262178361515812 0.48042855588587824 0.13795711049811363 -0.13795711049811363 +21 43529186 43659488 ENSG00000160207 -0.03751445734407257 0.13795711049811363 -2.1392064429859774 0.012502212342580959 2.498590560962256 0.06255019758103977 -2.498590560962256 0.5664729456325049 1.145818341997217 -0.6882873909026717 1.1954271085021424 0.11275544983055917 1.5882958682169486 -1.9400873318827652 -1.68354659767802 0.5086856698276004 0.5960793860276631 1.3655831908785105 0.08762521122251538 0.4525499884018013 -0.3442300078704089 0.4250188373912557 -0.7531303783884556 -0.7203302308575226 0.16324671084032097 0.29162472875305195 0.03751445734407243 -0.1632467108403211 1.0116180790824516 -1.3046268229653297 1.3046268229653302 -0.012502212342580959 1.7971034256260585 -0.3178174129491543 -0.3708849944820911 0.8568619257010015 2.139206442985977 -0.6262178361515811 -0.5960793860276631 0.9314497863026412 -0.8935343746060127 -0.21415788100561842 -0.08762521122251522 -0.11275544983055917 -1.1954271085021426 0.18864116776152437 -1.3655831908785105 0.8935343746060127 0.26563063350790206 0.3708849944820911 -1.505601216304423 -1.145818341997217 -0.7867615829230669 -0.4525499884018013 -1.5882958682169486 -0.18864116776152437 -0.5664729456325054 0.8213071752056109 1.2481665394580725 1.0542454124924512 1.9400873318827656 1.43208428708654 -0.06255019758103977 -0.8213071752056109 -0.26563063350790206 -1.7971034256260587 1.6835465976780204 -1.43208428708654 -0.48042855588587813 -0.6569361927965854 -0.5373549665979251 -1.2481665394580725 0.6882873909026717 0.5373549665979254 1.0988799140705434 0.6262178361515812 0.34423000787040914 0.3978061720339455 -0.5086856698276004 0.48042855588587824 0.3178174129491543 0.7531303783884556 -1.0116180790824516 0.23981482260806397 -0.13795711049811363 1.5056012163044221 0.9707539424317222 0.7203302308575226 0.6569361927965854 -0.8568619257010015 -1.0988799140705434 -0.39780617203394536 -0.23981482260806397 -0.9707539424317223 -0.29162472875305206 -0.9314497863026412 0.7867615829230666 -0.4250188373912558 0.2141578810056186 -1.0542454124924512 +21 43659560 43696079 ENSG00000160208 1.6835465976780204 0.5373549665979254 -1.145818341997217 -0.13795711049811363 1.43208428708654 1.0542454124924512 -0.5086856698276004 0.5086856698276004 1.0988799140705434 0.6882873909026717 1.3046268229653302 1.9400873318827656 0.3708849944820911 1.5056012163044221 -0.03751445734407257 -0.06255019758103977 1.3655831908785105 2.498590560962256 -0.012502212342580959 -0.8213071752056109 0.18864116776152437 -1.68354659767802 -0.6262178361515811 -1.9400873318827652 -0.8935343746060127 -0.1632467108403211 1.0116180790824516 -1.0542454124924512 -0.3178174129491543 -0.18864116776152437 -0.9707539424317223 -0.29162472875305206 -1.43208428708654 -0.7203302308575226 -0.7531303783884556 -2.1392064429859774 -1.7971034256260587 -0.26563063350790206 1.145818341997217 -1.0988799140705434 -0.4250188373912558 1.1954271085021424 -1.5882958682169486 0.3178174129491543 -0.5664729456325054 -0.08762521122251522 0.26563063350790206 0.29162472875305195 -0.7867615829230669 0.11275544983055917 -1.3046268229653297 0.7531303783884556 0.6262178361515812 0.23981482260806397 -0.21415788100561842 -0.39780617203394536 -0.23981482260806397 0.7867615829230666 -0.6569361927965854 0.4525499884018013 -1.3655831908785105 0.03751445734407243 -0.3708849944820911 0.012502212342580959 -0.3442300078704089 -0.48042855588587813 0.5960793860276631 0.16324671084032097 0.13795711049811363 0.8935343746060127 0.4250188373912557 1.2481665394580725 -1.2481665394580725 0.8568619257010015 1.7971034256260585 0.08762521122251538 0.06255019758103977 0.9314497863026412 -0.6882873909026717 -0.8568619257010015 -2.498590560962256 -1.505601216304423 -0.5960793860276631 -0.9314497863026412 -0.11275544983055917 -0.4525499884018013 0.34423000787040914 -0.5373549665979251 0.2141578810056186 0.9707539424317222 -1.0116180790824516 -1.1954271085021426 0.5664729456325049 0.3978061720339455 0.6569361927965854 0.8213071752056109 0.48042855588587824 1.5882958682169486 2.139206442985977 0.7203302308575226 +21 43789513 43805293 ENSG00000160214 1.6835465976780204 1.5882958682169486 0.23981482260806397 1.145818341997217 1.43208428708654 0.7203302308575226 0.6262178361515812 1.0116180790824516 0.9707539424317222 0.9314497863026412 1.7971034256260585 1.5056012163044221 0.8935343746060127 1.1954271085021424 0.7531303783884556 0.7867615829230666 1.9400873318827656 2.498590560962256 0.5960793860276631 -0.39780617203394536 -0.48042855588587813 -2.498590560962256 -0.6882873909026717 -1.0116180790824516 -0.3178174129491543 -0.1632467108403211 -0.08762521122251522 -1.43208428708654 -1.1954271085021426 -0.03751445734407257 -1.2481665394580725 -0.5373549665979251 -1.505601216304423 -0.5086856698276004 0.03751445734407243 -1.3046268229653297 -1.9400873318827652 -0.23981482260806397 0.3708849944820911 -1.145818341997217 0.08762521122251538 0.34423000787040914 -0.9707539424317223 0.29162472875305195 0.26563063350790206 0.3978061720339455 0.18864116776152437 -0.012502212342580959 -0.21415788100561842 0.5086856698276004 -0.7531303783884556 0.3178174129491543 0.48042855588587824 0.16324671084032097 0.4525499884018013 -0.11275544983055917 0.06255019758103977 1.3046268229653302 -0.8213071752056109 0.8213071752056109 -1.3655831908785105 -0.7203302308575226 -1.7971034256260587 -0.5664729456325054 -0.6569361927965854 -0.8935343746060127 -0.26563063350790206 -0.06255019758103977 -0.4525499884018013 -0.13795711049811363 0.2141578810056186 0.11275544983055917 -1.0542454124924512 0.012502212342580959 2.139206442985977 -0.6262178361515811 -0.3708849944820911 0.5373549665979254 -0.8568619257010015 -0.3442300078704089 -2.1392064429859774 -1.68354659767802 -0.5960793860276631 -0.4250188373912558 -0.9314497863026412 -0.7867615829230669 0.13795711049811363 -0.29162472875305206 -0.18864116776152437 0.4250188373912557 -1.5882958682169486 -1.0988799140705434 0.8568619257010015 0.6569361927965854 0.6882873909026717 1.3655831908785105 1.0988799140705434 1.0542454124924512 1.2481665394580725 0.5664729456325049 +21 44107373 44131181 ENSG00000241945 2.498590560962256 0.23981482260806397 -0.3442300078704089 -0.48042855588587813 -0.03751445734407257 0.7531303783884556 1.145818341997217 -1.505601216304423 2.139206442985977 0.11275544983055917 1.43208428708654 1.5056012163044221 0.9707539424317222 0.29162472875305195 -0.08762521122251522 1.7971034256260585 1.0116180790824516 0.012502212342580959 -0.1632467108403211 -0.21415788100561842 0.7867615829230666 0.18864116776152437 0.13795711049811363 -0.6262178361515811 0.5960793860276631 0.5086856698276004 -0.5373549665979251 1.1954271085021424 0.8935343746060127 -1.9400873318827652 -1.3046268229653297 -0.6882873909026717 -0.11275544983055917 -0.3708849944820911 -1.145818341997217 -0.5664729456325054 0.16324671084032097 -0.4525499884018013 -0.9314497863026412 -1.7971034256260587 0.48042855588587824 -2.498590560962256 0.03751445734407243 0.8568619257010015 1.0988799140705434 -0.29162472875305206 0.06255019758103977 -0.5086856698276004 -0.18864116776152437 -1.5882958682169486 0.8213071752056109 -0.012502212342580959 0.5664729456325049 -1.43208428708654 0.4525499884018013 0.5373549665979254 0.4250188373912557 1.2481665394580725 0.7203302308575226 -0.39780617203394536 -0.4250188373912558 -0.8213071752056109 -0.8935343746060127 0.6262178361515812 0.08762521122251538 -0.7531303783884556 -0.8568619257010015 -1.0988799140705434 0.26563063350790206 -0.26563063350790206 -1.68354659767802 1.3046268229653302 -1.2481665394580725 -0.13795711049811363 1.5882958682169486 -0.7203302308575226 -1.3655831908785105 0.34423000787040914 -2.1392064429859774 -0.7867615829230669 -0.23981482260806397 -0.6569361927965854 -1.1954271085021426 -1.0116180790824516 0.3178174129491543 0.2141578810056186 0.3708849944820911 0.3978061720339455 0.6882873909026717 -0.06255019758103977 -1.0542454124924512 -0.9707539424317223 1.6835465976780204 1.0542454124924512 1.3655831908785105 -0.5960793860276631 0.6569361927965854 0.9314497863026412 1.9400873318827656 -0.3178174129491543 +21 44133610 44210114 ENSG00000160221 1.145818341997217 0.29162472875305195 -0.7203302308575226 -0.9314497863026412 -0.3442300078704089 -0.29162472875305206 0.34423000787040914 -1.145818341997217 0.9707539424317222 -0.6882873909026717 1.43208428708654 0.3978061720339455 0.18864116776152437 -0.4525499884018013 -0.06255019758103977 1.0988799140705434 -0.3178174129491543 -0.8568619257010015 -0.11275544983055917 -0.5373549665979251 0.4525499884018013 2.139206442985977 -0.13795711049811363 -1.9400873318827652 0.3708849944820911 0.6569361927965854 -0.5960793860276631 1.7971034256260585 1.5882958682169486 -1.3046268229653297 -1.0542454124924512 -0.1632467108403211 -0.23981482260806397 -0.26563063350790206 -1.505601216304423 -0.6569361927965854 0.4250188373912557 -0.4250188373912558 -1.0116180790824516 -2.1392064429859774 0.08762521122251538 -1.3655831908785105 0.6882873909026717 1.3655831908785105 0.11275544983055917 -0.08762521122251522 1.0542454124924512 -0.03751445734407257 0.23981482260806397 -1.68354659767802 0.48042855588587824 -0.8213071752056109 1.6835465976780204 -1.2481665394580725 0.5664729456325049 0.3178174129491543 0.06255019758103977 1.2481665394580725 2.498590560962256 -0.8935343746060127 0.13795711049811363 -0.6262178361515811 0.012502212342580959 0.8935343746060127 -0.39780617203394536 -0.012502212342580959 0.8213071752056109 -1.1954271085021426 0.5086856698276004 0.2141578810056186 -2.498590560962256 1.1954271085021424 -1.5882958682169486 -0.3708849944820911 -0.18864116776152437 -0.48042855588587813 -1.43208428708654 -0.7867615829230669 -1.0988799140705434 1.0116180790824516 0.8568619257010015 -0.5086856698276004 -1.7971034256260587 0.03751445734407243 0.7203302308575226 1.9400873318827656 1.3046268229653302 0.7867615829230666 1.5056012163044221 0.6262178361515812 -0.9707539424317223 -0.5664729456325054 0.7531303783884556 0.5373549665979254 0.5960793860276631 0.16324671084032097 0.9314497863026412 -0.21415788100561842 0.26563063350790206 -0.7531303783884556 +21 44215382 44241446 ENSG00000160223 1.0542454124924512 -0.29162472875305206 -1.0116180790824516 -0.18864116776152437 2.139206442985977 1.5056012163044221 -2.1392064429859774 1.5882958682169486 0.11275544983055917 -0.012502212342580959 0.5373549665979254 1.7971034256260585 -0.23981482260806397 0.8568619257010015 1.2481665394580725 -0.5086856698276004 0.13795711049811363 1.3046268229653302 -0.3442300078704089 0.5960793860276631 -1.0542454124924512 0.6569361927965854 0.012502212342580959 -2.498590560962256 -1.7971034256260587 0.2141578810056186 1.145818341997217 1.3655831908785105 -0.03751445734407257 -0.6882873909026717 -0.7867615829230669 0.29162472875305195 0.3178174129491543 -1.3655831908785105 0.26563063350790206 -0.8568619257010015 -1.2481665394580725 -0.39780617203394536 0.6882873909026717 -0.6262178361515811 0.8213071752056109 0.06255019758103977 -0.9707539424317223 0.9314497863026412 -0.8935343746060127 0.7531303783884556 -0.08762521122251522 -0.1632467108403211 -0.4250188373912558 -0.8213071752056109 -1.5882958682169486 -1.505601216304423 1.0988799140705434 0.23981482260806397 -0.5664729456325054 -0.7203302308575226 -1.3046268229653297 1.9400873318827656 0.8935343746060127 -0.3178174129491543 -1.9400873318827652 0.16324671084032097 -0.48042855588587813 -1.1954271085021426 -1.43208428708654 -1.0988799140705434 0.34423000787040914 -1.145818341997217 -0.5960793860276631 -0.6569361927965854 -0.4525499884018013 -0.7531303783884556 -0.3708849944820911 -1.68354659767802 0.5086856698276004 -0.21415788100561842 -0.9314497863026412 0.7203302308575226 1.1954271085021424 -0.26563063350790206 -0.13795711049811363 0.3708849944820911 1.6835465976780204 -0.5373549665979251 0.5664729456325049 1.0116180790824516 0.18864116776152437 1.43208428708654 0.3978061720339455 2.498590560962256 0.4250188373912557 0.48042855588587824 0.03751445734407243 -0.06255019758103977 -0.11275544983055917 0.4525499884018013 0.6262178361515812 0.7867615829230666 0.9707539424317222 0.08762521122251538 +21 44328944 44339402 ENSG00000160226 0.48042855588587824 1.5882958682169486 1.0116180790824516 0.06255019758103977 1.3046268229653302 0.9707539424317222 0.5086856698276004 -0.3442300078704089 1.145818341997217 -0.012502212342580959 1.0542454124924512 1.7971034256260585 1.3655831908785105 1.9400873318827656 0.8935343746060127 1.5056012163044221 0.4250188373912557 0.7203302308575226 1.2481665394580725 0.4525499884018013 -0.06255019758103977 -1.9400873318827652 -0.4525499884018013 -0.9707539424317223 -0.4250188373912558 1.0988799140705434 0.012502212342580959 -1.2481665394580725 -1.0542454124924512 0.5664729456325049 0.08762521122251538 0.29162472875305195 -0.8213071752056109 -0.08762521122251522 0.6569361927965854 -0.5664729456325054 -1.145818341997217 0.8568619257010015 -0.7203302308575226 -0.5960793860276631 0.34423000787040914 -0.03751445734407257 -0.29162472875305206 0.7867615829230666 1.1954271085021424 0.8213071752056109 -0.13795711049811363 0.3708849944820911 -0.3708849944820911 0.16324671084032097 -1.3046268229653297 -2.1392064429859774 0.03751445734407243 0.6882873909026717 0.5960793860276631 0.13795711049811363 0.5373549665979254 1.43208428708654 -0.11275544983055917 0.11275544983055917 -0.6569361927965854 -0.8935343746060127 -0.23981482260806397 -1.3655831908785105 -0.9314497863026412 -1.7971034256260587 -0.6262178361515811 0.7531303783884556 -0.21415788100561842 -0.5373549665979251 0.18864116776152437 -0.8568619257010015 -2.498590560962256 -0.7531303783884556 -0.3178174129491543 -0.6882873909026717 -1.68354659767802 0.2141578810056186 -1.1954271085021426 -0.26563063350790206 -1.505601216304423 -0.5086856698276004 -0.39780617203394536 0.6262178361515812 -1.5882958682169486 -0.18864116776152437 0.3978061720339455 -0.7867615829230669 -1.0988799140705434 -0.48042855588587813 -1.0116180790824516 -1.43208428708654 0.9314497863026412 -0.1632467108403211 0.3178174129491543 1.6835465976780204 2.139206442985977 2.498590560962256 0.26563063350790206 0.23981482260806397 +21 44350163 44443081 ENSG00000142185 0.23981482260806397 -1.0988799140705434 0.3708849944820911 -0.9314497863026412 1.6835465976780204 0.6882873909026717 -2.498590560962256 0.4250188373912557 -0.6569361927965854 1.9400873318827656 1.0988799140705434 1.1954271085021424 0.5960793860276631 0.8213071752056109 0.7203302308575226 0.08762521122251538 -1.0116180790824516 0.18864116776152437 -1.145818341997217 1.0116180790824516 -0.03751445734407257 -0.13795711049811363 -0.18864116776152437 0.6262178361515812 2.139206442985977 1.3046268229653302 -0.7867615829230669 -0.8935343746060127 -0.4250188373912558 -0.5664729456325054 -1.5882958682169486 -0.5373549665979251 0.3978061720339455 -1.43208428708654 0.13795711049811363 0.6569361927965854 0.5086856698276004 -0.5086856698276004 0.9707539424317222 -0.23981482260806397 0.16324671084032097 1.5882958682169486 -1.3655831908785105 0.8935343746060127 -0.4525499884018013 -0.012502212342580959 -0.08762521122251522 1.3655831908785105 -1.68354659767802 -0.6262178361515811 0.03751445734407243 -0.7531303783884556 2.498590560962256 -1.0542454124924512 -0.3708849944820911 -1.505601216304423 0.2141578810056186 1.43208428708654 -0.9707539424317223 -0.8213071752056109 -0.3178174129491543 1.0542454124924512 -0.29162472875305206 1.145818341997217 0.8568619257010015 -0.21415788100561842 -2.1392064429859774 0.29162472875305195 0.48042855588587824 -0.6882873909026717 0.26563063350790206 -1.9400873318827652 0.7531303783884556 0.5373549665979254 0.11275544983055917 0.34423000787040914 -0.1632467108403211 0.012502212342580959 0.7867615829230666 0.5664729456325049 0.06255019758103977 0.4525499884018013 -0.3442300078704089 1.2481665394580725 0.9314497863026412 -0.11275544983055917 -0.06255019758103977 0.3178174129491543 -0.7203302308575226 1.7971034256260585 -1.2481665394580725 -1.7971034256260587 -1.1954271085021426 -1.3046268229653297 -0.5960793860276631 -0.26563063350790206 -0.48042855588587813 1.5056012163044221 -0.8568619257010015 -0.39780617203394536 +21 44455510 44462196 ENSG00000160233 -0.5086856698276004 0.06255019758103977 -1.505601216304423 0.11275544983055917 -0.8213071752056109 -0.6262178361515811 -1.5882958682169486 0.2141578810056186 -1.43208428708654 -0.06255019758103977 -1.3046268229653297 0.48042855588587824 -0.3178174129491543 0.8213071752056109 -0.8935343746060127 0.012502212342580959 -1.3655831908785105 -0.6569361927965854 0.7867615829230666 0.03751445734407243 0.5373549665979254 -0.29162472875305206 -1.1954271085021426 -1.2481665394580725 -1.0116180790824516 -0.5664729456325054 0.4525499884018013 -0.5960793860276631 1.0542454124924512 0.9314497863026412 -1.9400873318827652 1.3655831908785105 1.145818341997217 -0.9707539424317223 -0.4525499884018013 -0.48042855588587813 -0.21415788100561842 -1.145818341997217 -0.4250188373912558 1.43208428708654 -0.3442300078704089 0.8935343746060127 0.08762521122251538 1.6835465976780204 -1.0542454124924512 0.34423000787040914 1.1954271085021424 2.498590560962256 -0.5373549665979251 -0.3708849944820911 -1.0988799140705434 -0.11275544983055917 -0.26563063350790206 -0.1632467108403211 0.3978061720339455 -0.23981482260806397 1.0988799140705434 1.5056012163044221 0.9707539424317222 0.5086856698276004 0.26563063350790206 0.6262178361515812 0.7203302308575226 0.13795711049811363 0.6882873909026717 -0.6882873909026717 -2.1392064429859774 -0.39780617203394536 1.7971034256260585 0.5664729456325049 -0.012502212342580959 -2.498590560962256 -0.7867615829230669 0.16324671084032097 -0.7531303783884556 -0.8568619257010015 0.18864116776152437 1.9400873318827656 0.5960793860276631 0.3708849944820911 0.23981482260806397 0.7531303783884556 1.2481665394580725 0.8568619257010015 1.0116180790824516 -0.08762521122251522 -0.7203302308575226 1.3046268229653302 0.6569361927965854 0.29162472875305195 1.5882958682169486 -0.9314497863026412 0.3178174129491543 -1.7971034256260587 0.4250188373912557 -0.13795711049811363 2.139206442985977 -0.03751445734407257 -1.68354659767802 -0.18864116776152437 +21 44497893 44711572 ENSG00000175894 -1.5882958682169486 -0.8935343746060127 0.5086856698276004 2.498590560962256 1.9400873318827656 0.3708849944820911 -1.0988799140705434 0.8935343746060127 -0.48042855588587813 -0.39780617203394536 1.2481665394580725 1.5882958682169486 0.16324671084032097 1.145818341997217 -0.012502212342580959 1.1954271085021424 1.5056012163044221 -1.0116180790824516 -0.5664729456325054 -0.21415788100561842 0.34423000787040914 0.3178174129491543 -0.6882873909026717 -1.7971034256260587 -1.1954271085021426 -0.3178174129491543 -0.6569361927965854 -2.498590560962256 -2.1392064429859774 -1.2481665394580725 -0.29162472875305206 -0.23981482260806397 0.7531303783884556 0.6569361927965854 -1.9400873318827652 -0.5960793860276631 -1.3046268229653297 -0.06255019758103977 -0.9707539424317223 -0.9314497863026412 0.06255019758103977 0.7867615829230666 0.9314497863026412 0.13795711049811363 -0.7203302308575226 0.7203302308575226 -0.26563063350790206 -0.4525499884018013 -1.3655831908785105 -1.68354659767802 -0.8568619257010015 -1.145818341997217 -0.13795711049811363 -0.11275544983055917 1.0542454124924512 0.08762521122251538 -0.6262178361515811 0.11275544983055917 0.8568619257010015 0.18864116776152437 -0.5086856698276004 1.43208428708654 0.6882873909026717 0.48042855588587824 1.7971034256260585 0.23981482260806397 -0.7531303783884556 0.29162472875305195 0.012502212342580959 -0.3442300078704089 -0.3708849944820911 -0.08762521122251522 0.3978061720339455 0.8213071752056109 1.3655831908785105 -1.43208428708654 -0.4250188373912558 2.139206442985977 0.26563063350790206 0.5664729456325049 -0.8213071752056109 -0.5373549665979251 -0.1632467108403211 -0.03751445734407257 0.9707539424317222 -1.0542454124924512 1.0988799140705434 1.6835465976780204 0.03751445734407243 -0.7867615829230669 0.2141578810056186 0.5960793860276631 0.5373549665979254 0.4525499884018013 1.0116180790824516 -0.18864116776152437 0.6262178361515812 -1.505601216304423 1.3046268229653302 0.4250188373912557 +21 44768580 44801826 ENSG00000184787 1.5056012163044221 -0.012502212342580959 -0.3708849944820911 0.6262178361515812 1.7971034256260585 0.5086856698276004 -0.48042855588587813 0.23981482260806397 0.9707539424317222 0.11275544983055917 0.9314497863026412 0.4250188373912557 0.3178174129491543 0.6569361927965854 0.8935343746060127 0.5960793860276631 1.0988799140705434 1.9400873318827656 -0.26563063350790206 -0.3442300078704089 1.0542454124924512 -2.498590560962256 -0.8935343746060127 -1.145818341997217 -0.9707539424317223 0.7867615829230666 1.2481665394580725 -0.21415788100561842 -0.29162472875305206 0.7203302308575226 -1.0988799140705434 1.43208428708654 -1.3046268229653297 -0.03751445734407257 0.7531303783884556 -1.7971034256260587 -1.5882958682169486 -0.39780617203394536 0.5664729456325049 -0.8568619257010015 0.08762521122251538 0.13795711049811363 -2.1392064429859774 0.26563063350790206 -0.08762521122251522 0.16324671084032097 -0.4525499884018013 -0.6262178361515811 0.03751445734407243 0.2141578810056186 -0.7531303783884556 1.1954271085021424 0.48042855588587824 0.06255019758103977 -0.5960793860276631 -0.6882873909026717 0.29162472875305195 1.3046268229653302 -0.3178174129491543 1.3655831908785105 -1.505601216304423 -0.13795711049811363 -0.5373549665979251 -0.18864116776152437 -1.2481665394580725 -0.4250188373912558 -0.5664729456325054 -0.5086856698276004 -0.06255019758103977 0.4525499884018013 0.3978061720339455 0.5373549665979254 -1.3655831908785105 0.8568619257010015 2.139206442985977 0.18864116776152437 -0.7203302308575226 1.145818341997217 -0.1632467108403211 -1.43208428708654 -1.0542454124924512 -1.68354659767802 -0.8213071752056109 -0.6569361927965854 -0.7867615829230669 -0.9314497863026412 1.6835465976780204 -1.0116180790824516 -0.11275544983055917 1.5882958682169486 -1.1954271085021426 -1.9400873318827652 -0.23981482260806397 0.8213071752056109 1.0116180790824516 0.6882873909026717 0.3708849944820911 2.498590560962256 0.012502212342580959 0.34423000787040914 +21 44849585 44873903 ENSG00000183255 0.5960793860276631 1.145818341997217 0.3978061720339455 1.9400873318827656 0.2141578810056186 -0.26563063350790206 0.9707539424317222 2.139206442985977 0.11275544983055917 1.43208428708654 0.3178174129491543 0.8213071752056109 0.18864116776152437 0.7203302308575226 -0.18864116776152437 2.498590560962256 0.5086856698276004 -0.4250188373912558 0.9314497863026412 0.23981482260806397 -1.9400873318827652 0.06255019758103977 -0.8568619257010015 0.7531303783884556 -2.498590560962256 -0.7203302308575226 -1.43208428708654 1.0542454124924512 -0.03751445734407257 -0.1632467108403211 -1.2481665394580725 0.012502212342580959 0.03751445734407243 -0.13795711049811363 -0.3442300078704089 0.6569361927965854 -0.06255019758103977 -0.9707539424317223 -0.7531303783884556 1.6835465976780204 0.4250188373912557 -0.8935343746060127 -1.145818341997217 -0.3178174129491543 -0.7867615829230669 -0.8213071752056109 0.16324671084032097 0.34423000787040914 1.0988799140705434 -0.39780617203394536 1.2481665394580725 -0.6882873909026717 -1.3655831908785105 -0.9314497863026412 -0.012502212342580959 -0.6569361927965854 -0.5960793860276631 0.29162472875305195 0.48042855588587824 1.3046268229653302 0.3708849944820911 -0.5086856698276004 -1.0116180790824516 -1.1954271085021426 -0.5373549665979251 0.5373549665979254 -1.7971034256260587 -2.1392064429859774 -1.505601216304423 -1.3046268229653297 -0.6262178361515811 -1.5882958682169486 -0.11275544983055917 -1.0988799140705434 -0.29162472875305206 -0.21415788100561842 -0.3708849944820911 -1.68354659767802 0.4525499884018013 -0.23981482260806397 1.0116180790824516 1.1954271085021424 0.08762521122251538 0.5664729456325049 -0.5664729456325054 -0.08762521122251522 -0.4525499884018013 0.6882873909026717 0.26563063350790206 -1.0542454124924512 1.7971034256260585 0.6262178361515812 1.3655831908785105 0.13795711049811363 1.5882958682169486 0.8935343746060127 0.8568619257010015 0.7867615829230666 -0.48042855588587813 1.5056012163044221 +21 44885953 44931989 ENSG00000160255 -0.3178174129491543 -0.5664729456325054 1.5056012163044221 -0.8935343746060127 -1.7971034256260587 -0.48042855588587813 2.139206442985977 -1.3655831908785105 -0.7531303783884556 -1.3046268229653297 -1.0988799140705434 -1.5882958682169486 0.23981482260806397 -0.8568619257010015 -0.18864116776152437 0.8568619257010015 -0.9707539424317223 -1.0116180790824516 -0.6882873909026717 1.1954271085021424 0.29162472875305195 -0.03751445734407257 1.5882958682169486 1.43208428708654 0.08762521122251538 0.7203302308575226 -0.39780617203394536 1.3655831908785105 0.5960793860276631 0.11275544983055917 -0.21415788100561842 0.5373549665979254 0.5086856698276004 -0.1632467108403211 -0.23981482260806397 0.6882873909026717 0.6262178361515812 0.4525499884018013 0.18864116776152437 1.0116180790824516 0.7531303783884556 0.34423000787040914 0.8935343746060127 1.9400873318827656 1.0988799140705434 1.145818341997217 0.06255019758103977 -0.26563063350790206 0.3178174129491543 0.2141578810056186 1.3046268229653302 -0.4250188373912558 0.26563063350790206 0.6569361927965854 0.9707539424317222 2.498590560962256 0.16324671084032097 -1.68354659767802 0.3978061720339455 -1.505601216304423 1.7971034256260585 0.8213071752056109 -0.11275544983055917 -0.06255019758103977 0.3708849944820911 -0.6262178361515811 0.03751445734407243 -0.7867615829230669 -0.5373549665979251 -0.012502212342580959 -0.13795711049811363 1.2481665394580725 0.9314497863026412 0.13795711049811363 -2.1392064429859774 -0.29162472875305206 -1.145818341997217 -1.2481665394580725 -0.3442300078704089 -1.9400873318827652 1.0542454124924512 0.012502212342580959 -0.3708849944820911 0.7867615829230666 0.4250188373912557 1.6835465976780204 -0.4525499884018013 -0.8213071752056109 0.5664729456325049 -0.5960793860276631 -0.5086856698276004 -0.08762521122251522 -1.1954271085021426 0.48042855588587824 -0.7203302308575226 -0.6569361927965854 -1.43208428708654 -2.498590560962256 -0.9314497863026412 -1.0542454124924512 +21 45073853 45226560 ENSG00000197381 2.139206442985977 -1.3046268229653297 0.29162472875305195 -1.2481665394580725 -0.012502212342580959 0.4525499884018013 -0.39780617203394536 -0.9314497863026412 -0.3178174129491543 0.06255019758103977 -0.29162472875305206 0.08762521122251538 1.3655831908785105 1.145818341997217 0.9707539424317222 -0.06255019758103977 0.5373549665979254 0.7867615829230666 0.11275544983055917 -1.0116180790824516 0.5086856698276004 0.26563063350790206 -0.21415788100561842 -0.8213071752056109 1.5056012163044221 0.5664729456325049 0.13795711049811363 -2.1392064429859774 -0.8568619257010015 -1.5882958682169486 0.8935343746060127 -1.0542454124924512 -1.43208428708654 1.0542454124924512 -1.68354659767802 -1.0988799140705434 -0.3708849944820911 0.8568619257010015 2.498590560962256 -0.6262178361515811 -0.4525499884018013 1.0116180790824516 0.7531303783884556 0.2141578810056186 -0.5960793860276631 0.48042855588587824 -0.7203302308575226 -0.1632467108403211 -1.3655831908785105 0.23981482260806397 -0.7531303783884556 0.012502212342580959 1.9400873318827656 -0.13795711049811363 -0.11275544983055917 -0.4250188373912558 -1.505601216304423 0.34423000787040914 -0.26563063350790206 0.16324671084032097 -0.8935343746060127 0.3708849944820911 0.9314497863026412 0.3178174129491543 1.1954271085021424 -0.3442300078704089 1.43208428708654 0.03751445734407243 0.4250188373912557 1.7971034256260585 0.18864116776152437 -0.23981482260806397 -1.9400873318827652 -0.6569361927965854 0.8213071752056109 0.6262178361515812 -0.5373549665979251 -0.5664729456325054 -0.7867615829230669 -0.48042855588587813 -0.03751445734407257 -0.9707539424317223 -0.6882873909026717 -0.08762521122251522 0.5960793860276631 1.5882958682169486 1.2481665394580725 -1.1954271085021426 1.0988799140705434 1.3046268229653302 -1.7971034256260587 0.7203302308575226 -1.145818341997217 0.6882873909026717 0.6569361927965854 0.3978061720339455 -2.498590560962256 -0.18864116776152437 1.6835465976780204 -0.5086856698276004 +21 45263928 45287898 ENSG00000186866 0.11275544983055917 -0.21415788100561842 0.3178174129491543 0.7203302308575226 0.13795711049811363 -0.11275544983055917 1.9400873318827656 1.0542454124924512 0.3708849944820911 -0.13795711049811363 0.48042855588587824 -0.03751445734407257 0.08762521122251538 0.7531303783884556 0.5960793860276631 1.1954271085021424 0.3978061720339455 0.6262178361515812 -0.06255019758103977 -0.18864116776152437 0.2141578810056186 0.5664729456325049 -1.0542454124924512 -1.9400873318827652 -2.498590560962256 -0.012502212342580959 -0.9707539424317223 1.3655831908785105 0.9314497863026412 -0.23981482260806397 -0.5664729456325054 1.0116180790824516 0.34423000787040914 -1.1954271085021426 -0.3442300078704089 -0.7531303783884556 -0.5960793860276631 0.18864116776152437 -2.1392064429859774 -0.7203302308575226 0.4250188373912557 -0.39780617203394536 0.012502212342580959 0.03751445734407243 -0.48042855588587813 0.16324671084032097 -1.0116180790824516 -0.26563063350790206 -0.8568619257010015 -1.505601216304423 -1.68354659767802 -1.5882958682169486 -0.8213071752056109 -0.3708849944820911 -0.7867615829230669 0.6882873909026717 -1.3655831908785105 0.8213071752056109 -0.29162472875305206 1.145818341997217 0.5373549665979254 -1.0988799140705434 0.6569361927965854 -0.4250188373912558 -0.1632467108403211 -0.6882873909026717 -1.145818341997217 1.43208428708654 0.06255019758103977 -0.4525499884018013 -1.43208428708654 -1.7971034256260587 0.29162472875305195 -0.9314497863026412 0.26563063350790206 -0.6262178361515811 0.9707539424317222 0.7867615829230666 1.5056012163044221 2.139206442985977 -1.3046268229653297 0.8568619257010015 1.5882958682169486 0.5086856698276004 1.3046268229653302 0.4525499884018013 -0.8935343746060127 1.6835465976780204 1.0988799140705434 -0.08762521122251522 2.498590560962256 1.7971034256260585 1.2481665394580725 -1.2481665394580725 -0.6569361927965854 -0.3178174129491543 0.23981482260806397 0.8935343746060127 -0.5086856698276004 -0.5373549665979251 +21 45405165 45513720 ENSG00000182871 2.139206442985977 -0.9707539424317223 0.012502212342580959 1.0542454124924512 0.2141578810056186 0.4525499884018013 0.6882873909026717 0.48042855588587824 0.6569361927965854 1.2481665394580725 1.43208428708654 -0.3708849944820911 -0.18864116776152437 2.498590560962256 1.3655831908785105 0.5960793860276631 1.5056012163044221 -0.11275544983055917 1.7971034256260585 -1.2481665394580725 -1.9400873318827652 -0.8568619257010015 1.9400873318827656 0.06255019758103977 0.08762521122251538 -0.012502212342580959 0.4250188373912557 -1.505601216304423 -1.145818341997217 -2.498590560962256 -0.7531303783884556 -1.0988799140705434 -1.1954271085021426 -1.7971034256260587 -0.7203302308575226 -1.43208428708654 0.5373549665979254 -1.0542454124924512 -0.1632467108403211 -0.21415788100561842 -0.48042855588587813 0.3978061720339455 1.0988799140705434 0.26563063350790206 0.18864116776152437 0.29162472875305195 0.23981482260806397 0.03751445734407243 -0.39780617203394536 -2.1392064429859774 -0.5664729456325054 -1.3655831908785105 0.8213071752056109 -0.6569361927965854 1.0116180790824516 -0.03751445734407257 0.13795711049811363 -0.9314497863026412 -0.7867615829230669 -0.6262178361515811 -0.8213071752056109 -1.0116180790824516 0.34423000787040914 -0.6882873909026717 -0.08762521122251522 -0.4525499884018013 0.8935343746060127 -0.29162472875305206 0.3178174129491543 0.6262178361515812 -1.5882958682169486 1.3046268229653302 -0.8935343746060127 -1.68354659767802 -0.5373549665979251 -0.13795711049811363 -0.5086856698276004 -1.3046268229653297 0.9707539424317222 -0.26563063350790206 0.7531303783884556 -0.4250188373912558 0.5086856698276004 0.16324671084032097 -0.3178174129491543 1.6835465976780204 -0.23981482260806397 -0.5960793860276631 0.9314497863026412 0.3708849944820911 -0.3442300078704089 1.145818341997217 -0.06255019758103977 0.7867615829230666 0.5664729456325049 0.7203302308575226 1.1954271085021424 1.5882958682169486 0.8568619257010015 0.11275544983055917 +21 45493572 45573365 ENSG00000173638 2.498590560962256 0.8935343746060127 -2.1392064429859774 0.3978061720339455 1.3046268229653302 0.06255019758103977 -0.7531303783884556 1.145818341997217 0.3708849944820911 1.0116180790824516 1.7971034256260585 1.1954271085021424 0.11275544983055917 1.5882958682169486 0.9707539424317222 0.13795711049811363 0.8213071752056109 1.43208428708654 -0.6262178361515811 -0.13795711049811363 -0.29162472875305206 -1.9400873318827652 0.08762521122251538 -0.48042855588587813 -0.08762521122251522 0.5373549665979254 0.5960793860276631 -0.3708849944820911 -0.8213071752056109 1.0542454124924512 -0.18864116776152437 -1.0116180790824516 -1.0988799140705434 -0.23981482260806397 -0.03751445734407257 -1.43208428708654 -0.7867615829230669 -0.3178174129491543 0.7203302308575226 -0.9707539424317223 -0.06255019758103977 0.6262178361515812 -1.2481665394580725 0.7531303783884556 0.3178174129491543 0.4250188373912557 -0.012502212342580959 -0.5960793860276631 -0.5664729456325054 1.6835465976780204 -0.4525499884018013 1.9400873318827656 0.7867615829230666 0.23981482260806397 0.6569361927965854 0.16324671084032097 0.5664729456325049 -0.21415788100561842 -0.3442300078704089 -0.7203302308575226 -0.6882873909026717 0.2141578810056186 -0.8935343746060127 -0.4250188373912558 -0.6569361927965854 -1.0542454124924512 0.26563063350790206 0.4525499884018013 -0.1632467108403211 1.5056012163044221 1.2481665394580725 2.139206442985977 -1.5882958682169486 0.18864116776152437 0.34423000787040914 0.48042855588587824 -1.3046268229653297 0.29162472875305195 -0.9314497863026412 -1.505601216304423 -1.3655831908785105 -1.68354659767802 -1.145818341997217 -0.5373549665979251 -0.8568619257010015 0.9314497863026412 0.6882873909026717 -1.1954271085021426 -0.39780617203394536 -0.5086856698276004 -2.498590560962256 -1.7971034256260587 -0.26563063350790206 -0.11275544983055917 0.012502212342580959 1.0988799140705434 0.03751445734407243 0.8568619257010015 1.3655831908785105 0.5086856698276004 +21 45643694 45942454 ENSG00000183570 1.43208428708654 -0.8213071752056109 1.2481665394580725 -0.8568619257010015 2.498590560962256 0.5664729456325049 0.8568619257010015 1.0116180790824516 0.4525499884018013 0.9314497863026412 2.139206442985977 -1.68354659767802 -0.8935343746060127 0.5373549665979254 1.7971034256260585 -0.23981482260806397 1.0988799140705434 0.5086856698276004 -0.7531303783884556 -0.06255019758103977 -0.3442300078704089 1.3655831908785105 0.8935343746060127 0.08762521122251538 -0.6262178361515811 0.7531303783884556 -0.21415788100561842 -1.9400873318827652 0.03751445734407243 -1.5882958682169486 -1.0542454124924512 -1.0988799140705434 -0.11275544983055917 0.13795711049811363 -1.145818341997217 -0.9707539424317223 -0.5960793860276631 -0.08762521122251522 -1.43208428708654 0.3708849944820911 -0.012502212342580959 0.18864116776152437 0.8213071752056109 -1.0116180790824516 0.4250188373912557 0.7203302308575226 0.11275544983055917 -1.3655831908785105 0.23981482260806397 -1.505601216304423 -0.3178174129491543 -0.5086856698276004 0.48042855588587824 0.5960793860276631 -0.13795711049811363 -0.7203302308575226 1.1954271085021424 -0.18864116776152437 -0.5373549665979251 0.7867615829230666 -0.3708849944820911 -1.2481665394580725 1.5882958682169486 0.3978061720339455 -0.7867615829230669 0.34423000787040914 -0.4250188373912558 0.6569361927965854 0.3178174129491543 1.3046268229653302 -0.26563063350790206 -0.29162472875305206 -1.7971034256260587 0.012502212342580959 -0.4525499884018013 0.16324671084032097 1.5056012163044221 -2.1392064429859774 0.6262178361515812 -1.3046268229653297 0.26563063350790206 -0.39780617203394536 1.6835465976780204 0.2141578810056186 0.29162472875305195 1.9400873318827656 -1.1954271085021426 -0.1632467108403211 1.0542454124924512 -0.48042855588587813 1.145818341997217 0.9707539424317222 -0.5664729456325054 -0.6569361927965854 0.06255019758103977 -0.03751445734407257 0.6882873909026717 -2.498590560962256 -0.9314497863026412 -0.6882873909026717 +21 45981770 46005050 ENSG00000142156 0.5664729456325049 0.26563063350790206 -1.0988799140705434 0.6262178361515812 0.3978061720339455 1.43208428708654 -1.7971034256260587 0.18864116776152437 -1.1954271085021426 -2.1392064429859774 -0.9314497863026412 -1.3655831908785105 0.5373549665979254 -1.9400873318827652 -0.8935343746060127 1.3046268229653302 0.23981482260806397 0.9707539424317222 -0.5373549665979251 -0.6569361927965854 0.34423000787040914 -1.3046268229653297 -0.3708849944820911 0.2141578810056186 0.03751445734407243 0.8935343746060127 1.2481665394580725 0.06255019758103977 0.4525499884018013 0.08762521122251538 -0.5086856698276004 -0.11275544983055917 0.11275544983055917 0.48042855588587824 0.012502212342580959 -1.505601216304423 -0.21415788100561842 0.4250188373912557 1.5056012163044221 -0.1632467108403211 1.0116180790824516 -1.0542454124924512 0.13795711049811363 -0.03751445734407257 1.145818341997217 -0.8568619257010015 0.6882873909026717 -0.012502212342580959 -0.48042855588587813 -0.29162472875305206 -1.145818341997217 -0.7867615829230669 1.5882958682169486 0.7531303783884556 -0.7531303783884556 -0.8213071752056109 1.1954271085021424 1.3655831908785105 0.8568619257010015 -0.6882873909026717 -1.43208428708654 0.29162472875305195 1.0988799140705434 0.7203302308575226 -0.3178174129491543 -0.13795711049811363 -0.6262178361515811 -1.68354659767802 0.3178174129491543 1.0542454124924512 -0.3442300078704089 -1.0116180790824516 -0.39780617203394536 -0.5664729456325054 1.9400873318827656 -0.08762521122251522 -2.498590560962256 -0.7203302308575226 0.8213071752056109 -0.06255019758103977 0.16324671084032097 0.7867615829230666 0.9314497863026412 -0.18864116776152437 0.6569361927965854 -0.23981482260806397 1.6835465976780204 -1.2481665394580725 0.5086856698276004 0.5960793860276631 -0.26563063350790206 -0.4250188373912558 -0.4525499884018013 -0.9707539424317223 2.139206442985977 2.498590560962256 -1.5882958682169486 1.7971034256260585 0.3708849944820911 -0.5960793860276631 +21 46098112 46132848 ENSG00000142173 -0.3442300078704089 -0.03751445734407257 -2.498590560962256 0.3178174129491543 1.3655831908785105 1.7971034256260585 -0.5373549665979251 -0.39780617203394536 0.11275544983055917 -0.7531303783884556 0.2141578810056186 0.06255019758103977 0.7867615829230666 0.012502212342580959 0.29162472875305195 1.0116180790824516 -1.145818341997217 -0.48042855588587813 -0.29162472875305206 -1.1954271085021426 -1.505601216304423 0.03751445734407243 0.7531303783884556 -2.1392064429859774 -1.9400873318827652 0.8568619257010015 1.1954271085021424 -1.0116180790824516 0.5086856698276004 -0.26563063350790206 -0.6569361927965854 0.16324671084032097 -0.5664729456325054 0.6569361927965854 0.6882873909026717 -0.7867615829230669 -0.7203302308575226 0.5373549665979254 1.3046268229653302 -0.1632467108403211 0.5960793860276631 -0.6882873909026717 0.7203302308575226 0.8213071752056109 0.6262178361515812 -0.23981482260806397 0.26563063350790206 1.5056012163044221 -0.9314497863026412 0.13795711049811363 -0.012502212342580959 -0.8935343746060127 1.145818341997217 0.18864116776152437 -1.0542454124924512 -1.0988799140705434 1.43208428708654 1.2481665394580725 -0.6262178361515811 0.23981482260806397 -1.3655831908785105 -0.21415788100561842 0.5664729456325049 0.08762521122251538 -0.8568619257010015 0.4250188373912557 -1.43208428708654 -1.68354659767802 -0.18864116776152437 -0.06255019758103977 -0.08762521122251522 -0.13795711049811363 -0.11275544983055917 -0.9707539424317223 1.5882958682169486 0.9314497863026412 -1.3046268229653297 -1.7971034256260587 1.0542454124924512 0.3978061720339455 -0.4250188373912558 0.8935343746060127 0.9707539424317222 0.48042855588587824 1.0988799140705434 -0.5086856698276004 1.9400873318827656 -0.3178174129491543 0.34423000787040914 -0.8213071752056109 0.3708849944820911 0.4525499884018013 -0.3708849944820911 -0.5960793860276631 1.6835465976780204 2.498590560962256 -1.5882958682169486 2.139206442985977 -0.4525499884018013 -1.2481665394580725 +21 46136160 46155579 ENSG00000160282 -1.2481665394580725 0.26563063350790206 -1.7971034256260587 -0.4525499884018013 0.9707539424317222 -0.3708849944820911 1.1954271085021424 -0.06255019758103977 0.7203302308575226 -0.23981482260806397 0.06255019758103977 1.3046268229653302 1.9400873318827656 1.2481665394580725 2.139206442985977 -0.08762521122251522 1.7971034256260585 -0.7867615829230669 -0.3442300078704089 -0.012502212342580959 -0.5960793860276631 -0.6262178361515811 -0.5086856698276004 -1.3655831908785105 -1.0116180790824516 0.3978061720339455 0.6569361927965854 -2.498590560962256 -2.1392064429859774 -1.0542454124924512 -0.1632467108403211 -0.03751445734407257 0.7867615829230666 -0.48042855588587813 -1.505601216304423 -0.39780617203394536 -1.0988799140705434 1.3655831908785105 1.5056012163044221 -0.7531303783884556 0.11275544983055917 0.4250188373912557 1.0116180790824516 1.145818341997217 -0.5373549665979251 -0.26563063350790206 -0.11275544983055917 -0.29162472875305206 -1.145818341997217 -1.3046268229653297 -0.7203302308575226 -0.9707539424317223 0.48042855588587824 0.012502212342580959 0.18864116776152437 0.13795711049811363 -0.4250188373912558 1.5882958682169486 0.8935343746060127 0.5373549665979254 0.34423000787040914 -0.18864116776152437 0.7531303783884556 -1.9400873318827652 -0.9314497863026412 -1.1954271085021426 -0.5664729456325054 0.29162472875305195 1.0988799140705434 -0.21415788100561842 0.8213071752056109 0.03751445734407243 -0.3178174129491543 -0.13795711049811363 0.23981482260806397 0.2141578810056186 0.3708849944820911 -0.8935343746060127 -0.8568619257010015 -0.8213071752056109 -0.6882873909026717 0.6882873909026717 0.9314497863026412 1.0542454124924512 0.16324671084032097 1.6835465976780204 0.6262178361515812 0.3178174129491543 0.08762521122251538 0.5960793860276631 -1.5882958682169486 0.5664729456325049 -1.43208428708654 0.5086856698276004 1.43208428708654 0.4525499884018013 -0.6569361927965854 2.498590560962256 -1.68354659767802 0.8568619257010015 +21 46161148 46184476 ENSG00000160284 -2.1392064429859774 -0.29162472875305206 -2.498590560962256 -1.43208428708654 0.26563063350790206 -0.012502212342580959 0.2141578810056186 -1.145818341997217 -1.3046268229653297 -0.8213071752056109 0.18864116776152437 -0.08762521122251522 0.16324671084032097 0.29162472875305195 -0.7203302308575226 0.5664729456325049 -0.9314497863026412 0.4525499884018013 -0.3178174129491543 -0.11275544983055917 -1.9400873318827652 2.498590560962256 0.5960793860276631 -0.18864116776152437 0.3978061720339455 -0.7531303783884556 -1.0542454124924512 -0.23981482260806397 0.3178174129491543 0.5373549665979254 0.6262178361515812 -0.21415788100561842 -1.5882958682169486 -0.13795711049811363 -0.03751445734407257 -1.0988799140705434 -1.7971034256260587 1.5056012163044221 -0.3442300078704089 0.5086856698276004 -0.3708849944820911 -0.8568619257010015 1.3046268229653302 1.9400873318827656 -0.5960793860276631 -1.68354659767802 0.012502212342580959 1.0542454124924512 0.7203302308575226 -0.06255019758103977 1.145818341997217 -1.0116180790824516 1.2481665394580725 -1.3655831908785105 -0.6882873909026717 0.06255019758103977 -1.1954271085021426 -0.5373549665979251 0.9314497863026412 -0.6262178361515811 0.3708849944820911 0.4250188373912557 0.8935343746060127 0.7867615829230666 0.48042855588587824 -0.39780617203394536 0.6882873909026717 0.8213071752056109 1.0116180790824516 0.11275544983055917 1.0988799140705434 0.23981482260806397 1.1954271085021424 0.34423000787040914 0.08762521122251538 -0.9707539424317223 0.6569361927965854 -0.8935343746060127 -0.1632467108403211 1.7971034256260585 0.7531303783884556 0.9707539424317222 -1.2481665394580725 1.6835465976780204 1.43208428708654 2.139206442985977 -0.6569361927965854 -0.48042855588587813 1.3655831908785105 -0.26563063350790206 -0.5664729456325054 -0.5086856698276004 -0.4250188373912558 0.03751445734407243 -0.4525499884018013 0.13795711049811363 -1.505601216304423 0.8568619257010015 1.5882958682169486 -0.7867615829230669 +21 46188141 46228824 ENSG00000160285 1.43208428708654 1.0116180790824516 -1.3046268229653297 0.9314497863026412 0.8213071752056109 0.29162472875305195 -0.5373549665979251 0.7203302308575226 0.012502212342580959 0.7531303783884556 -0.23981482260806397 1.3046268229653302 -0.18864116776152437 0.48042855588587824 0.13795711049811363 0.3178174129491543 1.1954271085021424 1.5056012163044221 -1.505601216304423 -0.8935343746060127 -0.7203302308575226 -0.8568619257010015 -1.145818341997217 -0.3178174129491543 -0.7531303783884556 -0.6882873909026717 0.4525499884018013 0.9707539424317222 0.7867615829230666 -0.5086856698276004 -0.9707539424317223 0.23981482260806397 -1.0542454124924512 -1.0116180790824516 0.34423000787040914 -2.498590560962256 -1.7971034256260587 -0.29162472875305206 0.6882873909026717 -1.2481665394580725 -0.8213071752056109 -0.3708849944820911 -0.9314497863026412 0.16324671084032097 -1.0988799140705434 -2.1392064429859774 -0.6569361927965854 -0.3442300078704089 -0.7867615829230669 1.5882958682169486 -1.1954271085021426 -1.5882958682169486 0.11275544983055917 -1.68354659767802 -0.5664729456325054 0.08762521122251538 -1.43208428708654 1.3655831908785105 1.7971034256260585 1.9400873318827656 -0.012502212342580959 2.139206442985977 1.6835465976780204 0.5373549665979254 1.145818341997217 -1.9400873318827652 1.0988799140705434 0.03751445734407243 -0.26563063350790206 0.06255019758103977 -0.03751445734407257 0.5664729456325049 -0.08762521122251522 1.0542454124924512 2.498590560962256 -0.4250188373912558 1.2481665394580725 0.5086856698276004 -0.6262178361515811 0.18864116776152437 -0.11275544983055917 -0.39780617203394536 0.26563063350790206 -0.21415788100561842 0.3708849944820911 0.2141578810056186 0.6569361927965854 0.3978061720339455 0.4250188373912557 0.8935343746060127 -0.5960793860276631 -0.48042855588587813 0.6262178361515812 -1.3655831908785105 0.5960793860276631 -0.06255019758103977 -0.4525499884018013 -0.13795711049811363 0.8568619257010015 -0.1632467108403211 +21 46286342 46297751 ENSG00000182362 0.5373549665979254 0.6882873909026717 0.13795711049811363 1.5056012163044221 0.3978061720339455 -0.06255019758103977 0.26563063350790206 0.8568619257010015 0.48042855588587824 -0.08762521122251522 1.1954271085021424 -1.0542454124924512 0.4250188373912557 0.5086856698276004 -0.5086856698276004 0.7203302308575226 1.2481665394580725 -1.505601216304423 -1.3655831908785105 0.6569361927965854 -0.18864116776152437 2.139206442985977 -1.3046268229653297 -0.23981482260806397 -2.498590560962256 0.18864116776152437 0.4525499884018013 -0.7203302308575226 0.29162472875305195 -0.8213071752056109 -0.5960793860276631 -0.26563063350790206 -0.9314497863026412 -0.6569361927965854 -0.4525499884018013 1.9400873318827656 0.9707539424317222 -1.0988799140705434 0.9314497863026412 0.23981482260806397 -1.1954271085021426 -0.3178174129491543 1.5882958682169486 -1.9400873318827652 -1.145818341997217 -0.21415788100561842 -0.4250188373912558 -0.9707539424317223 -0.6882873909026717 -1.68354659767802 -1.2481665394580725 1.43208428708654 -0.48042855588587813 0.03751445734407243 0.3708849944820911 0.16324671084032097 -0.5664729456325054 0.3178174129491543 -0.012502212342580959 -0.39780617203394536 1.145818341997217 -0.13795711049811363 0.6262178361515812 -0.6262178361515811 -0.11275544983055917 -0.03751445734407257 1.3046268229653302 1.3655831908785105 0.7531303783884556 -0.8935343746060127 -0.5373549665979251 0.34423000787040914 -0.8568619257010015 0.11275544983055917 -1.7971034256260587 -1.5882958682169486 -0.29162472875305206 1.0988799140705434 0.012502212342580959 0.7867615829230666 0.5664729456325049 0.8213071752056109 1.6835465976780204 -0.3442300078704089 -0.1632467108403211 2.498590560962256 1.7971034256260585 1.0116180790824516 0.2141578810056186 -2.1392064429859774 -0.7531303783884556 -0.3708849944820911 0.08762521122251538 -1.43208428708654 1.0542454124924512 0.8935343746060127 0.5960793860276631 -1.0116180790824516 0.06255019758103977 -0.7867615829230669 +21 46300181 46323875 ENSG00000160298 -1.9400873318827652 -0.5664729456325054 -0.8568619257010015 -1.1954271085021426 -1.3046268229653297 -0.5373549665979251 -1.68354659767802 -1.3655831908785105 -1.7971034256260587 -1.43208428708654 -1.0988799140705434 -0.7531303783884556 -0.5086856698276004 -0.8213071752056109 -0.8935343746060127 -0.9314497863026412 -1.0542454124924512 -0.7867615829230669 -0.6262178361515811 0.9314497863026412 1.5056012163044221 -0.6569361927965854 -0.11275544983055917 0.7867615829230666 -0.3178174129491543 1.43208428708654 1.9400873318827656 0.6569361927965854 1.2481665394580725 0.3708849944820911 1.0116180790824516 1.3655831908785105 1.6835465976780204 -0.03751445734407257 -0.29162472875305206 0.4250188373912557 0.23981482260806397 1.0988799140705434 0.26563063350790206 -0.21415788100561842 0.5960793860276631 0.7203302308575226 -0.26563063350790206 0.6262178361515812 0.18864116776152437 0.06255019758103977 0.16324671084032097 0.2141578810056186 0.11275544983055917 0.5086856698276004 -0.08762521122251522 0.5373549665979254 0.9707539424317222 0.8213071752056109 0.5664729456325049 0.4525499884018013 1.1954271085021424 -1.145818341997217 0.48042855588587824 -2.498590560962256 0.29162472875305195 1.5882958682169486 1.7971034256260585 0.3978061720339455 -0.48042855588587813 0.13795711049811363 0.7531303783884556 2.139206442985977 1.0542454124924512 0.6882873909026717 1.145818341997217 0.8568619257010015 0.03751445734407243 1.3046268229653302 -1.2481665394580725 0.08762521122251538 -0.012502212342580959 0.34423000787040914 -0.3442300078704089 -0.7203302308575226 -0.39780617203394536 -0.23981482260806397 -0.3708849944820911 -0.06255019758103977 -0.18864116776152437 -0.4250188373912558 0.8935343746060127 -1.0116180790824516 -0.1632467108403211 0.3178174129491543 -0.5960793860276631 -0.6882873909026717 -1.5882958682169486 -1.505601216304423 -2.1392064429859774 -0.13795711049811363 0.012502212342580959 2.498590560962256 -0.9707539424317223 -0.4525499884018013 +21 46324124 46445769 ENSG00000160299 -0.5960793860276631 0.08762521122251538 -0.11275544983055917 -2.1392064429859774 -1.145818341997217 0.5086856698276004 -1.7971034256260587 -1.1954271085021426 -1.0988799140705434 -1.3046268229653297 -0.13795711049811363 0.7203302308575226 -0.23981482260806397 -0.03751445734407257 -0.3442300078704089 -0.8935343746060127 -1.0116180790824516 0.03751445734407243 -0.7531303783884556 0.7531303783884556 1.3655831908785105 -1.0542454124924512 0.3708849944820911 0.23981482260806397 -0.012502212342580959 1.5882958682169486 2.498590560962256 1.145818341997217 1.0542454124924512 0.8213071752056109 0.6569361927965854 0.5373549665979254 1.3046268229653302 0.3178174129491543 -0.6569361927965854 -1.2481665394580725 -0.18864116776152437 1.6835465976780204 0.012502212342580959 -0.4525499884018013 0.6262178361515812 1.5056012163044221 -0.5664729456325054 0.9314497863026412 0.8568619257010015 -0.29162472875305206 0.2141578810056186 0.4250188373912557 -0.3708849944820911 -0.08762521122251522 -0.8213071752056109 0.5664729456325049 1.0988799140705434 1.9400873318827656 -0.06255019758103977 0.7867615829230666 0.5960793860276631 0.3978061720339455 -0.21415788100561842 -0.6262178361515811 -1.3655831908785105 -0.1632467108403211 0.9707539424317222 0.11275544983055917 -0.9707539424317223 -0.3178174129491543 0.4525499884018013 0.48042855588587824 1.0116180790824516 1.2481665394580725 1.7971034256260585 1.1954271085021424 -0.7203302308575226 0.26563063350790206 0.16324671084032097 -0.26563063350790206 -0.6882873909026717 0.13795711049811363 -0.8568619257010015 -1.43208428708654 -1.9400873318827652 -1.5882958682169486 0.06255019758103977 -0.4250188373912558 -0.5086856698276004 -0.7867615829230669 0.34423000787040914 -1.505601216304423 -0.48042855588587813 0.6882873909026717 -1.68354659767802 -2.498590560962256 -0.9314497863026412 -0.5373549665979251 -0.39780617203394536 0.29162472875305195 0.8935343746060127 2.139206442985977 1.43208428708654 0.18864116776152437 +21 46598604 46605208 ENSG00000160307 0.6262178361515812 0.7203302308575226 -1.5882958682169486 -0.4525499884018013 1.6835465976780204 0.7531303783884556 -0.8568619257010015 0.11275544983055917 -0.29162472875305206 -0.18864116776152437 1.0542454124924512 0.9707539424317222 0.5664729456325049 0.9314497863026412 1.145818341997217 0.08762521122251538 0.23981482260806397 1.3655831908785105 0.7867615829230666 0.16324671084032097 -0.5664729456325054 -0.5960793860276631 1.5056012163044221 -1.2481665394580725 1.2481665394580725 -0.08762521122251522 -0.39780617203394536 -2.1392064429859774 -1.9400873318827652 -1.0116180790824516 -0.012502212342580959 0.13795711049811363 -0.21415788100561842 -0.48042855588587813 -1.3655831908785105 -0.3442300078704089 -1.0542454124924512 0.3178174129491543 -0.8213071752056109 -0.7867615829230669 0.4250188373912557 -0.06255019758103977 1.0116180790824516 0.5086856698276004 -0.5373549665979251 0.8935343746060127 0.03751445734407243 -0.23981482260806397 -1.0988799140705434 0.5960793860276631 -0.7531303783884556 0.6882873909026717 1.5882958682169486 0.26563063350790206 0.5373549665979254 0.4525499884018013 -0.3708849944820911 1.1954271085021424 0.06255019758103977 -1.7971034256260587 -0.3178174129491543 -0.11275544983055917 0.8568619257010015 -1.68354659767802 -0.9707539424317223 -1.1954271085021426 1.43208428708654 -0.6882873909026717 0.3708849944820911 -0.13795711049811363 -0.1632467108403211 0.29162472875305195 -0.26563063350790206 0.012502212342580959 1.9400873318827656 -1.145818341997217 2.139206442985977 -0.9314497863026412 -0.8935343746060127 1.3046268229653302 -0.7203302308575226 0.8213071752056109 0.2141578810056186 1.0988799140705434 0.48042855588587824 2.498590560962256 -0.4250188373912558 -0.5086856698276004 0.3978061720339455 1.7971034256260585 -1.43208428708654 -0.6569361927965854 -1.3046268229653297 0.34423000787040914 -2.498590560962256 0.18864116776152437 -0.6262178361515811 0.6569361927965854 -1.505601216304423 -0.03751445734407257 diff --git a/tests/testthat/test_data/test_phenotypes.tsv.gz b/tests/testthat/test_data/test_phenotypes.tsv.gz new file mode 100644 index 000000000..e27bd7043 Binary files /dev/null and b/tests/testthat/test_data/test_phenotypes.tsv.gz differ diff --git a/tests/testthat/test_data/test_phenotypes.tsv.gz.tbi b/tests/testthat/test_data/test_phenotypes.tsv.gz.tbi new file mode 100644 index 000000000..7bab185b0 Binary files /dev/null and b/tests/testthat/test_data/test_phenotypes.tsv.gz.tbi differ diff --git a/tests/testthat/test_data/test_sumstats.tsv.gz b/tests/testthat/test_data/test_sumstats.tsv.gz new file mode 100644 index 000000000..957e0fd59 Binary files /dev/null and b/tests/testthat/test_data/test_sumstats.tsv.gz differ diff --git a/tests/testthat/test_data/test_sumstats.tsv.gz.tbi b/tests/testthat/test_data/test_sumstats.tsv.gz.tbi new file mode 100644 index 000000000..a752d710f Binary files /dev/null and b/tests/testthat/test_data/test_sumstats.tsv.gz.tbi differ diff --git a/tests/testthat/test_data/test_variants.afreq b/tests/testthat/test_data/test_variants.afreq new file mode 100644 index 000000000..38aa44b6a --- /dev/null +++ b/tests/testthat/test_data/test_variants.afreq @@ -0,0 +1,350 @@ +#CHROM ID REF ALT PROVISIONAL_REF? ALT_FREQS OBS_CT +21 chr21_17513228_C_G C G Y 0.1 200 +21 chr21_17513580_C_T C T Y 0.075 200 +21 chr21_17513624_T_C T C Y 0.06 200 +21 chr21_17514447_G_A G A Y 0.11 200 +21 chr21_17514685_G_A G A Y 0.1 200 +21 chr21_17514813_T_C T C Y 0.1 200 +21 chr21_17514883_C_G C G Y 0.215 200 +21 chr21_17514886_A_T A T Y 0.06 200 +21 chr21_17515165_C_T C T Y 0.215 200 +21 chr21_17515283_A_G A G Y 0.21 200 +21 chr21_17515360_T_A A T Y 0.17 200 +21 chr21_17515408_G_A G A Y 0.105 200 +21 chr21_17515432_A_T A T Y 0.19 200 +21 chr21_17515602_G_A G A Y 0.06 200 +21 chr21_17515636_C_A C A Y 0.06 200 +21 chr21_17515808_A_C A C Y 0.145 200 +21 chr21_17516162_C_G C G Y 0.1 200 +21 chr21_17516223_G_A G A Y 0.065 200 +21 chr21_17516546_T_C T C Y 0.1 200 +21 chr21_17516815_AGT_A AGT A Y 0.175 200 +21 chr21_17516952_GA_G GA G Y 0.1 200 +21 chr21_17517680_A_C A C Y 0.19 200 +21 chr21_17517683_T_TTGAAGA T TTGAAGA Y 0.105 200 +21 chr21_17517734_A_G A G Y 0.105 200 +21 chr21_17518122_G_A G A Y 0.1 200 +21 chr21_17518266_C_A A C Y 0.175 200 +21 chr21_17519634_C_T C T Y 0.1 200 +21 chr21_17519707_T_C T C Y 0.1 200 +21 chr21_17519734_G_C G C Y 0.1 200 +21 chr21_17520407_T_C T C Y 0.21 200 +21 chr21_17520648_G_A G A Y 0.475 200 +21 chr21_17520779_T_C T C Y 0.08 200 +21 chr21_17521022_T_G T G Y 0.085 200 +21 chr21_17521131_A_G A G Y 0.2 200 +21 chr21_17521375_T_A T A Y 0.235 200 +21 chr21_17521464_A_G A G Y 0.14 200 +21 chr21_17521559_GTGA_G GTGA G Y 0.125 200 +21 chr21_17522133_G_C C G Y 0.325 200 +21 chr21_17522315_AT_A AT A Y 0.245 200 +21 chr21_17522348_A_G G A Y 0.495 200 +21 chr21_17522480_A_G A G Y 0.125 200 +21 chr21_17522958_A_G A G Y 0.125 200 +21 chr21_17523579_G_A G A Y 0.065 200 +21 chr21_17523652_T_A T A Y 0.065 200 +21 chr21_17523753_G_A G A Y 0.2 200 +21 chr21_17523894_T_C T C Y 0.175 200 +21 chr21_17523928_G_A G A Y 0.5 200 +21 chr21_17524195_A_T A T Y 0.245 200 +21 chr21_17524490_C_T C T Y 0.255 200 +21 chr21_17525474_C_T C T Y 0.125 200 +21 chr21_17525608_T_A A T Y 0.485 200 +21 chr21_17526014_T_C T C Y 0.065 200 +21 chr21_17526279_T_C T C Y 0.25 200 +21 chr21_17526364_A_T A T Y 0.065 200 +21 chr21_17526577_G_T G T Y 0.065 200 +21 chr21_17526911_A_C A C Y 0.065 200 +21 chr21_17527800_T_TTTTA T TTTTA Y 0.125 200 +21 chr21_17527957_A_G A G Y 0.065 200 +21 chr21_17528363_C_T C T Y 0.125 200 +21 chr21_17529100_G_A G A Y 0.065 200 +21 chr21_17529502_A_G A G Y 0.2 200 +21 chr21_17529651_G_A A G Y 0.36 200 +21 chr21_17529955_T_C T C Y 0.125 200 +21 chr21_17530220_C_T C T Y 0.175 200 +21 chr21_17530224_C_G C G Y 0.065 200 +21 chr21_17530294_AT_A AT A Y 0.065 200 +21 chr21_17530453_G_C G C Y 0.175 200 +21 chr21_17530755_G_A G A Y 0.245 200 +21 chr21_17530762_C_T C T Y 0.115 200 +21 chr21_17530820_A_C A C Y 0.125 200 +21 chr21_17531415_A_G A G Y 0.125 200 +21 chr21_17531536_A_G G A Y 0.055 200 +21 chr21_17531721_A_G A G Y 0.055 200 +21 chr21_17531779_CTT_C CTT C Y 0.245 200 +21 chr21_17532183_C_T T C Y 0.22 200 +21 chr21_17532261_G_C G C Y 0.08 200 +21 chr21_17532402_ACTGT_A ACTGT A Y 0.065 200 +21 chr21_17532474_C_T C T Y 0.255 200 +21 chr21_17533041_G_A G A Y 0.115 200 +21 chr21_17533080_T_A T A Y 0.165 200 +21 chr21_17533581_G_A G A Y 0.115 200 +21 chr21_17533587_A_G A G Y 0.14 200 +21 chr21_17533873_G_T G T Y 0.06 200 +21 chr21_17534211_G_A G A Y 0.48 200 +21 chr21_17534215_C_T C T Y 0.115 200 +21 chr21_17534571_G_T G T Y 0.115 200 +21 chr21_17534583_G_C G C Y 0.175 200 +21 chr21_17535659_A_C A C Y 0.175 200 +21 chr21_17536186_A_C C A Y 0.38 200 +21 chr21_17536232_A_G A G Y 0.11 200 +21 chr21_17536260_T_C T C Y 0.08 200 +21 chr21_17536503_C_A A C Y 0.38 200 +21 chr21_17536949_G_A G A Y 0.11 200 +21 chr21_17536995_T_A T A Y 0.145 200 +21 chr21_17537118_A_G A G Y 0.115 200 +21 chr21_17537728_A_G G A Y 0.38 200 +21 chr21_17538189_T_C C T Y 0.38 200 +21 chr21_17539918_G_GT G GT Y 0.08 200 +21 chr21_17540894_C_T C T Y 0.085 200 +21 chr21_17541380_G_A G A Y 0.14 200 +21 chr21_17541396_C_CA C CA Y 0.11 200 +21 chr21_17541499_A_G A G Y 0.17 200 +21 chr21_17541596_C_A C A Y 0.14 200 +21 chr21_17541774_G_C G C Y 0.17 200 +21 chr21_17542024_ACT_A ACT A Y 0.14 200 +21 chr21_17542052_T_A T A Y 0.17 200 +21 chr21_17542068_A_G A G Y 0.115 200 +21 chr21_17542147_A_G A G Y 0.07 200 +21 chr21_17542741_A_G A G Y 0.135 200 +21 chr21_17543019_T_C T C Y 0.085 200 +21 chr21_17543312_C_T C T Y 0.175 200 +21 chr21_17543494_C_T C T Y 0.325 200 +21 chr21_17543820_G_A G A Y 0.12 200 +21 chr21_17544714_A_G A G Y 0.315 200 +21 chr21_17544780_C_T C T Y 0.11 200 +21 chr21_17544865_A_G A G Y 0.175 200 +21 chr21_17544962_CCT_C CCT C Y 0.11 200 +21 chr21_17545007_C_T C T Y 0.175 200 +21 chr21_17545391_T_A T A Y 0.11 200 +21 chr21_17545666_G_A G A Y 0.085 200 +21 chr21_17545937_A_G A G Y 0.09 200 +21 chr21_17546068_C_T C T Y 0.08 200 +21 chr21_17546736_C_G C G Y 0.11 200 +21 chr21_17546737_T_G T G Y 0.11 200 +21 chr21_17546936_A_G A G Y 0.065 200 +21 chr21_17547434_G_A G A Y 0.1 200 +21 chr21_17547937_C_G C G Y 0.095 200 +21 chr21_17548085_A_C A C Y 0.11 200 +21 chr21_17548112_A_G A G Y 0.11 200 +21 chr21_17548319_T_C T C Y 0.14 200 +21 chr21_17548368_C_G C G Y 0.24 200 +21 chr21_17549420_C_A C A Y 0.24 200 +21 chr21_17549503_G_T G T Y 0.11 200 +21 chr21_17549944_C_T C T Y 0.095 200 +21 chr21_17550109_C_G C G Y 0.145 200 +21 chr21_17550454_C_T C T Y 0.095 200 +21 chr21_17550613_A_G A G Y 0.095 200 +21 chr21_17551097_T_TA T TA Y 0.125 200 +21 chr21_17551331_T_C T C Y 0.24 200 +21 chr21_17551392_CAAAAA_C CAAAAA C Y 0.095 200 +21 chr21_17551547_A_G A G Y 0.145 200 +21 chr21_17551702_T_G T G Y 0.145 200 +21 chr21_17551871_A_G A G Y 0.24 200 +21 chr21_17552019_T_C T C Y 0.11 200 +21 chr21_17552481_T_G G T Y 0.44 200 +21 chr21_17552573_T_TTA T TTA Y 0.095 200 +21 chr21_17552741_G_A G A Y 0.18 200 +21 chr21_17552956_T_A T A Y 0.24 200 +21 chr21_17553007_C_T C T Y 0.24 200 +21 chr21_17553033_T_C T C Y 0.145 200 +21 chr21_17553036_C_T C T Y 0.145 200 +21 chr21_17553048_A_G A G Y 0.145 200 +21 chr21_17553054_C_T C T Y 0.145 200 +21 chr21_17553066_GCA_G GCA G Y 0.145 200 +21 chr21_17553071_C_CCT C CCT Y 0.145 200 +21 chr21_17553072_A_G A G Y 0.145 200 +21 chr21_17553081_C_A C A Y 0.145 200 +21 chr21_17553184_G_A A G Y 0.345 200 +21 chr21_17553223_G_A G A Y 0.11 200 +21 chr21_17553605_G_C G C Y 0.095 200 +21 chr21_17554263_T_C T C Y 0.24 200 +21 chr21_17554291_AG_A AG A Y 0.435 200 +21 chr21_17554488_G_C G C Y 0.125 200 +21 chr21_17554491_G_C G C Y 0.075 200 +21 chr21_17554492_G_C G C Y 0.36 200 +21 chr21_17554543_C_T C T Y 0.11 200 +21 chr21_17554567_A_G A G Y 0.21 200 +21 chr21_17554616_T_C T C Y 0.38 200 +21 chr21_17555515_C_T C T Y 0.24 200 +21 chr21_17555598_A_G A G Y 0.24 200 +21 chr21_17555632_TCTC_T TCTC T Y 0.145 200 +21 chr21_17555658_A_G A G Y 0.11 200 +21 chr21_17555970_C_T C T Y 0.095 200 +21 chr21_17556326_A_G A G Y 0.145 200 +21 chr21_17556414_T_A T A Y 0.18 200 +21 chr21_17556432_G_A A G Y 0.4 200 +21 chr21_17556468_GA_G GA G Y 0.075 200 +21 chr21_17556741_T_A T A Y 0.075 200 +21 chr21_17556778_A_T T A Y 0.35 200 +21 chr21_17556841_A_G G A Y 0.385 200 +21 chr21_17557016_G_A G A Y 0.41 200 +21 chr21_17557426_C_A C A Y 0.415 200 +21 chr21_17557522_G_A G A Y 0.415 200 +21 chr21_17557671_G_A G A Y 0.095 200 +21 chr21_17557752_GAA_G GAA G Y 0.41 200 +21 chr21_17557911_G_A G A Y 0.41 200 +21 chr21_17558115_A_G A G Y 0.41 200 +21 chr21_17558685_ATT_A ATT A Y 0.15 200 +21 chr21_17558747_T_G T G Y 0.095 200 +21 chr21_17559176_C_T C T Y 0.15 200 +21 chr21_17559641_T_A T A Y 0.41 200 +21 chr21_17559865_C_G G C Y 0.145 200 +21 chr21_17560034_G_A G A Y 0.41 200 +21 chr21_17560291_A_C A C Y 0.345 200 +21 chr21_17560332_G_T G T Y 0.095 200 +21 chr21_17560437_G_C C G Y 0.145 200 +21 chr21_17560616_T_A T A Y 0.41 200 +21 chr21_17560678_G_C G C Y 0.07 200 +21 chr21_17560918_G_T G T Y 0.095 200 +21 chr21_17561510_A_G A G Y 0.075 200 +21 chr21_17561586_A_G A G Y 0.15 200 +21 chr21_17561678_C_G C G Y 0.11 200 +21 chr21_17561761_G_A G A Y 0.095 200 +21 chr21_17562194_CAGTG_C CAGTG C Y 0.095 200 +21 chr21_17562221_G_A G A Y 0.41 200 +21 chr21_17562230_G_T G T Y 0.095 200 +21 chr21_17562335_TC_T TC T Y 0.375 200 +21 chr21_17562965_C_T C T Y 0.15 200 +21 chr21_17563079_C_T C T Y 0.375 200 +21 chr21_17563155_GTTAA_G GTTAA G Y 0.15 200 +21 chr21_17563260_G_C C G Y 0.145 200 +21 chr21_17563353_G_C G C Y 0.15 200 +21 chr21_17563664_G_A G A Y 0.2 200 +21 chr21_17563757_C_T C T Y 0.15 200 +21 chr21_17563801_T_C C T Y 0.495 200 +21 chr21_17563829_C_T C T Y 0.41 200 +21 chr21_17564141_T_A T A Y 0.07 200 +21 chr21_17564224_G_A G A Y 0.48 200 +21 chr21_17564536_A_G G A Y 0.41 200 +21 chr21_17564596_G_C G C Y 0.35 200 +21 chr21_17564957_A_G A G Y 0.11 200 +21 chr21_17564994_C_G C G Y 0.35 200 +21 chr21_17565239_A_G A G Y 0.085 200 +21 chr21_17565440_A_G A G Y 0.345 200 +21 chr21_17565725_T_C T C Y 0.085 200 +21 chr21_17565762_G_T G T Y 0.145 200 +21 chr21_17565800_ATAAGT_A ATAAGT A Y 0.085 200 +21 chr21_17565942_T_G G T Y 0.41 200 +21 chr21_17566167_C_T C T Y 0.11 200 +21 chr21_17566359_T_C T C Y 0.495 200 +21 chr21_17566449_G_A G A Y 0.095 200 +21 chr21_17567111_T_C T C Y 0.495 200 +21 chr21_17567128_C_T C T Y 0.245 200 +21 chr21_17567657_G_A G A Y 0.095 200 +21 chr21_17568012_T_C T C Y 0.105 200 +21 chr21_17568161_G_C C G Y 0.41 200 +21 chr21_17568206_G_T G T Y 0.495 200 +21 chr21_17568330_G_A A G Y 0.41 200 +21 chr21_17568406_G_A G A Y 0.095 200 +21 chr21_17568498_CTT_C C CTT Y 0.41 200 +21 chr21_17568582_A_G G A Y 0.41 200 +21 chr21_17568605_G_C G C Y 0.495 200 +21 chr21_17568743_G_C G C Y 0.095 200 +21 chr21_17568769_G_A A G Y 0.41 200 +21 chr21_17568797_C_G C G Y 0.075 200 +21 chr21_17568945_A_G A G Y 0.34 200 +21 chr21_17569383_C_T C T Y 0.485 200 +21 chr21_17569657_G_C C G Y 0.41 200 +21 chr21_17569787_T_C T C Y 0.15 200 +21 chr21_17569931_G_A G A Y 0.105 200 +21 chr21_17570136_A_T A T Y 0.145 200 +21 chr21_17570190_G_C G C Y 0.095 200 +21 chr21_17570414_G_A G A Y 0.105 200 +21 chr21_17570499_T_C T C Y 0.245 200 +21 chr21_17570510_G_C G C Y 0.245 200 +21 chr21_17570831_A_C A C Y 0.27 200 +21 chr21_17571153_C_G C G Y 0.38 200 +21 chr21_17571311_A_G A G Y 0.095 200 +21 chr21_17571318_T_C T C Y 0.105 200 +21 chr21_17571369_G_A G A Y 0.095 200 +21 chr21_17571794_T_A A T Y 0.385 200 +21 chr21_17571869_G_A G A Y 0.13 200 +21 chr21_17572000_G_A A G Y 0.145 200 +21 chr21_17572184_A_C A C Y 0.175 200 +21 chr21_17572242_A_G A G Y 0.22 200 +21 chr21_17572383_A_G G A Y 0.155 200 +21 chr21_17572543_A_G G A Y 0.235 200 +21 chr21_17572554_CCTT_C CCTT C Y 0.065 200 +21 chr21_17572563_G_A G A Y 0.17 200 +21 chr21_17572571_G_A G A Y 0.075 200 +21 chr21_17572576_A_G A G Y 0.445 200 +21 chr21_17572717_T_C T C Y 0.295 200 +21 chr21_17572852_G_A G A Y 0.365 200 +21 chr21_17573059_A_G G A Y 0.295 200 +21 chr21_17573157_C_A C A Y 0.17 200 +21 chr21_17573190_C_CG C CG Y 0.195 200 +21 chr21_17573533_A_G G A Y 0.44 200 +21 chr21_17573592_C_T T C Y 0.44 200 +21 chr21_17573619_G_A G A Y 0.08 200 +21 chr21_17573759_A_T A T Y 0.085 200 +21 chr21_17573916_ATTC_A ATTC A Y 0.315 200 +21 chr21_17573921_T_G T G Y 0.315 200 +21 chr21_17573923_A_T A T Y 0.315 200 +21 chr21_17574064_G_C C G Y 0.32 200 +21 chr21_17574310_T_A A T Y 0.32 200 +21 chr21_17574383_AT_A A AT Y 0.32 200 +21 chr21_17574409_A_T A T Y 0.235 200 +21 chr21_17574719_G_C G C Y 0.085 200 +21 chr21_17574752_A_G G A Y 0.32 200 +21 chr21_17575127_C_CTCATTCTA CTCATTCTA C Y 0.37 200 +21 chr21_17575256_C_G C G Y 0.14 200 +21 chr21_17575514_G_A G A Y 0.07 200 +21 chr21_17575543_T_G G T Y 0.19 200 +21 chr21_17575643_A_G A G Y 0.205 200 +21 chr21_17575667_A_G G A Y 0.17 200 +21 chr21_17575695_G_A G A Y 0.055 200 +21 chr21_17575714_T_C C T Y 0.195 200 +21 chr21_17575787_T_G T G Y 0.14 200 +21 chr21_17575947_G_A G A Y 0.14 200 +21 chr21_17576576_C_T C T Y 0.06 200 +21 chr21_17576915_C_CA C CA Y 0.16 200 +21 chr21_17577143_C_A C A Y 0.14 200 +21 chr21_17578144_A_G A G Y 0.435 200 +21 chr21_17578173_A_G A G Y 0.065 200 +21 chr21_17578198_A_G A G Y 0.145 200 +21 chr21_17578245_T_G T G Y 0.2 200 +21 chr21_17578336_G_A G A Y 0.12 200 +21 chr21_17578690_A_G G A Y 0.265 200 +21 chr21_17578700_G_A G A Y 0.065 200 +21 chr21_17578815_C_A C A Y 0.075 200 +21 chr21_17578893_A_G A G Y 0.12 200 +21 chr21_17578994_T_C T C Y 0.065 200 +21 chr21_17579244_G_A G A Y 0.095 200 +21 chr21_17579344_G_T G T Y 0.125 200 +21 chr21_17579604_T_C C T Y 0.18 200 +21 chr21_17580257_G_A G A Y 0.195 200 +21 chr21_17580756_A_G A G Y 0.08 200 +21 chr21_17580802_G_A G A Y 0.055 200 +21 chr21_17580832_C_T C T Y 0.055 200 +21 chr21_17581092_T_C T C Y 0.11 200 +21 chr21_17581880_C_T C T Y 0.055 200 +21 chr21_17581976_C_T C T Y 0.055 200 +21 chr21_17582085_A_G A G Y 0.105 200 +21 chr21_17582606_C_T C T Y 0.115 200 +21 chr21_17582730_T_C T C Y 0.095 200 +21 chr21_17583168_A_G A G Y 0.095 200 +21 chr21_17583287_A_G A G Y 0.105 200 +21 chr21_17583375_C_T C T Y 0.325 200 +21 chr21_17584190_C_T C T Y 0.22 200 +21 chr21_17584262_G_C G C Y 0.22 200 +21 chr21_17584440_A_T A T Y 0.11 200 +21 chr21_17584502_A_G A G Y 0.1 200 +21 chr21_17584577_G_A G A Y 0.2 200 +21 chr21_17584717_G_C G C Y 0.365 200 +21 chr21_17585152_G_T G T Y 0.225 200 +21 chr21_17585313_A_G A G Y 0.32 200 +21 chr21_17585496_C_T C T Y 0.225 200 +21 chr21_17585621_G_A G A Y 0.055 200 +21 chr21_17586078_T_G T G Y 0.055 200 +21 chr21_17586363_G_A A G Y 0.135 200 +21 chr21_17586771_G_A A G Y 0.135 200 +21 chr21_17586862_G_A G A Y 0.105 200 +21 chr21_17587003_C_T C T Y 0.24 200 +21 chr21_17587397_C_T C T Y 0.055 200 +21 chr21_17588743_G_A G A Y 0.225 200 +21 chr21_17589032_TAATA_T TAATA T Y 0.065 200 +21 chr21_17591636_A_G A G Y 0.145 200 +21 chr21_17591962_C_T C T Y 0.065 200 +21 chr21_17592874_G_GACTTT GACTTT G Y 0.19 200 diff --git a/tests/testthat/test_data/test_variants.bed b/tests/testthat/test_data/test_variants.bed new file mode 100644 index 000000000..b00cff688 --- /dev/null +++ b/tests/testthat/test_data/test_variants.bed @@ -0,0 +1,22 @@ +l>...?/Ͽ믿￿ᆵ>믿?/Ͽ.ƒ⣯쯲".."믿.Ϯ>#(*>>ο;첊뺨.(>*€#(+>꿯> ʎ>￯꿯?:躯+3뿿̿."( +".ʺ.뿿뿿絛絛:몳:몳뿿:몳:몳?333뿿뿯3請ᄐ"뿿3뿿3뿿뿿뿿?뿿뿿밻￿밻￿뿿?밻￿밻￿뿿.<ό3̿밻￿밻￿몳밻￿⪌.ð뿿?*갻>뿿̿⪬ꮮð돺밻￿밻￿̿뿿돻/<, +ú껯(̺??;?./ +*ʨ+?/ +*ʨ*2몳*2몳*2몳*﮺2몳*﮺2몳*﮺2몳*﮺2몳̿*﮺2몳몳?̿*﮺2몳??*﮺2몳?*﮾몳*﮾몳̿??>;..<,./ + +(*﮺2몳+/:,.*0ꪮώ*﮺2몳?./ꪊ.˺?./ꪊ.˺ꫯ. +:몾ώ̿̿*﮺2몳;..<,./ + +(;..<,./ + +(ꮿ./ꪮ뿿*﮺2몳;..<,./ + +(*﮺2몳*﮺2몳*﮺2몳;..<,./ + +(*﮺2몳??./ꪊ/˺;..<,./ + (*﮺2몳̿ﻯ. +뻿θ̿ﻯ. +뻿θ̿ﻯ. +뿫Ψ̿"..껿*﮾*몳ȿȿ*﮿ȿ?隷.,..꫺.+ꈮ?꫏. +:꺫ώȿκ+#ȿ(/㺪ϼ*0(/㺪ϼ*0??뺣뺣뺣뺣Ⱦ뺣Ⱦ뺣Ⱦ뮿?뺣Ⱦȿȿȿ⿯⊏ +:꺫舿;絛?˻뿿?+;﮾>,ʏ󼯯󼯯󼯯+誯.:(+󼯯>,ʏ󼯯;;???→Ͽ; \ No newline at end of file diff --git a/tests/testthat/test_data/test_variants.bim b/tests/testthat/test_data/test_variants.bim new file mode 100644 index 000000000..a5b14590a --- /dev/null +++ b/tests/testthat/test_data/test_variants.bim @@ -0,0 +1,349 @@ +21 chr21_17513228_C_G 0 17513228 G C +21 chr21_17513580_C_T 0 17513580 T C +21 chr21_17513624_T_C 0 17513624 C T +21 chr21_17514447_G_A 0 17514447 A G +21 chr21_17514685_G_A 0 17514685 A G +21 chr21_17514813_T_C 0 17514813 C T +21 chr21_17514883_C_G 0 17514883 G C +21 chr21_17514886_A_T 0 17514886 T A +21 chr21_17515165_C_T 0 17515165 T C +21 chr21_17515283_A_G 0 17515283 G A +21 chr21_17515360_T_A 0 17515360 T A +21 chr21_17515408_G_A 0 17515408 A G +21 chr21_17515432_A_T 0 17515432 T A +21 chr21_17515602_G_A 0 17515602 A G +21 chr21_17515636_C_A 0 17515636 A C +21 chr21_17515808_A_C 0 17515808 C A +21 chr21_17516162_C_G 0 17516162 G C +21 chr21_17516223_G_A 0 17516223 A G +21 chr21_17516546_T_C 0 17516546 C T +21 chr21_17516815_AGT_A 0 17516815 A AGT +21 chr21_17516952_GA_G 0 17516952 G GA +21 chr21_17517680_A_C 0 17517680 C A +21 chr21_17517683_T_TTGAAGA 0 17517683 TTGAAGA T +21 chr21_17517734_A_G 0 17517734 G A +21 chr21_17518122_G_A 0 17518122 A G +21 chr21_17518266_C_A 0 17518266 C A +21 chr21_17519634_C_T 0 17519634 T C +21 chr21_17519707_T_C 0 17519707 C T +21 chr21_17519734_G_C 0 17519734 C G +21 chr21_17520407_T_C 0 17520407 C T +21 chr21_17520648_G_A 0 17520648 A G +21 chr21_17520779_T_C 0 17520779 C T +21 chr21_17521022_T_G 0 17521022 G T +21 chr21_17521131_A_G 0 17521131 G A +21 chr21_17521375_T_A 0 17521375 A T +21 chr21_17521464_A_G 0 17521464 G A +21 chr21_17521559_GTGA_G 0 17521559 G GTGA +21 chr21_17522133_G_C 0 17522133 G C +21 chr21_17522315_AT_A 0 17522315 A AT +21 chr21_17522348_A_G 0 17522348 A G +21 chr21_17522480_A_G 0 17522480 G A +21 chr21_17522958_A_G 0 17522958 G A +21 chr21_17523579_G_A 0 17523579 A G +21 chr21_17523652_T_A 0 17523652 A T +21 chr21_17523753_G_A 0 17523753 A G +21 chr21_17523894_T_C 0 17523894 C T +21 chr21_17523928_G_A 0 17523928 A G +21 chr21_17524195_A_T 0 17524195 T A +21 chr21_17524490_C_T 0 17524490 T C +21 chr21_17525474_C_T 0 17525474 T C +21 chr21_17525608_T_A 0 17525608 T A +21 chr21_17526014_T_C 0 17526014 C T +21 chr21_17526279_T_C 0 17526279 C T +21 chr21_17526364_A_T 0 17526364 T A +21 chr21_17526577_G_T 0 17526577 T G +21 chr21_17526911_A_C 0 17526911 C A +21 chr21_17527800_T_TTTTA 0 17527800 TTTTA T +21 chr21_17527957_A_G 0 17527957 G A +21 chr21_17528363_C_T 0 17528363 T C +21 chr21_17529100_G_A 0 17529100 A G +21 chr21_17529502_A_G 0 17529502 G A +21 chr21_17529651_G_A 0 17529651 G A +21 chr21_17529955_T_C 0 17529955 C T +21 chr21_17530220_C_T 0 17530220 T C +21 chr21_17530224_C_G 0 17530224 G C +21 chr21_17530294_AT_A 0 17530294 A AT +21 chr21_17530453_G_C 0 17530453 C G +21 chr21_17530755_G_A 0 17530755 A G +21 chr21_17530762_C_T 0 17530762 T C +21 chr21_17530820_A_C 0 17530820 C A +21 chr21_17531415_A_G 0 17531415 G A +21 chr21_17531536_A_G 0 17531536 A G +21 chr21_17531721_A_G 0 17531721 G A +21 chr21_17531779_CTT_C 0 17531779 C CTT +21 chr21_17532183_C_T 0 17532183 C T +21 chr21_17532261_G_C 0 17532261 C G +21 chr21_17532402_ACTGT_A 0 17532402 A ACTGT +21 chr21_17532474_C_T 0 17532474 T C +21 chr21_17533041_G_A 0 17533041 A G +21 chr21_17533080_T_A 0 17533080 A T +21 chr21_17533581_G_A 0 17533581 A G +21 chr21_17533587_A_G 0 17533587 G A +21 chr21_17533873_G_T 0 17533873 T G +21 chr21_17534211_G_A 0 17534211 A G +21 chr21_17534215_C_T 0 17534215 T C +21 chr21_17534571_G_T 0 17534571 T G +21 chr21_17534583_G_C 0 17534583 C G +21 chr21_17535659_A_C 0 17535659 C A +21 chr21_17536186_A_C 0 17536186 A C +21 chr21_17536232_A_G 0 17536232 G A +21 chr21_17536260_T_C 0 17536260 C T +21 chr21_17536503_C_A 0 17536503 C A +21 chr21_17536949_G_A 0 17536949 A G +21 chr21_17536995_T_A 0 17536995 A T +21 chr21_17537118_A_G 0 17537118 G A +21 chr21_17537728_A_G 0 17537728 A G +21 chr21_17538189_T_C 0 17538189 T C +21 chr21_17539918_G_GT 0 17539918 GT G +21 chr21_17540894_C_T 0 17540894 T C +21 chr21_17541380_G_A 0 17541380 A G +21 chr21_17541396_C_CA 0 17541396 CA C +21 chr21_17541499_A_G 0 17541499 G A +21 chr21_17541596_C_A 0 17541596 A C +21 chr21_17541774_G_C 0 17541774 C G +21 chr21_17542024_ACT_A 0 17542024 A ACT +21 chr21_17542052_T_A 0 17542052 A T +21 chr21_17542068_A_G 0 17542068 G A +21 chr21_17542147_A_G 0 17542147 G A +21 chr21_17542741_A_G 0 17542741 G A +21 chr21_17543019_T_C 0 17543019 C T +21 chr21_17543312_C_T 0 17543312 T C +21 chr21_17543494_C_T 0 17543494 T C +21 chr21_17543820_G_A 0 17543820 A G +21 chr21_17544714_A_G 0 17544714 G A +21 chr21_17544780_C_T 0 17544780 T C +21 chr21_17544865_A_G 0 17544865 G A +21 chr21_17544962_CCT_C 0 17544962 C CCT +21 chr21_17545007_C_T 0 17545007 T C +21 chr21_17545391_T_A 0 17545391 A T +21 chr21_17545666_G_A 0 17545666 A G +21 chr21_17545937_A_G 0 17545937 G A +21 chr21_17546068_C_T 0 17546068 T C +21 chr21_17546736_C_G 0 17546736 G C +21 chr21_17546737_T_G 0 17546737 G T +21 chr21_17546936_A_G 0 17546936 G A +21 chr21_17547434_G_A 0 17547434 A G +21 chr21_17547937_C_G 0 17547937 G C +21 chr21_17548085_A_C 0 17548085 C A +21 chr21_17548112_A_G 0 17548112 G A +21 chr21_17548319_T_C 0 17548319 C T +21 chr21_17548368_C_G 0 17548368 G C +21 chr21_17549420_C_A 0 17549420 A C +21 chr21_17549503_G_T 0 17549503 T G +21 chr21_17549944_C_T 0 17549944 T C +21 chr21_17550109_C_G 0 17550109 G C +21 chr21_17550454_C_T 0 17550454 T C +21 chr21_17550613_A_G 0 17550613 G A +21 chr21_17551097_T_TA 0 17551097 TA T +21 chr21_17551331_T_C 0 17551331 C T +21 chr21_17551392_CAAAAA_C 0 17551392 C CAAAAA +21 chr21_17551547_A_G 0 17551547 G A +21 chr21_17551702_T_G 0 17551702 G T +21 chr21_17551871_A_G 0 17551871 G A +21 chr21_17552019_T_C 0 17552019 C T +21 chr21_17552481_T_G 0 17552481 T G +21 chr21_17552573_T_TTA 0 17552573 TTA T +21 chr21_17552741_G_A 0 17552741 A G +21 chr21_17552956_T_A 0 17552956 A T +21 chr21_17553007_C_T 0 17553007 T C +21 chr21_17553033_T_C 0 17553033 C T +21 chr21_17553036_C_T 0 17553036 T C +21 chr21_17553048_A_G 0 17553048 G A +21 chr21_17553054_C_T 0 17553054 T C +21 chr21_17553066_GCA_G 0 17553066 G GCA +21 chr21_17553071_C_CCT 0 17553071 CCT C +21 chr21_17553072_A_G 0 17553072 G A +21 chr21_17553081_C_A 0 17553081 A C +21 chr21_17553184_G_A 0 17553184 G A +21 chr21_17553223_G_A 0 17553223 A G +21 chr21_17553605_G_C 0 17553605 C G +21 chr21_17554263_T_C 0 17554263 C T +21 chr21_17554291_AG_A 0 17554291 A AG +21 chr21_17554488_G_C 0 17554488 C G +21 chr21_17554491_G_C 0 17554491 C G +21 chr21_17554492_G_C 0 17554492 C G +21 chr21_17554543_C_T 0 17554543 T C +21 chr21_17554567_A_G 0 17554567 G A +21 chr21_17554616_T_C 0 17554616 C T +21 chr21_17555515_C_T 0 17555515 T C +21 chr21_17555598_A_G 0 17555598 G A +21 chr21_17555632_TCTC_T 0 17555632 T TCTC +21 chr21_17555658_A_G 0 17555658 G A +21 chr21_17555970_C_T 0 17555970 T C +21 chr21_17556326_A_G 0 17556326 G A +21 chr21_17556414_T_A 0 17556414 A T +21 chr21_17556432_G_A 0 17556432 G A +21 chr21_17556468_GA_G 0 17556468 G GA +21 chr21_17556741_T_A 0 17556741 A T +21 chr21_17556778_A_T 0 17556778 A T +21 chr21_17556841_A_G 0 17556841 A G +21 chr21_17557016_G_A 0 17557016 A G +21 chr21_17557426_C_A 0 17557426 A C +21 chr21_17557522_G_A 0 17557522 A G +21 chr21_17557671_G_A 0 17557671 A G +21 chr21_17557752_GAA_G 0 17557752 G GAA +21 chr21_17557911_G_A 0 17557911 A G +21 chr21_17558115_A_G 0 17558115 G A +21 chr21_17558685_ATT_A 0 17558685 A ATT +21 chr21_17558747_T_G 0 17558747 G T +21 chr21_17559176_C_T 0 17559176 T C +21 chr21_17559641_T_A 0 17559641 A T +21 chr21_17559865_C_G 0 17559865 C G +21 chr21_17560034_G_A 0 17560034 A G +21 chr21_17560291_A_C 0 17560291 C A +21 chr21_17560332_G_T 0 17560332 T G +21 chr21_17560437_G_C 0 17560437 G C +21 chr21_17560616_T_A 0 17560616 A T +21 chr21_17560678_G_C 0 17560678 C G +21 chr21_17560918_G_T 0 17560918 T G +21 chr21_17561510_A_G 0 17561510 G A +21 chr21_17561586_A_G 0 17561586 G A +21 chr21_17561678_C_G 0 17561678 G C +21 chr21_17561761_G_A 0 17561761 A G +21 chr21_17562194_CAGTG_C 0 17562194 C CAGTG +21 chr21_17562221_G_A 0 17562221 A G +21 chr21_17562230_G_T 0 17562230 T G +21 chr21_17562335_TC_T 0 17562335 T TC +21 chr21_17562965_C_T 0 17562965 T C +21 chr21_17563079_C_T 0 17563079 T C +21 chr21_17563155_GTTAA_G 0 17563155 G GTTAA +21 chr21_17563260_G_C 0 17563260 G C +21 chr21_17563353_G_C 0 17563353 C G +21 chr21_17563664_G_A 0 17563664 A G +21 chr21_17563757_C_T 0 17563757 T C +21 chr21_17563801_T_C 0 17563801 T C +21 chr21_17563829_C_T 0 17563829 T C +21 chr21_17564141_T_A 0 17564141 A T +21 chr21_17564224_G_A 0 17564224 A G +21 chr21_17564536_A_G 0 17564536 A G +21 chr21_17564596_G_C 0 17564596 C G +21 chr21_17564957_A_G 0 17564957 G A +21 chr21_17564994_C_G 0 17564994 G C +21 chr21_17565239_A_G 0 17565239 G A +21 chr21_17565440_A_G 0 17565440 G A +21 chr21_17565725_T_C 0 17565725 C T +21 chr21_17565762_G_T 0 17565762 T G +21 chr21_17565800_ATAAGT_A 0 17565800 A ATAAGT +21 chr21_17565942_T_G 0 17565942 T G +21 chr21_17566167_C_T 0 17566167 T C +21 chr21_17566359_T_C 0 17566359 C T +21 chr21_17566449_G_A 0 17566449 A G +21 chr21_17567111_T_C 0 17567111 C T +21 chr21_17567128_C_T 0 17567128 T C +21 chr21_17567657_G_A 0 17567657 A G +21 chr21_17568012_T_C 0 17568012 C T +21 chr21_17568161_G_C 0 17568161 G C +21 chr21_17568206_G_T 0 17568206 T G +21 chr21_17568330_G_A 0 17568330 G A +21 chr21_17568406_G_A 0 17568406 A G +21 chr21_17568498_CTT_C 0 17568498 CTT C +21 chr21_17568582_A_G 0 17568582 A G +21 chr21_17568605_G_C 0 17568605 C G +21 chr21_17568743_G_C 0 17568743 C G +21 chr21_17568769_G_A 0 17568769 G A +21 chr21_17568797_C_G 0 17568797 G C +21 chr21_17568945_A_G 0 17568945 G A +21 chr21_17569383_C_T 0 17569383 T C +21 chr21_17569657_G_C 0 17569657 G C +21 chr21_17569787_T_C 0 17569787 C T +21 chr21_17569931_G_A 0 17569931 A G +21 chr21_17570136_A_T 0 17570136 T A +21 chr21_17570190_G_C 0 17570190 C G +21 chr21_17570414_G_A 0 17570414 A G +21 chr21_17570499_T_C 0 17570499 C T +21 chr21_17570510_G_C 0 17570510 C G +21 chr21_17570831_A_C 0 17570831 C A +21 chr21_17571153_C_G 0 17571153 G C +21 chr21_17571311_A_G 0 17571311 G A +21 chr21_17571318_T_C 0 17571318 C T +21 chr21_17571369_G_A 0 17571369 A G +21 chr21_17571794_T_A 0 17571794 T A +21 chr21_17571869_G_A 0 17571869 A G +21 chr21_17572000_G_A 0 17572000 G A +21 chr21_17572184_A_C 0 17572184 C A +21 chr21_17572242_A_G 0 17572242 G A +21 chr21_17572383_A_G 0 17572383 A G +21 chr21_17572543_A_G 0 17572543 A G +21 chr21_17572554_CCTT_C 0 17572554 C CCTT +21 chr21_17572563_G_A 0 17572563 A G +21 chr21_17572571_G_A 0 17572571 A G +21 chr21_17572576_A_G 0 17572576 G A +21 chr21_17572717_T_C 0 17572717 C T +21 chr21_17572852_G_A 0 17572852 A G +21 chr21_17573059_A_G 0 17573059 A G +21 chr21_17573157_C_A 0 17573157 A C +21 chr21_17573190_C_CG 0 17573190 CG C +21 chr21_17573533_A_G 0 17573533 A G +21 chr21_17573592_C_T 0 17573592 C T +21 chr21_17573619_G_A 0 17573619 A G +21 chr21_17573759_A_T 0 17573759 T A +21 chr21_17573916_ATTC_A 0 17573916 A ATTC +21 chr21_17573921_T_G 0 17573921 G T +21 chr21_17573923_A_T 0 17573923 T A +21 chr21_17574064_G_C 0 17574064 G C +21 chr21_17574310_T_A 0 17574310 T A +21 chr21_17574383_AT_A 0 17574383 AT A +21 chr21_17574409_A_T 0 17574409 T A +21 chr21_17574719_G_C 0 17574719 C G +21 chr21_17574752_A_G 0 17574752 A G +21 chr21_17575127_C_CTCATTCTA 0 17575127 C CTCATTCTA +21 chr21_17575256_C_G 0 17575256 G C +21 chr21_17575514_G_A 0 17575514 A G +21 chr21_17575543_T_G 0 17575543 T G +21 chr21_17575643_A_G 0 17575643 G A +21 chr21_17575667_A_G 0 17575667 A G +21 chr21_17575695_G_A 0 17575695 A G +21 chr21_17575714_T_C 0 17575714 T C +21 chr21_17575787_T_G 0 17575787 G T +21 chr21_17575947_G_A 0 17575947 A G +21 chr21_17576576_C_T 0 17576576 T C +21 chr21_17576915_C_CA 0 17576915 CA C +21 chr21_17577143_C_A 0 17577143 A C +21 chr21_17578144_A_G 0 17578144 G A +21 chr21_17578173_A_G 0 17578173 G A +21 chr21_17578198_A_G 0 17578198 G A +21 chr21_17578245_T_G 0 17578245 G T +21 chr21_17578336_G_A 0 17578336 A G +21 chr21_17578690_A_G 0 17578690 A G +21 chr21_17578700_G_A 0 17578700 A G +21 chr21_17578815_C_A 0 17578815 A C +21 chr21_17578893_A_G 0 17578893 G A +21 chr21_17578994_T_C 0 17578994 C T +21 chr21_17579244_G_A 0 17579244 A G +21 chr21_17579344_G_T 0 17579344 T G +21 chr21_17579604_T_C 0 17579604 T C +21 chr21_17580257_G_A 0 17580257 A G +21 chr21_17580756_A_G 0 17580756 G A +21 chr21_17580802_G_A 0 17580802 A G +21 chr21_17580832_C_T 0 17580832 T C +21 chr21_17581092_T_C 0 17581092 C T +21 chr21_17581880_C_T 0 17581880 T C +21 chr21_17581976_C_T 0 17581976 T C +21 chr21_17582085_A_G 0 17582085 G A +21 chr21_17582606_C_T 0 17582606 T C +21 chr21_17582730_T_C 0 17582730 C T +21 chr21_17583168_A_G 0 17583168 G A +21 chr21_17583287_A_G 0 17583287 G A +21 chr21_17583375_C_T 0 17583375 T C +21 chr21_17584190_C_T 0 17584190 T C +21 chr21_17584262_G_C 0 17584262 C G +21 chr21_17584440_A_T 0 17584440 T A +21 chr21_17584502_A_G 0 17584502 G A +21 chr21_17584577_G_A 0 17584577 A G +21 chr21_17584717_G_C 0 17584717 C G +21 chr21_17585152_G_T 0 17585152 T G +21 chr21_17585313_A_G 0 17585313 G A +21 chr21_17585496_C_T 0 17585496 T C +21 chr21_17585621_G_A 0 17585621 A G +21 chr21_17586078_T_G 0 17586078 G T +21 chr21_17586363_G_A 0 17586363 G A +21 chr21_17586771_G_A 0 17586771 G A +21 chr21_17586862_G_A 0 17586862 A G +21 chr21_17587003_C_T 0 17587003 T C +21 chr21_17587397_C_T 0 17587397 T C +21 chr21_17588743_G_A 0 17588743 A G +21 chr21_17589032_TAATA_T 0 17589032 T TAATA +21 chr21_17591636_A_G 0 17591636 G A +21 chr21_17591962_C_T 0 17591962 T C +21 chr21_17592874_G_GACTTT 0 17592874 G GACTTT diff --git a/tests/testthat/test_data/test_variants.fam b/tests/testthat/test_data/test_variants.fam new file mode 100644 index 000000000..fcc168c80 --- /dev/null +++ b/tests/testthat/test_data/test_variants.fam @@ -0,0 +1,100 @@ +HG02461 HG02461 0 0 0 -9 +HG02462 HG02462 0 0 0 -9 +HG02464 HG02464 0 0 0 -9 +HG02465 HG02465 0 0 0 -9 +HG02561 HG02561 0 0 0 -9 +HG02562 HG02562 0 0 0 -9 +HG02568 HG02568 0 0 0 -9 +HG02570 HG02570 0 0 0 -9 +HG02571 HG02571 0 0 0 -9 +HG02573 HG02573 0 0 0 -9 +HG02574 HG02574 0 0 0 -9 +HG02582 HG02582 0 0 0 -9 +HG02583 HG02583 0 0 0 -9 +HG02585 HG02585 0 0 0 -9 +HG02586 HG02586 0 0 0 -9 +HG02588 HG02588 0 0 0 -9 +HG02589 HG02589 0 0 0 -9 +HG02594 HG02594 0 0 0 -9 +HG02595 HG02595 0 0 0 -9 +HG02610 HG02610 0 0 0 -9 +HG02611 HG02611 0 0 0 -9 +HG02613 HG02613 0 0 0 -9 +HG02614 HG02614 0 0 0 -9 +HG02620 HG02620 0 0 0 -9 +HG02621 HG02621 0 0 0 -9 +HG02623 HG02623 0 0 0 -9 +HG02624 HG02624 0 0 0 -9 +HG02628 HG02628 0 0 0 -9 +HG02629 HG02629 0 0 0 -9 +HG02634 HG02634 0 0 0 -9 +HG02635 HG02635 0 0 0 -9 +HG02642 HG02642 0 0 0 -9 +HG02643 HG02643 0 0 0 -9 +HG02645 HG02645 0 0 0 -9 +HG02646 HG02646 0 0 0 -9 +HG02666 HG02666 0 0 0 -9 +HG02667 HG02667 0 0 0 -9 +HG02675 HG02675 0 0 0 -9 +HG02676 HG02676 0 0 0 -9 +HG02678 HG02678 0 0 0 -9 +HG02679 HG02679 0 0 0 -9 +HG02702 HG02702 0 0 0 -9 +HG02703 HG02703 0 0 0 -9 +HG02715 HG02715 0 0 0 -9 +HG02716 HG02716 0 0 0 -9 +HG02721 HG02721 0 0 0 -9 +HG02722 HG02722 0 0 0 -9 +HG02757 HG02757 0 0 0 -9 +HG02759 HG02759 0 0 0 -9 +HG02760 HG02760 0 0 0 -9 +HG02763 HG02763 0 0 0 -9 +HG02768 HG02768 0 0 0 -9 +HG02769 HG02769 0 0 0 -9 +HG02771 HG02771 0 0 0 -9 +HG02772 HG02772 0 0 0 -9 +HG02798 HG02798 0 0 0 -9 +HG02799 HG02799 0 0 0 -9 +HG02804 HG02804 0 0 0 -9 +HG02805 HG02805 0 0 0 -9 +HG02807 HG02807 0 0 0 -9 +HG02808 HG02808 0 0 0 -9 +HG02810 HG02810 0 0 0 -9 +HG02811 HG02811 0 0 0 -9 +HG02813 HG02813 0 0 0 -9 +HG02814 HG02814 0 0 0 -9 +HG02816 HG02816 0 0 0 -9 +HG02817 HG02817 0 0 0 -9 +HG02819 HG02819 0 0 0 -9 +HG02820 HG02820 0 0 0 -9 +HG02836 HG02836 0 0 0 -9 +HG02837 HG02837 0 0 0 -9 +HG02839 HG02839 0 0 0 -9 +HG02840 HG02840 0 0 0 -9 +HG02851 HG02851 0 0 0 -9 +HG02852 HG02852 0 0 0 -9 +HG02854 HG02854 0 0 0 -9 +HG02855 HG02855 0 0 0 -9 +HG02860 HG02860 0 0 0 -9 +HG02861 HG02861 0 0 0 -9 +HG02870 HG02870 0 0 0 -9 +HG02878 HG02878 0 0 0 -9 +HG02879 HG02879 0 0 0 -9 +HG02881 HG02881 0 0 0 -9 +HG02882 HG02882 0 0 0 -9 +HG02884 HG02884 0 0 0 -9 +HG02885 HG02885 0 0 0 -9 +HG02887 HG02887 0 0 0 -9 +HG02888 HG02888 0 0 0 -9 +HG02890 HG02890 0 0 0 -9 +HG02891 HG02891 0 0 0 -9 +HG02895 HG02895 0 0 0 -9 +HG02896 HG02896 0 0 0 -9 +HG02922 HG02922 0 0 0 -9 +HG02923 HG02923 0 0 0 -9 +HG02938 HG02938 0 0 0 -9 +HG02941 HG02941 0 0 0 -9 +HG02943 HG02943 0 0 0 -9 +HG02944 HG02944 0 0 0 -9 +HG02946 HG02946 0 0 0 -9 +HG02947 HG02947 0 0 0 -9 diff --git a/tests/testthat/test_data/test_variants.gds b/tests/testthat/test_data/test_variants.gds new file mode 100644 index 000000000..612ed21ca Binary files /dev/null and b/tests/testthat/test_data/test_variants.gds differ diff --git a/tests/testthat/test_data/test_variants.pgen b/tests/testthat/test_data/test_variants.pgen new file mode 100644 index 000000000..c50569041 Binary files /dev/null and b/tests/testthat/test_data/test_variants.pgen differ diff --git a/tests/testthat/test_data/test_variants.psam b/tests/testthat/test_data/test_variants.psam new file mode 100644 index 000000000..632f941a7 --- /dev/null +++ b/tests/testthat/test_data/test_variants.psam @@ -0,0 +1,101 @@ +#FID IID SEX +HG02461 HG02461 NA +HG02462 HG02462 NA +HG02464 HG02464 NA +HG02465 HG02465 NA +HG02561 HG02561 NA +HG02562 HG02562 NA +HG02568 HG02568 NA +HG02570 HG02570 NA +HG02571 HG02571 NA +HG02573 HG02573 NA +HG02574 HG02574 NA +HG02582 HG02582 NA +HG02583 HG02583 NA +HG02585 HG02585 NA +HG02586 HG02586 NA +HG02588 HG02588 NA +HG02589 HG02589 NA +HG02594 HG02594 NA +HG02595 HG02595 NA +HG02610 HG02610 NA +HG02611 HG02611 NA +HG02613 HG02613 NA +HG02614 HG02614 NA +HG02620 HG02620 NA +HG02621 HG02621 NA +HG02623 HG02623 NA +HG02624 HG02624 NA +HG02628 HG02628 NA +HG02629 HG02629 NA +HG02634 HG02634 NA +HG02635 HG02635 NA +HG02642 HG02642 NA +HG02643 HG02643 NA +HG02645 HG02645 NA +HG02646 HG02646 NA +HG02666 HG02666 NA +HG02667 HG02667 NA +HG02675 HG02675 NA +HG02676 HG02676 NA +HG02678 HG02678 NA +HG02679 HG02679 NA +HG02702 HG02702 NA +HG02703 HG02703 NA +HG02715 HG02715 NA +HG02716 HG02716 NA +HG02721 HG02721 NA +HG02722 HG02722 NA +HG02757 HG02757 NA +HG02759 HG02759 NA +HG02760 HG02760 NA +HG02763 HG02763 NA +HG02768 HG02768 NA +HG02769 HG02769 NA +HG02771 HG02771 NA +HG02772 HG02772 NA +HG02798 HG02798 NA +HG02799 HG02799 NA +HG02804 HG02804 NA +HG02805 HG02805 NA +HG02807 HG02807 NA +HG02808 HG02808 NA +HG02810 HG02810 NA +HG02811 HG02811 NA +HG02813 HG02813 NA +HG02814 HG02814 NA +HG02816 HG02816 NA +HG02817 HG02817 NA +HG02819 HG02819 NA +HG02820 HG02820 NA +HG02836 HG02836 NA +HG02837 HG02837 NA +HG02839 HG02839 NA +HG02840 HG02840 NA +HG02851 HG02851 NA +HG02852 HG02852 NA +HG02854 HG02854 NA +HG02855 HG02855 NA +HG02860 HG02860 NA +HG02861 HG02861 NA +HG02870 HG02870 NA +HG02878 HG02878 NA +HG02879 HG02879 NA +HG02881 HG02881 NA +HG02882 HG02882 NA +HG02884 HG02884 NA +HG02885 HG02885 NA +HG02887 HG02887 NA +HG02888 HG02888 NA +HG02890 HG02890 NA +HG02891 HG02891 NA +HG02895 HG02895 NA +HG02896 HG02896 NA +HG02922 HG02922 NA +HG02923 HG02923 NA +HG02938 HG02938 NA +HG02941 HG02941 NA +HG02943 HG02943 NA +HG02944 HG02944 NA +HG02946 HG02946 NA +HG02947 HG02947 NA diff --git a/tests/testthat/test_data/test_variants.pvar b/tests/testthat/test_data/test_variants.pvar new file mode 100644 index 000000000..e4f1f0407 --- /dev/null +++ b/tests/testthat/test_data/test_variants.pvar @@ -0,0 +1,350 @@ +#CHROM POS ID REF ALT +21 17513228 chr21_17513228_C_G C G +21 17513580 chr21_17513580_C_T C T +21 17513624 chr21_17513624_T_C T C +21 17514447 chr21_17514447_G_A G A +21 17514685 chr21_17514685_G_A G A +21 17514813 chr21_17514813_T_C T C +21 17514883 chr21_17514883_C_G C G +21 17514886 chr21_17514886_A_T A T +21 17515165 chr21_17515165_C_T C T +21 17515283 chr21_17515283_A_G A G +21 17515360 chr21_17515360_T_A A T +21 17515408 chr21_17515408_G_A G A +21 17515432 chr21_17515432_A_T A T +21 17515602 chr21_17515602_G_A G A +21 17515636 chr21_17515636_C_A C A +21 17515808 chr21_17515808_A_C A C +21 17516162 chr21_17516162_C_G C G +21 17516223 chr21_17516223_G_A G A +21 17516546 chr21_17516546_T_C T C +21 17516815 chr21_17516815_AGT_A AGT A +21 17516952 chr21_17516952_GA_G GA G +21 17517680 chr21_17517680_A_C A C +21 17517683 chr21_17517683_T_TTGAAGA T TTGAAGA +21 17517734 chr21_17517734_A_G A G +21 17518122 chr21_17518122_G_A G A +21 17518266 chr21_17518266_C_A A C +21 17519634 chr21_17519634_C_T C T +21 17519707 chr21_17519707_T_C T C +21 17519734 chr21_17519734_G_C G C +21 17520407 chr21_17520407_T_C T C +21 17520648 chr21_17520648_G_A G A +21 17520779 chr21_17520779_T_C T C +21 17521022 chr21_17521022_T_G T G +21 17521131 chr21_17521131_A_G A G +21 17521375 chr21_17521375_T_A T A +21 17521464 chr21_17521464_A_G A G +21 17521559 chr21_17521559_GTGA_G GTGA G +21 17522133 chr21_17522133_G_C C G +21 17522315 chr21_17522315_AT_A AT A +21 17522348 chr21_17522348_A_G G A +21 17522480 chr21_17522480_A_G A G +21 17522958 chr21_17522958_A_G A G +21 17523579 chr21_17523579_G_A G A +21 17523652 chr21_17523652_T_A T A +21 17523753 chr21_17523753_G_A G A +21 17523894 chr21_17523894_T_C T C +21 17523928 chr21_17523928_G_A G A +21 17524195 chr21_17524195_A_T A T +21 17524490 chr21_17524490_C_T C T +21 17525474 chr21_17525474_C_T C T +21 17525608 chr21_17525608_T_A A T +21 17526014 chr21_17526014_T_C T C +21 17526279 chr21_17526279_T_C T C +21 17526364 chr21_17526364_A_T A T +21 17526577 chr21_17526577_G_T G T +21 17526911 chr21_17526911_A_C A C +21 17527800 chr21_17527800_T_TTTTA T TTTTA +21 17527957 chr21_17527957_A_G A G +21 17528363 chr21_17528363_C_T C T +21 17529100 chr21_17529100_G_A G A +21 17529502 chr21_17529502_A_G A G +21 17529651 chr21_17529651_G_A A G +21 17529955 chr21_17529955_T_C T C +21 17530220 chr21_17530220_C_T C T +21 17530224 chr21_17530224_C_G C G +21 17530294 chr21_17530294_AT_A AT A +21 17530453 chr21_17530453_G_C G C +21 17530755 chr21_17530755_G_A G A +21 17530762 chr21_17530762_C_T C T +21 17530820 chr21_17530820_A_C A C +21 17531415 chr21_17531415_A_G A G +21 17531536 chr21_17531536_A_G G A +21 17531721 chr21_17531721_A_G A G +21 17531779 chr21_17531779_CTT_C CTT C +21 17532183 chr21_17532183_C_T T C +21 17532261 chr21_17532261_G_C G C +21 17532402 chr21_17532402_ACTGT_A ACTGT A +21 17532474 chr21_17532474_C_T C T +21 17533041 chr21_17533041_G_A G A +21 17533080 chr21_17533080_T_A T A +21 17533581 chr21_17533581_G_A G A +21 17533587 chr21_17533587_A_G A G +21 17533873 chr21_17533873_G_T G T +21 17534211 chr21_17534211_G_A G A +21 17534215 chr21_17534215_C_T C T +21 17534571 chr21_17534571_G_T G T +21 17534583 chr21_17534583_G_C G C +21 17535659 chr21_17535659_A_C A C +21 17536186 chr21_17536186_A_C C A +21 17536232 chr21_17536232_A_G A G +21 17536260 chr21_17536260_T_C T C +21 17536503 chr21_17536503_C_A A C +21 17536949 chr21_17536949_G_A G A +21 17536995 chr21_17536995_T_A T A +21 17537118 chr21_17537118_A_G A G +21 17537728 chr21_17537728_A_G G A +21 17538189 chr21_17538189_T_C C T +21 17539918 chr21_17539918_G_GT G GT +21 17540894 chr21_17540894_C_T C T +21 17541380 chr21_17541380_G_A G A +21 17541396 chr21_17541396_C_CA C CA +21 17541499 chr21_17541499_A_G A G +21 17541596 chr21_17541596_C_A C A +21 17541774 chr21_17541774_G_C G C +21 17542024 chr21_17542024_ACT_A ACT A +21 17542052 chr21_17542052_T_A T A +21 17542068 chr21_17542068_A_G A G +21 17542147 chr21_17542147_A_G A G +21 17542741 chr21_17542741_A_G A G +21 17543019 chr21_17543019_T_C T C +21 17543312 chr21_17543312_C_T C T +21 17543494 chr21_17543494_C_T C T +21 17543820 chr21_17543820_G_A G A +21 17544714 chr21_17544714_A_G A G +21 17544780 chr21_17544780_C_T C T +21 17544865 chr21_17544865_A_G A G +21 17544962 chr21_17544962_CCT_C CCT C +21 17545007 chr21_17545007_C_T C T +21 17545391 chr21_17545391_T_A T A +21 17545666 chr21_17545666_G_A G A +21 17545937 chr21_17545937_A_G A G +21 17546068 chr21_17546068_C_T C T +21 17546736 chr21_17546736_C_G C G +21 17546737 chr21_17546737_T_G T G +21 17546936 chr21_17546936_A_G A G +21 17547434 chr21_17547434_G_A G A +21 17547937 chr21_17547937_C_G C G +21 17548085 chr21_17548085_A_C A C +21 17548112 chr21_17548112_A_G A G +21 17548319 chr21_17548319_T_C T C +21 17548368 chr21_17548368_C_G C G +21 17549420 chr21_17549420_C_A C A +21 17549503 chr21_17549503_G_T G T +21 17549944 chr21_17549944_C_T C T +21 17550109 chr21_17550109_C_G C G +21 17550454 chr21_17550454_C_T C T +21 17550613 chr21_17550613_A_G A G +21 17551097 chr21_17551097_T_TA T TA +21 17551331 chr21_17551331_T_C T C +21 17551392 chr21_17551392_CAAAAA_C CAAAAA C +21 17551547 chr21_17551547_A_G A G +21 17551702 chr21_17551702_T_G T G +21 17551871 chr21_17551871_A_G A G +21 17552019 chr21_17552019_T_C T C +21 17552481 chr21_17552481_T_G G T +21 17552573 chr21_17552573_T_TTA T TTA +21 17552741 chr21_17552741_G_A G A +21 17552956 chr21_17552956_T_A T A +21 17553007 chr21_17553007_C_T C T +21 17553033 chr21_17553033_T_C T C +21 17553036 chr21_17553036_C_T C T +21 17553048 chr21_17553048_A_G A G +21 17553054 chr21_17553054_C_T C T +21 17553066 chr21_17553066_GCA_G GCA G +21 17553071 chr21_17553071_C_CCT C CCT +21 17553072 chr21_17553072_A_G A G +21 17553081 chr21_17553081_C_A C A +21 17553184 chr21_17553184_G_A A G +21 17553223 chr21_17553223_G_A G A +21 17553605 chr21_17553605_G_C G C +21 17554263 chr21_17554263_T_C T C +21 17554291 chr21_17554291_AG_A AG A +21 17554488 chr21_17554488_G_C G C +21 17554491 chr21_17554491_G_C G C +21 17554492 chr21_17554492_G_C G C +21 17554543 chr21_17554543_C_T C T +21 17554567 chr21_17554567_A_G A G +21 17554616 chr21_17554616_T_C T C +21 17555515 chr21_17555515_C_T C T +21 17555598 chr21_17555598_A_G A G +21 17555632 chr21_17555632_TCTC_T TCTC T +21 17555658 chr21_17555658_A_G A G +21 17555970 chr21_17555970_C_T C T +21 17556326 chr21_17556326_A_G A G +21 17556414 chr21_17556414_T_A T A +21 17556432 chr21_17556432_G_A A G +21 17556468 chr21_17556468_GA_G GA G +21 17556741 chr21_17556741_T_A T A +21 17556778 chr21_17556778_A_T T A +21 17556841 chr21_17556841_A_G G A +21 17557016 chr21_17557016_G_A G A +21 17557426 chr21_17557426_C_A C A +21 17557522 chr21_17557522_G_A G A +21 17557671 chr21_17557671_G_A G A +21 17557752 chr21_17557752_GAA_G GAA G +21 17557911 chr21_17557911_G_A G A +21 17558115 chr21_17558115_A_G A G +21 17558685 chr21_17558685_ATT_A ATT A +21 17558747 chr21_17558747_T_G T G +21 17559176 chr21_17559176_C_T C T +21 17559641 chr21_17559641_T_A T A +21 17559865 chr21_17559865_C_G G C +21 17560034 chr21_17560034_G_A G A +21 17560291 chr21_17560291_A_C A C +21 17560332 chr21_17560332_G_T G T +21 17560437 chr21_17560437_G_C C G +21 17560616 chr21_17560616_T_A T A +21 17560678 chr21_17560678_G_C G C +21 17560918 chr21_17560918_G_T G T +21 17561510 chr21_17561510_A_G A G +21 17561586 chr21_17561586_A_G A G +21 17561678 chr21_17561678_C_G C G +21 17561761 chr21_17561761_G_A G A +21 17562194 chr21_17562194_CAGTG_C CAGTG C +21 17562221 chr21_17562221_G_A G A +21 17562230 chr21_17562230_G_T G T +21 17562335 chr21_17562335_TC_T TC T +21 17562965 chr21_17562965_C_T C T +21 17563079 chr21_17563079_C_T C T +21 17563155 chr21_17563155_GTTAA_G GTTAA G +21 17563260 chr21_17563260_G_C C G +21 17563353 chr21_17563353_G_C G C +21 17563664 chr21_17563664_G_A G A +21 17563757 chr21_17563757_C_T C T +21 17563801 chr21_17563801_T_C C T +21 17563829 chr21_17563829_C_T C T +21 17564141 chr21_17564141_T_A T A +21 17564224 chr21_17564224_G_A G A +21 17564536 chr21_17564536_A_G G A +21 17564596 chr21_17564596_G_C G C +21 17564957 chr21_17564957_A_G A G +21 17564994 chr21_17564994_C_G C G +21 17565239 chr21_17565239_A_G A G +21 17565440 chr21_17565440_A_G A G +21 17565725 chr21_17565725_T_C T C +21 17565762 chr21_17565762_G_T G T +21 17565800 chr21_17565800_ATAAGT_A ATAAGT A +21 17565942 chr21_17565942_T_G G T +21 17566167 chr21_17566167_C_T C T +21 17566359 chr21_17566359_T_C T C +21 17566449 chr21_17566449_G_A G A +21 17567111 chr21_17567111_T_C T C +21 17567128 chr21_17567128_C_T C T +21 17567657 chr21_17567657_G_A G A +21 17568012 chr21_17568012_T_C T C +21 17568161 chr21_17568161_G_C C G +21 17568206 chr21_17568206_G_T G T +21 17568330 chr21_17568330_G_A A G +21 17568406 chr21_17568406_G_A G A +21 17568498 chr21_17568498_CTT_C C CTT +21 17568582 chr21_17568582_A_G G A +21 17568605 chr21_17568605_G_C G C +21 17568743 chr21_17568743_G_C G C +21 17568769 chr21_17568769_G_A A G +21 17568797 chr21_17568797_C_G C G +21 17568945 chr21_17568945_A_G A G +21 17569383 chr21_17569383_C_T C T +21 17569657 chr21_17569657_G_C C G +21 17569787 chr21_17569787_T_C T C +21 17569931 chr21_17569931_G_A G A +21 17570136 chr21_17570136_A_T A T +21 17570190 chr21_17570190_G_C G C +21 17570414 chr21_17570414_G_A G A +21 17570499 chr21_17570499_T_C T C +21 17570510 chr21_17570510_G_C G C +21 17570831 chr21_17570831_A_C A C +21 17571153 chr21_17571153_C_G C G +21 17571311 chr21_17571311_A_G A G +21 17571318 chr21_17571318_T_C T C +21 17571369 chr21_17571369_G_A G A +21 17571794 chr21_17571794_T_A A T +21 17571869 chr21_17571869_G_A G A +21 17572000 chr21_17572000_G_A A G +21 17572184 chr21_17572184_A_C A C +21 17572242 chr21_17572242_A_G A G +21 17572383 chr21_17572383_A_G G A +21 17572543 chr21_17572543_A_G G A +21 17572554 chr21_17572554_CCTT_C CCTT C +21 17572563 chr21_17572563_G_A G A +21 17572571 chr21_17572571_G_A G A +21 17572576 chr21_17572576_A_G A G +21 17572717 chr21_17572717_T_C T C +21 17572852 chr21_17572852_G_A G A +21 17573059 chr21_17573059_A_G G A +21 17573157 chr21_17573157_C_A C A +21 17573190 chr21_17573190_C_CG C CG +21 17573533 chr21_17573533_A_G G A +21 17573592 chr21_17573592_C_T T C +21 17573619 chr21_17573619_G_A G A +21 17573759 chr21_17573759_A_T A T +21 17573916 chr21_17573916_ATTC_A ATTC A +21 17573921 chr21_17573921_T_G T G +21 17573923 chr21_17573923_A_T A T +21 17574064 chr21_17574064_G_C C G +21 17574310 chr21_17574310_T_A A T +21 17574383 chr21_17574383_AT_A A AT +21 17574409 chr21_17574409_A_T A T +21 17574719 chr21_17574719_G_C G C +21 17574752 chr21_17574752_A_G G A +21 17575127 chr21_17575127_C_CTCATTCTA CTCATTCTA C +21 17575256 chr21_17575256_C_G C G +21 17575514 chr21_17575514_G_A G A +21 17575543 chr21_17575543_T_G G T +21 17575643 chr21_17575643_A_G A G +21 17575667 chr21_17575667_A_G G A +21 17575695 chr21_17575695_G_A G A +21 17575714 chr21_17575714_T_C C T +21 17575787 chr21_17575787_T_G T G +21 17575947 chr21_17575947_G_A G A +21 17576576 chr21_17576576_C_T C T +21 17576915 chr21_17576915_C_CA C CA +21 17577143 chr21_17577143_C_A C A +21 17578144 chr21_17578144_A_G A G +21 17578173 chr21_17578173_A_G A G +21 17578198 chr21_17578198_A_G A G +21 17578245 chr21_17578245_T_G T G +21 17578336 chr21_17578336_G_A G A +21 17578690 chr21_17578690_A_G G A +21 17578700 chr21_17578700_G_A G A +21 17578815 chr21_17578815_C_A C A +21 17578893 chr21_17578893_A_G A G +21 17578994 chr21_17578994_T_C T C +21 17579244 chr21_17579244_G_A G A +21 17579344 chr21_17579344_G_T G T +21 17579604 chr21_17579604_T_C C T +21 17580257 chr21_17580257_G_A G A +21 17580756 chr21_17580756_A_G A G +21 17580802 chr21_17580802_G_A G A +21 17580832 chr21_17580832_C_T C T +21 17581092 chr21_17581092_T_C T C +21 17581880 chr21_17581880_C_T C T +21 17581976 chr21_17581976_C_T C T +21 17582085 chr21_17582085_A_G A G +21 17582606 chr21_17582606_C_T C T +21 17582730 chr21_17582730_T_C T C +21 17583168 chr21_17583168_A_G A G +21 17583287 chr21_17583287_A_G A G +21 17583375 chr21_17583375_C_T C T +21 17584190 chr21_17584190_C_T C T +21 17584262 chr21_17584262_G_C G C +21 17584440 chr21_17584440_A_T A T +21 17584502 chr21_17584502_A_G A G +21 17584577 chr21_17584577_G_A G A +21 17584717 chr21_17584717_G_C G C +21 17585152 chr21_17585152_G_T G T +21 17585313 chr21_17585313_A_G A G +21 17585496 chr21_17585496_C_T C T +21 17585621 chr21_17585621_G_A G A +21 17586078 chr21_17586078_T_G T G +21 17586363 chr21_17586363_G_A A G +21 17586771 chr21_17586771_G_A A G +21 17586862 chr21_17586862_G_A G A +21 17587003 chr21_17587003_C_T C T +21 17587397 chr21_17587397_C_T C T +21 17588743 chr21_17588743_G_A G A +21 17589032 chr21_17589032_TAATA_T TAATA T +21 17591636 chr21_17591636_A_G A G +21 17591962 chr21_17591962_C_T C T +21 17592874 chr21_17592874_G_GACTTT GACTTT G diff --git a/tests/testthat/test_data/test_variants.vcf.gz b/tests/testthat/test_data/test_variants.vcf.gz new file mode 100644 index 000000000..f8f90c031 Binary files /dev/null and b/tests/testthat/test_data/test_variants.vcf.gz differ diff --git a/tests/testthat/test_data/test_variants.vcf.gz.tbi b/tests/testthat/test_data/test_variants.vcf.gz.tbi new file mode 100644 index 000000000..83cc507cb Binary files /dev/null and b/tests/testthat/test_data/test_variants.vcf.gz.tbi differ diff --git a/tests/testthat/test_file_utils.R b/tests/testthat/test_file_utils.R index fc2ea0af8..c5a21654e 100644 --- a/tests/testthat/test_file_utils.R +++ b/tests/testthat/test_file_utils.R @@ -1,20 +1,13 @@ context("file_utils") library(tidyverse) -test_that("read_pvar dummy data works",{ - skip("disabled pending Bucket B resolution: read_pvar not exported / removed") - dummy_path <- gsub("//", "/", tempfile(pattern = "dummy_pvar", tmpdir = tempdir(), fileext = ".pvar")) - dummy <- data.frame("#CHROM" = c(1, 2, 3, 4, 5), - "ID" = c("rs1", "rs2", "rs3", "rs4", "rs5"), - "POS" = c(100, 200, 300, 400, 500), - "REF" = c("A", "T", "C", "G", "A"), - "ALT" = c("T", "C", "G", "A", "T")) - colnames(dummy) <- c("#CHROM", "ID", "POS", "REF", "ALT") - cat(c("#DUMMY HEADER 1", "#DUMMY HEADER 2", "#DUMMY HEADER 3"), file = dummy_path, sep = "\n") - write_delim( - dummy, dummy_path, delim = "\t", col_names = TRUE, append = TRUE) - expect_equal(colnames(read_pvar(dummy_path)), c("chrom", "id", "pos", "A2", "A1")) - file.remove(dummy_path) +test_that("read_pvar reads real pvar file", { + skip_if_not_installed("pgenlibr") + pvar_path <- file.path(test_path("test_data"), "test_variants.pvar") + res <- pecotmr:::read_pvar(pvar_path) + expect_equal(colnames(res), c("chrom", "id", "pos", "A2", "A1")) + expect_equal(nrow(res), 349L) + expect_true(all(res$chrom == "21")) }) test_that("read_bim dummy data works",{ @@ -24,35 +17,12 @@ test_that("read_bim dummy data works",{ expect_equal(nrow(res), 100) }) -test_that("read_psam dummy data works",{ - skip("disabled pending Bucket B resolution: read_psam not exported / removed") - dummy_path <- gsub("//", "/", tempfile(pattern = "dummy_psam", tmpdir = tempdir(), fileext = ".psam")) - dummy <- data.frame("#CHROM" = c(1, 2, 3, 4, 5), - "IID" = c("rs1", "rs2", "rs3", "rs4", "rs5"), - "SID" = c(100, 200, 300, 400, 500), - "PAT" = c("A", "T", "C", "G", "A"), - "MAT" = c("T", "C", "G", "A", "T"), - "SEX" = c(1, 2, 1, 2, 1)) - write_delim( - dummy, dummy_path, delim = "\t", col_names = TRUE, append = TRUE) - res <- read_psam(dummy_path) - expect_equal(colnames(res), c("FID", "IID", "SID", "PAT", "MAT", "SEX")) - file.remove(dummy_path) -}) - test_that("read_fam dummy data works",{ example_path <- "test_data/protocol_example.genotype.bed" res <- read_fam(example_path) expect_equal(nrow(res), 100) }) -test_that("open_pgen dummy data works",{ - skip("disabled pending Bucket B resolution: open_pgen not exported / removed") - example_path <- "test_data/dummy_data.pgen" - res <- open_pgen(example_path) - expect_equal(res$class, "pgen") -}) - test_that("open_bed dummy data works",{ example_path <- "test_data/protocol_example.genotype.bed" res <- open_bed(example_path) @@ -231,6 +201,148 @@ test_that("load_genotype_region errors on missing genotype files", { ) }) +# --- find_stochastic_meta tests --- + +test_that("find_stochastic_meta finds generic sidecar from PLINK1 prefix", { + td <- test_path("test_data") + # test_harmonize_regions has .stochastic_meta.tsv alongside it + result <- pecotmr:::find_stochastic_meta(file.path(td, "test_harmonize_regions")) + expect_true(!is.null(result)) + expect_true(grepl("\\.(afreq|stochastic_meta\\.tsv)$", result)) +}) + +test_that("find_stochastic_meta finds sidecar from VCF path", { + td <- test_path("test_data") + result <- pecotmr:::find_stochastic_meta(file.path(td, "test_harmonize_regions.vcf.gz")) + expect_true(!is.null(result)) + expect_true(grepl("\\.(afreq|stochastic_meta\\.tsv)$", result)) +}) + +test_that("find_stochastic_meta finds sidecar from GDS path", { + td <- test_path("test_data") + result <- pecotmr:::find_stochastic_meta(file.path(td, "test_harmonize_regions.gds")) + expect_true(!is.null(result)) + expect_true(grepl("\\.(afreq|stochastic_meta\\.tsv)$", result)) +}) + +test_that("find_stochastic_meta returns NULL when no sidecar exists", { + td <- test_path("test_data") + result <- pecotmr:::find_stochastic_meta(file.path(td, "protocol_example.genotype")) + expect_null(result) +}) + +# --- read_stochastic_meta tests --- + +test_that("read_stochastic_meta reads generic format", { + td <- test_path("test_data") + path <- file.path(td, "test_harmonize_regions.stochastic_meta.tsv") + result <- pecotmr:::read_stochastic_meta(path) + expect_true(is.data.frame(result)) + expect_equal(colnames(result), c("id", "u_min", "u_max")) + expect_equal(nrow(result), 8L) + expect_true(is.numeric(result$u_min)) + expect_true(is.numeric(result$u_max)) +}) + +test_that("read_stochastic_meta reads afreq format", { + td <- test_path("test_data") + path <- file.path(td, "test_harmonize_regions.afreq") + result <- pecotmr:::read_stochastic_meta(path) + expect_true(is.data.frame(result)) + expect_equal(colnames(result), c("id", "u_min", "u_max")) + expect_equal(nrow(result), 8L) + expect_true(all(grepl("^chr21_", result$id))) +}) + +test_that("read_stochastic_meta reads afreq.zst format", { + td <- test_path("test_data") + path <- file.path(td, "test_harmonize_regions.afreq.zst") + result <- pecotmr:::read_stochastic_meta(path) + expect_true(is.data.frame(result)) + expect_equal(colnames(result), c("id", "u_min", "u_max")) + expect_equal(nrow(result), 8L) + # Should produce identical results to the plain afreq + plain <- pecotmr:::read_stochastic_meta(file.path(td, "test_harmonize_regions.afreq")) + expect_equal(result, plain) +}) + +test_that("find_stochastic_meta prefers afreq over afreq.zst", { + td <- test_path("test_data") + # Both .afreq and .afreq.zst exist; find_stochastic_meta should return .afreq first + result <- pecotmr:::find_stochastic_meta(file.path(td, "test_harmonize_regions")) + expect_true(grepl("\\.afreq$", result)) +}) + +test_that("read_stochastic_meta auto-detects format from extension", { + td <- test_path("test_data") + # .afreq extension -> afreq parser + afreq_result <- pecotmr:::read_stochastic_meta(file.path(td, "test_harmonize_regions.afreq")) + # .tsv extension -> generic parser + generic_result <- pecotmr:::read_stochastic_meta( + file.path(td, "test_harmonize_regions.stochastic_meta.tsv")) + # Both should return the same u_min/u_max values + expect_equal(afreq_result$u_min, generic_result$u_min) + expect_equal(afreq_result$u_max, generic_result$u_max) + expect_equal(afreq_result$id, generic_result$id) +}) + +test_that("read_stochastic_meta respects format override", { + td <- test_path("test_data") + path <- file.path(td, "test_harmonize_regions.stochastic_meta.tsv") + # Explicit generic format should work + result <- pecotmr:::read_stochastic_meta(path, format = "generic") + expect_equal(nrow(result), 8L) + expect_equal(colnames(result), c("id", "u_min", "u_max")) +}) + +test_that("read_stochastic_meta returns NULL for afreq without U_MIN/U_MAX", { + td <- test_path("test_data") + # test_variants.afreq has no U_MIN/U_MAX columns + path <- file.path(td, "test_variants.afreq") + result <- pecotmr:::read_stochastic_meta(path) + expect_null(result) +}) + +test_that("read_stochastic_meta returns NULL for nonexistent file", { + result <- pecotmr:::read_stochastic_meta("/nonexistent/file.tsv") + expect_null(result) +}) + +# --- load_genotype_region stochastic inversion test --- + +test_that("load_genotype_region applies stochastic inversion with explicit sidecar", { + td <- test_path("test_data") + meta_path <- file.path(td, "test_harmonize_regions.stochastic_meta.tsv") + smeta <- pecotmr:::read_stochastic_meta(meta_path) + + # Load with explicit sidecar — inversion transforms the integer dosages + res <- load_genotype_region( + file.path(td, "test_harmonize_regions"), + return_variant_info = TRUE, + stochastic_meta_path = meta_path + ) + + expect_equal(ncol(res$X), 8L) + # u_min/u_max should be attached to variant_info + expect_true("u_min" %in% colnames(res$variant_info)) + expect_true("u_max" %in% colnames(res$variant_info)) + expect_equal(res$variant_info$u_min, smeta$u_min) + expect_equal(res$variant_info$u_max, smeta$u_max) + + # Verify inversion math: for a dosage value d with u_min/u_max, + # inverted = d * (u_max - u_min) / 2 + u_min + # Check the first variant's first sample manually + raw <- load_genotype_region( + file.path(td, "protocol_example.genotype"), + region = "chr22:20689453-20845958" + ) + # protocol_example has no sidecar, so raw values are unchanged (integer dosages) + expect_true(all(raw == round(raw), na.rm = TRUE)) + + # The inverted matrix should NOT be all integers (u_min != 0 or u_max != 2) + expect_false(all(res$X == round(res$X), na.rm = TRUE)) +}) + test_that("Test load_covariate_data reads tab-delimited file", { # Create a temp covariate file: first column is sample ID, rest are numeric tmp <- tempfile(fileext = ".tsv") @@ -953,35 +1065,9 @@ test_that("load_regional_functional_data returns full association data", { }) # =========================================================================== -# read_pvar / read_bim vroom-based tests +# read_bim vroom-based tests # =========================================================================== -test_that("read_pvar handles multiple comment styles", { - skip("disabled pending Bucket B resolution: read_pvar not exported / removed") - pvar_path <- tempfile(fileext = ".pvar") - cat("##fileformat=VCFv4.2\n", file = pvar_path) - cat("##INFO=\n", file = pvar_path, append = TRUE) - cat("#CHROM\tID\tPOS\tREF\tALT\n", file = pvar_path, append = TRUE) - cat("1\trs10\t1000\tA\tG\n", file = pvar_path, append = TRUE) - cat("1\trs20\t2000\tT\tC\n", file = pvar_path, append = TRUE) - - res <- read_pvar(pvar_path) - expect_equal(nrow(res), 2) - expect_equal(colnames(res), c("chrom", "id", "pos", "A2", "A1")) - expect_equal(res$id, c("rs10", "rs20")) - expect_equal(res$pos, c(1000, 2000)) - file.remove(pvar_path) -}) - -test_that("read_pvar errors when #CHROM header is missing", { - skip("disabled pending Bucket B resolution: read_pvar not exported / removed") - bad_path <- tempfile(fileext = ".pvar") - cat("col1\tcol2\tcol3\n", file = bad_path) - cat("1\t2\t3\n", file = bad_path, append = TRUE) - expect_error(read_pvar(bad_path), "Could not find #CHROM header") - file.remove(bad_path) -}) - test_that("read_bim returns correct columns and types", { bim_path <- tempfile(fileext = ".bim") cat("22\trs100\t0\t50000\tA\tG\n", file = bim_path) @@ -1013,7 +1099,7 @@ test_that("tabix_region returns empty tibble on NULL cmd_output (error path)", { tmp <- tempfile() writeLines("dummy", tmp) local_mocked_bindings( - vroom = function(...) stop("mock error") + read_tabix_region = function(...) stop("mock error") ) result <- tabix_region(tmp, "chr1:1-100") expect_true(nrow(result) == 0) @@ -1030,7 +1116,7 @@ test_that("tabix_region filters with target and target_column_index", { tmp <- tempfile() writeLines("dummy", tmp) local_mocked_bindings( - vroom = function(...) mock_df + read_tabix_region = function(...) mock_df ) result <- tabix_region(tmp, "chr1:1-500", target = "BRCA1", target_column_index = 3) expect_equal(nrow(result), 2) @@ -1047,7 +1133,7 @@ test_that("tabix_region filters with target but no target_column_index (text pat tmp <- tempfile() writeLines("dummy", tmp) local_mocked_bindings( - vroom = function(...) mock_df + read_tabix_region = function(...) mock_df ) result <- tabix_region(tmp, "chr1:1-500", target = "ABC") expect_equal(nrow(result), 1) @@ -1402,58 +1488,32 @@ test_that("get_filter_lbf_index returns numeric index vector", { # get_ref_variant_info # =========================================================================== -test_that("get_ref_variant_info processes bim files with 6 columns", { - skip("disabled pending Bucket C resolution: resolve_ld_source now requires real LD metadata file") - bim_path <- tempfile(fileext = ".bim") - bim_data <- data.frame( - V1 = c("chr1", "chr1"), - V2 = c("chr1:100:A:G", "chr1:200:C:T"), - V3 = c(0, 0), - V4 = c(100, 200), - V5 = c("A", "C"), - V6 = c("G", "T"), - stringsAsFactors = FALSE - ) - readr::write_tsv(bim_data, bim_path, col_names = FALSE) - - local_mocked_bindings( - get_regional_ld_meta = function(...) { - list(intersections = list(bim_file_paths = bim_path)) - } - ) - - result <- get_ref_variant_info("/fake/ld_meta.txt", "chr1:1-300") +test_that("get_ref_variant_info processes precomputed bim with 6 columns", { + td <- test_path("test_data") + meta_file <- file.path(td, "ld_meta_refinfo_6col_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- get_ref_variant_info(meta_file, "chr1:1000-1190") expect_true(is.data.frame(result)) expect_true(all(c("chrom", "id", "pos", "A2", "A1") %in% colnames(result))) - expect_equal(nrow(result), 2) - file.remove(bim_path) + expect_equal(nrow(result), 5L) }) -test_that("get_ref_variant_info processes bim files with 8 columns", { - skip("disabled pending Bucket C resolution: resolve_ld_source now requires real LD metadata file") - bim_path <- tempfile(fileext = ".bim") - bim_data <- data.frame( - V1 = c("chr1", "chr1"), - V2 = c("chr1:100:A:G", "chr1:200:C:T"), - V3 = c(0, 0), - V4 = c(100, 200), - V5 = c("A", "C"), - V6 = c("G", "T"), - V7 = c(0.01, 0.02), - V8 = c(0.3, 0.4), - stringsAsFactors = FALSE - ) - readr::write_tsv(bim_data, bim_path, col_names = FALSE) - - local_mocked_bindings( - get_regional_ld_meta = function(...) { - list(intersections = list(bim_file_paths = bim_path)) - } - ) - - result <- get_ref_variant_info("/fake/ld_meta.txt", "chr1:1-300") - expect_true(all(c("chrom", "id", "pos", "A2", "A1", "variance", "allele_freq") %in% colnames(result))) - file.remove(bim_path) +test_that("get_ref_variant_info processes precomputed bim with 9 columns", { + td <- test_path("test_data") + meta_file <- file.path(td, "ld_meta_refinfo_9col_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("1", "1000", "1200", + "LD_block_1.chr1_1000_1200.float16.txt.xz,LD_block_1.chr1_1000_1200.float16.9col.bim", + sep = "\t"), "\n", file = meta_file, append = TRUE) + result <- get_ref_variant_info(meta_file, "chr1:1000-1190") + expect_true(all(c("chrom", "id", "pos", "A2", "A1", "variance", "allele_freq", "n_nomiss") %in% colnames(result))) + expect_equal(nrow(result), 5L) + expect_equal(result$allele_freq, c(0.3, 0.4, 0.2, 0.5, 0.15)) }) # =========================================================================== @@ -1479,6 +1539,128 @@ test_that("load_multitask_regional_data errors with multiple genotypes and no ma ) }) +test_that("load_multitask_regional_data individual-level path returns expected structure", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_multitask_regional_data( + region = "chr21:17513043-17593579", + genotype_list = file.path(td, "test_variants"), + phenotype_list = file.path(td, "test_phenotypes.tsv.gz"), + covariate_list = file.path(td, "test_covariates.tsv"), + conditions_list_individual = "cond1" + ) + expect_true(is.list(result)) + expect_named(result, c("individual_data", "sumstat_data")) + expect_false(is.null(result$individual_data)) + expect_true(is.null(result$sumstat_data)) + # Individual data should have standard fields + expect_true("residual_Y" %in% names(result$individual_data)) + expect_true("X" %in% names(result$individual_data)) + expect_true("chrom" %in% names(result$individual_data)) +}) + +test_that("load_multitask_regional_data sumstat path returns expected structure", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + # Create LD metadata file pointing to harmonize_regions genotype + meta_file <- file.path(td, "ld_meta_harmonize_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines( + paste("chrom", "start", "end", "path", sep = "\t"), + meta_file + ) + cat(paste("21", "0", "0", "test_harmonize_regions", sep = "\t"), "\n", + file = meta_file, append = TRUE) + + sumstat_path <- file.path(td, "test_sumstats.tsv.gz") + result <- suppressMessages(suppressWarnings( + load_multitask_regional_data( + region = "chr21:17014042-45433269", + association_window = "chr21:17014042-45433269", + sumstat_path_list = sumstat_path, + LD_meta_file_path_list = meta_file, + conditions_list_sumstat = "sumstat_cond1", + n_samples = 1000, + n_cases = 0, + n_controls = 0 + ) + )) + expect_true(is.list(result)) + expect_named(result, c("individual_data", "sumstat_data")) + expect_true(is.null(result$individual_data)) + expect_false(is.null(result$sumstat_data)) + # Sumstat data should have sumstats and LD_info lists + expect_true("sumstats" %in% names(result$sumstat_data)) + expect_true("LD_info" %in% names(result$sumstat_data)) + expect_equal(length(result$sumstat_data$sumstats), 1L) + expect_equal(length(result$sumstat_data$LD_info), 1L) + # The inner sumstats should be a named list with the condition + inner <- result$sumstat_data$sumstats[[1]] + expect_true("sumstat_cond1" %in% names(inner)) + ss <- inner[["sumstat_cond1"]] + expect_true(is.data.frame(ss$sumstats)) + expect_true(nrow(ss$sumstats) > 0) + expect_true("z" %in% names(ss$sumstats)) + expect_equal(ss$n, 1000) +}) + +test_that("load_multitask_regional_data both paths simultaneously", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + # Create LD metadata for sumstat path + meta_file <- file.path(td, "ld_meta_both_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines( + paste("chrom", "start", "end", "path", sep = "\t"), + meta_file + ) + cat(paste("21", "0", "0", "test_harmonize_regions", sep = "\t"), "\n", + file = meta_file, append = TRUE) + + result <- suppressMessages(suppressWarnings( + load_multitask_regional_data( + region = "chr21:17513043-17593579", + # Individual-level data + genotype_list = file.path(td, "test_variants"), + phenotype_list = file.path(td, "test_phenotypes.tsv.gz"), + covariate_list = file.path(td, "test_covariates.tsv"), + conditions_list_individual = "ind_cond1", + # Summary statistics + association_window = "chr21:17014042-45433269", + sumstat_path_list = file.path(td, "test_sumstats.tsv.gz"), + LD_meta_file_path_list = meta_file, + conditions_list_sumstat = "ss_cond1", + n_samples = 500, + n_cases = 0, + n_controls = 0 + ) + )) + expect_false(is.null(result$individual_data)) + expect_false(is.null(result$sumstat_data)) + # Both paths should produce valid data + expect_true("X" %in% names(result$individual_data)) + expect_true(is.data.frame(result$sumstat_data$sumstats[[1]][["ss_cond1"]]$sumstats)) +}) + +test_that("load_multitask_regional_data sumstat path errors on mismatched match_LD_sumstat", { + td <- test_path("test_data") + expect_error( + load_multitask_regional_data( + region = "chr21:17014042-45433269", + sumstat_path_list = file.path(td, "test_sumstats.tsv.gz"), + LD_meta_file_path_list = c("meta1.tsv", "meta2.tsv"), + match_LD_sumstat = list("cond1"), + conditions_list_sumstat = "cond1", + n_samples = 100, + n_cases = 0, + n_controls = 0 + ), + "match_LD_sumstat" + ) +}) + # ---- invert_minmax_scaling ---- test_that("invert_minmax_scaling exactly recovers original U", { @@ -1597,3 +1779,714 @@ test_that("batch_load_twas_weights puts oversized gene in its own batch", { # Big gene should be in its own batch expect_true(length(result) >= 2) }) + +# =========================================================================== +# load_covariate_data with real fixture +# =========================================================================== + +test_that("load_covariate_data reads and transposes covariate file", { + covar_path <- file.path(test_path("test_data"), "test_covariates.tsv") + result <- pecotmr:::load_covariate_data(covar_path) + expect_true(is.list(result)) + expect_equal(length(result), 1L) + mat <- result[[1]] + expect_true(is.matrix(mat)) + # Original: 8 rows (PCs) x 101 cols (variable + 100 samples) + # After drop col 1 + transpose: 100 rows (samples) x 8 cols (PCs) + expect_equal(nrow(mat), 100L) + expect_equal(ncol(mat), 8L) + expect_true(is.numeric(mat)) + expect_false(any(is.na(mat))) +}) + +test_that("load_covariate_data errors on missing file", { + expect_error( + pecotmr:::load_covariate_data("/nonexistent/covariate.tsv"), + "not found" + ) +}) + +# =========================================================================== +# load_tsv_region with real tabix-indexed fixture +# =========================================================================== + +test_that("load_tsv_region reads full gz file without region", { + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- load_tsv_region(sumstat_path) + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 8L) + expect_true("BETA" %in% names(result) || "beta" %in% names(result)) +}) + +test_that("load_tsv_region queries region via tabix", { + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- load_tsv_region(sumstat_path, region = "chr21:17014042-45433269") + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 8L) +}) + +test_that("load_tsv_region errors for non-overlapping region", { + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + expect_error(load_tsv_region(sumstat_path, region = "chr1:1-2"), "tabix-indexed") +}) + +test_that("load_tsv_region queries subregion correctly", { + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + # Only first 2 variants: pos 17014042 and 18759786 + result <- load_tsv_region(sumstat_path, region = "chr21:17014042-18759786") + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 2L) +}) + +# =========================================================================== +# load_rss_data with real tabix-indexed fixture +# =========================================================================== + +test_that("load_rss_data reads summary statistics without region", { + skip_if_not_installed("MungeSumstats") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- suppressMessages(load_rss_data(sumstat_path)) + expect_true(is.list(result)) + expect_true(is.data.frame(result$sumstats)) + expect_equal(nrow(result$sumstats), 8L) + # Should have standardized column names including z + expect_true("beta" %in% names(result$sumstats)) + expect_true("se" %in% names(result$sumstats)) + expect_true("z" %in% names(result$sumstats)) + # z should be beta / se + expect_equal(result$sumstats$z, result$sumstats$beta / result$sumstats$se) +}) + +test_that("load_rss_data reads summary statistics with region", { + skip_if_not_installed("MungeSumstats") + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- suppressMessages( + load_rss_data(sumstat_path, region = "chr21:17014042-45433269") + ) + expect_true(is.data.frame(result$sumstats)) + expect_equal(nrow(result$sumstats), 8L) +}) + +test_that("load_rss_data with n_sample returns sample size", { + skip_if_not_installed("MungeSumstats") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- suppressMessages(load_rss_data(sumstat_path, n_sample = 500)) + expect_equal(result$n, 500) + expect_null(result$var_y) +}) + +test_that("load_rss_data with n_case and n_control computes var_y", { + skip_if_not_installed("MungeSumstats") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + result <- suppressMessages(load_rss_data(sumstat_path, n_case = 200, n_control = 300)) + expect_equal(result$n, 500) + expect_true(!is.null(result$var_y)) + # var_y = 1 / (phi * (1 - phi)) where phi = 200/500 = 0.4 + expect_equal(result$var_y, 1 / (0.4 * 0.6)) +}) + +test_that("load_rss_data extracts n from sumstats N column", { + skip_if_not_installed("MungeSumstats") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + # n_sample=0 means "get from file" + result <- suppressMessages(load_rss_data(sumstat_path)) + # The fixture has N column with per-variant sample sizes; median should be used + expect_true(!is.null(result$n)) + expect_true(result$n > 0) +}) + +test_that("load_rss_data errors on missing file", { + expect_error(load_rss_data("/nonexistent/sumstats.tsv.gz"), "not found") +}) + +test_that("load_rss_data errors for non-overlapping region", { + skip_if_not_installed("MungeSumstats") + skip_if_not_installed("Rsamtools") + sumstat_path <- file.path(test_path("test_data"), "test_sumstats.tsv.gz") + expect_error( + suppressMessages(load_rss_data(sumstat_path, region = "chr1:1-2")), + "tabix-indexed" + ) +}) + +# =========================================================================== +# get_ref_variant_info with PLINK2 fixture +# =========================================================================== + +test_that("get_ref_variant_info returns variant info for PLINK2 source", { + skip_if_not_installed("pgenlibr") + meta_file <- file.path(test_path("test_data"), "ld_meta_refinfo_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- get_ref_variant_info(meta_file, region = "chr21:17513228-17592874") + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 349L) + expect_true(all(c("chrom", "id", "pos", "A2", "A1") %in% names(result))) + # .afreq is present, so allele_freq should be populated + expect_true("allele_freq" %in% names(result)) + expect_true(all(result$allele_freq > 0 & result$allele_freq < 1)) +}) + +test_that("get_ref_variant_info filters by subregion", { + skip_if_not_installed("pgenlibr") + meta_file <- file.path(test_path("test_data"), "ld_meta_refinfo_sub_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- get_ref_variant_info(meta_file, region = "chr21:17513228-17550000") + expect_true(nrow(result) < 349L) + expect_true(all(result$pos >= 17513228 & result$pos <= 17550000)) +}) + +test_that("get_ref_variant_info returns variant info for VCF source", { + skip_if_not_installed("VariantAnnotation") + meta_file <- file.path(test_path("test_data"), "ld_meta_refinfo_vcf_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.vcf.gz", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- suppressWarnings( + get_ref_variant_info(meta_file, region = "chr21:17513228-17592874") + ) + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 349L) + expect_true(all(c("chrom", "id", "pos", "A2", "A1") %in% names(result))) + expect_true("allele_freq" %in% names(result)) + expect_true(all(result$allele_freq > 0 & result$allele_freq < 1)) +}) + +test_that("get_ref_variant_info returns variant info for GDS source", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + meta_file <- file.path(test_path("test_data"), "ld_meta_refinfo_gds_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.gds", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- get_ref_variant_info(meta_file, region = "chr21:17513228-17592874") + expect_true(is.data.frame(result)) + expect_equal(nrow(result), 349L) + expect_true(all(c("chrom", "id", "pos", "A2", "A1") %in% names(result))) + expect_true("allele_freq" %in% names(result)) +}) + +test_that("get_ref_variant_info VCF filters by subregion", { + skip_if_not_installed("VariantAnnotation") + skip_if_not_installed("Rsamtools") + meta_file <- file.path(test_path("test_data"), "ld_meta_refinfo_vcf_sub_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), meta_file) + cat(paste("21", "0", "0", "test_variants.vcf.gz", sep = "\t"), "\n", + file = meta_file, append = TRUE) + result <- suppressWarnings( + get_ref_variant_info(meta_file, region = "chr21:17513228-17550000") + ) + expect_true(nrow(result) < 349L) + expect_true(all(result$pos >= 17513228 & result$pos <= 17550000)) +}) + +test_that("get_ref_variant_info returns consistent results across formats", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + region <- "chr21:17513228-17592874" + td <- test_path("test_data") + + meta_plink <- file.path(td, "ld_meta_refinfo_cmp_p2_tmp.tsv") + meta_gds <- file.path(td, "ld_meta_refinfo_cmp_gds_tmp.tsv") + on.exit({unlink(meta_plink); unlink(meta_gds)}, add = TRUE) + + for (f in c(meta_plink, meta_gds)) { + writeLines(paste("chrom", "start", "end", "path", sep = "\t"), f) + } + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_plink, append = TRUE) + cat(paste("21", "0", "0", "test_variants.gds", sep = "\t"), "\n", + file = meta_gds, append = TRUE) + + info_plink <- get_ref_variant_info(meta_plink, region = region) + info_gds <- get_ref_variant_info(meta_gds, region = region) + + expect_equal(nrow(info_plink), nrow(info_gds)) + expect_equal(info_plink$pos, info_gds$pos) +}) + +# =========================================================================== +# read_afreq +# =========================================================================== + +test_that("read_afreq returns correct structure from .afreq file", { + td <- test_path("test_data") + af <- read_afreq(file.path(td, "test_variants")) + expect_true(is.data.frame(af)) + expect_equal(nrow(af), 349L) + expect_true(all(c("chrom", "id", "A2", "A1", "alt_freq", "obs_ct") %in% colnames(af))) +}) + +test_that("read_afreq returns correct types", { + td <- test_path("test_data") + af <- read_afreq(file.path(td, "test_variants")) + expect_type(af$alt_freq, "double") + expect_true(all(af$alt_freq >= 0 & af$alt_freq <= 1)) + expect_true(all(af$obs_ct > 0)) +}) + +test_that("read_afreq returns NULL when no afreq file exists", { + af <- read_afreq(file.path(tempdir(), "nonexistent_prefix")) + expect_null(af) +}) + +test_that("read_afreq reads .afreq.zst file", { + td <- test_path("test_data") + # test_harmonize_regions has both .afreq and .afreq.zst; read_afreq prefers .zst + af <- read_afreq(file.path(td, "test_harmonize_regions")) + expect_true(is.data.frame(af)) + expect_true(all(c("id", "A2", "A1", "alt_freq", "obs_ct") %in% colnames(af))) + # This afreq has U_MIN/U_MAX columns + expect_true(all(c("u_min", "u_max") %in% colnames(af))) + expect_equal(nrow(af), 8L) +}) + +test_that("read_afreq reads plain .afreq with U_MIN/U_MAX", { + td <- test_path("test_data") + # Temporarily hide the .zst so read_afreq falls through to plain .afreq + zst_path <- file.path(td, "test_harmonize_regions.afreq.zst") + tmp_path <- paste0(zst_path, ".bak") + file.rename(zst_path, tmp_path) + on.exit(file.rename(tmp_path, zst_path), add = TRUE) + + af <- read_afreq(file.path(td, "test_harmonize_regions")) + expect_true(is.data.frame(af)) + expect_true(all(c("u_min", "u_max") %in% colnames(af))) + expect_equal(nrow(af), 8L) +}) + +test_that("read_afreq IDs match pvar IDs", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + af <- read_afreq(file.path(td, "test_variants")) + pvar <- read_pvar(file.path(td, "test_variants.pvar")) + expect_equal(af$id, pvar$id) +}) + +# =========================================================================== +# match_variants_to_keep +# =========================================================================== + +test_that("match_variants_to_keep filters to specified variants", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + result <- load_plink2_data(file.path(td, "test_variants")) + vi <- result$variant_info + + # Write a keep file as tab-delimited with chrom/pos columns + keep_file <- tempfile(fileext = ".tsv") + on.exit(unlink(keep_file), add = TRUE) + keep_df <- vi[c(1, 5, 10), c("chrom", "pos", "A2", "A1")] + vroom::vroom_write(keep_df, keep_file, delim = "\t") + + mask <- match_variants_to_keep(vi, keep_file) + expect_type(mask, "logical") + expect_equal(sum(mask), 3L) + expect_true(mask[1]) + expect_true(mask[5]) + expect_true(mask[10]) +}) + +test_that("match_variants_to_keep returns all FALSE for non-matching variants", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + result <- load_plink2_data(file.path(td, "test_variants")) + vi <- result$variant_info + + keep_file <- tempfile(fileext = ".tsv") + on.exit(unlink(keep_file), add = TRUE) + keep_df <- data.frame(chrom = c(1L, 2L), pos = c(999L, 888L), + A2 = c("A", "C"), A1 = c("T", "G")) + vroom::vroom_write(keep_df, keep_file, delim = "\t") + + mask <- match_variants_to_keep(vi, keep_file) + expect_true(all(!mask)) +}) + +# =========================================================================== +# standardise_sumstats_columns +# =========================================================================== + +test_that("standardise_sumstats_columns renames standard headers", { + skip_if_not_installed("MungeSumstats") + df <- data.frame( + SNPID = "rs1", CHR = 1, POS = 100, + EFFECT_ALLELE = "A", OTHER_ALLELE = "G", + BETA = 0.5, SE = 0.1, P = 0.01, + stringsAsFactors = FALSE + ) + result <- standardise_sumstats_columns(df) + expect_true("chrom" %in% colnames(result)) + expect_true("pos" %in% colnames(result)) + expect_true("beta" %in% colnames(result)) + expect_true("se" %in% colnames(result)) + expect_true("p" %in% colnames(result)) +}) + +test_that("standardise_sumstats_columns applies custom column mapping", { + skip_if_not_installed("MungeSumstats") + df <- data.frame( + SNP = "rs1", CHR = 1, BP = 100, + A1 = "A", A2 = "G", + BETA = 0.5, SE = 0.1, P = 0.01, + MY_FREQ = 0.3, + stringsAsFactors = FALSE + ) + col_file <- tempfile(fileext = ".txt") + on.exit(unlink(col_file), add = TRUE) + writeLines("maf:MY_FREQ", col_file) + + result <- standardise_sumstats_columns(df, column_file_path = col_file) + expect_true("maf" %in% colnames(result)) +}) + +test_that("standardise_sumstats_columns errors on missing column file", { + skip_if_not_installed("MungeSumstats") + df <- data.frame(SNP = "rs1", CHR = 1, BP = 100, A1 = "A", A2 = "G", + BETA = 0.5, SE = 0.1, P = 0.01, stringsAsFactors = FALSE) + expect_error( + standardise_sumstats_columns(df, column_file_path = "/no/such/file.txt"), + "Column mapping file not found" + ) +}) + +# =========================================================================== +# load_plink2_data: direct tests +# =========================================================================== + +test_that("load_plink2_data loads all variants without region", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + result <- load_plink2_data(file.path(td, "test_variants")) + expect_true(is.matrix(result$X)) + expect_equal(nrow(result$X), 100L) + expect_equal(ncol(result$X), 349L) + expect_true(is.data.frame(result$variant_info)) + expect_equal(nrow(result$variant_info), 349L) +}) + +test_that("load_plink2_data filters by region", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + region <- "chr21:17513228-17550000" + result <- load_plink2_data(file.path(td, "test_variants"), region = region) + expect_true(ncol(result$X) < 349L) + expect_true(all(result$variant_info$pos >= 17513228)) + expect_true(all(result$variant_info$pos <= 17550000)) + expect_equal(ncol(result$X), nrow(result$variant_info)) +}) + +test_that("load_plink2_data errors on empty region", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + expect_error( + load_plink2_data(file.path(td, "test_variants"), region = "chr21:1-2"), + "No variants found" + ) +}) + +test_that("load_plink2_data removes indels with keep_indel=FALSE", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + full <- load_plink2_data(file.path(td, "test_variants")) + filtered <- load_plink2_data(file.path(td, "test_variants"), keep_indel = FALSE) + # test data has 36 indels + expect_equal(ncol(filtered$X), ncol(full$X) - 36L) + # all remaining alleles should be single characters + expect_true(all(nchar(filtered$variant_info$A1) == 1)) + expect_true(all(nchar(filtered$variant_info$A2) == 1)) +}) + +test_that("load_plink2_data filters by keep_variants_path", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + full <- load_plink2_data(file.path(td, "test_variants")) + + keep_file <- tempfile(fileext = ".tsv") + on.exit(unlink(keep_file), add = TRUE) + keep_df <- full$variant_info[c(1, 3, 7), c("chrom", "pos", "A2", "A1")] + vroom::vroom_write(keep_df, keep_file, delim = "\t") + + result <- load_plink2_data(file.path(td, "test_variants"), keep_variants_path = keep_file) + expect_equal(ncol(result$X), 3L) + expect_equal(nrow(result$variant_info), 3L) +}) + +test_that("load_plink2_data attaches afreq info to variant_info", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + result <- load_plink2_data(file.path(td, "test_variants")) + expect_true("alt_freq" %in% colnames(result$variant_info)) + expect_true("obs_ct" %in% colnames(result$variant_info)) + expect_true(all(result$variant_info$alt_freq >= 0 & result$variant_info$alt_freq <= 1)) +}) + +test_that("load_plink2_data sample names match psam IIDs", { + skip_if_not_installed("pgenlibr") + td <- test_path("test_data") + result <- load_plink2_data(file.path(td, "test_variants")) + expect_true(all(grepl("^(HG|NA)\\d+", rownames(result$X)))) + expect_equal(length(unique(rownames(result$X))), 100L) +}) + +# =========================================================================== +# load_phenotype_data with real BED-style tabix-indexed fixture +# =========================================================================== + +test_that("load_phenotype_data reads compressed file with tabix region", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:17513043-17593579" + ) + expect_true(is.list(pheno)) + expect_equal(length(pheno), 1L) + mat <- pheno[[1]] + expect_true(is.matrix(mat)) + # 4 header rows (seqid, start, end, gene_id) + 100 samples = 104 rows, 1 gene column + expect_equal(nrow(mat), 104L) + expect_equal(ncol(mat), 1L) + # Sample IDs start at row 5 + expect_equal(rownames(mat)[5], "HG02461") +}) + +test_that("load_phenotype_data filters by extract_region_name and region_name_col", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:17513043-17593579", + extract_region_name = list(c("ENSG00000154639")), + region_name_col = 4 + ) + expect_equal(length(pheno), 1L) + expect_true("ENSG00000154639" %in% colnames(pheno[[1]])) +}) + +test_that("load_phenotype_data assigns gene names with region_name_col", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:17513043-17593579", + region_name_col = 4 + ) + expect_equal(colnames(pheno[[1]]), "ENSG00000154639") +}) + +test_that("load_phenotype_data returns multiple genes for broad region", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:14000000-18000000", + region_name_col = 4 + ) + expect_equal(length(pheno), 1L) + expect_true(ncol(pheno[[1]]) > 1) + expect_true("ENSG00000154639" %in% colnames(pheno[[1]])) +}) + +test_that("load_phenotype_data errors on non-overlapping region", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + expect_error( + load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:1-100" + ), + "empty" + ) +}) + +test_that("load_phenotype_data reads uncompressed file without region", { + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv"), + region = NULL, + region_name_col = 4 + ) + expect_equal(length(pheno), 1L) + # All 93 genes in the uncompressed file + expect_equal(ncol(pheno[[1]]), 93L) +}) + +test_that("load_phenotype_data stores kept_indices attribute", { + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + pheno <- load_phenotype_data( + file.path(td, "test_phenotypes.tsv.gz"), + region = "chr21:17513043-17593579" + ) + expect_equal(attr(pheno, "kept_indices"), 1L) +}) + +# =========================================================================== +# load_regional_association_data with real fixtures (full pipeline) +# =========================================================================== + +test_that("load_regional_association_data returns expected structure", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_association_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1" + ) + expect_true(is.list(result)) + expected_names <- c("residual_Y", "residual_X", "residual_Y_scalar", + "residual_X_scalar", "dropped_sample", "covar", + "Y", "X_data", "X", "maf", "chrom", "grange", + "Y_coordinates") + expect_true(all(expected_names %in% names(result))) + # 100 samples, 349 variants + expect_equal(nrow(result$X), 100L) + expect_equal(ncol(result$X), 349L) + expect_equal(result$chrom, "chr21") + expect_equal(names(result$residual_Y), "cond1") + # residual_Y should be a 100-sample x 1-gene matrix + expect_equal(nrow(result$residual_Y[[1]]), 100L) + expect_equal(ncol(result$residual_Y[[1]]), 1L) + # Y_coordinates should have gene coordinates + expect_true(is.data.frame(result$Y_coordinates[[1]])) +}) + +test_that("load_regional_association_data with scale_residuals returns scalars", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_association_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1", + scale_residuals = TRUE + ) + # With scale_residuals, residual_Y_scalar should be non-trivial + expect_true(is.list(result$residual_Y_scalar)) + expect_true(all(unlist(result$residual_Y_scalar) > 0)) + expect_true(is.list(result$residual_X_scalar)) +}) + +test_that("load_regional_association_data with keep_indel=FALSE reduces variants", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_association_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1", + keep_indel = FALSE + ) + # 349 total - 36 indels = 313 SNPs + expect_equal(ncol(result$X), 313L) +}) + +test_that("load_regional_association_data covariate residuals affect Y", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_association_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1" + ) + # Raw Y and residual Y should differ (covariates regressed out) + raw_y <- as.numeric(result$Y[[1]]) + resid_y <- as.numeric(result$residual_Y[[1]]) + expect_false(isTRUE(all.equal(raw_y, resid_y))) +}) + +# =========================================================================== +# load_regional_univariate_data with real fixtures +# =========================================================================== + +test_that("load_regional_univariate_data returns correct fields", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_univariate_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1" + ) + expected_names <- c("residual_Y", "residual_X", "residual_Y_scalar", + "residual_X_scalar", "dropped_sample", "maf", + "X", "chrom", "grange", "X_variance") + expect_true(all(expected_names %in% names(result))) + expect_equal(nrow(result$X), 100L) + # X_variance should be a list with one entry per condition + expect_true(is.list(result$X_variance)) + expect_equal(length(result$X_variance[[1]]), ncol(result$X)) +}) + +# =========================================================================== +# load_regional_regression_data with real fixtures +# =========================================================================== + +test_that("load_regional_regression_data returns correct fields", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_regression_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1" + ) + expected_names <- c("Y", "X_data", "covar", "dropped_sample", + "maf", "chrom", "grange") + expect_true(all(expected_names %in% names(result))) + expect_true(is.list(result$Y)) + expect_true(is.list(result$X_data)) + expect_true(is.list(result$covar)) +}) + +# =========================================================================== +# load_regional_multivariate_data with real fixtures +# =========================================================================== + +test_that("load_regional_multivariate_data returns correct fields", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("Rsamtools") + td <- test_path("test_data") + result <- load_regional_multivariate_data( + genotype = file.path(td, "test_variants"), + phenotype = file.path(td, "test_phenotypes.tsv.gz"), + covariate = file.path(td, "test_covariates.tsv"), + region = "chr21:17513043-17593579", + conditions = "cond1" + ) + expected_names <- c("residual_Y", "residual_Y_scalar", "dropped_sample", + "X", "maf", "chrom", "grange", "X_variance") + expect_true(all(expected_names %in% names(result))) + # residual_Y should be a matrix (not list) after pheno_list_to_mat + expect_true(is.matrix(result$residual_Y)) + expect_equal(nrow(result$X), 100L) +}) diff --git a/tests/testthat/test_genotype_derived.R b/tests/testthat/test_genotype_derived.R new file mode 100644 index 000000000..f5ec2fbe9 --- /dev/null +++ b/tests/testthat/test_genotype_derived.R @@ -0,0 +1,318 @@ +# Tests for functions that consume genotype matrices or compute LD: +# compute_LD, check_ld, ld_prune_by_correlation, ld_clump_by_score, +# enforce_design_full_rank, filter_variants_by_ld_reference, +# resolve_LD_input, dentist_single_window, dentist + +# Fixtures: 100 samples x 100 biallelic polymorphic SNPs on chr21 +test_data_dir <- test_path("test_data") +plink_prefix <- file.path(test_data_dir, "test_variants") + +# Load genotype matrix once for reuse across tests +load_test_genotype <- function() { + load_genotype_region(plink_prefix, return_variant_info = TRUE) +} + +# ─── compute_LD ────────────────────────────────────────────────────────────── + +test_that("compute_LD produces valid sample correlation matrix", { + skip_if_not_installed("pgenlibr") + geno <- load_test_genotype() + R <- compute_LD(geno$X, method = "sample") + expect_true(is.matrix(R)) + expect_equal(nrow(R), ncol(geno$X)) + expect_equal(ncol(R), ncol(geno$X)) + expect_true(isSymmetric(R)) + expect_true(all(abs(diag(R) - 1) < 1e-10)) + expect_false(any(is.nan(R))) + expect_true(all(R >= -1 - 1e-10 & R <= 1 + 1e-10)) +}) + +test_that("compute_LD population method produces valid matrix", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "population") + expect_true(isSymmetric(R)) + expect_true(all(abs(diag(R) - 1) < 1e-10)) + expect_false(any(is.nan(R))) +}) + +test_that("compute_LD sample and population methods are similar", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R_s <- compute_LD(X, method = "sample") + R_p <- compute_LD(X, method = "population") + # Should be close but not identical (N-1 vs N denominator) + expect_true(max(abs(R_s - R_p)) < 0.05) +}) + +test_that("compute_LD errors on NULL input", { + expect_error(compute_LD(NULL), "X must be provided") +}) + +# ─── check_ld ──────────────────────────────────────────────────────────────── + +test_that("check_ld diagnoses real LD matrix correctly", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + result <- check_ld(R) + expect_true(is.list(result)) + expect_true(result$is_psd) + expect_equal(result$method_applied, "none") + # min eigenvalue may be near-zero (numerically PSD, not strictly PD) + expect_true(result$min_eigenvalue > -1e-7) + expect_true(result$n_negative == 0) + expect_true(is.finite(result$condition_number)) +}) + +test_that("check_ld eigenfix improves non-PSD matrix", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + # Make a non-PSD matrix by negating a small block of off-diagonal entries + R_bad <- R + R_bad[1:3, 4:6] <- -abs(R_bad[1:3, 4:6]) - 0.5 + R_bad[4:6, 1:3] <- t(R_bad[1:3, 4:6]) + diag(R_bad) <- 1 + + result_check <- check_ld(R_bad, method = "check") + expect_false(result_check$is_psd) + expect_true(result_check$n_negative > 0) + + result_fix <- check_ld(R_bad, method = "eigenfix") + expect_equal(result_fix$method_applied, "eigenfix") + # Eigenfix should improve (raise) minimum eigenvalue + fixed_check <- check_ld(result_fix$R) + expect_true(fixed_check$min_eigenvalue > result_check$min_eigenvalue) +}) + +test_that("check_ld shrink repairs perturbed LD matrix", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + R_bad <- R + R_bad[1, 2] <- R_bad[2, 1] <- 1.5 + diag(R_bad) <- 1 + result <- check_ld(R_bad, method = "shrink", shrinkage = 0.1) + expect_equal(result$method_applied, "shrink") +}) + +# ─── ld_prune_by_correlation ───────────────────────────────────────────────── + +test_that("ld_prune_by_correlation prunes correlated variants", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + result <- ld_prune_by_correlation(X, cor_thres = 0.8) + expect_true(is.list(result)) + expect_true(is.matrix(result$X.new)) + expect_true(ncol(result$X.new) <= ncol(X)) + expect_true(ncol(result$X.new) > 0) + expect_equal(length(result$filter.id), ncol(result$X.new)) + # Retained columns are a subset of original + expect_true(all(result$filter.id %in% seq_len(ncol(X)))) +}) + +test_that("ld_prune_by_correlation with strict threshold prunes more", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + loose <- ld_prune_by_correlation(X, cor_thres = 0.95) + strict <- ld_prune_by_correlation(X, cor_thres = 0.5) + expect_true(ncol(strict$X.new) <= ncol(loose$X.new)) +}) + +test_that("ld_prune_by_correlation with high threshold keeps most columns", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + result <- ld_prune_by_correlation(X, cor_thres = 0.999) + # At threshold near 1, only near-duplicates are pruned; real data may have many + expect_true(ncol(result$X.new) >= ncol(X) * 0.4) +}) + +# ─── ld_clump_by_score ─────────────────────────────────────────────────────── + +test_that("ld_clump_by_score returns valid indices", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("bigsnpr") + skip_if_not_installed("bigstatsr") + geno <- load_test_genotype() + set.seed(42) + score <- runif(ncol(geno$X)) + chr <- as.integer(geno$variant_info$chrom) + pos <- geno$variant_info$pos + keep <- ld_clump_by_score(geno$X, score = score, chr = chr, pos = pos, r2 = 0.2) + expect_true(is.integer(keep)) + expect_true(length(keep) > 0) + expect_true(length(keep) <= ncol(geno$X)) + expect_true(all(keep %in% seq_len(ncol(geno$X)))) +}) + +# ─── enforce_design_full_rank ──────────────────────────────────────────────── + +test_that("enforce_design_full_rank handles genotype matrix with covariates", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + # Create a simple covariate matrix (e.g., first 2 PCs of X) + pca <- prcomp(X, rank. = 2) + C <- pca$x + result <- enforce_design_full_rank(X, C, strategy = "correlation") + expect_true(is.matrix(result)) + expect_equal(nrow(result), nrow(X)) + # Should produce full-rank design + full_design <- cbind(1, result, C) + expect_equal(qr(full_design)$rank, ncol(full_design)) +}) + +# ─── filter_variants_by_ld_reference ───────────────────────────────────────── + +test_that("filter_variants_by_ld_reference filters against PLINK reference via metadata", { + skip_if_not_installed("pgenlibr") + geno <- load_test_genotype() + vi <- geno$variant_info + variant_ids <- paste0(vi$chrom, ":", vi$pos, ":", vi$A2, ":", vi$A1) + fake_ids <- c("21:999999:A:G", "21:888888:C:T") + all_ids <- c(variant_ids, fake_ids) + + # Create a metadata TSV in the same directory as the PLINK files + # so the relative path resolves correctly + meta_file <- file.path(test_data_dir, "ld_meta_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines( + paste("chrom", "start", "end", "path", sep = "\t"), + meta_file + ) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + + result <- suppressMessages( + filter_variants_by_ld_reference(all_ids, meta_file, keep_indel = TRUE) + ) + expect_true(is.list(result)) + expect_true(length(result$data) <= length(all_ids)) + expect_true(length(result$idx) == length(result$data)) + # Fake variants should be filtered out + expect_true(length(result$data) <= length(variant_ids)) +}) + +# ─── resolve_LD_input (internal) ───────────────────────────────────────────── + +test_that("resolve_LD_input computes LD from genotype matrix", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + result <- pecotmr:::resolve_LD_input(X = X, need_nSample = TRUE) + expect_true(is.list(result)) + expect_true(is.matrix(result$R)) + expect_equal(nrow(result$R), ncol(X)) + expect_equal(result$nSample, nrow(X)) + expect_true(isSymmetric(result$R)) +}) + +test_that("resolve_LD_input passes through pre-computed R", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + result <- pecotmr:::resolve_LD_input(R = R, nSample = 100L, need_nSample = TRUE) + expect_equal(result$R, R) + expect_equal(result$nSample, 100L) +}) + +test_that("resolve_LD_input errors when neither R nor X provided", { + expect_error(pecotmr:::resolve_LD_input(), "Either R .* or X .* must be provided") +}) + +test_that("resolve_LD_input errors when both R and X provided", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + expect_error(pecotmr:::resolve_LD_input(R = R, X = X), "Provide either R or X, not both") +}) + +test_that("resolve_LD_input errors when R given without nSample and needed", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + expect_error(pecotmr:::resolve_LD_input(R = R, need_nSample = TRUE), + "nSample is required") +}) + +# ─── dentist_single_window ─────────────────────────────────────────────────── + +test_that("dentist_single_window works with genotype matrix X", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + set.seed(42) + z <- rnorm(ncol(X)) + result <- suppressWarnings(dentist_single_window(z, X = X)) + expect_true(is.data.frame(result)) + expect_equal(nrow(result), length(z)) + expect_true("original_z" %in% names(result)) + expect_true("imputed_z" %in% names(result)) + expect_true("outlier" %in% names(result)) + expect_true(is.logical(result$outlier)) +}) + +test_that("dentist_single_window works with pre-computed R", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + set.seed(42) + z <- rnorm(ncol(X)) + result <- suppressWarnings(dentist_single_window(z, R = R, nSample = nrow(X))) + expect_true(is.data.frame(result)) + expect_equal(nrow(result), length(z)) +}) + +test_that("dentist_single_window detects injected outliers", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + R <- compute_LD(X, method = "sample") + set.seed(42) + z <- rnorm(ncol(X)) + # Inject extreme outliers + z[1] <- 50 + z[2] <- -50 + result <- suppressWarnings(dentist_single_window(z, R = R, nSample = nrow(X))) + # At least one of the injected values should be flagged + expect_true(any(result$outlier)) +}) + +# ─── dentist (multi-window) ───────────────────────────────────────────────── + +test_that("dentist works with genotype matrix and sum_stat data frame", { + skip_if_not_installed("pgenlibr") + geno <- load_test_genotype() + set.seed(42) + sum_stat <- data.frame( + pos = geno$variant_info$pos, + z = rnorm(ncol(geno$X)) + ) + # Use count mode with small window since we only have 100 variants + result <- suppressWarnings( + dentist(sum_stat, X = geno$X, window_mode = "count", min_dim = 50) + ) + expect_true(is.data.frame(result)) + # Window merging may add overlap rows; result should be >= input size + expect_true(nrow(result) >= nrow(sum_stat)) + expect_true(all(c("original_z", "imputed_z", "outlier") %in% names(result))) +}) + +test_that("dentist accepts zscore column name variant", { + skip_if_not_installed("pgenlibr") + geno <- load_test_genotype() + R <- compute_LD(geno$X, method = "sample") + set.seed(42) + sum_stat <- data.frame( + position = geno$variant_info$pos, + zscore = rnorm(ncol(geno$X)) + ) + result <- suppressWarnings( + dentist(sum_stat, R = R, nSample = nrow(geno$X), window_mode = "count", min_dim = 50) + ) + expect_true(nrow(result) >= nrow(sum_stat)) +}) + +test_that("dentist errors when sum_stat missing required columns", { + skip_if_not_installed("pgenlibr") + X <- load_test_genotype()$X + bad_stat <- data.frame(x = 1:ncol(X), y = rnorm(ncol(X))) + expect_error(dentist(bad_stat, X = X), "missing either") +}) diff --git a/tests/testthat/test_ld_loader.R b/tests/testthat/test_ld_loader.R index 3576794f8..489cf87c7 100644 --- a/tests/testthat/test_ld_loader.R +++ b/tests/testthat/test_ld_loader.R @@ -120,3 +120,123 @@ test_that("ld_loader with LD_info errors when missing LD_file column", { "LD_info must be a data.frame with column 'LD_file'" ) }) + +# =========================================================================== +# ld_loader: LD_info branch with real genotype fixtures +# =========================================================================== + +test_data_dir <- test_path("test_data") + +test_that("ld_loader LD_info loads LD from PLINK2 files", { + skip_if_not_installed("pgenlibr") + plink_prefix <- file.path(test_data_dir, "test_variants") + loader <- ld_loader(LD_info = data.frame(LD_file = plink_prefix)) + mat <- loader(1) + expect_true(is.matrix(mat)) + expect_equal(nrow(mat), 349L) + expect_equal(ncol(mat), 349L) + expect_true(isSymmetric(mat)) + expect_true(all(abs(diag(mat) - 1) < 1e-10)) +}) + +test_that("ld_loader LD_info loads LD from VCF file", { + skip_if_not_installed("VariantAnnotation") + vcf_path <- file.path(test_data_dir, "test_variants.vcf.gz") + loader <- ld_loader(LD_info = data.frame(LD_file = vcf_path)) + mat <- suppressWarnings(loader(1)) + expect_true(is.matrix(mat)) + expect_equal(nrow(mat), 349L) + expect_true(isSymmetric(mat)) +}) + +test_that("ld_loader LD_info loads LD from GDS file", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + gds_path <- file.path(test_data_dir, "test_variants.gds") + loader <- ld_loader(LD_info = data.frame(LD_file = gds_path)) + mat <- loader(1) + expect_true(is.matrix(mat)) + expect_equal(nrow(mat), 349L) + expect_true(isSymmetric(mat)) +}) + +test_that("ld_loader LD_info loads LD from PLINK1 files", { + skip_if_not_installed("snpStats") + plink1_prefix <- file.path(test_data_dir, "protocol_example.genotype") + loader <- ld_loader(LD_info = data.frame(LD_file = plink1_prefix)) + mat <- loader(1) + expect_true(is.matrix(mat)) + expect_true(isSymmetric(mat)) +}) + +test_that("ld_loader LD_info loads pre-computed .cor.xz blocks", { + ld_file <- file.path(test_data_dir, "LD_block_1.chr1_1000_1200.float16.txt.xz") + bim_file <- file.path(test_data_dir, "LD_block_1.chr1_1000_1200.float16.bim") + loader <- ld_loader(LD_info = data.frame(LD_file = ld_file, SNP_file = bim_file)) + mat <- loader(1) + expect_true(is.matrix(mat)) + expect_true(isSymmetric(mat)) + expect_true(nrow(mat) > 0) +}) + +test_that("ld_loader LD_info with max_variants subsamples", { + skip_if_not_installed("pgenlibr") + plink_prefix <- file.path(test_data_dir, "test_variants") + set.seed(42) + loader <- ld_loader(LD_info = data.frame(LD_file = plink_prefix), max_variants = 20) + mat <- loader(1) + expect_equal(nrow(mat), 20L) + expect_equal(ncol(mat), 20L) +}) + +test_that("ld_loader LD_info returns consistent LD across formats", { + skip_if_not_installed("pgenlibr") + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + plink_prefix <- file.path(test_data_dir, "test_variants") + gds_path <- file.path(test_data_dir, "test_variants.gds") + loader_plink <- ld_loader(LD_info = data.frame(LD_file = plink_prefix)) + loader_gds <- ld_loader(LD_info = data.frame(LD_file = gds_path)) + mat_plink <- loader_plink(1) + mat_gds <- loader_gds(1) + expect_equal(dim(mat_plink), dim(mat_gds)) +}) + +# =========================================================================== +# ld_loader: ld_meta_path branch with real genotype fixtures +# =========================================================================== + +test_that("ld_loader ld_meta_path loads LD from PLINK2 metadata", { + skip_if_not_installed("pgenlibr") + meta_file <- file.path(test_data_dir, "ld_meta_plink2_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines( + paste("chrom", "start", "end", "path", sep = "\t"), + meta_file + ) + cat(paste("21", "0", "0", "test_variants", sep = "\t"), "\n", + file = meta_file, append = TRUE) + region <- "chr21:17513228-17592874" + loader <- ld_loader(ld_meta_path = meta_file, regions = region) + mat <- loader(1) + expect_true(is.matrix(mat)) + expect_equal(nrow(mat), 349L) + expect_equal(ncol(mat), 349L) +}) + +test_that("ld_loader ld_meta_path loads LD from VCF metadata", { + skip_if_not_installed("VariantAnnotation") + meta_file <- file.path(test_data_dir, "ld_meta_vcf_tmp.tsv") + on.exit(unlink(meta_file), add = TRUE) + writeLines( + paste("chrom", "start", "end", "path", sep = "\t"), + meta_file + ) + cat(paste("21", "0", "0", "test_variants.vcf.gz", sep = "\t"), "\n", + file = meta_file, append = TRUE) + region <- "chr21:17513228-17592874" + loader <- ld_loader(ld_meta_path = meta_file, regions = region) + mat <- suppressWarnings(loader(1)) + expect_true(is.matrix(mat)) + expect_equal(nrow(mat), 349L) +}) diff --git a/tests/testthat/test_load_genotype.R b/tests/testthat/test_load_genotype.R new file mode 100644 index 000000000..3c35cd6c4 --- /dev/null +++ b/tests/testthat/test_load_genotype.R @@ -0,0 +1,241 @@ +# Tests for genotype loading functions: +# load_plink1_data, load_plink2_data, load_vcf_data, load_gds_data, +# load_genotype_region + +# Fixtures: 100 samples x 349 variants on chr21:17513228-17592874 +test_data_dir <- test_path("test_data") +plink_prefix <- file.path(test_data_dir, "test_variants") +vcf_path <- file.path(test_data_dir, "test_variants.vcf.gz") +gds_path <- file.path(test_data_dir, "test_variants.gds") +region_all <- "chr21:17513228-17592874" +region_sub <- "chr21:17513228-17550000" + +# Expected dimensions +n_samples <- 100L +n_variants <- 349L + +# Shared helper: validate the output structure from any loader +check_genotype_result <- function(result, expected_nrow = n_samples, expected_ncol = n_variants, + label = "") { + expect_true(is.list(result), label = paste(label, "is list")) + expect_named(result, c("X", "variant_info"), ignore.order = TRUE) + expect_true(is.matrix(result$X)) + expect_true(is.numeric(result$X)) + expect_equal(nrow(result$X), expected_nrow) + expect_equal(ncol(result$X), expected_ncol) + expect_true(is.data.frame(result$variant_info)) + expect_true(all(c("chrom", "id", "pos", "A2", "A1") %in% names(result$variant_info))) + expect_equal(nrow(result$variant_info), expected_ncol) + # Column names of X match variant IDs + expect_equal(colnames(result$X), result$variant_info$id) + # Dosage values should be non-negative integers (0, 1, 2 for biallelic; + # multiallelic VCF sites can have higher values) + vals <- result$X[!is.na(result$X)] + expect_true(all(vals >= 0), label = paste(label, "dosage non-negative")) + expect_true(all(vals == round(vals)), label = paste(label, "dosage integer-valued")) +} + +# ─── PLINK1 (snpStats) ─────────────────────────────────────────────────────── + +test_that("load_plink1_data loads all variants", { + skip_if_not_installed("snpStats") + result <- load_plink1_data(plink_prefix) + check_genotype_result(result, label = "plink1 all") +}) + +test_that("load_plink1_data filters by region", { + skip_if_not_installed("snpStats") + result <- load_plink1_data(plink_prefix, region = region_sub) + check_genotype_result(result, expected_ncol = 134L, label = "plink1 region") + expect_true(all(result$variant_info$pos >= 17513228 & result$variant_info$pos <= 17550000)) +}) + +test_that("load_plink1_data filters indels", { + skip_if_not_installed("snpStats") + result <- load_plink1_data(plink_prefix, keep_indel = FALSE) + # Should have fewer variants than 100 (fixture has indels) + expect_lt(ncol(result$X), n_variants) + # All remaining alleles should be single characters + expect_true(all(nchar(result$variant_info$A1) == 1)) + expect_true(all(nchar(result$variant_info$A2) == 1)) +}) + +test_that("load_plink1_data errors on missing files", { + skip_if_not_installed("snpStats") + expect_error(load_plink1_data("/nonexistent/path"), "not found") +}) + +test_that("load_plink1_data errors on empty region", { + skip_if_not_installed("snpStats") + expect_error(load_plink1_data(plink_prefix, region = "chr1:1-2"), class = "NoSNPsError") +}) + +# ─── PLINK2 (pgenlibr) ─────────────────────────────────────────────────────── + +test_that("load_plink2_data loads all variants", { + skip_if_not_installed("pgenlibr") + result <- load_plink2_data(plink_prefix) + check_genotype_result(result, label = "plink2 all") +}) + +test_that("load_plink2_data filters by region", { + skip_if_not_installed("pgenlibr") + result <- load_plink2_data(plink_prefix, region = region_sub) + check_genotype_result(result, expected_ncol = 134L, label = "plink2 region") + expect_true(all(result$variant_info$pos >= 17513228 & result$variant_info$pos <= 17550000)) +}) + +test_that("load_plink2_data filters indels", { + skip_if_not_installed("pgenlibr") + result <- load_plink2_data(plink_prefix, keep_indel = FALSE) + expect_lt(ncol(result$X), n_variants) + expect_true(all(nchar(result$variant_info$A1) == 1)) + expect_true(all(nchar(result$variant_info$A2) == 1)) +}) + +test_that("load_plink2_data errors on missing files", { + skip_if_not_installed("pgenlibr") + expect_error(load_plink2_data("/nonexistent/path"), "not found") +}) + +test_that("load_plink2_data errors on empty region", { + skip_if_not_installed("pgenlibr") + expect_error(load_plink2_data(plink_prefix, region = "chr1:1-2"), class = "NoSNPsError") +}) + +# ─── VCF (VariantAnnotation) ───────────────────────────────────────────────── + +test_that("load_vcf_data loads all variants", { + skip_if_not_installed("VariantAnnotation") + result <- suppressWarnings(load_vcf_data(vcf_path)) + check_genotype_result(result, label = "vcf all") +}) + +test_that("load_vcf_data filters by region", { + skip_if_not_installed("VariantAnnotation") + skip_if_not_installed("Rsamtools") + result <- suppressWarnings(load_vcf_data(vcf_path, region = region_sub)) + check_genotype_result(result, expected_ncol = 134L, label = "vcf region") + expect_true(all(result$variant_info$pos >= 17513228 & result$variant_info$pos <= 17550000)) +}) + +test_that("load_vcf_data filters indels", { + skip_if_not_installed("VariantAnnotation") + result <- suppressWarnings(load_vcf_data(vcf_path, keep_indel = FALSE)) + expect_lt(ncol(result$X), n_variants) + expect_true(all(nchar(result$variant_info$A1) == 1)) + expect_true(all(nchar(result$variant_info$A2) == 1)) +}) + +test_that("load_vcf_data errors on empty region", { + skip_if_not_installed("VariantAnnotation") + skip_if_not_installed("Rsamtools") + expect_error(suppressWarnings(load_vcf_data(vcf_path, region = "chr1:1-2"))) +}) + +# ─── GDS (SNPRelate) ───────────────────────────────────────────────────────── + +test_that("load_gds_data loads all variants", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + result <- load_gds_data(gds_path) + check_genotype_result(result, label = "gds all") +}) + +test_that("load_gds_data filters by region", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + result <- load_gds_data(gds_path, region = region_sub) + check_genotype_result(result, expected_ncol = 134L, label = "gds region") + expect_true(all(result$variant_info$pos >= 17513228 & result$variant_info$pos <= 17550000)) +}) + +test_that("load_gds_data filters indels", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + result <- load_gds_data(gds_path, keep_indel = FALSE) + expect_lt(ncol(result$X), n_variants) + expect_true(all(nchar(result$variant_info$A1) == 1)) + expect_true(all(nchar(result$variant_info$A2) == 1)) +}) + +test_that("load_gds_data errors on empty region", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + expect_error(load_gds_data(gds_path, region = "chr1:1-2"), class = "NoSNPsError") +}) + +# ─── Cross-format consistency ───────────────────────────────────────────────── + +test_that("all formats return same dimensions and positions", { + skip_if_not_installed("snpStats") + skip_if_not_installed("pgenlibr") + skip_if_not_installed("VariantAnnotation") + skip_if_not_installed("SNPRelate") + p1 <- load_plink1_data(plink_prefix) + p2 <- load_plink2_data(plink_prefix) + vcf <- suppressWarnings(load_vcf_data(vcf_path)) + gds <- load_gds_data(gds_path) + + # Same dimensions + expect_equal(dim(p1$X), dim(p2$X)) + expect_equal(dim(p1$X), dim(vcf$X)) + expect_equal(dim(p1$X), dim(gds$X)) + + # Same positions + expect_equal(p1$variant_info$pos, p2$variant_info$pos) + expect_equal(p1$variant_info$pos, vcf$variant_info$pos) + expect_equal(p1$variant_info$pos, gds$variant_info$pos) + + # Same variant IDs between PLINK formats + expect_equal(p1$variant_info$id, p2$variant_info$id) +}) + +test_that("PLINK1 and PLINK2 return consistent alleles", { + skip_if_not_installed("snpStats") + skip_if_not_installed("pgenlibr") + p1 <- load_plink1_data(plink_prefix) + p2 <- load_plink2_data(plink_prefix) + + expect_equal(p1$variant_info$A1, p2$variant_info$A1) + expect_equal(p1$variant_info$A2, p2$variant_info$A2) +}) + +# ─── load_genotype_region (dispatch) ───────────────────────────────────────── + +test_that("load_genotype_region dispatches to VCF by extension", { + skip_if_not_installed("VariantAnnotation") + result <- suppressWarnings(load_genotype_region(vcf_path, return_variant_info = TRUE)) + check_genotype_result(result, label = "dispatch vcf") +}) + +test_that("load_genotype_region dispatches to GDS by extension", { + skip_if_not_installed("SNPRelate") + skip_if_not_installed("gdsfmt") + result <- load_genotype_region(gds_path, return_variant_info = TRUE) + check_genotype_result(result, label = "dispatch gds") +}) + +test_that("load_genotype_region dispatches to PLINK2 by prefix", { + skip_if_not_installed("pgenlibr") + result <- load_genotype_region(plink_prefix, return_variant_info = TRUE) + check_genotype_result(result, label = "dispatch plink2") +}) + +test_that("load_genotype_region returns matrix when return_variant_info=FALSE", { + skip_if_not_installed("pgenlibr") + result <- load_genotype_region(plink_prefix) + expect_true(is.matrix(result)) + expect_equal(nrow(result), n_samples) + expect_equal(ncol(result), n_variants) +}) + +test_that("load_genotype_region applies region filter", { + skip_if_not_installed("pgenlibr") + result <- load_genotype_region(plink_prefix, region = region_sub, return_variant_info = TRUE) + expect_equal(ncol(result$X), 134L) +}) + +test_that("load_genotype_region errors on unrecognized format", { + expect_error(load_genotype_region("/nonexistent/file.xyz"), "not found") +}) diff --git a/tests/testthat/test_multivariate_pipeline.R b/tests/testthat/test_multivariate_pipeline.R index b74d95621..f08e711a4 100644 --- a/tests/testthat/test_multivariate_pipeline.R +++ b/tests/testthat/test_multivariate_pipeline.R @@ -148,9 +148,11 @@ test_that("multivariate_analysis_pipeline accepts maf of all ones past validatio ), error = function(e) e ) - # If it errors, the error should NOT be about maf validation + # Whether it succeeds or errors, the error should NOT be about maf validation if (inherits(result, "error")) { expect_false(grepl("maf values must be between", result$message)) + } else { + expect_true(is.list(result)) } }) @@ -236,9 +238,11 @@ test_that("pipeline with pip_cutoff_to_skip vector matching ncol(Y) is accepted" ), error = function(e) e ) - # If it errors, the error should not be about pip_cutoff_to_skip + # Whether it succeeds or errors, the error should not be about pip_cutoff_to_skip if (inherits(result, "error")) { expect_false(grepl("pip_cutoff_to_skip", result$message)) + } else { + expect_true(is.list(result)) } }) diff --git a/tests/testthat/test_slalom.R b/tests/testthat/test_slalom.R index a86bbcb82..011ad538e 100644 --- a/tests/testthat/test_slalom.R +++ b/tests/testthat/test_slalom.R @@ -12,7 +12,7 @@ make_synthetic_ld <- function(n_samples, n_snps, seed = 1) { L <- matrix(runif(n_factors * n_snps, -1, 1), nrow = n_factors) X_raw <- Z %*% L + matrix(rnorm(n_samples * n_snps, sd = 0.5), nrow = n_samples) # Discretise to genotype-like values (0, 1, 2) - X <- matrix(as.integer(cut(X_raw, breaks = c(-Inf, -0.5, 0.5, Inf)) - 1L), + X <- matrix(as.integer(cut(X_raw, breaks = c(-Inf, -0.5, 0.5, Inf))) - 1L, nrow = n_samples, ncol = n_snps) colnames(X) <- paste0("snp", seq_len(n_snps)) R <- cor(X) diff --git a/tests/testthat/test_twas.R b/tests/testthat/test_twas.R index 7dff17ef1..1ef488286 100644 --- a/tests/testthat/test_twas.R +++ b/tests/testthat/test_twas.R @@ -763,7 +763,7 @@ test_that("harmonize_gwas: computes z from beta and se when z is absent", { stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -810,7 +810,7 @@ test_that("harmonize_gwas: renames #chrom to chrom in tabix output", { colnames(df)[1] <- "#chrom" df }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -836,7 +836,7 @@ test_that("harmonize_gwas: uses load_rss_data when column_file_path is provided" stringsAsFactors = FALSE )) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -1079,7 +1079,7 @@ test_that("harmonize_gwas: rows with NA or Inf z are removed from output", { stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -1162,7 +1162,7 @@ test_that("harmonize_gwas: gwas_file with named path uses the name in the warnin expect_null(result) }) -test_that("harmonize_gwas: col_to_flip parameter is passed through to allele_qc", { +test_that("harmonize_gwas: col_to_flip parameter is passed through to match_ref_panel", { received_col_to_flip <- NULL local_mocked_bindings( tabix_region = function(file, region, ...) { @@ -1176,7 +1176,8 @@ test_that("harmonize_gwas: col_to_flip parameter is passed through to allele_qc" stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, col_to_flip = NULL, ...) { + standardise_sumstats_columns = function(sumstats, ...) sumstats, + match_ref_panel = function(target_data, ref_data, col_to_flip = NULL, ...) { received_col_to_flip <<- col_to_flip target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) @@ -1189,7 +1190,7 @@ test_that("harmonize_gwas: col_to_flip parameter is passed through to allele_qc" expect_equal(received_col_to_flip, c("beta", "z")) }) -test_that("harmonize_gwas: match_min_prop parameter is passed to allele_qc", { +test_that("harmonize_gwas: match_min_prop parameter is passed to match_ref_panel", { received_match_min_prop <- NULL local_mocked_bindings( tabix_region = function(file, region, ...) { @@ -1202,7 +1203,8 @@ test_that("harmonize_gwas: match_min_prop parameter is passed to allele_qc", { stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, col_to_flip = NULL, match_min_prop = 0.2, ...) { + standardise_sumstats_columns = function(sumstats, ...) sumstats, + match_ref_panel = function(target_data, ref_data, col_to_flip = NULL, match_min_prop = 0.2, ...) { received_match_min_prop <<- match_min_prop target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) @@ -1228,7 +1230,7 @@ test_that("harmonize_gwas: z computed from beta/se has correct values", { stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -1250,7 +1252,7 @@ test_that("harmonize_gwas: only keeps rows with finite non-NA z after allele_qc" stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -1336,7 +1338,7 @@ test_that("harmonize_gwas: existing z column is used directly", { stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -2335,7 +2337,7 @@ test_that("harmonize_gwas: complete flow with beta/se produces correct z-scores stringsAsFactors = FALSE ) }, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", target_data$A2, ":", target_data$A1) list(target_data_qced = target_data) } @@ -2761,7 +2763,7 @@ test_that("harmonize_twas: group_contexts_by_region single context path (lines 4 }, get_ref_variant_info = function(...) mock_snp_info, harmonize_gwas = function(...) mock_gwas_data, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { if (is.data.frame(target_data)) { if (!"variant_id" %in% colnames(target_data)) { target_data$variant_id <- if ("pos" %in% colnames(target_data)) { @@ -2876,7 +2878,7 @@ test_that("harmonize_twas: group_contexts_by_region multi-context clustering (li }, get_ref_variant_info = function(...) mock_snp_info, harmonize_gwas = function(...) mock_gwas_data, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { if (is.data.frame(target_data)) { if (!"variant_id" %in% colnames(target_data)) { target_data$variant_id <- if ("pos" %in% colnames(target_data)) { @@ -3296,7 +3298,7 @@ test_that("harmonize_twas: duplicated LD variants are removed", { list(LD_matrix = dup_LD_matrix, LD_variants = dup_variant_ids, ref_panel = dup_ref_panel) }, harmonize_gwas = function(...) mock_gwas_data, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { if (is.data.frame(target_data)) { if (!"variant_id" %in% colnames(target_data)) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":", @@ -3358,7 +3360,7 @@ test_that("harmonize_twas: drops molecular_id when harmonize_gwas returns NULL f }, # Returning NULL skips the entire context loop, so gwas_qced stays empty harmonize_gwas = function(...) NULL, - allele_qc = function(target_data, ref_data, ...) list(target_data_qced = target_data) + match_ref_panel = function(target_data, ref_data, ...) list(target_data_qced = target_data) ) gwas_meta <- data.frame( @@ -3427,7 +3429,7 @@ test_that("harmonize_twas: susie_weights column triggers adjust_susie_weights br list(LD_matrix = LD_matrix, LD_variants = variant_ids, ref_panel = ref_panel) }, harmonize_gwas = function(...) mock_gwas_data, - allele_qc = function(target_data, ref_data, ...) { + match_ref_panel = function(target_data, ref_data, ...) { if (is.data.frame(target_data)) { if (!"variant_id" %in% colnames(target_data)) { target_data$variant_id <- paste0("chr", target_data$chrom, ":", target_data$pos, ":",