@jbrowse/plugin-dotplot-view 2.6.1 → 2.6.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.
Files changed (188) hide show
  1. package/dist/ComparativeRenderer/index.js +0 -1
  2. package/dist/DotplotDisplay/components/DotplotDisplay.js +0 -1
  3. package/dist/DotplotDisplay/index.js +0 -1
  4. package/dist/DotplotDisplay/renderDotplotBlock.js +0 -1
  5. package/dist/DotplotDisplay/stateModelFactory.js +0 -1
  6. package/dist/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
  7. package/dist/DotplotReadVsRef/index.js +0 -1
  8. package/dist/DotplotRenderer/ComparativeRenderRpc.js +0 -1
  9. package/dist/DotplotRenderer/DotplotRenderer.js +0 -1
  10. package/dist/DotplotRenderer/components/DotplotRendering.js +0 -1
  11. package/dist/DotplotRenderer/configSchema.js +0 -1
  12. package/dist/DotplotRenderer/index.js +0 -1
  13. package/dist/DotplotView/1dview.js +0 -1
  14. package/dist/DotplotView/blockTypes.js +0 -1
  15. package/dist/DotplotView/components/Axes.js +0 -1
  16. package/dist/DotplotView/components/CursorIcon.js +0 -1
  17. package/dist/DotplotView/components/DotplotTooltip.js +0 -1
  18. package/dist/DotplotView/components/DotplotView.js +0 -1
  19. package/dist/DotplotView/components/DotplotWarnings.js +0 -1
  20. package/dist/DotplotView/components/ExportSvgDialog.js +0 -1
  21. package/dist/DotplotView/components/Grid.js +0 -1
  22. package/dist/DotplotView/components/Header.js +0 -1
  23. package/dist/DotplotView/components/ImportCustomTrack.js +0 -1
  24. package/dist/DotplotView/components/ImportForm.js +0 -1
  25. package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
  26. package/dist/DotplotView/components/PanButtons.js +0 -1
  27. package/dist/DotplotView/components/WarningDialog.js +0 -1
  28. package/dist/DotplotView/components/util.js +0 -1
  29. package/dist/DotplotView/index.js +0 -1
  30. package/dist/DotplotView/model.js +0 -1
  31. package/dist/DotplotView/svgcomponents/SVGBackground.js +0 -1
  32. package/dist/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
  33. package/dist/LaunchDotplotView.js +0 -1
  34. package/dist/ServerSideRenderedBlockContent.js +0 -1
  35. package/dist/ServerSideSyntenyRendering.js +0 -1
  36. package/dist/index.js +0 -1
  37. package/dist/util.js +0 -1
  38. package/esm/ComparativeRenderer/index.js +0 -1
  39. package/esm/DotplotDisplay/components/DotplotDisplay.js +0 -1
  40. package/esm/DotplotDisplay/index.js +0 -1
  41. package/esm/DotplotDisplay/renderDotplotBlock.js +0 -1
  42. package/esm/DotplotDisplay/stateModelFactory.js +0 -1
  43. package/esm/DotplotReadVsRef/DotplotReadVsRef.js +0 -1
  44. package/esm/DotplotReadVsRef/index.js +0 -1
  45. package/esm/DotplotRenderer/ComparativeRenderRpc.js +0 -1
  46. package/esm/DotplotRenderer/DotplotRenderer.js +0 -1
  47. package/esm/DotplotRenderer/components/DotplotRendering.js +0 -1
  48. package/esm/DotplotRenderer/configSchema.js +0 -1
  49. package/esm/DotplotRenderer/index.js +0 -1
  50. package/esm/DotplotView/1dview.js +0 -1
  51. package/esm/DotplotView/blockTypes.js +0 -1
  52. package/esm/DotplotView/components/Axes.js +0 -1
  53. package/esm/DotplotView/components/CursorIcon.js +0 -1
  54. package/esm/DotplotView/components/DotplotTooltip.js +0 -1
  55. package/esm/DotplotView/components/DotplotView.js +0 -1
  56. package/esm/DotplotView/components/DotplotWarnings.js +0 -1
  57. package/esm/DotplotView/components/ExportSvgDialog.js +0 -1
  58. package/esm/DotplotView/components/Grid.js +0 -1
  59. package/esm/DotplotView/components/Header.js +0 -1
  60. package/esm/DotplotView/components/ImportCustomTrack.js +0 -1
  61. package/esm/DotplotView/components/ImportForm.js +0 -1
  62. package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +0 -1
  63. package/esm/DotplotView/components/PanButtons.js +0 -1
  64. package/esm/DotplotView/components/WarningDialog.js +0 -1
  65. package/esm/DotplotView/components/util.js +0 -1
  66. package/esm/DotplotView/index.js +0 -1
  67. package/esm/DotplotView/model.js +0 -1
  68. package/esm/DotplotView/svgcomponents/SVGBackground.js +0 -1
  69. package/esm/DotplotView/svgcomponents/SVGDotplotView.js +0 -1
  70. package/esm/LaunchDotplotView.js +0 -1
  71. package/esm/ServerSideRenderedBlockContent.js +0 -1
  72. package/esm/ServerSideSyntenyRendering.js +0 -1
  73. package/esm/index.js +0 -1
  74. package/esm/util.js +0 -1
  75. package/package.json +3 -4
  76. package/dist/ComparativeRenderer/index.js.map +0 -1
  77. package/dist/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
  78. package/dist/DotplotDisplay/index.js.map +0 -1
  79. package/dist/DotplotDisplay/renderDotplotBlock.js.map +0 -1
  80. package/dist/DotplotDisplay/stateModelFactory.js.map +0 -1
  81. package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
  82. package/dist/DotplotReadVsRef/index.js.map +0 -1
  83. package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
  84. package/dist/DotplotRenderer/DotplotRenderer.js.map +0 -1
  85. package/dist/DotplotRenderer/components/DotplotRendering.js.map +0 -1
  86. package/dist/DotplotRenderer/configSchema.js.map +0 -1
  87. package/dist/DotplotRenderer/index.js.map +0 -1
  88. package/dist/DotplotView/1dview.js.map +0 -1
  89. package/dist/DotplotView/blockTypes.js.map +0 -1
  90. package/dist/DotplotView/components/Axes.js.map +0 -1
  91. package/dist/DotplotView/components/CursorIcon.js.map +0 -1
  92. package/dist/DotplotView/components/DotplotTooltip.js.map +0 -1
  93. package/dist/DotplotView/components/DotplotView.js.map +0 -1
  94. package/dist/DotplotView/components/DotplotWarnings.js.map +0 -1
  95. package/dist/DotplotView/components/ExportSvgDialog.js.map +0 -1
  96. package/dist/DotplotView/components/Grid.js.map +0 -1
  97. package/dist/DotplotView/components/Header.js.map +0 -1
  98. package/dist/DotplotView/components/ImportCustomTrack.js.map +0 -1
  99. package/dist/DotplotView/components/ImportForm.js.map +0 -1
  100. package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
  101. package/dist/DotplotView/components/PanButtons.js.map +0 -1
  102. package/dist/DotplotView/components/WarningDialog.js.map +0 -1
  103. package/dist/DotplotView/components/util.js.map +0 -1
  104. package/dist/DotplotView/index.js.map +0 -1
  105. package/dist/DotplotView/model.js.map +0 -1
  106. package/dist/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
  107. package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
  108. package/dist/LaunchDotplotView.js.map +0 -1
  109. package/dist/ServerSideRenderedBlockContent.js.map +0 -1
  110. package/dist/ServerSideSyntenyRendering.js.map +0 -1
  111. package/dist/index.js.map +0 -1
  112. package/dist/util.js.map +0 -1
  113. package/esm/ComparativeRenderer/index.js.map +0 -1
  114. package/esm/DotplotDisplay/components/DotplotDisplay.js.map +0 -1
  115. package/esm/DotplotDisplay/index.js.map +0 -1
  116. package/esm/DotplotDisplay/renderDotplotBlock.js.map +0 -1
  117. package/esm/DotplotDisplay/stateModelFactory.js.map +0 -1
  118. package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +0 -1
  119. package/esm/DotplotReadVsRef/index.js.map +0 -1
  120. package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +0 -1
  121. package/esm/DotplotRenderer/DotplotRenderer.js.map +0 -1
  122. package/esm/DotplotRenderer/components/DotplotRendering.js.map +0 -1
  123. package/esm/DotplotRenderer/configSchema.js.map +0 -1
  124. package/esm/DotplotRenderer/index.js.map +0 -1
  125. package/esm/DotplotView/1dview.js.map +0 -1
  126. package/esm/DotplotView/blockTypes.js.map +0 -1
  127. package/esm/DotplotView/components/Axes.js.map +0 -1
  128. package/esm/DotplotView/components/CursorIcon.js.map +0 -1
  129. package/esm/DotplotView/components/DotplotTooltip.js.map +0 -1
  130. package/esm/DotplotView/components/DotplotView.js.map +0 -1
  131. package/esm/DotplotView/components/DotplotWarnings.js.map +0 -1
  132. package/esm/DotplotView/components/ExportSvgDialog.js.map +0 -1
  133. package/esm/DotplotView/components/Grid.js.map +0 -1
  134. package/esm/DotplotView/components/Header.js.map +0 -1
  135. package/esm/DotplotView/components/ImportCustomTrack.js.map +0 -1
  136. package/esm/DotplotView/components/ImportForm.js.map +0 -1
  137. package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +0 -1
  138. package/esm/DotplotView/components/PanButtons.js.map +0 -1
  139. package/esm/DotplotView/components/WarningDialog.js.map +0 -1
  140. package/esm/DotplotView/components/util.js.map +0 -1
  141. package/esm/DotplotView/index.js.map +0 -1
  142. package/esm/DotplotView/model.js.map +0 -1
  143. package/esm/DotplotView/svgcomponents/SVGBackground.js.map +0 -1
  144. package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +0 -1
  145. package/esm/LaunchDotplotView.js.map +0 -1
  146. package/esm/ServerSideRenderedBlockContent.js.map +0 -1
  147. package/esm/ServerSideSyntenyRendering.js.map +0 -1
  148. package/esm/index.js.map +0 -1
  149. package/esm/util.js.map +0 -1
  150. package/src/ComparativeRenderer/index.ts +0 -87
  151. package/src/DotplotDisplay/components/DotplotDisplay.tsx +0 -34
  152. package/src/DotplotDisplay/index.ts +0 -48
  153. package/src/DotplotDisplay/renderDotplotBlock.ts +0 -60
  154. package/src/DotplotDisplay/stateModelFactory.tsx +0 -196
  155. package/src/DotplotReadVsRef/DotplotReadVsRef.ts +0 -115
  156. package/src/DotplotReadVsRef/index.ts +0 -50
  157. package/src/DotplotRenderer/ComparativeRenderRpc.ts +0 -87
  158. package/src/DotplotRenderer/DotplotRenderer.ts +0 -328
  159. package/src/DotplotRenderer/__image_snapshots__/linear-synteny-renderer-test-ts-test-rendering-a-simple-synteny-from-fake-data-1-snap.png +0 -0
  160. package/src/DotplotRenderer/components/DotplotRendering.tsx +0 -12
  161. package/src/DotplotRenderer/configSchema.ts +0 -92
  162. package/src/DotplotRenderer/index.ts +0 -16
  163. package/src/DotplotView/1dview.ts +0 -98
  164. package/src/DotplotView/blockTypes.ts +0 -140
  165. package/src/DotplotView/components/Axes.tsx +0 -246
  166. package/src/DotplotView/components/CursorIcon.tsx +0 -24
  167. package/src/DotplotView/components/DotplotTooltip.tsx +0 -163
  168. package/src/DotplotView/components/DotplotView.tsx +0 -348
  169. package/src/DotplotView/components/DotplotWarnings.tsx +0 -26
  170. package/src/DotplotView/components/ExportSvgDialog.tsx +0 -129
  171. package/src/DotplotView/components/Grid.tsx +0 -112
  172. package/src/DotplotView/components/Header.tsx +0 -182
  173. package/src/DotplotView/components/ImportCustomTrack.tsx +0 -262
  174. package/src/DotplotView/components/ImportForm.tsx +0 -209
  175. package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +0 -90
  176. package/src/DotplotView/components/PanButtons.tsx +0 -93
  177. package/src/DotplotView/components/WarningDialog.tsx +0 -74
  178. package/src/DotplotView/components/util.ts +0 -118
  179. package/src/DotplotView/index.ts +0 -16
  180. package/src/DotplotView/model.test.ts +0 -17
  181. package/src/DotplotView/model.ts +0 -719
  182. package/src/DotplotView/svgcomponents/SVGBackground.tsx +0 -21
  183. package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +0 -68
  184. package/src/LaunchDotplotView.ts +0 -63
  185. package/src/ServerSideRenderedBlockContent.tsx +0 -86
  186. package/src/ServerSideSyntenyRendering.tsx +0 -54
  187. package/src/index.ts +0 -41
  188. package/src/util.ts +0 -14
