plot_lawn: Create an interactive lawn plot

View source: R/plotting_gene_sgrna.R

plot_lawnR Documentation

Create an interactive lawn plot

Description

Create an interactive lawn plot for data with significance values. Typically, this plot is randomly ordered along the x-axis, but the user is free to order it by any term in res that they'd like.

Usage

plot_lawn(
  res,
  ylim = 5,
  fc.thresh = 0.5,
  hover.info = NULL,
  sig.line = TRUE,
  h.id = "crispr",
  feat.term = "rows",
  x.term = "RandomIndex",
  sig.term = "fdr",
  lfc.term = "LFC",
  down.color = "#0026ff",
  up.color = "#ff0000",
  insig.color = "#A6A6A6",
  sig.thresh = 0.05,
  fs = NULL,
  sig.size = 6,
  insig.size = 5,
  sig.opacity = 1,
  insig.opacity = 0.5,
  label.size = 10,
  webgl = TRUE,
  webgl.ratio = 7,
  show.counts = TRUE,
  show.hl.counts = TRUE,
  counts.size = TRUE,
  highlight.featsets = NULL,
  highlight.feats = NULL,
  featsets = NULL,
  highlight.feats.color = "#E69F00",
  highlight.feats.size = 7,
  highlight.feats.opac = 1,
  highlight.feats.linecolor = "#000000",
  highlight.feats.linewidth = 1,
  highlight.feats.label = TRUE,
  highlight.featsets.color = "#009E73",
  highlight.featsets.size = 7,
  highlight.featsets.opac = 1,
  highlight.featsets.linecolor = "#000000",
  highlight.featsets.linewidth = 1,
  highlight.featsets.label = FALSE,
  h.id.suffix = "_lawn"
)

Arguments

res

Dataframe containing, at minimum, significance values and a term by which the x-axis can be ordered.

ylim

Positive numeric scalar indicating y-axis limits. The negative value will be used for the lower limit.

fc.thresh

Numeric scalar indicating the fold change threshold for coloring significant features.

hover.info

Character vector indicating which additional columns from res to include in the hover info.

sig.line

Logical indicating whether to add a significance threshold line to the plot.

h.id

Character scalar indicating the unique ID of the plotly object. Can usually be ignored, but should be used if multiple plots are being created in the same R session (e.g. Shiny app).

feat.term

Character scalar indicating the column name of the feature IDs in res.

x.term

Character scalar for the x-axis term from res to be plotted.

sig.term

Character scalar indicating the column name of the significance values in res.

lfc.term

Character scalar indicating the column name of the log fold change values in res.

down.color

Character scalar indicating the color of down-regulated features.

up.color

Character scalar indicating the color of up-regulated features.

insig.color

Character scalar indicating the color of insignificant features.

sig.thresh

Numeric scalar indicating the significance threshold for coloring significant features.

fs

Dataframe containing coordinates and label information for points that should be labeled. Columns should be:

  • x - x coordinate of the point

  • y - y coordinate of the point

  • customdata - label to be displayed

sig.size

Numeric scalar indicating the size of significant feature points.

insig.size

Numeric scalar indicating the size of insignificant feature points.

sig.opacity

Numeric scalar indicating the opacity of significant feature points.

insig.opacity

Numeric scalar indicating the opacity of insignificant feature points.

label.size

Numeric scalar indicating the size of feature labels.

webgl

Logical indicating whether to use WebGL for rendering the plot.

webgl.ratio

Numeric scalar indicating the ratio of WebGL to HTML5 canvas rendering, increases resolution of saved plot when WebGL plotting is not used.

show.counts

Logical indicating whether to show annotations for the number of features in the plot.

show.hl.counts

Logical indicating whether to show annotations for the number of highlighted features in the plot.

counts.size

Numeric scalar indicating the size of the feature counts labels.

highlight.featsets

Character vector indicating which feature sets should be highlighted.

highlight.feats

Character vector indicating which features should be highlighted.

featsets

Named list of feature sets to be used for highlighting.

highlight.feats.color

Character scalar indicating the color of highlighted features.

highlight.feats.size

Numeric scalar indicating the size of highlighted features.

highlight.feats.opac

Numeric scalar indicating the opacity of highlighted features.

highlight.feats.linecolor

Character scalar indicating the line color of highlighted features.

highlight.feats.linewidth

Numeric scalar indicating the line width of highlighted features.

highlight.feats.label

Logical indicating whether to label highlighted features.

highlight.featsets.color

Character scalar indicating the color of highlighted feature sets.

highlight.featsets.size

Numeric scalar indicating the point size of highlighted feature sets.

highlight.featsets.opac

Numeric scalar indicating the opacity of highlighted feature sets.

highlight.featsets.linecolor

Character scalar indicating the line color of highlighted feature sets.

highlight.featsets.linewidth

Numeric scalar indicating the line width of highlighted feature sets.

highlight.featsets.label

Logical indicating whether to label highlighted feature sets.

h.id.suffix

Character scalar indicating the suffix to be added to the plotly object ID.

Value

An interactive plotly rank plot.

Author(s)

Jared Andrews

Examples

library(CRISPRball)
d1.genes <- read.delim(system.file("extdata", "esc1.gene_summary.txt",
    package = "CRISPRball"
), check.names = FALSE)
plot.df <- gene_ingress(d1.genes,
    sig.thresh = 0.05, es.thresh = 0.5,
    es.col = "LFC", sig.col = "fdr"
)
plot_lawn(plot.df, feat.term = "id")

j-andrews7/CRISPRball documentation built on Nov. 8, 2024, 2:43 a.m.