Skip to contents

This function performs weights computation for Transcriptome-Wide Association Study (TWAS) incorporating various steps such as filtering variants by linkage disequilibrium reference panel variants, fitting models using SuSiE and other methods, and calculating TWAS weights and predictions. Optionally, it can perform cross-validation for TWAS weights.

Usage

twas_weights_pipeline(
  X,
  y,
  susie_fit = NULL,
  cv_folds = 5,
  sample_partition = NULL,
  weight_methods = list(enet_weights = list(), lasso_weights = list(), bayes_r_weights =
    list(), bayes_l_weights = list(), mrash_weights = list(init_prior_sd = TRUE, max.iter
    = 100), susie_weights = list(refine = FALSE, init_L = 5, max_L = 20)),
  max_cv_variants = -1,
  cv_threads = 1,
  cv_weight_methods = NULL
)

Arguments

X

A matrix of genotype data where rows represent samples and columns represent genetic variants.

y

A vector of phenotype measurements for each sample.

susie_fit

An object returned by the SuSiE function, containing the SuSiE model fit.

cv_folds

The number of folds to use for cross-validation. Set to 0 to skip cross-validation. Defaults to 5.

weight_methods

List of methods to use to compute weights for TWAS; along with their parameters.

max_cv_variants

The maximum number of variants to be included in cross-validation. Defaults to -1 which means no limit.

cv_threads

The number of threads to use for parallel computation in cross-validation. Defaults to 1.

cv_weight_methods

List of methods to use for cross-validation. If NULL, uses the same methods as weight_methods.

Value

A list containing results from the TWAS pipeline, including TWAS weights, predictions, and optionally cross-validation results.

Examples

# Example usage (assuming appropriate objects for X, y, and susie_fit are available):
twas_results <- twas_weights_pipeline(X, y, susie_fit)
#> Performing TWAS weights computation for univariate analysis methods ...
#> Error: object 'susie_fit' not found