@jbrowse/plugin-linear-comparative-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 (209) hide show
  1. package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
  2. package/dist/LGVSyntenyDisplay/configSchemaF.js +0 -1
  3. package/dist/LGVSyntenyDisplay/index.js +0 -1
  4. package/dist/LGVSyntenyDisplay/model.d.ts +4 -2
  5. package/dist/LGVSyntenyDisplay/model.js +0 -1
  6. package/dist/LaunchLinearSyntenyView.js +0 -1
  7. package/dist/LinearComparativeDisplay/configSchemaF.js +0 -1
  8. package/dist/LinearComparativeDisplay/index.js +0 -1
  9. package/dist/LinearComparativeDisplay/stateModelFactory.js +0 -1
  10. package/dist/LinearComparativeView/components/Header.js +11 -2
  11. package/dist/LinearComparativeView/components/LinearComparativeView.js +0 -1
  12. package/dist/LinearComparativeView/components/Rubberband.js +11 -33
  13. package/dist/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
  14. package/dist/LinearComparativeView/components/VerticalGuide.js +33 -0
  15. package/dist/LinearComparativeView/index.js +0 -1
  16. package/dist/LinearComparativeView/model.d.ts +9 -15
  17. package/dist/LinearComparativeView/model.js +0 -1
  18. package/dist/LinearReadVsRef/LinearReadVsRef.js +0 -1
  19. package/dist/LinearReadVsRef/index.js +0 -1
  20. package/dist/LinearSyntenyDisplay/afterAttach.js +0 -1
  21. package/dist/LinearSyntenyDisplay/components/Component.js +0 -1
  22. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
  23. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
  24. package/dist/LinearSyntenyDisplay/components/util.js +0 -1
  25. package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -1
  26. package/dist/LinearSyntenyDisplay/drawSynteny.js +0 -1
  27. package/dist/LinearSyntenyDisplay/index.js +0 -1
  28. package/dist/LinearSyntenyDisplay/model.js +0 -1
  29. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
  30. package/dist/LinearSyntenyView/components/Icons.js +0 -1
  31. package/dist/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
  32. package/dist/LinearSyntenyView/components/ImportForm.js +0 -1
  33. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
  34. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
  35. package/dist/LinearSyntenyView/index.js +0 -1
  36. package/dist/LinearSyntenyView/model.d.ts +9 -9
  37. package/dist/LinearSyntenyView/model.js +0 -1
  38. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +0 -1
  39. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
  40. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
  41. package/dist/SyntenyFeatureDetail/index.js +0 -1
  42. package/dist/SyntenyTrack/configSchema.js +0 -1
  43. package/dist/SyntenyTrack/index.js +0 -1
  44. package/dist/index.js +0 -1
  45. package/dist/util.js +0 -1
  46. package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +1 -3
  47. package/esm/LGVSyntenyDisplay/configSchemaF.js +0 -1
  48. package/esm/LGVSyntenyDisplay/index.js +0 -1
  49. package/esm/LGVSyntenyDisplay/model.d.ts +4 -2
  50. package/esm/LGVSyntenyDisplay/model.js +0 -1
  51. package/esm/LaunchLinearSyntenyView.js +0 -1
  52. package/esm/LinearComparativeDisplay/configSchemaF.js +0 -1
  53. package/esm/LinearComparativeDisplay/index.js +0 -1
  54. package/esm/LinearComparativeDisplay/stateModelFactory.js +0 -1
  55. package/esm/LinearComparativeView/components/Header.js +11 -2
  56. package/esm/LinearComparativeView/components/LinearComparativeView.js +0 -1
  57. package/esm/LinearComparativeView/components/Rubberband.js +8 -33
  58. package/esm/LinearComparativeView/components/VerticalGuide.d.ts +8 -0
  59. package/esm/LinearComparativeView/components/VerticalGuide.js +28 -0
  60. package/esm/LinearComparativeView/index.js +0 -1
  61. package/esm/LinearComparativeView/model.d.ts +9 -15
  62. package/esm/LinearComparativeView/model.js +0 -1
  63. package/esm/LinearReadVsRef/LinearReadVsRef.js +0 -1
  64. package/esm/LinearReadVsRef/index.js +0 -1
  65. package/esm/LinearSyntenyDisplay/afterAttach.js +0 -1
  66. package/esm/LinearSyntenyDisplay/components/Component.js +0 -1
  67. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +0 -1
  68. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +0 -1
  69. package/esm/LinearSyntenyDisplay/components/util.js +0 -1
  70. package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -1
  71. package/esm/LinearSyntenyDisplay/drawSynteny.js +0 -1
  72. package/esm/LinearSyntenyDisplay/index.js +0 -1
  73. package/esm/LinearSyntenyDisplay/model.js +0 -1
  74. package/esm/LinearSyntenyView/components/ExportSvgDialog.js +0 -1
  75. package/esm/LinearSyntenyView/components/Icons.js +0 -1
  76. package/esm/LinearSyntenyView/components/ImportCustomTrack.js +0 -1
  77. package/esm/LinearSyntenyView/components/ImportForm.js +0 -1
  78. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +0 -1
  79. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +0 -1
  80. package/esm/LinearSyntenyView/index.js +0 -1
  81. package/esm/LinearSyntenyView/model.d.ts +9 -9
  82. package/esm/LinearSyntenyView/model.js +0 -1
  83. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +0 -1
  84. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +0 -1
  85. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +0 -1
  86. package/esm/SyntenyFeatureDetail/index.js +0 -1
  87. package/esm/SyntenyTrack/configSchema.js +0 -1
  88. package/esm/SyntenyTrack/index.js +0 -1
  89. package/esm/index.js +0 -1
  90. package/esm/util.js +0 -1
  91. package/package.json +3 -4
  92. package/dist/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
  93. package/dist/LGVSyntenyDisplay/index.js.map +0 -1
  94. package/dist/LGVSyntenyDisplay/model.js.map +0 -1
  95. package/dist/LaunchLinearSyntenyView.js.map +0 -1
  96. package/dist/LinearComparativeDisplay/configSchemaF.js.map +0 -1
  97. package/dist/LinearComparativeDisplay/index.js.map +0 -1
  98. package/dist/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
  99. package/dist/LinearComparativeView/components/Header.js.map +0 -1
  100. package/dist/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
  101. package/dist/LinearComparativeView/components/Rubberband.js.map +0 -1
  102. package/dist/LinearComparativeView/index.js.map +0 -1
  103. package/dist/LinearComparativeView/model.js.map +0 -1
  104. package/dist/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
  105. package/dist/LinearReadVsRef/index.js.map +0 -1
  106. package/dist/LinearSyntenyDisplay/afterAttach.js.map +0 -1
  107. package/dist/LinearSyntenyDisplay/components/Component.js.map +0 -1
  108. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
  109. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
  110. package/dist/LinearSyntenyDisplay/components/util.js.map +0 -1
  111. package/dist/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
  112. package/dist/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
  113. package/dist/LinearSyntenyDisplay/index.js.map +0 -1
  114. package/dist/LinearSyntenyDisplay/model.js.map +0 -1
  115. package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
  116. package/dist/LinearSyntenyView/components/Icons.js.map +0 -1
  117. package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
  118. package/dist/LinearSyntenyView/components/ImportForm.js.map +0 -1
  119. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
  120. package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
  121. package/dist/LinearSyntenyView/index.js.map +0 -1
  122. package/dist/LinearSyntenyView/model.js.map +0 -1
  123. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
  124. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
  125. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
  126. package/dist/SyntenyFeatureDetail/index.js.map +0 -1
  127. package/dist/SyntenyTrack/configSchema.js.map +0 -1
  128. package/dist/SyntenyTrack/index.js.map +0 -1
  129. package/dist/index.js.map +0 -1
  130. package/dist/util.js.map +0 -1
  131. package/esm/LGVSyntenyDisplay/configSchemaF.js.map +0 -1
  132. package/esm/LGVSyntenyDisplay/index.js.map +0 -1
  133. package/esm/LGVSyntenyDisplay/model.js.map +0 -1
  134. package/esm/LaunchLinearSyntenyView.js.map +0 -1
  135. package/esm/LinearComparativeDisplay/configSchemaF.js.map +0 -1
  136. package/esm/LinearComparativeDisplay/index.js.map +0 -1
  137. package/esm/LinearComparativeDisplay/stateModelFactory.js.map +0 -1
  138. package/esm/LinearComparativeView/components/Header.js.map +0 -1
  139. package/esm/LinearComparativeView/components/LinearComparativeView.js.map +0 -1
  140. package/esm/LinearComparativeView/components/Rubberband.js.map +0 -1
  141. package/esm/LinearComparativeView/index.js.map +0 -1
  142. package/esm/LinearComparativeView/model.js.map +0 -1
  143. package/esm/LinearReadVsRef/LinearReadVsRef.js.map +0 -1
  144. package/esm/LinearReadVsRef/index.js.map +0 -1
  145. package/esm/LinearSyntenyDisplay/afterAttach.js.map +0 -1
  146. package/esm/LinearSyntenyDisplay/components/Component.js.map +0 -1
  147. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +0 -1
  148. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +0 -1
  149. package/esm/LinearSyntenyDisplay/components/util.js.map +0 -1
  150. package/esm/LinearSyntenyDisplay/configSchemaF.js.map +0 -1
  151. package/esm/LinearSyntenyDisplay/drawSynteny.js.map +0 -1
  152. package/esm/LinearSyntenyDisplay/index.js.map +0 -1
  153. package/esm/LinearSyntenyDisplay/model.js.map +0 -1
  154. package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +0 -1
  155. package/esm/LinearSyntenyView/components/Icons.js.map +0 -1
  156. package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +0 -1
  157. package/esm/LinearSyntenyView/components/ImportForm.js.map +0 -1
  158. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +0 -1
  159. package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +0 -1
  160. package/esm/LinearSyntenyView/index.js.map +0 -1
  161. package/esm/LinearSyntenyView/model.js.map +0 -1
  162. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +0 -1
  163. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +0 -1
  164. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +0 -1
  165. package/esm/SyntenyFeatureDetail/index.js.map +0 -1
  166. package/esm/SyntenyTrack/configSchema.js.map +0 -1
  167. package/esm/SyntenyTrack/index.js.map +0 -1
  168. package/esm/index.js.map +0 -1
  169. package/esm/util.js.map +0 -1
  170. package/src/LGVSyntenyDisplay/configSchemaF.ts +0 -22
  171. package/src/LGVSyntenyDisplay/index.ts +0 -20
  172. package/src/LGVSyntenyDisplay/model.ts +0 -177
  173. package/src/LaunchLinearSyntenyView.ts +0 -86
  174. package/src/LinearComparativeDisplay/configSchemaF.ts +0 -22
  175. package/src/LinearComparativeDisplay/index.ts +0 -21
  176. package/src/LinearComparativeDisplay/stateModelFactory.ts +0 -212
  177. package/src/LinearComparativeView/components/Header.tsx +0 -103
  178. package/src/LinearComparativeView/components/LinearComparativeView.tsx +0 -152
  179. package/src/LinearComparativeView/components/Rubberband.tsx +0 -329
  180. package/src/LinearComparativeView/index.ts +0 -15
  181. package/src/LinearComparativeView/model.ts +0 -395
  182. package/src/LinearReadVsRef/LinearReadVsRef.tsx +0 -360
  183. package/src/LinearReadVsRef/index.ts +0 -58
  184. package/src/LinearSyntenyDisplay/afterAttach.ts +0 -149
  185. package/src/LinearSyntenyDisplay/components/Component.tsx +0 -75
  186. package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +0 -200
  187. package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +0 -82
  188. package/src/LinearSyntenyDisplay/components/util.ts +0 -142
  189. package/src/LinearSyntenyDisplay/configSchemaF.ts +0 -38
  190. package/src/LinearSyntenyDisplay/drawSynteny.ts +0 -266
  191. package/src/LinearSyntenyDisplay/index.ts +0 -21
  192. package/src/LinearSyntenyDisplay/model.ts +0 -187
  193. package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +0 -148
  194. package/src/LinearSyntenyView/components/Icons.tsx +0 -24
  195. package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +0 -262
  196. package/src/LinearSyntenyView/components/ImportForm.tsx +0 -221
  197. package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +0 -82
  198. package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +0 -20
  199. package/src/LinearSyntenyView/index.ts +0 -15
  200. package/src/LinearSyntenyView/model.test.ts +0 -1605
  201. package/src/LinearSyntenyView/model.ts +0 -169
  202. package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +0 -21
  203. package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +0 -176
  204. package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +0 -64
  205. package/src/SyntenyFeatureDetail/index.ts +0 -36
  206. package/src/SyntenyTrack/configSchema.ts +0 -23
  207. package/src/SyntenyTrack/index.tsx +0 -15
  208. package/src/index.tsx +0 -42
  209. package/src/util.ts +0 -124
