Files
obitools4/autodoc/docmd/pkg/obilua/obiseqslice.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

1.5 KiB
Raw Blame History

obilua Package: Lua Bindings for BioSequence Slicing

This Go module provides Lua scripting support for biological sequence manipulation via the obilua package. It exposes a custom Lua type, "BioSequenceSlice", wrapping Gos *obiseq.BioSequenceSlice to enable high-level sequence operations in Lua.

Core Features

  • Type Registration: Registers BioSequenceSlice as a userdata type in Lua with metatable support.
  • Constructor: new([capacity]) creates a new slice (optionally pre-sized).
  • Indexing & Assignment: slice[i] = seq or seq = slice[i], with bounds checking.
  • Dynamic Operations:
    • push(seq): Append a sequence.
    • pop(): Remove and return the last sequence.
  • Length Query: len() returns number of sequences in slice.

Output Formatting

Provides multiple export methods to format all contained sequences:

  • fasta([format]): Returns FASTA string (supports "json" or "obi" headers).
  • fastq([format]): Returns FASTQ string (same format options as above).
  • string([format]): Smart formatter:
    • Uses FASTQ if all sequences have quality scores.
    • Falls back to FASTA otherwise.

Design Notes

  • All methods validate input types and indices.
  • Format selection is optional; defaults to "obi" header style unless specified as "json".
  • Integrates with obiseq.BioSequence and formatting utilities from the OBItools4 ecosystem.

This enables Lua users to process NGS data (e.g., FASTA/FASTQ) interactively within pipelines, leveraging Gos performance and Luas expressiveness.