@jbrowse/plugin-legacy-jbrowse 5.0.0-beta.1 → 5.0.0-beta.10

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.
@@ -17,35 +17,51 @@
17
17
  * ```
18
18
  */
19
19
  declare const JBrowse1Connection: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
20
- /**
21
- * #slot
22
- */
23
- readonly dataDirLocation: {
24
- readonly type: "fileLocation";
25
- readonly defaultValue: {
26
- readonly uri: "https://mysite.com/jbrowse/data/";
27
- readonly locationType: "UriLocation";
28
- };
29
- readonly description: "the location of the JBrowse 1 data directory, often something like https://mysite.com/jbrowse/data/";
30
- };
31
- /**
32
- * #slot
33
- */
34
- readonly assemblyNames: {
35
- readonly description: "name of the assembly the connection belongs to, should be a single entry";
36
- readonly type: "stringArray";
37
- readonly defaultValue: readonly [];
20
+ assemblyNames: {
21
+ type: "stringArray";
22
+ } & {
23
+ defaultValue: unknown;
24
+ };
25
+ connectionId: {
26
+ type: "string";
27
+ } & {
28
+ defaultValue: string;
29
+ };
30
+ dataDirLocation: {
31
+ type: "fileLocation";
32
+ } & {
33
+ defaultValue: unknown;
34
+ };
35
+ name: {
36
+ type: "string";
37
+ } & {
38
+ defaultValue: string;
39
+ };
40
+ type: {
41
+ type: "string";
42
+ } & {
43
+ defaultValue: string;
38
44
  };
39
45
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
40
46
  readonly name: {
41
- readonly type: "string";
42
- readonly defaultValue: "nameOfConnection";
43
- readonly description: "a unique name for this connection";
47
+ type: "string";
48
+ } & {
49
+ defaultValue: string;
44
50
  };
45
51
  readonly assemblyNames: {
46
- readonly type: "stringArray";
47
- readonly defaultValue: readonly [];
48
- readonly description: "optional list of names of assemblies in this connection";
52
+ type: "stringArray";
53
+ } & {
54
+ defaultValue: unknown;
55
+ };
56
+ type: {
57
+ type: "string";
58
+ } & {
59
+ defaultValue: string;
60
+ };
61
+ connectionId: {
62
+ type: "string";
63
+ } & {
64
+ defaultValue: string;
49
65
  };
50
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>;
66
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
51
67
  export default JBrowse1Connection;
@@ -9,7 +9,7 @@ interface Jb2Track {
9
9
  displays?: {
10
10
  type: string;
11
11
  displayId: string;
12
- defaultRendering: string;
12
+ mark: string;
13
13
  }[];
14
14
  }
15
15
  interface Jb2Adapter {
@@ -42,21 +42,21 @@ const NO_ADAPTER = {
42
42
  'Sequence/StaticChunked': 'StaticChunked',
43
43
  };
44
44
  /**
45
- * `defaultRendering` is a slot on LinearWiggleDisplay, not on the track — a
46
- * track-level one is a key JBrowse does not declare, and is ignored.
45
+ * `mark` is a slot on LinearWiggleDisplay, not on the track — a track-level
46
+ * one is a key JBrowse does not declare, and is ignored.
47
47
  */
48
48
  function wiggleDisplays(jb1TrackConfig, jb2TrackConfig) {
49
- const rendering = jb1TrackConfig.type?.endsWith('Density')
50
- ? 'density'
49
+ const mark = jb1TrackConfig.type?.endsWith('Density')
50
+ ? 'heatmap'
51
51
  : jb1TrackConfig.type?.endsWith('XYPlot')
52
- ? 'xyplot'
52
+ ? 'bar'
53
53
  : undefined;
54
- return rendering
54
+ return mark
55
55
  ? [
56
56
  {
57
57
  type: 'LinearWiggleDisplay',
58
58
  displayId: `${jb2TrackConfig.trackId}-LinearWiggleDisplay`,
59
- defaultRendering: rendering,
59
+ mark,
60
60
  },
61
61
  ]
62
62
  : undefined;
@@ -5,47 +5,79 @@ import type PluginManager from '@jbrowse/core/PluginManager';
5
5
  * composed on the base connection model.
6
6
  */
7
7
  export default function stateModelFactory(pluginManager: PluginManager): import("@jbrowse/mobx-state-tree").IModelType<Omit<{
8
- tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyType>;
8
+ tracks: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>;
9
9
  configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
10
10
  readonly name: {
11
- readonly type: "string";
12
- readonly defaultValue: "nameOfConnection";
13
- readonly description: "a unique name for this connection";
11
+ type: "string";
12
+ } & {
13
+ defaultValue: string;
14
14
  };
15
15
  readonly assemblyNames: {
16
- readonly type: "stringArray";
17
- readonly defaultValue: readonly [];
18
- readonly description: "optional list of names of assemblies in this connection";
16
+ type: "stringArray";
17
+ } & {
18
+ defaultValue: unknown;
19
19
  };
20
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>>;
20
+ type: {
21
+ type: "string";
22
+ } & {
23
+ defaultValue: string;
24
+ };
25
+ connectionId: {
26
+ type: "string";
27
+ } & {
28
+ defaultValue: string;
29
+ };
30
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
21
31
  silent: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>, [undefined]>;
22
32
  }, "configuration" | "type"> & {
23
33
  configuration: import("@jbrowse/core/configuration/configurationSchema").IConfigurationReference<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
24
- readonly dataDirLocation: {
25
- readonly type: "fileLocation";
26
- readonly defaultValue: {
27
- readonly uri: "https://mysite.com/jbrowse/data/";
28
- readonly locationType: "UriLocation";
29
- };
30
- readonly description: "the location of the JBrowse 1 data directory, often something like https://mysite.com/jbrowse/data/";
34
+ assemblyNames: {
35
+ type: "stringArray";
36
+ } & {
37
+ defaultValue: unknown;
31
38
  };
32
- readonly assemblyNames: {
33
- readonly description: "name of the assembly the connection belongs to, should be a single entry";
34
- readonly type: "stringArray";
35
- readonly defaultValue: readonly [];
39
+ connectionId: {
40
+ type: "string";
41
+ } & {
42
+ defaultValue: string;
43
+ };
44
+ dataDirLocation: {
45
+ type: "fileLocation";
46
+ } & {
47
+ defaultValue: unknown;
48
+ };
49
+ name: {
50
+ type: "string";
51
+ } & {
52
+ defaultValue: string;
53
+ };
54
+ type: {
55
+ type: "string";
56
+ } & {
57
+ defaultValue: string;
36
58
  };
37
59
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
38
60
  readonly name: {
39
- readonly type: "string";
40
- readonly defaultValue: "nameOfConnection";
41
- readonly description: "a unique name for this connection";
61
+ type: "string";
62
+ } & {
63
+ defaultValue: string;
42
64
  };
43
65
  readonly assemblyNames: {
44
- readonly type: "stringArray";
45
- readonly defaultValue: readonly [];
46
- readonly description: "optional list of names of assemblies in this connection";
66
+ type: "stringArray";
67
+ } & {
68
+ defaultValue: unknown;
69
+ };
70
+ type: {
71
+ type: "string";
72
+ } & {
73
+ defaultValue: string;
74
+ };
75
+ connectionId: {
76
+ type: "string";
77
+ } & {
78
+ defaultValue: string;
47
79
  };
48
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId">>, undefined>>>;
80
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "connectionId", true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
49
81
  type: import("@jbrowse/mobx-state-tree").ILiteralType<"JBrowse1Connection">;
50
82
  }, {
51
83
  loading: boolean;
@@ -57,18 +89,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
57
89
  setLoading(loading: boolean): void;
58
90
  } & {
59
91
  afterAttach(): void;
60
- addTrackConf(trackConf: Record<string, unknown> | (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
61
- setSubschema(slotName: string, data: Record<string, unknown>): any;
62
- setSlot(slotName: string, value: unknown): void;
63
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)): any;
64
- addTrackConfs(trackConfs: (Record<string, unknown> | (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
65
- setSubschema(slotName: string, data: Record<string, unknown>): any;
66
- setSlot(slotName: string, value: unknown): void;
67
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
68
- setTrackConfs(trackConfs: (Record<string, unknown> | (import("@jbrowse/mobx-state-tree").ModelInstanceTypeProps<Record<string, any>> & {
69
- setSubschema(slotName: string, data: Record<string, unknown>): any;
70
- setSlot(slotName: string, value: unknown): void;
71
- } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>))[]): void;
92
+ addTrackConf(trackConf: Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel): (import("@jbrowse/core/configuration").PluggableConfigNode & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/core/PluginManager").PluggableConfigSchemaType>) | undefined;
93
+ addTrackConfs(trackConfs: (Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel)[]): void;
94
+ setTrackConfs(trackConfs: (Record<string, unknown> | import("@jbrowse/core/configuration").AnyConfigurationModel)[]): void;
72
95
  } & {
73
96
  connect(): Promise<void>;
74
97
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -34,8 +34,9 @@ export default class HttpMap {
34
34
  * Loads a file using the url and provided id.
35
35
  * Returns response object with contents of the file
36
36
  * @param id - string
37
+ * @param ifMissing - the contents a 404 stands for, if it is not an error
37
38
  */
38
- loadFile(id: string): Promise<any>;
39
+ loadFile(id: string, ifMissing?: object): Promise<any>;
39
40
  /**
40
41
  * Returns the corresponding path of the file given a hex string
41
42
  * @param hex - hex string
@@ -27,13 +27,16 @@ export default class HttpMap {
27
27
  * loads meta.json file from names directory and reads number of hash_bits used
28
28
  */
29
29
  async readMeta() {
30
- if (!this.metaPromise) {
31
- this.metaPromise = this.loadFile('meta.json').then(meta => ({
32
- hashHexCharacters: Math.ceil(meta.hash_bits / 4),
33
- compress: meta.compress,
34
- tracks: meta.track_names,
35
- }));
36
- }
30
+ this.metaPromise ??= this.loadFile('meta.json')
31
+ .then(meta => ({
32
+ hashHexCharacters: Math.ceil(meta.hash_bits / 4),
33
+ compress: meta.compress,
34
+ tracks: meta.track_names,
35
+ }))
36
+ .catch((e) => {
37
+ this.metaPromise = undefined;
38
+ throw e;
39
+ });
37
40
  return this.metaPromise;
38
41
  }
39
42
  async getHashHexCharacters() {
@@ -60,16 +63,22 @@ export default class HttpMap {
60
63
  async getBucket(key) {
61
64
  const bucketIdent = this.hash(key);
62
65
  const hexToDirPath = await this.hexToDirPath(bucketIdent);
63
- return this.loadFile(hexToDirPath);
66
+ // generate-names.pl writes only the buckets that hold a name, so a missing
67
+ // one is an empty bucket, as JBrowse 1's own Store/Hash reads it
68
+ return this.loadFile(hexToDirPath, {});
64
69
  }
65
70
  /**
66
71
  * Loads a file using the url and provided id.
67
72
  * Returns response object with contents of the file
68
73
  * @param id - string
74
+ * @param ifMissing - the contents a 404 stands for, if it is not an error
69
75
  */
70
- async loadFile(id) {
76
+ async loadFile(id, ifMissing) {
71
77
  const response = await fetch(`${this.url}${id}`);
72
- if (!response.ok) {
78
+ if (response.status === 404 && ifMissing) {
79
+ return ifMissing;
80
+ }
81
+ else if (!response.ok) {
73
82
  throw new Error(`HTTP ${response.status} ${response.statusText}`);
74
83
  }
75
84
  return response.json();
@@ -14,7 +14,6 @@ interface SearchResults {
14
14
  type IndexFile = Record<string, SearchResults>;
15
15
  export default class JBrowse1TextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
16
16
  httpMap: HttpMap;
17
- tracksNames?: string[];
18
17
  constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
19
18
  /**
20
19
  * Returns the contents of the file containing the query if it exists
@@ -5,7 +5,6 @@ import HttpMap from './HttpMap.js';
5
5
  // Uses index built by generate-names.pl
6
6
  export default class JBrowse1TextSearchAdapter extends BaseAdapter {
7
7
  httpMap;
8
- tracksNames;
9
8
  constructor(config, getSubAdapter, pluginManager) {
10
9
  super(config, getSubAdapter, pluginManager);
11
10
  const namesIndex = readConfObject(config, 'namesIndexLocation');
@@ -24,7 +23,7 @@ export default class JBrowse1TextSearchAdapter extends BaseAdapter {
24
23
  }
25
24
  async searchIndex(args) {
26
25
  const { searchType, queryString } = args;
27
- const tracks = this.tracksNames ?? (await this.httpMap.getTrackNames());
26
+ const tracks = await this.httpMap.getTrackNames();
28
27
  const str = queryString.toLowerCase();
29
28
  const entries = await this.loadIndexFile(str);
30
29
  const results = entries[str];
@@ -11,39 +11,31 @@
11
11
  * ```js
