diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore index 76f85cb..c6c031d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ mrbase.oauth *.rdx *.rdb +*_cache/ +.DS_Store diff --git a/DESCRIPTION b/DESCRIPTION index cd28f8e..4ec3b79 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,21 +1,44 @@ Package: tryx Title: MR-TRYX (treasure your exceptions) -Version: 0.2.0 -Authors@R: c(person("Gibran", "Hemani", email = "g.hemani@bristol.ac.uk", role = c("aut", "cre")), person("Yoonsu", "Cho", email = "yoonsu.cho@bristol.ac.uk", role = c("aut"))) -Description: Heterogeneity in MR analyses can arise due to horizontal pleiotropy. This package uses MR-Base to identify possible traits that can explain the heterogeneity, with a view to identifying novel putative associations, and adjusting for their influences to reduce heterogeneity and improve power. -Depends: R (>= 3.6.0), - TwoSampleMR, - dplyr, - RadialMR, - magrittr, - tidyr, - ggplot2, - glmnet, - ggrepel +Version: 0.2.1 +Authors@R: c( + person("Gibran", "Hemani", , "g.hemani@bristol.ac.uk", role = c("aut", "cre")), + person("Yoonsu", "Cho", , "yoonsu.cho@bristol.ac.uk", role = "aut") + ) +Description: Heterogeneity in MR analyses can arise due to horizontal + pleiotropy. This package uses MR-Base to identify possible traits that + can explain the heterogeneity, with a view to identifying novel + putative associations, and adjusting for their influences to reduce + heterogeneity and improve power. +License: MIT + file LICENSE +URL: https://mrcieu.r-universe.dev/tryx, + https://explodecomputer.github.io/tryx/, + https://github.com/explodecomputer/tryx +BugReports: https://github.com/explodecomputer/tryx/issues +Depends: + R (>= 4.1.0) +Imports: + dplyr, + ggplot2, + ggrepel, + glmnet, + magrittr, + R6, + RadialMR, + tibble, + tidyr, + TwoSampleMR Suggests: igraph, + knitr, + rmarkdown, + simulateGP, testthat -License: MIT + file LICENSE +VignetteBuilder: + knitr +Remotes: + explodecomputer/simulateGP, + MRCIEU/TwoSampleMR, + WSpiller/RadialMR +Config/roxygen2/version: 8.1.0 Encoding: UTF-8 -LazyData: true -RoxygenNote: 7.0.2 diff --git a/NAMESPACE b/NAMESPACE index 0448e00..caf3f36 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,3 +10,63 @@ export(tryx.scan) export(tryx.sig) export(tryx.simulate) export(volcano_plot) +importFrom(R6,R6Class) +importFrom(TwoSampleMR, + available_outcomes, + extract_instruments, + extract_outcome_data, + harmonise_data, + mr, + mr_heterogeneity, + mr_method_list, + mv_extract_exposures, + mv_harmonise_data, + mv_multiple +) +importFrom(dplyr, + arrange, + bind_rows, + desc, + do, + filter, + group_by, + mutate, + n, + summarise +) +importFrom(ggplot2, + aes, + arrow, + element_blank, + element_text, + facet_grid, + geom_abline, + geom_errorbarh, + geom_point, + geom_segment, + geom_vline, + ggplot, + labs, + scale_colour_brewer, + theme, + theme_bw, + unit, + xlim, + ylim +) +importFrom(ggrepel,geom_label_repel) +importFrom(magrittr, + "%$%", + "%>%" +) +importFrom(stats, + as.formula, + coef, + coefficients, + lm, + p.adjust, + rnorm, + sd +) +importFrom(tibble,tibble) +importFrom(utils,combn) diff --git a/R/adjustment.r b/R/adjustment.r index 6a87484..be1044b 100644 --- a/R/adjustment.r +++ b/R/adjustment.r @@ -207,7 +207,7 @@ tryx.adjustment.mv <- function(tryxscan, lasso=TRUE, id_remove=NULL, proxies=FAL #' @param tryxscan Output from \code{tryx.scan} #' @param plot Whether to plot or not. Default is TRUE #' @param id_remove List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate. -#' @param duplicate_outliers_method Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity +#' @param filter_duplicate_outliers Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity #' #' @export #' @return List of @@ -246,11 +246,6 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o # analysis$detection <- detection # } - cpg <- require(ggrepel) - if(!cpg) - { - stop("Please install the ggrepel package\ninstall.packages('ggrepel')") - } dat <- subset(tryxscan$dat, mr_keep, select=c(SNP, beta.exposure, beta.outcome, se.exposure, se.outcome)) dat$ratio <- dat$beta.outcome / dat$beta.exposure @@ -310,7 +305,7 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o # Outliers removed (all) tt <- subset(dat, !SNP %in% tryxscan$outliers) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -328,7 +323,7 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o # Outliers removed (candidates) tt <- subset(dat, !SNP %in% temp$SNP) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -348,7 +343,7 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o tt$qi <- cochrans_q(tt$beta.outcome / tt$beta.exposure, tt$se.outcome / abs(tt$beta.exposure)) analysis$Q$adj_Q <- sum(tt$qi) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -382,7 +377,7 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o { tt <- subset(dat, !SNP %in% tryxscan$true_outliers) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -451,26 +446,6 @@ tryx.analyse <- function(tryxscan, plot=TRUE, id_remove=NULL, filter_duplicate_o -#' Analyse tryx results -#' -#' This returns various heterogeneity statistics, IVW estimates for raw, -#' adjusted and outlier removed datasets, and summary of peripheral -#' traits detected etc. -#' -#' @param tryxscan Output from \code{tryx.scan} -#' @param plot Whether to plot or not. Default is TRUE -#' @param filter_duplicate_outliers Whether to only allow each putative outlier to be adjusted by a single trait (in order of largest divergence). Default is TRUE. -#' -#' @export -#' @return List of -#' - adj_full: data frame of SNP adjustments for all candidate traits -#' - adj: The results from adj_full selected to adjust the exposure-outcome model -#' - Q: Heterogeneity stats -#' - estimates: Adjusted and unadjested exposure-outcome effects -#' - plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment - - - #' Adjust and analyse the tryx results #' #' Similar to tryx.analyse, but when there are multiple traits associated with a single variant then we use a LASSO-based multivariable approach @@ -597,7 +572,6 @@ bootstrap_path <- function(gx, gx.se, gp, gp.se, px, px.se, nboot=1000) radialmr <- function(dat, outlier=NULL) { - library(ggplot2) beta.exposure <- dat$beta.exposure beta.outcome <- dat$beta.outcome se.outcome <- dat$se.outcome diff --git a/R/plots.r b/R/plots.r index 7868b19..ed9c462 100644 --- a/R/plots.r +++ b/R/plots.r @@ -6,17 +6,6 @@ #' @return ggplot of volcano plots volcano_plot <- function(res, what="exposure") { - cpg <- require(ggplot2) - if(!cpg) - { - stop("Please install the ggplot2 package") - } - cpg <- require(ggrepel) - if(!cpg) - { - stop("Please install the ggrepel package") - } - stopifnot(all(c("outcome", "exposure", "b", "se", "pval") %in% names(res))) if(!"sig" %in% names(res)) { @@ -44,7 +33,7 @@ volcano_plot <- function(res, what="exposure") geom_vline(xintercept=0, linetype="dotted") + geom_errorbarh(aes(xmin=b-1.96*se, xmax=b+1.96*se)) + geom_point(aes(colour=sig)) + - facet_grid(form, scale="free") + + facet_grid(form, scales="free") + geom_label_repel(data=subset(res, sig), aes(label=exposure), colour="black", segment.colour="black", point.padding = unit(0.7, "lines"), box.padding = unit(0.7, "lines"), segment.size=0.5, force=2, max.iter=3e3) + # geom_text_repel(data=subset(res, sig), aes(label=outcome, colour=category)) + geom_point(aes(colour=sig)) + @@ -69,16 +58,10 @@ volcano_plot <- function(res, what="exposure") tryx.network <- function(tryxscan) { - a <- require(igraph) - if(!a) + if(!requireNamespace("igraph", quietly=TRUE)) { stop("Please install the igraph R package") } - a <- require(dplyr) - if(!a) - { - stop("Please install the dplyr R package") - } stopifnot("candidate_outcome_mr" %in% names(tryxscan)) stopifnot("candidate_exposure_mr" %in% names(tryxscan)) @@ -174,14 +157,14 @@ tryx.network <- function(tryxscan) nodes <- rbind( - data_frame( + tibble( name=c( ao$trait[ao$id %in% tryxscan$dat$id.exposure[1]], ao$trait[ao$id %in% tryxscan$dat$id.outcome[1]]), id=c(tryxscan$dat$id.exposure[1], tryxscan$dat$id.outcome[1]), what=c("original") ), - data_frame( + tibble( name=unique(tryxscan$outliers), id=NA, what="Outlier instruments" @@ -230,20 +213,20 @@ tryx.network <- function(tryxscan) grp$size <- 0.1 grp$size[grp$what == "Main hypothesis"] <- 0.5 - layoutg <- graph_from_data_frame(layoutd2, vertices=nodes) - l <- layout_with_fr(layoutg) - grl <- graph_from_data_frame(grp, directed=TRUE, vertices=nodes) + layoutg <- igraph::graph_from_data_frame(layoutd2, vertices=nodes) + l <- igraph::layout_with_fr(layoutg) + grl <- igraph::graph_from_data_frame(grp, directed=TRUE, vertices=nodes) plot(grl, layout=l, - vertex.size=V(grl)$size, - vertex.label=V(grl)$label, - # edge.arrow.size=E(grl)$size, + vertex.size=igraph::V(grl)$size, + vertex.label=igraph::V(grl)$label, + # edge.arrow.size=igraph::E(grl)$size, edge.arrow.size=0.3, - edge.color=E(grl)$colour, + edge.color=igraph::E(grl)$colour, vertex.label.cex=0.5, vertex.label.family="sans", vertex.label.color="black", - vertex.color=V(grl)$colour, + vertex.color=igraph::V(grl)$colour, edge.color="red" ) } diff --git a/R/scan.r b/R/scan.r index 41e61c5..cc61342 100644 --- a/R/scan.r +++ b/R/scan.r @@ -56,16 +56,6 @@ tryx.scan <- function(dat, outliers="RadialMR", outlier_correction="none", outli if(outliers[1] == "RadialMR") { message("Using RadialMR package to detect outliers") - cpg <- require(RadialMR) - if(!cpg) - { - stop("Please install the RadialMR package\ndevtools::install_github('WSpiller/RadialMR')") - } - cpg <- require(dplyr) - if(!cpg) - { - stop("Please install the RadialMR package\ndevtools::install_github('WSpiller/RadialMR')") - } # radial <- RadialMR::ivw_radial(RadialMR::format_radial(dat$beta.exposure, dat$beta.outcome, dat$se.exposure, dat$se.outcome, dat$SNP), alpha=0.05/nrow(dat), weights=3) @@ -82,7 +72,7 @@ tryx.scan <- function(dat, outliers="RadialMR", outlier_correction="none", outli # apply outlier_correction method with outlier_threshold to radial SNP-Q statistics - if(radial$outliers[1] == "No significant outliers") + if(is.character(radial$outliers) && radial$outliers[1] == "No significant outliers") { message("No outliers found") message("Try changing the outlier_threshold parameter") @@ -318,6 +308,7 @@ strategy1 <- function(dat, het_threshold=0.05, ivw_max_snp=1) #' Identify putatively significant associations in the outlier scan #' +#' @param tryxscan Output from \code{tryx.scan} #' @param mr_threshold_method This is the argument to be passed to \code{p.adjust}. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted" #' @param mr_threshold Threshold to declare significance #' @export diff --git a/R/simulations.r b/R/simulations.r index cd63ab6..420f506 100644 --- a/R/simulations.r +++ b/R/simulations.r @@ -25,7 +25,7 @@ #' @param vgxu2 = 0.2 Variance explained by each gx instrument on each u2 mediator #' @param vu2y = 0.2 Variance explained by all u2 mediators on y #' @param ngxu3 = 0 Number of gx instruments that pleiotropically associate with u3 mediator -#' @param vgxu3y = 0 Variance explained by all gx variants directly on u3 mediator +#' @param vgxu3 = 0 Variance explained by all gx variants directly on u3 mediator #' @param mininum_instruments = 10 Minimum number of instruments required to have been detected to run simulation #' @param instrument_threshold = "bonferroni" Threshold, either numeric or 'bonferroni' #' @param outlier_threshold = "bonferroni" Threshold, either numeric or 'bonferroni' @@ -36,21 +36,26 @@ #' @return list for tryx.analyse tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, ngu3 = 30, vgx = 0.2, vgu1 = 0.6, vgu2 = 0.2, vgu3 = 0.2, bxy = 0, bu1x = 0.6, bu1y = 0.4, bxu3 = 0.3, bu3y = 0, vgxu2 = 0.2, vu2y = 0.2, ngxu3 = 0, vgxu3=0, mininum_instruments = 10, instrument_threshold = "bonferroni", outlier_threshold = "bonferroni", outliers_known = "detected", directional_bias = FALSE) { + if(!requireNamespace("simulateGP", quietly=TRUE)) + { + stop("Please install the simulateGP package\nremotes::install_github('explodecomputer/simulateGP')") + } + out <- list() message("Generating genetic effects") - gx <- make_geno(nid, ngx, 0.5) - gu1 <- make_geno(nid, ngu1, 0.5) - gu2 <- make_geno(nid, ngu2 * nu2, 0.5) - gu3 <- make_geno(nid, ngu3, 0.5) - u1 <- make_phen(choose_effects(ngu1, vgu1), gu1) - x <- make_phen(c(abs(choose_effects(ngx, vgx)), bu1x), cbind(gx, u1)) + gx <- simulateGP::make_geno(nid, ngx, 0.5) + gu1 <- simulateGP::make_geno(nid, ngu1, 0.5) + gu2 <- simulateGP::make_geno(nid, ngu2 * nu2, 0.5) + gu3 <- simulateGP::make_geno(nid, ngu3, 0.5) + u1 <- simulateGP::make_phen(simulateGP::choose_effects(ngu1, vgu1), gu1) + x <- simulateGP::make_phen(c(abs(simulateGP::choose_effects(ngx, vgx)), bu1x), cbind(gx, u1)) if(ngxu3 > 0) { - u3 <- make_phen(c(choose_effects(ngu3, vgu3), bxu3, choose_effects(ngxu3, vgxu3)), cbind(gu3, x, gx[,sample(1:ngx, ngxu3)])) + u3 <- simulateGP::make_phen(c(simulateGP::choose_effects(ngu3, vgu3), bxu3, simulateGP::choose_effects(ngxu3, vgxu3)), cbind(gu3, x, gx[,sample(1:ngx, ngxu3)])) } else { - u3 <- make_phen(c(choose_effects(ngu3, vgu3), bxu3), cbind(gu3, x)) + u3 <- simulateGP::make_phen(c(simulateGP::choose_effects(ngu3, vgu3), bxu3), cbind(gu3, x)) } @@ -63,22 +68,22 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, for(i in 1:nu2) { message("SNP ", i, " is pleiotropic") - u2[,i] <- make_phen( - c(choose_effects(ngu2, vgu2), abs(choose_effects(1, vgxu2))), + u2[,i] <- simulateGP::make_phen( + c(simulateGP::choose_effects(ngu2, vgu2), abs(simulateGP::choose_effects(1, vgxu2))), cbind(gu2[,((i-1) * ngu2 + 1):(ngu2 * i)], gx[,i]) ) } message("Creating outcome") - bu2y <- choose_effects(nu2, vu2y) + bu2y <- simulateGP::choose_effects(nu2, vu2y) if(directional_bias) { message("U2 bias is directional") bu2y <- abs(bu2y) } - y <- make_phen( + y <- simulateGP::make_phen( c(bxy, bu3y, bu1y, bu2y), cbind(x, u3, u1, u2) ) @@ -117,7 +122,7 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, message("Getting instruments") - out$dat_all <- get_effs(x, y, G, "X", "Y") + out$dat_all <- simulateGP::get_effs(x, y, G, "X", "Y") out$dat <- subset(out$dat_all, pval.exposure < instrument_threshold) stopifnot(nrow(out$dat) > mininum_instruments) out$dat$mr_keep <- TRUE @@ -158,7 +163,7 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, } else if(outliers_known %in% c("detected", "all")) { message("Detecting outliers") radial <- RadialMR::ivw_radial(RadialMR::format_radial(out$dat$beta.exposure, out$dat$beta.outcome, out$dat$se.exposure, out$dat$se.outcome, out$dat$SNP), ifelse(outlier_threshold == "bonferroni", 0.05/nrow(out$dat), outlier_threshold), weights=3) - if(radial$outliers[1] == "No significant outliers") + if(is.character(radial$outliers) && radial$outliers[1] == "No significant outliers") { message("No significant outliers detected") outliers <- as.character(out$dat$SNP[out$dat$SNP %in% invalid]) @@ -190,7 +195,7 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, outlier_scan <- list() for(i in 1:ncol(U)) { - outlier_scan[[colnames(U)[i]]] <- gwas(U[,i], G[,outliers, drop=FALSE]) + outlier_scan[[colnames(U)[i]]] <- simulateGP::gwas(U[,i], G[,outliers, drop=FALSE]) outlier_scan[[colnames(U)[i]]]$SNP <- outliers outlier_scan[[colnames(U)[i]]]$outcome <- colnames(U)[i] } @@ -220,13 +225,13 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, message("Analysing ", length(PHEN), " traits: ", paste(names(PHEN), collapse=",")) snplist <- sapply(1:length(PHEN), function(x) { - subset(gwas(PHEN[[x]], G), pval < instrument_threshold)$snp + subset(simulateGP::gwas(PHEN[[x]], G), pval < instrument_threshold)$snp }) %>% unlist() %>% sort %>% unique message("Found ", length(snplist), " unique instruments") message("Perform mvmr") out$mvres <- try({ - mvdat <- make_mvdat(PHEN, y, G[,snplist]) + mvdat <- simulateGP::make_mvdat(PHEN, y, G[,snplist]) mvres <- mv_multiple(mvdat) mvres$result$exposure <- c("x", traitlist) mvres @@ -241,8 +246,8 @@ tryx.simulate <- function(nid = 10000, ngx = 30, ngu1 = 30, ngu2 = 30, nu2 = 2, for(i in traitlist) { message(i) - ux[[i]] <- get_effs(U[,i], x, G, i, "X") %>% subset(pval.exposure < instrument_threshold) - uy[[i]] <- get_effs(U[,i], y, G, i, "Y") %>% subset(pval.exposure < instrument_threshold) + ux[[i]] <- simulateGP::get_effs(U[,i], x, G, i, "X") %>% subset(pval.exposure < instrument_threshold) + uy[[i]] <- simulateGP::get_effs(U[,i], y, G, i, "Y") %>% subset(pval.exposure < instrument_threshold) if(nrow(ux[[i]]) > 0) { ux[[i]]$effect_allele.exposure <- "A" diff --git a/R/tryx-package.R b/R/tryx-package.R new file mode 100644 index 0000000..e0b962a --- /dev/null +++ b/R/tryx-package.R @@ -0,0 +1,26 @@ +#' @keywords internal +"_PACKAGE" + +#' @importFrom magrittr %>% %$% +#' @importFrom dplyr arrange bind_rows desc do filter group_by mutate n summarise +#' @importFrom tibble tibble +#' @importFrom ggplot2 aes arrow element_blank element_text facet_grid geom_abline geom_errorbarh geom_point geom_segment geom_vline ggplot labs scale_colour_brewer theme theme_bw unit xlim ylim +#' @importFrom ggrepel geom_label_repel +#' @importFrom TwoSampleMR available_outcomes extract_instruments extract_outcome_data harmonise_data mr mr_heterogeneity mr_method_list mv_extract_exposures mv_harmonise_data mv_multiple +#' @importFrom R6 R6Class +#' @importFrom stats as.formula coef coefficients lm p.adjust rnorm sd +#' @importFrom utils combn +NULL + +# Column names used in non-standard evaluation (subset, dplyr, ggplot2) +utils::globalVariables(c( + ".", "Q", "Q_df", "Q_pval", "Qj", "Qj_Chi", "SNP", + "adj.beta.exposure", "adj.beta.outcome", "adj.se.exposure", "adj.se.outcome", + "b", "beta.exposure", "beta.outcome", "candidate", "d", + "eaf.exposure", "eaf.outcome", "effect_allele.exposure", "effect_allele.outcome", + "est", "exposure", "id", "id.exposure", "id.outcome", "label", "method", "mp", + "mr_keep", "orig.ratiow", "orig.weights", "other_allele.exposure", "other_allele.outcome", + "outcome", "p", "pval", "pval.exposure", "pval.outcome", "qi", "ratiow", "ratiow.x", + "ratiow.y", "rdpadj", "sample_size", "se", "se.exposure", "se.outcome", "sig", + "snpcount", "trait", "weights", "weights.x", "weights.y", "what", "x", "xend", "y", "yend" +)) diff --git a/R/tryxclass.R b/R/tryxclass.R index 13ca1de..5330303 100644 --- a/R/tryxclass.R +++ b/R/tryxclass.R @@ -7,6 +7,7 @@ #' Perform MR of each of those candidate traits with the original exposure and outcome. #' @export Tryx <- R6::R6Class("Tryx", list( + #' @field output List holding the input data and the results of each analysis step. output = list(), ########################################################################################################################################################################## @@ -27,6 +28,9 @@ Tryx <- R6::R6Class("Tryx", list( invisible(self) }, + #' @description + #' Print a summary of the analysis status. + #' @param ... Unused. print = function(...) { cat("Tryx analysis of ", self$output$dat$exposure[1], " against ", self$output$dat$outcome[1], "\n") cat("Status:\n") @@ -52,16 +56,6 @@ Tryx <- R6::R6Class("Tryx", list( if(outliers[1] == "RadialMR") { message("Using RadialMR package to detect outliers") - cpg <- require(RadialMR) - if(!cpg) - { - stop("Please install the RadialMR package\ndevtools::install_github('WSpiller/RadialMR')") - } - cpg <- require(dplyr) - if(!cpg) - { - stop("Please install the RadialMR package\ndevtools::install_github('WSpiller/RadialMR')") - } radialor <- RadialMR::ivw_radial(RadialMR::format_radial(dat$beta.exposure, dat$beta.outcome, dat$se.exposure, dat$se.outcome, dat$SNP), alpha=1, weights=3) @@ -73,7 +67,7 @@ Tryx <- R6::R6Class("Tryx", list( rownames(radial$outliers) <- 1:nrow(radial$outliers) # apply outlier_correction method with outlier_threshold to radial SNP-Q statistics - if(radial$outliers[1] == "No significant outliers") + if(is.character(radial$outliers) && radial$outliers[1] == "No significant outliers") { message("No outliers found") message("Try changing the outlier_threshold parameter") @@ -689,7 +683,7 @@ Tryx <- R6::R6Class("Tryx", list( #' #' @param id_remove List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate. #' - #' @param duplicate_outliers_method Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity. + #' @param filter_duplicate_outliers Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity. analyse = function(tryxscan=self$output, plot=TRUE, id_remove=NULL, filter_duplicate_outliers=TRUE) { analysis <- list() @@ -709,11 +703,6 @@ Tryx <- R6::R6Class("Tryx", list( analysis$adj <- adj - cpg <- require(ggrepel) - if(!cpg) - { - stop("Please install the ggrepel package\ninstall.packages('ggrepel')") - } dat <- subset(tryxscan$dat, mr_keep, select=c(SNP, beta.exposure, beta.outcome, se.exposure, se.outcome)) dat$ratio <- dat$beta.outcome / dat$beta.exposure @@ -773,7 +762,7 @@ Tryx <- R6::R6Class("Tryx", list( # Outliers removed (all) tt <- subset(dat, !SNP %in% tryxscan$outliers) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -791,7 +780,7 @@ Tryx <- R6::R6Class("Tryx", list( # Outliers removed (candidates) tt <- subset(dat, !SNP %in% temp$SNP) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -811,7 +800,7 @@ Tryx <- R6::R6Class("Tryx", list( tt$qi <- private$cochrans_q(tt$beta.outcome / tt$beta.exposure, tt$se.outcome / abs(tt$beta.exposure)) analysis$Q$adj_Q <- sum(tt$qi) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -845,7 +834,7 @@ Tryx <- R6::R6Class("Tryx", list( { tt <- subset(dat, !SNP %in% tryxscan$true_outliers) mod <- try(summary(lm(ratiow ~ -1 + weights, data=tt))) - if(class(mod) != "try-error") + if(!inherits(mod, "try-error")) { estimates <- bind_rows(estimates, tibble( @@ -903,6 +892,8 @@ Tryx <- R6::R6Class("Tryx", list( #' @param lasso Whether to shrink the estimates of each trait within SNP. Default=TRUE. #' #' @param proxies Look for proxies in the MVMR methods. Default = FALSE. + #' + #' @param plot Whether to plot or not. Default is TRUE. analyse.mv = function(tryxscan=self$output, lasso=TRUE, plot=TRUE, id_remove=NULL, proxies=FALSE) { x$adjustment.mv(tryxscan=self$output, lasso=lasso, id_remove=id_remove, proxies=proxies) adj <- tryxscan$adjustment.mv @@ -989,16 +980,6 @@ Tryx <- R6::R6Class("Tryx", list( #' @param label Display the names of the traits on the graph. manhattan_plot = function(what="outcome", id_remove=NULL, y_scale=NULL, label = TRUE){ - cpg <- require(ggplot2) - if(!cpg) - { - stop("Please install the ggplot2 package") - } - cpg <- require(ggrepel) - if(!cpg) - { - stop("Please install the ggrepel package") - } #Open & clean data #mr outcome: candidate traits-outcome / candidate traits-exposure / exposure-candidate traits diff --git a/R/tryxclass_private.R b/R/tryxclass_private.R index d4b9fd8..7c3968a 100644 --- a/R/tryxclass_private.R +++ b/R/tryxclass_private.R @@ -66,7 +66,6 @@ Tryx$set("private", "bootstrap_path", function(gx, gx.se, gp, gp.se, px, px.se, Tryx$set("private", "radialmr", function(dat, outlier=NULL) { - library(ggplot2) beta.exposure <- dat$beta.exposure beta.outcome <- dat$beta.outcome se.outcome <- dat$se.outcome diff --git a/docs/.DS_Store b/docs/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/docs/.DS_Store and /dev/null differ diff --git a/docs/404.html b/docs/404.html index f8e7ce2..ca09d91 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1,66 +1,27 @@ - - - - + + + + - Page not found (404) • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - -
-
- + +
+ + + - - -
+
+
-
+ - - - + + diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index f473ca6..dcaa5fb 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -1,66 +1,12 @@ - - - - - - - -License • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -License • tryx + - - - -
-
- - -
-
+
+
-
- +
+ + - - - + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 5b067a2..95ca759 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -1,66 +1,12 @@ - - - - - - - -MIT License • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MIT License • tryx + - - - -
-
- - -
-
+
+
-
- +
+ + - - - + diff --git a/docs/articles/guide.html b/docs/articles/guide.html index 7e09239..521b394 100644 --- a/docs/articles/guide.html +++ b/docs/articles/guide.html @@ -6,19 +6,20 @@ Guide to using MR-TRYX • tryx - + - + +
@@ -70,1172 +69,227 @@
- +
-

