Skip to content

Commit

Permalink
Bug Fix: learnErrors and filterAndTrim arguments
Browse files Browse the repository at this point in the history
The compress argument for filterAndTrim, and the
errorEstimationFunction argument for learnErrors, are now properly used.
  • Loading branch information
bcallah authored and bcallah committed Jun 10, 2017
1 parent 094a060 commit d57ccf5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: The dada2 package infers exact sequence variants (SVs) from amplico
and their sample-wise abundances after removing substitution and chimera
errors. Taxonomic classification is available via a native implementation
of the RDP naive Bayesian classifier.
Version: 1.4.0
Version: 1.4.1
Date: 2017-04-24
Maintainer: Benjamin Callahan <[email protected]>
Author: Benjamin Callahan <[email protected]>, Paul McMurdie, Susan
Expand Down
10 changes: 10 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
CHANGES IN VERSION 1.4.1
-----------------------

BUG FIXES

o filterAndTrim now respects the compress argument.

o learnErrors now respects the errorEstimationFunction argument.


CHANGES IN VERSION 1.3.5
-----------------------

Expand Down
6 changes: 2 additions & 4 deletions R/errorModels.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ loessErrfun <- function(trans) {
#'
#' @param errorEstimationFunction (Optional). Function. Default \code{\link{loessErrfun}}.
#'
#' If USE_QUALS = TRUE, \code{errorEstimationFunction} is computed on the matrix of observed transitions
#' \code{errorEstimationFunction} is computed on the matrix of observed transitions
#' after each sample inference step in order to generate the new matrix of estimated error rates.
#'
#' If USE_QUALS = FALSE, this argument is ignored, and transition rates are estimated by maximum likelihood (t_ij = n_ij/n_i).
#'
#' @param multithread (Optional). Default is FALSE.
#' If TRUE, multithreading is enabled and the number of available threads is automatically determined.
Expand Down Expand Up @@ -133,7 +131,7 @@ learnErrors <- function(fls, nreads=1e6, errorEstimationFunction = loessErrfun,
}
drps <- drps[1:i]
# Run dada in self-consist mode on those samples
dds <- dada(drps, err=NULL, selfConsist=TRUE, multithread=multithread)
dds <- dada(drps, err=NULL, selfConsist=TRUE, errorEstimationFunction=errorEstimationFunction, multithread=multithread)
cat("Total reads used: ", NREADS, "\n")
return(getErrors(dds, detailed=TRUE))
}
Expand Down
5 changes: 3 additions & 2 deletions R/filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,15 @@ filterAndTrim <- function(fwd, filt, rev=NULL, filt.rev=NULL, compress=TRUE,
mapply(c, fwd, rev, SIMPLIFY=FALSE), mapply(c, filt, filt.rev, SIMPLIFY=FALSE),
MoreArgs = list(truncQ=truncQ, truncLen=truncLen, trimLeft=trimLeft, maxLen=maxLen, minLen=minLen,
maxN=maxN, minQ=minQ, maxEE=maxEE, rm.phix=rm.phix, primer.fwd=primer.fwd,
matchIDs=matchIDs, id.sep=id.sep, id.field=id.field, n=n, OMP=OMP, verbose=verbose),
matchIDs=matchIDs, id.sep=id.sep, id.field=id.field, n=n, OMP=OMP,
compress=compress, verbose=verbose),
mc.cores=ncores, mc.silent=TRUE)
} else {
rval <- mcmapply(fastqFilter,
fwd, filt,
MoreArgs = list(truncQ=truncQ, truncLen=truncLen, trimLeft=trimLeft, maxLen=maxLen, minLen=minLen,
maxN=maxN, minQ=minQ, maxEE=maxEE, rm.phix=rm.phix, primer.fwd=primer.fwd,
n=n, OMP=OMP, verbose=verbose),
n=n, OMP=OMP, compress=compress, verbose=verbose),
mc.cores=ncores, mc.silent=TRUE)
}
colnames(rval) <- basename(fwd)
Expand Down
6 changes: 2 additions & 4 deletions man/learnErrors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,27 @@ RcppExport SEXP dada2_RcppExport_registerCCallable() {
R_RegisterCCallable("dada2", "dada2_RcppExport_validate", (DL_FUNC)dada2_RcppExport_validate);
return R_NilValue;
}

static const R_CallMethodDef CallEntries[] = {
{"dada2_dada_uniques", (DL_FUNC) &dada2_dada_uniques, 19},
{"dada2_C_is_bimera", (DL_FUNC) &dada2_C_is_bimera, 8},
{"dada2_C_table_bimera2", (DL_FUNC) &dada2_C_table_bimera2, 10},
{"dada2_C_nwalign", (DL_FUNC) &dada2_C_nwalign, 8},
{"dada2_C_eval_pair", (DL_FUNC) &dada2_C_eval_pair, 2},
{"dada2_C_pair_consensus", (DL_FUNC) &dada2_C_pair_consensus, 4},
{"dada2_C_isACGT", (DL_FUNC) &dada2_C_isACGT, 1},
{"dada2_evaluate_kmers", (DL_FUNC) &dada2_evaluate_kmers, 6},
{"dada2_C_subpos", (DL_FUNC) &dada2_C_subpos, 2},
{"dada2_C_matchRef", (DL_FUNC) &dada2_C_matchRef, 4},
{"dada2_C_matrixEE", (DL_FUNC) &dada2_C_matrixEE, 1},
{"dada2_C_nwvec", (DL_FUNC) &dada2_C_nwvec, 7},
{"dada2_C_assign_taxonomy", (DL_FUNC) &dada2_C_assign_taxonomy, 7},
{"dada2_C_assign_taxonomy2", (DL_FUNC) &dada2_C_assign_taxonomy2, 7},
{"dada2_RcppExport_registerCCallable", (DL_FUNC) &dada2_RcppExport_registerCCallable, 0},
{NULL, NULL, 0}
};

RcppExport void R_init_dada2(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

0 comments on commit d57ccf5

Please sign in to comment.