12
12
  * {
13
13
  * type: 'JBrowse1TextSearchAdapter',
14
- * textSearchAdapterId: 'jbrowse1-names',
15
14
  * namesIndexLocation: { uri: 'https://example.com/jbrowse1/data/names/' },
16
15
  * assemblyNames: ['hg19'],
17
16
  * }
18
17
  * ```
19
18
  */
20
19
  declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
21
- /**
22
- * #slot
23
- */
20
+ type: {
21
+ type: "string";
22
+ } & {
23
+ defaultValue: string;
24
+ };
24
25
  readonly namesIndexLocation: {
25
- readonly type: "fileLocation";
26
- readonly defaultValue: {
27
- readonly uri: "/volvox/names";
28
- readonly locationType: "UriLocation";
29
- };
30
- readonly description: "the location of the JBrowse1 names index data directory";
26
+ type: "fileLocation";
27
+ } & {
28
+ defaultValue: unknown;
31
29
  };
32
- /**
33
- * #slot
34
- */
35
30
  readonly tracks: {
36
- readonly type: "stringArray";
37
- readonly defaultValue: readonly [];
38
- readonly description: "List of tracks covered by text search adapter";
31
+ type: "stringArray";
32
+ } & {
33
+ defaultValue: unknown;
39
34
  };
40
- /**
41
- * #slot
42
- */
43
35
  readonly assemblyNames: {
44
- readonly type: "stringArray";
45
- readonly defaultValue: readonly [];
46
- readonly description: "List of assemblies covered by text search adapter";
36
+ type: "stringArray";
37
+ } & {
38
+ defaultValue: unknown;
47
39
  };
48
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "textSearchAdapterId">>;
40
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
49
41
  export default _default;
@@ -12,7 +12,6 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
12
12
  * ```js
