@jbrowse/plugin-linear-genome-view 1.5.7 → 1.6.1

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 (28) hide show
  1. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +35 -17
  2. package/dist/LinearBareDisplay/model.d.ts +28 -4
  3. package/dist/LinearBasicDisplay/model.d.ts +28 -4
  4. package/dist/LinearGenomeView/components/Header.d.ts +2 -1
  5. package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
  6. package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -8
  7. package/dist/LinearGenomeView/components/SearchBox.d.ts +8 -0
  8. package/dist/LinearGenomeView/index.d.ts +7 -4
  9. package/dist/index.d.ts +85 -14
  10. package/dist/plugin-linear-genome-view.cjs.development.js +738 -389
  11. package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
  12. package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
  13. package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
  14. package/dist/plugin-linear-genome-view.esm.js +749 -401
  15. package/dist/plugin-linear-genome-view.esm.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +308 -88
  18. package/src/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.ts +10 -3
  19. package/src/LinearBasicDisplay/configSchema.ts +0 -6
  20. package/src/LinearGenomeView/components/Header.tsx +38 -120
  21. package/src/LinearGenomeView/components/ImportForm.tsx +1 -1
  22. package/src/LinearGenomeView/components/LinearGenomeView.test.js +6 -4
  23. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +9 -5
  24. package/src/LinearGenomeView/components/SearchBox.tsx +111 -0
  25. package/src/LinearGenomeView/components/TrackLabel.tsx +10 -6
  26. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +10 -11
  27. package/src/LinearGenomeView/index.tsx +25 -53
  28. package/src/index.ts +61 -2
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { lazy } from 'react'
2
+ import { when } from 'mobx'
2
3
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
3
4
  import {
4
5
  createBaseTrackConfig,
@@ -27,6 +28,7 @@ import {
27
28
  stateModelFactory as linearGenomeViewStateModelFactory,
28
29
  renderToSvg,
29
30
  RefNameAutocomplete,
31
+ SearchBox,
30
32
  } from './LinearGenomeView'
31
33
 
32
34
  import {
@@ -34,6 +36,8 @@ import {
34
36
  modelFactory as linearBasicDisplayModelFactory,
35
37
  } from './LinearBasicDisplay'
36
38
 
39
+ type LGV = LinearGenomeViewModel
40
+
37
41
  export default class LinearGenomeViewPlugin extends Plugin {
38
42
  name = 'LinearGenomeViewPlugin'
39
43
 
@@ -118,6 +122,60 @@ export default class LinearGenomeViewPlugin extends Plugin {
118
122
  ),
119
123
  }),
120
124
  )
125
+
126
+ pluginManager.addToExtensionPoint(
127
+ 'LaunchView-LinearGenomeView',
128
+ // @ts-ignore
129
+ async ({
130
+ session,
131
+ assembly,
132
+ loc,
133
+ tracks = [],
134
+ }: {
135
+ session: AbstractSessionModel
136
+ assembly?: string
137
+ loc: string
138
+ tracks?: string[]
139
+ }) => {
140
+ const { assemblyManager } = session
141
+ const view = session.addView('LinearGenomeView', {}) as LGV
142
+
143
+ await when(() => !!view.volatileWidth)
144
+
145
+ if (!assembly) {
146
+ throw new Error(
147
+ 'No assembly provided when launching linear genome view',
148
+ )
149
+ }
150
+
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
+ }
157
+
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
169
+ }
170
+ }
171
+ })
172
+ if (idsNotFound.length) {
173
+ throw new Error(
174
+ `Could not resolve identifiers: ${idsNotFound.join(',')}`,
175
+ )
176
+ }
177
+ },
178
+ )
121
179
  }
122
180
 
123
181
  configure(pluginManager: PluginManager) {
@@ -134,14 +192,15 @@ export default class LinearGenomeViewPlugin extends Plugin {
134
192
  }
135
193
 
136
194
  export {
137
- BaseLinearDisplayComponent,
138
- BaseLinearDisplay,
139
195
  baseLinearDisplayConfigSchema,
140
196
  linearBareDisplayConfigSchemaFactory,
141
197
  linearBasicDisplayConfigSchemaFactory,
142
198
  linearBasicDisplayModelFactory,
143
199
  renderToSvg,
200
+ BaseLinearDisplayComponent,
201
+ BaseLinearDisplay,
144
202
  RefNameAutocomplete,
203
+ SearchBox,
145
204
  }
146
205
 
147
206
  export type { LinearGenomeViewModel, LinearGenomeViewStateModel, BlockModel }