@jbrowse/plugin-variants 2.6.1 → 2.6.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/dist/ChordVariantDisplay/index.js +0 -1
- package/dist/ChordVariantDisplay/models/configSchema.js +0 -1
- package/dist/ChordVariantDisplay/models/stateModelFactory.js +0 -1
- package/dist/LinearVariantDisplay/configSchema.js +0 -1
- package/dist/LinearVariantDisplay/index.js +0 -1
- package/dist/LinearVariantDisplay/model.js +0 -1
- package/dist/StructuralVariantChordRenderer/Chord.js +0 -1
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/dist/StructuralVariantChordRenderer/configSchema.js +0 -1
- package/dist/StructuralVariantChordRenderer/index.js +0 -1
- package/dist/VariantFeatureWidget/AnnotGrid.js +0 -1
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
- package/dist/VariantFeatureWidget/BreakendPanel.js +0 -1
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +0 -1
- package/dist/VariantFeatureWidget/VariantSampleGrid.js +0 -1
- package/dist/VariantFeatureWidget/index.js +0 -1
- package/dist/VariantTrack/configSchema.js +0 -1
- package/dist/VariantTrack/index.js +0 -1
- package/dist/VcfAdapter/VcfAdapter.js +0 -1
- package/dist/VcfAdapter/configSchema.js +0 -1
- package/dist/VcfAdapter/index.js +0 -1
- package/dist/VcfFeature/index.js +2 -2
- package/dist/VcfFeature/util.js +0 -1
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
- package/dist/VcfTabixAdapter/configSchema.js +0 -1
- package/dist/VcfTabixAdapter/index.js +0 -1
- package/dist/extensionPoints.js +0 -1
- package/dist/index.js +0 -1
- package/esm/ChordVariantDisplay/index.js +0 -1
- package/esm/ChordVariantDisplay/models/configSchema.js +0 -1
- package/esm/ChordVariantDisplay/models/stateModelFactory.js +0 -1
- package/esm/LinearVariantDisplay/configSchema.js +0 -1
- package/esm/LinearVariantDisplay/index.js +0 -1
- package/esm/LinearVariantDisplay/model.js +0 -1
- package/esm/StructuralVariantChordRenderer/Chord.js +0 -1
- package/esm/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/esm/StructuralVariantChordRenderer/configSchema.js +0 -1
- package/esm/StructuralVariantChordRenderer/index.js +0 -1
- package/esm/VariantFeatureWidget/AnnotGrid.js +0 -1
- package/esm/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
- package/esm/VariantFeatureWidget/BreakendPanel.js +0 -1
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js +0 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +0 -1
- package/esm/VariantFeatureWidget/VariantSampleGrid.js +0 -1
- package/esm/VariantFeatureWidget/index.js +0 -1
- package/esm/VariantTrack/configSchema.js +0 -1
- package/esm/VariantTrack/index.js +0 -1
- package/esm/VcfAdapter/VcfAdapter.js +0 -1
- package/esm/VcfAdapter/configSchema.js +0 -1
- package/esm/VcfAdapter/index.js +0 -1
- package/esm/VcfFeature/index.js +2 -2
- package/esm/VcfFeature/util.js +0 -1
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
- package/esm/VcfTabixAdapter/configSchema.js +0 -1
- package/esm/VcfTabixAdapter/index.js +0 -1
- package/esm/extensionPoints.js +0 -1
- package/esm/index.js +0 -1
- package/package.json +3 -4
- package/dist/ChordVariantDisplay/index.js.map +0 -1
- package/dist/ChordVariantDisplay/models/configSchema.js.map +0 -1
- package/dist/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
- package/dist/LinearVariantDisplay/configSchema.js.map +0 -1
- package/dist/LinearVariantDisplay/index.js.map +0 -1
- package/dist/LinearVariantDisplay/model.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/Chord.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/configSchema.js.map +0 -1
- package/dist/StructuralVariantChordRenderer/index.js.map +0 -1
- package/dist/VariantFeatureWidget/AnnotGrid.js.map +0 -1
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
- package/dist/VariantFeatureWidget/BreakendPanel.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
- package/dist/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
- package/dist/VariantFeatureWidget/index.js.map +0 -1
- package/dist/VariantTrack/configSchema.js.map +0 -1
- package/dist/VariantTrack/index.js.map +0 -1
- package/dist/VcfAdapter/VcfAdapter.js.map +0 -1
- package/dist/VcfAdapter/configSchema.js.map +0 -1
- package/dist/VcfAdapter/index.js.map +0 -1
- package/dist/VcfFeature/index.js.map +0 -1
- package/dist/VcfFeature/util.js.map +0 -1
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
- package/dist/VcfTabixAdapter/configSchema.js.map +0 -1
- package/dist/VcfTabixAdapter/index.js.map +0 -1
- package/dist/extensionPoints.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/esm/ChordVariantDisplay/index.js.map +0 -1
- package/esm/ChordVariantDisplay/models/configSchema.js.map +0 -1
- package/esm/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
- package/esm/LinearVariantDisplay/configSchema.js.map +0 -1
- package/esm/LinearVariantDisplay/index.js.map +0 -1
- package/esm/LinearVariantDisplay/model.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/Chord.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/configSchema.js.map +0 -1
- package/esm/StructuralVariantChordRenderer/index.js.map +0 -1
- package/esm/VariantFeatureWidget/AnnotGrid.js.map +0 -1
- package/esm/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
- package/esm/VariantFeatureWidget/BreakendPanel.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
- package/esm/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
- package/esm/VariantFeatureWidget/index.js.map +0 -1
- package/esm/VariantTrack/configSchema.js.map +0 -1
- package/esm/VariantTrack/index.js.map +0 -1
- package/esm/VcfAdapter/VcfAdapter.js.map +0 -1
- package/esm/VcfAdapter/configSchema.js.map +0 -1
- package/esm/VcfAdapter/index.js.map +0 -1
- package/esm/VcfFeature/index.js.map +0 -1
- package/esm/VcfFeature/util.js.map +0 -1
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
- package/esm/VcfTabixAdapter/configSchema.js.map +0 -1
- package/esm/VcfTabixAdapter/index.js.map +0 -1
- package/esm/extensionPoints.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/src/ChordVariantDisplay/index.ts +0 -23
- package/src/ChordVariantDisplay/models/configSchema.ts +0 -33
- package/src/ChordVariantDisplay/models/stateModelFactory.ts +0 -63
- package/src/LinearVariantDisplay/configSchema.ts +0 -30
- package/src/LinearVariantDisplay/index.ts +0 -20
- package/src/LinearVariantDisplay/model.ts +0 -76
- package/src/StructuralVariantChordRenderer/Chord.tsx +0 -141
- package/src/StructuralVariantChordRenderer/ReactComponent.tsx +0 -78
- package/src/StructuralVariantChordRenderer/configSchema.ts +0 -42
- package/src/StructuralVariantChordRenderer/index.ts +0 -17
- package/src/VariantFeatureWidget/AnnotGrid.tsx +0 -51
- package/src/VariantFeatureWidget/BreakendOptionDialog.tsx +0 -117
- package/src/VariantFeatureWidget/BreakendPanel.tsx +0 -93
- package/src/VariantFeatureWidget/VariantAnnotationTable.tsx +0 -27
- package/src/VariantFeatureWidget/VariantFeatureWidget.test.tsx +0 -42
- package/src/VariantFeatureWidget/VariantFeatureWidget.tsx +0 -112
- package/src/VariantFeatureWidget/VariantSampleGrid.tsx +0 -151
- package/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap +0 -244
- package/src/VariantFeatureWidget/index.ts +0 -32
- package/src/VariantTrack/configSchema.ts +0 -24
- package/src/VariantTrack/index.ts +0 -16
- package/src/VcfAdapter/VcfAdapter.test.ts +0 -28
- package/src/VcfAdapter/VcfAdapter.ts +0 -125
- package/src/VcfAdapter/__snapshots__/VcfAdapter.test.ts.snap +0 -325
- package/src/VcfAdapter/configSchema.ts +0 -22
- package/src/VcfAdapter/index.ts +0 -15
- package/src/VcfAdapter/test_data/volvox.filtered.vcf +0 -73
- package/src/VcfFeature/index.test.ts +0 -132
- package/src/VcfFeature/index.ts +0 -104
- package/src/VcfFeature/util.ts +0 -138
- package/src/VcfTabixAdapter/VcfTabixAdapter.test.ts +0 -69
- package/src/VcfTabixAdapter/VcfTabixAdapter.ts +0 -90
- package/src/VcfTabixAdapter/__snapshots__/VcfTabixAdapter.test.ts.snap +0 -325
- package/src/VcfTabixAdapter/configSchema.ts +0 -43
- package/src/VcfTabixAdapter/index.ts +0 -17
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz +0 -0
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.csi +0 -0
- package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.tbi +0 -0
- package/src/__snapshots__/index.test.ts.snap +0 -20
- package/src/extensionPoints.ts +0 -74
- package/src/index.test.ts +0 -32
- package/src/index.ts +0 -27
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
|
-
import { observer } from 'mobx-react'
|
|
3
|
-
import { Feature } from '@jbrowse/core/util'
|
|
4
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
5
|
-
|
|
6
|
-
// locals
|
|
7
|
-
import Chord, { Block, AnyRegion } from './Chord'
|
|
8
|
-
|
|
9
|
-
export default observer(function StructuralVariantChords({
|
|
10
|
-
features,
|
|
11
|
-
config,
|
|
12
|
-
displayModel,
|
|
13
|
-
blockDefinitions,
|
|
14
|
-
radius,
|
|
15
|
-
bezierRadius,
|
|
16
|
-
displayModel: { selectedFeatureId },
|
|
17
|
-
onChordClick,
|
|
18
|
-
}: {
|
|
19
|
-
features: Map<string, Feature>
|
|
20
|
-
radius: number
|
|
21
|
-
config: AnyConfigurationModel
|
|
22
|
-
displayModel: { id: string; selectedFeatureId: string }
|
|
23
|
-
blockDefinitions: Block[]
|
|
24
|
-
bezierRadius: number
|
|
25
|
-
onChordClick: (
|
|
26
|
-
feature: Feature,
|
|
27
|
-
reg: AnyRegion,
|
|
28
|
-
endBlock: AnyRegion,
|
|
29
|
-
evt: unknown,
|
|
30
|
-
) => void
|
|
31
|
-
}) {
|
|
32
|
-
// make a map of refName -> blockDefinition
|
|
33
|
-
const blocksForRefsMemo = useMemo(() => {
|
|
34
|
-
const blocksForRefs = {} as { [key: string]: Block }
|
|
35
|
-
blockDefinitions.forEach(block => {
|
|
36
|
-
;(block.region.elided ? block.region.regions : [block.region]).forEach(
|
|
37
|
-
r => (blocksForRefs[r.refName] = block),
|
|
38
|
-
)
|
|
39
|
-
})
|
|
40
|
-
return blocksForRefs
|
|
41
|
-
}, [blockDefinitions])
|
|
42
|
-
const chords = []
|
|
43
|
-
for (const feature of features.values()) {
|
|
44
|
-
const id = feature.id()
|
|
45
|
-
const selected = String(selectedFeatureId) === String(id)
|
|
46
|
-
chords.push(
|
|
47
|
-
<Chord
|
|
48
|
-
key={id}
|
|
49
|
-
feature={feature}
|
|
50
|
-
config={config}
|
|
51
|
-
radius={radius}
|
|
52
|
-
bezierRadius={bezierRadius}
|
|
53
|
-
blocksForRefs={blocksForRefsMemo}
|
|
54
|
-
selected={selected}
|
|
55
|
-
onClick={onChordClick}
|
|
56
|
-
/>,
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
const trackStyleId = `chords-${
|
|
60
|
-
typeof jest !== 'undefined' ? 'test' : displayModel.id
|
|
61
|
-
}`
|
|
62
|
-
return (
|
|
63
|
-
<g id={trackStyleId} data-testid="structuralVariantChordRenderer">
|
|
64
|
-
<style
|
|
65
|
-
// eslint-disable-next-line react/no-danger
|
|
66
|
-
dangerouslySetInnerHTML={{
|
|
67
|
-
__html: `
|
|
68
|
-
#${trackStyleId} > path {
|
|
69
|
-
cursor: crosshair;
|
|
70
|
-
fill: none;
|
|
71
|
-
}
|
|
72
|
-
`,
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
{chords}
|
|
76
|
-
</g>
|
|
77
|
-
)
|
|
78
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
-
/**
|
|
3
|
-
* #config StructuralVariantChordRenderer
|
|
4
|
-
*/
|
|
5
|
-
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
6
|
-
|
|
7
|
-
const configSchema = ConfigurationSchema(
|
|
8
|
-
'StructuralVariantChordRenderer',
|
|
9
|
-
{
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
*/
|
|
13
|
-
strokeColor: {
|
|
14
|
-
type: 'color',
|
|
15
|
-
description: 'the line color of each arc',
|
|
16
|
-
defaultValue: 'rgba(255,133,0,0.32)',
|
|
17
|
-
contextVariable: ['feature'],
|
|
18
|
-
},
|
|
19
|
-
/**
|
|
20
|
-
* #slot
|
|
21
|
-
*/
|
|
22
|
-
strokeColorSelected: {
|
|
23
|
-
type: 'color',
|
|
24
|
-
description: 'the line color of an arc that has been selected',
|
|
25
|
-
defaultValue: 'black',
|
|
26
|
-
contextVariable: ['feature'],
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* #slot
|
|
30
|
-
*/
|
|
31
|
-
strokeColorHover: {
|
|
32
|
-
type: 'color',
|
|
33
|
-
description:
|
|
34
|
-
'the line color of an arc that is being hovered over with the mouse',
|
|
35
|
-
defaultValue: '#555',
|
|
36
|
-
contextVariable: ['feature'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{ explicitlyTyped: true },
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
export default configSchema
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import ChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType'
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
-
import configSchema from './configSchema'
|
|
4
|
-
import ReactComponent from './ReactComponent'
|
|
5
|
-
|
|
6
|
-
export default (pluginManager: PluginManager) => {
|
|
7
|
-
pluginManager.addRendererType(
|
|
8
|
-
() =>
|
|
9
|
-
new ChordRendererType({
|
|
10
|
-
name: 'StructuralVariantChordRenderer',
|
|
11
|
-
displayName: 'SV chord renderer',
|
|
12
|
-
ReactComponent,
|
|
13
|
-
configSchema,
|
|
14
|
-
pluginManager,
|
|
15
|
-
}),
|
|
16
|
-
)
|
|
17
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
DataGrid,
|
|
4
|
-
GridColDef,
|
|
5
|
-
GridToolbar,
|
|
6
|
-
GridValidRowModel,
|
|
7
|
-
} from '@mui/x-data-grid'
|
|
8
|
-
import { Checkbox, FormControlLabel, Typography } from '@mui/material'
|
|
9
|
-
import ResizeBar, { useResizeBar } from '@jbrowse/core/ui/ResizeBar'
|
|
10
|
-
import { measureGridWidth } from '@jbrowse/core/util'
|
|
11
|
-
|
|
12
|
-
export default function VariantAnnotPanel({
|
|
13
|
-
rows,
|
|
14
|
-
columns,
|
|
15
|
-
}: {
|
|
16
|
-
rows: GridValidRowModel[]
|
|
17
|
-
columns: GridColDef[]
|
|
18
|
-
}) {
|
|
19
|
-
const { ref, scrollLeft } = useResizeBar()
|
|
20
|
-
const [checked, setChecked] = useState(false)
|
|
21
|
-
const [widths, setWidths] = useState(
|
|
22
|
-
columns.map(e => measureGridWidth(rows.map(r => r[e.field]))),
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
return rows.length ? (
|
|
26
|
-
<div ref={ref}>
|
|
27
|
-
<FormControlLabel
|
|
28
|
-
control={
|
|
29
|
-
<Checkbox
|
|
30
|
-
checked={checked}
|
|
31
|
-
onChange={event => setChecked(event.target.checked)}
|
|
32
|
-
/>
|
|
33
|
-
}
|
|
34
|
-
label={<Typography variant="body2">Show options</Typography>}
|
|
35
|
-
/>
|
|
36
|
-
<div ref={ref}>
|
|
37
|
-
<ResizeBar
|
|
38
|
-
widths={widths}
|
|
39
|
-
setWidths={setWidths}
|
|
40
|
-
scrollLeft={scrollLeft}
|
|
41
|
-
/>
|
|
42
|
-
<DataGrid
|
|
43
|
-
rowHeight={25}
|
|
44
|
-
rows={rows}
|
|
45
|
-
columns={columns.map((c, i) => ({ ...c, width: widths[i] }))}
|
|
46
|
-
slots={{ toolbar: checked ? GridToolbar : null }}
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
) : null
|
|
51
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
import { observer } from 'mobx-react'
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Checkbox,
|
|
7
|
-
DialogActions,
|
|
8
|
-
DialogContent,
|
|
9
|
-
FormControlLabel,
|
|
10
|
-
} from '@mui/material'
|
|
11
|
-
import { makeStyles } from 'tss-react/mui'
|
|
12
|
-
import { getSnapshot } from 'mobx-state-tree'
|
|
13
|
-
// jbrowse
|
|
14
|
-
import { Dialog } from '@jbrowse/core/ui'
|
|
15
|
-
import { getSession, Feature } from '@jbrowse/core/util'
|
|
16
|
-
|
|
17
|
-
const useStyles = makeStyles()({
|
|
18
|
-
block: {
|
|
19
|
-
display: 'block',
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export default observer(function BreakendOptionDialog({
|
|
24
|
-
model,
|
|
25
|
-
handleClose,
|
|
26
|
-
feature,
|
|
27
|
-
viewType,
|
|
28
|
-
}: {
|
|
29
|
-
model: any
|
|
30
|
-
handleClose: () => void
|
|
31
|
-
feature: Feature
|
|
32
|
-
viewType: any
|
|
33
|
-
}) {
|
|
34
|
-
const { classes } = useStyles()
|
|
35
|
-
const [copyTracks, setCopyTracks] = useState(true)
|
|
36
|
-
const [mirrorTracks, setMirrorTracks] = useState(true)
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Dialog open onClose={handleClose} title="Breakpoint split view options">
|
|
40
|
-
<DialogContent>
|
|
41
|
-
<FormControlLabel
|
|
42
|
-
className={classes.block}
|
|
43
|
-
control={
|
|
44
|
-
<Checkbox
|
|
45
|
-
checked={copyTracks}
|
|
46
|
-
onChange={event => setCopyTracks(event.target.checked)}
|
|
47
|
-
/>
|
|
48
|
-
}
|
|
49
|
-
label="Copy tracks into the new view"
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
<FormControlLabel
|
|
53
|
-
className={classes.block}
|
|
54
|
-
control={
|
|
55
|
-
<Checkbox
|
|
56
|
-
checked={mirrorTracks}
|
|
57
|
-
onChange={event => setMirrorTracks(event.target.checked)}
|
|
58
|
-
/>
|
|
59
|
-
}
|
|
60
|
-
label="Mirror tracks vertically in vertically stacked view"
|
|
61
|
-
/>
|
|
62
|
-
</DialogContent>
|
|
63
|
-
<DialogActions>
|
|
64
|
-
<Button
|
|
65
|
-
onClick={() => {
|
|
66
|
-
const { view } = model
|
|
67
|
-
const session = getSession(model)
|
|
68
|
-
try {
|
|
69
|
-
const viewSnapshot = viewType.snapshotFromBreakendFeature(
|
|
70
|
-
feature,
|
|
71
|
-
view,
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
interface Track {
|
|
75
|
-
trackId: string
|
|
76
|
-
[key: string]: unknown
|
|
77
|
-
}
|
|
78
|
-
function remapIds(arr: Track[]) {
|
|
79
|
-
return arr.map(v => ({
|
|
80
|
-
...v,
|
|
81
|
-
id: `${v.trackId}-${Math.random()}`,
|
|
82
|
-
}))
|
|
83
|
-
}
|
|
84
|
-
viewSnapshot.views[0].offsetPx -= view.width / 2 + 100
|
|
85
|
-
viewSnapshot.views[1].offsetPx -= view.width / 2 + 100
|
|
86
|
-
viewSnapshot.featureData = feature
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
88
|
-
const viewTracks = getSnapshot(view.tracks) as Track[]
|
|
89
|
-
viewSnapshot.views[0].tracks = remapIds(viewTracks)
|
|
90
|
-
viewSnapshot.views[1].tracks = remapIds(
|
|
91
|
-
mirrorTracks ? [...viewTracks].reverse() : viewTracks,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
session.addView('BreakpointSplitView', viewSnapshot)
|
|
95
|
-
} catch (e) {
|
|
96
|
-
console.error(e)
|
|
97
|
-
session.notify(`${e}`)
|
|
98
|
-
}
|
|
99
|
-
handleClose()
|
|
100
|
-
}}
|
|
101
|
-
variant="contained"
|
|
102
|
-
color="primary"
|
|
103
|
-
autoFocus
|
|
104
|
-
>
|
|
105
|
-
OK
|
|
106
|
-
</Button>
|
|
107
|
-
<Button
|
|
108
|
-
onClick={() => handleClose()}
|
|
109
|
-
color="secondary"
|
|
110
|
-
variant="contained"
|
|
111
|
-
>
|
|
112
|
-
Cancel
|
|
113
|
-
</Button>
|
|
114
|
-
</DialogActions>
|
|
115
|
-
</Dialog>
|
|
116
|
-
)
|
|
117
|
-
})
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
import { Link, Typography } from '@mui/material'
|
|
4
|
-
import SimpleFeature, {
|
|
5
|
-
SimpleFeatureSerialized,
|
|
6
|
-
} from '@jbrowse/core/util/simpleFeature'
|
|
7
|
-
import { getEnv, getSession } from '@jbrowse/core/util'
|
|
8
|
-
import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
|
|
9
|
-
import BreakendOptionDialog from './BreakendOptionDialog'
|
|
10
|
-
|
|
11
|
-
export default function BreakendPanel(props: {
|
|
12
|
-
locStrings: string[]
|
|
13
|
-
model: any
|
|
14
|
-
feature: SimpleFeatureSerialized
|
|
15
|
-
}) {
|
|
16
|
-
const { model, locStrings, feature } = props
|
|
17
|
-
const session = getSession(model)
|
|
18
|
-
const { pluginManager } = getEnv(session)
|
|
19
|
-
const [breakpointDialog, setBreakpointDialog] = useState(false)
|
|
20
|
-
let viewType
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
viewType = pluginManager.getViewType('BreakpointSplitView')
|
|
24
|
-
} catch (e) {
|
|
25
|
-
// ignore
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const simpleFeature = new SimpleFeature(feature)
|
|
29
|
-
return (
|
|
30
|
-
<BaseCard {...props} title="Breakends">
|
|
31
|
-
<Typography>Link to linear view of breakend endpoints</Typography>
|
|
32
|
-
<ul>
|
|
33
|
-
{locStrings.map(locString => (
|
|
34
|
-
<li key={`${JSON.stringify(locString)}`}>
|
|
35
|
-
<Link
|
|
36
|
-
href="#"
|
|
37
|
-
onClick={event => {
|
|
38
|
-
event.preventDefault()
|
|
39
|
-
const { view } = model
|
|
40
|
-
try {
|
|
41
|
-
if (view) {
|
|
42
|
-
view.navToLocString?.(locString)
|
|
43
|
-
} else {
|
|
44
|
-
throw new Error(
|
|
45
|
-
'No view associated with this feature detail panel anymore',
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.error(e)
|
|
50
|
-
session.notify(`${e}`)
|
|
51
|
-
}
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
{`LGV - ${locString}`}
|
|
55
|
-
</Link>
|
|
56
|
-
</li>
|
|
57
|
-
))}
|
|
58
|
-
</ul>
|
|
59
|
-
{viewType ? (
|
|
60
|
-
<div>
|
|
61
|
-
<Typography>
|
|
62
|
-
Launch split views with breakend source and target
|
|
63
|
-
</Typography>
|
|
64
|
-
<ul>
|
|
65
|
-
{locStrings.map(locString => (
|
|
66
|
-
<li key={`${JSON.stringify(locString)}`}>
|
|
67
|
-
<Link
|
|
68
|
-
href="#"
|
|
69
|
-
onClick={event => {
|
|
70
|
-
event.preventDefault()
|
|
71
|
-
setBreakpointDialog(true)
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
{`${feature.refName}:${feature.start} // ${locString} (split view)`}
|
|
75
|
-
</Link>
|
|
76
|
-
</li>
|
|
77
|
-
))}
|
|
78
|
-
</ul>
|
|
79
|
-
{breakpointDialog ? (
|
|
80
|
-
<BreakendOptionDialog
|
|
81
|
-
model={model}
|
|
82
|
-
feature={simpleFeature}
|
|
83
|
-
viewType={viewType}
|
|
84
|
-
handleClose={() => {
|
|
85
|
-
setBreakpointDialog(false)
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
) : null}
|
|
89
|
-
</div>
|
|
90
|
-
) : null}
|
|
91
|
-
</BaseCard>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
|
|
3
|
-
import AnnotGrid from './AnnotGrid'
|
|
4
|
-
|
|
5
|
-
export default function VariantAnnotationTable({
|
|
6
|
-
data,
|
|
7
|
-
fields,
|
|
8
|
-
title,
|
|
9
|
-
}: {
|
|
10
|
-
data: string[]
|
|
11
|
-
fields: string[]
|
|
12
|
-
title: string
|
|
13
|
-
}) {
|
|
14
|
-
return data.length ? (
|
|
15
|
-
<BaseCard title={title}>
|
|
16
|
-
<AnnotGrid
|
|
17
|
-
rows={
|
|
18
|
-
data.map((elt, id) => ({
|
|
19
|
-
id,
|
|
20
|
-
...Object.fromEntries(elt.split('|').map((e, i) => [fields[i], e])),
|
|
21
|
-
})) || []
|
|
22
|
-
}
|
|
23
|
-
columns={fields.map(c => ({ field: c }))}
|
|
24
|
-
/>
|
|
25
|
-
</BaseCard>
|
|
26
|
-
) : null
|
|
27
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
import { types } from 'mobx-state-tree'
|
|
4
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
5
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
6
|
-
|
|
7
|
-
// locals
|
|
8
|
-
import { stateModelFactory } from '.'
|
|
9
|
-
import VariantFeatureDetails from './VariantFeatureWidget'
|
|
10
|
-
|
|
11
|
-
test('renders with just the required model elements', () => {
|
|
12
|
-
const pluginManager = new PluginManager([])
|
|
13
|
-
const Session = types.model({
|
|
14
|
-
rpcManager: types.optional(types.frozen(), {}),
|
|
15
|
-
configuration: ConfigurationSchema('test', {}),
|
|
16
|
-
widget: stateModelFactory(pluginManager),
|
|
17
|
-
})
|
|
18
|
-
const model = Session.create(
|
|
19
|
-
{
|
|
20
|
-
widget: {
|
|
21
|
-
// @ts-expect-error
|
|
22
|
-
type: 'VariantFeatureWidget',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{ pluginManager },
|
|
26
|
-
)
|
|
27
|
-
model.widget.setFeatureData({
|
|
28
|
-
refName: 'ctgA',
|
|
29
|
-
start: 176,
|
|
30
|
-
end: 177,
|
|
31
|
-
name: 'rs123',
|
|
32
|
-
REF: 'A',
|
|
33
|
-
ALT: ['<TRA>'],
|
|
34
|
-
QUAL: 10.4,
|
|
35
|
-
INFO: {
|
|
36
|
-
MQ: 5,
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const { container } = render(<VariantFeatureDetails model={model.widget} />)
|
|
41
|
-
expect(container.firstChild).toMatchSnapshot()
|
|
42
|
-
})
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { observer } from 'mobx-react'
|
|
3
|
-
import { Divider, Paper } from '@mui/material'
|
|
4
|
-
import { FeatureDetails } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
|
|
5
|
-
import { parseBreakend } from '@gmod/vcf'
|
|
6
|
-
|
|
7
|
-
// locals
|
|
8
|
-
import VariantSampleGrid from './VariantSampleGrid'
|
|
9
|
-
import BreakendPanel from './BreakendPanel'
|
|
10
|
-
import VariantAnnotationTable from './VariantAnnotationTable'
|
|
11
|
-
import { SimpleFeatureSerialized } from '@jbrowse/core/util'
|
|
12
|
-
|
|
13
|
-
const basicDescriptions = {
|
|
14
|
-
CHROM: 'chromosome: An identifier from the reference genome',
|
|
15
|
-
POS: 'position: The reference position, with the 1st base having position 1',
|
|
16
|
-
ID: 'identifier: Semi-colon separated list of unique identifiers where available',
|
|
17
|
-
REF: 'reference base(s): Each base must be one of A,C,G,T,N (case insensitive).',
|
|
18
|
-
ALT: 'alternate base(s): Comma-separated list of alternate non-reference alleles',
|
|
19
|
-
QUAL: 'quality: Phred-scaled quality score for the assertion made in ALT',
|
|
20
|
-
FILTER:
|
|
21
|
-
'filter status: PASS if this position has passed all filters, otherwise a semicolon-separated list of codes for filters that fail',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function VariantFeatureDetails(props: {
|
|
25
|
-
model: {
|
|
26
|
-
featureData: SimpleFeatureSerialized
|
|
27
|
-
descriptions: Record<string, string>
|
|
28
|
-
}
|
|
29
|
-
}) {
|
|
30
|
-
const { model } = props
|
|
31
|
-
const { featureData, descriptions } = model
|
|
32
|
-
const feat = JSON.parse(JSON.stringify(featureData))
|
|
33
|
-
const { samples, ...rest } = feat
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Paper data-testid="variant-side-drawer">
|
|
37
|
-
<FeatureDetails
|
|
38
|
-
feature={rest}
|
|
39
|
-
descriptions={{ ...basicDescriptions, ...descriptions }}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
<Divider />
|
|
43
|
-
<CsqPanel feature={rest} descriptions={descriptions} />
|
|
44
|
-
<Divider />
|
|
45
|
-
<AnnPanel feature={rest} descriptions={descriptions} />
|
|
46
|
-
<Divider />
|
|
47
|
-
{feat.type === 'breakend' ? (
|
|
48
|
-
<BreakendPanel
|
|
49
|
-
feature={feat}
|
|
50
|
-
locStrings={feat.ALT.map(
|
|
51
|
-
(alt: string) => parseBreakend(alt)?.MatePosition || '',
|
|
52
|
-
)}
|
|
53
|
-
model={model}
|
|
54
|
-
/>
|
|
55
|
-
) : null}
|
|
56
|
-
{feat.type === 'translocation' ? (
|
|
57
|
-
<BreakendPanel
|
|
58
|
-
feature={feat}
|
|
59
|
-
model={model}
|
|
60
|
-
locStrings={[`${feat.INFO.CHR2[0]}:${feat.INFO.END}`]}
|
|
61
|
-
/>
|
|
62
|
-
) : null}
|
|
63
|
-
<VariantSampleGrid
|
|
64
|
-
feature={feat}
|
|
65
|
-
{...props}
|
|
66
|
-
descriptions={descriptions}
|
|
67
|
-
/>
|
|
68
|
-
</Paper>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function AnnPanel({
|
|
73
|
-
descriptions,
|
|
74
|
-
feature,
|
|
75
|
-
}: {
|
|
76
|
-
descriptions: { INFO?: { ANN?: { Description?: string } } }
|
|
77
|
-
feature: { INFO?: { ANN?: string[] } }
|
|
78
|
-
}) {
|
|
79
|
-
const annDesc = descriptions?.INFO?.ANN?.Description
|
|
80
|
-
const annFields =
|
|
81
|
-
annDesc?.match(/.*Functional annotations:'(.*)'$/)?.[1].split('|') || []
|
|
82
|
-
const ann = feature.INFO?.ANN || []
|
|
83
|
-
return (
|
|
84
|
-
<VariantAnnotationTable
|
|
85
|
-
fields={annFields}
|
|
86
|
-
data={ann}
|
|
87
|
-
title="Variant ANN field"
|
|
88
|
-
/>
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function CsqPanel({
|
|
93
|
-
descriptions,
|
|
94
|
-
feature,
|
|
95
|
-
}: {
|
|
96
|
-
descriptions: { INFO?: { CSQ?: { Description?: string } } }
|
|
97
|
-
feature: { INFO?: { CSQ?: string[] } }
|
|
98
|
-
}) {
|
|
99
|
-
const csqDescription = descriptions?.INFO?.CSQ?.Description
|
|
100
|
-
const csqFields =
|
|
101
|
-
csqDescription?.match(/.*Format: (.*)/)?.[1].split('|') || []
|
|
102
|
-
const csq = feature.INFO?.CSQ || []
|
|
103
|
-
return (
|
|
104
|
-
<VariantAnnotationTable
|
|
105
|
-
fields={csqFields}
|
|
106
|
-
data={csq}
|
|
107
|
-
title="Variant CSQ field"
|
|
108
|
-
/>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export default observer(VariantFeatureDetails)
|