@jbrowse/plugin-dotplot-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/ComparativeRenderer/index.js +0 -1
- package/dist/DotplotDisplay/components/DotplotDisplay.js +0 -1
- package/dist/DotplotDisplay/index.js +0 -1
- package/dist/DotplotDisplay/renderDotplotBlock.js +0 -1
- package/dist/DotplotDisplay/stateModelFactory.js +0 -1
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
- package/dist/DotplotReadVsRef/index.js +0 -1
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +0 -1
- package/dist/DotplotRenderer/DotplotRenderer.js +0 -1
- package/dist/DotplotRenderer/components/DotplotRendering.js +0 -1
- package/dist/DotplotRenderer/configSchema.js +0 -1
- package/dist/DotplotRenderer/index.js +0 -1
- package/dist/DotplotView/1dview.js +0 -1
- package/dist/DotplotView/blockTypes.js +0 -1
- package/dist/DotplotView/components/Axes.js +0 -1
- package/dist/DotplotView/components/CursorIcon.js +0 -1
- package/dist/DotplotView/components/DotplotTooltip.js +0 -1
- package/dist/DotplotView/components/DotplotView.js +0 -1
- package/dist/DotplotView/components/DotplotWarnings.js +0 -1
- package/dist/DotplotView/components/ExportSvgDialog.js +0 -1
- package/dist/DotplotView/components/Grid.js +0 -1
- package/dist/DotplotView/components/Header.js +0 -1
- package/dist/DotplotView/components/ImportCustomTrack.js +0 -1
- package/dist/DotplotView/components/ImportForm.js +0 -1
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
- package/dist/DotplotView/components/PanButtons.js +0 -1
- package/dist/DotplotView/components/WarningDialog.js +0 -1
- package/dist/DotplotView/components/util.js +0 -1
- package/dist/DotplotView/index.js +0 -1
- package/dist/DotplotView/model.js +0 -1
- package/dist/DotplotView/svgcomponents/SVGBackground.js +0 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
- package/dist/LaunchDotplotView.js +0 -1
- package/dist/ServerSideRenderedBlockContent.js +0 -1
- package/dist/ServerSideSyntenyRendering.js +0 -1
- package/dist/index.js +0 -1
- package/dist/util.js +0 -1
- package/esm/ComparativeRenderer/index.js +0 -1
- package/esm/DotplotDisplay/components/DotplotDisplay.js +0 -1
- package/esm/DotplotDisplay/index.js +0 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js +0 -1
- package/esm/DotplotDisplay/stateModelFactory.js +0 -1
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
- package/esm/DotplotReadVsRef/index.js +0 -1
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +0 -1
- package/esm/DotplotRenderer/DotplotRenderer.js +0 -1
- package/esm/DotplotRenderer/components/DotplotRendering.js +0 -1
- package/esm/DotplotRenderer/configSchema.js +0 -1
- package/esm/DotplotRenderer/index.js +0 -1
- package/esm/DotplotView/1dview.js +0 -1
- package/esm/DotplotView/blockTypes.js +0 -1
- package/esm/DotplotView/components/Axes.js +0 -1
- package/esm/DotplotView/components/CursorIcon.js +0 -1
- package/esm/DotplotView/components/DotplotTooltip.js +0 -1
- package/esm/DotplotView/components/DotplotView.js +0 -1
- package/esm/DotplotView/components/DotplotWarnings.js +0 -1
- package/esm/DotplotView/components/ExportSvgDialog.js +0 -1
- package/esm/DotplotView/components/Grid.js +0 -1
- package/esm/DotplotView/components/Header.js +0 -1
- package/esm/DotplotView/components/ImportCustomTrack.js +0 -1
- package/esm/DotplotView/components/ImportForm.js +0 -1
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
- package/esm/DotplotView/components/PanButtons.js +0 -1
- package/esm/DotplotView/components/WarningDialog.js +0 -1
- package/esm/DotplotView/components/util.js +0 -1
- package/esm/DotplotView/index.js +0 -1
- package/esm/DotplotView/model.js +0 -1
- package/esm/DotplotView/svgcomponents/SVGBackground.js +0 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
- package/esm/LaunchDotplotView.js +0 -1
- package/esm/ServerSideRenderedBlockContent.js +0 -1
- package/esm/ServerSideSyntenyRendering.js +0 -1
- package/esm/index.js +0 -1
- package/esm/util.js +0 -1
- package/package.json +3 -4
- package/dist/ComparativeRenderer/index.js.map +0 -1
- package/dist/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
- package/dist/DotplotDisplay/index.js.map +0 -1
- package/dist/DotplotDisplay/renderDotplotBlock.js.map +0 -1
- package/dist/DotplotDisplay/stateModelFactory.js.map +0 -1
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
- package/dist/DotplotReadVsRef/index.js.map +0 -1
- package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
- package/dist/DotplotRenderer/DotplotRenderer.js.map +0 -1
- package/dist/DotplotRenderer/components/DotplotRendering.js.map +0 -1
- package/dist/DotplotRenderer/configSchema.js.map +0 -1
- package/dist/DotplotRenderer/index.js.map +0 -1
- package/dist/DotplotView/1dview.js.map +0 -1
- package/dist/DotplotView/blockTypes.js.map +0 -1
- package/dist/DotplotView/components/Axes.js.map +0 -1
- package/dist/DotplotView/components/CursorIcon.js.map +0 -1
- package/dist/DotplotView/components/DotplotTooltip.js.map +0 -1
- package/dist/DotplotView/components/DotplotView.js.map +0 -1
- package/dist/DotplotView/components/DotplotWarnings.js.map +0 -1
- package/dist/DotplotView/components/ExportSvgDialog.js.map +0 -1
- package/dist/DotplotView/components/Grid.js.map +0 -1
- package/dist/DotplotView/components/Header.js.map +0 -1
- package/dist/DotplotView/components/ImportCustomTrack.js.map +0 -1
- package/dist/DotplotView/components/ImportForm.js.map +0 -1
- package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/dist/DotplotView/components/PanButtons.js.map +0 -1
- package/dist/DotplotView/components/WarningDialog.js.map +0 -1
- package/dist/DotplotView/components/util.js.map +0 -1
- package/dist/DotplotView/index.js.map +0 -1
- package/dist/DotplotView/model.js.map +0 -1
- package/dist/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
- package/dist/LaunchDotplotView.js.map +0 -1
- package/dist/ServerSideRenderedBlockContent.js.map +0 -1
- package/dist/ServerSideSyntenyRendering.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/util.js.map +0 -1
- package/esm/ComparativeRenderer/index.js.map +0 -1
- package/esm/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
- package/esm/DotplotDisplay/index.js.map +0 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js.map +0 -1
- package/esm/DotplotDisplay/stateModelFactory.js.map +0 -1
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
- package/esm/DotplotReadVsRef/index.js.map +0 -1
- package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
- package/esm/DotplotRenderer/DotplotRenderer.js.map +0 -1
- package/esm/DotplotRenderer/components/DotplotRendering.js.map +0 -1
- package/esm/DotplotRenderer/configSchema.js.map +0 -1
- package/esm/DotplotRenderer/index.js.map +0 -1
- package/esm/DotplotView/1dview.js.map +0 -1
- package/esm/DotplotView/blockTypes.js.map +0 -1
- package/esm/DotplotView/components/Axes.js.map +0 -1
- package/esm/DotplotView/components/CursorIcon.js.map +0 -1
- package/esm/DotplotView/components/DotplotTooltip.js.map +0 -1
- package/esm/DotplotView/components/DotplotView.js.map +0 -1
- package/esm/DotplotView/components/DotplotWarnings.js.map +0 -1
- package/esm/DotplotView/components/ExportSvgDialog.js.map +0 -1
- package/esm/DotplotView/components/Grid.js.map +0 -1
- package/esm/DotplotView/components/Header.js.map +0 -1
- package/esm/DotplotView/components/ImportCustomTrack.js.map +0 -1
- package/esm/DotplotView/components/ImportForm.js.map +0 -1
- package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
- package/esm/DotplotView/components/PanButtons.js.map +0 -1
- package/esm/DotplotView/components/WarningDialog.js.map +0 -1
- package/esm/DotplotView/components/util.js.map +0 -1
- package/esm/DotplotView/index.js.map +0 -1
- package/esm/DotplotView/model.js.map +0 -1
- package/esm/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
- package/esm/LaunchDotplotView.js.map +0 -1
- package/esm/ServerSideRenderedBlockContent.js.map +0 -1
- package/esm/ServerSideSyntenyRendering.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/util.js.map +0 -1
- package/src/ComparativeRenderer/index.ts +0 -87
- package/src/DotplotDisplay/components/DotplotDisplay.tsx +0 -34
- package/src/DotplotDisplay/index.ts +0 -48
- package/src/DotplotDisplay/renderDotplotBlock.ts +0 -60
- package/src/DotplotDisplay/stateModelFactory.tsx +0 -196
- package/src/DotplotReadVsRef/DotplotReadVsRef.ts +0 -115
- package/src/DotplotReadVsRef/index.ts +0 -50
- package/src/DotplotRenderer/ComparativeRenderRpc.ts +0 -87
- package/src/DotplotRenderer/DotplotRenderer.ts +0 -328
- 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 +0 -12
- package/src/DotplotRenderer/configSchema.ts +0 -92
- package/src/DotplotRenderer/index.ts +0 -16
- package/src/DotplotView/1dview.ts +0 -98
- package/src/DotplotView/blockTypes.ts +0 -140
- package/src/DotplotView/components/Axes.tsx +0 -246
- package/src/DotplotView/components/CursorIcon.tsx +0 -24
- package/src/DotplotView/components/DotplotTooltip.tsx +0 -163
- package/src/DotplotView/components/DotplotView.tsx +0 -348
- package/src/DotplotView/components/DotplotWarnings.tsx +0 -26
- package/src/DotplotView/components/ExportSvgDialog.tsx +0 -129
- package/src/DotplotView/components/Grid.tsx +0 -112
- package/src/DotplotView/components/Header.tsx +0 -182
- package/src/DotplotView/components/ImportCustomTrack.tsx +0 -262
- package/src/DotplotView/components/ImportForm.tsx +0 -209
- package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +0 -90
- package/src/DotplotView/components/PanButtons.tsx +0 -93
- package/src/DotplotView/components/WarningDialog.tsx +0 -74
- package/src/DotplotView/components/util.ts +0 -118
- package/src/DotplotView/index.ts +0 -16
- package/src/DotplotView/model.test.ts +0 -17
- package/src/DotplotView/model.ts +0 -719
- package/src/DotplotView/svgcomponents/SVGBackground.tsx +0 -21
- package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +0 -68
- package/src/LaunchDotplotView.ts +0 -63
- package/src/ServerSideRenderedBlockContent.tsx +0 -86
- package/src/ServerSideSyntenyRendering.tsx +0 -54
- package/src/index.ts +0 -41
- package/src/util.ts +0 -14
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { IconButton, Typography } from '@mui/material'
|
|
3
|
-
import { observer } from 'mobx-react'
|
|
4
|
-
import { makeStyles } from 'tss-react/mui'
|
|
5
|
-
import { getBpDisplayStr } from '@jbrowse/core/util'
|
|
6
|
-
import { Menu } from '@jbrowse/core/ui'
|
|
7
|
-
|
|
8
|
-
// icons
|
|
9
|
-
import ZoomOut from '@mui/icons-material/ZoomOut'
|
|
10
|
-
import ZoomIn from '@mui/icons-material/ZoomIn'
|
|
11
|
-
import MoreVert from '@mui/icons-material/MoreVert'
|
|
12
|
-
import { CursorMouse, CursorMove } from './CursorIcon'
|
|
13
|
-
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
|
|
14
|
-
|
|
15
|
-
// locals
|
|
16
|
-
import { DotplotViewModel } from '../model'
|
|
17
|
-
import DotplotWarnings from './DotplotWarnings'
|
|
18
|
-
import PanButtons from './PanButtons'
|
|
19
|
-
|
|
20
|
-
const useStyles = makeStyles()({
|
|
21
|
-
iconButton: {
|
|
22
|
-
margin: 5,
|
|
23
|
-
},
|
|
24
|
-
bp: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
marginLeft: 10,
|
|
28
|
-
},
|
|
29
|
-
spacer: {
|
|
30
|
-
flexGrow: 1,
|
|
31
|
-
},
|
|
32
|
-
headerBar: {
|
|
33
|
-
display: 'flex',
|
|
34
|
-
position: 'relative',
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const DotplotControls = observer(({ model }: { model: DotplotViewModel }) => {
|
|
39
|
-
const { classes } = useStyles()
|
|
40
|
-
const [menuAnchorEl, setMenuAnchorEl] = useState<HTMLElement>()
|
|
41
|
-
return (
|
|
42
|
-
<div>
|
|
43
|
-
<IconButton onClick={model.zoomOutButton} className={classes.iconButton}>
|
|
44
|
-
<ZoomOut />
|
|
45
|
-
</IconButton>
|
|
46
|
-
|
|
47
|
-
<IconButton onClick={model.zoomInButton} className={classes.iconButton}>
|
|
48
|
-
<ZoomIn />
|
|
49
|
-
</IconButton>
|
|
50
|
-
|
|
51
|
-
<IconButton
|
|
52
|
-
onClick={() => model.activateTrackSelector()}
|
|
53
|
-
className={classes.iconButton}
|
|
54
|
-
title="Open track selector"
|
|
55
|
-
data-testid="circular_track_select"
|
|
56
|
-
>
|
|
57
|
-
<TrackSelectorIcon />
|
|
58
|
-
</IconButton>
|
|
59
|
-
|
|
60
|
-
<IconButton
|
|
61
|
-
onClick={event => setMenuAnchorEl(event.currentTarget)}
|
|
62
|
-
className={classes.iconButton}
|
|
63
|
-
>
|
|
64
|
-
<MoreVert />
|
|
65
|
-
</IconButton>
|
|
66
|
-
|
|
67
|
-
{menuAnchorEl ? (
|
|
68
|
-
<Menu
|
|
69
|
-
anchorEl={menuAnchorEl}
|
|
70
|
-
open
|
|
71
|
-
onMenuItemClick={(_event, callback) => {
|
|
72
|
-
callback()
|
|
73
|
-
setMenuAnchorEl(undefined)
|
|
74
|
-
}}
|
|
75
|
-
menuItems={[
|
|
76
|
-
{
|
|
77
|
-
onClick: () => model.squareView(),
|
|
78
|
-
label: 'Square view - same base pairs per pixel',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
onClick: () => model.squareViewProportional(),
|
|
82
|
-
label: 'Rectanglularize view - same total bp',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
onClick: () => model.showAllRegions(),
|
|
86
|
-
label: 'Show all regions',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
onClick: () => model.setDrawCigar(!model.drawCigar),
|
|
90
|
-
type: 'checkbox',
|
|
91
|
-
label: 'Draw CIGAR',
|
|
92
|
-
checked: model.drawCigar,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
onClick: () => model.setShowPanButtons(!model.showPanButtons),
|
|
96
|
-
label: 'Show pan buttons',
|
|
97
|
-
type: 'checkbox',
|
|
98
|
-
checked: model.showPanButtons,
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: 'Click and drag mode',
|
|
102
|
-
subMenu: [
|
|
103
|
-
{
|
|
104
|
-
onClick: () => model.setCursorMode('move'),
|
|
105
|
-
label: 'Pan by default, select region when ctrl key is held',
|
|
106
|
-
icon: CursorMove,
|
|
107
|
-
type: 'radio',
|
|
108
|
-
checked: model.cursorMode === 'move',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
onClick: () => model.setCursorMode('crosshair'),
|
|
112
|
-
label: 'Select region by default, pan when ctrl key is held',
|
|
113
|
-
icon: CursorMouse,
|
|
114
|
-
type: 'radio',
|
|
115
|
-
checked: model.cursorMode === 'crosshair',
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
label: 'Wheel scroll mode',
|
|
121
|
-
subMenu: [
|
|
122
|
-
{
|
|
123
|
-
onClick: () => model.setWheelMode('pan'),
|
|
124
|
-
label: 'Pans view',
|
|
125
|
-
type: 'radio',
|
|
126
|
-
checked: model.wheelMode === 'pan',
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
onClick: () => model.setWheelMode('zoom'),
|
|
130
|
-
label: 'Zooms view',
|
|
131
|
-
type: 'radio',
|
|
132
|
-
checked: model.wheelMode === 'zoom',
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
onClick: () => model.setWheelMode('none'),
|
|
136
|
-
label: 'Disable',
|
|
137
|
-
type: 'radio',
|
|
138
|
-
checked: model.wheelMode === 'none',
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
]}
|
|
143
|
-
onClose={() => setMenuAnchorEl(undefined)}
|
|
144
|
-
/>
|
|
145
|
-
) : null}
|
|
146
|
-
</div>
|
|
147
|
-
)
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
export default observer(function Header({
|
|
151
|
-
model,
|
|
152
|
-
selection,
|
|
153
|
-
}: {
|
|
154
|
-
model: DotplotViewModel
|
|
155
|
-
selection?: { width: number; height: number }
|
|
156
|
-
}) {
|
|
157
|
-
const { classes } = useStyles()
|
|
158
|
-
const { hview, vview, showPanButtons } = model
|
|
159
|
-
return (
|
|
160
|
-
<div className={classes.headerBar}>
|
|
161
|
-
<DotplotControls model={model} />
|
|
162
|
-
<Typography className={classes.bp} variant="body2" color="textSecondary">
|
|
163
|
-
x: {hview.assemblyNames.join(',')} {getBpDisplayStr(hview.currBp)}
|
|
164
|
-
<br />
|
|
165
|
-
y: {vview.assemblyNames.join(',')} {getBpDisplayStr(vview.currBp)}
|
|
166
|
-
</Typography>
|
|
167
|
-
{selection ? (
|
|
168
|
-
<Typography
|
|
169
|
-
className={classes.bp}
|
|
170
|
-
variant="body2"
|
|
171
|
-
color="textSecondary"
|
|
172
|
-
>
|
|
173
|
-
{`width:${getBpDisplayStr(hview.bpPerPx * selection.width)}`} <br />
|
|
174
|
-
{`height:${getBpDisplayStr(vview.bpPerPx * selection.height)}`}
|
|
175
|
-
</Typography>
|
|
176
|
-
) : null}
|
|
177
|
-
<div className={classes.spacer} />
|
|
178
|
-
<DotplotWarnings model={model} />
|
|
179
|
-
{showPanButtons ? <PanButtons model={model} /> : null}
|
|
180
|
-
</div>
|
|
181
|
-
)
|
|
182
|
-
})
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { SnapshotIn } from 'mobx-state-tree'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import {
|
|
5
|
-
FormControlLabel,
|
|
6
|
-
Grid,
|
|
7
|
-
Paper,
|
|
8
|
-
Radio,
|
|
9
|
-
RadioGroup,
|
|
10
|
-
Typography,
|
|
11
|
-
} from '@mui/material'
|
|
12
|
-
import { ErrorMessage, FileSelector } from '@jbrowse/core/ui'
|
|
13
|
-
import { FileLocation } from '@jbrowse/core/util/types'
|
|
14
|
-
import { observer } from 'mobx-react'
|
|
15
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
16
|
-
|
|
17
|
-
function getName(
|
|
18
|
-
sessionTrackData?: { uri: string } | { localPath: string } | { name: string },
|
|
19
|
-
) {
|
|
20
|
-
return sessionTrackData
|
|
21
|
-
? // @ts-expect-error
|
|
22
|
-
sessionTrackData.uri ||
|
|
23
|
-
// @ts-expect-error
|
|
24
|
-
sessionTrackData.localPath ||
|
|
25
|
-
// @ts-expect-error
|
|
26
|
-
sessionTrackData.name
|
|
27
|
-
: undefined
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function stripGz(fileName: string) {
|
|
31
|
-
return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getAdapter({
|
|
35
|
-
radioOption,
|
|
36
|
-
assembly1,
|
|
37
|
-
assembly2,
|
|
38
|
-
fileLocation,
|
|
39
|
-
bed1Location,
|
|
40
|
-
bed2Location,
|
|
41
|
-
}: {
|
|
42
|
-
radioOption: string
|
|
43
|
-
assembly1: string
|
|
44
|
-
assembly2: string
|
|
45
|
-
fileLocation?: FileLocation
|
|
46
|
-
bed1Location?: FileLocation
|
|
47
|
-
bed2Location?: FileLocation
|
|
48
|
-
}) {
|
|
49
|
-
if (radioOption === '.paf') {
|
|
50
|
-
return {
|
|
51
|
-
type: 'PAFAdapter',
|
|
52
|
-
pafLocation: fileLocation,
|
|
53
|
-
queryAssembly: assembly1,
|
|
54
|
-
targetAssembly: assembly2,
|
|
55
|
-
}
|
|
56
|
-
} else if (radioOption === '.out') {
|
|
57
|
-
return {
|
|
58
|
-
type: 'MashMapAdapter',
|
|
59
|
-
outLocation: fileLocation,
|
|
60
|
-
queryAssembly: assembly1,
|
|
61
|
-
targetAssembly: assembly2,
|
|
62
|
-
}
|
|
63
|
-
} else if (radioOption === '.delta') {
|
|
64
|
-
return {
|
|
65
|
-
type: 'DeltaAdapter',
|
|
66
|
-
deltaLocation: fileLocation,
|
|
67
|
-
queryAssembly: assembly1,
|
|
68
|
-
targetAssembly: assembly2,
|
|
69
|
-
}
|
|
70
|
-
} else if (radioOption === '.chain') {
|
|
71
|
-
return {
|
|
72
|
-
type: 'ChainAdapter',
|
|
73
|
-
chainLocation: fileLocation,
|
|
74
|
-
queryAssembly: assembly1,
|
|
75
|
-
targetAssembly: assembly2,
|
|
76
|
-
}
|
|
77
|
-
} else if (radioOption === '.anchors') {
|
|
78
|
-
return {
|
|
79
|
-
type: 'MCScanAnchorsAdapter',
|
|
80
|
-
mcscanAnchorsLocation: fileLocation,
|
|
81
|
-
bed1Location,
|
|
82
|
-
bed2Location,
|
|
83
|
-
assemblyNames: [assembly1, assembly2],
|
|
84
|
-
}
|
|
85
|
-
} else if (radioOption === '.anchors.simple') {
|
|
86
|
-
return {
|
|
87
|
-
type: 'MCScanSimpleAnchorsAdapter',
|
|
88
|
-
mcscanSimpleAnchorsLocation: fileLocation,
|
|
89
|
-
bed1Location,
|
|
90
|
-
bed2Location,
|
|
91
|
-
assemblyNames: [assembly1, assembly2],
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
throw new Error('Unknown type')
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
type Conf = SnapshotIn<AnyConfigurationModel>
|
|
99
|
-
|
|
100
|
-
const OpenTrack = observer(
|
|
101
|
-
({
|
|
102
|
-
sessionTrackData,
|
|
103
|
-
assembly1,
|
|
104
|
-
assembly2,
|
|
105
|
-
setSessionTrackData,
|
|
106
|
-
}: {
|
|
107
|
-
sessionTrackData: Conf
|
|
108
|
-
assembly1: string
|
|
109
|
-
assembly2: string
|
|
110
|
-
setSessionTrackData: (arg: Conf) => void
|
|
111
|
-
}) => {
|
|
112
|
-
const [bed2Location, setBed2Location] = useState<FileLocation>()
|
|
113
|
-
const [bed1Location, setBed1Location] = useState<FileLocation>()
|
|
114
|
-
const [fileLocation, setFileLocation] = useState<FileLocation>()
|
|
115
|
-
const [value, setValue] = useState('')
|
|
116
|
-
const [error, setError] = useState<unknown>()
|
|
117
|
-
const fileName = getName(fileLocation)
|
|
118
|
-
|
|
119
|
-
const radioOption =
|
|
120
|
-
value || (fileName ? path.extname(stripGz(fileName)) : '')
|
|
121
|
-
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
try {
|
|
124
|
-
if (fileLocation) {
|
|
125
|
-
const fn = fileName ? path.basename(fileName) : 'MyTrack'
|
|
126
|
-
const trackId = `${fn}-${Date.now()}`
|
|
127
|
-
setError(undefined)
|
|
128
|
-
|
|
129
|
-
setSessionTrackData({
|
|
130
|
-
trackId,
|
|
131
|
-
name: fn,
|
|
132
|
-
assemblyNames: [assembly2, assembly1],
|
|
133
|
-
type: 'SyntenyTrack',
|
|
134
|
-
adapter: getAdapter({
|
|
135
|
-
radioOption,
|
|
136
|
-
assembly1,
|
|
137
|
-
assembly2,
|
|
138
|
-
fileLocation,
|
|
139
|
-
bed1Location,
|
|
140
|
-
bed2Location,
|
|
141
|
-
}),
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
} catch (e) {
|
|
145
|
-
console.error(e)
|
|
146
|
-
setError(e)
|
|
147
|
-
}
|
|
148
|
-
}, [
|
|
149
|
-
fileName,
|
|
150
|
-
assembly1,
|
|
151
|
-
assembly2,
|
|
152
|
-
bed1Location,
|
|
153
|
-
bed2Location,
|
|
154
|
-
fileLocation,
|
|
155
|
-
radioOption,
|
|
156
|
-
setSessionTrackData,
|
|
157
|
-
])
|
|
158
|
-
return (
|
|
159
|
-
<Paper style={{ padding: 12 }}>
|
|
160
|
-
{error ? <ErrorMessage error={error} /> : null}
|
|
161
|
-
<Typography style={{ textAlign: 'center' }}>
|
|
162
|
-
Add a .paf, .out (MashMap), .delta (Mummer), .chain, .anchors or
|
|
163
|
-
.anchors.simple (MCScan) file to view in the dotplot. These file types
|
|
164
|
-
can also be gzipped. The first assembly should be the query sequence
|
|
165
|
-
(e.g. left column of the PAF) and the second assembly should be the
|
|
166
|
-
target sequence (e.g. right column of the PAF)
|
|
167
|
-
</Typography>
|
|
168
|
-
<RadioGroup
|
|
169
|
-
value={radioOption}
|
|
170
|
-
onChange={event => setValue(event.target.value)}
|
|
171
|
-
>
|
|
172
|
-
<Grid container justifyContent="center">
|
|
173
|
-
<Grid item>
|
|
174
|
-
<FormControlLabel value=".paf" control={<Radio />} label=".paf" />
|
|
175
|
-
</Grid>
|
|
176
|
-
<Grid item>
|
|
177
|
-
<FormControlLabel value=".out" control={<Radio />} label=".out" />
|
|
178
|
-
</Grid>
|
|
179
|
-
<Grid item>
|
|
180
|
-
<FormControlLabel
|
|
181
|
-
value=".delta"
|
|
182
|
-
control={<Radio />}
|
|
183
|
-
label=".delta"
|
|
184
|
-
/>
|
|
185
|
-
</Grid>
|
|
186
|
-
<Grid item>
|
|
187
|
-
<FormControlLabel
|
|
188
|
-
value=".chain"
|
|
189
|
-
control={<Radio />}
|
|
190
|
-
label=".chain"
|
|
191
|
-
/>
|
|
192
|
-
</Grid>
|
|
193
|
-
<Grid item>
|
|
194
|
-
<FormControlLabel
|
|
195
|
-
value=".anchors"
|
|
196
|
-
control={<Radio />}
|
|
197
|
-
label=".anchors"
|
|
198
|
-
/>
|
|
199
|
-
</Grid>
|
|
200
|
-
<Grid item>
|
|
201
|
-
<FormControlLabel
|
|
202
|
-
value=".anchors.simple"
|
|
203
|
-
control={<Radio />}
|
|
204
|
-
label=".anchors.simple"
|
|
205
|
-
/>
|
|
206
|
-
</Grid>
|
|
207
|
-
</Grid>
|
|
208
|
-
</RadioGroup>
|
|
209
|
-
<Grid container justifyContent="center">
|
|
210
|
-
<Grid item>
|
|
211
|
-
{value === '.anchors' || value === '.anchors.simple' ? (
|
|
212
|
-
<div>
|
|
213
|
-
<div style={{ margin: 20 }}>
|
|
214
|
-
Open the {value} and .bed files for both genome assemblies
|
|
215
|
-
from the MCScan (Python version) pipeline{' '}
|
|
216
|
-
<a href="https://github.com/tanghaibao/jcvi/wiki/MCscan-(Python-version)">
|
|
217
|
-
(more info)
|
|
218
|
-
</a>
|
|
219
|
-
</div>
|
|
220
|
-
<div style={{ display: 'flex' }}>
|
|
221
|
-
<div>
|
|
222
|
-
<FileSelector
|
|
223
|
-
name=".anchors file"
|
|
224
|
-
description=""
|
|
225
|
-
location={fileLocation}
|
|
226
|
-
setLocation={loc => setFileLocation(loc)}
|
|
227
|
-
/>
|
|
228
|
-
</div>
|
|
229
|
-
<div>
|
|
230
|
-
<FileSelector
|
|
231
|
-
name="genome 1 .bed (left column of anchors file)"
|
|
232
|
-
description=""
|
|
233
|
-
location={bed1Location}
|
|
234
|
-
setLocation={loc => setBed1Location(loc)}
|
|
235
|
-
/>
|
|
236
|
-
</div>
|
|
237
|
-
<div>
|
|
238
|
-
<FileSelector
|
|
239
|
-
name="genome 2 .bed (right column of anchors file)"
|
|
240
|
-
description=""
|
|
241
|
-
location={bed2Location}
|
|
242
|
-
setLocation={loc => setBed2Location(loc)}
|
|
243
|
-
/>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
) : (
|
|
248
|
-
<FileSelector
|
|
249
|
-
name={value ? value + ' location' : ''}
|
|
250
|
-
description=""
|
|
251
|
-
location={fileLocation}
|
|
252
|
-
setLocation={loc => setFileLocation(loc)}
|
|
253
|
-
/>
|
|
254
|
-
)}
|
|
255
|
-
</Grid>
|
|
256
|
-
</Grid>
|
|
257
|
-
</Paper>
|
|
258
|
-
)
|
|
259
|
-
},
|
|
260
|
-
)
|
|
261
|
-
|
|
262
|
-
export default OpenTrack
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
Container,
|
|
5
|
-
FormControl,
|
|
6
|
-
FormLabel,
|
|
7
|
-
FormControlLabel,
|
|
8
|
-
Grid,
|
|
9
|
-
Paper,
|
|
10
|
-
Radio,
|
|
11
|
-
RadioGroup,
|
|
12
|
-
Typography,
|
|
13
|
-
} from '@mui/material'
|
|
14
|
-
import { makeStyles } from 'tss-react/mui'
|
|
15
|
-
import { observer } from 'mobx-react'
|
|
16
|
-
import { transaction } from 'mobx'
|
|
17
|
-
import { SnapshotIn } from 'mobx-state-tree'
|
|
18
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
19
|
-
import { getSession, isSessionWithAddTracks } from '@jbrowse/core/util'
|
|
20
|
-
import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui'
|
|
21
|
-
|
|
22
|
-
// locals
|
|
23
|
-
import { DotplotViewModel } from '../model'
|
|
24
|
-
import ImportCustomTrack from './ImportCustomTrack'
|
|
25
|
-
import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector'
|
|
26
|
-
|
|
27
|
-
const useStyles = makeStyles()(theme => ({
|
|
28
|
-
importFormContainer: {
|
|
29
|
-
padding: theme.spacing(4),
|
|
30
|
-
margin: '0 auto',
|
|
31
|
-
},
|
|
32
|
-
assemblySelector: {
|
|
33
|
-
width: '75%',
|
|
34
|
-
margin: '0 auto',
|
|
35
|
-
},
|
|
36
|
-
}))
|
|
37
|
-
|
|
38
|
-
type Conf = SnapshotIn<AnyConfigurationModel>
|
|
39
|
-
|
|
40
|
-
function TrackSelector({
|
|
41
|
-
setSessionTrackData,
|
|
42
|
-
setShowTrackId,
|
|
43
|
-
sessionTrackData,
|
|
44
|
-
assembly1,
|
|
45
|
-
assembly2,
|
|
46
|
-
model,
|
|
47
|
-
}: {
|
|
48
|
-
sessionTrackData: Conf
|
|
49
|
-
setSessionTrackData: (arg: Conf) => void
|
|
50
|
-
setShowTrackId: (arg?: string) => void
|
|
51
|
-
model: DotplotViewModel
|
|
52
|
-
assembly1: string
|
|
53
|
-
assembly2: string
|
|
54
|
-
}) {
|
|
55
|
-
const [choice, setChoice] = useState('none')
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (choice === 'none') {
|
|
59
|
-
setSessionTrackData(undefined)
|
|
60
|
-
setShowTrackId(undefined)
|
|
61
|
-
}
|
|
62
|
-
}, [choice, setSessionTrackData, setShowTrackId])
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
<FormControl>
|
|
66
|
-
<FormLabel id="group-label">
|
|
67
|
-
(Optional) Select or add a synteny track
|
|
68
|
-
</FormLabel>
|
|
69
|
-
<RadioGroup
|
|
70
|
-
row
|
|
71
|
-
value={choice}
|
|
72
|
-
onChange={event => setChoice(event.target.value)}
|
|
73
|
-
aria-labelledby="group-label"
|
|
74
|
-
>
|
|
75
|
-
<FormControlLabel value="none" control={<Radio />} label="None" />
|
|
76
|
-
<FormControlLabel
|
|
77
|
-
value="tracklist"
|
|
78
|
-
control={<Radio />}
|
|
79
|
-
label="Existing track"
|
|
80
|
-
/>
|
|
81
|
-
<FormControlLabel
|
|
82
|
-
value="custom"
|
|
83
|
-
control={<Radio />}
|
|
84
|
-
label="New track"
|
|
85
|
-
/>
|
|
86
|
-
</RadioGroup>
|
|
87
|
-
</FormControl>
|
|
88
|
-
{choice === 'custom' ? (
|
|
89
|
-
<ImportCustomTrack
|
|
90
|
-
setSessionTrackData={setSessionTrackData}
|
|
91
|
-
sessionTrackData={sessionTrackData}
|
|
92
|
-
assembly2={assembly2}
|
|
93
|
-
assembly1={assembly1}
|
|
94
|
-
/>
|
|
95
|
-
) : null}
|
|
96
|
-
{choice === 'tracklist' ? (
|
|
97
|
-
<ImportSyntenyTrackSelector
|
|
98
|
-
model={model}
|
|
99
|
-
assembly1={assembly1}
|
|
100
|
-
assembly2={assembly2}
|
|
101
|
-
setShowTrackId={setShowTrackId}
|
|
102
|
-
/>
|
|
103
|
-
) : null}
|
|
104
|
-
</>
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const DotplotImportForm = observer(({ model }: { model: DotplotViewModel }) => {
|
|
109
|
-
const { classes } = useStyles()
|
|
110
|
-
const session = getSession(model)
|
|
111
|
-
const { assemblyNames } = session
|
|
112
|
-
const [assembly2, setAssembly2] = useState(assemblyNames[0] || '')
|
|
113
|
-
const [assembly1, setAssembly1] = useState(assemblyNames[0] || '')
|
|
114
|
-
const [error, setError] = useState<unknown>()
|
|
115
|
-
const [sessionTrackData, setSessionTrackData] = useState<Conf>()
|
|
116
|
-
const [showTrackId, setShowTrackId] = useState<string>()
|
|
117
|
-
|
|
118
|
-
function onOpenClick() {
|
|
119
|
-
try {
|
|
120
|
-
if (!isSessionWithAddTracks(session)) {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
setError(undefined)
|
|
124
|
-
model.setError(undefined)
|
|
125
|
-
transaction(() => {
|
|
126
|
-
if (sessionTrackData) {
|
|
127
|
-
session.addTrackConf(sessionTrackData)
|
|
128
|
-
model.toggleTrack(sessionTrackData.trackId)
|
|
129
|
-
} else if (showTrackId) {
|
|
130
|
-
model.showTrack(showTrackId)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
model.setViews([
|
|
134
|
-
{ bpPerPx: 0.1, offsetPx: 0 },
|
|
135
|
-
{ bpPerPx: 0.1, offsetPx: 0 },
|
|
136
|
-
])
|
|
137
|
-
model.setAssemblyNames(assembly2, assembly1)
|
|
138
|
-
})
|
|
139
|
-
} catch (e) {
|
|
140
|
-
console.error(e)
|
|
141
|
-
setError(e)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// this is a combination of any displayed error message we have
|
|
146
|
-
const displayError = error || model.error
|
|
147
|
-
return (
|
|
148
|
-
<Container className={classes.importFormContainer}>
|
|
149
|
-
{displayError ? <ErrorMessage error={displayError} /> : null}
|
|
150
|
-
<Grid
|
|
151
|
-
container
|
|
152
|
-
spacing={1}
|
|
153
|
-
justifyContent="center"
|
|
154
|
-
alignItems="center"
|
|
155
|
-
className={classes.assemblySelector}
|
|
156
|
-
>
|
|
157
|
-
<Grid item>
|
|
158
|
-
<Paper style={{ padding: 12 }}>
|
|
159
|
-
<Typography style={{ textAlign: 'center' }}>
|
|
160
|
-
Select assemblies for dotplot view
|
|
161
|
-
</Typography>
|
|
162
|
-
<Grid
|
|
163
|
-
container
|
|
164
|
-
spacing={1}
|
|
165
|
-
justifyContent="center"
|
|
166
|
-
alignItems="center"
|
|
167
|
-
>
|
|
168
|
-
<Grid item>
|
|
169
|
-
<AssemblySelector
|
|
170
|
-
selected={assembly1}
|
|
171
|
-
onChange={val => setAssembly1(val)}
|
|
172
|
-
session={session}
|
|
173
|
-
/>
|
|
174
|
-
</Grid>
|
|
175
|
-
<Grid item>
|
|
176
|
-
<AssemblySelector
|
|
177
|
-
selected={assembly2}
|
|
178
|
-
onChange={val => setAssembly2(val)}
|
|
179
|
-
session={session}
|
|
180
|
-
/>
|
|
181
|
-
</Grid>
|
|
182
|
-
<Grid item>
|
|
183
|
-
<FormControl>
|
|
184
|
-
<Button
|
|
185
|
-
onClick={onOpenClick}
|
|
186
|
-
variant="contained"
|
|
187
|
-
color="primary"
|
|
188
|
-
>
|
|
189
|
-
Launch
|
|
190
|
-
</Button>
|
|
191
|
-
</FormControl>
|
|
192
|
-
</Grid>
|
|
193
|
-
</Grid>
|
|
194
|
-
</Paper>
|
|
195
|
-
<TrackSelector
|
|
196
|
-
setShowTrackId={setShowTrackId}
|
|
197
|
-
assembly2={assembly2}
|
|
198
|
-
assembly1={assembly1}
|
|
199
|
-
setSessionTrackData={setSessionTrackData}
|
|
200
|
-
sessionTrackData={sessionTrackData}
|
|
201
|
-
model={model}
|
|
202
|
-
/>
|
|
203
|
-
</Grid>
|
|
204
|
-
</Grid>
|
|
205
|
-
</Container>
|
|
206
|
-
)
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
export default DotplotImportForm
|