Hi!
For better visualization of my heat tree (inserted below), I want to remove taxa that are missing names. I'm not so familiar with the nomenclature so please excuse my long-winded explanation.
I want to remove these taxa from the tree display only (i.e. not removed from internal calculation of n_obs), and I want to keep each tree branch in the display up until it is missing a name. For example, if I have a taxa that has a name up until and including genus level, I only want to remove the species node that doesn't have a name, and keep the branch until genus. Or, if I have a taxa that has a name up until and including family level, I only want to remove the genus and species nodes with missing names, and keep the branch until family. I hope that makes sense!
I've tried using taxa::filter_taxa with various inputs but no success. Any advice? I'm happy to share my files via email for reproducibility. Thank you!!!
treephys2=parse_phyloseq(treephys7)
treephys2$data$otu_table <- calc_obs_props(treephys2,
data = "otu_table",
cols = treephys2$data$sample_data$SampleID)
treephys2$data$tax_table <- calc_taxon_abund(treephys2,
data = "otu_table",
cols = treephys2$data$sample_data$SampleID)
treephys2$data$diff_table <- compare_groups(treephys2,
data = "tax_table",
cols = treephys2$data$sample_data$SampleID,
groups = treephys2$data$sample_data$race4)
color_interval <- c(-.045, .045)
treephys2 %>%
taxa::filter_taxa(taxon_names == "Bacteria", subtaxa = TRUE) %>%
#taxa::filter_taxa(taxon_names!="",reassign_obs=TRUE) %>% #something like this? but this does not work
#taxa::filter_taxa(!
is.na(taxon_names),reassign_obs=TRUE) %>% #something like this? but this does not work
heat_tree(node_size_axis_label = "Number of OTUs",
node_size = n_obs,
node_color_axis_label = "mean difference",
node_color = mean_diff,
node_color_range = diverging_palette(),
node_color_trans = "linear",
node_color_interval = color_interval,
edge_color_interval = color_interval,
node_label = taxon_names,
node_label_max = 150)
