Skip to content
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

Coloring of branches based on different groups (taxa detection by 12S, 16S gene regions) #366

Open
Meng-OY opened this issue Sep 26, 2024 · 0 comments

Comments

@Meng-OY
Copy link

Meng-OY commented Sep 26, 2024

Dear Zachary Foster and everyone,

I am having trouble on coloring the branches of one tree based on detection of taxa by different gene regions 12S and 16S (and also possibly grouping based on two study regions in another identical tree).

I understand that there is another Metacoder script on coloring of taxa based on differential tree - comparing abundance but our interest is not on comparing OTU abundance/any other variable from further statistical analysis so the script might not be usable for us. I wonder if you have the script on coloring of branches of one tree simply based on two different groups - 12S, 16S region (and possibly third color on shared regions of 12S, 16S). Or if not possible for the previous, I would like to have two identical trees but with coloring of different branches based on 12S, 16S?

Currently I am only able to display two separate trees based on single gene region so I'm emailing for urgent help. Here is my running script:

install.packages("metacoder")
install.packages("phyloseq")
library(phyloseq)
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.19")
setwd("E:/1-R/metacoder/")
otu <- read.delim('otu_table.txt', row.names = 1, sep = '\t', check.names = FALSE)
tax <- read.delim('tax_table.txt', row.names = 1, sep = '\t', check.names = FALSE)
phy <- phyloseq(otu_table(as.matrix(otu), taxa_are_rows = TRUE), tax_table(as.matrix(tax)))
obj <- parse_phyloseq(phy)
obj
set.seed(123)
heat_tree(
obj,
node_size = n_obs, node_color = n_obs,
node_size_axis_label = 'OTU count', node_color_axis_label = 'OTU count',
node_label = taxon_names, tree_label = taxon_names,
layout = 'davidson-harel', initial_layout = 'reingold-tilford'
)

And here is my current generated picture (but we hope to have identical trees with coloring of different branches (taxa) based on the detection of different 12S, 16S gene regions):
image

I will be very grateful if you can answer me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant