This function performs weights computation for Transcriptome-Wide Association Study (TWAS) in a multivariate setting. It incorporates steps such as fitting models using mvSuSiE and mr.mash, calculating TWAS weights and predictions, and optionally performing cross-validation for TWAS weights.
Usage
twas_multivariate_weights_pipeline(
X,
Y,
mnm_fit,
L = NULL,
L_greedy = 5,
cv_folds = 5,
sample_partition = NULL,
data_driven_prior_matrices = NULL,
data_driven_prior_matrices_cv = NULL,
canonical_prior_matrices = FALSE,
mvsusie_max_iter = 200,
mrmash_max_iter = 5000,
max_cv_variants = -1,
cv_threads = 1,
verbose = 1
)Arguments
- X
A matrix of genotype data where rows represent samples and columns represent genetic variants.
- Y
A matrix of phenotype measurements, where rows represent samples and columns represent conditions.
- mnm_fit
An object containing the fitted multivariate models (e.g., mvSuSiE and mr.mash fits).
- L
Maximum number of components in mvSuSiE. If NULL, the number of components in the fitted mvSuSiE object is used.
- L_greedy
Initial greedy number of components in mvSuSiE. Defaults to 5.
- cv_folds
The number of folds to use for cross-validation. Defaults to 5. Set to 0 to skip cross-validation.
- sample_partition
Optional data frame with Sample and Fold columns for cross-validation. If NULL, a random partition is generated.
- data_driven_prior_matrices
A list of data-driven covariance matrices for mr.mash weights. Defaults to NULL.
- data_driven_prior_matrices_cv
A list of data-driven covariance matrices for mr.mash weights in cross-validation. Defaults to NULL.
- canonical_prior_matrices
If TRUE, computes canonical covariance matrices for mr.mash. Defaults to FALSE.
- mvsusie_max_iter
The maximum number of iterations for mvSuSiE. Defaults to 200.
- mrmash_max_iter
The maximum number of iterations for mr.mash. Defaults to 5000.
- 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.
- verbose
Integer controlling verbosity level: 0 = suppress all messages, 1 = show pecotmr messages but suppress external package messages (default), 2 = show all messages including those from external packages.