13
13
  * {
14
14
  * type: 'JBrowse1TextSearchAdapter',
15
- * textSearchAdapterId: 'jbrowse1-names',
16
15
  * namesIndexLocation: { uri: 'https://example.com/jbrowse1/data/names/' },
17
16
  * assemblyNames: ['hg19'],
18
17
  * }
@@ -43,10 +42,4 @@ export default ConfigurationSchema('JBrowse1TextSearchAdapter', {
43
42
  defaultValue: [],
44
43
  description: 'List of assemblies covered by text search adapter',
45
44
  },
46
- }, {
47
- explicitlyTyped: true,
48
- /**
49
- * #identifier
50
- */
51
- explicitIdentifier: 'textSearchAdapterId',
52
- });
45
+ }, { explicitlyTyped: true });
@@ -14,7 +14,7 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
14
14
  /**
15
15
  * Fetch features for a certain region.
16
16
  * @param region -
17
- * @param opts - [stopToken] optional stopTokenling object for aborting the fetch
17
+ * @param opts - [signal] optional signalling object for aborting the fetch
18
18
  * @returns Observable of Feature objects in the region
19
19
  */
20
20
  getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
@@ -1,7 +1,7 @@
1
1
  import NCListStore from '@gmod/nclist';
2
2
  import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import { checkAbortSignal } from '@jbrowse/core/util/aborting';
