@jbrowse/plugin-data-management 2.3.2 → 2.3.3
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.
- package/dist/AddConnectionWidget/index.d.ts +3 -2
- package/dist/AddConnectionWidget/index.js +38 -4
- package/dist/AddConnectionWidget/index.js.map +1 -1
- package/dist/AddTrackWidget/index.d.ts +3 -2
- package/dist/AddTrackWidget/index.js +38 -4
- package/dist/AddTrackWidget/index.js.map +1 -1
- package/dist/HierarchicalTrackSelectorWidget/index.d.ts +3 -0
- package/dist/HierarchicalTrackSelectorWidget/index.js +36 -0
- package/dist/HierarchicalTrackSelectorWidget/index.js.map +1 -1
- package/dist/PluginStoreWidget/index.d.ts +3 -2
- package/dist/PluginStoreWidget/index.js +38 -4
- package/dist/PluginStoreWidget/index.js.map +1 -1
- package/dist/index.js +10 -51
- package/dist/index.js.map +1 -1
- package/dist/ucsc-trackhub/index.d.ts +3 -2
- package/dist/ucsc-trackhub/index.js +13 -5
- package/dist/ucsc-trackhub/index.js.map +1 -1
- package/esm/AddConnectionWidget/index.d.ts +3 -2
- package/esm/AddConnectionWidget/index.js +15 -2
- package/esm/AddConnectionWidget/index.js.map +1 -1
- package/esm/AddTrackWidget/index.d.ts +3 -2
- package/esm/AddTrackWidget/index.js +15 -2
- package/esm/AddTrackWidget/index.js.map +1 -1
- package/esm/HierarchicalTrackSelectorWidget/index.d.ts +3 -0
- package/esm/HierarchicalTrackSelectorWidget/index.js +13 -0
- package/esm/HierarchicalTrackSelectorWidget/index.js.map +1 -1
- package/esm/PluginStoreWidget/index.d.ts +3 -2
- package/esm/PluginStoreWidget/index.js +15 -2
- package/esm/PluginStoreWidget/index.js.map +1 -1
- package/esm/index.js +10 -51
- package/esm/index.js.map +1 -1
- package/esm/ucsc-trackhub/index.d.ts +3 -2
- package/esm/ucsc-trackhub/index.js +13 -2
- package/esm/ucsc-trackhub/index.js.map +1 -1
- package/package.json +2 -2
- package/src/AddConnectionWidget/components/{AddConnectionWidget.test.js → AddConnectionWidget.test.tsx} +17 -8
- package/src/AddConnectionWidget/components/__snapshots__/{AddConnectionWidget.test.js.snap → AddConnectionWidget.test.tsx.snap} +0 -0
- package/src/AddConnectionWidget/index.ts +17 -2
- package/src/AddTrackWidget/{index.test.jsx → index.test.tsx} +34 -37
- package/src/AddTrackWidget/index.ts +17 -2
- package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.tsx +124 -128
- package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +5 -5
- package/src/HierarchicalTrackSelectorWidget/index.ts +17 -0
- package/src/PluginStoreWidget/components/PluginStoreWidget.test.tsx +132 -0
- package/src/PluginStoreWidget/components/__snapshots__/{PluginStoreWidget.test.js.snap → PluginStoreWidget.test.tsx.snap} +2 -2
- package/src/PluginStoreWidget/index.ts +17 -2
- package/src/PluginStoreWidget/{model.test.js → model.test.tsx} +0 -0
- package/src/__snapshots__/index.test.ts.snap +9 -0
- package/src/index.test.ts +54 -0
- package/src/index.ts +10 -83
- package/src/ucsc-trackhub/index.ts +19 -2
- package/src/PluginStoreWidget/components/PluginStoreWidget.test.js +0 -123
- package/src/__snapshots__/index.test.js.snap +0 -9
- package/src/index.test.js +0 -61
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ConnectionType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
|
+
import stateModelFactory from './model';
|
|
3
|
+
import configSchema from './configSchema';
|
|
4
|
+
export default (pluginManager) => {
|
|
5
|
+
pluginManager.addConnectionType(() => new ConnectionType({
|
|
6
|
+
name: 'UCSCTrackHubConnection',
|
|
7
|
+
configSchema,
|
|
8
|
+
stateModel: stateModelFactory(pluginManager),
|
|
9
|
+
displayName: 'UCSC Track Hub',
|
|
10
|
+
description: 'A track or assembly hub in the Track Hub format',
|
|
11
|
+
url: '//genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html#Intro',
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
3
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ucsc-trackhub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ucsc-trackhub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGpE,OAAO,iBAAiB,MAAM,SAAS,CAAA;AACvC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,eAAe,CAAC,aAA4B,EAAE,EAAE;IAC9C,aAAa,CAAC,iBAAiB,CAC7B,GAAG,EAAE,CACH,IAAI,cAAc,CAAC;QACjB,IAAI,EAAE,wBAAwB;QAC9B,YAAY;QACZ,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC;QAC5C,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,iDAAiD;QAC9D,GAAG,EAAE,6DAA6D;KACnE,CAAC,CACL,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-data-management",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"distModule": "esm/index.js",
|
|
61
61
|
"srcModule": "src/index.ts",
|
|
62
62
|
"module": "esm/index.js",
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "283e0387ccd5acc9f092cf00804d1fcac212e68d"
|
|
64
64
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { render, cleanup, fireEvent } from '@testing-library/react'
|
|
2
1
|
import React from 'react'
|
|
2
|
+
import { render, cleanup, fireEvent } from '@testing-library/react'
|
|
3
3
|
import { createTestSession } from '@jbrowse/web/src/rootModel'
|
|
4
|
+
|
|
5
|
+
// locals
|
|
4
6
|
import AddConnectionWidget from './AddConnectionWidget'
|
|
7
|
+
|
|
5
8
|
jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
|
|
6
9
|
|
|
7
|
-
window.fetch = jest.fn(() => new Promise(resolve => resolve()))
|
|
10
|
+
// window.fetch = jest.fn(() => new Promise(resolve => resolve()))
|
|
8
11
|
|
|
9
12
|
describe('<AddConnectionWidget />', () => {
|
|
10
|
-
|
|
11
|
-
let
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
let model: any
|
|
15
|
+
let session: ReturnType<typeof createTestSession>
|
|
12
16
|
|
|
13
17
|
beforeEach(() => {
|
|
14
18
|
session = createTestSession()
|
|
@@ -42,7 +46,8 @@ describe('<AddConnectionWidget />', () => {
|
|
|
42
46
|
})
|
|
43
47
|
|
|
44
48
|
it('can handle a custom UCSC trackHub URL', async () => {
|
|
45
|
-
const mockFetch = url => {
|
|
49
|
+
const mockFetch = async (url: RequestInfo | URL) => {
|
|
50
|
+
// @ts-ignore
|
|
46
51
|
const urlText = url.href ? url.href : url
|
|
47
52
|
let responseText = ''
|
|
48
53
|
if (urlText.endsWith('hub.txt')) {
|
|
@@ -66,9 +71,11 @@ type bigWig
|
|
|
66
71
|
`
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
return
|
|
74
|
+
return new Response(responseText)
|
|
70
75
|
}
|
|
76
|
+
|
|
71
77
|
jest.spyOn(global, 'fetch').mockImplementation(mockFetch)
|
|
78
|
+
|
|
72
79
|
const { findByTestId, getAllByRole, findAllByText, findByDisplayValue } =
|
|
73
80
|
render(<AddConnectionWidget model={model} />)
|
|
74
81
|
expect(session.connections.length).toBe(0)
|
|
@@ -90,7 +97,8 @@ type bigWig
|
|
|
90
97
|
})
|
|
91
98
|
|
|
92
99
|
it('can handle a custom JBrowse 1 data directory URL', async () => {
|
|
93
|
-
const mockFetch = url => {
|
|
100
|
+
const mockFetch = async (url: RequestInfo | URL) => {
|
|
101
|
+
// @ts-ignore
|
|
94
102
|
const urlText = url.href ? url.href : url
|
|
95
103
|
let responseText = ''
|
|
96
104
|
if (urlText.endsWith('trackList.json')) {
|
|
@@ -98,9 +106,10 @@ type bigWig
|
|
|
98
106
|
} else if (urlText.endsWith('refSeqs.json')) {
|
|
99
107
|
responseText = '[]'
|
|
100
108
|
}
|
|
101
|
-
return
|
|
109
|
+
return new Response(responseText)
|
|
102
110
|
}
|
|
103
111
|
jest.spyOn(global, 'fetch').mockImplementation(mockFetch)
|
|
112
|
+
|
|
104
113
|
const {
|
|
105
114
|
findByTestId,
|
|
106
115
|
getAllByRole,
|
|
File without changes
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
4
|
+
import { lazy } from 'react'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
import stateModel from './model'
|
|
7
|
+
const configSchema = ConfigurationSchema('AddConnectionWidget', {})
|
|
8
|
+
|
|
9
|
+
export default (pluginManager: PluginManager) => {
|
|
10
|
+
pluginManager.addWidgetType(() => {
|
|
11
|
+
return new WidgetType({
|
|
12
|
+
name: 'AddConnectionWidget',
|
|
13
|
+
heading: 'Add a connection',
|
|
14
|
+
configSchema,
|
|
15
|
+
stateModel,
|
|
16
|
+
ReactComponent: lazy(() => import('./components/AddConnectionWidget')),
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
}
|
|
@@ -52,10 +52,13 @@ function standardInitializer() {
|
|
|
52
52
|
const realLocation = window.location
|
|
53
53
|
|
|
54
54
|
// https://stackoverflow.com/a/60110508/2129219
|
|
55
|
-
function setWindowLoc(loc) {
|
|
55
|
+
function setWindowLoc(loc: string) {
|
|
56
|
+
// @ts-ignore
|
|
56
57
|
delete window.location
|
|
58
|
+
// @ts-ignore
|
|
57
59
|
window.location = new URL(loc)
|
|
58
60
|
}
|
|
61
|
+
|
|
59
62
|
const FakeViewModel = types.model('FakeView', {
|
|
60
63
|
id: types.identifier,
|
|
61
64
|
type: types.literal('FakeView'),
|
|
@@ -67,7 +70,7 @@ const FakeViewModel = types.model('FakeView', {
|
|
|
67
70
|
class FakeViewPlugin extends Plugin {
|
|
68
71
|
name = 'FakeViewPlugin'
|
|
69
72
|
|
|
70
|
-
install(pluginManager) {
|
|
73
|
+
install(pluginManager: PluginManager) {
|
|
71
74
|
pluginManager.addViewType(() => {
|
|
72
75
|
return new ViewType({
|
|
73
76
|
name: 'FakeView',
|
|
@@ -79,7 +82,7 @@ class FakeViewPlugin extends Plugin {
|
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
describe('tests on an LGV type system with view.assemblyNames, using URL', () => {
|
|
82
|
-
let session
|
|
85
|
+
let session: ReturnType<typeof standardInitializer>
|
|
83
86
|
beforeEach(() => {
|
|
84
87
|
session = standardInitializer()
|
|
85
88
|
})
|
|
@@ -89,7 +92,6 @@ describe('tests on an LGV type system with view.assemblyNames, using URL', () =>
|
|
|
89
92
|
})
|
|
90
93
|
|
|
91
94
|
it('adds relative URL (BAM)', () => {
|
|
92
|
-
console.warn = jest.fn()
|
|
93
95
|
const { widget } = session
|
|
94
96
|
widget.setTrackData({
|
|
95
97
|
uri: 'volvox-sorted.bam',
|
|
@@ -135,45 +137,40 @@ describe('tests on an LGV type system with view.assemblyNames, using URL', () =>
|
|
|
135
137
|
})
|
|
136
138
|
})
|
|
137
139
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
pluginManager.createPluggableElements()
|
|
143
|
-
pluginManager.configure()
|
|
144
|
-
const SessionModel = types.model({
|
|
145
|
-
view: FakeViewModel,
|
|
146
|
-
widget: stateModelFactory(pluginManager),
|
|
147
|
-
})
|
|
140
|
+
test('tests on an view without view.assemblyNames', () => {
|
|
141
|
+
const pluginManager = new PluginManager([new FakeViewPlugin()])
|
|
142
|
+
pluginManager.createPluggableElements()
|
|
143
|
+
pluginManager.configure()
|
|
148
144
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
145
|
+
const SessionModel = types.model({
|
|
146
|
+
view: FakeViewModel,
|
|
147
|
+
widget: stateModelFactory(pluginManager),
|
|
148
|
+
})
|
|
149
|
+
// no assemblyNames on the view, just in case some view does not implement
|
|
150
|
+
// view.assemblyNames (it is just a convenience)
|
|
151
|
+
const session = SessionModel.create({
|
|
152
|
+
view: {
|
|
153
|
+
type: 'FakeView',
|
|
154
|
+
id: 'testing',
|
|
155
|
+
},
|
|
156
|
+
widget: {
|
|
157
|
+
type: 'AddTrackWidget',
|
|
158
|
+
view: 'testing',
|
|
159
|
+
},
|
|
161
160
|
})
|
|
162
161
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
locationType: 'UriLocation',
|
|
168
|
-
})
|
|
169
|
-
expect(widget.trackName).toBe('volvox-sorted.bam')
|
|
170
|
-
expect(widget.isRelativeUrl).toBe(true)
|
|
171
|
-
expect(widget.assembly).toBe(undefined)
|
|
162
|
+
const { widget } = session
|
|
163
|
+
widget.setTrackData({
|
|
164
|
+
uri: 'volvox-sorted.bam',
|
|
165
|
+
locationType: 'UriLocation',
|
|
172
166
|
})
|
|
167
|
+
expect(widget.trackName).toBe('volvox-sorted.bam')
|
|
168
|
+
expect(widget.isRelativeUrl).toBe(true)
|
|
169
|
+
expect(widget.assembly).toBe(undefined)
|
|
173
170
|
})
|
|
174
171
|
|
|
175
172
|
describe('tests different file types', () => {
|
|
176
|
-
let session
|
|
173
|
+
let session: ReturnType<typeof standardInitializer>
|
|
177
174
|
beforeEach(() => {
|
|
178
175
|
session = standardInitializer()
|
|
179
176
|
})
|
|
@@ -229,7 +226,7 @@ describe('tests different file types', () => {
|
|
|
229
226
|
})
|
|
230
227
|
|
|
231
228
|
describe('tests localpath', () => {
|
|
232
|
-
let session
|
|
229
|
+
let session: ReturnType<typeof standardInitializer>
|
|
233
230
|
beforeEach(() => {
|
|
234
231
|
session = standardInitializer()
|
|
235
232
|
})
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
4
|
+
import { lazy } from 'react'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
import stateModelFactory from './model'
|
|
7
|
+
const configSchema = ConfigurationSchema('AddTrackWidget', {})
|
|
8
|
+
|
|
9
|
+
export default (pluginManager: PluginManager) => {
|
|
10
|
+
pluginManager.addWidgetType(() => {
|
|
11
|
+
return new WidgetType({
|
|
12
|
+
name: 'AddTrackWidget',
|
|
13
|
+
heading: 'Add a track',
|
|
14
|
+
configSchema,
|
|
15
|
+
stateModel: stateModelFactory(pluginManager),
|
|
16
|
+
ReactComponent: lazy(() => import('./components/AddTrackWidget')),
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { createJBrowseTheme } from '@jbrowse/core/ui'
|
|
3
3
|
import { createTestSession } from '@jbrowse/web/src/rootModel'
|
|
4
|
-
import {
|
|
4
|
+
import { render } from '@testing-library/react'
|
|
5
5
|
import { ThemeProvider } from '@mui/material/styles'
|
|
6
6
|
|
|
7
7
|
// locals
|
|
@@ -13,140 +13,136 @@ jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
|
|
|
13
13
|
window.requestIdleCallback = cb => cb()
|
|
14
14
|
window.cancelIdleCallback = () => {}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
test('renders nothing with no assembly', () => {
|
|
17
|
+
const session = createTestSession()
|
|
18
|
+
const firstView = session.addView('LinearGenomeView')
|
|
19
|
+
const model = firstView.activateTrackSelector()
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const { container } = render(
|
|
22
|
+
<ThemeProvider theme={createJBrowseTheme()}>
|
|
23
|
+
{/* @ts-ignore*/}
|
|
24
|
+
<HierarchicalTrackSelector model={model} />
|
|
25
|
+
</ThemeProvider>,
|
|
26
|
+
)
|
|
27
|
+
expect(container.firstChild).toMatchSnapshot()
|
|
28
|
+
})
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
test('renders with a couple of uncategorized tracks', async () => {
|
|
31
|
+
const session = createTestSession()
|
|
32
|
+
session.addAssemblyConf({
|
|
33
|
+
name: 'volMyt1',
|
|
34
|
+
sequence: {
|
|
35
|
+
trackId: 'sequenceConfigId',
|
|
36
|
+
type: 'ReferenceSequenceTrack',
|
|
37
|
+
adapter: {
|
|
38
|
+
type: 'FromConfigSequenceAdapter',
|
|
39
|
+
features: [
|
|
40
|
+
{
|
|
41
|
+
refName: 'ctgA',
|
|
42
|
+
uniqueId: 'firstId',
|
|
43
|
+
start: 0,
|
|
44
|
+
end: 10,
|
|
45
|
+
seq: 'cattgttgcg',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
31
50
|
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
51
|
+
session.addTrackConf({
|
|
52
|
+
trackId: 'fooC',
|
|
53
|
+
assemblyNames: ['volMyt1'],
|
|
54
|
+
type: 'FeatureTrack',
|
|
55
|
+
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
56
|
+
})
|
|
57
|
+
session.addTrackConf({
|
|
58
|
+
trackId: 'barC',
|
|
59
|
+
assemblyNames: ['volMyt1'],
|
|
60
|
+
type: 'FeatureTrack',
|
|
61
|
+
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
62
|
+
})
|
|
63
|
+
const firstView = session.addView('LinearGenomeView', {
|
|
64
|
+
displayedRegions: [
|
|
65
|
+
{
|
|
66
|
+
assemblyName: 'volMyt1',
|
|
67
|
+
refName: 'ctgA',
|
|
68
|
+
start: 0,
|
|
69
|
+
end: 1000,
|
|
52
70
|
},
|
|
53
|
-
|
|
54
|
-
session.addTrackConf({
|
|
55
|
-
trackId: 'fooC',
|
|
56
|
-
assemblyNames: ['volMyt1'],
|
|
57
|
-
type: 'FeatureTrack',
|
|
58
|
-
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
59
|
-
})
|
|
60
|
-
session.addTrackConf({
|
|
61
|
-
trackId: 'barC',
|
|
62
|
-
assemblyNames: ['volMyt1'],
|
|
63
|
-
type: 'FeatureTrack',
|
|
64
|
-
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
65
|
-
})
|
|
66
|
-
const firstView = session.addView('LinearGenomeView', {
|
|
67
|
-
displayedRegions: [
|
|
68
|
-
{
|
|
69
|
-
assemblyName: 'volMyt1',
|
|
70
|
-
refName: 'ctgA',
|
|
71
|
-
start: 0,
|
|
72
|
-
end: 1000,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
})
|
|
76
|
-
firstView.showTrack(session.sessionTracks[0].trackId)
|
|
77
|
-
firstView.showTrack(session.sessionTracks[1].trackId)
|
|
78
|
-
const model = firstView.activateTrackSelector()
|
|
79
|
-
|
|
80
|
-
const { container, findByTestId } = render(
|
|
81
|
-
<ThemeProvider theme={createJBrowseTheme()}>
|
|
82
|
-
{/* @ts-ignore*/}
|
|
83
|
-
<HierarchicalTrackSelector model={model} />
|
|
84
|
-
</ThemeProvider>,
|
|
85
|
-
)
|
|
86
|
-
await findByTestId('hierarchical_track_selector')
|
|
87
|
-
expect(container.firstChild).toMatchSnapshot()
|
|
71
|
+
],
|
|
88
72
|
})
|
|
73
|
+
firstView.showTrack(session.sessionTracks[0].trackId)
|
|
74
|
+
firstView.showTrack(session.sessionTracks[1].trackId)
|
|
75
|
+
const model = firstView.activateTrackSelector()
|
|
89
76
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
features: [
|
|
100
|
-
{
|
|
101
|
-
refName: 'ctgA',
|
|
102
|
-
uniqueId: 'firstId',
|
|
103
|
-
start: 0,
|
|
104
|
-
end: 10,
|
|
105
|
-
seq: 'cattgttgcg',
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
})
|
|
77
|
+
const { container, findByTestId } = render(
|
|
78
|
+
<ThemeProvider theme={createJBrowseTheme()}>
|
|
79
|
+
{/* @ts-ignore*/}
|
|
80
|
+
<HierarchicalTrackSelector model={model} />
|
|
81
|
+
</ThemeProvider>,
|
|
82
|
+
)
|
|
83
|
+
await findByTestId('hierarchical_track_selector')
|
|
84
|
+
expect(container.firstChild).toMatchSnapshot()
|
|
85
|
+
})
|
|
111
86
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
firstView.showTrack(session.sessionTracks[0].trackId)
|
|
135
|
-
firstView.showTrack(session.sessionTracks[1].trackId)
|
|
136
|
-
firstView.tracks[0].configuration.category.set(['Foo Category'])
|
|
137
|
-
firstView.tracks[1].configuration.category.set([
|
|
138
|
-
'Foo Category',
|
|
139
|
-
'Bar Category',
|
|
140
|
-
])
|
|
141
|
-
const model = firstView.activateTrackSelector()
|
|
87
|
+
test('renders with a couple of categorized tracks', async () => {
|
|
88
|
+
const session = createTestSession()
|
|
89
|
+
session.addAssemblyConf({
|
|
90
|
+
name: 'volMyt1',
|
|
91
|
+
sequence: {
|
|
92
|
+
trackId: 'sequenceConfigId',
|
|
93
|
+
type: 'ReferenceSequenceTrack',
|
|
94
|
+
adapter: {
|
|
95
|
+
type: 'FromConfigSequenceAdapter',
|
|
96
|
+
features: [
|
|
97
|
+
{
|
|
98
|
+
refName: 'ctgA',
|
|
99
|
+
uniqueId: 'firstId',
|
|
100
|
+
start: 0,
|
|
101
|
+
end: 10,
|
|
102
|
+
seq: 'cattgttgcg',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
})
|
|
142
108
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
109
|
+
session.addTrackConf({
|
|
110
|
+
trackId: 'fooC',
|
|
111
|
+
assemblyNames: ['volMyt1'],
|
|
112
|
+
type: 'FeatureTrack',
|
|
113
|
+
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
114
|
+
})
|
|
115
|
+
session.addTrackConf({
|
|
116
|
+
trackId: 'barC',
|
|
117
|
+
assemblyNames: ['volMyt1'],
|
|
118
|
+
type: 'FeatureTrack',
|
|
119
|
+
adapter: { type: 'FromConfigAdapter', features: [] },
|
|
151
120
|
})
|
|
121
|
+
const firstView = session.addView('LinearGenomeView', {
|
|
122
|
+
displayedRegions: [
|
|
123
|
+
{
|
|
124
|
+
assemblyName: 'volMyt1',
|
|
125
|
+
refName: 'ctgA',
|
|
126
|
+
start: 0,
|
|
127
|
+
end: 1000,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
})
|
|
131
|
+
firstView.showTrack(session.sessionTracks[0].trackId)
|
|
132
|
+
firstView.showTrack(session.sessionTracks[1].trackId)
|
|
133
|
+
firstView.tracks[0].configuration.category.set(['Foo Category'])
|
|
134
|
+
firstView.tracks[1].configuration.category.set([
|
|
135
|
+
'Foo Category',
|
|
136
|
+
'Bar Category',
|
|
137
|
+
])
|
|
138
|
+
const model = firstView.activateTrackSelector()
|
|
139
|
+
|
|
140
|
+
const { container, findByTestId } = render(
|
|
141
|
+
<ThemeProvider theme={createJBrowseTheme()}>
|
|
142
|
+
{/* @ts-ignore*/}
|
|
143
|
+
<HierarchicalTrackSelector model={model} />
|
|
144
|
+
</ThemeProvider>,
|
|
145
|
+
)
|
|
146
|
+
await findByTestId('hierarchical_track_selector')
|
|
147
|
+
expect(container.firstChild).toMatchSnapshot()
|
|
152
148
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`renders nothing with no assembly 1`] = `
|
|
4
4
|
<button
|
|
5
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"
|
|
@@ -23,7 +23,7 @@ exports[`HierarchicalTrackSelector widget renders nothing with no assembly 1`] =
|
|
|
23
23
|
</button>
|
|
24
24
|
`;
|
|
25
25
|
|
|
26
|
-
exports[`
|
|
26
|
+
exports[`renders with a couple of categorized tracks 1`] = `
|
|
27
27
|
<div
|
|
28
28
|
data-testid="hierarchical_track_selector"
|
|
29
29
|
>
|
|
@@ -81,7 +81,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of categorized t
|
|
|
81
81
|
Filter tracks
|
|
82
82
|
</label>
|
|
83
83
|
<div
|
|
84
|
-
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-
|
|
84
|
+
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
|
|
85
85
|
>
|
|
86
86
|
<input
|
|
87
87
|
aria-invalid="false"
|
|
@@ -120,7 +120,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of categorized t
|
|
|
120
120
|
</div>
|
|
121
121
|
`;
|
|
122
122
|
|
|
123
|
-
exports[`
|
|
123
|
+
exports[`renders with a couple of uncategorized tracks 1`] = `
|
|
124
124
|
<div
|
|
125
125
|
data-testid="hierarchical_track_selector"
|
|
126
126
|
>
|
|
@@ -178,7 +178,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of uncategorized
|
|
|
178
178
|
Filter tracks
|
|
179
179
|
</label>
|
|
180
180
|
<div
|
|
181
|
-
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-
|
|
181
|
+
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
|
|
182
182
|
>
|
|
183
183
|
<input
|
|
184
184
|
aria-invalid="false"
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import stateModelFactory, { HierarchicalTrackSelectorModel } from './model'
|
|
2
2
|
import configSchema from './configSchema'
|
|
3
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
4
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
|
|
5
|
+
import { lazy } from 'react'
|
|
3
6
|
|
|
4
7
|
export { stateModelFactory, configSchema }
|
|
5
8
|
export type { HierarchicalTrackSelectorModel }
|
|
9
|
+
|
|
10
|
+
export default (pluginManager: PluginManager) => {
|
|
11
|
+
pluginManager.addWidgetType(() => {
|
|
12
|
+
return new WidgetType({
|
|
13
|
+
name: 'HierarchicalTrackSelectorWidget',
|
|
14
|
+
heading: 'Available tracks',
|
|
15
|
+
configSchema,
|
|
16
|
+
stateModel: stateModelFactory(pluginManager),
|
|
17
|
+
ReactComponent: lazy(
|
|
18
|
+
() => import('./components/HierarchicalTrackSelector'),
|
|
19
|
+
),
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
}
|