Skip to content

Commit ceec784

Browse files
fixed a few examples
1 parent 4cda5de commit ceec784

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

R/heat_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ heat_tree.Taxmap <- function(.input, ...) {
363363
#' # You can plot up to 4 quantative variables use node/edge size/color, but it
364364
#' # is usually best to use 2 or 3. The plot below uses node size for number of
365365
#' # OTUs and color for number of reads and edge size for number of samples
366-
#' x$data$taxon_counts <- calc_n_samples(x, dataset = "taxon_counts", append = TRUE)
366+
#' x$data$n_samples <- calc_n_samples(x, dataset = "taxon_counts")
367367
#' heat_tree(x, node_label = taxon_names, node_size = n_obs, node_color = total,
368368
#' edge_color = n_samples)
369369
#'

R/parsers.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,16 +573,17 @@ parse_silva_fasta <- function(file = NULL, input = NULL, include_seqs = TRUE) {
573573
raw_headers <- names(raw_data)
574574

575575
# Make classifications easier to parse
576-
name_chars <- "A-Za-z0-9._+ \\-"
576+
name_chars <- "A-Za-z0-9._+ ='\"\\-"
577577
parts <- stringr::str_match(raw_headers,
578578
paste0("^(.+;)([", name_chars, "]+)(\\(?.*\\)?)$"))
579579
parts <- as.data.frame(parts[, -1], stringsAsFactors = FALSE)
580580
colnames(parts) <- c("tax", "binom", "common")
581581
parts$binom <- sub(parts$binom, pattern = "sp\\. ", replacement = "sp\\._")
582582
parts$binom <- sub(parts$binom, pattern = "uncultured ", replacement = "uncultured_")
583-
parts$binom <- gsub(pattern = " ", replacement = ";", parts$binom)
583+
# parts$binom <- gsub(pattern = " ", replacement = ";", parts$binom)
584584
parts$binom <- sub(pattern = ";$", replacement = " ", parts$binom)
585585
headers <- apply(parts, MARGIN = 1, paste0, collapse = "")
586+
headers <- gsub(headers, pattern = "\\[|\\]", replacement = "")
586587

587588
# Create taxmap object
588589
output <- taxa::extract_tax_data(tax_data = headers,

R/primersearch.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ parse_primersearch <- function(file_path) {
210210
#'
211211
#' # Visualize which taxa were amplified
212212
#' # This work because only amplicons are returned by `primersearch`
213-
#' n_amplified <- obj$obs_apply("pcr",
214-
#' function(x) length(unique(x)),
215-
#' value = "input",
216-
#' simplify = TRUE)
213+
#' n_amplified <- unlist(obj$obs_apply("pcr",
214+
#' function(x) length(unique(x)),
215+
#' value = "input"))
217216
#' prop_amped <- n_amplified / obj$n_obs()
218217
#' heat_tree(obj,
219218
#' node_label = taxon_names,

man/heat_tree.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/primersearch.Rd

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)