Skip to contents

This function calculates the ligand receptor interaction score using CellChat The output features are in the form of celltype a -> celltype b -- ligand 1 -> receptor 2 , which indicates the interaction between ligand 1 in celltype a and receptor 2 in celltype b.

It supports scRNA-seq.

Usage

run_CCI(data, type = "scrna", species = "Homo sapiens", ncores = 1)

Arguments

data

A list object containing data matrix and celltype and sample vector.

type

input data type, either scrna, spatial_p, or spatial_t

ncores

number of cores

Value

a matrix of samples x features The features are in the form of ligand 1 receptor 2 celltype a, ligand 1 receptor 2 celltype b ... etc, with the numbers representing cell-cell interaction probability.

Examples


utils::data("example_scrnaseq" , package = "scFeatures")
data <- example_scrnaseq[1:1000, 1:100]
celltype <- data$celltype
sample <- data$sample
data <- as.matrix(data@assays$RNA@data)

alldata <- scFeatures:::formatData(data = data, celltype = celltype, sample = sample )
if (requireNamespace("CellChat", quietly = TRUE)) {
  feature_CCI <- run_CCI(alldata, type = "scrna", ncores = 1)
}
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Error in make.unique(colnames(this_sample_data)) : 
#>   'names' must be a character vector
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error in wilcoxauc.default(data.use, labels, groups_use = level.use) : 
#>   Must have at least 2 groups defined.
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Warning: The 'meta' data does not have a column named `samples`. We now add this column and all cells are assumed to belong to `sample1`!
#> Error : 'smoothData' is not an exported object from 'namespace:CellChat'
#> Error in make.unique(colnames(this_sample_data)) : 
#>   'names' must be a character vector
#> Error in make.unique(colnames(this_sample_data)) : 
#>   'names' must be a character vector
#> Warning: column names 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result
#> Warning: column names 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y', 'prob.x', 'prob.y' are duplicated in the result