makeForest: Plot allelic ratio result as forest

View source: R/makeForest.R

makeForestR Documentation

Plot allelic ratio result as forest

Description

Draw a forest plot to visualized cell type specific allelic ratio estimator and confidence interval. It is based on the forestplot-package's forestplot function.

Usage

makeForest(
  sce,
  genepoi,
  ctpoi = seq_len(nlevels(sce$x)),
  showtext = FALSE,
  xticks,
  boxsize = 0.25,
  xlab = "Allelic Ratio",
  col,
  grid = structure(seq(0.1, 0.9, 0.1), gp = gpar(lty = 2, col = "#CCCCFF")),
  ...
)

Arguments

sce

A SingleCellExperiment containing colData allelic ratio estimator in the third column and last two column is the confidence interval.

genepoi

the gene position index or gene name vector that want to be plotted. Ordered by increased cell type svalue. Default is the top 40 genes that has minimum svalue in any cell type or all genes if number of genes smaller than 40.

ctpoi

the cell type position index that want to be plotted.

showtext

indicate whether show the svalue information along the forestplot.

xticks

argument as described in forestplot

boxsize

Override the default box size based on precision

xlab

x-axis label. Default is "Allelic Ratio"

col

Set the colors for all the elements. See fpColors for details

grid

If you want a discrete gray dashed grid at the level of the ticks you can set this parameter to TRUE. If you set the parameter to a vector of values lines will be drawn at the corresponding positions. If you want to specify the gpar of the lines then either directly pass a gpar object or set the gp attribute e.g. attr(line_vector, "gp") <- gpar(lty=2, col = "red")

...

Passsed on the other argument in forestplot.

Value

generates a forest plot

See Also

forestplot, fpColors, fpShapesGp, fpLegend

Examples

sce <- makeSimulatedData()
sce <- preprocess(sce)
sce <- geneCluster(sce, G = 1:4)
sce_sub <- wilcoxExt(sce, genecluster = 1)
sce_sub <- allelicRatio(sce_sub)
makeForest(sce_sub, showtext = TRUE)

# if want to change some properties, like ticks position
library(forestplot)
xticks <- seq(from = 0, to = 1, by = 0.25)
xtlab <- rep(c(TRUE, FALSE), length.out = length(xticks))
attr(xticks, "labels") <- xtlab
genepoi <- paste0("gene", seq_len(5))
ctpoi <- c(1, 3)
makeForest(sce_sub, genepoi, ctpoi,
  xticks = xticks,
  col = fpColors(box = c("blue", "red", "black", "darkgreen"))
)

Wancen/airpart documentation built on March 12, 2023, 11:53 a.m.