Learn R Programming

glmmSeq (version 0.2.0)

fcPlot: Plotly or ggplot fold change plots

Description

Plotly or ggplot fold change plots

Usage

fcPlot(
  glmmResult,
  x1Label,
  x2Label,
  x1Values = NULL,
  x2Values = NULL,
  pCutoff = 0.01,
  labels = c(),
  useAdjusted = FALSE,
  plotCutoff = 1,
  graphics = "ggplot",
  fontSize = 12,
  labelFontSize = 5,
  colours = c("grey", "goldenrod1", "red", "blue"),
  verbose = FALSE
)

Value

Returns a plot for fold change between x1Values in one x2Value subset on x axis and fold change in the other x2Value on the y axis.

Arguments

glmmResult

A glmmSeq object created by glmmSeq::glmmSeq().

x1Label

The name of the first (inner) x parameter

x2Label

The name of the second (outer) x parameter

x1Values

Subpopulations in x1Label to be used to calculate fold change. If NULL the first two levels in x1Label are used.

x2Values

Subpopulations in x2Label to be compared on x and y axis.

pCutoff

The significance cut-off for colour-coding (default = 0.01)

labels

Row names or indices to label on plot

useAdjusted

whether to use adjusted pvalues (must have q_ columns in glmmResult). Default = FALSE

plotCutoff

Which probes to include on plot by significance cut-off (default = 1, for all markers)

graphics

Graphics system to use: "ggplot" or "plotly"

fontSize

Font size

labelFontSize

Font size for labels

colours

Vector of colours to use for significance groups

verbose

Whether to print statistics

Examples

Run this code
data(PEAC_minimal_load)

disp <- apply(tpm, 1, function(x) {
(var(x, na.rm = TRUE)-mean(x, na.rm = TRUE))/(mean(x, na.rm = TRUE)**2)
})

glmmFit <- glmmSeq(~ Timepoint * EULAR_6m + (1 | PATID),
                     id = 'PATID',
                     countdata = tpm[1:5, ],
                     metadata = metadata,
                     dispersion = disp,
                     verbose = FALSE)

fcPlot(glmmResult = glmmFit,
      x1Label = "Timepoint",
      x2Label = "EULAR_6m",
      x2Values = c("Good responder", "Non responder"),
      pCutoff = 0.05,
      useAdjusted = FALSE,
      plotCutoff = 1,
      graphics = "plotly")

Run the code above in your browser using DataLab