@jbrowse/plugin-alignments 2.3.1 → 2.3.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/BamAdapter/BamAdapter.js +2 -1
- package/dist/BamAdapter/BamAdapter.js.map +1 -1
- package/dist/CramAdapter/CramAdapter.js +3 -3
- package/dist/CramAdapter/CramAdapter.js.map +1 -1
- package/dist/LinearReadArcsDisplay/configSchema.js +8 -0
- package/dist/LinearReadArcsDisplay/configSchema.js.map +1 -1
- package/dist/LinearReadArcsDisplay/drawFeats.d.ts +1 -0
- package/dist/LinearReadArcsDisplay/drawFeats.js +45 -37
- package/dist/LinearReadArcsDisplay/drawFeats.js.map +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +46 -15
- package/dist/LinearReadArcsDisplay/model.js +42 -0
- package/dist/LinearReadArcsDisplay/model.js.map +1 -1
- package/dist/LinearReadCloudDisplay/drawFeats.js +18 -32
- package/dist/LinearReadCloudDisplay/drawFeats.js.map +1 -1
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js.map +1 -1
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +8 -8
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js +3 -1
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -1
- package/dist/PileupRPC/methods/GetReducedFeatures.js +2 -4
- package/dist/PileupRPC/methods/GetReducedFeatures.js.map +1 -1
- package/dist/PileupRPC/methods/GetVisibleModifications.js +2 -4
- package/dist/PileupRPC/methods/GetVisibleModifications.js.map +1 -1
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +3 -4
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
- package/dist/util.js +3 -3
- package/dist/util.js.map +1 -1
- package/esm/BamAdapter/BamAdapter.js +2 -1
- package/esm/BamAdapter/BamAdapter.js.map +1 -1
- package/esm/CramAdapter/CramAdapter.js +3 -3
- package/esm/CramAdapter/CramAdapter.js.map +1 -1
- package/esm/LinearReadArcsDisplay/configSchema.js +8 -0
- package/esm/LinearReadArcsDisplay/configSchema.js.map +1 -1
- package/esm/LinearReadArcsDisplay/drawFeats.d.ts +1 -0
- package/esm/LinearReadArcsDisplay/drawFeats.js +45 -37
- package/esm/LinearReadArcsDisplay/drawFeats.js.map +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +46 -15
- package/esm/LinearReadArcsDisplay/model.js +42 -0
- package/esm/LinearReadArcsDisplay/model.js.map +1 -1
- package/esm/LinearReadCloudDisplay/drawFeats.js +19 -33
- package/esm/LinearReadCloudDisplay/drawFeats.js.map +1 -1
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js.map +1 -1
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +8 -8
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js +3 -1
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js.map +1 -1
- package/esm/PileupRPC/methods/GetReducedFeatures.js +2 -4
- package/esm/PileupRPC/methods/GetReducedFeatures.js.map +1 -1
- package/esm/PileupRPC/methods/GetVisibleModifications.js +2 -4
- package/esm/PileupRPC/methods/GetVisibleModifications.js.map +1 -1
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +3 -4
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js.map +1 -1
- package/esm/util.js +3 -3
- package/esm/util.js.map +1 -1
- package/package.json +3 -3
- package/src/AlignmentsFeatureDetail/__snapshots__/{index.test.js.snap → index.test.tsx.snap} +0 -0
- package/src/AlignmentsFeatureDetail/{index.test.js → index.test.tsx} +4 -2
- package/src/BamAdapter/BamAdapter.test.ts +5 -4
- package/src/BamAdapter/BamAdapter.ts +2 -1
- package/src/CombinationTest.test.ts +3 -2
- package/src/CramAdapter/CramAdapter.test.ts +3 -2
- package/src/CramAdapter/CramAdapter.ts +11 -9
- package/src/LinearAlignmentsDisplay/models/{configSchema.test.js → configSchema.test.ts} +5 -1
- package/src/LinearReadArcsDisplay/configSchema.ts +10 -0
- package/src/LinearReadArcsDisplay/drawFeats.ts +73 -54
- package/src/LinearReadArcsDisplay/model.tsx +45 -0
- package/src/LinearReadCloudDisplay/drawFeats.ts +21 -33
- package/src/LinearSNPCoverageDisplay/components/Tooltip.tsx +76 -73
- package/src/LinearSNPCoverageDisplay/models/{configSchema.test.js → configSchema.test.ts} +3 -1
- package/src/PileupRPC/methods/GetGlobalValueForTag.ts +4 -1
- package/src/PileupRPC/methods/GetReducedFeatures.ts +4 -5
- package/src/PileupRPC/methods/GetVisibleModifications.ts +4 -4
- package/src/SNPCoverageAdapter/SNPCoverageAdapter.ts +6 -4
- package/src/index.test.ts +0 -1
- package/src/util.ts +10 -8
- package/src/PileupRenderer/components/PileupRendering.test.js +0 -21
- package/src/PileupRenderer/components/__snapshots__/PileupRendering.test.js.snap +0 -23
|
@@ -65,6 +65,11 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
65
65
|
*/
|
|
66
66
|
lineWidth: types.maybe(types.number),
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* #property
|
|
70
|
+
*/
|
|
71
|
+
jitter: types.maybe(types.number),
|
|
72
|
+
|
|
68
73
|
/**
|
|
69
74
|
* #property
|
|
70
75
|
*/
|
|
@@ -175,6 +180,15 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
175
180
|
setLineWidth(n: number) {
|
|
176
181
|
self.lineWidth = n
|
|
177
182
|
},
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* #action
|
|
186
|
+
* jitter val, helpful to jitter the x direction so you see better evidence when e.g. 100
|
|
187
|
+
* long reads map to same x position
|
|
188
|
+
*/
|
|
189
|
+
setJitter(n: number) {
|
|
190
|
+
self.jitter = n
|
|
191
|
+
},
|
|
178
192
|
}))
|
|
179
193
|
|
|
180
194
|
.views(self => {
|
|
@@ -190,6 +204,13 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
190
204
|
get lineWidthSetting() {
|
|
191
205
|
return self.lineWidth ?? getConf(self, 'lineWidth')
|
|
192
206
|
},
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* #getter
|
|
210
|
+
*/
|
|
211
|
+
get jitterVal(): number {
|
|
212
|
+
return self.jitter ?? getConf(self, 'jitter')
|
|
213
|
+
},
|
|
193
214
|
/**
|
|
194
215
|
* #getter
|
|
195
216
|
*/
|
|
@@ -245,6 +266,30 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
245
266
|
},
|
|
246
267
|
],
|
|
247
268
|
},
|
|
269
|
+
{
|
|
270
|
+
label: 'Jitter x-positions',
|
|
271
|
+
subMenu: [
|
|
272
|
+
{
|
|
273
|
+
type: 'checkbox',
|
|
274
|
+
checked: this.jitterVal === 0,
|
|
275
|
+
label: 'None',
|
|
276
|
+
onClick: () => self.setJitter(0),
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
type: 'checkbox',
|
|
280
|
+
checked: this.jitterVal === 2,
|
|
281
|
+
label: 'Small',
|
|
282
|
+
onClick: () => self.setJitter(2),
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
type: 'checkbox',
|
|
286
|
+
checked: this.jitterVal === 10,
|
|
287
|
+
label: 'Large',
|
|
288
|
+
onClick: () => self.setJitter(10),
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
|
|
248
293
|
{
|
|
249
294
|
label: 'Draw inter-region vertical lines',
|
|
250
295
|
type: 'checkbox',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConf } from '@jbrowse/core/configuration'
|
|
2
|
-
import { getContainingView } from '@jbrowse/core/util'
|
|
2
|
+
import { getContainingView, getSession } from '@jbrowse/core/util'
|
|
3
3
|
|
|
4
4
|
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
5
5
|
// locals
|
|
@@ -60,9 +60,15 @@ export default async function drawFeats(
|
|
|
60
60
|
if (!chainData) {
|
|
61
61
|
return
|
|
62
62
|
}
|
|
63
|
+
const { assemblyManager } = getSession(self)
|
|
63
64
|
const featureHeight = getConf(self, 'featureHeight')
|
|
64
65
|
const displayHeight = self.height
|
|
65
66
|
const view = getContainingView(self) as LGV
|
|
67
|
+
const assemblyName = view.assemblyNames[0]
|
|
68
|
+
const asm = assemblyManager.get(assemblyName)
|
|
69
|
+
if (!asm) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
66
72
|
|
|
67
73
|
self.setLastDrawnOffsetPx(view.offsetPx)
|
|
68
74
|
|
|
@@ -76,22 +82,13 @@ export default async function drawFeats(
|
|
|
76
82
|
if (chain[0].flags & 1 && chain.length > 1) {
|
|
77
83
|
const v0 = chain[0]
|
|
78
84
|
const v1 = chain[1]
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})
|
|
87
|
-
const r2s = view.bpToPx({
|
|
88
|
-
refName: v1.refName,
|
|
89
|
-
coord: v1.start,
|
|
90
|
-
})
|
|
91
|
-
const r2e = view.bpToPx({
|
|
92
|
-
refName: v1.refName,
|
|
93
|
-
coord: v1.end,
|
|
94
|
-
})
|
|
85
|
+
const ra1 = asm.getCanonicalRefName(v0.refName)
|
|
86
|
+
const ra2 = asm.getCanonicalRefName(v1.refName)
|
|
87
|
+
const r1s = view.bpToPx({ refName: ra1, coord: v0.start })
|
|
88
|
+
const r1e = view.bpToPx({ refName: ra1, coord: v0.end })
|
|
89
|
+
const r2s = view.bpToPx({ refName: ra2, coord: v1.start })
|
|
90
|
+
const r2e = view.bpToPx({ refName: ra2, coord: v1.end })
|
|
91
|
+
|
|
95
92
|
let distance = 0
|
|
96
93
|
|
|
97
94
|
if (
|
|
@@ -121,22 +118,13 @@ export default async function drawFeats(
|
|
|
121
118
|
for (let i = 1; i < chain.length; i++) {
|
|
122
119
|
const v0 = chain[i - 1]
|
|
123
120
|
const v1 = chain[i]
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
132
|
-
const r2s = view.bpToPx({
|
|
133
|
-
refName: v1.refName,
|
|
134
|
-
coord: v1.start,
|
|
135
|
-
})
|
|
136
|
-
const r2e = view.bpToPx({
|
|
137
|
-
refName: v1.refName,
|
|
138
|
-
coord: v1.end,
|
|
139
|
-
})
|
|
121
|
+
const ra1 = asm.getCanonicalRefName(v0.refName)
|
|
122
|
+
const ra2 = asm.getCanonicalRefName(v1.refName)
|
|
123
|
+
const r1s = view.bpToPx({ refName: ra1, coord: v0.start })
|
|
124
|
+
const r1e = view.bpToPx({ refName: ra1, coord: v0.end })
|
|
125
|
+
const r2s = view.bpToPx({ refName: ra2, coord: v1.start })
|
|
126
|
+
const r2e = view.bpToPx({ refName: ra2, coord: v1.end })
|
|
127
|
+
|
|
140
128
|
let distance = 0
|
|
141
129
|
|
|
142
130
|
if (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { observer } from 'mobx-react'
|
|
3
|
-
import { Feature } from '@jbrowse/core/util
|
|
3
|
+
import { Feature } from '@jbrowse/core/util'
|
|
4
4
|
import { Tooltip } from '@jbrowse/plugin-wiggle'
|
|
5
5
|
|
|
6
6
|
type Count = {
|
|
@@ -29,80 +29,83 @@ type SNPInfo = {
|
|
|
29
29
|
const en = (n: number) => n.toLocaleString('en-US')
|
|
30
30
|
const toP = (s = 0) => +(+s).toFixed(1)
|
|
31
31
|
const pct = (n: number, total: number) => `${toP((n / (total || 1)) * 100)}%`
|
|
32
|
+
interface Props {
|
|
33
|
+
feature: Feature
|
|
34
|
+
}
|
|
35
|
+
const TooltipContents = React.forwardRef<HTMLDivElement, Props>(function (
|
|
36
|
+
{ feature },
|
|
37
|
+
reactRef,
|
|
38
|
+
) {
|
|
39
|
+
const start = feature.get('start')
|
|
40
|
+
const end = feature.get('end')
|
|
41
|
+
const name = feature.get('refName')
|
|
42
|
+
const {
|
|
43
|
+
refbase,
|
|
44
|
+
all,
|
|
45
|
+
total,
|
|
46
|
+
ref,
|
|
47
|
+
'-1': rn1,
|
|
48
|
+
'1': r1,
|
|
49
|
+
'0': r0,
|
|
50
|
+
...info
|
|
51
|
+
} = feature.get('snpinfo') as SNPInfo
|
|
52
|
+
const loc = [name, start === end ? en(start) : `${en(start)}..${en(end)}`]
|
|
53
|
+
.filter(f => !!f)
|
|
54
|
+
.join(':')
|
|
32
55
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<th>Strands</th>
|
|
62
|
-
<th>Source</th>
|
|
63
|
-
</tr>
|
|
64
|
-
</thead>
|
|
65
|
-
<tbody>
|
|
66
|
-
<tr>
|
|
67
|
-
<td>Total</td>
|
|
68
|
-
<td>{all}</td>
|
|
69
|
-
</tr>
|
|
70
|
-
<tr>
|
|
71
|
-
<td>REF {refbase ? `(${refbase.toUpperCase()})` : ''}</td>
|
|
72
|
-
<td>{ref}</td>
|
|
73
|
-
<td>{pct(ref, all)}</td>
|
|
74
|
-
<td>
|
|
75
|
-
{rn1 ? `${rn1}(-)` : ''}
|
|
76
|
-
{r1 ? `${r1}(+)` : ''}
|
|
77
|
-
</td>
|
|
78
|
-
<td />
|
|
79
|
-
</tr>
|
|
56
|
+
return (
|
|
57
|
+
<div ref={reactRef}>
|
|
58
|
+
<table>
|
|
59
|
+
<caption>{loc}</caption>
|
|
60
|
+
<thead>
|
|
61
|
+
<tr>
|
|
62
|
+
<th>Base</th>
|
|
63
|
+
<th>Count</th>
|
|
64
|
+
<th>% of Total</th>
|
|
65
|
+
<th>Strands</th>
|
|
66
|
+
<th>Source</th>
|
|
67
|
+
</tr>
|
|
68
|
+
</thead>
|
|
69
|
+
<tbody>
|
|
70
|
+
<tr>
|
|
71
|
+
<td>Total</td>
|
|
72
|
+
<td>{all}</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<tr>
|
|
75
|
+
<td>REF {refbase ? `(${refbase.toUpperCase()})` : ''}</td>
|
|
76
|
+
<td>{ref}</td>
|
|
77
|
+
<td>{pct(ref, all)}</td>
|
|
78
|
+
<td>
|
|
79
|
+
{rn1 ? `${rn1}(-)` : ''}
|
|
80
|
+
{r1 ? `${r1}(+)` : ''}
|
|
81
|
+
</td>
|
|
82
|
+
<td />
|
|
83
|
+
</tr>
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
85
|
+
{Object.entries(info as unknown as Record<string, Count>).map(
|
|
86
|
+
([key, entry]) =>
|
|
87
|
+
Object.entries(entry).map(([base, score]) => (
|
|
88
|
+
<tr key={base}>
|
|
89
|
+
<td>{base.toUpperCase()}</td>
|
|
90
|
+
<td>{score.total}</td>
|
|
91
|
+
<td>
|
|
92
|
+
{base === 'total' || base === 'skip'
|
|
93
|
+
? '---'
|
|
94
|
+
: pct(score.total, all)}
|
|
95
|
+
</td>
|
|
96
|
+
<td>
|
|
97
|
+
{score['-1'] ? `${score['-1']}(-)` : ''}
|
|
98
|
+
{score['1'] ? `${score['1']}(+)` : ''}
|
|
99
|
+
</td>
|
|
100
|
+
<td>{key}</td>
|
|
101
|
+
</tr>
|
|
102
|
+
)),
|
|
103
|
+
)}
|
|
104
|
+
</tbody>
|
|
105
|
+
</table>
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
})
|
|
106
109
|
|
|
107
110
|
type Coord = [number, number]
|
|
108
111
|
|
|
@@ -9,11 +9,13 @@ beforeEach(() => {
|
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
afterEach(() => {
|
|
12
|
+
// @ts-ignore
|
|
12
13
|
console.warn.mockRestore()
|
|
13
14
|
})
|
|
14
15
|
// change renderer
|
|
15
16
|
class SNPCoverageRendererPlugin extends Plugin {
|
|
16
|
-
|
|
17
|
+
name = 'SNPCoverageRendererPlugin'
|
|
18
|
+
install(pluginManager: PluginManager) {
|
|
17
19
|
SNPCoverageRenderer(pluginManager)
|
|
18
20
|
}
|
|
19
21
|
}
|
|
@@ -3,6 +3,9 @@ import { Region } from '@jbrowse/core/util'
|
|
|
3
3
|
import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
|
|
4
4
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
5
|
import { toArray } from 'rxjs/operators'
|
|
6
|
+
import { firstValueFrom } from 'rxjs'
|
|
7
|
+
|
|
8
|
+
// locals
|
|
6
9
|
import PileupBaseRPC from '../base'
|
|
7
10
|
import { getTag } from '../../util'
|
|
8
11
|
|
|
@@ -28,7 +31,7 @@ export default class PileupGetGlobalValueForTag extends PileupBaseRPC {
|
|
|
28
31
|
).dataAdapter as BaseFeatureDataAdapter
|
|
29
32
|
|
|
30
33
|
const features = dataAdapter.getFeaturesInMultipleRegions(regions)
|
|
31
|
-
const featuresArray = await features.pipe(toArray())
|
|
34
|
+
const featuresArray = await firstValueFrom(features.pipe(toArray()))
|
|
32
35
|
return [
|
|
33
36
|
...new Set(
|
|
34
37
|
featuresArray
|
|
@@ -3,7 +3,7 @@ import { Region, dedupe } from '@jbrowse/core/util'
|
|
|
3
3
|
import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
|
|
4
4
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
5
5
|
import { toArray } from 'rxjs/operators'
|
|
6
|
-
|
|
6
|
+
import { firstValueFrom } from 'rxjs'
|
|
7
7
|
// locals
|
|
8
8
|
import { filterForPairs, getInsertSizeStats } from '../util'
|
|
9
9
|
import { ReducedFeature } from '../../shared/fetchChains'
|
|
@@ -31,10 +31,9 @@ export default class PileupGetReducedFeatures extends PileupBaseRPC {
|
|
|
31
31
|
await getAdapter(this.pluginManager, sessionId, adapterConfig)
|
|
32
32
|
).dataAdapter as BaseFeatureDataAdapter
|
|
33
33
|
|
|
34
|
-
const featuresArray = await
|
|
35
|
-
.getFeaturesInMultipleRegions(regions, des)
|
|
36
|
-
|
|
37
|
-
.toPromise()
|
|
34
|
+
const featuresArray = await firstValueFrom(
|
|
35
|
+
dataAdapter.getFeaturesInMultipleRegions(regions, des).pipe(toArray()),
|
|
36
|
+
)
|
|
38
37
|
|
|
39
38
|
const reduced = dedupe(
|
|
40
39
|
featuresArray.map(f => ({
|
|
@@ -3,6 +3,7 @@ import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
|
|
|
3
3
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
4
4
|
import { Region } from '@jbrowse/core/util'
|
|
5
5
|
import { toArray } from 'rxjs/operators'
|
|
6
|
+
import { firstValueFrom } from 'rxjs'
|
|
6
7
|
|
|
7
8
|
// locals
|
|
8
9
|
import { getModificationTypes } from '../../MismatchParser'
|
|
@@ -29,10 +30,9 @@ export default class PileupGetVisibleModifications extends PileupBaseRPC {
|
|
|
29
30
|
await getAdapter(this.pluginManager, sessionId, adapterConfig)
|
|
30
31
|
).dataAdapter as BaseFeatureDataAdapter
|
|
31
32
|
|
|
32
|
-
const featuresArray = await
|
|
33
|
-
.getFeaturesInMultipleRegions(regions)
|
|
34
|
-
|
|
35
|
-
.toPromise()
|
|
33
|
+
const featuresArray = await firstValueFrom(
|
|
34
|
+
dataAdapter.getFeaturesInMultipleRegions(regions).pipe(toArray()),
|
|
35
|
+
)
|
|
36
36
|
|
|
37
37
|
const uniqueValues = new Set<string>()
|
|
38
38
|
featuresArray.forEach(f => {
|
|
@@ -6,6 +6,9 @@ import { AugmentedRegion as Region } from '@jbrowse/core/util/types'
|
|
|
6
6
|
import SimpleFeature, { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
7
7
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs'
|
|
8
8
|
import { toArray } from 'rxjs/operators'
|
|
9
|
+
import { firstValueFrom } from 'rxjs'
|
|
10
|
+
|
|
11
|
+
// locals
|
|
9
12
|
import generateCoverageBins from './generateCoverageBins'
|
|
10
13
|
import { fetchSequence } from '../util'
|
|
11
14
|
|
|
@@ -43,10 +46,9 @@ export default class SNPCoverageAdapter extends BaseFeatureDataAdapter {
|
|
|
43
46
|
getFeatures(region: Region, opts: BaseOptions = {}) {
|
|
44
47
|
return ObservableCreate<Feature>(async observer => {
|
|
45
48
|
const { subadapter } = await this.configure()
|
|
46
|
-
const feats = await
|
|
47
|
-
.getFeatures(region, opts)
|
|
48
|
-
|
|
49
|
-
.toPromise()
|
|
49
|
+
const feats = await firstValueFrom(
|
|
50
|
+
subadapter.getFeatures(region, opts).pipe(toArray()),
|
|
51
|
+
)
|
|
50
52
|
|
|
51
53
|
const { bins, skipmap } = await generateCoverageBins(
|
|
52
54
|
feats,
|
package/src/index.test.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { getSnapshot } from 'mobx-state-tree'
|
|
|
4
4
|
import ThisPlugin from '.'
|
|
5
5
|
|
|
6
6
|
test('plugin in a stock JBrowse', () => {
|
|
7
|
-
console.warn = jest.fn()
|
|
8
7
|
const pluginManager = new PluginManager([new ThisPlugin(), new SVG()])
|
|
9
8
|
pluginManager.createPluggableElements()
|
|
10
9
|
pluginManager.configure()
|
package/src/util.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
|
2
2
|
import { toArray } from 'rxjs/operators'
|
|
3
3
|
import { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
4
4
|
import { AugmentedRegion } from '@jbrowse/core/util'
|
|
5
|
+
import { firstValueFrom } from 'rxjs'
|
|
5
6
|
// get tag from BAM or CRAM feature, where CRAM uses feature.get('tags') and
|
|
6
7
|
// BAM does not
|
|
7
8
|
export function getTag(feature: Feature, tag: string) {
|
|
@@ -86,14 +87,15 @@ export async function fetchSequence(
|
|
|
86
87
|
) {
|
|
87
88
|
const { end, originalRefName, refName } = region
|
|
88
89
|
|
|
89
|
-
const feats = await
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
const feats = await firstValueFrom(
|
|
91
|
+
adapter
|
|
92
|
+
.getFeatures({
|
|
93
|
+
...region,
|
|
94
|
+
refName: originalRefName || refName,
|
|
95
|
+
end: end + 1,
|
|
96
|
+
})
|
|
97
|
+
.pipe(toArray()),
|
|
98
|
+
)
|
|
97
99
|
return feats[0]?.get('seq')
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import PrecomputedLayout from '@jbrowse/core/util/layouts/PrecomputedLayout'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { render } from '@testing-library/react'
|
|
4
|
-
import PileupRendering from './PileupRendering'
|
|
5
|
-
|
|
6
|
-
// these tests do very little, let's try to expand them at some point
|
|
7
|
-
test('one', () => {
|
|
8
|
-
const { container } = render(
|
|
9
|
-
<PileupRendering
|
|
10
|
-
width={500}
|
|
11
|
-
height={500}
|
|
12
|
-
regions={[{ refName: 'zonk', start: 1, end: 3 }]}
|
|
13
|
-
layout={new PrecomputedLayout({ rectangles: {}, totalHeight: 20 })}
|
|
14
|
-
displayModel={{}}
|
|
15
|
-
bpPerPx={3}
|
|
16
|
-
config={{ type: 'DummyRenderer' }}
|
|
17
|
-
/>,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
expect(container.firstChild).toMatchSnapshot()
|
|
21
|
-
})
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`one 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
class="PileupRendering"
|
|
6
|
-
data-testid="pileup-normal"
|
|
7
|
-
style="position: relative; width: 500px; height: 500px;"
|
|
8
|
-
>
|
|
9
|
-
<canvas
|
|
10
|
-
data-testid="prerendered_canvas"
|
|
11
|
-
height="500"
|
|
12
|
-
style="width: 500px; height: 500px; position: absolute; left: 0px; top: 0px;"
|
|
13
|
-
width="500"
|
|
14
|
-
/>
|
|
15
|
-
<canvas
|
|
16
|
-
class="highlightOverlayCanvas"
|
|
17
|
-
data-testid="pileup_overlay_canvas"
|
|
18
|
-
height="600"
|
|
19
|
-
style="position: absolute; left: 0px; top: 0px;"
|
|
20
|
-
width="500"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
`;
|