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. A dict holds the label-to-index map, so a lookup costs the same at any table size, and the order of the table follows the order of registration.
Attributes:
| Name | Type | Description |
|---|---|---|
n_taxa |
int
|
Number of registered taxa. |
labels |
list[str]
|
Taxon labels in registration order (index 0, 1, ...). |
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.
Source code in src/hifuku/taxa.py
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.