get_gene_correlation_scores: get_gene_correlation_scores

View source: R/get_gene_prediction_scores.R

get_gene_correlation_scoresR Documentation

get_gene_correlation_scores

Description

Calculates per gene correlation between measured expression levels and estimated expression levels (average across neighbors). It is an intermediate step for 'get_gene_prediction_scores' function. It can be handy to calculate this part separately to be recycled multiple times to compare different seelctions.

Usage

get_gene_correlation_scores(
  sce,
  genes,
  batch = NULL,
  n.neigh = 5,
  nPC = NULL,
  genes.predict = rownames(sce),
  method = "spearman",
  ...
)

Arguments

sce

SingleCellExperiment object containing gene counts matrix (stored in 'logcounts' assay).

genes

Character vector containing names of selected genes.

batch

Name of the field in colData(sce) to specify batch. Default batch=NULL if no batch is applied.

n.neigh

Positive integer > 1, specifying number of neighbors to use for kNN-graph. Default n.neigh=5.

nPC

Scalar (or NULL) specifying number of PCs to use for construction of kNN-graph. Default nPC=NULL. We advise to set it to 50 if length(genes.selection) > 50.

genes.predict

Character vector containing names of genes for which we want to calculate gene prediction score. Default = rownames(sce).

method

Character specifying method for correlation. Availbale options are c("spearman", "pearson", "kendall"). Default method="spearman".

...

Additional arguments.

Examples

require(SingleCellExperiment)
n_row = 1000
n_col = 100
sce = SingleCellExperiment(assays = list(logcounts = matrix(rnorm(n_row*n_col), ncol=n_col)))
rownames(sce) = as.factor(1:n_row)
colnames(sce) = c(1:n_col)
sce$cell = colnames(sce)
genes = rownames(sce)
out = get_gene_correlation_scores(sce, genes)


MarioniLab/geneBasisR documentation built on June 30, 2023, 2:04 p.m.