@jbrowse/plugin-linear-comparative-view 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +52 -0
- package/dist/LGVSyntenyDisplay/configSchemaF.js +18 -0
- package/dist/LGVSyntenyDisplay/configSchemaF.js.map +1 -0
- package/dist/LGVSyntenyDisplay/index.d.ts +3 -0
- package/dist/LGVSyntenyDisplay/index.js +24 -0
- package/dist/LGVSyntenyDisplay/index.js.map +1 -0
- package/dist/LGVSyntenyDisplay/model.d.ts +380 -0
- package/dist/LGVSyntenyDisplay/model.js +154 -0
- package/dist/LGVSyntenyDisplay/model.js.map +1 -0
- package/dist/LaunchLinearSyntenyView.d.ts +2 -0
- package/dist/LaunchLinearSyntenyView.js +58 -0
- package/dist/LaunchLinearSyntenyView.js.map +1 -0
- package/dist/LinearComparativeDisplay/configSchemaF.d.ts +5 -0
- package/dist/LinearComparativeDisplay/configSchemaF.js +18 -0
- package/dist/LinearComparativeDisplay/configSchemaF.js.map +1 -0
- package/dist/LinearComparativeDisplay/index.d.ts +3 -0
- package/dist/LinearComparativeDisplay/index.js +24 -0
- package/dist/LinearComparativeDisplay/index.js.map +1 -0
- package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +275 -0
- package/dist/LinearComparativeDisplay/stateModelFactory.js +172 -0
- package/dist/LinearComparativeDisplay/stateModelFactory.js.map +1 -0
- package/dist/LinearComparativeView/components/Header.d.ts +7 -0
- package/dist/LinearComparativeView/components/Header.js +89 -0
- package/dist/LinearComparativeView/components/Header.js.map +1 -0
- package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +8 -0
- package/dist/LinearComparativeView/components/LinearComparativeView.js +99 -0
- package/dist/LinearComparativeView/components/LinearComparativeView.js.map +1 -0
- package/dist/LinearComparativeView/components/Rubberband.d.ts +9 -0
- package/dist/LinearComparativeView/components/Rubberband.js +225 -0
- package/dist/LinearComparativeView/components/Rubberband.js.map +1 -0
- package/dist/LinearComparativeView/index.d.ts +3 -0
- package/dist/LinearComparativeView/index.js +42 -0
- package/dist/LinearComparativeView/index.js.map +1 -0
- package/dist/LinearComparativeView/model.d.ts +326 -0
- package/dist/LinearComparativeView/model.js +346 -0
- package/dist/LinearComparativeView/model.js.map +1 -0
- package/dist/LinearReadVsRef/LinearReadVsRef.d.ts +7 -0
- package/dist/LinearReadVsRef/LinearReadVsRef.js +284 -0
- package/dist/LinearReadVsRef/LinearReadVsRef.js.map +1 -0
- package/dist/LinearReadVsRef/index.d.ts +2 -0
- package/dist/LinearReadVsRef/index.js +55 -0
- package/dist/LinearReadVsRef/index.js.map +1 -0
- package/dist/LinearSyntenyDisplay/afterAttach.d.ts +2 -0
- package/dist/LinearSyntenyDisplay/afterAttach.js +108 -0
- package/dist/LinearSyntenyDisplay/afterAttach.js.map +1 -0
- package/dist/LinearSyntenyDisplay/components/Component.d.ts +6 -0
- package/dist/LinearSyntenyDisplay/components/Component.js +87 -0
- package/dist/LinearSyntenyDisplay/components/Component.js.map +1 -0
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +6 -0
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +160 -0
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +1 -0
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +7 -0
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +83 -0
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +1 -0
- package/dist/LinearSyntenyDisplay/components/util.d.ts +27 -0
- package/dist/LinearSyntenyDisplay/components/util.js +84 -0
- package/dist/LinearSyntenyDisplay/components/util.js.map +1 -0
- package/dist/LinearSyntenyDisplay/configSchemaF.d.ts +23 -0
- package/dist/LinearSyntenyDisplay/configSchemaF.js +36 -0
- package/dist/LinearSyntenyDisplay/configSchemaF.js.map +1 -0
- package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +5 -0
- package/dist/LinearSyntenyDisplay/drawSynteny.js +235 -0
- package/dist/LinearSyntenyDisplay/drawSynteny.js.map +1 -0
- package/dist/LinearSyntenyDisplay/index.d.ts +3 -0
- package/dist/LinearSyntenyDisplay/index.js +47 -0
- package/dist/LinearSyntenyDisplay/index.js.map +1 -0
- package/dist/LinearSyntenyDisplay/model.d.ts +333 -0
- package/dist/LinearSyntenyDisplay/model.js +179 -0
- package/dist/LinearSyntenyDisplay/model.js.map +1 -0
- package/dist/LinearSyntenyView/components/ExportSvgDialog.d.ts +8 -0
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js +86 -0
- package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +1 -0
- package/dist/LinearSyntenyView/components/Icons.d.ts +4 -0
- package/dist/LinearSyntenyView/components/Icons.js +19 -0
- package/dist/LinearSyntenyView/components/Icons.js.map +1 -0
- package/dist/LinearSyntenyView/components/ImportCustomTrack.d.ts +11 -0
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js +180 -0
- package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +1 -0
- package/dist/LinearSyntenyView/components/ImportForm.d.ts +6 -0
- package/dist/LinearSyntenyView/components/ImportForm.js +127 -0
- package/dist/LinearSyntenyView/components/ImportForm.js.map +1 -0
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +63 -0
- package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/dist/LinearSyntenyView/components/LinearSyntenyView.d.ts +7 -0
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js +38 -0
- package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +1 -0
- package/dist/LinearSyntenyView/index.d.ts +3 -0
- package/dist/LinearSyntenyView/index.js +42 -0
- package/dist/LinearSyntenyView/index.js.map +1 -0
- package/dist/LinearSyntenyView/model.d.ts +754 -0
- package/dist/LinearSyntenyView/model.js +170 -0
- package/dist/LinearSyntenyView/model.js.map +1 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +6 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +13 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +1 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +4 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +85 -0
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +1 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +66 -0
- package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +1 -0
- package/dist/SyntenyFeatureDetail/index.d.ts +3 -0
- package/dist/SyntenyFeatureDetail/index.js +58 -0
- package/dist/SyntenyFeatureDetail/index.js.map +1 -0
- package/dist/SyntenyTrack/configSchema.d.ts +75 -0
- package/dist/SyntenyTrack/configSchema.js +16 -0
- package/dist/SyntenyTrack/configSchema.js.map +1 -0
- package/dist/SyntenyTrack/index.d.ts +3 -0
- package/dist/SyntenyTrack/index.js +19 -0
- package/dist/SyntenyTrack/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +25 -0
- package/dist/util.js +77 -0
- package/dist/util.js.map +1 -0
- package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +52 -0
- package/esm/LGVSyntenyDisplay/configSchemaF.js +16 -0
- package/esm/LGVSyntenyDisplay/configSchemaF.js.map +1 -0
- package/esm/LGVSyntenyDisplay/index.d.ts +3 -0
- package/esm/LGVSyntenyDisplay/index.js +19 -0
- package/esm/LGVSyntenyDisplay/index.js.map +1 -0
- package/esm/LGVSyntenyDisplay/model.d.ts +380 -0
- package/esm/LGVSyntenyDisplay/model.js +152 -0
- package/esm/LGVSyntenyDisplay/model.js.map +1 -0
- package/esm/LaunchLinearSyntenyView.d.ts +2 -0
- package/esm/LaunchLinearSyntenyView.js +55 -0
- package/esm/LaunchLinearSyntenyView.js.map +1 -0
- package/esm/LinearComparativeDisplay/configSchemaF.d.ts +5 -0
- package/esm/LinearComparativeDisplay/configSchemaF.js +16 -0
- package/esm/LinearComparativeDisplay/configSchemaF.js.map +1 -0
- package/esm/LinearComparativeDisplay/index.d.ts +3 -0
- package/esm/LinearComparativeDisplay/index.js +19 -0
- package/esm/LinearComparativeDisplay/index.js.map +1 -0
- package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +275 -0
- package/esm/LinearComparativeDisplay/stateModelFactory.js +170 -0
- package/esm/LinearComparativeDisplay/stateModelFactory.js.map +1 -0
- package/esm/LinearComparativeView/components/Header.d.ts +7 -0
- package/esm/LinearComparativeView/components/Header.js +61 -0
- package/esm/LinearComparativeView/components/Header.js.map +1 -0
- package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +8 -0
- package/esm/LinearComparativeView/components/LinearComparativeView.js +94 -0
- package/esm/LinearComparativeView/components/LinearComparativeView.js.map +1 -0
- package/esm/LinearComparativeView/components/Rubberband.d.ts +9 -0
- package/esm/LinearComparativeView/components/Rubberband.js +200 -0
- package/esm/LinearComparativeView/components/Rubberband.js.map +1 -0
- package/esm/LinearComparativeView/index.d.ts +3 -0
- package/esm/LinearComparativeView/index.js +14 -0
- package/esm/LinearComparativeView/index.js.map +1 -0
- package/esm/LinearComparativeView/model.d.ts +326 -0
- package/esm/LinearComparativeView/model.js +318 -0
- package/esm/LinearComparativeView/model.js.map +1 -0
- package/esm/LinearReadVsRef/LinearReadVsRef.d.ts +7 -0
- package/esm/LinearReadVsRef/LinearReadVsRef.js +258 -0
- package/esm/LinearReadVsRef/LinearReadVsRef.js.map +1 -0
- package/esm/LinearReadVsRef/index.d.ts +2 -0
- package/esm/LinearReadVsRef/index.js +49 -0
- package/esm/LinearReadVsRef/index.js.map +1 -0
- package/esm/LinearSyntenyDisplay/afterAttach.d.ts +2 -0
- package/esm/LinearSyntenyDisplay/afterAttach.js +104 -0
- package/esm/LinearSyntenyDisplay/afterAttach.js.map +1 -0
- package/esm/LinearSyntenyDisplay/components/Component.d.ts +6 -0
- package/esm/LinearSyntenyDisplay/components/Component.js +59 -0
- package/esm/LinearSyntenyDisplay/components/Component.js.map +1 -0
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +6 -0
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +132 -0
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +1 -0
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +7 -0
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +58 -0
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +1 -0
- package/esm/LinearSyntenyDisplay/components/util.d.ts +27 -0
- package/esm/LinearSyntenyDisplay/components/util.js +77 -0
- package/esm/LinearSyntenyDisplay/components/util.js.map +1 -0
- package/esm/LinearSyntenyDisplay/configSchemaF.d.ts +23 -0
- package/esm/LinearSyntenyDisplay/configSchemaF.js +31 -0
- package/esm/LinearSyntenyDisplay/configSchemaF.js.map +1 -0
- package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +5 -0
- package/esm/LinearSyntenyDisplay/drawSynteny.js +229 -0
- package/esm/LinearSyntenyDisplay/drawSynteny.js.map +1 -0
- package/esm/LinearSyntenyDisplay/index.d.ts +3 -0
- package/esm/LinearSyntenyDisplay/index.js +19 -0
- package/esm/LinearSyntenyDisplay/index.js.map +1 -0
- package/esm/LinearSyntenyDisplay/model.d.ts +333 -0
- package/esm/LinearSyntenyDisplay/model.js +151 -0
- package/esm/LinearSyntenyDisplay/model.js.map +1 -0
- package/esm/LinearSyntenyView/components/ExportSvgDialog.d.ts +8 -0
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js +60 -0
- package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +1 -0
- package/esm/LinearSyntenyView/components/Icons.d.ts +4 -0
- package/esm/LinearSyntenyView/components/Icons.js +11 -0
- package/esm/LinearSyntenyView/components/Icons.js.map +1 -0
- package/esm/LinearSyntenyView/components/ImportCustomTrack.d.ts +11 -0
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js +152 -0
- package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +1 -0
- package/esm/LinearSyntenyView/components/ImportForm.d.ts +6 -0
- package/esm/LinearSyntenyView/components/ImportForm.js +99 -0
- package/esm/LinearSyntenyView/components/ImportForm.js.map +1 -0
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +38 -0
- package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/esm/LinearSyntenyView/components/LinearSyntenyView.d.ts +7 -0
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js +10 -0
- package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +1 -0
- package/esm/LinearSyntenyView/index.d.ts +3 -0
- package/esm/LinearSyntenyView/index.js +14 -0
- package/esm/LinearSyntenyView/index.js.map +1 -0
- package/esm/LinearSyntenyView/model.d.ts +754 -0
- package/esm/LinearSyntenyView/model.js +141 -0
- package/esm/LinearSyntenyView/model.js.map +1 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +6 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +7 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +1 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +4 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +78 -0
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +1 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +38 -0
- package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +1 -0
- package/esm/SyntenyFeatureDetail/index.d.ts +3 -0
- package/esm/SyntenyFeatureDetail/index.js +30 -0
- package/esm/SyntenyFeatureDetail/index.js.map +1 -0
- package/esm/SyntenyTrack/configSchema.d.ts +75 -0
- package/esm/SyntenyTrack/configSchema.js +14 -0
- package/esm/SyntenyTrack/configSchema.js.map +1 -0
- package/esm/SyntenyTrack/index.d.ts +3 -0
- package/esm/SyntenyTrack/index.js +14 -0
- package/esm/SyntenyTrack/index.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +41 -0
- package/esm/index.js.map +1 -0
- package/esm/util.d.ts +25 -0
- package/esm/util.js +69 -0
- package/esm/util.js.map +1 -0
- package/package.json +67 -0
- package/src/LGVSyntenyDisplay/configSchemaF.ts +22 -0
- package/src/LGVSyntenyDisplay/index.ts +20 -0
- package/src/LGVSyntenyDisplay/model.ts +177 -0
- package/src/LaunchLinearSyntenyView.ts +86 -0
- package/src/LinearComparativeDisplay/configSchemaF.ts +22 -0
- package/src/LinearComparativeDisplay/index.ts +21 -0
- package/src/LinearComparativeDisplay/stateModelFactory.ts +212 -0
- package/src/LinearComparativeView/components/Header.tsx +103 -0
- package/src/LinearComparativeView/components/LinearComparativeView.tsx +152 -0
- package/src/LinearComparativeView/components/Rubberband.tsx +329 -0
- package/src/LinearComparativeView/index.ts +15 -0
- package/src/LinearComparativeView/model.ts +395 -0
- package/src/LinearReadVsRef/LinearReadVsRef.tsx +360 -0
- package/src/LinearReadVsRef/index.ts +58 -0
- package/src/LinearSyntenyDisplay/afterAttach.ts +149 -0
- package/src/LinearSyntenyDisplay/components/Component.tsx +75 -0
- package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +200 -0
- package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +82 -0
- package/src/LinearSyntenyDisplay/components/util.ts +142 -0
- package/src/LinearSyntenyDisplay/configSchemaF.ts +38 -0
- package/src/LinearSyntenyDisplay/drawSynteny.ts +266 -0
- package/src/LinearSyntenyDisplay/index.ts +21 -0
- package/src/LinearSyntenyDisplay/model.ts +187 -0
- package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +148 -0
- package/src/LinearSyntenyView/components/Icons.tsx +24 -0
- package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +262 -0
- package/src/LinearSyntenyView/components/ImportForm.tsx +221 -0
- package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +82 -0
- package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +20 -0
- package/src/LinearSyntenyView/index.ts +15 -0
- package/src/LinearSyntenyView/model.test.ts +1605 -0
- package/src/LinearSyntenyView/model.ts +169 -0
- package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +21 -0
- package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +176 -0
- package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +64 -0
- package/src/SyntenyFeatureDetail/index.ts +36 -0
- package/src/SyntenyTrack/configSchema.ts +23 -0
- package/src/SyntenyTrack/index.tsx +15 -0
- package/src/index.tsx +42 -0
- package/src/util.ts +124 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { lazy } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
addDisposer,
|
|
4
|
+
cast,
|
|
5
|
+
getParent,
|
|
6
|
+
getPath,
|
|
7
|
+
getRoot,
|
|
8
|
+
onAction,
|
|
9
|
+
resolveIdentifier,
|
|
10
|
+
types,
|
|
11
|
+
Instance,
|
|
12
|
+
SnapshotIn,
|
|
13
|
+
} from 'mobx-state-tree'
|
|
14
|
+
import { autorun, transaction } from 'mobx'
|
|
15
|
+
|
|
16
|
+
// jbrowse
|
|
17
|
+
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel'
|
|
18
|
+
import { MenuItem } from '@jbrowse/core/ui'
|
|
19
|
+
import { getSession, isSessionModelWithWidgets, avg } from '@jbrowse/core/util'
|
|
20
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
21
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
22
|
+
import { ElementId } from '@jbrowse/core/util/types/mst'
|
|
23
|
+
import {
|
|
24
|
+
LinearGenomeViewModel,
|
|
25
|
+
LinearGenomeViewStateModel,
|
|
26
|
+
} from '@jbrowse/plugin-linear-genome-view'
|
|
27
|
+
|
|
28
|
+
// icons
|
|
29
|
+
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
|
|
30
|
+
import FolderOpenIcon from '@mui/icons-material/FolderOpen'
|
|
31
|
+
|
|
32
|
+
// lazies
|
|
33
|
+
const ReturnToImportFormDialog = lazy(
|
|
34
|
+
() => import('@jbrowse/core/ui/ReturnToImportFormDialog'),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* #stateModel LinearComparativeView
|
|
39
|
+
*/
|
|
40
|
+
function stateModelFactory(pluginManager: PluginManager) {
|
|
41
|
+
return types
|
|
42
|
+
.compose(
|
|
43
|
+
'LinearComparativeView',
|
|
44
|
+
BaseViewModel,
|
|
45
|
+
types.model({
|
|
46
|
+
/**
|
|
47
|
+
* #property
|
|
48
|
+
*/
|
|
49
|
+
id: ElementId,
|
|
50
|
+
/**
|
|
51
|
+
* #property
|
|
52
|
+
*/
|
|
53
|
+
type: types.literal('LinearComparativeView'),
|
|
54
|
+
/**
|
|
55
|
+
* #property
|
|
56
|
+
*/
|
|
57
|
+
trackSelectorType: 'hierarchical',
|
|
58
|
+
/**
|
|
59
|
+
* #property
|
|
60
|
+
*/
|
|
61
|
+
showIntraviewLinks: true,
|
|
62
|
+
/**
|
|
63
|
+
* #property
|
|
64
|
+
*/
|
|
65
|
+
linkViews: false,
|
|
66
|
+
/**
|
|
67
|
+
* #property
|
|
68
|
+
*/
|
|
69
|
+
interactToggled: false,
|
|
70
|
+
/**
|
|
71
|
+
* #property
|
|
72
|
+
*/
|
|
73
|
+
middleComparativeHeight: 100,
|
|
74
|
+
/**
|
|
75
|
+
* #property
|
|
76
|
+
*/
|
|
77
|
+
tracks: types.array(
|
|
78
|
+
pluginManager.pluggableMstType('track', 'stateModel'),
|
|
79
|
+
),
|
|
80
|
+
/**
|
|
81
|
+
* #property
|
|
82
|
+
* currently this is limited to an array of two
|
|
83
|
+
*/
|
|
84
|
+
views: types.array(
|
|
85
|
+
pluginManager.getViewType('LinearGenomeView')
|
|
86
|
+
.stateModel as LinearGenomeViewStateModel,
|
|
87
|
+
),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* #property
|
|
91
|
+
* this represents tracks specific to this view specifically used
|
|
92
|
+
* for read vs ref dotplots where this track would not really apply
|
|
93
|
+
* elsewhere
|
|
94
|
+
*/
|
|
95
|
+
viewTrackConfigs: types.array(
|
|
96
|
+
pluginManager.pluggableConfigSchemaType('track'),
|
|
97
|
+
),
|
|
98
|
+
}),
|
|
99
|
+
)
|
|
100
|
+
.volatile(() => ({
|
|
101
|
+
width: undefined as number | undefined,
|
|
102
|
+
}))
|
|
103
|
+
.views(self => ({
|
|
104
|
+
/**
|
|
105
|
+
* #getter
|
|
106
|
+
*/
|
|
107
|
+
get highResolutionScaling() {
|
|
108
|
+
return 2
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* #getter
|
|
112
|
+
*/
|
|
113
|
+
get initialized() {
|
|
114
|
+
return (
|
|
115
|
+
self.width !== undefined &&
|
|
116
|
+
self.views.length > 0 &&
|
|
117
|
+
self.views.every(view => view.initialized)
|
|
118
|
+
)
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* #getter
|
|
123
|
+
*/
|
|
124
|
+
get refNames() {
|
|
125
|
+
return self.views.map(v => [
|
|
126
|
+
...new Set(v.staticBlocks.map(m => m.refName)),
|
|
127
|
+
])
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* #getter
|
|
132
|
+
*/
|
|
133
|
+
get assemblyNames() {
|
|
134
|
+
return [...new Set(self.views.flatMap(v => v.assemblyNames))]
|
|
135
|
+
},
|
|
136
|
+
}))
|
|
137
|
+
.actions(self => ({
|
|
138
|
+
afterAttach() {
|
|
139
|
+
addDisposer(
|
|
140
|
+
self,
|
|
141
|
+
onAction(self, param => {
|
|
142
|
+
if (self.linkViews) {
|
|
143
|
+
const { name, path, args } = param
|
|
144
|
+
|
|
145
|
+
// doesn't link showTrack/hideTrack, doesn't make sense in
|
|
146
|
+
// synteny views most time
|
|
147
|
+
const actions = ['horizontalScroll', 'zoomTo', 'setScaleFactor']
|
|
148
|
+
if (actions.includes(name) && path) {
|
|
149
|
+
this.onSubviewAction(name, path, args)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
)
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
// automatically removes session assemblies associated with this view
|
|
157
|
+
// e.g. read vs ref
|
|
158
|
+
beforeDestroy() {
|
|
159
|
+
const session = getSession(self)
|
|
160
|
+
self.assemblyNames.forEach(asm => session.removeTemporaryAssembly(asm))
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
onSubviewAction(actionName: string, path: string, args?: unknown[]) {
|
|
164
|
+
self.views.forEach(view => {
|
|
165
|
+
const ret = getPath(view)
|
|
166
|
+
if (ret.lastIndexOf(path) !== ret.length - path.length) {
|
|
167
|
+
// @ts-expect-error
|
|
168
|
+
view[actionName](args?.[0])
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* #action
|
|
175
|
+
*/
|
|
176
|
+
setWidth(newWidth: number) {
|
|
177
|
+
self.width = newWidth
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* #action
|
|
182
|
+
*/
|
|
183
|
+
setViews(views: SnapshotIn<LinearGenomeViewModel>[]) {
|
|
184
|
+
self.views = cast(views)
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* #action
|
|
189
|
+
*/
|
|
190
|
+
removeView(view: LinearGenomeViewModel) {
|
|
191
|
+
self.views.remove(view)
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* #action
|
|
196
|
+
* removes the view itself from the state tree entirely by calling the
|
|
197
|
+
* parent removeView
|
|
198
|
+
*/
|
|
199
|
+
closeView() {
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
|
+
getParent<any>(self, 2).removeView(self)
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* #action
|
|
206
|
+
*/
|
|
207
|
+
setMiddleComparativeHeight(n: number) {
|
|
208
|
+
self.middleComparativeHeight = n
|
|
209
|
+
return self.middleComparativeHeight
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* #action
|
|
214
|
+
*/
|
|
215
|
+
toggleLinkViews() {
|
|
216
|
+
self.linkViews = !self.linkViews
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* #action
|
|
221
|
+
*/
|
|
222
|
+
activateTrackSelector() {
|
|
223
|
+
if (self.trackSelectorType === 'hierarchical') {
|
|
224
|
+
const session = getSession(self)
|
|
225
|
+
if (isSessionModelWithWidgets(session)) {
|
|
226
|
+
const selector = session.addWidget(
|
|
227
|
+
'HierarchicalTrackSelectorWidget',
|
|
228
|
+
'hierarchicalTrackSelector',
|
|
229
|
+
{ view: self },
|
|
230
|
+
)
|
|
231
|
+
session.showWidget(selector)
|
|
232
|
+
return selector
|
|
233
|
+
}
|
|
234
|
+
return undefined
|
|
235
|
+
}
|
|
236
|
+
throw new Error(`invalid track selector type ${self.trackSelectorType}`)
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* #action
|
|
241
|
+
*/
|
|
242
|
+
toggleTrack(trackId: string) {
|
|
243
|
+
// if we have any tracks with that configuration, turn them off
|
|
244
|
+
const hiddenCount = this.hideTrack(trackId)
|
|
245
|
+
|
|
246
|
+
// if none had that configuration, turn one on
|
|
247
|
+
if (!hiddenCount) {
|
|
248
|
+
this.showTrack(trackId)
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* #action
|
|
254
|
+
*/
|
|
255
|
+
showTrack(trackId: string, initialSnapshot = {}) {
|
|
256
|
+
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
257
|
+
const configuration = resolveIdentifier(schema, getRoot(self), trackId)
|
|
258
|
+
if (!configuration) {
|
|
259
|
+
throw new Error(`track not found ${trackId}`)
|
|
260
|
+
}
|
|
261
|
+
const trackType = pluginManager.getTrackType(configuration.type)
|
|
262
|
+
if (!trackType) {
|
|
263
|
+
throw new Error(`unknown track type ${configuration.type}`)
|
|
264
|
+
}
|
|
265
|
+
const viewType = pluginManager.getViewType(self.type)
|
|
266
|
+
const supportedDisplays = new Set(
|
|
267
|
+
viewType.displayTypes.map(d => d.name),
|
|
268
|
+
)
|
|
269
|
+
const displayConf = configuration.displays.find(
|
|
270
|
+
(d: AnyConfigurationModel) => supportedDisplays.has(d.type),
|
|
271
|
+
)
|
|
272
|
+
if (!displayConf) {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`could not find a compatible display for view type ${self.type}`,
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
self.tracks.push(
|
|
278
|
+
trackType.stateModel.create({
|
|
279
|
+
...initialSnapshot,
|
|
280
|
+
type: configuration.type,
|
|
281
|
+
configuration,
|
|
282
|
+
displays: [{ type: displayConf.type, configuration: displayConf }],
|
|
283
|
+
}),
|
|
284
|
+
)
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* #action
|
|
289
|
+
*/
|
|
290
|
+
hideTrack(trackId: string) {
|
|
291
|
+
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
292
|
+
const config = resolveIdentifier(schema, getRoot(self), trackId)
|
|
293
|
+
const shownTracks = self.tracks.filter(t => t.configuration === config)
|
|
294
|
+
transaction(() => shownTracks.forEach(t => self.tracks.remove(t)))
|
|
295
|
+
return shownTracks.length
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* #action
|
|
299
|
+
*/
|
|
300
|
+
squareView() {
|
|
301
|
+
const average = avg(self.views.map(v => v.bpPerPx))
|
|
302
|
+
self.views.forEach(view => {
|
|
303
|
+
const center = view.pxToBp(view.width / 2)
|
|
304
|
+
view.setNewView(average, view.offsetPx)
|
|
305
|
+
if (!center.refName) {
|
|
306
|
+
return
|
|
307
|
+
}
|
|
308
|
+
view.centerAt(center.coord, center.refName, center.index)
|
|
309
|
+
})
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* #action
|
|
313
|
+
*/
|
|
314
|
+
clearView() {
|
|
315
|
+
self.views = cast([])
|
|
316
|
+
self.tracks = cast([])
|
|
317
|
+
},
|
|
318
|
+
}))
|
|
319
|
+
.views(() => ({
|
|
320
|
+
/**
|
|
321
|
+
* #method
|
|
322
|
+
* includes a subset of view menu options because the full list is a
|
|
323
|
+
* little overwhelming. overridden by subclasses
|
|
324
|
+
*/
|
|
325
|
+
headerMenuItems(): MenuItem[] {
|
|
326
|
+
return []
|
|
327
|
+
},
|
|
328
|
+
}))
|
|
329
|
+
.views(self => ({
|
|
330
|
+
/**
|
|
331
|
+
* #method
|
|
332
|
+
*/
|
|
333
|
+
menuItems(): MenuItem[] {
|
|
334
|
+
return [
|
|
335
|
+
...self.views
|
|
336
|
+
.map((view, idx) => [idx, view.menuItems?.()] as const)
|
|
337
|
+
.filter(f => !!f[1])
|
|
338
|
+
.map(f => ({ label: `View ${f[0] + 1} Menu`, subMenu: f[1] })),
|
|
339
|
+
{
|
|
340
|
+
label: 'Return to import form',
|
|
341
|
+
onClick: () => {
|
|
342
|
+
getSession(self).queueDialog(handleClose => [
|
|
343
|
+
ReturnToImportFormDialog,
|
|
344
|
+
{ model: self, handleClose },
|
|
345
|
+
])
|
|
346
|
+
},
|
|
347
|
+
icon: FolderOpenIcon,
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
label: 'Open track selector',
|
|
351
|
+
onClick: self.activateTrackSelector,
|
|
352
|
+
icon: TrackSelectorIcon,
|
|
353
|
+
},
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
/**
|
|
357
|
+
* #method
|
|
358
|
+
*/
|
|
359
|
+
rubberBandMenuItems() {
|
|
360
|
+
return [
|
|
361
|
+
{
|
|
362
|
+
label: 'Zoom to region(s)',
|
|
363
|
+
onClick: () => {
|
|
364
|
+
self.views.forEach(view => {
|
|
365
|
+
const { leftOffset, rightOffset } = view
|
|
366
|
+
if (leftOffset && rightOffset) {
|
|
367
|
+
view.moveTo(leftOffset, rightOffset)
|
|
368
|
+
}
|
|
369
|
+
})
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
}))
|
|
375
|
+
.actions(self => ({
|
|
376
|
+
afterAttach() {
|
|
377
|
+
addDisposer(
|
|
378
|
+
self,
|
|
379
|
+
autorun(() => {
|
|
380
|
+
if (self.width) {
|
|
381
|
+
self.views.forEach(v => v.setWidth(self.width))
|
|
382
|
+
}
|
|
383
|
+
}),
|
|
384
|
+
)
|
|
385
|
+
},
|
|
386
|
+
}))
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export type LinearComparativeViewStateModel = ReturnType<
|
|
390
|
+
typeof stateModelFactory
|
|
391
|
+
>
|
|
392
|
+
export type LinearComparativeViewModel =
|
|
393
|
+
Instance<LinearComparativeViewStateModel>
|
|
394
|
+
|
|
395
|
+
export default stateModelFactory
|