Alignment¶
FASTA/PHYLIP alignment loading with site-pattern compression.
Alignment
dataclass
¶
Compressed alignment with site-pattern multiplicities.
Attributes:
| Name | Type | Description |
|---|---|---|
seq_type |
'DNA' or 'AA'
|
|
index |
AlignmentIndex tying local taxa to the global TaxonTable
|
|
patterns |
uint8 array of shape (n_local, n_patterns) - encoded states
|
|
weights |
int32 array of shape (n_patterns,) - column multiplicities
|
|
n_sites |
total alignment length (= weights.sum())
|
|
Source code in src/hifuku/alignment.py
load_alignment
¶
load_alignment(path: Union[str, Path], taxon_table: TaxonTable, *, schema: str = 'fasta') -> Alignment
Read an alignment file and return a compressed :class:Alignment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, Path]
|
|
required |
taxon_table
|
Shared global TaxonTable; taxa are registered here.
|
|
required |
schema
|
str
|
|
'fasta'
|
Notes
Sequence type (DNA vs protein) is inferred from the DendroPy matrix class that successfully parses the file.
- Sukumaran & Holder (2010) : CharacterMatrix API; taxon registration.
Source code in src/hifuku/alignment.py
|