The following analyses should run within a couple of minutes, depending on internet speed and the traffic that the IEU GWAS database servers are experiencing.

-

Begin by choosing an exposure-outcome hypothesis to explore. e.g. LDL cholesterol on coronary heart disease. These data can be extracted from the IEU GWAS database using the TwoSampleMR package:

-
-

-Data setup

+

The following analyses should run within a couple of minutes, +depending on internet speed and the traffic that the IEU GWAS database servers are +experiencing.

+

Begin by choosing an exposure-outcome hypothesis to explore. e.g. LDL +cholesterol on coronary heart disease. These data can be extracted from +the IEU GWAS database using the TwoSampleMR +package:

+
+

Data setup +

If necessary install TwoSampleMR:

-
-devtools::install_github("mrcieu/TwoSampleMR@ieugwasr")
-
+
+devtools::install_github("mrcieu/TwoSampleMR@ieugwasr")

Create a dataset for SBP and CHD

-
-library(TwoSampleMR)
-a <- extract_instruments("ukb-b-20175")
-#> API: public: http://gwas-api.mrcieu.ac.uk/
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-b <- extract_outcome_data(a$SNP, "ieu-a-7", access_token=NULL)
-#> Extracting data for 244 SNP(s) from 1 GWAS(s)
-#> Finding proxies for 4 SNPs in outcome ieu-a-7
-#> Extracting data for 4 SNP(s) from 1 GWAS(s)
-dat <- harmonise_data(a,b)
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
-#> Removing the following SNPs for incompatible alleles:
-#> rs17811915
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs2246832, rs28470858, rs28667801
-
+
+library(TwoSampleMR)
+a <- extract_instruments("ukb-b-20175")
+b <- extract_outcome_data(a$SNP, "ieu-a-7", access_token=NULL)
+dat <- harmonise_data(a,b)
-
-

-Running Tryx

+
+

Running Tryx +

We can now perform the analysis:

This will do the following:

    -
  1. Initialise the Tryx class with the dat object we already created
  2. +
  3. Initialise the Tryx class with the dat object we +already created
  4. Find outlier SNPs in the exposure-outcome analysis
  5. -
  6. Find traits in the IEU GWAS database that those outliers associate with. These traits are known as ‘candidate traits’
  7. +
  8. Find traits in the IEU GWAS database that those outliers associate +with. These traits are known as ‘candidate traits’
  9. Extract instruments for those ‘candidate traits’
  10. -
  11. Perform MR of each of those ‘candidate traits’ against the exposure and the outcome
  12. +
  13. Perform MR of each of those ‘candidate traits’ against the exposure +and the outcome
-
-library(tryx)
-x <- Tryx$new(dat)
-x$mrtryx()
-#> Using RadialMR package to detect outliers
-#> 
-#> Radial IVW
-#> 
-#>                   Estimate  Std.Error   t value     Pr(>|t|)
-#> Effect (Mod.2nd) 0.5991043 0.07718481  7.761945 8.363657e-15
-#> Iterative        0.5991043 0.07718481  7.761945 8.363657e-15
-#> Exact (FE)       0.6420699 0.04024276 15.954916 2.633294e-57
-#> Exact (RE)       0.6101965 0.08857214  6.889260 5.227019e-11
-#> 
-#> 
-#> Residual standard error: 1.92 on 232 degrees of freedom
-#> 
-#> F-statistic: 60.25 on 1 and 232 DF, p-value: 2.66e-13
-#> Q-Statistic for heterogeneity: 855.6769 on 232 DF , p-value: 2.874833e-72
-#> 
-#>  Outliers detected 
-#> Number of iterations = 2
-#> Warning in if (radial$outliers[1] == "No significant outliers") {: the condition
-#> has length > 1 and only the first element will be used
-#> Identified 11 outliers
-#> Using default list of 6467 traits
-#> Extracting data for 11 SNP(s) from 6467 GWAS(s)
-#> Found 139 candidate traits associated with outliers at p < 5e-08
-#> Finding instruments for candidate traits
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '3mm strong meridian (left) || id:ukb-b-14664. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '3mm strong meridian (right) || id:ukb-b-6852. Just keeping the first instance:
-#> rs2242398
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '3mm weak meridian (left) || id:ukb-b-11113. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '3mm weak meridian (right) || id:ukb-b-13506. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '6mm strong meridian (right) || id:ukb-b-11452. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '6mm weak meridian (left) || id:ukb-b-13538. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype '6mm weak meridian (right) || id:ukb-b-13416. Just keeping the first instance:
-#> rs8047844
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Alcohol intake frequency. || id:ukb-b-5779. Just keeping the first instance:
-#> rs9958320
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Ankle spacing width || id:ukb-b-4080. Just keeping the first instance:
-#> rs3732360
-#> rs1294438
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Arm fat percentage (left) || id:ukb-b-20188. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Arm fat-free mass (right) || id:ukb-b-19520. Just keeping the first instance:
-#> rs3740591
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Basal metabolic rate || id:ukb-b-16446. Just keeping the first instance:
-#> rs3129962
-#> rs3740591
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Birth weight || id:ukb-b-13378. Just keeping the first instance:
-#> rs2140240
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Blood clot, DVT, bronchitis, emphysema, asthma, rhinitis, eczema, allergy diagnosed by doctor: Asthma || id:ukb-b-20296. Just keeping the first instance:
-#> rs35320232
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Blood clot, DVT, bronchitis, emphysema, asthma, rhinitis, eczema, allergy diagnosed by doctor: Hayfever, allergic rhinitis or eczema || id:ukb-b-17241. Just keeping the first instance:
-#> rs35320232
-#> rs2075973
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Blood clot, DVT, bronchitis, emphysema, asthma, rhinitis, eczema, allergy diagnosed by doctor: None of the above || id:ukb-b-18200. Just keeping the first instance:
-#> rs35320232
-#> rs2097431
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Body fat percentage || id:ukb-b-8909. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Diastolic blood pressure, automated reading || id:ukb-b-7992. Just keeping the first instance:
-#> rs28752924
-#> rs17304212
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Duration to first press of snap-button in each round || id:ukb-b-19373. Just keeping the first instance:
-#> rs9304167
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Hip circumference || id:ukb-b-15590. Just keeping the first instance:
-#> rs1294438
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Impedance of arm (right) || id:ukb-b-7859. Just keeping the first instance:
-#> rs111650620
-#> rs1382568
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Impedance of leg (left) || id:ukb-b-14068. Just keeping the first instance:
-#> rs776912
-#> rs2952894
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Impedance of leg (right) || id:ukb-b-7376. Just keeping the first instance:
-#> rs776912
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat percentage (left) || id:ukb-b-18377. Just keeping the first instance:
-#> rs1428
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat percentage (right) || id:ukb-b-20531. Just keeping the first instance:
-#> rs7027096
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat-free mass (left) || id:ukb-b-16099. Just keeping the first instance:
-#> rs3129962
-#> rs77760034
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat-free mass (right) || id:ukb-b-12828. Just keeping the first instance:
-#> rs77760034
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg predicted mass (left) || id:ukb-b-17271. Just keeping the first instance:
-#> rs3129962
-#> rs77760034
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg predicted mass (right) || id:ukb-b-14310. Just keeping the first instance:
-#> rs77760034
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014. Just keeping the first instance:
-#> rs2209042
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: None of the above || id:ukb-b-20379. Just keeping the first instance:
-#> rs13204736
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Medication for pain relief, constipation, heartburn: Paracetamol || id:ukb-b-17595. Just keeping the first instance:
-#> rs34555420
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Non-cancer illness code, self-reported: asthma || id:ukb-b-18113. Just keeping the first instance:
-#> rs17142799
-#> rs35320232
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057. Just keeping the first instance:
-#> rs4783581
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Number of self-reported non-cancer illnesses || id:ukb-b-4063. Just keeping the first instance:
-#> rs13204736
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Pain type(s) experienced in last month: Headache || id:ukb-b-12181. Just keeping the first instance:
-#> rs34555420
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Peak expiratory flow (PEF) || id:ukb-b-12019. Just keeping the first instance:
-#> rs2666547
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Sitting height || id:ukb-b-16881. Just keeping the first instance:
-#> rs4651157
-#> rs872937
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Standing height || id:ukb-b-10787. Just keeping the first instance:
-#> rs11252860
-#> rs34773647
-#> rs664317
-#> rs7978217
-#> rs11051456
-#> rs1019075
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Treatment/medication code: amlodipine || id:ukb-b-9207. Just keeping the first instance:
-#> rs2077111
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat mass || id:ukb-b-20044. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat percentage || id:ukb-b-16407. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat-free mass || id:ukb-b-17409. Just keeping the first instance:
-#> rs3735352
-#> rs3740591
-#> rs1040457
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk predicted mass || id:ukb-b-9685. Just keeping the first instance:
-#> rs77760034
-#> rs3735352
-#> rs7978217
-#> rs1040457
-#> rs3740591
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177. Just keeping the first instance:
-#> rs4783581
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352. Just keeping the first instance:
-#> rs4783581
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Whole body fat-free mass || id:ukb-b-13354. Just keeping the first instance:
-#> rs434072
-#> rs3740591
-#> rs1040457
-#> rs77760034
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Whole body water mass || id:ukb-b-14540. Just keeping the first instance:
-#> rs1040457
-#> rs3740591
-#> rs77760034
-#> Warning in format_data(d, type = "exposure", snps = NULL, phenotype_col =
-#> "phenotype", : eaf column is not numeric. Coercing...
-#> Removing outlier SNPs from candidate trait instrument lists
-#> 139 traits with at least one instrument
-#> Looking up candidate trait instruments for Coronary heart disease || id:ieu-a-7
-#> Extracting data for 10546 SNP(s) from 1 GWAS(s)
-#> 1 of 1 outcomes
-#>  [>] 1 of 2 chunks
-#>  [>] 2 of 2 chunks
-#> 10339 instruments extracted for Coronary heart disease || id:ieu-a-7
-#> Looking up candidate trait instruments for Systolic blood pressure, automated reading || id:ukb-b-20175
-#> Extracting data for 10546 SNP(s) from 1 GWAS(s)
-#> 1 of 1 outcomes
-#>  [>] 1 of 2 chunks
-#>  [>] 2 of 2 chunks
-#>  instruments extracted for Systolic blood pressure, automated reading || id:ukb-b-20175
-#> Looking up exposure instruments for 139 candidate traits
-#> Extracting data for 233 SNP(s) from 139 GWAS(s)
-#> 30833 instruments extracted
-#> Removing outlier SNPs from candidate trait outcome lists
-#> Removed 212 outlier SNPs
-#> Performing MR of 139 candidate traits against Coronary heart disease || id:ieu-a-7
-#> Performing MR of 139 candidate traits against Systolic blood pressure, automated reading || id:ukb-b-20175
-#> Performing MR of Systolic blood pressure, automated reading || id:ukb-b-20175 against 139 candidate traits
-
-
-

-Step-by-step analysis

-

The analysis performed by mrtryx() can be broken down into multiple steps, running the following commands:

-
-# Find outlier SNPs in the exposure-outcome analysis
-x$get_outliers()
-
-# Find traits in the MR-Base database that those outliers associate with. These traits are known as 'candidate traits'
-x$set_candidate_traits()
-x$scan()
-
-

Note that you can browse available traits here: https://gwas.mrcieu.ac.uk/ and get a complete list using:

-
-traits <- TwoSampleMR::available_outcomes()
-
-
-# Extract instruments for those 'candidate traits'
-x$extractions() #which includes the following functions:
-  x$candidate_instruments()
-  x$outcome_instruments()
-  x$exposure_instruments()
-  x$exposure_candidate_instruments()
-
-# Make datasets for MR analysis
-x$harmonise() #which includes the following functions:
-  x$candidate_outcome_dat()
-  x$candidate_exposure_dat()
-  x$exposure_candidate_dat()
-
-# Perform MR of each of those 'candidate traits' against the exposure and the outcomes
-x$mr()
-
-

See the ?Tryx for options on the parameters for this analysis. e.g. You can specify your own set of outliers, for example SNPs that have extreme p-values in the outcome GWAS

-
-a <- as.character(subset(dat, pval.outcome < 5e-8)$SNP)
-x <- Tryx$new(dat)
-x$mrtryx(outliers=a)
-
-

The next steps are to determine which of the candidate traits are of interest (e.g. using p-value thresholds), visualise the results, and adjust the exposure-outcome estimates based on knowledge of the ‘candidate trait’ associations.

+
+library(tryx)
+x <- Tryx$new(dat)
+x$mrtryx()
+
+

