mergePairs: Merge denoised forward and reverse reads.

Description Usage Arguments Value See Also Examples

View source: R/paired.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
mergePairs(
  dadaF,
  derepF,
  dadaR,
  derepR,
  minOverlap = 12,
  maxMismatch = 0,
  returnRejects = FALSE,
  propagateCol = character(0),
  justConcatenate = FALSE,
  trimOverhang = 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). character or derep-class. The file path(s) to the fastq file(s), or a directory containing fastq file(s) corresponding to the the forward reads of the samples to be merged. Compressed file formats such as .fastq.gz and .fastq.bz2 are supported. A derep-class object (or list thereof) returned by link{derepFastq} can also be provided. These derep-class object(s) or fastq files should correspond to those 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). character or derep-class. The file path(s) to the fastq file(s), or a directory containing fastq file(s) corresponding to the the reverse reads of the samples to be merged. Compressed file formats such as .fastq.gz and .fastq.bz2 are supported. A derep-class object (or list thereof) returned by link{derepFastq} can also be provided. These derep-class object(s) or fastq files should correspond to those used as input to the the dada function when denoising the reverse reads.

minOverlap

(Optional). Default 12. 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.

trimOverhang

(Optional). Default FALSE. If TRUE, "overhangs" in the alignment between the forwards and reverse read are trimmed off. "Overhangs" are when the reverse read extends past the start of the forward read, and vice-versa, as can happen when reads are longer than the amplicon and read into the other-direction primer region.

verbose

(Optional). Default FALSE. If TRUE, a summary of the function results are printed to standard output.

...

(Optional). Further arguments to pass on to nwalign. By default, mergePairs uses alignment parameters that hevaily penalizes mismatches and gaps when aligning the forward and reverse sequences.

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:

A list of data.frames are returned if a list of input objects was provided.

See Also

derepFastq, dada, fastqPairedFilter

Examples

1
2
3
4
5
6
7
fnF <- system.file("extdata", "sam1F.fastq.gz", package="dada2")
fnR = system.file("extdata", "sam1R.fastq.gz", package="dada2")
dadaF <- dada(fnF, selfConsist=TRUE)
dadaR <- dada(fnR, selfConsist=TRUE)
merger <- mergePairs(dadaF, fnF, dadaR, fnR)
merger <- mergePairs(dadaF, fnF, dadaR, fnR, returnRejects=TRUE, propagateCol=c("n0", "birth_ham"))
merger <- mergePairs(dadaF, fnF, dadaR, fnR, justConcatenate=TRUE)

dada2 documentation built on Nov. 8, 2020, 6:48 p.m.