@jbrowse/plugin-data-management 2.2.2 → 2.3.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 (73) hide show
  1. package/dist/AddTrackWidget/components/AddTrackWidget.js +28 -5
  2. package/dist/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
  3. package/dist/AddTrackWidget/components/ConfirmTrack.d.ts +2 -3
  4. package/dist/AddTrackWidget/components/ConfirmTrack.js +30 -177
  5. package/dist/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
  6. package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
  7. package/dist/AddTrackWidget/components/TextIndexingConfig.d.ts +6 -0
  8. package/dist/AddTrackWidget/components/TextIndexingConfig.js +109 -0
  9. package/dist/AddTrackWidget/components/TextIndexingConfig.js.map +1 -0
  10. package/dist/AddTrackWidget/components/TrackAdapterSelector.d.ts +6 -0
  11. package/dist/AddTrackWidget/components/TrackAdapterSelector.js +50 -0
  12. package/dist/AddTrackWidget/components/TrackAdapterSelector.js.map +1 -0
  13. package/dist/AddTrackWidget/components/TrackTypeSelector.d.ts +6 -0
  14. package/dist/AddTrackWidget/components/TrackTypeSelector.js +27 -0
  15. package/dist/AddTrackWidget/components/TrackTypeSelector.js.map +1 -0
  16. package/dist/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.js +3 -4
  17. package/dist/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.js.map +1 -1
  18. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +3 -1
  19. package/dist/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  20. package/dist/HierarchicalTrackSelectorWidget/model.d.ts +2 -1
  21. package/dist/HierarchicalTrackSelectorWidget/model.js +5 -5
  22. package/dist/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  23. package/dist/ucsc-trackhub/index.d.ts +2 -2
  24. package/dist/ucsc-trackhub/index.js.map +1 -1
  25. package/dist/ucsc-trackhub/model.d.ts +3 -2
  26. package/dist/ucsc-trackhub/model.js +41 -40
  27. package/dist/ucsc-trackhub/model.js.map +1 -1
  28. package/dist/ucsc-trackhub/ucscAssemblies.js.map +1 -1
  29. package/esm/AddTrackWidget/components/AddTrackWidget.js +6 -6
  30. package/esm/AddTrackWidget/components/AddTrackWidget.js.map +1 -1
  31. package/esm/AddTrackWidget/components/ConfirmTrack.d.ts +2 -3
  32. package/esm/AddTrackWidget/components/ConfirmTrack.js +28 -175
  33. package/esm/AddTrackWidget/components/ConfirmTrack.js.map +1 -1
  34. package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js.map +1 -1
  35. package/esm/AddTrackWidget/components/TextIndexingConfig.d.ts +6 -0
  36. package/esm/AddTrackWidget/components/TextIndexingConfig.js +81 -0
  37. package/esm/AddTrackWidget/components/TextIndexingConfig.js.map +1 -0
  38. package/esm/AddTrackWidget/components/TrackAdapterSelector.d.ts +6 -0
  39. package/esm/AddTrackWidget/components/TrackAdapterSelector.js +45 -0
  40. package/esm/AddTrackWidget/components/TrackAdapterSelector.js.map +1 -0
  41. package/esm/AddTrackWidget/components/TrackTypeSelector.d.ts +6 -0
  42. package/esm/AddTrackWidget/components/TrackTypeSelector.js +22 -0
  43. package/esm/AddTrackWidget/components/TrackTypeSelector.js.map +1 -0
  44. package/esm/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.js +3 -4
  45. package/esm/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.js.map +1 -1
  46. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js +3 -1
  47. package/esm/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.js.map +1 -1
  48. package/esm/HierarchicalTrackSelectorWidget/model.d.ts +2 -1
  49. package/esm/HierarchicalTrackSelectorWidget/model.js +5 -5
  50. package/esm/HierarchicalTrackSelectorWidget/model.js.map +1 -1
  51. package/esm/ucsc-trackhub/index.d.ts +2 -2
  52. package/esm/ucsc-trackhub/index.js.map +1 -1
  53. package/esm/ucsc-trackhub/model.d.ts +3 -2
  54. package/esm/ucsc-trackhub/model.js +41 -40
  55. package/esm/ucsc-trackhub/model.js.map +1 -1
  56. package/esm/ucsc-trackhub/ucscAssemblies.js.map +1 -1
  57. package/package.json +3 -4
  58. package/src/AddTrackWidget/components/AddTrackWidget.test.tsx +3 -4
  59. package/src/AddTrackWidget/components/AddTrackWidget.tsx +6 -9
  60. package/src/AddTrackWidget/components/ConfirmTrack.tsx +36 -296
  61. package/src/AddTrackWidget/components/DefaultAddTrackWorkflow.tsx +0 -1
  62. package/src/AddTrackWidget/components/TextIndexingConfig.tsx +134 -0
  63. package/src/AddTrackWidget/components/TrackAdapterSelector.tsx +73 -0
  64. package/src/AddTrackWidget/components/TrackTypeSelector.tsx +46 -0
  65. package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.tsx +4 -4
  66. package/src/HierarchicalTrackSelectorWidget/components/ToggleConnectionsDialog.tsx +5 -1
  67. package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +1 -1
  68. package/src/HierarchicalTrackSelectorWidget/model.ts +7 -7
  69. package/src/PluginStoreWidget/components/__snapshots__/PluginStoreWidget.test.js.snap +0 -22
  70. package/src/ucsc-trackhub/{index.js → index.ts} +0 -0
  71. package/src/ucsc-trackhub/model.ts +119 -0
  72. package/src/ucsc-trackhub/{ucscAssemblies.js → ucscAssemblies.ts} +0 -0
  73. package/src/ucsc-trackhub/model.js +0 -125
