@jbrowse/plugin-circular-view 2.6.1 → 2.6.3

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 (104) hide show
  1. package/dist/BaseChordDisplay/components/BaseChordDisplay.js +0 -1
  2. package/dist/BaseChordDisplay/components/DisplayError.js +0 -1
  3. package/dist/BaseChordDisplay/components/Loading.js +0 -1
  4. package/dist/BaseChordDisplay/index.js +0 -1
  5. package/dist/BaseChordDisplay/models/configSchema.js +0 -1
  6. package/dist/BaseChordDisplay/models/model.js +0 -1
  7. package/dist/BaseChordDisplay/models/renderReaction.js +0 -1
  8. package/dist/CircularView/components/CircularView.js +0 -1
  9. package/dist/CircularView/components/Controls.js +0 -1
  10. package/dist/CircularView/components/ExportSvgDialog.js +0 -1
  11. package/dist/CircularView/components/ImportForm.js +0 -1
  12. package/dist/CircularView/components/Ruler.js +0 -1
  13. package/dist/CircularView/index.js +0 -1
  14. package/dist/CircularView/models/CircularView.js +0 -1
  15. package/dist/CircularView/models/slices.js +0 -1
  16. package/dist/CircularView/models/viewportVisibleRegion.js +0 -1
  17. package/dist/CircularView/svgcomponents/SVGBackground.js +2 -2
  18. package/dist/CircularView/svgcomponents/SVGCircularView.js +0 -1
  19. package/dist/LaunchCircularView/index.js +0 -1
  20. package/dist/index.js +0 -1
  21. package/esm/BaseChordDisplay/components/BaseChordDisplay.js +0 -1
  22. package/esm/BaseChordDisplay/components/DisplayError.js +0 -1
  23. package/esm/BaseChordDisplay/components/Loading.js +0 -1
  24. package/esm/BaseChordDisplay/index.js +0 -1
  25. package/esm/BaseChordDisplay/models/configSchema.js +0 -1
  26. package/esm/BaseChordDisplay/models/model.js +0 -1
  27. package/esm/BaseChordDisplay/models/renderReaction.js +0 -1
  28. package/esm/CircularView/components/CircularView.js +0 -1
  29. package/esm/CircularView/components/Controls.js +0 -1
  30. package/esm/CircularView/components/ExportSvgDialog.js +0 -1
  31. package/esm/CircularView/components/ImportForm.js +0 -1
  32. package/esm/CircularView/components/Ruler.js +0 -1
  33. package/esm/CircularView/index.js +0 -1
  34. package/esm/CircularView/models/CircularView.js +0 -1
  35. package/esm/CircularView/models/slices.js +0 -1
  36. package/esm/CircularView/models/viewportVisibleRegion.js +0 -1
  37. package/esm/CircularView/svgcomponents/SVGBackground.js +2 -2
  38. package/esm/CircularView/svgcomponents/SVGCircularView.js +0 -1
  39. package/esm/LaunchCircularView/index.js +0 -1
  40. package/esm/index.js +0 -1
  41. package/package.json +4 -4
  42. package/dist/BaseChordDisplay/components/BaseChordDisplay.js.map +0 -1
  43. package/dist/BaseChordDisplay/components/DisplayError.js.map +0 -1
  44. package/dist/BaseChordDisplay/components/Loading.js.map +0 -1
  45. package/dist/BaseChordDisplay/index.js.map +0 -1
  46. package/dist/BaseChordDisplay/models/configSchema.js.map +0 -1
  47. package/dist/BaseChordDisplay/models/model.js.map +0 -1
  48. package/dist/BaseChordDisplay/models/renderReaction.js.map +0 -1
  49. package/dist/CircularView/components/CircularView.js.map +0 -1
  50. package/dist/CircularView/components/Controls.js.map +0 -1
  51. package/dist/CircularView/components/ExportSvgDialog.js.map +0 -1
  52. package/dist/CircularView/components/ImportForm.js.map +0 -1
  53. package/dist/CircularView/components/Ruler.js.map +0 -1
  54. package/dist/CircularView/index.js.map +0 -1
  55. package/dist/CircularView/models/CircularView.js.map +0 -1
  56. package/dist/CircularView/models/slices.js.map +0 -1
  57. package/dist/CircularView/models/viewportVisibleRegion.js.map +0 -1
  58. package/dist/CircularView/svgcomponents/SVGBackground.js.map +0 -1
  59. package/dist/CircularView/svgcomponents/SVGCircularView.js.map +0 -1
  60. package/dist/LaunchCircularView/index.js.map +0 -1
  61. package/dist/index.js.map +0 -1
  62. package/esm/BaseChordDisplay/components/BaseChordDisplay.js.map +0 -1
  63. package/esm/BaseChordDisplay/components/DisplayError.js.map +0 -1
  64. package/esm/BaseChordDisplay/components/Loading.js.map +0 -1
  65. package/esm/BaseChordDisplay/index.js.map +0 -1
  66. package/esm/BaseChordDisplay/models/configSchema.js.map +0 -1
  67. package/esm/BaseChordDisplay/models/model.js.map +0 -1
  68. package/esm/BaseChordDisplay/models/renderReaction.js.map +0 -1
  69. package/esm/CircularView/components/CircularView.js.map +0 -1
  70. package/esm/CircularView/components/Controls.js.map +0 -1
  71. package/esm/CircularView/components/ExportSvgDialog.js.map +0 -1
  72. package/esm/CircularView/components/ImportForm.js.map +0 -1
  73. package/esm/CircularView/components/Ruler.js.map +0 -1
  74. package/esm/CircularView/index.js.map +0 -1
  75. package/esm/CircularView/models/CircularView.js.map +0 -1
  76. package/esm/CircularView/models/slices.js.map +0 -1
  77. package/esm/CircularView/models/viewportVisibleRegion.js.map +0 -1
  78. package/esm/CircularView/svgcomponents/SVGBackground.js.map +0 -1
  79. package/esm/CircularView/svgcomponents/SVGCircularView.js.map +0 -1
  80. package/esm/LaunchCircularView/index.js.map +0 -1
  81. package/esm/index.js.map +0 -1
  82. package/src/BaseChordDisplay/components/BaseChordDisplay.tsx +0 -26
  83. package/src/BaseChordDisplay/components/DisplayError.tsx +0 -47
  84. package/src/BaseChordDisplay/components/Loading.tsx +0 -111
  85. package/src/BaseChordDisplay/index.ts +0 -3
  86. package/src/BaseChordDisplay/models/configSchema.ts +0 -30
  87. package/src/BaseChordDisplay/models/model.tsx +0 -314
  88. package/src/BaseChordDisplay/models/renderReaction.ts +0 -75
  89. package/src/CircularView/components/CircularView.tsx +0 -128
  90. package/src/CircularView/components/Controls.tsx +0 -119
  91. package/src/CircularView/components/ExportSvgDialog.tsx +0 -132
  92. package/src/CircularView/components/ImportForm.tsx +0 -68
  93. package/src/CircularView/components/Ruler.tsx +0 -265
  94. package/src/CircularView/index.ts +0 -16
  95. package/src/CircularView/models/CircularView.ts +0 -621
  96. package/src/CircularView/models/__snapshots__/slices.test.js.snap +0 -91
  97. package/src/CircularView/models/slices.test.js +0 -70
  98. package/src/CircularView/models/slices.ts +0 -101
  99. package/src/CircularView/models/viewportVisibleRegion.test.js +0 -168
  100. package/src/CircularView/models/viewportVisibleRegion.ts +0 -272
  101. package/src/CircularView/svgcomponents/SVGBackground.tsx +0 -21
  102. package/src/CircularView/svgcomponents/SVGCircularView.tsx +0 -58
  103. package/src/LaunchCircularView/index.ts +0 -48
  104. package/src/index.ts +0 -43
