plotGeneLoadings: Visualize factor expression and gene loading

View source: R/visualization.R

plotGeneLoadingsR Documentation

Visualize factor expression and gene loading

Description

Visualize factor expression and gene loading

Usage

plotGeneLoadings(
  object,
  markerTable,
  useFactor,
  useDimRed = NULL,
  nLabel = 15,
  nPlot = 30,
  ...
)

plotGeneLoadingRank(
  object,
  markerTable,
  useFactor,
  nLabel = 15,
  nPlot = 30,
  ...
)

Arguments

object

A liger object with valid factorization result.

markerTable

Returned result of getFactorMarkers.

useFactor

Integer index for which factor to visualize.

useDimRed

Name of the variable storing dimensionality reduction result in the cellMeta slot. Default "UMAP".

nLabel

Integer, number of top genes to be shown with text labels. Default 15.

nPlot

Integer, number of top genes to be shown in the loading rank plot. Default 30.

...

Arguments passed on to plotDimRed, .ggScatter, .ggplotLigerTheme

colorByFunc

Default NULL. A function object that expects a vector/factor/data.frame retrieved by colorBy as the only input, and returns an object of the same size, so that the all color "aes" are replaced by this output. Useful when, for example, users need to scale the gene expression shown on plot.

cellIdx

Character, logical or numeric index that can subscribe cells. Missing or NULL for all cells.

shapeBy

Available variable name in cellMeta slot to look for categorical annotation to be reflected by dot shapes. Default NULL.

titles

Title text. A character scalar or a character vector with as many elements as multiple plots are supposed to be generated. Default NULL.

dotSize,dotAlpha

Numeric, controls the size or transparency of all dots. Default getOption("ligerDotSize") (1) and 0.9.

trimHigh,trimLow

Numeric, limit the largest or smallest value of continuous colorBy variable. Default NULL.

raster

Logical, whether to rasterize the plot. Default NULL automatically rasterize the plot when number of total dots to be plotted exceeds 100,000.

legendColorTitle

Legend title text for color aesthetics, often used for categorical or continuous coloring of dots. Default NULL shows the original variable name.

legendShapeTitle

Legend title text for shape aesthetics, often used for shaping dots by categorical variable. Default NULL shows the original variable name.

showLegend

Whether to show the legend. Default TRUE.

legendPosition

Text indicating where to place the legend. Choose from "top", "bottom", "left" or "right". Default "right".

baseSize

One-parameter control of all text sizes. Individual text element sizes can be controlled by other size arguments. "Title" sizes are 2 points larger than "text" sizes when being controlled by this.

titleSize,xTitleSize,yTitleSize,legendTitleSize

Size of main title, axis titles and legend title. Default NULL controls by baseSize + 2.

subtitleSize,xTextSize,yTextSize,legendTextSize

Size of subtitle text, axis texts and legend text. Default NULL controls by baseSize.

panelBorder

Whether to show rectangle border of the panel instead of using ggplot classic bottom and left axis lines. Default FALSE.

colorPalette

For continuous coloring, an index or a palette name to select from available options from ggplot scale_brewer or viridis. Default "magma".

colorDirection

Choose 1 or -1. Applied when colorPalette is from Viridis options. Default -1 use darker color for higher value, while 1 reverses this direction.

naColor

The color code for NA values. Default "#DEDEDE". scale_colour_gradient2. Default NULL.

Examples

result <- getFactorMarkers(pbmcPlot, "ctrl", "stim")
plotGeneLoadings(pbmcPlot, result, useFactor = 2)

rliger documentation built on Oct. 30, 2024, 1:07 a.m.