@@ -1,262 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { SnapshotIn } from 'mobx-state-tree'
3
- import path from 'path'
4
- import {
5
- FormControlLabel,
6
- Grid,
7
- Paper,
8
- Radio,
9
- RadioGroup,
10
- Typography,
11
- } from '@mui/material'
12
- import { ErrorMessage, FileSelector } from '@jbrowse/core/ui'
13
- import { FileLocation } from '@jbrowse/core/util/types'
14
- import { observer } from 'mobx-react'
15
- import { AnyConfigurationModel } from '@jbrowse/core/configuration'
16
-
17
- function getName(
18
- sessionTrackData?: { uri: string } | { localPath: string } | { name: string },
19
- ) {
20
- return sessionTrackData
21
- ? // @ts-expect-error
22
- sessionTrackData.uri ||
23
- // @ts-expect-error
24
- sessionTrackData.localPath ||
25
- // @ts-expect-error
26
- sessionTrackData.name
27
- : undefined
28
- }
29
-
30
- function stripGz(fileName: string) {
31
- return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName
32
- }
33
-
34
- function getAdapter({
35
- radioOption,
36
- assembly1,
37
- assembly2,
38
- fileLocation,
39
- bed1Location,
40
- bed2Location,
41
- }: {
42
- radioOption: string
43
- assembly1: string
44
- assembly2: string
45
- fileLocation?: FileLocation
46
- bed1Location?: FileLocation
47
- bed2Location?: FileLocation
48
- }) {
49
- if (radioOption === '.paf') {
50
- return {
51
- type: 'PAFAdapter',
52
- pafLocation: fileLocation,
53
- queryAssembly: assembly1,
54
- targetAssembly: assembly2,
55
- }
56
- } else if (radioOption === '.out') {
57
- return {
58
- type: 'MashMapAdapter',
59
- outLocation: fileLocation,
60
- queryAssembly: assembly1,
61
- targetAssembly: assembly2,
62
- }
63
- } else if (radioOption === '.delta') {
64
- return {
65
- type: 'DeltaAdapter',
66
- deltaLocation: fileLocation,
67
- queryAssembly: assembly1,
68
- targetAssembly: assembly2,
69
- }
70
- } else if (radioOption === '.chain') {
71
- return {
72
- type: 'ChainAdapter',
73
- chainLocation: fileLocation,
74
- queryAssembly: assembly1,
75
- targetAssembly: assembly2,
76
- }
77
- } else if (radioOption === '.anchors') {
78
- return {
79
- type: 'MCScanAnchorsAdapter',
80
- mcscanAnchorsLocation: fileLocation,
81
- bed1Location,
82
- bed2Location,
83
- assemblyNames: [assembly1, assembly2],
84
- }
85
- } else if (radioOption === '.anchors.simple') {
86
- return {
87
- type: 'MCScanSimpleAnchorsAdapter',
88
- mcscanSimpleAnchorsLocation: fileLocation,
89
- bed1Location,
90
- bed2Location,
91
- assemblyNames: [assembly1, assembly2],
92
- }
93
- } else {
94
- throw new Error('Unknown type')
95
- }
96
- }
97
-
98
- type Conf = SnapshotIn<AnyConfigurationModel>
99
-
100
- const OpenTrack = observer(
101
- ({
102
- sessionTrackData,
103
- assembly1,
104
- assembly2,
105
- setSessionTrackData,
106
- }: {
107
- sessionTrackData: Conf
108
- assembly1: string
109
- assembly2: string
110
- setSessionTrackData: (arg: Conf) => void
111
- }) => {
112
- const [bed2Location, setBed2Location] = useState<FileLocation>()
113
- const [bed1Location, setBed1Location] = useState<FileLocation>()
114
- const [fileLocation, setFileLocation] = useState<FileLocation>()
115
- const [value, setValue] = useState('')
116
- const [error, setError] = useState<unknown>()
117
- const fileName = getName(fileLocation)
118
-
119
- const radioOption =
120
- value || (fileName ? path.extname(stripGz(fileName)) : '')
121
-
122
- useEffect(() => {
123
- try {
124
- if (fileLocation) {
125
- const fn = fileName ? path.basename(fileName) : 'MyTrack'
126
- const trackId = `${fn}-${Date.now()}`
127
- setError(undefined)
128
-
129
- setSessionTrackData({
130
- trackId,
131
- name: fn,
132
- assemblyNames: [assembly2, assembly1],
133
- type: 'SyntenyTrack',
134
- adapter: getAdapter({
135
- radioOption,
136
- assembly1,
137
- assembly2,
138
- fileLocation,
139
- bed1Location,
140
- bed2Location,
141
- }),
142
- })
143
- }
144
- } catch (e) {
145
- console.error(e)
146
- setError(e)
147
- }
148
- }, [
149
- fileName,
150
- assembly1,
151
- assembly2,
152
- bed1Location,
153
- bed2Location,
154
- fileLocation,
155
- radioOption,
156
- setSessionTrackData,
157
- ])
158
- return (
159
- <Paper style={{ padding: 12 }}>
160
- {error ? <ErrorMessage error={error} /> : null}
161
- <Typography style={{ textAlign: 'center' }}>
162
- Add a .paf, .out (MashMap), .delta (Mummer), .chain, .anchors or
163
- .anchors.simple (MCScan) file to view in the dotplot. These file types
164
- can also be gzipped. The first assembly should be the query sequence
165
- (e.g. left column of the PAF) and the second assembly should be the
166
- target sequence (e.g. right column of the PAF)
167
- </Typography>
168
- <RadioGroup
169
- value={radioOption}
170
- onChange={event => setValue(event.target.value)}
171
- >
172
- <Grid container justifyContent="center">
173
- <Grid item>
174
- <FormControlLabel value=".paf" control={<Radio />} label=".paf" />
175
- </Grid>
176
- <Grid item>
177
- <FormControlLabel value=".out" control={<Radio />} label=".out" />
178
- </Grid>
179
- <Grid item>
180
- <FormControlLabel
181
- value=".delta"
182
- control={<Radio />}
183
- label=".delta"
184
- />
185
- </Grid>
186
- <Grid item>
187
- <FormControlLabel
188
- value=".chain"
189
- control={<Radio />}
190
- label=".chain"
191
- />
192
- </Grid>
193
- <Grid item>
194
- <FormControlLabel
195
- value=".anchors"
196
- control={<Radio />}
197
- label=".anchors"
198
- />
199
- </Grid>
200
- <Grid item>
201
- <FormControlLabel
202
- value=".anchors.simple"
203
- control={<Radio />}
204
- label=".anchors.simple"
205
- />
206
- </Grid>
207
- </Grid>
208
- </RadioGroup>
209
- <Grid container justifyContent="center">
210
- <Grid item>
211
- {value === '.anchors' || value === '.anchors.simple' ? (
212
- <div>
213
- <div style={{ margin: 20 }}>
214
- Open the {value} and .bed files for both genome assemblies
215
- from the MCScan (Python version) pipeline{' '}
216
- <a href="https://github.com/tanghaibao/jcvi/wiki/MCscan-(Python-version)">
217
- (more info)
218
- </a>
219
- </div>
220
- <div style={{ display: 'flex' }}>
221
- <div>
222
- <FileSelector
223
- name=".anchors file"
224
- description=""
225
- location={fileLocation}
226
- setLocation={loc => setFileLocation(loc)}
227
- />
228
- </div>
229
- <div>
230
- <FileSelector
231
- name="genome 1 .bed (left column of anchors file)"
232
- description=""
233
- location={bed1Location}
234
- setLocation={loc => setBed1Location(loc)}
235
- />
236
- </div>
237
- <div>
238
- <FileSelector
239
- name="genome 2 .bed (right column of anchors file)"
240
- description=""
241
- location={bed2Location}
242
- setLocation={loc => setBed2Location(loc)}
243
- />
244
- </div>
245
- </div>
246
- </div>
247
- ) : (
248
- <FileSelector
249
- name={value ? value + ' location' : ''}
250
- description=""
251
- location={fileLocation}
252
- setLocation={loc => setFileLocation(loc)}
253
- />
254
- )}
255
- </Grid>
256
- </Grid>
257
- </Paper>
258
- )
259
- },
260
- )
261
-
262
- export default OpenTrack
@@ -1,221 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import {
3
- Button,
4
- Container,
5
- FormControl,
6
- FormLabel,
7
- FormControlLabel,
8
- Grid,
9
- Paper,
10
- Radio,
11
- RadioGroup,
12
- } from '@mui/material'
13
- import { makeStyles } from 'tss-react/mui'
14
- import { observer } from 'mobx-react'
15
- import { AnyConfigurationModel } from '@jbrowse/core/configuration'
16
- import { SnapshotIn } from 'mobx-state-tree'
17
- import { getSession, isSessionWithAddTracks } from '@jbrowse/core/util'
18
- import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui'
19
-
20
- // locals
21
- import { LinearSyntenyViewModel } from '../model'
22
- import ImportCustomTrack from './ImportCustomTrack'
23
- import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector'
24
-
25
- const useStyles = makeStyles()(theme => ({
26
- importFormContainer: {
27
- padding: theme.spacing(4),
28
- margin: '0 auto',
29
- },
30
- assemblySelector: {
31
- width: '75%',
32
- margin: '0 auto',
33
- },
34
- }))
35
-
36
- type Conf = SnapshotIn<AnyConfigurationModel>
37
-
38
- function TrackSelector({
39
- setSessionTrackData,
40
- setShowTrackId,
41
- sessionTrackData,
42
- assembly1,
43
- assembly2,
44
- model,
45
- }: {
46
- sessionTrackData: Conf
47
- setSessionTrackData: (arg: Conf) => void
48
- setShowTrackId: (arg?: string) => void
49
- model: LinearSyntenyViewModel
50
- assembly1: string
51
- assembly2: string
52
- }) {
53
- const [choice, setChoice] = useState('none')
54
-
55
- useEffect(() => {
56
- if (choice === 'none') {
57
- setSessionTrackData(undefined)
58
- setShowTrackId(undefined)
59
- }
60
- }, [choice, setSessionTrackData, setShowTrackId])
61
- return (
62
- <>
63
- <FormControl>
64
- <FormLabel id="group-label">
65
- (Optional) Select or add a synteny track
66
- </FormLabel>
67
- <RadioGroup
68
- row
69
- value={choice}
70
- onChange={event => setChoice(event.target.value)}
71
- aria-labelledby="group-label"
72
- >
73
- <FormControlLabel value="none" control={<Radio />} label="None" />
74
- <FormControlLabel
75
- value="tracklist"
76
- control={<Radio />}
77
- label="Existing track"
78
- />
79
- <FormControlLabel
80
- value="custom"
81
- control={<Radio />}
82
- label="New track"
83
- />
84
- </RadioGroup>
85
- </FormControl>
86
- {choice === 'custom' ? (
87
- <ImportCustomTrack
88
- setSessionTrackData={setSessionTrackData}
89
- sessionTrackData={sessionTrackData}
90
- assembly2={assembly2}
91
- assembly1={assembly1}
92
- />
93
- ) : null}
94
- {choice === 'tracklist' ? (
95
- <ImportSyntenyTrackSelector
96
- model={model}
97
- assembly1={assembly1}
98
- assembly2={assembly2}
99
- setShowTrackId={setShowTrackId}
100
- />
101
- ) : null}
102
- </>
103
- )
104
- }
105
-
106
- export default observer(function ({
107
- model,
108
- }: {
109
- model: LinearSyntenyViewModel
110
- }) {
111
- const { classes } = useStyles()
112
- const session = getSession(model)
113
- const { assemblyNames } = session
114
- const [assembly2, setAssembly2] = useState(assemblyNames[0] || '')
115
- const [assembly1, setAssembly1] = useState(assemblyNames[0] || '')
116
- const [error, setError] = useState<unknown>()
117
- const [sessionTrackData, setSessionTrackData] = useState<Conf>()
118
- const [showTrackId, setShowTrackId] = useState<string>()
119
-
120
- async function onOpenClick() {
121
- try {
122
- if (!isSessionWithAddTracks(session)) {
123
- return
124
- }
125
- setError(undefined)
126
-
127
- const { assemblyManager } = session
128
- const assemblies = [assembly1, assembly2]
129
- model.setViews(
130
- await Promise.all(
131
- assemblies.map(async sel => {
132
- const asm = await assemblyManager.waitForAssembly(sel)
133
- if (!asm) {
134
- throw new Error(`Assembly ${sel} failed to load`)
135
- }
136
- return {
137
- type: 'LinearGenomeView' as const,
138
- bpPerPx: 1,
139
- offsetPx: 0,
140
- hideHeader: true,
141
- displayedRegions: asm.regions,
142
- }
143
- }),
144
- ),
145
- )
146
- model.views.forEach(view => view.setWidth(model.width))
147
- if (sessionTrackData) {
148
- session.addTrackConf(sessionTrackData)
149
- model.toggleTrack(sessionTrackData.trackId)
150
- } else if (showTrackId) {
151
- model.showTrack(showTrackId)
152
- }
153
- } catch (e) {
154
- console.error(e)
155
- setError(e)
156
- }
157
- }
158
-
159
- // this is a combination of any displayed error message we have
160
- const displayError = error
161
- return (
162
- <Container className={classes.importFormContainer}>
163
- {displayError ? <ErrorMessage error={displayError} /> : null}
164
- <Grid
165
- container
166
- spacing={1}
167
- justifyContent="center"
168
- alignItems="center"
169
- className={classes.assemblySelector}
170
- >
171
- <Grid item>
172
- <Paper style={{ padding: 12 }}>
173
- <p style={{ textAlign: 'center' }}>
174
- Select assemblies for linear synteny view
175
- </p>
176
- <Grid
177
- container
178
- spacing={1}
179
- justifyContent="center"
180
- alignItems="center"
181
- >
182
- <Grid item>
183
- <AssemblySelector
184
- selected={assembly1}
185
- onChange={val => setAssembly1(val)}
186
- session={session}
187
- />
188
- </Grid>
189
- <Grid item>
190
- <AssemblySelector
191
- selected={assembly2}
192
- onChange={val => setAssembly2(val)}
193
- session={session}
194
- />
195
- </Grid>
196
- <Grid item>
197
- <FormControl>
198
- <Button
199
- onClick={onOpenClick}
200
- variant="contained"
201
- color="primary"
202
- >
203
- Launch
204
- </Button>
205
- </FormControl>
206
- </Grid>
207
- </Grid>
208
- </Paper>
209
- <TrackSelector
210
- setShowTrackId={setShowTrackId}
211
- assembly2={assembly2}
212
- assembly1={assembly1}
213
- setSessionTrackData={setSessionTrackData}
214
- sessionTrackData={sessionTrackData}
215
- model={model}
216
- />
217
- </Grid>
218
- </Grid>
219
- </Container>
220
- )
221
- })
@@ -1,82 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { Select, MenuItem, Paper, Typography } from '@mui/material'
3
- import { getSession } from '@jbrowse/core/util'
4
- import { getTrackName } from '@jbrowse/core/util/tracks'
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
- // locals
13
- import { LinearSyntenyViewModel } from '../model'
14
-
15
- function f(track: AnyConfigurationModel, assembly1: string, assembly2: string) {
16
- const assemblyNames = readConfObject(track, 'assemblyNames')
17
- return (
18
- assemblyNames.includes(assembly1) &&
19
- assemblyNames.includes(assembly2) &&
20
- track.type.includes('Synteny')
21
- )
22
- }
23
-
24
- const Selector = observer(
25
- ({
26
- model,
27
- assembly1,
28
- assembly2,
29
- setShowTrackId,
30
- }: {
31
- model: LinearSyntenyViewModel
32
- assembly1: string
33
- assembly2: string
34
- setShowTrackId: (arg: string) => void
35
- }) => {
36
- const session = getSession(model)
37
- const { tracks = [], sessionTracks = [] } = session
38
- const allTracks = [...tracks, ...sessionTracks] as AnyConfigurationModel[]
39
- const filteredTracks = allTracks.filter(t => f(t, assembly2, assembly1))
40
- const resetTrack = filteredTracks[0]?.trackId || ''
41
- const [value, setValue] = useState(resetTrack)
42
- useEffect(() => {
43
- // if assembly1/assembly2 changes, then we will want to use this effect to
44
- // change the state of the useState because it otherwise gets locked to a
45
- // stale value
46
- setValue(resetTrack)
47
- }, [resetTrack])
48
-
49
- useEffect(() => {
50
- // sets track data in a useEffect because the initial load is needed as well
51
- // as onChange's to the select box
52
- setShowTrackId(value)
53
- }, [value, setShowTrackId])
54
- return (
55
- <Paper style={{ padding: 12 }}>
56
- <Typography paragraph>
57
- Select a track from the select box below, the track will be shown when
58
- you hit "Launch".
59
- </Typography>
60
-
61
- {filteredTracks.length ? (
62
- <Select
63
- value={value}
64
- onChange={event => setValue(event.target.value)}
65
- >
66
- {filteredTracks.map(track => (
67
- <MenuItem key={track.trackId} value={track.trackId}>
68
- {getTrackName(track, session)}
69
- </MenuItem>
70
- ))}
71
- </Select>
72
- ) : (
73
- <ErrorMessage
74
- error={`No synteny tracks found for ${assembly1},${assembly2}`}
75
- />
76
- )}
77
- </Paper>
78
- )
79
- },
80
- )
81
-
82
- export default Selector
@@ -1,20 +0,0 @@
1
- import React, { lazy } from 'react'
2
- import { observer } from 'mobx-react'
3
-
4
- // locals
5
- import LinearComparativeViewComponent from '../../LinearComparativeView/components/LinearComparativeView'
6
- import { LinearSyntenyViewModel } from '../model'
7
-
8
- const ImportForm = lazy(() => import('./ImportForm'))
9
-
10
- type LSV = LinearSyntenyViewModel
11
-
12
- const LinearSyntenyView = observer(({ model }: { model: LSV }) => {
13
- return !model.initialized ? (
14
- <ImportForm model={model} />
15
- ) : (
16
- <LinearComparativeViewComponent model={model} />
17
- )
18
- })
19
-
20
- export default LinearSyntenyView
@@ -1,15 +0,0 @@
1
- import { lazy } from 'react'
2
- import PluginManager from '@jbrowse/core/PluginManager'
3
- import modelFactory from './model'
4
- import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
5
-
6
- export default (pluginManager: PluginManager) => {
7
- pluginManager.addViewType(() => {
8
- return new ViewType({
9
- name: 'LinearSyntenyView',
10
- displayName: 'Linear synteny view',
11
- stateModel: modelFactory(pluginManager),
12
- ReactComponent: lazy(() => import('./components/LinearSyntenyView')),
13
- })
14
- })
15
- }