From fdca90585ebc1fb3eac47e1be9004212487b8bc0 Mon Sep 17 00:00:00 2001 From: Michael Levin Date: Thu, 21 Mar 2024 09:41:32 -0400 Subject: [PATCH] allow missing samplesize columns in metal config --- R/annotate_rsids.R | 11 ++--- R/calc_credset.R | 9 ++-- R/coloc_run.R | 64 +++++++++++++------------- R/gg_manhattan_df.R | 1 - R/gg_qq_df.R | 1 - R/hyprcoloc_df.R | 5 +- R/ldak_h2.R | 27 ++++++----- R/magmar.R | 6 +-- R/metal_config.R | 40 +++++++++++----- R/metal_run.R | 5 +- R/plink_extract_ld.R | 22 +++++---- R/populate_targets_proj.R | 25 +++++----- R/render_datatable.R | 1 - R/run_carma.R | 42 ++++++++--------- R/s_multixcan.R | 19 ++------ R/s_predixcan.R | 7 ++- R/use_crew_lsf.R | 5 +- dev/flat_genomics_functions.Rmd | 40 +++++++++++----- man/metal_config.Rd | 6 +-- tests/testthat/test-annotate_rsids.R | 2 +- tests/testthat/test-calc_credset.R | 2 +- tests/testthat/test-coloc_run.R | 15 +++--- tests/testthat/test-gg_manhattan_df.R | 2 +- tests/testthat/test-hyprcoloc_df.R | 20 ++++---- tests/testthat/test-ldak_h2.R | 2 +- tests/testthat/test-magmar.R | 2 +- tests/testthat/test-metal_config.R | 2 +- tests/testthat/test-metal_run.R | 2 +- tests/testthat/test-mr_mega.R | 2 +- tests/testthat/test-plink_extract_ld.R | 2 +- tests/testthat/test-run_carma.R | 2 +- tests/testthat/test-s_multixcan.R | 2 +- tests/testthat/test-s_predixcan.R | 2 +- tests/testthat/test-use_crew_lsf.R | 12 ++--- vignettes/genomics-functions.Rmd | 2 +- 35 files changed, 215 insertions(+), 194 deletions(-) diff --git a/R/annotate_rsids.R b/R/annotate_rsids.R index bb532c3..a08a543 100644 --- a/R/annotate_rsids.R +++ b/R/annotate_rsids.R @@ -1,24 +1,23 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Annotate a dataframe containing genomic coordinates with rsids -#' +#' #' This function can be used rapidly add rsids to GWAS summary statistics or any other dataframe containing genomic coordinates (eg. chromosome and position). This is a rapid function that does not explicitly account for differences in variants at each position, strand flips, etc.) -#' +#' #' @param df Dataframe containing genomic coordinates to annotate with rsid #' @param dbSNP Bioconductor object containing SNP locations and alleles to be used for annotation (default: `SNPlocs.Hsapiens.dbSNP144.GRCh37::SNPlocs.Hsapiens.dbSNP144.GRCh37`) -#' @param chrom_col Chromosome column +#' @param chrom_col Chromosome column #' @param pos_col Position column #' #' @return A dataframe containing the original contents, with an additional `rsid` column. -#' +#' #' @export -#' @concept genomics +#' @concept genomics #' @family {annotation} #' @examples #' \dontrun{ #' annotate_rsids(sumstats_df) #' } - annotate_rsids <- function(df, dbSNP = SNPlocs.Hsapiens.dbSNP144.GRCh37::SNPlocs.Hsapiens.dbSNP144.GRCh37, chrom_col = Chromosome, pos_col = Position) { if (sum(stringr::str_detect(names(df), "rsid")) > 0) { cli::cli_abort("A column named 'rsid' is already present") diff --git a/R/calc_credset.R b/R/calc_credset.R index 47646fb..47da378 100644 --- a/R/calc_credset.R +++ b/R/calc_credset.R @@ -1,18 +1,18 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Perform Bayesian finemapping using the Approximate Bayes Factor approach -#' +#' #' Description -#' +#' #' @param df Dataframe containing GWAS summary statistics -#' @param locus_marker_col Column containing a locus-level identifier +#' @param locus_marker_col Column containing a locus-level identifier #' @param effect_col Column containing effect estimates #' @param se_col Column containing standard errors fo the effect estimates #' @param samplesize_col Column containing sample sizes #' @param cred_interval Credible interval for the fine-mapped credible sets (default = 0.99; 0.95 is another common but artbitrarily determined interval) #' #' @return A data.frame containing credible sets at each locus. For each variant within the credible set, the prior probability of being the casual variant is provided. -#' +#' #' @export #' @family {finemapping} #' @concept genomics @@ -20,7 +20,6 @@ #' \dontrun{ #' calc_credset(gwas_df) #' } - calc_credset <- function(df, locus_marker_col = locus_marker, effect_col = effect, se_col = std_err, samplesize_col = samplesize, cred_interval = 0.99) { df %>% group_by({{ locus_marker_col }}) %>% diff --git a/R/coloc_run.R b/R/coloc_run.R index 7fac2e0..40c893e 100644 --- a/R/coloc_run.R +++ b/R/coloc_run.R @@ -1,9 +1,9 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Run Bayesian enumeration colocalization using Coloc -#' +#' #' This function is a wrapper around [coloc::coloc.abf()] that takes a dataframe as input, and performs colocalization under the single-causal-variant assumption. Coloc was described in Giambartolomei et al. (PLOS Genetics 2014; ). -#' +#' #' @param df Dataframe containing summary statistics at a single locus for two traits in a "long" format, with one row per variant per trait. #' @param trait_col Column containing trait names #' @param variant_col Column containing unique variant identifiers (Eg. rsids, chr:pos) @@ -21,7 +21,7 @@ #' @return A list containing coloc results. #' - `summary` is a named vector containing the number of snps, and the posterior probabilities of the 5 colocalization hypotheses #' - `results` is an annotated version of the input data containing log approximate Bayes Factors and posterior probability of each SNP being causal if H4 is true. -#' +#' #' @concept genomics #' @family {colocalization} #' @export @@ -29,47 +29,49 @@ #' \dontrun{ #' coloc_run(locus_df) #' } - coloc_run <- function(df, trait_col = trait, variant_col = rsid, beta_col = beta, se_col = se, samplesize_col = samplesize, maf_col = maf, type_col = type, case_prop_col = case_prop, p1 = 1e-4, p2 = 1e-4, p12 = 1e-5, ...) { - -df <- df %>% - select(trait = {{trait_col}}, maf = {{maf_col}}, type = {{type_col}}, variant_id = {{variant_col}}, beta = {{beta_col}}, se = {{se_col}}, samplesize = {{samplesize_col}}, case_prop = {{case_prop_col}}) %>% + df <- df %>% + select(trait = {{ trait_col }}, maf = {{ maf_col }}, type = {{ type_col }}, variant_id = {{ variant_col }}, beta = {{ beta_col }}, se = {{ se_col }}, samplesize = {{ samplesize_col }}, case_prop = {{ case_prop_col }}) %>% add_count(variant_id) %>% filter(n == 2) - + trait_dfs <- df %>% distinct(trait) - - if(nrow(trait_dfs) != 2) { + + if (nrow(trait_dfs) != 2) { cli::cli_abort("The input dataframe must contain only two traits") } - + trait1 <- df %>% filter(trait == trait_dfs$trait[1]) %>% distinct(variant_id, .keep_all = TRUE) - + trait2 <- df %>% filter(trait == trait_dfs$trait[2]) %>% distinct(variant_id, .keep_all = TRUE) - - trait1_dataset <- list(beta = trait1$beta, #If log_OR column is full of NAs then use beta column instead - varbeta = trait1$se^2, - # pvalues = trait1$pval, - type = unique(trait1$type), - snp = trait1$variant_id, - N = trait1$samplesize, - # {if(unique(trait1$type) == "cc") {s = trait1$case_prop[1]}}, - MAF = trait1$maf) - - trait2_dataset <- list(beta = trait2$beta, #If log_OR column is full of NAs then use beta column instead - varbeta = trait2$se^2, - # pvalues = trait2$pval, - type = unique(trait2$type), - snp = trait2$variant_id, - N = trait2$samplesize, - # {if(unique(trait2$type) == "cc") {s = trait1$case_prop[2]}}, - MAF = trait2$maf) - + + trait1_dataset <- list( + beta = trait1$beta, # If log_OR column is full of NAs then use beta column instead + varbeta = trait1$se^2, + # pvalues = trait1$pval, + type = unique(trait1$type), + snp = trait1$variant_id, + N = trait1$samplesize, + # {if(unique(trait1$type) == "cc") {s = trait1$case_prop[1]}}, + MAF = trait1$maf + ) + + trait2_dataset <- list( + beta = trait2$beta, # If log_OR column is full of NAs then use beta column instead + varbeta = trait2$se^2, + # pvalues = trait2$pval, + type = unique(trait2$type), + snp = trait2$variant_id, + N = trait2$samplesize, + # {if(unique(trait2$type) == "cc") {s = trait1$case_prop[2]}}, + MAF = trait2$maf + ) + suppressWarnings(coloc_res <- coloc::coloc.abf(dataset1 = trait1_dataset, dataset2 = trait2_dataset, p1 = p1, p2 = p2, p12 = p12, ...)) return(coloc_res) } diff --git a/R/gg_manhattan_df.R b/R/gg_manhattan_df.R index ee5358b..0570bd0 100644 --- a/R/gg_manhattan_df.R +++ b/R/gg_manhattan_df.R @@ -26,7 +26,6 @@ #' \dontrun{ #' gg_manhattan_df(sumstats_df) #' } - gg_manhattan_df <- function(sumstats_df, annotation_df = NULL, chr_col = chromosome, pos_col = position, pval_col = p_value, pval_threshold = 0.001, label_col = gene, build = "hg19", color1 = "#045ea7", color2 = "#82afd3", speed = "slow", ...) { if (!is.null((annotation_df))) { df <- sumstats_df %>% diff --git a/R/gg_qq_df.R b/R/gg_qq_df.R index bcacc7b..f429aa2 100644 --- a/R/gg_qq_df.R +++ b/R/gg_qq_df.R @@ -18,7 +18,6 @@ #' \dontrun{ #' gg_qq_df(sumstats_df) #' } - gg_qq_df <- function(sumstats_df, pval_col = p_value, ...) { df <- sumstats_df %>% select(pvalue = {{ pval_col }}) %>% diff --git a/R/hyprcoloc_df.R b/R/hyprcoloc_df.R index 37aff87..bc6b8f1 100644 --- a/R/hyprcoloc_df.R +++ b/R/hyprcoloc_df.R @@ -1,9 +1,9 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Run multi-trait colocalization using HyPrColoc -#' +#' #' This function is a convenience wrapper around [hyprcoloc::hyprcoloc()] that takes a dataframe as input, and performs mutli-trait colocalization. Details of the HyPrColoc method are described in Foley et al. (Nature Communications 2021; ). -#' +#' #' @param df Dataframe containing summary statistics at a single locus, in a "long" format, with one row per variant per trait. #' @param trait_col Column containing trait names #' @param snp_col Column containing variant names (eg. rsid, marker_name), which should be consistent across studies @@ -22,7 +22,6 @@ #' \dontrun{ #' hyprcoloc_df(gwas_results_df) #' } - hyprcoloc_df <- function(df, trait_col = trait, snp_col = rsid, beta_col = beta, se_col = se, type_col = type, ...) { df <- df %>% select(trait = {{ trait_col }}, rsid = {{ snp_col }}, beta.exposure = {{ beta_col }}, se.exposure = {{ se_col }}, type = {{ type_col }}) %>% diff --git a/R/ldak_h2.R b/R/ldak_h2.R index 21bb8ea..3267567 100644 --- a/R/ldak_h2.R +++ b/R/ldak_h2.R @@ -1,15 +1,15 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Calculate heritability using LDAK -#' +#' #' This function wraps LDAK, a command-line tool for estimating heritability. The tool and associated reference files can be download from the LDAK website (). The method is described in Zhang et al. (Nature Communications 2021; % - read_delim(col_names = c("category", "annotation"), delim = " ") %>% - mutate(binary = str_detect(annotation, "\\*")) %>% - mutate(annotation = str_replace(annotation, "\\*", "")) + read_delim(col_names = c("category", "annotation"), delim = " ") %>% + mutate(binary = str_detect(annotation, "\\*")) %>% + mutate(annotation = str_replace(annotation, "\\*", "")) # read files cli::cli_progress_step("Reading files") @@ -123,8 +122,12 @@ ldak_h2 <- function(sumstats_file, ldak_bin, ldak_tagfile, sample_prev = NULL, p "--summary", ldak_in, "--tagfile", ldak_tagfile, "--check-sums", "NO", - if(!is.null(population_prev)){c("--prevalence", population_prev)}, - if(!is.null(sample_prev)){c("--ascertainment", sample_prev)}, + if (!is.null(population_prev)) { + c("--prevalence", population_prev) + }, + if (!is.null(sample_prev)) { + c("--ascertainment", sample_prev) + }, "--cutoff", ldak_cutoff ), error_on_status = FALSE, diff --git a/R/magmar.R b/R/magmar.R index c4cbbff..0a6de19 100644 --- a/R/magmar.R +++ b/R/magmar.R @@ -1,9 +1,9 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Run MAGMA gene-based analysis -#' +#' #' This function provides a wrapper to MAGMA, which performs gene-based testing from GWAS summary statistics. Details of MAGMA described in de Leeuw et al. (PLoS Cumputational Biology 2015; ). The MAGMA binary and reference files are available from the Complex Trait Genetics lab (). -#' +#' #' @param sumstats_df Dataframe containing GWAS summary statistics #' @param pval_col Column containing p-values #' @param snp_col Column containing rsids @@ -17,7 +17,7 @@ #' @concept genomics #' @family Gene-based testing #' @export -#' +#' #' @examples #' \dontrun{ #' magmar(sumstats_df, magma_bin = "/path/to/magma", bfile = "/path/to/bfiles", gene_file = "/path/to/genes", out_file = "magma_output") diff --git a/R/metal_config.R b/R/metal_config.R index 4b40bd8..3e565d3 100644 --- a/R/metal_config.R +++ b/R/metal_config.R @@ -33,8 +33,7 @@ #' metal_config(config_name = "name-of-analysis", output_dir = "/path/to/output/", study_files = c("/path/to/sumstats_1.txt", "/path/to/sumstats_2.txt)) #' } -metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR", AVERAGEFREQ = "ON", MINMAXFREQ = "OFF", TRACKPOSITIONS = "ON", MARKERLABEL = "MARKER", CHROMOSOMELABEL = "CHROM", POSITIONLABEL = "POS", EFFECT_ALLELE = "EFFECT_ALLELE", OTHER_ALLELE = "OTHER_ALLELE", EFFECTLABEL = "BETA", STDERR = "SE", FREQLABEL = "EAF", NCASE = "N_CASE", NCONTROL = "N_CONTROL", SAMPLESIZE = "N") { - +metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR", AVERAGEFREQ = "ON", MINMAXFREQ = "OFF", TRACKPOSITIONS = "ON", MARKERLABEL = "MARKER", CHROMOSOMELABEL = "CHROM", POSITIONLABEL = "POS", EFFECT_ALLELE = "EFFECT_ALLELE", OTHER_ALLELE = "OTHER_ALLELE", EFFECTLABEL = "BETA", STDERR = "SE", FREQLABEL = "EAF", NCASE = NULL, NCONTROL = NULL, SAMPLESIZE = NULL) { fs::dir_create(output_dir, recurse = TRUE) config_outfile <- fs::path(output_dir, paste0(config_name, "_metal-config.txt")) @@ -46,7 +45,7 @@ metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR" "SCHEME {SCHEME} AVERAGEFREQ {AVERAGEFREQ} MINMAXFREQ {MINMAXFREQ} - TRACKPOSITIONs {TRACKPOSITIONS} + TRACKPOSITIONS {TRACKPOSITIONS} MARKERLABEL {MARKERLABEL} CHROMOSOMELABEL {CHROMOSOMELABEL} POSITIONLABEL {POSITIONLABEL} @@ -54,24 +53,41 @@ metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR" EFFECTLABEL {EFFECTLABEL} STDERR {STDERR} FREQLABEL {FREQLABEL} - + + " + ) + + if (!is.null(NCASE)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE NCASE LABEL NCASE as {NCASE} - + ") + } + + if (!is.null(NCONTROL)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE NCONTROL - LABEL NCONTROL as {NCONTROL} - + LABEL NCONTROL as {NCONTROL}") + } + + if (!is.null(SAMPLESIZE)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE SAMPLESIZE - LABEL SAMPLESIZE as {SAMPLESIZE} - + LABEL SAMPLESIZE as {SAMPLESIZE}") + } + + config_text <- glue::glue(" + {config_text} + {study_files} OUTFILE {meta_outfile}_metal- .txt ANALYZE HETEROGENEITY - QUIT - " - ) + QUIT") readr::write_lines(x = config_text, file = config_outfile) diff --git a/R/metal_run.R b/R/metal_run.R index a449cc6..fd87f90 100644 --- a/R/metal_run.R +++ b/R/metal_run.R @@ -1,9 +1,9 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Use METAL to run a GWAS meta-analysis -#' +#' #' This function is a wrapper for METAL, a tool for performing meta-analysis of GWAS summary statistics . Details of the arguments to METAL are described in the METAL documentation: . -#' +#' #' @param config_file (path) Path to a METAL configuration file (this can be generated using [levinmisc::metal_config()]) #' @param metal_path (path) Path to the METAL binary #' @@ -16,7 +16,6 @@ #' \dontrun{ #' metal_run(config_file = "config.txt", metal_path = "/path/to/metal_binary") #' } - metal_run <- function(config_file, metal_path) { metal_path <- normalizePath(metal_path) config_file <- normalizePath(config_file) diff --git a/R/plink_extract_ld.R b/R/plink_extract_ld.R index 51854ad..ce9a9bb 100644 --- a/R/plink_extract_ld.R +++ b/R/plink_extract_ld.R @@ -15,20 +15,22 @@ #' @export #' @concept genomics #' @family {linkage disequilibrium} -#' +#' #' @examples #' \dontrun{ #' plink_extract_ld(df, snp_col, effect_allele_col, metric = "r", bfile = "/path/to/reference/panel/", plink_bin = "/path/to/plink1.9") #' } -plink_extract_ld <- function(df, snp_col, effect_allele_col, metric = "r", bfile, threads = 1, memory = 16000, +plink_extract_ld <- function(df, snp_col, effect_allele_col, metric = "r", bfile, threads = 1, memory = 16000, plink_bin) { + snp_id <- df %>% + select(SNP = {{ snp_col }}) %>% + head(1) %>% + pull(SNP) - snp_id <- df %>% select(SNP = {{snp_col}}) %>% head(1) %>% pull(SNP) - snp_file <- fs::file_temp(pattern = snp_id) ld_dir <- fs::path_temp(snp_id) - + fs::dir_create(ld_dir, recurse = TRUE) df %>% @@ -36,7 +38,7 @@ plink_extract_ld <- function(df, snp_col, effect_allele_col, metric = "r", bfile write_tsv(snp_file, col_names = FALSE) cli::cli_alert_info("Extracting LD") - + processx::run(plink_bin, args = c( "--threads", threads, @@ -53,10 +55,10 @@ plink_extract_ld <- function(df, snp_col, effect_allele_col, metric = "r", bfile echo = TRUE ) - ld_matrix <- data.table::fread(fs::path(ld_dir, "LD.ld.gz"), col.names = df %>% pull({{snp_col}})) %>% + ld_matrix <- data.table::fread(fs::path(ld_dir, "LD.ld.gz"), col.names = df %>% pull({{ snp_col }})) %>% as.matrix() - - rownames(ld_matrix) <- df %>% pull({{snp_col}}) - + + rownames(ld_matrix) <- df %>% pull({{ snp_col }}) + return(ld_matrix) } diff --git a/R/populate_targets_proj.R b/R/populate_targets_proj.R index ce60184..56c9e2c 100644 --- a/R/populate_targets_proj.R +++ b/R/populate_targets_proj.R @@ -1,7 +1,7 @@ # WARNING - Generated by {fusen} from dev/LPC_targets_project.Rmd: do not edit by hand #' Create a minimal targets template in the current project -#' +#' #' @description #' This function creates a minimal targets template in the current directory. This includes creating a `Pipelines.qmd` file containing boilerplate for running analyses, and a `Results.qmd` file which can be used to visualize the results. Parallelization of the pipeline is implemented using [targets::tar_make()] and `crew.cluster`, using pre-filled using parameters specific to the LPC system at Penn. #' @@ -15,7 +15,6 @@ #' \dontrun{ #' populate_targets_proj("test") #' } - populate_targets_proj <- function(title, log_folder = "build_logs", overwrite = FALSE) { @@ -37,26 +36,30 @@ populate_targets_proj <- function(title, # Copy batch script for job submission usethis::use_template(".make-targets.sh", - save_as = ".make-targets.sh", - package = "levinmisc") + save_as = ".make-targets.sh", + package = "levinmisc" + ) cli::cli_alert_success("Submission template created at {.file .make-targets.sh}") # Copy batch script to submit targets job usethis::use_template("submit-targets.sh", - save_as = "submit-targets.sh", - package = "levinmisc") + save_as = "submit-targets.sh", + package = "levinmisc" + ) cli::cli_alert_success("Targets submission script created at {.file submit-targets.sh}") # Copy targets pipeline template usethis::use_template("Pipeline.qmd", - save_as = paste0(title, "-Pipeline.qmd"), - data = list(global_options = levinmisc::use_crew_lsf()), - package = "levinmisc") + save_as = paste0(title, "-Pipeline.qmd"), + data = list(global_options = levinmisc::use_crew_lsf()), + package = "levinmisc" + ) cli::cli_alert_success("Targets Pipeline template created at {.file {paste0(title, '-Pipeline.qmd')}}") # Copy targets results template usethis::use_template("Results.qmd", - save_as = paste0(title, "-Results.qmd"), - package = "levinmisc") + save_as = paste0(title, "-Results.qmd"), + package = "levinmisc" + ) cli::cli_alert_success("Targets Results template created at {.file {paste0(title, '-Results.qmd')}}") } diff --git a/R/render_datatable.R b/R/render_datatable.R index 68984cd..5741bd7 100644 --- a/R/render_datatable.R +++ b/R/render_datatable.R @@ -19,7 +19,6 @@ #' @concept miscellaneous #' @examples #' render_datatable(datasets::mtcars) - render_datatable <- function(df, extensions = c("Buttons"), class = c("compact", "stripe", "hover", "row-border"), diff --git a/R/run_carma.R b/R/run_carma.R index bd2ddbb..ab246cb 100644 --- a/R/run_carma.R +++ b/R/run_carma.R @@ -1,7 +1,7 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Perform Bayesian finemapping using CARMA -#' +#' #' This function is a wrapper around [CARMA::CARMA()] that takes a dataframe containing variants at a locus and performs Bayesian finemapping based on their signed z-scores and an LD reference panel. The function requires a plink-formatted LD reference panel (`bfile`), which will be used to generate a signed LD matrix at the locus. CARMA was described in Yang et al. (Nature Genetics 2023; ) #' #' @param df Dataframe containing variants at a locus for finemapping @@ -16,7 +16,7 @@ #' @param ... additional arguments passsed to [CARMA::CARMA()] #' #' @return A dataframe containing the input dataframe, and additional columns denoting which credible set (`CS`) each variant belongs to, as well as the posterior inclusion probability (`PIP`), and an `ld_error` column noting whether there were problems generating the LD matrix that limited fine-mapping. -#' +#' #' @export #' @family {finemapping} #' @concept genomics @@ -24,41 +24,39 @@ #' \dontrun{ #' run_carma(locus_df, snp_col = SNP, z_col = z, effect_allele_col = allele1) #' } - run_carma <- function(df, snp_col, z_col, effect_allele_col, outlier_switch = TRUE, bfile, threads = 1, memory = 16000, plink_bin, ...) { - sumstat <- df - - plink_extract_ld_possibly <- purrr::possibly(levinmisc::plink_extract_ld) - + + plink_extract_ld_possibly <- purrr::possibly(levinmisc::plink_extract_ld) + ld <- df %>% - plink_extract_ld_possibly(bfile = bfile, plink_bin = plink_bin, snp_col = {{snp_col}}, effect_allele_col = {{effect_allele_col}}) - - if(is.null(ld)) { + plink_extract_ld_possibly(bfile = bfile, plink_bin = plink_bin, snp_col = {{ snp_col }}, effect_allele_col = {{ effect_allele_col }}) + + if (is.null(ld)) { return(sumstat %>% mutate(ld_error = TRUE)) } - + # if(!is.null(ld$error)) { # sumstat <- sumstat %>% # mutate(ld = ld$error) # return(sumstat) # } - + cli::cli_alert_info("Running CARMA") - z.list<-list() - ld.list<-list() - lambda.list<-list() - z.list[[1]] <- sumstat %>% pull({{z_col}}) + z.list <- list() + ld.list <- list() + lambda.list <- list() + z.list[[1]] <- sumstat %>% pull({{ z_col }}) ld.list[[1]] <- as.matrix(ld) lambda.list[[1]] <- 1 - CARMA.results <- CARMA::CARMA(z.list, ld.list, lambda.list=lambda.list, outlier.switch = outlier_switch, ...) - + CARMA.results <- CARMA::CARMA(z.list, ld.list, lambda.list = lambda.list, outlier.switch = outlier_switch, ...) + sumstat.result <- sumstat %>% mutate(PIP = CARMA.results[[1]]$PIPs, CS = 0) - if(length(CARMA.results[[1]]$`Credible set`[[2]])!=0){ - for(l in 1:length(CARMA.results[[1]]$`Credible set`[[2]])){ - sumstat.result$CS[CARMA.results[[1]]$`Credible set`[[2]][[l]]]=l + if (length(CARMA.results[[1]]$`Credible set`[[2]]) != 0) { + for (l in 1:length(CARMA.results[[1]]$`Credible set`[[2]])) { + sumstat.result$CS[CARMA.results[[1]]$`Credible set`[[2]][[l]]] <- l } } - + return(sumstat.result) } diff --git a/R/s_multixcan.R b/R/s_multixcan.R index 7c3f469..6b287ca 100644 --- a/R/s_multixcan.R +++ b/R/s_multixcan.R @@ -1,8 +1,8 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Integrate PrediXcan data across tissues -#' -#' This function is a wrapper around S-MultiXcan, a tool for identifying genes associate with a trait using GWAS summary statistics. This approach leverages the sharing of eQTLs acorss tissues to improve upon tissue-specific TWAS-methods like S-PrediXcan. This method uses data generated by [levinmisc::s_predixcan()]. The S-MultiXcan method was described in Barbeira et al. (PLOS Genetics 2019; ). The MetaXcan tools can be found on Github () and PredictDB (). +#' +#' This function is a wrapper around S-MultiXcan, a tool for identifying genes associate with a trait using GWAS summary statistics. This approach leverages the sharing of eQTLs acorss tissues to improve upon tissue-specific TWAS-methods like S-PrediXcan. This method uses data generated by [levinmisc::s_predixcan()]. The S-MultiXcan method was described in Barbeira et al. (PLOS Genetics 2019; ). The MetaXcan tools can be found on Github () and PredictDB (). #' @param df Dataframe containing GWAS summary statistics #' @param snp Column containing rsids @@ -28,7 +28,7 @@ #' @param models_name_pattern Filter used to extract trait name from the model (default = `"mashr_(.*)\\.db"`) #' @param snp_covariance Path to file containing S-MultiXcan covariance (eg. `"MetaXcan/data/models/gtex_v8_expression_mashr_snp_smultixcan_covariance.txt.gz"`) #' @param data Path to MetaXcan data (eg. `"MetaXcan/data"`) -#' @param metaxcan Path to MetaXcan (eg. `"MetaXcan/software"`) +#' @param metaxcan Path to MetaXcan (eg. `"MetaXcan/software"`) #' #' @return A dataframe containing S-MultiXcan results #' @import dplyr @@ -37,19 +37,6 @@ #' @family Gene-based testing #' @concept genomics #' @examples -#' \dontrun{ -#' s_multixcan(df, -#' models_folder = "MetaXcan/data/models/eqtl/mashr/", -#' models_name_filter = ".*\\.db", -#' models_name_pattern = "mashr_(.*)\\.db", -#' metaxcan_folder = "/path/to/metaxcan_files/, -#' metaxcan_filter = "GWAS-trait_mashr_(.*)_S-prediXcan.csv", -#' metaxcan_file_name_parse_pattern = "(.*)_mashr_(.*)_S-prediXcan.csv", -#' data = "MetaXcan/data", -#' metaxcan = "MetaXcan/software", -#' snp_covariance = "MetaXcan/data/models/gtex_v8_expression_mashr_snp_smultixcan_covariance.txt.gz") -#' } - s_multixcan <- function(df, models_folder, models_name_filter = ".*db", models_name_pattern, snp = SNP, effect_allele = effect_allele, other_allele = other_allele, beta = beta, eaf = eaf, chr = chr, pos = pos, se = se, pval = pval, samplesize = samplesize, regularization = 0.01, cutoff_condition_number = 30, cutoff_eigen_ratio = 0.001, cutoff_threshold = 0.4, cutoff_trace_ratio = 0.01, metaxcan_folder, metaxcan_filter, metaxcan_file_name_parse_pattern, snp_covariance, metaxcan, data) { cli::cli_alert_info("Formatting summary statistics") diff --git a/R/s_predixcan.R b/R/s_predixcan.R index de586bc..902c742 100644 --- a/R/s_predixcan.R +++ b/R/s_predixcan.R @@ -1,7 +1,7 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand #' Run a TWAS using S-PrediXcan -#' +#' #' This function is a wrapper around S-PrediXcan, a method of integrating GWAS summary statistics with gene-expression/splicing data to identify genes associated with a trait. The PrediXcan/MetaXcan method is described in Barbeira et al. (Nature Communications 2018; ). The MetaXcan tools can be found on Github () and PredictDB (). If S-PrediXcan is run across multiple tissues, the results can be integrated using [levinmisc::s_multixcan()]. #' @param df Dataframe containing GWAS summary statistics @@ -16,7 +16,7 @@ #' @param pval Column containing p-value #' @param samplesize Column containing samplesize #' @param data Path to MetaXcan data (eg. `"MetaXcan/data"`) -#' @param metaxcan Path to MetaXcan (eg. `"MetaXcan/software"`) +#' @param metaxcan Path to MetaXcan (eg. `"MetaXcan/software"`) #' @param output Output directory to save S-PrediXcan results #' @param model_db_path Path to PrediXcan model database #' @param model_covariance_path Path to PrediXcan model covariance @@ -32,7 +32,6 @@ #' \dontrun{ #' s_predixcan(df, data = "MetaXcan/data", metaxcan = "MetaXcan/software", output = "/path/to/output", model_db_path = "MetaXcan/data/models/eqtl/mashr/mashr_Liver.db", model_covariance_path = "MetaXcan/data/models/eqtl/mashr/mashr_Liver.txt.gz", trait_name = "GWAS_trait") #' } - s_predixcan <- function(df, snp = SNP, effect_allele = effect_allele, other_allele = other_allele, beta = beta, eaf = eaf, chr = chr, pos = pos, se = se, pval = pval, samplesize = samplesize, data, metaxcan, output, model_db_path, model_covariance_path, trait_name) { fs::dir_create(output, recurse = TRUE) @@ -42,7 +41,7 @@ s_predixcan <- function(df, snp = SNP, effect_allele = effect_allele, other_alle df %>% select(rsid = {{ snp }}, noneffect_allele = {{ other_allele }}, effect_allele = {{ effect_allele }}, effect = {{ beta }}, p_value = {{ pval }}) %>% vroom::vroom_write(.fn) - + .eqtl_name <- fs::path_file(model_db_path) %>% str_replace("\\.db$", "") .harmonize <- paste0( "export DATA=", shQuote(data, type = shell), diff --git a/R/use_crew_lsf.R b/R/use_crew_lsf.R index 927c309..7b417f2 100644 --- a/R/use_crew_lsf.R +++ b/R/use_crew_lsf.R @@ -1,10 +1,10 @@ # WARNING - Generated by {fusen} from dev/LPC_targets_project.Rmd: do not edit by hand #' Use crew lsf to execute a targets pipeline using the LSF HPC scheduler -#' +#' #' @description #' `r lifecycle::badge("experimental")` -#' +#' #' This function returns a template for using `crew.cluster` in a targets project, enabling the parallel execution of a targets workflow. By default, the template is pre-filled using parameters specific to the LPC system at Penn. By default, this function creates workers that submit to different queues (eg. `voltron_normal`, `voltron_long`), and allocate different resources (eg. a "normal" worker will use 1 core and 16GB memory, while a "long" worker will use 1 core and 10GB memory). #' #' @return A code block to copy/paste into a targets project @@ -15,7 +15,6 @@ #' \dontrun{ #' use_crew_lsf() #' } - use_crew_lsf <- function() { title <- basename(here::here()) diff --git a/dev/flat_genomics_functions.Rmd b/dev/flat_genomics_functions.Rmd index dea8c1e..5de1aa0 100644 --- a/dev/flat_genomics_functions.Rmd +++ b/dev/flat_genomics_functions.Rmd @@ -345,8 +345,7 @@ METAL () is a common command-line tool for per #' @seealso Run GWAS meta-analysis using METAL: [levinmisc::metal_run()] #' @export -metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR", AVERAGEFREQ = "ON", MINMAXFREQ = "OFF", TRACKPOSITIONS = "ON", MARKERLABEL = "MARKER", CHROMOSOMELABEL = "CHROM", POSITIONLABEL = "POS", EFFECT_ALLELE = "EFFECT_ALLELE", OTHER_ALLELE = "OTHER_ALLELE", EFFECTLABEL = "BETA", STDERR = "SE", FREQLABEL = "EAF", NCASE = "N_CASE", NCONTROL = "N_CONTROL", SAMPLESIZE = "N") { - +metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR", AVERAGEFREQ = "ON", MINMAXFREQ = "OFF", TRACKPOSITIONS = "ON", MARKERLABEL = "MARKER", CHROMOSOMELABEL = "CHROM", POSITIONLABEL = "POS", EFFECT_ALLELE = "EFFECT_ALLELE", OTHER_ALLELE = "OTHER_ALLELE", EFFECTLABEL = "BETA", STDERR = "SE", FREQLABEL = "EAF", NCASE = NULL, NCONTROL = NULL, SAMPLESIZE = NULL) { fs::dir_create(output_dir, recurse = TRUE) config_outfile <- fs::path(output_dir, paste0(config_name, "_metal-config.txt")) @@ -358,7 +357,7 @@ metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR" "SCHEME {SCHEME} AVERAGEFREQ {AVERAGEFREQ} MINMAXFREQ {MINMAXFREQ} - TRACKPOSITIONs {TRACKPOSITIONS} + TRACKPOSITIONS {TRACKPOSITIONS} MARKERLABEL {MARKERLABEL} CHROMOSOMELABEL {CHROMOSOMELABEL} POSITIONLABEL {POSITIONLABEL} @@ -366,24 +365,41 @@ metal_config <- function(config_name, output_dir, study_files, SCHEME = "STDERR" EFFECTLABEL {EFFECTLABEL} STDERR {STDERR} FREQLABEL {FREQLABEL} - + + " + ) + + if (!is.null(NCASE)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE NCASE LABEL NCASE as {NCASE} - + ") + } + + if (!is.null(NCONTROL)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE NCONTROL - LABEL NCONTROL as {NCONTROL} - + LABEL NCONTROL as {NCONTROL}") + } + + if (!is.null(SAMPLESIZE)) { + config_text <- glue::glue(" + {config_text}\n CUSTOMVARIABLE SAMPLESIZE - LABEL SAMPLESIZE as {SAMPLESIZE} - + LABEL SAMPLESIZE as {SAMPLESIZE}") + } + + config_text <- glue::glue(" + {config_text} + {study_files} OUTFILE {meta_outfile}_metal- .txt ANALYZE HETEROGENEITY - QUIT - " - ) + QUIT") readr::write_lines(x = config_text, file = config_outfile) diff --git a/man/metal_config.Rd b/man/metal_config.Rd index 7a26cca..c3b5942 100644 --- a/man/metal_config.Rd +++ b/man/metal_config.Rd @@ -20,9 +20,9 @@ metal_config( EFFECTLABEL = "BETA", STDERR = "SE", FREQLABEL = "EAF", - NCASE = "N_CASE", - NCONTROL = "N_CONTROL", - SAMPLESIZE = "N" + NCASE = NULL, + NCONTROL = NULL, + SAMPLESIZE = NULL ) } \arguments{ diff --git a/tests/testthat/test-annotate_rsids.R b/tests/testthat/test-annotate_rsids.R index 09323fb..b5da338 100644 --- a/tests/testthat/test-annotate_rsids.R +++ b/tests/testthat/test-annotate_rsids.R @@ -1,7 +1,7 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("annotate_rsids works", { - expect_true(inherits(annotate_rsids, "function")) + expect_true(inherits(annotate_rsids, "function")) }) test_that("annotate_rsids returns a tibble", { diff --git a/tests/testthat/test-calc_credset.R b/tests/testthat/test-calc_credset.R index 8b54207..0049475 100644 --- a/tests/testthat/test-calc_credset.R +++ b/tests/testthat/test-calc_credset.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("calc_credset works", { - expect_true(inherits(calc_credset, "function")) + expect_true(inherits(calc_credset, "function")) }) diff --git a/tests/testthat/test-coloc_run.R b/tests/testthat/test-coloc_run.R index 5819d93..b9048c5 100644 --- a/tests/testthat/test-coloc_run.R +++ b/tests/testthat/test-coloc_run.R @@ -1,17 +1,16 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("coloc_run works", { - expect_true(inherits(coloc_run, "function")) + expect_true(inherits(coloc_run, "function")) }) test_that("coloc_run returns a list", { - - locus_df1 <- tibble::tibble(trait = "A", rsid = letters, beta = runif(26, min = -1), se = runif(26, max = 0.2), p_value = runif(1, min = 1/1e5, max = 0.99), samplesize = 10000, maf = runif(26), type = "quant", case_prop = NA) - locus_df2 <- tibble::tibble(trait = "B", rsid = letters, beta = runif(26, min = -1), se = runif(26, max = 0.2), p_value = runif(1, min = 1/1e5, max = 0.99), samplesize = 10000, maf = runif(26), type = "cc", case_prop = 0.2) - + locus_df1 <- tibble::tibble(trait = "A", rsid = letters, beta = runif(26, min = -1), se = runif(26, max = 0.2), p_value = runif(1, min = 1 / 1e5, max = 0.99), samplesize = 10000, maf = runif(26), type = "quant", case_prop = NA) + locus_df2 <- tibble::tibble(trait = "B", rsid = letters, beta = runif(26, min = -1), se = runif(26, max = 0.2), p_value = runif(1, min = 1 / 1e5, max = 0.99), samplesize = 10000, maf = runif(26), type = "cc", case_prop = 0.2) + locus_df <- dplyr::bind_rows(locus_df1, locus_df2) - + coloc_res <- coloc_run(locus_df) - - expect_true(inherits(coloc_res, "list")) + + expect_true(inherits(coloc_res, "list")) }) diff --git a/tests/testthat/test-gg_manhattan_df.R b/tests/testthat/test-gg_manhattan_df.R index b8d4e1b..ef1ae55 100644 --- a/tests/testthat/test-gg_manhattan_df.R +++ b/tests/testthat/test-gg_manhattan_df.R @@ -8,7 +8,7 @@ test_that("gg_manhattan_df returns a ggplot object", { locus_df <- tibble(position = sample.int(1000, 100)) %>% tidyr::crossing(chromosome = 1:22) %>% rowwise() %>% - mutate(p_value = runif(1, min = 1/1e100, max = 0.001)) %>% + mutate(p_value = runif(1, min = 1 / 1e100, max = 0.001)) %>% mutate(label = "Test") plot_res <- locus_df %>% diff --git a/tests/testthat/test-hyprcoloc_df.R b/tests/testthat/test-hyprcoloc_df.R index 415b58e..4d03e39 100644 --- a/tests/testthat/test-hyprcoloc_df.R +++ b/tests/testthat/test-hyprcoloc_df.R @@ -1,15 +1,19 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("hyprcoloc_df works", { - expect_true(inherits(hyprcoloc_df, "function")) - - df <- tibble::tibble(rsid = letters, - beta = runif(26, min = -1, max = 1), - se = runif(26)) %>% - tidyr::crossing(trait = letters[1:3], - type = c(1, 0, 0)) + expect_true(inherits(hyprcoloc_df, "function")) + + df <- tibble::tibble( + rsid = letters, + beta = runif(26, min = -1, max = 1), + se = runif(26) + ) %>% + tidyr::crossing( + trait = letters[1:3], + type = c(1, 0, 0) + ) hyprcoloc_res <- hyprcoloc_df(df) - + expect_true(inherits(hyprcoloc_res, "hyprcoloc")) }) diff --git a/tests/testthat/test-ldak_h2.R b/tests/testthat/test-ldak_h2.R index d43b355..c3d391f 100644 --- a/tests/testthat/test-ldak_h2.R +++ b/tests/testthat/test-ldak_h2.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("ldak_h2 works", { - expect_true(inherits(ldak_h2, "function")) + expect_true(inherits(ldak_h2, "function")) }) diff --git a/tests/testthat/test-magmar.R b/tests/testthat/test-magmar.R index 52a7a12..a5811a8 100644 --- a/tests/testthat/test-magmar.R +++ b/tests/testthat/test-magmar.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("magmar works", { - expect_true(inherits(magmar, "function")) + expect_true(inherits(magmar, "function")) }) diff --git a/tests/testthat/test-metal_config.R b/tests/testthat/test-metal_config.R index 3aea7da..9ece40d 100644 --- a/tests/testthat/test-metal_config.R +++ b/tests/testthat/test-metal_config.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("metal_config works", { - expect_true(inherits(metal_config, "function")) + expect_true(inherits(metal_config, "function")) }) diff --git a/tests/testthat/test-metal_run.R b/tests/testthat/test-metal_run.R index f4d87ec..a3e60fb 100644 --- a/tests/testthat/test-metal_run.R +++ b/tests/testthat/test-metal_run.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("metal_run works", { - expect_true(inherits(metal_run, "function")) + expect_true(inherits(metal_run, "function")) }) diff --git a/tests/testthat/test-mr_mega.R b/tests/testthat/test-mr_mega.R index 5ab8cd3..5a72c4e 100644 --- a/tests/testthat/test-mr_mega.R +++ b/tests/testthat/test-mr_mega.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("mr_mega works", { - expect_true(inherits(mr_mega, "function")) + expect_true(inherits(mr_mega, "function")) }) diff --git a/tests/testthat/test-plink_extract_ld.R b/tests/testthat/test-plink_extract_ld.R index a939195..96b29a9 100644 --- a/tests/testthat/test-plink_extract_ld.R +++ b/tests/testthat/test-plink_extract_ld.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("plink_extract_ld works", { - expect_true(inherits(plink_extract_ld, "function")) + expect_true(inherits(plink_extract_ld, "function")) }) diff --git a/tests/testthat/test-run_carma.R b/tests/testthat/test-run_carma.R index 27f32d7..42d0b01 100644 --- a/tests/testthat/test-run_carma.R +++ b/tests/testthat/test-run_carma.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("run_carma works", { - expect_true(inherits(run_carma, "function")) + expect_true(inherits(run_carma, "function")) }) diff --git a/tests/testthat/test-s_multixcan.R b/tests/testthat/test-s_multixcan.R index 585d51e..566ba58 100644 --- a/tests/testthat/test-s_multixcan.R +++ b/tests/testthat/test-s_multixcan.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("s_multixcan works", { - expect_true(inherits(s_multixcan, "function")) + expect_true(inherits(s_multixcan, "function")) }) diff --git a/tests/testthat/test-s_predixcan.R b/tests/testthat/test-s_predixcan.R index e0ccd35..f8294af 100644 --- a/tests/testthat/test-s_predixcan.R +++ b/tests/testthat/test-s_predixcan.R @@ -1,5 +1,5 @@ # WARNING - Generated by {fusen} from dev/flat_genomics_functions.Rmd: do not edit by hand test_that("s_predixcan works", { - expect_true(inherits(s_predixcan, "function")) + expect_true(inherits(s_predixcan, "function")) }) diff --git a/tests/testthat/test-use_crew_lsf.R b/tests/testthat/test-use_crew_lsf.R index c9ee36c..7ef90a7 100644 --- a/tests/testthat/test-use_crew_lsf.R +++ b/tests/testthat/test-use_crew_lsf.R @@ -3,13 +3,13 @@ test_that("populate_targets_proj works", { expect_true(inherits(populate_targets_proj, "function")) }) -# +# # # Functions to allow creating files in new temporary directory # dir_empty <- function(x) { # unlink(x, recursive = TRUE, force = TRUE) # dir.create(x) # } -# +# # test_with_dir <- function(desc, ...) { # new <- tempfile() # dir_empty(new) @@ -23,25 +23,25 @@ test_that("populate_targets_proj works", { # ) # invisible() # } -# +# # test_with_dir("populate_targets_proj creates log folder", { # usethis::proj_set(force = TRUE) # populate_targets_proj() # expect_true(dir.exists("build_logs")) # }) -# +# # test_with_dir("populate_targets_proj creates .make-targets.sh", { # usethis::proj_set(force = TRUE) # populate_targets_proj() # expect_true(file.exists(".make-targets.sh")) # }) -# +# # test_with_dir("populate_targets_proj creates submit-targets.sh", { # usethis::proj_set(force = TRUE) # populate_targets_proj() # expect_true(file.exists("submit-targets.sh")) # }) -# +# # test_with_dir("populate_targets_proj creates pipeline and results .qmd templates", { # usethis::proj_set(force = TRUE) # populate_targets_proj() diff --git a/vignettes/genomics-functions.Rmd b/vignettes/genomics-functions.Rmd index da35e66..29adacd 100644 --- a/vignettes/genomics-functions.Rmd +++ b/vignettes/genomics-functions.Rmd @@ -319,7 +319,7 @@ This function provides a wrapper to MAGMA, which performs gene-based testing fro ```{r example-s_multixcan} #' \dontrun{ -#' s_multixcan(df, +#' s_multixcan(df, #' models_folder = "MetaXcan/data/models/eqtl/mashr/", #' models_name_filter = ".*\\.db", #' models_name_pattern = "mashr_(.*)\\.db",