@jbrowse/plugin-dotplot-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/ComparativeRenderer/index.d.ts +27 -0
- package/dist/ComparativeRenderer/index.js +59 -0
- package/dist/ComparativeRenderer/index.js.map +1 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.js +24 -0
- package/dist/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
- package/dist/DotplotDisplay/index.d.ts +12 -0
- package/dist/DotplotDisplay/index.js +48 -0
- package/dist/DotplotDisplay/index.js.map +1 -0
- package/dist/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
- package/dist/DotplotDisplay/renderDotplotBlock.js +57 -0
- package/dist/DotplotDisplay/renderDotplotBlock.js.map +1 -0
- package/dist/DotplotDisplay/stateModelFactory.d.ts +138 -0
- package/dist/DotplotDisplay/stateModelFactory.js +165 -0
- package/dist/DotplotDisplay/stateModelFactory.js.map +1 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +102 -0
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
- package/dist/DotplotReadVsRef/index.d.ts +2 -0
- package/dist/DotplotReadVsRef/index.js +42 -0
- package/dist/DotplotReadVsRef/index.js.map +1 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +59 -0
- package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +69 -0
- package/dist/DotplotRenderer/DotplotRenderer.js +274 -0
- package/dist/DotplotRenderer/DotplotRenderer.js.map +1 -0
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
- package/dist/DotplotRenderer/components/DotplotRendering.js +13 -0
- package/dist/DotplotRenderer/components/DotplotRendering.js.map +1 -0
- package/dist/DotplotRenderer/configSchema.d.ts +61 -0
- package/dist/DotplotRenderer/configSchema.js +83 -0
- package/dist/DotplotRenderer/configSchema.js.map +1 -0
- package/dist/DotplotRenderer/index.d.ts +3 -0
- package/dist/DotplotRenderer/index.js +17 -0
- package/dist/DotplotRenderer/index.js.map +1 -0
- package/dist/DotplotView/1dview.d.ts +307 -0
- package/dist/DotplotView/1dview.js +95 -0
- package/dist/DotplotView/1dview.js.map +1 -0
- package/dist/DotplotView/blockTypes.d.ts +61 -0
- package/dist/DotplotView/blockTypes.js +117 -0
- package/dist/DotplotView/blockTypes.js.map +1 -0
- package/dist/DotplotView/components/Axes.d.ts +14 -0
- package/dist/DotplotView/components/Axes.js +127 -0
- package/dist/DotplotView/components/Axes.js.map +1 -0
- package/dist/DotplotView/components/CursorIcon.d.ts +4 -0
- package/dist/DotplotView/components/CursorIcon.js +19 -0
- package/dist/DotplotView/components/CursorIcon.js.map +1 -0
- package/dist/DotplotView/components/DotplotTooltip.d.ts +19 -0
- package/dist/DotplotView/components/DotplotTooltip.js +128 -0
- package/dist/DotplotView/components/DotplotTooltip.js.map +1 -0
- package/dist/DotplotView/components/DotplotView.d.ts +6 -0
- package/dist/DotplotView/components/DotplotView.js +272 -0
- package/dist/DotplotView/components/DotplotView.js.map +1 -0
- package/dist/DotplotView/components/DotplotWarnings.d.ts +6 -0
- package/dist/DotplotView/components/DotplotWarnings.js +40 -0
- package/dist/DotplotView/components/DotplotWarnings.js.map +1 -0
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +8 -0
- package/dist/DotplotView/components/ExportSvgDialog.js +76 -0
- package/dist/DotplotView/components/ExportSvgDialog.js.map +1 -0
- package/dist/DotplotView/components/Grid.d.ts +10 -0
- package/dist/DotplotView/components/Grid.js +60 -0
- package/dist/DotplotView/components/Grid.js.map +1 -0
- package/dist/DotplotView/components/Header.d.ts +10 -0
- package/dist/DotplotView/components/Header.js +168 -0
- package/dist/DotplotView/components/Header.js.map +1 -0
- package/dist/DotplotView/components/ImportCustomTrack.d.ts +11 -0
- package/dist/DotplotView/components/ImportCustomTrack.js +180 -0
- package/dist/DotplotView/components/ImportCustomTrack.js.map +1 -0
- package/dist/DotplotView/components/ImportForm.d.ts +6 -0
- package/dist/DotplotView/components/ImportForm.js +121 -0
- package/dist/DotplotView/components/ImportForm.js.map +1 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +69 -0
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/dist/DotplotView/components/PanButtons.d.ts +6 -0
- package/dist/DotplotView/components/PanButtons.js +60 -0
- package/dist/DotplotView/components/PanButtons.js.map +1 -0
- package/dist/DotplotView/components/WarningDialog.d.ts +16 -0
- package/dist/DotplotView/components/WarningDialog.js +41 -0
- package/dist/DotplotView/components/WarningDialog.js.map +1 -0
- package/dist/DotplotView/components/util.d.ts +19 -0
- package/dist/DotplotView/components/util.js +90 -0
- package/dist/DotplotView/components/util.js.map +1 -0
- package/dist/DotplotView/index.d.ts +2 -0
- package/dist/DotplotView/index.js +44 -0
- package/dist/DotplotView/index.js.map +1 -0
- package/dist/DotplotView/model.d.ts +616 -0
- package/dist/DotplotView/model.js +647 -0
- package/dist/DotplotView/model.js.map +1 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.js +13 -0
- package/dist/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +47 -0
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
- package/dist/LaunchDotplotView.d.ts +2 -0
- package/dist/LaunchDotplotView.js +45 -0
- package/dist/LaunchDotplotView.js.map +1 -0
- package/dist/ServerSideRenderedBlockContent.d.ts +12 -0
- package/dist/ServerSideRenderedBlockContent.js +87 -0
- package/dist/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/ServerSideSyntenyRendering.d.ts +23 -0
- package/dist/ServerSideSyntenyRendering.js +54 -0
- package/dist/ServerSideSyntenyRendering.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +9 -0
- package/dist/util.js +9 -0
- package/dist/util.js.map +1 -0
- package/esm/ComparativeRenderer/index.d.ts +27 -0
- package/esm/ComparativeRenderer/index.js +53 -0
- package/esm/ComparativeRenderer/index.js.map +1 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.js +19 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
- package/esm/DotplotDisplay/index.d.ts +12 -0
- package/esm/DotplotDisplay/index.js +41 -0
- package/esm/DotplotDisplay/index.js.map +1 -0
- package/esm/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
- package/esm/DotplotDisplay/renderDotplotBlock.js +49 -0
- package/esm/DotplotDisplay/renderDotplotBlock.js.map +1 -0
- package/esm/DotplotDisplay/stateModelFactory.d.ts +138 -0
- package/esm/DotplotDisplay/stateModelFactory.js +158 -0
- package/esm/DotplotDisplay/stateModelFactory.js.map +1 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +98 -0
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
- package/esm/DotplotReadVsRef/index.d.ts +2 -0
- package/esm/DotplotReadVsRef/index.js +36 -0
- package/esm/DotplotReadVsRef/index.js.map +1 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +53 -0
- package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +69 -0
- package/esm/DotplotRenderer/DotplotRenderer.js +268 -0
- package/esm/DotplotRenderer/DotplotRenderer.js.map +1 -0
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
- package/esm/DotplotRenderer/components/DotplotRendering.js +8 -0
- package/esm/DotplotRenderer/components/DotplotRendering.js.map +1 -0
- package/esm/DotplotRenderer/configSchema.d.ts +61 -0
- package/esm/DotplotRenderer/configSchema.js +81 -0
- package/esm/DotplotRenderer/configSchema.js.map +1 -0
- package/esm/DotplotRenderer/index.d.ts +3 -0
- package/esm/DotplotRenderer/index.js +12 -0
- package/esm/DotplotRenderer/index.js.map +1 -0
- package/esm/DotplotView/1dview.d.ts +307 -0
- package/esm/DotplotView/1dview.js +87 -0
- package/esm/DotplotView/1dview.js.map +1 -0
- package/esm/DotplotView/blockTypes.d.ts +61 -0
- package/esm/DotplotView/blockTypes.js +109 -0
- package/esm/DotplotView/blockTypes.js.map +1 -0
- package/esm/DotplotView/components/Axes.d.ts +14 -0
- package/esm/DotplotView/components/Axes.js +121 -0
- package/esm/DotplotView/components/Axes.js.map +1 -0
- package/esm/DotplotView/components/CursorIcon.d.ts +4 -0
- package/esm/DotplotView/components/CursorIcon.js +11 -0
- package/esm/DotplotView/components/CursorIcon.js.map +1 -0
- package/esm/DotplotView/components/DotplotTooltip.d.ts +19 -0
- package/esm/DotplotView/components/DotplotTooltip.js +101 -0
- package/esm/DotplotView/components/DotplotTooltip.js.map +1 -0
- package/esm/DotplotView/components/DotplotView.d.ts +6 -0
- package/esm/DotplotView/components/DotplotView.js +244 -0
- package/esm/DotplotView/components/DotplotView.js.map +1 -0
- package/esm/DotplotView/components/DotplotWarnings.d.ts +6 -0
- package/esm/DotplotView/components/DotplotWarnings.js +15 -0
- package/esm/DotplotView/components/DotplotWarnings.js.map +1 -0
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +8 -0
- package/esm/DotplotView/components/ExportSvgDialog.js +50 -0
- package/esm/DotplotView/components/ExportSvgDialog.js.map +1 -0
- package/esm/DotplotView/components/Grid.d.ts +10 -0
- package/esm/DotplotView/components/Grid.js +53 -0
- package/esm/DotplotView/components/Grid.js.map +1 -0
- package/esm/DotplotView/components/Header.d.ts +10 -0
- package/esm/DotplotView/components/Header.js +140 -0
- package/esm/DotplotView/components/Header.js.map +1 -0
- package/esm/DotplotView/components/ImportCustomTrack.d.ts +11 -0
- package/esm/DotplotView/components/ImportCustomTrack.js +152 -0
- package/esm/DotplotView/components/ImportCustomTrack.js.map +1 -0
- package/esm/DotplotView/components/ImportForm.d.ts +6 -0
- package/esm/DotplotView/components/ImportForm.js +93 -0
- package/esm/DotplotView/components/ImportForm.js.map +1 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +44 -0
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
- package/esm/DotplotView/components/PanButtons.d.ts +6 -0
- package/esm/DotplotView/components/PanButtons.js +55 -0
- package/esm/DotplotView/components/PanButtons.js.map +1 -0
- package/esm/DotplotView/components/WarningDialog.d.ts +16 -0
- package/esm/DotplotView/components/WarningDialog.js +36 -0
- package/esm/DotplotView/components/WarningDialog.js.map +1 -0
- package/esm/DotplotView/components/util.d.ts +19 -0
- package/esm/DotplotView/components/util.js +83 -0
- package/esm/DotplotView/components/util.js.map +1 -0
- package/esm/DotplotView/index.d.ts +2 -0
- package/esm/DotplotView/index.js +15 -0
- package/esm/DotplotView/index.js.map +1 -0
- package/esm/DotplotView/model.d.ts +616 -0
- package/esm/DotplotView/model.js +616 -0
- package/esm/DotplotView/model.js.map +1 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.js +7 -0
- package/esm/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +40 -0
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
- package/esm/LaunchDotplotView.d.ts +2 -0
- package/esm/LaunchDotplotView.js +42 -0
- package/esm/LaunchDotplotView.js.map +1 -0
- package/esm/ServerSideRenderedBlockContent.d.ts +12 -0
- package/esm/ServerSideRenderedBlockContent.js +62 -0
- package/esm/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/ServerSideSyntenyRendering.d.ts +23 -0
- package/esm/ServerSideSyntenyRendering.js +29 -0
- package/esm/ServerSideSyntenyRendering.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +38 -0
- package/esm/index.js.map +1 -0
- package/esm/util.d.ts +9 -0
- package/esm/util.js +5 -0
- package/esm/util.js.map +1 -0
- package/package.json +69 -0
- package/src/ComparativeRenderer/index.ts +87 -0
- package/src/DotplotDisplay/components/DotplotDisplay.tsx +34 -0
- package/src/DotplotDisplay/index.ts +48 -0
- package/src/DotplotDisplay/renderDotplotBlock.ts +60 -0
- package/src/DotplotDisplay/stateModelFactory.tsx +196 -0
- package/src/DotplotReadVsRef/DotplotReadVsRef.ts +115 -0
- package/src/DotplotReadVsRef/index.ts +50 -0
- package/src/DotplotRenderer/ComparativeRenderRpc.ts +87 -0
- package/src/DotplotRenderer/DotplotRenderer.ts +328 -0
- package/src/DotplotRenderer/__image_snapshots__/linear-synteny-renderer-test-ts-test-rendering-a-simple-synteny-from-fake-data-1-snap.png +0 -0
- package/src/DotplotRenderer/components/DotplotRendering.tsx +12 -0
- package/src/DotplotRenderer/configSchema.ts +92 -0
- package/src/DotplotRenderer/index.ts +16 -0
- package/src/DotplotView/1dview.ts +98 -0
- package/src/DotplotView/blockTypes.ts +140 -0
- package/src/DotplotView/components/Axes.tsx +246 -0
- package/src/DotplotView/components/CursorIcon.tsx +24 -0
- package/src/DotplotView/components/DotplotTooltip.tsx +163 -0
- package/src/DotplotView/components/DotplotView.tsx +348 -0
- package/src/DotplotView/components/DotplotWarnings.tsx +26 -0
- package/src/DotplotView/components/ExportSvgDialog.tsx +129 -0
- package/src/DotplotView/components/Grid.tsx +112 -0
- package/src/DotplotView/components/Header.tsx +182 -0
- package/src/DotplotView/components/ImportCustomTrack.tsx +262 -0
- package/src/DotplotView/components/ImportForm.tsx +209 -0
- package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +90 -0
- package/src/DotplotView/components/PanButtons.tsx +93 -0
- package/src/DotplotView/components/WarningDialog.tsx +74 -0
- package/src/DotplotView/components/util.ts +118 -0
- package/src/DotplotView/index.ts +16 -0
- package/src/DotplotView/model.test.ts +17 -0
- package/src/DotplotView/model.ts +719 -0
- package/src/DotplotView/svgcomponents/SVGBackground.tsx +21 -0
- package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +68 -0
- package/src/LaunchDotplotView.ts +63 -0
- package/src/ServerSideRenderedBlockContent.tsx +86 -0
- package/src/ServerSideSyntenyRendering.tsx +54 -0
- package/src/index.ts +41 -0
- package/src/util.ts +14 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { Select, MenuItem, Paper, Typography } from '@mui/material'
|
|
3
|
+
import { getTrackName } from '@jbrowse/core/util/tracks'
|
|
4
|
+
import { getSession } from '@jbrowse/core/util'
|
|
5
|
+
import { ErrorMessage } from '@jbrowse/core/ui'
|
|
6
|
+
import {
|
|
7
|
+
AnyConfigurationModel,
|
|
8
|
+
readConfObject,
|
|
9
|
+
} from '@jbrowse/core/configuration'
|
|
10
|
+
import { observer } from 'mobx-react'
|
|
11
|
+
|
|
12
|
+
// icons
|
|
13
|
+
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
|
|
14
|
+
|
|
15
|
+
// locals
|
|
16
|
+
import { DotplotViewModel } from '../model'
|
|
17
|
+
|
|
18
|
+
function f(track: AnyConfigurationModel, assembly1: string, assembly2: string) {
|
|
19
|
+
const assemblyNames = readConfObject(track, 'assemblyNames')
|
|
20
|
+
return (
|
|
21
|
+
assemblyNames.includes(assembly1) &&
|
|
22
|
+
assemblyNames.includes(assembly2) &&
|
|
23
|
+
track.type.includes('Synteny')
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const Selector = observer(
|
|
28
|
+
({
|
|
29
|
+
model,
|
|
30
|
+
assembly1,
|
|
31
|
+
assembly2,
|
|
32
|
+
setShowTrackId,
|
|
33
|
+
}: {
|
|
34
|
+
model: DotplotViewModel
|
|
35
|
+
assembly1: string
|
|
36
|
+
assembly2: string
|
|
37
|
+
setShowTrackId: (arg: string) => void
|
|
38
|
+
}) => {
|
|
39
|
+
const session = getSession(model)
|
|
40
|
+
const { tracks, sessionTracks } = session
|
|
41
|
+
const allTracks = [...tracks, ...sessionTracks] as AnyConfigurationModel[]
|
|
42
|
+
const filteredTracks = allTracks.filter(t => f(t, assembly2, assembly1))
|
|
43
|
+
const resetTrack = filteredTracks[0]?.trackId || ''
|
|
44
|
+
const [value, setValue] = useState(resetTrack)
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
// if assembly1/assembly2 changes, then we will want to use this effect to change
|
|
47
|
+
// the state of the useState because it otherwise gets locked to a stale value
|
|
48
|
+
setValue(resetTrack)
|
|
49
|
+
}, [resetTrack])
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
// sets track data in a useEffect because the initial load is needed as well as
|
|
53
|
+
// onChange's to the select box
|
|
54
|
+
setShowTrackId(value)
|
|
55
|
+
}, [value, setShowTrackId])
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Paper style={{ padding: 12 }}>
|
|
59
|
+
<Typography paragraph>
|
|
60
|
+
Select a track from the select box below, the track will be shown when
|
|
61
|
+
you hit "Launch".
|
|
62
|
+
</Typography>
|
|
63
|
+
|
|
64
|
+
<Typography paragraph>
|
|
65
|
+
Note: there is a track selector <i>inside</i> the DotplotView, which
|
|
66
|
+
can turn on one or more SyntenyTracks (more than one can be displayed
|
|
67
|
+
at once). Look for the track selector icon <TrackSelectorIcon />
|
|
68
|
+
</Typography>
|
|
69
|
+
{filteredTracks.length ? (
|
|
70
|
+
<Select
|
|
71
|
+
value={value}
|
|
72
|
+
onChange={event => setValue(event.target.value)}
|
|
73
|
+
>
|
|
74
|
+
{filteredTracks.map(track => (
|
|
75
|
+
<MenuItem key={track.trackId} value={track.trackId}>
|
|
76
|
+
{getTrackName(track, session)}
|
|
77
|
+
</MenuItem>
|
|
78
|
+
))}
|
|
79
|
+
</Select>
|
|
80
|
+
) : (
|
|
81
|
+
<ErrorMessage
|
|
82
|
+
error={`No synteny tracks found for ${assembly1},${assembly2}`}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</Paper>
|
|
86
|
+
)
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
export default Selector
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconButton, Paper } from '@mui/material'
|
|
3
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
|
+
import { observer } from 'mobx-react'
|
|
5
|
+
|
|
6
|
+
// icons
|
|
7
|
+
import ArrowDropDown from '@mui/icons-material/ArrowDropDown'
|
|
8
|
+
import ArrowDropUp from '@mui/icons-material/ArrowDropUp'
|
|
9
|
+
import ArrowLeft from '@mui/icons-material/ArrowLeft'
|
|
10
|
+
import ArrowRight from '@mui/icons-material/ArrowRight'
|
|
11
|
+
import ZoomIn from '@mui/icons-material/ZoomIn'
|
|
12
|
+
import ZoomOut from '@mui/icons-material/ZoomOut'
|
|
13
|
+
|
|
14
|
+
// locals
|
|
15
|
+
import { DotplotViewModel } from '../model'
|
|
16
|
+
|
|
17
|
+
const useStyles = makeStyles()({
|
|
18
|
+
dpad: {
|
|
19
|
+
display: 'grid',
|
|
20
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
21
|
+
margin: 0,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
right: 50,
|
|
24
|
+
zIndex: 1000,
|
|
25
|
+
top: 50,
|
|
26
|
+
},
|
|
27
|
+
icon: {
|
|
28
|
+
padding: 0,
|
|
29
|
+
margin: 0,
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export default observer(function PanButtons({
|
|
34
|
+
model,
|
|
35
|
+
}: {
|
|
36
|
+
model: DotplotViewModel
|
|
37
|
+
}) {
|
|
38
|
+
const { classes } = useStyles()
|
|
39
|
+
return (
|
|
40
|
+
<Paper className={classes.dpad} elevation={6}>
|
|
41
|
+
<div />
|
|
42
|
+
<IconButton
|
|
43
|
+
className={classes.icon}
|
|
44
|
+
onClick={() => model.vview.scroll(100)}
|
|
45
|
+
>
|
|
46
|
+
<ArrowDropUp />
|
|
47
|
+
</IconButton>
|
|
48
|
+
<div />
|
|
49
|
+
|
|
50
|
+
<IconButton
|
|
51
|
+
className={classes.icon}
|
|
52
|
+
onClick={() => model.hview.scroll(-100)}
|
|
53
|
+
>
|
|
54
|
+
<ArrowLeft />
|
|
55
|
+
</IconButton>
|
|
56
|
+
<div />
|
|
57
|
+
<IconButton
|
|
58
|
+
className={classes.icon}
|
|
59
|
+
onClick={() => model.hview.scroll(100)}
|
|
60
|
+
>
|
|
61
|
+
<ArrowRight />
|
|
62
|
+
</IconButton>
|
|
63
|
+
|
|
64
|
+
<div />
|
|
65
|
+
<IconButton
|
|
66
|
+
className={classes.icon}
|
|
67
|
+
onClick={() => model.vview.scroll(-100)}
|
|
68
|
+
>
|
|
69
|
+
<ArrowDropDown />
|
|
70
|
+
</IconButton>
|
|
71
|
+
<div />
|
|
72
|
+
<IconButton
|
|
73
|
+
className={classes.icon}
|
|
74
|
+
onClick={() => {
|
|
75
|
+
model.hview.zoomIn()
|
|
76
|
+
model.vview.zoomIn()
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<ZoomIn />
|
|
80
|
+
</IconButton>
|
|
81
|
+
<div />
|
|
82
|
+
<IconButton
|
|
83
|
+
className={classes.icon}
|
|
84
|
+
onClick={() => {
|
|
85
|
+
model.hview.zoomOut()
|
|
86
|
+
model.vview.zoomOut()
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<ZoomOut />
|
|
90
|
+
</IconButton>
|
|
91
|
+
</Paper>
|
|
92
|
+
)
|
|
93
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { DialogContent, DialogContentText } from '@mui/material'
|
|
3
|
+
import { Dialog } from '@jbrowse/core/ui'
|
|
4
|
+
import { observer } from 'mobx-react'
|
|
5
|
+
import { makeStyles } from 'tss-react/mui'
|
|
6
|
+
import { DataGrid } from '@mui/x-data-grid'
|
|
7
|
+
import { AnyConfigurationModel, getConf } from '@jbrowse/core/configuration'
|
|
8
|
+
import { measureGridWidth } from '@jbrowse/core/util'
|
|
9
|
+
|
|
10
|
+
const useStyles = makeStyles()({
|
|
11
|
+
content: {
|
|
12
|
+
minWidth: 600,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
interface TrackWarning {
|
|
17
|
+
configuration: AnyConfigurationModel
|
|
18
|
+
displays: { warnings: { message: string; effect: string }[] }[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default observer(function WarningDialog({
|
|
22
|
+
trackWarnings,
|
|
23
|
+
handleClose,
|
|
24
|
+
}: {
|
|
25
|
+
handleClose: () => void
|
|
26
|
+
trackWarnings: TrackWarning[]
|
|
27
|
+
}) {
|
|
28
|
+
const { classes } = useStyles()
|
|
29
|
+
const rows = [] as {
|
|
30
|
+
name: string
|
|
31
|
+
message: string
|
|
32
|
+
effect: string
|
|
33
|
+
id: string
|
|
34
|
+
}[]
|
|
35
|
+
for (let i = 0; i < trackWarnings.length; i++) {
|
|
36
|
+
const track = trackWarnings[i]
|
|
37
|
+
const name = getConf(track, 'name')
|
|
38
|
+
for (let j = 0; j < track.displays[0].warnings.length; j++) {
|
|
39
|
+
const warning = track.displays[0].warnings[j]
|
|
40
|
+
rows.push({ name, ...warning, id: i + '_' + j })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const columns = [
|
|
44
|
+
{ field: 'name' },
|
|
45
|
+
{ field: 'message', width: measureGridWidth(rows.map(r => r.message)) },
|
|
46
|
+
{ field: 'effect', width: measureGridWidth(rows.map(r => r.effect)) },
|
|
47
|
+
]
|
|
48
|
+
return (
|
|
49
|
+
<Dialog
|
|
50
|
+
open
|
|
51
|
+
onClose={handleClose}
|
|
52
|
+
maxWidth="xl"
|
|
53
|
+
title="Dotplot rendered with warnings"
|
|
54
|
+
>
|
|
55
|
+
<DialogContent className={classes.content}>
|
|
56
|
+
<DialogContentText>
|
|
57
|
+
Found warnings while rendering the dotplot. This is often due to
|
|
58
|
+
out-of-bound features that may indicate the wrong assemblies are being
|
|
59
|
+
used. Check that the query and target are configured correctly, and
|
|
60
|
+
that the right assemblies are being compared.
|
|
61
|
+
</DialogContentText>
|
|
62
|
+
<div style={{ height: 600, width: '100%', overflow: 'auto' }}>
|
|
63
|
+
<DataGrid
|
|
64
|
+
rows={rows}
|
|
65
|
+
columns={columns}
|
|
66
|
+
disableRowSelectionOnClick
|
|
67
|
+
rowHeight={25}
|
|
68
|
+
disableColumnMenu
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</DialogContent>
|
|
72
|
+
</Dialog>
|
|
73
|
+
)
|
|
74
|
+
})
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { BaseBlock } from '@jbrowse/core/util/blockTypes'
|
|
2
|
+
import { Dotplot1DViewModel } from '../model'
|
|
3
|
+
|
|
4
|
+
export function locstr(
|
|
5
|
+
px: number,
|
|
6
|
+
view: Dotplot1DViewModel,
|
|
7
|
+
includeAsm = true,
|
|
8
|
+
) {
|
|
9
|
+
const { assemblyName, refName, start, offset, oob } = view.pxToBp(px)
|
|
10
|
+
const coord = Math.floor(start + offset)
|
|
11
|
+
return oob
|
|
12
|
+
? 'out of bounds'
|
|
13
|
+
: `${
|
|
14
|
+
includeAsm ? '{' + assemblyName + '}' : ''
|
|
15
|
+
}${refName}:${coord.toLocaleString('en-US')}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getBlockLabelKeysToHide(
|
|
19
|
+
blocks: BaseBlock[],
|
|
20
|
+
length: number,
|
|
21
|
+
viewOffsetPx: number,
|
|
22
|
+
) {
|
|
23
|
+
const blockLabelKeysToHide = new Set<string>()
|
|
24
|
+
const sortedBlocks = [...blocks].sort((a, b) => {
|
|
25
|
+
const alen = a.end - a.start
|
|
26
|
+
const blen = b.end - b.start
|
|
27
|
+
return blen - alen
|
|
28
|
+
})
|
|
29
|
+
const positions = Array.from({ length: Math.round(length) })
|
|
30
|
+
for (const { key, offsetPx } of sortedBlocks) {
|
|
31
|
+
const y = Math.round(length - offsetPx + viewOffsetPx)
|
|
32
|
+
const labelBounds = [Math.max(y - 12, 0), y]
|
|
33
|
+
if (y === 0 || positions.slice(...labelBounds).some(Boolean)) {
|
|
34
|
+
blockLabelKeysToHide.add(key)
|
|
35
|
+
} else {
|
|
36
|
+
positions.fill(true, ...labelBounds)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return blockLabelKeysToHide
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
43
|
+
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
44
|
+
* the gridline pitches to use.
|
|
45
|
+
*/
|
|
46
|
+
export function chooseGridPitch(
|
|
47
|
+
scale: number,
|
|
48
|
+
minMajorPitchPx: number,
|
|
49
|
+
minMinorPitchPx: number,
|
|
50
|
+
) {
|
|
51
|
+
scale = Math.abs(scale)
|
|
52
|
+
const minMajorPitchBp = minMajorPitchPx * scale
|
|
53
|
+
const majorMagnitude = Number.parseInt(
|
|
54
|
+
Number(minMajorPitchBp).toExponential().split(/e/i)[1],
|
|
55
|
+
10,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
let majorPitch = 10 ** majorMagnitude
|
|
59
|
+
while (majorPitch < minMajorPitchBp) {
|
|
60
|
+
majorPitch *= 2
|
|
61
|
+
if (majorPitch >= minMajorPitchBp) {
|
|
62
|
+
break
|
|
63
|
+
}
|
|
64
|
+
majorPitch *= 2.5
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
majorPitch = Math.max(majorPitch, 5)
|
|
68
|
+
|
|
69
|
+
const majorPitchPx = majorPitch / scale
|
|
70
|
+
|
|
71
|
+
let minorPitch = 0
|
|
72
|
+
if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {
|
|
73
|
+
minorPitch = majorPitch / 10
|
|
74
|
+
} else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {
|
|
75
|
+
minorPitch = majorPitch / 5
|
|
76
|
+
} else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {
|
|
77
|
+
minorPitch = majorPitch / 2
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { majorPitch, minorPitch }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function makeTicks(
|
|
84
|
+
regions: BaseBlock[],
|
|
85
|
+
bpPerPx: number,
|
|
86
|
+
emitMajor = true,
|
|
87
|
+
emitMinor = true,
|
|
88
|
+
) {
|
|
89
|
+
const ticks = []
|
|
90
|
+
const gridPitch = chooseGridPitch(bpPerPx, 60, 15)
|
|
91
|
+
const iterPitch = gridPitch.minorPitch || gridPitch.majorPitch
|
|
92
|
+
for (let i = 0; i < regions.length; i++) {
|
|
93
|
+
const region = regions[i]
|
|
94
|
+
const { start, end, refName } = region
|
|
95
|
+
let index = 0
|
|
96
|
+
|
|
97
|
+
const minBase = start
|
|
98
|
+
const maxBase = end
|
|
99
|
+
|
|
100
|
+
for (
|
|
101
|
+
let base = Math.floor(minBase / iterPitch) * iterPitch;
|
|
102
|
+
base < Math.ceil(maxBase / iterPitch) * iterPitch + 1;
|
|
103
|
+
base += iterPitch
|
|
104
|
+
) {
|
|
105
|
+
if (emitMinor && base % gridPitch.majorPitch) {
|
|
106
|
+
ticks.push({ type: 'minor', base: base - 1, index, refName })
|
|
107
|
+
index += 1
|
|
108
|
+
} else if (
|
|
109
|
+
emitMajor &&
|
|
110
|
+
Math.abs(base - region.start) > gridPitch.minorPitch
|
|
111
|
+
) {
|
|
112
|
+
ticks.push({ type: 'major', base: base - 1, index, refName })
|
|
113
|
+
index += 1
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return ticks
|
|
118
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { lazy } from 'react'
|
|
2
|
+
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
4
|
+
// locals
|
|
5
|
+
import stateModelFactory from './model'
|
|
6
|
+
|
|
7
|
+
export default function (pluginManager: PluginManager) {
|
|
8
|
+
pluginManager.addViewType(() => {
|
|
9
|
+
return new ViewType({
|
|
10
|
+
name: 'DotplotView',
|
|
11
|
+
displayName: 'Dotplot view',
|
|
12
|
+
stateModel: stateModelFactory(pluginManager),
|
|
13
|
+
ReactComponent: lazy(() => import('./components/DotplotView')),
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createTestSession } from '@jbrowse/web/src/rootModel/test_util'
|
|
2
|
+
import { getEnv } from 'mobx-state-tree'
|
|
3
|
+
jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
const { pluginManager } = getEnv(createTestSession() as any)
|
|
7
|
+
|
|
8
|
+
describe('dotplot state model', () => {
|
|
9
|
+
test('can instantiate from an empty object', () => {
|
|
10
|
+
const DotplotModel = pluginManager.jbrequire(require('./model'))
|
|
11
|
+
expect(() =>
|
|
12
|
+
DotplotModel.create({
|
|
13
|
+
type: 'DotplotView',
|
|
14
|
+
}),
|
|
15
|
+
).not.toThrow()
|
|
16
|
+
})
|
|
17
|
+
})
|