@gmod/bam 2.0.0 → 2.0.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 +16 -7
- package/dist/bai.d.ts +2 -6
- package/dist/bai.js.map +1 -1
- package/dist/bamFile.d.ts +1 -3
- package/dist/bamFile.js +7 -11
- package/dist/bamFile.js.map +1 -1
- package/dist/chunk.js +1 -1
- package/dist/chunk.js.map +1 -1
- package/dist/csi.d.ts +5 -15
- package/dist/csi.js.map +1 -1
- package/dist/htsget.js +3 -3
- package/dist/htsget.js.map +1 -1
- package/dist/record.d.ts +1 -4
- package/dist/record.js +2 -4
- package/dist/record.js.map +1 -1
- package/dist/sam.js +3 -1
- package/dist/sam.js.map +1 -1
- package/dist/util.d.ts +1 -3
- package/dist/util.js.map +1 -1
- package/dist/virtualOffset.js.map +1 -1
- package/esm/bai.d.ts +2 -6
- package/esm/bai.js.map +1 -1
- package/esm/bamFile.d.ts +1 -3
- package/esm/bamFile.js +1 -1
- package/esm/bamFile.js.map +1 -1
- package/esm/chunk.js +1 -1
- package/esm/chunk.js.map +1 -1
- package/esm/csi.d.ts +5 -15
- package/esm/csi.js.map +1 -1
- package/esm/htsget.js +0 -1
- package/esm/htsget.js.map +1 -1
- package/esm/record.d.ts +1 -4
- package/esm/record.js +2 -4
- package/esm/record.js.map +1 -1
- package/esm/sam.js +3 -1
- package/esm/sam.js.map +1 -1
- package/esm/util.d.ts +1 -3
- package/esm/util.js.map +1 -1
- package/esm/virtualOffset.js.map +1 -1
- package/package.json +10 -11
- package/src/bai.ts +2 -2
- package/src/bamFile.ts +6 -6
- package/src/chunk.ts +1 -1
- package/src/csi.ts +3 -5
- package/src/htsget.ts +1 -1
- package/src/record.ts +5 -8
- package/src/sam.ts +3 -1
- package/src/util.ts +2 -2
package/src/htsget.ts
CHANGED
|
@@ -18,7 +18,7 @@ async function concat(arr: HtsgetChunk[], opts?: Record<string, any>) {
|
|
|
18
18
|
} else {
|
|
19
19
|
//remove referer header, it is not even allowed to be specified
|
|
20
20
|
// @ts-expect-error
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const { referer, ...rest } = headers
|
|
23
23
|
const res = await fetch(url, {
|
|
24
24
|
...opts,
|
package/src/record.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
1
|
import Constants from './constants'
|
|
3
2
|
|
|
4
3
|
const SEQRET_DECODER = '=ACMGRSVTWYHKDBN'.split('')
|
|
@@ -8,7 +7,7 @@ const CIGAR_DECODER = 'MIDNSHP=X???????'.split('')
|
|
|
8
7
|
* Class of each BAM record returned by this API.
|
|
9
8
|
*/
|
|
10
9
|
export default class BamRecord {
|
|
11
|
-
private data = {} as
|
|
10
|
+
private data = {} as Record<string, any>
|
|
12
11
|
private bytes: { start: number; end: number; byteArray: Buffer }
|
|
13
12
|
private _id: number
|
|
14
13
|
private _tagOffset: number | undefined
|
|
@@ -84,12 +83,12 @@ export default class BamRecord {
|
|
|
84
83
|
tags = tags.concat(this._tagList || [])
|
|
85
84
|
|
|
86
85
|
for (const k of Object.keys(this.data)) {
|
|
87
|
-
if (k
|
|
86
|
+
if (!k.startsWith('_') && k !== 'next_seq_id') {
|
|
88
87
|
tags.push(k)
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
const seen:
|
|
91
|
+
const seen: Record<string, boolean> = {}
|
|
93
92
|
return tags.filter(t => {
|
|
94
93
|
if (
|
|
95
94
|
(t in this.data && this.data[t] === undefined) ||
|
|
@@ -494,8 +493,6 @@ export default class BamRecord {
|
|
|
494
493
|
}
|
|
495
494
|
}
|
|
496
495
|
|
|
497
|
-
_flags() {}
|
|
498
|
-
|
|
499
496
|
length_on_ref() {
|
|
500
497
|
if (this.data.length_on_ref) {
|
|
501
498
|
return this.data.length_on_ref
|
|
@@ -606,9 +603,9 @@ export default class BamRecord {
|
|
|
606
603
|
}
|
|
607
604
|
|
|
608
605
|
toJSON() {
|
|
609
|
-
const data:
|
|
606
|
+
const data: Record<string, any> = {}
|
|
610
607
|
for (const k of Object.keys(this)) {
|
|
611
|
-
if (k.
|
|
608
|
+
if (k.startsWith('_') || k === 'bytes') {
|
|
612
609
|
continue
|
|
613
610
|
}
|
|
614
611
|
//@ts-ignore
|
package/src/sam.ts
CHANGED
|
@@ -7,7 +7,9 @@ export function parseHeaderText(text: string) {
|
|
|
7
7
|
data.push({
|
|
8
8
|
tag: tag.slice(1),
|
|
9
9
|
data: fields.map(f => {
|
|
10
|
-
const
|
|
10
|
+
const r = f.indexOf(':')
|
|
11
|
+
const fieldTag = f.slice(0, r)
|
|
12
|
+
const value = f.slice(r + 1)
|
|
11
13
|
return { tag: fieldTag, value }
|
|
12
14
|
}),
|
|
13
15
|
})
|
package/src/util.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface BaseOpts {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export function makeOpts(obj: AbortSignal | BaseOpts = {}): BaseOpts {
|
|
78
|
-
return 'aborted' in obj ? ({ signal: obj } as BaseOpts) :
|
|
78
|
+
return 'aborted' in obj ? ({ signal: obj } as BaseOpts) : obj
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export function optimizeChunks(chunks: Chunk[], lowest?: VirtualOffset) {
|
|
@@ -140,7 +140,7 @@ export function parseNameBytes(
|
|
|
140
140
|
let currRefId = 0
|
|
141
141
|
let currNameStart = 0
|
|
142
142
|
const refIdToName = []
|
|
143
|
-
const refNameToId:
|
|
143
|
+
const refNameToId: Record<string, number> = {}
|
|
144
144
|
for (let i = 0; i < namesBytes.length; i += 1) {
|
|
145
145
|
if (!namesBytes[i]) {
|
|
146
146
|
if (currNameStart < i) {
|