@jbrowse/plugin-linear-genome-view 1.6.5 → 1.6.6

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.
Files changed (25) hide show
  1. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -1
  2. package/dist/LinearBareDisplay/configSchema.d.ts +1 -1
  3. package/dist/LinearBasicDisplay/configSchema.d.ts +1 -1
  4. package/dist/LinearGenomeView/components/TrackContainer.d.ts +3 -2
  5. package/dist/index.d.ts +1 -1
  6. package/dist/plugin-linear-genome-view.cjs.development.js +118 -228
  7. package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
  8. package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
  9. package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
  10. package/dist/plugin-linear-genome-view.esm.js +120 -230
  11. package/dist/plugin-linear-genome-view.esm.js.map +1 -1
  12. package/package.json +2 -2
  13. package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +1 -1
  14. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +6 -1
  15. package/src/LinearBasicDisplay/model.ts +1 -1
  16. package/src/LinearGenomeView/components/HelpDialog.tsx +14 -1
  17. package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +1 -13
  18. package/src/LinearGenomeView/components/OverviewScaleBar.tsx +7 -3
  19. package/src/LinearGenomeView/components/TrackContainer.tsx +24 -39
  20. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +194 -197
  21. package/src/LinearGenomeView/index.test.ts +44 -42
  22. package/src/LinearGenomeView/index.tsx +55 -131
  23. package/src/LinearGenomeView/volvoxDisplayedRegions.json +16 -0
  24. package/dist/LinearGenomeView/components/ReturnToImportFormDialog.d.ts +0 -9
  25. package/src/LinearGenomeView/components/ReturnToImportFormDialog.tsx +0 -83
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-linear-genome-view",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "ab41f017840ffef09f5d60b008281cedaa5abe26"
64
+ "gitHead": "9fcca7793af0df2d6e527ddaace2b368c8ed2879"
65
65
  }
