@jbrowse/plugin-linear-genome-view 1.7.9 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -5
  2. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +118 -226
  3. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
  4. package/dist/BaseLinearDisplay/components/Block.js +53 -74
  5. package/dist/BaseLinearDisplay/components/Block.js.map +1 -0
  6. package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +11 -1
  7. package/dist/BaseLinearDisplay/components/LinearBlocks.js +64 -103
  8. package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
  9. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +145 -175
  10. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
  11. package/dist/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
  12. package/dist/BaseLinearDisplay/components/Tooltip.js +118 -0
  13. package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -0
  14. package/dist/BaseLinearDisplay/index.js +13 -40
  15. package/dist/BaseLinearDisplay/index.js.map +1 -0
  16. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +20 -15
  17. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +605 -683
  18. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
  19. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +15 -22
  20. package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
  21. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +7 -8
  22. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +266 -312
  23. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
  24. package/dist/LinearBareDisplay/configSchema.js +11 -17
  25. package/dist/LinearBareDisplay/configSchema.js.map +1 -0
  26. package/dist/LinearBareDisplay/index.js +7 -20
  27. package/dist/LinearBareDisplay/index.js.map +1 -0
  28. package/dist/LinearBareDisplay/model.d.ts +16 -14
  29. package/dist/LinearBareDisplay/model.js +36 -42
  30. package/dist/LinearBareDisplay/model.js.map +1 -0
  31. package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
  32. package/dist/LinearBasicDisplay/components/SetMaxHeight.js +76 -85
  33. package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
  34. package/dist/LinearBasicDisplay/configSchema.js +15 -23
  35. package/dist/LinearBasicDisplay/configSchema.js.map +1 -0
  36. package/dist/LinearBasicDisplay/index.js +10 -22
  37. package/dist/LinearBasicDisplay/index.js.map +1 -0
  38. package/dist/LinearBasicDisplay/model.d.ts +20 -15
  39. package/dist/LinearBasicDisplay/model.js +180 -159
  40. package/dist/LinearBasicDisplay/model.js.map +1 -0
  41. package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -8
  42. package/dist/LinearGenomeView/components/CenterLine.js +60 -74
  43. package/dist/LinearGenomeView/components/CenterLine.js.map +1 -0
  44. package/dist/LinearGenomeView/components/ExportSvgDialog.js +141 -141
  45. package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
  46. package/dist/LinearGenomeView/components/Header.js +70 -123
  47. package/dist/LinearGenomeView/components/Header.js.map +1 -0
  48. package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
  49. package/dist/LinearGenomeView/components/HelpDialog.js +62 -45
  50. package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -0
  51. package/dist/LinearGenomeView/components/ImportForm.js +223 -320
  52. package/dist/LinearGenomeView/components/ImportForm.js.map +1 -0
  53. package/dist/LinearGenomeView/components/LinearGenomeView.js +64 -120
  54. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
  55. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +198 -337
  56. package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
  57. package/dist/LinearGenomeView/components/MiniControls.js +64 -78
  58. package/dist/LinearGenomeView/components/MiniControls.js.map +1 -0
  59. package/dist/LinearGenomeView/components/OverviewRubberBand.js +226 -293
  60. package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
  61. package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +24 -8
  62. package/dist/LinearGenomeView/components/OverviewScaleBar.js +277 -365
  63. package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
  64. package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +1 -1
  65. package/dist/LinearGenomeView/components/RefNameAutocomplete.js +237 -324
  66. package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
  67. package/dist/LinearGenomeView/components/RubberBand.js +229 -296
  68. package/dist/LinearGenomeView/components/RubberBand.js.map +1 -0
  69. package/dist/LinearGenomeView/components/Ruler.js +45 -90
  70. package/dist/LinearGenomeView/components/Ruler.js.map +1 -0
  71. package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -399
  72. package/dist/LinearGenomeView/components/ScaleBar.js +121 -167
  73. package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -0
  74. package/dist/LinearGenomeView/components/SearchBox.js +158 -205
  75. package/dist/LinearGenomeView/components/SearchBox.js.map +1 -0
  76. package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -1
  77. package/dist/LinearGenomeView/components/SearchResultsDialog.js +105 -150
  78. package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
  79. package/dist/LinearGenomeView/components/SequenceDialog.js +219 -272
  80. package/dist/LinearGenomeView/components/SequenceDialog.js.map +1 -0
  81. package/dist/LinearGenomeView/components/TrackContainer.js +116 -156
  82. package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -0
  83. package/dist/LinearGenomeView/components/TrackLabel.d.ts +6 -42
  84. package/dist/LinearGenomeView/components/TrackLabel.js +115 -150
  85. package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -0
  86. package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  87. package/dist/LinearGenomeView/components/TracksContainer.js +172 -199
  88. package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -0
  89. package/dist/LinearGenomeView/components/VerticalGuides.d.ts +2 -3
  90. package/dist/LinearGenomeView/components/VerticalGuides.js +66 -104
  91. package/dist/LinearGenomeView/components/VerticalGuides.js.map +1 -0
  92. package/dist/LinearGenomeView/components/ZoomControls.js +72 -87
  93. package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -0
  94. package/dist/LinearGenomeView/components/util.d.ts +12 -0
  95. package/dist/LinearGenomeView/components/util.js +95 -13
  96. package/dist/LinearGenomeView/components/util.js.map +1 -0
  97. package/dist/LinearGenomeView/index.d.ts +6 -11
  98. package/dist/LinearGenomeView/index.js +1163 -1387
  99. package/dist/LinearGenomeView/index.js.map +1 -0
  100. package/dist/LinearGenomeView/util.js +76 -83
  101. package/dist/LinearGenomeView/util.js.map +1 -0
  102. package/dist/index.d.ts +101 -51
  103. package/dist/index.js +225 -284
  104. package/dist/index.js.map +1 -0
  105. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +9 -0
  106. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +68 -0
  107. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
  108. package/esm/BaseLinearDisplay/components/Block.d.ts +15 -0
  109. package/esm/BaseLinearDisplay/components/Block.js +46 -0
  110. package/esm/BaseLinearDisplay/components/Block.js.map +1 -0
  111. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +22 -0
  112. package/esm/BaseLinearDisplay/components/LinearBlocks.js +62 -0
  113. package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
  114. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -0
  115. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +113 -0
  116. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
  117. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
  118. package/esm/BaseLinearDisplay/components/Tooltip.js +64 -0
  119. package/esm/BaseLinearDisplay/components/Tooltip.js.map +1 -0
  120. package/esm/BaseLinearDisplay/index.d.ts +5 -0
  121. package/esm/BaseLinearDisplay/index.js +4 -0
  122. package/esm/BaseLinearDisplay/index.js.map +1 -0
  123. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +232 -0
  124. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +541 -0
  125. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
  126. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -0
  127. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +14 -0
  128. package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
  129. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -0
  130. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +225 -0
  131. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
  132. package/esm/LinearBareDisplay/configSchema.d.ts +2 -0
  133. package/esm/LinearBareDisplay/configSchema.js +9 -0
  134. package/esm/LinearBareDisplay/configSchema.js.map +1 -0
  135. package/esm/LinearBareDisplay/index.d.ts +2 -0
  136. package/esm/LinearBareDisplay/index.js +3 -0
  137. package/esm/LinearBareDisplay/index.js.map +1 -0
  138. package/esm/LinearBareDisplay/model.d.ts +194 -0
  139. package/esm/LinearBareDisplay/model.js +28 -0
  140. package/esm/LinearBareDisplay/model.js.map +1 -0
  141. package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -0
  142. package/esm/LinearBasicDisplay/components/SetMaxHeight.js +40 -0
  143. package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
  144. package/esm/LinearBasicDisplay/configSchema.d.ts +2 -0
  145. package/esm/LinearBasicDisplay/configSchema.js +14 -0
  146. package/esm/LinearBasicDisplay/configSchema.js.map +1 -0
  147. package/esm/LinearBasicDisplay/index.d.ts +2 -0
  148. package/esm/LinearBasicDisplay/index.js +3 -0
  149. package/esm/LinearBasicDisplay/index.js.map +1 -0
  150. package/esm/LinearBasicDisplay/model.d.ts +218 -0
  151. package/esm/LinearBasicDisplay/model.js +127 -0
  152. package/esm/LinearBasicDisplay/model.js.map +1 -0
  153. package/esm/LinearGenomeView/components/CenterLine.d.ts +8 -0
  154. package/esm/LinearGenomeView/components/CenterLine.js +40 -0
  155. package/esm/LinearGenomeView/components/CenterLine.js.map +1 -0
  156. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -0
  157. package/esm/LinearGenomeView/components/ExportSvgDialog.js +52 -0
  158. package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
  159. package/esm/LinearGenomeView/components/Header.d.ts +7 -0
  160. package/esm/LinearGenomeView/components/Header.js +81 -0
  161. package/esm/LinearGenomeView/components/Header.js.map +1 -0
  162. package/esm/LinearGenomeView/components/HelpDialog.d.ts +4 -0
  163. package/esm/LinearGenomeView/components/HelpDialog.js +58 -0
  164. package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -0
  165. package/esm/LinearGenomeView/components/ImportForm.d.ts +7 -0
  166. package/esm/LinearGenomeView/components/ImportForm.js +141 -0
  167. package/esm/LinearGenomeView/components/ImportForm.js.map +1 -0
  168. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +7 -0
  169. package/esm/LinearGenomeView/components/LinearGenomeView.js +67 -0
  170. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
  171. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
  172. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +132 -0
  173. package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
  174. package/esm/LinearGenomeView/components/MiniControls.d.ts +6 -0
  175. package/esm/LinearGenomeView/components/MiniControls.js +25 -0
  176. package/esm/LinearGenomeView/components/MiniControls.js.map +1 -0
  177. package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -0
  178. package/esm/LinearGenomeView/components/OverviewRubberBand.js +194 -0
  179. package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
  180. package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +148 -0
  181. package/esm/LinearGenomeView/components/OverviewScaleBar.js +287 -0
  182. package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
  183. package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +22 -0
  184. package/esm/LinearGenomeView/components/RefNameAutocomplete.js +136 -0
  185. package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
  186. package/esm/LinearGenomeView/components/RubberBand.d.ts +9 -0
  187. package/esm/LinearGenomeView/components/RubberBand.js +198 -0
  188. package/esm/LinearGenomeView/components/RubberBand.js.map +1 -0
  189. package/esm/LinearGenomeView/components/Ruler.d.ts +27 -0
  190. package/esm/LinearGenomeView/components/Ruler.js +50 -0
  191. package/esm/LinearGenomeView/components/Ruler.js.map +1 -0
  192. package/esm/LinearGenomeView/components/ScaleBar.d.ts +10 -0
  193. package/esm/LinearGenomeView/components/ScaleBar.js +112 -0
  194. package/esm/LinearGenomeView/components/ScaleBar.js.map +1 -0
  195. package/esm/LinearGenomeView/components/SearchBox.d.ts +8 -0
  196. package/esm/LinearGenomeView/components/SearchBox.js +94 -0
  197. package/esm/LinearGenomeView/components/SearchBox.js.map +1 -0
  198. package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +7 -0
  199. package/esm/LinearGenomeView/components/SearchResultsDialog.js +107 -0
  200. package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
  201. package/esm/LinearGenomeView/components/SequenceDialog.d.ts +8 -0
  202. package/esm/LinearGenomeView/components/SequenceDialog.js +147 -0
  203. package/esm/LinearGenomeView/components/SequenceDialog.js.map +1 -0
  204. package/esm/LinearGenomeView/components/TrackContainer.d.ts +9 -0
  205. package/esm/LinearGenomeView/components/TrackContainer.js +109 -0
  206. package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -0
  207. package/esm/LinearGenomeView/components/TrackLabel.d.ts +8 -0
  208. package/esm/LinearGenomeView/components/TrackLabel.js +89 -0
  209. package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -0
  210. package/esm/LinearGenomeView/components/TracksContainer.d.ts +10 -0
  211. package/esm/LinearGenomeView/components/TracksContainer.js +142 -0
  212. package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -0
  213. package/esm/LinearGenomeView/components/VerticalGuides.d.ts +8 -0
  214. package/esm/LinearGenomeView/components/VerticalGuides.js +71 -0
  215. package/esm/LinearGenomeView/components/VerticalGuides.js.map +1 -0
  216. package/esm/LinearGenomeView/components/ZoomControls.d.ts +7 -0
  217. package/esm/LinearGenomeView/components/ZoomControls.js +32 -0
  218. package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -0
  219. package/esm/LinearGenomeView/components/util.d.ts +14 -0
  220. package/esm/LinearGenomeView/components/util.js +17 -0
  221. package/esm/LinearGenomeView/components/util.js.map +1 -0
  222. package/esm/LinearGenomeView/index.d.ts +288 -0
  223. package/esm/LinearGenomeView/index.js +1124 -0
  224. package/esm/LinearGenomeView/index.js.map +1 -0
  225. package/esm/LinearGenomeView/util.d.ts +14 -0
  226. package/esm/LinearGenomeView/util.js +62 -0
  227. package/esm/LinearGenomeView/util.js.map +1 -0
  228. package/esm/index.d.ts +615 -0
  229. package/esm/index.js +127 -0
  230. package/esm/index.js.map +1 -0
  231. package/package.json +21 -13
  232. package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +6 -90
  233. package/src/BaseLinearDisplay/components/Block.tsx +5 -5
  234. package/src/BaseLinearDisplay/components/LinearBlocks.tsx +4 -4
  235. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +7 -8
  236. package/src/BaseLinearDisplay/components/Tooltip.tsx +107 -0
  237. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +16 -8
  238. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
  239. package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +10 -7
  240. package/src/LinearBasicDisplay/model.ts +21 -15
  241. package/src/LinearGenomeView/components/CenterLine.tsx +6 -11
  242. package/src/LinearGenomeView/components/ExportSvgDialog.tsx +5 -5
  243. package/src/LinearGenomeView/components/Header.tsx +12 -16
  244. package/src/LinearGenomeView/components/HelpDialog.tsx +10 -9
  245. package/src/LinearGenomeView/components/ImportForm.tsx +24 -37
  246. package/src/LinearGenomeView/components/LinearGenomeView.test.js +18 -8
  247. package/src/LinearGenomeView/components/LinearGenomeView.tsx +20 -13
  248. package/src/LinearGenomeView/components/MiniControls.tsx +29 -40
  249. package/src/LinearGenomeView/components/OverviewRubberBand.tsx +6 -10
  250. package/src/LinearGenomeView/components/OverviewScaleBar.tsx +103 -93
  251. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +13 -44
  252. package/src/LinearGenomeView/components/RubberBand.tsx +12 -17
  253. package/src/LinearGenomeView/components/Ruler.tsx +5 -11
  254. package/src/LinearGenomeView/components/ScaleBar.tsx +27 -34
  255. package/src/LinearGenomeView/components/SearchBox.tsx +22 -32
  256. package/src/LinearGenomeView/components/SearchResultsDialog.tsx +7 -7
  257. package/src/LinearGenomeView/components/SequenceDialog.tsx +9 -9
  258. package/src/LinearGenomeView/components/TrackContainer.tsx +12 -12
  259. package/src/LinearGenomeView/components/TrackLabel.tsx +37 -50
  260. package/src/LinearGenomeView/components/TracksContainer.tsx +8 -13
  261. package/src/LinearGenomeView/components/VerticalGuides.tsx +9 -11
  262. package/src/LinearGenomeView/components/ZoomControls.tsx +12 -13
  263. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +504 -568
  264. package/src/LinearGenomeView/components/util.ts +43 -0
  265. package/src/LinearGenomeView/index.test.ts +21 -5
  266. package/src/LinearGenomeView/index.tsx +101 -88
  267. package/src/index.ts +36 -31
  268. package/dist/LinearBareDisplay/index.test.js +0 -33
  269. package/dist/LinearGenomeView/components/LinearGenomeView.test.js +0 -234
  270. package/dist/LinearGenomeView/components/ScaleBar.test.js +0 -180
  271. package/dist/LinearGenomeView/index.test.js +0 -1170
  272. package/dist/LinearGenomeView/util.test.js +0 -78
