makeBinnedQualErrfun: Create a function that uses a piecewise linear fit to...

View source: R/errorModels.R

makeBinnedQualErrfunR Documentation

Create a function that uses a piecewise linear fit to estimate error rates from transition counts derived from binned quality score data. The binned quality scores are defined in the argument to this function call.

Description

Create a function that uses a piecewise linear fit to estimate error rates from transition counts derived from binned quality score data. The binned quality scores are defined in the argument to this function call.

Usage

makeBinnedQualErrfun(binnedQ = c(2, 11, 25, 37))

Arguments

binnedQ

(Optional). Default value of c(2, 11, 25, 37) is taken from current Illumina binned quality scores on e.g. NovaSeq instruments. Must be changed if the data uses a different set of binned quality scores.

Value

This function returns a function. The returned function accepts a matrix of observed transitions, with each transition corresponding to a row (eg. row 2 = A->C) and each column to a quality score (eg. col 31 = Q30). That function returns a matrix of estimated error rates of the same shape.

The returned function has as required input the trans matrix, and returns a numeric matrix with 16 rows and the same number of columns as trans. The estimated error rates for each transition (row, eg. "A2C") and quality score (column, eg. 31). See 'loessErrfun' for a comparable function to the one that is returned here.

Examples

derep1 <- derepFastq(system.file("extdata", "sam1F.fastq.gz", package="dada2"))
dada1 <- dada(derep1, err=tperr1)
novaBinnedErrfun <- makeBinnedQualErrfun(c(7, 17, 27, 40))
err.new <- novaBinnedErrfun(dada1$trans)


benjjneb/dada2 documentation built on Jan. 12, 2025, 10:03 a.m.