Step-by-step analysis +

+

The analysis performed by mrtryx() can be broken down +into multiple steps, running the following commands:

+
+# Find outlier SNPs in the exposure-outcome analysis
+x$get_outliers()
+
+# Find traits in the MR-Base database that those outliers associate with. These traits are known as 'candidate traits'
+x$set_candidate_traits()
+x$scan()
+

Note that you can browse available traits here: https://gwas.mrcieu.ac.uk/ and get a complete list +using:

+
+traits <- TwoSampleMR::available_outcomes()
+
+# Extract instruments for those 'candidate traits'
+x$extractions() #which includes the following functions:
+  x$candidate_instruments()
+  x$outcome_instruments()
+  x$exposure_instruments()
+  x$exposure_candidate_instruments()
+
+# Make datasets for MR analysis
+x$harmonise() #which includes the following functions:
+  x$candidate_outcome_dat()
+  x$candidate_exposure_dat()
+  x$exposure_candidate_dat()
+
+# Perform MR of each of those 'candidate traits' against the exposure and the outcomes
+x$mr()
+

See the ?Tryx for options on the parameters for this +analysis. e.g. You can specify your own set of outliers, for example +SNPs that have extreme p-values in the outcome GWAS

+
+a <- as.character(subset(dat, pval.outcome < 5e-8)$SNP)
+x <- Tryx$new(dat)
+x$mrtryx(outliers=a)
+

The next steps are to determine which of the candidate traits are of +interest (e.g. using p-value thresholds), visualise the results, and +adjust the exposure-outcome estimates based on knowledge of the +‘candidate trait’ associations.

-
-

-Significant candidate traits

-

One can determine which of the putative associations might be ‘interesting’ in different ways. We have provided a simple convenience function to apply different multiple testing corrections. e.g.

-
-x$tryx.sig()
-#> Adjusting p-value
-#> * * * *
-#> Number of candidate - outcome associations: 78
-#> * * * *
-#> Large vessel disease || id:ieu-a-1110
-#> HDL cholesterol || id:ieu-a-299
-#> LDL cholesterol || id:ieu-a-300
-#> Total cholesterol || id:ieu-a-301
-#> Myocardial infarction || id:ieu-a-798
-#> Interleukin-2 receptor subunit beta || id:prot-a-1519
-#> Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466
-#> Illnesses of mother: None of the above (group 1) || id:ukb-b-10454
-#> Age high blood pressure diagnosed || id:ukb-b-1061
-#> Standing height || id:ukb-b-10787
-#> Diagnoses - secondary ICD10: Z95.1 Presence of aortocoronary bypass graft || id:ukb-b-11064
-#> Father's age at death || id:ukb-b-11303
-#> Vascular/heart problems diagnosed by doctor: Heart attack || id:ukb-b-11590
-#> Treatment/medication code: atenolol || id:ukb-b-11632
-#> Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740
-#> Weight || id:ukb-b-11842
-#> Treatment/medication code: ramipril || id:ukb-b-11895
-#> Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#> Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> Operation code: coronary artery bypass grafts (cabg) || id:ukb-b-12465
-#> Illnesses of mother: Heart disease || id:ukb-b-12477
-#> Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#> Treatment speciality of consultant (recoded): General medicine || id:ukb-b-12646
-#> Arm fat percentage (right) || id:ukb-b-12854
-#> Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> Birth weight || id:ukb-b-13378
-#> 3mm weak meridian (right) || id:ukb-b-13506
-#> Long-standing illness, disability or infirmity || id:ukb-b-13764
-#> Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> Illnesses of siblings: Heart disease || id:ukb-b-14371
-#> Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#> Illnesses of father: None of the above (group 1) || id:ukb-b-15169
-#> Operative procedures - main OPCS: K45.3 Anastomosis of mammary artery to left anterior descending coronary artery || id:ukb-b-15491
-#> Hip circumference || id:ukb-b-15590
-#> Diagnoses - secondary ICD10: I20.9 Angina pectoris, unspecified || id:ukb-b-15686
-#> Diagnoses - secondary ICD10: Z95.5 Presence of coronary angioplasty implant and graft || id:ukb-b-15748
-#> Non-cancer illness code, self-reported: heart attack/myocardial infarction || id:ukb-b-15829
-#> Main speciality of consultant (recoded): Cardiology || id:ukb-b-16376
-#> Trunk fat percentage || id:ukb-b-16407
-#> Diagnoses - secondary ICD10: I25.8 Other forms of chronic ischaemic heart disease || id:ukb-b-16606
-#> Diagnoses - main ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-1668
-#> Treatment/medication code: ibuprofen || id:ukb-b-16866
-#> Sitting height || id:ukb-b-16881
-#> Illnesses of siblings: None of the above (group 1) || id:ukb-b-17360
-#> Trunk fat-free mass || id:ukb-b-17409
-#> Operative procedures - secondary OPCS: Y02.2 Insertion of prosthesis into organ NOC || id:ukb-b-1744
-#> Treatment/medication code: levothyroxine sodium || id:ukb-b-17918
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> Operative procedures - main OPCS: K49.1 Percutaneous transluminal balloon angioplasty of one coronary artery || id:ukb-b-18018
-#> Illnesses of mother: High blood pressure || id:ukb-b-18167
-#> Leg fat percentage (left) || id:ukb-b-18377
-#> Illnesses of father: Heart disease || id:ukb-b-18408
-#> Treatment/medication code: bendroflumethiazide || id:ukb-b-18799
-#> Impedance of arm (left) || id:ukb-b-19379
-#> Non-cancer illness code, self-reported: hypothyroidism/myxoedema || id:ukb-b-19732
-#> Impedance of whole body || id:ukb-b-19921
-#> Trunk fat mass || id:ukb-b-20044
-#> Arm fat percentage (left) || id:ukb-b-20188
-#> Taking other prescription medications || id:ukb-b-20292
-#> Treatment speciality of consultant (recoded): Cardiology || id:ukb-b-20300
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: None of the above || id:ukb-b-20379
-#> Leg fat percentage (right) || id:ukb-b-20531
-#> Birth weight of first child || id:ukb-b-3357
-#> Number of treatments/medications taken || id:ukb-b-3656
-#> Number of self-reported non-cancer illnesses || id:ukb-b-4063
-#> Diagnoses - secondary ICD10: E03.9 Hypothyroidism, unspecified || id:ukb-b-4226
-#> Medication for pain relief, constipation, heartburn: Aspirin || id:ukb-b-7137
-#> Diagnoses - secondary ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-7436
-#> Impedance of arm (right) || id:ukb-b-7859
-#> Operation code: coronary angioplasty (ptca) +/- stent || id:ukb-b-7869
-#> Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> Vascular/heart problems diagnosed by doctor: Angina || id:ukb-b-8468
-#> Non-cancer illness code, self-reported: angina || id:ukb-b-8650
-#> Illnesses of siblings: High blood pressure || id:ukb-b-8746
-#> Treatment/medication code: aspirin || id:ukb-b-8755
-#> Body fat percentage || id:ukb-b-8909
-#> Treatment/medication code: amlodipine || id:ukb-b-9207
-#> 
-#> * * * *
-#> Number of candidate - exposure associations: 68
-#> * * * *
-#> Large vessel disease || id:ieu-a-1110
-#> Interleukin-2 receptor subunit beta || id:prot-a-1519
-#> Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466
-#> Illnesses of mother: None of the above (group 1) || id:ukb-b-10454
-#> Age high blood pressure diagnosed || id:ukb-b-1061
-#> Standing height || id:ukb-b-10787
-#> Treatment/medication code: atenolol || id:ukb-b-11632
-#> Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740
-#> Treatment/medication code: ramipril || id:ukb-b-11895
-#> Pulse wave Arterial Stiffness index || id:ukb-b-11971
-#> Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#> Peak expiratory flow (PEF) || id:ukb-b-12019
-#> Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#> Leg fat-free mass (right) || id:ukb-b-12828
-#> Arm fat percentage (right) || id:ukb-b-12854
-#> Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> Whole body fat-free mass || id:ukb-b-13354
-#> Birth weight || id:ukb-b-13378
-#> 6mm weak meridian (right) || id:ukb-b-13416
-#> 3mm weak meridian (right) || id:ukb-b-13506
-#> Long-standing illness, disability or infirmity || id:ukb-b-13764
-#> Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> Leg predicted mass (right) || id:ukb-b-14310
-#> Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#> Whole body water mass || id:ukb-b-14540
-#> 3mm strong meridian (left) || id:ukb-b-14664
-#> Leg fat-free mass (left) || id:ukb-b-16099
-#> Trunk fat percentage || id:ukb-b-16407
-#> Basal metabolic rate || id:ukb-b-16446
-#> Arm predicted mass (right) || id:ukb-b-16698
-#> Treatment/medication code: ibuprofen || id:ukb-b-16866
-#> Sitting height || id:ukb-b-16881
-#> Leg predicted mass (left) || id:ukb-b-17271
-#> Illnesses of siblings: None of the above (group 1) || id:ukb-b-17360
-#> Trunk fat-free mass || id:ukb-b-17409
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> Non-cancer illness code, self-reported: asthma || id:ukb-b-18113
-#> Illnesses of mother: High blood pressure || id:ukb-b-18167
-#> Leg fat percentage (left) || id:ukb-b-18377
-#> Treatment/medication code: bendroflumethiazide || id:ukb-b-18799
-#> Impedance of arm (left) || id:ukb-b-19379
-#> Illnesses of father: High blood pressure || id:ukb-b-19456
-#> Impedance of whole body || id:ukb-b-19921
-#> Arm fat-free mass (left) || id:ukb-b-19925
-#> Trunk fat mass || id:ukb-b-20044
-#> Arm fat percentage (left) || id:ukb-b-20188
-#> Ever smoked || id:ukb-b-20261
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: None of the above || id:ukb-b-20379
-#> Leg fat percentage (right) || id:ukb-b-20531
-#> Birth weight of first child || id:ukb-b-3357
-#> Number of treatments/medications taken || id:ukb-b-3656
-#> Operation code: hysterectomy || id:ukb-b-3700
-#> Number of self-reported non-cancer illnesses || id:ukb-b-4063
-#> Lifetime number of sexual partners || id:ukb-b-4256
-#> 6mm strong meridian (left) || id:ukb-b-645
-#> Impedance of arm (right) || id:ukb-b-7859
-#> Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> Vascular/heart problems diagnosed by doctor: Angina || id:ukb-b-8468
-#> Non-cancer illness code, self-reported: angina || id:ukb-b-8650
-#> Illnesses of siblings: High blood pressure || id:ukb-b-8746
-#> Treatment/medication code: aspirin || id:ukb-b-8755
-#> Pulse wave peak to peak time || id:ukb-b-8778
-#> Body fat percentage || id:ukb-b-8909
-#> Arm predicted mass (left) || id:ukb-b-9093
-#> Treatment/medication code: amlodipine || id:ukb-b-9207
-#> Trunk predicted mass || id:ukb-b-9685
-#> 
-#> * * * *
-#> Number of exposure - candidate associations: 89
-#> * * * *
-#> Large vessel disease || id:ieu-a-1110
-#> Interleukin-2 receptor subunit beta || id:prot-a-1519
-#> Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466
-#> Illnesses of mother: None of the above (group 1) || id:ukb-b-10454
-#> Age high blood pressure diagnosed || id:ukb-b-1061
-#> Standing height || id:ukb-b-10787
-#> Treatment/medication code: atenolol || id:ukb-b-11632
-#> Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740
-#> Treatment/medication code: ramipril || id:ukb-b-11895
-#> Pulse wave Arterial Stiffness index || id:ukb-b-11971
-#> Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#> Peak expiratory flow (PEF) || id:ukb-b-12019
-#> Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#> Leg fat-free mass (right) || id:ukb-b-12828
-#> Arm fat percentage (right) || id:ukb-b-12854
-#> Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> Whole body fat-free mass || id:ukb-b-13354
-#> Birth weight || id:ukb-b-13378
-#> 6mm weak meridian (right) || id:ukb-b-13416
-#> 3mm weak meridian (right) || id:ukb-b-13506
-#> Long-standing illness, disability or infirmity || id:ukb-b-13764
-#> Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> Leg predicted mass (right) || id:ukb-b-14310
-#> Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#> Whole body water mass || id:ukb-b-14540
-#> 3mm strong meridian (left) || id:ukb-b-14664
-#> Leg fat-free mass (left) || id:ukb-b-16099
-#> Trunk fat percentage || id:ukb-b-16407
-#> Basal metabolic rate || id:ukb-b-16446
-#> Arm predicted mass (right) || id:ukb-b-16698
-#> Treatment/medication code: ibuprofen || id:ukb-b-16866
-#> Sitting height || id:ukb-b-16881
-#> Leg predicted mass (left) || id:ukb-b-17271
-#> Illnesses of siblings: None of the above (group 1) || id:ukb-b-17360
-#> Trunk fat-free mass || id:ukb-b-17409
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> Non-cancer illness code, self-reported: asthma || id:ukb-b-18113
-#> Illnesses of mother: High blood pressure || id:ukb-b-18167
-#> Leg fat percentage (left) || id:ukb-b-18377
-#> Treatment/medication code: bendroflumethiazide || id:ukb-b-18799
-#> Impedance of arm (left) || id:ukb-b-19379
-#> Illnesses of father: High blood pressure || id:ukb-b-19456
-#> Impedance of whole body || id:ukb-b-19921
-#> Arm fat-free mass (left) || id:ukb-b-19925
-#> Trunk fat mass || id:ukb-b-20044
-#> Arm fat percentage (left) || id:ukb-b-20188
-#> Ever smoked || id:ukb-b-20261
-#> Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: None of the above || id:ukb-b-20379
-#> Leg fat percentage (right) || id:ukb-b-20531
-#> Birth weight of first child || id:ukb-b-3357
-#> Number of treatments/medications taken || id:ukb-b-3656
-#> Operation code: hysterectomy || id:ukb-b-3700
-#> Number of self-reported non-cancer illnesses || id:ukb-b-4063
-#> Lifetime number of sexual partners || id:ukb-b-4256
-#> 6mm strong meridian (left) || id:ukb-b-645
-#> Impedance of arm (right) || id:ukb-b-7859
-#> Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> Vascular/heart problems diagnosed by doctor: Angina || id:ukb-b-8468
-#> Non-cancer illness code, self-reported: angina || id:ukb-b-8650
-#> Illnesses of siblings: High blood pressure || id:ukb-b-8746
-#> Treatment/medication code: aspirin || id:ukb-b-8755
-#> Pulse wave peak to peak time || id:ukb-b-8778
-#> Body fat percentage || id:ukb-b-8909
-#> Arm predicted mass (left) || id:ukb-b-9093
-#> Treatment/medication code: amlodipine || id:ukb-b-9207
-#> Trunk predicted mass || id:ukb-b-9685
-
-

Will by default use FDR of 5%. See ?Tryx for more options.

+
+

Significant candidate traits +

+

One can determine which of the putative associations might be +‘interesting’ in different ways. We have provided a simple convenience +function to apply different multiple testing corrections. e.g.

+
+x$tryx.sig()
+

Will by default use FDR of 5%. See ?Tryx for more +options.

-
-

-Adjustment

-

Finally, to adjust the SNP effects on the exposure and outcome traits given their influences on the candidate traits, we can run:

-
-x$analyse()
-#>    p->y:  rs9349379  - Diagnoses - secondary ICD10: I20.9 Angina pectoris, unspecified || id:ukb-b-15686
-#> x<-p->y:  rs10774625 - Birth weight || id:ukb-b-13378
-#>    p->y:  rs6430078  - Illnesses of father: Heart disease || id:ukb-b-18408
-#> x<-p->y:  rs10774625 - Long-standing illness, disability or infirmity || id:ukb-b-13764
-#> x<-p->y:  rs10774625 - Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> x<-p->y:  rs2681492  - Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> x<-p->y:  rs10774625 - Treatment/medication code: aspirin || id:ukb-b-8755
-#> x<-p->y:  rs10774625 - Treatment/medication code: atenolol || id:ukb-b-11632
-#> x<-p->y:  rs10774625 - Illnesses of siblings: High blood pressure || id:ukb-b-8746
-#>    p->y:  rs9349379  - Illnesses of siblings: Heart disease || id:ukb-b-14371
-#> x<-p->y:  rs2681492  - Treatment/medication code: bendroflumethiazide || id:ukb-b-18799
-#> x<-p->y:  rs57866767 - Treatment/medication code: amlodipine || id:ukb-b-9207
-#>    p->y:  rs9349379  - Operation code: coronary angioplasty (ptca) +/- stent || id:ukb-b-7869
-#>    p->y:  rs10774625 - Treatment speciality of consultant (recoded): Cardiology || id:ukb-b-20300
-#> x<-p->y:  rs57866767 - Impedance of arm (left) || id:ukb-b-19379
-#> x<-p->y:  rs35114617 - Sitting height || id:ukb-b-16881
-#> x<-p->y:  rs8027450  - Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#>    p->y:  rs9349379  - Illnesses of mother: Heart disease || id:ukb-b-12477
-#>    p->y:  rs10774625 - Vascular/heart problems diagnosed by doctor: Heart attack || id:ukb-b-11590
-#> x<-p->y:  rs2681492  - Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#>    p->y:  rs9349379  - Diagnoses - secondary ICD10: Z95.5 Presence of coronary angioplasty implant and graft || id:ukb-b-15748
-#> x<-p->y:  rs57866767 - 3mm weak meridian (right) || id:ukb-b-13506
-#>    p->y:  rs10774625 - Hip circumference || id:ukb-b-15590
-#>    p->y:  rs10774625 - Illnesses of father: None of the above (group 1) || id:ukb-b-15169
-#>    p->y:  rs8027450  - Illnesses of father: None of the above (group 1) || id:ukb-b-15169
-#> x<-p->y:  rs57866767 - Impedance of whole body || id:ukb-b-19921
-#> x<-p->y:  rs57866767 - Arm fat percentage (left) || id:ukb-b-20188
-#> x<-p->y:  rs57866767 - Birth weight || id:ukb-b-13378
-#>    p->y:  rs9349379  - Diagnoses - secondary ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-7436
-#> x<-p->y:  rs10774625 - Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: None of the above || id:ukb-b-20379
-#>    p->y:  rs10774625 - Diagnoses - secondary ICD10: E03.9 Hypothyroidism, unspecified || id:ukb-b-4226
-#> x<-p->y:  rs10774625 - Standing height || id:ukb-b-10787
-#>    p->y:  rs9349379  - Operative procedures - secondary OPCS: Y02.2 Insertion of prosthesis into organ NOC || id:ukb-b-1744
-#> x<-p->y:  rs57866767 - Leg fat percentage (left) || id:ukb-b-18377
-#> x<-p->y:  rs57866767 - Body fat percentage || id:ukb-b-8909
-#> x<-p->y:  rs10774625 - Age high blood pressure diagnosed || id:ukb-b-1061
-#> x<-p->y:  rs8027450  - Illnesses of mother: High blood pressure || id:ukb-b-18167
-#>    p->y:  rs10774625 - Medication for pain relief, constipation, heartburn: Aspirin || id:ukb-b-7137
-#>    p->y:  rs9349379  - Non-cancer illness code, self-reported: heart attack/myocardial infarction || id:ukb-b-15829
-#>    p->y:  rs9349379  - Diagnoses - secondary ICD10: I25.8 Other forms of chronic ischaemic heart disease || id:ukb-b-16606
-#> x<-p->y:  rs10774625 - Illnesses of siblings: None of the above (group 1) || id:ukb-b-17360
-#> x<-p->y:  rs57866767 - Leg fat percentage (right) || id:ukb-b-20531
-#> x<-p->y:  rs57866767 - Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> x<-p->y:  rs10774625 - Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#> x<-p->y:  rs2681492  - Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#> x<-p->y:  rs57866767 - Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#>    p->y:  rs10774625 - Diagnoses - secondary ICD10: Z95.5 Presence of coronary angioplasty implant and graft || id:ukb-b-15748
-#>    p->y:  rs10774625 - Weight || id:ukb-b-11842
-#> x<-p->y:  rs8027450  - Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> x<-p->y:  rs57866767 - Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> x<-p->y:  rs2681492  - Diastolic blood pressure, automated reading || id:ukb-b-7992
-#>    p->y:  rs10774625 - Diagnoses - secondary ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-7436
-#>    p->y:  rs9349379  - Diagnoses - secondary ICD10: Z95.1 Presence of aortocoronary bypass graft || id:ukb-b-11064
-#> x<-p->y:  rs35114617 - Standing height || id:ukb-b-10787
-#>    p->y:  rs10774625 - Non-cancer illness code, self-reported: hypothyroidism/myxoedema || id:ukb-b-19732
-#>    p->y:  rs10774625 - Treatment/medication code: levothyroxine sodium || id:ukb-b-17918
-#> x<-p->y:  rs10774625 - Treatment/medication code: ramipril || id:ukb-b-11895
-#>    p->y:  rs8027450  - Illnesses of father: Heart disease || id:ukb-b-18408
-#> x<-p->y:  rs8027450  - Illnesses of siblings: High blood pressure || id:ukb-b-8746
-#> x<-p->y:  rs57866767 - Arm fat percentage (right) || id:ukb-b-12854
-#> x<-p->y:  rs10774625 - Trunk fat-free mass || id:ukb-b-17409
-#>    p->y:  rs9349379  - Operative procedures - main OPCS: K45.3 Anastomosis of mammary artery to left anterior descending coronary artery || id:ukb-b-15491
-#> x<-p->y:  rs8027450  - Birth weight of first child || id:ukb-b-3357
-#>    p->y:  rs9349379  - Main speciality of consultant (recoded): Cardiology || id:ukb-b-16376
-#> x<-p->y:  rs8027450  - Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> x<-p->y:  rs2681492  - Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> x<-p->y:  rs57866767 - Impedance of arm (right) || id:ukb-b-7859
-#> x<-p->y:  rs10774625 - 3mm weak meridian (right) || id:ukb-b-13506
-#> x<-p->y:  rs57866767 - Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> x<-p->y:  rs10774625 - Impedance of whole body || id:ukb-b-19921
-#> x<-p->y:  rs6430078  - Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> x<-p->y:  rs8027450  - Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> x<-p->y:  rs57866767 - Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones: Blood pressure medication || id:ukb-b-18009
-#> x<-p->y:  rs10774625 - Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#> x<-p->y:  rs8027450  - Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#> x<-p->y:  rs57866767 - Diagnoses - secondary ICD10: I10 Essential (primary) hypertension || id:ukb-b-12493
-#>    p->y:  rs10774625 - Treatment speciality of consultant (recoded): General medicine || id:ukb-b-12646
-#> x<-p->y:  rs8027450  - Treatment/medication code: atenolol || id:ukb-b-11632
-#> x<-p->y:  rs10774625 - Number of treatments/medications taken || id:ukb-b-3656
-#> x<-p->y:  rs9349379  - Treatment/medication code: ibuprofen || id:ukb-b-16866
-#> x<-p->y:  rs57866767 - Trunk fat-free mass || id:ukb-b-17409
-#> x<-p->y:  rs10774625 - Birth weight of first child || id:ukb-b-3357
-#> x<-p->y:  rs10774625 - Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> x<-p->y:  rs57866767 - Vascular/heart problems diagnosed by doctor: None of the above || id:ukb-b-13352
-#> x<-p->y:  rs2681492  - Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> x<-p->y:  rs10774625 - Non-cancer illness code, self-reported: hypertension || id:ukb-b-14057
-#> x<-p->y:  rs10774625 - Impedance of arm (right) || id:ukb-b-7859
-#>    p->y:  rs9349379  - Operative procedures - main OPCS: K49.1 Percutaneous transluminal balloon angioplasty of one coronary artery || id:ukb-b-18018
-#> x<-p->y:  rs8027450  - Medication for cholesterol, blood pressure or diabetes: None of the above || id:ukb-b-12014
-#>    p->y:  rs10774625 - Father's age at death || id:ukb-b-11303
-#> x<-p->y:  rs2681492  - Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> x<-p->y:  rs10774625 - Vascular/heart problems diagnosed by doctor: High blood pressure || id:ukb-b-14177
-#> x<-p->y:  rs10774625 - Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> x<-p->y:  rs8027450  - Diastolic blood pressure, automated reading || id:ukb-b-7992
-#> x<-p->y:  rs8027450  - Birth weight || id:ukb-b-13378
-#> x<-p->y:  rs57866767 - Trunk fat percentage || id:ukb-b-16407
-#>    p->y:  rs10774625 - Illnesses of father: Heart disease || id:ukb-b-18408
-#>    p->y:  rs9349379  - Illnesses of father: Heart disease || id:ukb-b-18408
-#> x<-p->y:  rs8027450  - Treatment/medication code: ramipril || id:ukb-b-11895
-#> x<-p->y:  rs9349379  - Vascular/heart problems diagnosed by doctor: Angina || id:ukb-b-8468
-#>    p->y:  rs9349379  - Operation code: coronary artery bypass grafts (cabg) || id:ukb-b-12465
-#> x<-p->y:  rs2971603  - Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> x<-p->y:  rs9349379  - Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#>    p->y:  rs10774625 - Taking other prescription medications || id:ukb-b-20292
-#> x<-p->y:  rs8027450  - Age high blood pressure diagnosed || id:ukb-b-1061
-#> x<-p->y:  rs9349379  - Non-cancer illness code, self-reported: angina || id:ukb-b-8650
-#> x<-p->y:  rs10774625 - Treatment/medication code: bendroflumethiazide || id:ukb-b-18799
-#> x<-p->y:  rs8027450  - Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740
-#>    p->y:  rs10774625 - Non-cancer illness code, self-reported: heart attack/myocardial infarction || id:ukb-b-15829
-#>    p->y:  rs9349379  - Treatment speciality of consultant (recoded): Cardiology || id:ukb-b-20300
-#> x<-p->y:  rs10774625 - Impedance of arm (left) || id:ukb-b-19379
-#> x<-p->y:  rs10774625 - Number of self-reported non-cancer illnesses || id:ukb-b-4063
-#>    p->y:  rs9349379  - Diagnoses - main ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-1668
-#>    p->y:  rs10774625 - Diagnoses - main ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-1668
-#>    p->y:  rs7798197  - Diagnoses - main ICD10: I25.1 Atherosclerotic heart disease || id:ukb-b-1668
-#> x<-p->y:  rs57866767 - Trunk fat mass || id:ukb-b-20044
-#>    p->y:  rs9349379  - Vascular/heart problems diagnosed by doctor: Heart attack || id:ukb-b-11590
-#> x<-p->y:  rs10774625 - Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#> x<-p->y:  rs8027450  - Medication for cholesterol, blood pressure or diabetes: Blood pressure medication || id:ukb-b-14395
-#> x<-p->y:  rs8027450  - Illnesses of mother: None of the above (group 1) || id:ukb-b-10454
-#> x<-p->y:  rs35114617 - Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466
-#> x<-p->y:  rs10774625 - Interleukin-2 receptor subunit beta || id:prot-a-1519
-#>    p->y:  rs9349379  - Myocardial infarction || id:ieu-a-798
-#>    p->y:  rs10774625 - Myocardial infarction || id:ieu-a-798
-#>    p->y:  rs10774625 - HDL cholesterol || id:ieu-a-299
-#> x<-p->y:  rs7798197  - Large vessel disease || id:ieu-a-1110
-#>    p->y:  rs10774625 - Total cholesterol || id:ieu-a-301
-#>    p->y:  rs2681492  - Myocardial infarction || id:ieu-a-798
-#>    p->y:  rs10774625 - LDL cholesterol || id:ieu-a-300
-
-

This will estimate the outlier effect that is due to the candidate pathways, adjust the outlier-outcome estimate, and re-perform MR of exposure on outcome with the adjusted outliers.

-

By default, this adjusts for the trait that has the largest impact for a particular SNP.

-

There is also a multivariable adjustment method here, where for each outlier, all candidate trait effects are estimated jointly:

-
-x$analyse.mv()
-
-

NOTE: it’s a good idea to check that there are no traits amongst the candidates that are identical or equivalent to the outcome:

-
-id_remove = c("ieu-a-1110", "ieu-a-798", "ukb-b-1061", "ukb-b-10454", "ukb-b-1061", "ukb-b-11064",
-              "ukb-b-11590", "ukb-b-11632", "ukb-b-11895", "ukb-b-11971", "ukb-b-12014", "ukb-b-12019", 
-              "ukb-b-12465", "ukb-b-12493", "ukb-b-13352", "ukb-b-13506", "ukb-b-12477", "ukb-b-12493",
-              "ukb-b-12646", "ukb-b-13352", "ukb-b-13506", "ukb-b-14057",   "ukb-b-14177", "ukb-b-14371",
-              "ukb-b-14395", "ukb-b-15169", "ukb-b-15491", "ukb-b-15686",   "ukb-b-15748", "ukb-b-15829",
-              "ukb-b-16376", "ukb-b-16606", "ukb-b-1668",   "ukb-b-17360", "ukb-b-18009",   "ukb-b-18018",
-              "ukb-b-18167", "ukb-b-18408", "ukb-b-18799", "ukb-b-20300",   "ukb-b-20379", "ukb-b-3656",
-              "ukb-b-4063", "ukb-b-7137", "ukb-b-7436", "ukb-b-7869",   "ukb-b-7992",   "ukb-b-8468",
-              "ukb-b-8650", "ukb-b-8746",   "ukb-b-9207",   "ieu-a-1110",   "ukb-b-1061",   "ukb-b-11971",
-              "ukb-b-12014", "ukb-b-12019", "ukb-b-19456", "ukb-b-8778", "ukb-b-10454", "ukb-b-11632",
-              "ukb-b-11895")
-
-x$analyse.mv(id_remove = id_remove)
-#> Estimating joint effects of the following trait(s) associated with rs10774625
-#> Birth weight || id:ukb-b-13378
-#> Long-standing illness, disability or infirmity || id:ukb-b-13764
-#> Treatment/medication code: aspirin || id:ukb-b-8755
-#> Hip circumference || id:ukb-b-15590
-#> Diagnoses - secondary ICD10: E03.9 Hypothyroidism, unspecified || id:ukb-b-4226
-#> Standing height || id:ukb-b-10787
-#> Weight || id:ukb-b-11842
-#> Non-cancer illness code, self-reported: hypothyroidism/myxoedema || id:ukb-b-19732
-#> Treatment/medication code: levothyroxine sodium || id:ukb-b-17918
-#> Trunk fat-free mass || id:ukb-b-17409
-#> Impedance of whole body || id:ukb-b-19921
-#> Birth weight of first child || id:ukb-b-3357
-#> Impedance of arm (right) || id:ukb-b-7859
-#> Father's age at death || id:ukb-b-11303
-#> Taking other prescription medications || id:ukb-b-20292
-#> Impedance of arm (left) || id:ukb-b-19379
-#> Interleukin-2 receptor subunit beta || id:prot-a-1519
-#> HDL cholesterol || id:ieu-a-299
-#> Total cholesterol || id:ieu-a-301
-#> LDL cholesterol || id:ieu-a-300
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Birth weight || id:ukb-b-13378. Just keeping the first instance:
-#> rs2140240
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Hip circumference || id:ukb-b-15590. Just keeping the first instance:
-#> rs1294438
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Impedance of arm (right) || id:ukb-b-7859. Just keeping the first instance:
-#> rs111650620
-#> rs1382568
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Standing height || id:ukb-b-10787. Just keeping the first instance:
-#> rs11252860
-#> rs34773647
-#> rs664317
-#> rs7978217
-#> rs11051456
-#> rs1019075
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat-free mass || id:ukb-b-17409. Just keeping the first instance:
-#> rs3735352
-#> rs3740591
-#> rs1040457
-#> Warning in format_data(d, type = "exposure", snps = NULL, phenotype_col =
-#> "phenotype", : eaf column is not numeric. Coercing...
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 4776 variants
-#> Removing 3745 of 4776 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 765 SNP(s) from 21 GWAS(s)
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs664317
-#> rs11252860
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and HDL cholesterol || id:ieu-a-299 (ieu-a-299)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs10498672, rs10499659, rs10505073, rs11122824, rs11664336, rs11756783, rs12258967, rs12572775, rs1290790, rs1420150, rs1467847, rs1556516, rs16905189, rs17010961, rs1867780, rs1875969, rs2138628, rs219162, rs2270894, rs2410728, rs2422054, rs2663335, rs2952615, rs3771382, rs3790086, rs3812163, rs4865956, rs519384, rs578475, rs6824592, rs7619139, rs7652177, rs7917801, rs7961994, rs832806, rs9352895, rs964184, rs968821
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and LDL cholesterol || id:ieu-a-300 (ieu-a-300)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs10498672, rs10499659, rs10505073, rs11122824, rs11664336, rs11756783, rs12258967, rs12572775, rs1290790, rs1420150, rs1467847, rs1556516, rs16905189, rs17010961, rs1867780, rs1875969, rs2138628, rs219162, rs2270894, rs2410728, rs2422054, rs2663335, rs2952615, rs3771382, rs3790086, rs3812163, rs4865956, rs519384, rs578475, rs6824592, rs7619139, rs7652177, rs7917801, rs7961994, rs832806, rs9352895, rs964184, rs968821
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Total cholesterol || id:ieu-a-301 (ieu-a-301)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs10498672, rs10499659, rs10505073, rs11122824, rs11664336, rs11756783, rs12258967, rs12572775, rs1290790, rs1420150, rs1467847, rs1556516, rs16905189, rs17010961, rs1867780, rs1875969, rs2138628, rs219162, rs2270894, rs2410728, rs2422054, rs2663335, rs2952615, rs3771382, rs3790086, rs3812163, rs4865956, rs519384, rs578475, rs6824592, rs7619139, rs7652177, rs7917801, rs7961994, rs832806, rs9352895, rs964184, rs968821
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Interleukin-2 receptor subunit beta || id:prot-a-1519 (prot-a-1519)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Standing height || id:ukb-b-10787 (ukb-b-10787)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Father's age at death || id:ukb-b-11303 (ukb-b-11303)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Weight || id:ukb-b-11842 (ukb-b-11842)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Birth weight || id:ukb-b-13378 (ukb-b-13378)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Long-standing illness, disability or infirmity || id:ukb-b-13764 (ukb-b-13764)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Hip circumference || id:ukb-b-15590 (ukb-b-15590)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Trunk fat-free mass || id:ukb-b-17409 (ukb-b-17409)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Treatment/medication code: levothyroxine sodium || id:ukb-b-17918 (ukb-b-17918)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of arm (left) || id:ukb-b-19379 (ukb-b-19379)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Non-cancer illness code, self-reported: hypothyroidism/myxoedema || id:ukb-b-19732 (ukb-b-19732)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of whole body || id:ukb-b-19921 (ukb-b-19921)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Taking other prescription medications || id:ukb-b-20292 (ukb-b-20292)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Birth weight of first child || id:ukb-b-3357 (ukb-b-3357)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Diagnoses - secondary ICD10: E03.9 Hypothyroidism, unspecified || id:ukb-b-4226 (ukb-b-4226)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of arm (right) || id:ukb-b-7859 (ukb-b-7859)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860, rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Treatment/medication code: aspirin || id:ukb-b-8755 (ukb-b-8755)
-#> Removing the following SNPs for incompatible alleles:
-#> rs664317, rs664317
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10228350, rs11664336, rs11756783, rs12572775, rs1290790, rs13264909, rs1467847, rs1556516, rs1580100, rs165656, rs3771382, rs3790086, rs3812163, rs418280, rs4243765, rs4302014, rs5759006, rs62134416, rs7652177, rs7754251, rs7917801, rs832806, rs9352895, rs9976812
-#> Performing shrinkage
-#> After shrinkage keeping:
-#> ieu-a-299
-#> ieu-a-300
-#> prot-a-1519
-#> ukb-b-10787
-#> ukb-b-11303
-#> ukb-b-11842
-#> ukb-b-13378
-#> ukb-b-13764
-#> ukb-b-17918
-#> ukb-b-19379
-#> ukb-b-20175
-#> ukb-b-20292
-#> ukb-b-3357
-#> ukb-b-4226
-#> ukb-b-8755
-#> Estimating joint effects of the following trait(s) associated with rs57866767
-#> Impedance of arm (left) || id:ukb-b-19379
-#> Impedance of whole body || id:ukb-b-19921
-#> Arm fat percentage (left) || id:ukb-b-20188
-#> Birth weight || id:ukb-b-13378
-#> Leg fat percentage (left) || id:ukb-b-18377
-#> Body fat percentage || id:ukb-b-8909
-#> Leg fat percentage (right) || id:ukb-b-20531
-#> Arm fat percentage (right) || id:ukb-b-12854
-#> Impedance of arm (right) || id:ukb-b-7859
-#> Trunk fat-free mass || id:ukb-b-17409
-#> Trunk fat percentage || id:ukb-b-16407
-#> Trunk fat mass || id:ukb-b-20044
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Arm fat percentage (left) || id:ukb-b-20188. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Birth weight || id:ukb-b-13378. Just keeping the first instance:
-#> rs2140240
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Body fat percentage || id:ukb-b-8909. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Impedance of arm (right) || id:ukb-b-7859. Just keeping the first instance:
-#> rs111650620
-#> rs1382568
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat percentage (left) || id:ukb-b-18377. Just keeping the first instance:
-#> rs1428
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Leg fat percentage (right) || id:ukb-b-20531. Just keeping the first instance:
-#> rs7027096
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat mass || id:ukb-b-20044. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat percentage || id:ukb-b-16407. Just keeping the first instance:
-#> rs2731238
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Trunk fat-free mass || id:ukb-b-17409. Just keeping the first instance:
-#> rs3735352
-#> rs3740591
-#> rs1040457
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 5198 variants
-#> Removing 4002 of 5198 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 668 SNP(s) from 13 GWAS(s)
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs2731238
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Arm fat percentage (right) || id:ukb-b-12854 (ukb-b-12854)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Birth weight || id:ukb-b-13378 (ukb-b-13378)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Trunk fat percentage || id:ukb-b-16407 (ukb-b-16407)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Trunk fat-free mass || id:ukb-b-17409 (ukb-b-17409)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Leg fat percentage (left) || id:ukb-b-18377 (ukb-b-18377)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of arm (left) || id:ukb-b-19379 (ukb-b-19379)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of whole body || id:ukb-b-19921 (ukb-b-19921)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Trunk fat mass || id:ukb-b-20044 (ukb-b-20044)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Arm fat percentage (left) || id:ukb-b-20188 (ukb-b-20188)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Leg fat percentage (right) || id:ukb-b-20531 (ukb-b-20531)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Impedance of arm (right) || id:ukb-b-7859 (ukb-b-7859)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Body fat percentage || id:ukb-b-8909 (ukb-b-8909)
-#> Removing the following SNPs for incompatible alleles:
-#> rs2731238, rs2731238
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs1080347, rs10887578, rs11208779, rs12722976, rs13264909, rs1443641, rs1905095, rs2592828, rs28721380, rs2968669, rs3771382, rs3773851, rs445077, rs4714935, rs59086897, rs62134416, rs6540497, rs7491529, rs7788672, rs7917801, rs7971536, rs9882731, rs9976812
-#> Performing shrinkage
-#> After shrinkage keeping:
-#> ukb-b-12854
-#> ukb-b-13378
-#> ukb-b-17409
-#> ukb-b-20175
-#> ukb-b-20188
-#> ukb-b-20531
-#> ukb-b-7859
-#> Estimating joint effects of the following trait(s) associated with rs35114617
-#> Sitting height || id:ukb-b-16881
-#> Standing height || id:ukb-b-10787
-#> Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Sitting height || id:ukb-b-16881. Just keeping the first instance:
-#> rs4651157
-#> rs872937
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Standing height || id:ukb-b-10787. Just keeping the first instance:
-#> rs11252860
-#> rs34773647
-#> rs664317
-#> rs7978217
-#> rs11051456
-#> rs1019075
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 1620 variants
-#> Removing 796 of 1620 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 738 SNP(s) from 4 GWAS(s)
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs11252860
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Glutaminyl-peptide cyclotransferase-like protein || id:prot-a-2466 (prot-a-2466)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10811092, rs12572775, rs12722976, rs1290790, rs1467847, rs153661, rs3771382, rs3790086, rs3812163, rs418280, rs4302014, rs6947915, rs7652177, rs7847059, rs832806, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Standing height || id:ukb-b-10787 (ukb-b-10787)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10811092, rs12572775, rs12722976, rs1290790, rs1467847, rs153661, rs3771382, rs3790086, rs3812163, rs418280, rs4302014, rs6947915, rs7652177, rs7847059, rs832806, rs9976812
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Sitting height || id:ukb-b-16881 (ukb-b-16881)
-#> Removing the following SNPs for incompatible alleles:
-#> rs11252860, rs11252860
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs10811092, rs12572775, rs12722976, rs1290790, rs1467847, rs153661, rs3771382, rs3790086, rs3812163, rs418280, rs4302014, rs6947915, rs7652177, rs7847059, rs832806, rs9976812
-#> Performing shrinkage
-#> After shrinkage keeping:
-#> ukb-b-10787
-#> ukb-b-20175
-#> Estimating joint effects of the following trait(s) associated with rs8027450
-#> Birth weight of first child || id:ukb-b-3357
-#> Birth weight || id:ukb-b-13378
-#> Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Birth weight || id:ukb-b-13378. Just keeping the first instance:
-#> rs2140240
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 507 variants
-#> Removing 183 of 507 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 318 SNP(s) from 4 GWAS(s)
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Medication for cholesterol, blood pressure or diabetes: Cholesterol lowering medication || id:ukb-b-11740 (ukb-b-11740)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs1344672, rs2246832
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Birth weight || id:ukb-b-13378 (ukb-b-13378)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs1344672, rs2246832
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Birth weight of first child || id:ukb-b-3357 (ukb-b-3357)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs1344672, rs2246832
-#> Performing shrinkage
-#> After shrinkage keeping:
-#> ukb-b-11740
-#> ukb-b-13378
-#> ukb-b-20175
-#> ukb-b-3357
-#> Estimating joint effects of the following trait(s) associated with rs9349379
-#> Operative procedures - secondary OPCS: Y02.2 Insertion of prosthesis into organ NOC || id:ukb-b-1744
-#> Treatment/medication code: ibuprofen || id:ukb-b-16866
-#> Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Pain type(s) experienced in last month: Headache || id:ukb-b-12181. Just keeping the first instance:
-#> rs34555420
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 298 variants
-#> Removing 36 of 298 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 259 SNP(s) from 4 GWAS(s)
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Pain type(s) experienced in last month: Headache || id:ukb-b-12181 (ukb-b-12181)
-#> Removing the following SNPs for incompatible alleles:
-#> rs17811915, rs17811915
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs2246832
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Treatment/medication code: ibuprofen || id:ukb-b-16866 (ukb-b-16866)
-#> Removing the following SNPs for incompatible alleles:
-#> rs17811915, rs17811915
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs2246832
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Operative procedures - secondary OPCS: Y02.2 Insertion of prosthesis into organ NOC || id:ukb-b-1744 (ukb-b-1744)
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs2246832
-#> Performing shrinkage
-#> After shrinkage keeping:
-#> ukb-b-12181
-#> ukb-b-1744
-#> ukb-b-20175
-#> Estimating joint effects of the following trait(s) associated with rs2971603
-#> Pain type(s) experienced in last month: Headache || id:ukb-b-12181
-#> Only one candidate trait for SNP rs2971603 so performing standard MVMR instead of LASSO
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Pain type(s) experienced in last month: Headache || id:ukb-b-12181. Just keeping the first instance:
-#> rs34555420
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Warning: 'clump_data' is deprecated.
-#> Use 'ieugwasr::ld_clump()' instead.
-#> See help("Deprecated")
-#> Clumping 1, 292 variants
-#> Removing 34 of 292 variants due to LD with other variants or absence from LD reference panel
-#> Extracting data for 257 SNP(s) from 2 GWAS(s)
-#> Warning in .fun(piece, ...): Duplicated SNPs present in exposure data for phenotype 'Systolic blood pressure, automated reading || id:ukb-b-20175. Just keeping the first instance:
-#> rs17811915
-#> Harmonising Systolic blood pressure, automated reading || id:ukb-b-20175 (ukb-b-20175) and Pain type(s) experienced in last month: Headache || id:ukb-b-12181 (ukb-b-12181)
-#> Removing the following SNPs for incompatible alleles:
-#> rs17811915, rs17811915
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs11592442, rs12779675, rs1290790, rs2246832
-
+
+

Adjustment +

+

Finally, to adjust the SNP effects on the exposure and outcome traits +given their influences on the candidate traits, we can run:

+
+x$analyse()
+

This will estimate the outlier effect that is due to the candidate +pathways, adjust the outlier-outcome estimate, and re-perform MR of +exposure on outcome with the adjusted outliers.

+

By default, this adjusts for the trait that has the largest impact +for a particular SNP.

+

There is also a multivariable adjustment method here, where for each +outlier, all candidate trait effects are estimated jointly:

+
+x$analyse.mv()
+

NOTE: it’s a good idea to check that there are no traits amongst the +candidates that are identical or equivalent to the outcome:

+
+id_remove = c("ieu-a-1110", "ieu-a-798", "ukb-b-1061", "ukb-b-10454", "ukb-b-1061", "ukb-b-11064",
+              "ukb-b-11590", "ukb-b-11632", "ukb-b-11895", "ukb-b-11971", "ukb-b-12014", "ukb-b-12019", 
+              "ukb-b-12465", "ukb-b-12493", "ukb-b-13352", "ukb-b-13506", "ukb-b-12477", "ukb-b-12493",
+              "ukb-b-12646", "ukb-b-13352", "ukb-b-13506", "ukb-b-14057",   "ukb-b-14177", "ukb-b-14371",
+              "ukb-b-14395", "ukb-b-15169", "ukb-b-15491", "ukb-b-15686",   "ukb-b-15748", "ukb-b-15829",
+              "ukb-b-16376", "ukb-b-16606", "ukb-b-1668",   "ukb-b-17360", "ukb-b-18009",   "ukb-b-18018",
+              "ukb-b-18167", "ukb-b-18408", "ukb-b-18799", "ukb-b-20300",   "ukb-b-20379", "ukb-b-3656",
+              "ukb-b-4063", "ukb-b-7137", "ukb-b-7436", "ukb-b-7869",   "ukb-b-7992",   "ukb-b-8468",
+              "ukb-b-8650", "ukb-b-8746",   "ukb-b-9207",   "ieu-a-1110",   "ukb-b-1061",   "ukb-b-11971",
+              "ukb-b-12014", "ukb-b-12019", "ukb-b-19456", "ukb-b-8778", "ukb-b-10454", "ukb-b-11632",
+              "ukb-b-11895")
+
+x$analyse.mv(id_remove = id_remove)

The adjusted effect estimates:

-
-x$output$analyse.mv$estimates
-#>                             est         b         se         pval nsnp        Q
-#> 1                           Raw 0.5991067 0.07717696 2.642311e-13  233 870.8370
-#> 2        Outliers removed (all) 0.6437695 0.06349886 3.767303e-20  222 393.1945
-#> 3 Outliers removed (candidates) 0.7095277 0.05475819 6.135623e-29  227 553.3497
-#> 4             Outliers adjusted 0.6192846 0.06555078 3.930161e-18  233 616.0294
-#>   int       Isq
-#> 1   0 0.7312930
-#> 2   0 0.4328507
-#> 3   0 0.5879640
-#> 4   0 0.6201480
-
+
+x$output$analyse.mv$estimates
-
-

-Visualisation

-
-

-Adjustment plot

-

A plot is generated showing how SNP effects have changed due to candidate trait adjustments in:

-
-x$output$analyse.mv$plot
-
-

+
+

Visualisation +

+
+

Adjustment plot +

+

A plot is generated showing how SNP effects have changed due to +candidate trait adjustments in:

+
+x$output$analyse.mv$plot
-
-

-Network plot

-

To produce a basic diagram of the connectivity of SNPs, candidate traits, exposure and outcome:

-
-tryx.network(x$output)
-
-

This shows that some candidate traits influence the exposure only, the outcome only, or both the exposure and the outcome.

+
+

Network plot +

+

To produce a basic diagram of the connectivity of SNPs, candidate +traits, exposure and outcome:

+
+tryx.network(x$output)
+

This shows that some candidate traits influence the exposure only, +the outcome only, or both the exposure and the outcome.

-
-

-Volcano plot

-

You can also create a volcano plot of the candidate-exposure and/or candidate-outcome associations. e.g. to show exposures and outcomes

-
-volcano_plot(
-    rbind(x$output$candidate_exposure_mr, x$output$candidate_outcome_mr)
-)
-
-

+
+

Volcano plot +

+

You can also create a volcano plot of the candidate-exposure and/or +candidate-outcome associations. e.g. to show exposures and outcomes

+
+volcano_plot(
+    rbind(x$output$candidate_exposure_mr, x$output$candidate_outcome_mr)
+)

or e.g. just exposures

-
-volcano_plot(x$output$candidate_exposure_mr)
-
-

+
+volcano_plot(x$output$candidate_exposure_mr)
-
-

-Manhattan plot

-

Similar to the volcano plot, a Manhattan plot can also be produced. This can be done for the candidate-exposure associations

-
-x$manhattan_plot("exposure")
-x$output$plots$manhattan_plot
-
-

+
+

Manhattan plot +

+

Similar to the volcano plot, a Manhattan plot can also be produced. +This can be done for the candidate-exposure associations

+
+x$manhattan_plot("exposure")
+x$output$plots$manhattan_plot

or the candidate-outcome associations

-
-x$manhattan_plot("outcome")
-x$output$plots$manhattan_plot
-
-

+
+x$manhattan_plot("outcome")
+x$output$plots$manhattan_plot
+
-

Site built with pkgdown 1.5.1.9000.

+

+

Site built with pkgdown 2.2.1.

- + + + diff --git a/docs/articles/index.html b/docs/articles/index.html index 9132080..7fac1be 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,66 +1,12 @@ - - - - - - - -Articles • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Articles • tryx + - - - -
-
- - -
-
+
+
Guide to using MR-TRYX
+
+
-
- +
+ + - - - + diff --git a/docs/authors.html b/docs/authors.html index 0d0dea5..be5f7c8 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,66 +1,12 @@ - - - - - - - -Authors • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Authors and Citation • tryx - - + - - -
-
-
-
+
- @@ -137,22 +90,20 @@

Authors

-
- +
+ + - - - + diff --git a/docs/index.html b/docs/index.html index 04ac17a..187d347 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ MR-TRYX (treasure your exceptions) • tryx - + @@ -19,6 +19,8 @@ + +
@@ -70,120 +70,137 @@
- +

Note: Apologies if the scan function times out sometimes - there are changes being made to the underlying database which will be resolved soon. We will also be releasing a major update to this package in the next few days that will make it more resilient to timeouts

-
- +
+

Major update:

This package has been under major development and the way in which it is implemented has changed quite substantially. See below for how to revert to the previous version if necessary


-

Full documentation including a vignette is available here: https://explodecomputer.github.io/tryx/

+

Full documentation including a vignette is available here: https://explodecomputer.github.io/tryx/


This package will perform MR-TRYX analysis, which entails the following.

In MR analysis a major assumption is that the SNP influences the outcome only through the exposure. If the SNP influences the outcome through some other (candidate) traits, in addition to influencing through the exposure, then the MR estimate can be biased.

Knowing which traits through which SNPs might be acting in a horizontal pleiotropic manner allows us to exploit these outliers to:

-
    +
    1. Identify novel candidate traits that influence the outcome (and possibly the exposure also)
    2. Adjust the SNP-outcome / SNP-exposure ratio based on knowledge of the alternative pathways, thereby reducing heterogeneity in the original exposure-outcome effect estimate.

    This package uses the MR-Base infrastructure to search for alternative pathways through which instruments might influence the exposure.


    The package name TRYX (pronounced ‘tricks’) is taken from the phrase ‘TReasure Your Exceptions’, a quote from William Bateson (1908).

    -
    -

    -Requirements

    +
    +

    Requirements +

    This software is an R package that depends on various other packages available on CRAN (see DESCRIPTION file). It has only been tested on some R versions >= 3.2.0. The software will run on any standard laptop, desktop or server for which R can be installed.

    -
    -

    -Installation

    +
    +

    Installation +

    A beta development version can be installed directly from this repository.

    First install the TwoSampleMR and RadialMR R packages:

    -
    -        devtools::install_github("MRCIEU/TwoSampleMR")
    -        devtools::install_github("WSpiller/RadialMR")
    -
    +
    +        devtools::install_github("MRCIEU/TwoSampleMR")
    +        devtools::install_github("WSpiller/RadialMR")

    Next install the tryx package:

    -
    -        devtools::install_github("explodecomputer/tryx")
    -
    +
    +        devtools::install_github("explodecomputer/tryx")

    You may also want to install some plotting packages

    -
    -        install.packages(c("ggplot2", "ggrepel", "igraph"))
    -
    +
    +        install.packages(c("ggplot2", "ggrepel", "igraph"))

    and a package for simulating genotype-phenotype maps

    -
    -    devtools::install_github("explodecomputer/simulateGP")
    -
    +
    +    devtools::install_github("explodecomputer/simulateGP")

    It should not take more than a few minutes to install all of these packages.

    -
    -

    -Installing previous versions

    +
    +

    Installing previous versions +

    You can go back to an earlier version using:

    -
    -        devtools::install_github("explodecomputer/tryx@0.1.1")
    -
    +
    +        devtools::install_github("explodecomputer/tryx@0.1.1")
    -
    -
    - +
    + + - - - + diff --git a/docs/reference/cochrans_q.html b/docs/reference/cochrans_q.html index 17ce877..5841e3b 100644 --- a/docs/reference/cochrans_q.html +++ b/docs/reference/cochrans_q.html @@ -1,67 +1,12 @@ - - - - - - - -Cochran's Q statistic — cochrans_q • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Cochran's Q statistic — cochrans_q • tryx - - + - -
    -
    - - -
    -
    +
    @@ -127,50 +59,48 @@

    Cochran's Q statistic

    Cochran's Q statistic

    -
    cochrans_q(b, se)
    +
    +
    cochrans_q(b, se)
    +
    + +
    +

    Arguments

    + + +
    b
    +

    vector of effecti

    -

    Arguments

    - - - - - - - - - - -
    b

    vector of effecti

    se

    vector of standard errors

    -

    Value

    +
    se
    +

    vector of standard errors

    +
    +
    +

    Value

    q values

    +
    +
    -
    - +
+ + - - - + diff --git a/docs/reference/index.html b/docs/reference/index.html index 5ed5d72..ad9ff00 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,66 +1,12 @@ - - - - - - - -Function reference • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Package index • tryx - + - - -
-
- - -
-
+
- - - - - - - - - - -
-

All functions

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - -
+

All functions

+

Tryx

Class for MR-TRYX analysis

+

cochrans_q()

Cochran's Q statistic

+

strategy1()

MR Strategy 1

+

tryx.adjustment()

Outlier adjustment estimation

+

tryx.analyse()

Analyse tryx results

+

tryx.analyse.mv()

Analyse tryx results

+

Adjust and analyse the tryx results

tryx.network()

Plot results from outlier_scan in a network

+

tryx.scan()

Outlier scan

+

tryx.sig()

Identify putatively significant associations in the outlier scan

+

tryx.simulate()

Simulate data to test tryx

+

volcano_plot()

Plot volcano plot of many MR analyses

- +
+
-
- +
+ + - - - + diff --git a/docs/reference/strategy1.html b/docs/reference/strategy1.html index ec12bc8..9ced077 100644 --- a/docs/reference/strategy1.html +++ b/docs/reference/strategy1.html @@ -1,71 +1,16 @@ - - - - - - - -MR Strategy 1 — strategy1 • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -MR Strategy 1 — strategy1 • tryx - - - - - - - - - + - - - -
-
- - -
-
+
@@ -135,51 +67,48 @@

MR Strategy 1

Use weighted mode if more than some minimum number of SNPs and heterogeneity is high

-
strategy1(dat, het_threshold = 0.05, ivw_max_snp = 1)
- -

Arguments

- - - - - - - - - - - - - - -
dat

Output from harmonise_data function

het_threshold

The p-value threshold for Cochran's Q - if lower than this threshold then run weighted mode. Default p = 0.05

ivw_max_snp

Maximum SNPs to allow IVW result even if heterogeneity is high. Default = 1

+
+
strategy1(dat, het_threshold = 0.05, ivw_max_snp = 1)
+
+ +
+

Arguments

+
dat
+

Output from harmonise_data function

+ + +
het_threshold
+

The p-value threshold for Cochran's Q - if lower than this threshold then run weighted mode. Default p = 0.05

+ + +
ivw_max_snp
+

Maximum SNPs to allow IVW result even if heterogeneity is high. Default = 1

+ +
+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx-package.html b/docs/reference/tryx-package.html new file mode 100644 index 0000000..8fc62d6 --- /dev/null +++ b/docs/reference/tryx-package.html @@ -0,0 +1,101 @@ + +tryx: MR-TRYX (treasure your exceptions) — tryx-package • tryx + + +
+
+ + + +
+
+ + +
+

Heterogeneity in MR analyses can arise due to horizontal pleiotropy. This package uses MR-Base to identify possible traits that can explain the heterogeneity, with a view to identifying novel putative associations, and adjusting for their influences to reduce heterogeneity and improve power.

+
+ + + +
+

Author

+

Maintainer: Gibran Hemani g.hemani@bristol.ac.uk

+

Authors:

+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.2.1.

+
+ +
+ + + + + + + + diff --git a/docs/reference/tryx.adjustment.html b/docs/reference/tryx.adjustment.html index 2e490b8..a14cb90 100644 --- a/docs/reference/tryx.adjustment.html +++ b/docs/reference/tryx.adjustment.html @@ -1,67 +1,12 @@ - - - - - - - -Outlier adjustment estimation — tryx.adjustment • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Outlier adjustment estimation — tryx.adjustment • tryx - - + - -
-
- - -
-
+
@@ -127,50 +59,48 @@

Outlier adjustment estimation

How much of the heterogeneity due to the outlier can be explained by alternative pathways?

-
tryx.adjustment(tryxscan, id_remove = NULL)
+
+
tryx.adjustment(tryxscan, id_remove = NULL)
+
+ +
+

Arguments

+ + +
tryxscan
+

Output from tryx.scan

-

Arguments

- - - - - - - - - - -
tryxscan

Output from tryx.scan

id_remove

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

-

Value

+
id_remove
+

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

+
+
+

Value

data frame of adjusted effect estimates and heterogeneity stats

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.analyse.html b/docs/reference/tryx.analyse.html index 587b9d8..094289d 100644 --- a/docs/reference/tryx.analyse.html +++ b/docs/reference/tryx.analyse.html @@ -1,69 +1,14 @@ - - - - - - - -Analyse tryx results — tryx.analyse • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Analyse tryx results — tryx.analyse • tryx - - + - -
-
- - -
-
+
-

This returns various heterogeneity statistics, IVW estimates for raw, -adjusted and outlier removed datasets, and summary of peripheral +

This returns various heterogeneity statistics, IVW estimates for raw, +adjusted and outlier removed datasets, and summary of peripheral traits detected etc.