@@ -1,4 +1,8 @@
1
+ import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
2
+ import { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'
1
3
  import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
4
+ import { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'
5
+ import { TextSearchManager } from '@jbrowse/core/util'
2
6
 
3
7
  export function dedupe(
4
8
  results: BaseResult[] = [],
@@ -8,3 +12,42 @@ export function dedupe(
8
12
  (elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)),
9
13
  )
10
14
  }
15
+
16
+ export async function fetchResults({
17
+ queryString,
18
+ searchType,
19
+ searchScope,
20
+ rankSearchResults,
21
+ textSearchManager,
22
+ assembly,
23
+ }: {
24
+ queryString: string
25
+ searchScope: SearchScope
26
+ rankSearchResults: (results: BaseResult[]) => BaseResult[]
27
+ searchType?: SearchType
28
+ textSearchManager?: TextSearchManager
29
+ assembly?: Assembly
30
+ }) {
31
+ if (!textSearchManager) {
32
+ console.warn('No text search manager')
33
+ }
34
+
35
+ const textSearchResults = await textSearchManager?.search(
36
+ {
37
+ queryString,
38
+ searchType,
39
+ },
40
+ searchScope,
41
+ rankSearchResults,
42
+ )
43
+
44
+ const refNameResults = assembly?.allRefNames
45
+ ?.filter(ref => ref.toLowerCase().startsWith(queryString.toLowerCase()))
46
+ .slice(0, 10)
47
+ .map(r => new BaseResult({ label: r }))
48
+
49
+ return dedupe(
50
+ [...(refNameResults || []), ...(textSearchResults || [])],
51
+ elt => elt.getId(),
52
+ )
53
+ }
@@ -72,7 +72,7 @@ function initialize() {
72
72
  })
