Skip to content

Commit

Permalink
Merge pull request #21 from gmteunisse/20-nested_top_taxa
Browse files Browse the repository at this point in the history
Fixed issue #20.
  • Loading branch information
gmteunisse authored Jun 25, 2023
2 parents 61892eb + 59b6c0d commit 7b422c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/nested_top_taxa.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ nested_top_taxa <- function(ps_obj,
top_top <- top_taxa(ps_obj, tax_level = top_tax_level, n_taxa = n_top_taxa,
by_proportion = by_proportion, ...)$top_taxa
ranks <- tax_ranks[1:which(tax_ranks == top_tax_level)]
top_top_taxa <- apply(top_top[,ranks], 1, paste, collapse = '_')
top_top_taxa <- apply(top_top[,ranks,drop=FALSE], 1, paste, collapse = '_')

# Extract the taxonomy of the top_tax_level and collapse all others
taxa <- tax_table(ps_obj) %>%
Expand Down Expand Up @@ -172,6 +172,7 @@ nested_top_taxa <- function(ps_obj,
to_merge <- all_taxids
}


# Merge the non-top taxa within this top-level taxon
ps_obj_nest <- merge_taxa(ps_obj_nest, to_merge, 1) %>%
suppressWarnings()
Expand Down

0 comments on commit 7b422c5

Please sign in to comment.