Identify potential doublet cells using cluster assignments. Imagine the following scenario: we have a macrophage-endothelial doublet cell; an endothelial cell cluster, and a macrophage cluster in which the doublet cell is currently 'hidden'. We take the residual profile of the hidden doublet cell against its cluster centroid (the average expression profile of same-sample cells in its cluster). Since the cluster is a macrophage cluster, what we are theoretically left with is an endothelial expression profile. We then look for correlations between this cell's residual profile and the residual profile of every other cluster centroid to the same original centroid (that of the macrophage clsuter in which the doublet cell resides). The endothelial cluster centroid - the macrophage cluster centroid will leave us with an endothelial expression profile, which should have high correlation to the residual profile of the doublet cell.

doubletCells(
  m,
  clusters,
  samples,
  clusters_to_check = clusters,
  return.type = c("matrix", "list")
)

Arguments

m

matrix of genes by cells expression values

clusters

list of cell IDs in each cluster

samples

character vector of unique sample ids. These are used to calculate sample-specific cluster centroids, since doublets can only occur between cells coming from the same sample.

clusters_to_check

the clusters to look for doublet cells in. These are checked against the clusters in <clusters>. Default: clusters

return.type

"matrix" returns the matrix of cluster by cell correlation values, with the cells from each cluster combined into one matrix. "list" returns a list of matrices, with the cells in each cluster in separate matrices. Default: c("matrix", "list")

Value

a matrix or list of matrices. Each matrix is of the form cluster X cell and is described by their respective pairwise pearson correlation values.

See also

str_detect setNames,character(0)