Taxa & Namespace¶
Global taxon namespace shared across all alignments and trees.
TaxonTable
¶
Global taxon namespace: maps taxon label (str) to a stable integer index.
Indices are assigned in order of first registration and never change.
Backed by a dendropy.TaxonNamespace so trees parsed into this
namespace share the same Taxon objects.
Attributes:
| Name | Type | Description |
|---|---|---|
n_taxa |
int
|
Number of registered taxa. |
labels |
list[str]
|
Taxon labels in registration order (index 0, 1, …). |
dendropy_namespace |
TaxonNamespace
|
Underlying DendroPy namespace; pass to DendroPy tree-reading calls. |
Notes
- Sukumaran & Holder (2010) : TaxonNamespace API; taxon objects backed by DendroPy.
Source code in src/hifuku/taxa.py
|
AlignmentIndex
¶
Per-alignment local ↔ global index map and presence mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taxon_table
|
TaxonTable
|
The shared global TaxonTable. Taxa in labels are registered (added if absent) during construction. |
required |
labels
|
list[str]
|
Ordered list of taxon labels for this alignment. The order defines the local index (0 … n_local-1). |
required |
Notes
The presence mask depends on the total number of global taxa, which
may grow after construction. Use :meth:build_mask and pass the
current taxon_table.n_taxa to get a correctly-sized mask.
- Sukumaran & Holder (2010) : taxon namespace restriction semantics.
Source code in src/hifuku/taxa.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
local_to_global
property
¶
Shape (n_local,) int32: maps local index to global index.
global_to_local
¶
build_mask
¶
Return a boolean mask of shape (n_global,) where True = taxon present.
Pass taxon_table.n_taxa after all alignments have been registered
so that the mask has the correct final length.