Learn R Programming

Seurat (version 3.1.0)

as.Seurat: Convert objects to Seurat objects

Description

Convert objects to Seurat objects

Usage

as.Seurat(x, ...)

# S3 method for CellDataSet as.Seurat(x, slot = "counts", assay = "RNA", verbose = TRUE, ...)

# S3 method for loom as.Seurat(x, cells = "CellID", features = "Gene", normalized = NULL, scaled = NULL, assay = NULL, verbose = TRUE, ...)

# S3 method for SingleCellExperiment as.Seurat(x, counts = "counts", data = "logcounts", assay = "RNA", project = "SingleCellExperiment", ...)

Arguments

x

An object to convert to class Seurat

...

Arguments passed to other methods

slot

Slot to store expression data as

assay

Name to store expression matrices as

verbose

Display progress updates

cells

The name of the dataset within col_attrs containing cell names

features

The name of the dataset within row_attrs containing feature names

normalized

The name of the dataset within layers containing the normalized expression matrix; pass /matrix (with preceeding forward slash) to store /matrix as normalized data

scaled

The name of the dataset within layers containing the scaled expression matrix

counts

name of the SingleCellExperiment assay to store as counts; set to NULL if only normalized data are present

data

name of the SingleCellExperiment assay to slot as data. Set to NULL if only counts are present

project

Project name for new Seurat object

Details

The loom method for as.Seurat will try to automatically fill in a Seurat object based on data presence. For example, if no normalized data is present, then scaled data, dimensional reduction informan, and neighbor graphs will not be pulled as these depend on normalized data. The following is a list of how the Seurat object will be constructed

  • If no assay information is provided, will default to an assay name in a root-level HDF5 attribute called assay; if no attribute is present, will default to "RNA"

  • Cell-level metadata will consist of all one-dimensional datasets in col_attrs except datasets named "ClusterID", "ClusterName", and whatever is passed to cells

  • Identity classes will be set if either col_attrs/ClusterID or col_attrs/ClusterName are present; if both are present, then the values in col_attrs/ClusterID will set the order (numeric value of a factor) for values in col_attrs/ClusterName (charater value of a factor)

  • Feature-level metadata will consist of all one-dimensional datasets in row_attrs except datasets named "Selected" and whatever is passed to features; any feature-level metadata named "variance_standardized", "variance_expected", or "dispersion_scaled" will have underscores "_" replaced with a period "."

  • Variable features will be set if row_attrs/Selected exists and it is a numeric type

  • If a dataset is passed to normalized, stored as a sparse matrix in data; if no dataset provided, scaled will be set to NULL

  • If a dataset is passed to scaled, stored as a dense matrix in scale.data; all rows entirely consisting of NAs will be removed

  • If a dataset is passed to scaled, dimensional reduction information will assembled from cell embedding information stored in col_attrs; cell embeddings will be pulled from two-dimensional datasets ending with "_cell_embeddings"; priority will be given to cell embeddings that have the name of assay in their name; feature loadings will be added from two-dimensional datasets in row_attrs that start with the name of the dimensional reduction and end with either "feature_loadings" or "feature_loadings_projected" (priority given to the latter)

  • If a dataset is passed to scaled, neighbor graphs will be pulled from col_graphs, provided the name starts with the value of assay

Examples

Run this code
# NOT RUN {
lfile <- as.loom(x = pbmc_small)
pbmc <- as.Seurat(x = lfile)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab