Sign in

    moonbit-genbank

    MoonBit GenBank/INSDC annotation parser with feature queries, CDS validation, JSON export, and CI

    Download zip
    Version
    0.2.3
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    25

    No dependencies

    #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:

    • 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 an original MoonBit project for the August 2026 MoonBit Hackathon. 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
    • Queries: feature key filtering, qualifier lookup, span overlap checks
    • CDS validation: extracts feature sequence, handles complement strands, and compares computed translation with /translation
    • Sequence statistics: base counts and GC percentage for ORIGIN
    • Sequence analytics: FASTA parsing, windows, k-mers, motif search, IUPAC expansion, composition entropy, consensus, homopolymers, and identity
    • Translation toolkit: selectable standard/vertebrate-mitochondrial tables, codon usage, reading frames, and bounded ORF discovery
    • Workflow utilities: strict FASTA validation, IUPAC motif scanning on both strands, global sequence alignment, contig overlap assembly, and windowed quality profiles
    • Interoperability exports: feature tables, BED/GFF3 projections, FASTA conversion, codon reports, and batch translation audits
    • Coordinate analytics: interval union/intersection, coverage masks, and feature-key coverage reports
    • Location analysis: biological coordinate order, span/length/containment, fuzzy/remote flags, and deterministic annotation summaries
    • Record audit: sequence length, source feature, bounds, remote locations, between-base locations, and CDS translation findings
    • JSON export: compact stable representation for downstream tooling
    • Runnable demo CLI: summary output by default and JSON output with --json

    #Quick Start

    moon check --deny-warn moon test --deny-warn moon run cmd/main moon run cmd/main -- --json

    #Library Example

    ///|
    test "parse a minimal record" {
    let text =
    #|LOCUS DEMO0001 12 bp DNA linear SYN 28-JUL-2026
    #|DEFINITION Minimal MoonBit GenBank demo record.
    #|ACCESSION DEMO0001
    #|FEATURES Location/Qualifiers
    #| source 1..12
    #| /organism="synthetic construct"
    #| CDS 1..12
    #| /gene="demo"
    #| /translation="MAIV"
    #|ORIGIN
    #| 1 atggccattgta
    #|//
    let record = parse_record(text)
    inspect(record.accession, content="DEMO0001")
    inspect(record.features_by_key("CDS").length(), content="1")
    inspect(record.check_cds_translations()[0].ok, content="true")
    }

    #API Surface

    The main package exposes:

    • parse_record(text) -> Record raise GenBankError
    • parse_records(text) -> Array[Record] raise GenBankError
    • parse_locus(line) -> Locus raise GenBankError
    • parse_location(text) -> Location raise GenBankError
    • GenBankError::message
    • Record::features_by_key
    • Record::features_with_qualifier
    • Feature::qualifier
    • Feature::overlaps
    • Record::sequence_for
    • Record::check_cds_translations
    • Record::sequence_stats
    • Record::validate
    • Record::to_json_string
    • Record::to_genbank_string
    • record_to_bed and record_to_gff3
    • scan_iupac_both_strands
    • global_align
    • batch_quality
    • translation_audit
    • ValidationIssue::is_error
    • ValidationIssue::to_json_string
    • translate_dna
    • reverse_complement

    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

    Remaining extension points:

    • richer feature-table normalization and structured metadata fields
    • remote sequence resolution and full fuzzy-location alternatives
    • 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.

    The regression suite runs against the checked-in demo.gb, U49845, and AF165912 fixtures without network access.

    #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

    For native coverage, run:

    moon test --target native --deny-warn --enable-coverage moon coverage report -f summary

    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.

    GenBankError

    pub(all) suberror GenBankError {
    MissingSection(String)
    InvalidLocus(String)
    InvalidLocation(String)
    InvalidNumber(String)
    } derive(Eq,
    Debug
    )

    GenBankError::message

    fn GenBankError::message(self : GenBankError) -> String

    Human-readable parse error message for CLIs and logs.

    AlignmentSummary

    pub struct AlignmentSummary {
    left_length : Int
    right_length : Int
    matches : Int
    mismatches : Int
    gaps : Int
    identity : Double
    edit_distance : Int
    } derive(Eq,
    Debug
    )

    AlignmentSummary::to_json_string

    fn AlignmentSummary::to_json_string(self : AlignmentSummary) -> String

    AnnotationSummary

    pub struct AnnotationSummary {
    feature_count : Int
    cds_count : Int
    gene_count : Int
    source_count : Int
    base_count : Int
    gc_percent : Double
    feature_keys : Array[String]
    qualifier_names : Array[String]
    } derive(Eq,
    Debug
    )

    A compact, deterministic annotation summary for dashboards and reports.

    AnnotationSummary::to_json_string

    fn AnnotationSummary::to_json_string(self : AnnotationSummary) -> String

    AssemblyResult

    pub struct AssemblyResult {
    sequence : String
    contig_count : Int
    merged_count : Int
    overlaps : Array[ContigOverlap]
    unresolved : Array[String]
    } derive(Eq,
    Debug
    )

    Result of a deterministic greedy contig merge.

    AssemblyResult::to_json_string

    fn AssemblyResult::to_json_string(self : AssemblyResult) -> String

    Export assembly diagnostics as JSON for pipeline artifacts.

    BatchQualityReport

    pub struct BatchQualityReport {
    record_count : Int
    valid_count : Int
    invalid_count : Int
    total_bases : Int
    mean_length : Double
    mean_gc : Double
    duplicate_accessions : Array[String]
    records_with_remote_locations : Int
    records_with_fuzzy_locations : Int
    records_with_translation_errors : Int
    } derive(Eq,
    Debug
    )

    Quality summary for a collection of parsed GenBank records.

    BatchQualityReport::to_json_string

    fn BatchQualityReport::to_json_string(self : BatchQualityReport) -> String

    BatchQualityReport::to_text

    fn BatchQualityReport::to_text(self : BatchQualityReport) -> String

    Return a stable report line useful for a CLI summary.

    BatchSummary

    pub struct BatchSummary {
    record_count : Int
    total_bases : Int
    total_features : Int
    total_cds : Int
    total_genes : Int
    valid_records : Int
    invalid_records : Int
    accessions : Array[String]
    } derive(Eq,
    Debug
    )

    Summary statistics for a batch of GenBank records.

    BatchSummary::to_json_string

    fn BatchSummary::to_json_string(self : BatchSummary) -> String

    BatchSummary::to_text

    fn BatchSummary::to_text(self : BatchSummary) -> String

    CdsTranslationResult

    pub struct CdsTranslationResult {
    feature_index : Int
    location : String
    nucleotide : String
    protein : String
    expected : String?
    matches_expected : Bool
    start_codon : String
    terminal_codon : String
    codon_count : Int
    } derive(Eq,
    Debug
    )

    Detailed CDS translation result with source coordinates.

    CdsTranslationResult::to_json_string

    fn CdsTranslationResult::to_json_string(self : CdsTranslationResult) -> String

    CodingSequenceReport

    pub struct CodingSequenceReport {
    nucleotide_length : Int
    complete_codons : Int
    trailing_bases : Int
    start_codons : Int
    stop_codons : Int
    ambiguous_codons : Int
    gc_first : Double
    gc_second : Double
    gc_third : Double
    usage : Array[CodonUsage]
    } derive(Eq,
    Debug
    )

    Aggregate coding-sequence statistics for reporting and QC.

    CodingSequenceReport::to_json_string

    fn CodingSequenceReport::to_json_string(self : CodingSequenceReport) -> String

    CodingSequenceReport::to_tsv

    fn CodingSequenceReport::to_tsv(self : CodingSequenceReport) -> String

    Emit a stable tabular codon report for downstream scripts.

    CodonTable

    pub enum CodonTable {
    Standard
    VertebrateMitochondrial
    } derive(Eq,
    Debug
    )

    Genetic-code presets supported by the translation helpers.

    CodonUsage

    pub struct CodonUsage {
    codon : String
    amino : String
    count : Int
    } derive(Eq,
    Debug
    )

    CodonUsage::to_json_string

    fn CodonUsage::to_json_string(self : CodonUsage) -> String

    CompositionReport

    pub struct CompositionReport {
    length : Int
    a : Int
    c : Int
    g : Int
    t : Int
    ambiguous : Int
    gc_percent : Double
    entropy : Double
    } derive(Eq,
    Debug
    )

    Composition and diversity statistics for a nucleotide sequence.

    CompositionReport::to_json_string

    fn CompositionReport::to_json_string(self : CompositionReport) -> String

    ContigOverlap

    pub struct ContigOverlap {
    left_index : Int
    right_index : Int
    overlap : Int
    merged_length : Int
    } derive(Eq,
    Debug
    )

    An overlap between the suffix of one contig and the prefix of another.

    CoordinateInterval

    pub struct CoordinateInterval {
    start : Int
    end : Int
    } derive(Eq,
    Debug
    )

    A normalized half-open interval used by coordinate set operations.

    CoordinateInterval::to_json_string

    fn CoordinateInterval::to_json_string(self : CoordinateInterval) -> String

    FastaIssue

    pub struct FastaIssue {
    id : String
    code : String
    message : String
    position : Int
    } derive(Eq,
    Debug
    )

    A validation finding tied to a FASTA record identifier.

    FastaIssue::to_text

    fn FastaIssue::to_text(self : FastaIssue) -> String

    FastaRecord

    pub struct FastaRecord {
    id : String
    description : String
    sequence : String
    } derive(Eq,
    Debug
    )

    A FASTA sequence with its identifier and optional description.

    FastaRecord::to_fasta

    fn FastaRecord::to_fasta(self : FastaRecord, line_width : Int) -> String

    FastaValidationReport

    pub struct FastaValidationReport {
    record_count : Int
    total_bases : Int
    duplicate_ids : Array[String]
    issues : Array[FastaIssue]
    valid : Bool
    } derive(Eq,
    Debug
    )

    A strict batch validation result for FASTA input.

    FastaValidationReport::to_json_string

    fn FastaValidationReport::to_json_string(self : FastaValidationReport) -> String

    Emit a compact validation report for logs and CI artifacts.

    Feature

    pub struct Feature {
    key : String
    location : Location
    qualifiers : Array[Qualifier]
    } derive(Eq,
    Debug
    )

    A feature-table entry such as source, gene, or CDS.

    Feature::overlaps

    fn Feature::overlaps(self : Feature, start : Int, end : Int) -> Bool

    True when any parsed range overlaps a 1-based inclusive query span.

    Feature::qualifier

    fn Feature::qualifier(self : Feature, name : String) -> String?

    Look up the first qualifier value by name.

    Feature::to_genbank_head

    fn Feature::to_genbank_head(self : Feature) -> String

    Feature::to_json_string

    fn Feature::to_json_string(self : Feature) -> String

    FeatureExtraction

    pub struct FeatureExtraction {
    index : Int
    key : String
    location : String
    sequence : String
    sequence_length : Int
    translation : String
    } derive(Eq,
    Debug
    )

    A compact result for a feature extraction workflow.

    FeatureExtraction::to_json_string

    fn FeatureExtraction::to_json_string(self : FeatureExtraction) -> String

    Return an extraction as JSON without requiring a JSON dependency.

    FeatureIndex

    pub struct FeatureIndex {
    record : Record
    entries : Array[FeatureIndexEntry]
    } derive(Eq,
    Debug
    )

    An immutable-style feature index built for repeated annotation queries.

    FeatureIndex::all

    FeatureIndex::at

    fn FeatureIndex::at(self : FeatureIndex, position : Int) -> Array[Feature]

    FeatureIndex::by_key

    fn FeatureIndex::by_key(self : FeatureIndex, key : String) -> Array[Feature]

    FeatureIndex::by_keys

    fn FeatureIndex::by_keys(self : FeatureIndex, keys : Array[String]) -> Array[Feature]

    FeatureIndex::by_qualifier

    fn FeatureIndex::by_qualifier(self : FeatureIndex, name : String, value : String) -> Array[Feature]

    FeatureIndex::contained_in

    fn FeatureIndex::contained_in(self : FeatureIndex, start : Int, end : Int) -> Array[Feature]

    FeatureIndex::count

    fn FeatureIndex::count(self : FeatureIndex) -> Int

    FeatureIndex::keys

    fn FeatureIndex::keys(self : FeatureIndex) -> Array[String]

    FeatureIndex::overlapping

    fn FeatureIndex::overlapping(self : FeatureIndex, start : Int, end : Int) -> Array[Feature]

    FeatureIndex::positions

    fn FeatureIndex::positions(self : FeatureIndex, key : String) -> Array[Int]

    FeatureIndex::qualifier_names

    fn FeatureIndex::qualifier_names(self : FeatureIndex) -> Array[String]

    FeatureIndex::summary_json

    fn FeatureIndex::summary_json(self : FeatureIndex) -> String

    FeatureIndex::with_qualifier

    fn FeatureIndex::with_qualifier(self : FeatureIndex, name : String) -> Array[Feature]

    FeatureIndexEntry

    type FeatureIndexEntry derive(Eq,
    Debug
    )

    FeatureKeySummary

    pub struct FeatureKeySummary {
    key : String
    count : Int
    total_bases : Int
    remote_count : Int
    fuzzy_count : Int
    qualifier_count : Int
    } derive(Eq,
    Debug
    )

    A key-level annotation summary used by dashboards and batch reports.

    FeatureKeySummary::to_json_string

    fn FeatureKeySummary::to_json_string(self : FeatureKeySummary) -> String

    FeatureProjection

    pub struct FeatureProjection {
    accession : String
    key : String
    start : Int
    end : Int
    strand : String
    name : String
    attributes : String
    } derive(Eq,
    Debug
    )

    A feature projection in BED/GFF-compatible coordinate conventions.

    FeatureProjection::to_json_string

    fn FeatureProjection::to_json_string(self : FeatureProjection) -> String

    Serialize a projection for APIs that do not need the full record model.

    FeatureTableRow

    pub struct FeatureTableRow {
    index : Int
    key : String
    start : Int
    end : Int
    length : Int
    strand : String
    remote : Bool
    fuzzy : Bool
    qualifier_count : Int
    label : String
    } derive(Eq,
    Debug
    )

    A flat row suitable for TSV export, spreadsheets, and lightweight UIs.

    FeatureTableRow::to_json_string

    fn FeatureTableRow::to_json_string(self : FeatureTableRow) -> String

    GlobalAlignment

    pub struct GlobalAlignment {
    left : String
    right : String
    score : Int
    matches : Int
    mismatches : Int
    gaps : Int
    identity : Double
    } derive(Eq,
    Debug
    )

    A global alignment with an explicit traceback, not only a distance score.

    GlobalAlignment::to_json_string

    fn GlobalAlignment::to_json_string(self : GlobalAlignment) -> String

    Export alignment metrics and strings for a JSON consumer.

    IntervalCoverage

    pub struct IntervalCoverage {
    intervals : Array[CoordinateInterval]
    covered_bases : Int
    minimum : Int
    maximum : Int
    gaps : Int
    } derive(Eq,
    Debug
    )

    Summary of interval union/intersection calculations.

    IntervalCoverage::to_json_string

    fn IntervalCoverage::to_json_string(self : IntervalCoverage) -> String

    KmerCount

    pub struct KmerCount {
    kmer : String
    count : Int
    } derive(Eq,
    Debug
    )

    One k-mer and its number of occurrences.

    Location

    pub struct Location {
    raw : String
    ranges : Array[Range]
    complement : Bool
    joined : Bool
    ordered : Bool
    segments : Array[LocationSegment]
    } derive(Eq,
    Debug
    )

    Location text is preserved exactly enough for round-trip inspection and exposes common numeric spans for simple queries.

    Location::to_json_string

    fn Location::to_json_string(self : Location) -> String

    LocationSegment

    pub struct LocationSegment {
    range : Range
    reverse : Bool
    remote : String?
    } derive(Eq,
    Debug
    )

    One ordered segment in a feature location expression.

    LocationSummary

    pub struct LocationSummary {
    raw : String
    minimum : Int
    maximum : Int
    length : Int
    segment_count : Int
    reverse_segments : Int
    remote_segments : Int
    fuzzy : Bool
    between : Bool
    } derive(Eq,
    Debug
    )

    A biological span with optional remote accession metadata.

    LocationSummary::to_json_string

    fn LocationSummary::to_json_string(self : LocationSummary) -> String

    Locus

    pub struct Locus {
    name : String
    length : Int
    molecule_type : String
    topology : String
    division : String
    date : String
    } derive(Eq,
    Debug
    )

    Information extracted from the LOCUS line.

    Locus::to_genbank_line

    fn Locus::to_genbank_line(self : Locus) -> String

    Locus::to_json_string

    fn Locus::to_json_string(self : Locus) -> String

    MotifHit

    pub struct MotifHit {
    motif : String
    start : Int
    end : Int
    strand : String
    matched : String
    } derive(Eq,
    Debug
    )

    An occurrence of an IUPAC motif in a nucleotide sequence.

    MotifHit::to_json_string

    fn MotifHit::to_json_string(self : MotifHit) -> String

    MotifScanReport

    pub struct MotifScanReport {
    motif : String
    sequence_length : Int
    forward_hits : Int
    reverse_hits : Int
    hits : Array[MotifHit]
    } derive(Eq,
    Debug
    )

    Summary of a forward and reverse-complement motif scan.

    MotifScanReport::to_json_string

    fn MotifScanReport::to_json_string(self : MotifScanReport) -> String

    OpenReadingFrame

    pub struct OpenReadingFrame {
    start : Int
    end : Int
    frame : Int
    protein : String
    nucleotide_length : Int
    } derive(Eq,
    Debug
    )

    OpenReadingFrame::to_json_string

    fn OpenReadingFrame::to_json_string(self : OpenReadingFrame) -> String

    Qualifier

    pub struct Qualifier {
    name : String
    value : String?
    } derive(Eq,
    Debug
    )

    A slash-prefixed feature qualifier such as /gene="lacZ".

    Qualifier::to_genbank_lines

    fn Qualifier::to_genbank_lines(self : Qualifier, line_width? : Int) -> Array[String]

    QualifierMatch

    pub struct QualifierMatch {
    feature_key : String
    qualifier_name : String
    value : String
    feature_start : Int
    feature_end : Int
    } derive(Eq,
    Debug
    )

    A normalized qualifier lookup result.

    QualifierMatch::to_json_string

    fn QualifierMatch::to_json_string(self : QualifierMatch) -> String

    Range

    pub struct Range {
    start : Int
    end : Int
    partial_start : Bool
    partial_end : Bool
    between : Bool
    } derive(Eq,
    Debug
    )

    A 1-based inclusive interval from a GenBank feature location.

    Record

    pub struct Record {
    accession : String
    version : String
    locus : Locus
    definition : String
    keywords : String
    source : String
    features : Array[Feature]
    origin : String
    } derive(Eq,
    Debug
    )

    Parsed representation of a GenBank or INSDC flat-file record.

    Record::check_cds_translations

    fn Record::check_cds_translations(self : Record) -> Array[TranslationCheck]

    Validate every CDS feature that provides a /translation qualifier.

    Record::features_by_key

    fn Record::features_by_key(self : Record, key : String) -> Array[Feature]

    Find all features with a matching key.

    Record::features_with_qualifier

    fn Record::features_with_qualifier(self : Record, name : String) -> Array[Feature]

    Return all features that carry a named qualifier.

    Record::sequence_for

    fn Record::sequence_for(self : Record, feature : Feature) -> String

    Extract and orient feature sequence from the parsed ORIGIN.

    Record::sequence_stats

    fn Record::sequence_stats(self : Record) -> SequenceStats

    Count normalized bases in the ORIGIN sequence.

    Record::to_genbank_string

    fn Record::to_genbank_string(self : Record, line_width? : Int) -> String

    Render a record as a canonical GenBank flat-file document.

    Record::to_json_string

    fn Record::to_json_string(self : Record) -> String

    Export a parsed record as compact JSON.

    Record::validate

    fn Record::validate(self : Record) -> Array[ValidationIssue]

    Audit structural invariants that can be checked without network access.

    RecordCollection

    pub struct RecordCollection {
    records : Array[Record]
    source_name : String
    } derive(Eq,
    Debug
    )

    A reusable collection wrapper for multi-record workflows.

    RecordCollection::accessions

    fn RecordCollection::accessions(self : RecordCollection) -> Array[String]

    RecordCollection::all_feature_keys

    fn RecordCollection::all_feature_keys(self : RecordCollection) -> Array[String]

    RecordCollection::at

    fn RecordCollection::at(self : RecordCollection, index : Int) -> Record?

    RecordCollection::between_locations

    fn RecordCollection::between_locations(self : RecordCollection) -> Int

    RecordCollection::count

    fn RecordCollection::count(self : RecordCollection) -> Int

    RecordCollection::definitions

    fn RecordCollection::definitions(self : RecordCollection) -> Array[String]

    RecordCollection::feature_density

    fn RecordCollection::feature_density(self : RecordCollection) -> Double

    RecordCollection::filter_accession

    fn RecordCollection::filter_accession(self : RecordCollection, prefix : String) -> RecordCollection

    RecordCollection::filter_definition

    fn RecordCollection::filter_definition(self : RecordCollection, text : String) -> RecordCollection

    RecordCollection::filter_valid

    RecordCollection::fuzzy_locations

    fn RecordCollection::fuzzy_locations(self : RecordCollection) -> Int

    RecordCollection::gc

    fn RecordCollection::gc(self : RecordCollection) -> Double

    RecordCollection::invalid_count

    fn RecordCollection::invalid_count(self : RecordCollection) -> Int

    RecordCollection::map_normalized

    fn RecordCollection::map_normalized(self : RecordCollection) -> RecordCollection

    RecordCollection::records

    RecordCollection::records_with_feature

    fn RecordCollection::records_with_feature(self : RecordCollection, key : String) -> RecordCollection

    RecordCollection::remote_locations

    fn RecordCollection::remote_locations(self : RecordCollection) -> Int

    RecordCollection::reports

    fn RecordCollection::reports(self : RecordCollection) -> Array[String]

    RecordCollection::sequence_signatures

    fn RecordCollection::sequence_signatures(self : RecordCollection) -> Array[String]

    RecordCollection::source_name

    fn RecordCollection::source_name(self : RecordCollection) -> String

    RecordCollection::summary

    RecordCollection::to_fasta_string

    fn RecordCollection::to_fasta_string(self : RecordCollection) -> String

    RecordCollection::to_genbank_string

    fn RecordCollection::to_genbank_string(self : RecordCollection) -> String

    RecordCollection::total_bases

    fn RecordCollection::total_bases(self : RecordCollection) -> Int

    RecordCollection::total_cds

    fn RecordCollection::total_cds(self : RecordCollection) -> Int

    RecordCollection::total_features

    fn RecordCollection::total_features(self : RecordCollection) -> Int

    RecordCollection::total_genes

    fn RecordCollection::total_genes(self : RecordCollection) -> Int

    RecordCollection::valid_count

    fn RecordCollection::valid_count(self : RecordCollection) -> Int

    RecordCollection::validation_reports

    fn RecordCollection::validation_reports(self : RecordCollection) -> Array[ValidationReport]

    RecordDiff

    pub struct RecordDiff {
    accession_changed : Bool
    definition_changed : Bool
    sequence_changed : Bool
    length_delta : Int
    feature_count_left : Int
    feature_count_right : Int
    added_features : Int
    removed_features : Int
    changed_features : Int
    qualifier_changes : Int
    identical : Bool
    } derive(Eq,
    Debug
    )

    A deterministic comparison between two parsed records.

    RecordDiff::to_json_string

    fn RecordDiff::to_json_string(self : RecordDiff) -> String

    RecordDiff::to_text

    fn RecordDiff::to_text(self : RecordDiff) -> String

    Produce an actionable human-readable comparison.

    RecordMetrics

    pub struct RecordMetrics {
    accession : String
    length : Int
    gc_percent : Double
    entropy : Double
    feature_count : Int
    feature_coverage : Int
    feature_coverage_percent : Double
    cds_count : Int
    gene_count : Int
    translation_count : Int
    remote_locations : Int
    fuzzy_locations : Int
    between_locations : Int
    validation_errors : Int
    validation_warnings : Int
    } derive(Eq,
    Debug
    )

    A compact metrics snapshot used by CLI and batch reporting.

    RecordMetrics::to_json_string

    fn RecordMetrics::to_json_string(self : RecordMetrics) -> String

    RecordMetrics::to_text

    fn RecordMetrics::to_text(self : RecordMetrics) -> String

    SequenceAnalysis

    pub struct SequenceAnalysis {
    sequence : String
    length : Int
    windows : Array[SequenceWindow]
    composition : CompositionReport
    gc_skew : Int
    longest_run : Int
    motifs : Array[String]
    } derive(Eq,
    Debug
    )

    A complete sequence analysis result suitable for a report or dashboard.

    SequenceAnalysis::to_json_string

    fn SequenceAnalysis::to_json_string(self : SequenceAnalysis) -> String

    SequenceInterval

    pub struct SequenceInterval {
    start : Int
    end : Int
    sequence : String
    } derive(Eq,
    Debug
    )

    A normalized interval used by trimming and masking workflows.

    SequenceProfile

    pub struct SequenceProfile {
    start : Int
    end : Int
    length : Int
    gc_percent : Double
    ambiguous : Int
    entropy : Double
    motif_hits : Int
    } derive(Eq,
    Debug
    )

    Composition metrics for one coordinate window.

    SequenceProfile::to_json_string

    fn SequenceProfile::to_json_string(self : SequenceProfile) -> String

    SequenceQualityReport

    pub struct SequenceQualityReport {
    sequence_length : Int
    canonical_bases : Int
    ambiguous_bases : Int
    invalid_bases : Int
    gc_percent : Double
    longest_run : Int
    run_count : Int
    has_internal_gap : Bool
    valid : Bool
    } derive(Eq,
    Debug
    )

    Quality and composition findings for a sequence supplied by a caller.

    SequenceQualityReport::to_json_string

    fn SequenceQualityReport::to_json_string(self : SequenceQualityReport) -> String

    Render a compact machine-readable quality report.

    SequenceRun

    pub struct SequenceRun {
    base : Char
    start : Int
    end : Int
    length : Int
    } derive(Eq,
    Debug
    )

    SequenceRun::to_text

    fn SequenceRun::to_text(self : SequenceRun) -> String

    SequenceStats

    pub struct SequenceStats {
    length : Int
    a : Int
    c : Int
    g : Int
    t : Int
    n : Int
    gc_percent : Double
    } derive(Eq,
    Debug
    )

    SequenceStats::to_json_string

    fn SequenceStats::to_json_string(self : SequenceStats) -> String

    SequenceWindow

    pub struct SequenceWindow {
    start : Int
    end : Int
    sequence : String
    gc_percent : Double
    } derive(Eq,
    Debug
    )

    A sequence window and coordinates in the original sequence.

    TranslationAuditSummary

    pub struct TranslationAuditSummary {
    accession : String
    cds_count : Int
    checked_count : Int
    passed_count : Int
    failed_count : Int
    missing_translation_count : Int
    total_nucleotide_bases : Int
    } derive(Eq,
    Debug
    )

    Aggregate result for CDS translation validation in a single record.

    TranslationAuditSummary::to_json_string

    fn TranslationAuditSummary::to_json_string(self : TranslationAuditSummary) -> String

    TranslationAuditSummary::to_tsv

    Render one row per CDS for human review and spreadsheet import.

    TranslationCheck

    pub struct TranslationCheck {
    feature_index : Int
    location : String
    expected : String
    actual : String
    ok : Bool
    } derive(Eq,
    Debug
    )

    CDS validation status for /translation qualifiers.

    TranslationReport

    pub struct TranslationReport {
    protein : String
    codons : Int
    stops : Int
    ambiguous : Int
    trailing_bases : Int
    } derive(Eq,
    Debug
    )

    Translation details useful for validation reports.

    TranslationReport::to_json_string

    fn TranslationReport::to_json_string(self : TranslationReport) -> String

    ValidationIssue

    pub struct ValidationIssue {
    code : String
    message : String
    severity : ValidationSeverity
    } derive(Eq,
    Debug
    )

    A deterministic audit finding for a parsed record.

    ValidationIssue::is_error

    fn ValidationIssue::is_error(self : ValidationIssue) -> Bool

    True when an audit finding is an error rather than an advisory warning.

    ValidationIssue::to_json_string

    fn ValidationIssue::to_json_string(self : ValidationIssue) -> String

    Render an audit finding for CLI and JSON consumers.

    ValidationReport

    pub struct ValidationReport {
    ok : Bool
    error_count : Int
    warning_count : Int
    issues : Array[ValidationIssue]
    accession : String
    sequence_length : Int
    feature_count : Int
    } derive(Eq,
    Debug
    )

    A validation result grouped for human and machine consumers.

    ValidationReport::to_json_string

    fn ValidationReport::to_json_string(self : ValidationReport) -> String

    ValidationReport::to_text

    fn ValidationReport::to_text(self : ValidationReport) -> String

    ValidationSeverity

    pub enum ValidationSeverity {
    Error
    Warning
    } derive(Eq,
    Debug
    )

    Severity of a structural record audit finding.

    align_sequences

    fn align_sequences(left : String, right : String) -> GlobalAlignment

    Use conventional scoring for quick pairwise comparisons.

    aligned_iupac_consensus

    fn aligned_iupac_consensus(sequences : Array[String]) -> String

    Derive a position-wise IUPAC consensus from aligned sequences.

    alignment_display

    fn alignment_display(alignment : GlobalAlignment) -> String

    Convert an alignment to a three-line display with a match marker row.

    alignment_operations

    fn alignment_operations(alignment : GlobalAlignment) -> String

    Return a CIGAR-like operation string (M, X, and -).

    ambiguous_base_positions

    fn ambiguous_base_positions(sequence : String) -> Array[Int]

    Return one-based positions of IUPAC ambiguity symbols.

    ambiguous_codon_count

    fn ambiguous_codon_count(sequence : String, table : CodonTable) -> Int

    analyze_sequence

    fn analyze_sequence(sequence : String, window_size : Int, step : Int) -> SequenceAnalysis

    annotation_summary

    fn annotation_summary(record : Record) -> AnnotationSummary

    assembly_contig_lengths

    fn assembly_contig_lengths(result : AssemblyResult) -> Array[Int]

    Return a stable length vector for assembled contigs.

    assembly_to_fasta

    fn assembly_to_fasta(result : AssemblyResult, id : String) -> String

    Format an assembly as a FASTA record for downstream tools.

    base_frequencies

    fn base_frequencies(sequence : String) -> Array[(Char, Int)]

    base_profile

    fn base_profile(sequence : String, base : Char, window_size : Int) -> Array[Int]

    batch_checked_translation_count

    fn batch_checked_translation_count(records : Array[Record]) -> Int

    Count all CDS features with a supplied translation in a batch.

    batch_coding_bases

    fn batch_coding_bases(records : Array[Record]) -> Int

    Return the total amount of nucleotide material represented by CDS checks.

    batch_failed_translation_count

    fn batch_failed_translation_count(records : Array[Record]) -> Int

    Count all failed CDS translation checks in a batch.

    batch_metric_invalid

    fn batch_metric_invalid(records : Array[Record]) -> Int

    batch_metric_max_length

    fn batch_metric_max_length(records : Array[Record]) -> Int

    batch_metric_mean_gc

    fn batch_metric_mean_gc(records : Array[Record]) -> Double

    batch_metric_mean_length

    fn batch_metric_mean_length(records : Array[Record]) -> Double

    batch_metric_min_length

    fn batch_metric_min_length(records : Array[Record]) -> Int

    batch_metric_report

    fn batch_metric_report(records : Array[Record]) -> String

    batch_metric_total_cds

    fn batch_metric_total_cds(records : Array[Record]) -> Int

    batch_metric_total_features

    fn batch_metric_total_features(records : Array[Record]) -> Int

    batch_metric_total_genes

    fn batch_metric_total_genes(records : Array[Record]) -> Int

    batch_metric_valid

    fn batch_metric_valid(records : Array[Record]) -> Int

    batch_metrics

    fn batch_metrics(records : Array[Record]) -> Array[RecordMetrics]

    batch_metrics_json

    fn batch_metrics_json(records : Array[Record]) -> String

    batch_quality

    fn batch_quality(records : Array[Record]) -> BatchQualityReport

    Build a batch report without mutating or reparsing records.

    batch_quality_from_text

    fn batch_quality_from_text(text : String) -> BatchQualityReport raise GenBankError

    Parse and assess a multi-record stream in one operation.

    batch_translation_audits

    fn batch_translation_audits(records : Array[Record]) -> Array[TranslationAuditSummary]

    Summarize translation checks across a multi-record batch.

    batch_translation_status

    fn batch_translation_status(records : Array[Record]) -> String

    Return a compact batch status string for monitoring jobs.

    best_alignments

    fn best_alignments(query : String, candidates : Array[String]) -> Array[GlobalAlignment]

    Compare a sequence against many candidates and retain their best scores.

    best_contig_overlap

    fn best_contig_overlap(contigs : Array[String], minimum : Int) -> ContigOverlap?

    Compare every ordered contig pair and choose the strongest available join.

    build_feature_index

    fn build_feature_index(record : Record) -> FeatureIndex

    build_validation_report

    fn build_validation_report(record : Record) -> ValidationReport

    cds_complete

    fn cds_complete(record : Record, feature : Feature) -> Bool

    cds_frame_length

    fn cds_frame_length(record : Record, feature : Feature) -> Int

    cds_in_frame

    fn cds_in_frame(record : Record, feature : Feature) -> Bool

    cds_nucleotide_lengths

    fn cds_nucleotide_lengths(record : Record) -> Array[Int]

    cds_partial

    fn cds_partial(record : Record, feature : Feature) -> Bool

    cds_protein_lengths

    fn cds_protein_lengths(record : Record) -> Array[Int]

    cds_start_codons

    fn cds_start_codons(record : Record) -> Array[String]

    cds_terminal_codons

    fn cds_terminal_codons(record : Record) -> Array[String]

    cds_translation_error_count

    fn cds_translation_error_count(record : Record) -> Int

    cds_translation_json

    fn cds_translation_json(record : Record) -> String

    cds_translation_matches

    fn cds_translation_matches(record : Record) -> Array[CdsTranslationResult]

    cds_translation_mismatches

    fn cds_translation_mismatches(record : Record) -> Array[CdsTranslationResult]

    cds_translation_ok

    fn cds_translation_ok(record : Record) -> Bool

    cds_translation_results

    fn cds_translation_results(record : Record) -> Array[CdsTranslationResult]

    cds_translation_summary

    fn cds_translation_summary(record : Record) -> String

    cds_with_start_codon

    fn cds_with_start_codon(record : Record, codon : String) -> Array[Feature]

    cds_with_stop_codon

    fn cds_with_stop_codon(record : Record, codon : String) -> Array[Feature]

    change_points

    fn change_points(sequence : String) -> Array[Int]

    Return all positions where a sequence changes base.

    clean_records

    fn clean_records(records : Array[Record]) -> Array[Record]

    Return records that pass structural validation and CDS translation checks.

    coding_sequence_report

    fn coding_sequence_report(sequence : String, table : CodonTable) -> CodingSequenceReport

    Calculate codon-position GC and translation diagnostics.

    codon_amino

    fn codon_amino(table : CodonTable, codon : String) -> String

    codon_frequency_by_amino

    fn codon_frequency_by_amino(sequence : String, table : CodonTable) -> Array[(String, Int)]

    codon_usage

    fn codon_usage(sequence : String, table : CodonTable) -> Array[CodonUsage]

    Count complete codons in first-seen order.

    codon_usage_frequencies

    fn codon_usage_frequencies(sequence : String, table : CodonTable) -> Array[(String, Double)]

    Calculate the proportion of each codon among complete codons.

    codon_usage_ranked

    fn codon_usage_ranked(sequence : String, table : CodonTable) -> Array[CodonUsage]

    Return codons sorted by descending usage, preserving first-seen ties.

    codon_usage_total

    fn codon_usage_total(items : Array[CodonUsage]) -> Int

    collection_fasta

    fn collection_fasta(text : String) -> String raise GenBankError

    collection_from_records

    fn collection_from_records(records : Array[Record], source_name? : String) -> RecordCollection

    collection_json

    fn collection_json(text : String) -> String raise GenBankError

    common_dna_motifs

    fn common_dna_motifs(sequence : String) -> Array[String]

    compare_records

    fn compare_records(left : Record, right : Record) -> RecordDiff

    Compare records using normalized sequence and feature signatures.

    composition_report

    fn composition_report(sequence : String) -> CompositionReport

    Compute composition and Shannon entropy using canonical base frequencies.

    consensus_sequence

    fn consensus_sequence(sequences : Array[String]) -> String

    Build a majority consensus; ties and absent positions become N.

    coordinate_coverage

    fn coordinate_coverage(intervals : Array[CoordinateInterval]) -> Int

    Calculate the number of bases covered by a coordinate set.

    coordinate_mask

    fn coordinate_mask(intervals : Array[CoordinateInterval], sequence_length : Int) -> Array[Bool]

    Return a boolean mask indexed by one-based sequence coordinates.

    count_base

    fn count_base(sequence : String, base : Char) -> Int

    count_not_in

    fn count_not_in(left : Array[String], right : Array[String]) -> Int

    Count signatures that occur in the left array but not the right array.

    distinct_codon_count

    fn distinct_codon_count(sequence : String, table : CodonTable) -> Int

    Calculate the effective number of distinct codons in a sequence.

    dna_sequence

    fn dna_sequence(sequence : String) -> String

    extract_cds

    fn extract_cds(record : Record) -> Array[FeatureExtraction]

    Extract all CDS sequences and orient joined/complement locations correctly.

    extract_features

    fn extract_features(record : Record, key : String) -> Array[FeatureExtraction]

    Extract feature sequences while retaining enough context for audit logs.

    failed_translation_checks_tsv

    fn failed_translation_checks_tsv(record : Record) -> String

    Render only failed translation checks, making review output concise.

    fasta_length_histogram

    fn fasta_length_histogram(records : Array[FastaRecord], bin_width : Int) -> Array[(Int, Int)]

    Compute a length histogram using inclusive bins.

    feature_at_coordinate

    fn feature_at_coordinate(record : Record, coordinate : Int) -> Array[FeatureTableRow]

    Locate the first feature covering a one-based sequence coordinate.

    feature_coverage

    fn feature_coverage(record : Record) -> Int

    feature_coverage_percent

    fn feature_coverage_percent(record : Record) -> Double

    feature_density

    fn feature_density(record : Record) -> Double

    feature_end

    fn feature_end(feature : Feature) -> Int

    feature_extractions_json

    fn feature_extractions_json(record : Record, key : String) -> String

    Export extracted features as a line-oriented JSON document.

    feature_gene_name

    fn feature_gene_name(feature : Feature) -> String?

    feature_has_fuzzy_location

    fn feature_has_fuzzy_location(feature : Feature) -> Bool

    feature_has_remote_location

    fn feature_has_remote_location(feature : Feature) -> Bool

    feature_has_translation

    fn feature_has_translation(feature : Feature) -> Bool

    feature_is_cds

    fn feature_is_cds(feature : Feature) -> Bool

    feature_is_empty

    fn feature_is_empty(feature : Feature) -> Bool

    feature_is_gene

    fn feature_is_gene(feature : Feature) -> Bool

    feature_is_source

    fn feature_is_source(feature : Feature) -> Bool

    feature_key_counts

    fn feature_key_counts(record : Record) -> Array[(String, Int)]

    feature_key_coverage

    fn feature_key_coverage(record : Record, key : String) -> Double

    Return the percentage of a record covered by features of one key.

    feature_key_summary

    fn feature_key_summary(record : Record) -> Array[FeatureKeySummary]

    Summarize all features by key in first-seen order.

    feature_key_summary_tsv

    fn feature_key_summary_tsv(record : Record) -> String

    Export key summaries as stable TSV for command-line data processing.

    feature_length

    fn feature_length(feature : Feature) -> Int

    feature_note_values

    fn feature_note_values(feature : Feature) -> Array[String]

    feature_overlaps_any

    fn feature_overlaps_any(features : Array[Feature], start : Int, end : Int) -> Array[Feature]

    feature_product_name

    fn feature_product_name(feature : Feature) -> String?

    feature_qualifier_count

    fn feature_qualifier_count(feature : Feature) -> Int

    feature_qualifier_counts

    fn feature_qualifier_counts(record : Record) -> Array[(String, Int)]

    feature_qualifier_names

    fn feature_qualifier_names(feature : Feature) -> Array[String]

    feature_qualifier_values

    fn feature_qualifier_values(features : Array[Feature], qualifier_name : String) -> Array[String]

    fn feature_search(record : Record, text : String) -> Array[Feature]

    feature_sequence_lengths

    fn feature_sequence_lengths(record : Record) -> Array[(String, Int)]

    Return all features with their local sequence length, preserving order.

    feature_signatures

    fn feature_signatures(record : Record) -> Array[String]

    Build a signature that includes key, location, and all qualifier values.

    feature_span

    fn feature_span(feature : Feature) -> Int

    feature_start

    fn feature_start(feature : Feature) -> Int

    feature_summary_text

    fn feature_summary_text(feature : Feature) -> String

    feature_table

    fn feature_table(record : Record) -> Array[FeatureTableRow]

    Build rows in source order; source order is preserved for reproducible CSV.

    feature_table_by_key

    fn feature_table_by_key(record : Record, key : String) -> Array[FeatureTableRow]

    Select rows by key without rebuilding the complete feature index.

    feature_table_row

    fn feature_table_row(index : Int, feature : Feature) -> FeatureTableRow

    Convert a parsed feature to a stable tabular record.

    feature_table_tsv

    fn feature_table_tsv(record : Record) -> String

    Export feature rows as RFC-style tab-separated text with a header.

    features_in_length_range

    fn features_in_length_range(record : Record, minimum : Int, maximum : Int) -> Array[FeatureTableRow]

    Return feature rows with a location length in the inclusive range.

    features_with_location_property

    fn features_with_location_property(features : Array[Feature], include_remote : Bool, include_fuzzy : Bool) -> Array[Feature]

    features_with_qualifier_text

    fn features_with_qualifier_text(record : Record, name : String, needle : String) -> Array[Feature]

    Find features whose qualifier contains a case-insensitive search term.

    features_with_strand

    fn features_with_strand(features : Array[Feature], reverse : Bool) -> Array[Feature]

    find_motif_positions

    fn find_motif_positions(sequence : String, motif : String) -> Array[Int]

    Find every overlapping occurrence of a motif, using zero-based positions.

    find_orfs

    fn find_orfs(sequence : String, minimum_codons : Int, maximum_bases : Int, table : CodonTable) -> Array[OpenReadingFrame]

    Find start-to-stop ORFs in all three forward reading frames.

    find_qualifier_matches

    fn find_qualifier_matches(record : Record, name : String) -> Array[QualifierMatch]

    find_qualifier_value_matches

    fn find_qualifier_value_matches(record : Record, name : String, value : String) -> Array[QualifierMatch]

    first_feature_by_key

    fn first_feature_by_key(record : Record, key : String) -> Feature?

    format_fasta_records

    fn format_fasta_records(records : Array[FastaRecord], line_width : Int) -> String

    Render a FASTA batch with explicit wrapping and normalized bases.

    gap_count

    fn gap_count(sequence : String) -> Int

    gc_profile

    fn gc_profile(sequence : String, window_size : Int) -> Array[Double]

    gc_skew_profile

    fn gc_skew_profile(sequence : String, window_size : Int) -> Array[Int]

    gc_skew_windows

    fn gc_skew_windows(sequence : String, window_size : Int, step : Int) -> Array[(Int, Int, Double)]

    Produce non-overlapping windows containing GC skew (G-C)/(G+C).

    genbank_round_trip

    fn genbank_round_trip(text : String) -> String raise GenBankError

    gene_summary_json

    fn gene_summary_json(record : Record) -> String

    global_align

    fn global_align(left : String, right : String, match_score : Int, mismatch_score : Int, gap_score : Int) -> GlobalAlignment

    Align two sequences with a deterministic Needleman-Wunsch implementation.

    greedy_assemble

    fn greedy_assemble(contigs : Array[String], minimum_overlap : Int) -> AssemblyResult

    Greedily merge the strongest suffix/prefix join until no join remains.

    hamming_distance

    fn hamming_distance(left : String, right : String) -> Int

    Hamming distance, or -1 when strings have different lengths.

    has_motif

    fn has_motif(sequence : String, motif : String) -> Bool

    highest_gc_profile

    fn highest_gc_profile(profiles : Array[SequenceProfile]) -> SequenceProfile?

    Return the window with the highest GC percentage, if one exists.

    homopolymer_runs

    fn homopolymer_runs(sequence : String, minimum_length : Int) -> Array[SequenceRun]

    Find every homopolymer run of at least minimum_length.

    intersect_coordinate_intervals

    fn intersect_coordinate_intervals(left : Array[CoordinateInterval], right : Array[CoordinateInterval]) -> Array[CoordinateInterval]

    Calculate the intersection of two coordinate sets.

    interval_contains

    fn interval_contains(outer : CoordinateInterval, inner : CoordinateInterval) -> Bool

    Determine whether an interval is wholly contained in another interval.

    interval_coverage

    fn interval_coverage(intervals : Array[CoordinateInterval]) -> IntervalCoverage

    Build a coverage report including unannotated gaps in the enclosing span.

    intervals_to_text

    fn intervals_to_text(intervals : Array[CoordinateInterval]) -> String

    Render interval sets as start..end values for logs and reports.

    invalid_base_positions

    fn invalid_base_positions(sequence : String) -> Array[Int]

    Return positions of symbols that are not valid IUPAC nucleotides.

    is_iupac_base

    fn is_iupac_base(ch : Char) -> Bool

    Whether a character is one of the 15 standard IUPAC nucleotide symbols.

    is_palindromic_motif

    fn is_palindromic_motif(motif : String) -> Bool

    is_valid_dna

    fn is_valid_dna(sequence : String) -> Bool

    iupac_consensus

    fn iupac_consensus(observed : Array[Char]) -> Char

    Build a consensus IUPAC symbol for a set of observed canonical bases.

    iupac_expansion

    fn iupac_expansion(ch : Char) -> Array[Char]

    Expand an IUPAC code to sorted canonical bases.

    iupac_motif_count

    fn iupac_motif_count(sequence : String, motif : String) -> Int

    Count overlapping IUPAC motif occurrences.

    iupac_motif_matches_at

    fn iupac_motif_matches_at(sequence : String, motif : String, offset : Int) -> Bool

    Match one IUPAC motif at a zero-based sequence offset.

    iupac_motif_positions

    fn iupac_motif_positions(sequence : String, motif : String) -> Array[Int]

    Return only one-based coordinates for a strand-specific scan.

    join_sequences

    fn join_sequences(sequences : Array[String]) -> String

    kmer_profile

    fn kmer_profile(sequence : String, k : Int) -> Array[KmerCount]

    Count k-mers in first-seen order, making reports stable across targets.

    local_features_fit_origin

    fn local_features_fit_origin(record : Record) -> Bool

    Check whether every local feature lies inside the declared ORIGIN length.

    location_between_ranges

    fn location_between_ranges(location : Location) -> Array[Range]

    location_contains

    fn location_contains(location : Location, position : Int) -> Bool

    location_coordinates

    fn location_coordinates(location : Location) -> Array[Int]

    Emit each coordinate in biological order, reversing complemented segments.

    location_distance

    fn location_distance(left : Location, right : Location) -> Int?

    location_forward_coordinates

    fn location_forward_coordinates(location : Location) -> Array[Int]

    location_has_overlap

    fn location_has_overlap(left : Location, right : Location) -> Bool

    location_intervals

    fn location_intervals(location : Location) -> Array[CoordinateInterval]

    Convert a location into sorted, valid inclusive coordinate intervals.

    location_is_complemented

    fn location_is_complemented(location : Location) -> Bool

    location_is_fuzzy

    fn location_is_fuzzy(location : Location) -> Bool

    location_is_joined

    fn location_is_joined(location : Location) -> Bool

    location_is_ordered

    fn location_is_ordered(location : Location) -> Bool

    location_is_remote

    fn location_is_remote(location : Location) -> Bool

    location_is_single_range

    fn location_is_single_range(location : Location) -> Bool

    location_length

    fn location_length(location : Location) -> Int

    location_minimum

    fn location_minimum(location : Location) -> Int

    location_overlap_length

    fn location_overlap_length(left : Location, right : Location) -> Int

    Calculate the number of shared bases between two locations.

    location_partial_ranges

    fn location_partial_ranges(location : Location) -> Array[Range]

    location_range_text

    fn location_range_text(range : Range) -> String

    location_ranges_text

    fn location_ranges_text(location : Location) -> Array[String]

    location_remote_accessions

    fn location_remote_accessions(location : Location) -> Array[String]

    location_segments

    fn location_segments(location : Location) -> Array[Range]

    location_span

    fn location_span(location : Location) -> Int

    location_summary_text

    fn location_summary_text(location : Location) -> String

    location_unique_coordinates

    fn location_unique_coordinates(location : Location) -> Array[Int]

    longest_fasta_record

    fn longest_fasta_record(records : Array[FastaRecord]) -> FastaRecord?

    Return the longest sequence in a FASTA batch.

    longest_homopolymer

    fn longest_homopolymer(sequence : String) -> Int

    Return the length of the longest run of the same base.

    longest_sequence_run

    fn longest_sequence_run(sequence : String) -> SequenceRun?

    longest_translation

    fn longest_translation(record : Record) -> String?

    mask_ambiguities

    fn mask_ambiguities(sequence : String) -> String

    Mask ambiguity symbols to N while retaining gaps and their coordinates.

    mask_ambiguous

    fn mask_ambiguous(sequence : String) -> String

    mask_to_intervals

    fn mask_to_intervals(mask : Array[Bool]) -> Array[CoordinateInterval]

    Convert a mask back into maximal inclusive intervals.

    merge_coordinate_intervals

    fn merge_coordinate_intervals(intervals : Array[CoordinateInterval]) -> Array[CoordinateInterval]

    Merge touching and overlapping intervals into a minimal union.

    metric_between_count

    fn metric_between_count(record : Record) -> Int

    metric_cds_count

    fn metric_cds_count(record : Record) -> Int

    metric_coverage

    fn metric_coverage(record : Record) -> Int

    metric_coverage_percent

    fn metric_coverage_percent(record : Record) -> Double

    metric_entropy

    fn metric_entropy(record : Record) -> Double

    metric_error_count

    fn metric_error_count(record : Record) -> Int

    metric_feature_count

    fn metric_feature_count(record : Record) -> Int

    metric_fuzzy_count

    fn metric_fuzzy_count(record : Record) -> Int

    metric_gc

    fn metric_gc(record : Record) -> Double

    metric_gene_count

    fn metric_gene_count(record : Record) -> Int

    metric_length

    fn metric_length(record : Record) -> Int

    metric_remote_count

    fn metric_remote_count(record : Record) -> Int

    metric_warning_count

    fn metric_warning_count(record : Record) -> Int

    most_ambiguous_profile

    fn most_ambiguous_profile(profiles : Array[SequenceProfile]) -> SequenceProfile?

    Return the window with the greatest ambiguity burden.

    motif_count

    fn motif_count(sequence : String, motif : String) -> Int

    motif_density

    fn motif_density(sequence : String, motif : String) -> Double

    normalize_genbank_text

    fn normalize_genbank_text(text : String) -> String

    Normalize line endings and ensure a final GenBank terminator.

    normalize_record

    fn normalize_record(record : Record) -> Record

    normalize_sequence

    fn normalize_sequence(text : String) -> String

    Remove formatting characters and normalize a sequence to uppercase.

    normalize_spaces

    fn normalize_spaces(text : String) -> String

    nucleotide_length

    fn nucleotide_length(sequence : String) -> Int

    pad_sequence

    fn pad_sequence(sequence : String, length : Int, base : Char) -> String

    parse_fasta

    fn parse_fasta(text : String) -> Array[FastaRecord] raise GenBankError

    Parse FASTA records while preserving the first-line description.

    parse_fasta_strict

    fn parse_fasta_strict(text : String) -> Array[FastaRecord] raise GenBankError

    Parse FASTA and reject missing identifiers, duplicate identifiers, and symbols outside the IUPAC alphabet instead of silently dropping them.

    parse_location

    fn parse_location(text : String) -> Location raise GenBankError

    Parse a GenBank location expression into ordered, strand-aware segments.

    parse_locus

    fn parse_locus(line : String) -> Locus raise GenBankError

    Parse the LOCUS line into its stable fields.

    parse_record

    fn parse_record(text : String) -> Record raise GenBankError

    Parse one GenBank/INSDC flat-file record.

    parse_record_collection

    fn parse_record_collection(text : String, source_name? : String) -> RecordCollection raise GenBankError

    parse_records

    fn parse_records(text : String) -> Array[Record] raise GenBankError

    Parse all records in a GenBank flat-file stream separated by //.

    profile_has_ambiguity

    fn profile_has_ambiguity(profiles : Array[SequenceProfile]) -> Bool

    Check whether any profile contains ambiguity symbols.

    profile_mean_gc

    fn profile_mean_gc(profiles : Array[SequenceProfile]) -> Double

    Calculate a length-weighted mean GC percentage across profiles.

    profile_total_motif_hits

    fn profile_total_motif_hits(profiles : Array[SequenceProfile]) -> Int

    Count motif occurrences represented by a profile series.

    profile_window_count

    fn profile_window_count(profiles : Array[SequenceProfile]) -> Int

    Return the number of windows in a profile series.

    project_feature

    fn project_feature(record : Record, feature : Feature) -> FeatureProjection

    Convert a feature to a zero-based, half-open projection for genome tools.

    project_interval

    fn project_interval(record : Record, start : Int, end : Int) -> Array[FeatureProjection]

    Return only projections overlapping a requested one-based interval.

    project_record_features

    fn project_record_features(record : Record) -> Array[FeatureProjection]

    Project every local feature in source order.

    protein_has_unknowns

    fn protein_has_unknowns(protein : String) -> Bool

    protein_is_empty

    fn protein_is_empty(protein : String) -> Bool

    protein_length

    fn protein_length(protein : String) -> Int

    protein_molecular_weight_approximation

    fn protein_molecular_weight_approximation(protein : String) -> Double

    protein_stop_count

    fn protein_stop_count(protein : String) -> Int

    protein_unknown_count

    fn protein_unknown_count(protein : String) -> Int

    qualifier_difference

    fn qualifier_difference(left : Record, right : Record) -> Int

    Count qualifier values that changed for features occupying the same slot.

    qualifier_exists

    fn qualifier_exists(record : Record, name : String) -> Bool

    qualifier_histogram

    fn qualifier_histogram(record : Record) -> Array[(String, Int)]

    qualifier_match_json

    fn qualifier_match_json(record : Record, name : String) -> String

    qualifier_match_text

    fn qualifier_match_text(item : QualifierMatch) -> String

    qualifier_name_count

    fn qualifier_name_count(record : Record, name : String) -> Int

    qualifier_names_for_record

    fn qualifier_names_for_record(record : Record) -> Array[String]

    fn qualifier_search(record : Record, text : String) -> Array[QualifierMatch]

    qualifier_value

    fn qualifier_value(record : Record, key : String, name : String) -> Array[String]

    qualifier_value_count

    fn qualifier_value_count(record : Record, name : String, value : String) -> Int

    qualifier_value_exists

    fn qualifier_value_exists(record : Record, name : String, value : String) -> Bool

    qualifier_values_for_feature

    fn qualifier_values_for_feature(feature : Feature, name : String) -> Array[String]

    qualifier_values_json

    fn qualifier_values_json(record : Record, name : String) -> String

    record_annotation_report

    fn record_annotation_report(record : Record) -> String

    record_between_location_count

    fn record_between_location_count(record : Record) -> Int

    record_cds_count

    fn record_cds_count(record : Record) -> Int

    record_coding_reports

    fn record_coding_reports(record : Record, table : CodonTable) -> Array[CodingSequenceReport]

    Calculate codon usage for every CDS feature in one record.

    record_complete_codon_count

    fn record_complete_codon_count(record : Record) -> Int

    Sum complete codons across all CDS features.

    record_error_count

    fn record_error_count(record : Record) -> Int

    record_feature_labels

    fn record_feature_labels(record : Record) -> Array[String]

    Produce stable feature labels in source order for list and search widgets.

    record_feature_report

    fn record_feature_report(record : Record) -> String

    record_feature_span

    fn record_feature_span(record : Record) -> Int

    record_fuzzy_location_count

    fn record_fuzzy_location_count(record : Record) -> Int

    record_gene_count

    fn record_gene_count(record : Record) -> Int

    record_gene_names

    fn record_gene_names(record : Record) -> Array[String]

    record_has_terminator

    fn record_has_terminator(record : Record) -> Bool

    record_has_translation_errors

    fn record_has_translation_errors(record : Record) -> Bool

    record_is_normalized

    fn record_is_normalized(record : Record) -> Bool

    record_is_valid

    fn record_is_valid(record : Record) -> Bool

    record_key_coverage

    fn record_key_coverage(record : Record, key : String) -> IntervalCoverage

    Count bases in a record covered by features of a selected key.

    record_location_json

    fn record_location_json(record : Record) -> String

    record_location_summaries

    fn record_location_summaries(record : Record) -> Array[LocationSummary]

    record_locus_tags

    fn record_locus_tags(record : Record) -> Array[String]

    record_maximum_feature_end

    fn record_maximum_feature_end(record : Record) -> Int

    record_metrics

    fn record_metrics(record : Record) -> RecordMetrics

    record_metrics_json

    fn record_metrics_json(record : Record) -> String

    record_metrics_text

    fn record_metrics_text(record : Record) -> String

    record_minimum_feature_start

    fn record_minimum_feature_start(record : Record) -> Int

    record_notes

    fn record_notes(record : Record) -> Array[String]

    record_organisms

    fn record_organisms(record : Record) -> Array[String]

    record_origin_chunks

    fn record_origin_chunks(record : Record, chunk_size : Int) -> Array[String]

    Return the normalized ORIGIN split into fixed-size chunks for streaming UIs.

    record_products

    fn record_products(record : Record) -> Array[String]

    record_qualifier_report

    fn record_qualifier_report(record : Record) -> String

    record_references

    fn record_references(record : Record) -> Array[String]

    record_remote_accession_count

    fn record_remote_accession_count(record : Record) -> Int

    record_report

    fn record_report(record : Record) -> String

    record_report_json

    fn record_report_json(record : Record) -> String

    record_source_count

    fn record_source_count(record : Record) -> Int

    record_span

    fn record_span(record : Record) -> Int

    record_text_length

    fn record_text_length(record : Record) -> Int

    record_text_lines

    fn record_text_lines(record : Record) -> Array[String]

    record_to_bed

    fn record_to_bed(record : Record) -> String

    Render BED6 rows; coordinates are zero-based and end-exclusive.

    record_to_fasta

    fn record_to_fasta(record : Record, line_width : Int) -> String

    Render an indexed FASTA header that retains accession and definition.

    record_to_gff3

    fn record_to_gff3(record : Record) -> String

    Render GFF3 rows with escaped attributes for common downstream consumers.

    record_translations

    fn record_translations(record : Record) -> Array[String]

    record_warning_count

    fn record_warning_count(record : Record) -> Int

    records_equivalent

    fn records_equivalent(left : Record, right : Record) -> Bool

    Compare a record against itself after canonical sequence normalization.

    records_with_consistent_translations

    fn records_with_consistent_translations(records : Array[Record]) -> Array[Record]

    Select records whose CDS annotations are fully self-consistent.

    remove_gaps

    fn remove_gaps(sequence : String) -> String

    render_location

    fn render_location(location : Location) -> String

    reverse_complement

    fn reverse_complement(seq : String) -> String

    reverse_complement_frames

    fn reverse_complement_frames(sequence : String, table : CodonTable) -> Array[String]

    rna_sequence

    fn rna_sequence(sequence : String) -> String

    scan_iupac_both_strands

    fn scan_iupac_both_strands(sequence : String, motif : String) -> MotifScanReport

    Scan both strands and retain orientation in every hit.

    scan_iupac_motif

    fn scan_iupac_motif(sequence : String, motif : String) -> Array[MotifHit]

    Scan overlapping occurrences on one strand using IUPAC semantics.

    sequence_chunks

    fn sequence_chunks(sequence : String, size : Int) -> Array[String]

    sequence_complexity

    fn sequence_complexity(sequence : String) -> Double

    sequence_edit_distance

    fn sequence_edit_distance(left : String, right : String) -> Int

    sequence_entropy_profile

    fn sequence_entropy_profile(sequence : String, window_size : Int) -> Array[Double]

    sequence_gc_skew

    fn sequence_gc_skew(sequence : String) -> Int

    GC skew (G-C) for a sequence.

    sequence_identity

    fn sequence_identity(left : String, right : String) -> Double

    sequence_is_clean

    fn sequence_is_clean(sequence : String) -> Bool

    Validate that a sequence has no invalid symbols and no internal gaps.

    sequence_is_low_complexity

    fn sequence_is_low_complexity(sequence : String, threshold : Double) -> Bool

    sequence_pairwise_identity

    fn sequence_pairwise_identity(left : String, right : String) -> Double

    sequence_palindrome

    fn sequence_palindrome(sequence : String) -> Bool

    Check whether a sequence equals its reverse complement.

    sequence_profile

    fn sequence_profile(sequence : String, window_size : Int, step : Int, motif : String) -> Array[SequenceProfile]

    Compute composition and motif metrics for overlapping windows.

    sequence_profiles_tsv

    fn sequence_profiles_tsv(profiles : Array[SequenceProfile]) -> String

    Export profiles as tab-separated rows for plotting or spreadsheet review.

    sequence_quality_flags

    fn sequence_quality_flags(sequence : String) -> Array[String]

    sequence_quality_ok

    fn sequence_quality_ok(sequence : String) -> Bool

    sequence_quality_report

    fn sequence_quality_report(sequence : String) -> SequenceQualityReport

    Analyze canonical, ambiguous, gap, and invalid symbols without silently discarding input. Coordinates in all reports are one-based and inclusive.

    sequence_runs

    fn sequence_runs(sequence : String) -> Array[SequenceRun]

    sequence_signature

    fn sequence_signature(sequence : String) -> String

    sequence_subsequence

    fn sequence_subsequence(sequence : String, start : Int, end : Int) -> String

    Extract an inclusive one-based subsequence.

    sequence_windows

    fn sequence_windows(sequence : String, window_size : Int, step : Int) -> Array[SequenceWindow]

    Return overlapping windows. Invalid window sizes produce an empty array.

    shortest_translation

    fn shortest_translation(record : Record) -> String?

    sort_fasta_by_length

    fn sort_fasta_by_length(records : Array[FastaRecord]) -> Array[FastaRecord]

    Sort records by descending sequence length, with source order as a tie-break.

    sorted_feature_keys

    fn sorted_feature_keys(record : Record) -> Array[String]

    sorted_qualifier_names

    fn sorted_qualifier_names(record : Record) -> Array[String]

    source_feature

    fn source_feature(record : Record) -> Feature?

    standard_codon_table

    fn standard_codon_table() -> CodonTable

    stop_codon_count

    fn stop_codon_count(sequence : String, table : CodonTable) -> Int

    stop_codon_fraction

    fn stop_codon_fraction(sequence : String, table : CodonTable) -> Double

    Return the fraction of a coding sequence represented by a stop codon.

    suffix_prefix_overlap

    fn suffix_prefix_overlap(left : String, right : String, minimum : Int) -> Int

    Find the longest suffix/prefix overlap subject to a minimum length.

    summarize_alignment

    fn summarize_alignment(left : String, right : String) -> AlignmentSummary

    summarize_location

    fn summarize_location(location : Location) -> LocationSummary

    summarize_records

    fn summarize_records(text : String) -> BatchSummary raise GenBankError

    synonymous_codon_count

    fn synonymous_codon_count(sequence : String, table : CodonTable) -> Int

    translate_all_frames

    fn translate_all_frames(sequence : String, table : CodonTable) -> Array[String]

    translate_dna

    fn translate_dna(seq : String) -> String

    translate_dna_report

    fn translate_dna_report(seq : String) -> TranslationReport

    Translate a nucleotide sequence and retain quality diagnostics.

    translate_feature

    fn translate_feature(record : Record, feature_index : Int, table? : CodonTable) -> CdsTranslationResult?

    translate_frame

    fn translate_frame(sequence : String, frame : Int, table : CodonTable) -> String

    Translate a one-based reading frame, where frame 1 starts at position 1.

    translation_audit

    fn translation_audit(record : Record) -> TranslationAuditSummary

    Summarize every CDS, including entries that do not provide /translation.

    translation_checks_json

    fn translation_checks_json(record : Record) -> String

    Return the checked CDS findings as stable JSON objects.

    translation_has_internal_stop

    fn translation_has_internal_stop(protein : String) -> Bool

    translation_is_terminated

    fn translation_is_terminated(protein : String) -> Bool

    translation_lengths

    fn translation_lengths(record : Record) -> Array[Int]

    translation_pass_rate

    fn translation_pass_rate(record : Record) -> Double

    Compute the proportion of supplied translations that passed validation.

    translation_without_stop

    fn translation_without_stop(protein : String) -> String

    translations_are_consistent

    fn translations_are_consistent(record : Record) -> Bool

    Return false when any supplied translation disagrees with extracted DNA.

    trim_sequence

    fn trim_sequence(sequence : String, left : Int, right : Int) -> String

    ungapped_intervals

    fn ungapped_intervals(sequence : String) -> Array[SequenceInterval]

    Split a sequence at gaps and return the biological sequence intervals.

    unresolved_feature_count

    fn unresolved_feature_count(record : Record) -> Int

    Count features that cannot be materialized from the local ORIGIN.

    validate_fasta_records

    fn validate_fasta_records(records : Array[FastaRecord]) -> FastaValidationReport

    Validate parsed FASTA records without changing their sequences.

    validate_fasta_text

    fn validate_fasta_text(text : String) -> FastaValidationReport raise GenBankError

    Validate FASTA text using the same parser used by production workflows.

    vertebrate_mitochondrial_table

    fn vertebrate_mitochondrial_table() -> CodonTable