@jbrowse/plugin-linear-genome-view 2.4.1 → 2.5.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/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -4
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +8 -43
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/dist/BaseLinearDisplay/components/TooLargeMessage.d.ts +3 -4
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js +9 -9
- package/dist/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Tooltip.d.ts +0 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +81 -35
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +105 -143
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/configSchema.d.ts +35 -1
- package/dist/BaseLinearDisplay/models/configSchema.js +9 -0
- package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +10 -6
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/BaseLinearDisplay/models/util.d.ts +8 -0
- package/dist/BaseLinearDisplay/models/util.js +33 -1
- package/dist/BaseLinearDisplay/models/util.js.map +1 -1
- package/dist/BasicTrack/configSchema.d.ts +73 -1
- package/dist/FeatureTrack/configSchema.d.ts +75 -1
- package/dist/LinearBareDisplay/configSchema.d.ts +28 -1
- package/dist/LinearBareDisplay/index.js +1 -0
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +66 -23
- package/dist/LinearBareDisplay/model.js +2 -2
- package/dist/LinearBareDisplay/model.js.map +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -2
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +2 -5
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/dist/LinearBasicDisplay/configSchema.d.ts +28 -1
- package/dist/LinearBasicDisplay/configSchema.js +0 -9
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
- package/dist/LinearBasicDisplay/index.js +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +76 -36
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/CenterLine.d.ts +0 -1
- package/dist/LinearGenomeView/components/Cytobands.d.ts +22 -23
- package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.js +14 -16
- package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/Gridlines.d.ts +0 -1
- package/dist/LinearGenomeView/components/Header.d.ts +0 -1
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/ImportForm.d.ts +0 -1
- package/dist/LinearGenomeView/components/ImportForm.js +4 -7
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +0 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +0 -4
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/dist/LinearGenomeView/components/MiniControls.d.ts +0 -1
- package/dist/LinearGenomeView/components/OverviewScalebar.js +2 -1
- package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +53 -52
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchBox.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +5 -3
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +6 -82
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchResultsTable.d.ts +8 -0
- package/dist/LinearGenomeView/components/SearchResultsTable.js +83 -0
- package/dist/LinearGenomeView/components/SearchResultsTable.js.map +1 -0
- package/dist/LinearGenomeView/components/SequenceSearchDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +0 -1
- package/dist/LinearGenomeView/components/TrackContainer.js +8 -2
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +5 -7
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/VerticalGuide.d.ts +0 -1
- package/dist/LinearGenomeView/components/ZoomControls.d.ts +0 -1
- package/dist/LinearGenomeView/components/util.js +1 -1
- package/dist/LinearGenomeView/components/util.js.map +1 -1
- package/dist/LinearGenomeView/model.d.ts +49 -36
- package/dist/LinearGenomeView/model.js +121 -198
- package/dist/LinearGenomeView/model.js.map +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +0 -1
- package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +0 -1
- package/dist/LinearGenomeView/util.d.ts +29 -0
- package/dist/LinearGenomeView/util.js +79 -1
- package/dist/LinearGenomeView/util.js.map +1 -1
- package/dist/index.d.ts +201 -106
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -4
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +8 -20
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +3 -4
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js +9 -9
- package/esm/BaseLinearDisplay/components/TooLargeMessage.js.map +1 -1
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +0 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +81 -35
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +105 -143
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/configSchema.d.ts +35 -1
- package/esm/BaseLinearDisplay/models/configSchema.js +9 -0
- package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +10 -6
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/BaseLinearDisplay/models/util.d.ts +8 -0
- package/esm/BaseLinearDisplay/models/util.js +30 -0
- package/esm/BaseLinearDisplay/models/util.js.map +1 -1
- package/esm/BasicTrack/configSchema.d.ts +73 -1
- package/esm/FeatureTrack/configSchema.d.ts +75 -1
- package/esm/LinearBareDisplay/configSchema.d.ts +28 -1
- package/esm/LinearBareDisplay/index.js +1 -0
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +66 -23
- package/esm/LinearBareDisplay/model.js +1 -1
- package/esm/LinearBareDisplay/model.js.map +1 -1
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -2
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +2 -5
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/esm/LinearBasicDisplay/configSchema.d.ts +28 -1
- package/esm/LinearBasicDisplay/configSchema.js +0 -9
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -1
- package/esm/LinearBasicDisplay/index.js +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +76 -36
- package/esm/LinearBasicDisplay/model.js.map +1 -1
- package/esm/LinearGenomeView/components/CenterLine.d.ts +0 -1
- package/esm/LinearGenomeView/components/Cytobands.d.ts +22 -23
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +0 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +0 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.js +15 -17
- package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/Gridlines.d.ts +0 -1
- package/esm/LinearGenomeView/components/Header.d.ts +0 -1
- package/esm/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/esm/LinearGenomeView/components/ImportForm.d.ts +0 -1
- package/esm/LinearGenomeView/components/ImportForm.js +5 -8
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +0 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +0 -4
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/esm/LinearGenomeView/components/MiniControls.d.ts +0 -1
- package/esm/LinearGenomeView/components/OverviewScalebar.js +2 -1
- package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +53 -52
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +0 -1
- package/esm/LinearGenomeView/components/SearchBox.d.ts +0 -1
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +5 -3
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +7 -83
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +8 -0
- package/esm/LinearGenomeView/components/SearchResultsTable.js +77 -0
- package/esm/LinearGenomeView/components/SearchResultsTable.js.map +1 -0
- package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +0 -1
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +0 -1
- package/esm/LinearGenomeView/components/TrackContainer.js +8 -2
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.js +5 -7
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/VerticalGuide.d.ts +0 -1
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +0 -1
- package/esm/LinearGenomeView/components/util.js +1 -1
- package/esm/LinearGenomeView/components/util.js.map +1 -1
- package/esm/LinearGenomeView/model.d.ts +49 -36
- package/esm/LinearGenomeView/model.js +122 -199
- package/esm/LinearGenomeView/model.js.map +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +0 -1
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +0 -1
- package/esm/LinearGenomeView/util.d.ts +29 -0
- package/esm/LinearGenomeView/util.js +76 -0
- package/esm/LinearGenomeView/util.js.map +1 -1
- package/esm/index.d.ts +201 -106
- package/package.json +3 -3
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +8 -28
- package/src/BaseLinearDisplay/components/TooLargeMessage.tsx +13 -11
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +148 -197
- package/src/BaseLinearDisplay/models/configSchema.ts +10 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +19 -13
- package/src/BaseLinearDisplay/models/util.ts +43 -0
- package/src/LinearBareDisplay/index.ts +1 -0
- package/src/LinearBareDisplay/model.ts +1 -1
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +3 -7
- package/src/LinearBasicDisplay/configSchema.ts +0 -10
- package/src/LinearBasicDisplay/index.ts +1 -1
- package/src/LinearBasicDisplay/model.ts +1 -1
- package/src/LinearGenomeView/components/GetSequenceDialog.tsx +15 -25
- package/src/LinearGenomeView/components/ImportForm.tsx +4 -14
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +0 -14
- package/src/LinearGenomeView/components/OverviewScalebar.tsx +2 -1
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +122 -82
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +17 -112
- package/src/LinearGenomeView/components/SearchResultsTable.tsx +121 -0
- package/src/LinearGenomeView/components/TrackContainer.tsx +12 -3
- package/src/LinearGenomeView/components/TracksContainer.tsx +9 -6
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +11 -11
- package/src/LinearGenomeView/components/util.ts +2 -1
- package/src/LinearGenomeView/index.test.ts +10 -12
- package/src/LinearGenomeView/model.ts +163 -236
- package/src/LinearGenomeView/util.ts +98 -0
|
@@ -1,143 +1,48 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { resolveIdentifier, getRoot } from 'mobx-state-tree'
|
|
3
|
-
import { getSession, getEnv } from '@jbrowse/core/util'
|
|
4
2
|
import { Dialog } from '@jbrowse/core/ui'
|
|
5
3
|
import {
|
|
6
4
|
Button,
|
|
7
5
|
DialogActions,
|
|
8
6
|
DialogContent,
|
|
9
7
|
Divider,
|
|
10
|
-
Paper,
|
|
11
|
-
Table,
|
|
12
|
-
TableBody,
|
|
13
|
-
TableCell,
|
|
14
|
-
TableContainer,
|
|
15
|
-
TableHead,
|
|
16
|
-
TableRow,
|
|
17
8
|
Typography,
|
|
18
9
|
} from '@mui/material'
|
|
19
10
|
|
|
20
11
|
import { LinearGenomeViewModel } from '../..'
|
|
12
|
+
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
13
|
+
import SearchResultsTable from './SearchResultsTable'
|
|
21
14
|
|
|
22
15
|
export default function SearchResultsDialog({
|
|
23
16
|
model,
|
|
24
|
-
|
|
17
|
+
assemblyName,
|
|
18
|
+
searchQuery,
|
|
19
|
+
searchResults,
|
|
25
20
|
handleClose,
|
|
26
21
|
}: {
|
|
27
22
|
model: LinearGenomeViewModel
|
|
28
|
-
|
|
23
|
+
assemblyName?: string
|
|
24
|
+
searchQuery: string
|
|
25
|
+
searchResults?: BaseResult[]
|
|
29
26
|
handleClose: () => void
|
|
30
27
|
}) {
|
|
31
|
-
const session = getSession(model)
|
|
32
|
-
const { pluginManager } = getEnv(session)
|
|
33
|
-
const { assemblyManager } = session
|
|
34
|
-
let assemblyName = optAssemblyName
|
|
35
|
-
if (model.displayedRegions.length > 0) {
|
|
36
|
-
assemblyName = model.displayedRegions[0]?.assemblyName
|
|
37
|
-
}
|
|
38
|
-
if (!assemblyName) {
|
|
39
|
-
throw new Error(`Assembly name not found`)
|
|
40
|
-
}
|
|
41
|
-
const assembly = assemblyManager.get(assemblyName)
|
|
42
|
-
if (!assembly) {
|
|
43
|
-
throw new Error(`assembly ${assemblyName} not found`)
|
|
44
|
-
}
|
|
45
|
-
if (!assembly.regions) {
|
|
46
|
-
throw new Error(`assembly ${assemblyName} regions not loaded`)
|
|
47
|
-
}
|
|
48
|
-
const assemblyRegions = assembly.regions
|
|
49
|
-
|
|
50
|
-
async function handleClick(location: string) {
|
|
51
|
-
try {
|
|
52
|
-
const newRegion = assemblyRegions.find(
|
|
53
|
-
region => location === region.refName,
|
|
54
|
-
)
|
|
55
|
-
if (newRegion) {
|
|
56
|
-
model.setDisplayedRegions([newRegion])
|
|
57
|
-
// we use showAllRegions after setDisplayedRegions to make the entire
|
|
58
|
-
// region visible, xref #1703
|
|
59
|
-
model.showAllRegions()
|
|
60
|
-
} else {
|
|
61
|
-
await model.navToLocString(location, assemblyName)
|
|
62
|
-
}
|
|
63
|
-
} catch (e) {
|
|
64
|
-
console.warn(e)
|
|
65
|
-
session.notify(`${e}`, 'warning')
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function getTrackName(trackId: string | undefined) {
|
|
70
|
-
if (trackId) {
|
|
71
|
-
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
72
|
-
const configuration = resolveIdentifier(schema, getRoot(model), trackId)
|
|
73
|
-
return configuration?.name?.value || ''
|
|
74
|
-
}
|
|
75
|
-
return ''
|
|
76
|
-
}
|
|
77
|
-
|
|
78
28
|
return (
|
|
79
29
|
<Dialog open maxWidth="xl" onClose={handleClose} title="Search results">
|
|
80
30
|
<DialogContent>
|
|
81
|
-
{!
|
|
31
|
+
{!searchResults?.length ? (
|
|
82
32
|
<Typography>
|
|
83
|
-
No results found for <b>{
|
|
33
|
+
No results found for <b>{searchQuery}</b>
|
|
84
34
|
</Typography>
|
|
85
35
|
) : (
|
|
86
36
|
<>
|
|
87
37
|
<Typography>
|
|
88
|
-
Showing results for <b>{
|
|
38
|
+
Showing results for <b>{searchQuery}</b>
|
|
89
39
|
</Typography>
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<TableCell align="right">Track</TableCell>
|
|
97
|
-
<TableCell align="right" />
|
|
98
|
-
</TableRow>
|
|
99
|
-
</TableHead>
|
|
100
|
-
<TableBody>
|
|
101
|
-
{model.searchResults.map(result => (
|
|
102
|
-
<TableRow key={`${result.getId()}`}>
|
|
103
|
-
<TableCell component="th" scope="row">
|
|
104
|
-
{result.getLabel()}
|
|
105
|
-
</TableCell>
|
|
106
|
-
<TableCell align="right">
|
|
107
|
-
{result.getLocation()}
|
|
108
|
-
</TableCell>
|
|
109
|
-
<TableCell align="right">
|
|
110
|
-
{getTrackName(result.getTrackId()) || 'N/A'}
|
|
111
|
-
</TableCell>
|
|
112
|
-
<TableCell align="right">
|
|
113
|
-
<Button
|
|
114
|
-
onClick={async () => {
|
|
115
|
-
try {
|
|
116
|
-
const location = result.getLocation()
|
|
117
|
-
if (location) {
|
|
118
|
-
await handleClick(location)
|
|
119
|
-
const resultTrackId = result.getTrackId()
|
|
120
|
-
if (resultTrackId) {
|
|
121
|
-
model.showTrack(resultTrackId)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
} catch (e) {
|
|
125
|
-
console.error(e)
|
|
126
|
-
session.notify(`${e}`, 'error')
|
|
127
|
-
}
|
|
128
|
-
handleClose()
|
|
129
|
-
}}
|
|
130
|
-
color="primary"
|
|
131
|
-
variant="contained"
|
|
132
|
-
>
|
|
133
|
-
Go
|
|
134
|
-
</Button>
|
|
135
|
-
</TableCell>
|
|
136
|
-
</TableRow>
|
|
137
|
-
))}
|
|
138
|
-
</TableBody>
|
|
139
|
-
</Table>
|
|
140
|
-
</TableContainer>
|
|
40
|
+
<SearchResultsTable
|
|
41
|
+
model={model}
|
|
42
|
+
handleClose={handleClose}
|
|
43
|
+
assemblyName={assemblyName}
|
|
44
|
+
searchResults={searchResults}
|
|
45
|
+
/>
|
|
141
46
|
</>
|
|
142
47
|
)}
|
|
143
48
|
</DialogContent>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Paper,
|
|
5
|
+
Table,
|
|
6
|
+
TableBody,
|
|
7
|
+
TableCell,
|
|
8
|
+
TableContainer,
|
|
9
|
+
TableHead,
|
|
10
|
+
TableRow,
|
|
11
|
+
} from '@mui/material'
|
|
12
|
+
import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
|
|
13
|
+
import { getRoot, resolveIdentifier } from 'mobx-state-tree'
|
|
14
|
+
import { getEnv, getSession } from '@jbrowse/core/util'
|
|
15
|
+
|
|
16
|
+
// locals
|
|
17
|
+
import { LinearGenomeViewModel } from '../..'
|
|
18
|
+
|
|
19
|
+
export default function SearchResultsTable({
|
|
20
|
+
searchResults,
|
|
21
|
+
assemblyName: optAssemblyName,
|
|
22
|
+
model,
|
|
23
|
+
handleClose,
|
|
24
|
+
}: {
|
|
25
|
+
searchResults: BaseResult[]
|
|
26
|
+
assemblyName?: string
|
|
27
|
+
model: LinearGenomeViewModel
|
|
28
|
+
handleClose: () => void
|
|
29
|
+
}) {
|
|
30
|
+
const session = getSession(model)
|
|
31
|
+
const { pluginManager } = getEnv(session)
|
|
32
|
+
const { assemblyManager } = session
|
|
33
|
+
const assemblyName =
|
|
34
|
+
optAssemblyName || model.displayedRegions[0]?.assemblyName
|
|
35
|
+
|
|
36
|
+
const assembly = assemblyManager.get(assemblyName)
|
|
37
|
+
if (!assembly) {
|
|
38
|
+
throw new Error(`assembly ${assemblyName} not found`)
|
|
39
|
+
}
|
|
40
|
+
if (!assembly.regions) {
|
|
41
|
+
throw new Error(`assembly ${assemblyName} regions not loaded`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getTrackName(trackId: string | undefined) {
|
|
45
|
+
if (trackId) {
|
|
46
|
+
const schema = pluginManager.pluggableConfigSchemaType('track')
|
|
47
|
+
const configuration = resolveIdentifier(schema, getRoot(model), trackId)
|
|
48
|
+
return configuration?.name?.value || ''
|
|
49
|
+
}
|
|
50
|
+
return ''
|
|
51
|
+
}
|
|
52
|
+
async function handleClick(location: string) {
|
|
53
|
+
try {
|
|
54
|
+
const newRegion = assembly?.regions?.find(
|
|
55
|
+
region => location === region.refName,
|
|
56
|
+
)
|
|
57
|
+
if (newRegion) {
|
|
58
|
+
model.setDisplayedRegions([newRegion])
|
|
59
|
+
// we use showAllRegions after setDisplayedRegions to make the entire
|
|
60
|
+
// region visible, xref #1703
|
|
61
|
+
model.showAllRegions()
|
|
62
|
+
} else {
|
|
63
|
+
await model.navToLocString(location, assemblyName)
|
|
64
|
+
}
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.warn(e)
|
|
67
|
+
session.notify(`${e}`, 'warning')
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return (
|
|
71
|
+
<TableContainer component={Paper}>
|
|
72
|
+
<Table>
|
|
73
|
+
<TableHead>
|
|
74
|
+
<TableRow>
|
|
75
|
+
<TableCell>Name</TableCell>
|
|
76
|
+
<TableCell align="right">Location</TableCell>
|
|
77
|
+
<TableCell align="right">Track</TableCell>
|
|
78
|
+
<TableCell align="right" />
|
|
79
|
+
</TableRow>
|
|
80
|
+
</TableHead>
|
|
81
|
+
<TableBody>
|
|
82
|
+
{searchResults.map(result => (
|
|
83
|
+
<TableRow key={`${result.getId()}`}>
|
|
84
|
+
<TableCell component="th" scope="row">
|
|
85
|
+
{result.getLabel()}
|
|
86
|
+
</TableCell>
|
|
87
|
+
<TableCell align="right">{result.getLocation()}</TableCell>
|
|
88
|
+
<TableCell align="right">
|
|
89
|
+
{getTrackName(result.getTrackId()) || 'N/A'}
|
|
90
|
+
</TableCell>
|
|
91
|
+
<TableCell align="right">
|
|
92
|
+
<Button
|
|
93
|
+
onClick={async () => {
|
|
94
|
+
try {
|
|
95
|
+
const location = result.getLocation()
|
|
96
|
+
if (location) {
|
|
97
|
+
await handleClick(location)
|
|
98
|
+
const resultTrackId = result.getTrackId()
|
|
99
|
+
if (resultTrackId) {
|
|
100
|
+
model.showTrack(resultTrackId)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {
|
|
104
|
+
console.error(e)
|
|
105
|
+
session.notify(`${e}`, 'error')
|
|
106
|
+
}
|
|
107
|
+
handleClose()
|
|
108
|
+
}}
|
|
109
|
+
color="primary"
|
|
110
|
+
variant="contained"
|
|
111
|
+
>
|
|
112
|
+
Go
|
|
113
|
+
</Button>
|
|
114
|
+
</TableCell>
|
|
115
|
+
</TableRow>
|
|
116
|
+
))}
|
|
117
|
+
</TableBody>
|
|
118
|
+
</Table>
|
|
119
|
+
</TableContainer>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -93,7 +93,7 @@ function TrackContainer({
|
|
|
93
93
|
const { horizontalScroll, draggingTrackId, moveTrack } = model
|
|
94
94
|
const { height, RenderingComponent, DisplayBlurb } = display
|
|
95
95
|
const trackId = getConf(track, 'trackId')
|
|
96
|
-
const ref = useRef(null)
|
|
96
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
97
97
|
const dimmed = draggingTrackId !== undefined && draggingTrackId !== display.id
|
|
98
98
|
const minimized = track.minimized
|
|
99
99
|
const debouncedOnDragEnter = useDebouncedCallback(() => {
|
|
@@ -111,7 +111,17 @@ function TrackContainer({
|
|
|
111
111
|
}, [model.trackRefs, trackId])
|
|
112
112
|
|
|
113
113
|
return (
|
|
114
|
-
<Paper
|
|
114
|
+
<Paper
|
|
115
|
+
ref={ref}
|
|
116
|
+
className={classes.root}
|
|
117
|
+
variant="outlined"
|
|
118
|
+
onClick={event => {
|
|
119
|
+
if (event.detail === 2 && !track.displays[0].featureIdUnderMouse) {
|
|
120
|
+
const left = ref.current?.getBoundingClientRect().left || 0
|
|
121
|
+
model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)
|
|
122
|
+
}
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
115
125
|
<TrackContainerLabel model={track} view={model} />
|
|
116
126
|
<ErrorBoundary
|
|
117
127
|
key={track.id}
|
|
@@ -127,7 +137,6 @@ function TrackContainer({
|
|
|
127
137
|
{!minimized ? (
|
|
128
138
|
<>
|
|
129
139
|
<div
|
|
130
|
-
ref={ref}
|
|
131
140
|
className={classes.renderingComponentContainer}
|
|
132
141
|
style={{ transform: `scaleX(${model.scaleFactor})` }}
|
|
133
142
|
>
|
|
@@ -14,6 +14,7 @@ import Gridlines from './Gridlines'
|
|
|
14
14
|
import CenterLine from './CenterLine'
|
|
15
15
|
import VerticalGuide from './VerticalGuide'
|
|
16
16
|
import RubberbandSpan from './RubberbandSpan'
|
|
17
|
+
import { getEnv } from '@jbrowse/core/util'
|
|
17
18
|
|
|
18
19
|
const useStyles = makeStyles()({
|
|
19
20
|
tracksContainer: {
|
|
@@ -32,6 +33,7 @@ export default observer(function TracksContainer({
|
|
|
32
33
|
model: LGV
|
|
33
34
|
}) {
|
|
34
35
|
const { classes } = useStyles()
|
|
36
|
+
const { pluginManager } = getEnv(model)
|
|
35
37
|
const { mouseDown: mouseDown1, mouseUp } = useSideScroll(model)
|
|
36
38
|
const ref = useRef<HTMLDivElement>(null)
|
|
37
39
|
const {
|
|
@@ -51,17 +53,17 @@ export default observer(function TracksContainer({
|
|
|
51
53
|
} = useRangeSelect(ref, model, true)
|
|
52
54
|
useWheelScroll(ref, model)
|
|
53
55
|
|
|
56
|
+
const additionals = pluginManager.evaluateExtensionPoint(
|
|
57
|
+
'LinearGenomeView-TracksContainerComponent',
|
|
58
|
+
undefined,
|
|
59
|
+
{ model },
|
|
60
|
+
) as React.ReactNode
|
|
61
|
+
|
|
54
62
|
return (
|
|
55
63
|
<div
|
|
56
64
|
ref={ref}
|
|
57
65
|
data-testid="trackContainer"
|
|
58
66
|
className={classes.tracksContainer}
|
|
59
|
-
onClick={event => {
|
|
60
|
-
if (event.detail === 2) {
|
|
61
|
-
const left = ref.current?.getBoundingClientRect().left || 0
|
|
62
|
-
model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)
|
|
63
|
-
}
|
|
64
|
-
}}
|
|
65
67
|
onMouseDown={event => {
|
|
66
68
|
mouseDown1(event)
|
|
67
69
|
mouseDown2(event)
|
|
@@ -105,6 +107,7 @@ export default observer(function TracksContainer({
|
|
|
105
107
|
/>
|
|
106
108
|
}
|
|
107
109
|
/>
|
|
110
|
+
{additionals}
|
|
108
111
|
{children}
|
|
109
112
|
</div>
|
|
110
113
|
)
|
|
@@ -77,7 +77,7 @@ exports[`renders one track, one region 1`] = `
|
|
|
77
77
|
class="css-1fs11k8-overview"
|
|
78
78
|
>
|
|
79
79
|
<svg
|
|
80
|
-
class="css-
|
|
80
|
+
class="css-191b84s-overviewSvg"
|
|
81
81
|
height="48"
|
|
82
82
|
>
|
|
83
83
|
<polygon
|
|
@@ -157,7 +157,7 @@ exports[`renders one track, one region 1`] = `
|
|
|
157
157
|
/>
|
|
158
158
|
</button>
|
|
159
159
|
<div
|
|
160
|
-
class="MuiAutocomplete-root css-
|
|
160
|
+
class="MuiAutocomplete-root css-1h51icj-MuiAutocomplete-root"
|
|
161
161
|
data-testid="autocomplete"
|
|
162
162
|
style="width: 175px;"
|
|
163
163
|
>
|
|
@@ -166,7 +166,7 @@ exports[`renders one track, one region 1`] = `
|
|
|
166
166
|
style="margin: 7px;"
|
|
167
167
|
>
|
|
168
168
|
<div
|
|
169
|
-
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-154xyx0-MuiInputBase-root-MuiOutlinedInput-root"
|
|
169
|
+
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-154xyx0-MuiInputBase-root-MuiOutlinedInput-root"
|
|
170
170
|
style="padding: 0px; height: 32px; background: rgba(255, 255, 255, 0.8);"
|
|
171
171
|
>
|
|
172
172
|
<input
|
|
@@ -175,7 +175,7 @@ exports[`renders one track, one region 1`] = `
|
|
|
175
175
|
aria-invalid="false"
|
|
176
176
|
autocapitalize="none"
|
|
177
177
|
autocomplete="off"
|
|
178
|
-
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-
|
|
178
|
+
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-19qh8xo-MuiInputBase-input-MuiOutlinedInput-input"
|
|
179
179
|
id="mui-7"
|
|
180
180
|
placeholder="Search for location"
|
|
181
181
|
role="combobox"
|
|
@@ -184,7 +184,7 @@ exports[`renders one track, one region 1`] = `
|
|
|
184
184
|
value="ctgA:1..100"
|
|
185
185
|
/>
|
|
186
186
|
<div
|
|
187
|
-
class="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-outlined MuiInputAdornment-
|
|
187
|
+
class="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-outlined MuiInputAdornment-sizeSmall css-1laqsz7-MuiInputAdornment-root"
|
|
188
188
|
style="margin-right: 7px;"
|
|
189
189
|
>
|
|
190
190
|
<svg
|
|
@@ -651,7 +651,7 @@ exports[`renders two tracks, two regions 1`] = `
|
|
|
651
651
|
class="css-1fs11k8-overview"
|
|
652
652
|
>
|
|
653
653
|
<svg
|
|
654
|
-
class="css-
|
|
654
|
+
class="css-191b84s-overviewSvg"
|
|
655
655
|
height="48"
|
|
656
656
|
>
|
|
657
657
|
<polygon
|
|
@@ -731,16 +731,16 @@ exports[`renders two tracks, two regions 1`] = `
|
|
|
731
731
|
/>
|
|
732
732
|
</button>
|
|
733
733
|
<div
|
|
734
|
-
class="MuiAutocomplete-root css-
|
|
734
|
+
class="MuiAutocomplete-root css-1h51icj-MuiAutocomplete-root"
|
|
735
735
|
data-testid="autocomplete"
|
|
736
|
-
style="width:
|
|
736
|
+
style="width: 283.990625px;"
|
|
737
737
|
>
|
|
738
738
|
<div
|
|
739
739
|
class="MuiFormControl-root MuiFormControl-fullWidth MuiTextField-root css-1efd6m0-MuiFormControl-root-MuiTextField-root-headerRefName"
|
|
740
740
|
style="margin: 7px;"
|
|
741
741
|
>
|
|
742
742
|
<div
|
|
743
|
-
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-154xyx0-MuiInputBase-root-MuiOutlinedInput-root"
|
|
743
|
+
class="MuiInputBase-root MuiOutlinedInput-root MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd MuiAutocomplete-inputRoot css-154xyx0-MuiInputBase-root-MuiOutlinedInput-root"
|
|
744
744
|
style="padding: 0px; height: 32px; background: rgba(255, 255, 255, 0.8);"
|
|
745
745
|
>
|
|
746
746
|
<input
|
|
@@ -749,7 +749,7 @@ exports[`renders two tracks, two regions 1`] = `
|
|
|
749
749
|
aria-invalid="false"
|
|
750
750
|
autocapitalize="none"
|
|
751
751
|
autocomplete="off"
|
|
752
|
-
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-
|
|
752
|
+
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputSizeSmall MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-19qh8xo-MuiInputBase-input-MuiOutlinedInput-input"
|
|
753
753
|
id="mui-9"
|
|
754
754
|
placeholder="Search for location"
|
|
755
755
|
role="combobox"
|
|
@@ -758,7 +758,7 @@ exports[`renders two tracks, two regions 1`] = `
|
|
|
758
758
|
value="ctgA:1..100 ctgB:1,001..1,698"
|
|
759
759
|
/>
|
|
760
760
|
<div
|
|
761
|
-
class="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-outlined MuiInputAdornment-
|
|
761
|
+
class="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-outlined MuiInputAdornment-sizeSmall css-1laqsz7-MuiInputAdornment-root"
|
|
762
762
|
style="margin-right: 7px;"
|
|
763
763
|
>
|
|
764
764
|
<svg
|
|
@@ -65,7 +65,8 @@ export function getCytobands(assembly: Assembly | undefined, refName: string) {
|
|
|
65
65
|
return (
|
|
66
66
|
assembly?.cytobands
|
|
67
67
|
?.map(f => ({
|
|
68
|
-
refName:
|
|
68
|
+
refName:
|
|
69
|
+
assembly.getCanonicalRefName(f.get('refName')) || f.get('refName'),
|
|
69
70
|
start: f.get('start'),
|
|
70
71
|
end: f.get('end'),
|
|
71
72
|
type: f.get('type'),
|
|
@@ -234,29 +234,27 @@ test('can instantiate a model that tests navTo/moveTo', async () => {
|
|
|
234
234
|
expect(model.bpPerPx).toBe(0.125)
|
|
235
235
|
|
|
236
236
|
expect(() => model.navTo({ refName: 'ctgA', start: 200, end: 100 })).toThrow(
|
|
237
|
-
|
|
237
|
+
/start greater than end/,
|
|
238
238
|
)
|
|
239
239
|
|
|
240
|
-
expect(() =>
|
|
241
|
-
|
|
242
|
-
)
|
|
240
|
+
expect(() => model.navTo({ refName: 'noExist', start: 0, end: 100 })).toThrow(
|
|
241
|
+
/could not find a region/,
|
|
242
|
+
)
|
|
243
243
|
|
|
244
244
|
expect(() => model.navTo({ refName: 'ctgA', end: 20100 })).toThrow(
|
|
245
|
-
|
|
245
|
+
/could not find a region/,
|
|
246
246
|
)
|
|
247
247
|
|
|
248
248
|
expect(() => model.navTo({ refName: 'ctgA', start: 20000 })).toThrow(
|
|
249
|
-
|
|
249
|
+
/could not find a region/,
|
|
250
250
|
)
|
|
251
251
|
|
|
252
252
|
expect(() =>
|
|
253
253
|
model.navTo({ refName: 'ctgA', start: 20000, end: 20100 }),
|
|
254
|
-
).toThrow(
|
|
255
|
-
'could not find a region that completely contained "ctgA:20,001..20,100"',
|
|
256
|
-
)
|
|
254
|
+
).toThrow(/could not find a region/)
|
|
257
255
|
|
|
258
256
|
expect(() => model.navTo({ refName: 'ctgA', start: 0, end: 20000 })).toThrow(
|
|
259
|
-
|
|
257
|
+
/could not find a region/,
|
|
260
258
|
)
|
|
261
259
|
})
|
|
262
260
|
|
|
@@ -304,8 +302,8 @@ test('can navToMultiple', () => {
|
|
|
304
302
|
{ refName: 'ctgA', start: 5000, end: 10000 },
|
|
305
303
|
{ refName: 'ctgC', start: 0, end: 5000 },
|
|
306
304
|
])
|
|
307
|
-
expect(model.offsetPx).toBe(
|
|
308
|
-
expect(model.bpPerPx).toBeCloseTo(
|
|
305
|
+
expect(model.offsetPx).toBe(199)
|
|
306
|
+
expect(model.bpPerPx).toBeCloseTo(25.12562)
|
|
309
307
|
})
|
|
310
308
|
|
|
311
309
|
describe('Zoom to selected displayed regions', () => {
|