@jbrowse/plugin-alignments 2.3.4 → 2.4.0
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/LinearAlignmentsDisplay/models/configSchema.js +7 -0
- package/dist/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +24 -6
- package/dist/LinearAlignmentsDisplay/models/model.js +20 -3
- package/dist/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/dist/LinearPileupDisplay/model.d.ts +75 -12
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +14 -11
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +78 -29
- package/dist/LinearReadArcsDisplay/model.js +16 -4
- package/dist/LinearReadArcsDisplay/model.js.map +1 -1
- package/dist/LinearReadCloudDisplay/model.d.ts +72 -20
- package/dist/LinearReadCloudDisplay/model.js +15 -3
- package/dist/LinearReadCloudDisplay/model.js.map +1 -1
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +9 -14
- package/dist/PileupRenderer/PileupRenderer.js +2 -4
- package/dist/PileupRenderer/PileupRenderer.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/models/configSchema.js +7 -0
- package/esm/LinearAlignmentsDisplay/models/configSchema.js.map +1 -1
- package/esm/LinearAlignmentsDisplay/models/model.d.ts +24 -6
- package/esm/LinearAlignmentsDisplay/models/model.js +20 -3
- package/esm/LinearAlignmentsDisplay/models/model.js.map +1 -1
- package/esm/LinearPileupDisplay/model.d.ts +75 -12
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +14 -11
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js.map +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +78 -29
- package/esm/LinearReadArcsDisplay/model.js +16 -4
- package/esm/LinearReadArcsDisplay/model.js.map +1 -1
- package/esm/LinearReadCloudDisplay/model.d.ts +72 -20
- package/esm/LinearReadCloudDisplay/model.js +15 -3
- package/esm/LinearReadCloudDisplay/model.js.map +1 -1
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +9 -14
- package/esm/PileupRenderer/PileupRenderer.js +2 -4
- package/esm/PileupRenderer/PileupRenderer.js.map +1 -1
- package/package.json +2 -2
- package/src/AlignmentsFeatureDetail/__snapshots__/index.test.tsx.snap +13 -13
- package/src/LinearAlignmentsDisplay/models/configSchema.ts +8 -0
- package/src/LinearAlignmentsDisplay/models/model.tsx +19 -3
- package/src/LinearReadArcsDisplay/components/ReactComponent.tsx +14 -12
- package/src/LinearReadArcsDisplay/model.tsx +23 -5
- package/src/LinearReadCloudDisplay/model.tsx +23 -7
- package/src/MismatchParser/index.ts +3 -3
- package/src/PileupRenderer/PileupRenderer.ts +2 -4
|
@@ -111,7 +111,7 @@ function AlignmentsModel(
|
|
|
111
111
|
/**
|
|
112
112
|
* #property
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
heightPreConfig: types.maybe(types.number),
|
|
115
115
|
/**
|
|
116
116
|
* #property
|
|
117
117
|
*/
|
|
@@ -155,6 +155,14 @@ function stateModelFactory(
|
|
|
155
155
|
self.snpCovHeight = n
|
|
156
156
|
},
|
|
157
157
|
}))
|
|
158
|
+
.views(self => ({
|
|
159
|
+
/**
|
|
160
|
+
* #getter
|
|
161
|
+
*/
|
|
162
|
+
get height() {
|
|
163
|
+
return self.heightPreConfig ?? getConf(self, 'height')
|
|
164
|
+
},
|
|
165
|
+
}))
|
|
158
166
|
.views(self => ({
|
|
159
167
|
/**
|
|
160
168
|
* #getter
|
|
@@ -245,8 +253,8 @@ function stateModelFactory(
|
|
|
245
253
|
* #action
|
|
246
254
|
*/
|
|
247
255
|
setHeight(n: number) {
|
|
248
|
-
self.
|
|
249
|
-
return self.
|
|
256
|
+
self.heightPreConfig = Math.max(n, minDisplayHeight)
|
|
257
|
+
return self.heightPreConfig
|
|
250
258
|
},
|
|
251
259
|
/**
|
|
252
260
|
* #action
|
|
@@ -369,6 +377,14 @@ function stateModelFactory(
|
|
|
369
377
|
},
|
|
370
378
|
}
|
|
371
379
|
})
|
|
380
|
+
.preProcessSnapshot(snap => {
|
|
381
|
+
if (!snap) {
|
|
382
|
+
return snap
|
|
383
|
+
}
|
|
384
|
+
// @ts-ignore
|
|
385
|
+
const { height, ...rest } = snap
|
|
386
|
+
return { heightPreConfig: height, ...rest }
|
|
387
|
+
})
|
|
372
388
|
}
|
|
373
389
|
|
|
374
390
|
export default stateModelFactory
|
|
@@ -14,18 +14,20 @@ import { LinearReadArcsDisplayModel } from '../model'
|
|
|
14
14
|
|
|
15
15
|
type LGV = LinearGenomeViewModel
|
|
16
16
|
|
|
17
|
-
const useStyles = makeStyles()(theme =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
17
|
+
const useStyles = makeStyles()(theme => {
|
|
18
|
+
const bg = theme.palette.action.disabledBackground
|
|
19
|
+
return {
|
|
20
|
+
loading: {
|
|
21
|
+
paddingLeft: '0.6em',
|
|
22
|
+
backgroundColor: theme.palette.background.default,
|
|
23
|
+
backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,
|
|
24
|
+
height: '100%',
|
|
25
|
+
width: '100%',
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
textAlign: 'center',
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
})
|
|
29
31
|
|
|
30
32
|
const Arcs = observer(function ({
|
|
31
33
|
model,
|
|
@@ -22,11 +22,16 @@ import FilterListIcon from '@mui/icons-material/ClearAll'
|
|
|
22
22
|
import { FilterModel } from '../shared'
|
|
23
23
|
import drawFeats from './drawFeats'
|
|
24
24
|
import { fetchChains, ChainData } from '../shared/fetchChains'
|
|
25
|
-
import { ExportSvgOptions } from '@jbrowse/plugin-linear-genome-view/src/LinearGenomeView'
|
|
26
25
|
|
|
27
26
|
// async
|
|
28
27
|
const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'))
|
|
29
28
|
|
|
29
|
+
// stabilize clipid under test for snapshot
|
|
30
|
+
function getId(id: string) {
|
|
31
|
+
const isJest = typeof jest === 'undefined'
|
|
32
|
+
return `arc-clip-${isJest ? id : 'jest'}`
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
interface Filter {
|
|
31
36
|
flagInclude: number
|
|
32
37
|
flagExclude: number
|
|
@@ -333,7 +338,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
333
338
|
/**
|
|
334
339
|
* #method
|
|
335
340
|
*/
|
|
336
|
-
async renderSvg(opts:
|
|
341
|
+
async renderSvg(opts: { rasterizeLayers?: boolean }) {
|
|
337
342
|
const view = getContainingView(self) as LGV
|
|
338
343
|
const width = view.dynamicBlocks.totalWidthPx
|
|
339
344
|
const height = self.height
|
|
@@ -360,13 +365,26 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
360
365
|
const C2S = await import('canvas2svg')
|
|
361
366
|
const ctx = new C2S.default(width, height)
|
|
362
367
|
await drawFeats(self, ctx)
|
|
368
|
+
const clipid = getId(self.id)
|
|
363
369
|
str = (
|
|
364
|
-
|
|
365
|
-
|
|
370
|
+
<>
|
|
371
|
+
<defs>
|
|
372
|
+
<clipPath id={clipid}>
|
|
373
|
+
<rect x={0} y={0} width={width} height={height} />
|
|
374
|
+
</clipPath>
|
|
375
|
+
</defs>
|
|
376
|
+
<g
|
|
377
|
+
/* eslint-disable-next-line react/no-danger */
|
|
378
|
+
dangerouslySetInnerHTML={{
|
|
379
|
+
__html: ctx.getSvg().innerHTML,
|
|
380
|
+
}}
|
|
381
|
+
clipPath={`url(#${clipid})`}
|
|
382
|
+
/>
|
|
383
|
+
</>
|
|
366
384
|
)
|
|
367
385
|
}
|
|
368
386
|
|
|
369
|
-
return
|
|
387
|
+
return <>{str}</>
|
|
370
388
|
},
|
|
371
389
|
}))
|
|
372
390
|
.actions(self => ({
|
|
@@ -17,10 +17,7 @@ import FilterListIcon from '@mui/icons-material/ClearAll'
|
|
|
17
17
|
import { FilterModel } from '../shared'
|
|
18
18
|
import { fetchChains, ChainData } from '../shared/fetchChains'
|
|
19
19
|
import drawFeats from './drawFeats'
|
|
20
|
-
import {
|
|
21
|
-
ExportSvgOptions,
|
|
22
|
-
LinearGenomeViewModel,
|
|
23
|
-
} from '@jbrowse/plugin-linear-genome-view/src/LinearGenomeView'
|
|
20
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
|
|
24
21
|
|
|
25
22
|
// async
|
|
26
23
|
const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'))
|
|
@@ -32,6 +29,12 @@ interface Filter {
|
|
|
32
29
|
tagFilter?: { tag: string; value: string }
|
|
33
30
|
}
|
|
34
31
|
|
|
32
|
+
// stabilize clipid under test for snapshot
|
|
33
|
+
function getId(id: string) {
|
|
34
|
+
const isJest = typeof jest === 'undefined'
|
|
35
|
+
return `cloud-clip-${isJest ? id : 'jest'}`
|
|
36
|
+
}
|
|
37
|
+
|
|
35
38
|
/**
|
|
36
39
|
* #stateModel LinearReadCloudDisplay
|
|
37
40
|
* extends `BaseLinearDisplay`
|
|
@@ -205,7 +208,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
205
208
|
/**
|
|
206
209
|
* #method
|
|
207
210
|
*/
|
|
208
|
-
async renderSvg(opts:
|
|
211
|
+
async renderSvg(opts: { rasterizeLayers?: boolean }) {
|
|
209
212
|
const view = getContainingView(self) as LinearGenomeViewModel
|
|
210
213
|
const width = view.dynamicBlocks.totalWidthPx
|
|
211
214
|
const height = self.height
|
|
@@ -232,9 +235,22 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
|
232
235
|
const C2S = await import('canvas2svg')
|
|
233
236
|
const ctx = new C2S.default(width, height)
|
|
234
237
|
await drawFeats(self, ctx)
|
|
238
|
+
const clipid = getId(self.id)
|
|
235
239
|
str = (
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
<>
|
|
241
|
+
<defs>
|
|
242
|
+
<clipPath id={clipid}>
|
|
243
|
+
<rect x={0} y={0} width={width} height={height} />
|
|
244
|
+
</clipPath>
|
|
245
|
+
</defs>
|
|
246
|
+
<g
|
|
247
|
+
/* eslint-disable-next-line react/no-danger */
|
|
248
|
+
dangerouslySetInnerHTML={{
|
|
249
|
+
__html: ctx.getSvg().innerHTML,
|
|
250
|
+
}}
|
|
251
|
+
clipPath={`url(#${clipid})`}
|
|
252
|
+
/>
|
|
253
|
+
</>
|
|
238
254
|
)
|
|
239
255
|
}
|
|
240
256
|
|
|
@@ -25,7 +25,7 @@ export function cigarToMismatches(
|
|
|
25
25
|
seq?: string,
|
|
26
26
|
ref?: string,
|
|
27
27
|
qual?: Buffer,
|
|
28
|
-
)
|
|
28
|
+
) {
|
|
29
29
|
let roffset = 0 // reference offset
|
|
30
30
|
let soffset = 0 // seq offset
|
|
31
31
|
const mismatches: Mismatch[] = []
|
|
@@ -125,7 +125,7 @@ export function mdToMismatches(
|
|
|
125
125
|
cigarMismatches: Mismatch[],
|
|
126
126
|
seq: string,
|
|
127
127
|
qual?: Buffer,
|
|
128
|
-
)
|
|
128
|
+
) {
|
|
129
129
|
const mismatchRecords: Mismatch[] = []
|
|
130
130
|
let curr: Mismatch = { start: 0, base: '', length: 0, type: 'mismatch' }
|
|
131
131
|
const skips = cigarMismatches.filter(cigar => cigar.type === 'skip')
|
|
@@ -216,7 +216,7 @@ export function getMismatches(
|
|
|
216
216
|
seq?: string,
|
|
217
217
|
ref?: string,
|
|
218
218
|
qual?: Buffer,
|
|
219
|
-
)
|
|
219
|
+
) {
|
|
220
220
|
let mismatches: Mismatch[] = []
|
|
221
221
|
const ops = parseCigar(cigar)
|
|
222
222
|
|
|
@@ -74,11 +74,9 @@ function getColorBaseMap(theme: Theme) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function getContrastBaseMap(theme: Theme) {
|
|
77
|
+
const map = getColorBaseMap(theme)
|
|
77
78
|
return Object.fromEntries(
|
|
78
|
-
Object.entries(
|
|
79
|
-
key,
|
|
80
|
-
theme.palette.getContrastText(value),
|
|
81
|
-
]),
|
|
79
|
+
Object.entries(map).map(([k, v]) => [k, theme.palette.getContrastText(v)]),
|
|
82
80
|
)
|
|
83
81
|
}
|
|
84
82
|
|