Step 1 of variance decomposition analysis (see examples).

vd_Formula(object, covariates = NULL, interactions = NULL)

Arguments

object

Seurat Object

covariates

vector of model covariates

interactions

vector of interaction terms.

Value

List containing model formula and data.frame of covariates.

See also

Author

Nicholas Mikolajewicz

Examples


parameter.list <- list(
 covariates = c( "cluster", "percent.mt", "batch", "cycle", "seq.coverage"),
 interactions = c("batch:cluster")
)

# step 1: model formulation
vd_model.list <- vd_Formula(object = so.query,
                           covariates = parameter.list$covariates,
                           interactions = parameter.list$interactions)
#> Error in vd_Formula(object = so.query, covariates = parameter.list$covariates,     interactions = parameter.list$interactions): could not find function "vd_Formula"

# step 2: prep model inputs
vd_inputs.list <- vd_Inputs(object = so.query, vd_model.list = vd_model.list, features = NULL,
                           pct.min =  0.9, variable.features = F, subsample.factor = 1)
#> Error in vd_Inputs(object = so.query, vd_model.list = vd_model.list, features = NULL,     pct.min = 0.9, variable.features = F, subsample.factor = 1): could not find function "vd_Inputs"

# step 3: run variance decomposition
vd_results.list <- vd_Run(vd_inputs.list, n.workers = 20)
#> Error in vd_Run(vd_inputs.list, n.workers = 20): could not find function "vd_Run"

# step 4 (optional): visualize UMAP distribution of covariates
plt.umap.list <- vd_UMAP(object = so.query, vd_model.list = vd_model.list)
#> Error in vd_UMAP(object = so.query, vd_model.list = vd_model.list): could not find function "vd_UMAP"

# step 5 (optional): visualize decomposition
res.var2 <- vd_results.list$varPart.format1
#> Error in eval(expr, envir, enclos): object 'vd_results.list' not found
plt.var <- plotVarPart( res.var2 ) +
 theme_miko() +
 labs(title = "Variance Decomposition", subtitle = "Linear Mixed-Effects Model")  +
 theme(axis.text.x = element_text(angle = 45, hjust = 1))
#> Error in plotVarPart(res.var2): could not find function "plotVarPart"