@@ -1,90 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { Select, MenuItem, Paper, Typography } from '@mui/material'
3
- import { getTrackName } from '@jbrowse/core/util/tracks'
4
- import { getSession } from '@jbrowse/core/util'
5
- import { ErrorMessage } from '@jbrowse/core/ui'
6
- import {
7
- AnyConfigurationModel,
8
- readConfObject,
9
- } from '@jbrowse/core/configuration'
10
- import { observer } from 'mobx-react'
11
-
12
- // icons
13
- import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
14
-
15
- // locals
16
- import { DotplotViewModel } from '../model'
17
-
18
- function f(track: AnyConfigurationModel, assembly1: string, assembly2: string) {
19
- const assemblyNames = readConfObject(track, 'assemblyNames')
20
- return (
21
- assemblyNames.includes(assembly1) &&
22
- assemblyNames.includes(assembly2) &&
23
- track.type.includes('Synteny')
24
- )
25
- }
26
-
27
- const Selector = observer(
28
- ({
29
- model,
30
- assembly1,
31
- assembly2,
32
- setShowTrackId,
33
- }: {
34
- model: DotplotViewModel
35
- assembly1: string
36
- assembly2: string
37
- setShowTrackId: (arg: string) => void
38
- }) => {
39
- const session = getSession(model)
40
- const { tracks, sessionTracks } = session
41
- const allTracks = [...tracks, ...sessionTracks] as AnyConfigurationModel[]
42
- const filteredTracks = allTracks.filter(t => f(t, assembly2, assembly1))
43
- const resetTrack = filteredTracks[0]?.trackId || ''
44
- const [value, setValue] = useState(resetTrack)
45
- useEffect(() => {
46
- // if assembly1/assembly2 changes, then we will want to use this effect to change
47
- // the state of the useState because it otherwise gets locked to a stale value
48
- setValue(resetTrack)
49
- }, [resetTrack])
50
-
51
- useEffect(() => {
52
- // sets track data in a useEffect because the initial load is needed as well as
53
- // onChange's to the select box
54
- setShowTrackId(value)
55
- }, [value, setShowTrackId])
56
-
57
- return (
58
- <Paper style={{ padding: 12 }}>
59
- <Typography paragraph>
60
- Select a track from the select box below, the track will be shown when
61
- you hit "Launch".
62
- </Typography>
63
-
64
- <Typography paragraph>
65
- Note: there is a track selector <i>inside</i> the DotplotView, which
66
- can turn on one or more SyntenyTracks (more than one can be displayed
67
- at once). Look for the track selector icon <TrackSelectorIcon />
68
- </Typography>
69
- {filteredTracks.length ? (
70
- <Select
71
- value={value}
72
- onChange={event => setValue(event.target.value)}
73
- >
74
- {filteredTracks.map(track => (
75
- <MenuItem key={track.trackId} value={track.trackId}>
76
- {getTrackName(track, session)}
77
- </MenuItem>
78
- ))}
79
- </Select>
80
- ) : (
81
- <ErrorMessage
82
- error={`No synteny tracks found for ${assembly1},${assembly2}`}
83
- />
84
- )}
85
- </Paper>
86
- )
87
- },
88
- )
89
-
90
- export default Selector
@@ -1,93 +0,0 @@
1
- import React from 'react'
2
- import { IconButton, Paper } from '@mui/material'
3
- import { makeStyles } from 'tss-react/mui'
4
- import { observer } from 'mobx-react'
5
-
6
- // icons
7
- import ArrowDropDown from '@mui/icons-material/ArrowDropDown'
8
- import ArrowDropUp from '@mui/icons-material/ArrowDropUp'
9
- import ArrowLeft from '@mui/icons-material/ArrowLeft'
10
- import ArrowRight from '@mui/icons-material/ArrowRight'
11
- import ZoomIn from '@mui/icons-material/ZoomIn'
12
- import ZoomOut from '@mui/icons-material/ZoomOut'
13
-
14
- // locals
15
- import { DotplotViewModel } from '../model'
16
-
17
- const useStyles = makeStyles()({
18
- dpad: {
19
- display: 'grid',
20
- gridTemplateColumns: 'repeat(3, 1fr)',
21
- margin: 0,
22
- position: 'absolute',
23
- right: 50,
24
- zIndex: 1000,
25
- top: 50,
26
- },
27
- icon: {
28
- padding: 0,
29
- margin: 0,
30
- },
31
- })
32
-
33
- export default observer(function PanButtons({
34
- model,
35
- }: {
36
- model: DotplotViewModel
37
- }) {
38
- const { classes } = useStyles()
39
- return (
40
- <Paper className={classes.dpad} elevation={6}>
41
- <div />
42
- <IconButton
43
- className={classes.icon}
44
- onClick={() => model.vview.scroll(100)}
45
- >
46
- <ArrowDropUp />
47
- </IconButton>
48
- <div />
49
-
50
- <IconButton
51
- className={classes.icon}
52
- onClick={() => model.hview.scroll(-100)}
53
- >
54
- <ArrowLeft />
55
- </IconButton>
56
- <div />
57
- <IconButton
58
- className={classes.icon}
59
- onClick={() => model.hview.scroll(100)}
60
- >
61
- <ArrowRight />
62
- </IconButton>
63
-
64
- <div />
65
- <IconButton
66
- className={classes.icon}
67
- onClick={() => model.vview.scroll(-100)}
68
- >
69
- <ArrowDropDown />
70
- </IconButton>
71
- <div />
72
- <IconButton
73
- className={classes.icon}
74
- onClick={() => {
75
- model.hview.zoomIn()
76
- model.vview.zoomIn()
77
- }}
78
- >
79
- <ZoomIn />
80
- </IconButton>
81
- <div />
82
- <IconButton
83
- className={classes.icon}
84
- onClick={() => {
85
- model.hview.zoomOut()
86
- model.vview.zoomOut()
87
- }}
88
- >
89
- <ZoomOut />
90
- </IconButton>
91
- </Paper>
92
- )
93
- })
@@ -1,74 +0,0 @@
1
- import React from 'react'
2
- import { DialogContent, DialogContentText } from '@mui/material'
3
- import { Dialog } from '@jbrowse/core/ui'
4
- import { observer } from 'mobx-react'
5
- import { makeStyles } from 'tss-react/mui'
6
- import { DataGrid } from '@mui/x-data-grid'
7
- import { AnyConfigurationModel, getConf } from '@jbrowse/core/configuration'
8
- import { measureGridWidth } from '@jbrowse/core/util'
9
-
10
- const useStyles = makeStyles()({
11
- content: {
12
- minWidth: 600,
13
- },
14
- })
15
-
16
- interface TrackWarning {
17
- configuration: AnyConfigurationModel
18
- displays: { warnings: { message: string; effect: string }[] }[]
19
- }
20
-
21
- export default observer(function WarningDialog({
22
- trackWarnings,
23
- handleClose,
24
- }: {
25
- handleClose: () => void
26
- trackWarnings: TrackWarning[]
27
- }) {
28
- const { classes } = useStyles()
29
- const rows = [] as {
30
- name: string
31
- message: string
32
- effect: string
33
- id: string
34
- }[]
35
- for (let i = 0; i < trackWarnings.length; i++) {
36
- const track = trackWarnings[i]
37
- const name = getConf(track, 'name')
38
- for (let j = 0; j < track.displays[0].warnings.length; j++) {
39
- const warning = track.displays[0].warnings[j]
40
- rows.push({ name, ...warning, id: i + '_' + j })
41
- }
42
- }
43
- const columns = [
44
- { field: 'name' },
45
- { field: 'message', width: measureGridWidth(rows.map(r => r.message)) },
46
- { field: 'effect', width: measureGridWidth(rows.map(r => r.effect)) },
47
- ]
48
- return (
49
- <Dialog
50
- open
51
- onClose={handleClose}
52
- maxWidth="xl"
53
- title="Dotplot rendered with warnings"
54
- >
55
- <DialogContent className={classes.content}>
56
- <DialogContentText>
57
- Found warnings while rendering the dotplot. This is often due to
58
- out-of-bound features that may indicate the wrong assemblies are being
59
- used. Check that the query and target are configured correctly, and
60
- that the right assemblies are being compared.
61
- </DialogContentText>
62
- <div style={{ height: 600, width: '100%', overflow: 'auto' }}>
63
- <DataGrid
64
- rows={rows}
65
- columns={columns}
66
- disableRowSelectionOnClick
67
- rowHeight={25}
68
- disableColumnMenu
69
- />
70
- </div>
71
- </DialogContent>
72
- </Dialog>
73
- )
74
- })
@@ -1,118 +0,0 @@
1
- import { BaseBlock } from '@jbrowse/core/util/blockTypes'
2
- import { Dotplot1DViewModel } from '../model'
3
-
4
- export function locstr(
5
- px: number,
6
- view: Dotplot1DViewModel,
7
- includeAsm = true,
8
- ) {
9
- const { assemblyName, refName, start, offset, oob } = view.pxToBp(px)
10
- const coord = Math.floor(start + offset)
11
- return oob
12
- ? 'out of bounds'
13
- : `${
14
- includeAsm ? '{' + assemblyName + '}' : ''
15
- }${refName}:${coord.toLocaleString('en-US')}`
16
- }
17
-
18
- export function getBlockLabelKeysToHide(
19
- blocks: BaseBlock[],
20
- length: number,
21
- viewOffsetPx: number,
22
- ) {
23
- const blockLabelKeysToHide = new Set<string>()
24
- const sortedBlocks = [...blocks].sort((a, b) => {
25
- const alen = a.end - a.start
26
- const blen = b.end - b.start
27
- return blen - alen
28
- })
29
- const positions = Array.from({ length: Math.round(length) })
30
- for (const { key, offsetPx } of sortedBlocks) {
31
- const y = Math.round(length - offsetPx + viewOffsetPx)
32
- const labelBounds = [Math.max(y - 12, 0), y]
33
- if (y === 0 || positions.slice(...labelBounds).some(Boolean)) {
34
- blockLabelKeysToHide.add(key)
35
- } else {
36
- positions.fill(true, ...labelBounds)
37
- }
38
- }
39
- return blockLabelKeysToHide
40
- }
41
- /**
42
- * Given a scale ( bp/px ) and minimum distances (px) between major and minor
43
- * gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
44
- * the gridline pitches to use.
45
- */
46
- export function chooseGridPitch(
47
- scale: number,
48
- minMajorPitchPx: number,
49
- minMinorPitchPx: number,
50
- ) {
51
- scale = Math.abs(scale)
52
- const minMajorPitchBp = minMajorPitchPx * scale
53
- const majorMagnitude = Number.parseInt(
54
- Number(minMajorPitchBp).toExponential().split(/e/i)[1],
55
- 10,
56
- )
57
-
58
- let majorPitch = 10 ** majorMagnitude
59
- while (majorPitch < minMajorPitchBp) {
60
- majorPitch *= 2
61
- if (majorPitch >= minMajorPitchBp) {
62
- break
63
- }
64
- majorPitch *= 2.5
65
- }
66
-
67
- majorPitch = Math.max(majorPitch, 5)
68
-
69
- const majorPitchPx = majorPitch / scale
70
-
71
- let minorPitch = 0
72
- if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {
73
- minorPitch = majorPitch / 10
74
- } else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {
75
- minorPitch = majorPitch / 5
76
- } else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {
77
- minorPitch = majorPitch / 2
78
- }
79
-
80
- return { majorPitch, minorPitch }
81
- }
82
-
83
- export function makeTicks(
84
- regions: BaseBlock[],
85
- bpPerPx: number,
86
- emitMajor = true,
87
- emitMinor = true,
88
- ) {
89
- const ticks = []
90
- const gridPitch = chooseGridPitch(bpPerPx, 60, 15)
91
- const iterPitch = gridPitch.minorPitch || gridPitch.majorPitch
92
- for (let i = 0; i < regions.length; i++) {
93
- const region = regions[i]
94
- const { start, end, refName } = region
95
- let index = 0
96
-
97
- const minBase = start
98
- const maxBase = end
99
-
100
- for (
101
- let base = Math.floor(minBase / iterPitch) * iterPitch;
102
- base < Math.ceil(maxBase / iterPitch) * iterPitch + 1;
103
- base += iterPitch
104
- ) {
105
- if (emitMinor && base % gridPitch.majorPitch) {
106
- ticks.push({ type: 'minor', base: base - 1, index, refName })
107
- index += 1
108
- } else if (
109
- emitMajor &&
110
- Math.abs(base - region.start) > gridPitch.minorPitch
111
- ) {
112
- ticks.push({ type: 'major', base: base - 1, index, refName })
113
- index += 1
114
- }
115
- }
116
- }
117
- return ticks
118
- }
@@ -1,16 +0,0 @@
1
- import { lazy } from 'react'
2
- import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
3
- import PluginManager from '@jbrowse/core/PluginManager'
4
- // locals
5
- import stateModelFactory from './model'
6
-
7
- export default function (pluginManager: PluginManager) {
8
- pluginManager.addViewType(() => {
9
- return new ViewType({
10
- name: 'DotplotView',
11
- displayName: 'Dotplot view',
12
- stateModel: stateModelFactory(pluginManager),
13
- ReactComponent: lazy(() => import('./components/DotplotView')),
14
- })
15
- })
16
- }
@@ -1,17 +0,0 @@
1
- import { createTestSession } from '@jbrowse/web/src/rootModel/test_util'
2
- import { getEnv } from 'mobx-state-tree'
3
- jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
4
-
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- const { pluginManager } = getEnv(createTestSession() as any)
7
-
8
- describe('dotplot state model', () => {
9
- test('can instantiate from an empty object', () => {
10
- const DotplotModel = pluginManager.jbrequire(require('./model'))
11
- expect(() =>
12
- DotplotModel.create({
13
- type: 'DotplotView',
14
- }),
15
- ).not.toThrow()
16
- })
17
- })