microViz discussions #18
david-barnett
started this conversation in
General
Replies: 1 comment 3 replies
-
Hi. I am running a differential abundance model in microViz on some fungal data using a philoseq object. I am writing a csv from taxatree_stats_get and would like it to spit out actual otu numbers in addition to/instead of taxa names. How can I do this? Below is my code. Thanks. bosfun_log2prop <- bosque_fun.phyloseq%>%
tax_fix(unknowns = c("Glomerales")) %>%
# prepend the 1st letter of the rank to each tax_table entry, to ensure all are unique
tax_prepend_ranks() %>%
tax_transform(
trans = "compositional", rank = "Species",
add = "halfmin" # adds half the minimum observed abundance to all values
) %>% #
# for various statistical, biological, and practical reasons, let's strictly filter taxa
tax_filter(min_prevalence = 0.01, use_counts = TRUE) %>%
tax_transform(
trans = "log2", # pseudocount added earlier allows us to use a log transform
chain = TRUE # chain = TRUE allows the 2nd transformation
)
bosfun_log2prop
rank_names(bosfun_log2prop)
bosfun_treeStats <- bosfun_log2prop %>%
# run all the statistical models
taxatree_models(
ranks = c("Phylum", "Class", "Order", "Family", "Genus", "Species"),
variables = c("Site.type" ), type = lm # modelling function
) %>%
# extract stats from the models
taxatree_models2stats(.keep_models = TRUE) %>%
# adjust the p values for multiple testing, within each rank
taxatree_stats_p_adjust(method = "BH", grouping = "rank")
bosfun_treeStats
taxatree_stats_get(bosfun_treeStats)
write_csv(taxatree_stats_get(bosfun_treeStats), "./data/processed/log2fold_fungal_out.csv") |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
👋 Welcome to the microViz discussion forum:
You can use discussions to:
If you would like to report a bug 🐞 consider raising an issue instead. Preferably with a reproducible example.
Feature requests can be made in discussions or issues.
Thank you! 🙂
Beta Was this translation helpful? Give feedback.
All reactions