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

    Class SubseqExtractor

    High-performance subsequence extractor with flexible region specification

    Extracts subsequences from biological sequences using various coordinate systems and region specifications. Supports both simple coordinate ranges and complex region files.

    // Extract specific region
    const extractor = new SubseqExtractor();
    const subseqs = extractor.extract(sequences, {
    region: "100:500",
    includeCoordinates: true
    });

    // Extract with flanking sequences
    const withFlanks = extractor.extract(sequences, {
    region: "1000:2000",
    upstream: 100,
    downstream: 100
    });

    // Extract multiple regions
    const multiRegions = extractor.extract(sequences, {
    regions: ["1:100", "200:300", "-100:-1"]
    });
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Extract subsequences from input sequences

      Processes sequences and extracts specified regions, handling various coordinate formats and options.

      Type Parameters

      Parameters

      • sequences: AsyncIterable<T>

        Input sequences to extract from

      • options: SubseqOptions

        Extraction configuration

      Returns AsyncIterable<T>

      Extracted subsequences

      for await (const subseq of extractor.extract(sequences, options)) {
      console.log(`Extracted ${subseq.length} bases from ${subseq.sourceId}`);
      }
    • Parse region string into coordinates

      Supports various formats:

      • "100:200" - from position 100 to 200
      • "100:-1" - from position 100 to end
      • "-100:-1" - last 100 bases
      • ":500" - from start to position 500

      Parameters

      • region: string

        Region string to parse

      • sequenceLength: number

        Length of the sequence for negative indices

      • oneBased: boolean = true

        Whether to use 1-based coordinates

      • circular: boolean = false

      Returns ParsedCoordinates

      Parsed region with 0-based coordinates

      const region = extractor.parseRegion("100:200", 1000, true);
      // Returns: { start: 99, end: 200, original: "100:200", hasNegativeIndices: false }

      NATIVE_CANDIDATE - STRING PARSING WITH BOUNDS CHECKING

      • Lots of string operations and integer parsing
      • Boundary checking and coordinate conversion
      • Could be optimized with pre-compiled regex or state machine
      • Expected speedup: 5-10x