Neighbor-Joining Anchors¶
Anchor trees are neighbor-joining trees built from the gene alignments, with corrected pairwise distances (JC69 for DNA, Kimura 1983 for protein).
nj_tree
¶
Compute a neighbor-joining anchor tree from a compressed alignment.
The NJ algorithm runs on all of the alignment's local taxa. The returned HifukuTree is restricted to the taxa currently in taxon_table, so the caller controls the effective namespace by pre-populating taxon_table.
Negative branch lengths produced by the NJ algorithm (a known artifact on non-tree-metric distance matrices) are clamped to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alignment
|
'Alignment'
|
Compressed alignment (DNA or AA) produced by |
required |
taxon_table
|
TaxonTable
|
Shared global TaxonTable. Leaf taxa from the NJ tree that are in
this table are kept; the rest are pruned. Any kept taxa not already
in the table are registered via |
required |
Returns:
| Type | Description |
|---|---|
HifukuTree
|
NJ tree restricted to taxon_table, with |
Notes
Distance model (per seq_type):
'DNA': Jukes-Cantor 1969 correction, d = -(3/4) ln(1-(4/3)p). Jukes & Cantor (1969).'AA': Kimura 1983 correction, d = -ln(1-p-0.2p^2). Kimura (1983).
Saturated pairs are capped at a large finite distance; see _SATURATED_DIST.
Neighbor-joining: saitou1987nj. DendroPy NJ: Sukumaran & Holder (2010).
Source code in src/hifuku/nj.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |