react-msaview 1.3.1 → 2.0.0
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/bundle/index.js +283 -97265
- package/dist/StructureModel.d.ts +9 -0
- package/dist/StructureModel.js +11 -0
- package/dist/StructureModel.js.map +1 -0
- package/dist/UniprotTrack.d.ts +27 -0
- package/dist/UniprotTrack.js +52 -0
- package/dist/UniprotTrack.js.map +1 -0
- package/dist/colorSchemes.d.ts +2 -2
- package/dist/colorSchemes.js +24 -29
- package/dist/colorSchemes.js.map +1 -0
- package/dist/components/AboutDlg.d.ts +0 -1
- package/dist/components/AboutDlg.js +38 -48
- package/dist/components/AboutDlg.js.map +1 -0
- package/dist/components/AddTrackDlg.d.ts +0 -1
- package/dist/components/AddTrackDlg.js +13 -13
- package/dist/components/AddTrackDlg.js.map +1 -0
- package/dist/components/AnnotationDlg.d.ts +0 -1
- package/dist/components/AnnotationDlg.js +36 -48
- package/dist/components/AnnotationDlg.js.map +1 -0
- package/dist/components/BoxTrack.d.ts +3 -4
- package/dist/components/BoxTrack.js +51 -48
- package/dist/components/BoxTrack.js.map +1 -0
- package/dist/components/DetailsDlg.d.ts +0 -1
- package/dist/components/DetailsDlg.js +7 -7
- package/dist/components/DetailsDlg.js.map +1 -0
- package/dist/components/Header.d.ts +0 -1
- package/dist/components/Header.js +39 -34
- package/dist/components/Header.js.map +1 -0
- package/dist/components/ImportForm.d.ts +0 -1
- package/dist/components/ImportForm.js +59 -71
- package/dist/components/ImportForm.js.map +1 -0
- package/dist/components/MSACanvas.d.ts +0 -1
- package/dist/components/MSACanvas.js +71 -74
- package/dist/components/MSACanvas.js.map +1 -0
- package/dist/components/MSAView.d.ts +0 -1
- package/dist/components/MSAView.js +19 -38
- package/dist/components/MSAView.js.map +1 -0
- package/dist/components/MoreInfoDlg.d.ts +2 -3
- package/dist/components/MoreInfoDlg.js +5 -5
- package/dist/components/MoreInfoDlg.js.map +1 -0
- package/dist/components/ResizeHandles.d.ts +2 -3
- package/dist/components/ResizeHandles.js +31 -32
- package/dist/components/ResizeHandles.js.map +1 -0
- package/dist/components/Rubberband.d.ts +2 -1
- package/dist/components/Rubberband.js +42 -64
- package/dist/components/Rubberband.js.map +1 -0
- package/dist/components/Ruler.d.ts +0 -15
- package/dist/components/Ruler.js +18 -87
- package/dist/components/Ruler.js.map +1 -0
- package/dist/components/SettingsDlg.d.ts +0 -1
- package/dist/components/SettingsDlg.js +29 -22
- package/dist/components/SettingsDlg.js.map +1 -0
- package/dist/components/TextTrack.d.ts +3 -4
- package/dist/components/TextTrack.js +23 -24
- package/dist/components/TextTrack.js.map +1 -0
- package/dist/components/Track.d.ts +2 -3
- package/dist/components/Track.js +38 -38
- package/dist/components/Track.js.map +1 -0
- package/dist/components/TrackInfoDlg.d.ts +5 -3
- package/dist/components/TrackInfoDlg.js +12 -13
- package/dist/components/TrackInfoDlg.js.map +1 -0
- package/dist/components/TracklistDlg.d.ts +0 -1
- package/dist/components/TracklistDlg.js +9 -9
- package/dist/components/TracklistDlg.js.map +1 -0
- package/dist/components/TreeCanvas.d.ts +0 -1
- package/dist/components/TreeCanvas.js +135 -148
- package/dist/components/TreeCanvas.js.map +1 -0
- package/dist/components/TreeRuler.d.ts +0 -1
- package/dist/components/TreeRuler.js +3 -3
- package/dist/components/TreeRuler.js.map +1 -0
- package/dist/components/VerticalGuide.d.ts +6 -0
- package/dist/components/VerticalGuide.js +30 -0
- package/dist/components/VerticalGuide.js.map +1 -0
- package/dist/components/data/seq2.d.ts +3 -3
- package/dist/components/data/seq2.js +33 -3
- package/dist/components/data/seq2.js.map +1 -0
- package/{bundle/components/Ruler.d.ts → dist/components/util.d.ts} +1 -6
- package/dist/components/util.js +69 -0
- package/dist/components/util.js.map +1 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -0
- package/dist/layout.js +14 -20
- package/dist/layout.js.map +1 -0
- package/dist/model.d.ts +94 -74
- package/dist/model.js +232 -473
- package/dist/model.js.map +1 -0
- package/dist/parseNewick.d.ts +1 -5
- package/dist/parseNewick.js +10 -7
- package/dist/parseNewick.js.map +1 -0
- package/dist/parsers/ClustalMSA.d.ts +6 -18
- package/dist/parsers/ClustalMSA.js +55 -64
- package/dist/parsers/ClustalMSA.js.map +1 -0
- package/dist/parsers/FastaMSA.d.ts +4 -9
- package/dist/parsers/FastaMSA.js +55 -64
- package/dist/parsers/FastaMSA.js.map +1 -0
- package/dist/parsers/StockholmMSA.d.ts +8 -13
- package/dist/parsers/StockholmMSA.js +78 -107
- package/dist/parsers/StockholmMSA.js.map +1 -0
- package/dist/util.d.ts +33 -4
- package/dist/util.js +76 -24
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +30 -30
- package/src/StructureModel.ts +11 -0
- package/src/UniprotTrack.ts +60 -0
- package/src/colorSchemes.ts +520 -0
- package/src/components/AboutDlg.tsx +64 -0
- package/src/components/AddTrackDlg.tsx +74 -0
- package/src/components/AnnotationDlg.tsx +144 -0
- package/src/components/BoxTrack.tsx +225 -0
- package/src/components/DetailsDlg.tsx +28 -0
- package/src/components/Header.tsx +117 -0
- package/src/components/ImportForm.tsx +192 -0
- package/src/components/MSACanvas.tsx +297 -0
- package/src/components/MSAView.tsx +132 -0
- package/src/components/MoreInfoDlg.tsx +21 -0
- package/src/components/ResizeHandles.tsx +137 -0
- package/src/components/Rubberband.tsx +271 -0
- package/src/components/Ruler.tsx +122 -0
- package/src/components/SettingsDlg.tsx +154 -0
- package/src/components/TextTrack.tsx +120 -0
- package/src/components/Track.tsx +150 -0
- package/src/components/TrackInfoDlg.tsx +59 -0
- package/src/components/TracklistDlg.tsx +61 -0
- package/src/components/TreeCanvas.tsx +633 -0
- package/src/components/TreeRuler.tsx +12 -0
- package/src/components/VerticalGuide.tsx +50 -0
- package/src/components/data/seq2.ts +35 -0
- package/src/components/util.ts +94 -0
- package/src/declare.d.ts +2 -0
- package/src/index.ts +2 -0
- package/src/layout.ts +83 -0
- package/src/model.ts +790 -0
- package/{bundle/parseNewick.d.ts → src/parseNewick.ts} +36 -5
- package/src/parsers/ClustalMSA.ts +79 -0
- package/src/parsers/FastaMSA.ts +82 -0
- package/src/parsers/StockholmMSA.ts +137 -0
- package/src/util.ts +142 -0
- package/src/version.ts +1 -0
- package/bundle/colorSchemes.d.ts +0 -16
- package/bundle/colorSchemes.js +0 -455
- package/bundle/components/AboutDlg.d.ts +0 -5
- package/bundle/components/AboutDlg.js +0 -47
- package/bundle/components/AddTrackDlg.d.ts +0 -8
- package/bundle/components/AddTrackDlg.js +0 -26
- package/bundle/components/AnnotationDlg.d.ts +0 -11
- package/bundle/components/AnnotationDlg.js +0 -77
- package/bundle/components/BoxTrack.d.ts +0 -7
- package/bundle/components/BoxTrack.js +0 -143
- package/bundle/components/DetailsDlg.d.ts +0 -8
- package/bundle/components/DetailsDlg.js +0 -12
- package/bundle/components/Header.d.ts +0 -6
- package/bundle/components/Header.js +0 -63
- package/bundle/components/ImportForm.d.ts +0 -6
- package/bundle/components/ImportForm.js +0 -89
- package/bundle/components/MSACanvas.d.ts +0 -6
- package/bundle/components/MSACanvas.js +0 -210
- package/bundle/components/MSAView.d.ts +0 -6
- package/bundle/components/MSAView.js +0 -88
- package/bundle/components/MoreInfoDlg.d.ts +0 -6
- package/bundle/components/MoreInfoDlg.js +0 -11
- package/bundle/components/ResizeHandles.d.ts +0 -8
- package/bundle/components/ResizeHandles.js +0 -110
- package/bundle/components/Rubberband.d.ts +0 -7
- package/bundle/components/Rubberband.js +0 -196
- package/bundle/components/Ruler.js +0 -121
- package/bundle/components/SettingsDlg.d.ts +0 -8
- package/bundle/components/SettingsDlg.js +0 -40
- package/bundle/components/TextTrack.d.ts +0 -7
- package/bundle/components/TextTrack.js +0 -72
- package/bundle/components/Track.d.ts +0 -11
- package/bundle/components/Track.js +0 -81
- package/bundle/components/TrackInfoDlg.d.ts +0 -6
- package/bundle/components/TrackInfoDlg.js +0 -33
- package/bundle/components/TracklistDlg.d.ts +0 -8
- package/bundle/components/TracklistDlg.js +0 -18
- package/bundle/components/TreeCanvas.d.ts +0 -6
- package/bundle/components/TreeCanvas.js +0 -431
- package/bundle/components/TreeRuler.d.ts +0 -6
- package/bundle/components/TreeRuler.js +0 -8
- package/bundle/components/data/seq2.d.ts +0 -3
- package/bundle/components/data/seq2.js +0 -3
- package/bundle/index.d.ts +0 -4
- package/bundle/layout.d.ts +0 -23
- package/bundle/layout.js +0 -53
- package/bundle/model.d.ts +0 -364
- package/bundle/model.js +0 -894
- package/bundle/parseNewick.js +0 -94
- package/bundle/parsers/ClustalMSA.d.ts +0 -39
- package/bundle/parsers/ClustalMSA.js +0 -77
- package/bundle/parsers/FastaMSA.d.ts +0 -26
- package/bundle/parsers/FastaMSA.js +0 -78
- package/bundle/parsers/StockholmMSA.d.ts +0 -75
- package/bundle/parsers/StockholmMSA.js +0 -142
- package/bundle/util.d.ts +0 -17
- package/bundle/util.js +0 -33
- package/dist/components/package.json +0 -62
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react'
|
|
2
|
+
import normalizeWheel from 'normalize-wheel'
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
import { IconButton, Menu, MenuItem } from '@mui/material'
|
|
5
|
+
import { makeStyles } from 'tss-react/mui'
|
|
6
|
+
|
|
7
|
+
// icons
|
|
8
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
|
|
9
|
+
|
|
10
|
+
// locals
|
|
11
|
+
import { MsaViewModel } from '../model'
|
|
12
|
+
import TrackInfoDialog from './TrackInfoDlg'
|
|
13
|
+
|
|
14
|
+
const useStyles = makeStyles()({
|
|
15
|
+
button: {
|
|
16
|
+
padding: 0,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const TrackLabel = observer(function ({
|
|
21
|
+
model,
|
|
22
|
+
track,
|
|
23
|
+
}: {
|
|
24
|
+
model: MsaViewModel
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
track: any
|
|
27
|
+
}) {
|
|
28
|
+
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>()
|
|
29
|
+
const [trackInfoDlgOpen, setTrackInfoDlgOpen] = useState(false)
|
|
30
|
+
const { rowHeight, treeAreaWidth: width } = model
|
|
31
|
+
const {
|
|
32
|
+
height,
|
|
33
|
+
model: { name },
|
|
34
|
+
} = track
|
|
35
|
+
const { classes } = useStyles()
|
|
36
|
+
const trackLabelHeight = Math.max(8, rowHeight - 8)
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
width,
|
|
42
|
+
height,
|
|
43
|
+
flexShrink: 0,
|
|
44
|
+
textAlign: 'right',
|
|
45
|
+
fontSize: trackLabelHeight,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{name}{' '}
|
|
49
|
+
<IconButton
|
|
50
|
+
className={classes.button}
|
|
51
|
+
style={{
|
|
52
|
+
width: trackLabelHeight,
|
|
53
|
+
height: trackLabelHeight,
|
|
54
|
+
}}
|
|
55
|
+
onClick={event => setAnchorEl(event.currentTarget)}
|
|
56
|
+
>
|
|
57
|
+
<ArrowDropDownIcon />
|
|
58
|
+
</IconButton>
|
|
59
|
+
{anchorEl ? (
|
|
60
|
+
<Menu
|
|
61
|
+
anchorEl={anchorEl}
|
|
62
|
+
transitionDuration={0}
|
|
63
|
+
open
|
|
64
|
+
onClose={() => setAnchorEl(undefined)}
|
|
65
|
+
>
|
|
66
|
+
<MenuItem
|
|
67
|
+
dense
|
|
68
|
+
onClick={() => {
|
|
69
|
+
model.toggleTrack(track.model.id)
|
|
70
|
+
setAnchorEl(undefined)
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
Close
|
|
74
|
+
</MenuItem>
|
|
75
|
+
<MenuItem
|
|
76
|
+
dense
|
|
77
|
+
onClick={() => {
|
|
78
|
+
setTrackInfoDlgOpen(true)
|
|
79
|
+
setAnchorEl(undefined)
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
Get info
|
|
83
|
+
</MenuItem>
|
|
84
|
+
</Menu>
|
|
85
|
+
) : null}
|
|
86
|
+
{trackInfoDlgOpen ? (
|
|
87
|
+
<TrackInfoDialog
|
|
88
|
+
model={track.model}
|
|
89
|
+
onClose={() => setTrackInfoDlgOpen(false)}
|
|
90
|
+
/>
|
|
91
|
+
) : null}
|
|
92
|
+
</div>
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const Track = observer(function ({
|
|
97
|
+
model,
|
|
98
|
+
track,
|
|
99
|
+
}: {
|
|
100
|
+
model: MsaViewModel
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
track: any
|
|
103
|
+
}) {
|
|
104
|
+
const { resizeHandleWidth } = model
|
|
105
|
+
const {
|
|
106
|
+
model: { height, error },
|
|
107
|
+
} = track
|
|
108
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
109
|
+
const scheduled = useRef(false)
|
|
110
|
+
const deltaX = useRef(0)
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
const curr = ref.current
|
|
113
|
+
if (!curr) {
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
function onWheel(origEvent: WheelEvent) {
|
|
117
|
+
const event = normalizeWheel(origEvent)
|
|
118
|
+
deltaX.current += event.pixelX
|
|
119
|
+
|
|
120
|
+
if (!scheduled.current) {
|
|
121
|
+
scheduled.current = true
|
|
122
|
+
requestAnimationFrame(() => {
|
|
123
|
+
model.doScrollX(-deltaX.current)
|
|
124
|
+
deltaX.current = 0
|
|
125
|
+
scheduled.current = false
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
origEvent.preventDefault()
|
|
129
|
+
}
|
|
130
|
+
curr.addEventListener('wheel', onWheel)
|
|
131
|
+
return () => {
|
|
132
|
+
curr.removeEventListener('wheel', onWheel)
|
|
133
|
+
}
|
|
134
|
+
}, [model])
|
|
135
|
+
return (
|
|
136
|
+
<div key={track.id} style={{ display: 'flex', height }}>
|
|
137
|
+
<TrackLabel model={model} track={track} />
|
|
138
|
+
<div style={{ width: resizeHandleWidth, flexShrink: 0 }} />
|
|
139
|
+
<div ref={ref}>
|
|
140
|
+
{error ? (
|
|
141
|
+
<div style={{ color: 'red', fontSize: 10 }}>{`${error}`}</div>
|
|
142
|
+
) : (
|
|
143
|
+
<track.ReactComponent model={model} track={track} />
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
export default Track
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import copy from 'copy-to-clipboard'
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
4
|
+
import { Dialog } from '@jbrowse/core/ui'
|
|
5
|
+
import { Button, DialogActions, DialogContent } from '@mui/material'
|
|
6
|
+
import { makeStyles } from 'tss-react/mui'
|
|
7
|
+
|
|
8
|
+
const useStyles = makeStyles()(theme => ({
|
|
9
|
+
textArea: {
|
|
10
|
+
padding: theme.spacing(2),
|
|
11
|
+
overflow: 'auto',
|
|
12
|
+
background: '#ddd',
|
|
13
|
+
wordBreak: 'break-word',
|
|
14
|
+
},
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
const TrackInfoDialog = observer(function ({
|
|
18
|
+
model,
|
|
19
|
+
onClose,
|
|
20
|
+
}: {
|
|
21
|
+
model: { name: string; data: string }
|
|
22
|
+
onClose: () => void
|
|
23
|
+
}) {
|
|
24
|
+
const [label, setLabel] = useState('Copy to clipboard')
|
|
25
|
+
const { classes } = useStyles()
|
|
26
|
+
return (
|
|
27
|
+
<Dialog
|
|
28
|
+
open
|
|
29
|
+
onClose={onClose}
|
|
30
|
+
fullWidth
|
|
31
|
+
maxWidth="lg"
|
|
32
|
+
title={`Track info - ${model.name}`}
|
|
33
|
+
>
|
|
34
|
+
<DialogContent>
|
|
35
|
+
<Button
|
|
36
|
+
variant="contained"
|
|
37
|
+
color="primary"
|
|
38
|
+
onClick={() => {
|
|
39
|
+
copy(model.data)
|
|
40
|
+
setLabel('Copied!')
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
setLabel('Copy to clipboard')
|
|
43
|
+
}, 300)
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{label}
|
|
47
|
+
</Button>
|
|
48
|
+
<pre className={classes.textArea}>{model.data}</pre>
|
|
49
|
+
</DialogContent>
|
|
50
|
+
<DialogActions>
|
|
51
|
+
<Button variant="contained" onClick={onClose} color="secondary">
|
|
52
|
+
Close
|
|
53
|
+
</Button>
|
|
54
|
+
</DialogActions>
|
|
55
|
+
</Dialog>
|
|
56
|
+
)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export default TrackInfoDialog
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Dialog } from '@jbrowse/core/ui'
|
|
3
|
+
import {
|
|
4
|
+
DialogContent,
|
|
5
|
+
FormControlLabel,
|
|
6
|
+
FormGroup,
|
|
7
|
+
Checkbox,
|
|
8
|
+
DialogActions,
|
|
9
|
+
Button,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@mui/material'
|
|
12
|
+
import { observer } from 'mobx-react'
|
|
13
|
+
|
|
14
|
+
// locals
|
|
15
|
+
import { MsaViewModel } from '../model'
|
|
16
|
+
|
|
17
|
+
export default observer(function ({
|
|
18
|
+
model,
|
|
19
|
+
onClose,
|
|
20
|
+
open,
|
|
21
|
+
}: {
|
|
22
|
+
model: MsaViewModel
|
|
23
|
+
onClose: () => void
|
|
24
|
+
open: boolean
|
|
25
|
+
}) {
|
|
26
|
+
const { tracks } = model
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Dialog onClose={() => onClose()} open={open} title="Add track">
|
|
30
|
+
<DialogContent>
|
|
31
|
+
<Typography>
|
|
32
|
+
Open relevant per-alignment tracks e.g. protein domains
|
|
33
|
+
</Typography>
|
|
34
|
+
|
|
35
|
+
<FormGroup>
|
|
36
|
+
{tracks.map(track => {
|
|
37
|
+
return (
|
|
38
|
+
<FormControlLabel
|
|
39
|
+
key={track.model.id}
|
|
40
|
+
control={
|
|
41
|
+
<Checkbox
|
|
42
|
+
checked={!model.turnedOffTracks.has(track.model.id)}
|
|
43
|
+
onChange={() => {
|
|
44
|
+
model.toggleTrack(track.model.id)
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
}
|
|
48
|
+
label={track.model.name}
|
|
49
|
+
/>
|
|
50
|
+
)
|
|
51
|
+
})}
|
|
52
|
+
</FormGroup>
|
|
53
|
+
<DialogActions>
|
|
54
|
+
<Button onClick={() => onClose()} variant="contained" color="primary">
|
|
55
|
+
Close
|
|
56
|
+
</Button>
|
|
57
|
+
</DialogActions>
|
|
58
|
+
</DialogContent>
|
|
59
|
+
</Dialog>
|
|
60
|
+
)
|
|
61
|
+
})
|