Skip to contents

The function plots the effect size plot and volcano plot based on the output from linda.

The function plots the effect size plot and volcano plot based on the output from linda.

Usage

linda.plot(
  linda.obj,
  variables.plot,
  titles = NULL,
  alpha = 0.05,
  lfc.cut = 1,
  legend = FALSE,
  directory = NULL,
  width = 11,
  height = 8
)

linda.plot(
  linda.obj,
  variables.plot,
  titles = NULL,
  alpha = 0.05,
  lfc.cut = 1,
  legend = FALSE,
  directory = NULL,
  width = 11,
  height = 8
)

Arguments

linda.obj

return from function linda.

variables.plot

vector; variables whose results are to be plotted. For example, suppose the return value variables is equal to ('x1', 'x2', 'x3b', 'x3c', 'x1:x2'), then one could set variables.plot = c('x3b', 'x1:x2').

titles

vector; titles of the effect size plot and volcano plot for each variable in variables.plot. Default is NULL. If NULL, the titles will be set as variables.plot.

alpha

a real value between 0 and 1; cutoff for padj.

lfc.cut

a positive value; cutoff for log2FoldChange.

legend

TRUE or FALSE; whether to show the legends of the effect size plot and volcano plot.

directory

character; the directory to save the figures, e.g., getwd(). Default is NULL. If NULL, figures will not be saved.

width

the width of the graphics region in inches. See R function pdf.

height

the height of the graphics region in inches. See R function pdf.

Value

A list of ggplot2 objects.

plot.lfc

a list of effect size plots. Each plot corresponds to one variable in variables.plot.

plot.volcano

a list of volcano plots. Each plot corresponds to one variable in variables.plot.

A list of ggplot2 objects.

plot.lfc

a list of effect size plots. Each plot corresponds to one variable in variables.plot.

plot.volcano

a list of volcano plots. Each plot corresponds to one variable in variables.plot.

References

Huijuan Zhou, Kejun He, Jun Chen, and Xianyang Zhang. LinDA: Linear Models for Differential Abundance Analysis of Microbiome Compositional Data.

Huijuan Zhou, Kejun He, Jun Chen, and Xianyang Zhang. LinDA: Linear Models for Differential Abundance Analysis of Microbiome Compositional Data.

Author

Huijuan Zhou huijuanzhou2019@gmail.com Jun Chen Chen.Jun2@mayo.edu Maintainer: Huijuan Zhou

Examples

if (FALSE) { # \dontrun{
library(ggrepel)
data(smokers)
ind <- smokers$meta$AIRWAYSITE == "Throat"
otu.tab <- as.data.frame(smokers$otu[, ind])
meta <- cbind.data.frame(
  Smoke = factor(smokers$meta$SMOKER[ind]),
  Sex = factor(smokers$meta$SEX[ind]),
  Site = factor(smokers$meta$SIDEOFBODY[ind]),
  SubjectID = factor(smokers$meta$HOST_SUBJECT_ID[ind])
)
ind1 <- which(meta$Site == "Left")
res.left <- linda(otu.tab[, ind1], meta[ind1, ],
  formula = "~Smoke+Sex"
)
ind2 <- which(meta$Site == "Right")
res.right <- linda(otu.tab[, ind2], meta[ind2, ],
  formula = "~Smoke+Sex"
)
rownames(res.left$output[[1]])[which(res.left$output[[1]]$reject)]
rownames(res.right$output[[1]])[which(res.right$output[[1]]$reject)]

linda.obj <- linda(otu.tab, meta,
  formula = "~Smoke+Sex+(1|SubjectID)"
)
} # }
if (FALSE) { # \dontrun{
library(ggrepel)
data(smokers)
ind <- smokers$meta$AIRWAYSITE == "Throat"
otu.tab <- as.data.frame(smokers$otu[, ind])
meta <- cbind.data.frame(
  Smoke = factor(smokers$meta$SMOKER[ind]),
  Sex = factor(smokers$meta$SEX[ind]),
  Site = factor(smokers$meta$SIDEOFBODY[ind]),
  SubjectID = factor(smokers$meta$HOST_SUBJECT_ID[ind])
)
ind1 <- which(meta$Site == "Left")
res.left <- linda(otu.tab[, ind1], meta[ind1, ],
  formula = "~Smoke+Sex"
)
ind2 <- which(meta$Site == "Right")
res.right <- linda(otu.tab[, ind2], meta[ind2, ],
  formula = "~Smoke+Sex"
)
rownames(res.left$output[[1]])[which(res.left$output[[1]]$reject)]
rownames(res.right$output[[1]])[which(res.right$output[[1]]$reject)]

linda.obj <- linda(otu.tab, meta,
  formula = "~Smoke+Sex+(1|SubjectID)"
)
} # }