@jbrowse/plugin-wiggle 2.2.1 → 2.3.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.
Files changed (109) hide show
  1. package/dist/BigWigAdapter/index.js +1 -0
  2. package/dist/BigWigAdapter/index.js.map +1 -1
  3. package/dist/LinearWiggleDisplay/components/SetColorDialog.js +3 -19
  4. package/dist/LinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
  5. package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  6. package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
  7. package/dist/LinearWiggleDisplay/index.js +1 -0
  8. package/dist/LinearWiggleDisplay/index.js.map +1 -1
  9. package/dist/LinearWiggleDisplay/models/model.d.ts +25 -17
  10. package/dist/LinearWiggleDisplay/models/model.js +14 -7
  11. package/dist/LinearWiggleDisplay/models/model.js.map +1 -1
  12. package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.d.ts +7 -0
  13. package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.js +43 -0
  14. package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.js.map +1 -0
  15. package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +4 -22
  16. package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
  17. package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  18. package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
  19. package/dist/MultiLinearWiggleDisplay/index.js +1 -0
  20. package/dist/MultiLinearWiggleDisplay/index.js.map +1 -1
  21. package/dist/MultiLinearWiggleDisplay/models/model.d.ts +6 -7
  22. package/dist/MultiLinearWiggleDisplay/models/model.js +15 -8
  23. package/dist/MultiLinearWiggleDisplay/models/model.js.map +1 -1
  24. package/dist/MultiQuantitativeTrack/index.js +1 -0
  25. package/dist/MultiQuantitativeTrack/index.js.map +1 -1
  26. package/dist/MultiWiggleAdapter/index.js +4 -0
  27. package/dist/MultiWiggleAdapter/index.js.map +1 -1
  28. package/dist/QuantitativeTrack/index.js +1 -0
  29. package/dist/QuantitativeTrack/index.js.map +1 -1
  30. package/dist/WiggleRendering.js +1 -1
  31. package/dist/WiggleRendering.js.map +1 -1
  32. package/dist/drawxy.js +1 -0
  33. package/dist/drawxy.js.map +1 -1
  34. package/dist/index.d.ts +13 -15
  35. package/dist/index.js +1 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/{LinearWiggleDisplay/components → shared}/SetMinMaxDialog.d.ts +0 -0
  38. package/dist/shared/SetMinMaxDialog.js +53 -0
  39. package/dist/shared/SetMinMaxDialog.js.map +1 -0
  40. package/esm/BigWigAdapter/index.js +1 -0
  41. package/esm/BigWigAdapter/index.js.map +1 -1
  42. package/esm/LinearWiggleDisplay/components/SetColorDialog.js +4 -17
  43. package/esm/LinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
  44. package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  45. package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
  46. package/esm/LinearWiggleDisplay/index.js +1 -0
  47. package/esm/LinearWiggleDisplay/index.js.map +1 -1
  48. package/esm/LinearWiggleDisplay/models/model.d.ts +25 -17
  49. package/esm/LinearWiggleDisplay/models/model.js +14 -7
  50. package/esm/LinearWiggleDisplay/models/model.js.map +1 -1
  51. package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.d.ts +7 -0
  52. package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.js +38 -0
  53. package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.js.map +1 -0
  54. package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +5 -23
  55. package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
  56. package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  57. package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
  58. package/esm/MultiLinearWiggleDisplay/index.js +1 -0
  59. package/esm/MultiLinearWiggleDisplay/index.js.map +1 -1
  60. package/esm/MultiLinearWiggleDisplay/models/model.d.ts +6 -7
  61. package/esm/MultiLinearWiggleDisplay/models/model.js +15 -8
  62. package/esm/MultiLinearWiggleDisplay/models/model.js.map +1 -1
  63. package/esm/MultiQuantitativeTrack/index.js +1 -0
  64. package/esm/MultiQuantitativeTrack/index.js.map +1 -1
  65. package/esm/MultiWiggleAdapter/index.js +4 -0
  66. package/esm/MultiWiggleAdapter/index.js.map +1 -1
  67. package/esm/QuantitativeTrack/index.js +1 -0
  68. package/esm/QuantitativeTrack/index.js.map +1 -1
  69. package/esm/WiggleRendering.js +1 -1
  70. package/esm/WiggleRendering.js.map +1 -1
  71. package/esm/drawxy.js +1 -0
  72. package/esm/drawxy.js.map +1 -1
  73. package/esm/index.d.ts +13 -15
  74. package/esm/index.js +1 -1
  75. package/esm/index.js.map +1 -1
  76. package/{dist/MultiLinearWiggleDisplay/components → esm/shared}/SetMinMaxDialog.d.ts +0 -0
  77. package/esm/shared/SetMinMaxDialog.js +27 -0
  78. package/esm/shared/SetMinMaxDialog.js.map +1 -0
  79. package/package.json +4 -5
  80. package/src/BigWigAdapter/__snapshots__/BigWigAdapter.test.ts.snap +3 -3
  81. package/src/BigWigAdapter/index.ts +1 -0
  82. package/src/LinearWiggleDisplay/components/SetColorDialog.tsx +7 -27
  83. package/src/LinearWiggleDisplay/components/WiggleDisplayComponent.tsx +3 -1
  84. package/src/LinearWiggleDisplay/index.ts +1 -0
  85. package/src/LinearWiggleDisplay/models/model.tsx +13 -7
  86. package/src/MultiLinearWiggleDisplay/components/DraggableDialog.tsx +71 -0
  87. package/src/MultiLinearWiggleDisplay/components/SetColorDialog.tsx +7 -41
  88. package/src/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.tsx +1 -1
  89. package/src/MultiLinearWiggleDisplay/index.ts +1 -0
  90. package/src/MultiLinearWiggleDisplay/models/model.tsx +15 -8
  91. package/src/MultiQuantitativeTrack/index.ts +1 -0
  92. package/src/MultiWiggleAdapter/index.ts +4 -0
  93. package/src/QuantitativeTrack/index.ts +1 -0
  94. package/src/WiggleRendering.tsx +1 -1
  95. package/src/drawxy.ts +1 -0
  96. package/src/index.ts +1 -2
  97. package/src/shared/SetMinMaxDialog.tsx +88 -0
  98. package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js +0 -75
  99. package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js.map +0 -1
  100. package/dist/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js +0 -75
  101. package/dist/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js.map +0 -1
  102. package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.d.ts +0 -11
  103. package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.js +0 -46
  104. package/esm/LinearWiggleDisplay/components/SetMinMaxDialog.js.map +0 -1
  105. package/esm/MultiLinearWiggleDisplay/components/SetMinMaxDialog.d.ts +0 -11
  106. package/esm/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js +0 -46
  107. package/esm/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js.map +0 -1
  108. package/src/LinearWiggleDisplay/components/SetMinMaxDialog.tsx +0 -113
  109. package/src/MultiLinearWiggleDisplay/components/SetMinMaxDialog.tsx +0 -113
