@jbrowse/plugin-alignments 2.4.0 → 2.4.1
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/BamAdapter/BamAdapter.js +2 -2
- package/dist/BamAdapter/BamAdapter.js.map +1 -1
- package/dist/BamAdapter/BamSlightlyLazyFeature.js +2 -2
- package/dist/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
- package/dist/CramAdapter/CramAdapter.js +2 -2
- package/dist/CramAdapter/CramAdapter.js.map +1 -1
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +2 -2
- package/dist/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
- package/dist/CramAdapter/util.js +10 -10
- package/dist/CramAdapter/util.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +1 -3
- package/dist/LinearAlignmentsDisplay/models/model.js +3 -4
- package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/dist/LinearPileupDisplay/index.d.ts +2 -3
- package/dist/LinearPileupDisplay/index.js +4 -2
- package/dist/LinearPileupDisplay/index.js.map +1 -1
- package/dist/LinearPileupDisplay/model.d.ts +7 -9
- package/dist/LinearPileupDisplay/model.js +4 -4
- package/dist/LinearPileupDisplay/model.js.map +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +2 -2
- package/dist/LinearReadCloudDisplay/model.d.ts +2 -2
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +2 -2
- package/dist/MismatchParser/index.js +4 -6
- package/dist/MismatchParser/index.js.map +1 -1
- package/dist/NestedFrequencyTable.js +3 -13
- package/dist/NestedFrequencyTable.js.map +1 -1
- package/dist/PileupRPC/rpcMethods.d.ts +3 -4
- package/dist/PileupRPC/rpcMethods.js +6 -6
- package/dist/PileupRPC/rpcMethods.js.map +1 -1
- package/dist/PileupRenderer/PileupRenderer.d.ts +6 -4
- package/dist/PileupRenderer/PileupRenderer.js +30 -34
- package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
- package/dist/PileupRenderer/components/PileupRendering.js +2 -2
- package/dist/PileupRenderer/components/PileupRendering.js.map +1 -1
- package/dist/PileupRenderer/configSchema.js +1 -1
- package/dist/PileupRenderer/configSchema.js.map +1 -1
- package/dist/PileupRenderer/sortUtil.js +5 -4
- package/dist/PileupRenderer/sortUtil.js.map +1 -1
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +10 -7
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/esm/BamAdapter/BamAdapter.js +2 -2
- package/esm/BamAdapter/BamAdapter.js.map +1 -1
- package/esm/BamAdapter/BamSlightlyLazyFeature.js +2 -2
- package/esm/BamAdapter/BamSlightlyLazyFeature.js.map +1 -1
- package/esm/CramAdapter/CramAdapter.js +2 -2
- package/esm/CramAdapter/CramAdapter.js.map +1 -1
- package/esm/CramAdapter/CramSlightlyLazyFeature.js +2 -2
- package/esm/CramAdapter/CramSlightlyLazyFeature.js.map +1 -1
- package/esm/CramAdapter/util.js +10 -10
- package/esm/CramAdapter/util.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +2 -2
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/models/model.d.ts +1 -3
- package/esm/LinearAlignmentsDisplay/models/model.js +3 -4
- package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/esm/LinearPileupDisplay/index.d.ts +2 -3
- package/esm/LinearPileupDisplay/index.js +2 -1
- package/esm/LinearPileupDisplay/index.js.map +1 -1
- package/esm/LinearPileupDisplay/model.d.ts +7 -9
- package/esm/LinearPileupDisplay/model.js +4 -4
- package/esm/LinearPileupDisplay/model.js.map +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +2 -2
- package/esm/LinearReadCloudDisplay/model.d.ts +2 -2
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +2 -2
- package/esm/MismatchParser/index.js +4 -6
- package/esm/MismatchParser/index.js.map +1 -1
- package/esm/NestedFrequencyTable.js +3 -13
- package/esm/NestedFrequencyTable.js.map +1 -1
- package/esm/PileupRPC/rpcMethods.d.ts +3 -4
- package/esm/PileupRPC/rpcMethods.js +3 -4
- package/esm/PileupRPC/rpcMethods.js.map +1 -1
- package/esm/PileupRenderer/PileupRenderer.d.ts +6 -4
- package/esm/PileupRenderer/PileupRenderer.js +30 -34
- package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
- package/esm/PileupRenderer/components/PileupRendering.js +2 -2
- package/esm/PileupRenderer/components/PileupRendering.js.map +1 -1
- package/esm/PileupRenderer/configSchema.js +1 -1
- package/esm/PileupRenderer/configSchema.js.map +1 -1
- package/esm/PileupRenderer/sortUtil.js +5 -4
- package/esm/PileupRenderer/sortUtil.js.map +1 -1
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +10 -7
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js.map +1 -1
- package/esm/index.d.ts +3 -5
- package/esm/index.js +3 -3
- package/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/AlignmentsFeatureDetail/index.test.tsx +1 -1
- package/src/BamAdapter/BamAdapter.ts +2 -2
- package/src/BamAdapter/BamSlightlyLazyFeature.ts +2 -2
- package/src/CramAdapter/CramAdapter.ts +2 -2
- package/src/CramAdapter/CramSlightlyLazyFeature.ts +2 -2
- package/src/CramAdapter/util.ts +10 -10
- package/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx +2 -2
- package/src/LinearAlignmentsDisplay/models/configSchema.test.ts +1 -1
- package/src/LinearAlignmentsDisplay/models/model.tsx +3 -4
- package/src/LinearPileupDisplay/index.ts +2 -4
- package/src/LinearPileupDisplay/model.ts +4 -4
- package/src/LinearSNPCoverageDisplay/models/configSchema.test.ts +1 -1
- package/src/MismatchParser/index.ts +3 -5
- package/src/NestedFrequencyTable.ts +3 -11
- package/src/PileupRPC/rpcMethods.ts +3 -9
- package/src/PileupRenderer/PileupRenderer.ts +47 -61
- package/src/PileupRenderer/components/PileupRendering.tsx +2 -2
- package/src/PileupRenderer/configSchema.ts +1 -1
- package/src/PileupRenderer/sortUtil.ts +5 -4
- package/src/SNPCoverageRenderer/SNPCoverageRenderer.ts +14 -13
- package/src/index.ts +5 -10
|
@@ -97,9 +97,9 @@ export default class BamSlightlyLazyFeature implements Feature {
|
|
|
97
97
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
98
98
|
get(field: string): any {
|
|
99
99
|
const methodName = `_get_${field}`
|
|
100
|
-
// @ts-
|
|
100
|
+
// @ts-expect-error
|
|
101
101
|
if (this[methodName]) {
|
|
102
|
-
// @ts-
|
|
102
|
+
// @ts-expect-error
|
|
103
103
|
return this[methodName]()
|
|
104
104
|
}
|
|
105
105
|
return this.record.get(field)
|
|
@@ -124,7 +124,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
124
124
|
const trimEnd = Math.min(end - chunkStart, chunkEnd - chunkStart)
|
|
125
125
|
const trimLength = trimEnd - trimStart
|
|
126
126
|
const chunkSeq = chunk.get('seq') || chunk.get('residues')
|
|
127
|
-
return chunkSeq.
|
|
127
|
+
return chunkSeq.slice(trimStart, trimStart + trimLength)
|
|
128
128
|
})
|
|
129
129
|
.join('')
|
|
130
130
|
|
|
@@ -253,7 +253,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
|
|
|
253
253
|
|
|
254
254
|
if (tagFilter) {
|
|
255
255
|
filtered = filtered.filter(record => {
|
|
256
|
-
// @ts-
|
|
256
|
+
// @ts-expect-error
|
|
257
257
|
const val = record[tagFilter.tag]
|
|
258
258
|
return val === '*' ? val !== undefined : val === tagFilter.value
|
|
259
259
|
})
|
|
@@ -131,9 +131,9 @@ export default class CramSlightlyLazyFeature implements Feature {
|
|
|
131
131
|
|
|
132
132
|
get(field: string) {
|
|
133
133
|
const methodName = `_get_${field}`
|
|
134
|
-
// @ts-
|
|
134
|
+
// @ts-expect-error
|
|
135
135
|
if (this[methodName]) {
|
|
136
|
-
// @ts-
|
|
136
|
+
// @ts-expect-error
|
|
137
137
|
return this[methodName]()
|
|
138
138
|
}
|
|
139
139
|
return undefined
|
package/src/CramAdapter/util.ts
CHANGED
|
@@ -153,7 +153,7 @@ export function readFeaturesToCIGAR(
|
|
|
153
153
|
for (let i = 0; i < readFeatures.length; i++) {
|
|
154
154
|
const { code, refPos, sub, data } = readFeatures[i]
|
|
155
155
|
sublen = refPos - lastPos
|
|
156
|
-
seq += ref.
|
|
156
|
+
seq += ref.slice(lastPos - refStart, refPos - refStart)
|
|
157
157
|
lastPos = refPos
|
|
158
158
|
|
|
159
159
|
if (insLen > 0 && sublen) {
|
|
@@ -161,7 +161,7 @@ export function readFeaturesToCIGAR(
|
|
|
161
161
|
insLen = 0
|
|
162
162
|
}
|
|
163
163
|
if (oplen && op !== 'M') {
|
|
164
|
-
cigar += oplen
|
|
164
|
+
cigar += `${oplen}${op}`
|
|
165
165
|
oplen = 0
|
|
166
166
|
}
|
|
167
167
|
if (sublen) {
|
|
@@ -190,7 +190,7 @@ export function readFeaturesToCIGAR(
|
|
|
190
190
|
// Deletion or Ref Skip
|
|
191
191
|
lastPos += data
|
|
192
192
|
if (oplen) {
|
|
193
|
-
cigar += oplen
|
|
193
|
+
cigar += `${oplen}${op}`
|
|
194
194
|
}
|
|
195
195
|
cigar += data + code
|
|
196
196
|
oplen = 0
|
|
@@ -198,7 +198,7 @@ export function readFeaturesToCIGAR(
|
|
|
198
198
|
// Insertion or soft-clip
|
|
199
199
|
seq += data
|
|
200
200
|
if (oplen) {
|
|
201
|
-
cigar += oplen
|
|
201
|
+
cigar += `${oplen}${op}`
|
|
202
202
|
}
|
|
203
203
|
cigar += data.length + code
|
|
204
204
|
oplen = 0
|
|
@@ -206,7 +206,7 @@ export function readFeaturesToCIGAR(
|
|
|
206
206
|
// Single base insertion
|
|
207
207
|
// seq += data
|
|
208
208
|
if (oplen) {
|
|
209
|
-
cigar += oplen
|
|
209
|
+
cigar += `${oplen}${op}`
|
|
210
210
|
}
|
|
211
211
|
insLen++
|
|
212
212
|
seq += data
|
|
@@ -214,13 +214,13 @@ export function readFeaturesToCIGAR(
|
|
|
214
214
|
} else if (code === 'P') {
|
|
215
215
|
// Padding
|
|
216
216
|
if (oplen) {
|
|
217
|
-
cigar += oplen
|
|
217
|
+
cigar += `${oplen}${op}`
|
|
218
218
|
}
|
|
219
219
|
cigar += `${data}P`
|
|
220
220
|
} else if (code === 'H') {
|
|
221
221
|
// Hard clip
|
|
222
222
|
if (oplen) {
|
|
223
|
-
cigar += oplen
|
|
223
|
+
cigar += `${oplen}${op}`
|
|
224
224
|
}
|
|
225
225
|
cigar += `${data}H`
|
|
226
226
|
oplen = 0
|
|
@@ -231,10 +231,10 @@ export function readFeaturesToCIGAR(
|
|
|
231
231
|
}
|
|
232
232
|
if (seq.length !== readLen) {
|
|
233
233
|
sublen = readLen - seq.length
|
|
234
|
-
seq += ref.
|
|
234
|
+
seq += ref.slice(lastPos - refStart, lastPos - refStart + sublen)
|
|
235
235
|
|
|
236
236
|
if (oplen && op !== 'M') {
|
|
237
|
-
cigar += oplen
|
|
237
|
+
cigar += `${oplen}${op}`
|
|
238
238
|
oplen = 0
|
|
239
239
|
}
|
|
240
240
|
op = 'M'
|
|
@@ -244,7 +244,7 @@ export function readFeaturesToCIGAR(
|
|
|
244
244
|
cigar += `${insLen}I`
|
|
245
245
|
}
|
|
246
246
|
if (oplen) {
|
|
247
|
-
cigar += oplen
|
|
247
|
+
cigar += `${oplen}${op}`
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
return cigar
|
|
@@ -7,13 +7,13 @@ import { ResizeHandle } from '@jbrowse/core/ui'
|
|
|
7
7
|
// locals
|
|
8
8
|
import { AlignmentsDisplayModel } from '../models/model'
|
|
9
9
|
|
|
10
|
-
const useStyles = makeStyles()(
|
|
10
|
+
const useStyles = makeStyles()({
|
|
11
11
|
resizeHandle: {
|
|
12
12
|
height: 2,
|
|
13
13
|
position: 'absolute',
|
|
14
14
|
zIndex: 2,
|
|
15
15
|
},
|
|
16
|
-
})
|
|
16
|
+
})
|
|
17
17
|
|
|
18
18
|
function AlignmentsDisplay({ model }: { model: AlignmentsDisplayModel }) {
|
|
19
19
|
const { PileupDisplay, SNPCoverageDisplay } = model
|
|
@@ -27,9 +27,9 @@ function getLowerPanelDisplays(pluginManager: PluginManager) {
|
|
|
27
27
|
return (
|
|
28
28
|
pluginManager
|
|
29
29
|
.getDisplayElements()
|
|
30
|
-
// @ts-
|
|
30
|
+
// @ts-expect-error
|
|
31
31
|
.filter(f => f.subDisplay?.type === 'LinearAlignmentsDisplay')
|
|
32
|
-
// @ts-
|
|
32
|
+
// @ts-expect-error
|
|
33
33
|
.filter(f => f.subDisplay?.lowerPanel)
|
|
34
34
|
)
|
|
35
35
|
}
|
|
@@ -87,7 +87,6 @@ function AlignmentsModel(
|
|
|
87
87
|
* #property
|
|
88
88
|
* refers to LinearPileupDisplay sub-display model
|
|
89
89
|
*/
|
|
90
|
-
// @ts-ignore
|
|
91
90
|
PileupDisplay: types.maybe(types.union(...lowerPanelDisplays)),
|
|
92
91
|
/**
|
|
93
92
|
* #property
|
|
@@ -381,7 +380,7 @@ function stateModelFactory(
|
|
|
381
380
|
if (!snap) {
|
|
382
381
|
return snap
|
|
383
382
|
}
|
|
384
|
-
// @ts-
|
|
383
|
+
// @ts-expect-error
|
|
385
384
|
const { height, ...rest } = snap
|
|
386
385
|
return { heightPreConfig: height, ...rest }
|
|
387
386
|
})
|
|
@@ -20,7 +20,5 @@ export default function register(pluginManager: PluginManager) {
|
|
|
20
20
|
})
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export {
|
|
24
|
-
|
|
25
|
-
configSchemaFactory as linearPileupDisplayConfigSchemaFactory,
|
|
26
|
-
}
|
|
23
|
+
export { default as linearPileupDisplayStateModelFactory } from './model'
|
|
24
|
+
export { default as linearPileupDisplayConfigSchemaFactory } from './configSchema'
|
|
@@ -275,7 +275,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
275
275
|
if (sortedBy) {
|
|
276
276
|
const { pos, refName, assemblyName } = sortedBy
|
|
277
277
|
// render just the sorted region first
|
|
278
|
-
// @ts-
|
|
278
|
+
// @ts-expect-error
|
|
279
279
|
await self.rendererType.renderInClient(rpcManager, {
|
|
280
280
|
assemblyName,
|
|
281
281
|
regions: [
|
|
@@ -337,9 +337,9 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
337
337
|
// feature.id that was returned e.g. that the user hasn't
|
|
338
338
|
// moused over to a new position during the async operation
|
|
339
339
|
// above
|
|
340
|
-
// @ts-
|
|
340
|
+
// @ts-expect-error
|
|
341
341
|
if (self.featureIdUnderMouse === feature.uniqueId) {
|
|
342
|
-
// @ts-
|
|
342
|
+
// @ts-expect-error
|
|
343
343
|
self.setFeatureUnderMouse(new SimpleFeature(feature))
|
|
344
344
|
}
|
|
345
345
|
}
|
|
@@ -617,7 +617,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
617
617
|
)) as { feature: unknown }
|
|
618
618
|
|
|
619
619
|
if (feature) {
|
|
620
|
-
// @ts-
|
|
620
|
+
// @ts-expect-error
|
|
621
621
|
self.selectFeature(new SimpleFeature(feature))
|
|
622
622
|
}
|
|
623
623
|
}
|
|
@@ -330,20 +330,19 @@ export function getModificationTypes(mm: string) {
|
|
|
330
330
|
const mods = mm.split(';')
|
|
331
331
|
return mods
|
|
332
332
|
.filter(mod => !!mod)
|
|
333
|
-
.
|
|
333
|
+
.flatMap(mod => {
|
|
334
334
|
const [basemod] = mod.split(',')
|
|
335
335
|
|
|
336
336
|
const matches = basemod.match(modificationRegex)
|
|
337
337
|
if (!matches) {
|
|
338
338
|
throw new Error(`bad format for MM tag: ${mm}`)
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const typestr = matches[3]
|
|
341
341
|
|
|
342
342
|
// can be a multi e.g. C+mh for both meth (m) and hydroxymeth (h) so
|
|
343
343
|
// split, and they can also be chemical codes (ChEBI) e.g. C+16061
|
|
344
344
|
return typestr.split(/(\d+|.)/).filter(f => !!f)
|
|
345
345
|
})
|
|
346
|
-
.flat()
|
|
347
346
|
}
|
|
348
347
|
|
|
349
348
|
export function getOrientedCigar(flip: boolean, cigar: string[]) {
|
|
@@ -357,8 +356,7 @@ export function getOrientedCigar(flip: boolean, cigar: string[]) {
|
|
|
357
356
|
} else if (op === 'I') {
|
|
358
357
|
op = 'D'
|
|
359
358
|
}
|
|
360
|
-
ret.push(len)
|
|
361
|
-
ret.push(op)
|
|
359
|
+
ret.push(len, op)
|
|
362
360
|
}
|
|
363
361
|
return ret
|
|
364
362
|
} else {
|
|
@@ -27,11 +27,7 @@ export default class NestedFrequencyTable {
|
|
|
27
27
|
amount = 1
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
slotName = 'default'
|
|
32
|
-
} else {
|
|
33
|
-
slotName = slotName.toString()
|
|
34
|
-
}
|
|
30
|
+
slotName = slotName ? slotName.toString() : 'default'
|
|
35
31
|
|
|
36
32
|
if (this.categories[slotName]) {
|
|
37
33
|
this.categories[slotName] = Math.max(
|
|
@@ -49,11 +45,7 @@ export default class NestedFrequencyTable {
|
|
|
49
45
|
amount = 1
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
slotName = 'default'
|
|
54
|
-
} else {
|
|
55
|
-
slotName = slotName.toString()
|
|
56
|
-
}
|
|
48
|
+
slotName = slotName ? slotName.toString() : 'default'
|
|
57
49
|
|
|
58
50
|
this.categories[slotName] = (this.categories[slotName] || 0) + amount
|
|
59
51
|
return this.categories[slotName]
|
|
@@ -71,7 +63,7 @@ export default class NestedFrequencyTable {
|
|
|
71
63
|
path = path.split('/')
|
|
72
64
|
}
|
|
73
65
|
|
|
74
|
-
if (
|
|
66
|
+
if (path.length === 0) {
|
|
75
67
|
return this
|
|
76
68
|
}
|
|
77
69
|
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
PileupGetReducedFeatures,
|
|
7
|
-
PileupGetVisibleModifications,
|
|
8
|
-
PileupGetGlobalValueForTag,
|
|
9
|
-
}
|
|
1
|
+
export { default as PileupGetReducedFeatures } from './methods/GetReducedFeatures'
|
|
2
|
+
export { default as PileupGetVisibleModifications } from './methods/GetVisibleModifications'
|
|
3
|
+
export { default as PileupGetGlobalValueForTag } from './methods/GetGlobalValueForTag'
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { Theme } from '@mui/material/styles'
|
|
2
2
|
import BoxRendererType, {
|
|
3
|
-
RenderArgs,
|
|
4
|
-
RenderArgsSerialized,
|
|
5
3
|
RenderArgsDeserialized as BoxRenderArgsDeserialized,
|
|
6
|
-
RenderResults,
|
|
7
|
-
ResultsSerialized,
|
|
8
|
-
ResultsDeserialized,
|
|
9
4
|
} from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'
|
|
10
5
|
import { createJBrowseTheme } from '@jbrowse/core/ui'
|
|
11
6
|
import {
|
|
@@ -189,13 +184,10 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
189
184
|
}
|
|
190
185
|
}
|
|
191
186
|
}
|
|
187
|
+
const s = feature.get('start') - expansionBefore
|
|
188
|
+
const e = feature.get('end') + expansionAfter
|
|
192
189
|
|
|
193
|
-
const [leftPx, rightPx] = bpSpanPx(
|
|
194
|
-
feature.get('start') - expansionBefore,
|
|
195
|
-
feature.get('end') + expansionAfter,
|
|
196
|
-
region,
|
|
197
|
-
bpPerPx,
|
|
198
|
-
)
|
|
190
|
+
const [leftPx, rightPx] = bpSpanPx(s, e, region, bpPerPx)
|
|
199
191
|
|
|
200
192
|
if (displayMode === 'compact') {
|
|
201
193
|
heightPx /= 3
|
|
@@ -207,13 +199,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
207
199
|
}`,
|
|
208
200
|
)
|
|
209
201
|
}
|
|
210
|
-
const topPx = layout.addRect(
|
|
211
|
-
feature.id(),
|
|
212
|
-
feature.get('start') - expansionBefore,
|
|
213
|
-
feature.get('end') + expansionAfter,
|
|
214
|
-
heightPx,
|
|
215
|
-
feature,
|
|
216
|
-
)
|
|
202
|
+
const topPx = layout.addRect(feature.id(), s, e, heightPx, feature)
|
|
217
203
|
if (topPx === null) {
|
|
218
204
|
return null
|
|
219
205
|
}
|
|
@@ -473,11 +459,10 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
473
459
|
|
|
474
460
|
// probIndex applies across multiple modifications e.g.
|
|
475
461
|
let probIndex = 0
|
|
476
|
-
for (
|
|
477
|
-
const { type, positions } = modifications[i]
|
|
462
|
+
for (const { type, positions } of modifications) {
|
|
478
463
|
const col = modificationTagMap[type] || 'black'
|
|
479
464
|
|
|
480
|
-
// @ts-
|
|
465
|
+
// @ts-expect-error
|
|
481
466
|
const base = Color(col)
|
|
482
467
|
for (const readPos of getNextRefPos(cigarOps, positions)) {
|
|
483
468
|
const r = start + readPos
|
|
@@ -658,6 +643,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
658
643
|
charWidth,
|
|
659
644
|
charHeight,
|
|
660
645
|
defaultColor,
|
|
646
|
+
theme,
|
|
661
647
|
canvasWidth,
|
|
662
648
|
}: {
|
|
663
649
|
ctx: CanvasRenderingContext2D
|
|
@@ -669,9 +655,9 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
669
655
|
charHeight: number
|
|
670
656
|
defaultColor: boolean
|
|
671
657
|
canvasWidth: number
|
|
658
|
+
theme: Theme
|
|
672
659
|
}) {
|
|
673
660
|
const { config, bpPerPx, regions, colorBy, colorTagMap = {} } = renderArgs
|
|
674
|
-
|
|
675
661
|
const { tag = '', type: colorType = '' } = colorBy || {}
|
|
676
662
|
const { feature } = feat
|
|
677
663
|
const region = regions[0]
|
|
@@ -732,30 +718,25 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
732
718
|
}
|
|
733
719
|
break
|
|
734
720
|
}
|
|
735
|
-
case 'insertSizeAndPairOrientation':
|
|
721
|
+
case 'insertSizeAndPairOrientation': {
|
|
736
722
|
break
|
|
723
|
+
}
|
|
737
724
|
|
|
738
725
|
case 'modifications':
|
|
739
|
-
case 'methylation':
|
|
726
|
+
case 'methylation': {
|
|
740
727
|
// this coloring is similar to igv.js, and is helpful to color negative
|
|
741
728
|
// strand reads differently because their c-g will be flipped (e.g. g-c
|
|
742
729
|
// read right to left)
|
|
743
|
-
|
|
744
|
-
ctx.fillStyle = '#c8dcc8'
|
|
745
|
-
} else {
|
|
746
|
-
ctx.fillStyle = '#c8c8c8'
|
|
747
|
-
}
|
|
730
|
+
ctx.fillStyle = feature.get('flags') & 16 ? '#c8dcc8' : '#c8c8c8'
|
|
748
731
|
break
|
|
732
|
+
}
|
|
749
733
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
ctx.fillStyle = '#c8c8c8'
|
|
755
|
-
} else {
|
|
756
|
-
ctx.fillStyle = readConfObject(config, 'color', { feature })
|
|
757
|
-
}
|
|
734
|
+
default: {
|
|
735
|
+
ctx.fillStyle = defaultColor
|
|
736
|
+
? 'lightgrey'
|
|
737
|
+
: readConfObject(config, 'color', { feature })
|
|
758
738
|
break
|
|
739
|
+
}
|
|
759
740
|
}
|
|
760
741
|
|
|
761
742
|
this.drawRect(ctx, feat, renderArgs)
|
|
@@ -825,6 +806,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
825
806
|
canvasWidth,
|
|
826
807
|
drawSNPsMuted,
|
|
827
808
|
drawIndels = true,
|
|
809
|
+
theme,
|
|
828
810
|
}: {
|
|
829
811
|
ctx: CanvasRenderingContext2D
|
|
830
812
|
feat: LayoutFeature
|
|
@@ -839,6 +821,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
839
821
|
charWidth: number
|
|
840
822
|
charHeight: number
|
|
841
823
|
canvasWidth: number
|
|
824
|
+
theme: Theme
|
|
842
825
|
}) {
|
|
843
826
|
const { Color, bpPerPx, regions } = renderArgs
|
|
844
827
|
const { heightPx, topPx, feature } = feat
|
|
@@ -875,19 +858,20 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
875
858
|
|
|
876
859
|
fillRect(
|
|
877
860
|
ctx,
|
|
878
|
-
leftPx,
|
|
861
|
+
Math.round(leftPx),
|
|
879
862
|
topPx,
|
|
880
863
|
widthPx,
|
|
881
864
|
heightPx,
|
|
882
865
|
canvasWidth,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
866
|
+
|
|
867
|
+
mismatchAlpha
|
|
868
|
+
? mismatch.qual === undefined
|
|
869
|
+
? baseColor
|
|
870
|
+
: // @ts-expect-error
|
|
871
|
+
Color(baseColor)
|
|
872
|
+
.alpha(Math.min(1, mismatch.qual / 50))
|
|
873
|
+
.hsl()
|
|
874
|
+
.string()
|
|
891
875
|
: baseColor,
|
|
892
876
|
)
|
|
893
877
|
}
|
|
@@ -897,14 +881,14 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
897
881
|
const contrastColor = drawSNPsMuted
|
|
898
882
|
? 'black'
|
|
899
883
|
: contrastForBase[mismatch.base] || 'black'
|
|
900
|
-
ctx.fillStyle =
|
|
901
|
-
?
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
884
|
+
ctx.fillStyle = mismatchAlpha
|
|
885
|
+
? mismatch.qual === undefined
|
|
886
|
+
? contrastColor
|
|
887
|
+
: // @ts-expect-error
|
|
888
|
+
Color(contrastColor)
|
|
889
|
+
.alpha(Math.min(1, mismatch.qual / 50))
|
|
890
|
+
.hsl()
|
|
891
|
+
.string()
|
|
908
892
|
: contrastColor
|
|
909
893
|
ctx.fillText(
|
|
910
894
|
mbase,
|
|
@@ -1165,6 +1149,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
1165
1149
|
charWidth,
|
|
1166
1150
|
charHeight,
|
|
1167
1151
|
canvasWidth,
|
|
1152
|
+
theme,
|
|
1168
1153
|
})
|
|
1169
1154
|
this.drawMismatches({
|
|
1170
1155
|
ctx,
|
|
@@ -1180,6 +1165,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
1180
1165
|
colorForBase,
|
|
1181
1166
|
contrastForBase,
|
|
1182
1167
|
canvasWidth,
|
|
1168
|
+
theme,
|
|
1183
1169
|
})
|
|
1184
1170
|
if (showSoftClip) {
|
|
1185
1171
|
this.drawSoftClipping({
|
|
@@ -1315,10 +1301,10 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
1315
1301
|
}
|
|
1316
1302
|
}
|
|
1317
1303
|
|
|
1318
|
-
export
|
|
1319
|
-
RenderArgs,
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
ResultsSerialized,
|
|
1323
|
-
ResultsDeserialized,
|
|
1324
|
-
}
|
|
1304
|
+
export {
|
|
1305
|
+
type RenderArgs,
|
|
1306
|
+
type RenderResults,
|
|
1307
|
+
type RenderArgsSerialized,
|
|
1308
|
+
type ResultsSerialized,
|
|
1309
|
+
type ResultsDeserialized,
|
|
1310
|
+
} from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'
|
|
@@ -159,10 +159,10 @@ function PileupRendering(props: {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
function callMouseHandler(handlerName: string, event: React.MouseEvent) {
|
|
162
|
-
// @ts-
|
|
162
|
+
// @ts-expect-error
|
|
163
163
|
// eslint-disable-next-line react/destructuring-assignment
|
|
164
164
|
const featureHandler = props[`onFeature${handlerName}`]
|
|
165
|
-
// @ts-
|
|
165
|
+
// @ts-expect-error
|
|
166
166
|
// eslint-disable-next-line react/destructuring-assignment
|
|
167
167
|
const canvasHandler = props[`on${handlerName}`]
|
|
168
168
|
if (featureHandler && featureIdUnderMouse) {
|
|
@@ -50,7 +50,7 @@ const PileupRenderer = ConfigurationSchema(
|
|
|
50
50
|
type: 'number',
|
|
51
51
|
description:
|
|
52
52
|
'the minimum width in px for a pileup mismatch feature. use for increasing/decreasing mismatch marker widths when zoomed out, e.g. 0 or 1',
|
|
53
|
-
defaultValue:
|
|
53
|
+
defaultValue: 1,
|
|
54
54
|
},
|
|
55
55
|
/**
|
|
56
56
|
* #slot
|
|
@@ -78,7 +78,7 @@ export const sortFeature = (
|
|
|
78
78
|
const acode = bMismatch && bMismatch.base.toUpperCase()
|
|
79
79
|
const bcode = aMismatch && aMismatch.base.toUpperCase()
|
|
80
80
|
if (acode === bcode && acode === '*') {
|
|
81
|
-
// @ts-
|
|
81
|
+
// @ts-expect-error
|
|
82
82
|
return aMismatch.length - bMismatch.length
|
|
83
83
|
}
|
|
84
84
|
return (
|
|
@@ -99,9 +99,10 @@ export const sortFeature = (
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const sortedMap = new Map(
|
|
102
|
-
featuresInCenterLine
|
|
103
|
-
.
|
|
104
|
-
|
|
102
|
+
[...featuresInCenterLine, ...featuresOutsideCenter].map(feature => [
|
|
103
|
+
feature.id(),
|
|
104
|
+
feature,
|
|
105
|
+
]),
|
|
105
106
|
)
|
|
106
107
|
|
|
107
108
|
return sortedMap
|
|
@@ -35,6 +35,8 @@ interface SNPInfo {
|
|
|
35
35
|
total: number
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
const fudgeFactor = 0.6
|
|
39
|
+
|
|
38
40
|
export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
39
41
|
// note: the snps are drawn on linear scale even if the data is drawn in log
|
|
40
42
|
// scape hence the two different scales being used
|
|
@@ -78,6 +80,7 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
78
80
|
scaleType: 'linear',
|
|
79
81
|
})
|
|
80
82
|
const originY = getOrigin(scaleOpts.scaleType)
|
|
83
|
+
const originLinear = getOrigin('linear')
|
|
81
84
|
|
|
82
85
|
const indicatorThreshold = readConfObject(cfg, 'indicatorThreshold')
|
|
83
86
|
const drawInterbaseCounts = readConfObject(cfg, 'drawInterbaseCounts')
|
|
@@ -87,11 +90,9 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
87
90
|
// get the y coordinate that we are plotting at, this can be log scale
|
|
88
91
|
const toY = (n: number) => height - (viewScale(n) || 0) + offset
|
|
89
92
|
const toHeight = (n: number) => toY(originY) - toY(n)
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
const indicatorToHeight = (n: number) =>
|
|
94
|
-
indicatorToY(getOrigin('linear')) - indicatorToY(n)
|
|
93
|
+
// used specifically for indicator
|
|
94
|
+
const toY2 = (n: number) => height - (indicatorViewScale(n) || 0) + offset
|
|
95
|
+
const toHeight2 = (n: number) => toY2(originLinear) - toY2(n)
|
|
95
96
|
|
|
96
97
|
const { bases } = theme.palette
|
|
97
98
|
const colorForBase: { [key: string]: string } = {
|
|
@@ -105,7 +106,6 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
105
106
|
hardclip: 'red',
|
|
106
107
|
meth: 'red',
|
|
107
108
|
unmeth: 'blue',
|
|
108
|
-
ref: 'lightgrey',
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const feats = [...features.values()]
|
|
@@ -118,7 +118,7 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
118
118
|
for (let i = 0; i < coverage.length; i++) {
|
|
119
119
|
const feature = coverage[i]
|
|
120
120
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)
|
|
121
|
-
const w = rightPx - leftPx +
|
|
121
|
+
const w = rightPx - leftPx + fudgeFactor
|
|
122
122
|
const score = feature.get('score') as number
|
|
123
123
|
ctx.fillRect(leftPx, toY(score), w, toHeight(score))
|
|
124
124
|
}
|
|
@@ -144,7 +144,7 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
144
144
|
|
|
145
145
|
const score = feature.get('score') as number
|
|
146
146
|
const snpinfo = feature.get('snpinfo') as SNPInfo
|
|
147
|
-
const w = Math.max(rightPx - leftPx +
|
|
147
|
+
const w = Math.max(rightPx - leftPx + fudgeFactor, 1)
|
|
148
148
|
const totalScore = snpinfo.total
|
|
149
149
|
const keys = Object.keys(snpinfo.cov).sort()
|
|
150
150
|
|
|
@@ -160,7 +160,7 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
160
160
|
const height = toHeight(score)
|
|
161
161
|
const bottom = toY(score) + height
|
|
162
162
|
ctx.fillRect(
|
|
163
|
-
leftPx,
|
|
163
|
+
Math.round(leftPx),
|
|
164
164
|
bottom - ((total + curr) / score) * height,
|
|
165
165
|
w,
|
|
166
166
|
(total / score) * height,
|
|
@@ -175,12 +175,13 @@ export default class SNPCoverageRenderer extends WiggleBaseRenderer {
|
|
|
175
175
|
for (let i = 0; i < interbaseEvents.length; i++) {
|
|
176
176
|
const base = interbaseEvents[i]
|
|
177
177
|
const { total } = snpinfo.noncov[base]
|
|
178
|
+
const r = 0.6
|
|
178
179
|
ctx.fillStyle = colorForBase[base]
|
|
179
180
|
ctx.fillRect(
|
|
180
|
-
leftPx -
|
|
181
|
-
indicatorHeight +
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
leftPx - r + extraHorizontallyFlippedOffset,
|
|
182
|
+
indicatorHeight + toHeight2(curr),
|
|
183
|
+
r * 2,
|
|
184
|
+
toHeight2(total),
|
|
184
185
|
)
|
|
185
186
|
curr += total
|
|
186
187
|
}
|