73
73
  .actions(self => ({
74
74
  isValidRefName(str: string) {
75
- return !str.includes(':')
75
+ return str === 'ctgA' || str === 'ctgB'
76
76
  },
77
77
  get(str: string) {
78
78
  return self.assemblies.get(str)
@@ -88,6 +88,7 @@ function initialize() {
88
88
  assemblyManager: types.optional(AssemblyManager, {
89
89
  assemblies: {
90
90
  volvox: {
91
+ // @ts-ignore
91
92
  regions: volvoxDisplayedRegions,
92
93
  },
93
94
  },
@@ -989,8 +990,23 @@ test('multi region', () => {
989
990
  model.navToLocString('ctgA ctgB')
990
991
  expect(model.displayedRegions[0].refName).toBe('ctgA')
991
992
  expect(model.displayedRegions[1].refName).toBe('ctgB')
992
- // [
993
- // { refName: 'ctgA', start: 0, end: 50001 },
994
- // { refName: 'ctgB', start: 0, end: 6079 },
995
- // ])
993
+ })
994
+
995
+ test('space separated locstring', () => {
996
+ const { Session, LinearGenomeModel } = initialize()
997
+ const model = Session.create({
998
+ configuration: {},
999
+ }).setView(
1000
+ LinearGenomeModel.create({
1001
+ type: 'LinearGenomeView',
1002
+ tracks: [{ name: 'foo track', type: 'BasicTrack' }],
1003
+ }),
1004
+ )
1005
+ model.setWidth(800)
1006
+ model.setDisplayedRegions(volvoxDisplayedRegions.slice(0, 1))
1007
+
1008
+ model.navToLocString('ctgA 0 100')
1009
+
1010
+ expect(model.offsetPx).toBe(0)
1011
+ expect(model.bpPerPx).toBe(0.125)
996
1012
  })
@@ -39,13 +39,13 @@ import { saveAs } from 'file-saver'
39
39
 
40
40
  // icons
41
41
  import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
42
- import SyncAltIcon from '@material-ui/icons/SyncAlt'
43
- import VisibilityIcon from '@material-ui/icons/Visibility'
44
- import LabelIcon from '@material-ui/icons/Label'
45
- import FolderOpenIcon from '@material-ui/icons/FolderOpen'
46
- import PhotoCameraIcon from '@material-ui/icons/PhotoCamera'
47
- import ZoomInIcon from '@material-ui/icons/ZoomIn'
48
- import MenuOpenIcon from '@material-ui/icons/MenuOpen'
42
+ import SyncAltIcon from '@mui/icons-material/SyncAlt'
43
+ import VisibilityIcon from '@mui/icons-material/Visibility'
44
+ import LabelIcon from '@mui/icons-material/Label'
45
+ import FolderOpenIcon from '@mui/icons-material/FolderOpen'
46
+ import PhotoCameraIcon from '@mui/icons-material/PhotoCamera'
47
+ import ZoomInIcon from '@mui/icons-material/ZoomIn'
48
+ import MenuOpenIcon from '@mui/icons-material/MenuOpen'
49
49
 
50
50
  // locals
51
51
  import { renderToSvg } from './components/LinearGenomeViewSvg'
@@ -127,6 +127,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
127
127
  ),
128
128
  hideHeader: false,
129
129
  hideHeaderOverview: false,
130
+ hideNoTracksActive: false,
130
131
  trackSelectorType: types.optional(
131
132
  types.enumeration(['hierarchical']),
132
133
  'hierarchical',
@@ -177,11 +178,18 @@ export function stateModelFactory(pluginManager: PluginManager) {
177
178
  get interRegionPaddingWidth() {
178
179
  return INTER_REGION_PADDING_WIDTH
179
180
  },
181
+
182
+ get assemblyNames() {
183
+ return [
184
+ ...new Set(self.displayedRegions.map(region => region.assemblyName)),
185
+ ]
186
+ },
180
187
  }))
181
188
  .views(self => ({
182
189
  get assemblyErrors() {
183
190
  const { assemblyManager } = getSession(self)
184
- return this.assemblyNames
191
+ const { assemblyNames } = self
192
+ return assemblyNames
185
193
  .map(a => assemblyManager.get(a)?.error)
186
194
  .filter(f => !!f)
187
195
  .join(', ')
@@ -189,9 +197,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
189
197
 
190
198
  get assembliesInitialized() {
191
199
  const { assemblyManager } = getSession(self)
192
- return this.assemblyNames.every(
193
- a => assemblyManager.get(a)?.initialized,
194
- )
200
+ const { assemblyNames } = self
201
+ return assemblyNames.every(a => assemblyManager.get(a)?.initialized)
195
202
  },
196
203
  get initialized() {
197
204
  return self.volatileWidth !== undefined && this.assembliesInitialized
@@ -273,11 +280,6 @@ export function stateModelFactory(pluginManager: PluginManager) {
273
280
  }
274
281
  },
275
282
 
276
- get assemblyNames() {
277
- return [
278
- ...new Set(self.displayedRegions.map(region => region.assemblyName)),
279
- ]
280
- },
281
283
  searchScope(assemblyName: string) {
282
284
  return {
283
285
  assemblyName,
@@ -286,13 +288,6 @@ export function stateModelFactory(pluginManager: PluginManager) {
286
288
  }
287
289
  },
288
290
 
289
- /**
290
- * @param refName - refName of the displayedRegion
291
- * @param coord - coordinate at the displayed Region
292
- * @param regionNumber - optional param used as identifier when
293
- * there are multiple displayedRegions with the same refName
294
- * @returns offsetPx of the displayed region that it lands in
295
- */
296
291
  bpToPx({
297
292
  refName,
298
293
  coord,
@@ -316,8 +311,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
316
311
  if (bp < 0) {
317
312
  const region = self.displayedRegions[0]
318
313
  const offset = bp
314
+ const snap = getSnapshot(region)
319
315
  return {
320
- ...getSnapshot(region),
316
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
317
+ ...(snap as Omit<typeof snap, symbol>),
321
318
  oob: true,
322
319
  coord: region.reversed
323
320
  ? Math.floor(region.end - offset) + 1
@@ -335,8 +332,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
335
332
  const len = region.end - region.start
336
333
  const offset = bp - bpSoFar
337
334
  if (len + bpSoFar > bp && bpSoFar <= bp) {
335
+ const snap = getSnapshot(region)
338
336
  return {
339
- ...getSnapshot(region),
337
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
338
+ ...(snap as Omit<typeof snap, symbol>),
340
339
  oob: false,
341
340
  offset,
342
341
  coord: region.reversed
@@ -363,8 +362,10 @@ export function stateModelFactory(pluginManager: PluginManager) {
363
362
  const region = self.displayedRegions[n - 1]
364
363
  const len = region.end - region.start
365
364
  const offset = bp - bpSoFar + len
365
+ const snap = getSnapshot(region)
366
366
  return {
367
- ...getSnapshot(region),
367
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
368
+ ...(snap as Omit<typeof snap, symbol>),
368
369
  oob: true,
369
370
  offset,
370
371
  coord: region.reversed
@@ -396,10 +397,8 @@ export function stateModelFactory(pluginManager: PluginManager) {
396
397
  track => track.configuration.trackId,
397
398
  )
398
399
  results.forEach(result => {
399
- if (openTrackIds !== []) {
400
- if (openTrackIds.includes(result.trackId)) {
401
- result.updateScore(result.getScore() + 1)
402
- }
400
+ if (openTrackIds.includes(result.trackId)) {
401
+ result.updateScore(result.getScore() + 1)
403
402
  }
404
403
  })
405
404
  return results
@@ -407,7 +406,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
407
406
 
408
407
  // modifies view menu action onClick to apply to all tracks of same type
409
408
  rewriteOnClicks(trackType: string, viewMenuActions: MenuItem[]) {
410
- viewMenuActions.forEach((action: MenuItem) => {
409
+ viewMenuActions.forEach(action => {
411
410
  // go to lowest level menu
412
411
  if ('subMenu' in action) {
413
412
  this.rewriteOnClicks(trackType, action.subMenu)
@@ -464,6 +463,9 @@ export function stateModelFactory(pluginManager: PluginManager) {
464
463
  toggleHeaderOverview() {
465
464
  self.hideHeaderOverview = !self.hideHeaderOverview
466
465
  },
466
+ toggleNoTracksActive() {
467
+ self.hideNoTracksActive = !self.hideNoTracksActive
468
+ },
467
469
 
468
470
  scrollTo(offsetPx: number) {
469
471
  const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset)
@@ -533,26 +535,19 @@ export function stateModelFactory(pluginManager: PluginManager) {
533
535
  initialSnapshot = {},
534
536
  displayInitialSnapshot = {},
535
537
  ) {
536
- const trackConfigSchema =
537
- pluginManager.pluggableConfigSchemaType('track')
538
- const configuration = resolveIdentifier(
539
- trackConfigSchema,
540
- getRoot(self),
541
- trackId,
542
- )
543
- if (!configuration) {
538
+ const schema = pluginManager.pluggableConfigSchemaType('track')
539
+ const conf = resolveIdentifier(schema, getRoot(self), trackId)
540
+ if (!conf) {
544
541
  throw new Error(`Could not resolve identifier "${trackId}"`)
545
542
  }
546
- const trackType = pluginManager.getTrackType(configuration?.type)
543
+ const trackType = pluginManager.getTrackType(conf?.type)
547
544
  if (!trackType) {
548
- throw new Error(`Unknown track type ${configuration.type}`)
545
+ throw new Error(`Unknown track type ${conf.type}`)
549
546
  }
550
547
  const viewType = pluginManager.getViewType(self.type)
551
- const supportedDisplays = viewType.displayTypes.map(
552
- displayType => displayType.name,
553
- )
554
- const displayConf = configuration.displays.find(
555
- (d: AnyConfigurationModel) => supportedDisplays.includes(d.type),
548
+ const supportedDisplays = viewType.displayTypes.map(d => d.name)
549
+ const displayConf = conf.displays.find((d: AnyConfigurationModel) =>
550
+ supportedDisplays.includes(d.type),
556
551
  )
557
552
  if (!displayConf) {
558
553
  throw new Error(
@@ -560,14 +555,12 @@ export function stateModelFactory(pluginManager: PluginManager) {
560
555
  )
561
556
  }
562
557
 
563
- const shownTracks = self.tracks.filter(
564
- t => t.configuration === configuration,
565
- )
566
- if (shownTracks.length === 0) {
558
+ const t = self.tracks.filter(t => t.configuration === conf)
559
+ if (t.length === 0) {
567
560
  const track = trackType.stateModel.create({
568
561
  ...initialSnapshot,
569
- type: configuration.type,
570
- configuration,
562
+ type: conf.type,
563
+ configuration: conf,
571
564
  displays: [
572
565
  {
573
566
  type: displayConf.type,
@@ -579,38 +572,26 @@ export function stateModelFactory(pluginManager: PluginManager) {
579
572
  self.tracks.push(track)
580
573
  return track
581
574
  }
582
- return shownTracks[0]
575
+ return t[0]
583
576
  },
584
577
 
585
578
  hideTrack(trackId: string) {
586
- const trackConfigSchema =
587
- pluginManager.pluggableConfigSchemaType('track')
588
- const configuration = resolveIdentifier(
589
- trackConfigSchema,
590
- getRoot(self),
591
- trackId,
592
- )
593
- // if we have any tracks with that configuration, turn them off
594
- const shownTracks = self.tracks.filter(
595
- t => t.configuration === configuration,
596
- )
597
- transaction(() => shownTracks.forEach(t => self.tracks.remove(t)))
598
- return shownTracks.length
579
+ const schema = pluginManager.pluggableConfigSchemaType('track')
580
+ const conf = resolveIdentifier(schema, getRoot(self), trackId)
581
+ const t = self.tracks.filter(t => t.configuration === conf)
582
+ transaction(() => t.forEach(t => self.tracks.remove(t)))
583
+ return t.length
599
584
  },
600
585
  }))
601
586
  .actions(self => ({
602
- moveTrack(movingTrackId: string, targetTrackId: string) {
603
- const oldIndex = self.tracks.findIndex(
604
- track => track.id === movingTrackId,
605
- )
587
+ moveTrack(movingId: string, targetId: string) {
588
+ const oldIndex = self.tracks.findIndex(track => track.id === movingId)
606
589
  if (oldIndex === -1) {
607
- throw new Error(`Track ID ${movingTrackId} not found`)
590
+ throw new Error(`Track ID ${movingId} not found`)
608
591
  }
609
- const newIndex = self.tracks.findIndex(
610
- track => track.id === targetTrackId,
611
- )
592
+ const newIndex = self.tracks.findIndex(track => track.id === targetId)
612
593
  if (newIndex === -1) {
613
- throw new Error(`Track ID ${targetTrackId} not found`)
594
+ throw new Error(`Track ID ${targetId} not found`)
614
595
  }
615
596
  const track = getSnapshot(self.tracks[oldIndex])
616
597
  self.tracks.splice(oldIndex, 1)
@@ -675,13 +656,38 @@ export function stateModelFactory(pluginManager: PluginManager) {
675
656
  const { assemblyManager } = getSession(self)
676
657
  const { isValidRefName } = assemblyManager
677
658
  const assemblyName = optAssemblyName || assemblyNames[0]
659
+ let parsedLocStrings
660
+ const inputs = locString
661
+ .split(/(\s+)/)
662
+ .map(f => f.trim())
663
+ .filter(f => !!f)
678
664
 
679
- const parsedLocStrings = locString
680
- .split(' ')
681
- .filter(f => !!f.trim())
682
- .map(l => parseLocString(l, ref => isValidRefName(ref, assemblyName)))
665
+ // first try interpreting as a whitespace-separated sequence of
666
+ // multiple locstrings
667
+ try {
668
+ parsedLocStrings = inputs.map(l =>
669
+ parseLocString(l, ref => isValidRefName(ref, assemblyName)),
670
+ )
671
+ } catch (e) {
672
+ // if this fails, try interpreting as a whitespace-separated refname,
673
+ // start, end if start and end are integer inputs
674
+ const [refName, start, end] = inputs
675
+ if (
676
+ `${e}`.match(/Unknown reference sequence/) &&
677
+ Number.isInteger(+start) &&
678
+ Number.isInteger(+end)
679
+ ) {
680
+ parsedLocStrings = [
681
+ parseLocString(refName + ':' + start + '..' + end, ref =>
682
+ isValidRefName(ref, assemblyName),
683
+ ),
684
+ ]
685
+ } else {
686
+ throw e
687
+ }
688
+ }
683
689
 
684
- const locations = parsedLocStrings.map(region => {
690
+ const locations = parsedLocStrings?.map(region => {
685
691
  const asmName = region.assemblyName || assemblyName
686
692
  const asm = assemblyManager.get(asmName)
687
693
  const { refName } = region
@@ -932,21 +938,21 @@ export function stateModelFactory(pluginManager: PluginManager) {
932
938
  leftOffset: BpOffset | undefined,
933
939
  rightOffset: BpOffset | undefined,
934
940
  ) {
941
+ const snap = getSnapshot(self)
935
942
  const simView = Base1DView.create({
936
- ...getSnapshot(self),
943
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
944
+ ...(snap as Omit<typeof self, symbol>),
937
945
  interRegionPaddingWidth: self.interRegionPaddingWidth,
938
946
  })
939
947
 
940
948
  simView.setVolatileWidth(self.width)
941
949
  simView.zoomToDisplayedRegions(leftOffset, rightOffset)
942
950
 
943
- return simView.dynamicBlocks.contentBlocks.map(region => {
944
- return {
945
- ...region,
946
- start: Math.floor(region.start),
947
- end: Math.ceil(region.end),
948
- }
949
- })
951
+ return simView.dynamicBlocks.contentBlocks.map(region => ({
952
+ ...region,
953
+ start: Math.floor(region.start),
954
+ end: Math.ceil(region.end),
955
+ }))
950
956
  },
951
957
 
952
958
  // schedule something to be run after the next time displayedRegions is set
@@ -1207,6 +1213,13 @@ export function stateModelFactory(pluginManager: PluginManager) {
1207
1213
  onClick: self.toggleHeaderOverview,
1208
1214
  disabled: self.hideHeader,
1209
1215
  },
1216
+ {
1217
+ label: 'Show no tracks active button',
1218
+ icon: VisibilityIcon,
1219
+ type: 'checkbox',
1220
+ checked: !self.hideNoTracksActive,
1221
+ onClick: self.toggleNoTracksActive,
1222
+ },
1210
1223
  {
1211
1224
  label: 'Track labels',
1212
1225
  icon: LabelIcon,
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'
11
11
  import Plugin from '@jbrowse/core/Plugin'
12
12
  import PluginManager from '@jbrowse/core/PluginManager'
13
13
  import { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'
14
- import LineStyleIcon from '@material-ui/icons/LineStyle'
14
+ import LineStyleIcon from '@mui/icons-material/LineStyle'
15
15
  import {
16
16
  BaseLinearDisplay,
17
17
  BaseLinearDisplayComponent,
@@ -137,42 +137,47 @@ export default class LinearGenomeViewPlugin extends Plugin {
137
137
  loc: string
138
138
  tracks?: string[]
139
139
  }) => {
140
- const { assemblyManager } = session
141
- const view = session.addView('LinearGenomeView', {}) as LGV
140
+ try {
141
+ const { assemblyManager } = session
142
+ const view = session.addView('LinearGenomeView', {}) as LGV
142
143
 
143
- await when(() => !!view.volatileWidth)
144
+ await when(() => !!view.volatileWidth)
144
145
 
145
- if (!assembly) {
146
- throw new Error(
147
- 'No assembly provided when launching linear genome view',
148
- )
149
- }
146
+ if (!assembly) {
147
+ throw new Error(
148
+ 'No assembly provided when launching linear genome view',
149
+ )
150
+ }
150
151
 
151
- const asm = await assemblyManager.waitForAssembly(assembly)
152
- if (!asm) {
153
- throw new Error(
154
- `Assembly "${assembly}" not found when launching linear genome view`,
155
- )
156
- }
152
+ const asm = await assemblyManager.waitForAssembly(assembly)
153
+ if (!asm) {
154
+ throw new Error(
155
+ `Assembly "${assembly}" not found when launching linear genome view`,
156
+ )
157
+ }
157
158
 
158
- view.navToLocString(loc, assembly)
159
-
160
- const idsNotFound = [] as string[]
161
- tracks.forEach(track => {
162
- try {
163
- view.showTrack(track)
164
- } catch (e) {
165
- if (`${e}`.match('Could not resolve identifier')) {
166
- idsNotFound.push(track)
167
- } else {
168
- throw e
159
+ view.navToLocString(loc, assembly)
160
+
161
+ const idsNotFound = [] as string[]
162
+ tracks.forEach(track => {
163
+ try {
164
+ view.showTrack(track)
165
+ } catch (e) {
166
+ if (`${e}`.match('Could not resolve identifier')) {
167
+ idsNotFound.push(track)
168
+ } else {
169
+ throw e
170
+ }
169
171
  }
172
+ })
173
+ if (idsNotFound.length) {
174
+ throw new Error(
175
+ `Could not resolve identifiers: ${idsNotFound.join(',')}`,
176
+ )
170
177
  }
171
- })
172
- if (idsNotFound.length) {
173
- throw new Error(
174
- `Could not resolve identifiers: ${idsNotFound.join(',')}`,
175
- )
178
+ } catch (e) {
179
+ session.notify(`${e}`, 'error')
180
+ throw e
176
181
  }
177
182
  },
178
183
  )
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- var _mobxStateTree = require("mobx-state-tree");
4
-
5
- var _configuration = require("@jbrowse/core/configuration");
6
-
7
- var _ = require(".");
8
-
9
- test('config schema renderer type', function () {
10
- var stubPluginManager = {
11
- pluggableConfigSchemaType: function pluggableConfigSchemaType(type) {
12
- var one = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeOne"), {}, {
13
- explicitlyTyped: true
14
- });
15
- var two = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeTwo"), {}, {
16
- explicitlyTyped: true
17
- });
18
- var three = (0, _configuration.ConfigurationSchema)("".concat(type, "_TypeThree"), {}, {
19
- explicitlyTyped: true
20
- });
21
- return _mobxStateTree.types.union(one, two, three);
22
- }
23
- };
24
- var configSchema = (0, _.configSchemaFactory)(stubPluginManager);
25
- var instance = configSchema.create({
26
- type: 'LinearBareDisplay',
27
- displayId: 'displayId0',
28
- renderer: {
29
- type: 'renderer_TypeTwo'
30
- }
31
- });
32
- expect(instance.renderer.type).toBe('renderer_TypeTwo');
33
- });