UNPKG

gff-nostream

Version:
36 lines (35 loc) 1.53 kB
import type { GffFeature } from './util.ts'; export interface LineRecord { /** Raw GFF3 feature line */ line: string; } /** * A top-level parsed feature paired with the input record it came from. The * parser stamps no identity onto the feature itself; callers that need a stable * per-feature id (e.g. from a tabix byte offset) read it off their own `record`. */ export interface ParsedRecord<R extends LineRecord = LineRecord> { feature: GffFeature; record: R; } /** Extract the GFF3 feature type (column 3) from a raw line without a full split. */ export declare function extractType(line: string): string; /** * Synchronously parse a string containing GFF3 and return an array of the * parsed features. Comments, directives, and `##FASTA` sections are ignored. * * @param str - GFF3 string * @returns array of parsed features */ export declare function parseStringSync(str: string): GffFeature[]; /** * Parse an array of records wrapping raw GFF3 lines, resolving parent/child * relationships into `subfeatures`. Returns each top-level feature paired with * the record it came from, so callers can attach their own identity (e.g. a * byte offset) without the parser stamping anything onto the feature. * * @param records - Array of records, each carrying a raw GFF3 `line` * @returns top-level features, each paired with its originating record */ export declare function parseRecords<R extends LineRecord>(records: readonly R[]): ParsedRecord<R>[]; export type { GffFeature } from './util.ts';