@jbrowse/plugin-variants 2.5.0 → 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 (190) hide show
  1. package/dist/ChordVariantDisplay/index.js +0 -1
  2. package/dist/ChordVariantDisplay/models/configSchema.js +0 -1
  3. package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +11 -3
  4. package/dist/ChordVariantDisplay/models/stateModelFactory.js +0 -1
  5. package/dist/LinearVariantDisplay/configSchema.js +0 -1
  6. package/dist/LinearVariantDisplay/index.js +0 -1
  7. package/dist/LinearVariantDisplay/model.d.ts +52 -49
  8. package/dist/LinearVariantDisplay/model.js +0 -1
  9. package/dist/StructuralVariantChordRenderer/Chord.d.ts +2 -1
  10. package/dist/StructuralVariantChordRenderer/Chord.js +0 -1
  11. package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -1
  12. package/dist/StructuralVariantChordRenderer/ReactComponent.js +0 -1
  13. package/dist/StructuralVariantChordRenderer/configSchema.js +0 -1
  14. package/dist/StructuralVariantChordRenderer/index.js +0 -1
  15. package/dist/VariantFeatureWidget/AnnotGrid.d.ts +2 -1
  16. package/dist/VariantFeatureWidget/AnnotGrid.js +8 -14
  17. package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -1
  18. package/dist/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
  19. package/dist/VariantFeatureWidget/BreakendPanel.d.ts +2 -1
  20. package/dist/VariantFeatureWidget/BreakendPanel.js +0 -1
  21. package/dist/VariantFeatureWidget/VariantAnnotationTable.d.ts +6 -0
  22. package/dist/VariantFeatureWidget/VariantAnnotationTable.js +16 -0
  23. package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +8 -1
  24. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +26 -15
  25. package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -2
  26. package/dist/VariantFeatureWidget/VariantSampleGrid.js +0 -1
  27. package/dist/VariantFeatureWidget/index.js +0 -1
  28. package/dist/VariantTrack/configSchema.js +0 -1
  29. package/dist/VariantTrack/index.js +0 -1
  30. package/dist/VcfAdapter/VcfAdapter.js +0 -1
  31. package/dist/VcfAdapter/configSchema.js +0 -1
  32. package/dist/VcfAdapter/index.js +0 -1
  33. package/dist/VcfFeature/index.js +2 -2
  34. package/dist/VcfFeature/util.js +0 -1
  35. package/dist/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
  36. package/dist/VcfTabixAdapter/configSchema.js +0 -1
  37. package/dist/VcfTabixAdapter/index.js +0 -1
  38. package/dist/extensionPoints.js +0 -1
  39. package/dist/index.js +0 -1
  40. package/esm/ChordVariantDisplay/index.js +0 -1
  41. package/esm/ChordVariantDisplay/models/configSchema.js +0 -1
  42. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +11 -3
  43. package/esm/ChordVariantDisplay/models/stateModelFactory.js +0 -1
  44. package/esm/LinearVariantDisplay/configSchema.js +0 -1
  45. package/esm/LinearVariantDisplay/index.js +0 -1
  46. package/esm/LinearVariantDisplay/model.d.ts +52 -49
  47. package/esm/LinearVariantDisplay/model.js +0 -1
  48. package/esm/StructuralVariantChordRenderer/Chord.d.ts +2 -1
  49. package/esm/StructuralVariantChordRenderer/Chord.js +0 -1
  50. package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -1
  51. package/esm/StructuralVariantChordRenderer/ReactComponent.js +0 -1
  52. package/esm/StructuralVariantChordRenderer/configSchema.js +0 -1
  53. package/esm/StructuralVariantChordRenderer/index.js +0 -1
  54. package/esm/VariantFeatureWidget/AnnotGrid.d.ts +2 -1
  55. package/esm/VariantFeatureWidget/AnnotGrid.js +8 -14
  56. package/esm/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -1
  57. package/esm/VariantFeatureWidget/BreakendOptionDialog.js +0 -1
  58. package/esm/VariantFeatureWidget/BreakendPanel.d.ts +2 -1
  59. package/esm/VariantFeatureWidget/BreakendPanel.js +0 -1
  60. package/esm/VariantFeatureWidget/VariantAnnotationTable.d.ts +6 -0
  61. package/esm/VariantFeatureWidget/VariantAnnotationTable.js +10 -0
  62. package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +8 -1
  63. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +26 -15
  64. package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -2
  65. package/esm/VariantFeatureWidget/VariantSampleGrid.js +0 -1
  66. package/esm/VariantFeatureWidget/index.js +0 -1
  67. package/esm/VariantTrack/configSchema.js +0 -1
  68. package/esm/VariantTrack/index.js +0 -1
  69. package/esm/VcfAdapter/VcfAdapter.js +0 -1
  70. package/esm/VcfAdapter/configSchema.js +0 -1
  71. package/esm/VcfAdapter/index.js +0 -1
  72. package/esm/VcfFeature/index.js +2 -2
  73. package/esm/VcfFeature/util.js +0 -1
  74. package/esm/VcfTabixAdapter/VcfTabixAdapter.js +0 -1
  75. package/esm/VcfTabixAdapter/configSchema.js +0 -1
  76. package/esm/VcfTabixAdapter/index.js +0 -1
  77. package/esm/extensionPoints.js +0 -1
  78. package/esm/index.js +0 -1
  79. package/package.json +3 -4
  80. package/dist/ChordVariantDisplay/index.js.map +0 -1
  81. package/dist/ChordVariantDisplay/models/configSchema.js.map +0 -1
  82. package/dist/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
  83. package/dist/LinearVariantDisplay/configSchema.js.map +0 -1
  84. package/dist/LinearVariantDisplay/index.js.map +0 -1
  85. package/dist/LinearVariantDisplay/model.js.map +0 -1
  86. package/dist/StructuralVariantChordRenderer/Chord.js.map +0 -1
  87. package/dist/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
  88. package/dist/StructuralVariantChordRenderer/configSchema.js.map +0 -1
  89. package/dist/StructuralVariantChordRenderer/index.js.map +0 -1
  90. package/dist/VariantFeatureWidget/AnnotGrid.js.map +0 -1
  91. package/dist/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
  92. package/dist/VariantFeatureWidget/BreakendPanel.js.map +0 -1
  93. package/dist/VariantFeatureWidget/VariantAnnPanel.d.ts +0 -4
  94. package/dist/VariantFeatureWidget/VariantAnnPanel.js +0 -25
  95. package/dist/VariantFeatureWidget/VariantAnnPanel.js.map +0 -1
  96. package/dist/VariantFeatureWidget/VariantCsqPanel.d.ts +0 -4
  97. package/dist/VariantFeatureWidget/VariantCsqPanel.js +0 -25
  98. package/dist/VariantFeatureWidget/VariantCsqPanel.js.map +0 -1
  99. package/dist/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
  100. package/dist/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
  101. package/dist/VariantFeatureWidget/index.js.map +0 -1
  102. package/dist/VariantTrack/configSchema.js.map +0 -1
  103. package/dist/VariantTrack/index.js.map +0 -1
  104. package/dist/VcfAdapter/VcfAdapter.js.map +0 -1
  105. package/dist/VcfAdapter/configSchema.js.map +0 -1
  106. package/dist/VcfAdapter/index.js.map +0 -1
  107. package/dist/VcfFeature/index.js.map +0 -1
  108. package/dist/VcfFeature/util.js.map +0 -1
  109. package/dist/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
  110. package/dist/VcfTabixAdapter/configSchema.js.map +0 -1
  111. package/dist/VcfTabixAdapter/index.js.map +0 -1
  112. package/dist/extensionPoints.js.map +0 -1
  113. package/dist/index.js.map +0 -1
  114. package/esm/ChordVariantDisplay/index.js.map +0 -1
  115. package/esm/ChordVariantDisplay/models/configSchema.js.map +0 -1
  116. package/esm/ChordVariantDisplay/models/stateModelFactory.js.map +0 -1
  117. package/esm/LinearVariantDisplay/configSchema.js.map +0 -1
  118. package/esm/LinearVariantDisplay/index.js.map +0 -1
  119. package/esm/LinearVariantDisplay/model.js.map +0 -1
  120. package/esm/StructuralVariantChordRenderer/Chord.js.map +0 -1
  121. package/esm/StructuralVariantChordRenderer/ReactComponent.js.map +0 -1
  122. package/esm/StructuralVariantChordRenderer/configSchema.js.map +0 -1
  123. package/esm/StructuralVariantChordRenderer/index.js.map +0 -1
  124. package/esm/VariantFeatureWidget/AnnotGrid.js.map +0 -1
  125. package/esm/VariantFeatureWidget/BreakendOptionDialog.js.map +0 -1
  126. package/esm/VariantFeatureWidget/BreakendPanel.js.map +0 -1
  127. package/esm/VariantFeatureWidget/VariantAnnPanel.d.ts +0 -4
  128. package/esm/VariantFeatureWidget/VariantAnnPanel.js +0 -19
  129. package/esm/VariantFeatureWidget/VariantAnnPanel.js.map +0 -1
  130. package/esm/VariantFeatureWidget/VariantCsqPanel.d.ts +0 -4
  131. package/esm/VariantFeatureWidget/VariantCsqPanel.js +0 -19
  132. package/esm/VariantFeatureWidget/VariantCsqPanel.js.map +0 -1
  133. package/esm/VariantFeatureWidget/VariantFeatureWidget.js.map +0 -1
  134. package/esm/VariantFeatureWidget/VariantSampleGrid.js.map +0 -1
  135. package/esm/VariantFeatureWidget/index.js.map +0 -1
  136. package/esm/VariantTrack/configSchema.js.map +0 -1
  137. package/esm/VariantTrack/index.js.map +0 -1
  138. package/esm/VcfAdapter/VcfAdapter.js.map +0 -1
  139. package/esm/VcfAdapter/configSchema.js.map +0 -1
  140. package/esm/VcfAdapter/index.js.map +0 -1
  141. package/esm/VcfFeature/index.js.map +0 -1
  142. package/esm/VcfFeature/util.js.map +0 -1
  143. package/esm/VcfTabixAdapter/VcfTabixAdapter.js.map +0 -1
  144. package/esm/VcfTabixAdapter/configSchema.js.map +0 -1
  145. package/esm/VcfTabixAdapter/index.js.map +0 -1
  146. package/esm/extensionPoints.js.map +0 -1
  147. package/esm/index.js.map +0 -1
  148. package/src/ChordVariantDisplay/index.ts +0 -23
  149. package/src/ChordVariantDisplay/models/configSchema.ts +0 -33
  150. package/src/ChordVariantDisplay/models/stateModelFactory.ts +0 -63
  151. package/src/LinearVariantDisplay/configSchema.ts +0 -30
  152. package/src/LinearVariantDisplay/index.ts +0 -20
  153. package/src/LinearVariantDisplay/model.ts +0 -76
  154. package/src/StructuralVariantChordRenderer/Chord.tsx +0 -141
  155. package/src/StructuralVariantChordRenderer/ReactComponent.tsx +0 -78
  156. package/src/StructuralVariantChordRenderer/configSchema.ts +0 -42
  157. package/src/StructuralVariantChordRenderer/index.ts +0 -17
  158. package/src/VariantFeatureWidget/AnnotGrid.tsx +0 -52
  159. package/src/VariantFeatureWidget/BreakendOptionDialog.tsx +0 -117
  160. package/src/VariantFeatureWidget/BreakendPanel.tsx +0 -93
  161. package/src/VariantFeatureWidget/VariantAnnPanel.tsx +0 -31
  162. package/src/VariantFeatureWidget/VariantCsqPanel.tsx +0 -31
  163. package/src/VariantFeatureWidget/VariantFeatureWidget.test.tsx +0 -42
  164. package/src/VariantFeatureWidget/VariantFeatureWidget.tsx +0 -67
  165. package/src/VariantFeatureWidget/VariantSampleGrid.tsx +0 -152
  166. package/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.tsx.snap +0 -244
  167. package/src/VariantFeatureWidget/index.ts +0 -32
  168. package/src/VariantTrack/configSchema.ts +0 -24
  169. package/src/VariantTrack/index.ts +0 -16
  170. package/src/VcfAdapter/VcfAdapter.test.ts +0 -28
  171. package/src/VcfAdapter/VcfAdapter.ts +0 -125
  172. package/src/VcfAdapter/__snapshots__/VcfAdapter.test.ts.snap +0 -325
  173. package/src/VcfAdapter/configSchema.ts +0 -22
  174. package/src/VcfAdapter/index.ts +0 -15
  175. package/src/VcfAdapter/test_data/volvox.filtered.vcf +0 -73
  176. package/src/VcfFeature/index.test.ts +0 -132
  177. package/src/VcfFeature/index.ts +0 -104
  178. package/src/VcfFeature/util.ts +0 -138
  179. package/src/VcfTabixAdapter/VcfTabixAdapter.test.ts +0 -69
  180. package/src/VcfTabixAdapter/VcfTabixAdapter.ts +0 -90
  181. package/src/VcfTabixAdapter/__snapshots__/VcfTabixAdapter.test.ts.snap +0 -325
  182. package/src/VcfTabixAdapter/configSchema.ts +0 -43
  183. package/src/VcfTabixAdapter/index.ts +0 -17
  184. package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz +0 -0
  185. package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.csi +0 -0
  186. package/src/VcfTabixAdapter/test_data/volvox.filtered.vcf.gz.tbi +0 -0
  187. package/src/__snapshots__/index.test.ts.snap +0 -20
  188. package/src/extensionPoints.ts +0 -74
  189. package/src/index.test.ts +0 -32
  190. package/src/index.ts +0 -27
