@gmod/cram 4.0.0 → 4.0.3
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/dist/cram-bundle.js +1 -1
- package/dist/cram-bundle.js.LICENSE.txt +0 -9
- package/dist/cramFile/slice/index.d.ts +1 -1
- package/dist/cramFile/slice/index.js +3 -1
- package/dist/cramFile/slice/index.js.map +1 -1
- package/dist/indexedCramFile.d.ts +14 -8
- package/dist/indexedCramFile.js +16 -13
- package/dist/indexedCramFile.js.map +1 -1
- package/dist/io/index.d.ts +1 -1
- package/dist/io/index.js +3 -3
- package/dist/io/index.js.map +1 -1
- package/esm/cramFile/slice/index.d.ts +1 -1
- package/esm/cramFile/slice/index.js +3 -1
- package/esm/cramFile/slice/index.js.map +1 -1
- package/esm/indexedCramFile.d.ts +14 -8
- package/esm/indexedCramFile.js +16 -13
- package/esm/indexedCramFile.js.map +1 -1
- package/esm/io/index.d.ts +1 -1
- package/esm/io/index.js +1 -1
- package/esm/io/index.js.map +1 -1
- package/package.json +7 -7
- package/src/cramFile/slice/index.ts +3 -1
- package/src/indexedCramFile.ts +24 -17
- package/src/io/index.ts +1 -1
package/src/indexedCramFile.ts
CHANGED
|
@@ -29,10 +29,17 @@ export default class IndexedCramFile {
|
|
|
29
29
|
*
|
|
30
30
|
* @param {object} args
|
|
31
31
|
* @param {CramFile} args.cram
|
|
32
|
-
*
|
|
33
|
-
* @param {
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* @param {Index-like} args.index object that supports
|
|
34
|
+
* getEntriesForRange(seqId,start,end) -> Promise[Array[index entries]]
|
|
35
|
+
*
|
|
36
|
+
* @param {number} [args.cacheSize] optional maximum number of CRAM records
|
|
37
|
+
* to cache. default 20,000
|
|
38
|
+
*
|
|
39
|
+
* @param {boolean} [args.checkSequenceMD5] - default true. if false,
|
|
40
|
+
* disables verifying the MD5 checksum of the reference sequence underlying a
|
|
41
|
+
* slice. In some applications, this check can cause an inconvenient amount
|
|
42
|
+
* (many megabases) of sequences to be fetched.
|
|
36
43
|
*/
|
|
37
44
|
constructor(
|
|
38
45
|
args: {
|
|
@@ -47,7 +54,6 @@ export default class IndexedCramFile {
|
|
|
47
54
|
} & CramFileSource)
|
|
48
55
|
),
|
|
49
56
|
) {
|
|
50
|
-
// { cram, index, seqFetch /* fasta, fastaIndex */ }) {
|
|
51
57
|
this.cram =
|
|
52
58
|
args.cram ??
|
|
53
59
|
new CramFile({
|
|
@@ -68,10 +74,9 @@ export default class IndexedCramFile {
|
|
|
68
74
|
|
|
69
75
|
/**
|
|
70
76
|
*
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @returns {Promise[Array[CramRecord]]}
|
|
77
|
+
* @param seq numeric ID of the reference sequence
|
|
78
|
+
* @param start start of the range of interest. 1-based closed coordinates.
|
|
79
|
+
* @param end end of the range of interest. 1-based closed coordinates.
|
|
75
80
|
*/
|
|
76
81
|
async getRecordsForRange(
|
|
77
82
|
seq: number,
|
|
@@ -96,16 +101,18 @@ export default class IndexedCramFile {
|
|
|
96
101
|
const seqId = seq
|
|
97
102
|
const slices = await this.index.getEntriesForRange(seqId, start, end)
|
|
98
103
|
|
|
99
|
-
// TODO: do we need to merge or de-duplicate the blocks?
|
|
100
|
-
|
|
101
104
|
// fetch all the slices and parse the feature data
|
|
102
|
-
const filter = (feature: CramRecord) =>
|
|
103
|
-
feature.sequenceId === seq &&
|
|
104
|
-
feature.alignmentStart <= end &&
|
|
105
|
-
feature.lengthOnRef !== undefined &&
|
|
106
|
-
feature.alignmentStart + feature.lengthOnRef - 1 >= start
|
|
107
105
|
const sliceResults = await Promise.all(
|
|
108
|
-
slices.map(slice =>
|
|
106
|
+
slices.map(slice =>
|
|
107
|
+
this.getRecordsInSlice(
|
|
108
|
+
slice,
|
|
109
|
+
feature =>
|
|
110
|
+
feature.sequenceId === seq &&
|
|
111
|
+
feature.alignmentStart <= end &&
|
|
112
|
+
feature.lengthOnRef !== undefined &&
|
|
113
|
+
feature.alignmentStart + feature.lengthOnRef - 1 >= start,
|
|
114
|
+
),
|
|
115
|
+
),
|
|
109
116
|
)
|
|
110
117
|
|
|
111
118
|
let ret: CramRecord[] = Array.prototype.concat(...sliceResults)
|
package/src/io/index.ts
CHANGED