plot_hexbin_interact: Plot of interaction of expression of single cells in...

View source: R/plot_hexbin_interact.R

plot_hexbin_interactR Documentation

Plot of interaction of expression of single cells in bivariate hexagon cells.

Description

Plot of interaction of expression of single cells in bivariate hexagon cells.

Usage

plot_hexbin_interact(
  sce,
  mod,
  type,
  feature,
  interact,
  title = NULL,
  xlab = NULL,
  ylab = NULL
)

Arguments

sce

A SingleCellExperiment object.

mod

A vector of strings referring to the names of the modularities. For SingleCellExperiment use "RNA" to access the RNA expression data stored as the main experiment type.

type

A vector of strings referring to the types of assays in the SingleCellExperiment object.

feature

A vector of strings referring to the names of one features in the same order as the vector of modularities.

interact

A string specifying how interaction between features is calculated. Possible interaction measures are corr_spearman and mi (see details).

title

A string containing the title of the plot.

xlab

A string containing the title of the x axis.

ylab

A string containing the title of the y axis.

Details

This function plots the interaction between any features in the hexagon cell representation calculated with make_hexbin. The interaction between the chosen features is calculated by one of two measurers corr_spearman, ratio and mi:

mi

Returns the mutual information coefficient.

corr_spearman

Returns the Spearman correlation.

fc

Return the log fold change between the features.

Note that fc should be applied to log normalized values.

Value

A ggplot2{ggplot} object.

Examples

# For SingleCellExperiment
library(TENxPBMCData)
library(scater)
tenx_pbmc3k <- TENxPBMCData(dataset = "pbmc3k")
rm_ind <- calculateAverage(tenx_pbmc3k) < 0.1
tenx_pbmc3k <- tenx_pbmc3k[!rm_ind, ]
colData(tenx_pbmc3k) <- cbind(colData(tenx_pbmc3k), perCellQCMetrics(tenx_pbmc3k))
tenx_pbmc3k <- logNormCounts(tenx_pbmc3k)
tenx_pbmc3k <- runPCA(tenx_pbmc3k)
tenx_pbmc3k <- make_hexbin(tenx_pbmc3k, 10, dimension_reduction = "PCA")
plot_hexbin_interact(tenx_pbmc3k,
    type = c("counts", "counts"), mod = c("RNA", "RNA"),
    feature = c("ENSG00000146109", "ENSG00000102265"), interact = "fc"
)

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