make_hexbin: Bivariate binning of single cell data into hexagon cells.

make_hexbinR Documentation

Bivariate binning of single cell data into hexagon cells.

Description

make_hexbin returns a SingleCellExperiment object of binned hexagon cells.

Usage

make_hexbin(sce, nbins = 80, dimension_reduction = "UMAP", use_dims = c(1, 2))

## S4 method for signature 'SingleCellExperiment'
make_hexbin(sce, nbins = 80, dimension_reduction = "UMAP", use_dims = c(1, 2))

Arguments

sce

A SingleCellExperiment object.

nbins

The number of bins partitioning the range of the first component of the chosen dimension reduction.

dimension_reduction

A string indicating the reduced dimension result to calculate hexagon cell representation of.

use_dims

A vector of two integers specifying the dimensions used.

Details

This function bins observations with computed reduced dimension results into hexagon cells. For a SingleCellExperiment as a list in the @metadata. The list contains two items. The first item stores a vector specifying the hexagon ID for each observation. The second item stores a matrix with the x and y positions of the hexagon cells and the number of observations in each of them.

Value

A SingleCellExperiment object.

Functions

  • make_hexbin(SingleCellExperiment): Bivariate binning of SingleCellExperiment into hexagon cells.

Examples

# For SingleCellExperiment object
library(TENxPBMCData)
library(scater)
tenx_pbmc3k <- TENxPBMCData(dataset = "pbmc3k")
rm_ind <- calculateAverage(tenx_pbmc3k) < 0.1
tenx_pbmc3k <- tenx_pbmc3k[!rm_ind, ]
tenx_pbmc3k <- logNormCounts(tenx_pbmc3k)
tenx_pbmc3k <- runPCA(tenx_pbmc3k)
tenx_pbmc3k <- make_hexbin(tenx_pbmc3k, 80, dimension_reduction = "PCA")

SaskiaFreytag/schex documentation built on Feb. 4, 2024, 7:49 p.m.