Files
obitools4/autodoc/docmd/pkg/obilua/obiseq.md
T
Eric Coissac 8c7017a99d ⬆️ version bump to v4.5
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
2026-04-13 13:34:53 +02:00

35 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# `obilua` Package: Biosequence Lua Bindings
The `obilua` Go package provides **Lua bindings** for biological sequence objects (`obiseq.BioSequence`) used in the OBITools4 ecosystem. It enables scripting and automation of sequence analysis directly from Lua.
## Core Functionality
- **Type Registration**: Registers a new userdata type `BioSequence` in the Lua state, exposing methods and constructors.
- **Constructor**:
```lua
BioSequence.new(id, sequence[, definition]) →BioSequence```
- **Accessors & Mutators**:
- `id()`, `sequence()`, `definition()` get/set identifiers and sequence data.
- `qualities([table])` handle PHRED-quality scores (as Lua table or string).
- `count()`, `taxid()` numeric abundance and taxonomic ID.
- **Taxonomy Integration**:
- `taxon([Taxon])` get/set taxonomic assignment via integrated taxonomy engine.
- **Attributes**:
- `attribute(name[, value])` arbitrary metadata storage (supports tables, strings, numbers).
- **Sequence Operations**:
- `len()` length of the sequence.
- `has_sequence()`, `has_qualities()` boolean checks for presence of data.
- **Computation & Transformation**:
- `subsequence(start, end)` extract a region.
- `reverse_complement()` → BioSequence.
- `md5()`, `md5_string()` compute sequence checksums (raw bytes or hex string).
- **Serialization**:
- `fasta([format])`, `fastq([format])` output in FASTA/FASTQ, supporting `"json"` or `"obi"` header formats.
- `string([format])` smart formatting: FASTQ if qualities present, else FASTA.
## Implementation Notes
- Uses `gopher-lua` for interpreter integration.
- UserData wrapping ensures type safety and GC management of Go-backed objects.
- Error handling via Lua `ArgError` or `RaiseError`.