[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CVNAXG8F615AXBZ3AR2PHE":3,"skill-same:01M7CVNAXG8F615AXBZ3AR2PHE":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7CVNAXG8F615AXBZ3AR2PHE","bio-phylo-tree-manipulation",null,"Edit phylogenetic tree structure with Biopython Bio.Phylo, and treat rooting as a separate statistical inference rather than a display choice. Covers why most inference returns an unrooted tree so placing the root creates every ancestor\u002Fdescendant and basal claim; why a distant or lonely outgroup misroots inside the ingroup via long-branch attraction; the outgroup\u002Fmidpoint\u002FMAD\u002FMinVar\u002Fnon-reversible-likelihood rooting tradeoffs; why pruning must suppress degree-2 nodes and sum their branch lengths or all patristic distances silently corrupt; and why collapsing by support makes SOFT (uncertainty) polytomies, not HARD (radiation) ones. Use when rooting, re-rooting, pruning or subsetting taxa, extracting a clade or induced subtree, collapsing low-support branches, resolving polytomies, or ladderizing. Routes clock-based rooting to divergence-dating, inference to modern-tree-inference, and reading\u002Fplotting to tree-io and tree-visualization.","mrsonord2240\u002Fopenscience-specialists","mrsonord2240","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76487430?v=4","01M7CTEM40S43GSJZ9A3YCCXZK","Samuel Nord","01M7CTEM4K69JD1GBYNHVJ9ZP4",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-phylo-tree-manipulation\ndescription: Edit phylogenetic tree structure with Biopython Bio.Phylo, and treat rooting as a separate statistical inference rather than a display choice. Covers why most inference returns an unrooted tree so placing the root creates every ancestor\u002Fdescendant and basal claim; why a distant or lonely outgroup misroots inside the ingroup via long-branch attraction; the outgroup\u002Fmidpoint\u002FMAD\u002FMinVar\u002Fnon-reversible-likelihood rooting tradeoffs; why pruning must suppress degree-2 nodes and sum their branch lengths or all patristic distances silently corrupt; and why collapsing by support makes SOFT (uncertainty) polytomies, not HARD (radiation) ones. Use when rooting, re-rooting, pruning or subsetting taxa, extracting a clade or induced subtree, collapsing low-support branches, resolving polytomies, or ladderizing. Routes clock-based rooting to divergence-dating, inference to modern-tree-inference, and reading\u002Fplotting to tree-io and tree-visualization.\ntool_type: mixed\nprimary_tool: Bio.Phylo\n---\n\n## Version Compatibility\n\nReference examples tested with: BioPython 1.83+. Alternatives: ape 5.8+ \u002F phangorn \u002F phytools (R), DendroPy 5+ and ete3 (Python), Newick Utilities 1.6+, MAD and RootDigger as standalone CLIs.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show biopython` then `help(module.function)` to check signatures\n- R: `packageVersion('ape')` then `?drop.tip` to verify parameters\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nape has NO midpoint function of its own (use phangorn::midpoint or phytools::midpoint.root); ete3 prune drops branch lengths unless preserve_branch_length=True; ape di2multi filters by branch LENGTH (tol), not support.\n\n# Tree Manipulation -- Rooting Is an Inference, Not a Cosmetic Operation\n\n**\"Root and prune my tree\"** -> Edit an existing tree object, treating the root placement as a separate statistical inference and every structural edit as potentially distance-corrupting.\n- Python: `tree.root_with_outgroup(...)`, `tree.root_at_midpoint()`, `tree.prune(...)`, `tree.collapse_all(...)` (Bio.Phylo)\n- R: `root()`, `phangorn::midpoint()`, `drop.tip()`, `di2multi()` (ape\u002Fphangorn); CLI: `nw_reroot`, `nw_prune` (Newick Utilities); outgroup-free rooters: `mad`, `FastRoot.py`, `rootdigger`\n\nScope: editing an existing tree -- rooting, pruning\u002Fsubsetting, extracting clades or induced subtrees, collapsing branches into polytomies, resolving polytomies, ladderizing. Reading\u002Fwriting\u002Fconverting tree files -> tree-io. Plotting and mapping annotations -> tree-visualization. Inferring the tree in the first place -> modern-tree-inference. Clock-based or Bayesian rooting co-estimated with dates -> divergence-dating.\n\n## The Single Most Important Modern Insight\n\nRooting is a separate statistical inference layered on top of the topology, and it is the highest-error decision in the entire tree. Nearly every inference method (ML under a time-reversible model, neighbor-joining, most Bayesian runs) returns an UNROOTED tree: a reversible model is blind to the direction of time, so the likelihood is identical wherever the root sits. The unrooted tree states which taxa are neighbors; it is silent about who is ancestor and who is descendant. Placing the root is what converts a neighbor-graph into an evolutionary narrative, and it CREATES every \"X is basal\", every \"the common ancestor had trait T\", every character-polarity, every divergence ordering. Three load-bearing facts:\n\n1. **Rooting needs its own justification and its own uncertainty statement, distinct from branch support.** Bootstrap 95 on an ingroup clade says nothing about whether the root is in the right place. The relationships can be robust while the root -- the thing every downstream story hangs on -- is the least reliable part of the figure.\n2. **The deep nodes near an outgroup-defined root are the LEAST trustworthy.** A distant outgroup sits on a long branch, and long branches attract each other (long-branch attraction): the outgroup pulls the fastest ingroup taxon toward the root and makes it look artifactually \"basal\". Accuracy degrades monotonically as outgroup distance grows.\n3. **The choice of rooting METHOD is a modeling choice with assumptions** (clock? outgroup monophyly? non-reversible model?), and the wrong method silently fabricates basal lineages. Pruning, collapsing, and ladderizing are comparatively mechanical -- but each has its own silent traps (distance corruption, soft\u002Fhard polytomy conflation, perceived trends).\n\n## Rooting Method Decision\n\n| Method | Core assumption | Needs | Robust to rate variation | Gives root uncertainty | Best when | Avoid when |\n|--------|-----------------|-------|--------------------------|------------------------|-----------|------------|\n| Outgroup (multiple, close) | outgroup truly outside ingroup, not LBA-misplaced | a priori outgroup taxa + sequences | moderate (depends on outgroup branch) | weakly (via ingroup-monophyly check) | closely related, balanced, monophyletic outgroups exist | only a distant\u002Flonely outgroup available |\n| Outgroup (single) | same, but one long branch | one outgroup taxon | poor (max LBA exposure) | no | a close single sister exists, nothing better | only a distant\u002Flonely outgroup (one long branch, max LBA exposure) |\n| Midpoint | strict molecular clock | tree with branch lengths | no | no | shallow, clock-like, intraspecific\u002Fviral data | deep trees, heterotachy, any long branch |\n| MinVar | clock deviations are random\u002Funbiased | tree with branch lengths | better than midpoint | no | outgroup-free, noise looks like unbiased clock scatter | strong lineage-specific rate shifts |\n| MAD | minimal relative ancestor deviation | tree with branch lengths | yes (tolerates heterotachy) | yes (root ambiguity index) | outgroup-free deep\u002Fprokaryotic trees; default no-outgroup choice | strongly structured rate variation |\n| Non-reversible likelihood (RootDigger \u002F IQ-TREE) | non-reversible model carries directional signal | tree + ALIGNMENT; enough data | yes (model-based) | yes (per-branch likelihood confidence) | the alignment is available and a root confidence is needed | little data; weak signal; compute-limited |\n| Relaxed clock (BEAST) -> divergence-dating | explicit clock + tree prior | alignment + calibrations\u002Ftip dates; MCMC | yes | yes (posterior over roots) | time-scaled \u002F dated \u002F phylodynamic analyses | a quick structural edit, no dating intended |\n\nRule: never report a root from a single method without a sanity check. If a close, monophyletic outgroup is available, use it. If not, run MAD and MinVar; disagreement, or a MAD ambiguity index near 1, means the root is poorly determined and all \"basal\" claims must be hedged. Agreement is NOT root confidence: under a strong clade-wide rate shift both can agree on the same wrong root. With an alignment and a need for a confidence value, use RootDigger (Bettisworth and Stamatakis 2021) or non-reversible IQ-TREE. MAD = Tria et al. 2017; MinVar = Mai et al. 2017; outgroup-free CLIs and Newick Utilities = Junier and Zdobnov 2010.\n\n## Tool Taxonomy\n\n| Tool (lang) | Rooting | Pruning \u002F clade | Collapse \u002F resolve | When |\n|-------------|---------|-----------------|--------------------|------|\n| Bio.Phylo (Py) | `root_with_outgroup`, `root_at_midpoint` | `prune`, `common_ancestor` | `collapse_all` | general Python pipelines; the default here |\n| ape \u002F phangorn \u002F phytools (R) | `root`, `phangorn::midpoint`, `phytools::midpoint.root` | `drop.tip`, `extract.clade` | `di2multi`, `multi2di` | R workflows; `drop.tip` sums suppressed branch lengths correctly |\n| DendroPy (Py) | `reroot_at_edge`, `reroot_at_midpoint` | `retain_taxa_with_labels(suppress_unifurcations=True)` | edge collapse, `resolve_polytomies` | metadata-aware edits, posterior tree sets |\n| ete3 (Py) | `set_outgroup`, `set_outgroup(get_midpoint_outgroup())` | `prune([...], preserve_branch_length=True)`, `detach` | `delete`, `resolve_polytomy` | NHX features; MUST pass preserve_branch_length |\n| Newick Utilities (CLI) | `nw_reroot` | `nw_prune`, `nw_clade` | `nw_ed` with a support address (`nw_condense` merges same-label clades, not low-support branches) | streaming\u002FUnix-pipeline edits on many trees |\n| MAD \u002F MinVar \u002F RootDigger (CLI) | `mad`, `FastRoot.py`, `rootdigger` | -- | -- | outgroup-free or likelihood rooting when no trustworthy outgroup exists |\n\n## Root with an Outgroup (Multiple, Monophyletic)\n\n**Goal:** Root the tree using known sister-group taxa, preferring multiple close outgroups and verifying ingroup monophyly first.\n\n**Approach:** Confirm the outgroup taxa form a monophyletic group, root on the branch separating them from the ingroup, then check the ingroup is recovered as monophyletic -- if not, the rooting is suspect. An inferred tree is arbitrarily rooted (IQ-TREE writes `(OutA,OutB,ingroup...)`), so first root on an ingroup tip, or the monophyly test returns False for a valid outgroup; pass `outgroup_branch_length`, or Biopython makes the outgroup MRCA a trifurcating root.\n\n```python\nfrom Bio import Phylo\n\ntree = Phylo.read('tree.nwk', 'newick')\noutgroup = [{'name': 'OutA'}, {'name': 'OutB'}]      # multiple close outgroups beat a single long branch\n\ntree.root_with_outgroup({'name': 'I1'})              # any INGROUP tip: makes the outgroup a clade of the temporary root\nif tree.is_monophyletic([tree.find_any(**o) for o in outgroup]):\n    stem = tree.common_ancestor(*outgroup).branch_length\n    tree.root_with_outgroup(*outgroup, outgroup_branch_length=stem \u002F 2)   # bifurcating root on the outgroup stem\nelse:\n    print('outgroup not monophyletic: root placement is unreliable, re-check taxon choice')\n```\n\n## Root at the Midpoint (Clock-Limited Fallback)\n\n**Goal:** Root an outgroup-free tree where evolution is approximately clock-like (shallow\u002Fviral data).\n\n**Approach:** Place the root at the midpoint of the longest tip-to-tip path; trust it only when no single long branch can hijack that path. For deep trees with rate variation prefer MAD\u002FMinVar.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')\ntree.root_at_midpoint()                              # assumes a clock; a long branch slides the root onto the fast lineage\n# Outgroup-free and clock-relaxed (deep trees): standalone CLIs run on the Newick file\n# MAD:    mad tree.nwk           -> tree.nwk.rooted   (report the ambiguity index AI; AI near 1 = ambiguous root)\n#         a Newick written by Bio.Phylo ends in '):0;', which MAD 2.2 rejects as corrupt -> strip it first: re.sub(r'\\):[0-9.eE+-]+;$', ');', nwk)\n# MinVar: FastRoot.py -i tree.nwk -m MV -o rooted.nwk\n# Non-reversible likelihood root with confidence (needs the alignment; iqtree2 on IQ-TREE 2.x):\n#   iqtree3 -s aln.fa --model-joint 12.12 -B 1000 --root-test -zb 1000 -au\n#   -> report the rootstrap on the root branch (.rootstrap.nex) and the AU confidence set of root branches (.roottest.csv)\n```\n\n## Prune Taxa With Branch-Length Preservation\n\n**Goal:** Remove tips and keep every surviving patristic distance unchanged.\n\n**Approach:** Drop the tip and SUPPRESS the resulting degree-2 (\"knee\") node, ADDING its branch length to the child so path lengths are conserved. Bio.Phylo `prune` and ape `drop.tip` do this by default; ete3 `prune` needs `preserve_branch_length=True`.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')\nkeep = {'Human', 'Chimp', 'Mouse'}\n\nfor term in list(tree.get_terminals()):\n    if term.name not in keep:\n        tree.prune(term)                             # collapses the degree-2 parent and sums branch lengths\n# ape (R):   drop.tip(phy, c('X','Y'))               # sums suppressed branch lengths by default\n# ete3 (Py): tree.prune(list(keep), preserve_branch_length=True)   # the flag is mandatory, else distances shrink\n```\n\nNon-monophyletic targets cannot be \"extracted as a clade\" -- there is no node whose descendants are exactly those taxa. Prune to the taxon set to get the induced subtree instead; `common_ancestor` of non-monophyletic taxa returns an MRCA whose clade contains EXTRA taxa.\n\n## Collapse Low-Support Branches Into SOFT Polytomies\n\n**Goal:** Replace poorly-supported resolved nodes with multifurcations that honestly say \"unresolved\".\n\n**Approach:** Collapse any internal branch whose support is below a stated cutoff. The result is a SOFT (uncertainty) polytomy, never a HARD (simultaneous-radiation) one -- label it as such.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')              # single-number labels parse into clade.confidence\n\ndef support(c):                                      # IQ-TREE -B + --alrt writes '98.5\u002F100' -> kept in c.name, confidence None\n    if c.confidence is not None:\n        return c.confidence\n    if c.name and '\u002F' in c.name:\n        return float(c.name.split('\u002F')[-1])          # last field = UFBoot\n    return None\n\nassert any(support(c) is not None for c in tree.get_nonterminals()), 'no readable support: collapse would silently do nothing'\ntree.collapse_all(lambda c: support(c) is not None and support(c) \u003C 70)   # 70 for std bootstrap; use 95 for UFBoot2\ntree.collapse_all(lambda c: c.branch_length is not None and c.branch_length \u003C= 1e-6)   # zero-length: match the writer's floor (IQ-TREE 1e-6)\ntree.ladderize()                                     # display order only; rotation changes no biology\n# ape (R): di2multi filters by LENGTH (tol), not support -> zero out low-support branch lengths first, THEN di2multi(phy)\n```\n\nAny collapse changes some patristic distances (Bio.Phylo `collapse_all` pushes the removed length onto the children; the ape zero-then-`di2multi` recipe shortens paths). Collapse a copy for display or topology work and keep the resolved tree for distance-based analyses.\n\nResolving the inverse direction (`multi2di` \u002F `resolve_polytomy`) invents an arbitrary order with zero-length branches; analyzing one random resolution treats an arbitrary choice as fact. If a binary tree is required, integrate over many random resolutions and treat the inserted zero-length branches as \"no information\", not instantaneous divergence.\n\n## Per-Method Failure Modes\n\n### Distant Outgroup Roots Inside the Ingroup\n**Trigger:** A single distant outgroup, or many outgroups all far from the ingroup, used to root.\n**Mechanism:** The long outgroup branch attracts the fastest ingroup taxon (LBA), pulling the root into the ingroup; far outgroups attach at essentially random positions (DeSalle et al. 2023).\n**Symptom:** Ingroup not recovered as monophyletic; a fast taxon appears \"basal\"; the root jumps as the outgroup set changes.\n**Fix:** Use multiple CLOSELY-related, monophyletic, roughly-equidistant outgroups; verify ingroup monophyly; treat a lonely distant outgroup as a red flag.\n\n### Single Distant Outgroup -- Long-Branch Misrooting\n**Trigger:** Rooting on one distant outgroup taxon.\n**Mechanism:** One unbroken long branch maximizes LBA exposure, with no way to subdivide it or check ingroup monophyly, so the root is drawn toward other long branches.\n**Symptom:** The root lands inside the ingroup or on a spurious deep branch; deep nodes near the root are unstable across analyses.\n**Fix:** Add multiple closer, monophyletic outgroups to subdivide the long branch and enable a monophyly check, or use an outgroup-free method (MAD\u002FMinVar).\n\n### Midpoint Misroots Under Rate Variation\n**Trigger:** Midpoint rooting a deep tree with heterotachy or any long branch.\n**Mechanism:** Midpoint assumes a clock; a long branch hijacks the longest path and slides the root onto the fast lineage.\n**Symptom:** A rate-elevated taxon appears earliest-diverging; the root sits on a suspiciously long branch.\n**Fix:** Use MAD or MinVar (clock-relaxed) or a close outgroup; report root uncertainty and hedge \"basal\".\n\n### Soft vs Hard Polytomy Conflation\n**Trigger:** Collapsing branches below a support threshold, then describing the multifurcation as a radiation.\n**Mechanism:** Threshold-collapse encodes UNCERTAINTY (soft polytomy = \"we cannot resolve the order\"); a hard polytomy is a biological claim of simultaneous divergence -- different meanings.\n**Symptom:** A paper claims simultaneous divergence from what is just unresolved data.\n**Fix:** Label threshold-collapsed nodes as unresolved\u002Fsoft; never read them as a biological radiation.\n\n### Pruning Leaves a Spurious Node or Drops Distances\n**Trigger:** A tool that leaves the degree-2 node in place, or removes it without summing branch lengths (notably ete3 `prune` without `preserve_branch_length=True`).\n**Mechanism:** The suppressed knee's branch length is not added to its child, so every path through that lineage shortens.\n**Symptom:** Patristic distances shrink; subsequent midpoint\u002FMAD\u002FMinVar rooting on the pruned tree is now wrong.\n**Fix:** Use Bio.Phylo `prune` \u002F ape `drop.tip` (correct by default) or pass ete3 `preserve_branch_length=True`; verify a known pairwise distance is unchanged.\n\n### Randomly Resolving a Polytomy Biases Downstream\n**Trigger:** `multi2di` \u002F `resolve_polytomy` to satisfy a binary-tree requirement, then analyzing the single tree.\n**Mechanism:** An arbitrary order with zero-length branches is invented; the downstream result depends on a topology the data never supported.\n**Symptom:** Results that change under a different random resolution.\n**Fix:** Integrate over many resolutions and summarize; treat zero-length branches as \"no info\", not instantaneous divergence.\n\n### Ladderizing Manufactures an Apparent Trend\n**Trigger:** Ladderizing a figure so one lineage sits visually at the top\u002Fbottom.\n**Mechanism:** Rotation about internal nodes changes no topology, branch lengths, or bipartitions, but readers unconsciously read the staircase as an early-to-late sequence.\n**Symptom:** Reviewers infer a basal-to-derived trend that does not exist.\n**Fix:** Ladderize only for legibility; state that rotation changes no biology. -> tree-visualization.\n\n## Quantitative Thresholds\n\n| Quantity | Value | Source \u002F rationale |\n|----------|-------|--------------------|\n| Midpoint root recovery, single-outgroup source data | ~54% (barely a coin flip) | Hess and Russo 2007 |\n| Midpoint root recovery, multiple-outgroup source data | ~82% (inconsistent) to ~94% (consistent) | Hess and Russo 2007 |\n| MAD accuracy on benchmarks | >~70%, beating midpoint | Tria et al. 2017 |\n| MinVar vs midpoint | matched or beat midpoint in all simulated conditions | Mai et al. 2017 |\n| Bootstrap collapse cutoff | \u003C50% (near-uninformative floor) or \u003C70% (reliability boundary); state which | common practice |\n| UFBoot2 collapse cutoff | \u003C95% (a different scale from bootstrap -- not 70) | Hoang 2018 |\n| Bayesian posterior collapse cutoff | \u003C0.95 | common practice |\n| Zero-length collapse tolerance | match the program that wrote the tree: IQ-TREE writes zero as 1e-6 (use `\u003C= 1e-6`); ape `di2multi` default 1e-8 | a tolerance below the writer's floor catches no zero-length branch |\n| Outgroup distance | accuracy degrades monotonically with distance | prefer the closest credible outgroup |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| `ape::midpoint` function-not-found | midpoint is not in base ape | use `phangorn::midpoint` or `phytools::midpoint.root` |\n| Pruned tree has wrong distances | degree-2 node not suppressed \u002F not summed | Bio.Phylo `prune` \u002F ape `drop.tip` default, or ete3 `preserve_branch_length=True` |\n| \"Extract the clade of X,Y,Z\" returns extra taxa or None | X,Y,Z are not monophyletic | prune to the taxon set (induced subtree) instead of extracting a clade |\n| `di2multi(tol)` did not drop low-support nodes | `tol` filters branch LENGTH, not support | zero out low-support branch lengths first, then `di2multi` |\n| Bootstrap re-read as support for a pruned subtree | support was computed on the full taxon set | re-run inference on the subset for valid support |\n| MAD and MinVar disagree on the root | the root is genuinely poorly determined | treat as uncertain; seek a close outgroup or RootDigger confidence; hedge all ancestral claims |\n| `root_with_midpoint` AttributeError | no such method | the methods are `root_at_midpoint()` and `root_with_outgroup()` |\n| Valid outgroup reported \"not monophyletic\" on an IQ-TREE tree | `is_monophyletic` tests rooted clades; the file is rooted on the outgroup's own trifurcation | root on an ingroup tip first, then test and root with `outgroup_branch_length` |\n| `collapse_all` on support collapses nothing, no error | IQ-TREE `SH-aLRT\u002FUFBoot` label kept in `clade.name`, `confidence` None | parse `clade.name.split('\u002F')[-1]`; assert support was read before collapsing |\n\n## References\n\nTria FDK, Landan G, Dagan T. 2017. Phylogenetic rooting using minimal ancestor deviation. *Nature Ecology & Evolution* 1:0193.\nMai U, Sayyari E, Mirarab S. 2017. Minimum variance rooting of phylogenetic trees and implications for species tree reconstruction. *PLOS ONE* 12(8):e0182238.\nBettisworth B, Stamatakis A. 2021. Root Digger: a root placement program for phylogenetic trees. *BMC Bioinformatics* 22:225.\nHess PN, De Moraes Russo CA. 2007. An empirical test of the midpoint rooting method. *Biological Journal of the Linnean Society* 92(4):669-674.\nDeSalle R, Narechania A, Tessler M. 2023. Multiple outgroups can cause random rooting in phylogenomics. *Molecular Phylogenetics and Evolution* 184:107806.\nJunier T, Zdobnov EM. 2010. The Newick utilities: high-throughput phylogenetic tree processing in the Unix shell. *Bioinformatics* 26(13):1669-1670.\nHuerta-Cepas J, Serra F, Bork P. 2016. ETE 3: reconstruction, analysis, and visualization of phylogenomic data. *Molecular Biology and Evolution* 33(6):1635-1638.\nParadis E, Schliep K. 2019. ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R. *Bioinformatics* 35(3):526-528.\n\n## Related Skills\n\n- tree-io - reading and writing the trees these edits consume and produce, without dropping annotations\n- tree-visualization - ladderize is a perception choice; mapping support onto branches\n- divergence-dating - clock-based and Bayesian rooting co-estimated with node ages, not bolted on by midpoint\n- modern-tree-inference - produces the unrooted ML tree and the support values these edits act on\n","## Version Compatibility\n\nReference examples tested with: BioPython 1.83+. Alternatives: ape 5.8+ \u002F phangorn \u002F phytools (R), DendroPy 5+ and ete3 (Python), Newick Utilities 1.6+, MAD and RootDigger as standalone CLIs.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- Python: `pip show biopython` then `help(module.function)` to check signatures\n- R: `packageVersion('ape')` then `?drop.tip` to verify parameters\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nape has NO midpoint function of its own (use phangorn::midpoint or phytools::midpoint.root); ete3 prune drops branch lengths unless preserve_branch_length=True; ape di2multi filters by branch LENGTH (tol), not support.\n\n# Tree Manipulation -- Rooting Is an Inference, Not a Cosmetic Operation\n\n**\"Root and prune my tree\"** -> Edit an existing tree object, treating the root placement as a separate statistical inference and every structural edit as potentially distance-corrupting.\n- Python: `tree.root_with_outgroup(...)`, `tree.root_at_midpoint()`, `tree.prune(...)`, `tree.collapse_all(...)` (Bio.Phylo)\n- R: `root()`, `phangorn::midpoint()`, `drop.tip()`, `di2multi()` (ape\u002Fphangorn); CLI: `nw_reroot`, `nw_prune` (Newick Utilities); outgroup-free rooters: `mad`, `FastRoot.py`, `rootdigger`\n\nScope: editing an existing tree -- rooting, pruning\u002Fsubsetting, extracting clades or induced subtrees, collapsing branches into polytomies, resolving polytomies, ladderizing. Reading\u002Fwriting\u002Fconverting tree files -> tree-io. Plotting and mapping annotations -> tree-visualization. Inferring the tree in the first place -> modern-tree-inference. Clock-based or Bayesian rooting co-estimated with dates -> divergence-dating.\n\n## The Single Most Important Modern Insight\n\nRooting is a separate statistical inference layered on top of the topology, and it is the highest-error decision in the entire tree. Nearly every inference method (ML under a time-reversible model, neighbor-joining, most Bayesian runs) returns an UNROOTED tree: a reversible model is blind to the direction of time, so the likelihood is identical wherever the root sits. The unrooted tree states which taxa are neighbors; it is silent about who is ancestor and who is descendant. Placing the root is what converts a neighbor-graph into an evolutionary narrative, and it CREATES every \"X is basal\", every \"the common ancestor had trait T\", every character-polarity, every divergence ordering. Three load-bearing facts:\n\n1. **Rooting needs its own justification and its own uncertainty statement, distinct from branch support.** Bootstrap 95 on an ingroup clade says nothing about whether the root is in the right place. The relationships can be robust while the root -- the thing every downstream story hangs on -- is the least reliable part of the figure.\n2. **The deep nodes near an outgroup-defined root are the LEAST trustworthy.** A distant outgroup sits on a long branch, and long branches attract each other (long-branch attraction): the outgroup pulls the fastest ingroup taxon toward the root and makes it look artifactually \"basal\". Accuracy degrades monotonically as outgroup distance grows.\n3. **The choice of rooting METHOD is a modeling choice with assumptions** (clock? outgroup monophyly? non-reversible model?), and the wrong method silently fabricates basal lineages. Pruning, collapsing, and ladderizing are comparatively mechanical -- but each has its own silent traps (distance corruption, soft\u002Fhard polytomy conflation, perceived trends).\n\n## Rooting Method Decision\n\n| Method | Core assumption | Needs | Robust to rate variation | Gives root uncertainty | Best when | Avoid when |\n|--------|-----------------|-------|--------------------------|------------------------|-----------|------------|\n| Outgroup (multiple, close) | outgroup truly outside ingroup, not LBA-misplaced | a priori outgroup taxa + sequences | moderate (depends on outgroup branch) | weakly (via ingroup-monophyly check) | closely related, balanced, monophyletic outgroups exist | only a distant\u002Flonely outgroup available |\n| Outgroup (single) | same, but one long branch | one outgroup taxon | poor (max LBA exposure) | no | a close single sister exists, nothing better | only a distant\u002Flonely outgroup (one long branch, max LBA exposure) |\n| Midpoint | strict molecular clock | tree with branch lengths | no | no | shallow, clock-like, intraspecific\u002Fviral data | deep trees, heterotachy, any long branch |\n| MinVar | clock deviations are random\u002Funbiased | tree with branch lengths | better than midpoint | no | outgroup-free, noise looks like unbiased clock scatter | strong lineage-specific rate shifts |\n| MAD | minimal relative ancestor deviation | tree with branch lengths | yes (tolerates heterotachy) | yes (root ambiguity index) | outgroup-free deep\u002Fprokaryotic trees; default no-outgroup choice | strongly structured rate variation |\n| Non-reversible likelihood (RootDigger \u002F IQ-TREE) | non-reversible model carries directional signal | tree + ALIGNMENT; enough data | yes (model-based) | yes (per-branch likelihood confidence) | the alignment is available and a root confidence is needed | little data; weak signal; compute-limited |\n| Relaxed clock (BEAST) -> divergence-dating | explicit clock + tree prior | alignment + calibrations\u002Ftip dates; MCMC | yes | yes (posterior over roots) | time-scaled \u002F dated \u002F phylodynamic analyses | a quick structural edit, no dating intended |\n\nRule: never report a root from a single method without a sanity check. If a close, monophyletic outgroup is available, use it. If not, run MAD and MinVar; disagreement, or a MAD ambiguity index near 1, means the root is poorly determined and all \"basal\" claims must be hedged. Agreement is NOT root confidence: under a strong clade-wide rate shift both can agree on the same wrong root. With an alignment and a need for a confidence value, use RootDigger (Bettisworth and Stamatakis 2021) or non-reversible IQ-TREE. MAD = Tria et al. 2017; MinVar = Mai et al. 2017; outgroup-free CLIs and Newick Utilities = Junier and Zdobnov 2010.\n\n## Tool Taxonomy\n\n| Tool (lang) | Rooting | Pruning \u002F clade | Collapse \u002F resolve | When |\n|-------------|---------|-----------------|--------------------|------|\n| Bio.Phylo (Py) | `root_with_outgroup`, `root_at_midpoint` | `prune`, `common_ancestor` | `collapse_all` | general Python pipelines; the default here |\n| ape \u002F phangorn \u002F phytools (R) | `root`, `phangorn::midpoint`, `phytools::midpoint.root` | `drop.tip`, `extract.clade` | `di2multi`, `multi2di` | R workflows; `drop.tip` sums suppressed branch lengths correctly |\n| DendroPy (Py) | `reroot_at_edge`, `reroot_at_midpoint` | `retain_taxa_with_labels(suppress_unifurcations=True)` | edge collapse, `resolve_polytomies` | metadata-aware edits, posterior tree sets |\n| ete3 (Py) | `set_outgroup`, `set_outgroup(get_midpoint_outgroup())` | `prune([...], preserve_branch_length=True)`, `detach` | `delete`, `resolve_polytomy` | NHX features; MUST pass preserve_branch_length |\n| Newick Utilities (CLI) | `nw_reroot` | `nw_prune`, `nw_clade` | `nw_ed` with a support address (`nw_condense` merges same-label clades, not low-support branches) | streaming\u002FUnix-pipeline edits on many trees |\n| MAD \u002F MinVar \u002F RootDigger (CLI) | `mad`, `FastRoot.py`, `rootdigger` | -- | -- | outgroup-free or likelihood rooting when no trustworthy outgroup exists |\n\n## Root with an Outgroup (Multiple, Monophyletic)\n\n**Goal:** Root the tree using known sister-group taxa, preferring multiple close outgroups and verifying ingroup monophyly first.\n\n**Approach:** Confirm the outgroup taxa form a monophyletic group, root on the branch separating them from the ingroup, then check the ingroup is recovered as monophyletic -- if not, the rooting is suspect. An inferred tree is arbitrarily rooted (IQ-TREE writes `(OutA,OutB,ingroup...)`), so first root on an ingroup tip, or the monophyly test returns False for a valid outgroup; pass `outgroup_branch_length`, or Biopython makes the outgroup MRCA a trifurcating root.\n\n```python\nfrom Bio import Phylo\n\ntree = Phylo.read('tree.nwk', 'newick')\noutgroup = [{'name': 'OutA'}, {'name': 'OutB'}]      # multiple close outgroups beat a single long branch\n\ntree.root_with_outgroup({'name': 'I1'})              # any INGROUP tip: makes the outgroup a clade of the temporary root\nif tree.is_monophyletic([tree.find_any(**o) for o in outgroup]):\n    stem = tree.common_ancestor(*outgroup).branch_length\n    tree.root_with_outgroup(*outgroup, outgroup_branch_length=stem \u002F 2)   # bifurcating root on the outgroup stem\nelse:\n    print('outgroup not monophyletic: root placement is unreliable, re-check taxon choice')\n```\n\n## Root at the Midpoint (Clock-Limited Fallback)\n\n**Goal:** Root an outgroup-free tree where evolution is approximately clock-like (shallow\u002Fviral data).\n\n**Approach:** Place the root at the midpoint of the longest tip-to-tip path; trust it only when no single long branch can hijack that path. For deep trees with rate variation prefer MAD\u002FMinVar.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')\ntree.root_at_midpoint()                              # assumes a clock; a long branch slides the root onto the fast lineage\n# Outgroup-free and clock-relaxed (deep trees): standalone CLIs run on the Newick file\n# MAD:    mad tree.nwk           -> tree.nwk.rooted   (report the ambiguity index AI; AI near 1 = ambiguous root)\n#         a Newick written by Bio.Phylo ends in '):0;', which MAD 2.2 rejects as corrupt -> strip it first: re.sub(r'\\):[0-9.eE+-]+;$', ');', nwk)\n# MinVar: FastRoot.py -i tree.nwk -m MV -o rooted.nwk\n# Non-reversible likelihood root with confidence (needs the alignment; iqtree2 on IQ-TREE 2.x):\n#   iqtree3 -s aln.fa --model-joint 12.12 -B 1000 --root-test -zb 1000 -au\n#   -> report the rootstrap on the root branch (.rootstrap.nex) and the AU confidence set of root branches (.roottest.csv)\n```\n\n## Prune Taxa With Branch-Length Preservation\n\n**Goal:** Remove tips and keep every surviving patristic distance unchanged.\n\n**Approach:** Drop the tip and SUPPRESS the resulting degree-2 (\"knee\") node, ADDING its branch length to the child so path lengths are conserved. Bio.Phylo `prune` and ape `drop.tip` do this by default; ete3 `prune` needs `preserve_branch_length=True`.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')\nkeep = {'Human', 'Chimp', 'Mouse'}\n\nfor term in list(tree.get_terminals()):\n    if term.name not in keep:\n        tree.prune(term)                             # collapses the degree-2 parent and sums branch lengths\n# ape (R):   drop.tip(phy, c('X','Y'))               # sums suppressed branch lengths by default\n# ete3 (Py): tree.prune(list(keep), preserve_branch_length=True)   # the flag is mandatory, else distances shrink\n```\n\nNon-monophyletic targets cannot be \"extracted as a clade\" -- there is no node whose descendants are exactly those taxa. Prune to the taxon set to get the induced subtree instead; `common_ancestor` of non-monophyletic taxa returns an MRCA whose clade contains EXTRA taxa.\n\n## Collapse Low-Support Branches Into SOFT Polytomies\n\n**Goal:** Replace poorly-supported resolved nodes with multifurcations that honestly say \"unresolved\".\n\n**Approach:** Collapse any internal branch whose support is below a stated cutoff. The result is a SOFT (uncertainty) polytomy, never a HARD (simultaneous-radiation) one -- label it as such.\n\n```python\ntree = Phylo.read('tree.nwk', 'newick')              # single-number labels parse into clade.confidence\n\ndef support(c):                                      # IQ-TREE -B + --alrt writes '98.5\u002F100' -> kept in c.name, confidence None\n    if c.confidence is not None:\n        return c.confidence\n    if c.name and '\u002F' in c.name:\n        return float(c.name.split('\u002F')[-1])          # last field = UFBoot\n    return None\n\nassert any(support(c) is not None for c in tree.get_nonterminals()), 'no readable support: collapse would silently do nothing'\ntree.collapse_all(lambda c: support(c) is not None and support(c) \u003C 70)   # 70 for std bootstrap; use 95 for UFBoot2\ntree.collapse_all(lambda c: c.branch_length is not None and c.branch_length \u003C= 1e-6)   # zero-length: match the writer's floor (IQ-TREE 1e-6)\ntree.ladderize()                                     # display order only; rotation changes no biology\n# ape (R): di2multi filters by LENGTH (tol), not support -> zero out low-support branch lengths first, THEN di2multi(phy)\n```\n\nAny collapse changes some patristic distances (Bio.Phylo `collapse_all` pushes the removed length onto the children; the ape zero-then-`di2multi` recipe shortens paths). Collapse a copy for display or topology work and keep the resolved tree for distance-based analyses.\n\nResolving the inverse direction (`multi2di` \u002F `resolve_polytomy`) invents an arbitrary order with zero-length branches; analyzing one random resolution treats an arbitrary choice as fact. If a binary tree is required, integrate over many random resolutions and treat the inserted zero-length branches as \"no information\", not instantaneous divergence.\n\n## Per-Method Failure Modes\n\n### Distant Outgroup Roots Inside the Ingroup\n**Trigger:** A single distant outgroup, or many outgroups all far from the ingroup, used to root.\n**Mechanism:** The long outgroup branch attracts the fastest ingroup taxon (LBA), pulling the root into the ingroup; far outgroups attach at essentially random positions (DeSalle et al. 2023).\n**Symptom:** Ingroup not recovered as monophyletic; a fast taxon appears \"basal\"; the root jumps as the outgroup set changes.\n**Fix:** Use multiple CLOSELY-related, monophyletic, roughly-equidistant outgroups; verify ingroup monophyly; treat a lonely distant outgroup as a red flag.\n\n### Single Distant Outgroup -- Long-Branch Misrooting\n**Trigger:** Rooting on one distant outgroup taxon.\n**Mechanism:** One unbroken long branch maximizes LBA exposure, with no way to subdivide it or check ingroup monophyly, so the root is drawn toward other long branches.\n**Symptom:** The root lands inside the ingroup or on a spurious deep branch; deep nodes near the root are unstable across analyses.\n**Fix:** Add multiple closer, monophyletic outgroups to subdivide the long branch and enable a monophyly check, or use an outgroup-free method (MAD\u002FMinVar).\n\n### Midpoint Misroots Under Rate Variation\n**Trigger:** Midpoint rooting a deep tree with heterotachy or any long branch.\n**Mechanism:** Midpoint assumes a clock; a long branch hijacks the longest path and slides the root onto the fast lineage.\n**Symptom:** A rate-elevated taxon appears earliest-diverging; the root sits on a suspiciously long branch.\n**Fix:** Use MAD or MinVar (clock-relaxed) or a close outgroup; report root uncertainty and hedge \"basal\".\n\n### Soft vs Hard Polytomy Conflation\n**Trigger:** Collapsing branches below a support threshold, then describing the multifurcation as a radiation.\n**Mechanism:** Threshold-collapse encodes UNCERTAINTY (soft polytomy = \"we cannot resolve the order\"); a hard polytomy is a biological claim of simultaneous divergence -- different meanings.\n**Symptom:** A paper claims simultaneous divergence from what is just unresolved data.\n**Fix:** Label threshold-collapsed nodes as unresolved\u002Fsoft; never read them as a biological radiation.\n\n### Pruning Leaves a Spurious Node or Drops Distances\n**Trigger:** A tool that leaves the degree-2 node in place, or removes it without summing branch lengths (notably ete3 `prune` without `preserve_branch_length=True`).\n**Mechanism:** The suppressed knee's branch length is not added to its child, so every path through that lineage shortens.\n**Symptom:** Patristic distances shrink; subsequent midpoint\u002FMAD\u002FMinVar rooting on the pruned tree is now wrong.\n**Fix:** Use Bio.Phylo `prune` \u002F ape `drop.tip` (correct by default) or pass ete3 `preserve_branch_length=True`; verify a known pairwise distance is unchanged.\n\n### Randomly Resolving a Polytomy Biases Downstream\n**Trigger:** `multi2di` \u002F `resolve_polytomy` to satisfy a binary-tree requirement, then analyzing the single tree.\n**Mechanism:** An arbitrary order with zero-length branches is invented; the downstream result depends on a topology the data never supported.\n**Symptom:** Results that change under a different random resolution.\n**Fix:** Integrate over many resolutions and summarize; treat zero-length branches as \"no info\", not instantaneous divergence.\n\n### Ladderizing Manufactures an Apparent Trend\n**Trigger:** Ladderizing a figure so one lineage sits visually at the top\u002Fbottom.\n**Mechanism:** Rotation about internal nodes changes no topology, branch lengths, or bipartitions, but readers unconsciously read the staircase as an early-to-late sequence.\n**Symptom:** Reviewers infer a basal-to-derived trend that does not exist.\n**Fix:** Ladderize only for legibility; state that rotation changes no biology. -> tree-visualization.\n\n## Quantitative Thresholds\n\n| Quantity | Value | Source \u002F rationale |\n|----------|-------|--------------------|\n| Midpoint root recovery, single-outgroup source data | ~54% (barely a coin flip) | Hess and Russo 2007 |\n| Midpoint root recovery, multiple-outgroup source data | ~82% (inconsistent) to ~94% (consistent) | Hess and Russo 2007 |\n| MAD accuracy on benchmarks | >~70%, beating midpoint | Tria et al. 2017 |\n| MinVar vs midpoint | matched or beat midpoint in all simulated conditions | Mai et al. 2017 |\n| Bootstrap collapse cutoff | \u003C50% (near-uninformative floor) or \u003C70% (reliability boundary); state which | common practice |\n| UFBoot2 collapse cutoff | \u003C95% (a different scale from bootstrap -- not 70) | Hoang 2018 |\n| Bayesian posterior collapse cutoff | \u003C0.95 | common practice |\n| Zero-length collapse tolerance | match the program that wrote the tree: IQ-TREE writes zero as 1e-6 (use `\u003C= 1e-6`); ape `di2multi` default 1e-8 | a tolerance below the writer's floor catches no zero-length branch |\n| Outgroup distance | accuracy degrades monotonically with distance | prefer the closest credible outgroup |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| `ape::midpoint` function-not-found | midpoint is not in base ape | use `phangorn::midpoint` or `phytools::midpoint.root` |\n| Pruned tree has wrong distances | degree-2 node not suppressed \u002F not summed | Bio.Phylo `prune` \u002F ape `drop.tip` default, or ete3 `preserve_branch_length=True` |\n| \"Extract the clade of X,Y,Z\" returns extra taxa or None | X,Y,Z are not monophyletic | prune to the taxon set (induced subtree) instead of extracting a clade |\n| `di2multi(tol)` did not drop low-support nodes | `tol` filters branch LENGTH, not support | zero out low-support branch lengths first, then `di2multi` |\n| Bootstrap re-read as support for a pruned subtree | support was computed on the full taxon set | re-run inference on the subset for valid support |\n| MAD and MinVar disagree on the root | the root is genuinely poorly determined | treat as uncertain; seek a close outgroup or RootDigger confidence; hedge all ancestral claims |\n| `root_with_midpoint` AttributeError | no such method | the methods are `root_at_midpoint()` and `root_with_outgroup()` |\n| Valid outgroup reported \"not monophyletic\" on an IQ-TREE tree | `is_monophyletic` tests rooted clades; the file is rooted on the outgroup's own trifurcation | root on an ingroup tip first, then test and root with `outgroup_branch_length` |\n| `collapse_all` on support collapses nothing, no error | IQ-TREE `SH-aLRT\u002FUFBoot` label kept in `clade.name`, `confidence` None | parse `clade.name.split('\u002F')[-1]`; assert support was read before collapsing |\n\n## References\n\nTria FDK, Landan G, Dagan T. 2017. Phylogenetic rooting using minimal ancestor deviation. *Nature Ecology & Evolution* 1:0193.\nMai U, Sayyari E, Mirarab S. 2017. Minimum variance rooting of phylogenetic trees and implications for species tree reconstruction. *PLOS ONE* 12(8):e0182238.\nBettisworth B, Stamatakis A. 2021. Root Digger: a root placement program for phylogenetic trees. *BMC Bioinformatics* 22:225.\nHess PN, De Moraes Russo CA. 2007. An empirical test of the midpoint rooting method. *Biological Journal of the Linnean Society* 92(4):669-674.\nDeSalle R, Narechania A, Tessler M. 2023. Multiple outgroups can cause random rooting in phylogenomics. *Molecular Phylogenetics and Evolution* 184:107806.\nJunier T, Zdobnov EM. 2010. The Newick utilities: high-throughput phylogenetic tree processing in the Unix shell. *Bioinformatics* 26(13):1669-1670.\nHuerta-Cepas J, Serra F, Bork P. 2016. ETE 3: reconstruction, analysis, and visualization of phylogenomic data. *Molecular Biology and Evolution* 33(6):1635-1638.\nParadis E, Schliep K. 2019. ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R. *Bioinformatics* 35(3):526-528.\n\n## Related Skills\n\n- tree-io - reading and writing the trees these edits consume and produce, without dropping annotations\n- tree-visualization - ladderize is a perception choice; mapping support onto branches\n- divergence-dating - clock-based and Bayesian rooting co-estimated with node ages, not bolted on by midpoint\n- modern-tree-inference - produces the unrooted ML tree and the support values these edits act on\n",{"name":5,"tool_type":24,"description":7,"primary_tool":25},"mixed","Bio.Phylo","main","e0956dc9606356ab78468936b502e55a365282e2","specialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation",0,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists","https:\u002F\u002Fgithub.com\u002Fmrsonord2240","2026-10-12 03:19:04",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-phylo-tree-manipulation",{"tool":39,"command":40},"bunx","bunx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-phylo-tree-manipulation",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-phylo-tree-manipulation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002FSKILL.md",true,[47,53,57,61,65],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"examples\u002Fcollapse_support.py","SCRIPT","脚本",1744,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002Fexamples\u002Fcollapse_support.py",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"examples\u002Fcommon_ancestor.py",1312,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002Fexamples\u002Fcommon_ancestor.py",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"examples\u002Fprune_taxa.py",1019,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002Fexamples\u002Fprune_taxa.py",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"examples\u002Froot_tree.py",1842,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002Fexamples\u002Froot_tree.py",{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"usage-guide.md","REFERENCE","参考文档",5203,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fmolecular-phylogenetics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-phylo-tree-manipulation\u002Fusage-guide.md",[72,79,86,93,100,107],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7CW36A6QAGWFE2C008M1XPG","bio-workflows-metabolomics-pipeline","Orchestrates the untargeted LC-MS metabolomics pipeline end-to-end (xcms 4.x feature extraction, QC\u002Fdrift\u002Fnormalization, confidence-stratified annotation, permutation-validated statistics, background-aware pathway mapping), naming what each stage decides and where it silently fails. Use when running a full LC-MS metabolomics study from raw mzML to enriched pathways and needing the honest handoffs between stages. Each stage defers to its component skill for parameters and traps; for stable-isotope flux (a separate branch, not this untargeted flow) see metabolomics\u002Fisotope-tracing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-workflows-metabolomics-pipeline\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7CW2Y18623NA2S1Y30FRQW1","bio-metabolomics-xcms-preprocessing","Programmatic untargeted LC-MS feature extraction in R with the modern xcms 4.x MsExperiment\u002FXcmsExperiment API, taking raw mzML to a feature table via CentWave peak detection, retention-time alignment, peak-density correspondence, gap-filling, CAMERA redundancy collapse, and built-in QC feature filtering. Use when converting centroided LC-MS runs into a features-by-samples matrix and deciding centWave\u002Fgrouping\u002Falignment parameters. For drift correction and QC\u002FCV filtering execution see metabolomics\u002Fnormalization-qc; for metabolite identification see metabolomics\u002Fmetabolite-annotation; for the MS-DIAL GUI alternative with MS2Dec deconvolution see metabolomics\u002Fmsdial-preprocessing; for downstream statistics see metabolomics\u002Fstatistical-analysis.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-xcms-preprocessing\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7CW2M364HVWPNQEKE2WP4PP","bio-metabolomics-statistical-analysis","Decision-grade statistical analysis for metabolomics intensity tables. Covers transformation and scaling (Pareto vs unit-variance as a hidden hypothesis), unsupervised structure (PCA\u002FHCA for QC), permutation-validated PLS-DA\u002FOPLS-DA (R2 vs Q2, double CV, VIP as heuristic), univariate testing (Welch\u002FMann-Whitney\u002FANOVA\u002FLMM with covariate adjustment), and dependence-aware multiple testing. Use when testing which metabolites differ, building or validating a discriminant model, choosing a scaling, or correcting many correlated tests. For sample-wise normalization\u002Fdrift correction see metabolomics\u002Fnormalization-qc; for ML classifiers and selection-inside-CV leakage see machine-learning\u002Fbiomarker-discovery and machine-learning\u002Fmodel-validation; for pathway interpretation see metabolomics\u002Fpathway-mapping; for design\u002Fpower\u002Fmultiplicity regime see experimental-design\u002Fmultiple-testing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-statistical-analysis\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7CW2BCBF851WYE03Z8XPEDQ","bio-metabolomics-pathway-mapping","Maps metabolomics results to biological pathways via over-representation (ORA), metabolite-set enrichment (MSEA\u002FQEA), mummichog\u002FPSEA on raw m\u002Fz peaks, and network-diffusion enrichment (FELLA), with correct background-set construction and honest interpretive ceilings. Use when interpreting differential metabolites or an untargeted LC-MS feature table in pathway context, choosing ORA vs MSEA vs mummichog vs topology, or setting the reference\u002Fbackground set. For annotation confidence levels feeding ORA see metabolomics\u002Fmetabolite-annotation; for gene-set concepts see pathway-analysis\u002Fgo-enrichment and pathway-analysis\u002Fgsea; for joint gene+metabolite pathways see multi-omics-integration\u002Fmofa-integration.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-pathway-mapping\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7CW21NSZMCPMF7D9CHJM718","bio-metabolomics-normalization-qc","Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7CW1SWVM0NYHVE6Q7MA3G7R","bio-metabolomics-msdial-preprocessing","Runs the MS-DIAL preprocessing workflow (peak picking, MS2Dec spectral deconvolution, alignment, gap-filling) and imports the alignment-result table into R or Python with honest filtering. Use when preprocessing LC-MS DDA\u002FDIA (SWATH) or GC-MS raw data with MS-DIAL, deciding MS-DIAL vs XCMS, configuring the MSDIALCUI console run, or parsing an MS-DIAL export into a clean feature matrix. For programmatic R peak detection and the feature-table-as-artifact framing see metabolomics\u002Fxcms-preprocessing; for lipid annotation mode see metabolomics\u002Flipidomics; for MSI-level confidence honesty see metabolomics\u002Fmetabolite-annotation; for drift correction and QC see metabolomics\u002Fnormalization-qc.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-msdial-preprocessing\u002FSKILL.md",[],[]]