Tryx: Class for MR-TRYX analysis

Description Methods

Description

A simple wrapper function. 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.

Methods

Public methods


Method new()

Create a new dataset and initialise an R interface

Usage
Tryx$new(dat)
Arguments
dat

Dataset from TwoSampleMR::harmonise_data


Method print()

Usage
Tryx$print(...)

Method get_outliers()

Detect outliers in exposure-outcome dataset.

Usage
Tryx$get_outliers(
  dat = self$output$dat,
  outliers = "RadialMR",
  outlier_correction = "none",
  outlier_threshold = ifelse(outlier_correction == "none", 0.05/nrow(dat), 0.05)
)
Arguments
dat

Output from TwoSampleMR::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.


Method set_candidate_traits()

Set a list of GWAS IDs used.

Usage
Tryx$set_candidate_traits(id_list = NULL)
Arguments
id_list

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


Method scan()

Search for candidate traits associated with outliers.

Usage
Tryx$scan(
  dat = self$output$dat,
  search_correction = "none",
  search_threshold = ifelse(search_correction == "none", 5e-08, 0.05),
  use_proxies = FALSE
)
Arguments
dat

Output from TwoSampleMR::harmonise_data.

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.

use_proxies

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


Method candidate_instruments()

Obtain instruments for the candidate traits.

Usage
Tryx$candidate_instruments(
  candidate_instruments = NULL,
  include_outliers = FALSE
)
Arguments
candidate_instruments

Instruments for candidate traits.

include_outliers

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


Method outcome_instruments()

Extract instrument for candidate trait instruments for the original outcome.

Usage
Tryx$outcome_instruments(
  candidate_outcome = NULL,
  dat = self$output$dat,
  use_proxies = FALSE
)
Arguments
candidate_outcome

Extracted instrument SNPs from outcome.

dat

Output from TwoSampleMR::harmonise_data.

use_proxies

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


Method exposure_instruments()

Extract instrument for candidate trait instruments for the original exposure.

Usage
Tryx$exposure_instruments(
  candidate_exposure = NULL,
  dat = self$output$dat,
  use_proxies = FALSE
)
Arguments
candidate_exposure

Extracted instrument SNPs from exposure.

dat

Output from TwoSampleMR::harmonise_data.

use_proxies

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


Method exposure_candidate_instruments()

Extract instrument for the original exposure for the candidate traits.

Usage
Tryx$exposure_candidate_instruments(
  exposure_candidate = NULL,
  dat = self$output$dat,
  use_proxies = FALSE,
  include_outliers = FALSE
)
Arguments
exposure_candidate

Extracted instrument SNPs from exposure.

dat

Output from TwoSampleMR::harmonise_data.

use_proxies

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

include_outliers

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


Method extractions()

Extract instruments for MR analyses.

Usage
Tryx$extractions(
  dat = self$output$dat,
  candidate_instruments = NULL,
  candidate_outcome = NULL,
  candidate_exposure = NULL,
  exposure_candidate = NULL,
  include_outliers = FALSE,
  use_proxies = FALSE
)
Arguments
dat

Output from TwoSampleMR::harmonise_data.

candidate_instruments

Instruments for candidate traits.

candidate_outcome

Extracted instrument SNPs from outcome.

candidate_exposure

Extracted instrument SNPs from exposure.

exposure_candidate

Extracted instrument SNPs from exposure.

include_outliers

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

use_proxies

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


Method candidate_outcome_dat()

Make a dataset for the candidate traits and the original outcome.

Usage
Tryx$candidate_outcome_dat(dat = self$output$dat)
Arguments
dat

Output from TwoSampleMR::harmonise_data.


Method candidate_exposure_dat()

Make a dataset for the candidate traits and the original exposure.

Usage
Tryx$candidate_exposure_dat(dat = self$output$dat)
Arguments
dat

Output from TwoSampleMR::harmonise_data.


Method exposure_candidate_dat()

Make a dataset for the original exposure and the candidate traits.

Usage
Tryx$exposure_candidate_dat(dat = self$output$dat)
Arguments
dat

Output from TwoSampleMR::harmonise_data.


Method harmonise()

Harmonised exposure - outcome dataset.

Usage
Tryx$harmonise(dat = self$output$dat)
Arguments
dat

Output from TwoSampleMR::harmonise_data.


Method mr()

Perform MR anlayses of 1) candidate traits-outcome 2) candidate traits-exposure 3) exposure-candidate traits.

Usage
Tryx$mr(dat = self$output$dat, mr_method = "mr_ivw")
Arguments
dat

Output from TwoSampleMR::harmonise_data.

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.


Method mrtryx()

All-in-one: 1) Detect outlier 2) Search candidate traits 3) Perform MR of candidate traits and the outcome / exposure.

Usage
Tryx$mrtryx(
  dat = self$output$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),
  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.

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.


Method tryx.sig()

Identify putatively significant associations in the outlier scan.

Usage
Tryx$tryx.sig(mr_threshold_method = "fdr", mr_threshold = 0.05)
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


Method adjustment()

Outlier adjustment estimation - How much of the heterogeneity due to the outlier can be explained by alternative pathways?

Usage
Tryx$adjustment(tryxscan = self$output, id_remove = NULL)
Arguments
tryxscan

Output from x$mrtryx()

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.

dat

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


Method adjustment.mv()

Similar to adjusment, but when there are multiple traits associated with a single variant.

Usage
Tryx$adjustment.mv(
  tryxscan = self$output,
  lasso = TRUE,
  id_remove = NULL,
  proxies = FALSE
)
Arguments
tryxscan

Output from x$scan()

lasso

Whether to shrink the estimates of each trait within SNP. Default=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.

dat

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


Method analyse()

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

Usage
Tryx$analyse(
  tryxscan = self$output,
  plot = TRUE,
  id_remove = NULL,
  filter_duplicate_outliers = TRUE
)
Arguments
tryxscan

Output from x$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.


Method analyse.mv()

Similar to analyse, but when there are multiple traits associated with a single variant.

Usage
Tryx$analyse.mv(
  tryxscan = self$output,
  lasso = TRUE,
  plot = TRUE,
  id_remove = NULL,
  proxies = FALSE
)
Arguments
tryxscan

Output from x$scan()

lasso

Whether to shrink the estimates of each trait within SNP. Default=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.


Method manhattan_plot()

Draw a Manhattan style plot for candidate traits-outcome/exposure associations.

Usage
Tryx$manhattan_plot(
  what = "outcome",
  id_remove = NULL,
  y_scale = NULL,
  label = TRUE
)
Arguments
what

Analyse candidate-exposure ('exposure') or candidate-outcome ('outcome') associations

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.

y_scale

The scaling function to be applied to y scale.

label

Display the names of the traits on the graph.


Method clone()

The objects of this class are cloneable with this method.

Usage
Tryx$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


explodecomputer/tryx documentation built on July 26, 2020, 2:45 p.m.