@@ -68,7 +68,11 @@ function ToggleConnectionDialog({
68
68
  color="primary"
69
69
  />
70
70
  }
71
- label={`${name} (${ellipses(assemblyNames.join(','))})`}
71
+ label={`${name} ${
72
+ assemblyNames.length
73
+ ? '(' + ellipses(assemblyNames.join(',')) + ')'
74
+ : ''
75
+ }`}
72
76
  />
73
77
  )
74
78
  })}
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`HierarchicalTrackSelector widget renders nothing with no assembly 1`] = `
4
4
  <button
5
- class="MuiButtonBase-root MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary css-tbl9bo-MuiButtonBase-root-MuiFab-root-fab"
5
+ class="MuiButtonBase-root MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary css-15opis6-MuiButtonBase-root-MuiFab-root-fab"
6
6
  tabindex="0"
7
7
  type="button"
8
8
  >
@@ -67,6 +67,7 @@ export function generateHierarchy(
67
67
  model: HierarchicalTrackSelectorModel,
68
68
  trackConfigurations: AnyConfigurationModel[],
69
69
  collapsed: { get: (arg: string) => boolean | undefined },
70
+ extra?: string,
70
71
  ) {
71
72
  const hierarchy = { children: [] as TreeNode[] } as TreeNode
72
73
  const { filterText, view } = model
@@ -91,7 +92,7 @@ export function generateHierarchy(
91
92
  for (let i = 0; i < categories.length; i++) {
92
93
  const category = categories[i]
93
94
  const ret = currLevel.children.find(c => c.name === category)
94
- const id = categories.slice(0, i + 1).join(',')
95
+ const id = extra + '-' + categories.slice(0, i + 1).join(',')
95
96
  if (!ret) {
96
97
  const n = {
97
98
  children: [],
@@ -228,10 +229,7 @@ export default function stateTreeFactory(pluginManager: PluginManager) {
228
229
  const conns =
229
230
  (assembly &&
230
231
  connectionInstances
231
- ?.filter(c =>
232
- hasAnyOverlap(assembly.allAliases, getConf(c, 'assemblyNames')),
233
- )
234
- .map(c => ({
232
+ ?.map(c => ({
235
233
  // @ts-ignore
236
234
  id: getSnapshot(c).configuration,
237
235
  name: getConf(c, 'name'),
@@ -239,7 +237,8 @@ export default function stateTreeFactory(pluginManager: PluginManager) {
239
237
  state: {
240
238
  expanded: true,
241
239
  },
242
- }))) ||
240
+ }))
241
+ .filter(f => f.children.length)) ||
243
242
  []
244
243
 
245
244
  return {
@@ -254,13 +253,14 @@ export default function stateTreeFactory(pluginManager: PluginManager) {
254
253
 
255
254
  connectionHierarchy(
256
255
  assemblyName: string,
257
- connection: { tracks: AnyConfigurationModel[] },
256
+ connection: { name: string; tracks: AnyConfigurationModel[] },
258
257
  ) {
259
258
  return generateHierarchy(
260
259
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
261
260
  self as any,
262
261
  self.connectionTrackConfigurations(assemblyName, connection),
263
262
  self.collapsed,
263
+ connection.name,
264
264
  )
265
265
  },
266
266
  }))
@@ -501,28 +501,6 @@ exports[`<PluginStoreWidget /> renders with the available plugins 1`] = `
501
501
  SequencePlugin
502
502
  </p>
503
503
  </li>
