@gmod/cram
Advanced tools
Comparing version 1.7.1 to 1.7.2
@@ -0,1 +1,5 @@ | ||
# v1.7.2 | ||
- Update README.md with docs | ||
# v1.7.1 | ||
@@ -2,0 +6,0 @@ |
import { CramFileSource } from './cramFile/file'; | ||
export declare type Slice = { | ||
export type Slice = { | ||
start: number; | ||
@@ -9,3 +9,3 @@ span: number; | ||
}; | ||
declare type ParsedIndex = Record<string, Slice[]>; | ||
type ParsedIndex = Record<string, Slice[]>; | ||
export default class CraiIndex { | ||
@@ -12,0 +12,0 @@ private _parseCache; |
import CramSlice from '../slice'; | ||
import { CramFileBlock } from '../file'; | ||
import { DataType } from './dataSeriesTypes'; | ||
export declare type DataTypeMapping = { | ||
export type DataTypeMapping = { | ||
byte: number; | ||
@@ -10,7 +10,7 @@ int: number; | ||
}; | ||
export declare type Cursor = { | ||
export type Cursor = { | ||
bitPosition: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; | ||
bytePosition: number; | ||
}; | ||
export declare type Cursors = { | ||
export type Cursors = { | ||
lastAlignmentStart: number; | ||
@@ -17,0 +17,0 @@ coreBlock: Cursor; |
@@ -6,3 +6,3 @@ import CramCodec, { Cursors } from './_base'; | ||
import { DataType } from './dataSeriesTypes'; | ||
declare type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>; | ||
type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>; | ||
export default class ByteArrayStopCodec extends CramCodec<'byteArray', ByteArrayLengthEncoding['parameters']> { | ||
@@ -9,0 +9,0 @@ private instantiateCodec; |
import { CramEncoding } from '../encoding'; | ||
export declare type DataType = 'int' | 'byte' | 'long' | 'byteArray'; | ||
export declare type DataSeriesEncodingKey = 'BF' | 'CF' | 'RI' | 'RL' | 'AP' | 'RG' | 'RN' | 'MF' | 'NS' | 'NP' | 'TS' | 'NF' | 'TL' | 'FN' | 'FC' | 'FP' | 'DL' | 'BB' | 'QQ' | 'BS' | 'IN' | 'RS' | 'PD' | 'HC' | 'SC' | 'MQ' | 'BA' | 'QS' | 'TC' | 'TN'; | ||
export declare type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>; | ||
export type DataType = 'int' | 'byte' | 'long' | 'byteArray'; | ||
export type DataSeriesEncodingKey = 'BF' | 'CF' | 'RI' | 'RL' | 'AP' | 'RG' | 'RN' | 'MF' | 'NS' | 'NP' | 'TS' | 'NF' | 'TL' | 'FN' | 'FC' | 'FP' | 'DL' | 'BB' | 'QQ' | 'BS' | 'IN' | 'RS' | 'PD' | 'HC' | 'SC' | 'MQ' | 'BA' | 'QS' | 'TC' | 'TN'; | ||
export type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>; |
@@ -37,4 +37,4 @@ import CramCodec from '../codecs/_base'; | ||
}; | ||
export declare type DataSeriesTypes = typeof dataSeriesTypes; | ||
declare type DataSeriesCache = { | ||
export type DataSeriesTypes = typeof dataSeriesTypes; | ||
type DataSeriesCache = { | ||
[K in DataSeriesEncodingKey]?: CramCodec<DataSeriesTypes[K]>; | ||
@@ -41,0 +41,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export declare type NullEncoding = { | ||
export type NullEncoding = { | ||
codecId: 0; | ||
@@ -6,3 +6,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ExternalCramEncoding = { | ||
export type ExternalCramEncoding = { | ||
codecId: 1; | ||
@@ -14,3 +14,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GolombEncoding = { | ||
export type GolombEncoding = { | ||
codecId: 2; | ||
@@ -23,3 +23,3 @@ parametersBytes: number; | ||
}; | ||
export declare type HuffmanEncoding = { | ||
export type HuffmanEncoding = { | ||
codecId: 3; | ||
@@ -34,3 +34,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ByteArrayLengthEncoding = { | ||
export type ByteArrayLengthEncoding = { | ||
codecId: 4; | ||
@@ -43,3 +43,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ByteArrayStopCramEncoding = { | ||
export type ByteArrayStopCramEncoding = { | ||
codecId: 5; | ||
@@ -52,3 +52,3 @@ parametersBytes: number; | ||
}; | ||
export declare type BetaEncoding = { | ||
export type BetaEncoding = { | ||
codecId: 6; | ||
@@ -61,3 +61,3 @@ parametersBytes: number; | ||
}; | ||
export declare type SubexpEncoding = { | ||
export type SubexpEncoding = { | ||
codecId: 7; | ||
@@ -70,3 +70,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GolombRiceEncoding = { | ||
export type GolombRiceEncoding = { | ||
codecId: 8; | ||
@@ -79,3 +79,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GammaEncoding = { | ||
export type GammaEncoding = { | ||
codecId: 9; | ||
@@ -87,2 +87,2 @@ parametersBytes: number; | ||
}; | ||
export declare type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding; | ||
export type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding; |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { Filehandle } from './filehandle'; | ||
export declare type CramFileSource = { | ||
export type CramFileSource = { | ||
filehandle?: Filehandle; | ||
@@ -14,4 +14,4 @@ url?: string; | ||
}; | ||
export declare type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>; | ||
export declare type CramFileArgs = CramFileSource & { | ||
export type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>; | ||
export type CramFileArgs = CramFileSource & { | ||
checkSequenceMD5: boolean; | ||
@@ -21,3 +21,3 @@ cacheSize?: number; | ||
}; | ||
export declare type CramFileBlock = BlockHeader & { | ||
export type CramFileBlock = BlockHeader & { | ||
_endPosition: number; | ||
@@ -24,0 +24,0 @@ contentPosition: number; |
import CramContainerCompressionScheme from './container/compressionScheme'; | ||
import decodeRecord from './slice/decodeRecord'; | ||
export declare type RefRegion = { | ||
export type RefRegion = { | ||
start: number; | ||
@@ -8,3 +8,3 @@ end: number; | ||
}; | ||
export declare type ReadFeature = { | ||
export type ReadFeature = { | ||
code: string; | ||
@@ -17,3 +17,3 @@ pos: number; | ||
}; | ||
export declare type MateRecord = { | ||
export type MateRecord = { | ||
readName?: string; | ||
@@ -28,6 +28,6 @@ sequenceId: number; | ||
export declare const MateFlags: readonly [readonly [1, "OnNegativeStrand"], readonly [2, "Unmapped"]]; | ||
declare type FlagsDecoder<Type> = { | ||
type FlagsDecoder<Type> = { | ||
[Property in Type as `is${Capitalize<string & Property>}`]: (flags: number) => boolean; | ||
}; | ||
declare type FlagsEncoder<Type> = { | ||
type FlagsEncoder<Type> = { | ||
[Property in Type as `set${Capitalize<string & Property>}`]: (flags: number) => number; | ||
@@ -34,0 +34,0 @@ }; |
@@ -10,4 +10,4 @@ import { Parser } from '@gmod/binary-parser'; | ||
}; | ||
export declare type CramTagDictionary = string[][]; | ||
export declare type CramPreservationMap = { | ||
export type CramTagDictionary = string[][]; | ||
export type CramPreservationMap = { | ||
MI: boolean; | ||
@@ -22,3 +22,3 @@ UI: boolean; | ||
}; | ||
export declare type MappedSliceHeader = { | ||
export type MappedSliceHeader = { | ||
refSeqId: number; | ||
@@ -35,3 +35,3 @@ refSeqStart: number; | ||
}; | ||
export declare type UnmappedSliceHeader = { | ||
export type UnmappedSliceHeader = { | ||
numRecords: number; | ||
@@ -45,4 +45,4 @@ recordCounter: number; | ||
export declare function isMappedSliceHeader(header: MappedSliceHeader | UnmappedSliceHeader): header is MappedSliceHeader; | ||
export declare type CompressionMethod = 'raw' | 'gzip' | 'bzip2' | 'lzma' | 'rans' | 'rans4x16' | 'arith' | 'fqzcomp' | 'tok3'; | ||
export declare type BlockHeader = { | ||
export type CompressionMethod = 'raw' | 'gzip' | 'bzip2' | 'lzma' | 'rans' | 'rans4x16' | 'arith' | 'fqzcomp' | 'tok3'; | ||
export type BlockHeader = { | ||
compressionMethod: CompressionMethod; | ||
@@ -54,3 +54,3 @@ contentType: 'FILE_HEADER' | 'COMPRESSION_HEADER' | 'MAPPED_SLICE_HEADER' | 'UNMAPPED_SLICE_HEADER' | 'EXTERNAL_DATA' | 'CORE_DATA'; | ||
}; | ||
export declare type CramCompressionHeader = ParsedItem<{ | ||
export type CramCompressionHeader = ParsedItem<{ | ||
preservation: CramPreservationMap; | ||
@@ -57,0 +57,0 @@ dataSeriesEncoding: DataSeriesEncodingMap; |
@@ -7,3 +7,3 @@ import { ReadFeature } from '../record'; | ||
import { DataSeriesEncodingKey } from '../codecs/dataSeriesTypes'; | ||
export declare type DataSeriesDecoder = <T extends DataSeriesEncodingKey>(dataSeriesName: T) => DataTypeMapping[DataSeriesTypes[T]]; | ||
export type DataSeriesDecoder = <T extends DataSeriesEncodingKey>(dataSeriesName: T) => DataTypeMapping[DataSeriesTypes[T]]; | ||
export default function decodeRecord(slice: CramSlice, decodeDataSeries: DataSeriesDecoder, compressionScheme: CramContainerCompressionScheme, sliceHeader: SliceHeader, coreDataBlock: CramFileBlock, blocksByContentId: Record<number, CramFileBlock>, cursors: Cursors, majorVersion: number, recordNumber: number): { | ||
@@ -10,0 +10,0 @@ readLength: number; |
@@ -5,3 +5,3 @@ import CramRecord from '../record'; | ||
import { MappedSliceHeader, UnmappedSliceHeader } from '../sectionParsers'; | ||
export declare type SliceHeader = CramFileBlock & { | ||
export type SliceHeader = CramFileBlock & { | ||
parsedContent: MappedSliceHeader | UnmappedSliceHeader; | ||
@@ -8,0 +8,0 @@ }; |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
export declare function parseItf8(buffer: Uint8Array, initialOffset: number): [number, number]; | ||
export declare type ParsedItem<T> = T & { | ||
export type ParsedItem<T> = T & { | ||
_endPosition: number; | ||
@@ -8,0 +8,0 @@ _size: number; |
@@ -6,3 +6,3 @@ import CramFile from './cramFile'; | ||
import { Slice } from './craiIndex'; | ||
export declare type CramFileSource = { | ||
export type CramFileSource = { | ||
cramFilehandle?: Filehandle; | ||
@@ -12,3 +12,3 @@ cramUrl?: string; | ||
}; | ||
export declare type CramIndexLike = { | ||
export type CramIndexLike = { | ||
getEntriesForRange: (seqId: number, start: number, end: number) => Promise<Slice[]>; | ||
@@ -15,0 +15,0 @@ hasDataForReferenceSequence: (seqId: number) => Promise<boolean>; |
@@ -1,2 +0,2 @@ | ||
export declare type HeaderDataItem = { | ||
export type HeaderDataItem = { | ||
tag: string; | ||
@@ -3,0 +3,0 @@ data: Array<{ |
export declare function ensureNotNullish<T>(x: T | null | undefined): T; | ||
export declare type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never; | ||
export declare type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>; | ||
export type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never; | ||
export type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>; |
import { CramFileSource } from './cramFile/file'; | ||
export declare type Slice = { | ||
export type Slice = { | ||
start: number; | ||
@@ -9,3 +9,3 @@ span: number; | ||
}; | ||
declare type ParsedIndex = Record<string, Slice[]>; | ||
type ParsedIndex = Record<string, Slice[]>; | ||
export default class CraiIndex { | ||
@@ -12,0 +12,0 @@ private _parseCache; |
import CramSlice from '../slice'; | ||
import { CramFileBlock } from '../file'; | ||
import { DataType } from './dataSeriesTypes'; | ||
export declare type DataTypeMapping = { | ||
export type DataTypeMapping = { | ||
byte: number; | ||
@@ -10,7 +10,7 @@ int: number; | ||
}; | ||
export declare type Cursor = { | ||
export type Cursor = { | ||
bitPosition: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7; | ||
bytePosition: number; | ||
}; | ||
export declare type Cursors = { | ||
export type Cursors = { | ||
lastAlignmentStart: number; | ||
@@ -17,0 +17,0 @@ coreBlock: Cursor; |
@@ -6,3 +6,3 @@ import CramCodec, { Cursors } from './_base'; | ||
import { DataType } from './dataSeriesTypes'; | ||
declare type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>; | ||
type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>; | ||
export default class ByteArrayStopCodec extends CramCodec<'byteArray', ByteArrayLengthEncoding['parameters']> { | ||
@@ -9,0 +9,0 @@ private instantiateCodec; |
import { CramEncoding } from '../encoding'; | ||
export declare type DataType = 'int' | 'byte' | 'long' | 'byteArray'; | ||
export declare type DataSeriesEncodingKey = 'BF' | 'CF' | 'RI' | 'RL' | 'AP' | 'RG' | 'RN' | 'MF' | 'NS' | 'NP' | 'TS' | 'NF' | 'TL' | 'FN' | 'FC' | 'FP' | 'DL' | 'BB' | 'QQ' | 'BS' | 'IN' | 'RS' | 'PD' | 'HC' | 'SC' | 'MQ' | 'BA' | 'QS' | 'TC' | 'TN'; | ||
export declare type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>; | ||
export type DataType = 'int' | 'byte' | 'long' | 'byteArray'; | ||
export type DataSeriesEncodingKey = 'BF' | 'CF' | 'RI' | 'RL' | 'AP' | 'RG' | 'RN' | 'MF' | 'NS' | 'NP' | 'TS' | 'NF' | 'TL' | 'FN' | 'FC' | 'FP' | 'DL' | 'BB' | 'QQ' | 'BS' | 'IN' | 'RS' | 'PD' | 'HC' | 'SC' | 'MQ' | 'BA' | 'QS' | 'TC' | 'TN'; | ||
export type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>; |
@@ -37,4 +37,4 @@ import CramCodec from '../codecs/_base'; | ||
}; | ||
export declare type DataSeriesTypes = typeof dataSeriesTypes; | ||
declare type DataSeriesCache = { | ||
export type DataSeriesTypes = typeof dataSeriesTypes; | ||
type DataSeriesCache = { | ||
[K in DataSeriesEncodingKey]?: CramCodec<DataSeriesTypes[K]>; | ||
@@ -41,0 +41,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
export declare type NullEncoding = { | ||
export type NullEncoding = { | ||
codecId: 0; | ||
@@ -6,3 +6,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ExternalCramEncoding = { | ||
export type ExternalCramEncoding = { | ||
codecId: 1; | ||
@@ -14,3 +14,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GolombEncoding = { | ||
export type GolombEncoding = { | ||
codecId: 2; | ||
@@ -23,3 +23,3 @@ parametersBytes: number; | ||
}; | ||
export declare type HuffmanEncoding = { | ||
export type HuffmanEncoding = { | ||
codecId: 3; | ||
@@ -34,3 +34,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ByteArrayLengthEncoding = { | ||
export type ByteArrayLengthEncoding = { | ||
codecId: 4; | ||
@@ -43,3 +43,3 @@ parametersBytes: number; | ||
}; | ||
export declare type ByteArrayStopCramEncoding = { | ||
export type ByteArrayStopCramEncoding = { | ||
codecId: 5; | ||
@@ -52,3 +52,3 @@ parametersBytes: number; | ||
}; | ||
export declare type BetaEncoding = { | ||
export type BetaEncoding = { | ||
codecId: 6; | ||
@@ -61,3 +61,3 @@ parametersBytes: number; | ||
}; | ||
export declare type SubexpEncoding = { | ||
export type SubexpEncoding = { | ||
codecId: 7; | ||
@@ -70,3 +70,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GolombRiceEncoding = { | ||
export type GolombRiceEncoding = { | ||
codecId: 8; | ||
@@ -79,3 +79,3 @@ parametersBytes: number; | ||
}; | ||
export declare type GammaEncoding = { | ||
export type GammaEncoding = { | ||
codecId: 9; | ||
@@ -87,2 +87,2 @@ parametersBytes: number; | ||
}; | ||
export declare type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding; | ||
export type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding; |
@@ -8,3 +8,3 @@ /// <reference types="node" /> | ||
import { Filehandle } from './filehandle'; | ||
export declare type CramFileSource = { | ||
export type CramFileSource = { | ||
filehandle?: Filehandle; | ||
@@ -14,4 +14,4 @@ url?: string; | ||
}; | ||
export declare type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>; | ||
export declare type CramFileArgs = CramFileSource & { | ||
export type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>; | ||
export type CramFileArgs = CramFileSource & { | ||
checkSequenceMD5: boolean; | ||
@@ -21,3 +21,3 @@ cacheSize?: number; | ||
}; | ||
export declare type CramFileBlock = BlockHeader & { | ||
export type CramFileBlock = BlockHeader & { | ||
_endPosition: number; | ||
@@ -24,0 +24,0 @@ contentPosition: number; |
import CramContainerCompressionScheme from './container/compressionScheme'; | ||
import decodeRecord from './slice/decodeRecord'; | ||
export declare type RefRegion = { | ||
export type RefRegion = { | ||
start: number; | ||
@@ -8,3 +8,3 @@ end: number; | ||
}; | ||
export declare type ReadFeature = { | ||
export type ReadFeature = { | ||
code: string; | ||
@@ -17,3 +17,3 @@ pos: number; | ||
}; | ||
export declare type MateRecord = { | ||
export type MateRecord = { | ||
readName?: string; | ||
@@ -28,6 +28,6 @@ sequenceId: number; | ||
export declare const MateFlags: readonly [readonly [1, "OnNegativeStrand"], readonly [2, "Unmapped"]]; | ||
declare type FlagsDecoder<Type> = { | ||
type FlagsDecoder<Type> = { | ||
[Property in Type as `is${Capitalize<string & Property>}`]: (flags: number) => boolean; | ||
}; | ||
declare type FlagsEncoder<Type> = { | ||
type FlagsEncoder<Type> = { | ||
[Property in Type as `set${Capitalize<string & Property>}`]: (flags: number) => number; | ||
@@ -34,0 +34,0 @@ }; |
@@ -10,4 +10,4 @@ import { Parser } from '@gmod/binary-parser'; | ||
}; | ||
export declare type CramTagDictionary = string[][]; | ||
export declare type CramPreservationMap = { | ||
export type CramTagDictionary = string[][]; | ||
export type CramPreservationMap = { | ||
MI: boolean; | ||
@@ -22,3 +22,3 @@ UI: boolean; | ||
}; | ||
export declare type MappedSliceHeader = { | ||
export type MappedSliceHeader = { | ||
refSeqId: number; | ||
@@ -35,3 +35,3 @@ refSeqStart: number; | ||
}; | ||
export declare type UnmappedSliceHeader = { | ||
export type UnmappedSliceHeader = { | ||
numRecords: number; | ||
@@ -45,4 +45,4 @@ recordCounter: number; | ||
export declare function isMappedSliceHeader(header: MappedSliceHeader | UnmappedSliceHeader): header is MappedSliceHeader; | ||
export declare type CompressionMethod = 'raw' | 'gzip' | 'bzip2' | 'lzma' | 'rans' | 'rans4x16' | 'arith' | 'fqzcomp' | 'tok3'; | ||
export declare type BlockHeader = { | ||
export type CompressionMethod = 'raw' | 'gzip' | 'bzip2' | 'lzma' | 'rans' | 'rans4x16' | 'arith' | 'fqzcomp' | 'tok3'; | ||
export type BlockHeader = { | ||
compressionMethod: CompressionMethod; | ||
@@ -54,3 +54,3 @@ contentType: 'FILE_HEADER' | 'COMPRESSION_HEADER' | 'MAPPED_SLICE_HEADER' | 'UNMAPPED_SLICE_HEADER' | 'EXTERNAL_DATA' | 'CORE_DATA'; | ||
}; | ||
export declare type CramCompressionHeader = ParsedItem<{ | ||
export type CramCompressionHeader = ParsedItem<{ | ||
preservation: CramPreservationMap; | ||
@@ -57,0 +57,0 @@ dataSeriesEncoding: DataSeriesEncodingMap; |
@@ -7,3 +7,3 @@ import { ReadFeature } from '../record'; | ||
import { DataSeriesEncodingKey } from '../codecs/dataSeriesTypes'; | ||
export declare type DataSeriesDecoder = <T extends DataSeriesEncodingKey>(dataSeriesName: T) => DataTypeMapping[DataSeriesTypes[T]]; | ||
export type DataSeriesDecoder = <T extends DataSeriesEncodingKey>(dataSeriesName: T) => DataTypeMapping[DataSeriesTypes[T]]; | ||
export default function decodeRecord(slice: CramSlice, decodeDataSeries: DataSeriesDecoder, compressionScheme: CramContainerCompressionScheme, sliceHeader: SliceHeader, coreDataBlock: CramFileBlock, blocksByContentId: Record<number, CramFileBlock>, cursors: Cursors, majorVersion: number, recordNumber: number): { | ||
@@ -10,0 +10,0 @@ readLength: number; |
@@ -5,3 +5,3 @@ import CramRecord from '../record'; | ||
import { MappedSliceHeader, UnmappedSliceHeader } from '../sectionParsers'; | ||
export declare type SliceHeader = CramFileBlock & { | ||
export type SliceHeader = CramFileBlock & { | ||
parsedContent: MappedSliceHeader | UnmappedSliceHeader; | ||
@@ -8,0 +8,0 @@ }; |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
export declare function parseItf8(buffer: Uint8Array, initialOffset: number): [number, number]; | ||
export declare type ParsedItem<T> = T & { | ||
export type ParsedItem<T> = T & { | ||
_endPosition: number; | ||
@@ -8,0 +8,0 @@ _size: number; |
@@ -6,3 +6,3 @@ import CramFile from './cramFile'; | ||
import { Slice } from './craiIndex'; | ||
export declare type CramFileSource = { | ||
export type CramFileSource = { | ||
cramFilehandle?: Filehandle; | ||
@@ -12,3 +12,3 @@ cramUrl?: string; | ||
}; | ||
export declare type CramIndexLike = { | ||
export type CramIndexLike = { | ||
getEntriesForRange: (seqId: number, start: number, end: number) => Promise<Slice[]>; | ||
@@ -15,0 +15,0 @@ hasDataForReferenceSequence: (seqId: number) => Promise<boolean>; |
@@ -1,2 +0,2 @@ | ||
export declare type HeaderDataItem = { | ||
export type HeaderDataItem = { | ||
tag: string; | ||
@@ -3,0 +3,0 @@ data: Array<{ |
export declare function ensureNotNullish<T>(x: T | null | undefined): T; | ||
export declare type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never; | ||
export declare type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>; | ||
export type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never; | ||
export type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>; |
{ | ||
"name": "@gmod/cram", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "read CRAM files with pure Javascript", | ||
@@ -60,12 +60,12 @@ "license": "MIT", | ||
"@gmod/indexedfasta": "^2.0.2", | ||
"@types/buffer-crc32": "^0.2.0", | ||
"@types/jest": "^27.4.0", | ||
"@types/buffer-crc32": "^0.2.2", | ||
"@types/jest": "^29.2.4", | ||
"@types/long": "^4.0.2", | ||
"@types/md5": "^2.3.2", | ||
"@types/pako": "^1.0.3", | ||
"@typescript-eslint/eslint-plugin": "^5.9.1", | ||
"@typescript-eslint/parser": "^5.9.1", | ||
"@typescript-eslint/eslint-plugin": "^5.46.1", | ||
"@typescript-eslint/parser": "^5.46.1", | ||
"buffer": "^6.0.3", | ||
"documentation": "^13.2.5", | ||
"eslint": "^8.15.0", | ||
"documentation": "^14.0.1", | ||
"eslint": "^8.30.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
@@ -75,11 +75,11 @@ "eslint-plugin-import": "^2.25.4", | ||
"glob": "^8.0.3", | ||
"jest": "^28.1.0", | ||
"mock-fs": "^5.1.2", | ||
"prettier": "^2.5.1", | ||
"jest": "^29.3.1", | ||
"mock-fs": "^5.2.0", | ||
"prettier": "^2.8.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^28.0.2", | ||
"typescript": "^4.5.4", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.9.4", | ||
"url": "^0.11.0", | ||
"webpack": "5.72.1", | ||
"webpack-cli": "^4.9.2" | ||
"webpack": "5.75.0", | ||
"webpack-cli": "^5.0.1" | ||
}, | ||
@@ -86,0 +86,0 @@ "publishConfig": { |
259
README.md
@@ -5,10 +5,10 @@ # @gmod/cram | ||
[![Coverage Status](https://img.shields.io/codecov/c/github/GMOD/cram-js/master.svg?style=flat-square)](https://codecov.io/gh/GMOD/cram-js/branch/master) | ||
[![Build Status](https://img.shields.io/github/workflow/status/GMOD/cram-js/Push/master?logo=github&style=flat-query)](https://github.com/GMOD/cram-js/actions?query=branch%3Amaster+workflow%3APush+) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/GMOD/cram-js/push.yml?branch=master)](https://github.com/GMOD/cram-js/actions?query=branch%3Amaster+workflow%3APush+) | ||
Read CRAM files (indexed or unindexed) with pure JS, works in node or in the browser. | ||
- Reads CRAM 3.x and 2.x (3.1 added in v1.6.0) | ||
- Does not read CRAM 1.x | ||
- Can use .crai indexes out of the box, for efficient sequence fetching, but also has an [index API](#craiindex) that would allow use with other index types | ||
- Does implement bzip2 but not lzma codecs (yet); if this is important to your use case, please file an issue | ||
* Reads CRAM 3.x and 2.x (3.1 added in v1.6.0) | ||
* Does not read CRAM 1.x | ||
* Can use .crai indexes out of the box, for efficient sequence fetching, but also has an [index API](#craiindex) that would allow use with other index types | ||
* Does implement bzip2 but not lzma codecs (yet); if this is important to your use case, please file an issue | ||
@@ -126,8 +126,8 @@ ## Install | ||
- [CramRecord](#cramrecord) - format of CRAM records returned by this API | ||
- [ReadFeatures](#readfeatures) - format of read features on records | ||
- [IndexedCramFile](#indexedcramfile) - indexed access into a CRAM file | ||
- [CramFile](#cramfile) - .cram API | ||
- [CraiIndex](#craiindex) - .crai index API | ||
- [Error Classes](#error-classes) - special error classes thrown by this API | ||
* [CramRecord](#cramrecord) - format of CRAM records returned by this API | ||
* [ReadFeatures](#readfeatures) - format of read features on records | ||
* [IndexedCramFile](#indexedcramfile) - indexed access into a CRAM file | ||
* [CramFile](#cramfile) - .cram API | ||
* [CraiIndex](#craiindex) - .crai index API | ||
* [Error Classes](#error-classes) - special error classes thrown by this API | ||
@@ -138,125 +138,4 @@ ### CramRecord | ||
##### Table of Contents | ||
#### Table of Contents | ||
- [CramRecord](#cramrecord) | ||
- [isPaired](#ispaired) | ||
- [isProperlyPaired](#isproperlypaired) | ||
- [isSegmentUnmapped](#issegmentunmapped) | ||
- [isMateUnmapped](#ismateunmapped) | ||
- [isReverseComplemented](#isreversecomplemented) | ||
- [isMateReverseComplemented](#ismatereversecomplemented) | ||
- [isRead1](#isread1) | ||
- [isRead2](#isread2) | ||
- [isSecondary](#issecondary) | ||
- [isFailedQc](#isfailedqc) | ||
- [isDuplicate](#isduplicate) | ||
- [isSupplementary](#issupplementary) | ||
- [isDetached](#isdetached) | ||
- [hasMateDownStream](#hasmatedownstream) | ||
- [isPreservingQualityScores](#ispreservingqualityscores) | ||
- [isUnknownBases](#isunknownbases) | ||
- [getReadBases](#getreadbases) | ||
- [getPairOrientation](#getpairorientation) | ||
- [addReferenceSequence](#addreferencesequence) | ||
- [Parameters](#parameters) | ||
#### CramRecord | ||
Class of each CRAM record returned by this API. | ||
##### isPaired | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read is paired, regardless of whether both segments are mapped | ||
##### isProperlyPaired | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read is paired, and both segments are mapped | ||
##### isSegmentUnmapped | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read itself is unmapped; conflictive with isProperlyPaired | ||
##### isMateUnmapped | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read itself is unmapped; conflictive with isProperlyPaired | ||
##### isReverseComplemented | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read is mapped to the reverse strand | ||
##### isMateReverseComplemented | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the mate is mapped to the reverse strand | ||
##### isRead1 | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if this is read number 1 in a pair | ||
##### isRead2 | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if this is read number 2 in a pair | ||
##### isSecondary | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if this is a secondary alignment | ||
##### isFailedQc | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if this read has failed QC checks | ||
##### isDuplicate | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read is an optical or PCR duplicate | ||
##### isSupplementary | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if this is a supplementary alignment | ||
##### isDetached | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read is detached | ||
##### hasMateDownStream | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read has a mate in this same CRAM segment | ||
##### isPreservingQualityScores | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read contains qual scores | ||
##### isUnknownBases | ||
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the read has no sequence bases | ||
##### getReadBases | ||
Get the original sequence of this read. | ||
Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** sequence basepairs | ||
##### getPairOrientation | ||
Get the pair orientation of a paired read. Adapted from igv.js | ||
Returns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of paired orientatin | ||
##### addReferenceSequence | ||
Annotates this feature with the given reference sequence basepair | ||
information. This will add a `sub` and a `ref` item to base | ||
subsitution read features given the actual substituted and reference | ||
base pairs, and will make the `getReadSequence()` method work. | ||
###### Parameters | ||
- `refRegion` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `refRegion.start` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `refRegion.end` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `refRegion.seq` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `compressionScheme` **CramContainerCompressionScheme** | ||
Returns **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** nothing | ||
### ReadFeatures | ||
@@ -268,6 +147,6 @@ | ||
- **code** (`character`): One of "bqBXIDiQNSPH". See page 15 of the CRAM v3 spec for their meanings. | ||
- **data** (`any`): the data associated with the feature. The format of this varies depending on the feature code. | ||
- **pos** (`number`): location relative to the read (1-based) | ||
- **refPos** (`number`): location relative to the reference (1-based) | ||
* **code** (`character`): One of "bqBXIDiQNSPH". See page 15 of the CRAM v3 spec for their meanings. | ||
* **data** (`any`): the data associated with the feature. The format of this varies depending on the feature code. | ||
* **pos** (`number`): location relative to the read (1-based) | ||
* **refPos** (`number`): location relative to the reference (1-based) | ||
@@ -278,42 +157,4 @@ ### IndexedCramFile | ||
##### Table of Contents | ||
#### Table of Contents | ||
- [constructor](#constructor) | ||
- [Parameters](#parameters) | ||
- [getRecordsForRange](#getrecordsforrange) | ||
- [Parameters](#parameters-1) | ||
- [hasDataForReferenceSequence](#hasdataforreferencesequence) | ||
- [Parameters](#parameters-2) | ||
#### constructor | ||
##### Parameters | ||
- `args` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `args.cram` **CramFile** | ||
- `args.index` **Index-like** object that supports getEntriesForRange(seqId,start,end) -> Promise\[Array\[index entries]] | ||
- `args.cacheSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** optional maximum number of CRAM records to cache. default 20,000 | ||
- `args.fetchSizeLimit` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** optional maximum number of bytes to fetch in a single getRecordsForRange call. Default 3 MiB. | ||
- `args.checkSequenceMD5` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** default true. if false, disables verifying the MD5 | ||
checksum of the reference sequence underlying a slice. In some applications, this check can cause an inconvenient amount (many megabases) of sequences to be fetched. | ||
#### getRecordsForRange | ||
##### Parameters | ||
- `seq` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** numeric ID of the reference sequence | ||
- `start` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** start of the range of interest. 1-based closed coordinates. | ||
- `end` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** end of the range of interest. 1-based closed coordinates. | ||
- `opts` (optional, default `{}`) | ||
#### hasDataForReferenceSequence | ||
##### Parameters | ||
- `seqId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** true if the CRAM file contains data for the given | ||
reference sequence numerical ID | ||
### CramFile | ||
@@ -323,26 +164,4 @@ | ||
##### Table of Contents | ||
#### Table of Contents | ||
- [constructor](#constructor) | ||
- [Parameters](#parameters) | ||
- [containerCount](#containercount) | ||
#### constructor | ||
##### Parameters | ||
- `args` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `args.filehandle` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** a filehandle that implements the stat() and | ||
read() methods of the Node filehandle API <https://nodejs.org/api/fs.html#fs_class_filehandle> | ||
- `args.path` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** path to the cram file | ||
- `args.url` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** url for the cram file. also supports file:// urls for local files | ||
- `args.seqFetch` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** a function with signature | ||
`(seqId, startCoordinate, endCoordinate)` that returns a promise for a string of sequence bases | ||
- `args.cacheSize` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** optional maximum number of CRAM records to cache. default 20,000 | ||
- `args.checkSequenceMD5` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** default true. if false, disables verifying the MD5 | ||
checksum of the reference sequence underlying a slice. In some applications, this check can cause an inconvenient amount (many megabases) of sequences to be fetched. | ||
#### containerCount | ||
### CraiIndex | ||
@@ -352,44 +171,4 @@ | ||
##### Table of Contents | ||
#### Table of Contents | ||
- [constructor](#constructor) | ||
- [Parameters](#parameters) | ||
- [hasDataForReferenceSequence](#hasdataforreferencesequence) | ||
- [Parameters](#parameters-1) | ||
- [getEntriesForRange](#getentriesforrange) | ||
- [Parameters](#parameters-2) | ||
#### constructor | ||
##### Parameters | ||
- `args` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** | ||
- `args.path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `args.url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** | ||
- `args.filehandle` **FileHandle?** | ||
#### hasDataForReferenceSequence | ||
##### Parameters | ||
- `seqId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** true if the index contains entries for | ||
the given reference sequence ID, false otherwise | ||
#### getEntriesForRange | ||
fetch index entries for the given range | ||
##### Parameters | ||
- `seqId` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `queryStart` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `queryEnd` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise for | ||
an array of objects of the form | ||
`{start, span, containerStart, sliceStart, sliceBytes }` | ||
### CramUnimplementedError | ||
@@ -396,0 +175,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
974029
192