@@ -31,7 +31,7 @@ const useStyles = makeStyles(theme => ({
31
31
  color: theme.palette.common.white,
32
32
  fontFamily: theme.typography.fontFamily,
33
33
  padding: '4px 8px',
34
- fontSize: theme.typography.pxToRem(10),
34
+ fontSize: theme.typography.pxToRem(12),
35
35
  lineHeight: `${round(14 / 10)}em`,
36
36
  maxWidth: 300,
37
37
  wordWrap: 'break-word',
@@ -426,7 +426,12 @@ export const BaseLinearDisplay = types
426
426
  const aborter = new AbortController()
427
427
  const view = getContainingView(self) as LGV
428
428
 
429
- if (!view.initialized) {
429
+ // extra check for contentBlocks.length
430
+ // https://github.com/GMOD/jbrowse-components/issues/2694
431
+ if (
432
+ !view.initialized ||
433
+ !view.staticBlocks.contentBlocks.length
434
+ ) {
430
435
  return
431
436
  }
432
437
 
@@ -139,7 +139,7 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
139
139
  {
140
140
  label: 'Set max height',
141
141
  onClick: () => {
142
- getSession(self).queueDialog((doneCallback: Function) => [
142
+ getSession(self).queueDialog(doneCallback => [
143
143
  SetMaxHeightDlg,
144
144
  { model: self, handleClose: doneCallback },
145
145
  ])
@@ -53,7 +53,9 @@ export default function HelpDialog({
53
53
  <li>
54
54
  Jump to a specific region by typing the region into the location box
55
55
  as: <code>ref:start..end</code> or <code>ref:start-end</code>.
56
- Commas are allowed in the start and end coordinates.
56
+ Commas are allowed in the start and end coordinates. A
57
+ space-separated list of locstrings can be used to open up multiple
58
+ chromosomes at a time
57
59
  </li>
58
60
  </ul>
59
61
  <h3>Example Searches</h3>
@@ -68,6 +70,17 @@ export default function HelpDialog({
68
70
  <code>chr4:79,500,000..80,000,000</code> - jumps the region on
69
71
  chromosome 4 between 79.5Mb and 80Mb.
70
72
  </li>
73
+ <li>
74
+ <code>chr1:1-100 chr2:1-100</code> - create a split view of
75
+ chr1:1-100 and chr2:1-100
76
+ </li>
77
+ <li>
78
+ <code>chr1 chr2 chr3</code> - open up multiple chromosomes at once
79
+ </li>
80
+ <li>
81
+ <code>chr1:1-100[rev] chr2:1-100</code> - open up the first region
82
+ in the horizontally flipped orientation
83
+ </li>
71
84
  </ul>
72
85
  </DialogContent>
73
86
  <Divider />
@@ -3,7 +3,7 @@ import { renderToStaticMarkup } from 'react-dom/server'
3
3
  import { when } from 'mobx'
4
4
  import { getParent } from 'mobx-state-tree'
5
5
  import { getConf, readConfObject } from '@jbrowse/core/configuration'
6
- import { getSession } from '@jbrowse/core/util'
6
+ import { getSession, getBpDisplayStr } from '@jbrowse/core/util'
7
7
  import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
8
8
  import Base1DView from '@jbrowse/core/util/Base1DViewModel'
9
9
 
@@ -18,18 +18,6 @@ import { Polygon, Cytobands } from './OverviewScaleBar'
18
18
 
19
19
  type LGV = LinearGenomeViewModel
20
20
 
21
- function getBpDisplayStr(totalBp: number) {
22
- let displayBp
23
- if (Math.floor(totalBp / 1000000) > 0) {
24
- displayBp = `${parseFloat((totalBp / 1000000).toPrecision(3))}Mbp`
25
- } else if (Math.floor(totalBp / 1000) > 0) {
26
- displayBp = `${parseFloat((totalBp / 1000).toPrecision(3))}Kbp`
27
- } else {
28
- displayBp = `${Math.floor(totalBp)}bp`
29
- }
30
- return displayBp
31
- }
32
-
33
21
  function ScaleBar({ model, fontSize }: { model: LGV; fontSize: number }) {
34
22
  const {
35
23
  offsetPx,
@@ -181,7 +181,7 @@ const Cytobands = observer(
181
181
  assembly?: Assembly
182
182
  block: ContentBlock
183
183
  }) => {
184
- const { offsetPx } = block
184
+ const { offsetPx, reversed } = block
185
185
  const cytobands = assembly?.cytobands
186
186
  ?.map(f => ({
187
187
  refName: assembly.getCanonicalRefName(f.get('refName')),
@@ -205,6 +205,10 @@ const Cytobands = observer(
205
205
  ]
206
206
  })
207
207
 
208
+ const arr = cytobands || []
209
+ const lcap = reversed ? arr.length - 1 : 0
210
+ const rcap = reversed ? 0 : arr.length - 1
211
+
208
212
  let firstCent = true
209
213
  return cytobands ? (
210
214
  <g transform={`translate(-${offsetPx})`}>
@@ -238,7 +242,7 @@ const Cytobands = observer(
238
242
  )
239
243
  }
240
244
 
241
- if (index === 0) {
245
+ if (lcap === index) {
242
246
  return (
243
247
  <path
244
248
  key={key}
@@ -252,7 +256,7 @@ const Cytobands = observer(
252
256
  fill={colorMap[type]}
253
257
  />
254
258
  )
255
- } else if (index === cytobands.length - 1) {
259
+ } else if (rcap === index) {
256
260
  return (
257
261
  <path
258
262
  key={key}
@@ -1,13 +1,12 @@
1
1
  import React, { useEffect, useRef } from 'react'
2
+ import { Paper, makeStyles } from '@material-ui/core'
2
3
  import { observer } from 'mobx-react'
3
4
  import { isAlive } from 'mobx-state-tree'
4
- import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
5
5
  import { getConf } from '@jbrowse/core/configuration'
6
+ import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'
6
7
  import { ResizeHandle } from '@jbrowse/core/ui'
7
- import { useDebouncedCallback, getContainingView } from '@jbrowse/core/util'
8
+ import { useDebouncedCallback } from '@jbrowse/core/util'
8
9
  import clsx from 'clsx'
9
- import Paper from '@material-ui/core/Paper'
10
- import { makeStyles } from '@material-ui/core/styles'
11
10
 
12
11
  import { LinearGenomeViewModel, RESIZE_HANDLE_HEIGHT } from '..'
13
12
  import TrackLabel from './TrackLabel'
@@ -16,8 +15,6 @@ const useStyles = makeStyles(theme => ({
16
15
  root: {},
17
16
  resizeHandle: {
18
17
  height: RESIZE_HANDLE_HEIGHT,
19
- boxSizing: 'border-box',
20
- position: 'relative',
21
18
  zIndex: 2,
22
19
  },
23
20
  overlay: {
@@ -29,13 +26,6 @@ const useStyles = makeStyles(theme => ({
29
26
  zIndex: 3,
30
27
  borderRadius: theme.shape.borderRadius,
31
28
  },
32
- renderingComponentContainer: {
33
- position: 'absolute',
34
- // -1 offset because of the 1px border of the Paper
35
- left: -1,
36
- height: '100%',
37
- width: '100%',
38
- },
39
29
  trackLabel: {
40
30
  zIndex: 3,
41
31
  margin: theme.spacing(1),
@@ -54,24 +44,25 @@ const useStyles = makeStyles(theme => ({
54
44
  position: 'relative',
55
45
  background: 'none',
56
46
  zIndex: 2,
57
- boxSizing: 'content-box',
58
47
  },
59
48
  }))
60
49
 
61
50
  type LGV = LinearGenomeViewModel
62
51
 
63
- function TrackContainer(props: {
64
- model: LinearGenomeViewModel
52
+ function TrackContainer({
53
+ model,
54
+ track,
55
+ }: {
56
+ model: LGV
65
57
  track: BaseTrackModel
66
58
  }) {
67
59
  const classes = useStyles()
68
- const { model, track } = props
69
60
  const display = track.displays[0]
70
- const { horizontalScroll, draggingTrackId, moveTrack } = model
61
+ const { id, trackLabels, horizontalScroll, draggingTrackId, moveTrack } =
62
+ model
71
63
  const { height } = display
72
- const view = getContainingView(display) as LGV
73
64
  const trackId = getConf(track, 'trackId')
74
- const ref = useRef(null)
65
+ const ref = useRef<HTMLDivElement>(null)
75
66
 
76
67
  useEffect(() => {
77
68
  if (ref.current) {
@@ -96,18 +87,6 @@ function TrackContainer(props: {
96
87
 
97
88
  return (
98
89
  <div className={classes.root}>
99
- {view.trackLabels !== 'hidden' ? (
100
- <TrackLabel
101
- track={track}
102
- className={clsx(
103
- classes.trackLabel,
104
- view.trackLabels === 'overlapping'
105
- ? classes.trackLabelOverlap
106
- : classes.trackLabelInline,
107
- )}
108
- />
109
- ) : null}
110
-
111
90
  <Paper
112
91
  variant="outlined"
113
92
  className={classes.trackRenderingContainer}
@@ -117,14 +96,21 @@ function TrackContainer(props: {
117
96
  display.setScrollTop(target.scrollTop)
118
97
  }}
119
98
  onDragEnter={debouncedOnDragEnter}
120
- data-testid={`trackRenderingContainer-${view.id}-${trackId}`}
99
+ data-testid={`trackRenderingContainer-${id}-${trackId}`}
121
100
  role="presentation"
122
101
  >
123
- <div
124
- ref={ref}
125
- className={classes.renderingComponentContainer}
126
- style={{ transform: `scaleX(${model.scaleFactor})` }}
127
- >
102
+ {trackLabels !== 'hidden' ? (
103
+ <TrackLabel
104
+ track={track}
105
+ className={clsx(
106
+ classes.trackLabel,
107
+ trackLabels === 'overlapping'
108
+ ? classes.trackLabelOverlap
109
+ : classes.trackLabelInline,
110
+ )}
111
+ />
112
+ ) : null}
113
+ <div ref={ref} style={{ transform: `scaleX(${model.scaleFactor})` }}>
128
114
  <RenderingComponent
129
115
  model={display}
130
116
  blockState={{}}
@@ -140,7 +126,6 @@ function TrackContainer(props: {
140
126
  top: display.height - 20,
141
127
  }}
142
128
  >
143
- {' '}
144
129
  <DisplayBlurb model={display} />
145
130
  </div>
146
131
  ) : null}