@jbrowse/plugin-linear-comparative-view 2.6.1 → 2.6.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/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
- package/dist/LGVSyntenyDisplay/configSchemaF.js +0 -1
- package/dist/LGVSyntenyDisplay/index.js +0 -1
- package/dist/LGVSyntenyDisplay/model.d.ts +17 -76
- package/dist/LGVSyntenyDisplay/model.js +22 -4
- package/dist/LaunchLinearSyntenyView.js +0 -1
- package/dist/LinearComparativeDisplay/configSchemaF.js +0 -1
- package/dist/LinearComparativeDisplay/index.js +0 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.js +0 -1
- package/dist/LinearComparativeView/components/Header.js +11 -2
- package/dist/LinearComparativeView/components/LinearComparativeView.js +0 -1
- package/dist/LinearComparativeView/components/Rubberband.js +11 -33
- package/dist/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
- package/dist/LinearComparativeView/components/VerticalGuide.js +33 -0
- package/dist/LinearComparativeView/index.js +0 -1
- package/dist/LinearComparativeView/model.d.ts +9 -15
- package/dist/LinearComparativeView/model.js +0 -1
- package/dist/LinearReadVsRef/LinearReadVsRef.js +0 -1
- package/dist/LinearReadVsRef/index.js +0 -1
- package/dist/LinearSyntenyDisplay/afterAttach.js +0 -1
- package/dist/LinearSyntenyDisplay/components/Component.js +0 -1
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
- package/dist/LinearSyntenyDisplay/components/util.js +0 -1
- package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js +0 -1
- package/dist/LinearSyntenyDisplay/index.js +0 -1
- package/dist/LinearSyntenyDisplay/model.js +0 -1
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
- package/dist/LinearSyntenyView/components/Icons.js +0 -1
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
- package/dist/LinearSyntenyView/components/ImportForm.js +0 -1
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/dist/LinearSyntenyView/index.js +0 -1
- package/dist/LinearSyntenyView/model.d.ts +9 -9
- package/dist/LinearSyntenyView/model.js +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +2 -2
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
- package/dist/SyntenyFeatureDetail/index.js +0 -1
- package/dist/SyntenyTrack/configSchema.js +0 -1
- package/dist/SyntenyTrack/index.js +0 -1
- package/dist/index.js +0 -1
- package/dist/util.js +0 -1
- package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
- package/esm/LGVSyntenyDisplay/configSchemaF.js +0 -1
- package/esm/LGVSyntenyDisplay/index.js +0 -1
- package/esm/LGVSyntenyDisplay/model.d.ts +17 -76
- package/esm/LGVSyntenyDisplay/model.js +23 -5
- package/esm/LaunchLinearSyntenyView.js +0 -1
- package/esm/LinearComparativeDisplay/configSchemaF.js +0 -1
- package/esm/LinearComparativeDisplay/index.js +0 -1
- package/esm/LinearComparativeDisplay/stateModelFactory.js +0 -1
- package/esm/LinearComparativeView/components/Header.js +11 -2
- package/esm/LinearComparativeView/components/LinearComparativeView.js +0 -1
- package/esm/LinearComparativeView/components/Rubberband.js +8 -33
- package/esm/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
- package/esm/LinearComparativeView/components/VerticalGuide.js +28 -0
- package/esm/LinearComparativeView/index.js +0 -1
- package/esm/LinearComparativeView/model.d.ts +9 -15
- package/esm/LinearComparativeView/model.js +0 -1
- package/esm/LinearReadVsRef/LinearReadVsRef.js +0 -1
- package/esm/LinearReadVsRef/index.js +0 -1
- package/esm/LinearSyntenyDisplay/afterAttach.js +0 -1
- package/esm/LinearSyntenyDisplay/components/Component.js +0 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
- package/esm/LinearSyntenyDisplay/components/util.js +0 -1
- package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js +0 -1
- package/esm/LinearSyntenyDisplay/index.js +0 -1
- package/esm/LinearSyntenyDisplay/model.js +0 -1
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
- package/esm/LinearSyntenyView/components/Icons.js +0 -1
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
- package/esm/LinearSyntenyView/components/ImportForm.js +0 -1
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
- package/esm/LinearSyntenyView/index.js +0 -1
- package/esm/LinearSyntenyView/model.d.ts +9 -9
- package/esm/LinearSyntenyView/model.js +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +2 -2
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
- package/esm/SyntenyFeatureDetail/index.js +0 -1
- package/esm/SyntenyTrack/configSchema.js +0 -1
- package/esm/SyntenyTrack/index.js +0 -1
- package/esm/index.js +0 -1
- package/esm/util.js +0 -1
- package/package.json +4 -4
- package/dist/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
- package/dist/LGVSyntenyDisplay/index.js.map +0 -1
- package/dist/LGVSyntenyDisplay/model.js.map +0 -1
- package/dist/LaunchLinearSyntenyView.js.map +0 -1
- package/dist/LinearComparativeDisplay/configSchemaF.js.map +0 -1
- package/dist/LinearComparativeDisplay/index.js.map +0 -1
- package/dist/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
- package/dist/LinearComparativeView/components/Header.js.map +0 -1
- package/dist/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
- package/dist/LinearComparativeView/components/Rubberband.js.map +0 -1
- package/dist/LinearComparativeView/index.js.map +0 -1
- package/dist/LinearComparativeView/model.js.map +0 -1
- package/dist/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
- package/dist/LinearReadVsRef/index.js.map +0 -1
- package/dist/LinearSyntenyDisplay/afterAttach.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/Component.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
- package/dist/LinearSyntenyDisplay/components/util.js.map +0 -1
- package/dist/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
- package/dist/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
- package/dist/LinearSyntenyDisplay/index.js.map +0 -1
- package/dist/LinearSyntenyDisplay/model.js.map +0 -1
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
- package/dist/LinearSyntenyView/components/Icons.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportForm.js.map +0 -1
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
- package/dist/LinearSyntenyView/index.js.map +0 -1
- package/dist/LinearSyntenyView/model.js.map +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
- package/dist/SyntenyFeatureDetail/index.js.map +0 -1
- package/dist/SyntenyTrack/configSchema.js.map +0 -1
- package/dist/SyntenyTrack/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util.js.map +0 -1
- package/esm/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
- package/esm/LGVSyntenyDisplay/index.js.map +0 -1
- package/esm/LGVSyntenyDisplay/model.js.map +0 -1
- package/esm/LaunchLinearSyntenyView.js.map +0 -1
- package/esm/LinearComparativeDisplay/configSchemaF.js.map +0 -1
- package/esm/LinearComparativeDisplay/index.js.map +0 -1
- package/esm/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
- package/esm/LinearComparativeView/components/Header.js.map +0 -1
- package/esm/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
- package/esm/LinearComparativeView/components/Rubberband.js.map +0 -1
- package/esm/LinearComparativeView/index.js.map +0 -1
- package/esm/LinearComparativeView/model.js.map +0 -1
- package/esm/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
- package/esm/LinearReadVsRef/index.js.map +0 -1
- package/esm/LinearSyntenyDisplay/afterAttach.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/Component.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
- package/esm/LinearSyntenyDisplay/components/util.js.map +0 -1
- package/esm/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
- package/esm/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
- package/esm/LinearSyntenyDisplay/index.js.map +0 -1
- package/esm/LinearSyntenyDisplay/model.js.map +0 -1
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
- package/esm/LinearSyntenyView/components/Icons.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportForm.js.map +0 -1
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
- package/esm/LinearSyntenyView/index.js.map +0 -1
- package/esm/LinearSyntenyView/model.js.map +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
- package/esm/SyntenyFeatureDetail/index.js.map +0 -1
- package/esm/SyntenyTrack/configSchema.js.map +0 -1
- package/esm/SyntenyTrack/index.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/util.js.map +0 -1
- package/src/LGVSyntenyDisplay/configSchemaF.ts +0 -22
- package/src/LGVSyntenyDisplay/index.ts +0 -20
- package/src/LGVSyntenyDisplay/model.ts +0 -177
- package/src/LaunchLinearSyntenyView.ts +0 -86
- package/src/LinearComparativeDisplay/configSchemaF.ts +0 -22
- package/src/LinearComparativeDisplay/index.ts +0 -21
- package/src/LinearComparativeDisplay/stateModelFactory.ts +0 -212
- package/src/LinearComparativeView/components/Header.tsx +0 -103
- package/src/LinearComparativeView/components/LinearComparativeView.tsx +0 -152
- package/src/LinearComparativeView/components/Rubberband.tsx +0 -329
- package/src/LinearComparativeView/index.ts +0 -15
- package/src/LinearComparativeView/model.ts +0 -395
- package/src/LinearReadVsRef/LinearReadVsRef.tsx +0 -360
- package/src/LinearReadVsRef/index.ts +0 -58
- package/src/LinearSyntenyDisplay/afterAttach.ts +0 -149
- package/src/LinearSyntenyDisplay/components/Component.tsx +0 -75
- package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +0 -200
- package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +0 -82
- package/src/LinearSyntenyDisplay/components/util.ts +0 -142
- package/src/LinearSyntenyDisplay/configSchemaF.ts +0 -38
- package/src/LinearSyntenyDisplay/drawSynteny.ts +0 -266
- package/src/LinearSyntenyDisplay/index.ts +0 -21
- package/src/LinearSyntenyDisplay/model.ts +0 -187
- package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +0 -148
- package/src/LinearSyntenyView/components/Icons.tsx +0 -24
- package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +0 -262
- package/src/LinearSyntenyView/components/ImportForm.tsx +0 -221
- package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +0 -82
- package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +0 -20
- package/src/LinearSyntenyView/index.ts +0 -15
- package/src/LinearSyntenyView/model.test.ts +0 -1605
- package/src/LinearSyntenyView/model.ts +0 -169
- package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +0 -21
- package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +0 -176
- package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +0 -64
- package/src/SyntenyFeatureDetail/index.ts +0 -36
- package/src/SyntenyTrack/configSchema.ts +0 -23
- package/src/SyntenyTrack/index.tsx +0 -15
- package/src/index.tsx +0 -42
- package/src/util.ts +0 -124
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigurationReference,
|
|
3
|
-
AnyConfigurationSchemaType,
|
|
4
|
-
} from '@jbrowse/core/configuration'
|
|
5
|
-
import {
|
|
6
|
-
getSession,
|
|
7
|
-
getContainingTrack,
|
|
8
|
-
getContainingView,
|
|
9
|
-
Feature,
|
|
10
|
-
} from '@jbrowse/core/util'
|
|
11
|
-
import {
|
|
12
|
-
MismatchParser,
|
|
13
|
-
linearPileupDisplayStateModelFactory,
|
|
14
|
-
} from '@jbrowse/plugin-alignments'
|
|
15
|
-
import { IAnyStateTreeNode, types } from 'mobx-state-tree'
|
|
16
|
-
import { when } from 'mobx'
|
|
17
|
-
|
|
18
|
-
// locals
|
|
19
|
-
import { LinearSyntenyViewModel } from '../LinearSyntenyView/model'
|
|
20
|
-
|
|
21
|
-
type LSV = LinearSyntenyViewModel
|
|
22
|
-
|
|
23
|
-
const { parseCigar } = MismatchParser
|
|
24
|
-
|
|
25
|
-
function findPosInCigar(cigar: string[], startX: number) {
|
|
26
|
-
let featX = 0
|
|
27
|
-
let mateX = 0
|
|
28
|
-
for (let i = 0; i < cigar.length; i++) {
|
|
29
|
-
const len = +cigar[i]
|
|
30
|
-
const op = cigar[i + 1]
|
|
31
|
-
const min = Math.min(len, startX - featX)
|
|
32
|
-
|
|
33
|
-
if (featX >= startX) {
|
|
34
|
-
break
|
|
35
|
-
} else if (op === 'I') {
|
|
36
|
-
mateX += len
|
|
37
|
-
} else if (op === 'D') {
|
|
38
|
-
featX += min
|
|
39
|
-
} else if (op === 'M') {
|
|
40
|
-
mateX += min
|
|
41
|
-
featX += min
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return [featX, mateX]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function navToSynteny(feature: Feature, self: IAnyStateTreeNode) {
|
|
48
|
-
const session = getSession(self)
|
|
49
|
-
const track = getContainingTrack(self)
|
|
50
|
-
const view = getContainingView(self)
|
|
51
|
-
const reg = view.dynamicBlocks.contentBlocks[0]
|
|
52
|
-
const cigar = feature.get('CIGAR')
|
|
53
|
-
const strand = feature.get('strand')
|
|
54
|
-
const regStart = reg.start
|
|
55
|
-
const regEnd = reg.end
|
|
56
|
-
const featStart = feature.get('start')
|
|
57
|
-
const featEnd = feature.get('end')
|
|
58
|
-
const mate = feature.get('mate')
|
|
59
|
-
const mateStart = mate.start
|
|
60
|
-
const mateEnd = mate.end
|
|
61
|
-
const mateAsm = mate.assemblyName
|
|
62
|
-
const mateRef = mate.refName
|
|
63
|
-
const featAsm = reg.assemblyName
|
|
64
|
-
const featRef = reg.refName
|
|
65
|
-
|
|
66
|
-
let rMateStart: number
|
|
67
|
-
let rMateEnd: number
|
|
68
|
-
let rFeatStart: number
|
|
69
|
-
let rFeatEnd: number
|
|
70
|
-
|
|
71
|
-
if (cigar) {
|
|
72
|
-
const p = parseCigar(cigar)
|
|
73
|
-
const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart)
|
|
74
|
-
const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart)
|
|
75
|
-
|
|
76
|
-
// avoid multiply by 0 with strand undefined
|
|
77
|
-
const flipper = strand === -1 ? -1 : 1
|
|
78
|
-
rFeatStart = featStart + fStartX
|
|
79
|
-
rFeatEnd = featStart + fEndX
|
|
80
|
-
rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper
|
|
81
|
-
rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper
|
|
82
|
-
} else {
|
|
83
|
-
rFeatStart = featStart
|
|
84
|
-
rFeatEnd = featEnd
|
|
85
|
-
rMateStart = mateStart
|
|
86
|
-
rMateEnd = mateEnd
|
|
87
|
-
}
|
|
88
|
-
const trackId = track.configuration.trackId
|
|
89
|
-
|
|
90
|
-
const view2 = session.addView('LinearSyntenyView', {
|
|
91
|
-
type: 'LinearSyntenyView',
|
|
92
|
-
views: [
|
|
93
|
-
{
|
|
94
|
-
id: `${Math.random()}`,
|
|
95
|
-
type: 'LinearGenomeView',
|
|
96
|
-
hideHeader: true,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
id: `${Math.random()}`,
|
|
100
|
-
type: 'LinearGenomeView',
|
|
101
|
-
hideHeader: true,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
tracks: [
|
|
105
|
-
{
|
|
106
|
-
configuration: trackId,
|
|
107
|
-
type: 'SyntenyTrack',
|
|
108
|
-
displays: [
|
|
109
|
-
{
|
|
110
|
-
type: 'LinearSyntenyDisplay',
|
|
111
|
-
configuration: `${trackId}-LinearSyntenyDisplay`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
}) as LSV
|
|
117
|
-
const f = (n: number) => Math.floor(n)
|
|
118
|
-
const l1 = `${featRef}:${f(rFeatStart)}-${f(rFeatEnd)}`
|
|
119
|
-
const m1 = Math.min(rMateStart, rMateEnd)
|
|
120
|
-
const m2 = Math.max(rMateStart, rMateEnd)
|
|
121
|
-
const l2 = `${mateRef}:${f(m1)}-${f(m2)}${strand === -1 ? '[rev]' : ''}`
|
|
122
|
-
await when(() => view2.width !== undefined)
|
|
123
|
-
await Promise.all([
|
|
124
|
-
view2.views[0].navToLocString(l1, featAsm),
|
|
125
|
-
view2.views[1].navToLocString(l2, mateAsm),
|
|
126
|
-
])
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* #stateModel LGVSyntenyDisplay
|
|
131
|
-
* extends `LinearPileupDisplay`, displays location of "synteny" feature in a
|
|
132
|
-
* plain LGV, allowing linking out to external synteny views
|
|
133
|
-
*/
|
|
134
|
-
function stateModelFactory(schema: AnyConfigurationSchemaType) {
|
|
135
|
-
return types
|
|
136
|
-
.compose(
|
|
137
|
-
'LGVSyntenyDisplay',
|
|
138
|
-
linearPileupDisplayStateModelFactory(schema),
|
|
139
|
-
types.model({
|
|
140
|
-
/**
|
|
141
|
-
* #property
|
|
142
|
-
*/
|
|
143
|
-
type: types.literal('LGVSyntenyDisplay'),
|
|
144
|
-
/**
|
|
145
|
-
* #property
|
|
146
|
-
*/
|
|
147
|
-
configuration: ConfigurationReference(schema),
|
|
148
|
-
}),
|
|
149
|
-
)
|
|
150
|
-
.views(self => {
|
|
151
|
-
const superContextMenuItems = self.contextMenuItems
|
|
152
|
-
return {
|
|
153
|
-
contextMenuItems() {
|
|
154
|
-
const feature = self.contextMenuFeature
|
|
155
|
-
return [
|
|
156
|
-
...superContextMenuItems(),
|
|
157
|
-
...(feature
|
|
158
|
-
? [
|
|
159
|
-
{
|
|
160
|
-
label: 'Open synteny view for this position',
|
|
161
|
-
onClick: () => navToSynteny(feature, self),
|
|
162
|
-
},
|
|
163
|
-
]
|
|
164
|
-
: []),
|
|
165
|
-
]
|
|
166
|
-
},
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
.actions(self => ({
|
|
170
|
-
afterCreate() {
|
|
171
|
-
// use color by strand to help indicate inversions better
|
|
172
|
-
self.setColorScheme({ type: 'strand' })
|
|
173
|
-
},
|
|
174
|
-
}))
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export default stateModelFactory
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
2
|
-
import { AbstractSessionModel } from '@jbrowse/core/util'
|
|
3
|
-
import { LinearSyntenyViewModel } from './LinearSyntenyView/model'
|
|
4
|
-
import { when } from 'mobx'
|
|
5
|
-
|
|
6
|
-
type LSV = LinearSyntenyViewModel
|
|
7
|
-
|
|
8
|
-
export default function LaunchLinearSyntenyView(pluginManager: PluginManager) {
|
|
9
|
-
pluginManager.addToExtensionPoint(
|
|
10
|
-
'LaunchView-LinearSyntenyView',
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
async ({
|
|
13
|
-
session,
|
|
14
|
-
views,
|
|
15
|
-
tracks = [],
|
|
16
|
-
}: {
|
|
17
|
-
session: AbstractSessionModel
|
|
18
|
-
views: { loc: string; assembly: string; tracks?: string[] }[]
|
|
19
|
-
tracks?: string[]
|
|
20
|
-
}) => {
|
|
21
|
-
try {
|
|
22
|
-
const { assemblyManager } = session
|
|
23
|
-
const model = session.addView('LinearSyntenyView', {}) as LSV
|
|
24
|
-
|
|
25
|
-
await when(() => !!model.width)
|
|
26
|
-
|
|
27
|
-
model.setViews(
|
|
28
|
-
await Promise.all(
|
|
29
|
-
views.map(async view => {
|
|
30
|
-
const asm = await assemblyManager.waitForAssembly(view.assembly)
|
|
31
|
-
if (!asm) {
|
|
32
|
-
throw new Error(`Assembly ${view.assembly} failed to load`)
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
type: 'LinearGenomeView' as const,
|
|
36
|
-
bpPerPx: 1,
|
|
37
|
-
offsetPx: 0,
|
|
38
|
-
hideHeader: true,
|
|
39
|
-
displayedRegions: asm.regions,
|
|
40
|
-
}
|
|
41
|
-
}),
|
|
42
|
-
),
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
await Promise.all(model.views.map(view => when(() => view.initialized)))
|
|
46
|
-
|
|
47
|
-
const idsNotFound = [] as string[]
|
|
48
|
-
await Promise.all(
|
|
49
|
-
views.map(async (data, idx) => {
|
|
50
|
-
const view = model.views[idx]
|
|
51
|
-
const { loc, tracks = [] } = data
|
|
52
|
-
await view.navToLocString(loc)
|
|
53
|
-
tracks.forEach(track => tryTrack(view, track, idsNotFound))
|
|
54
|
-
}),
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
tracks.forEach(track => tryTrack(model, track, idsNotFound))
|
|
58
|
-
|
|
59
|
-
if (idsNotFound.length) {
|
|
60
|
-
throw new Error(
|
|
61
|
-
`Could not resolve identifiers: ${idsNotFound.join(',')}`,
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
} catch (e) {
|
|
65
|
-
session.notify(`${e}`, 'error')
|
|
66
|
-
throw e
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function tryTrack(
|
|
73
|
-
model: { showTrack: (arg: string) => void },
|
|
74
|
-
trackId: string,
|
|
75
|
-
idsNotFound: string[],
|
|
76
|
-
) {
|
|
77
|
-
try {
|
|
78
|
-
model.showTrack(trackId)
|
|
79
|
-
} catch (e) {
|
|
80
|
-
if (`${e}`.match('Could not resolve identifier')) {
|
|
81
|
-
idsNotFound.push(trackId)
|
|
82
|
-
} else {
|
|
83
|
-
throw e
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* #config LinearComparativeDisplay
|
|
6
|
-
*/
|
|
7
|
-
function configSchemaFactory(pluginManager: any) {
|
|
8
|
-
return ConfigurationSchema(
|
|
9
|
-
'LinearComparativeDisplay',
|
|
10
|
-
{},
|
|
11
|
-
{
|
|
12
|
-
explicitlyTyped: true,
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* #identifier
|
|
16
|
-
*/
|
|
17
|
-
explicitIdentifier: 'displayId',
|
|
18
|
-
},
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default configSchemaFactory
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
-
|
|
4
|
-
import configSchemaFactory from './configSchemaF'
|
|
5
|
-
import stateModelFactory from './stateModelFactory'
|
|
6
|
-
|
|
7
|
-
export default (pluginManager: PluginManager) => {
|
|
8
|
-
pluginManager.addDisplayType(() => {
|
|
9
|
-
const configSchema = configSchemaFactory(pluginManager)
|
|
10
|
-
return new DisplayType({
|
|
11
|
-
name: 'LinearComparativeDisplay',
|
|
12
|
-
configSchema,
|
|
13
|
-
stateModel: stateModelFactory(configSchema),
|
|
14
|
-
trackType: 'SyntenyTrack',
|
|
15
|
-
viewType: 'LinearComparativeView',
|
|
16
|
-
ReactComponent: () => {
|
|
17
|
-
return null
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
}
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readConfObject,
|
|
3
|
-
ConfigurationReference,
|
|
4
|
-
AnyConfigurationSchemaType,
|
|
5
|
-
} from '@jbrowse/core/configuration'
|
|
6
|
-
import { types, getSnapshot, Instance } from 'mobx-state-tree'
|
|
7
|
-
import {
|
|
8
|
-
dedupe,
|
|
9
|
-
Feature,
|
|
10
|
-
getContainingView,
|
|
11
|
-
getSession,
|
|
12
|
-
makeAbortableReaction,
|
|
13
|
-
} from '@jbrowse/core/util'
|
|
14
|
-
import { getRpcSessionId } from '@jbrowse/core/util/tracks'
|
|
15
|
-
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'
|
|
16
|
-
import { LinearComparativeViewModel } from '../LinearComparativeView/model'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* #stateModel LinearComparativeDisplay
|
|
20
|
-
*/
|
|
21
|
-
function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
|
|
22
|
-
return types
|
|
23
|
-
.compose(
|
|
24
|
-
'LinearComparativeDisplay',
|
|
25
|
-
BaseDisplay,
|
|
26
|
-
types.model({
|
|
27
|
-
/**
|
|
28
|
-
* #property
|
|
29
|
-
*/
|
|
30
|
-
type: types.literal('LinearComparativeDisplay'),
|
|
31
|
-
/**
|
|
32
|
-
* #property
|
|
33
|
-
*/
|
|
34
|
-
configuration: ConfigurationReference(configSchema),
|
|
35
|
-
/**
|
|
36
|
-
* #property
|
|
37
|
-
*/
|
|
38
|
-
height: 100,
|
|
39
|
-
}),
|
|
40
|
-
)
|
|
41
|
-
.volatile((/* self */) => ({
|
|
42
|
-
renderInProgress: undefined as AbortController | undefined,
|
|
43
|
-
features: undefined as Feature[] | undefined,
|
|
44
|
-
message: undefined as string | undefined,
|
|
45
|
-
}))
|
|
46
|
-
.views(self => ({
|
|
47
|
-
/**
|
|
48
|
-
* #getter
|
|
49
|
-
*/
|
|
50
|
-
renderProps() {
|
|
51
|
-
return {
|
|
52
|
-
rpcDriverName: self.rpcDriverName,
|
|
53
|
-
displayModel: self,
|
|
54
|
-
highResolutionScaling: 2,
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
}))
|
|
58
|
-
.actions(self => {
|
|
59
|
-
let renderInProgress: undefined | AbortController
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
/**
|
|
63
|
-
* #action
|
|
64
|
-
* controlled by a reaction
|
|
65
|
-
*/
|
|
66
|
-
setLoading(abortController: AbortController) {
|
|
67
|
-
self.message = undefined
|
|
68
|
-
self.error = undefined
|
|
69
|
-
renderInProgress = abortController
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* #action
|
|
74
|
-
* controlled by a reaction
|
|
75
|
-
*/
|
|
76
|
-
setMessage(messageText: string) {
|
|
77
|
-
if (renderInProgress && !renderInProgress.signal.aborted) {
|
|
78
|
-
renderInProgress.abort()
|
|
79
|
-
}
|
|
80
|
-
self.message = messageText
|
|
81
|
-
self.error = undefined
|
|
82
|
-
renderInProgress = undefined
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* #action
|
|
87
|
-
* controlled by a reaction
|
|
88
|
-
*/
|
|
89
|
-
setRendered(args?: { features: Feature[] }) {
|
|
90
|
-
if (!args) {
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
const { features } = args
|
|
94
|
-
const existingFeatures = self.features || []
|
|
95
|
-
|
|
96
|
-
const featIds = new Set(existingFeatures.map(f => f.id()) || [])
|
|
97
|
-
const newFeatIds = new Set(features?.map(f => f.id()) || [])
|
|
98
|
-
|
|
99
|
-
let foundNewFeatureNotInExistingMap = false
|
|
100
|
-
let foundExistingFeatureNotInNewMap = false
|
|
101
|
-
for (let i = 0; i < features.length; i++) {
|
|
102
|
-
if (!featIds.has(features[i].id())) {
|
|
103
|
-
foundNewFeatureNotInExistingMap = true
|
|
104
|
-
break
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
for (let i = 0; i < existingFeatures.length; i++) {
|
|
108
|
-
if (!newFeatIds.has(existingFeatures[i].id())) {
|
|
109
|
-
foundExistingFeatureNotInNewMap = true
|
|
110
|
-
break
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
self.message = undefined
|
|
115
|
-
self.error = undefined
|
|
116
|
-
renderInProgress = undefined
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
foundNewFeatureNotInExistingMap ||
|
|
120
|
-
foundExistingFeatureNotInNewMap ||
|
|
121
|
-
!self.features
|
|
122
|
-
) {
|
|
123
|
-
self.features = features
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* #action
|
|
129
|
-
* controlled by a reaction
|
|
130
|
-
*/
|
|
131
|
-
setError(error: unknown) {
|
|
132
|
-
console.error(error)
|
|
133
|
-
if (renderInProgress && !renderInProgress.signal.aborted) {
|
|
134
|
-
renderInProgress.abort()
|
|
135
|
-
}
|
|
136
|
-
// the rendering failed for some reason
|
|
137
|
-
self.message = undefined
|
|
138
|
-
self.error = error
|
|
139
|
-
renderInProgress = undefined
|
|
140
|
-
},
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
.actions(self => ({
|
|
144
|
-
afterAttach() {
|
|
145
|
-
makeAbortableReaction(
|
|
146
|
-
// @ts-expect-error
|
|
147
|
-
self,
|
|
148
|
-
renderBlockData,
|
|
149
|
-
renderBlockEffect,
|
|
150
|
-
{
|
|
151
|
-
name: `${self.type} ${self.id} rendering`,
|
|
152
|
-
delay: 1000,
|
|
153
|
-
fireImmediately: true,
|
|
154
|
-
},
|
|
155
|
-
self.setLoading,
|
|
156
|
-
self.setRendered,
|
|
157
|
-
self.setError,
|
|
158
|
-
)
|
|
159
|
-
},
|
|
160
|
-
}))
|
|
161
|
-
}
|
|
162
|
-
function renderBlockData(self: LinearComparativeDisplay) {
|
|
163
|
-
const { rpcManager } = getSession(self)
|
|
164
|
-
const display = self
|
|
165
|
-
|
|
166
|
-
// Alternative to readConfObject(config) is below used because renderProps is
|
|
167
|
-
// something under our control. Compare to serverSideRenderedBlock
|
|
168
|
-
readConfObject(self.configuration)
|
|
169
|
-
|
|
170
|
-
const { adapterConfig } = self
|
|
171
|
-
const parent = getContainingView(self) as LinearComparativeViewModel
|
|
172
|
-
const sessionId = getRpcSessionId(self)
|
|
173
|
-
getSnapshot(parent)
|
|
174
|
-
|
|
175
|
-
return parent.initialized
|
|
176
|
-
? {
|
|
177
|
-
rpcManager,
|
|
178
|
-
renderProps: {
|
|
179
|
-
...display.renderProps(),
|
|
180
|
-
view: parent,
|
|
181
|
-
adapterConfig,
|
|
182
|
-
sessionId,
|
|
183
|
-
timeout: 1000000,
|
|
184
|
-
self,
|
|
185
|
-
},
|
|
186
|
-
}
|
|
187
|
-
: undefined
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
async function renderBlockEffect(props: ReturnType<typeof renderBlockData>) {
|
|
191
|
-
if (!props) {
|
|
192
|
-
return
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const { rpcManager, renderProps } = props
|
|
196
|
-
const { adapterConfig } = renderProps
|
|
197
|
-
const view0 = renderProps.view.views[0]
|
|
198
|
-
|
|
199
|
-
const features = (await rpcManager.call('getFeats', 'CoreGetFeatures', {
|
|
200
|
-
regions: view0.staticBlocks.contentBlocks,
|
|
201
|
-
sessionId: 'getFeats',
|
|
202
|
-
adapterConfig,
|
|
203
|
-
})) as Feature[]
|
|
204
|
-
|
|
205
|
-
return {
|
|
206
|
-
features: dedupe(features, f => f.id()),
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export default stateModelFactory
|
|
211
|
-
export type LinearComparativeDisplayModel = ReturnType<typeof stateModelFactory>
|
|
212
|
-
export type LinearComparativeDisplay = Instance<LinearComparativeDisplayModel>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { IconButton, Typography } from '@mui/material'
|
|
3
|
-
import { makeStyles } from 'tss-react/mui'
|
|
4
|
-
import { SearchBox } from '@jbrowse/plugin-linear-genome-view'
|
|
5
|
-
import { observer } from 'mobx-react'
|
|
6
|
-
import { Menu } from '@jbrowse/core/ui'
|
|
7
|
-
|
|
8
|
-
// icons
|
|
9
|
-
import MoreVertIcon from '@mui/icons-material/MoreVert'
|
|
10
|
-
|
|
11
|
-
// locals
|
|
12
|
-
import { LinearComparativeViewModel } from '../model'
|
|
13
|
-
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
|
|
14
|
-
|
|
15
|
-
type LCV = LinearComparativeViewModel
|
|
16
|
-
|
|
17
|
-
const useStyles = makeStyles()(() => ({
|
|
18
|
-
headerBar: {
|
|
19
|
-
gridArea: '1/1/auto/span 2',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
},
|
|
22
|
-
spacer: {
|
|
23
|
-
flexGrow: 1,
|
|
24
|
-
},
|
|
25
|
-
iconButton: {
|
|
26
|
-
margin: 5,
|
|
27
|
-
},
|
|
28
|
-
bp: {
|
|
29
|
-
display: 'flex',
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
marginLeft: 10,
|
|
32
|
-
},
|
|
33
|
-
searchContainer: {
|
|
34
|
-
marginLeft: 5,
|
|
35
|
-
},
|
|
36
|
-
searchBox: {
|
|
37
|
-
display: 'flex',
|
|
38
|
-
},
|
|
39
|
-
}))
|
|
40
|
-
|
|
41
|
-
const TrackSelector = observer(({ model }: { model: LCV }) => {
|
|
42
|
-
return (
|
|
43
|
-
<IconButton
|
|
44
|
-
onClick={model.activateTrackSelector}
|
|
45
|
-
title="Open track selector"
|
|
46
|
-
>
|
|
47
|
-
<TrackSelectorIcon />
|
|
48
|
-
</IconButton>
|
|
49
|
-
)
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const Header = observer(function ({ model }: { model: LCV }) {
|
|
53
|
-
const { classes } = useStyles()
|
|
54
|
-
const [menuAnchorEl, setMenuAnchorEl] = useState<HTMLElement>()
|
|
55
|
-
const anyShowHeaders = model.views.some(view => !view.hideHeader)
|
|
56
|
-
return (
|
|
57
|
-
<div className={classes.headerBar}>
|
|
58
|
-
<TrackSelector model={model} />
|
|
59
|
-
|
|
60
|
-
<IconButton
|
|
61
|
-
onClick={event => setMenuAnchorEl(event.currentTarget)}
|
|
62
|
-
className={classes.iconButton}
|
|
63
|
-
>
|
|
64
|
-
<MoreVertIcon />
|
|
65
|
-
</IconButton>
|
|
66
|
-
{!anyShowHeaders
|
|
67
|
-
? model.views.map(view => (
|
|
68
|
-
<div key={view.id} className={classes.searchBox}>
|
|
69
|
-
<div className={classes.searchContainer}>
|
|
70
|
-
<SearchBox model={view} showHelp={false} />
|
|
71
|
-
</div>
|
|
72
|
-
<div className={classes.bp}>
|
|
73
|
-
<Typography
|
|
74
|
-
variant="body2"
|
|
75
|
-
color="textSecondary"
|
|
76
|
-
className={classes.bp}
|
|
77
|
-
>
|
|
78
|
-
{Math.round(view.coarseTotalBp).toLocaleString('en-US')} bp
|
|
79
|
-
</Typography>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
))
|
|
83
|
-
: null}
|
|
84
|
-
|
|
85
|
-
<div className={classes.spacer} />
|
|
86
|
-
|
|
87
|
-
{menuAnchorEl ? (
|
|
88
|
-
<Menu
|
|
89
|
-
anchorEl={menuAnchorEl}
|
|
90
|
-
open
|
|
91
|
-
onMenuItemClick={(_event, callback) => {
|
|
92
|
-
callback()
|
|
93
|
-
setMenuAnchorEl(undefined)
|
|
94
|
-
}}
|
|
95
|
-
menuItems={model.headerMenuItems()}
|
|
96
|
-
onClose={() => setMenuAnchorEl(undefined)}
|
|
97
|
-
/>
|
|
98
|
-
) : null}
|
|
99
|
-
</div>
|
|
100
|
-
)
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
export default Header
|