@jbrowse/plugin-variants 1.6.4 → 1.6.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "1.6.4",
3
+ "version": "1.6.7",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@flatten-js/interval-tree": "^1.0.15",
39
- "@gmod/bgzf-filehandle": "^1.4.2",
39
+ "@gmod/bgzf-filehandle": "^1.4.3",
40
40
  "@gmod/tabix": "^1.5.2",
41
41
  "@gmod/vcf": "^5.0.5",
42
42
  "@material-ui/icons": "^4.11.2",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "7f157fbb2302d8825f99d01bcc0fd0616116c5d2"
61
+ "gitHead": "02012ec299c36647f755316571775d36b0fee5ec"
62
62
  }
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import React, { useState } from 'react'
3
3
  import { observer } from 'mobx-react'
4
- import { makeStyles } from '@material-ui/core/styles'
5
4
  import {
6
5
  Button,
7
6
  Dialog,
@@ -12,6 +11,7 @@ import {
12
11
  IconButton,
13
12
  FormControlLabel,
14
13
  Checkbox,
14
+ makeStyles,
15
15
  } from '@material-ui/core'
16
16
  import CloseIcon from '@material-ui/icons/Close'
17
17
  import { getSnapshot } from 'mobx-state-tree'
@@ -52,9 +52,7 @@ function BreakendOptionDialog({
52
52
  {handleClose ? (
53
53
  <IconButton
54
54
  className={classes.closeButton}
55
- onClick={() => {
56
- handleClose()
57
- }}
55
+ onClick={() => handleClose()}
58
56
  >
59
57
  <CloseIcon />
60
58
  </IconButton>
@@ -90,22 +88,25 @@ function BreakendOptionDialog({
90
88
  onClick={() => {
91
89
  const { view } = model
92
90
  const session = getSession(model)
91
+ try {
92
+ const viewSnapshot = viewType.snapshotFromBreakendFeature(
93
+ feature,
94
+ view,
95
+ )
96
+ viewSnapshot.views[0].offsetPx -= view.width / 2 + 100
97
+ viewSnapshot.views[1].offsetPx -= view.width / 2 + 100
98
+ viewSnapshot.featureData = feature
99
+ const viewTracks: any = getSnapshot(view.tracks)
100
+ viewSnapshot.views[0].tracks = viewTracks
101
+ viewSnapshot.views[1].tracks = mirrorTracks
102
+ ? viewTracks.slice().reverse()
103
+ : viewTracks
93
104
 
94
- const viewSnapshot = viewType.snapshotFromBreakendFeature(
95
- feature,
96
- view,
97
- )
98
- viewSnapshot.views[0].offsetPx -= view.width / 2 + 100
99
- viewSnapshot.views[1].offsetPx -= view.width / 2 + 100
100
- viewSnapshot.featureData = feature
101
- const viewTracks: any = getSnapshot(view.tracks)
102
- viewSnapshot.views[0].tracks = viewTracks
103
- viewSnapshot.views[1].tracks = mirrorTracks
104
- ? viewTracks.slice().reverse()
105
- : viewTracks
106
-
107
- session.addView('BreakpointSplitView', viewSnapshot)
108
-
105
+ session.addView('BreakpointSplitView', viewSnapshot)
106
+ } catch (e) {
107
+ console.error(e)
108
+ session.notify(`${e}`)
109
+ }
109
110
  handleClose()
110
111
  }}
111
112
  variant="contained"
@@ -115,12 +116,9 @@ function BreakendOptionDialog({
115
116
  OK
116
117
  </Button>
117
118
  <Button
118
- onClick={() => {
119
- handleClose()
120
- }}
119
+ onClick={() => handleClose()}
121
120
  color="secondary"
122
121
  variant="contained"
123
- autoFocus
124
122
  >
125
123
  Cancel
126
124
  </Button>
@@ -146,13 +146,17 @@ function BreakendPanel(props: {
146
146
  onClick={(event: any) => {
147
147
  event.preventDefault()
148
148
  const { view } = model
149
- if (view) {
150
- view.navToLocString?.(locString)
151
- } else {
152
- session.notify(
153
- 'No view associated with this feature detail panel anymore',
154
- 'warning',
155
- )
149
+ try {
150
+ if (view) {
151
+ view.navToLocString?.(locString)
152
+ } else {
153
+ throw new Error(
154
+ 'No view associated with this feature detail panel anymore',
155
+ )
156
+ }
157
+ } catch (e) {
158
+ console.error(e)
159
+ session.notify(`${e}`)
156
160
  }
157
161
  }}
158
162
  >
package/src/index.ts CHANGED
@@ -78,7 +78,10 @@ export default class VariantsPlugin extends Plugin {
78
78
  'Core-guessTrackTypeForLocation',
79
79
  (trackTypeGuesser: TrackTypeGuesser) => {
80
80
  return (adapterName: string) => {
81
- if (adapterName === 'VcfTabixAdapter') {
81
+ if (
82
+ adapterName === 'VcfTabixAdapter' ||
83
+ adapterName === 'VcfAdapter'
84
+ ) {
82
85
  return 'VariantTrack'
83
86
  }
84
87
  return trackTypeGuesser(adapterName)