From ce91d689f086fea6f0eb03e1062d34f11774c5d3 Mon Sep 17 00:00:00 2001 From: brendanf Date: Sun, 27 Oct 2019 14:20:47 +0100 Subject: [PATCH] bug fix for chimeras again. --- DESCRIPTION | 2 +- R/tzara.R | 12 ++++++++++-- man/find_all_region_chimeras.Rd | 5 ++++- man/find_region_chimeras.Rd | 6 +++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5b9cccb..092b02f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tzara Type: Package Title: Cluster long amplicons using dada2 denoising on variable regions -Version: 0.0.7.2 +Version: 0.0.7.3 Authors@R: person(given = "Brendan", family = "Furneaux", email = "brendan.furneaux@gmail.com", role = c("aut", "cre")) diff --git a/R/tzara.R b/R/tzara.R index 366b6e6..832f514 100644 --- a/R/tzara.R +++ b/R/tzara.R @@ -906,6 +906,7 @@ reconstruct <- function( region_table = region_table, order = order, sample_column = sample_column, + read_column = read_column, chimera_offset = chimera_offset) if (!is.null(raw_column)) { @@ -1090,6 +1091,8 @@ assemble_region_table <- function( #' which identifies different samples; if present, use #' \code{\link[dada2]{isBimeraDenovoTable}} instead of #' \code{\link[dada2]{isBimeraDenovo}}. +#' @param read_column (\code{character} scalar) column in region_table +#' which identifies different reads. #' @param chimera_offset (\code{integer} scalar) use \code{1} if the first #' region is conserved. #' @param ... passed to \code{find_region_chimeras}. @@ -1105,6 +1108,7 @@ find_all_region_chimeras <- function( region_table, order, sample_column = NULL, + read_column = "read_id", chimera_offset = 0, ... ) { @@ -1117,6 +1121,7 @@ find_all_region_chimeras <- function( find_region_chimeras, region_table = region_table, sample_column = sample_column, + read_column = read_column, ... ) ) @@ -1134,12 +1139,15 @@ find_all_region_chimeras <- function( #' which identifies different samples; if present, use #' \code{\link[dada2]{isBimeraDenovoTable}} instead of #' \code{\link[dada2]{isBimeraDenovo}}. +#' @param read_column (\code{character} scalar) column in region_table +#' which identifies different reads. #' @param ... passed on to \code{\link[dada2]{isBimeraDenovoTable}} or #' \code{\link[dada2]{isBimeraDenovo}}. #' #' @return an \code{character} vector giving the read IDs of #' \code{region_table} which were detected as bimeras. -find_region_chimeras <- function(region_table, chimset, sample_column, ...) { +find_region_chimeras <- function(region_table, chimset, sample_column, + read_column, ...) { seqs <- do.call(str_c, region_table[, chimset]) chimset_name <- paste(chimset, collapse = "--") flog.trace("Searching for bimeras in regions %s.", chimset_name) @@ -1167,7 +1175,7 @@ find_region_chimeras <- function(region_table, chimset, sample_column, ...) { sum(seqs %in% names(chims)[chims], na.rm = TRUE), sum(!is.na(seqs)), chimset_name) - names(chims)[chims] + region_table[[read_column]][seqs %in% names(chims)[chims]] } block_consensus <- function(.x, .y, reg, reg2, reg2_raw, read_column, ...) { diff --git a/man/find_all_region_chimeras.Rd b/man/find_all_region_chimeras.Rd index a89230d..8e30d2c 100644 --- a/man/find_all_region_chimeras.Rd +++ b/man/find_all_region_chimeras.Rd @@ -5,7 +5,7 @@ \title{Find chimeras in adjacent variable-conserved-variable domain triplets} \usage{ find_all_region_chimeras(region_table, order, sample_column = NULL, - chimera_offset = 0, ...) + read_column = "read_id", chimera_offset = 0, ...) } \arguments{ \item{region_table}{(\code{data.frame} containing all the regions in @@ -18,6 +18,9 @@ which identifies different samples; if present, use \code{\link[dada2]{isBimeraDenovoTable}} instead of \code{\link[dada2]{isBimeraDenovo}}.} +\item{read_column}{(\code{character} scalar) column in region_table +which identifies different reads.} + \item{chimera_offset}{(\code{integer} scalar) use \code{1} if the first region is conserved.} diff --git a/man/find_region_chimeras.Rd b/man/find_region_chimeras.Rd index 9137897..db046ad 100644 --- a/man/find_region_chimeras.Rd +++ b/man/find_region_chimeras.Rd @@ -4,7 +4,8 @@ \alias{find_region_chimeras} \title{Check for bimeras in a subset of regions} \usage{ -find_region_chimeras(region_table, chimset, sample_column, ...) +find_region_chimeras(region_table, chimset, sample_column, read_column, + ...) } \arguments{ \item{region_table}{(\code{data.frame} containing all the regions in @@ -18,6 +19,9 @@ which identifies different samples; if present, use \code{\link[dada2]{isBimeraDenovoTable}} instead of \code{\link[dada2]{isBimeraDenovo}}.} +\item{read_column}{(\code{character} scalar) column in region_table +which identifies different reads.} + \item{...}{passed on to \code{\link[dada2]{isBimeraDenovoTable}} or \code{\link[dada2]{isBimeraDenovo}}.} }