- 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
Obilua: Lua-Based Sequence Processing Framework
The obilua package provides a bridge between Go and the Lua scripting language for high-performance, parallelizable biological sequence processing. It enables users to write custom analysis logic in Lua while leveraging Go’s concurrency and I/O capabilities.
Core Features
-
Lua Interpreter Initialization:
NewInterpreter()creates an isolated Lua state preloaded with Obi-specific types (BioSequence, etc.). -
Compilation Support:
Compile()andCompileScript()parse and compile Lua code into efficient function prototypes. -
Worker Conversion:
LuaWorker(proto)wraps a compiled Lua script as a Go-compatibleSeqWorker, allowing seamless integration into sequence pipelines. -
Pipeline Integration:
LuaProcessor()executes a Lua script over an iterator of sequences using configurable parallelism.- It supports optional
begin()andfinish()hook functions in Lua for initialization/cleanup. - Errors can be handled either by halting (
breakOnError=true) or logging warnings.
-
Pipeable Interface:
LuaPipe()andLuaScriptPipe()expose Lua scripts as reusable, chainable pipeline stages (obiiter.Pipeable), supporting both inline programs and external.luafiles.
Lua API Contract
Scripts must define a global worker(sequence) function returning either:
- A single
BioSequence - A list (
BioSequenceSlice) Or return nothing (interpreted as filtered out).
Optionally, begin() and finish() functions may be defined for lifecycle management.
Parallel Execution
Uses Go routines to run multiple workers concurrently, with batched input and output management. Default worker count falls back to system-wide parallelism settings if nworkers ≤ 0.
Logging & Error Handling
Uses Logrus for structured logging; fatal errors are logged during setup, while runtime issues respect the breakOnError flag.