@jbrowse/plugin-linear-genome-view 1.5.1 → 1.5.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/LinearGenomeView/components/HelpDialog.d.ts +5 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
- package/dist/plugin-linear-genome-view.cjs.development.js +254 -198
- package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
- package/dist/plugin-linear-genome-view.esm.js +255 -199
- package/dist/plugin-linear-genome-view.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/LinearGenomeView/components/HelpDialog.tsx +81 -0
- package/src/LinearGenomeView/components/ImportForm.tsx +18 -27
- package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +1 -1
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +1 -1
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +6 -2
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +132 -114
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +12 -34
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +49 -3
|
@@ -15,7 +15,7 @@ import Typography from '@material-ui/core/Typography';
|
|
|
15
15
|
import MenuOpenIcon from '@material-ui/icons/MenuOpen';
|
|
16
16
|
import { autorun, when, transaction } from 'mobx';
|
|
17
17
|
import { getParent, types, cast, isAlive, addDisposer, getEnv, resolveIdentifier, getRoot, getSnapshot } from 'mobx-state-tree';
|
|
18
|
-
import { useTheme, makeStyles as makeStyles$1, alpha, Portal, Popover, Typography as Typography$1, Tooltip as Tooltip$1, TextField, Popper, CircularProgress, InputAdornment, Dialog, DialogTitle,
|
|
18
|
+
import { useTheme, makeStyles as makeStyles$1, alpha, Portal, Popover, Typography as Typography$1, Tooltip as Tooltip$1, TextField, Popper, CircularProgress, InputAdornment, IconButton, Dialog, DialogTitle, DialogContent, FormControlLabel, Checkbox, DialogActions, Button as Button$1, Divider, FormGroup, Container, Grid, TableContainer, Paper as Paper$1, Table, TableHead, TableRow, TableCell, TableBody } from '@material-ui/core';
|
|
19
19
|
import { Menu, ResizeHandle } from '@jbrowse/core/ui';
|
|
20
20
|
import { observer, PropTypes } from 'mobx-react';
|
|
21
21
|
import { usePopper } from 'react-popper';
|
|
@@ -43,6 +43,7 @@ import clsx from 'clsx';
|
|
|
43
43
|
import BaseResult, { RefSequenceResult } from '@jbrowse/core/TextSearch/BaseResults';
|
|
44
44
|
import SearchIcon from '@material-ui/icons/Search';
|
|
45
45
|
import Autocomplete from '@material-ui/lab/Autocomplete';
|
|
46
|
+
import HelpIcon from '@material-ui/icons/Help';
|
|
46
47
|
import CloseIcon from '@material-ui/icons/Close';
|
|
47
48
|
import ArrowForwardIcon from '@material-ui/icons/ArrowForward';
|
|
48
49
|
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
|
|
@@ -57,6 +58,7 @@ import { alpha as alpha$2 } from '@material-ui/core/styles/colorManipulator';
|
|
|
57
58
|
import Popover$1 from '@material-ui/core/Popover';
|
|
58
59
|
import Tooltip$2 from '@material-ui/core/Tooltip';
|
|
59
60
|
import AssemblySelector from '@jbrowse/core/ui/AssemblySelector';
|
|
61
|
+
import ErrorMessage from '@jbrowse/core/ui/ErrorMessage';
|
|
60
62
|
import ArrowDown from '@material-ui/icons/KeyboardArrowDown';
|
|
61
63
|
import Menu$1 from '@jbrowse/core/ui/Menu';
|
|
62
64
|
import copy from 'copy-to-clipboard';
|
|
@@ -2510,7 +2512,9 @@ function mathPower(num) {
|
|
|
2510
2512
|
return "".concat(mathPower(~~(num / 1000)), ",").concat("00".concat(~~(num % 1000)).substr(-3, 3));
|
|
2511
2513
|
}
|
|
2512
2514
|
|
|
2513
|
-
var useStyles$4 = /*#__PURE__*/makeStyles(function
|
|
2515
|
+
var useStyles$4 = /*#__PURE__*/makeStyles(function
|
|
2516
|
+
/* theme */
|
|
2517
|
+
() {
|
|
2514
2518
|
return {
|
|
2515
2519
|
majorTickLabel: {
|
|
2516
2520
|
fontSize: '11px'
|
|
@@ -2693,7 +2697,7 @@ function OverviewRubberBand(_ref2) {
|
|
|
2693
2697
|
|
|
2694
2698
|
|
|
2695
2699
|
if (controlsRef.current && startX !== undefined && currentX === undefined) {
|
|
2696
|
-
var clickedAt = overview.pxToBp(startX);
|
|
2700
|
+
var clickedAt = overview.pxToBp(startX - cytobandOffset);
|
|
2697
2701
|
model.centerAt(Math.round(clickedAt.coord), clickedAt.refName, clickedAt.index);
|
|
2698
2702
|
}
|
|
2699
2703
|
|
|
@@ -2897,7 +2901,7 @@ var useStyles$6 = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
|
2897
2901
|
height: HEADER_OVERVIEW_HEIGHT,
|
|
2898
2902
|
pointerEvents: 'none',
|
|
2899
2903
|
zIndex: 100,
|
|
2900
|
-
border: '1px solid
|
|
2904
|
+
border: '1px solid'
|
|
2901
2905
|
},
|
|
2902
2906
|
overview: {
|
|
2903
2907
|
height: HEADER_BAR_HEIGHT,
|
|
@@ -3141,6 +3145,8 @@ var ScaleBar = /*#__PURE__*/observer(function (_ref6) {
|
|
|
3141
3145
|
var lastOverviewPx = overview.bpToPx(_objectSpread2(_objectSpread2({}, last), {}, {
|
|
3142
3146
|
coord: last.reversed ? last.start : last.end
|
|
3143
3147
|
})) || 0;
|
|
3148
|
+
var color = showCytobands ? '#f00' : scaleBarColor;
|
|
3149
|
+
var transparency = showCytobands ? 0.1 : 0.3;
|
|
3144
3150
|
return /*#__PURE__*/React.createElement("div", {
|
|
3145
3151
|
className: classes.scaleBar
|
|
3146
3152
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -3148,7 +3154,8 @@ var ScaleBar = /*#__PURE__*/observer(function (_ref6) {
|
|
|
3148
3154
|
style: {
|
|
3149
3155
|
width: lastOverviewPx - firstOverviewPx,
|
|
3150
3156
|
left: firstOverviewPx + cytobandOffset,
|
|
3151
|
-
background:
|
|
3157
|
+
background: alpha(color, transparency),
|
|
3158
|
+
borderColor: color
|
|
3152
3159
|
}
|
|
3153
3160
|
}), overviewVisibleRegions.map(function (block, idx) {
|
|
3154
3161
|
return !(block instanceof ContentBlock$1) ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -3366,7 +3373,7 @@ var SVGHeader = function SVGHeader(_ref3) {
|
|
|
3366
3373
|
block: block
|
|
3367
3374
|
}), /*#__PURE__*/React.createElement("rect", {
|
|
3368
3375
|
stroke: "red",
|
|
3369
|
-
fill: "
|
|
3376
|
+
fill: "rgb(255,0,0,0.1)",
|
|
3370
3377
|
width: Math.max(lastOverviewPx - firstOverviewPx, 0.5),
|
|
3371
3378
|
height: HEADER_OVERVIEW_HEIGHT - 1,
|
|
3372
3379
|
x: firstOverviewPx,
|
|
@@ -3541,6 +3548,9 @@ function dedupe() {
|
|
|
3541
3548
|
});
|
|
3542
3549
|
}
|
|
3543
3550
|
|
|
3551
|
+
var HelpDialog = /*#__PURE__*/lazy(function () {
|
|
3552
|
+
return Promise.resolve().then(function () { return HelpDialog$2; });
|
|
3553
|
+
}); // the logic of this method is to only apply a filter to RefSequenceResults
|
|
3544
3554
|
// because they do not have a matchedObject. the trix search results already
|
|
3545
3555
|
// filter so don't need re-filtering
|
|
3546
3556
|
|
|
@@ -3572,6 +3582,8 @@ function RefNameAutocomplete(_ref) {
|
|
|
3572
3582
|
style = _ref.style,
|
|
3573
3583
|
fetchResults = _ref.fetchResults,
|
|
3574
3584
|
value = _ref.value,
|
|
3585
|
+
_ref$minWidth = _ref.minWidth,
|
|
3586
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
3575
3587
|
_ref$TextFieldProps = _ref.TextFieldProps,
|
|
3576
3588
|
TextFieldProps = _ref$TextFieldProps === void 0 ? {} : _ref$TextFieldProps;
|
|
3577
3589
|
var session = getSession(model);
|
|
@@ -3587,20 +3599,25 @@ function RefNameAutocomplete(_ref) {
|
|
|
3587
3599
|
loaded = _useState4[0],
|
|
3588
3600
|
setLoaded = _useState4[1];
|
|
3589
3601
|
|
|
3590
|
-
var _useState5 = useState(
|
|
3602
|
+
var _useState5 = useState(false),
|
|
3591
3603
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3592
|
-
|
|
3593
|
-
|
|
3604
|
+
isHelpDialogDisplayed = _useState6[0],
|
|
3605
|
+
setHelpDialogDisplayed = _useState6[1];
|
|
3594
3606
|
|
|
3595
3607
|
var _useState7 = useState(''),
|
|
3596
3608
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
3597
|
-
|
|
3598
|
-
|
|
3609
|
+
currentSearch = _useState8[0],
|
|
3610
|
+
setCurrentSearch = _useState8[1];
|
|
3599
3611
|
|
|
3600
|
-
var _useState9 = useState(),
|
|
3612
|
+
var _useState9 = useState(''),
|
|
3601
3613
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
3602
|
-
|
|
3603
|
-
|
|
3614
|
+
inputValue = _useState10[0],
|
|
3615
|
+
setInputValue = _useState10[1];
|
|
3616
|
+
|
|
3617
|
+
var _useState11 = useState(),
|
|
3618
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3619
|
+
searchOptions = _useState12[0],
|
|
3620
|
+
setSearchOptions = _useState12[1];
|
|
3604
3621
|
|
|
3605
3622
|
var debouncedSearch = useDebounce(currentSearch, 300);
|
|
3606
3623
|
var coarseVisibleLocStrings = model.coarseVisibleLocStrings,
|
|
@@ -3680,12 +3697,13 @@ function RefNameAutocomplete(_ref) {
|
|
|
3680
3697
|
active = false;
|
|
3681
3698
|
};
|
|
3682
3699
|
}, [assemblyName, fetchResults, debouncedSearch, session, model]);
|
|
3683
|
-
var inputBoxVal = coarseVisibleLocStrings || value || ''; // heuristic, text width + icon width
|
|
3700
|
+
var inputBoxVal = coarseVisibleLocStrings || value || ''; // heuristic, text width + icon width
|
|
3701
|
+
// + 45 accomodates help icon and search icon
|
|
3684
3702
|
|
|
3685
|
-
var width = Math.min(Math.max(measureText(inputBoxVal, 16) +
|
|
3703
|
+
var width = Math.min(Math.max(measureText(inputBoxVal, 16) + 45, minWidth), 550); // notes on implementation:
|
|
3686
3704
|
// The selectOnFocus setting helps highlight the field when clicked
|
|
3687
3705
|
|
|
3688
|
-
return /*#__PURE__*/React.createElement(Autocomplete, {
|
|
3706
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Autocomplete, {
|
|
3689
3707
|
id: "refNameAutocomplete-".concat(model.id),
|
|
3690
3708
|
"data-testid": "autocomplete",
|
|
3691
3709
|
disableListWrap: true,
|
|
@@ -3769,7 +3787,11 @@ function RefNameAutocomplete(_ref) {
|
|
|
3769
3787
|
style: {
|
|
3770
3788
|
marginRight: 7
|
|
3771
3789
|
}
|
|
3772
|
-
}, /*#__PURE__*/React.createElement(SearchIcon, null)
|
|
3790
|
+
}, /*#__PURE__*/React.createElement(SearchIcon, null), /*#__PURE__*/React.createElement(IconButton, {
|
|
3791
|
+
onClick: function onClick() {
|
|
3792
|
+
return setHelpDialogDisplayed(true);
|
|
3793
|
+
}
|
|
3794
|
+
}, /*#__PURE__*/React.createElement(HelpIcon, null))), params.InputProps.endAdornment)
|
|
3773
3795
|
}),
|
|
3774
3796
|
placeholder: "Search for location",
|
|
3775
3797
|
onChange: function onChange(e) {
|
|
@@ -3792,7 +3814,11 @@ function RefNameAutocomplete(_ref) {
|
|
|
3792
3814
|
getOptionLabel: function getOptionLabel(option) {
|
|
3793
3815
|
return (typeof option === 'string' ? option : option.result.getLabel()) || '';
|
|
3794
3816
|
}
|
|
3795
|
-
})
|
|
3817
|
+
}), isHelpDialogDisplayed ? /*#__PURE__*/React.createElement(HelpDialog, {
|
|
3818
|
+
handleClose: function handleClose() {
|
|
3819
|
+
return setHelpDialogDisplayed(false);
|
|
3820
|
+
}
|
|
3821
|
+
}) : null);
|
|
3796
3822
|
}
|
|
3797
3823
|
|
|
3798
3824
|
var RefNameAutocomplete$1 = /*#__PURE__*/observer(RefNameAutocomplete);
|
|
@@ -5299,158 +5325,10 @@ function TracksContainer(_ref) {
|
|
|
5299
5325
|
|
|
5300
5326
|
var TracksContainer$1 = /*#__PURE__*/observer(TracksContainer);
|
|
5301
5327
|
|
|
5302
|
-
var
|
|
5303
|
-
return {
|
|
5304
|
-
dialogContent: {
|
|
5305
|
-
width: '80em'
|
|
5306
|
-
},
|
|
5307
|
-
closeButton: {
|
|
5308
|
-
position: 'absolute',
|
|
5309
|
-
right: theme.spacing(1),
|
|
5310
|
-
top: theme.spacing(1),
|
|
5311
|
-
color: theme.palette.grey[500]
|
|
5312
|
-
}
|
|
5313
|
-
};
|
|
5328
|
+
var SearchResultsDialog = /*#__PURE__*/lazy(function () {
|
|
5329
|
+
return Promise.resolve().then(function () { return SearchResultsDialog$2; });
|
|
5314
5330
|
});
|
|
5315
|
-
function
|
|
5316
|
-
var _model$searchResults;
|
|
5317
|
-
|
|
5318
|
-
var model = _ref.model,
|
|
5319
|
-
optAssemblyName = _ref.optAssemblyName,
|
|
5320
|
-
handleClose = _ref.handleClose;
|
|
5321
|
-
var classes = useStyles$i();
|
|
5322
|
-
var session = getSession(model);
|
|
5323
|
-
|
|
5324
|
-
var _getEnv = getEnv(session),
|
|
5325
|
-
pluginManager = _getEnv.pluginManager;
|
|
5326
|
-
|
|
5327
|
-
var assemblyManager = session.assemblyManager;
|
|
5328
|
-
var assemblyName = optAssemblyName;
|
|
5329
|
-
|
|
5330
|
-
if (model.displayedRegions.length > 0) {
|
|
5331
|
-
var _model$displayedRegio;
|
|
5332
|
-
|
|
5333
|
-
assemblyName = (_model$displayedRegio = model.displayedRegions[0]) === null || _model$displayedRegio === void 0 ? void 0 : _model$displayedRegio.assemblyName;
|
|
5334
|
-
}
|
|
5335
|
-
|
|
5336
|
-
if (!assemblyName) {
|
|
5337
|
-
throw new Error("Assembly name not found");
|
|
5338
|
-
}
|
|
5339
|
-
|
|
5340
|
-
var assembly = assemblyManager.get(assemblyName);
|
|
5341
|
-
|
|
5342
|
-
if (!assembly) {
|
|
5343
|
-
throw new Error("assembly ".concat(assemblyName, " not found"));
|
|
5344
|
-
}
|
|
5345
|
-
|
|
5346
|
-
if (!assembly.regions) {
|
|
5347
|
-
throw new Error("assembly ".concat(assemblyName, " regions not loaded"));
|
|
5348
|
-
}
|
|
5349
|
-
|
|
5350
|
-
var assemblyRegions = assembly.regions;
|
|
5351
|
-
|
|
5352
|
-
function handleClick(location) {
|
|
5353
|
-
try {
|
|
5354
|
-
var newRegion = assemblyRegions.find(function (region) {
|
|
5355
|
-
return location === region.refName;
|
|
5356
|
-
});
|
|
5357
|
-
|
|
5358
|
-
if (newRegion) {
|
|
5359
|
-
model.setDisplayedRegions([newRegion]); // we use showAllRegions after setDisplayedRegions to make the entire
|
|
5360
|
-
// region visible, xref #1703
|
|
5361
|
-
|
|
5362
|
-
model.showAllRegions();
|
|
5363
|
-
} else {
|
|
5364
|
-
model.navToLocString(location, assemblyName);
|
|
5365
|
-
}
|
|
5366
|
-
} catch (e) {
|
|
5367
|
-
console.warn(e);
|
|
5368
|
-
session.notify("".concat(e), 'warning');
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
|
|
5372
|
-
function getTrackName(trackId) {
|
|
5373
|
-
if (trackId) {
|
|
5374
|
-
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
5375
|
-
var configuration = resolveIdentifier(trackConfigSchema, getRoot(model), trackId);
|
|
5376
|
-
|
|
5377
|
-
if (configuration) {
|
|
5378
|
-
var _configuration$name;
|
|
5379
|
-
|
|
5380
|
-
return (_configuration$name = configuration.name) === null || _configuration$name === void 0 ? void 0 : _configuration$name.value;
|
|
5381
|
-
}
|
|
5382
|
-
}
|
|
5383
|
-
|
|
5384
|
-
return '';
|
|
5385
|
-
}
|
|
5386
|
-
|
|
5387
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
|
5388
|
-
open: true,
|
|
5389
|
-
maxWidth: "xl",
|
|
5390
|
-
onClose: handleClose
|
|
5391
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, {
|
|
5392
|
-
id: "search-results-dialog"
|
|
5393
|
-
}, "Search Results", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
5394
|
-
"data-testid": "close-resultsDialog",
|
|
5395
|
-
className: classes.closeButton,
|
|
5396
|
-
onClick: function onClick() {
|
|
5397
|
-
handleClose();
|
|
5398
|
-
}
|
|
5399
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, ((_model$searchResults = model.searchResults) === null || _model$searchResults === void 0 ? void 0 : _model$searchResults.length) === 0 || model.searchResults === undefined ? /*#__PURE__*/React.createElement(Typography$1, null, "No results found for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DialogContentText, {
|
|
5400
|
-
id: "alert-dialog-slide-description"
|
|
5401
|
-
}, "Showing results for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)), /*#__PURE__*/React.createElement(TableContainer, {
|
|
5402
|
-
component: Paper$1
|
|
5403
|
-
}, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, null, "Name"), /*#__PURE__*/React.createElement(TableCell, {
|
|
5404
|
-
align: "right"
|
|
5405
|
-
}, "Location"), /*#__PURE__*/React.createElement(TableCell, {
|
|
5406
|
-
align: "right"
|
|
5407
|
-
}, "Track"), /*#__PURE__*/React.createElement(TableCell, {
|
|
5408
|
-
align: "right"
|
|
5409
|
-
}))), /*#__PURE__*/React.createElement(TableBody, null, model.searchResults.map(function (result, index) {
|
|
5410
|
-
return /*#__PURE__*/React.createElement(TableRow, {
|
|
5411
|
-
key: "".concat(result.getLabel(), "-").concat(index)
|
|
5412
|
-
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
5413
|
-
component: "th",
|
|
5414
|
-
scope: "row"
|
|
5415
|
-
}, result.getLabel()), /*#__PURE__*/React.createElement(TableCell, {
|
|
5416
|
-
align: "right"
|
|
5417
|
-
}, result.getLocation()), /*#__PURE__*/React.createElement(TableCell, {
|
|
5418
|
-
align: "right"
|
|
5419
|
-
}, getTrackName(result.getTrackId()) || 'N/A'), /*#__PURE__*/React.createElement(TableCell, {
|
|
5420
|
-
align: "right"
|
|
5421
|
-
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
5422
|
-
onClick: function onClick() {
|
|
5423
|
-
handleClick(result.getLocation());
|
|
5424
|
-
handleClose();
|
|
5425
|
-
},
|
|
5426
|
-
color: "primary",
|
|
5427
|
-
variant: "contained"
|
|
5428
|
-
}, "Go to location")), /*#__PURE__*/React.createElement(TableCell, {
|
|
5429
|
-
align: "right"
|
|
5430
|
-
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
5431
|
-
onClick: function onClick() {
|
|
5432
|
-
handleClick(result.getLocation());
|
|
5433
|
-
var resultTrackId = result.getTrackId();
|
|
5434
|
-
|
|
5435
|
-
if (resultTrackId) {
|
|
5436
|
-
model.showTrack(resultTrackId);
|
|
5437
|
-
}
|
|
5438
|
-
|
|
5439
|
-
handleClose();
|
|
5440
|
-
},
|
|
5441
|
-
disabled: !getTrackName(result.getTrackId()),
|
|
5442
|
-
color: "primary",
|
|
5443
|
-
variant: "contained"
|
|
5444
|
-
}, "Show Track")));
|
|
5445
|
-
})))))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
|
|
5446
|
-
onClick: function onClick() {
|
|
5447
|
-
handleClose();
|
|
5448
|
-
},
|
|
5449
|
-
color: "primary"
|
|
5450
|
-
}, "Cancel")));
|
|
5451
|
-
}
|
|
5452
|
-
|
|
5453
|
-
var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
5331
|
+
var useStyles$i = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
5454
5332
|
return {
|
|
5455
5333
|
importFormContainer: {
|
|
5456
5334
|
padding: theme.spacing(2)
|
|
@@ -5460,18 +5338,11 @@ var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
|
5460
5338
|
}
|
|
5461
5339
|
};
|
|
5462
5340
|
});
|
|
5463
|
-
var
|
|
5464
|
-
var error = _ref.error;
|
|
5465
|
-
return /*#__PURE__*/React.createElement(Typography$1, {
|
|
5466
|
-
variant: "h6",
|
|
5467
|
-
color: "error"
|
|
5468
|
-
}, "".concat(error));
|
|
5469
|
-
});
|
|
5470
|
-
var ImportForm = /*#__PURE__*/observer(function (_ref2) {
|
|
5341
|
+
var ImportForm = /*#__PURE__*/observer(function (_ref) {
|
|
5471
5342
|
var _regions$;
|
|
5472
5343
|
|
|
5473
|
-
var model =
|
|
5474
|
-
var classes = useStyles$
|
|
5344
|
+
var model = _ref.model;
|
|
5345
|
+
var classes = useStyles$i();
|
|
5475
5346
|
var session = getSession(model);
|
|
5476
5347
|
var assemblyNames = session.assemblyNames,
|
|
5477
5348
|
assemblyManager = session.assemblyManager,
|
|
@@ -5510,14 +5381,11 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
|
|
|
5510
5381
|
|
|
5511
5382
|
function fetchResults(_x, _x2) {
|
|
5512
5383
|
return _fetchResults.apply(this, arguments);
|
|
5513
|
-
}
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
* 2) if it's a single result navigate to it
|
|
5519
|
-
* 3) else assume it's a locstring and navigate to it
|
|
5520
|
-
*/
|
|
5384
|
+
} // gets a string as input, or use stored option results from previous query,
|
|
5385
|
+
// then re-query and
|
|
5386
|
+
// 1) if it has multiple results: pop a dialog
|
|
5387
|
+
// 2) if it's a single result navigate to it
|
|
5388
|
+
// 3) else assume it's a locstring and navigate to it
|
|
5521
5389
|
|
|
5522
5390
|
|
|
5523
5391
|
function _fetchResults() {
|
|
@@ -5643,13 +5511,13 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
|
|
|
5643
5511
|
return _handleSelectedRegion.apply(this, arguments);
|
|
5644
5512
|
}
|
|
5645
5513
|
|
|
5646
|
-
return /*#__PURE__*/React.createElement("div", null, err ? /*#__PURE__*/React.createElement(
|
|
5514
|
+
return /*#__PURE__*/React.createElement("div", null, err ? /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
5647
5515
|
error: err
|
|
5648
5516
|
}) : null, /*#__PURE__*/React.createElement(Container, {
|
|
5649
5517
|
className: classes.importFormContainer
|
|
5650
5518
|
}, /*#__PURE__*/React.createElement("form", {
|
|
5651
5519
|
onSubmit: function onSubmit(event) {
|
|
5652
|
-
event.preventDefault();
|
|
5520
|
+
return event.preventDefault();
|
|
5653
5521
|
}
|
|
5654
5522
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
5655
5523
|
container: true,
|
|
@@ -5667,20 +5535,24 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
|
|
|
5667
5535
|
selected: selectedAsm
|
|
5668
5536
|
})), /*#__PURE__*/React.createElement(Grid, {
|
|
5669
5537
|
item: true
|
|
5670
|
-
}, selectedAsm ? err ? /*#__PURE__*/React.createElement(
|
|
5671
|
-
|
|
5672
|
-
|
|
5538
|
+
}, selectedAsm ? err ? /*#__PURE__*/React.createElement(CloseIcon, {
|
|
5539
|
+
style: {
|
|
5540
|
+
color: 'red'
|
|
5541
|
+
}
|
|
5542
|
+
}) : selectedRegion ? /*#__PURE__*/React.createElement(RefNameAutocomplete$1, {
|
|
5673
5543
|
fetchResults: fetchResults,
|
|
5674
5544
|
model: model,
|
|
5675
5545
|
assemblyName: assemblyError ? undefined : selectedAsm,
|
|
5676
5546
|
value: selectedRegion,
|
|
5547
|
+
// note: minWidth 270 accomodates full width of helperText
|
|
5548
|
+
minWidth: 270,
|
|
5677
5549
|
onSelect: function onSelect(option) {
|
|
5678
5550
|
return setOption(option);
|
|
5679
5551
|
},
|
|
5680
5552
|
TextFieldProps: {
|
|
5681
5553
|
margin: 'normal',
|
|
5682
5554
|
variant: 'outlined',
|
|
5683
|
-
helperText: 'Enter
|
|
5555
|
+
helperText: 'Enter sequence name, feature name, or location'
|
|
5684
5556
|
}
|
|
5685
5557
|
}) : /*#__PURE__*/React.createElement(CircularProgress, {
|
|
5686
5558
|
role: "progressbar",
|
|
@@ -5688,6 +5560,8 @@ var ImportForm = /*#__PURE__*/observer(function (_ref2) {
|
|
|
5688
5560
|
disableShrink: true
|
|
5689
5561
|
}) : null), /*#__PURE__*/React.createElement(Grid, {
|
|
5690
5562
|
item: true
|
|
5563
|
+
}), /*#__PURE__*/React.createElement(Grid, {
|
|
5564
|
+
item: true
|
|
5691
5565
|
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
5692
5566
|
type: "submit",
|
|
5693
5567
|
disabled: !selectedRegion,
|
|
@@ -5768,7 +5642,7 @@ var MiniControls = /*#__PURE__*/observer(function (props) {
|
|
|
5768
5642
|
}));
|
|
5769
5643
|
});
|
|
5770
5644
|
|
|
5771
|
-
var useStyles$
|
|
5645
|
+
var useStyles$j = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
5772
5646
|
return {
|
|
5773
5647
|
loadingMessage: {
|
|
5774
5648
|
padding: theme.spacing(5)
|
|
@@ -5864,7 +5738,7 @@ function _fetchSequence() {
|
|
|
5864
5738
|
function SequenceDialog(_ref) {
|
|
5865
5739
|
var model = _ref.model,
|
|
5866
5740
|
handleClose = _ref.handleClose;
|
|
5867
|
-
var classes = useStyles$
|
|
5741
|
+
var classes = useStyles$j();
|
|
5868
5742
|
var session = getSession(model);
|
|
5869
5743
|
|
|
5870
5744
|
var _useState = useState(),
|
|
@@ -6029,6 +5903,150 @@ function SequenceDialog(_ref) {
|
|
|
6029
5903
|
|
|
6030
5904
|
var SequenceDialog$1 = /*#__PURE__*/observer(SequenceDialog);
|
|
6031
5905
|
|
|
5906
|
+
var useStyles$k = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
5907
|
+
return {
|
|
5908
|
+
dialogContent: {
|
|
5909
|
+
width: '80em'
|
|
5910
|
+
},
|
|
5911
|
+
closeButton: {
|
|
5912
|
+
position: 'absolute',
|
|
5913
|
+
right: theme.spacing(1),
|
|
5914
|
+
top: theme.spacing(1),
|
|
5915
|
+
color: theme.palette.grey[500]
|
|
5916
|
+
}
|
|
5917
|
+
};
|
|
5918
|
+
});
|
|
5919
|
+
function SearchResultsDialog$1(_ref) {
|
|
5920
|
+
var _model$searchResults;
|
|
5921
|
+
|
|
5922
|
+
var model = _ref.model,
|
|
5923
|
+
optAssemblyName = _ref.optAssemblyName,
|
|
5924
|
+
handleClose = _ref.handleClose;
|
|
5925
|
+
var classes = useStyles$k();
|
|
5926
|
+
var session = getSession(model);
|
|
5927
|
+
|
|
5928
|
+
var _getEnv = getEnv(session),
|
|
5929
|
+
pluginManager = _getEnv.pluginManager;
|
|
5930
|
+
|
|
5931
|
+
var assemblyManager = session.assemblyManager;
|
|
5932
|
+
var assemblyName = optAssemblyName;
|
|
5933
|
+
|
|
5934
|
+
if (model.displayedRegions.length > 0) {
|
|
5935
|
+
var _model$displayedRegio;
|
|
5936
|
+
|
|
5937
|
+
assemblyName = (_model$displayedRegio = model.displayedRegions[0]) === null || _model$displayedRegio === void 0 ? void 0 : _model$displayedRegio.assemblyName;
|
|
5938
|
+
}
|
|
5939
|
+
|
|
5940
|
+
if (!assemblyName) {
|
|
5941
|
+
throw new Error("Assembly name not found");
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5944
|
+
var assembly = assemblyManager.get(assemblyName);
|
|
5945
|
+
|
|
5946
|
+
if (!assembly) {
|
|
5947
|
+
throw new Error("assembly ".concat(assemblyName, " not found"));
|
|
5948
|
+
}
|
|
5949
|
+
|
|
5950
|
+
if (!assembly.regions) {
|
|
5951
|
+
throw new Error("assembly ".concat(assemblyName, " regions not loaded"));
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
var assemblyRegions = assembly.regions;
|
|
5955
|
+
|
|
5956
|
+
function handleClick(location) {
|
|
5957
|
+
try {
|
|
5958
|
+
var newRegion = assemblyRegions.find(function (region) {
|
|
5959
|
+
return location === region.refName;
|
|
5960
|
+
});
|
|
5961
|
+
|
|
5962
|
+
if (newRegion) {
|
|
5963
|
+
model.setDisplayedRegions([newRegion]); // we use showAllRegions after setDisplayedRegions to make the entire
|
|
5964
|
+
// region visible, xref #1703
|
|
5965
|
+
|
|
5966
|
+
model.showAllRegions();
|
|
5967
|
+
} else {
|
|
5968
|
+
model.navToLocString(location, assemblyName);
|
|
5969
|
+
}
|
|
5970
|
+
} catch (e) {
|
|
5971
|
+
console.warn(e);
|
|
5972
|
+
session.notify("".concat(e), 'warning');
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
function getTrackName(trackId) {
|
|
5977
|
+
if (trackId) {
|
|
5978
|
+
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
5979
|
+
var configuration = resolveIdentifier(trackConfigSchema, getRoot(model), trackId);
|
|
5980
|
+
|
|
5981
|
+
if (configuration) {
|
|
5982
|
+
var _configuration$name;
|
|
5983
|
+
|
|
5984
|
+
return (_configuration$name = configuration.name) === null || _configuration$name === void 0 ? void 0 : _configuration$name.value;
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5987
|
+
|
|
5988
|
+
return '';
|
|
5989
|
+
}
|
|
5990
|
+
|
|
5991
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
5992
|
+
open: true,
|
|
5993
|
+
maxWidth: "xl",
|
|
5994
|
+
onClose: handleClose
|
|
5995
|
+
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Search results", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
5996
|
+
"data-testid": "close-resultsDialog",
|
|
5997
|
+
className: classes.closeButton,
|
|
5998
|
+
onClick: function onClick() {
|
|
5999
|
+
handleClose();
|
|
6000
|
+
}
|
|
6001
|
+
}, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, !((_model$searchResults = model.searchResults) !== null && _model$searchResults !== void 0 && _model$searchResults.length) ? /*#__PURE__*/React.createElement(Typography$1, null, "No results found for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography$1, null, "Showing results for ", /*#__PURE__*/React.createElement("b", null, model.searchQuery)), /*#__PURE__*/React.createElement(TableContainer, {
|
|
6002
|
+
component: Paper$1
|
|
6003
|
+
}, /*#__PURE__*/React.createElement(Table, null, /*#__PURE__*/React.createElement(TableHead, null, /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, null, "Name"), /*#__PURE__*/React.createElement(TableCell, {
|
|
6004
|
+
align: "right"
|
|
6005
|
+
}, "Location"), /*#__PURE__*/React.createElement(TableCell, {
|
|
6006
|
+
align: "right"
|
|
6007
|
+
}, "Track"), /*#__PURE__*/React.createElement(TableCell, {
|
|
6008
|
+
align: "right"
|
|
6009
|
+
}))), /*#__PURE__*/React.createElement(TableBody, null, model.searchResults.map(function (result) {
|
|
6010
|
+
return /*#__PURE__*/React.createElement(TableRow, {
|
|
6011
|
+
key: "".concat(result.getId())
|
|
6012
|
+
}, /*#__PURE__*/React.createElement(TableCell, {
|
|
6013
|
+
component: "th",
|
|
6014
|
+
scope: "row"
|
|
6015
|
+
}, result.getLabel()), /*#__PURE__*/React.createElement(TableCell, {
|
|
6016
|
+
align: "right"
|
|
6017
|
+
}, result.getLocation()), /*#__PURE__*/React.createElement(TableCell, {
|
|
6018
|
+
align: "right"
|
|
6019
|
+
}, getTrackName(result.getTrackId()) || 'N/A'), /*#__PURE__*/React.createElement(TableCell, {
|
|
6020
|
+
align: "right"
|
|
6021
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
6022
|
+
onClick: function onClick() {
|
|
6023
|
+
handleClick(result.getLocation());
|
|
6024
|
+
var resultTrackId = result.getTrackId();
|
|
6025
|
+
|
|
6026
|
+
if (resultTrackId) {
|
|
6027
|
+
model.showTrack(resultTrackId);
|
|
6028
|
+
}
|
|
6029
|
+
|
|
6030
|
+
handleClose();
|
|
6031
|
+
},
|
|
6032
|
+
disabled: !getTrackName(result.getTrackId()),
|
|
6033
|
+
color: "primary",
|
|
6034
|
+
variant: "contained"
|
|
6035
|
+
}, "Go")));
|
|
6036
|
+
})))))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
|
|
6037
|
+
onClick: function onClick() {
|
|
6038
|
+
return handleClose();
|
|
6039
|
+
},
|
|
6040
|
+
color: "primary"
|
|
6041
|
+
}, "Cancel")));
|
|
6042
|
+
}
|
|
6043
|
+
|
|
6044
|
+
var SearchResultsDialog$2 = {
|
|
6045
|
+
__proto__: null,
|
|
6046
|
+
useStyles: useStyles$k,
|
|
6047
|
+
'default': SearchResultsDialog$1
|
|
6048
|
+
};
|
|
6049
|
+
|
|
6032
6050
|
var useStyles$l = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
6033
6051
|
return {
|
|
6034
6052
|
note: {
|
|
@@ -6089,7 +6107,7 @@ var LinearGenomeView = /*#__PURE__*/observer(function (_ref) {
|
|
|
6089
6107
|
handleClose: function handleClose() {
|
|
6090
6108
|
model.setSequenceDialogOpen(false);
|
|
6091
6109
|
}
|
|
6092
|
-
}) : null, model.isSearchDialogDisplayed ? /*#__PURE__*/React.createElement(SearchResultsDialog, {
|
|
6110
|
+
}) : null, model.isSearchDialogDisplayed ? /*#__PURE__*/React.createElement(SearchResultsDialog$1, {
|
|
6093
6111
|
model: model,
|
|
6094
6112
|
handleClose: function handleClose() {
|
|
6095
6113
|
model.setSearchResults(undefined, undefined);
|
|
@@ -7192,7 +7210,8 @@ function stateModelFactory$1(pluginManager) {
|
|
|
7192
7210
|
self.zoomTo(self.bpPerPx);
|
|
7193
7211
|
|
|
7194
7212
|
if ( // already zoomed all the way in
|
|
7195
|
-
targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx ||
|
|
7213
|
+
targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx || // already zoomed all the way out
|
|
7214
|
+
targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx) {
|
|
7196
7215
|
return;
|
|
7197
7216
|
}
|
|
7198
7217
|
|
|
@@ -7721,6 +7740,43 @@ var LinearGenomeViewPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
7721
7740
|
}(Plugin);
|
|
7722
7741
|
|
|
7723
7742
|
var useStyles$m = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
7743
|
+
return {
|
|
7744
|
+
closeButton: {
|
|
7745
|
+
position: 'absolute',
|
|
7746
|
+
right: theme.spacing(1),
|
|
7747
|
+
top: theme.spacing(1),
|
|
7748
|
+
color: theme.palette.grey[500]
|
|
7749
|
+
}
|
|
7750
|
+
};
|
|
7751
|
+
});
|
|
7752
|
+
function HelpDialog$1(_ref) {
|
|
7753
|
+
var handleClose = _ref.handleClose;
|
|
7754
|
+
var classes = useStyles$m();
|
|
7755
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
7756
|
+
open: true,
|
|
7757
|
+
maxWidth: "xl",
|
|
7758
|
+
onClose: handleClose
|
|
7759
|
+
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Using the search box", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
7760
|
+
"data-testid": "close-resultsDialog",
|
|
7761
|
+
className: classes.closeButton,
|
|
7762
|
+
onClick: function onClick() {
|
|
7763
|
+
handleClose();
|
|
7764
|
+
}
|
|
7765
|
+
}, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement("h3", null, "Searching"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, "Jump to a feature or reference sequence by typing its name in the location box and pressing Enter."), /*#__PURE__*/React.createElement("li", null, "Jump to a specific region by typing the region into the location box as: ", /*#__PURE__*/React.createElement("code", null, "ref:start..end"), " or ", /*#__PURE__*/React.createElement("code", null, "ref:start-end"), ". Commas are allowed in the start and end coordinates.")), /*#__PURE__*/React.createElement("h3", null, "Example Searches"), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "BRCA"), " - searches for the feature named BRCA"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "chr4"), " - jumps to chromosome 4"), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("code", null, "chr4:79,500,000..80,000,000"), " - jumps the region on chromosome 4 between 79.5Mb and 80Mb."))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button$1, {
|
|
7766
|
+
onClick: function onClick() {
|
|
7767
|
+
return handleClose();
|
|
7768
|
+
},
|
|
7769
|
+
color: "primary"
|
|
7770
|
+
}, "Close")));
|
|
7771
|
+
}
|
|
7772
|
+
|
|
7773
|
+
var HelpDialog$2 = {
|
|
7774
|
+
__proto__: null,
|
|
7775
|
+
useStyles: useStyles$m,
|
|
7776
|
+
'default': HelpDialog$1
|
|
7777
|
+
};
|
|
7778
|
+
|
|
7779
|
+
var useStyles$n = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
7724
7780
|
return {
|
|
7725
7781
|
root: {
|
|
7726
7782
|
width: 500
|
|
@@ -7740,7 +7796,7 @@ var useStyles$m = /*#__PURE__*/makeStyles$1(function (theme) {
|
|
|
7740
7796
|
function SetMaxHeightDlg$1(props) {
|
|
7741
7797
|
var model = props.model,
|
|
7742
7798
|
handleClose = props.handleClose;
|
|
7743
|
-
var classes = useStyles$
|
|
7799
|
+
var classes = useStyles$n();
|
|
7744
7800
|
var _model$maxHeight = model.maxHeight,
|
|
7745
7801
|
maxHeight = _model$maxHeight === void 0 ? '' : _model$maxHeight;
|
|
7746
7802
|
|