IQ-TREE基因一致性因子分析:如何确定gDF1与gDF2支持的近邻交换拓扑结构
Great question—this is a common point of confusion when working with gene concordance factors in IQ-TREE. Let’s break this down step by step, so you can pinpoint exactly which NNI topologies gDF1 and gDF2 correspond to, and how to reconstruct those alternative trees.
First: What gDF1 and gDF2 Actually Represent
For every internal branch in your reference rooted tree, IQ-TREE calculates three key values related to topological support:
gCF: The proportion of gene trees that support the reference tree’s branch (splitting the tree into two monophyletic groups, let’s call them Clade A and Clade B).gDF1: The proportion of gene trees that support the most common nearest-neighbor interchange (NNI) alternative topology for that branch. This is the first alternative you’d get by swapping one nearest-neighbor clade from A with one from B.gDF2: The proportion of gene trees that support the second most common NNI alternative topology for the same branch (the other possible NNI swap for that split).gDFp: The proportion of gene trees that support all other non-NNI alternative topologies.
How to Find the Exact gDF1/gDF2 Topologies
IQ-TREE actually outputs these alternative trees directly when you run the gCF calculation—you just need to know which files to look for:
- Locate the
.gCF.alt.treesfile: This is a NEXUS-formatted file generated alongside your stats output. It contains two alternative trees for every branch in your reference tree, named with a suffix matching the branch ID from your stats file (e.g.,Branch_42_DF1andBranch_42_DF2). - Match branch IDs to your stats file: Open your gCF stats file (usually named
[prefix].gCF.stats). Each row corresponds to a branch in your reference tree, with a unique ID (often tied to bootstrap values or node labels from your reference tree). Use this ID to find the corresponding_DF1and_DF2trees in the.gCF.alt.treesfile. - Visualize the alternative trees: Load the
.gCF.alt.treesfile into a tree viewer like FigTree, iTOL, or Dendroscope. You’ll be able to see exactly how the NNI swap alters the reference tree’s topology for that branch.
Reconstructing the Tree with a gDF1/gDF2 Branch
If you want to replace the reference tree’s branch with the topology supported by gDF1 or gDF2, you have two easy options:
- Use the pre-generated alternative tree: The
.gCF.alt.treesfile already contains full trees with the NNI swap applied. Just extract the_DF1or_DF2tree you need and use that as your new tree. - Manually modify the reference tree: If you prefer to edit the original reference tree, use the visualized alternative tree as a guide to adjust the clade relationships for the target branch in your tree editor of choice.
Quick Check to Ensure You Have the Right Files
Make sure your original IQ-TREE command included the necessary parameters to generate these files. For example, if you’re using pre-computed gene trees to calculate gCF, your command might look like this:
iqtree -s concatenated_aln.phy -t reference_tree.tre -gcf gene_trees.tre -pre my_phylogeny
The -gcf flag triggers the concordance factor calculation, and the -pre sets the prefix for all output files (including the .gCF.alt.trees and .gCF.stats files).
内容的提问来源于stack exchange,提问作者Sophie Leitch

