Learn R Programming

glmmSeq (version 0.2.0)

pairedPlot: Paired plots

Description

Paired plots to show differences between groups and over time

Usage

pairedPlot(
  glmmResult,
  geneName = NULL,
  x1Label = NULL,
  x2Label = NULL,
  IDColumn = "ID",
  xTitle = NULL,
  yTitle = "Gene Expression",
  title = NULL,
  logTransform = FALSE,
  shapes = 19,
  colours = "red",
  lineColours = "grey60",
  markerSize = 2,
  fontSize = NULL,
  alpha = 0.7,
  x2Offset = 6,
  pairedOnly = TRUE,
  graphics = "base",
  addModel = TRUE,
  modelSize = 3,
  modelColours = "black",
  modelLineSize = 1,
  modelLineColours = NULL,
  addBox = FALSE,
  addViolins = TRUE,
  violinWidth = 0.5,
  ...
)

Value

Returns a paired plot for matched samples.

Arguments

glmmResult

A glmmSeq object created by glmmSeq::glmmSeq()

geneName

The gene/row name to be plotted

x1Label

The name of the first (inner) x parameter. This must be able to be paired using the ID.

x2Label

The name of the second (outer) x parameter

IDColumn

Column name of sample IDs for pairing

xTitle

Title for the x axis

yTitle

Title for the y axis

title

Plot title. If NULL gene name is used

logTransform

Whether to perform a log10 transform on the y axis

shapes

The marker shapes (default=19)

colours

The marker colours (default='red') as vector or named vector

lineColours

The line colours (default='grey60') as vector or named vector

markerSize

Size of markers (default=2)

fontSize

Plot font size

alpha

Line and marker opacity (default=0.7)

x2Offset

Vertical adjustment to secondary x-axis (default=6)

pairedOnly

Logical whether to only plot paired samples (default=TRUE)

graphics

Which graphic system to use (options = "base" or "ggplot")

addModel

Whether to add the fit model with markers (default=TRUE)

modelSize

Size of model points (default=3)

modelColours

Colour of model fit markers (default="black") as vector or named vector

modelLineSize

Size of model points (default=1) as vector or named vector

modelLineColours

Colour of model fit lines. If NULL same colours as modelColour used (default=NULL).

addBox

Logical whether to add boxplots for mean and IQR.

addViolins

Logical whether to add half violin-plots (ggplot only), default=TRUE

violinWidth

Width of violin plots (default=0.5)

...

Other parameters to pass to graphics::plot() or ggplot2::theme().

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)
})

MS4A1glmm <- glmmSeq(~ Timepoint * EULAR_6m + (1 | PATID),
                     id = 'PATID',
                     countdata = tpm['MS4A1', ],
                     metadata = metadata,
                     dispersion = disp['MS4A1'],
                     removeDuplicatedMeasures=TRUE,
                     verbose=FALSE)

pairedPlot(glmmResult=MS4A1glmm,
           geneName = 'MS4A1',
           x1Label = 'Timepoint',
           x2Label='EULAR_6m',
           IDColumn = 'PATID',
           colours = c('skyblue', 'goldenrod1', 'mediumvioletred'),
           graphics = 'base')

Run the code above in your browser using DataLab