@@ -1,265 +0,0 @@
1
- import React from 'react'
2
- import { observer } from 'mobx-react'
3
- import {
4
- getSession,
5
- polarToCartesian,
6
- radToDeg,
7
- assembleLocString,
8
- } from '@jbrowse/core/util'
9
- import { makeContrasting } from '@jbrowse/core/util/color'
10
- import { useTheme } from '@mui/material/styles'
11
- import { makeStyles } from 'tss-react/mui'
12
-
13
- // locals
14
- import {
15
- Slice,
16
- SliceElidedRegion,
17
- SliceNonElidedRegion,
18
- } from '../models/slices'
19
- import { CircularViewModel } from '../models/CircularView'
20
-
21
- const useStyles = makeStyles()({
22
- rulerLabel: {
23
- fontSize: '0.8rem',
24
- fontWeight: 500,
25
- lineHeight: 1.6,
26
- letterSpacing: '0.0075em',
27
- },
28
- })
29
-
30
- function sliceArcPath(
31
- slice: Slice,
32
- radiusPx: number,
33
- startBase: number,
34
- endBase: number,
35
- ) {
36
- // A rx ry x-axis-rotation large-arc-flag sweep-flag x y
37
- if (slice.flipped) {
38
- ;[startBase, endBase] = [endBase, startBase]
39
- }
40
- const startXY = slice.bpToXY(startBase, radiusPx)
41
- const endXY = slice.bpToXY(endBase, radiusPx)
42
- const largeArc =
43
- Math.abs(endBase - startBase) / slice.bpPerRadian > Math.PI ? '1' : '0'
44
- const sweepFlag = '1'
45
- return [
46
- 'M',
47
- ...startXY,
48
- 'A',
49
- radiusPx,
50
- radiusPx,
51
- '0',
52
- largeArc,
53
- sweepFlag,
54
- ...endXY,
55
- ].join(' ')
56
- }
57
-
58
- const ElisionRulerArc = observer(function ({
59
- model,
60
- slice,
61
- region,
62
- }: {
63
- model: CircularViewModel
64
- slice: Slice
65
- region: SliceElidedRegion
66
- }) {
67
- const theme = useTheme()
68
- const { radiusPx: modelRadiusPx } = model
69
- const radiusPx = modelRadiusPx + 1
70
- const { endRadians, startRadians } = slice
71
- const startXY = polarToCartesian(radiusPx, startRadians)
72
- const endXY = polarToCartesian(radiusPx, endRadians)
73
- const widthPx = (endRadians - startRadians) * radiusPx
74
- const largeArc = endRadians - startRadians > Math.PI ? '1' : '0'
75
- // TODO: draw the elision
76
- const centerRadians = (endRadians + startRadians) / 2
77
- const regionCount = `[${Number(region.regions.length).toLocaleString()}]`
78
- return (
79
- <>
80
- <RulerLabel
81
- text={regionCount}
82
- view={model}
83
- maxWidthPx={widthPx}
84
- radians={centerRadians}
85
- radiusPx={radiusPx}
86
- title={`${regionCount} more regions`}
87
- color={theme.palette.text.primary}
88
- />
89
- <path
90
- d={[
91
- 'M',
92
- ...startXY,
93
- 'A',
94
- radiusPx,
95
- radiusPx,
96
- '0',
97
- largeArc,
98
- '1',
99
- ...endXY,
100
- ].join(' ')}
101
- stroke={theme.palette.text.secondary}
102
- strokeWidth={2}
103
- strokeDasharray="2,2"
104
- fill="none"
105
- />
106
- </>
107
- )
108
- })
109
-
110
- const RulerLabel = observer(function ({
111
- view,
112
- text,
113
- maxWidthPx,
114
- radians,
115
- radiusPx,
116
- title,
117
- color,
118
- }: {
119
- view: CircularViewModel
120
- text: string
121
- maxWidthPx: number
122
- radiusPx: number
123
- radians: number
124
- title?: string
125
- color: string
126
- }) {
127
- const { classes } = useStyles()
128
- const textXY = polarToCartesian(radiusPx + 5, radians)
129
- if (!text) {
130
- return null
131
- }
132
-
133
- if (text.length * 6.5 < maxWidthPx) {
134
- // text is rotated parallel to the ruler arc
135
- return (
136
- <text
137
- x={0}
138
- y={0}
139
- className={classes.rulerLabel}
140
- textAnchor="middle"
141
- dominantBaseline="baseline"
142
- transform={`translate(${textXY}) rotate(${radToDeg(radians) + 90})`}
143
- style={{ fill: color }}
144
- >
145
- {text}
146
- <title>{title || text}</title>
147
- </text>
148
- )
149
- }
150
- if (maxWidthPx > 4) {
151
- // text is rotated perpendicular to the ruler arc
152
- const overallRotation = radToDeg(radians + view.offsetRadians - Math.PI / 2)
153
- if (overallRotation >= 180) {
154
- return (
155
- <text
156
- x={0}
157
- y={0}
158
- className={classes.rulerLabel}
159
- textAnchor="start"
160
- dominantBaseline="middle"
161
- transform={`translate(${textXY}) rotate(${radToDeg(radians)})`}
162
- style={{ fill: color }}
163
- >
164
- {text}
165
- <title>{title || text}</title>
166
- </text>
167
- )
168
- }
169
- return (
170
- <text
171
- x={0}
172
- y={0}
173
- className={classes.rulerLabel}
174
- textAnchor="end"
175
- dominantBaseline="middle"
176
- transform={`translate(${textXY}) rotate(${radToDeg(radians) + 180})`}
177
- style={{ fill: color }}
178
- >
179
- {text}
180
- <title>{title || text}</title>
181
- </text>
182
- )
183
- }
184
-
185
- // if you get here there is no room for the text at all
186
- return null
187
- })
188
-
189
- const RegionRulerArc = observer(function ({
190
- model,
191
- slice,
192
- region,
193
- }: {
194
- model: CircularViewModel
195
- slice: Slice
196
- region: SliceNonElidedRegion
197
- }) {
198
- const theme = useTheme()
199
- const { radiusPx } = model
200
- const { endRadians, startRadians } = slice
201
- const centerRadians = (endRadians + startRadians) / 2
202
- const widthPx = (endRadians - startRadians) * radiusPx
203
- const session = getSession(model)
204
- let color
205
- const assembly = session.assemblyManager.get(region.assemblyName)
206
- if (assembly) {
207
- color = assembly.getRefNameColor(region.refName)
208
- }
209
- if (color) {
210
- try {
211
- color = makeContrasting(color, theme.palette.background.paper)
212
- } catch (error) {
213
- color = theme.palette.text.primary
214
- }
215
- } else {
216
- color = theme.palette.text.primary
217
- }
218
-
219
- // TODO: slice flipping
220
- return (
221
- <>
222
- <RulerLabel
223
- text={region.refName}
224
- view={model}
225
- maxWidthPx={widthPx}
226
- radians={centerRadians}
227
- radiusPx={radiusPx}
228
- color={color}
229
- />
230
- <path
231
- d={sliceArcPath(slice, radiusPx + 1, region.start, region.end)}
232
- stroke={color}
233
- strokeWidth={2}
234
- fill="none"
235
- />
236
- </>
237
- )
238
- })
239
-
240
- export default observer(function ({
241
- model,
242
- slice,
243
- }: {
244
- model: CircularViewModel
245
- slice: Slice
246
- }) {
247
- if (slice.region.elided) {
248
- return (
249
- <ElisionRulerArc
250
- key={assembleLocString(slice.region.regions[0])}
251
- model={model}
252
- region={slice.region}
253
- slice={slice}
254
- />
255
- )
256
- }
257
- return (
258
- <RegionRulerArc
259
- key={assembleLocString(slice.region)}
260
- region={slice.region}
261
- model={model}
262
- slice={slice}
263
- />
264
- )
265
- })
@@ -1,16 +0,0 @@
1
- import { lazy } from 'react'
2
- import PluginManager from '@jbrowse/core/PluginManager'
3
- import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
4
- import stateModelFactory from './models/CircularView'
5
-
6
- export default (pluginManager: PluginManager) => {
7
- pluginManager.addViewType(
8
- () =>
9
- new ViewType({
10
- ReactComponent: lazy(() => import('./components/CircularView')),
11
- stateModel: stateModelFactory(pluginManager),
12
- name: 'CircularView',
13
- displayName: 'Circular view',
14
- }),
15
- )
16
- }