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.9 KiB
1.9 KiB
BioSequence Attribute Management API
This Go package (obiseq) provides a rich set of methods for managing metadata and structural attributes associated with biological sequences (BioSequence). Below is a semantic overview of the core functionalities:
-
Key Discovery & Existence Checks:
Keys()andAttributeKeys()return all attribute names (optionally excluding container/statistics fields or the"definition"key).HasAttribute(key)verifies presence of a given attribute (including standard fields:"id","sequence","qualities").
-
Generic Attribute Access:
GetAttribute(key)retrieves any attribute value (asinterface{}), with thread-safe locking.SetAttribute(key, value)assigns values to attributes (including automatic conversion for"id","sequence"and"qualities").
-
Typed Attribute Retrieval:
- Type-specific getters (
GetIntAttribute,GetFloatAttribute,GetStringAttribute, etc.) ensure safe conversion and auto-upgrade of stored values (e.g., string"42"→ integer42). - Supports maps (
GetIntMap,GetStringMap) and slices (GetIntSlice).
- Type-specific getters (
-
Convenience & Domain-Specific Helpers:
Count()/SetCount(): manage observation frequency (default = 1).- OBITag indexing:
OBITagRefIndex()/SetOBITagRefIndex(), and geometry variants (geomref). Supports flexible input map types with dynamic conversion. - Coordinate & landmark support:
GetCoordinate()/SetCoordinate(), andlandmark_id-based operations (IsALandmark(),GetLandmarkID()).
All methods are designed for robustness: they handle type conversions gracefully, use locking to ensure concurrency safety, and provide fallbacks (e.g., default count = 1). The API abstracts internal storage (annotations map) while exposing a clean, consistent interface for sequence annotation manipulation.