plotGene: Plot counts and model for one gene

Description Usage Arguments Value Author(s) Examples

Description

Plot counts and model for one gene as a scatter plot with model trajectories: Both as counts or log10 counts vs continuous covariate . Dropout rates can be given and are visualised as the colour of the observation points. A reference model trajectory can be added. Contour plots: A contour plot aids the interpretation of the model trajectory in context of the observed data if local overplotting occurs because of a non-uniform distribution of cells in the continuous covariate (a very common scenario in pseudotime for example). In such a case, one might mistake cells with high counts from an interval with high cellular intensity as a indication of increased expression in this interval. Instead, one can explain such local maxima based on the simple phenomenom that more samples were taken from the underyling distribution in that continuous covariate interval distribution. To migitate this visually, we added the option to add "contours": A contour is an alternative to a confidence interval which includes information on the local sampling density. The contour is specific to a number of cells n. It is an expression trajectory in continuous covariate which lies at the line above which n cells are expected within a local continuous covariate bin given its sampling density and the H1 non-constant expression model. Contours therefore quantify the increase in maximum observed counts in continuous covariate intervals due to sampling density, which is not due to the expression model. Note that this effect is corrected for in the model fitting and that the contour plots just aids visual interpretation of the fit to the data!

Usage

1
2
3
4
plotGene(objLP, strGeneID, vecReferenceMuParam = NULL,
  strTitleSuffix = NULL, boolLogPlot = TRUE, boolColourByDropout = TRUE,
  boolH1NormCounts = FALSE, boolLineageContour = FALSE, boolTime = FALSE,
  bwDensity = NULL, scaGgplot2Size = 0.5, scaGgplot2Alpha = 0.5)

Arguments

objLP

(LineagePulseObject) LineagePulseObject base plot on.

strGeneID

(str) Name of gene, used for title of plot.

vecReferenceMuParam

(numeric vector length number of cells) [Default NULL] Reference mean trajectory which can be plotted

strTitleSuffix

(str) String to be added to title.

boolLogPlot

(bool) [Default TRUE] Whether to log transform y-axis.

boolColourByDropout

(bool) [Default TRUE] Whether to colour scatter plot by posterior of drop-out.

boolH1NormCounts

(bool) [Default FALSE] Whether to show normalised counts (size factors and H1 batch factor estimates) as oppose to raw counts.

boolLineageContour

(bool) [Default FALSE] Whether to the "lineage contour" lines to the scatter plot.

boolTime

(bool) [Default TRUE] Whether continuous covariate is time, this simplifies the scatter plot strongly. Show mean expression per time point as orange point and 25% and 75% quantile of observations per time point as error bars.

bwDensity

(bandwith numeric or string) [Default NULL] Bandwith to be used to kernel density smooting of cell density in continuous covariate (used if boolLineageContour=TRUE). If not set, defaults to stats:density() default.

scaGgplot2Size

(scalar) size in ggplot2 scatter

scaGgplot2Alpha

(scalar) alpha in ggplot2 scatter

Value

gplotGene (ggplot object) Model rajectories and scatter plot for given gene.

Author(s)

David Sebastian Fischer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
lsSimulatedData <- simulateContinuousDataSet(
    scaNCells = 100,
    scaNConst = 10,
    scaNLin = 10,
    scaNImp = 10,
    scaMumax = 100,
    scaSDMuAmplitude = 3,
    vecNormConstExternal=NULL,
    vecDispExternal=rep(20, 30),
    vecGeneWiseDropoutRates = rep(0.1, 30))
matDropoutPredictors <- as.matrix(data.frame(
    log_means = log(rowMeans(lsSimulatedData$counts)+1) ))
objLP <- runLineagePulse(
    counts = lsSimulatedData$counts,
    dfAnnotation = lsSimulatedData$annot,
    strMuModel = "splines", scaDFSplinesMu = 6,
    strDropModel="logistic", 
    matPiConstPredictors = matDropoutPredictors)
gplotExprProfile <- plotGene(
    objLP = objLP,
    strGeneID = rownames(lsSimulatedData$counts)[1],
    boolLineageContour = FALSE)
#print(gplotExprProfile)

YosefLab/LineagePulse documentation built on May 6, 2019, 2:19 p.m.