plotSmoothFitMultiCascade: Gene Smooth: Plot multiple fits

Description Usage Arguments Value Examples

View source: R/gene-smooth.R

Description

This plots gene expression in groups of cells and a curve representing its mean expression (generated using a smoothing algorithm). It takes output from multiple runs of geneSmoothFit (i.e. for different trajectories or different segments of the same trajectory). The individual results from geneSmoothFit should be combined into a list, and the names of the elements will be used to define the names of the segments in the plot. If multiple genes are provided, a grid of plots is produced.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotSmoothFitMultiCascade(
  smoothed.fits,
  genes,
  colors = NULL,
  scaled = T,
  plot.data = T,
  alpha.data = 0.2,
  alpha.smooth = 1,
  lwd.smooth = 1,
  ncol = NULL
)

Arguments

genes

(Character vector) Genes to include in the plot(s)

colors

(Character vector) Colors to use for each segment (names are matched against the names of elements in smoothed.fit).

scaled

(Logical) Plot actual expression values (FALSE) or expression scaled to its maximum value (TRUE)

plot.data

(Logical) Plot data points?

alpha.data

(Numeric: 0-1) Transparency of data points

alpha.smooth

(Numeric: 0-1) Transparency of curve

lwd.smooth

(Numeric) Line width of curve

ncol

(Numeric) Number of columns to use if several plots are produced (i.e. if several genes are provided). (Default NULL will attempt to produce a square aspect ratio.)

smoothed.fit

(List of lists) A list containing several lists that are the output of geneSmoothFit. Each one will generate a separate segment in the plot, labeled according to its name in the list.

Value

A ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Identify the pseudotime of the branchpoint
pt.crop <- as.numeric(unlist(hydra.en.tree@tree$segment.pseudotime.limits)[1])
# Crop according to the pseudotime of the branchpoint
foot.only.spline <- cropSmoothFit(tentacle.spline, pt.max = pt.crop)
hypostome.only.spline <- cropSmoothFit(hypo.spline, pt.min = pt.crop)
tentacle.only.spline <- cropSmoothFit(tentacle.spline, pt.min = pt.crop)
# Combine into a list
# Names in the plots are determined by names of the smooth objects in the list
splines <- list(foot.only.spline, tentacle.only.spline, hypostome.only.spline)
names(splines) <- c("Foot/Body", "Tentacle", "Hypostome")
# Plot expression of genes on the curves
endoderm.genes.plot <- c("t14194aep|WNT3_MOUSE", "t20768aep|BRAC_CANLF", 
  "t25396aep|NKX26_HUMAN", "t18735aep|FOXA2_ORYLA")
plotSmoothFitMultiCascade(smoothed.fits = splines, 
  genes = endoderm.genes.plot, scaled = F, 
  colors = c(`Foot/Body` = "#FF8C00", Hypostome = "#1E90FF", 
    Tentacle = "#32CD32"
  )
)

farrellja/URD documentation built on June 17, 2020, 4:48 a.m.