get_default_mefisto_options: Get default options for MEFISTO covariates

View source: R/mefisto.R

get_default_mefisto_optionsR Documentation

Get default options for MEFISTO covariates


Function to obtain the default options for the usage of MEFISTO covariates with MEFISTO





an untrained MOFA object


The options are the following:

  • scale_cov: logical: Scale covariates?

  • start_opt: integer: First iteration to start the optimisation of GP hyperparameters

  • n_grid: integer: Number of points for the grid search in the optimisation of GP hyperparameters

  • opt_freq: integer: Frequency of optimisation of GP hyperparameters

  • sparseGP: logical: Use sparse GPs to speed up the optimisation of the GP parameters?

  • frac_inducing: numeric between 0 and 1: Fraction of samples to use as inducing points (only relevant if sparseGP is TRUE)

  • warping: logical: Activate warping functionality to align covariates between groups (requires a multi-group design)

  • warping_freq: numeric: frequency of the warping (only relevant if warping is TRUE)

  • warping_ref: A character specifying the reference group for warping (only relevant if warping is TRUE)

  • warping_open_begin: logical: Warping: Allow for open beginning? (only relevant warping is TRUE)

  • warping_open_end: logical: Warping: Allow for open end? (only relevant warping is TRUE)

  • warping_groups: Assignment of groups to classes used for alignment (advanced option). Needs to be a vector of length number of samples, e.g. a column of samples_metadata, which needs to have the same value within each group. By default groups are used specified in 'create_mofa'.

  • model_groups: logical: Model covariance structure across groups (for more than one group, otherwise FALSE)? If FALSE, we assume the same patterns in all groups.

  • new_values: Values for which to predict the factor values (for interpolation / extrapolation). This should be numeric matrix in the same format with covariate(s) in rows and new values in columns. Default is NULL, leading to no interpolation.


Returns a list with default options for the MEFISTO covariate(s) functionality.


# generate example data
dd <- make_example_data(sample_cov = seq(0,1,length.out = 200), n_samples = 200,
n_factors = 4, n_features = 200, n_views = 4, lscales = c(0.5, 0.2, 0, 0))
# input data
data <- dd$data
# covariate matrix with samples in columns
time <- dd$sample_cov
rownames(time) <- "time"

# create mofa and set covariates
sm <- create_mofa(data = dd$data)
sm <- set_covariates(sm, covariates = time)

MEFISTO_opt <- get_default_mefisto_options(sm)

bioFAM/MOFA2 documentation built on March 21, 2023, 5:27 p.m.