@jbrowse/plugin-linear-comparative-view 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/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 +4 -2
- package/dist/LGVSyntenyDisplay/model.js +0 -1
- 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 +0 -1
- 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 +4 -2
- package/esm/LGVSyntenyDisplay/model.js +0 -1
- 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 +0 -1
- 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 +3 -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,169 +0,0 @@
|
|
|
1
|
-
import React, { lazy } from 'react'
|
|
2
|
-
import { types, Instance } from 'mobx-state-tree'
|
|
3
|
-
import { transaction } from 'mobx'
|
|
4
|
-
import { getSession } from '@jbrowse/core/util'
|
|
5
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
6
|
-
import { saveAs } from 'file-saver'
|
|
7
|
-
|
|
8
|
-
// icons
|
|
9
|
-
import CropFreeIcon from '@mui/icons-material/CropFree'
|
|
10
|
-
import LinkIcon from '@mui/icons-material/Link'
|
|
11
|
-
import VisibilityIcon from '@mui/icons-material/Visibility'
|
|
12
|
-
import PhotoCameraIcon from '@mui/icons-material/PhotoCamera'
|
|
13
|
-
import { Curves } from './components/Icons'
|
|
14
|
-
|
|
15
|
-
// locals
|
|
16
|
-
import baseModel from '../LinearComparativeView/model'
|
|
17
|
-
|
|
18
|
-
// lazies
|
|
19
|
-
const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'))
|
|
20
|
-
|
|
21
|
-
export interface ExportSvgOptions {
|
|
22
|
-
rasterizeLayers?: boolean
|
|
23
|
-
scale?: number
|
|
24
|
-
filename?: string
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
Wrapper?: React.FC<any>
|
|
27
|
-
fontSize?: number
|
|
28
|
-
rulerHeight?: number
|
|
29
|
-
textHeight?: number
|
|
30
|
-
paddingHeight?: number
|
|
31
|
-
headerHeight?: number
|
|
32
|
-
cytobandHeight?: number
|
|
33
|
-
themeName?: string
|
|
34
|
-
trackLabels?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* #stateModel LinearSyntenyView
|
|
39
|
-
* extends the `LinearComparativeView` base model
|
|
40
|
-
*/
|
|
41
|
-
export default function stateModelFactory(pluginManager: PluginManager) {
|
|
42
|
-
return types
|
|
43
|
-
.compose(
|
|
44
|
-
baseModel(pluginManager),
|
|
45
|
-
types.model('LinearSyntenyView', {
|
|
46
|
-
/**
|
|
47
|
-
* #property
|
|
48
|
-
*/
|
|
49
|
-
type: types.literal('LinearSyntenyView'),
|
|
50
|
-
/**
|
|
51
|
-
* #property/
|
|
52
|
-
*/
|
|
53
|
-
drawCIGAR: true,
|
|
54
|
-
/**
|
|
55
|
-
* #property
|
|
56
|
-
*/
|
|
57
|
-
drawCurves: false,
|
|
58
|
-
}),
|
|
59
|
-
)
|
|
60
|
-
.actions(self => ({
|
|
61
|
-
/**
|
|
62
|
-
* #action
|
|
63
|
-
*/
|
|
64
|
-
toggleCurves() {
|
|
65
|
-
self.drawCurves = !self.drawCurves
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* #action
|
|
69
|
-
*/
|
|
70
|
-
toggleCIGAR() {
|
|
71
|
-
self.drawCIGAR = !self.drawCIGAR
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* #action
|
|
75
|
-
*/
|
|
76
|
-
showAllRegions() {
|
|
77
|
-
transaction(() => {
|
|
78
|
-
self.views.forEach(view => view.showAllRegionsInAssembly())
|
|
79
|
-
})
|
|
80
|
-
},
|
|
81
|
-
}))
|
|
82
|
-
.actions(self => ({
|
|
83
|
-
async exportSvg(opts: ExportSvgOptions) {
|
|
84
|
-
const { renderToSvg } = await import(
|
|
85
|
-
'./svgcomponents/SVGLinearSyntenyView'
|
|
86
|
-
)
|
|
87
|
-
const html = await renderToSvg(self as LinearSyntenyViewModel, opts)
|
|
88
|
-
const blob = new Blob([html], { type: 'image/svg+xml' })
|
|
89
|
-
saveAs(blob, opts.filename || 'image.svg')
|
|
90
|
-
},
|
|
91
|
-
}))
|
|
92
|
-
.views(self => {
|
|
93
|
-
const superHeaderMenuItems = self.headerMenuItems
|
|
94
|
-
const superMenuItems = self.menuItems
|
|
95
|
-
return {
|
|
96
|
-
/**
|
|
97
|
-
* #method
|
|
98
|
-
* includes a subset of view menu options because the full list is a
|
|
99
|
-
* little overwhelming
|
|
100
|
-
*/
|
|
101
|
-
headerMenuItems() {
|
|
102
|
-
return [
|
|
103
|
-
...superHeaderMenuItems(),
|
|
104
|
-
{
|
|
105
|
-
label: 'Square view',
|
|
106
|
-
onClick: self.squareView,
|
|
107
|
-
description:
|
|
108
|
-
'Makes both views use the same zoom level, adjusting to the average of each',
|
|
109
|
-
icon: CropFreeIcon,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
label: 'Show all regions',
|
|
113
|
-
onClick: self.showAllRegions,
|
|
114
|
-
description: 'Show entire genome assemblies',
|
|
115
|
-
icon: VisibilityIcon,
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
label: 'Draw CIGAR',
|
|
119
|
-
onClick: self.toggleCIGAR,
|
|
120
|
-
checked: self.drawCIGAR,
|
|
121
|
-
type: 'checkbox',
|
|
122
|
-
description: 'Draws per-base CIGAR level alignments',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
label: 'Link views',
|
|
126
|
-
type: 'checkbox',
|
|
127
|
-
checked: self.linkViews,
|
|
128
|
-
onClick: self.toggleLinkViews,
|
|
129
|
-
icon: LinkIcon,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
label: 'Use curved lines',
|
|
133
|
-
type: 'checkbox',
|
|
134
|
-
checked: self.drawCurves,
|
|
135
|
-
onClick: self.toggleCurves,
|
|
136
|
-
icon: Curves,
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
label: 'Export SVG',
|
|
140
|
-
icon: PhotoCameraIcon,
|
|
141
|
-
onClick: (): void => {
|
|
142
|
-
getSession(self).queueDialog(handleClose => [
|
|
143
|
-
ExportSvgDialog,
|
|
144
|
-
{ model: self, handleClose },
|
|
145
|
-
])
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
menuItems() {
|
|
151
|
-
return [
|
|
152
|
-
...superMenuItems(),
|
|
153
|
-
{
|
|
154
|
-
label: 'Export SVG',
|
|
155
|
-
icon: PhotoCameraIcon,
|
|
156
|
-
onClick: () => {
|
|
157
|
-
getSession(self).queueDialog(handleClose => [
|
|
158
|
-
ExportSvgDialog,
|
|
159
|
-
{ model: self, handleClose },
|
|
160
|
-
])
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
]
|
|
164
|
-
},
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
export type LinearSyntenyViewStateModel = ReturnType<typeof stateModelFactory>
|
|
169
|
-
export type LinearSyntenyViewModel = Instance<LinearSyntenyViewStateModel>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useTheme } from '@mui/material'
|
|
3
|
-
|
|
4
|
-
export default function SVGBackground({
|
|
5
|
-
width,
|
|
6
|
-
height,
|
|
7
|
-
shift,
|
|
8
|
-
}: {
|
|
9
|
-
width: number
|
|
10
|
-
height: number
|
|
11
|
-
shift: number
|
|
12
|
-
}) {
|
|
13
|
-
const theme = useTheme()
|
|
14
|
-
return (
|
|
15
|
-
<rect
|
|
16
|
-
width={width + shift * 2}
|
|
17
|
-
height={height}
|
|
18
|
-
fill={theme.palette.background.default}
|
|
19
|
-
/>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ThemeProvider } from '@mui/material'
|
|
3
|
-
import { renderToStaticMarkup } from 'react-dom/server'
|
|
4
|
-
import { when } from 'mobx'
|
|
5
|
-
import {
|
|
6
|
-
getSession,
|
|
7
|
-
getSerializedSvg,
|
|
8
|
-
max,
|
|
9
|
-
measureText,
|
|
10
|
-
ReactRendering,
|
|
11
|
-
renderToAbstractCanvas,
|
|
12
|
-
sum,
|
|
13
|
-
} from '@jbrowse/core/util'
|
|
14
|
-
import { getTrackName } from '@jbrowse/core/util/tracks'
|
|
15
|
-
import { createJBrowseTheme } from '@jbrowse/core/ui'
|
|
16
|
-
import {
|
|
17
|
-
SVGTracks,
|
|
18
|
-
SVGRuler,
|
|
19
|
-
totalHeight,
|
|
20
|
-
} from '@jbrowse/plugin-linear-genome-view'
|
|
21
|
-
|
|
22
|
-
// locals
|
|
23
|
-
import SVGBackground from './SVGBackground'
|
|
24
|
-
import { ExportSvgOptions, LinearSyntenyViewModel } from '../model'
|
|
25
|
-
import { drawRef } from '../../LinearSyntenyDisplay/drawSynteny'
|
|
26
|
-
|
|
27
|
-
type LSV = LinearSyntenyViewModel
|
|
28
|
-
|
|
29
|
-
// render LGV to SVG
|
|
30
|
-
export async function renderToSvg(model: LSV, opts: ExportSvgOptions) {
|
|
31
|
-
await when(() => model.initialized)
|
|
32
|
-
const {
|
|
33
|
-
textHeight = 18,
|
|
34
|
-
headerHeight = 30,
|
|
35
|
-
rulerHeight = 30,
|
|
36
|
-
fontSize = 13,
|
|
37
|
-
trackLabels = 'offset',
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
Wrapper = ({ children }: any) => <>{children}</>,
|
|
40
|
-
themeName = 'default',
|
|
41
|
-
} = opts
|
|
42
|
-
const session = getSession(model)
|
|
43
|
-
const theme = session.allThemes?.()[themeName]
|
|
44
|
-
const { width, views, middleComparativeHeight: synH, tracks } = model
|
|
45
|
-
const shift = 50
|
|
46
|
-
const offset = headerHeight + rulerHeight
|
|
47
|
-
|
|
48
|
-
const heights = views.map(
|
|
49
|
-
v => totalHeight(v.tracks, textHeight, trackLabels) + offset,
|
|
50
|
-
)
|
|
51
|
-
const totalHeightSvg = sum(heights) + synH + 100
|
|
52
|
-
const displayResults = await Promise.all(
|
|
53
|
-
views.map(
|
|
54
|
-
async view =>
|
|
55
|
-
({
|
|
56
|
-
view,
|
|
57
|
-
data: await Promise.all(
|
|
58
|
-
view.tracks.map(async track => {
|
|
59
|
-
const d = track.displays[0]
|
|
60
|
-
await when(() => (d.ready !== undefined ? d.ready : true))
|
|
61
|
-
return { track, result: await d.renderSvg({ ...opts, theme }) }
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
} as const),
|
|
65
|
-
),
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
const renderings = await Promise.all(
|
|
69
|
-
tracks.map(async track => {
|
|
70
|
-
const d = track.displays[0]
|
|
71
|
-
await when(() => (d.ready !== undefined ? d.ready : true))
|
|
72
|
-
const r = await renderToAbstractCanvas(
|
|
73
|
-
width,
|
|
74
|
-
synH,
|
|
75
|
-
{ exportSVG: opts },
|
|
76
|
-
ctx => drawRef(d, ctx),
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
if ('imageData' in r) {
|
|
80
|
-
throw new Error('found a canvas in svg export, probably a bug')
|
|
81
|
-
} else if ('canvasRecordedData' in r) {
|
|
82
|
-
return {
|
|
83
|
-
html: await getSerializedSvg({
|
|
84
|
-
...r,
|
|
85
|
-
width,
|
|
86
|
-
height: synH,
|
|
87
|
-
}),
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
return r
|
|
91
|
-
}
|
|
92
|
-
}),
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
const trackLabelMaxLen =
|
|
96
|
-
max(
|
|
97
|
-
views.flatMap(view =>
|
|
98
|
-
view.tracks.map(t =>
|
|
99
|
-
measureText(getTrackName(t.configuration, session), fontSize),
|
|
100
|
-
),
|
|
101
|
-
),
|
|
102
|
-
0,
|
|
103
|
-
) + 40
|
|
104
|
-
const trackLabelOffset = trackLabels === 'left' ? trackLabelMaxLen : 0
|
|
105
|
-
const w = width + trackLabelOffset
|
|
106
|
-
|
|
107
|
-
const t = createJBrowseTheme(theme)
|
|
108
|
-
|
|
109
|
-
// the xlink namespace is used for rendering <image> tag
|
|
110
|
-
return renderToStaticMarkup(
|
|
111
|
-
<ThemeProvider theme={createJBrowseTheme(theme)}>
|
|
112
|
-
<Wrapper>
|
|
113
|
-
<svg
|
|
114
|
-
width={width}
|
|
115
|
-
height={totalHeightSvg}
|
|
116
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
117
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
118
|
-
viewBox={[0, 0, w + shift * 2, totalHeightSvg].toString()}
|
|
119
|
-
>
|
|
120
|
-
<SVGBackground width={w} height={totalHeightSvg} shift={shift} />
|
|
121
|
-
<g transform={`translate(${shift} ${fontSize})`}>
|
|
122
|
-
<g transform={`translate(${trackLabelOffset})`}>
|
|
123
|
-
<text x={0} fontSize={fontSize} fill={t.palette.text.primary}>
|
|
124
|
-
{views[0].assemblyNames.join(', ')}
|
|
125
|
-
</text>
|
|
126
|
-
|
|
127
|
-
<SVGRuler model={displayResults[0].view} fontSize={fontSize} />
|
|
128
|
-
</g>
|
|
129
|
-
<SVGTracks
|
|
130
|
-
textHeight={textHeight}
|
|
131
|
-
trackLabels={trackLabels}
|
|
132
|
-
fontSize={fontSize}
|
|
133
|
-
model={displayResults[0].view}
|
|
134
|
-
displayResults={displayResults[0].data}
|
|
135
|
-
offset={offset}
|
|
136
|
-
trackLabelOffset={trackLabelOffset}
|
|
137
|
-
/>
|
|
138
|
-
</g>
|
|
139
|
-
|
|
140
|
-
<defs>
|
|
141
|
-
<clipPath id={'synclip'}>
|
|
142
|
-
<rect x={0} y={0} width={width} height={synH} />
|
|
143
|
-
</clipPath>
|
|
144
|
-
</defs>
|
|
145
|
-
<g
|
|
146
|
-
transform={`translate(${shift + trackLabelOffset} ${
|
|
147
|
-
fontSize + heights[0]
|
|
148
|
-
})`}
|
|
149
|
-
clipPath={`url(#synclip)`}
|
|
150
|
-
>
|
|
151
|
-
{renderings.map((r, i) => (
|
|
152
|
-
<ReactRendering key={i} rendering={r} />
|
|
153
|
-
))}
|
|
154
|
-
</g>
|
|
155
|
-
<g transform={`translate(${shift} ${fontSize + heights[0] + synH})`}>
|
|
156
|
-
<g transform={`translate(${trackLabelOffset})`}>
|
|
157
|
-
<text x={0} fontSize={fontSize} fill={t.palette.text.primary}>
|
|
158
|
-
{views[1].assemblyNames.join(', ')}
|
|
159
|
-
</text>
|
|
160
|
-
<SVGRuler model={displayResults[1].view} fontSize={fontSize} />
|
|
161
|
-
</g>
|
|
162
|
-
<SVGTracks
|
|
163
|
-
textHeight={textHeight}
|
|
164
|
-
trackLabels={trackLabels}
|
|
165
|
-
fontSize={fontSize}
|
|
166
|
-
model={displayResults[1].view}
|
|
167
|
-
displayResults={displayResults[1].data}
|
|
168
|
-
offset={offset}
|
|
169
|
-
trackLabelOffset={trackLabelOffset}
|
|
170
|
-
/>
|
|
171
|
-
</g>
|
|
172
|
-
</svg>
|
|
173
|
-
</Wrapper>
|
|
174
|
-
</ThemeProvider>,
|
|
175
|
-
)
|
|
176
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import copy from 'copy-to-clipboard'
|
|
3
|
-
import { Paper } from '@mui/material'
|
|
4
|
-
import { observer } from 'mobx-react'
|
|
5
|
-
import {
|
|
6
|
-
BaseCoreDetails,
|
|
7
|
-
BaseAttributes,
|
|
8
|
-
} from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
|
|
9
|
-
import { SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature'
|
|
10
|
-
|
|
11
|
-
function Formatter({ value }: { value: unknown }) {
|
|
12
|
-
const [show, setShow] = useState(false)
|
|
13
|
-
const [copied, setCopied] = useState(false)
|
|
14
|
-
const display = String(value)
|
|
15
|
-
if (display.length > 100) {
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<button
|
|
19
|
-
type="button"
|
|
20
|
-
onClick={() => {
|
|
21
|
-
copy(display)
|
|
22
|
-
setCopied(true)
|
|
23
|
-
setTimeout(() => {
|
|
24
|
-
setCopied(false)
|
|
25
|
-
}, 700)
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
{copied ? 'Copied to clipboard' : 'Copy'}
|
|
29
|
-
</button>
|
|
30
|
-
<button type="button" onClick={() => setShow(val => !val)}>
|
|
31
|
-
{show ? 'Show less' : 'Show more'}
|
|
32
|
-
</button>
|
|
33
|
-
<div>{show ? display : `${display.slice(0, 100)}...`}</div>
|
|
34
|
-
</>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
return <div>{display}</div>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function CustomFeatureDetails(props: { feature: SimpleFeatureSerialized }) {
|
|
41
|
-
return (
|
|
42
|
-
<BaseAttributes
|
|
43
|
-
{...props}
|
|
44
|
-
formatter={(value: unknown) => <Formatter value={value} />}
|
|
45
|
-
/>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const BreakpointAlignmentsFeatureDetail = observer(
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
({ model }: { model: any }) => {
|
|
52
|
-
const { feature1, feature2 } = JSON.parse(JSON.stringify(model.featureData))
|
|
53
|
-
return (
|
|
54
|
-
<Paper data-testid="alignment-side-drawer">
|
|
55
|
-
<BaseCoreDetails title="Feature 1" feature={feature1} />
|
|
56
|
-
<BaseCoreDetails title="Feature 2" feature={feature2} />
|
|
57
|
-
<CustomFeatureDetails feature={feature1} />
|
|
58
|
-
<CustomFeatureDetails feature={feature2} />
|
|
59
|
-
</Paper>
|
|
60
|
-
)
|
|
61
|
-
},
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
export default BreakpointAlignmentsFeatureDetail
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { lazy } from 'react'
|
|
2
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
3
|
-
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType'
|
|
4
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
5
|
-
import { ElementId } from '@jbrowse/core/util/types/mst'
|
|
6
|
-
import { types } from 'mobx-state-tree'
|
|
7
|
-
|
|
8
|
-
const configSchema = ConfigurationSchema('SyntenyFeatureWidget', {})
|
|
9
|
-
|
|
10
|
-
const stateModel = types
|
|
11
|
-
.model('SyntenyFeatureWidget', {
|
|
12
|
-
id: ElementId,
|
|
13
|
-
type: types.literal('SyntenyFeatureWidget'),
|
|
14
|
-
featureData: types.frozen(),
|
|
15
|
-
})
|
|
16
|
-
.actions(self => ({
|
|
17
|
-
setFeatureData(data: unknown) {
|
|
18
|
-
self.featureData = data
|
|
19
|
-
},
|
|
20
|
-
clearFeatureData() {
|
|
21
|
-
self.featureData = undefined
|
|
22
|
-
},
|
|
23
|
-
}))
|
|
24
|
-
|
|
25
|
-
export default (pluginManager: PluginManager) => {
|
|
26
|
-
pluginManager.addWidgetType(
|
|
27
|
-
() =>
|
|
28
|
-
new WidgetType({
|
|
29
|
-
name: 'SyntenyFeatureWidget',
|
|
30
|
-
heading: 'Synteny feature details',
|
|
31
|
-
configSchema,
|
|
32
|
-
stateModel,
|
|
33
|
-
ReactComponent: lazy(() => import('./SyntenyFeatureDetail')),
|
|
34
|
-
}),
|
|
35
|
-
)
|
|
36
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
-
|
|
3
|
-
import { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes/models'
|
|
4
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* #config SyntenyTrack
|
|
8
|
-
*/
|
|
9
|
-
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
|
-
|
|
11
|
-
const configSchema = (pluginManager: PluginManager) =>
|
|
12
|
-
ConfigurationSchema(
|
|
13
|
-
'SyntenyTrack',
|
|
14
|
-
{},
|
|
15
|
-
{
|
|
16
|
-
/**
|
|
17
|
-
* #baseConfiguration
|
|
18
|
-
*/
|
|
19
|
-
baseConfiguration: createBaseTrackConfig(pluginManager),
|
|
20
|
-
},
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export default configSchema
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
|
|
2
|
-
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'
|
|
3
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
4
|
-
import configSchemaF from './configSchema'
|
|
5
|
-
|
|
6
|
-
export default (pm: PluginManager) => {
|
|
7
|
-
pm.addTrackType(() => {
|
|
8
|
-
const configSchema = configSchemaF(pm)
|
|
9
|
-
return new TrackType({
|
|
10
|
-
name: 'SyntenyTrack',
|
|
11
|
-
configSchema,
|
|
12
|
-
stateModel: createBaseTrackModel(pm, 'SyntenyTrack', configSchema),
|
|
13
|
-
})
|
|
14
|
-
})
|
|
15
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import Plugin from '@jbrowse/core/Plugin'
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager'
|
|
3
|
-
import { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'
|
|
4
|
-
|
|
5
|
-
import CalendarIcon from '@mui/icons-material/CalendarViewDay'
|
|
6
|
-
import LinearComparativeDisplayF from './LinearComparativeDisplay'
|
|
7
|
-
import LinearComparativeViewF from './LinearComparativeView'
|
|
8
|
-
import LinearSyntenyDisplayF from './LinearSyntenyDisplay'
|
|
9
|
-
import LGVSyntenyDisplayF from './LGVSyntenyDisplay'
|
|
10
|
-
import LinearSyntenyViewF from './LinearSyntenyView'
|
|
11
|
-
import LaunchLinearSyntenyViewF from './LaunchLinearSyntenyView'
|
|
12
|
-
import SyntenyTrackF from './SyntenyTrack'
|
|
13
|
-
import SyntenyFeatureWidgetF from './SyntenyFeatureDetail'
|
|
14
|
-
import LinearReadVsRefMenuItem from './LinearReadVsRef'
|
|
15
|
-
|
|
16
|
-
export default class extends Plugin {
|
|
17
|
-
name = 'LinearComparativeViewPlugin'
|
|
18
|
-
|
|
19
|
-
install(pluginManager: PluginManager) {
|
|
20
|
-
LinearComparativeViewF(pluginManager)
|
|
21
|
-
LinearSyntenyViewF(pluginManager)
|
|
22
|
-
LinearComparativeDisplayF(pluginManager)
|
|
23
|
-
LinearSyntenyDisplayF(pluginManager)
|
|
24
|
-
LGVSyntenyDisplayF(pluginManager)
|
|
25
|
-
LaunchLinearSyntenyViewF(pluginManager)
|
|
26
|
-
SyntenyTrackF(pluginManager)
|
|
27
|
-
SyntenyFeatureWidgetF(pluginManager)
|
|
28
|
-
LinearReadVsRefMenuItem(pluginManager)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
configure(pluginManager: PluginManager) {
|
|
32
|
-
if (isAbstractMenuManager(pluginManager.rootModel)) {
|
|
33
|
-
pluginManager.rootModel.appendToSubMenu(['Add'], {
|
|
34
|
-
label: 'Linear synteny view',
|
|
35
|
-
icon: CalendarIcon,
|
|
36
|
-
onClick: (session: AbstractSessionModel) => {
|
|
37
|
-
session.addView('LinearSyntenyView', {})
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/util.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { clamp } from '@jbrowse/core/util'
|
|
2
|
-
import { Region } from '@jbrowse/core/util/types'
|
|
3
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature'
|
|
4
|
-
|
|
5
|
-
export type LayoutRecord = [number, number, number, number]
|
|
6
|
-
|
|
7
|
-
export interface ReducedLinearGenomeView {
|
|
8
|
-
bpPerPx: number
|
|
9
|
-
offsetPx: number
|
|
10
|
-
staticBlocks: Region[]
|
|
11
|
-
dynamicBlocks: Region[]
|
|
12
|
-
displayedRegions: Region[]
|
|
13
|
-
headerHeight: number
|
|
14
|
-
scaleBarHeight: number
|
|
15
|
-
height: number
|
|
16
|
-
features: Feature[]
|
|
17
|
-
tracks: {
|
|
18
|
-
scrollTop: number
|
|
19
|
-
height: number
|
|
20
|
-
configuration: string
|
|
21
|
-
skip: number
|
|
22
|
-
}[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const [, TOP, , BOTTOM] = [0, 1, 2, 3]
|
|
26
|
-
|
|
27
|
-
export function cheight(chunk: LayoutRecord) {
|
|
28
|
-
return chunk[BOTTOM] - chunk[TOP]
|
|
29
|
-
}
|
|
30
|
-
function heightFromSpecificLevel(
|
|
31
|
-
views: ReducedLinearGenomeView[],
|
|
32
|
-
trackConfigId: string,
|
|
33
|
-
level: number,
|
|
34
|
-
) {
|
|
35
|
-
const heightUpUntilThisPoint = views
|
|
36
|
-
.slice(0, level)
|
|
37
|
-
.map(v => v.height + 7)
|
|
38
|
-
.reduce((a, b) => a + b, 0)
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
heightUpUntilThisPoint +
|
|
42
|
-
views[level].headerHeight +
|
|
43
|
-
views[level].scaleBarHeight +
|
|
44
|
-
getTrackPos(views[level], trackConfigId) +
|
|
45
|
-
1
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function getTrackPos(
|
|
50
|
-
view: ReducedLinearGenomeView,
|
|
51
|
-
trackConfigId: string,
|
|
52
|
-
) {
|
|
53
|
-
const idx = view.tracks.findIndex(t => t.configuration === trackConfigId)
|
|
54
|
-
let accum = 0
|
|
55
|
-
for (let i = 0; i < idx; i += 1) {
|
|
56
|
-
accum += view.tracks[i].height + 3 // +1px for trackresizehandle
|
|
57
|
-
}
|
|
58
|
-
return accum
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Uses bpToPx to get the screen pixel coordinates but ignores some conditions
|
|
62
|
-
// where bpToPx could return undefined
|
|
63
|
-
export function getPxFromCoordinate(
|
|
64
|
-
view: ReducedLinearGenomeView,
|
|
65
|
-
refName: string,
|
|
66
|
-
coord: number,
|
|
67
|
-
) {
|
|
68
|
-
return (
|
|
69
|
-
((bpToPx(view, { refName, coord }) || {}).offsetPx || 0) - view.offsetPx
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Retrieves the y-position of a layout record in a track
|
|
74
|
-
// If track not found returns 0
|
|
75
|
-
export function overlayYPos(
|
|
76
|
-
trackConfigId: string,
|
|
77
|
-
level: number,
|
|
78
|
-
views: ReducedLinearGenomeView[],
|
|
79
|
-
c: LayoutRecord,
|
|
80
|
-
cond: boolean,
|
|
81
|
-
) {
|
|
82
|
-
const track = views[level].tracks.find(t => t.configuration === trackConfigId)
|
|
83
|
-
const ypos = track
|
|
84
|
-
? clamp(c[TOP] - (track.scrollTop || 0), 0, track.height) +
|
|
85
|
-
heightFromSpecificLevel(views, trackConfigId, level) +
|
|
86
|
-
track.skip
|
|
87
|
-
: 0
|
|
88
|
-
|
|
89
|
-
return ypos + (cond ? cheight(c) : 0)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Returns the pixel screen position of a refName:coord input, or undefined if
|
|
93
|
-
// the input could not be located. Uses view.displayedRegions as a representation
|
|
94
|
-
// of what is on the screen
|
|
95
|
-
//
|
|
96
|
-
// Note: does not consider that this refName:coord input could multi-match
|
|
97
|
-
function bpToPx(
|
|
98
|
-
view: ReducedLinearGenomeView,
|
|
99
|
-
{ refName, coord }: { refName: string; coord: number },
|
|
100
|
-
) {
|
|
101
|
-
let offsetBp = 0
|
|
102
|
-
|
|
103
|
-
const index = view.displayedRegions.findIndex(r => {
|
|
104
|
-
if (refName === r.refName && coord >= r.start && coord <= r.end) {
|
|
105
|
-
offsetBp += coord - r.start
|
|
106
|
-
return true
|
|
107
|
-
}
|
|
108
|
-
offsetBp += r.end - r.start
|
|
109
|
-
return false
|
|
110
|
-
})
|
|
111
|
-
const foundRegion = view.displayedRegions[index]
|
|
112
|
-
if (foundRegion) {
|
|
113
|
-
return {
|
|
114
|
-
index,
|
|
115
|
-
offsetPx: Math.round(offsetBp / view.bpPerPx),
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return undefined
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Returns either 0 or height depending on condition
|
|
122
|
-
export function interstitialYPos(cond: boolean, height: number) {
|
|
123
|
-
return cond ? 0 : height
|
|
124
|
-
}
|