@jbrowse/plugin-legacy-jbrowse 2.1.4 → 2.1.5
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/JBrowse1Connection/model.d.ts +18 -5
- package/dist/JBrowse1Connection/model.js +12 -6
- package/dist/JBrowse1Connection/model.js.map +1 -1
- package/esm/JBrowse1Connection/model.d.ts +18 -5
- package/esm/JBrowse1Connection/model.js +12 -6
- package/esm/JBrowse1Connection/model.js.map +1 -1
- package/package.json +2 -2
- package/src/JBrowse1Connection/model.tsx +77 -0
- package/src/JBrowse1Connection/model.js +0 -69
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function (pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
2
3
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
3
|
-
tracks: import("mobx-state-tree").IArrayType<
|
|
4
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
4
5
|
} & {
|
|
5
6
|
configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
|
|
6
7
|
type: import("mobx-state-tree").ISimpleType<"JBrowse1Connection">;
|
|
7
8
|
}, {
|
|
8
9
|
afterAttach(): void;
|
|
9
|
-
addTrackConf(trackConf:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
addTrackConf(trackConf: {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
13
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
14
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
15
|
+
addTrackConfs(trackConfs: ({
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
18
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
19
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
20
|
+
setTrackConfs(trackConfs: ({
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
23
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
24
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
12
25
|
clear(): void;
|
|
13
26
|
} & {
|
|
14
27
|
connect(): void;
|
|
@@ -11,28 +11,34 @@ const configSchema_1 = __importDefault(require("./configSchema"));
|
|
|
11
11
|
const jb1ConfigLoad_1 = require("./jb1ConfigLoad");
|
|
12
12
|
const jb1ToJb2_1 = require("./jb1ToJb2");
|
|
13
13
|
function default_1(pluginManager) {
|
|
14
|
-
return mobx_state_tree_1.types
|
|
15
|
-
.model({
|
|
14
|
+
return mobx_state_tree_1.types
|
|
15
|
+
.compose('JBrowse1Connection', (0, models_1.BaseConnectionModelFactory)(pluginManager), mobx_state_tree_1.types.model({
|
|
16
16
|
configuration: (0, configuration_1.ConfigurationReference)(configSchema_1.default),
|
|
17
17
|
type: mobx_state_tree_1.types.literal('JBrowse1Connection'),
|
|
18
|
-
})
|
|
18
|
+
}))
|
|
19
19
|
.actions(self => ({
|
|
20
20
|
connect() {
|
|
21
21
|
const dataDirLocation = (0, configuration_1.readConfObject)(self.configuration, 'dataDirLocation');
|
|
22
22
|
const session = (0, util_1.getSession)(self);
|
|
23
23
|
(0, jb1ConfigLoad_1.fetchJb1)(dataDirLocation)
|
|
24
24
|
.then(config => {
|
|
25
|
+
var _a;
|
|
25
26
|
const assemblyName = (0, configuration_1.readConfObject)(self.configuration, 'assemblyNames')[0];
|
|
26
27
|
if (!assemblyName) {
|
|
27
28
|
throw new Error('assembly name required for JBrowse 1 connection');
|
|
28
29
|
}
|
|
29
30
|
const assemblyConf = session.assemblies.find(assembly => (0, configuration_1.readConfObject)(assembly, 'name') === assemblyName);
|
|
31
|
+
if (!assemblyConf) {
|
|
32
|
+
throw new Error(`Assembly "${assemblyName}" not found`);
|
|
33
|
+
}
|
|
30
34
|
const sequenceAdapter = (0, configuration_1.readConfObject)(assemblyConf, [
|
|
31
35
|
'sequence',
|
|
32
36
|
'adapter',
|
|
33
37
|
]);
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => {
|
|
40
|
+
const jb2Track = (0, jb1ToJb2_1.convertTrackConfig)(jb1Track, config.dataRoot || '', sequenceAdapter);
|
|
41
|
+
// @ts-ignore
|
|
36
42
|
jb2Track.assemblyNames = [assemblyName];
|
|
37
43
|
return jb2Track;
|
|
38
44
|
});
|
|
@@ -44,7 +50,7 @@ function default_1(pluginManager) {
|
|
|
44
50
|
session.breakConnection(self.configuration);
|
|
45
51
|
});
|
|
46
52
|
},
|
|
47
|
-
}))
|
|
53
|
+
}));
|
|
48
54
|
}
|
|
49
55
|
exports.default = default_1;
|
|
50
56
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/JBrowse1Connection/model.
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/JBrowse1Connection/model.tsx"],"names":[],"mappings":";;;;;AAAA,+DAGoC;AACpC,6CAA+C;AAC/C,uEAAuF;AACvF,qDAAuC;AACvC,kEAAyC;AAEzC,mDAA0C;AAC1C,yCAA+C;AAG/C,mBAAyB,aAA4B;IACnD,OAAO,uBAAK;SACT,OAAO,CACN,oBAAoB,EACpB,IAAA,mCAA0B,EAAC,aAAa,CAAC,EACzC,uB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,GAAG,CAAC,YAAY,CAAC,CAAA;oBACvC,OAAO,QAAQ,CAAA;gBACjB,CAAC,CAAC,CAAA;gBAEF,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;YAC/B,CAAC,CAAC;iBACD,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBACpB,OAAO,CAAC,MAAM,CACZ,mEAAmE,IAAI,CAAC,IAAI,yFAAyF,KAAK,GAAG,EAC7K,OAAO,CACR,CAAA;gBACD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;QACN,CAAC;KACF,CAAC,CAAC,CAAA;AACP,CAAC;AA/DD,4BA+DC"}
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function (pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
2
3
|
name: import("mobx-state-tree").ISimpleType<string>;
|
|
3
|
-
tracks: import("mobx-state-tree").IArrayType<
|
|
4
|
+
tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
|
|
4
5
|
} & {
|
|
5
6
|
configuration: import("mobx-state-tree").ITypeUnion<any, any, any>;
|
|
6
7
|
type: import("mobx-state-tree").ISimpleType<"JBrowse1Connection">;
|
|
7
8
|
}, {
|
|
8
9
|
afterAttach(): void;
|
|
9
|
-
addTrackConf(trackConf:
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
addTrackConf(trackConf: {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
13
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
14
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>): any;
|
|
15
|
+
addTrackConfs(trackConfs: ({
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
18
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
19
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): any[];
|
|
20
|
+
setTrackConfs(trackConfs: ({
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
23
|
+
setSubschema(slotName: string, data: unknown): any;
|
|
24
|
+
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[]): import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyModelType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>>;
|
|
12
25
|
clear(): void;
|
|
13
26
|
} & {
|
|
14
27
|
connect(): void;
|
|
@@ -6,28 +6,34 @@ import configSchema from './configSchema';
|
|
|
6
6
|
import { fetchJb1 } from './jb1ConfigLoad';
|
|
7
7
|
import { convertTrackConfig } from './jb1ToJb2';
|
|
8
8
|
export default function (pluginManager) {
|
|
9
|
-
return types
|
|
10
|
-
.model({
|
|
9
|
+
return types
|
|
10
|
+
.compose('JBrowse1Connection', BaseConnectionModelFactory(pluginManager), types.model({
|
|
11
11
|
configuration: ConfigurationReference(configSchema),
|
|
12
12
|
type: types.literal('JBrowse1Connection'),
|
|
13
|
-
})
|
|
13
|
+
}))
|
|
14
14
|
.actions(self => ({
|
|
15
15
|
connect() {
|
|
16
16
|
const dataDirLocation = readConfObject(self.configuration, 'dataDirLocation');
|
|
17
17
|
const session = getSession(self);
|
|
18
18
|
fetchJb1(dataDirLocation)
|
|
19
19
|
.then(config => {
|
|
20
|
+
var _a;
|
|
20
21
|
const assemblyName = readConfObject(self.configuration, 'assemblyNames')[0];
|
|
21
22
|
if (!assemblyName) {
|
|
22
23
|
throw new Error('assembly name required for JBrowse 1 connection');
|
|
23
24
|
}
|
|
24
25
|
const assemblyConf = session.assemblies.find(assembly => readConfObject(assembly, 'name') === assemblyName);
|
|
26
|
+
if (!assemblyConf) {
|
|
27
|
+
throw new Error(`Assembly "${assemblyName}" not found`);
|
|
28
|
+
}
|
|
25
29
|
const sequenceAdapter = readConfObject(assemblyConf, [
|
|
26
30
|
'sequence',
|
|
27
31
|
'adapter',
|
|
28
32
|
]);
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const jb2Tracks = (_a = config.tracks) === null || _a === void 0 ? void 0 : _a.map(jb1Track => {
|
|
35
|
+
const jb2Track = convertTrackConfig(jb1Track, config.dataRoot || '', sequenceAdapter);
|
|
36
|
+
// @ts-ignore
|
|
31
37
|
jb2Track.assemblyNames = [assemblyName];
|
|
32
38
|
return jb2Track;
|
|
33
39
|
});
|
|
@@ -39,6 +45,6 @@ export default function (pluginManager) {
|
|
|
39
45
|
session.breakConnection(self.configuration);
|
|
40
46
|
});
|
|
41
47
|
},
|
|
42
|
-
}))
|
|
48
|
+
}));
|
|
43
49
|
}
|
|
44
50
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/JBrowse1Connection/model.
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/JBrowse1Connection/model.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,cAAc,GACf,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA;AACvF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY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AI,EAAE,EACrB,eAAe,CAChB,CAAA;oBAED,aAAa;oBACb,QAAQ,CAAC,aAAa,GAAG,CAAC,YAAY,CAAC,CAAA;oBACvC,OAAO,QAAQ,CAAA;gBACjB,CAAC,CAAC,CAAA;gBAEF,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;YAC/B,CAAC,CAAC;iBACD,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBACpB,OAAO,CAAC,MAAM,CACZ,mEAAmE,IAAI,CAAC,IAAI,yFAAyF,KAAK,GAAG,EAC7K,OAAO,CACR,CAAA;gBACD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;QACN,CAAC;KACF,CAAC,CAAC,CAAA;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-legacy-jbrowse",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"distModule": "esm/index.js",
|
|
57
57
|
"srcModule": "src/index.ts",
|
|
58
58
|
"module": "esm/index.js",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "bc5253ecdddeceeb999fffebf6dc6cf5f444e1c9"
|
|
60
60
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigurationReference,
|
|
3
|
+
readConfObject,
|
|
4
|
+
} from '@jbrowse/core/configuration'
|
|
5
|
+
import { getSession } from '@jbrowse/core/util'
|
|
6
|
+
import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'
|
|
7
|
+
import { types } from 'mobx-state-tree'
|
|
8
|
+
import configSchema from './configSchema'
|
|
9
|
+
|
|
10
|
+
import { fetchJb1 } from './jb1ConfigLoad'
|
|
11
|
+
import { convertTrackConfig } from './jb1ToJb2'
|
|
12
|
+
import PluginManager from '@jbrowse/core/PluginManager'
|
|
13
|
+
|
|
14
|
+
export default function (pluginManager: PluginManager) {
|
|
15
|
+
return types
|
|
16
|
+
.compose(
|
|
17
|
+
'JBrowse1Connection',
|
|
18
|
+
BaseConnectionModelFactory(pluginManager),
|
|
19
|
+
types.model({
|
|
20
|
+
configuration: ConfigurationReference(configSchema),
|
|
21
|
+
type: types.literal('JBrowse1Connection'),
|
|
22
|
+
}),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
.actions(self => ({
|
|
26
|
+
connect() {
|
|
27
|
+
const dataDirLocation = readConfObject(
|
|
28
|
+
self.configuration,
|
|
29
|
+
'dataDirLocation',
|
|
30
|
+
)
|
|
31
|
+
const session = getSession(self)
|
|
32
|
+
fetchJb1(dataDirLocation)
|
|
33
|
+
.then(config => {
|
|
34
|
+
const assemblyName = readConfObject(
|
|
35
|
+
self.configuration,
|
|
36
|
+
'assemblyNames',
|
|
37
|
+
)[0]
|
|
38
|
+
if (!assemblyName) {
|
|
39
|
+
throw new Error('assembly name required for JBrowse 1 connection')
|
|
40
|
+
}
|
|
41
|
+
const assemblyConf = session.assemblies.find(
|
|
42
|
+
assembly => readConfObject(assembly, 'name') === assemblyName,
|
|
43
|
+
)
|
|
44
|
+
if (!assemblyConf) {
|
|
45
|
+
throw new Error(`Assembly "${assemblyName}" not found`)
|
|
46
|
+
}
|
|
47
|
+
const sequenceAdapter = readConfObject(assemblyConf, [
|
|
48
|
+
'sequence',
|
|
49
|
+
'adapter',
|
|
50
|
+
])
|
|
51
|
+
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
const jb2Tracks = config.tracks?.map(jb1Track => {
|
|
54
|
+
const jb2Track = convertTrackConfig(
|
|
55
|
+
jb1Track,
|
|
56
|
+
config.dataRoot || '',
|
|
57
|
+
sequenceAdapter,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
jb2Track.assemblyNames = [assemblyName]
|
|
62
|
+
return jb2Track
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
self.setTrackConfs(jb2Tracks)
|
|
66
|
+
})
|
|
67
|
+
.catch(error => {
|
|
68
|
+
console.error(error)
|
|
69
|
+
session.notify(
|
|
70
|
+
`There was a problem connecting to the JBrowse 1 data directory "${self.name}". Please make sure you have entered a valid location. The error that was thrown is: "${error}"`,
|
|
71
|
+
'error',
|
|
72
|
+
)
|
|
73
|
+
session.breakConnection(self.configuration)
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
}))
|
|
77
|
+
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigurationReference,
|
|
3
|
-
readConfObject,
|
|
4
|
-
} from '@jbrowse/core/configuration'
|
|
5
|
-
import { getSession } from '@jbrowse/core/util'
|
|
6
|
-
import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'
|
|
7
|
-
import { types } from 'mobx-state-tree'
|
|
8
|
-
import configSchema from './configSchema'
|
|
9
|
-
|
|
10
|
-
import { fetchJb1 } from './jb1ConfigLoad'
|
|
11
|
-
import { convertTrackConfig } from './jb1ToJb2'
|
|
12
|
-
|
|
13
|
-
export default function (pluginManager) {
|
|
14
|
-
return types.compose(
|
|
15
|
-
'JBrowse1Connection',
|
|
16
|
-
BaseConnectionModelFactory(pluginManager),
|
|
17
|
-
types
|
|
18
|
-
.model({
|
|
19
|
-
configuration: ConfigurationReference(configSchema),
|
|
20
|
-
type: types.literal('JBrowse1Connection'),
|
|
21
|
-
})
|
|
22
|
-
.actions(self => ({
|
|
23
|
-
connect() {
|
|
24
|
-
const dataDirLocation = readConfObject(
|
|
25
|
-
self.configuration,
|
|
26
|
-
'dataDirLocation',
|
|
27
|
-
)
|
|
28
|
-
const session = getSession(self)
|
|
29
|
-
fetchJb1(dataDirLocation)
|
|
30
|
-
.then(config => {
|
|
31
|
-
const assemblyName = readConfObject(
|
|
32
|
-
self.configuration,
|
|
33
|
-
'assemblyNames',
|
|
34
|
-
)[0]
|
|
35
|
-
if (!assemblyName) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
'assembly name required for JBrowse 1 connection',
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
const assemblyConf = session.assemblies.find(
|
|
41
|
-
assembly => readConfObject(assembly, 'name') === assemblyName,
|
|
42
|
-
)
|
|
43
|
-
const sequenceAdapter = readConfObject(assemblyConf, [
|
|
44
|
-
'sequence',
|
|
45
|
-
'adapter',
|
|
46
|
-
])
|
|
47
|
-
const jb2Tracks = config.tracks.map(jb1Track => {
|
|
48
|
-
const jb2Track = convertTrackConfig(
|
|
49
|
-
jb1Track,
|
|
50
|
-
config.dataRoot,
|
|
51
|
-
sequenceAdapter,
|
|
52
|
-
)
|
|
53
|
-
jb2Track.assemblyNames = [assemblyName]
|
|
54
|
-
return jb2Track
|
|
55
|
-
})
|
|
56
|
-
self.setTrackConfs(jb2Tracks)
|
|
57
|
-
})
|
|
58
|
-
.catch(error => {
|
|
59
|
-
console.error(error)
|
|
60
|
-
session.notify(
|
|
61
|
-
`There was a problem connecting to the JBrowse 1 data directory "${self.name}". Please make sure you have entered a valid location. The error that was thrown is: "${error}"`,
|
|
62
|
-
'error',
|
|
63
|
-
)
|
|
64
|
-
session.breakConnection(self.configuration)
|
|
65
|
-
})
|
|
66
|
-
},
|
|
67
|
-
})),
|
|
68
|
-
)
|
|
69
|
-
}
|