@@ -1,23 +0,0 @@
1
- import PluginManager from '@jbrowse/core/PluginManager'
2
- import { BaseChordDisplayComponent } from '@jbrowse/plugin-circular-view'
3
- import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
4
-
5
- // locals
6
- import configSchemaF from './models/configSchema'
7
- import stateModelF from './models/stateModelFactory'
8
-
9
- export default (pluginManager: PluginManager) => {
10
- pluginManager.addDisplayType(() => {
11
- const configSchema = configSchemaF(pluginManager)
12
- const stateModel = stateModelF(configSchema)
13
- return new DisplayType({
14
- name: 'ChordVariantDisplay',
15
- displayName: 'Chord variant display',
16
- configSchema,
17
- stateModel,
18
- trackType: 'VariantTrack',
19
- viewType: 'CircularView',
20
- ReactComponent: BaseChordDisplayComponent,
21
- })
22
- })
23
- }
@@ -1,33 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- import PluginManager from '@jbrowse/core/PluginManager'
3
- import { baseChordDisplayConfig } from '@jbrowse/plugin-circular-view'
4
- import { types } from 'mobx-state-tree'
5
-
6
- /**
7
- * #config ChordVariantDisplay
8
- */
9
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
10
-
11
- function stateModelFactory(pluginManager: PluginManager) {
12
- return ConfigurationSchema(
13
- 'ChordVariantDisplay',
14
- {
15
- /**
16
- * #slot
17
- */
18
- renderer: types.optional(
19
- pluginManager.pluggableConfigSchemaType('renderer'),
20
- { type: 'StructuralVariantChordRenderer' },
21
- ),
22
- },
23
- {
24
- /**
25
- * #baseConfiguration
26
- */
27
- baseConfiguration: baseChordDisplayConfig,
28
- explicitlyTyped: true,
29
- },
30
- )
31
- }
32
-
33
- export default stateModelFactory
@@ -1,63 +0,0 @@
1
- import { BaseChordDisplayModel } from '@jbrowse/plugin-circular-view'
2
- import {
3
- AnyConfigurationSchemaType,
4
- ConfigurationReference,
5
- } from '@jbrowse/core/configuration'
6
- import { types } from 'mobx-state-tree'
7
- import { Feature, getContainingView } from '@jbrowse/core/util'
8
- import { getParentRenderProps } from '@jbrowse/core/util/tracks'
9
-
10
- /**
11
- * #stateModel ChordVariantDisplay
12
- * extends `BaseChordDisplay`
13
- */
14
- const stateModelFactory = (configSchema: AnyConfigurationSchemaType) => {
15
- return types
16
- .compose(
17
- 'ChordVariantDisplay',
18
- BaseChordDisplayModel,
19
- types.model({
20
- /**
21
- * #property
22
- */
23
- type: types.literal('ChordVariantDisplay'),
24
- /**
25
- * #property
26
- */
27
- configuration: ConfigurationReference(configSchema),
28
- }),
29
- )
30
- .views(self => ({
31
- /**
32
- * #getter
33
- */
34
- get rendererTypeName() {
35
- return self.configuration.renderer.type
36
- },
37
-
38
- /**
39
- * #method
40
- */
41
- renderProps(): Record<string, unknown> {
42
- const view = getContainingView(self)
43
- return {
44
- ...getParentRenderProps(self),
45
- rpcDriverName: self.rpcDriverName,
46
- displayModel: self,
47
- bezierRadius: view.radiusPx * self.bezierRadiusRatio,
48
- radius: view.radiusPx,
49
- blockDefinitions: self.blockDefinitions,
50
- config: self.configuration.renderer,
51
- onChordClick: (arg: Feature) => self.onChordClick(arg),
52
- }
53
- },
54
- }))
55
- }
56
-
57
- // http://localhost:3000/test_data/hs37d5.HG002-SequelII-CCS.sv.vcf.gz.tbi
58
-
59
- // render request is for 1.5x the current viewing window
60
-
61
- // tracks all have a height
62
- //
63
- export default stateModelFactory
@@ -1,30 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- import { Instance } from 'mobx-state-tree'
3
- import PluginManager from '@jbrowse/core/PluginManager'
4
- import { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'
5
-
6
- /**
7
- * #config LinearVariantDisplay
8
- * mostly empty, this display type is very much
9
- * like a `FeatureTrack` with a `LinearBasicDisplay` except it has a custom
10
- * feature details widget
11
- */
12
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
13
-
14
- export default function configSchemaF(pluginManager: PluginManager) {
15
- return ConfigurationSchema(
16
- 'LinearVariantDisplay',
17
- {},
18
- {
19
- /**
20
- * #baseConfiguration
21
- */
22
- baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),
23
- explicitlyTyped: true,
24
- },
25
- )
26
- }
27
-
28
- export type LinearVariantDisplayConfigModel = ReturnType<typeof configSchemaF>
29
- export type LinearVariantDisplayConfig =
30
- Instance<LinearVariantDisplayConfigModel>
@@ -1,20 +0,0 @@
1
- import PluginManager from '@jbrowse/core/PluginManager'
2
- import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'
3
- import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
4
- import stateModelFactory from './model'
5
- import configSchemaF from './configSchema'
6
-
7
- export default (pluginManager: PluginManager) => {
8
- pluginManager.addDisplayType(() => {
9
- const configSchema = configSchemaF(pluginManager)
10
- return new DisplayType({
11
- name: 'LinearVariantDisplay',
12
- displayName: 'Variant display',
13
- configSchema,
14
- stateModel: stateModelFactory(configSchema),
15
- trackType: 'VariantTrack',
16
- viewType: 'LinearGenomeView',
17
- ReactComponent: BaseLinearDisplayComponent,
18
- })
19
- })
20
- }
@@ -1,76 +0,0 @@
1
- import { getConf, ConfigurationReference } from '@jbrowse/core/configuration'
2
- import { getRpcSessionId } from '@jbrowse/core/util/tracks'
3
- import {
4
- getContainingTrack,
5
- getSession,
6
- getContainingView,
7
- isSessionModelWithWidgets,
8
- Feature,
9
- } from '@jbrowse/core/util'
10
-
11
- import { linearBasicDisplayModelFactory } from '@jbrowse/plugin-linear-genome-view'
12
- import { Instance, types } from 'mobx-state-tree'
13
- import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration'
14
-
15
- /**
16
- * #stateModel LinearVariantDisplay
17
- * extends `LinearBasicDisplay`
18
- * very similar to basic display, but provides custom widget on feature click
19
- */
20
- export default function stateModelFactory(
21
- configSchema: AnyConfigurationSchemaType,
22
- ) {
23
- return types
24
- .compose(
25
- 'LinearVariantDisplay',
26
- linearBasicDisplayModelFactory(configSchema),
27
- types.model({
28
- /**
29
- * #property
30
- */
31
- type: types.literal('LinearVariantDisplay'),
32
- /**
33
- * #property
34
- */
35
- configuration: ConfigurationReference(configSchema),
36
- }),
37
- )
38
-
39
- .actions(self => ({
40
- /**
41
- * #action
42
- */
43
- async selectFeature(feature: Feature) {
44
- const session = getSession(self)
45
- if (isSessionModelWithWidgets(session)) {
46
- const { rpcManager } = session
47
- const sessionId = getRpcSessionId(self)
48
- const track = getContainingTrack(self)
49
- const view = getContainingView(self)
50
- const adapterConfig = getConf(track, 'adapter')
51
- const descriptions = await rpcManager.call(
52
- sessionId,
53
- 'CoreGetMetadata',
54
- {
55
- adapterConfig,
56
- },
57
- )
58
- session.showWidget(
59
- session.addWidget('VariantFeatureWidget', 'variantFeature', {
60
- featureData: feature.toJSON(),
61
- view,
62
- track,
63
- descriptions,
64
- }),
65
- )
66
- }
67
-
68
- session.setSelection(feature)
69
- },
70
- }))
71
- }
72
-
73
- export type LinearVariantDisplayStateModel = ReturnType<
74
- typeof stateModelFactory
75
- >
76
- export type LinearVariantDisplayModel = Instance<LinearVariantDisplayStateModel>
@@ -1,141 +0,0 @@
1
- import React from 'react'
2
- import { observer } from 'mobx-react'
3
- import { polarToCartesian, Feature } from '@jbrowse/core/util'
4
- import {
5
- AnyConfigurationModel,
6
- readConfObject,
7
- } from '@jbrowse/core/configuration'
8
- import { parseBreakend } from '@gmod/vcf'
9
-
10
- export interface Region {
11
- end: number
12
- start: number
13
- refName: string
14
- elided?: false
15
- }
16
-
17
- export interface ElidedRegion {
18
- elided: true
19
- regions: Region[]
20
- }
21
-
22
- export type AnyRegion = Region | ElidedRegion
23
-
24
- export interface Block {
25
- flipped: boolean
26
- bpPerRadian: number
27
- startRadians: number
28
- region: AnyRegion
29
- }
30
-
31
- function bpToRadians(block: Block, pos: number) {
32
- const blockStart = block.region.elided ? 0 : block.region.start
33
- const blockEnd = block.region.elided ? 0 : block.region.end
34
- const bpOffset = block.flipped ? blockEnd - pos : pos - blockStart
35
- return bpOffset / block.bpPerRadian + block.startRadians
36
- }
37
-
38
- const Chord = observer(function Chord({
39
- feature,
40
- blocksForRefs,
41
- radius,
42
- config,
43
- bezierRadius,
44
- selected,
45
- onClick,
46
- }: {
47
- feature: Feature
48
- blocksForRefs: { [key: string]: Block }
49
- radius: number
50
- config: AnyConfigurationModel
51
- bezierRadius: number
52
- selected: boolean
53
- onClick: (
54
- feature: Feature,
55
- reg: AnyRegion,
56
- endBlock: AnyRegion,
57
- evt: unknown,
58
- ) => void
59
- }) {
60
- // find the blocks that our start and end points belong to
61
- const startBlock = blocksForRefs[feature.get('refName')]
62
- if (!startBlock) {
63
- return null
64
- }
65
- let svType
66
- if (feature.get('INFO')) {
67
- ;[svType] = feature.get('INFO').SVTYPE || []
68
- } else if (feature.get('mate')) {
69
- svType = 'mate'
70
- }
71
- let endPosition
72
- let endBlock: Block | undefined
73
- const alt = feature.get('ALT')?.[0]
74
- const bnd = alt && parseBreakend(alt)
75
- if (bnd) {
76
- // VCF BND
77
- const matePosition = bnd.MatePosition.split(':')
78
- endPosition = +matePosition[1]
79
- endBlock = blocksForRefs[matePosition[0]]
80
- } else if (alt === '<TRA>') {
81
- // VCF TRA
82
- const chr2 = feature.get('INFO')?.CHR2?.[0]
83
- const end = feature.get('INFO')?.END?.[0]
84
- endPosition = parseInt(end, 10)
85
- endBlock = blocksForRefs[chr2]
86
- } else if (svType === 'mate') {
87
- // generic simplefeatures arcs
88
- const mate = feature.get('mate')
89
- const chr2 = mate.refName
90
- endPosition = mate.start
91
- endBlock = blocksForRefs[chr2]
92
- }
93
-
94
- if (endBlock) {
95
- const startPos = feature.get('start')
96
- const startRadians = bpToRadians(startBlock, startPos)
97
- const endRadians = bpToRadians(endBlock, endPosition)
98
- const startXY = polarToCartesian(radius, startRadians)
99
- const endXY = polarToCartesian(radius, endRadians)
100
- const controlXY = polarToCartesian(
101
- bezierRadius,
102
- (endRadians + startRadians) / 2,
103
- )
104
-
105
- const strokeColor = selected
106
- ? readConfObject(config, 'strokeColorSelected', { feature })
107
- : readConfObject(config, 'strokeColor', { feature })
108
-
109
- const hoverStrokeColor = readConfObject(config, 'strokeColorHover', {
110
- feature,
111
- })
112
- return (
113
- <path
114
- data-testid={`chord-${feature.id()}`}
115
- d={['M', ...startXY, 'Q', ...controlXY, ...endXY].join(' ')}
116
- style={{ stroke: strokeColor }}
117
- onClick={evt => {
118
- if (endBlock && startBlock) {
119
- onClick(feature, startBlock.region, endBlock.region, evt)
120
- }
121
- }}
122
- onMouseOver={evt => {
123
- if (!selected) {
124
- evt.currentTarget.style.stroke = hoverStrokeColor
125
- evt.currentTarget.style.strokeWidth = '3px'
126
- }
127
- }}
128
- onMouseOut={evt => {
129
- if (!selected) {
130
- evt.currentTarget.style.stroke = strokeColor
131
- evt.currentTarget.style.strokeWidth = '1px'
132
- }
133
- }}
134
- />
135
- )
136
- }
137
-
138
- return null
139
- })
140
-
141
- export default Chord
@@ -1,78 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import { observer } from 'mobx-react'
3
- import { Feature } from '@jbrowse/core/util'
4
- import { AnyConfigurationModel } from '@jbrowse/core/configuration'
5
-
6
- // locals
7
- import Chord, { Block, AnyRegion } from './Chord'
8
-
9
- export default observer(function StructuralVariantChords({
10
- features,
11
- config,
12
- displayModel,
13
- blockDefinitions,
14
- radius,
15
- bezierRadius,
16
- displayModel: { selectedFeatureId },
17
- onChordClick,
18
- }: {
19
- features: Map<string, Feature>
20
- radius: number
21
- config: AnyConfigurationModel
22
- displayModel: { id: string; selectedFeatureId: string }
23
- blockDefinitions: Block[]
24
- bezierRadius: number
25
- onChordClick: (
26
- feature: Feature,
27
- reg: AnyRegion,
28
- endBlock: AnyRegion,
29
- evt: unknown,
30
- ) => void
31
- }) {
32
- // make a map of refName -> blockDefinition
33
- const blocksForRefsMemo = useMemo(() => {
34
- const blocksForRefs = {} as { [key: string]: Block }
35
- blockDefinitions.forEach(block => {
36
- ;(block.region.elided ? block.region.regions : [block.region]).forEach(
37
- r => (blocksForRefs[r.refName] = block),
38
- )
39
- })
40
- return blocksForRefs
41
- }, [blockDefinitions])
42
- const chords = []
43
- for (const feature of features.values()) {
44
- const id = feature.id()
45
- const selected = String(selectedFeatureId) === String(id)
46
- chords.push(
47
- <Chord
48
- key={id}
49
- feature={feature}
50
- config={config}
51
- radius={radius}
52
- bezierRadius={bezierRadius}
53
- blocksForRefs={blocksForRefsMemo}
54
- selected={selected}
55
- onClick={onChordClick}
56
- />,
57
- )
58
- }
59
- const trackStyleId = `chords-${
60
- typeof jest !== 'undefined' ? 'test' : displayModel.id
61
- }`
62
- return (
63
- <g id={trackStyleId} data-testid="structuralVariantChordRenderer">
64
- <style
65
- // eslint-disable-next-line react/no-danger
66
- dangerouslySetInnerHTML={{
67
- __html: `
68
- #${trackStyleId} > path {
69
- cursor: crosshair;
70
- fill: none;
71
- }
72
- `,
73
- }}
74
- />
75
- {chords}
76
- </g>
77
- )
78
- })
@@ -1,42 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- /**
3
- * #config StructuralVariantChordRenderer
4
- */
5
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
6
-
7
- const configSchema = ConfigurationSchema(
8
- 'StructuralVariantChordRenderer',
9
- {
10
- /**
11
- * #slot
12
- */
13
- strokeColor: {
14
- type: 'color',
15
- description: 'the line color of each arc',
16
- defaultValue: 'rgba(255,133,0,0.32)',
17
- contextVariable: ['feature'],
18
- },
19
- /**
20
- * #slot
21
- */
22
- strokeColorSelected: {
23
- type: 'color',
24
- description: 'the line color of an arc that has been selected',
25
- defaultValue: 'black',
26
- contextVariable: ['feature'],
27
- },
28
- /**
29
- * #slot
30
- */
31
- strokeColorHover: {
32
- type: 'color',
33
- description:
34
- 'the line color of an arc that is being hovered over with the mouse',
35
- defaultValue: '#555',
36
- contextVariable: ['feature'],
37
- },
38
- },
39
- { explicitlyTyped: true },
40
- )
41
-
42
- export default configSchema
@@ -1,17 +0,0 @@
1
- import ChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType'
2
- import PluginManager from '@jbrowse/core/PluginManager'
3
- import configSchema from './configSchema'
4
- import ReactComponent from './ReactComponent'
5
-
6
- export default (pluginManager: PluginManager) => {
7
- pluginManager.addRendererType(
8
- () =>
9
- new ChordRendererType({
10
- name: 'StructuralVariantChordRenderer',
11
- displayName: 'SV chord renderer',
12
- ReactComponent,
13
- configSchema,
14
- pluginManager,
15
- }),
16
- )
17
- }
@@ -1,52 +0,0 @@
1
- import React, { useState } from 'react'
2
- import {
3
- DataGrid,
4
- GridColDef,
5
- GridToolbar,
6
- GridValidRowModel,
7
- } from '@mui/x-data-grid'
8
- import { Checkbox, FormControlLabel, Typography } from '@mui/material'
9
-
10
- export default function VariantAnnotPanel({
11
- rows,
12
- columns,
13
- }: {
14
- rows: GridValidRowModel[]
15
- columns: GridColDef[]
16
- }) {
17
- const rowHeight = 25
18
- const headerHeight = 100
19
- const footerHeight = 50
20
- const [checked, setChecked] = useState(false)
21
- const height =
22
- Math.min(rows.length, 100) * rowHeight +
23
- headerHeight +
24
- (checked ? 50 : 0) +
25
- footerHeight
26
- return rows.length ? (
27
- <div>
28
- <FormControlLabel
29
- control={
30
- <Checkbox
31
- checked={checked}
32
- onChange={event => setChecked(event.target.checked)}
33
- />
34
- }
35
- label={<Typography variant="body2">Show options</Typography>}
36
- />
37
- <div
38
- style={{
39
- height,
40
- width: '100%',
41
- }}
42
- >
43
- <DataGrid
44
- rowHeight={rowHeight}
45
- rows={rows}
46
- columns={columns}
47
- slots={{ toolbar: checked ? GridToolbar : null }}
48
- />
49
- </div>
50
- </div>
51
- ) : null
52
- }
@@ -1,117 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import React, { useState } from 'react'
3
- import { observer } from 'mobx-react'
4
- import {
5
- Button,
6
- Checkbox,
7
- DialogActions,
8
- DialogContent,
9
- FormControlLabel,
10
- } from '@mui/material'
11
- import { makeStyles } from 'tss-react/mui'
12
- import { getSnapshot } from 'mobx-state-tree'
13
- // jbrowse
14
- import { Dialog } from '@jbrowse/core/ui'
15
- import { getSession, Feature } from '@jbrowse/core/util'
16
-
17
- const useStyles = makeStyles()({
18
- block: {
19
- display: 'block',
20
- },
21
- })
22
-
23
- export default observer(function BreakendOptionDialog({
24
- model,
25
- handleClose,
26
- feature,
27
- viewType,
28
- }: {
29
- model: any
30
- handleClose: () => void
31
- feature: Feature
32
- viewType: any
33
- }) {
34
- const { classes } = useStyles()
35
- const [copyTracks, setCopyTracks] = useState(true)
36
- const [mirrorTracks, setMirrorTracks] = useState(true)
37
-
38
- return (
39
- <Dialog open onClose={handleClose} title="Breakpoint split view options">
40
- <DialogContent>
41
- <FormControlLabel
42
- className={classes.block}
43
- control={
44
- <Checkbox
45
- checked={copyTracks}
46
- onChange={event => setCopyTracks(event.target.checked)}
47
- />
48
- }
49
- label="Copy tracks into the new view"
50
- />
51
-
52
- <FormControlLabel
53
- className={classes.block}
54
- control={
55
- <Checkbox
56
- checked={mirrorTracks}
57
- onChange={event => setMirrorTracks(event.target.checked)}
58
- />
59
- }
60
- label="Mirror tracks vertically in vertically stacked view"
61
- />
62
- </DialogContent>
63
- <DialogActions>
64
- <Button
65
- onClick={() => {
66
- const { view } = model
67
- const session = getSession(model)
68
- try {
69
- const viewSnapshot = viewType.snapshotFromBreakendFeature(
70
- feature,
71
- view,
72
- )
73
-
74
- interface Track {
75
- trackId: string
76
- [key: string]: unknown
77
- }
78
- function remapIds(arr: Track[]) {
79
- return arr.map(v => ({
80
- ...v,
81
- id: `${v.trackId}-${Math.random()}`,
82
- }))
83
- }
84
- viewSnapshot.views[0].offsetPx -= view.width / 2 + 100
85
- viewSnapshot.views[1].offsetPx -= view.width / 2 + 100
86
- viewSnapshot.featureData = feature
87
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
88
- const viewTracks = getSnapshot(view.tracks) as Track[]
89
- viewSnapshot.views[0].tracks = remapIds(viewTracks)
90
- viewSnapshot.views[1].tracks = remapIds(
91
- mirrorTracks ? [...viewTracks].reverse() : viewTracks,
92
- )
93
-
94
- session.addView('BreakpointSplitView', viewSnapshot)
95
- } catch (e) {
96
- console.error(e)
97
- session.notify(`${e}`)
98
- }
99
- handleClose()
100
- }}
101
- variant="contained"
102
- color="primary"
103
- autoFocus
104
- >
105
- OK
106
- </Button>
107
- <Button
108
- onClick={() => handleClose()}
109
- color="secondary"
110
- variant="contained"
111
- >
112
- Cancel
113
- </Button>
114
- </DialogActions>
115
- </Dialog>
116
- )
117
- })