Step 2 of variance decomposition analysis (see examples). Given Seurat object and vd_Formula output, input list for variance decomposition are generated.

vd_Inputs(
  object,
  vd_model.list,
  features = NULL,
  pct.min = 0,
  variable.features = F,
  subsample.factor = 1
)

Arguments

object

Seurat object.

vd_model.list

Output from vd_Formula.

pct.min

Minimal expressing fraction for genes to be included in analysis. Default is 0.

variable.features

Logical specifying whether to use variable features only. If true, looks for variable features within provided Seurat object.

subsample.factor

Numeric [0,1] specfying how to subsample (i.e., downsample) data. Default is 1 (no subsampling)

Features

Features to include in analysis. If specified, pct.min and variable features are ignored.

Value

list of inputs for vd_Run() function.

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"