@gmod/cram 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +19 -240
- package/dist/craiIndex.d.ts +2 -2
- package/dist/cram-bundle.js +1 -1
- package/dist/cramFile/codecs/_base.d.ts +3 -3
- package/dist/cramFile/codecs/byteArrayLength.d.ts +1 -1
- package/dist/cramFile/codecs/dataSeriesTypes.d.ts +3 -3
- package/dist/cramFile/container/compressionScheme.d.ts +2 -2
- package/dist/cramFile/encoding.d.ts +11 -11
- package/dist/cramFile/file.d.ts +4 -4
- package/dist/cramFile/index.d.ts +1 -0
- package/dist/cramFile/index.js +3 -0
- package/dist/cramFile/index.js.map +1 -1
- package/dist/cramFile/record.d.ts +5 -5
- package/dist/cramFile/sectionParsers.d.ts +7 -7
- package/dist/cramFile/slice/decodeRecord.d.ts +1 -1
- package/dist/cramFile/slice/index.d.ts +1 -1
- package/dist/cramFile/util.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/indexedCramFile.d.ts +2 -2
- package/dist/sam.d.ts +1 -1
- package/dist/typescript.d.ts +2 -2
- package/esm/craiIndex.d.ts +2 -2
- package/esm/cramFile/codecs/_base.d.ts +3 -3
- package/esm/cramFile/codecs/byteArrayLength.d.ts +1 -1
- package/esm/cramFile/codecs/dataSeriesTypes.d.ts +3 -3
- package/esm/cramFile/container/compressionScheme.d.ts +2 -2
- package/esm/cramFile/encoding.d.ts +11 -11
- package/esm/cramFile/file.d.ts +4 -4
- package/esm/cramFile/index.d.ts +1 -0
- package/esm/cramFile/index.js +1 -0
- package/esm/cramFile/index.js.map +1 -1
- package/esm/cramFile/record.d.ts +5 -5
- package/esm/cramFile/sectionParsers.d.ts +7 -7
- package/esm/cramFile/slice/decodeRecord.d.ts +1 -1
- package/esm/cramFile/slice/index.d.ts +1 -1
- package/esm/cramFile/util.d.ts +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/indexedCramFile.d.ts +2 -2
- package/esm/sam.d.ts +1 -1
- package/esm/typescript.d.ts +2 -2
- package/package.json +14 -14
- package/src/cramFile/index.ts +1 -0
- package/src/index.ts +2 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import CramSlice from '../slice';
|
|
2
2
|
import { CramFileBlock } from '../file';
|
|
3
3
|
import { DataType } from './dataSeriesTypes';
|
|
4
|
-
export
|
|
4
|
+
export type DataTypeMapping = {
|
|
5
5
|
byte: number;
|
|
6
6
|
int: number;
|
|
7
7
|
long: number;
|
|
8
8
|
byteArray: Uint8Array;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type Cursor = {
|
|
11
11
|
bitPosition: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
12
12
|
bytePosition: number;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type Cursors = {
|
|
15
15
|
lastAlignmentStart: number;
|
|
16
16
|
coreBlock: Cursor;
|
|
17
17
|
externalBlocks: {
|
|
@@ -3,7 +3,7 @@ import { ByteArrayLengthEncoding, CramEncoding } from '../encoding';
|
|
|
3
3
|
import CramSlice from '../slice';
|
|
4
4
|
import { CramFileBlock } from '../file';
|
|
5
5
|
import { DataType } from './dataSeriesTypes';
|
|
6
|
-
|
|
6
|
+
type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>;
|
|
7
7
|
export default class ByteArrayStopCodec extends CramCodec<'byteArray', ByteArrayLengthEncoding['parameters']> {
|
|
8
8
|
private instantiateCodec;
|
|
9
9
|
constructor(parameters: ByteArrayLengthEncoding['parameters'], dataType: 'byteArray', instantiateCodec: CramCodecFactory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CramEncoding } from '../encoding';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type DataType = 'int' | 'byte' | 'long' | 'byteArray';
|
|
3
|
+
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';
|
|
4
|
+
export type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>;
|
|
@@ -34,8 +34,8 @@ declare const dataSeriesTypes: {
|
|
|
34
34
|
readonly QQ: "byteArray";
|
|
35
35
|
readonly TL: "int";
|
|
36
36
|
};
|
|
37
|
-
export
|
|
38
|
-
|
|
37
|
+
export type DataSeriesTypes = typeof dataSeriesTypes;
|
|
38
|
+
type DataSeriesCache = {
|
|
39
39
|
[K in DataSeriesEncodingKey]?: CramCodec<DataSeriesTypes[K]>;
|
|
40
40
|
};
|
|
41
41
|
export default class CramContainerCompressionScheme {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NullEncoding = {
|
|
2
2
|
codecId: 0;
|
|
3
3
|
parametersBytes: number;
|
|
4
4
|
parameters: Record<string, never>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ExternalCramEncoding = {
|
|
7
7
|
codecId: 1;
|
|
8
8
|
parametersBytes: number;
|
|
9
9
|
parameters: {
|
|
10
10
|
blockContentId: number;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type GolombEncoding = {
|
|
14
14
|
codecId: 2;
|
|
15
15
|
parametersBytes: number;
|
|
16
16
|
parameters: {
|
|
@@ -18,7 +18,7 @@ export declare type GolombEncoding = {
|
|
|
18
18
|
M: number;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type HuffmanEncoding = {
|
|
22
22
|
codecId: 3;
|
|
23
23
|
parametersBytes: number;
|
|
24
24
|
parameters: {
|
|
@@ -28,7 +28,7 @@ export declare type HuffmanEncoding = {
|
|
|
28
28
|
bitLengths: number[];
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type ByteArrayLengthEncoding = {
|
|
32
32
|
codecId: 4;
|
|
33
33
|
parametersBytes: number;
|
|
34
34
|
parameters: {
|
|
@@ -36,7 +36,7 @@ export declare type ByteArrayLengthEncoding = {
|
|
|
36
36
|
valuesEncoding: CramEncoding;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type ByteArrayStopCramEncoding = {
|
|
40
40
|
codecId: 5;
|
|
41
41
|
parametersBytes: number;
|
|
42
42
|
parameters: {
|
|
@@ -44,7 +44,7 @@ export declare type ByteArrayStopCramEncoding = {
|
|
|
44
44
|
blockContentId: number;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type BetaEncoding = {
|
|
48
48
|
codecId: 6;
|
|
49
49
|
parametersBytes: number;
|
|
50
50
|
parameters: {
|
|
@@ -52,7 +52,7 @@ export declare type BetaEncoding = {
|
|
|
52
52
|
length: number;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type SubexpEncoding = {
|
|
56
56
|
codecId: 7;
|
|
57
57
|
parametersBytes: number;
|
|
58
58
|
parameters: {
|
|
@@ -60,7 +60,7 @@ export declare type SubexpEncoding = {
|
|
|
60
60
|
K: number;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type GolombRiceEncoding = {
|
|
64
64
|
codecId: 8;
|
|
65
65
|
parametersBytes: number;
|
|
66
66
|
parameters: {
|
|
@@ -68,11 +68,11 @@ export declare type GolombRiceEncoding = {
|
|
|
68
68
|
log2m: number;
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
-
export
|
|
71
|
+
export type GammaEncoding = {
|
|
72
72
|
codecId: 9;
|
|
73
73
|
parametersBytes: number;
|
|
74
74
|
parameters: {
|
|
75
75
|
offset: number;
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
-
export
|
|
78
|
+
export type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding;
|
package/dist/cramFile/file.d.ts
CHANGED
|
@@ -5,18 +5,18 @@ import CramContainer from './container';
|
|
|
5
5
|
import { Parser } from '@gmod/binary-parser';
|
|
6
6
|
import CramRecord from './record';
|
|
7
7
|
import { Filehandle } from './filehandle';
|
|
8
|
-
export
|
|
8
|
+
export type CramFileSource = {
|
|
9
9
|
filehandle?: Filehandle;
|
|
10
10
|
url?: string;
|
|
11
11
|
path?: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>;
|
|
14
|
+
export type CramFileArgs = CramFileSource & {
|
|
15
15
|
checkSequenceMD5: boolean;
|
|
16
16
|
cacheSize?: number;
|
|
17
17
|
seqFetch: SeqFetch;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type CramFileBlock = BlockHeader & {
|
|
20
20
|
_endPosition: number;
|
|
21
21
|
contentPosition: number;
|
|
22
22
|
_size: number;
|
package/dist/cramFile/index.d.ts
CHANGED
package/dist/cramFile/index.js
CHANGED
|
@@ -3,6 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CramRecord = void 0;
|
|
6
7
|
const file_1 = __importDefault(require("./file"));
|
|
8
|
+
var record_1 = require("./record");
|
|
9
|
+
Object.defineProperty(exports, "CramRecord", { enumerable: true, get: function () { return __importDefault(record_1).default; } });
|
|
7
10
|
exports.default = file_1.default;
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cramFile/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cramFile/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA6B;AAC7B,mCAAgD;AAAvC,qHAAA,OAAO,OAAc;AAE9B,kBAAe,cAAQ,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import CramContainerCompressionScheme from './container/compressionScheme';
|
|
2
2
|
import decodeRecord from './slice/decodeRecord';
|
|
3
|
-
export
|
|
3
|
+
export type RefRegion = {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
seq: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ReadFeature = {
|
|
9
9
|
code: string;
|
|
10
10
|
pos: number;
|
|
11
11
|
refPos: number;
|
|
@@ -13,7 +13,7 @@ export declare type ReadFeature = {
|
|
|
13
13
|
ref?: string;
|
|
14
14
|
sub?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type MateRecord = {
|
|
17
17
|
readName?: string;
|
|
18
18
|
sequenceId: number;
|
|
19
19
|
alignmentStart: number;
|
|
@@ -23,10 +23,10 @@ export declare type MateRecord = {
|
|
|
23
23
|
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"]];
|
|
24
24
|
export declare const CramFlags: readonly [readonly [1, "PreservingQualityScores"], readonly [2, "Detached"], readonly [4, "WithMateDownstream"], readonly [8, "DecodeSequenceAsStar"]];
|
|
25
25
|
export declare const MateFlags: readonly [readonly [1, "OnNegativeStrand"], readonly [2, "Unmapped"]];
|
|
26
|
-
|
|
26
|
+
type FlagsDecoder<Type> = {
|
|
27
27
|
[Property in Type as `is${Capitalize<string & Property>}`]: (flags: number) => boolean;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
type FlagsEncoder<Type> = {
|
|
30
30
|
[Property in Type as `set${Capitalize<string & Property>}`]: (flags: number) => number;
|
|
31
31
|
};
|
|
32
32
|
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">;
|
|
@@ -7,8 +7,8 @@ declare const cramFileDefinition: {
|
|
|
7
7
|
parser: Parser<unknown>;
|
|
8
8
|
maxLength: number;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type CramTagDictionary = string[][];
|
|
11
|
+
export type CramPreservationMap = {
|
|
12
12
|
MI: boolean;
|
|
13
13
|
UI: boolean;
|
|
14
14
|
PI: boolean;
|
|
@@ -18,7 +18,7 @@ export declare type CramPreservationMap = {
|
|
|
18
18
|
SM: [number, number, number, number, number];
|
|
19
19
|
TD: CramTagDictionary;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type MappedSliceHeader = {
|
|
22
22
|
refSeqId: number;
|
|
23
23
|
refSeqStart: number;
|
|
24
24
|
refSeqSpan: number;
|
|
@@ -30,7 +30,7 @@ export declare type MappedSliceHeader = {
|
|
|
30
30
|
refBaseBlockId: number;
|
|
31
31
|
md5: TupleOf<number, 16>;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type UnmappedSliceHeader = {
|
|
34
34
|
numRecords: number;
|
|
35
35
|
recordCounter: number;
|
|
36
36
|
numBlocks: number;
|
|
@@ -39,15 +39,15 @@ export declare type UnmappedSliceHeader = {
|
|
|
39
39
|
md5: TupleOf<number, 16>;
|
|
40
40
|
};
|
|
41
41
|
export declare function isMappedSliceHeader(header: MappedSliceHeader | UnmappedSliceHeader): header is MappedSliceHeader;
|
|
42
|
-
export
|
|
43
|
-
export
|
|
42
|
+
export type CompressionMethod = 'raw' | 'gzip' | 'bzip2' | 'lzma' | 'rans' | 'rans4x16' | 'arith' | 'fqzcomp' | 'tok3';
|
|
43
|
+
export type BlockHeader = {
|
|
44
44
|
compressionMethod: CompressionMethod;
|
|
45
45
|
contentType: 'FILE_HEADER' | 'COMPRESSION_HEADER' | 'MAPPED_SLICE_HEADER' | 'UNMAPPED_SLICE_HEADER' | 'EXTERNAL_DATA' | 'CORE_DATA';
|
|
46
46
|
contentId: number;
|
|
47
47
|
compressedSize: number;
|
|
48
48
|
uncompressedSize: number;
|
|
49
49
|
};
|
|
50
|
-
export
|
|
50
|
+
export type CramCompressionHeader = ParsedItem<{
|
|
51
51
|
preservation: CramPreservationMap;
|
|
52
52
|
dataSeriesEncoding: DataSeriesEncodingMap;
|
|
53
53
|
tagEncoding: Record<string, CramEncoding>;
|
|
@@ -4,7 +4,7 @@ import CramContainerCompressionScheme, { DataSeriesTypes } from '../container/co
|
|
|
4
4
|
import { CramFileBlock } from '../file';
|
|
5
5
|
import { Cursors, DataTypeMapping } from '../codecs/_base';
|
|
6
6
|
import { DataSeriesEncodingKey } from '../codecs/dataSeriesTypes';
|
|
7
|
-
export
|
|
7
|
+
export type DataSeriesDecoder = <T extends DataSeriesEncodingKey>(dataSeriesName: T) => DataTypeMapping[DataSeriesTypes[T]];
|
|
8
8
|
export default function decodeRecord(slice: CramSlice, decodeDataSeries: DataSeriesDecoder, compressionScheme: CramContainerCompressionScheme, sliceHeader: SliceHeader, coreDataBlock: CramFileBlock, blocksByContentId: Record<number, CramFileBlock>, cursors: Cursors, majorVersion: number, recordNumber: number): {
|
|
9
9
|
readLength: number;
|
|
10
10
|
sequenceId: number;
|
|
@@ -2,7 +2,7 @@ import CramRecord from '../record';
|
|
|
2
2
|
import CramContainer from '../container';
|
|
3
3
|
import { CramFileBlock } from '../file';
|
|
4
4
|
import { MappedSliceHeader, UnmappedSliceHeader } from '../sectionParsers';
|
|
5
|
-
export
|
|
5
|
+
export type SliceHeader = CramFileBlock & {
|
|
6
6
|
parsedContent: MappedSliceHeader | UnmappedSliceHeader;
|
|
7
7
|
};
|
|
8
8
|
export default class CramSlice {
|
package/dist/cramFile/util.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Parser } from '@gmod/binary-parser';
|
|
3
3
|
export declare function itf8Size(v: number): 1 | 2 | 3 | 4 | 5;
|
|
4
4
|
export declare function parseItf8(buffer: Uint8Array, initialOffset: number): [number, number];
|
|
5
|
-
export
|
|
5
|
+
export type ParsedItem<T> = T & {
|
|
6
6
|
_endPosition: number;
|
|
7
7
|
_size: number;
|
|
8
8
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CramFile from './cramFile';
|
|
1
|
+
import CramFile, { CramRecord } from './cramFile';
|
|
2
2
|
import IndexedCramFile from './indexedCramFile';
|
|
3
3
|
import CraiIndex from './craiIndex';
|
|
4
|
-
export { CramFile, IndexedCramFile, CraiIndex };
|
|
4
|
+
export { CramFile, IndexedCramFile, CraiIndex, CramRecord };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CraiIndex = exports.IndexedCramFile = exports.CramFile = void 0;
|
|
7
|
-
const cramFile_1 =
|
|
29
|
+
exports.CramRecord = exports.CraiIndex = exports.IndexedCramFile = exports.CramFile = void 0;
|
|
30
|
+
const cramFile_1 = __importStar(require("./cramFile"));
|
|
8
31
|
exports.CramFile = cramFile_1.default;
|
|
32
|
+
Object.defineProperty(exports, "CramRecord", { enumerable: true, get: function () { return cramFile_1.CramRecord; } });
|
|
9
33
|
const indexedCramFile_1 = __importDefault(require("./indexedCramFile"));
|
|
10
34
|
exports.IndexedCramFile = indexedCramFile_1.default;
|
|
11
35
|
const craiIndex_1 = __importDefault(require("./craiIndex"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAiD;AAIxC,mBAJF,kBAAQ,CAIE;AAA8B,2FAJ5B,qBAAU,OAI4B;AAHzD,wEAA+C;AAG5B,0BAHZ,yBAAe,CAGY;AAFlC,4DAAmC;AAEC,oBAF7B,mBAAS,CAE6B"}
|
|
@@ -3,12 +3,12 @@ import CramRecord from './cramFile/record';
|
|
|
3
3
|
import { SeqFetch } from './cramFile/file';
|
|
4
4
|
import { Filehandle } from './cramFile/filehandle';
|
|
5
5
|
import { Slice } from './craiIndex';
|
|
6
|
-
export
|
|
6
|
+
export type CramFileSource = {
|
|
7
7
|
cramFilehandle?: Filehandle;
|
|
8
8
|
cramUrl?: string;
|
|
9
9
|
cramPath?: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type CramIndexLike = {
|
|
12
12
|
getEntriesForRange: (seqId: number, start: number, end: number) => Promise<Slice[]>;
|
|
13
13
|
hasDataForReferenceSequence: (seqId: number) => Promise<boolean>;
|
|
14
14
|
};
|
package/dist/sam.d.ts
CHANGED
package/dist/typescript.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function ensureNotNullish<T>(x: T | null | undefined): T;
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type TupleOf<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
|
3
|
+
export type _TupleOf<T, N extends number, R extends unknown[]> = R['length'] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
package/esm/craiIndex.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CramFileSource } from './cramFile/file';
|
|
2
|
-
export
|
|
2
|
+
export type Slice = {
|
|
3
3
|
start: number;
|
|
4
4
|
span: number;
|
|
5
5
|
containerStart: number;
|
|
6
6
|
sliceStart: number;
|
|
7
7
|
sliceBytes: number;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type ParsedIndex = Record<string, Slice[]>;
|
|
10
10
|
export default class CraiIndex {
|
|
11
11
|
private _parseCache;
|
|
12
12
|
private filehandle;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import CramSlice from '../slice';
|
|
2
2
|
import { CramFileBlock } from '../file';
|
|
3
3
|
import { DataType } from './dataSeriesTypes';
|
|
4
|
-
export
|
|
4
|
+
export type DataTypeMapping = {
|
|
5
5
|
byte: number;
|
|
6
6
|
int: number;
|
|
7
7
|
long: number;
|
|
8
8
|
byteArray: Uint8Array;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type Cursor = {
|
|
11
11
|
bitPosition: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
12
12
|
bytePosition: number;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type Cursors = {
|
|
15
15
|
lastAlignmentStart: number;
|
|
16
16
|
coreBlock: Cursor;
|
|
17
17
|
externalBlocks: {
|
|
@@ -3,7 +3,7 @@ import { ByteArrayLengthEncoding, CramEncoding } from '../encoding';
|
|
|
3
3
|
import CramSlice from '../slice';
|
|
4
4
|
import { CramFileBlock } from '../file';
|
|
5
5
|
import { DataType } from './dataSeriesTypes';
|
|
6
|
-
|
|
6
|
+
type CramCodecFactory = <TData extends DataType = DataType>(encodingData: CramEncoding, dataType: TData | 'ignore') => CramCodec<TData>;
|
|
7
7
|
export default class ByteArrayStopCodec extends CramCodec<'byteArray', ByteArrayLengthEncoding['parameters']> {
|
|
8
8
|
private instantiateCodec;
|
|
9
9
|
constructor(parameters: ByteArrayLengthEncoding['parameters'], dataType: 'byteArray', instantiateCodec: CramCodecFactory);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CramEncoding } from '../encoding';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type DataType = 'int' | 'byte' | 'long' | 'byteArray';
|
|
3
|
+
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';
|
|
4
|
+
export type DataSeriesEncodingMap = Record<DataSeriesEncodingKey, CramEncoding>;
|
|
@@ -34,8 +34,8 @@ declare const dataSeriesTypes: {
|
|
|
34
34
|
readonly QQ: "byteArray";
|
|
35
35
|
readonly TL: "int";
|
|
36
36
|
};
|
|
37
|
-
export
|
|
38
|
-
|
|
37
|
+
export type DataSeriesTypes = typeof dataSeriesTypes;
|
|
38
|
+
type DataSeriesCache = {
|
|
39
39
|
[K in DataSeriesEncodingKey]?: CramCodec<DataSeriesTypes[K]>;
|
|
40
40
|
};
|
|
41
41
|
export default class CramContainerCompressionScheme {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NullEncoding = {
|
|
2
2
|
codecId: 0;
|
|
3
3
|
parametersBytes: number;
|
|
4
4
|
parameters: Record<string, never>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ExternalCramEncoding = {
|
|
7
7
|
codecId: 1;
|
|
8
8
|
parametersBytes: number;
|
|
9
9
|
parameters: {
|
|
10
10
|
blockContentId: number;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type GolombEncoding = {
|
|
14
14
|
codecId: 2;
|
|
15
15
|
parametersBytes: number;
|
|
16
16
|
parameters: {
|
|
@@ -18,7 +18,7 @@ export declare type GolombEncoding = {
|
|
|
18
18
|
M: number;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type HuffmanEncoding = {
|
|
22
22
|
codecId: 3;
|
|
23
23
|
parametersBytes: number;
|
|
24
24
|
parameters: {
|
|
@@ -28,7 +28,7 @@ export declare type HuffmanEncoding = {
|
|
|
28
28
|
bitLengths: number[];
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type ByteArrayLengthEncoding = {
|
|
32
32
|
codecId: 4;
|
|
33
33
|
parametersBytes: number;
|
|
34
34
|
parameters: {
|
|
@@ -36,7 +36,7 @@ export declare type ByteArrayLengthEncoding = {
|
|
|
36
36
|
valuesEncoding: CramEncoding;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type ByteArrayStopCramEncoding = {
|
|
40
40
|
codecId: 5;
|
|
41
41
|
parametersBytes: number;
|
|
42
42
|
parameters: {
|
|
@@ -44,7 +44,7 @@ export declare type ByteArrayStopCramEncoding = {
|
|
|
44
44
|
blockContentId: number;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type BetaEncoding = {
|
|
48
48
|
codecId: 6;
|
|
49
49
|
parametersBytes: number;
|
|
50
50
|
parameters: {
|
|
@@ -52,7 +52,7 @@ export declare type BetaEncoding = {
|
|
|
52
52
|
length: number;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type SubexpEncoding = {
|
|
56
56
|
codecId: 7;
|
|
57
57
|
parametersBytes: number;
|
|
58
58
|
parameters: {
|
|
@@ -60,7 +60,7 @@ export declare type SubexpEncoding = {
|
|
|
60
60
|
K: number;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type GolombRiceEncoding = {
|
|
64
64
|
codecId: 8;
|
|
65
65
|
parametersBytes: number;
|
|
66
66
|
parameters: {
|
|
@@ -68,11 +68,11 @@ export declare type GolombRiceEncoding = {
|
|
|
68
68
|
log2m: number;
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
-
export
|
|
71
|
+
export type GammaEncoding = {
|
|
72
72
|
codecId: 9;
|
|
73
73
|
parametersBytes: number;
|
|
74
74
|
parameters: {
|
|
75
75
|
offset: number;
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
-
export
|
|
78
|
+
export type CramEncoding = NullEncoding | ExternalCramEncoding | GolombEncoding | HuffmanEncoding | ByteArrayLengthEncoding | ByteArrayStopCramEncoding | BetaEncoding | SubexpEncoding | GolombRiceEncoding | GammaEncoding;
|
package/esm/cramFile/file.d.ts
CHANGED
|
@@ -5,18 +5,18 @@ import CramContainer from './container';
|
|
|
5
5
|
import { Parser } from '@gmod/binary-parser';
|
|
6
6
|
import CramRecord from './record';
|
|
7
7
|
import { Filehandle } from './filehandle';
|
|
8
|
-
export
|
|
8
|
+
export type CramFileSource = {
|
|
9
9
|
filehandle?: Filehandle;
|
|
10
10
|
url?: string;
|
|
11
11
|
path?: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type SeqFetch = (seqId: number, start: number, end: number) => Promise<string>;
|
|
14
|
+
export type CramFileArgs = CramFileSource & {
|
|
15
15
|
checkSequenceMD5: boolean;
|
|
16
16
|
cacheSize?: number;
|
|
17
17
|
seqFetch: SeqFetch;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type CramFileBlock = BlockHeader & {
|
|
20
20
|
_endPosition: number;
|
|
21
21
|
contentPosition: number;
|
|
22
22
|
_size: number;
|
package/esm/cramFile/index.d.ts
CHANGED
package/esm/cramFile/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cramFile/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cramFile/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAA;AAEhD,eAAe,QAAQ,CAAA"}
|
package/esm/cramFile/record.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import CramContainerCompressionScheme from './container/compressionScheme';
|
|
2
2
|
import decodeRecord from './slice/decodeRecord';
|
|
3
|
-
export
|
|
3
|
+
export type RefRegion = {
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
seq: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ReadFeature = {
|
|
9
9
|
code: string;
|
|
10
10
|
pos: number;
|
|
11
11
|
refPos: number;
|
|
@@ -13,7 +13,7 @@ export declare type ReadFeature = {
|
|
|
13
13
|
ref?: string;
|
|
14
14
|
sub?: string;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type MateRecord = {
|
|
17
17
|
readName?: string;
|
|
18
18
|
sequenceId: number;
|
|
19
19
|
alignmentStart: number;
|
|
@@ -23,10 +23,10 @@ export declare type MateRecord = {
|
|
|
23
23
|
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"]];
|
|
24
24
|
export declare const CramFlags: readonly [readonly [1, "PreservingQualityScores"], readonly [2, "Detached"], readonly [4, "WithMateDownstream"], readonly [8, "DecodeSequenceAsStar"]];
|
|
25
25
|
export declare const MateFlags: readonly [readonly [1, "OnNegativeStrand"], readonly [2, "Unmapped"]];
|
|
26
|
-
|
|
26
|
+
type FlagsDecoder<Type> = {
|
|
27
27
|
[Property in Type as `is${Capitalize<string & Property>}`]: (flags: number) => boolean;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
type FlagsEncoder<Type> = {
|
|
30
30
|
[Property in Type as `set${Capitalize<string & Property>}`]: (flags: number) => number;
|
|
31
31
|
};
|
|
32
32
|
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">;
|