Genotype API Documentation - v0.1.0
    Preparing search index...

    Interface KmerSequence<K>

    K-mer sequence with compile-time size tracking and parsed coordinate information

    Extends AbstractSequence with k-mer-specific metadata extracted from seqkit sliding window ID format: {original_id}{suffix}:{start}-{end}

    The generic parameter K tracks k-mer size at compile-time, enabling:

    • Type-safe k-mer operations (21-mers vs 31-mers are different types)
    • Compile-time validation of k-mer compatibility
    • Prevention of mixing k-mers of different sizes
    • K-mer set operations with guaranteed size matching
    // These are DIFFERENT types at compile-time
    const kmer21: KmerSequence<21> = { ... };
    const kmer31: KmerSequence<31> = { ... };

    // Type error: cannot assign 31-mer to 21-mer variable
    const mixed: KmerSequence<21> = kmer31; // ❌ Compile error
    interface KmerSequence<K extends number = number> {
        id: string;
        description?: string;
        sequence: string;
        length: number;
        lineNumber?: number;
        kmerSize: K;
        stepSize: number;
        originalId: string;
        startPosition: number;
        endPosition: number;
        coordinateSystem: "0-based" | "1-based";
        suffix: string;
        isWrapped: boolean;
        windowIndex: number;
    }

    Type Parameters

    • K extends number = number

      K-mer size as a literal number type (e.g., 21, 31)

    Hierarchy (View Summary)

    Index

    Properties

    id: string

    Sequence identifier (required, but may be empty string in malformed data)

    description?: string

    Optional description/comment line

    sequence: string

    The actual sequence data

    length: number

    Cached sequence length for performance

    lineNumber?: number

    Original line number where this sequence started (for error reporting)

    kmerSize: K

    K-mer size (window size) tracked at compile-time

    This field's type is the literal K, not just number. TypeScript will infer K from the actual value.

    stepSize: number

    Step size used to generate these k-mers

    Recorded for metadata/reproducibility but NOT tracked at compile-time.

    originalId: string

    Original sequence ID before windowing

    Extracted from: {original_id}{suffix}:{start}-{end}

    startPosition: number

    Start position in original sequence (0-based or 1-based)

    Coordinate system depends on WindowOptions.zeroBased setting.

    endPosition: number

    End position in original sequence (0-based or 1-based)

    For 0-based: exclusive end (standard programming convention) For 1-based: inclusive end (bioinformatics convention)

    coordinateSystem: "0-based" | "1-based"

    Coordinate system used for startPosition and endPosition

    suffix: string

    Suffix used when generating this window

    isWrapped: boolean

    Whether this k-mer was generated from circular sequence wrapping

    windowIndex: number

    Index of this k-mer within the original sequence's k-mer set