Learn R Programming

dada2 (version 1.0.3)

plotErrors: Plot observed error rates after denoising.

Description

This function plots the observed frequency of each transition (eg. A->C) as a function of the associated quality score. It also plots the final estimated error rates (if they exist). The initial input rates and the expected error rates under the nominal definition of quality scores can also be shown.

Usage

plotErrors(dq, nti = c("A", "C", "G", "T"), ntj = c("A", "C", "G", "T"), obs = TRUE, err_out = TRUE, err_in = FALSE, nominalQ = FALSE)

Arguments

dq
(Required). A dada-class object, or a list of such objects that were pooled to estimate a common set of error rates.
nti
(Optional). Default c("A","C","G","T"). Some combination of the 4 DNA nucleotides.
ntj
(Optional). Default c("A","C","G","T"). Some combination of the 4 DNA nucleotides.

The error rates from nti->ntj will be plotted. If multiple nti or ntj are chosen, error rates from each-to-each will be plotted in a grid.

obs
(Optional). Default TRUE. If TRUE, the observed error rates are plotted as points.
err_out
(Optional). Default TRUE. If TRUE, plot the output error rates (solid line).
err_in
(Optional). Default FALSE. If TRUE, plot the input error rates (dashed line).
nominalQ
(Optional). Default FALSE. If TRUE, plot the expected error rates (red line) if quality scores exactly matched their nominal definition: Q = -10 log10(p_err).

Value

A ggplot2 object. Will be rendered to default device if printed, or can be stored and further modified. See ggsave for additional options.

Examples

Run this code
derep1 = derepFastq(system.file("extdata", "sam1F.fastq.gz", package="dada2"), verbose = TRUE)
dada1 <- dada(derep1, err = inflateErr(tperr1, 2), errorEstimationFunction = loessErrfun) 
plotErrors(dada1)
plotErrors(dada1, "A", "C")
plotErrors(dada1, nti="A", ntj=c("A","C","G","T"), err_in=TRUE, nominalQ=TRUE)

Run the code above in your browser using DataLab