newSlalomModel {slalom} | R Documentation

## Create a new SlalomModel object.

### Description

Slalom fits relatively complicated hierarchical Bayesian factor analysis models with data and results stored in a `"SlalomModel"` object. This function builds a new `"SlalomModel"` object from minimal inputs.

### Usage

    newSlalomModel(object, genesets, n_hidden = 5, prune_genes = TRUE,
      min_genes = 15, design = NULL, anno_fpr = 0.01, anno_fnr = 0.001,
      assay_name = "logcounts", verbose = TRUE)

### Arguments

`object` | `"SingleCellExperiment"` object N x G expression data matrix (cells x genes)
`genesets` | a `"GeneSetCollection"` object containing annotated gene sets
`n_hidden` | number of hidden factors to fit in the model (2-5 recommended)
`prune_genes` | logical, should genes that are not annotated to any gene sets be filtered out? If `TRUE`, then any genes with zero variance in expression are also filtered out.
`min_genes` | scalar, minimum number of genes required in order to retain a gene set for analysis
`design` | numeric design matrix providing values for covariates to fit in the model (rows represent cells)
`anno_fpr` | numeric(1), false positive rate (FPR) for assigning genes to factors (pathways); default is 0.01
`anno_fnr` | numeric(1), false negative rate (FNR) for assigning genes to factors (pathways); default is 0.001
`assay_name` | character(1), the name of the `assay` of the `object` to use as expression values. Default is `logcounts`, assumed to be normalised log2-counts-per-million values or equivalent.
`verbose` | logical(1), should information about what's going be printed to screen?

### Details

This function builds and returns the object, checking for validity, which includes checking that the input data is of consistent dimensions.

### Value

a new Rcpp_SlalomModel object

### Examples

    gmtfile <- system.file("extdata", "reactome_subset.gmt", package = "slalom")
    genesets <- GSEABase::getGmt(gmtfile)
    data("mesc")
    model <- newSlalomModel(mesc, genesets, n_hidden = 5, min_genes = 10)

    exprsfile <- system.file("extdata", "mesc.csv", package = "slalom")
    mesc_mat <- as.matrix(read.csv(exprsfile))
    sce <- SingleCellExperiment::SingleCellExperiment(assays = list(logcounts = mesc_mat))
    # model2 <- newSlalomModel(mesc_mat, genesets, n_hidden = 5, min_genes = 10)

[Package slalom version 1.8.0 Index]