Learn R Programming

dada2 (version 1.0.3)

mergePairs: Merge denoised forward and reverse reads.

Description

This function attempts to merge each denoised pair of forward and reverse reads, rejecting any pairs which do not sufficiently overlap or which contain too many (>0 by default) mismatches in the overlap region. Note: This function assumes that the fastq files for the forward and reverse reads were in the same order.

Usage

mergePairs(dadaF, derepF, dadaR, derepR, minOverlap = 20, maxMismatch = 0, returnRejects = FALSE, propagateCol = character(0), justConcatenate = FALSE, verbose = FALSE)

Arguments

dadaF
(Required). A dada-class object, or a list of such objects. The dada-class object(s) generated by denoising the forward reads.
derepF
(Required). A derep-class object, or a list of such objects. The derep-class object(s) used as input to the the dada function when denoising the forward reads.
dadaR
(Required). A dada-class object, or a list of such objects. The dada-class object(s) generated by denoising the reverse reads.
derepR
(Required). A derep-class object, or a list of such objects. The derep-class object(s) used as input to the the dada function when denoising the reverse reads.
minOverlap
(Optional). Default 20. The minimum length of the overlap required for merging the forward and reverse reads.
maxMismatch
(Optional). Default 0. The maximum mismatches allowed in the overlap region.
returnRejects
(Optional). Default FALSE. If TRUE, the pairs that that were rejected based on mismatches in the overlap region are retained in the return data.frame.
propagateCol
(Optional). character. Default character(0). The return data.frame will include values from columns in the $clustering data.frame of the provided dada-class objects with the provided names.
justConcatenate
(Optional). Default FALSE. If TRUE, the forward and reverse-complemented reverse read are concatenated rather than merged, with a NNNNNNNNNN (10 Ns) spacer inserted between them.
verbose
(Optional). Default FALSE. If TRUE, a summary of the function results are printed to standard output.

Value

A data.frame, or a list of data.frames.The return data.frame(s) has a row for each unique pairing of forward/reverse denoised sequences, and the following columns:
  • $abundance: Number of reads corresponding to this forward/reverse combination.
  • $sequence: The merged sequence.
  • $forward: The index of the forward denoised sequence.
  • $reverse: The index of the reverse denoised sequence.
  • $nmatch: Number of matches nts in the overlap region.
  • $nmismatch: Number of mismatches in the overlap region.
  • $nindel: Number of indels in the overlap region.
  • $prefer: The sequence used for the overlap region. 1=forward; 2=reverse.
  • $accept: TRUE if overlap between forward and reverse denoised sequences was at least minOverlap and had at most maxMismatch differences. FALSE otherwise.
  • $...: Additional columns specified in propagateCol.
A list of data.frames are returned if a list of input objects was provided.

See Also

derepFastq, dada, fastqPairedFilter

Examples

Run this code
derepF = derepFastq(system.file("extdata", "sam1F.fastq.gz", package="dada2"))
derepR = derepFastq(system.file("extdata", "sam1R.fastq.gz", package="dada2"))
dadaF <- dada(derepF, err=tperr1, errorEstimationFunction=loessErrfun, selfConsist=TRUE)
dadaR <- dada(derepR, err=tperr1, errorEstimationFunction=loessErrfun, selfConsist=TRUE)
mergePairs(dadaF, derepF, dadaR, derepR)
mergePairs(dadaF, derepF, dadaR, derepR, returnRejects=TRUE, propagateCol=c("n0", "birth_ham"))
mergePairs(dadaF, derepF, dadaR, derepR, justConcatenate=TRUE)

Run the code above in your browser using DataLab