mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.8 KiB
1.8 KiB
obitax Package: Taxonomic Node Representation and Management
The obitax package provides a lightweight, pointer-based Go implementation for representing taxonomic nodes in biological classification systems.
Core Data Structure
TaxNode: Represents a single taxon (e.g., species, genus) with the following fields:id: Unique taxon identifier (pointer to string).parent: Identifier of the parent node in the taxonomy hierarchy.rank: Taxonomic rank (e.g.,"species","family").scientificname: Canonical scientific name (e.g., Homo sapiens).alternatenames: Map of alternative names keyed by name class (e.g.,"common_name","synonym").
Key Functionalities
-
String Representation
String(taxonomyCode)returns a formatted label like"NCBI:12345 [Homo sapiens]@species"(or raw ID if enabled viaobidefault.UseRawTaxids()). -
Accessors
Id(),ParentId(): Retrieve identifiers.ScientificName()/Rank(): Return name or rank (defaulting to"NA"if missing).Name(class): Fetch name by class ("scientific name"or alternate).
-
Mutators
SetName(name, class): Assign scientific name or add/update alternate names.
-
Name Matching & Validation
IsNameEqual(name, ignoreCase): Exact or case-insensitive match against scientific/alternate names.IsNameMatching(pattern): Regex-based pattern matching over all available names.
Design Notes
- Uses pointers for optional fields (enables
nilsemantics). - Graceful handling of missing data (
NA, empty strings, safe dereferencing withnilchecks). - Integrates logging via Logrus (
log.Panicon misuse, e.g., setting name ofnilnode). - Designed for use in larger OBITools pipelines (e.g., with
obidefaultconfiguration).