---
title: "Intestinal Microbiome Taxa"
---
The intestinal microbiome is dominated by a small number of bacterial phyla, but clinically relevant datasets also include archaeal, fungal, and viral lineages. The navigator below is designed to help you move through those levels without losing sight of the larger phylogenetic structure.
::: {.taxa-note}
Use the tree to click through the major intestinal lineages. Neutral nodes show the added domain- and kingdom-level scaffolding, while each kingdom assigns a distinct bold color to every phylum-level branch. Sub-taxa then shift to progressively lighter shades so you can keep track of which lower-level groups belong to the same higher-level branch.
:::
::: {.taxa-legend}
### Lineage guide
<div class="taxa-legend-items">
<span class="taxa-legend-chip phylum-chip-actinomycetota">Actinomycetota</span>
<span class="taxa-legend-chip phylum-chip-bacteroidota">Bacteroidota</span>
<span class="taxa-legend-chip phylum-chip-verrucomicrobiota">Verrucomicrobiota</span>
<span class="taxa-legend-chip phylum-chip-bacillota">Bacillota</span>
<span class="taxa-legend-chip phylum-chip-pseudomonadota">Pseudomonadota</span>
<span class="taxa-legend-chip phylum-chip-fusobacteriota">Fusobacteriota</span>
</div>
<div class="taxa-legend-items">
<span class="taxa-legend-chip phylum-chip-euryarchaeota">Euryarchaeota</span>
<span class="taxa-legend-chip phylum-chip-ascomycota">Ascomycota</span>
<span class="taxa-legend-chip phylum-chip-basidiomycota">Basidiomycota</span>
<span class="taxa-legend-chip phylum-chip-zygomycota">Zygomycota</span>
<span class="taxa-legend-chip phylum-chip-mucoromycota">Mucoromycota</span>
<span class="taxa-legend-chip phylum-chip-chytridiomycota">Chytridiomycota</span>
<span class="taxa-legend-chip phylum-chip-glomeromycota">Glomeromycota</span>
<span class="taxa-legend-chip phylum-chip-neocallimastigomycota">Neocallimastigomycota</span>
</div>
<div class="taxa-legend-items">
<span class="taxa-legend-chip phylum-chip-uroviricota">Uroviricota</span>
<span class="taxa-legend-chip phylum-chip-phixviricota">Phixviricota</span>
<span class="taxa-legend-chip phylum-chip-preplasmiviricota">Preplasmiviricota</span>
</div>
<div class="taxa-rank-legend">
<span><strong>Boldest shade</strong> = the phylum-level branch color within each kingdom</span>
<span><strong>Lighter shades</strong> = deeper branches (class → order → family → genus → species) within that phylum</span>
</div>
:::
## Interactive intestinal phylogenetic tree
<div class="taxa-tree-toolbar" role="group" aria-label="Tree navigation controls">
<button type="button" class="taxa-tree-button" data-tree-action="expand-all">Expand all</button>
<button type="button" class="taxa-tree-button" data-tree-action="collapse-all">Collapse to domain</button>
<button type="button" class="taxa-tree-button" data-tree-action="reset-focus">Reset focus</button>
</div>
<div class="taxa-tree-layout">
<section class="taxa-tree-panel">
<h3>Tree navigator</h3>
<div id="intestinal-taxa-tree" aria-label="Interactive intestinal microbiome taxonomy tree"></div>
</section>
<aside class="taxa-detail-panel" id="intestinal-taxon-detail" aria-live="polite">
<h3>Selected taxon</h3>
<p>Select a node in the tree to see its lineage, taxonomic rank, and any representative descendants shown for that branch.</p>
</aside>
</div>
## How to read this page
- **Domain- and kingdom-level patterns** help separate bacterial, archaeal, fungal, and bacteriophage branches before you move into phylum-level detail.
- **Phylum-level patterns** are useful when comparing broad ecological states of the gut microbiome.
- **Family- and genus-level patterns** are usually what you encounter in MetaPhlAn, QIIME 2, or downstream association tables.
- **Species-level examples** help anchor the tree to well-known intestinal microbes without implying that these are the only important members of each branch.
<script>
document.addEventListener("DOMContentLoaded", function () {
const intestinalTree = {
name: "Intestinal microbiome",
rank: "body site",
description: "Representative bacterial, archaeal, fungal, and viral clades commonly discussed in healthy and perturbed human gut microbiome studies.",
children: [
{
name: "Actinomycetota",
rank: "phylum",
taxId: 201174,
phylum: "actinomycetota",
description: "Usually a smaller but biologically important gut phylum, especially for bifidobacteria and saccharolytic carbohydrate metabolism.",
children: [
{
name: "Actinomycetes",
rank: "class",
taxId: 1760,
description: "Core class containing bifidobacteria that often expand in infants and remain important in adults.",
children: [
{
name: "Bifidobacteriales",
rank: "order",
taxId: 85004,
description: "Order containing key mucin- and oligosaccharide-utilizing gut commensals.",
children: [
{
name: "Bifidobacteriaceae",
rank: "family",
taxId: 31953,
description: "Family enriched for health-associated saccharolytic anaerobes.",
children: [
{
name: "Bifidobacterium",
rank: "genus",
taxId: 1678,
description: "Major intestinal genus that produces acetate and other metabolites from complex carbohydrates.",
children: [
{
name: "Bifidobacterium adolescentis",
rank: "species",
taxId: 1680,
description: "Common adult-associated bifidobacterial species linked to plant carbohydrate utilization."
},
{
name: "Bifidobacterium longum",
rank: "species",
taxId: 1683,
description: "Widely studied intestinal species common across the lifespan and frequently used in probiotic formulations."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Bacteroidota",
rank: "phylum",
taxId: 976,
phylum: "bacteroidota",
description: "One of the dominant gut phyla, especially rich in carbohydrate-degrading anaerobes that shape community metabolism.",
children: [
{
name: "Bacteroidia",
rank: "class",
taxId: 200643,
description: "The major gut-associated class within Bacteroidota.",
children: [
{
name: "Bacteroidales",
rank: "order",
taxId: 171549,
description: "Order containing several of the most abundant and ecologically important intestinal families.",
children: [
{
name: "Bacteroidaceae",
rank: "family",
taxId: 815,
description: "Family dominated by Bacteroides, a hallmark genus of many adult gut communities.",
children: [
{
name: "Bacteroides",
rank: "genus",
taxId: 816,
description: "High-abundance anaerobic genus specialized in dietary and host-derived glycans.",
children: [
{
name: "Bacteroides vulgatus",
rank: "species",
taxId: 821,
description: "Common intestinal species often abundant in adult gut metagenomes."
},
{
name: "Bacteroides thetaiotaomicron",
rank: "species",
taxId: 818,
description: "Major glycan-degrading gut commensal widely used as a model organism for host-microbe interactions."
},
{
name: "Bacteroides fragilis",
rank: "species",
taxId: 817,
description: "Well-studied intestinal species whose strains range from mutualists to clinically important opportunists."
},
{
name: "Bacteroides uniformis",
rank: "species",
taxId: 820,
description: "Frequent gut commensal associated with broad glycan-degradation capacity."
}
]
}
]
},
{
name: "Prevotellaceae",
rank: "family",
taxId: 171552,
description: "Family often enriched in fiber-associated enterotypes and non-Westernized diets.",
children: [
{
name: "Prevotella",
rank: "genus",
taxId: 838,
description: "Genus associated with plant-rich diets and increased fermentation of complex polysaccharides.",
children: [
{
name: "Prevotella copri",
rank: "species",
taxId: 165179,
description: "A frequently discussed intestinal species whose abundance varies strongly across diets and populations."
}
]
}
]
},
{
name: "Rikenellaceae",
rank: "family",
taxId: 171550,
description: "Important family of strictly anaerobic gut bacteria often represented by Alistipes.",
children: [
{
name: "Alistipes",
rank: "genus",
taxId: 239759,
description: "Gut genus frequently tracked in host-phenotype association studies.",
children: [
{
name: "Alistipes putredinis",
rank: "species",
taxId: 28116,
description: "Representative intestinal Alistipes species commonly detected in shotgun surveys."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Verrucomicrobiota",
rank: "phylum",
taxId: 74201,
phylum: "verrucomicrobiota",
description: "Usually a low-abundance but influential gut phylum highlighted by the mucin-degrading genus Akkermansia.",
children: [
{
name: "Verrucomicrobiia",
rank: "class",
taxId: 74203,
description: "Class that contains the best-studied intestinal Verrucomicrobiota lineage.",
children: [
{
name: "Verrucomicrobiales",
rank: "order",
taxId: 74205,
description: "Order containing the Akkermansia lineage most often tracked in gut microbiome studies.",
children: [
{
name: "Akkermansiaceae",
rank: "family",
taxId: 1903409,
description: "Family centered on mucus-associated intestinal specialists.",
children: [
{
name: "Akkermansia",
rank: "genus",
taxId: 239934,
description: "Mucin-degrading intestinal genus frequently discussed in relation to metabolic health and epithelial barrier function.",
children: [
{
name: "Akkermansia muciniphila",
rank: "species",
taxId: 239935,
description: "Canonical mucus-associated intestinal species widely studied as a marker and potential mediator of gut barrier health."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Bacillota",
rank: "phylum",
taxId: 186801,
phylum: "bacillota",
description: "Formerly grouped within Firmicutes, this large phylum contains many of the dominant butyrate-producing gut lineages.",
children: [
{
name: "Clostridia",
rank: "class",
taxId: 186802,
description: "Large gut-associated class containing many obligate anaerobes central to short-chain fatty acid production.",
children: [
{
name: "Eubacteriales",
rank: "order",
taxId: 186803,
description: "Order with many important butyrate-producing intestinal families.",
children: [
{
name: "Lachnospiraceae",
rank: "family",
taxId: 186806,
description: "Family rich in fermentative anaerobes that produce acetate and butyrate.",
children: [
{
name: "Roseburia",
rank: "genus",
taxId: 48106,
description: "Genus of butyrate-producing commensals often considered beneficial in the colon.",
children: [
{
name: "Roseburia intestinalis",
rank: "species",
taxId: 166486,
description: "Canonical butyrate-producing intestinal species linked to epithelial health."
},
{
name: "Roseburia hominis",
rank: "species",
taxId: 301301,
description: "Butyrate-producing intestinal species often highlighted as a marker of a fiber-fermenting colon community."
}
]
},
{
name: "Blautia",
rank: "genus",
taxId: 572511,
description: "Common intestinal genus frequently detected in association studies and clinical cohorts.",
children: [
{
name: "Blautia obeum",
rank: "species",
taxId: 40520,
description: "Representative Blautia species commonly recovered from adult intestinal microbiomes."
},
{
name: "Blautia producta",
rank: "species",
taxId: 33035,
description: "Common anaerobic intestinal species associated with carbohydrate fermentation and cross-feeding networks."
}
]
},
{
name: "Agathobacter",
rank: "genus",
taxId: 1766253,
description: "Butyrate-producing genus that includes important carbohydrate-fermenting colonic commensals.",
children: [
{
name: "Agathobacter rectalis",
rank: "species",
taxId: 39491,
description: "High-abundance butyrate-producing intestinal species formerly known as Eubacterium rectale."
}
]
},
{
name: "Coprococcus",
rank: "genus",
taxId: 33042,
description: "Fermentative intestinal genus commonly associated with short-chain fatty acid production.",
children: [
{
name: "Coprococcus comes",
rank: "species",
taxId: 410072,
description: "Representative intestinal Coprococcus species found in many adult gut communities."
}
]
}
]
},
{
name: "Ruminococcaceae",
rank: "family",
taxId: 216572,
description: "Family containing major fiber-degrading intestinal anaerobes.",
children: [
{
name: "Faecalibacterium",
rank: "genus",
taxId: 216816,
description: "Prominent anti-inflammatory genus frequently used as a marker of intestinal health.",
children: [
{
name: "Faecalibacterium prausnitzii",
rank: "species",
taxId: 853,
description: "High-abundance, butyrate-producing intestinal species commonly depleted in inflammatory disease."
}
]
},
{
name: "Ruminococcus",
rank: "genus",
taxId: 1263,
description: "Fiber-adapted intestinal genus frequently discussed in mucus and host-glycan utilization studies.",
children: [
{
name: "Ruminococcus gnavus",
rank: "species",
taxId: 33038,
description: "Common intestinal species often enriched in perturbed or inflammatory gut communities."
}
]
}
]
},
]
},
{
name: "Peptostreptococcales",
rank: "order",
taxId: 3082720,
description: "Order containing anaerobic intestinal lineages that can expand strongly during dysbiosis.",
children: [
{
name: "Peptostreptococcaceae",
rank: "family",
taxId: 186804,
description: "Family containing spore-forming anaerobes of major clinical importance in the gut.",
children: [
{
name: "Clostridioides",
rank: "genus",
taxId: 1870884,
description: "Genus containing toxigenic spore-forming anaerobes of major clinical importance.",
children: [
{
name: "Clostridioides difficile",
rank: "species",
taxId: 1496,
description: "Pathobiont and enteric pathogen that can bloom after antibiotic exposure and disrupt colon ecology."
}
]
}
]
}
]
}
]
},
{
name: "Bacilli",
rank: "class",
taxId: 91061,
description: "Less dominant than Clostridia in the colon but still relevant for enterococci and lactobacilli.",
children: [
{
name: "Bacillales",
rank: "order",
taxId: 1385,
description: "Order containing spore formers and skin- or environment-associated taxa that can also appear in gut datasets.",
children: [
{
name: "Bacillaceae",
rank: "family",
taxId: 186817,
description: "Family containing spore-forming rods that are common in environmental and probiotic contexts.",
children: [
{
name: "Bacillus",
rank: "genus",
taxId: 1386,
description: "Genus of resilient, endospore-forming bacteria sometimes detected in intestinal and probiotic studies.",
children: [
{
name: "Bacillus subtilis",
rank: "species",
taxId: 1423,
description: "Classic spore-forming species used in biotechnology and some probiotic formulations."
}
]
}
]
},
{
name: "Staphylococcaceae",
rank: "family",
taxId: 90964,
description: "Family containing aerotolerant cocci that more often reflect skin or clinical contamination than core gut residency.",
children: [
{
name: "Staphylococcus",
rank: "genus",
taxId: 1279,
description: "Genus of facultative cocci better known for skin and clinical niches but occasionally detected in gut-associated samples.",
children: [
{
name: "Staphylococcus aureus",
rank: "species",
taxId: 1280,
description: "Clinically important opportunist that can transiently colonize the intestine, especially in perturbed settings."
}
]
}
]
}
]
},
{
name: "Lactobacillales",
rank: "order",
taxId: 186826,
description: "Order containing aerotolerant fermenters often highlighted in probiotics and dysbiosis contexts.",
children: [
{
name: "Enterococcaceae",
rank: "family",
taxId: 81852,
description: "Family containing opportunistic intestinal members that can bloom under antibiotic pressure.",
children: [
{
name: "Enterococcus",
rank: "genus",
taxId: 1350,
description: "Clinically important gut genus often monitored in perturbed microbiomes.",
children: [
{
name: "Enterococcus faecalis",
rank: "species",
taxId: 1351,
description: "Representative intestinal species notable for opportunism and antimicrobial resistance potential."
},
{
name: "Enterococcus faecium",
rank: "species",
taxId: 1352,
description: "Hospital-associated opportunist that can become abundant in antibiotic-perturbed intestinal communities."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Pseudomonadota",
rank: "phylum",
taxId: 1224,
phylum: "pseudomonadota",
description: "Usually a minor component of healthy adult stool but an important marker of inflammation, oxygen exposure, or ecological disturbance when expanded.",
children: [
{
name: "Gammaproteobacteria",
rank: "class",
taxId: 1236,
description: "Class that contains many facultative anaerobes and inflammation-associated gut blooms.",
children: [
{
name: "Enterobacterales",
rank: "order",
taxId: 91347,
description: "Order containing familiar intestinal facultative anaerobes.",
children: [
{
name: "Enterobacteriaceae",
rank: "family",
taxId: 543,
description: "Family that often expands during dysbiosis or inflammatory states.",
children: [
{
name: "Escherichia",
rank: "genus",
taxId: 561,
description: "Genus containing common gut commensals as well as opportunistic pathobionts.",
children: [
{
name: "Escherichia coli",
rank: "species",
taxId: 562,
description: "Canonical intestinal species ranging from benign commensals to clinically important strains."
}
]
},
{
name: "Klebsiella",
rank: "genus",
taxId: 570,
description: "Genus of facultative anaerobes that frequently expands in inflammation-associated or antibiotic-perturbed gut states.",
children: [
{
name: "Klebsiella pneumoniae",
rank: "species",
taxId: 573,
description: "Important opportunistic species often tracked as a marker of intestinal dysbiosis and antimicrobial resistance risk."
}
]
}
]
}
]
},
{
name: "Pseudomonadales",
rank: "order",
taxId: 72274,
description: "Order containing aerotolerant gammaproteobacteria more typical of oxygenated or disturbed niches.",
children: [
{
name: "Pseudomonadaceae",
rank: "family",
taxId: 135621,
description: "Family containing metabolically versatile bacteria that can appear in low-abundance intestinal datasets.",
children: [
{
name: "Pseudomonas",
rank: "genus",
taxId: 286,
description: "Genus of adaptable environmental and opportunistic bacteria that can transiently colonize the gut.",
children: [
{
name: "Pseudomonas aeruginosa",
rank: "species",
taxId: 287,
description: "Major opportunistic pathogen sometimes detected in highly perturbed intestinal microbiomes."
}
]
}
]
}
]
},
{
name: "Burkholderiales",
rank: "order",
taxId: 80840,
description: "Order that includes gut-associated lineages detected at low abundance in many cohorts.",
children: [
{
name: "Sutterellaceae",
rank: "family",
taxId: 204455,
description: "Family frequently represented by Sutterella in mucosa-associated gut communities.",
children: [
{
name: "Sutterella",
rank: "genus",
taxId: 40544,
description: "Genus often discussed in host-associated intestinal studies and mucosal niches.",
children: [
{
name: "Sutterella wadsworthensis",
rank: "species",
taxId: 40545,
description: "Representative Sutterella species found in the human intestinal tract."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Fusobacteriota",
rank: "phylum",
taxId: 203691,
phylum: "fusobacteriota",
description: "Usually a minor gut phylum but clinically important because some members expand in inflammatory states and colorectal cancer-associated datasets.",
children: [
{
name: "Fusobacteriia",
rank: "class",
taxId: 32066,
description: "Class containing the best-known Fusobacteriota lineages in host-associated microbiome studies.",
children: [
{
name: "Fusobacteriales",
rank: "order",
taxId: 848,
description: "Order containing oral and intestinal taxa linked to mucosal inflammation.",
children: [
{
name: "Fusobacteriaceae",
rank: "family",
taxId: 849,
description: "Family centered on fusiform anaerobes of oral and gastrointestinal relevance.",
children: [
{
name: "Fusobacterium",
rank: "genus",
taxId: 836,
description: "Genus of anaerobic pathobionts frequently highlighted in colorectal cancer and inflammatory gut studies.",
children: [
{
name: "Fusobacterium nucleatum",
rank: "species",
taxId: 851,
description: "Representative Fusobacterium species often discussed as an inflammation-associated and tumor-associated gut pathobiont."
}
]
}
]
}
]
}
]
}
]
},
{
name: "Euryarchaeota",
rank: "phylum",
taxId: 28890,
phylum: "euryarchaeota",
description: "Archaeal phylum that includes methanogens such as Methanobrevibacter, an important but often lower-abundance component of the intestinal microbiome."
},
{
name: "Ascomycota",
rank: "phylum",
taxId: 4890,
phylum: "ascomycota",
description: "Major fungal phylum that includes many yeasts and molds detected in gut mycobiome surveys."
},
{
name: "Basidiomycota",
rank: "phylum",
taxId: 5204,
phylum: "basidiomycota",
description: "Fungal phylum containing yeasts and other taxa that can contribute to the intestinal mycobiome."
},
{
name: "Zygomycota",
rank: "phylum",
taxId: 4811,
phylum: "zygomycota",
description: "A paraphyletic fungal grouping no longer recognized in modern taxonomy but retained here because it still appears in older reference taxonomies and microbiome annotations."
},
{
name: "Mucoromycota",
rank: "phylum",
taxId: 1653571,
phylum: "mucoromycota",
description: "Modern fungal phylum that contains mucoralean molds sometimes detected in intestinal or environmental sequencing datasets."
},
{
name: "Chytridiomycota",
rank: "phylum",
taxId: 4762,
phylum: "chytridiomycota",
description: "Flagellated fungal phylum occasionally included in broad environmental and host-associated eukaryotic reference databases."
},
{
name: "Glomeromycota",
rank: "phylum",
taxId: 214504,
phylum: "glomeromycota",
description: "Fungal phylum best known for arbuscular mycorrhizal symbiosis but sometimes retained in broad phylogenetic reference frameworks."
},
{
name: "Neocallimastigomycota",
rank: "phylum",
taxId: 451453,
phylum: "neocallimastigomycota",
description: "Anaerobic fungal phylum associated with digestive tracts and fiber degradation in herbivores, included here as a non-bacterial intestinal lineage."
},
{
name: "Uroviricota",
rank: "phylum",
taxId: 2732395,
phylum: "uroviricota",
description: "Viral phylum representing part of the intestinal virome and broader DNA virus diversity detected in metagenomic datasets."
},
{
name: "Phixviricota",
rank: "phylum",
taxId: 2732769,
phylum: "phixviricota",
description: "Viral phylum used for bacteriophage diversity in newer virome-oriented taxonomic frameworks."
},
{
name: "Preplasmiviricota",
rank: "phylum",
taxId: 2732754,
phylum: "preplasmiviricota",
description: "Viral phylum included to reflect current higher-level virome taxonomies relevant to metagenomic reference trees."
}
]
};
const treeMount = document.getElementById("intestinal-taxa-tree");
const detailMount = document.getElementById("intestinal-taxon-detail");
const toolbarButtons = document.querySelectorAll("[data-tree-action]");
const openNodeIds = new Set();
const nodeIndex = new Map();
let selectedNodeId = "root";
const ncbiBaseUrl = "https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=";
const colorDepthByRank = { "body site": 0, "domain": 0, "kingdom": 0, "phylum": 0, "class": 1, "order": 2, "family": 3, "genus": 4, "species": 5 };
const bacterialPhyla = ["Actinomycetota", "Bacteroidota", "Verrucomicrobiota", "Bacillota", "Pseudomonadota", "Fusobacteriota"];
const archaealPhyla = ["Euryarchaeota"];
const fungalPhyla = ["Ascomycota", "Basidiomycota", "Zygomycota", "Mucoromycota", "Chytridiomycota", "Glomeromycota", "Neocallimastigomycota"];
const bacteriophagePhyla = ["Uroviricota", "Phixviricota", "Preplasmiviricota"];
const assignIds = (node, parent = null, inheritedPhylum = "root", lineage = []) => {
const nodeId = parent ? `${parent.id}-${(parent.children || []).indexOf(node)}` : "root";
const phylum = node.phylum || inheritedPhylum;
const lineageTrail = [...lineage, node.name];
const enriched = {
...node,
id: nodeId,
phylum,
depth: colorDepthByRank[node.rank] ?? 0,
lineage: lineageTrail,
children: (node.children || []).map((child) => assignIds(child, { id: nodeId, children: node.children || [] }, phylum, lineageTrail))
};
nodeIndex.set(nodeId, enriched);
return enriched;
};
const buildHigherTaxaTree = (tree) => {
const phylaByName = new Map((tree.children || []).map((child) => [child.name, child]));
const groupedPhyla = [...bacterialPhyla, ...archaealPhyla, ...fungalPhyla, ...bacteriophagePhyla];
const duplicatePhyla = groupedPhyla.filter((name, index) => groupedPhyla.indexOf(name) !== index);
const ungroupedPhyla = [...phylaByName.keys()].filter((name) => !groupedPhyla.includes(name));
if (duplicatePhyla.length || ungroupedPhyla.length) {
const problems = [];
if (duplicatePhyla.length) {
problems.push(`duplicate group assignments for: ${[...new Set(duplicatePhyla)].join(", ")}`);
}
if (ungroupedPhyla.length) {
problems.push(`ungrouped phyla: ${ungroupedPhyla.join(", ")}`);
}
throw new Error(`Unable to build the higher-level taxonomy scaffold (${problems.join("; ")}).`);
}
const pickChildren = (names) => names.map((name) => {
const child = phylaByName.get(name);
if (!child) {
throw new Error(`Missing phylum in intestinalTree: ${name}`);
}
return child;
});
return {
...tree,
children: [
{
name: "Bacteria",
rank: "domain",
taxId: 2,
description: "Domain containing the major bacterial intestinal lineages represented in this tree.",
children: [
{
name: "Bacteria",
rank: "kingdom",
description: "Kingdom-level bacterial grouping used here to organize the gut-associated bacterial phyla below.",
children: pickChildren(bacterialPhyla)
}
]
},
{
name: "Archaea",
rank: "domain",
taxId: 2157,
description: "Domain containing archaeal lineages that contribute to gut ecology, especially methanogenesis.",
children: [
{
name: "Archaea",
rank: "kingdom",
description: "Kingdom-level archaeal grouping used here to place intestinal archaeal phyla in context.",
children: pickChildren(archaealPhyla)
}
]
},
{
name: "Eukaryota",
rank: "domain",
taxId: 2759,
description: "Domain containing the fungal intestinal lineages included in this simplified mycobiome overview.",
children: [
{
name: "Fungi",
rank: "kingdom",
taxId: 4751,
description: "Kingdom containing the intestinal and reference fungal phyla highlighted in this tree.",
children: pickChildren(fungalPhyla)
}
]
},
{
name: "Viruses",
rank: "domain",
taxId: 10239,
description: "Domain containing viral lineages included here to represent bacteriophage-oriented intestinal virome branches.",
children: [
{
name: "Bacteriophages",
rank: "kingdom",
taxId: 10699,
description: "Kingdom-level grouping used here to organize bacteriophage-focused intestinal virome phyla beneath the viral domain.",
children: pickChildren(bacteriophagePhyla)
}
]
}
]
};
};
let treeBuildMessage = "";
let treeData;
try {
treeData = assignIds(buildHigherTaxaTree(intestinalTree));
} catch (error) {
console.error("Unable to build higher taxonomy scaffold for intestinalTree.", error);
treeBuildMessage = "The domain/kingdom scaffold could not be applied, so the tree is falling back to the phylum-first view until the grouping metadata is corrected.";
treeData = assignIds(intestinalTree);
}
const openToDomain = () => {
openNodeIds.clear();
openNodeIds.add("root");
treeData.children.forEach((child) => openNodeIds.add(child.id));
};
const expandAll = (node) => {
openNodeIds.add(node.id);
(node.children || []).forEach(expandAll);
};
const renderDetail = () => {
const node = nodeIndex.get(selectedNodeId) || treeData;
const childNames = (node.children || []).map((child) => child.name);
const ncbiMarkup = node.taxId
? `<dt>NCBI taxonomy</dt><dd><a href="${ncbiBaseUrl}${node.taxId}" target="_blank" rel="noopener noreferrer">txid${node.taxId}</a></dd>`
: "";
detailMount.innerHTML = `
<h3>${node.name}</h3>
<p class="taxa-breadcrumbs">${node.lineage.join(" → ")}</p>
<dl>
<dt>Rank</dt>
<dd>${node.rank}</dd>
<dt>Color family</dt>
<dd>${node.phylum === "root" ? "overview" : node.phylum}</dd>
${ncbiMarkup}
</dl>
<p>${node.description}</p>
${treeBuildMessage && node.id === "root" ? `<p role="alert"><strong>Tree note:</strong> ${treeBuildMessage}</p>` : ""}
${
childNames.length
? `<h4>Immediate descendants</h4><ul>${childNames.map((name) => `<li>${name}</li>`).join("")}</ul>`
: node.rank === "species"
? "<p><strong>Representative endpoint:</strong> this species is shown as an example terminal taxon for its branch on this page.</p>"
: "<p><strong>Leaf node:</strong> no deeper representative descendants are shown for this branch on this page.</p>"
}
`;
};
const renderNode = (node) => {
const hasChildren = Boolean(node.children && node.children.length);
const isOpen = openNodeIds.has(node.id);
const li = document.createElement("li");
const row = document.createElement("div");
const button = document.createElement("button");
const ncbiLink = node.taxId ? document.createElement("a") : null;
button.type = "button";
button.className = `taxa-node-button phylum-${node.phylum} depth-${node.depth}${selectedNodeId === node.id ? " is-selected" : ""}`;
button.setAttribute("aria-expanded", hasChildren ? String(isOpen) : "false");
button.innerHTML = `<span>${hasChildren ? (isOpen ? "▾" : "▸") : "•"}</span><span><strong>${node.name}</strong><br><span class="taxa-node-rank">${node.rank}</span></span>`;
button.addEventListener("click", function () {
selectedNodeId = node.id;
if (hasChildren) {
if (openNodeIds.has(node.id)) {
openNodeIds.delete(node.id);
} else {
openNodeIds.add(node.id);
}
}
renderTree();
});
row.className = "taxa-node-row";
row.appendChild(button);
if (ncbiLink) {
ncbiLink.className = "taxa-node-link";
ncbiLink.href = `${ncbiBaseUrl}${node.taxId}`;
ncbiLink.target = "_blank";
ncbiLink.rel = "noopener noreferrer";
ncbiLink.textContent = "NCBI";
ncbiLink.setAttribute("aria-label", `${node.name} in the NCBI Taxonomy Browser (txid${node.taxId})`);
row.appendChild(ncbiLink);
}
li.appendChild(row);
if (hasChildren) {
const childList = document.createElement("ul");
childList.className = "taxa-node-children";
childList.hidden = !isOpen;
node.children.forEach((child) => childList.appendChild(renderNode(child)));
li.appendChild(childList);
}
return li;
};
const renderTree = () => {
treeMount.innerHTML = "";
const rootList = document.createElement("ul");
rootList.className = "taxa-tree-root";
rootList.appendChild(renderNode(treeData));
treeMount.appendChild(rootList);
renderDetail();
};
toolbarButtons.forEach((button) => {
button.addEventListener("click", function () {
const action = button.dataset.treeAction;
if (action === "expand-all") {
openNodeIds.clear();
expandAll(treeData);
}
if (action === "collapse-all") {
openToDomain();
}
if (action === "reset-focus") {
selectedNodeId = "root";
openToDomain();
}
renderTree();
});
});
openToDomain();
renderTree();
});
</script>