@jbrowse/plugin-alignments 4.1.8 → 4.1.9
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.
|
@@ -16,13 +16,13 @@ export default class CramSlightlyLazyFeature implements Feature {
|
|
|
16
16
|
get qual(): string;
|
|
17
17
|
get qualRaw(): Uint8Array<ArrayBufferLike> | null | undefined;
|
|
18
18
|
get refName(): string;
|
|
19
|
-
get pair_orientation(): string |
|
|
19
|
+
get pair_orientation(): string | undefined;
|
|
20
20
|
get template_length(): number | undefined;
|
|
21
21
|
get next_ref(): string | undefined;
|
|
22
22
|
get next_segment_position(): string | undefined;
|
|
23
23
|
get is_paired(): boolean;
|
|
24
24
|
get next_pos(): number | undefined;
|
|
25
|
-
get tags(): Record<string, string>;
|
|
25
|
+
get tags(): Record<string, string | number | number[] | undefined>;
|
|
26
26
|
get seq(): string | null | undefined;
|
|
27
27
|
get NUMERIC_CIGAR(): ArrayLike<number>;
|
|
28
28
|
get CIGAR(): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CODE_D, CODE_H, CODE_I, CODE_N, CODE_S, CODE_X, CODE_i, } from "./const.js";
|
|
2
1
|
import { readFeaturesToNumericCIGAR } from "./readFeaturesToNumericCIGAR.js";
|
|
3
2
|
import { CHAR_FROM_CODE } from "../PileupRenderer/renderers/cigarUtil.js";
|
|
4
3
|
import { DELETION_TYPE, HARDCLIP_TYPE, INSERTION_TYPE, MISMATCH_TYPE, SKIP_TYPE, SOFTCLIP_TYPE, } from "../shared/forEachMismatchTypes.js";
|
|
@@ -179,28 +178,28 @@ export default class CramSlightlyLazyFeature {
|
|
|
179
178
|
insertedBasesLen = 0;
|
|
180
179
|
}
|
|
181
180
|
refPos = rf.refPos - 1 - featStart;
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
181
|
+
const { code } = rf;
|
|
182
|
+
if (code === 'X') {
|
|
184
183
|
const refCharCode = rf.ref ? rf.ref.charCodeAt(0) & ~0x20 : 0;
|
|
185
|
-
callback(MISMATCH_TYPE, refPos, 1, rf.sub, hasQual ? qual[rf.pos - 1] : -1, refCharCode, 0);
|
|
184
|
+
callback(MISMATCH_TYPE, refPos, 1, rf.sub ?? '', hasQual ? qual[rf.pos - 1] : -1, refCharCode, 0);
|
|
186
185
|
}
|
|
187
|
-
else if (
|
|
186
|
+
else if (code === 'I') {
|
|
188
187
|
callback(INSERTION_TYPE, refPos, 0, rf.data, -1, 0, rf.data.length);
|
|
189
188
|
}
|
|
190
|
-
else if (
|
|
189
|
+
else if (code === 'N') {
|
|
191
190
|
callback(SKIP_TYPE, refPos, rf.data, 'N', -1, 0, 0);
|
|
192
191
|
}
|
|
193
|
-
else if (
|
|
192
|
+
else if (code === 'S') {
|
|
194
193
|
const dataLen = rf.data.length;
|
|
195
194
|
callback(SOFTCLIP_TYPE, refPos, 1, `S${dataLen}`, -1, 0, dataLen);
|
|
196
195
|
}
|
|
197
|
-
else if (
|
|
196
|
+
else if (code === 'H') {
|
|
198
197
|
callback(HARDCLIP_TYPE, refPos, 1, `H${rf.data}`, -1, 0, rf.data);
|
|
199
198
|
}
|
|
200
|
-
else if (
|
|
199
|
+
else if (code === 'D') {
|
|
201
200
|
callback(DELETION_TYPE, refPos, rf.data, '*', -1, 0, 0);
|
|
202
201
|
}
|
|
203
|
-
else if (
|
|
202
|
+
else if (code === 'i') {
|
|
204
203
|
insertedBases += rf.data;
|
|
205
204
|
insertedBasesLen++;
|
|
206
205
|
}
|
|
@@ -1,112 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
72: 5,
|
|
9
|
-
80: 6,
|
|
10
|
-
61: 7,
|
|
11
|
-
88: 8,
|
|
12
|
-
};
|
|
1
|
+
const CIGAR_OP_M = 0;
|
|
2
|
+
const CIGAR_OP_I = 1;
|
|
3
|
+
const CIGAR_OP_D = 2;
|
|
4
|
+
const CIGAR_OP_N = 3;
|
|
5
|
+
const CIGAR_OP_S = 4;
|
|
6
|
+
const CIGAR_OP_H = 5;
|
|
7
|
+
const CIGAR_OP_P = 6;
|
|
13
8
|
export function readFeaturesToNumericCIGAR(readFeatures, alignmentStart, readLen) {
|
|
14
9
|
const cigarParts = [];
|
|
15
|
-
let op =
|
|
10
|
+
let op = CIGAR_OP_M;
|
|
16
11
|
let oplen = 0;
|
|
17
12
|
let lastPos = alignmentStart;
|
|
18
13
|
let insLen = 0;
|
|
19
14
|
let seqLen = 0;
|
|
20
15
|
if (readFeatures !== undefined) {
|
|
21
16
|
for (let i = 0, l = readFeatures.length; i < l; i++) {
|
|
22
|
-
const
|
|
17
|
+
const rf = readFeatures[i];
|
|
18
|
+
const { code, refPos } = rf;
|
|
23
19
|
const sublen = refPos - lastPos;
|
|
24
20
|
seqLen += sublen;
|
|
25
21
|
lastPos = refPos;
|
|
26
22
|
if (insLen && sublen) {
|
|
27
|
-
|
|
28
|
-
cigarParts.push((insLen << 4) | opIndex);
|
|
23
|
+
cigarParts.push((insLen << 4) | CIGAR_OP_I);
|
|
29
24
|
insLen = 0;
|
|
30
25
|
}
|
|
31
|
-
if (oplen && op !==
|
|
32
|
-
|
|
33
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
26
|
+
if (oplen && op !== CIGAR_OP_M) {
|
|
27
|
+
cigarParts.push((oplen << 4) | op);
|
|
34
28
|
oplen = 0;
|
|
35
29
|
}
|
|
36
30
|
if (sublen) {
|
|
37
|
-
op =
|
|
31
|
+
op = CIGAR_OP_M;
|
|
38
32
|
oplen += sublen;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const addedLen = data.split(',').length;
|
|
34
|
+
if (code === 'b') {
|
|
35
|
+
const addedLen = rf.data.split(',').length;
|
|
43
36
|
seqLen += addedLen;
|
|
44
37
|
lastPos += addedLen;
|
|
45
38
|
oplen += addedLen;
|
|
46
39
|
}
|
|
47
|
-
else if (
|
|
40
|
+
else if (code === 'B' || code === 'X') {
|
|
48
41
|
seqLen++;
|
|
49
42
|
lastPos++;
|
|
50
43
|
oplen++;
|
|
51
44
|
}
|
|
52
|
-
else if (
|
|
53
|
-
lastPos += data;
|
|
45
|
+
else if (code === 'D' || code === 'N') {
|
|
46
|
+
lastPos += rf.data;
|
|
54
47
|
if (oplen) {
|
|
55
|
-
|
|
56
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
48
|
+
cigarParts.push((oplen << 4) | op);
|
|
57
49
|
oplen = 0;
|
|
58
50
|
}
|
|
59
|
-
const opIndex =
|
|
60
|
-
cigarParts.push((data << 4) | opIndex);
|
|
51
|
+
const opIndex = code === 'D' ? CIGAR_OP_D : CIGAR_OP_N;
|
|
52
|
+
cigarParts.push((rf.data << 4) | opIndex);
|
|
61
53
|
}
|
|
62
|
-
else if (
|
|
63
|
-
const dataLen = data.length;
|
|
54
|
+
else if (code === 'I' || code === 'S') {
|
|
55
|
+
const dataLen = rf.data.length;
|
|
64
56
|
seqLen += dataLen;
|
|
65
57
|
if (oplen) {
|
|
66
|
-
|
|
67
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
58
|
+
cigarParts.push((oplen << 4) | op);
|
|
68
59
|
oplen = 0;
|
|
69
60
|
}
|
|
70
|
-
const opIndex =
|
|
61
|
+
const opIndex = code === 'I' ? CIGAR_OP_I : CIGAR_OP_S;
|
|
71
62
|
cigarParts.push((dataLen << 4) | opIndex);
|
|
72
63
|
}
|
|
73
|
-
else if (
|
|
64
|
+
else if (code === 'i') {
|
|
74
65
|
if (oplen) {
|
|
75
|
-
|
|
76
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
66
|
+
cigarParts.push((oplen << 4) | op);
|
|
77
67
|
oplen = 0;
|
|
78
68
|
}
|
|
79
69
|
insLen++;
|
|
80
70
|
seqLen++;
|
|
81
71
|
}
|
|
82
|
-
else if (
|
|
72
|
+
else if (code === 'P' || code === 'H') {
|
|
83
73
|
if (oplen) {
|
|
84
|
-
|
|
85
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
74
|
+
cigarParts.push((oplen << 4) | op);
|
|
86
75
|
oplen = 0;
|
|
87
76
|
}
|
|
88
|
-
const opIndex =
|
|
89
|
-
cigarParts.push((data << 4) | opIndex);
|
|
77
|
+
const opIndex = code === 'P' ? CIGAR_OP_P : CIGAR_OP_H;
|
|
78
|
+
cigarParts.push((rf.data << 4) | opIndex);
|
|
90
79
|
}
|
|
91
80
|
}
|
|
92
81
|
}
|
|
93
82
|
const remaining = readLen - seqLen;
|
|
94
83
|
if (remaining) {
|
|
95
|
-
if (oplen && op !==
|
|
96
|
-
|
|
97
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
84
|
+
if (oplen && op !== CIGAR_OP_M) {
|
|
85
|
+
cigarParts.push((oplen << 4) | op);
|
|
98
86
|
oplen = 0;
|
|
99
87
|
}
|
|
100
|
-
op =
|
|
88
|
+
op = CIGAR_OP_M;
|
|
101
89
|
oplen += remaining;
|
|
102
90
|
}
|
|
103
91
|
if (remaining && insLen) {
|
|
104
|
-
|
|
105
|
-
cigarParts.push((insLen << 4) | opIndex);
|
|
92
|
+
cigarParts.push((insLen << 4) | CIGAR_OP_I);
|
|
106
93
|
}
|
|
107
94
|
if (oplen) {
|
|
108
|
-
|
|
109
|
-
cigarParts.push((oplen << 4) | opIndex);
|
|
95
|
+
cigarParts.push((oplen << 4) | op);
|
|
110
96
|
}
|
|
111
97
|
return cigarParts;
|
|
112
98
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-alignments",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 alignments adapters, tracks, etc.",
|
|
6
6
|
"keywords": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"esm"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@gmod/bam": "^7.1.
|
|
25
|
-
"@gmod/cram": "^8.0.
|
|
24
|
+
"@gmod/bam": "^7.1.17",
|
|
25
|
+
"@gmod/cram": "^8.0.4",
|
|
26
26
|
"@jbrowse/mobx-state-tree": "^5.5.0",
|
|
27
27
|
"@mui/icons-material": "^7.3.8",
|
|
28
28
|
"@mui/material": "^7.3.8",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"mobx": "^6.15.0",
|
|
35
35
|
"mobx-react": "^9.2.1",
|
|
36
36
|
"rxjs": "^7.8.2",
|
|
37
|
-
"@jbrowse/
|
|
38
|
-
"@jbrowse/
|
|
39
|
-
"@jbrowse/
|
|
40
|
-
"@jbrowse/plugin-
|
|
37
|
+
"@jbrowse/plugin-wiggle": "^4.1.9",
|
|
38
|
+
"@jbrowse/sv-core": "^4.1.9",
|
|
39
|
+
"@jbrowse/core": "^4.1.9",
|
|
40
|
+
"@jbrowse/plugin-linear-genome-view": "^4.1.9"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=18.0.0"
|