MoonBit GenBank/INSDC flat-file parser for small bioinformatics tools, teaching
examples, and data-conversion pipelines.
The library focuses on annotated sequence records rather than broad
bioinformatics algorithms. It parses LOCUS metadata, FEATURES entries, ORIGIN
sequence text, common feature locations, qualifiers, CDS translation checks, and
compact JSON export.
Why this project
MoonBit already has early bioinformatics ecosystem work, but GenBank flat-file
annotation parsing is still a useful standalone building block. Keeping this
package focused makes it suitable for:
validating small submitted sequence records
querying genes and CDS annotations in teaching examples
converting GenBank snippets to JSON for web or CLI tools
extending toward INSDC feature-table edge cases over time
This repository is developed as an original MoonBit OSC2026 project. No source
code is copied from existing GenBank parsers.
Features
LOCUS parsing: record name, length, molecule type, topology, division, date
FEATURES parsing: feature key, location expression, slash qualifiers
Location support: point/range, nested join(...) and order(...), nested
complement(...), partial markers, between-base positions, one-of(...),
and remote accessions
ORIGIN cleanup: sequence lines are normalized to uppercase bases
Generated public interfaces are committed in pkg.generated.mbti.
Scope
Implemented:
single-record GenBank flat files
multi-record streams separated by //
common feature-table qualifiers
multi-line qualifier values
nested range, join, order, and complement locations
fuzzy, between-base, and remote location segments
standard genetic code translation
IUPAC ambiguity bases in ORIGIN and reverse-complement operations
Planned extension points:
richer feature-table normalization and structured metadata fields
selectable genetic codes and codon-start handling
streaming/file-reading CLI once the async filesystem API is stabilized for
all supported MoonBit targets
Real benchmarks
examples/u49845.gb and examples/af165912.gb are fixed NCBI GenBank
snapshots covering partial locations, reverse-strand features, multiline
qualifiers, and multiline join expressions. Their source URLs and checksums
are documented in BENCHMARKS.md.
Validation
The CI workflow installs the latest MoonBit toolchain and runs on Linux, macOS,
and Windows:
moon fmt followed by git diff --exit-code
moon info followed by git diff --exit-code
moon check --target all --deny-warn
moon test --target all --deny-warn
Locally, this repository was checked with:
moon check --deny-warn
moon test --deny-warn
moon info
The current local Windows environment has no system C compiler, so native
--target all execution is delegated to CI, where gcc is installed explicitly.
License
Apache-2.0.
关于
MoonBit GenBank/INSDC annotation parser with feature queries, CDS validation, JSON export, and CI
moonbit-genbank
MoonBit GenBank/INSDC flat-file parser for small bioinformatics tools, teaching examples, and data-conversion pipelines.
The library focuses on annotated sequence records rather than broad bioinformatics algorithms. It parses LOCUS metadata, FEATURES entries, ORIGIN sequence text, common feature locations, qualifiers, CDS translation checks, and compact JSON export.
Why this project
MoonBit already has early bioinformatics ecosystem work, but GenBank flat-file annotation parsing is still a useful standalone building block. Keeping this package focused makes it suitable for:
This repository is developed as an original MoonBit OSC2026 project. No source code is copied from existing GenBank parsers.
Features
join(...)andorder(...), nestedcomplement(...), partial markers, between-base positions,one-of(...), and remote accessions/translation--jsonQuick Start
Library Example
API Surface
The main package exposes:
parse_record(text) -> Record raise GenBankErrorparse_records(text) -> Array[Record] raise GenBankErrorparse_locus(line) -> Locus raise GenBankErrorparse_location(text) -> Location raise GenBankErrorGenBankError::messageRecord::features_by_keyRecord::features_with_qualifierFeature::qualifierFeature::overlapsRecord::sequence_forRecord::check_cds_translationsRecord::sequence_statsRecord::validateRecord::to_json_stringValidationIssue::is_errorValidationIssue::to_json_stringtranslate_dnareverse_complementGenerated public interfaces are committed in
pkg.generated.mbti.Scope
Implemented:
//Planned extension points:
Real benchmarks
examples/u49845.gbandexamples/af165912.gbare fixed NCBI GenBank snapshots covering partial locations, reverse-strand features, multiline qualifiers, and multilinejoinexpressions. Their source URLs and checksums are documented inBENCHMARKS.md.Validation
The CI workflow installs the latest MoonBit toolchain and runs on Linux, macOS, and Windows:
moon fmtfollowed bygit diff --exit-codemoon infofollowed bygit diff --exit-codemoon check --target all --deny-warnmoon test --target all --deny-warnLocally, this repository was checked with:
The current local Windows environment has no system C compiler, so native
--target allexecution is delegated to CI, where gcc is installed explicitly.License
Apache-2.0.