Compute a correlation matrix of gene expression. For matrices, this function will correlate the columns; for Seurat objects, this function automatically retrieves the cluster means of the provided genes using meanClusterExpression, and then correlates the cluster means.

correlateExpression(s1, s2, genes, from_sp, to_sp, return_input = FALSE)

Arguments

s1

A Seurat object, or a gene x cluster/sample matrix giving mean cluster/sample expression for dataset 1. If a matrix, rownames should be gene symbols. This dataset will form the x-axis of the plot; column names will be pulled from the column names of this object.

s2

A Seurat object, or a gene x cluster/sample matrix giving mean cluster/sample expression for dataset 2. This dataset will form the y-axis of the plot; row names will be pulled from the column names of this object.

genes

Character vector of genes, in the same species as s1.

from_sp

Species of s1

to_sp

Species of s2. If different from from_sp, conversion of gene names will be handled automatically.

method

Character, one of "pearson", "kendall", "spearman", specifying the method to use for the correlations. Default: "spearman"

Examples

# Compute pairwise correlations between clusters in pbmc # NOT RUN # correlateExpression(s1 = pbmc, # s2 = pbmc, # genes = head(rownames(pbmc@raw.data), 100), # from_sp = "hg", # to_sp = "hg")