504
- <li
505
- class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding css-ypie1g-MuiListItem-root"
506
- >
507
- <svg
508
- aria-hidden="true"
509
- aria-label="This plugin was installed by an administrator, you cannot remove it."
510
- class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1a34d00-MuiSvgIcon-root-lockedPluginTooltip"
511
- data-mui-internal-clone-element="true"
512
- data-testid="LockIcon"
513
- focusable="false"
514
- viewBox="0 0 24 24"
515
- >
516
- <path
517
- d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"
518
- />
519
- </svg>
520
- <p
521
- class="MuiTypography-root MuiTypography-body1 css-k0xfey-MuiTypography-root"
522
- >
523
- TrackHubRegistryPlugin
524
- </p>
525
- </li>
526
504
  <li
527
505
  class="MuiListItem-root MuiListItem-dense MuiListItem-gutters MuiListItem-padding css-ypie1g-MuiListItem-root"
528
506
  >
File without changes
@@ -0,0 +1,119 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager'
2
+ import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'
3
+ import {
4
+ ConfigurationReference,
5
+ readConfObject,
6
+ getConf,
7
+ } from '@jbrowse/core/configuration'
8
+ import { getSession } from '@jbrowse/core/util'
9
+ import { types } from 'mobx-state-tree'
10
+
11
+ // locals
12
+ import configSchema from './configSchema'
13
+ import {
14
+ fetchGenomesFile,
15
+ fetchHubFile,
16
+ fetchTrackDbFile,
17
+ generateTracks,
18
+ } from './ucscTrackHub'
19
+
20
+ export default function UCSCTrackHubConnection(pluginManager: PluginManager) {
21
+ return types
22
+ .compose(
23
+ 'UCSCTrackHubConnection',
24
+ BaseConnectionModelFactory(pluginManager),
25
+ types.model({
26
+ configuration: ConfigurationReference(configSchema),
27
+ type: types.literal('UCSCTrackHubConnection'),
28
+ }),
29
+ )
30
+ .actions(self => ({
31
+ async connect() {
32
+ const session = getSession(self)
33
+ try {
34
+ const connectionName = getConf(self, 'name')
35
+ const hubFileLocation = getConf(self, 'hubTxtLocation')
36
+ const hubFile = await fetchHubFile(hubFileLocation)
37
+ const genomeFile = hubFile.get('genomesFile')
38
+ if (!genomeFile) {
39
+ throw new Error('genomesFile not found on hub')
40
+ }
41
+
42
+ const hubUri = new URL(hubFileLocation.uri, hubFileLocation.baseUri)
43
+ const genomesFileLocation = hubUri
44
+ ? {
45
+ uri: new URL(genomeFile, hubUri).href,
46
+ locationType: 'UriLocation',
47
+ }
48
+ : {
49
+ localPath: genomeFile,
50
+ locationType: 'LocalPathLocation',
51
+ }
52
+ const genomesFile = await fetchGenomesFile(genomesFileLocation)
53
+ const trackDbData = []
54
+ for (const [genomeName, genome] of genomesFile) {
55
+ const assemblyNames = getConf(self, 'assemblyNames')
56
+ if (
57
+ assemblyNames.length > 0 &&
58
+ !assemblyNames.includes(genomeName)
59
+ ) {
60
+ continue
61
+ }
62
+ const conf = session.assemblies.find(
63
+ a => readConfObject(a, 'name') === genomeName,
64
+ )
65
+ if (!conf) {
66
+ throw new Error(
67
+ `Cannot find assembly for "${genomeName}" from the genomes file for connection "${connectionName}"`,
68
+ )
69
+ }
70
+ const trackDb = genome.get('trackDb')
71
+ if (!trackDb) {
72
+ throw new Error('genomesFile not found on hub')
73
+ }
74
+ const trackDbFileLocation = hubUri
75
+ ? {
76
+ uri: new URL(trackDb, new URL(genomeFile, hubUri)).href,
77
+ locationType: 'UriLocation',
78
+ }
79
+ : {
80
+ localPath: trackDb,
81
+ locationType: 'LocalPathLocation',
82
+ }
83
+ trackDbData.push([
84
+ trackDbFileLocation,
85
+ await fetchTrackDbFile(trackDbFileLocation),
86
+ genomeName,
87
+ conf,
88
+ ] as const)
89
+ }
90
+ for (const [
91
+ trackDbFileLocation,
92
+ trackDbFile,
93
+ genomeName,
94
+ conf,
95
+ ] of trackDbData) {
96
+ const sequenceAdapter = readConfObject(conf, [
97
+ 'sequence',
98
+ 'adapter',
99
+ ])
100
+ self.addTrackConfs(
101
+ generateTracks(
102
+ trackDbFile,
103
+ trackDbFileLocation,
104
+ genomeName,
105
+ sequenceAdapter,
106
+ ),
107
+ )
108
+ }
109
+ } catch (e) {
110
+ console.error(e)
111
+ session.notify(
112
+ `There was a problem connecting to the UCSC Track Hub "${self.configuration.name}". Please make sure you have entered a valid hub.txt file. The error that was thrown is: "${e}"`,
113
+ 'error',
114
+ )
115
+ session.breakConnection(self.configuration)
116
+ }
117
+ },
118
+ }))
119
+ }
@@ -1,125 +0,0 @@
1
- import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'
2
- import {
3
- ConfigurationReference,
4
- readConfObject,
5
- getConf,
6
- } from '@jbrowse/core/configuration'
7
- import { getSession } from '@jbrowse/core/util'
8
- import { types } from 'mobx-state-tree'
9
- import configSchema from './configSchema'
10
- import {
11
- fetchGenomesFile,
12
- fetchHubFile,
13
- fetchTrackDbFile,
14
- generateTracks,
15
- } from './ucscTrackHub'
16
-
17
- export default function UCSCTrackHubConnection(pluginManager) {
18
- return types.compose(
19
- 'UCSCTrackHubConnection',
20
- BaseConnectionModelFactory(pluginManager),
21
- types
22
- .model({
23
- configuration: ConfigurationReference(configSchema),
24
- type: types.literal('UCSCTrackHubConnection'),
25
- })
26
- .actions(self => ({
27
- connect() {
28
- const connectionName = getConf(self, 'name')
29
- const hubFileLocation = getConf(self, 'hubTxtLocation')
30
- const session = getSession(self)
31
- fetchHubFile(hubFileLocation)
32
- .then(hubFile => {
33
- const genomesFileLocation = hubFileLocation.uri
34
- ? {
35
- uri: new URL(
36
- hubFile.get('genomesFile'),
37
- hubFileLocation.uri,
38
- ).href,
39
- locationType: 'UriLocation',
40
- }
41
- : {
42
- localPath: hubFile.get('genomesFile'),
43
- locationType: 'LocalPathLocation',
44
- }
45
- return Promise.all([
46
- hubFile,
47
- fetchGenomesFile(genomesFileLocation),
48
- ])
49
- })
50
- .then(([hubFile, genomesFile]) => {
51
- const trackDbData = []
52
- for (const [genomeName, genome] of genomesFile) {
53
- const assemblyNames = getConf(self, 'assemblyNames')
54
- if (
55
- assemblyNames.length > 0 &&
56
- !assemblyNames.includes(genomeName)
57
- ) {
58
- break
59
- }
60
- const assemblyConf = session.assemblies.find(
61
- assembly => readConfObject(assembly, 'name') === genomeName,
62
- )
63
- if (!assemblyConf) {
64
- throw new Error(
65
- `Cannot find assembly for "${genomeName}" from the genomes file for connection "${connectionName}"`,
66
- )
67
- }
68
- const trackDbFileLocation = hubFileLocation.uri
69
- ? {
70
- uri: new URL(
71
- genome.get('trackDb'),
72
- new URL(
73
- hubFile.get('genomesFile'),
74
- hubFileLocation.uri,
75
- ),
76
- ).href,
77
- locationType: 'UriLocation',
78
- }
79
- : {
80
- localPath: genome.get('trackDb'),
81
- locationType: 'LocalPathLocation',
82
- }
83
- trackDbData.push(
84
- Promise.all([
85
- trackDbFileLocation,
86
- fetchTrackDbFile(trackDbFileLocation),
87
- genomeName,
88
- assemblyConf,
89
- ]),
90
- )
91
- }
92
- return Promise.all([...trackDbData])
93
- })
94
- .then(trackDbData => {
95
- for (const [
96
- trackDbFileLocation,
97
- trackDbFile,
98
- genomeName,
99
- assemblyConf,
100
- ] of trackDbData) {
101
- const sequenceAdapter = readConfObject(assemblyConf, [
102
- 'sequence',
103
- 'adapter',
104
- ])
105
- const tracks = generateTracks(
106
- trackDbFile,
107
- trackDbFileLocation,
108
- genomeName,
109
- sequenceAdapter,
110
- )
111
- self.addTrackConfs(tracks)
112
- }
113
- })
114
- .catch(error => {
115
- console.error(error)
116
- session.notify(
117
- `There was a problem connecting to the UCSC Track Hub "${self.name}". Please make sure you have entered a valid hub.txt file. The error that was thrown is: "${error}"`,
118
- 'error',
119
- )
120
- session.breakConnection(self.configuration)
121
- })
122
- },
123
- })),
124
- )
125
- }