Learn R Programming

CrossExpression (version 1.0.0)

smooth_cells: Smooths cells' gene expression by averaging its expression by the nearest neighbors. Optionally computes genes by genes Pearson's correlation matrix between cells by genes and neighbors by genes matrices.

Description

Smooths cells' gene expression by averaging its expression by the nearest neighbors. Optionally computes genes by genes Pearson's correlation matrix between cells by genes and neighbors by genes matrices.

Usage

smooth_cells(data, locations, neighbors_smoothed = 1, corr = TRUE)

Value

Returns a smoothed gene expression matrix. If corr = TRUE, additionally returns a gene-gene correlation matrix.

Arguments

data

A cells by genes expression matrix.

locations

A cells by coordinates (x-y or higher dimensions) matrix.

neighbors_smoothed

Numbers of neighbors used for smoothing (0 is the cell itself; 1 is the nearest neighbor).

corr

If TRUE, computes genes by genes correlation matrix between regions.

Examples

Run this code
data("locations")
data("expression")
locations  = as.matrix(locations)
expression = as.matrix(expression)
expression = expression[,1:5]
results    = smooth_cells(data = expression, locations = locations)

Run the code above in your browser using DataLab