Skip to content

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

@Meng-OY

Description

@Meng-OY

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions