-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with a taxonomic subset? #25
Comments
Thanks for using require("fantaxtic")
require("phyloseq")
require("tidyverse")
# Load the data
data(GlobalPatterns)
ps <- GlobalPatterns
# Merge all non-cyanobacteria
cyano <- phyloseq::subset_taxa(ps, Phylum == "Cyanobacteria")
cyano_ids <- phyloseq::taxa_names(cyano) %>% as.integer()
ps_merged <- fantaxtic::collapse_taxa(ps, cyano_ids, discard_other = FALSE)
# Plot the top 10 ASVs (one of which is Other)
top_asv <- top_taxa(ps_merged, n_taxa = 10, merged_label = "Other cyanobacteria")
plot_nested_bar(ps_obj = top_asv$ps_obj,
top_level = "Phylum",
nested_level = "Species") Created on 2023-12-03 by the reprex package (v2.0.1) |
Wonderful! Thank you, exactly what I was looking for. Is it possible to pass color arguments to the nested tax. level via I also tried creating a plot object then replacing some of the defined colors in Thanks! |
Glad it solved your problem. You can only change the top-level taxon colours, but you can change the top level from phylum to something lower (e.g. class) to obtain more differentiation. If you want to use a single colour per ASV, you should use the regular |
Hi, thank you for the package, it's very easy and useful for manipulating the top ranked groups in a dataset!
Is it possible to work with a taxonomic subset, coupled with the core function of picking out the most abundant features, from within
fantaxtic
while retaining all the other (relative) abundance information of groups that were not subsetted?E.g. from the
GlobalPatterns
dataset, the 10 most abundant ASVs are phyla that include Cyanobacteria. Now, only from Cyanobacteria pick the top 20 most abundant ASVs, plot a nested bar withtop_level = "Class", nested_level = "Species"
so that all other (abundant and non abundant) features that were not subsetted are placed inother
?I know how to subset specific taxonomic groups from a phyloseq object, but the total rel. abundance information is clearly not retained then. Even if do export the relative abundance instead of raw counts, or manually change the abundance values in a
top_taxa
dataframe, not sure iffantaxtic
would accept those if the assumption is that the sum should always be 1?Thanks!
The text was updated successfully, but these errors were encountered: