TreeSummarizedExperiment object from ‘DADA2’ resultsR/convertFromDADA2.R
convertFromDADA2.RdCreate a TreeSummarizedExperiment object from ‘DADA2’ results
convertFromDADA2(...)convertFromDADA2 returns an object of class
TreeSummarizedExperiment
convertFromDADA2 is a wrapper for the
mergePairs function from the dada2 package.
A count matrix is constructed via
makeSequenceTable(mergePairs(...)) and rownames are dynamically
created as ASV(N) with N from 1 to nrow of the count
tables. The colnames and rownames from the output of makeSequenceTable
are stored as colnames and in the referenceSeq slot of the
TreeSummarizedExperiment, respectively.
### Coerce DADA2 results to a TreeSE object
if(requireNamespace("dada2")) {
fnF <- system.file("extdata", "sam1F.fastq.gz", package="dada2")
fnR = system.file("extdata", "sam1R.fastq.gz", package="dada2")
dadaF <- dada2::dada(fnF, selfConsist=TRUE)
dadaR <- dada2::dada(fnR, selfConsist=TRUE)
tse <- convertFromDADA2(dadaF, fnF, dadaR, fnR)
tse
}
#> Loading required namespace: dada2
#> Initializing error rates to maximum possible estimate.
#> selfConsist step 1 .
#> selfConsist step 2
#> selfConsist step 3
#> selfConsist step 4
#> Convergence after 4 rounds.
#> Initializing error rates to maximum possible estimate.
#> selfConsist step 1 .
#> selfConsist step 2
#> selfConsist step 3
#> selfConsist step 4
#> Convergence after 4 rounds.
#> class: TreeSummarizedExperiment
#> dim: 4 1
#> metadata(0):
#> assays(1): counts
#> rownames(4): ASV01 ASV02 ASV03 ASV04
#> rowData names(0):
#> colnames: NULL
#> colData names(0):
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):
#> rowLinks: NULL
#> rowTree: NULL
#> colLinks: NULL
#> colTree: NULL
#> referenceSeq: a DNAStringSet (4 sequences)