Function to get the density of points with value TRUE in the (x,y) plot

get_density(
  x,
  y,
  detection,
  rows.subset = 1:nrow(detection),
  high.resolution = FALSE
)

Arguments

x

x-axis coordinates of cells in a 2D representation (e.g. resulting from PCA or t-SNE)

y

y-axis coordinates of cells in a 2D representation

detection

A logical matrix or dgRMatrix showing which gens (rows) are detected in which cells (columns)

rows.subset

Indices of the rows of 'detection' for which to get the densities. Default: all.

high.resolution

Logical: should high resolution be used? Default is FALSE.

Value

A 3-dimensional array (dim 1: genes/rows of expression, dim 2 and 3: x and y grid points) with density data