Learn R Programming

CellChat (version 1.0.0)

createCellChat: Create a new CellChat object from a data matrix, Seurat or SingleCellExperiment object

Description

Create a new CellChat object from a data matrix, Seurat or SingleCellExperiment object

Usage

createCellChat(object, meta = NULL, group.by = NULL, do.sparse = T)

Arguments

object

a normalized data matrix (genes by cells), Seurat or SingleCellExperiment object

meta

a data frame consisting of cell information, which will be used for defining cell groups. If input is a Seurat or SingleCellExperiment object, the meta data in the object will be used

group.by

a char name of the variable in meta data, defining cell groups. If input is a data matrix and group.by is NULL, the input `meta` should contain a column named 'labels', If input is a Seurat or SingleCellExperiment object, USER must provide `group.by` to define the cell groups. e.g, group.by = "ident" for Seurat object

do.sparse

whether use sparse format

Value

Examples

Run this code
# NOT RUN {
# Input is a data matrix
## create a dataframe consisting of the cell labels
meta = data.frame(labels = cell.labels, row.names = names(cell.labels))
cellchat <- createCellChat(object = data.input, meta = meta, group.by = "labels")

# input is a Seurat object
## use the default cell identities of Seurat object
# cellchat <- createCellChat(object = seurat.obj, group.by = "ident")
## use other meta information as cell groups
# cellchat <- createCellChat(object = seurat.obj, group.by = "seurat.clusters")

# input is a SingleCellExperiment object
# cellchat <- createCellChat(object = sce.obj, group.by = "sce.clusters")
# }

Run the code above in your browser using DataLab