@jbrowse/plugin-data-management 3.6.2 → 3.6.4

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 (61) hide show
  1. package/dist/AddTrackWidget/components/DefaultAddTrackWorkflow.js +1 -1
  2. package/dist/AddTrackWidget/model.js +1 -0
  3. package/dist/HierarchicalTrackSelectorWidget/filterTracks.js +6 -6
  4. package/dist/JB2TrackHubConnection/addRelativeUris.d.ts +1 -0
  5. package/dist/JB2TrackHubConnection/addRelativeUris.js +15 -0
  6. package/dist/JB2TrackHubConnection/configSchema.d.ts +27 -0
  7. package/dist/JB2TrackHubConnection/configSchema.js +34 -0
  8. package/dist/JB2TrackHubConnection/doConnect.js +34 -0
  9. package/dist/JB2TrackHubConnection/index.d.ts +2 -0
  10. package/dist/JB2TrackHubConnection/index.js +21 -0
  11. package/dist/JB2TrackHubConnection/model.d.ts +75 -0
  12. package/dist/JB2TrackHubConnection/model.js +56 -0
  13. package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/ucscTrackHub.d.ts +0 -1
  14. package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/ucscTrackHub.js +0 -6
  15. package/dist/UCSCTrackHubConnection/util.js +41 -0
  16. package/dist/index.js +4 -2
  17. package/esm/AddTrackWidget/components/DefaultAddTrackWorkflow.js +1 -1
  18. package/esm/AddTrackWidget/model.js +1 -0
  19. package/esm/HierarchicalTrackSelectorWidget/filterTracks.js +6 -6
  20. package/esm/JB2TrackHubConnection/addRelativeUris.d.ts +1 -0
  21. package/esm/JB2TrackHubConnection/addRelativeUris.js +12 -0
  22. package/esm/JB2TrackHubConnection/configSchema.d.ts +27 -0
  23. package/esm/JB2TrackHubConnection/configSchema.js +32 -0
  24. package/esm/JB2TrackHubConnection/doConnect.d.ts +5 -0
  25. package/esm/JB2TrackHubConnection/doConnect.js +31 -0
  26. package/esm/JB2TrackHubConnection/index.d.ts +2 -0
  27. package/esm/JB2TrackHubConnection/index.js +15 -0
  28. package/esm/JB2TrackHubConnection/model.d.ts +75 -0
  29. package/esm/JB2TrackHubConnection/model.js +17 -0
  30. package/esm/JB2TrackHubConnection/util.d.ts +22 -0
  31. package/esm/UCSCTrackHubConnection/doConnect.d.ts +5 -0
  32. package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/ucscTrackHub.d.ts +0 -1
  33. package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/ucscTrackHub.js +0 -1
  34. package/esm/UCSCTrackHubConnection/util.d.ts +22 -0
  35. package/esm/UCSCTrackHubConnection/util.js +33 -0
  36. package/esm/index.js +3 -1
  37. package/package.json +5 -5
  38. /package/dist/{UCSCTrackHub → JB2TrackHubConnection}/doConnect.d.ts +0 -0
  39. /package/dist/{UCSCTrackHub → JB2TrackHubConnection}/util.d.ts +0 -0
  40. /package/dist/{UCSCTrackHub → JB2TrackHubConnection}/util.js +0 -0
  41. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/configSchema.d.ts +0 -0
  42. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/configSchema.js +0 -0
  43. /package/{esm/UCSCTrackHub → dist/UCSCTrackHubConnection}/doConnect.d.ts +0 -0
  44. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/doConnect.js +0 -0
  45. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/index.d.ts +0 -0
  46. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/index.js +0 -0
  47. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/model.d.ts +0 -0
  48. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/model.js +0 -0
  49. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/ucscAssemblies.d.ts +0 -0
  50. /package/dist/{UCSCTrackHub → UCSCTrackHubConnection}/ucscAssemblies.js +0 -0
  51. /package/{esm/UCSCTrackHub → dist/UCSCTrackHubConnection}/util.d.ts +0 -0
  52. /package/esm/{UCSCTrackHub → JB2TrackHubConnection}/util.js +0 -0
  53. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/configSchema.d.ts +0 -0
  54. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/configSchema.js +0 -0
  55. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/doConnect.js +0 -0
  56. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/index.d.ts +0 -0
  57. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/index.js +0 -0
  58. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/model.d.ts +0 -0
  59. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/model.js +0 -0
  60. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/ucscAssemblies.d.ts +0 -0
  61. /package/esm/{UCSCTrackHub → UCSCTrackHubConnection}/ucscAssemblies.js +0 -0
@@ -57,7 +57,7 @@ const DefaultAddTrackWorkflow = (0, mobx_react_1.observer)(function ({ model, })
57
57
  }
58
58
  return ((0, jsx_runtime_1.jsx)("div", { className: classes.root, children: (0, jsx_runtime_1.jsx)(material_1.Stepper, { className: classes.stepper, activeStep: activeStep, orientation: "vertical", children: steps.map((label, idx) => ((0, jsx_runtime_1.jsxs)(material_1.Step, { children: [(0, jsx_runtime_1.jsx)(material_1.StepLabel, { children: label }), (0, jsx_runtime_1.jsxs)(material_1.StepContent, { children: [getStepContent(idx), (0, jsx_runtime_1.jsxs)("div", { className: classes.actionsContainer, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { disabled: activeStep === 0, className: classes.button, onClick: () => {
59
59
  setActiveStep(activeStep - 1);
60
- }, children: "Back" }), (0, jsx_runtime_1.jsx)(material_1.Button, { disabled: isNextDisabled(), variant: "contained", color: "primary", onClick: () => {
60
+ }, "data-testid": "addTrackBackButton", children: "Back" }), (0, jsx_runtime_1.jsx)(material_1.Button, { disabled: isNextDisabled(), variant: "contained", color: "primary", onClick: () => {
61
61
  if (activeStep !== steps.length - 1) {
62
62
  setActiveStep(activeStep + 1);
63
63
  }
@@ -56,6 +56,7 @@ function f(pluginManager) {
56
56
  },
57
57
  setTrackData(obj) {
58
58
  self.trackData = obj;
59
+ self.adapterHint = '';
59
60
  },
60
61
  setIndexTrackData(obj) {
61
62
  self.indexTrackData = obj;
@@ -11,16 +11,16 @@ function filterTracks(tracks, self) {
11
11
  if (!view) {
12
12
  return [];
13
13
  }
14
- const trackListAssemblies = self.assemblyNames
15
- .map(a => assemblyManager.get(a))
14
+ const viewAssemblyNames = self.assemblyNames
15
+ .map(a => assemblyManager.getCanonicalAssemblyName(a))
16
16
  .filter(util_1.notEmpty);
17
17
  return tracks
18
18
  .filter(c => {
19
- const trackAssemblyNames = (0, configuration_1.readConfObject)(c, 'assemblyNames');
20
- const trackAssemblies = trackAssemblyNames === null || trackAssemblyNames === void 0 ? void 0 : trackAssemblyNames.map(name => assemblyManager.get(name)).filter(util_1.notEmpty);
19
+ const trackConfigAssemblyNames = (0, configuration_1.readConfObject)(c, 'assemblyNames');
20
+ const trackCanonicalAssemblyNames = trackConfigAssemblyNames === null || trackConfigAssemblyNames === void 0 ? void 0 : trackConfigAssemblyNames.map(name => assemblyManager.getCanonicalAssemblyName(name)).filter(util_1.notEmpty);
21
21
  return view.trackSelectorAnyOverlap
22
- ? (0, util_2.hasAnyOverlap)(trackAssemblies, trackListAssemblies)
23
- : (0, util_2.hasAllOverlap)(trackAssemblies, trackListAssemblies);
22
+ ? (0, util_2.hasAnyOverlap)(trackCanonicalAssemblyNames, viewAssemblyNames)
23
+ : (0, util_2.hasAllOverlap)(trackCanonicalAssemblyNames, viewAssemblyNames);
24
24
  })
25
25
  .filter(c => {
26
26
  const { displayTypes } = pluginManager.getViewType(view.type);
@@ -0,0 +1 @@
1
+ export declare function addRelativeUris(config: Record<string, unknown> | null, base: URL): void;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addRelativeUris = addRelativeUris;
4
+ function addRelativeUris(config, base) {
5
+ if (typeof config === 'object' && config !== null) {
6
+ for (const key of Object.keys(config)) {
7
+ if (typeof config[key] === 'object' && config[key] !== null) {
8
+ addRelativeUris(config[key], base);
9
+ }
10
+ else if (key === 'uri') {
11
+ config.baseUri = base.href;
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ declare const JB2TrackHubConnection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ configJsonLocation: {
3
+ type: string;
4
+ defaultValue: {
5
+ uri: string;
6
+ locationType: string;
7
+ };
8
+ description: string;
9
+ };
10
+ assemblyNames: {
11
+ type: string;
12
+ defaultValue: never[];
13
+ description: string;
14
+ };
15
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
16
+ name: {
17
+ type: string;
18
+ defaultValue: string;
19
+ description: string;
20
+ };
21
+ assemblyNames: {
22
+ type: string;
23
+ defaultValue: never[];
24
+ description: string;
25
+ };
26
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
27
+ export default JB2TrackHubConnection;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const configuration_1 = require("@jbrowse/core/configuration");
4
+ const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
5
+ function x() { }
6
+ const JB2TrackHubConnection = (0, configuration_1.ConfigurationSchema)('JB2TrackHubConnection', {
7
+ configJsonLocation: {
8
+ type: 'fileLocation',
9
+ defaultValue: {
10
+ uri: 'http://mysite.com/path/to/config.json',
11
+ locationType: 'UriLocation',
12
+ },
13
+ description: 'location of the jb2 config file (usually called config.json)',
14
+ },
15
+ assemblyNames: {
16
+ type: 'stringArray',
17
+ defaultValue: [],
18
+ description: 'optional list of genomes to import from this config.json, if empty all genomes will be imported',
19
+ },
20
+ }, {
21
+ baseConfiguration: models_1.baseConnectionConfig,
22
+ preProcessSnapshot: snap => {
23
+ return snap.uri
24
+ ? {
25
+ ...snap,
26
+ configJsonLocation: {
27
+ uri: snap.uri,
28
+ baseUri: snap.baseUri,
29
+ },
30
+ }
31
+ : snap;
32
+ },
33
+ });
34
+ exports.default = JB2TrackHubConnection;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doConnect = doConnect;
4
+ const configuration_1 = require("@jbrowse/core/configuration");
5
+ const util_1 = require("@jbrowse/core/util");
6
+ const io_1 = require("@jbrowse/core/util/io");
7
+ const addRelativeUris_1 = require("./addRelativeUris");
8
+ const util_2 = require("./util");
9
+ async function doConnect(self) {
10
+ var _a;
11
+ const session = (0, util_1.getSession)(self);
12
+ try {
13
+ const configJsonLocation = (0, configuration_1.getConf)(self, 'configJsonLocation');
14
+ const configJson = JSON.parse(await (0, io_1.openLocation)(configJsonLocation).readFile('utf8'));
15
+ const configUri = (0, util_2.resolve)(configJsonLocation.uri, configJsonLocation.baseUri);
16
+ (0, addRelativeUris_1.addRelativeUris)(configJson, new URL(configUri));
17
+ if (configJson.assemblies) {
18
+ for (const assembly of configJson.assemblies) {
19
+ if (!session.assemblyManager.get(assembly.name)) {
20
+ session.addSessionAssembly(assembly);
21
+ }
22
+ }
23
+ }
24
+ if (configJson.tracks) {
25
+ self.addTrackConfs(configJson.tracks);
26
+ }
27
+ session.notify('Successfully loaded', 'success');
28
+ }
29
+ catch (e) {
30
+ console.error(e);
31
+ session.notifyError(`${(0, configuration_1.getConf)(self, 'name')}: "${e}"`, e);
32
+ (_a = session.breakConnection) === null || _a === void 0 ? void 0 : _a.call(session, self.configuration);
33
+ }
34
+ }
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function JB2TrackHubConnectionF(pluginManager: PluginManager): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = JB2TrackHubConnectionF;
7
+ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
8
+ const configSchema_1 = __importDefault(require("./configSchema"));
9
+ const model_1 = __importDefault(require("./model"));
10
+ function JB2TrackHubConnectionF(pluginManager) {
11
+ pluginManager.addConnectionType(() => {
12
+ return new pluggableElementTypes_1.ConnectionType({
13
+ name: 'JB2TrackHubConnection',
14
+ configSchema: configSchema_1.default,
15
+ stateModel: (0, model_1.default)(pluginManager),
16
+ displayName: 'JB2 Track Hub',
17
+ description: 'A JBrowse 2 config file based trackhub',
18
+ url: 'https://jbrowse.org/jb2/',
19
+ });
20
+ });
21
+ }
@@ -0,0 +1,75 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function JB2TrackHubConnection(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
3
+ name: import("mobx-state-tree").ISimpleType<string>;
4
+ tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
5
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
+ name: {
7
+ type: string;
8
+ defaultValue: string;
9
+ description: string;
10
+ };
11
+ assemblyNames: {
12
+ type: string;
13
+ defaultValue: never[];
14
+ description: string;
15
+ };
16
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
+ } & {
18
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
+ configJsonLocation: {
20
+ type: string;
21
+ defaultValue: {
22
+ uri: string;
23
+ locationType: string;
24
+ };
25
+ description: string;
26
+ };
27
+ assemblyNames: {
28
+ type: string;
29
+ defaultValue: never[];
30
+ description: string;
31
+ };
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
+ name: {
34
+ type: string;
35
+ defaultValue: string;
36
+ description: string;
37
+ };
38
+ assemblyNames: {
39
+ type: string;
40
+ defaultValue: never[];
41
+ description: string;
42
+ };
43
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
+ type: import("mobx-state-tree").ISimpleType<"JB2TrackHubConnection">;
45
+ }, {
46
+ connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
+ } & {
48
+ afterAttach(): void;
49
+ addTrackConf(trackConf: ({
50
+ [x: string]: any;
51
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
+ [x: string]: any;
54
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
55
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
56
+ [x: string]: any;
57
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
59
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>): any;
60
+ addTrackConfs(trackConfs: (({
61
+ [x: string]: any;
62
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
+ [x: string]: any;
65
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
66
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
67
+ [x: string]: any;
68
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
70
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>)[]): void;
71
+ setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
72
+ clear(): void;
73
+ } & {
74
+ connect(): Promise<void>;
75
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.default = JB2TrackHubConnection;
40
+ const configuration_1 = require("@jbrowse/core/configuration");
41
+ const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
42
+ const mobx_state_tree_1 = require("mobx-state-tree");
43
+ const configSchema_1 = __importDefault(require("./configSchema"));
44
+ function JB2TrackHubConnection(pluginManager) {
45
+ return mobx_state_tree_1.types
46
+ .compose('JB2TrackHubConnection', (0, models_1.BaseConnectionModelFactory)(pluginManager), mobx_state_tree_1.types.model({
47
+ configuration: (0, configuration_1.ConfigurationReference)(configSchema_1.default),
48
+ type: mobx_state_tree_1.types.literal('JB2TrackHubConnection'),
49
+ }))
50
+ .actions(self => ({
51
+ async connect() {
52
+ const { doConnect } = await Promise.resolve().then(() => __importStar(require('./doConnect')));
53
+ doConnect(self);
54
+ },
55
+ }));
56
+ }
@@ -180,4 +180,3 @@ export declare function generateTracks({ trackDb, trackDbLoc, assemblyName, sequ
180
180
  };
181
181
  category: (string | undefined)[];
182
182
  })[];
183
- export { default as ucscAssemblies } from './ucscAssemblies';
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ucscAssemblies = void 0;
7
3
  exports.generateTracks = generateTracks;
8
4
  const util_1 = require("@jbrowse/core/util");
9
5
  const tracks_1 = require("@jbrowse/core/util/tracks");
@@ -164,5 +160,3 @@ function makeTrackConfig({ track, trackDbLoc, trackDb, sequenceAdapter, }) {
164
160
  return (0, tracks_1.generateUnknownTrackConf)(name, baseTrackType);
165
161
  }
166
162
  }
167
- var ucscAssemblies_1 = require("./ucscAssemblies");
168
- Object.defineProperty(exports, "ucscAssemblies", { enumerable: true, get: function () { return __importDefault(ucscAssemblies_1).default; } });
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchGenomesFile = fetchGenomesFile;
4
+ exports.fetchTrackDbFile = fetchTrackDbFile;
5
+ exports.makeLoc = makeLoc;
6
+ exports.makeLocAlt = makeLocAlt;
7
+ exports.makeLoc2 = makeLoc2;
8
+ exports.resolve = resolve;
9
+ const ucsc_hub_1 = require("@gmod/ucsc-hub");
10
+ const io_1 = require("@jbrowse/core/util/io");
11
+ async function fetchGenomesFile(genomesLoc) {
12
+ const genomesFileText = await (0, io_1.openLocation)(genomesLoc).readFile('utf8');
13
+ return new ucsc_hub_1.GenomesFile(genomesFileText);
14
+ }
15
+ async function fetchTrackDbFile(trackDbLoc) {
16
+ const text = await (0, io_1.openLocation)(trackDbLoc).readFile('utf8');
17
+ return new ucsc_hub_1.TrackDbFile(text);
18
+ }
19
+ function makeLoc(first, base) {
20
+ return {
21
+ uri: new URL(first, new URL(base.uri, base.baseUri)).href,
22
+ locationType: 'UriLocation',
23
+ };
24
+ }
25
+ function makeLocAlt(first, alt, base) {
26
+ return first ? makeLoc(first, base) : makeLoc(alt, base);
27
+ }
28
+ function makeLoc2(first, alt) {
29
+ return first
30
+ ? {
31
+ uri: first,
32
+ locationType: 'LocalPath',
33
+ }
34
+ : {
35
+ uri: alt,
36
+ locationType: 'UriLocation',
37
+ };
38
+ }
39
+ function resolve(uri, baseUri) {
40
+ return new URL(uri, baseUri).href;
41
+ }
package/dist/index.js CHANGED
@@ -42,8 +42,9 @@ const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
42
42
  const AddConnectionWidget_1 = __importDefault(require("./AddConnectionWidget"));
43
43
  const AddTrackWidget_1 = __importDefault(require("./AddTrackWidget"));
44
44
  const HierarchicalTrackSelectorWidget_1 = __importDefault(require("./HierarchicalTrackSelectorWidget"));
45
+ const JB2TrackHubConnection_1 = __importDefault(require("./JB2TrackHubConnection"));
45
46
  const PluginStoreWidget_1 = __importDefault(require("./PluginStoreWidget"));
46
- const UCSCTrackHub_1 = __importDefault(require("./UCSCTrackHub"));
47
+ const UCSCTrackHubConnection_1 = __importDefault(require("./UCSCTrackHubConnection"));
47
48
  const AssemblyManager = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./AssemblyManager'))));
48
49
  exports.AssemblyManager = AssemblyManager;
49
50
  class DataManagementPlugin extends Plugin_1.default {
@@ -55,7 +56,8 @@ class DataManagementPlugin extends Plugin_1.default {
55
56
  };
56
57
  }
57
58
  install(pluginManager) {
58
- (0, UCSCTrackHub_1.default)(pluginManager);
59
+ (0, UCSCTrackHubConnection_1.default)(pluginManager);
60
+ (0, JB2TrackHubConnection_1.default)(pluginManager);
59
61
  (0, AddTrackWidget_1.default)(pluginManager);
60
62
  (0, HierarchicalTrackSelectorWidget_1.default)(pluginManager);
61
63
  (0, AddConnectionWidget_1.default)(pluginManager);
@@ -52,7 +52,7 @@ const DefaultAddTrackWorkflow = observer(function ({ model, }) {
52
52
  }
53
53
  return (_jsx("div", { className: classes.root, children: _jsx(Stepper, { className: classes.stepper, activeStep: activeStep, orientation: "vertical", children: steps.map((label, idx) => (_jsxs(Step, { children: [_jsx(StepLabel, { children: label }), _jsxs(StepContent, { children: [getStepContent(idx), _jsxs("div", { className: classes.actionsContainer, children: [_jsx(Button, { disabled: activeStep === 0, className: classes.button, onClick: () => {
54
54
  setActiveStep(activeStep - 1);
55
- }, children: "Back" }), _jsx(Button, { disabled: isNextDisabled(), variant: "contained", color: "primary", onClick: () => {
55
+ }, "data-testid": "addTrackBackButton", children: "Back" }), _jsx(Button, { disabled: isNextDisabled(), variant: "contained", color: "primary", onClick: () => {
56
56
  if (activeStep !== steps.length - 1) {
57
57
  setActiveStep(activeStep + 1);
58
58
  }
@@ -50,6 +50,7 @@ export default function f(pluginManager) {
50
50
  },
51
51
  setTrackData(obj) {
52
52
  self.trackData = obj;
53
+ self.adapterHint = '';
53
54
  },
54
55
  setIndexTrackData(obj) {
55
56
  self.indexTrackData = obj;
@@ -8,16 +8,16 @@ export function filterTracks(tracks, self) {
8
8
  if (!view) {
9
9
  return [];
10
10
  }
11
- const trackListAssemblies = self.assemblyNames
12
- .map(a => assemblyManager.get(a))
11
+ const viewAssemblyNames = self.assemblyNames
12
+ .map(a => assemblyManager.getCanonicalAssemblyName(a))
13
13
  .filter(notEmpty);
14
14
  return tracks
15
15
  .filter(c => {
16
- const trackAssemblyNames = readConfObject(c, 'assemblyNames');
17
- const trackAssemblies = trackAssemblyNames === null || trackAssemblyNames === void 0 ? void 0 : trackAssemblyNames.map(name => assemblyManager.get(name)).filter(notEmpty);
16
+ const trackConfigAssemblyNames = readConfObject(c, 'assemblyNames');
17
+ const trackCanonicalAssemblyNames = trackConfigAssemblyNames === null || trackConfigAssemblyNames === void 0 ? void 0 : trackConfigAssemblyNames.map(name => assemblyManager.getCanonicalAssemblyName(name)).filter(notEmpty);
18
18
  return view.trackSelectorAnyOverlap
19
- ? hasAnyOverlap(trackAssemblies, trackListAssemblies)
20
- : hasAllOverlap(trackAssemblies, trackListAssemblies);
19
+ ? hasAnyOverlap(trackCanonicalAssemblyNames, viewAssemblyNames)
20
+ : hasAllOverlap(trackCanonicalAssemblyNames, viewAssemblyNames);
21
21
  })
22
22
  .filter(c => {
23
23
  const { displayTypes } = pluginManager.getViewType(view.type);
@@ -0,0 +1 @@
1
+ export declare function addRelativeUris(config: Record<string, unknown> | null, base: URL): void;
@@ -0,0 +1,12 @@
1
+ export function addRelativeUris(config, base) {
2
+ if (typeof config === 'object' && config !== null) {
3
+ for (const key of Object.keys(config)) {
4
+ if (typeof config[key] === 'object' && config[key] !== null) {
5
+ addRelativeUris(config[key], base);
6
+ }
7
+ else if (key === 'uri') {
8
+ config.baseUri = base.href;
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,27 @@
1
+ declare const JB2TrackHubConnection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ configJsonLocation: {
3
+ type: string;
4
+ defaultValue: {
5
+ uri: string;
6
+ locationType: string;
7
+ };
8
+ description: string;
9
+ };
10
+ assemblyNames: {
11
+ type: string;
12
+ defaultValue: never[];
13
+ description: string;
14
+ };
15
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
16
+ name: {
17
+ type: string;
18
+ defaultValue: string;
19
+ description: string;
20
+ };
21
+ assemblyNames: {
22
+ type: string;
23
+ defaultValue: never[];
24
+ description: string;
25
+ };
26
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
27
+ export default JB2TrackHubConnection;
@@ -0,0 +1,32 @@
1
+ import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
+ import { baseConnectionConfig } from '@jbrowse/core/pluggableElementTypes/models';
3
+ function x() { }
4
+ const JB2TrackHubConnection = ConfigurationSchema('JB2TrackHubConnection', {
5
+ configJsonLocation: {
6
+ type: 'fileLocation',
7
+ defaultValue: {
8
+ uri: 'http://mysite.com/path/to/config.json',
9
+ locationType: 'UriLocation',
10
+ },
11
+ description: 'location of the jb2 config file (usually called config.json)',
12
+ },
13
+ assemblyNames: {
14
+ type: 'stringArray',
15
+ defaultValue: [],
16
+ description: 'optional list of genomes to import from this config.json, if empty all genomes will be imported',
17
+ },
18
+ }, {
19
+ baseConfiguration: baseConnectionConfig,
20
+ preProcessSnapshot: snap => {
21
+ return snap.uri
22
+ ? {
23
+ ...snap,
24
+ configJsonLocation: {
25
+ uri: snap.uri,
26
+ baseUri: snap.baseUri,
27
+ },
28
+ }
29
+ : snap;
30
+ },
31
+ });
32
+ export default JB2TrackHubConnection;
@@ -0,0 +1,5 @@
1
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
+ export declare function doConnect(self: {
3
+ configuration: AnyConfigurationModel;
4
+ addTrackConfs: (arg: Record<string, unknown>[]) => void;
5
+ }): Promise<void>;
@@ -0,0 +1,31 @@
1
+ import { getConf } from '@jbrowse/core/configuration';
2
+ import { getSession } from '@jbrowse/core/util';
3
+ import { openLocation } from '@jbrowse/core/util/io';
4
+ import { addRelativeUris } from './addRelativeUris';
5
+ import { resolve } from './util';
6
+ export async function doConnect(self) {
7
+ var _a;
8
+ const session = getSession(self);
9
+ try {
10
+ const configJsonLocation = getConf(self, 'configJsonLocation');
11
+ const configJson = JSON.parse(await openLocation(configJsonLocation).readFile('utf8'));
12
+ const configUri = resolve(configJsonLocation.uri, configJsonLocation.baseUri);
13
+ addRelativeUris(configJson, new URL(configUri));
14
+ if (configJson.assemblies) {
15
+ for (const assembly of configJson.assemblies) {
16
+ if (!session.assemblyManager.get(assembly.name)) {
17
+ session.addSessionAssembly(assembly);
18
+ }
19
+ }
20
+ }
21
+ if (configJson.tracks) {
22
+ self.addTrackConfs(configJson.tracks);
23
+ }
24
+ session.notify('Successfully loaded', 'success');
25
+ }
26
+ catch (e) {
27
+ console.error(e);
28
+ session.notifyError(`${getConf(self, 'name')}: "${e}"`, e);
29
+ (_a = session.breakConnection) === null || _a === void 0 ? void 0 : _a.call(session, self.configuration);
30
+ }
31
+ }
@@ -0,0 +1,2 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function JB2TrackHubConnectionF(pluginManager: PluginManager): void;
@@ -0,0 +1,15 @@
1
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes';
2
+ import configSchema from './configSchema';
3
+ import stateModelFactory from './model';
4
+ export default function JB2TrackHubConnectionF(pluginManager) {
5
+ pluginManager.addConnectionType(() => {
6
+ return new ConnectionType({
7
+ name: 'JB2TrackHubConnection',
8
+ configSchema,
9
+ stateModel: stateModelFactory(pluginManager),
10
+ displayName: 'JB2 Track Hub',
11
+ description: 'A JBrowse 2 config file based trackhub',
12
+ url: 'https://jbrowse.org/jb2/',
13
+ });
14
+ });
15
+ }
@@ -0,0 +1,75 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function JB2TrackHubConnection(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
3
+ name: import("mobx-state-tree").ISimpleType<string>;
4
+ tracks: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
5
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
+ name: {
7
+ type: string;
8
+ defaultValue: string;
9
+ description: string;
10
+ };
11
+ assemblyNames: {
12
+ type: string;
13
+ defaultValue: never[];
14
+ description: string;
15
+ };
16
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>;
17
+ } & {
18
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
+ configJsonLocation: {
20
+ type: string;
21
+ defaultValue: {
22
+ uri: string;
23
+ locationType: string;
24
+ };
25
+ description: string;
26
+ };
27
+ assemblyNames: {
28
+ type: string;
29
+ defaultValue: never[];
30
+ description: string;
31
+ };
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
33
+ name: {
34
+ type: string;
35
+ defaultValue: string;
36
+ description: string;
37
+ };
38
+ assemblyNames: {
39
+ type: string;
40
+ defaultValue: never[];
41
+ description: string;
42
+ };
43
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
44
+ type: import("mobx-state-tree").ISimpleType<"JB2TrackHubConnection">;
45
+ }, {
46
+ connect(_arg: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
47
+ } & {
48
+ afterAttach(): void;
49
+ addTrackConf(trackConf: ({
50
+ [x: string]: any;
51
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
52
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
53
+ [x: string]: any;
54
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
55
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
56
+ [x: string]: any;
57
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
58
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
59
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>): any;
60
+ addTrackConfs(trackConfs: (({
61
+ [x: string]: any;
62
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
63
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
64
+ [x: string]: any;
65
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
66
+ setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
67
+ [x: string]: any;
68
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
69
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>);
70
+ } & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>) | Record<string, unknown>)[]): void;
71
+ setTrackConfs(trackConfs: import("@jbrowse/core/configuration").AnyConfigurationModel[]): void;
72
+ clear(): void;
73
+ } & {
74
+ connect(): Promise<void>;
75
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
@@ -0,0 +1,17 @@
1
+ import { ConfigurationReference } from '@jbrowse/core/configuration';
2
+ import { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models';
3
+ import { types } from 'mobx-state-tree';
4
+ import configSchema from './configSchema';
5
+ export default function JB2TrackHubConnection(pluginManager) {
6
+ return types
7
+ .compose('JB2TrackHubConnection', BaseConnectionModelFactory(pluginManager), types.model({
8
+ configuration: ConfigurationReference(configSchema),
9
+ type: types.literal('JB2TrackHubConnection'),
10
+ }))
11
+ .actions(self => ({
12
+ async connect() {
13
+ const { doConnect } = await import('./doConnect');
14
+ doConnect(self);
15
+ },
16
+ }));
17
+ }
@@ -0,0 +1,22 @@
1
+ import { GenomesFile, TrackDbFile } from '@gmod/ucsc-hub';
2
+ import type { FileLocation } from '@jbrowse/core/util';
3
+ export declare function fetchGenomesFile(genomesLoc: FileLocation): Promise<GenomesFile>;
4
+ export declare function fetchTrackDbFile(trackDbLoc: FileLocation): Promise<TrackDbFile>;
5
+ export declare function makeLoc(first: string, base: {
6
+ uri: string;
7
+ baseUri?: string;
8
+ }): {
9
+ uri: string;
10
+ locationType: string;
11
+ };
12
+ export declare function makeLocAlt(first: string, alt: string, base: {
13
+ uri: string;
14
+ }): {
15
+ uri: string;
16
+ locationType: string;
17
+ };
18
+ export declare function makeLoc2(first: string, alt?: string): {
19
+ uri: string | undefined;
20
+ locationType: string;
21
+ };
22
+ export declare function resolve(uri: string, baseUri: string): string;
@@ -0,0 +1,5 @@
1
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
+ export declare function doConnect(self: {
3
+ configuration: AnyConfigurationModel;
4
+ addTrackConfs: (arg: Record<string, unknown>[]) => void;
5
+ }): Promise<void>;
@@ -180,4 +180,3 @@ export declare function generateTracks({ trackDb, trackDbLoc, assemblyName, sequ
180
180
  };
181
181
  category: (string | undefined)[];
182
182
  })[];
183
- export { default as ucscAssemblies } from './ucscAssemblies';
@@ -157,4 +157,3 @@ function makeTrackConfig({ track, trackDbLoc, trackDb, sequenceAdapter, }) {
157
157
  return generateUnknownTrackConf(name, baseTrackType);
158
158
  }
159
159
  }
160
- export { default as ucscAssemblies } from './ucscAssemblies';
@@ -0,0 +1,22 @@
1
+ import { GenomesFile, TrackDbFile } from '@gmod/ucsc-hub';
2
+ import type { FileLocation } from '@jbrowse/core/util';
3
+ export declare function fetchGenomesFile(genomesLoc: FileLocation): Promise<GenomesFile>;
4
+ export declare function fetchTrackDbFile(trackDbLoc: FileLocation): Promise<TrackDbFile>;
5
+ export declare function makeLoc(first: string, base: {
6
+ uri: string;
7
+ baseUri?: string;
8
+ }): {
9
+ uri: string;
10
+ locationType: string;
11
+ };
12
+ export declare function makeLocAlt(first: string, alt: string, base: {
13
+ uri: string;
14
+ }): {
15
+ uri: string;
16
+ locationType: string;
17
+ };
18
+ export declare function makeLoc2(first: string, alt?: string): {
19
+ uri: string | undefined;
20
+ locationType: string;
21
+ };
22
+ export declare function resolve(uri: string, baseUri: string): string;
@@ -0,0 +1,33 @@
1
+ import { GenomesFile, TrackDbFile } from '@gmod/ucsc-hub';
2
+ import { openLocation } from '@jbrowse/core/util/io';
3
+ export async function fetchGenomesFile(genomesLoc) {
4
+ const genomesFileText = await openLocation(genomesLoc).readFile('utf8');
5
+ return new GenomesFile(genomesFileText);
6
+ }
7
+ export async function fetchTrackDbFile(trackDbLoc) {
8
+ const text = await openLocation(trackDbLoc).readFile('utf8');
9
+ return new TrackDbFile(text);
10
+ }
11
+ export function makeLoc(first, base) {
12
+ return {
13
+ uri: new URL(first, new URL(base.uri, base.baseUri)).href,
14
+ locationType: 'UriLocation',
15
+ };
16
+ }
17
+ export function makeLocAlt(first, alt, base) {
18
+ return first ? makeLoc(first, base) : makeLoc(alt, base);
19
+ }
20
+ export function makeLoc2(first, alt) {
21
+ return first
22
+ ? {
23
+ uri: first,
24
+ locationType: 'LocalPath',
25
+ }
26
+ : {
27
+ uri: alt,
28
+ locationType: 'UriLocation',
29
+ };
30
+ }
31
+ export function resolve(uri, baseUri) {
32
+ return new URL(uri, baseUri).href;
33
+ }
package/esm/index.js CHANGED
@@ -3,8 +3,9 @@ import Plugin from '@jbrowse/core/Plugin';
3
3
  import AddConnectionWidgetF from './AddConnectionWidget';
4
4
  import AddTrackWidgetF from './AddTrackWidget';
5
5
  import HierarchicalTrackSelectorWidgetF from './HierarchicalTrackSelectorWidget';
6
+ import JB2TrackHubConnectionF from './JB2TrackHubConnection';
6
7
  import PluginStoreWidgetF from './PluginStoreWidget';
7
- import UCSCTrackHubConnectionF from './UCSCTrackHub';
8
+ import UCSCTrackHubConnectionF from './UCSCTrackHubConnection';
8
9
  const AssemblyManager = lazy(() => import('./AssemblyManager'));
9
10
  export default class DataManagementPlugin extends Plugin {
10
11
  constructor() {
@@ -16,6 +17,7 @@ export default class DataManagementPlugin extends Plugin {
16
17
  }
17
18
  install(pluginManager) {
18
19
  UCSCTrackHubConnectionF(pluginManager);
20
+ JB2TrackHubConnectionF(pluginManager);
19
21
  AddTrackWidgetF(pluginManager);
20
22
  HierarchicalTrackSelectorWidgetF(pluginManager);
21
23
  AddConnectionWidgetF(pluginManager);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "3.6.2",
3
+ "version": "3.6.4",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -37,9 +37,9 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@gmod/ucsc-hub": "^2.0.1",
40
- "@jbrowse/core": "^3.6.2",
41
- "@jbrowse/plugin-config": "^3.6.2",
42
- "@jbrowse/product-core": "^3.6.2",
40
+ "@jbrowse/core": "^3.6.4",
41
+ "@jbrowse/plugin-config": "^3.6.4",
42
+ "@jbrowse/product-core": "^3.6.4",
43
43
  "@mui/icons-material": "^7.0.0",
44
44
  "@mui/material": "^7.0.0",
45
45
  "@mui/x-data-grid": "^8.0.0",
@@ -61,5 +61,5 @@
61
61
  "distModule": "esm/index.js",
62
62
  "srcModule": "src/index.ts",
63
63
  "module": "esm/index.js",
64
- "gitHead": "2a2c52face5f1b8fe899f48d5903e5c5f06dba63"
64
+ "gitHead": "3db8e50ce2bd9c081efbf6c2e7ae5f342380a25a"
65
65
  }