@@ -12,6 +12,7 @@ export default (pluginManager: PluginManager) => {
12
12
  const stateModel = modelFactory(pluginManager, configSchema)
13
13
  return new DisplayType({
14
14
  name: 'LinearWiggleDisplay',
15
+ displayName: 'Wiggle display',
15
16
  configSchema,
16
17
  stateModel,
17
18
  trackType: 'QuantitativeTrack',
@@ -32,7 +32,7 @@ import {
32
32
  import Tooltip from '../components/Tooltip'
33
33
  import { YScaleBar } from '../components/WiggleDisplayComponent'
34
34
 
35
- const SetMinMaxDlg = lazy(() => import('../components/SetMinMaxDialog'))
35
+ const SetMinMaxDlg = lazy(() => import('../../shared/SetMinMaxDialog'))
36
36
  const SetColorDlg = lazy(() => import('../components/SetColorDialog'))
37
37
 
38
38
  // using a map because it preserves order
@@ -126,9 +126,8 @@ function stateModelFactory(
126
126
  }),
127
127
  )
128
128
  .volatile(() => ({
129
- statsReady: false,
130
129
  message: undefined as undefined | string,
131
- stats: { scoreMin: 0, scoreMax: 50 },
130
+ stats: undefined as { scoreMin: number; scoreMax: number } | undefined,
132
131
  statsFetchInProgress: undefined as undefined | AbortController,
133
132
  }))
134
133
  .actions(self => ({
@@ -138,13 +137,14 @@ function stateModelFactory(
138
137
  updateStats(stats: { scoreMin: number; scoreMax: number }) {
139
138
  const { scoreMin, scoreMax } = stats
140
139
  const EPSILON = 0.000001
141
- if (
140
+ if (!self.stats) {
141
+ self.stats = { scoreMin, scoreMax }
142
+ } else if (
142
143
  Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
143
144
  Math.abs(self.stats.scoreMin - scoreMin) > EPSILON
144
145
  ) {
145
146
  self.stats = { scoreMin, scoreMax }
146
147
  }
147
- self.statsReady = true
148
148
  },
149
149
  /**
150
150
  * #action
@@ -401,6 +401,9 @@ function stateModelFactory(
401
401
  */
402
402
  get domain() {
403
403
  const { stats, scaleType, minScore, maxScore } = self
404
+ if (!stats) {
405
+ return undefined
406
+ }
404
407
 
405
408
  const ret = getNiceDomain({
406
409
  domain: [stats.scoreMin, stats.scoreMax],
@@ -475,6 +478,9 @@ function stateModelFactory(
475
478
  const minimalTicks = getConf(self, 'minimalTicks')
476
479
  const inverted = getConf(self, 'inverted')
477
480
  const range = [height - YSCALEBAR_LABEL_OFFSET, YSCALEBAR_LABEL_OFFSET]
481
+ if (!domain) {
482
+ return undefined
483
+ }
478
484
  const scale = getScale({
479
485
  scaleType,
480
486
  domain,
@@ -506,7 +512,7 @@ function stateModelFactory(
506
512
  const { filters, ticks, height, resolution, scaleOpts } = self
507
513
  return {
508
514
  ...superProps,
509
- notReady: superProps.notReady || !self.statsReady,
515
+ notReady: superProps.notReady || !self.stats,
510
516
  rpcDriverName: self.rpcDriverName,
511
517
  displayModel: self,
512
518
  config: self.rendererConfig,
@@ -702,7 +708,7 @@ function stateModelFactory(
702
708
  * #action
703
709
  */
704
710
  async renderSvg(opts: ExportSvgOpts) {
705
- await when(() => self.statsReady && !!self.regionCannotBeRenderedText)
711
+ await when(() => !!self.stats && !!self.regionCannotBeRenderedText)
706
712
  const { needsScalebar, stats } = self
707
713
  const { offsetPx } = getContainingView(self) as LGV
708
714
  return (
@@ -0,0 +1,71 @@
1
+ import React from 'react'
2
+ import {
3
+ Dialog,
4
+ DialogTitle,
5
+ IconButton,
6
+ Divider,
7
+ DialogProps,
8
+ Paper,
9
+ PaperProps,
10
+ ScopedCssBaseline,
11
+ } from '@mui/material'
12
+ import { observer } from 'mobx-react'
13
+ import { makeStyles } from 'tss-react/mui'
14
+ import Draggable from 'react-draggable'
15
+
16
+ // icons
17
+ import CloseIcon from '@mui/icons-material/Close'
18
+
19
+ const useStyles = makeStyles()(theme => ({
20
+ closeButton: {
21
+ position: 'absolute',
22
+ right: theme.spacing(1),
23
+ top: theme.spacing(1),
24
+ color: theme.palette.grey[500],
25
+ },
26
+ }))
27
+
28
+ // draggable dialog demo https://mui.com/material-ui/react-dialog/#draggable-dialog
29
+ function PaperComponent(props: PaperProps) {
30
+ return (
31
+ <Draggable
32
+ handle="#draggable-dialog-title"
33
+ cancel={'[class*="MuiDialogContent-root"]'}
34
+ >
35
+ <Paper {...props} />
36
+ </Draggable>
37
+ )
38
+ }
39
+
40
+ function DraggableDialog(props: DialogProps & { title: string }) {
41
+ const { classes } = useStyles()
42
+ const { title, children, onClose } = props
43
+
44
+ return (
45
+ <Dialog
46
+ {...props}
47
+ PaperComponent={PaperComponent}
48
+ aria-labelledby="draggable-dialog-title" // this area is important for the draggable functionality
49
+ >
50
+ <ScopedCssBaseline>
51
+ <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
52
+ {title}
53
+ {onClose ? (
54
+ <IconButton
55
+ className={classes.closeButton}
56
+ onClick={() => {
57
+ // @ts-ignore
58
+ onClose()
59
+ }}
60
+ >
61
+ <CloseIcon />
62
+ </IconButton>
63
+ ) : null}
64
+ </DialogTitle>
65
+ <Divider />
66
+ {children}
67
+ </ScopedCssBaseline>
68
+ </Dialog>
69
+ )
70
+ }
71
+ export default observer(DraggableDialog)
@@ -1,14 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import {
3
- Button,
4
- Dialog,
5
- DialogContent,
6
- DialogActions,
7
- DialogTitle,
8
- IconButton,
9
- Paper,
10
- PaperProps,
11
- } from '@mui/material'
2
+ import { Button, DialogContent, DialogActions } from '@mui/material'
12
3
  import { makeStyles } from 'tss-react/mui'
13
4
  import {
14
5
  getStr,
@@ -17,45 +8,27 @@ import {
17
8
  useLocalStorage,
18
9
  } from '@jbrowse/core/util'
19
10
  import { DataGrid, GridCellParams } from '@mui/x-data-grid'
20
- import Draggable from 'react-draggable'
21
11
  import clone from 'clone'
22
12
 
23
13
  // locals
14
+ import DraggableDialog from './DraggableDialog'
24
15
  import ColorPicker, { ColorPopover } from '@jbrowse/core/ui/ColorPicker'
25
16
  import { UriLink } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail'
26
17
  import { moveUp, moveDown } from './util'
27
18
  import { Source } from '../../util'
28
19
 
29
20
  // icons
30
- import CloseIcon from '@mui/icons-material/Close'
31
21
  import KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp'
32
22
  import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown'
33
23
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'
34
24
  import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'
35
25
 
36
- const useStyles = makeStyles()(theme => ({
37
- closeButton: {
38
- position: 'absolute',
39
- right: theme.spacing(1),
40
- top: theme.spacing(1),
41
- color: theme.palette.grey[500],
42
- },
26
+ const useStyles = makeStyles()({
43
27
  content: {
44
28
  minWidth: 800,
45
29
  },
46
- }))
30
+ })
47
31
 
48
- // draggable dialog demo https://mui.com/material-ui/react-dialog/#draggable-dialog
49
- function PaperComponent(props: PaperProps) {
50
- return (
51
- <Draggable
52
- handle="#draggable-dialog-title"
53
- cancel={'[class*="MuiDialogContent-root"]'}
54
- >
55
- <Paper {...props} />
56
- </Draggable>
57
- )
58
- }
59
32
  export default function SetColorDialog({
60
33
  model,
61
34
  handleClose,
@@ -72,19 +45,12 @@ export default function SetColorDialog({
72
45
  const [currLayout, setCurrLayout] = useState(clone(sources || []))
73
46
  const [showTips, setShowTips] = useLocalStorage('multiwiggle-showTips', true)
74
47
  return (
75
- <Dialog
76
- PaperComponent={PaperComponent}
48
+ <DraggableDialog
77
49
  open
78
50
  onClose={handleClose}
79
51
  maxWidth="xl"
80
- aria-labelledby="draggable-dialog-title" // this area is important for the draggable functionality
52
+ title={'Multi-wiggle color/arrangement editor'}
81
53
  >
82
- <DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
83
- Multi-wiggle color/arrangement editor{' '}
84
- <IconButton className={classes.closeButton} onClick={handleClose}>
85
- <CloseIcon />
86
- </IconButton>
87
- </DialogTitle>
88
54
  <DialogContent className={classes.content}>
89
55
  <Button
90
56
  variant="contained"
@@ -159,7 +125,7 @@ export default function SetColorDialog({
159
125
  Submit
160
126
  </Button>
161
127
  </DialogActions>
162
- </Dialog>
128
+ </DraggableDialog>
163
129
  )
164
130
  }
165
131
 
@@ -76,7 +76,7 @@ const ScoreLegend = observer(({ model }: { model: WiggleDisplayModel }) => {
76
76
  const { ticks, scaleType } = model
77
77
  const { width } = getContainingView(model) as LGV
78
78
  const legend =
79
- `[${ticks.values[0]}-${ticks.values[1]}]` +
79
+ `[${ticks?.values[0]}-${ticks?.values[1]}]` +
80
80
  (scaleType === 'log' ? ' (log scale)' : '')
81
81
  const len = measureText(legend, 14)
82
82
  const padding = 25
@@ -10,6 +10,7 @@ export default (pluginManager: PluginManager) => {
10
10
  const configSchema = configSchemaFactory(pluginManager)
11
11
  return new DisplayType({
12
12
  name: 'MultiLinearWiggleDisplay',
13
+ displayName: 'Multi-wiggle display',
13
14
  configSchema,
14
15
  stateModel: modelFactory(pluginManager, configSchema),
15
16
  trackType: 'MultiQuantitativeTrack',
@@ -42,7 +42,7 @@ const randomColor = () =>
42
42
  '#000000'.replace(/0/g, () => (~~(Math.random() * 16)).toString(16))
43
43
 
44
44
  // lazt components
45
- const SetMinMaxDlg = lazy(() => import('../components/SetMinMaxDialog'))
45
+ const SetMinMaxDlg = lazy(() => import('../../shared/SetMinMaxDialog'))
46
46
  const SetColorDlg = lazy(() => import('../components/SetColorDialog'))
47
47
 
48
48
  // using a map because it preserves order
@@ -97,9 +97,8 @@ const stateModelFactory = (
97
97
  }),
98
98
  )
99
99
  .volatile(() => ({
100
- statsReady: false,
101
100
  message: undefined as undefined | string,
102
- stats: { scoreMin: 0, scoreMax: 50 },
101
+ stats: undefined as { scoreMin: number; scoreMax: number } | undefined,
103
102
  statsRegion: undefined as string | undefined,
104
103
  statsFetchInProgress: undefined as undefined | AbortController,
105
104
  featureUnderMouseVolatile: undefined as Feature | undefined,
@@ -115,12 +114,13 @@ const stateModelFactory = (
115
114
  updateStats(stats: { scoreMin: number; scoreMax: number }) {
116
115
  const { scoreMin, scoreMax } = stats
117
116
  const EPSILON = 0.000001
118
- if (
117
+ if (!self.stats) {
118
+ self.stats = { scoreMin, scoreMax }
119
+ } else if (
119
120
  Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
120
121
  Math.abs(self.stats.scoreMin - scoreMin) > EPSILON
121
122
  ) {
122
123
  self.stats = { scoreMin, scoreMax }
123
- self.statsReady = true
124
124
  }
125
125
  },
126
126
  setSources(sources: Source[]) {
@@ -376,6 +376,9 @@ const stateModelFactory = (
376
376
  },
377
377
  get domain() {
378
378
  const { stats, scaleType, minScore, maxScore } = self
379
+ if (!stats) {
380
+ return undefined
381
+ }
379
382
  const { scoreMin, scoreMax } = stats
380
383
 
381
384
  const ret = getNiceDomain({
@@ -440,6 +443,10 @@ const stateModelFactory = (
440
443
  const { scaleType, domain, isMultiRow, rowHeight, useMinimalTicks } =
441
444
  self
442
445
 
446
+ if (!domain) {
447
+ return undefined
448
+ }
449
+
443
450
  const offset = isMultiRow ? 0 : YSCALEBAR_LABEL_OFFSET
444
451
  const ticks = axisPropsFromTickScale(
445
452
  getScale({
@@ -485,14 +492,14 @@ const stateModelFactory = (
485
492
  resolution,
486
493
  rpcDriverName,
487
494
  scaleOpts,
495
+ stats,
488
496
  sources,
489
- statsReady,
490
497
  ticks,
491
498
  rendererConfig: config,
492
499
  } = self
493
500
  return {
494
501
  ...superProps,
495
- notReady: superProps.notReady || !sources || !statsReady,
502
+ notReady: superProps.notReady || !sources || !stats,
496
503
  displayModel: self,
497
504
  config,
498
505
  displayCrossHatches,
@@ -702,7 +709,7 @@ const stateModelFactory = (
702
709
  )
703
710
  },
704
711
  async renderSvg(opts: ExportSvgOpts) {
705
- await when(() => self.statsReady && !!self.regionCannotBeRenderedText)
712
+ await when(() => !!self.stats && !!self.regionCannotBeRenderedText)
706
713
  const { offsetPx } = getContainingView(self) as LGV
707
714
  return (
708
715
  <>
@@ -8,6 +8,7 @@ export default (pluginManager: PluginManager) => {
8
8
  const configSchema = configSchemaF(pluginManager)
9
9
  return new TrackType({
10
10
  name: 'MultiQuantitativeTrack',
11
+ displayName: 'Multi-quantitative track',
11
12
  configSchema,
12
13
  stateModel: createBaseTrackModel(
13
14
  pluginManager,
@@ -7,12 +7,16 @@ export default (pluginManager: PluginManager) => {
7
7
  () =>
8
8
  new AdapterType({
9
9
  name: 'MultiWiggleAdapter',
10
+ displayName: 'Multi-wiggle adapter',
10
11
  configSchema,
11
12
  adapterCapabilities: [
12
13
  'hasResolution',
13
14
  'hasLocalStats',
14
15
  'hasGlobalStats',
15
16
  ],
17
+ adapterMetadata: {
18
+ hiddenFromGUI: true,
19
+ },
16
20
  getAdapterClass: () =>
17
21
  import('./MultiWiggleAdapter').then(r => r.default),
18
22
  }),
@@ -8,6 +8,7 @@ export default (pluginManager: PluginManager) => {
8
8
  const configSchema = configSchemaF(pluginManager)
9
9
  return new TrackType({
10
10
  name: 'QuantitativeTrack',
11
+ displayName: 'Quantitative track',
11
12
  configSchema,
12
13
  stateModel: createBaseTrackModel(
13
14
  pluginManager,
@@ -40,7 +40,7 @@ function WiggleRendering(props: {
40
40
  const clientBp = region.start + bpPerPx * px
41
41
  let featureUnderMouse
42
42
  for (const feature of features.values()) {
43
- // bpPerPx added to the end to accomodate "reduced features" (one feature per px)
43
+ // bpPerPx added to the end to accommodate "reduced features" (one feature per px)
44
44
  if (
45
45
  clientBp <= feature.get('end') + bpPerPx &&
46
46
  clientBp >= feature.get('start')
package/src/drawxy.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  import { clamp, featureSpanPx, Feature, Region } from '@jbrowse/core/util'
6
6
  import { getOrigin, getScale, ScaleOpts } from './util'
7
7
 
8
+ // avoid drawing negative width features for SVG exports
8
9
  function fillRectCtx(
9
10
  x: number,
10
11
  y: number,
package/src/index.ts CHANGED
@@ -112,10 +112,9 @@ export default class WigglePlugin extends Plugin {
112
112
  XYPlotRendererReactComponent,
113
113
  XYPlotRenderer,
114
114
  WiggleBaseRenderer,
115
-
115
+ linearWiggleDisplayModelFactory,
116
116
  xyPlotRendererConfigSchema,
117
117
  utils,
118
- linearWiggleDisplayModelFactory,
119
118
  }
120
119
  }
121
120
 
@@ -0,0 +1,88 @@
1
+ import React, { useState } from 'react'
2
+ import {
3
+ Button,
4
+ DialogActions,
5
+ DialogContent,
6
+ TextField,
7
+ Typography,
8
+ } from '@mui/material'
9
+ import { Dialog } from '@jbrowse/core/ui'
10
+
11
+ export default function SetMinMaxDlg(props: {
12
+ model: {
13
+ minScore: number
14
+ maxScore: number
15
+ scaleType: string
16
+ setMinScore: Function
17
+ setMaxScore: Function
18
+ }
19
+ handleClose: () => void
20
+ }) {
21
+ const { model, handleClose } = props
22
+ const { minScore, maxScore, scaleType } = model
23
+
24
+ const [min, setMin] = useState(
25
+ `${minScore !== Number.MIN_VALUE ? minScore : ''}`,
26
+ )
27
+ const [max, setMax] = useState(
28
+ `${maxScore !== Number.MAX_VALUE ? maxScore : ''}`,
29
+ )
30
+
31
+ const ok =
32
+ min !== '' && max !== '' && !Number.isNaN(+min) && !Number.isNaN(+max)
33
+ ? +max > +min
34
+ : true
35
+
36
+ const logOk =
37
+ scaleType === 'log' && min !== '' && !Number.isNaN(+min) ? +min > 0 : true
38
+
39
+ return (
40
+ <Dialog open onClose={handleClose} title="Set min/max score for track">
41
+ <DialogContent>
42
+ <Typography>Enter min/max score: </Typography>
43
+ {!ok ? (
44
+ <Typography color="error">
45
+ Max is greater than or equal to min
46
+ </Typography>
47
+ ) : null}
48
+
49
+ {!logOk ? (
50
+ <Typography color="error">
51
+ Min score should be greater than 0 for log scale
52
+ </Typography>
53
+ ) : null}
54
+
55
+ <TextField
56
+ value={min}
57
+ onChange={event => setMin(event.target.value)}
58
+ placeholder="Enter min score"
59
+ />
60
+ <TextField
61
+ value={max}
62
+ onChange={event => setMax(event.target.value)}
63
+ placeholder="Enter max score"
64
+ />
65
+ </DialogContent>
66
+ <DialogActions>
67
+ <Button
68
+ variant="contained"
69
+ color="primary"
70
+ type="submit"
71
+ style={{ marginLeft: 20 }}
72
+ disabled={!ok}
73
+ onClick={() => {
74
+ model.setMinScore(
75
+ min !== '' && !Number.isNaN(+min) ? +min : undefined,
76
+ )
77
+ model.setMaxScore(
78
+ max !== '' && !Number.isNaN(+max) ? +max : undefined,
79
+ )
80
+ handleClose()
81
+ }}
82
+ >
83
+ Submit
84
+ </Button>
85
+ </DialogActions>
86
+ </Dialog>
87
+ )
88
+ }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
30
- const material_1 = require("@mui/material");
31
- const mui_1 = require("tss-react/mui");
32
- const Close_1 = __importDefault(require("@mui/icons-material/Close"));
33
- const useStyles = (0, mui_1.makeStyles)()(theme => ({
34
- root: {},
35
- closeButton: {
36
- position: 'absolute',
37
- right: theme.spacing(1),
38
- top: theme.spacing(1),
39
- color: theme.palette.grey[500],
40
- },
41
- }));
42
- function SetMinMaxDlg(props) {
43
- const { classes } = useStyles();
44
- const { model, handleClose } = props;
45
- const { minScore, maxScore, scaleType } = model;
46
- const [min, setMin] = (0, react_1.useState)(`${minScore !== Number.MIN_VALUE ? minScore : ''}`);
47
- const [max, setMax] = (0, react_1.useState)(`${maxScore !== Number.MAX_VALUE ? maxScore : ''}`);
48
- const ok = min !== '' && max !== '' && !Number.isNaN(+min) && !Number.isNaN(+max)
49
- ? +max > +min
50
- : true;
51
- const logOk = scaleType === 'log' && min !== '' && !Number.isNaN(+min) ? +min > 0 : true;
52
- return (react_1.default.createElement(material_1.Dialog, { open: true, onClose: handleClose },
53
- react_1.default.createElement(material_1.DialogTitle, null,
54
- "Set min/max score for track",
55
- react_1.default.createElement(material_1.IconButton, { className: classes.closeButton, onClick: handleClose },
56
- react_1.default.createElement(Close_1.default, null))),
57
- react_1.default.createElement(material_1.DialogContent, { style: { overflowX: 'hidden' } },
58
- react_1.default.createElement("div", { className: classes.root },
59
- react_1.default.createElement(material_1.Typography, null, "Enter min/max score: "),
60
- !ok ? (react_1.default.createElement(material_1.Typography, { color: "error" }, "Max is greater than or equal to min")) : null,
61
- !logOk ? (react_1.default.createElement(material_1.Typography, { color: "error" }, "Min score should be greater than 0 for log scale")) : null,
62
- react_1.default.createElement(material_1.TextField, { value: min, onChange: event => {
63
- setMin(event.target.value);
64
- }, placeholder: "Enter min score" }),
65
- react_1.default.createElement(material_1.TextField, { value: max, onChange: event => {
66
- setMax(event.target.value);
67
- }, placeholder: "Enter max score" }),
68
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
69
- model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
70
- model.setMaxScore(max !== '' && !Number.isNaN(+max) ? +max : undefined);
71
- handleClose();
72
- } }, "Submit")))));
73
- }
74
- exports.default = SetMinMaxDlg;
75
- //# sourceMappingURL=SetMinMaxDialog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SetMinMaxDialog.js","sourceRoot":"","sources":["../../../src/LinearWiggleDisplay/components/SetMinMaxDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,4CAQsB;AACtB,uCAA0C;AAC1C,sEAAiD;AAEjD,MAAM,SAAS,GAAG,IAAA,gBAAU,GAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvC,IAAI,EAAE,EAAE;IACR,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACvB,GAAG,EAAE,KAAK,CAAC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;wBACD,KAAK,CAAC,WAAW,CACf,GAAG,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CACrD,CAAA;wBACD,WAAW,EAAE,CAAA;oBACf,CAAC,aAGM,CACL,CACQ,CACT,CACV,CAAA;AACH,CAAC;AAzFD,+BAyFC"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
30
- const material_1 = require("@mui/material");
31
- const mui_1 = require("tss-react/mui");
32
- const Close_1 = __importDefault(require("@mui/icons-material/Close"));
33
- const useStyles = (0, mui_1.makeStyles)()(theme => ({
34
- root: {},
35
- closeButton: {
36
- position: 'absolute',
37
- right: theme.spacing(1),
38
- top: theme.spacing(1),
39
- color: theme.palette.grey[500],
40
- },
41
- }));
42
- function SetMinMaxDlg(props) {
43
- const { classes } = useStyles();
44
- const { model, handleClose } = props;
45
- const { minScore, maxScore, scaleType } = model;
46
- const [min, setMin] = (0, react_1.useState)(`${minScore !== Number.MIN_VALUE ? minScore : ''}`);
47
- const [max, setMax] = (0, react_1.useState)(`${maxScore !== Number.MAX_VALUE ? maxScore : ''}`);
48
- const ok = min !== '' && max !== '' && !Number.isNaN(+min) && !Number.isNaN(+max)
49
- ? +max > +min
50
- : true;
51
- const logOk = scaleType === 'log' && min !== '' && !Number.isNaN(+min) ? +min > 0 : true;
52
- return (react_1.default.createElement(material_1.Dialog, { open: true, onClose: handleClose },
53
- react_1.default.createElement(material_1.DialogTitle, null,
54
- "Set min/max score for track",
55
- react_1.default.createElement(material_1.IconButton, { className: classes.closeButton, onClick: handleClose },
56
- react_1.default.createElement(Close_1.default, null))),
57
- react_1.default.createElement(material_1.DialogContent, { style: { overflowX: 'hidden' } },
58
- react_1.default.createElement("div", { className: classes.root },
59
- react_1.default.createElement(material_1.Typography, null, "Enter min/max score: "),
60
- !ok ? (react_1.default.createElement(material_1.Typography, { color: "error" }, "Max is greater than or equal to min")) : null,
61
- !logOk ? (react_1.default.createElement(material_1.Typography, { color: "error" }, "Min score should be greater than 0 for log scale")) : null,
62
- react_1.default.createElement(material_1.TextField, { value: min, onChange: event => {
63
- setMin(event.target.value);
64
- }, placeholder: "Enter min score" }),
65
- react_1.default.createElement(material_1.TextField, { value: max, onChange: event => {
66
- setMax(event.target.value);
67
- }, placeholder: "Enter max score" }),
68
- react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
69
- model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
70
- model.setMaxScore(max !== '' && !Number.isNaN(+max) ? +max : undefined);
71
- handleClose();
72
- } }, "Submit")))));
73
- }
74
- exports.default = SetMinMaxDlg;
75
- //# sourceMappingURL=SetMinMaxDialog.js.map