import CramContainerCompressionScheme from './container/compressionScheme.ts'; import type decodeRecord from './slice/decodeRecord.ts'; export interface RefRegion { start: number; end: number; seq: string; } interface ReadFeatureBase { pos: number; refPos: number; } /** * Read features describe differences between a read and the reference sequence. * Each feature has a code indicating the type of difference, a position in the * read (pos), and a position on the reference (refPos). */ export type ReadFeature = /** I=insertion, S=soft clip, b=bases, i=single-base insertion — all carry a sequence string */ (ReadFeatureBase & { code: 'I' | 'S' | 'b' | 'i'; data: string; }) /** B=base and quality pair — [substituted base, quality score] */ | (ReadFeatureBase & { code: 'B'; data: [string, number]; }) /** X=base substitution — data is the substitution matrix index, ref/sub filled in by addReferenceSequence */ | (ReadFeatureBase & { code: 'X'; data: number; ref?: string; sub?: string; }) /** D=deletion, N=reference skip, H=hard clip, P=padding, Q=single quality score */ | (ReadFeatureBase & { code: 'D' | 'N' | 'H' | 'P' | 'Q'; data: number; }) /** q=quality scores for a stretch of bases */ | (ReadFeatureBase & { code: 'q'; data: number[]; }); export interface DecodeOptions { /** Whether to parse tags. If false, raw tag data is stored for lazy parsing. Default true. */ decodeTags?: boolean; } export declare const defaultDecodeOptions: Required; export interface MateRecord { readName?: string; sequenceId: number; alignmentStart: number; flags?: number; uniqueId?: number; } export declare const BamFlags: readonly [readonly [1, "Paired"], readonly [2, "ProperlyPaired"], readonly [4, "SegmentUnmapped"], readonly [8, "MateUnmapped"], readonly [16, "ReverseComplemented"], readonly [32, "MateReverseComplemented"], readonly [64, "Read1"], readonly [128, "Read2"], readonly [256, "Secondary"], readonly [512, "FailedQc"], readonly [1024, "Duplicate"], readonly [2048, "Supplementary"]]; export declare const CramFlags: readonly [readonly [1, "PreservingQualityScores"], readonly [2, "Detached"], readonly [4, "WithMateDownstream"], readonly [8, "DecodeSequenceAsStar"]]; export declare const MateFlags: readonly [readonly [1, "OnNegativeStrand"], readonly [2, "Unmapped"]]; type FlagsDecoder = { [Property in Type as `is${Capitalize}`]: (flags: number) => boolean; }; type FlagsEncoder = { [Property in Type as `set${Capitalize}`]: (flags: number) => number; }; export declare const BamFlagsDecoder: FlagsDecoder<"Paired" | "ProperlyPaired" | "SegmentUnmapped" | "MateUnmapped" | "ReverseComplemented" | "MateReverseComplemented" | "Read1" | "Read2" | "Secondary" | "FailedQc" | "Duplicate" | "Supplementary"> & FlagsEncoder<"Paired" | "ProperlyPaired" | "SegmentUnmapped" | "MateUnmapped" | "ReverseComplemented" | "MateReverseComplemented" | "Read1" | "Read2" | "Secondary" | "FailedQc" | "Duplicate" | "Supplementary">; export declare const CramFlagsDecoder: FlagsDecoder<"PreservingQualityScores" | "Detached" | "WithMateDownstream" | "DecodeSequenceAsStar"> & FlagsEncoder<"PreservingQualityScores" | "Detached" | "WithMateDownstream" | "DecodeSequenceAsStar">; export declare const MateFlagsDecoder: FlagsDecoder<"OnNegativeStrand" | "Unmapped"> & FlagsEncoder<"OnNegativeStrand" | "Unmapped">; /** * Class of each CRAM record returned by this API. */ export default class CramRecord { tags: Record; flags: number; cramFlags: number; readBases?: string | null; _refRegion?: RefRegion; readFeatures?: ReadFeature[]; alignmentStart: number; lengthOnRef: number | undefined; readLength: number; templateLength?: number; templateSize?: number; private _readName?; private _readNameRaw?; _syntheticReadName?: string; mateRecordNumber?: number; mate?: MateRecord; uniqueId: number; sequenceId: number; readGroupId: number; mappingQuality: number | undefined; qualityScores: Uint8Array | null | undefined; get readName(): string | undefined; constructor({ flags, cramFlags, readLength, mappingQuality, lengthOnRef, qualityScores, mateRecordNumber, readBases, readFeatures, mateToUse, readGroupId, readNameRaw, sequenceId, uniqueId, templateSize, alignmentStart, tags, }: ReturnType); /** * Get a single quality score at the given index. * @param index 0-based index into the quality scores * @returns the quality score at that index, or undefined if not available */ qualityScoreAt(index: number): number | undefined; /** * @returns {boolean} true if the read is paired, regardless of whether both segments are mapped */ isPaired(): boolean; /** @returns {boolean} true if the read is paired, and both segments are mapped */ isProperlyPaired(): boolean; /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */ isSegmentUnmapped(): boolean; /** @returns {boolean} true if the read itself is unmapped; conflictive with isProperlyPaired */ isMateUnmapped(): boolean; /** @returns {boolean} true if the read is mapped to the reverse strand */ isReverseComplemented(): boolean; /** @returns {boolean} true if the mate is mapped to the reverse strand */ isMateReverseComplemented(): boolean; /** @returns {boolean} true if this is read number 1 in a pair */ isRead1(): boolean; /** @returns {boolean} true if this is read number 2 in a pair */ isRead2(): boolean; /** @returns {boolean} true if this is a secondary alignment */ isSecondary(): boolean; /** @returns {boolean} true if this read has failed QC checks */ isFailedQc(): boolean; /** @returns {boolean} true if the read is an optical or PCR duplicate */ isDuplicate(): boolean; /** @returns {boolean} true if this is a supplementary alignment */ isSupplementary(): boolean; /** * @returns {boolean} true if the read is detached */ isDetached(): boolean; /** @returns {boolean} true if the read has a mate in this same CRAM segment */ hasMateDownStream(): boolean; /** @returns {boolean} true if the read contains qual scores */ isPreservingQualityScores(): boolean; /** @returns {boolean} true if the read has no sequence bases */ isUnknownBases(): boolean; /** * Get the original sequence of this read. * @returns {String} sequence basepairs */ getReadBases(): string | null | undefined; getPairOrientation(): string | undefined; /** * Annotates this feature with the given reference sequence basepair * information. This will add a `sub` and a `ref` item to base * substitution read features given the actual substituted and reference * base pairs, and will make the `getReadSequence()` method work. * * @param {object} refRegion * @param {number} refRegion.start * @param {number} refRegion.end * @param {string} refRegion.seq * @param {CramContainerCompressionScheme} compressionScheme * @returns {undefined} nothing */ addReferenceSequence(refRegion: RefRegion, compressionScheme: CramContainerCompressionScheme): void; toJSON(): any; } export {};