UNPKG

gff-nostream

Version:
39 lines (38 loc) 1.32 kB
/** * Unescape a string value used in a GFF3 attribute. * * @param stringVal - Escaped GFF3 string value * @returns An unescaped string value */ export declare function unescape(stringVal: string): string; /** * A parsed GFF3 feature: a flat object with 0-based half-open coordinates, * numeric strand (`1`/`-1`/`0`), attributes spread as lowercase top-level keys, * and child features nested under `subfeatures`. */ export interface GffFeature { start: number; end: number; strand?: number; type: string | null; source: string | null; refName: string; phase?: number; score?: number; subfeatures: GffFeature[]; [key: string]: unknown; } /** * Parse the 9th column (attributes) of a GFF3 feature line into `result`, * lowercasing keys and suffixing any that collide with a default field name. * Pass shouldUnescape=false as a fast path for data with no escaped characters. */ export declare function parseAttributes(attrString: string, result: Record<string, unknown>, shouldUnescape: boolean): void; /** * Parse a GFF3 feature line. Unescaping is skipped entirely for lines with no * '%' character, which is the common case. * * @param line - GFF3 feature line * @returns The parsed feature */ export declare function parseFeature(line: string): GffFeature;