3
4
  import { ObservableCreate } from '@jbrowse/core/util/rxjs';
4
- import { checkStopToken } from '@jbrowse/core/util/stopToken';
5
5
  import { RemoteFile } from 'generic-filehandle2';
6
6
  import NCListFeature from './NCListFeature.js';
7
7
  export default class NCListAdapter extends BaseFeatureDataAdapter {
@@ -23,18 +23,18 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
23
23
  /**
24
24
  * Fetch features for a certain region.
25
25
  * @param region -
26
- * @param opts - [stopToken] optional stopTokenling object for aborting the fetch
26
+ * @param opts - [signal] optional signalling object for aborting the fetch
27
27
  * @returns Observable of Feature objects in the region
28
28
  */
29
29
  getFeatures(region, opts = {}) {
30
30
  return ObservableCreate(async (observer) => {
31
- const { stopToken } = opts;
31
+ const { signal } = opts;
32
32
  for await (const feature of this.nclist.getFeatures(region)) {
33
- checkStopToken(stopToken);
33
+ checkAbortSignal(signal);
34
34
  observer.next(this.wrapFeature(feature));
35
35
  }
36
36
  observer.complete();
37
- });
37
+ }, opts.signal);
38
38
  }
39
39
  wrapFeature(ncFeature) {
40
40
  return new NCListFeature(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
@@ -16,26 +16,20 @@
16
16
  * ```
17
17
  */
18
18
  declare const NCListAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
19
- /**
20
- * #slot
21
- * URL of a JBrowse 1 NCList `trackData.json`, with `{refseq}` standing in
22
- * for the reference sequence name — the per-reference directory layout
23
- * `flatfile-to-json.pl` and `biodb-to-json.pl` write.
24
- */
19
+ type: {
20
+ type: "string";
21
+ } & {
22
+ defaultValue: string;
23
+ };
25
24
  readonly rootUrlTemplate: {
26
- readonly type: "fileLocation";
27
- readonly defaultValue: {
28
- readonly uri: "/path/to/my/{refseq}/trackData.json";
29
- readonly locationType: "UriLocation";
30
- };
25
+ type: "fileLocation";
26
+ } & {
27
+ defaultValue: unknown;
31
28
  };
32
- /**
33
- * #slot
34
- */
35
29
  readonly refNames: {
36
- readonly type: "stringArray";
37
- readonly defaultValue: readonly [];
38
- readonly description: "List of refNames used by the NCList used for aliasing";
30
+ type: "stringArray";
31
+ } & {
32
+ defaultValue: unknown;
39
33
  };
40
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
34
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
41
35
  export default NCListAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-legacy-jbrowse",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.10",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
6
6
  "keywords": [
@@ -22,12 +22,12 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "@gmod/nclist": "^3.0.14",
25
- "@jbrowse/mobx-state-tree": "^6.5.1",
25
+ "@jbrowse/mobx-state-tree": "^6.6.1",
26
26
  "generic-filehandle2": "^2.4.0",
27
- "mobx": "^7.0.3",
27
+ "mobx": "^7.0.5",
28
28
  "rxjs": "^7.8.2",
29
- "@jbrowse/add-track-core": "^5.0.0-beta.1",
30
- "@jbrowse/core": "^5.0.0-beta.1"
29
+ "@jbrowse/add-track-core": "^5.0.0-beta.10",
30
+ "@jbrowse/core": "^5.0.0-beta.10"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"