-
tryx.analyse(
-  tryxscan,
-  plot = TRUE,
-  id_remove = NULL,
-  filter_duplicate_outliers = TRUE
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - -
tryxscan

Output from tryx.scan

plot

Whether to plot or not. Default is TRUE

id_remove

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

duplicate_outliers_method

Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity

- -

Value

- -

List of +

+
tryx.analyse(
+  tryxscan,
+  plot = TRUE,
+  id_remove = NULL,
+  filter_duplicate_outliers = TRUE
+)
+
+ +
+

Arguments

+ + +
tryxscan
+

Output from tryx.scan

+ + +
plot
+

Whether to plot or not. Default is TRUE

+ + +
id_remove
+

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

+ + +
filter_duplicate_outliers
+

Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity

+ +
+
+

Value

+

List of - adj_full: data frame of SNP adjustments for all candidate traits - adj: The results from adj_full selected to adjust the exposure-outcome model - Q: Heterogeneity stats - estimates: Adjusted and unadjested exposure-outcome effects - plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.analyse.mv.html b/docs/reference/tryx.analyse.mv.html index 61aa3a4..5face3d 100644 --- a/docs/reference/tryx.analyse.mv.html +++ b/docs/reference/tryx.analyse.mv.html @@ -1,69 +1,12 @@ - - - - - - - -Analyse tryx results — tryx.analyse.mv • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Adjust and analyse the tryx results — tryx.analyse.mv • tryx - - + - -
-
- - -
-
+
-

This returns various heterogeneity statistics, IVW estimates for raw, -adjusted and outlier removed datasets, and summary of peripheral -traits detected etc.

+

Similar to tryx.analyse, but when there are multiple traits associated with a single variant then we use a LASSO-based multivariable approach

-
tryx.analyse.mv(
-  tryxscan,
-  lasso = TRUE,
-  plot = TRUE,
-  id_remove = NULL,
-  proxies = FALSE
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - -
tryxscan

Output from tryx.scan

lasso

Whether to shrink the estimates of each trait within SNP. Default=TRUE.

plot

Whether to plot or not. Default is TRUE

id_remove

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

proxies

Look for proxies in the MVMR methods. Default = FALSE.

filter_duplicate_outliers

Whether to only allow each putative outlier to be adjusted by a single trait (in order of largest divergence). Default is TRUE.

- -

Value

- -

List of -- adj_full: data frame of SNP adjustments for all candidate traits -- adj: The results from adj_full selected to adjust the exposure-outcome model -- Q: Heterogeneity stats -- estimates: Adjusted and unadjested exposure-outcome effects -- plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment -Adjust and analyse the tryx results

-

Similar to tryx.analyse, but when there are multiple traits associated with a single variant then we use a LASSO-based multivariable approach

-

List of +

+
tryx.analyse.mv(
+  tryxscan,
+  lasso = TRUE,
+  plot = TRUE,
+  id_remove = NULL,
+  proxies = FALSE
+)
+
+ +
+

Arguments

+ + +
tryxscan
+

Output from tryx.scan

+ + +
lasso
+

Whether to shrink the estimates of each trait within SNP. Default=TRUE.

+ + +
plot
+

Whether to plot or not. Default is TRUE

+ + +
id_remove
+

List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.

+ + +
proxies
+

Look for proxies in the MVMR methods. Default = FALSE.

+ +
+
+

Value

+

List of - adj_full: data frame of SNP adjustments for all candidate traits - adj: The results from adj_full selected to adjust the exposure-outcome model - Q: Heterogeneity stats - estimates: Adjusted and unadjested exposure-outcome effects - plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.network.html b/docs/reference/tryx.network.html index a1834ad..15e0b2c 100644 --- a/docs/reference/tryx.network.html +++ b/docs/reference/tryx.network.html @@ -1,67 +1,12 @@ - - - - - - - -Plot results from outlier_scan in a network — tryx.network • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot results from outlier_scan in a network — tryx.network • tryx - - + - -
-
- - -
-
+
@@ -127,46 +59,44 @@

Plot results from outlier_scan in a network

Creates a simple network depicting the connections between outlier instruments, the original exposure and outcome traits, and the detected candidate associations

-
tryx.network(tryxscan)
+
+
tryx.network(tryxscan)
+
+ +
+

Arguments

-

Arguments

- - - - - - -
tryxscan

Output from outlier_scan function

-

Value

+
tryxscan
+

Output from outlier_scan function

+
+
+

Value

Prints plot, and returns dataframe of the connections

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.scan.html b/docs/reference/tryx.scan.html index 4449e52..c12cb41 100644 --- a/docs/reference/tryx.scan.html +++ b/docs/reference/tryx.scan.html @@ -1,70 +1,15 @@ - - - - - - - -Outlier scan — tryx.scan • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Outlier scan — tryx.scan • tryx - - - - - - - - - - - + - -
-
- - -
-
+
@@ -133,66 +65,67 @@

Outlier scan

Perform MR of each of those candidate traits with the original exposure and outcome

-
tryx.scan(
-  dat,
-  outliers = "RadialMR",
-  outlier_correction = "none",
-  outlier_threshold = ifelse(outlier_correction == "none", 0.05/nrow(dat), 0.05),
-  use_proxies = FALSE,
-  search_correction = "none",
-  search_threshold = ifelse(search_correction == "none", 5e-08, 0.05),
-  id_list = "default",
-  include_outliers = FALSE,
-  mr_method = "mr_ivw"
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dat

Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.

outliers

Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.

outlier_correction

Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").

outlier_threshold

If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.

use_proxies

Whether to use proxies when looking up associations. FALSE by default for speed.

search_correction

Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").

search_threshold

If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.

id_list

The list of trait IDs to search through for candidate associations. The default is the high priority traits in available_outcomes().

include_outliers

When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.

mr_method

Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.

- -

Value

+
+
tryx.scan(
+  dat,
+  outliers = "RadialMR",
+  outlier_correction = "none",
+  outlier_threshold = ifelse(outlier_correction == "none", 0.05/nrow(dat), 0.05),
+  use_proxies = FALSE,
+  search_correction = "none",
+  search_threshold = ifelse(search_correction == "none", 5e-08, 0.05),
+  id_list = "default",
+  include_outliers = FALSE,
+  mr_method = "mr_ivw"
+)
+
+ +
+

Arguments

+ + +
dat
+

Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.

+ + +
outliers
+

Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.

+ + +
outlier_correction
+

Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").

+ + +
outlier_threshold
+

If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.

+ + +
use_proxies
+

Whether to use proxies when looking up associations. FALSE by default for speed.

+ +
search_correction
+

Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").

+ + +
search_threshold
+

If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.

+ + +
id_list
+

The list of trait IDs to search through for candidate associations. The default is the high priority traits in available_outcomes().

+ + +
include_outliers
+

When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.

+ + +
mr_method
+

Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.

+ +
+
+

Value

List dat Cleaned dat input radialmr Results from RadialMR analysis @@ -206,32 +139,29 @@

Value

candidate_exposure Extracted instrument SNPs from exposure candidate_exposure_dat Harmonised candidate - exposure dataset candidate_exposure_mr MR analysis of candidates against exposure

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.sig.html b/docs/reference/tryx.sig.html index dfd5185..d1510aa 100644 --- a/docs/reference/tryx.sig.html +++ b/docs/reference/tryx.sig.html @@ -1,67 +1,12 @@ - - - - - - - -Identify putatively significant associations in the outlier scan — tryx.sig • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Identify putatively significant associations in the outlier scan — tryx.sig • tryx + - - - -
-
- - -
-
+
@@ -127,50 +59,52 @@

Identify putatively significant associations in the outlier scan

Identify putatively significant associations in the outlier scan

-
tryx.sig(tryxscan, mr_threshold_method = "fdr", mr_threshold = 0.05)
+
+
tryx.sig(tryxscan, mr_threshold_method = "fdr", mr_threshold = 0.05)
+
+ +
+

Arguments

+ + +
tryxscan
+

Output from tryx.scan

+ + +
mr_threshold_method
+

This is the argument to be passed to p.adjust. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted"

-

Arguments

- - - - - - - - - - -
mr_threshold_method

This is the argument to be passed to p.adjust. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted"

mr_threshold

Threshold to declare significance

-

Value

+
mr_threshold
+

Threshold to declare significance

+
+
+

Value

Same as outlier_scan but the candidate_exposure_mr and candidate_outcome_mr objects have an extra pval_adj and sig column each

+
+
-
- +
+ + - - - + diff --git a/docs/reference/tryx.simulate.html b/docs/reference/tryx.simulate.html index 6b22f5a..e445510 100644 --- a/docs/reference/tryx.simulate.html +++ b/docs/reference/tryx.simulate.html @@ -1,72 +1,17 @@ - - - - - - - -Simulate data to test tryx — tryx.simulate • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simulate data to test tryx — tryx.simulate • tryx - - - - - - - - - - - + - -
-
- - -
-
+
@@ -137,163 +69,161 @@

Simulate data to test tryx

u3 = mediator between x and y

-
tryx.simulate(
-  nid = 10000,
-  ngx = 30,
-  ngu1 = 30,
-  ngu2 = 30,
-  nu2 = 2,
-  ngu3 = 30,
-  vgx = 0.2,
-  vgu1 = 0.6,
-  vgu2 = 0.2,
-  vgu3 = 0.2,
-  bxy = 0,
-  bu1x = 0.6,
-  bu1y = 0.4,
-  bxu3 = 0.3,
-  bu3y = 0,
-  vgxu2 = 0.2,
-  vu2y = 0.2,
-  ngxu3 = 0,
-  vgxu3 = 0,
-  mininum_instruments = 10,
-  instrument_threshold = "bonferroni",
-  outlier_threshold = "bonferroni",
-  outliers_known = "detected",
-  directional_bias = FALSE
-)
- -

Arguments

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nid

= 10000 Number of samples

ngx

= 30 Number of direct instruments to x

ngu1

= 30 Number of instruments influencing confounder of x and y

ngu2

= 30 Number of instruments per mediating

nu2

= 2 Number of gx that are pleiotropic

ngu3

= 30 Number of instruments for u3 mediator

vgx

= 0.2 Variance explained by gx instruments

vgu1

= 0.6 Variance explained by u1 instruments

vgu2

= 0.2 Variance explained by u2 instruments

vgu3

= 0.2 Variance explained by u3 instruments

bxy

= 0 Causal effect of x on y

bu1x

= 0.6 Effect of u1 on x

bu1y

= 0.4 Effect of u1 on y

bxu3

= 0.3 Effect of x on u3

bu3y

= 0 Effect of u3 on y

vgxu2

= 0.2 Variance explained by each gx instrument on each u2 mediator

vu2y

= 0.2 Variance explained by all u2 mediators on y

ngxu3

= 0 Number of gx instruments that pleiotropically associate with u3 mediator

mininum_instruments

= 10 Minimum number of instruments required to have been detected to run simulation

instrument_threshold

= "bonferroni" Threshold, either numeric or 'bonferroni'

outlier_threshold

= "bonferroni" Threshold, either numeric or 'bonferroni'

outliers_known

= "detected" Either detected = using radial mr to find heterogeneity outliers; known = adjust for all known invalid instruments; all = adjust for all instruments

directional_bias

= FALSE Is the pleiotropic effect randomly centered around 0 (FALSE) or does it have a non-0 mean (TRUE)

vgxu3y

= 0 Variance explained by all gx variants directly on u3 mediator

- -

Value

+
+
tryx.simulate(
+  nid = 10000,
+  ngx = 30,
+  ngu1 = 30,
+  ngu2 = 30,
+  nu2 = 2,
+  ngu3 = 30,
+  vgx = 0.2,
+  vgu1 = 0.6,
+  vgu2 = 0.2,
+  vgu3 = 0.2,
+  bxy = 0,
+  bu1x = 0.6,
+  bu1y = 0.4,
+  bxu3 = 0.3,
+  bu3y = 0,
+  vgxu2 = 0.2,
+  vu2y = 0.2,
+  ngxu3 = 0,
+  vgxu3 = 0,
+  mininum_instruments = 10,
+  instrument_threshold = "bonferroni",
+  outlier_threshold = "bonferroni",
+  outliers_known = "detected",
+  directional_bias = FALSE
+)
+
+ +
+

Arguments

+ + +
nid
+

= 10000 Number of samples

+ + +
ngx
+

= 30 Number of direct instruments to x

+ + +
ngu1
+

= 30 Number of instruments influencing confounder of x and y

+ + +
ngu2
+

= 30 Number of instruments per mediating

+ + +
nu2
+

= 2 Number of gx that are pleiotropic

+ + +
ngu3
+

= 30 Number of instruments for u3 mediator

+ +
vgx
+

= 0.2 Variance explained by gx instruments

+ + +
vgu1
+

= 0.6 Variance explained by u1 instruments

+ + +
vgu2
+

= 0.2 Variance explained by u2 instruments

+ + +
vgu3
+

= 0.2 Variance explained by u3 instruments

+ + +
bxy
+

= 0 Causal effect of x on y

+ + +
bu1x
+

= 0.6 Effect of u1 on x

+ + +
bu1y
+

= 0.4 Effect of u1 on y

+ + +
bxu3
+

= 0.3 Effect of x on u3

+ + +
bu3y
+

= 0 Effect of u3 on y

+ + +
vgxu2
+

= 0.2 Variance explained by each gx instrument on each u2 mediator

+ + +
vu2y
+

= 0.2 Variance explained by all u2 mediators on y

+ + +
ngxu3
+

= 0 Number of gx instruments that pleiotropically associate with u3 mediator

+ + +
vgxu3
+

= 0 Variance explained by all gx variants directly on u3 mediator

+ + +
mininum_instruments
+

= 10 Minimum number of instruments required to have been detected to run simulation

+ + +
instrument_threshold
+

= "bonferroni" Threshold, either numeric or 'bonferroni'

+ + +
outlier_threshold
+

= "bonferroni" Threshold, either numeric or 'bonferroni'

+ + +
outliers_known
+

= "detected" Either detected = using radial mr to find heterogeneity outliers; known = adjust for all known invalid instruments; all = adjust for all instruments

+ + +
directional_bias
+

= FALSE Is the pleiotropic effect randomly centered around 0 (FALSE) or does it have a non-0 mean (TRUE)

+ +
+
+

Value

list for tryx.analyse

+
+
-
- +
+ + - - - + diff --git a/docs/reference/volcano_plot.html b/docs/reference/volcano_plot.html index 1bbb283..2ae6e0f 100644 --- a/docs/reference/volcano_plot.html +++ b/docs/reference/volcano_plot.html @@ -1,67 +1,12 @@ - - - - - - - -Plot volcano plot of many MR analyses — volcano_plot • tryx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Plot volcano plot of many MR analyses — volcano_plot • tryx - - + - -
-
- - -
-
+
@@ -127,50 +59,48 @@

Plot volcano plot of many MR analyses

Plot volcano plot of many MR analyses

-
volcano_plot(res, what = "exposure")
+
+
volcano_plot(res, what = "exposure")
+
+ +
+

Arguments

+ + +
res
+

Dataframe similar to output from mr() function, requiring id.exposure, id.outcome. Ideally only provide one MR estimate for each exposure-outcome hypothesis. Also provide a sig column of TRUE/FALSE to determine if that association is to be labelled

-

Arguments

- - - - - - - - - - -
res

Dataframe similar to output from mr() function, requiring id.exposure, id.outcome. Ideally only provide one MR estimate for each exposure-outcome hypothesis. Also provide a sig column of TRUE/FALSE to determine if that association is to be labelled

what

Whether to plot many exposures against few outcomes (default: exposure) or few exposures against many outcomes (outcome). If e.g. 'exposure' and there are multiple outcomes then will facet by outcome

-

Value

+
what
+

Whether to plot many exposures against few outcomes (default: exposure) or few exposures against many outcomes (outcome). If e.g. 'exposure' and there are multiple outcomes then will facet by outcome

+
+
+

Value

ggplot of volcano plots

+
+
-
- +
+ + - - - + diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..a494f19 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,24 @@ + +/404.html +/LICENSE-text.html +/LICENSE.html +/articles/guide.html +/articles/index.html +/articles/test_mrtryx.html +/authors.html +/index.html +/reference/Tryx.html +/reference/cochrans_q.html +/reference/index.html +/reference/strategy1.html +/reference/tryx-package.html +/reference/tryx.adjustment.html +/reference/tryx.analyse.html +/reference/tryx.analyse.mv.html +/reference/tryx.network.html +/reference/tryx.scan.html +/reference/tryx.sig.html +/reference/tryx.simulate.html +/reference/volcano_plot.html + + diff --git a/man/Tryx.Rd b/man/Tryx.Rd index 2ac70cf..e0ff7c7 100644 --- a/man/Tryx.Rd +++ b/man/Tryx.Rd @@ -9,230 +9,260 @@ Using a summary set, find outliers in the MR analysis between the pair of trais. Find other 'candidate traits' associated with those outliers. Perform MR of each of those candidate traits with the original exposure and outcome. } +\section{Public fields}{ + \if{html}{\out{
}} + \describe{ + \item{\code{output}}{List holding the input data and the results of each analysis step.} + } + \if{html}{\out{
}} +} \section{Methods}{ \subsection{Public methods}{ -\itemize{ -\item \href{#method-new}{\code{Tryx$new()}} -\item \href{#method-print}{\code{Tryx$print()}} -\item \href{#method-get_outliers}{\code{Tryx$get_outliers()}} -\item \href{#method-set_candidate_traits}{\code{Tryx$set_candidate_traits()}} -\item \href{#method-scan}{\code{Tryx$scan()}} -\item \href{#method-candidate_instruments}{\code{Tryx$candidate_instruments()}} -\item \href{#method-outcome_instruments}{\code{Tryx$outcome_instruments()}} -\item \href{#method-exposure_instruments}{\code{Tryx$exposure_instruments()}} -\item \href{#method-exposure_candidate_instruments}{\code{Tryx$exposure_candidate_instruments()}} -\item \href{#method-extractions}{\code{Tryx$extractions()}} -\item \href{#method-candidate_outcome_dat}{\code{Tryx$candidate_outcome_dat()}} -\item \href{#method-candidate_exposure_dat}{\code{Tryx$candidate_exposure_dat()}} -\item \href{#method-exposure_candidate_dat}{\code{Tryx$exposure_candidate_dat()}} -\item \href{#method-harmonise}{\code{Tryx$harmonise()}} -\item \href{#method-mr}{\code{Tryx$mr()}} -\item \href{#method-mrtryx}{\code{Tryx$mrtryx()}} -\item \href{#method-tryx.sig}{\code{Tryx$tryx.sig()}} -\item \href{#method-adjustment}{\code{Tryx$adjustment()}} -\item \href{#method-adjustment.mv}{\code{Tryx$adjustment.mv()}} -\item \href{#method-analyse}{\code{Tryx$analyse()}} -\item \href{#method-analyse.mv}{\code{Tryx$analyse.mv()}} -\item \href{#method-manhattan_plot}{\code{Tryx$manhattan_plot()}} -\item \href{#method-clone}{\code{Tryx$clone()}} -} + \itemize{ + \item \href{#method-Tryx-initialize}{\code{Tryx$new()}} + \item \href{#method-Tryx-print}{\code{Tryx$print()}} + \item \href{#method-Tryx-get_outliers}{\code{Tryx$get_outliers()}} + \item \href{#method-Tryx-set_candidate_traits}{\code{Tryx$set_candidate_traits()}} + \item \href{#method-Tryx-scan}{\code{Tryx$scan()}} + \item \href{#method-Tryx-candidate_instruments}{\code{Tryx$candidate_instruments()}} + \item \href{#method-Tryx-outcome_instruments}{\code{Tryx$outcome_instruments()}} + \item \href{#method-Tryx-exposure_instruments}{\code{Tryx$exposure_instruments()}} + \item \href{#method-Tryx-exposure_candidate_instruments}{\code{Tryx$exposure_candidate_instruments()}} + \item \href{#method-Tryx-extractions}{\code{Tryx$extractions()}} + \item \href{#method-Tryx-candidate_outcome_dat}{\code{Tryx$candidate_outcome_dat()}} + \item \href{#method-Tryx-candidate_exposure_dat}{\code{Tryx$candidate_exposure_dat()}} + \item \href{#method-Tryx-exposure_candidate_dat}{\code{Tryx$exposure_candidate_dat()}} + \item \href{#method-Tryx-harmonise}{\code{Tryx$harmonise()}} + \item \href{#method-Tryx-mr}{\code{Tryx$mr()}} + \item \href{#method-Tryx-mrtryx}{\code{Tryx$mrtryx()}} + \item \href{#method-Tryx-tryx.sig}{\code{Tryx$tryx.sig()}} + \item \href{#method-Tryx-adjustment}{\code{Tryx$adjustment()}} + \item \href{#method-Tryx-adjustment.mv}{\code{Tryx$adjustment.mv()}} + \item \href{#method-Tryx-analyse}{\code{Tryx$analyse()}} + \item \href{#method-Tryx-analyse.mv}{\code{Tryx$analyse.mv()}} + \item \href{#method-Tryx-manhattan_plot}{\code{Tryx$manhattan_plot()}} + \item \href{#method-Tryx-clone}{\code{Tryx$clone()}} + } } \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{new()}}{ -Create a new dataset and initialise an R interface -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$new(dat)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-initialize}{}}} +\subsection{\code{Tryx$new()}}{ + Create a new dataset and initialise an R interface + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$new(dat)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Dataset from TwoSampleMR::harmonise_data} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Dataset from TwoSampleMR::harmonise_data} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{print()}}{ -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$print(...)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-print}{}}} +\subsection{\code{Tryx$print()}}{ + Print a summary of the analysis status. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$print(...)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{...}}{Unused.} + } + \if{html}{\out{
}} + } } -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{get_outliers()}}{ -Detect outliers in exposure-outcome dataset. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$get_outliers( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-get_outliers}{}}} +\subsection{\code{Tryx$get_outliers()}}{ + Detect outliers in exposure-outcome dataset. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$get_outliers( dat = self$output$dat, outliers = "RadialMR", outlier_correction = "none", outlier_threshold = ifelse(outlier_correction == "none", 0.05/nrow(dat), 0.05) -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} + \item{\code{outliers}}{Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.} + \item{\code{outlier_correction}}{Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} + \item{\code{outlier_threshold}}{If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} - -\item{\code{outliers}}{Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.} - -\item{\code{outlier_correction}}{Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} - -\item{\code{outlier_threshold}}{If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{set_candidate_traits()}}{ -Set a list of GWAS IDs used. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$set_candidate_traits(id_list = NULL)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-set_candidate_traits}{}}} +\subsection{\code{Tryx$set_candidate_traits()}}{ + Set a list of GWAS IDs used. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$set_candidate_traits(id_list = NULL)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{id_list}}{The list of trait IDs to search through for candidate associations. The default is the high priority traits in available_outcomes().} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{id_list}}{The list of trait IDs to search through for candidate associations. The default is the high priority traits in available_outcomes().} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{scan()}}{ -Search for candidate traits associated with outliers. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$scan( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-scan}{}}} +\subsection{\code{Tryx$scan()}}{ + Search for candidate traits associated with outliers. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$scan( dat = self$output$dat, search_correction = "none", search_threshold = ifelse(search_correction == "none", 5e-08, 0.05), use_proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{search_correction}}{Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none.} + \item{\code{search_threshold}}{If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{search_correction}}{Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none.} - -\item{\code{search_threshold}}{If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{candidate_instruments()}}{ -Obtain instruments for the candidate traits. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$candidate_instruments( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-candidate_instruments}{}}} +\subsection{\code{Tryx$candidate_instruments()}}{ + Obtain instruments for the candidate traits. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$candidate_instruments( candidate_instruments = NULL, include_outliers = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{candidate_instruments}}{Instruments for candidate traits.} + \item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{candidate_instruments}}{Instruments for candidate traits.} - -\item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{outcome_instruments()}}{ -Extract instrument for candidate trait instruments for the original outcome. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$outcome_instruments( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-outcome_instruments}{}}} +\subsection{\code{Tryx$outcome_instruments()}}{ + Extract instrument for candidate trait instruments for the original outcome. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$outcome_instruments( candidate_outcome = NULL, dat = self$output$dat, use_proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{candidate_outcome}}{Extracted instrument SNPs from outcome.} + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{candidate_outcome}}{Extracted instrument SNPs from outcome.} - -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{exposure_instruments()}}{ -Extract instrument for candidate trait instruments for the original exposure. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$exposure_instruments( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-exposure_instruments}{}}} +\subsection{\code{Tryx$exposure_instruments()}}{ + Extract instrument for candidate trait instruments for the original exposure. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$exposure_instruments( candidate_exposure = NULL, dat = self$output$dat, use_proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{candidate_exposure}}{Extracted instrument SNPs from exposure.} + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{candidate_exposure}}{Extracted instrument SNPs from exposure.} - -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{exposure_candidate_instruments()}}{ -Extract instrument for the original exposure for the candidate traits. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$exposure_candidate_instruments( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-exposure_candidate_instruments}{}}} +\subsection{\code{Tryx$exposure_candidate_instruments()}}{ + Extract instrument for the original exposure for the candidate traits. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$exposure_candidate_instruments( exposure_candidate = NULL, dat = self$output$dat, use_proxies = FALSE, include_outliers = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{exposure_candidate}}{Extracted instrument SNPs from exposure.} + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + \item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{exposure_candidate}}{Extracted instrument SNPs from exposure.} - -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} - -\item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{extractions()}}{ -Extract instruments for MR analyses. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$extractions( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-extractions}{}}} +\subsection{\code{Tryx$extractions()}}{ + Extract instruments for MR analyses. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$extractions( dat = self$output$dat, candidate_instruments = NULL, candidate_outcome = NULL, @@ -240,117 +270,128 @@ Extract instruments for MR analyses. exposure_candidate = NULL, include_outliers = FALSE, use_proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{candidate_instruments}}{Instruments for candidate traits.} + \item{\code{candidate_outcome}}{Extracted instrument SNPs from outcome.} + \item{\code{candidate_exposure}}{Extracted instrument SNPs from exposure.} + \item{\code{exposure_candidate}}{Extracted instrument SNPs from exposure.} + \item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{candidate_instruments}}{Instruments for candidate traits.} - -\item{\code{candidate_outcome}}{Extracted instrument SNPs from outcome.} - -\item{\code{candidate_exposure}}{Extracted instrument SNPs from exposure.} - -\item{\code{exposure_candidate}}{Extracted instrument SNPs from exposure.} - -\item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{candidate_outcome_dat()}}{ -Make a dataset for the candidate traits and the original outcome. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$candidate_outcome_dat(dat = self$output$dat)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-candidate_outcome_dat}{}}} +\subsection{\code{Tryx$candidate_outcome_dat()}}{ + Make a dataset for the candidate traits and the original outcome. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$candidate_outcome_dat(dat = self$output$dat)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{candidate_exposure_dat()}}{ -Make a dataset for the candidate traits and the original exposure. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$candidate_exposure_dat(dat = self$output$dat)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-candidate_exposure_dat}{}}} +\subsection{\code{Tryx$candidate_exposure_dat()}}{ + Make a dataset for the candidate traits and the original exposure. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$candidate_exposure_dat(dat = self$output$dat)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{exposure_candidate_dat()}}{ -Make a dataset for the original exposure and the candidate traits. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$exposure_candidate_dat(dat = self$output$dat)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-exposure_candidate_dat}{}}} +\subsection{\code{Tryx$exposure_candidate_dat()}}{ + Make a dataset for the original exposure and the candidate traits. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$exposure_candidate_dat(dat = self$output$dat)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{harmonise()}}{ -Harmonised exposure - outcome dataset. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$harmonise(dat = self$output$dat)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-harmonise}{}}} +\subsection{\code{Tryx$harmonise()}}{ + Harmonised exposure - outcome dataset. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$harmonise(dat = self$output$dat)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{mr()}}{ -Perform MR anlayses of 1) candidate traits-outcome 2) candidate traits-exposure 3) exposure-candidate traits. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$mr(dat = self$output$dat, mr_method = "mr_ivw")}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-mr}{}}} +\subsection{\code{Tryx$mr()}}{ + Perform MR anlayses of 1) candidate traits-outcome 2) candidate traits-exposure 3) exposure-candidate traits. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$mr(dat = self$output$dat, mr_method = "mr_ivw")} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} + \item{\code{mr_method}}{Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from TwoSampleMR::harmonise_data.} - -\item{\code{mr_method}}{Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{mrtryx()}}{ -All-in-one: 1) Detect outlier 2) Search candidate traits 3) Perform MR of candidate traits and the outcome / exposure. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$mrtryx( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-mrtryx}{}}} +\subsection{\code{Tryx$mrtryx()}}{ + All-in-one: 1) Detect outlier 2) Search candidate traits 3) Perform MR of candidate traits and the outcome / exposure. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$mrtryx( dat = self$output$dat, outliers = "RadialMR", outlier_correction = "none", @@ -360,196 +401,195 @@ All-in-one: 1) Detect outlier 2) Search candidate traits 3) Perform MR of candid search_threshold = ifelse(search_correction == "none", 5e-08, 0.05), include_outliers = FALSE, mr_method = "mr_ivw" -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} + \item{\code{outliers}}{Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.} + \item{\code{outlier_correction}}{Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} + \item{\code{outlier_threshold}}{If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.} + \item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} + \item{\code{search_correction}}{Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} + \item{\code{search_threshold}}{If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.} + \item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} + \item{\code{mr_method}}{Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} - -\item{\code{outliers}}{Default is to use the RadialMR package to identify IVW outliers. Alternatively can providen an array of SNP names that are present in dat$SNP to use as outliers.} - -\item{\code{outlier_correction}}{Defualt = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} - -\item{\code{outlier_threshold}}{If outlier_correction = "none" then the p-value threshold for detecting outliers is by default 0.05.} - -\item{\code{use_proxies}}{Whether to use proxies when looking up associations. FALSE by default for speed.} - -\item{\code{search_correction}}{Default = "none", but can select from ("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").} - -\item{\code{search_threshold}}{If search_correction = "none" then the p-value threshold for detecting an association between an outlier and a candidate trait is by default 5e-8. Otherwise it is 0.05.} - -\item{\code{include_outliers}}{When performing MR of candidate traits against exposures or outcomes, whether to include the original outlier SNP. Default is FALSE.} - -\item{\code{mr_method}}{Method to use for candidate trait - exposure/outcome analysis. Default is mr_ivw. Can also provide basic MR methods e.g. mr_weighted_mode, mr_weighted_median etc. Also possible to use "strategy1" which performs IVW in the first instance, but then weighted mode for associations with high heterogeneity.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{tryx.sig()}}{ -Identify putatively significant associations in the outlier scan. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$tryx.sig(mr_threshold_method = "fdr", mr_threshold = 0.05)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-tryx.sig}{}}} +\subsection{\code{Tryx$tryx.sig()}}{ + Identify putatively significant associations in the outlier scan. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$tryx.sig(mr_threshold_method = "fdr", mr_threshold = 0.05)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{mr_threshold_method}}{This is the argument to be passed to \code{p.adjust}. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted".} + \item{\code{mr_threshold}}{Threshold to declare significance} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{mr_threshold_method}}{This is the argument to be passed to \code{p.adjust}. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted".} - -\item{\code{mr_threshold}}{Threshold to declare significance} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{adjustment()}}{ -Outlier adjustment estimation - How much of the heterogeneity due to the outlier can be explained by alternative pathways? -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$adjustment(tryxscan = self$output, id_remove = NULL)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-adjustment}{}}} +\subsection{\code{Tryx$adjustment()}}{ + Outlier adjustment estimation - How much of the heterogeneity due to the outlier can be explained by alternative pathways? + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$adjustment(tryxscan = self$output, id_remove = NULL)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{tryxscan}}{Output from \code{x$mrtryx()}} + \item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} + \item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{tryxscan}}{Output from \code{x$mrtryx()}} - -\item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} - -\item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{adjustment.mv()}}{ -Similar to adjusment, but when there are multiple traits associated with a single variant. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$adjustment.mv( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-adjustment.mv}{}}} +\subsection{\code{Tryx$adjustment.mv()}}{ + Similar to adjusment, but when there are multiple traits associated with a single variant. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$adjustment.mv( tryxscan = self$output, lasso = TRUE, id_remove = NULL, proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{tryxscan}}{Output from \code{x$scan()}} + \item{\code{lasso}}{Whether to shrink the estimates of each trait within SNP. Default=TRUE.} + \item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} + \item{\code{proxies}}{Look for proxies in the MVMR methods. Default = FALSE.} + \item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{tryxscan}}{Output from \code{x$scan()}} - -\item{\code{lasso}}{Whether to shrink the estimates of each trait within SNP. Default=TRUE.} - -\item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} - -\item{\code{proxies}}{Look for proxies in the MVMR methods. Default = FALSE.} - -\item{\code{dat}}{Output from harmonise_data. Note - only the first id.exposure - id.outcome pair will be used.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{analyse()}}{ -This returns various heterogeneity statistics, IVW estimates for raw, adjusted and outlier removed datasets, and summary of peripheral traits detected etc. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$analyse( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-analyse}{}}} +\subsection{\code{Tryx$analyse()}}{ + This returns various heterogeneity statistics, IVW estimates for raw, adjusted and outlier removed datasets, and summary of peripheral traits detected etc. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$analyse( tryxscan = self$output, plot = TRUE, id_remove = NULL, filter_duplicate_outliers = TRUE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{tryxscan}}{Output from \code{x$scan()}.} + \item{\code{plot}}{Whether to plot or not. Default is TRUE.} + \item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} + \item{\code{filter_duplicate_outliers}}{Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{tryxscan}}{Output from \code{x$scan()}.} - -\item{\code{plot}}{Whether to plot or not. Default is TRUE.} - -\item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} - -\item{\code{duplicate_outliers_method}}{Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{analyse.mv()}}{ -Similar to analyse, but when there are multiple traits associated with a single variant. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$analyse.mv( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-analyse.mv}{}}} +\subsection{\code{Tryx$analyse.mv()}}{ + Similar to analyse, but when there are multiple traits associated with a single variant. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$analyse.mv( tryxscan = self$output, lasso = TRUE, plot = TRUE, id_remove = NULL, proxies = FALSE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{tryxscan}}{Output from \code{x$scan()}} + \item{\code{lasso}}{Whether to shrink the estimates of each trait within SNP. Default=TRUE.} + \item{\code{plot}}{Whether to plot or not. Default is TRUE.} + \item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} + \item{\code{proxies}}{Look for proxies in the MVMR methods. Default = FALSE.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{tryxscan}}{Output from \code{x$scan()}} - -\item{\code{lasso}}{Whether to shrink the estimates of each trait within SNP. Default=TRUE.} - -\item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} - -\item{\code{proxies}}{Look for proxies in the MVMR methods. Default = FALSE.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{manhattan_plot()}}{ -Draw a Manhattan style plot for candidate traits-outcome/exposure associations. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$manhattan_plot( +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-manhattan_plot}{}}} +\subsection{\code{Tryx$manhattan_plot()}}{ + Draw a Manhattan style plot for candidate traits-outcome/exposure associations. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$manhattan_plot( what = "outcome", id_remove = NULL, y_scale = NULL, label = TRUE -)}\if{html}{\out{
}} +)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{what}}{Analyse candidate-exposure ('exposure') or candidate-outcome ('outcome') associations} + \item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} + \item{\code{y_scale}}{The scaling function to be applied to y scale.} + \item{\code{label}}{Display the names of the traits on the graph.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{what}}{Analyse candidate-exposure ('exposure') or candidate-outcome ('outcome') associations} - -\item{\code{id_remove}}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} - -\item{\code{y_scale}}{The scaling function to be applied to y scale.} - -\item{\code{label}}{Display the names of the traits on the graph.} -} -\if{html}{\out{
}} -} -} \if{html}{\out{
}} -\if{html}{\out{}} -\subsection{Method \code{clone()}}{ -The objects of this class are cloneable with this method. -\subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Tryx$clone(deep = FALSE)}\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Tryx-clone}{}}} +\subsection{\code{Tryx$clone()}}{ + The objects of this class are cloneable with this method. + \subsection{Usage}{ + \if{html}{\out{
}} + \preformatted{Tryx$clone(deep = FALSE)} + \if{html}{\out{
}} + } + \subsection{Arguments}{ + \if{html}{\out{
}} + \describe{ + \item{\code{deep}}{Whether to make a deep clone.} + } + \if{html}{\out{
}} + } } -\subsection{Arguments}{ -\if{html}{\out{
}} -\describe{ -\item{\code{deep}}{Whether to make a deep clone.} -} -\if{html}{\out{
}} -} -} } diff --git a/man/tryx-package.Rd b/man/tryx-package.Rd new file mode 100644 index 0000000..dd122a0 --- /dev/null +++ b/man/tryx-package.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tryx-package.R +\docType{package} +\name{tryx-package} +\alias{tryx} +\alias{tryx-package} +\title{tryx: MR-TRYX (treasure your exceptions)} +\description{ +Heterogeneity in MR analyses can arise due to horizontal pleiotropy. This package uses MR-Base to identify possible traits that can explain the heterogeneity, with a view to identifying novel putative associations, and adjusting for their influences to reduce heterogeneity and improve power. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://mrcieu.r-universe.dev/tryx} + \item \url{https://explodecomputer.github.io/tryx/} + \item \url{https://github.com/explodecomputer/tryx} + \item Report bugs at \url{https://github.com/explodecomputer/tryx/issues} +} + +} +\author{ +\strong{Maintainer}: Gibran Hemani \email{g.hemani@bristol.ac.uk} + +Authors: +\itemize{ + \item Gibran Hemani \email{g.hemani@bristol.ac.uk} + \item Yoonsu Cho \email{yoonsu.cho@bristol.ac.uk} +} + +} +\keyword{internal} diff --git a/man/tryx.analyse.Rd b/man/tryx.analyse.Rd index 5ecafd7..7089794 100644 --- a/man/tryx.analyse.Rd +++ b/man/tryx.analyse.Rd @@ -18,7 +18,7 @@ tryx.analyse( \item{id_remove}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} -\item{duplicate_outliers_method}{Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity} +\item{filter_duplicate_outliers}{Sometimes more than one trait will associate with a particular outlier. TRUE = only keep the trait that has the biggest influence on heterogeneity} } \value{ List of diff --git a/man/tryx.analyse.mv.Rd b/man/tryx.analyse.mv.Rd index 7ae8c6b..0497d68 100644 --- a/man/tryx.analyse.mv.Rd +++ b/man/tryx.analyse.mv.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/adjustment.r \name{tryx.analyse.mv} \alias{tryx.analyse.mv} -\title{Analyse tryx results} +\title{Adjust and analyse the tryx results} \usage{ tryx.analyse.mv( tryxscan, @@ -22,20 +22,8 @@ tryx.analyse.mv( \item{id_remove}{List of IDs to exclude from the adjustment analysis. It is possible that in the outlier search a candidate trait will come up which is essentially just a surrogate for the outcome trait (e.g. if you are analysing coronary heart disease as the outcome then a variable related to heart disease medication might come up as a candidate trait). Adjusting for a trait which is essentially the same as the outcome will erroneously nullify the result, so visually inspect the candidate trait list and remove those that are inappropriate.} \item{proxies}{Look for proxies in the MVMR methods. Default = FALSE.} - -\item{filter_duplicate_outliers}{Whether to only allow each putative outlier to be adjusted by a single trait (in order of largest divergence). Default is TRUE.} } \value{ -List of -- adj_full: data frame of SNP adjustments for all candidate traits -- adj: The results from adj_full selected to adjust the exposure-outcome model -- Q: Heterogeneity stats -- estimates: Adjusted and unadjested exposure-outcome effects -- plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment -Adjust and analyse the tryx results - -Similar to tryx.analyse, but when there are multiple traits associated with a single variant then we use a LASSO-based multivariable approach - List of - adj_full: data frame of SNP adjustments for all candidate traits - adj: The results from adj_full selected to adjust the exposure-outcome model @@ -44,7 +32,5 @@ List of - plot: Radial plot showing the comparison of different methods and the changes in SNP effects ater adjustment } \description{ -This returns various heterogeneity statistics, IVW estimates for raw, -adjusted and outlier removed datasets, and summary of peripheral -traits detected etc. +Similar to tryx.analyse, but when there are multiple traits associated with a single variant then we use a LASSO-based multivariable approach } diff --git a/man/tryx.sig.Rd b/man/tryx.sig.Rd index 10ada16..93c08be 100644 --- a/man/tryx.sig.Rd +++ b/man/tryx.sig.Rd @@ -7,6 +7,8 @@ tryx.sig(tryxscan, mr_threshold_method = "fdr", mr_threshold = 0.05) } \arguments{ +\item{tryxscan}{Output from \code{tryx.scan}} + \item{mr_threshold_method}{This is the argument to be passed to \code{p.adjust}. Default is "fdr". If no p-value adjustment is to be applied then specify "unadjusted"} \item{mr_threshold}{Threshold to declare significance} diff --git a/man/tryx.simulate.Rd b/man/tryx.simulate.Rd index a1462a7..a6e8f17 100644 --- a/man/tryx.simulate.Rd +++ b/man/tryx.simulate.Rd @@ -68,6 +68,8 @@ tryx.simulate( \item{ngxu3}{= 0 Number of gx instruments that pleiotropically associate with u3 mediator} +\item{vgxu3}{= 0 Variance explained by all gx variants directly on u3 mediator} + \item{mininum_instruments}{= 10 Minimum number of instruments required to have been detected to run simulation} \item{instrument_threshold}{= "bonferroni" Threshold, either numeric or 'bonferroni'} @@ -77,8 +79,6 @@ tryx.simulate( \item{outliers_known}{= "detected" Either detected = using radial mr to find heterogeneity outliers; known = adjust for all known invalid instruments; all = adjust for all instruments} \item{directional_bias}{= FALSE Is the pleiotropic effect randomly centered around 0 (FALSE) or does it have a non-0 mean (TRUE)} - -\item{vgxu3y}{= 0 Variance explained by all gx variants directly on u3 mediator} } \value{ list for tryx.analyse diff --git a/tests/testthat/test_scan.R b/tests/testthat/test_scan.R index 756927a..82423f7 100644 --- a/tests/testthat/test_scan.R +++ b/tests/testthat/test_scan.R @@ -1,13 +1,10 @@ context("initialise") -library(tryx) -test_that("initialise", -{ +test_that("initialise", { + skip() a <- extract_instruments("ieu-a-300") b <- extract_outcome_data(a$SNP, "ieu-a-7", access_token=NULL) dat <- harmonise_data(a,b) X <- Tryx$new(dat) expect_true(nrow(X$output$dat) == sum(dat$mr_keep)) }) - - diff --git a/vignettes/guide.Rmd b/vignettes/guide.Rmd index bfce319..e53a18e 100644 --- a/vignettes/guide.Rmd +++ b/vignettes/guide.Rmd @@ -15,7 +15,8 @@ vignette: > knitr::opts_chunk$set( collapse = TRUE, comment = "#>", - cache = TRUE + cache = TRUE, + eval = FALSE ) ``` diff --git a/vignettes/guide.html b/vignettes/guide.html deleted file mode 100644 index 433d020..0000000 --- a/vignettes/guide.html +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - - - - - - - - - - - -Guide to using MR-TRYX - - - - - - - - - - - - - - - - - - - - - -

Guide to using MR-TRYX

-

Yoonsu Cho

- - - - -

The following analyses should run within a couple of minutes, depending on internet speed and the traffic that the IEU GWAS database servers are experiencing.

-

Begin by choosing an exposure-outcome hypothesis to explore. e.g. LDL cholesterol on coronary heart disease. These data can be extracted from the IEU GWAS database using the TwoSampleMR package:

-
-

Data setup

-

If necessary install TwoSampleMR:

-
devtools::install_github("mrcieu/TwoSampleMR@ieugwasr")
-

Create a dataset for LDL and CHD

-
library(TwoSampleMR)
-a <- extract_instruments("ieu-a-300")
-#> API: public: https://gwas-api.mrcieu.ac.uk/
-#> Warning in format_data(d, type = "exposure", snps = NULL, phenotype_col =
-#> "phenotype", : eaf column is not numeric. Coercing...
-b <- extract_outcome_data(a$SNP, "ieu-a-7", access_token=NULL)
-#> Extracting data for 81 SNP(s) from 1 GWAS(s)
-#> Finding proxies for 1 SNPs in outcome ieu-a-7
-#> Extracting data for 1 SNP(s) from 1 GWAS(s)
-dat <- harmonise_data(a,b)
-#> Harmonising LDL cholesterol || id:ieu-a-300 (ieu-a-300) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
-#> Removing the following SNPs for incompatible alleles:
-#> rs10947332
-#> Removing the following SNPs for being palindromic with intermediate allele frequencies:
-#> rs2954029, rs3184504, rs964184
-
-
-

Running Tryx

-

First load the package

-

We can now perform the analysis:

-
library(tryx)
-#> Loading required package: dplyr
-#> 
-#> Attaching package: 'dplyr'
-#> The following objects are masked from 'package:stats':
-#> 
-#>     filter, lag
-#> The following objects are masked from 'package:base':
-#> 
-#>     intersect, setdiff, setequal, union
-#> Loading required package: RadialMR
-#> Loading required package: magrittr
-#> Loading required package: tidyr
-#> 
-#> Attaching package: 'tidyr'
-#> The following object is masked from 'package:magrittr':
-#> 
-#>     extract
-#> Loading required package: ggplot2
-#> Loading required package: glmnet
-#> Loading required package: Matrix
-#> 
-#> Attaching package: 'Matrix'
-#> The following objects are masked from 'package:tidyr':
-#> 
-#>     expand, pack, unpack
-#> Loaded glmnet 3.0-1
-#> Loading required package: ggrepel
-x <- Tryx$new(dat)
-x$mrtryx()
-#> Using RadialMR package to detect outliers
-#> 
-#> Radial IVW
-#> 
-#>                   Estimate  Std.Error   t value     Pr(>|t|)
-#> Effect (Mod.2nd) 0.4131547 0.04848067  8.522050 1.567537e-17
-#> Iterative        0.4131605 0.04848234  8.521877 1.569885e-17
-#> Exact (FE)       0.4307847 0.02360690 18.248257 2.136159e-74
-#> Exact (RE)       0.4182297 0.05616141  7.446922 1.251321e-10
-#> 
-#> 
-#> Residual standard error: 2.056 on 76 degrees of freedom
-#> 
-#> F-statistic: 72.63 on 1 and 76 DF, p-value: 1.1e-12
-#> Q-Statistic for heterogeneity: 321.246 on 76 DF , p-value: 6.778753e-32
-#> 
-#>  Outliers detected 
-#> Number of iterations = 3
-#> Warning in if (radial$outliers[1] == "No significant outliers") {: the
-#> condition has length > 1 and only the first element will be used
-#> Identified 7 outliers
-#> Using default list of 288 traits
-#> Extracting data for 7 SNP(s) from 288 GWAS(s)
-#> Found 24 candidate traits associated with outliers at p < 5e-08
-#> Finding instruments for candidate traits
-#> Warning in format_data(d, type = "exposure", snps = NULL, phenotype_col =
-#> "phenotype", : eaf column is not numeric. Coercing...
-#> Removing outlier SNPs from candidate trait instrument lists
-#> 24 traits with at least one instrument
-#> Looking up candidate trait instruments for Coronary heart disease || id:ieu-a-7
-#> Extracting data for 730 SNP(s) from 1 GWAS(s)
-#> 710 instruments extracted for Coronary heart disease || id:ieu-a-7
-#> Looking up candidate trait instruments for LDL cholesterol || id:ieu-a-300
-#> Extracting data for 730 SNP(s) from 1 GWAS(s)
-#>  instruments extracted for LDL cholesterol || id:ieu-a-300
-#> Looking up exposure instruments for 24 candidate traits
-#> Extracting data for 77 SNP(s) from 24 GWAS(s)
-#> 1790 instruments extracted
-#> Removing outlier SNPs from candidate trait outcome lists
-#> Removed 46 outlier SNPs
-#> Performing MR of 24 candidate traits against Coronary heart disease || id:ieu-a-7
-#> Performing MR of 23 candidate traits against LDL cholesterol || id:ieu-a-300
-#> Performing MR of LDL cholesterol || id:ieu-a-300 against 24 candidate traits
-

This will do the following:

-
    -
  1. Find outlier SNPs in the exposure-outcome analysis
  2. -
  3. Find traits in the IEU GWAS database that those outliers associate with. These traits are known as ‘candidate traits’
  4. -
  5. Extract instruments for those ‘candidate traits’
  6. -
  7. Perform MR of each of those ‘candidate traits’ against the exposure and the outcome
  8. -
-
-
-

Step-by-step analysis

-

The analysis steps can be done one-by-one running the following commands:

-
# Find outlier SNPs in the exposure-outcome analysis
-x$get_outliers()
-
-# Find traits in the MR-Base database that those outliers associate with. These traits are known as 'candidate traits'
-x$set_candidate_traits()
-x$scan()
-

Note that you can browse available traits here: https://gwas.mrcieu.ac.uk/ and get a complete list using:

-
traits <- TwoSampleMR::available_outcomes()
-
# Extract instruments for those 'candidate traits'
-x$extractions() #which includes the following functions:
-  x$candidate_instruments()
-  x$outcome_instruments()
-  x$exposure_instruments()
-  x$exposure_candidate_instruments()
-
-# Make datasets for MR analysis
-x$harmonise() #which includes the following functions:
-  x$candidate_outcome_dat()
-  x$candidate_exposure_dat()
-  x$exposure_candidate_dat()
-
-# Perform MR of each of those 'candidate traits' against the exposure and the outcomes
-x$mr()
-

See the ?Tryx for options on the parameters for this analysis. e.g. You can specify your own set of outliers, for example SNPs that have extreme p-values in the outcome GWAS

-
a <- as.character(subset(dat, pval.outcome < 5e-8)$SNP)
-x <- Tryx$new(dat)
-x$mrtryx(outliers=a)
-

The next steps are to determine which of the candidate traits are of interest (e.g. using p-value thresholds), visualise the results, and adjust the exposure-outcome estimates based on knowledge of the ‘candidate trait’ associations.

-
-
-

Significant candidate traits

-

One can determine which of the putative associations might be ‘interesting’ in different ways. We have provided a simple convenience function to apply different multiple testing corrections. e.g.

-
x$tryx.sig()
-

Will by default use FDR of 5%. See ?tryx.sig for more options.

-
-
-

Adjustment

-

Finally, to adjust the SNP effects on the exposure and outcome traits given their influences on the candidate traits, we can run:

-
x$adjustment()
-x$adjustment.mv()
-x$analyse()
-x$analyse.mv()
-

By default, this adjusts for the trait that has the largest impact for a particular SNP.

-

The x$output$adjustment$estimates show the adjusted effect estimates. A plot is generated showing how SNP effects have changed due to candidate trait adjustments in x$output$adjustment$plot.

-
-
-

Visualisation

-

To produce a basic diagram of the connectivity of SNPs, candidate traits, exposure and outcome:

-
tryx.network(tryxscan)
-

This shows that some candidate traits influence the exposure only, the outcome only, or both the exposure and the outcome.

-

You can also create a volcano plot of the candidate-exposure and/or candidate-outcome associations. e.g. to show exposures and outcomes

-
volcano_plot(
-    rbind(tryxscan$candidate_exposure_mr, tryxscan$candidate_outcome_mr)
-)
-

or e.g. just exposures

-
volcano_plot(tryxscan$candidate_exposure_mr)
-
- - - - - - - - - - - diff --git a/vignettes/guide_cache/html/__packages b/vignettes/guide_cache/html/__packages deleted file mode 100644 index 0e2d73d..0000000 --- a/vignettes/guide_cache/html/__packages +++ /dev/null @@ -1,12 +0,0 @@ -base -TwoSampleMR -dplyr -RadialMR -magrittr -tidyr -ggplot2 -Matrix -glmnet -ggrepel -tryx -reshape2 diff --git a/vignettes/guide_cache/html/unnamed-chunk-10_8551fc60b4285a74d13a631c4046e5e1.RData b/vignettes/guide_cache/html/unnamed-chunk-10_8551fc60b4285a74d13a631c4046e5e1.RData deleted file mode 100644 index d44d82e..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-10_8551fc60b4285a74d13a631c4046e5e1.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-11_ed8812eeea31e3d688380a52a03d06d3.RData b/vignettes/guide_cache/html/unnamed-chunk-11_ed8812eeea31e3d688380a52a03d06d3.RData deleted file mode 100644 index 70a69f5..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-11_ed8812eeea31e3d688380a52a03d06d3.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-12_3d01f34086a845efbc82f0958653b378.RData b/vignettes/guide_cache/html/unnamed-chunk-12_3d01f34086a845efbc82f0958653b378.RData deleted file mode 100644 index c43c965..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-12_3d01f34086a845efbc82f0958653b378.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-2_34060d49f2e0dcadeaaec7bfc3adc703.RData b/vignettes/guide_cache/html/unnamed-chunk-2_34060d49f2e0dcadeaaec7bfc3adc703.RData deleted file mode 100644 index 6095b88..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-2_34060d49f2e0dcadeaaec7bfc3adc703.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-3_0bbb821c961238935189b0e680c8e0e0.RData b/vignettes/guide_cache/html/unnamed-chunk-3_0bbb821c961238935189b0e680c8e0e0.RData deleted file mode 100644 index 6f61c81..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-3_0bbb821c961238935189b0e680c8e0e0.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-4_6a63640cdb44ab0e88bebbac2c983f1d.RData b/vignettes/guide_cache/html/unnamed-chunk-4_6a63640cdb44ab0e88bebbac2c983f1d.RData deleted file mode 100644 index 440502f..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-4_6a63640cdb44ab0e88bebbac2c983f1d.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-5_faf403bb3a1ea2958f968d77cee5232e.RData b/vignettes/guide_cache/html/unnamed-chunk-5_faf403bb3a1ea2958f968d77cee5232e.RData deleted file mode 100644 index 3fff702..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-5_faf403bb3a1ea2958f968d77cee5232e.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-6_6b9881d4f0b7e2874fe737e97ffee009.RData b/vignettes/guide_cache/html/unnamed-chunk-6_6b9881d4f0b7e2874fe737e97ffee009.RData deleted file mode 100644 index 0d1854e..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-6_6b9881d4f0b7e2874fe737e97ffee009.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-7_2f784a202ffa0159f7f88a77e23d0368.RData b/vignettes/guide_cache/html/unnamed-chunk-7_2f784a202ffa0159f7f88a77e23d0368.RData deleted file mode 100644 index 8b6c3be..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-7_2f784a202ffa0159f7f88a77e23d0368.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-8_7525c35c8a218ca19bb1d5022386193d.RData b/vignettes/guide_cache/html/unnamed-chunk-8_7525c35c8a218ca19bb1d5022386193d.RData deleted file mode 100644 index 01bf78e..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-8_7525c35c8a218ca19bb1d5022386193d.RData and /dev/null differ diff --git a/vignettes/guide_cache/html/unnamed-chunk-9_b03f66dc6a723e0ee331ebbbc40c09f6.RData b/vignettes/guide_cache/html/unnamed-chunk-9_b03f66dc6a723e0ee331ebbbc40c09f6.RData deleted file mode 100644 index be9dbab..0000000 Binary files a/vignettes/guide_cache/html/unnamed-chunk-9_b03f66dc6a723e0ee331ebbbc40c09f6.RData and /dev/null differ diff --git a/vignettes/test_mrtryx.Rmd b/vignettes/test_mrtryx.Rmd deleted file mode 100644 index 1e22512..0000000 --- a/vignettes/test_mrtryx.Rmd +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: "Test file for MR-TRYX" -author: "Yoonsu Cho" -date: "7 November 2019" -output: html_document ---- - -```{r, echo=TRUE, warning=FALSE, message=FALSE} -library(knitr) -knitr::opts_chunk$set(echo=TRUE, message=FALSE, warning=FALSE, dev="png", cache=TRUE, eval=FALSE) -``` - - -Test commands for each function - - -```{r} -library(TwoSampleMR) -library(MRInstruments) -library(RadialMR) -library(tryx) -``` - - -Data preparation - -Example: systolic blood pressure and coronary artery disease - - -```{r} -ao <- available_outcomes() -bmi <- extract_instruments(outcomes = 2) -sbp <- extract_outcome_data(snps=bmi$SNP, outcomes = "UKB-a:360") -dat <- harmonise_data(bmi, sbp) -``` - - - -Scan - - a. Test "tryx.scan" -```{r} -scan_bmi <- tryx.scan(dat) -load("~/tryx/tests/test_mrtryx.RData") -``` - - - b. Test "tryx.sig"" -```{r} -scan_bmi <- tryx.sig(scan_bmi) -``` - - - c. Test "tryx.adjustment" -```{r} -id_remove <- c(2, 72, 89, 90, "UKB-a:35", "UKB-a:359", "UKB-a:61", 1096, 85, 91, 93, 999) - -ad <- tryx.adjustment(scan_bmi, id_remove = id_remove) -``` - - - d. Test "tryx.adjustment.mv" -```{r} -ad.mv <- tryx.adjustment.mv(scan_bmi, id_remove = id_remove) -``` - - - e. Test "tryx.analyse" -```{r} -an <- tryx.analyse(scan_bmi, id_remove = id_remove) -``` - - - f. Test "tryx.analyse.mv" -```{r} -an.mv <- tryx.analyse.mv(scan_bmi, id_remove = id_remove) -``` \ No newline at end of file diff --git a/vignettes/test_mrtryx_cache/html/__packages b/vignettes/test_mrtryx_cache/html/__packages deleted file mode 100644 index 4b5c11a..0000000 --- a/vignettes/test_mrtryx_cache/html/__packages +++ /dev/null @@ -1,2 +0,0 @@ -base -knitr diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-2_dbcb0118852c064c839c8e6a769ef072.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-2_dbcb0118852c064c839c8e6a769ef072.RData deleted file mode 100644 index b069850..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-2_dbcb0118852c064c839c8e6a769ef072.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-3_e59665ff2041c53c23514c602a6da195.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-3_e59665ff2041c53c23514c602a6da195.RData deleted file mode 100644 index b06e09f..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-3_e59665ff2041c53c23514c602a6da195.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-4_ffeecf8d30ba6a3c897db24ff23e494b.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-4_ffeecf8d30ba6a3c897db24ff23e494b.RData deleted file mode 100644 index 0d616fb..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-4_ffeecf8d30ba6a3c897db24ff23e494b.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-5_681b7719dd7b3aad77411977a23d00aa.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-5_681b7719dd7b3aad77411977a23d00aa.RData deleted file mode 100644 index 05fb730..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-5_681b7719dd7b3aad77411977a23d00aa.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-6_36d82e83c03fefb70e74d504b3fdd884.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-6_36d82e83c03fefb70e74d504b3fdd884.RData deleted file mode 100644 index 4e536bc..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-6_36d82e83c03fefb70e74d504b3fdd884.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-7_eebfcc17870842da8b415d54e11a347c.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-7_eebfcc17870842da8b415d54e11a347c.RData deleted file mode 100644 index 042daf8..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-7_eebfcc17870842da8b415d54e11a347c.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-8_152debec66f2f51357ff9a0bdb39c458.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-8_152debec66f2f51357ff9a0bdb39c458.RData deleted file mode 100644 index 3328b94..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-8_152debec66f2f51357ff9a0bdb39c458.RData and /dev/null differ diff --git a/vignettes/test_mrtryx_cache/html/unnamed-chunk-9_363488870b068437f0c6c916f29575d1.RData b/vignettes/test_mrtryx_cache/html/unnamed-chunk-9_363488870b068437f0c6c916f29575d1.RData deleted file mode 100644 index e56726a..0000000 Binary files a/vignettes/test_mrtryx_cache/html/unnamed-chunk-9_363488870b068437f0c6c916f29575d1.RData and /dev/null differ