@jbrowse/plugin-legacy-jbrowse 2.17.0 → 3.0.0
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/GuessNCList/index.d.ts +1 -1
- package/dist/GuessNCList/index.js +6 -8
- package/dist/JBrowse1Connection/configSchema.d.ts +0 -6
- package/dist/JBrowse1Connection/configSchema.js +2 -14
- package/dist/JBrowse1Connection/index.d.ts +1 -1
- package/dist/JBrowse1Connection/index.js +1 -2
- package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +5 -44
- package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
- package/dist/JBrowse1Connection/jb1ConfigParse.js +1 -41
- package/dist/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
- package/dist/JBrowse1Connection/jb1ToJb2.js +1 -5
- package/dist/JBrowse1Connection/model.d.ts +5 -5
- package/dist/JBrowse1Connection/model.js +18 -10
- package/dist/JBrowse1Connection/util.d.ts +2 -21
- package/dist/JBrowse1Connection/util.js +9 -58
- package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js +1 -28
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +1 -7
- package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
- package/dist/JBrowse1TextSearchAdapter/configSchema.js +1 -17
- package/dist/JBrowse1TextSearchAdapter/index.d.ts +1 -1
- package/dist/JBrowse1TextSearchAdapter/index.js +17 -8
- package/dist/NCListAdapter/NCListAdapter.d.ts +7 -22
- package/dist/NCListAdapter/NCListAdapter.js +5 -21
- package/dist/NCListAdapter/NCListFeature.d.ts +1 -16
- package/dist/NCListAdapter/NCListFeature.js +0 -19
- package/dist/NCListAdapter/configSchema.d.ts +0 -6
- package/dist/NCListAdapter/configSchema.js +1 -10
- package/dist/NCListAdapter/index.d.ts +1 -1
- package/dist/NCListAdapter/index.js +20 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/esm/GuessNCList/index.d.ts +1 -1
- package/esm/GuessNCList/index.js +6 -8
- package/esm/JBrowse1Connection/configSchema.d.ts +0 -6
- package/esm/JBrowse1Connection/configSchema.js +2 -14
- package/esm/JBrowse1Connection/index.d.ts +1 -1
- package/esm/JBrowse1Connection/index.js +1 -2
- package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ConfigLoad.js +7 -46
- package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -8
- package/esm/JBrowse1Connection/jb1ConfigParse.js +1 -41
- package/esm/JBrowse1Connection/jb1ToJb2.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ToJb2.js +2 -6
- package/esm/JBrowse1Connection/model.d.ts +5 -5
- package/esm/JBrowse1Connection/model.js +1 -3
- package/esm/JBrowse1Connection/util.d.ts +2 -21
- package/esm/JBrowse1Connection/util.js +8 -57
- package/esm/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -20
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +1 -28
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +5 -9
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +2 -8
- package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -9
- package/esm/JBrowse1TextSearchAdapter/configSchema.js +1 -17
- package/esm/JBrowse1TextSearchAdapter/index.d.ts +1 -1
- package/esm/JBrowse1TextSearchAdapter/index.js +0 -1
- package/esm/NCListAdapter/NCListAdapter.d.ts +7 -22
- package/esm/NCListAdapter/NCListAdapter.js +5 -21
- package/esm/NCListAdapter/NCListFeature.d.ts +1 -16
- package/esm/NCListAdapter/NCListFeature.js +0 -19
- package/esm/NCListAdapter/configSchema.d.ts +0 -6
- package/esm/NCListAdapter/configSchema.js +1 -10
- package/esm/NCListAdapter/index.d.ts +1 -1
- package/esm/NCListAdapter/index.js +3 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +3 -3
- package/package.json +5 -5
|
@@ -18,16 +18,6 @@ export function deepUpdate(a, b) {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* replace variables in a template string with values
|
|
23
|
-
*
|
|
24
|
-
* @param template - String with variable names in curly brackets
|
|
25
|
-
* e.g., `http://foo/{bar}?arg={baz.foo}`
|
|
26
|
-
* @param fillWith - object with attribute-value mappings
|
|
27
|
-
* e.g., `{ 'bar': 'someurl', 'baz': { 'foo': 42 } }`
|
|
28
|
-
* @returns the template string with variables in fillWith replaced
|
|
29
|
-
* e.g., 'htp://foo/someurl?arg=valueforbaz'
|
|
30
|
-
*/
|
|
31
21
|
export function fillTemplate(template, fillWith) {
|
|
32
22
|
return template.replaceAll(/{([\s\w.]+)}/g, (match, varName) => {
|
|
33
23
|
varName = varName.replaceAll(/\s+/g, '');
|
|
@@ -36,7 +26,6 @@ export function fillTemplate(template, fillWith) {
|
|
|
36
26
|
return typeof fill === 'function' ? fill(varName) : fill;
|
|
37
27
|
}
|
|
38
28
|
if (fillWith.callback) {
|
|
39
|
-
// @ts-expect-error
|
|
40
29
|
const v = fillWith.callback.call(this, varName);
|
|
41
30
|
if (v !== undefined) {
|
|
42
31
|
return v;
|
|
@@ -45,81 +34,43 @@ export function fillTemplate(template, fillWith) {
|
|
|
45
34
|
return match;
|
|
46
35
|
});
|
|
47
36
|
}
|
|
48
|
-
|
|
49
|
-
* Clones objects (including DOM nodes) and all children.
|
|
50
|
-
* Warning: do not clone cyclic structures
|
|
51
|
-
* (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
|
|
52
|
-
* @param src - The object to clone
|
|
53
|
-
*/
|
|
54
|
-
export function clone(src) {
|
|
37
|
+
export function structuredClone(src) {
|
|
55
38
|
if (!src ||
|
|
56
39
|
typeof src !== 'object' ||
|
|
57
40
|
Object.prototype.toString.call(src) === '[object Function]') {
|
|
58
|
-
|
|
59
|
-
return src; // anything
|
|
41
|
+
return src;
|
|
60
42
|
}
|
|
61
43
|
if (src.nodeType && 'cloneNode' in src) {
|
|
62
|
-
|
|
63
|
-
return src.cloneNode(true); // Node
|
|
44
|
+
return src.cloneNode(true);
|
|
64
45
|
}
|
|
65
46
|
if (src instanceof Date) {
|
|
66
|
-
|
|
67
|
-
return new Date(src.getTime()); // Date
|
|
47
|
+
return new Date(src.getTime());
|
|
68
48
|
}
|
|
69
49
|
if (src instanceof RegExp) {
|
|
70
|
-
|
|
71
|
-
return new RegExp(src); // RegExp
|
|
50
|
+
return new RegExp(src);
|
|
72
51
|
}
|
|
73
52
|
let r;
|
|
74
53
|
if (Array.isArray(src)) {
|
|
75
|
-
// array
|
|
76
54
|
r = [];
|
|
77
55
|
for (let i = 0, l = src.length; i < l; ++i) {
|
|
78
56
|
if (i in src) {
|
|
79
|
-
r[i] =
|
|
57
|
+
r[i] = structuredClone(src[i]);
|
|
80
58
|
}
|
|
81
59
|
}
|
|
82
|
-
// we don't clone functions for performance reasons
|
|
83
|
-
// }else if(d.isFunction(src)){
|
|
84
|
-
// // function
|
|
85
|
-
// r = function(){ return src.apply(this, arguments); };
|
|
86
60
|
}
|
|
87
61
|
else {
|
|
88
|
-
// generic objects
|
|
89
62
|
r = src.constructor ? new src.constructor() : {};
|
|
90
63
|
}
|
|
91
|
-
return mixin(r, src,
|
|
64
|
+
return mixin(r, src, a => structuredClone(a));
|
|
92
65
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Copies/adds all properties of source to dest; returns dest.
|
|
95
|
-
* (Lifted from dojo https://github.com/dojo/dojo/blob/master/_base/lang.js)
|
|
96
|
-
*
|
|
97
|
-
* All properties, including functions (sometimes termed "methods"), excluding
|
|
98
|
-
* any non-standard extensions found in Object.prototype, are copied/added to
|
|
99
|
-
* dest. Copying/adding each particular property is delegated to copyFunc
|
|
100
|
-
* (if any); copyFunc defaults to the Javascript assignment operator if not
|
|
101
|
-
* provided. Notice that by default, mixin executes a so-called "shallow copy"
|
|
102
|
-
* and aggregate types are copied/added by reference.
|
|
103
|
-
* @param dest - The object to which to copy/add all properties contained in
|
|
104
|
-
* source.
|
|
105
|
-
* @param source - The object from which to draw all properties to copy into dest.
|
|
106
|
-
* @param copyFunc - The process used to copy/add a property in source; defaults
|
|
107
|
-
* to the Javascript assignment operator.
|
|
108
|
-
* @returns dest, as modified
|
|
109
|
-
*/
|
|
110
66
|
function mixin(dest, source, copyFunc) {
|
|
111
67
|
const empty = {};
|
|
112
68
|
for (const name in source) {
|
|
113
|
-
// the (!(name in empty) || empty[name] !== s) condition avoids copying
|
|
114
|
-
// properties in "source" inherited from Object.prototype. For example,
|
|
115
|
-
// if dest has a custom toString() method, don't overwrite it with the
|
|
116
|
-
// toString() method that source inherited from Object.prototype
|
|
117
69
|
const s = source[name];
|
|
118
70
|
if (!(name in dest) ||
|
|
119
|
-
// @ts-expect-error
|
|
120
71
|
(dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
|
|
121
72
|
dest[name] = copyFunc ? copyFunc(s) : s;
|
|
122
73
|
}
|
|
123
74
|
}
|
|
124
|
-
return dest;
|
|
75
|
+
return dest;
|
|
125
76
|
}
|
|
@@ -3,9 +3,6 @@ export default class HttpMap {
|
|
|
3
3
|
constructor(args: {
|
|
4
4
|
url: string;
|
|
5
5
|
});
|
|
6
|
-
/**
|
|
7
|
-
* loads meta.json file from names directory and reads number of hash_bits used
|
|
8
|
-
*/
|
|
9
6
|
readMeta(): Promise<{
|
|
10
7
|
hashHexCharacters: number;
|
|
11
8
|
compress: any;
|
|
@@ -14,26 +11,9 @@ export default class HttpMap {
|
|
|
14
11
|
getHashHexCharacters(): Promise<number>;
|
|
15
12
|
getCompress(): Promise<any>;
|
|
16
13
|
getTrackNames(): Promise<any>;
|
|
17
|
-
/**
|
|
18
|
-
* Returns contents of a bucket given a key
|
|
19
|
-
* @param key - string
|
|
20
|
-
*/
|
|
21
14
|
get(key: string): Promise<any>;
|
|
22
|
-
/**
|
|
23
|
-
* Returns a bucket given a key
|
|
24
|
-
* @param key - string
|
|
25
|
-
*/
|
|
26
15
|
getBucket(key: string): Promise<any>;
|
|
27
|
-
/**
|
|
28
|
-
* Loads a file using the url and provided id.
|
|
29
|
-
* Returns response object with contents of the file
|
|
30
|
-
* @param id - string
|
|
31
|
-
*/
|
|
32
16
|
loadFile(id: string): Promise<any>;
|
|
33
|
-
/**
|
|
34
|
-
* Returns the corresponding path of the file given a hex string
|
|
35
|
-
* @param hex - hex string
|
|
36
|
-
*/
|
|
37
17
|
hexToDirPath(hex: string): Promise<string>;
|
|
38
18
|
hash(data: string): string;
|
|
39
19
|
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper class allows reading names index generated in JBrowse1
|
|
3
|
-
* Adapted from https://github.com/GMOD/jbrowse/blob/master/src/JBrowse/Store/Hash.js
|
|
4
|
-
*/
|
|
5
1
|
import crc32 from 'crc/crc32';
|
|
6
|
-
import { Buffer } from 'buffer';
|
|
7
2
|
export default class HttpMap {
|
|
8
3
|
constructor(args) {
|
|
9
|
-
// make sure url has a trailing slash
|
|
10
4
|
this.url = args.url.endsWith('/') ? args.url : `${args.url}/`;
|
|
11
5
|
}
|
|
12
|
-
/**
|
|
13
|
-
* loads meta.json file from names directory and reads number of hash_bits used
|
|
14
|
-
*/
|
|
15
6
|
async readMeta() {
|
|
16
7
|
const meta = await this.loadFile('meta.json');
|
|
17
8
|
const { compress, track_names: tracks } = meta;
|
|
@@ -30,28 +21,15 @@ export default class HttpMap {
|
|
|
30
21
|
const meta = await this.readMeta();
|
|
31
22
|
return meta.tracks;
|
|
32
23
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Returns contents of a bucket given a key
|
|
35
|
-
* @param key - string
|
|
36
|
-
*/
|
|
37
24
|
async get(key) {
|
|
38
25
|
const bucket = await this.getBucket(key);
|
|
39
26
|
return bucket[key];
|
|
40
27
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Returns a bucket given a key
|
|
43
|
-
* @param key - string
|
|
44
|
-
*/
|
|
45
28
|
async getBucket(key) {
|
|
46
29
|
const bucketIdent = this.hash(key);
|
|
47
30
|
const hexToDirPath = await this.hexToDirPath(bucketIdent);
|
|
48
31
|
return this.loadFile(hexToDirPath);
|
|
49
32
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Loads a file using the url and provided id.
|
|
52
|
-
* Returns response object with contents of the file
|
|
53
|
-
* @param id - string
|
|
54
|
-
*/
|
|
55
33
|
async loadFile(id) {
|
|
56
34
|
const response = await fetch(`${this.url}${id}`);
|
|
57
35
|
if (!response.ok) {
|
|
@@ -59,12 +37,7 @@ export default class HttpMap {
|
|
|
59
37
|
}
|
|
60
38
|
return response.json();
|
|
61
39
|
}
|
|
62
|
-
/**
|
|
63
|
-
* Returns the corresponding path of the file given a hex string
|
|
64
|
-
* @param hex - hex string
|
|
65
|
-
*/
|
|
66
40
|
async hexToDirPath(hex) {
|
|
67
|
-
// zero-pad the hex string to be 8 chars if necessary
|
|
68
41
|
const hashHexCharacters = await this.getHashHexCharacters();
|
|
69
42
|
if (hashHexCharacters) {
|
|
70
43
|
const compress = await this.getCompress();
|
|
@@ -81,6 +54,6 @@ export default class HttpMap {
|
|
|
81
54
|
return '';
|
|
82
55
|
}
|
|
83
56
|
hash(data) {
|
|
84
|
-
return crc32(
|
|
57
|
+
return crc32(data).toString(16).toLowerCase().replace('-', 'n');
|
|
85
58
|
}
|
|
86
59
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BaseTextSearchAdapter, BaseTextSearchArgs, BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
1
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
3
|
-
import {
|
|
2
|
+
import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
3
|
import HttpMap from './HttpMap';
|
|
5
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
|
-
import {
|
|
4
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
5
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
6
|
+
import type { BaseTextSearchAdapter, BaseTextSearchArgs } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
7
|
+
import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
8
|
export interface TooManyHits {
|
|
8
9
|
name: string;
|
|
9
10
|
hitLimit: number;
|
|
@@ -20,11 +21,6 @@ export default class JBrowse1TextSearchAdapter extends BaseAdapter implements Ba
|
|
|
20
21
|
httpMap: HttpMap;
|
|
21
22
|
tracksNames?: string[];
|
|
22
23
|
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
23
|
-
/**
|
|
24
|
-
* Returns the contents of the file containing the query if it exists
|
|
25
|
-
* else it returns empty
|
|
26
|
-
* @param query - string query
|
|
27
|
-
*/
|
|
28
24
|
loadIndexFile(query: string): Promise<IndexFile>;
|
|
29
25
|
searchIndex(args: BaseTextSearchArgs): Promise<BaseResult[]>;
|
|
30
26
|
formatResults(results: SearchResults, tracks: string[], searchType?: string): BaseResult[];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BaseAdapter, } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
1
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
3
|
-
import { readConfObject
|
|
2
|
+
import { readConfObject } from '@jbrowse/core/configuration';
|
|
3
|
+
import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
4
|
import HttpMap from './HttpMap';
|
|
5
|
-
// Uses index built by generate-names.pl
|
|
6
5
|
export default class JBrowse1TextSearchAdapter extends BaseAdapter {
|
|
7
6
|
constructor(config, getSubAdapter, pluginManager) {
|
|
8
7
|
super(config, getSubAdapter, pluginManager);
|
|
@@ -12,11 +11,6 @@ export default class JBrowse1TextSearchAdapter extends BaseAdapter {
|
|
|
12
11
|
url: baseUri ? new URL(uri, baseUri).href : uri,
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Returns the contents of the file containing the query if it exists
|
|
17
|
-
* else it returns empty
|
|
18
|
-
* @param query - string query
|
|
19
|
-
*/
|
|
20
14
|
async loadIndexFile(query) {
|
|
21
15
|
return this.httpMap.getBucket(query);
|
|
22
16
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
namesIndexLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -10,17 +7,11 @@ declare const _default: import("@jbrowse/core/configuration/configurationSchema"
|
|
|
10
7
|
};
|
|
11
8
|
description: string;
|
|
12
9
|
};
|
|
13
|
-
/**
|
|
14
|
-
* #slot
|
|
15
|
-
*/
|
|
16
10
|
tracks: {
|
|
17
11
|
type: string;
|
|
18
12
|
defaultValue: never[];
|
|
19
13
|
description: string;
|
|
20
14
|
};
|
|
21
|
-
/**
|
|
22
|
-
* #slot
|
|
23
|
-
*/
|
|
24
15
|
assemblyNames: {
|
|
25
16
|
type: string;
|
|
26
17
|
defaultValue: never[];
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config JBrowse1TextSearchAdapter
|
|
4
|
-
* note: metadata about tracks and assemblies covered by text search adapter
|
|
5
|
-
*/
|
|
6
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
7
3
|
export default ConfigurationSchema('JBrowse1TextSearchAdapter', {
|
|
8
|
-
/**
|
|
9
|
-
* #slot
|
|
10
|
-
*/
|
|
11
4
|
namesIndexLocation: {
|
|
12
5
|
type: 'fileLocation',
|
|
13
6
|
defaultValue: { uri: '/volvox/names', locationType: 'UriLocation' },
|
|
14
7
|
description: 'the location of the JBrowse1 names index data directory',
|
|
15
8
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
9
|
tracks: {
|
|
20
10
|
type: 'stringArray',
|
|
21
11
|
defaultValue: [],
|
|
22
12
|
description: 'List of tracks covered by text search adapter',
|
|
23
13
|
},
|
|
24
|
-
/**
|
|
25
|
-
* #slot
|
|
26
|
-
*/
|
|
27
14
|
assemblyNames: {
|
|
28
15
|
type: 'stringArray',
|
|
29
16
|
defaultValue: [],
|
|
@@ -31,8 +18,5 @@ export default ConfigurationSchema('JBrowse1TextSearchAdapter', {
|
|
|
31
18
|
},
|
|
32
19
|
}, {
|
|
33
20
|
explicitlyTyped: true,
|
|
34
|
-
/**
|
|
35
|
-
* #identifier
|
|
36
|
-
*/
|
|
37
21
|
explicitIdentifier: 'textSearchAdapterId',
|
|
38
22
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function JBrowse1TextSearchAdapterF(pluginManager: PluginManager): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType';
|
|
2
|
-
// locals
|
|
3
2
|
import configSchema from './configSchema';
|
|
4
3
|
export default function JBrowse1TextSearchAdapterF(pluginManager) {
|
|
5
4
|
pluginManager.addTextSearchAdapterType(() => new TextSearchAdapterType({
|
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
1
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
2
|
import NCListFeature from './NCListFeature';
|
|
5
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
4
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
5
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
6
|
+
import type { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
|
+
import type { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
8
|
+
import type { Region } from '@jbrowse/core/util/types';
|
|
8
9
|
export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
9
10
|
private nclist;
|
|
10
11
|
private configRefNames?;
|
|
11
12
|
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
12
|
-
/**
|
|
13
|
-
* Fetch features for a certain region. Use getFeaturesInRegion() if you also
|
|
14
|
-
* want to verify that the store has features for the given reference sequence
|
|
15
|
-
* before fetching.
|
|
16
|
-
* @param region -
|
|
17
|
-
* @param opts - [signal] optional signalling object for aborting the fetch
|
|
18
|
-
* @returns Observable of Feature objects in the region
|
|
19
|
-
*/
|
|
20
13
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
21
14
|
wrapFeature(ncFeature: any): NCListFeature;
|
|
22
15
|
hasDataForRefName(refName: string): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* NCList is unable to get list of ref names so returns empty
|
|
25
|
-
*/
|
|
26
16
|
getRefNames(): Promise<string[]>;
|
|
27
|
-
/**
|
|
28
|
-
* called to provide a hint that data tied to a certain region
|
|
29
|
-
* will not be needed for the foreseeable future and can be purged
|
|
30
|
-
* from caches, etc
|
|
31
|
-
*/
|
|
32
17
|
freeResources(): void;
|
|
33
18
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import NCListStore from '@gmod/nclist';
|
|
2
|
-
import { BaseFeatureDataAdapter
|
|
2
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
3
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
4
|
-
import {
|
|
5
|
-
import { RemoteFile } from 'generic-
|
|
4
|
+
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
5
|
+
import { RemoteFile } from 'generic-filehandle2';
|
|
6
6
|
import NCListFeature from './NCListFeature';
|
|
7
7
|
export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
8
8
|
constructor(config, getSubAdapter, pluginManager) {
|
|
@@ -18,19 +18,11 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
|
18
18
|
: url)).readFile(),
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Fetch features for a certain region. Use getFeaturesInRegion() if you also
|
|
23
|
-
* want to verify that the store has features for the given reference sequence
|
|
24
|
-
* before fetching.
|
|
25
|
-
* @param region -
|
|
26
|
-
* @param opts - [signal] optional signalling object for aborting the fetch
|
|
27
|
-
* @returns Observable of Feature objects in the region
|
|
28
|
-
*/
|
|
29
21
|
getFeatures(region, opts = {}) {
|
|
30
22
|
return ObservableCreate(async (observer) => {
|
|
31
|
-
const {
|
|
23
|
+
const { stopToken } = opts;
|
|
32
24
|
for await (const feature of this.nclist.getFeatures(region, opts)) {
|
|
33
|
-
|
|
25
|
+
checkStopToken(stopToken);
|
|
34
26
|
observer.next(this.wrapFeature(feature));
|
|
35
27
|
}
|
|
36
28
|
observer.complete();
|
|
@@ -44,16 +36,8 @@ export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
|
44
36
|
const root = await this.nclist.getDataRoot(refName);
|
|
45
37
|
return !!((_a = root === null || root === void 0 ? void 0 : root.stats) === null || _a === void 0 ? void 0 : _a.featureCount);
|
|
46
38
|
}
|
|
47
|
-
/**
|
|
48
|
-
* NCList is unable to get list of ref names so returns empty
|
|
49
|
-
*/
|
|
50
39
|
async getRefNames() {
|
|
51
40
|
return this.configRefNames || [];
|
|
52
41
|
}
|
|
53
|
-
/**
|
|
54
|
-
* called to provide a hint that data tied to a certain region
|
|
55
|
-
* will not be needed for the foreseeable future and can be purged
|
|
56
|
-
* from caches, etc
|
|
57
|
-
*/
|
|
58
42
|
freeResources() { }
|
|
59
43
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
-
/**
|
|
3
|
-
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
4
|
-
*/
|
|
1
|
+
import type { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
5
2
|
export default class NCListFeature implements Feature {
|
|
6
3
|
private ncFeature;
|
|
7
4
|
private parentHandle?;
|
|
@@ -11,21 +8,9 @@ export default class NCListFeature implements Feature {
|
|
|
11
8
|
jb2TagToJb1Tag(tag: string): string;
|
|
12
9
|
jb1TagToJb2Tag(tag: string): string;
|
|
13
10
|
get(attrName: string): any;
|
|
14
|
-
/**
|
|
15
|
-
* Get an array listing which data keys are present in this feature.
|
|
16
|
-
*/
|
|
17
11
|
tags(): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Get the unique ID of this feature.
|
|
20
|
-
*/
|
|
21
12
|
id(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Get this feature's parent feature, or undefined if none.
|
|
24
|
-
*/
|
|
25
13
|
parent(): Feature | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Get an array of child features, or undefined if none.
|
|
28
|
-
*/
|
|
29
14
|
children(): Feature[] | undefined;
|
|
30
15
|
toJSON(): SimpleFeatureSerialized;
|
|
31
16
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
const jb2ToJb1 = { refName: 'seq_id' };
|
|
2
2
|
const jb1ToJb2 = { seq_id: 'refName' };
|
|
3
|
-
/**
|
|
4
|
-
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
5
|
-
*/
|
|
6
3
|
export default class NCListFeature {
|
|
7
4
|
constructor(ncFeature, parent, id) {
|
|
8
5
|
this.ncFeature = ncFeature;
|
|
@@ -13,13 +10,11 @@ export default class NCListFeature {
|
|
|
13
10
|
throw new Error('not implemented');
|
|
14
11
|
}
|
|
15
12
|
jb2TagToJb1Tag(tag) {
|
|
16
|
-
// @ts-expect-error
|
|
17
13
|
const mapped = jb2ToJb1[tag] || tag;
|
|
18
14
|
return mapped.toLowerCase();
|
|
19
15
|
}
|
|
20
16
|
jb1TagToJb2Tag(tag) {
|
|
21
17
|
const t = tag.toLowerCase();
|
|
22
|
-
// @ts-expect-error
|
|
23
18
|
return jb1ToJb2[t] || t;
|
|
24
19
|
}
|
|
25
20
|
get(attrName) {
|
|
@@ -29,39 +24,25 @@ export default class NCListFeature {
|
|
|
29
24
|
}
|
|
30
25
|
return attr;
|
|
31
26
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Get an array listing which data keys are present in this feature.
|
|
34
|
-
*/
|
|
35
27
|
tags() {
|
|
36
28
|
return this.ncFeature.tags().map((t) => this.jb1TagToJb2Tag(t));
|
|
37
29
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Get the unique ID of this feature.
|
|
40
|
-
*/
|
|
41
30
|
id() {
|
|
42
31
|
return this.uniqueId;
|
|
43
32
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Get this feature's parent feature, or undefined if none.
|
|
46
|
-
*/
|
|
47
33
|
parent() {
|
|
48
34
|
return this.parentHandle;
|
|
49
35
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Get an array of child features, or undefined if none.
|
|
52
|
-
*/
|
|
53
36
|
children() {
|
|
54
37
|
return this.get('subfeatures');
|
|
55
38
|
}
|
|
56
39
|
toJSON() {
|
|
57
|
-
// @ts-expect-error
|
|
58
40
|
const data = { uniqueId: this.id() };
|
|
59
41
|
this.ncFeature.tags().forEach((tag) => {
|
|
60
42
|
const mappedTag = this.jb1TagToJb2Tag(tag);
|
|
61
43
|
const value = this.ncFeature.get(tag);
|
|
62
44
|
if (mappedTag === 'subfeatures') {
|
|
63
45
|
data.subfeatures = (value || []).map((f) => {
|
|
64
|
-
// note: was new NCListFeature(f, `${this.id()}-${i}`, this).toJSON()
|
|
65
46
|
return new NCListFeature(f, this).toJSON();
|
|
66
47
|
});
|
|
67
48
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const NCListAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
rootUrlTemplate: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,9 +6,6 @@ declare const NCListAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
refNames: {
|
|
16
10
|
type: string;
|
|
17
11
|
defaultValue: never[];
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config NCListAdapter
|
|
4
|
-
*/
|
|
5
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
6
3
|
const NCListAdapter = ConfigurationSchema('NCListAdapter', {
|
|
7
|
-
/**
|
|
8
|
-
* #slot
|
|
9
|
-
*/
|
|
10
4
|
rootUrlTemplate: {
|
|
11
5
|
type: 'fileLocation',
|
|
12
6
|
defaultValue: {
|
|
@@ -14,9 +8,6 @@ const NCListAdapter = ConfigurationSchema('NCListAdapter', {
|
|
|
14
8
|
locationType: 'UriLocation',
|
|
15
9
|
},
|
|
16
10
|
},
|
|
17
|
-
/**
|
|
18
|
-
* #slot
|
|
19
|
-
*/
|
|
20
11
|
refNames: {
|
|
21
12
|
type: 'stringArray',
|
|
22
13
|
defaultValue: [],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function NCListAdapterF(pluginManager: PluginManager): void;
|
|
@@ -5,6 +5,9 @@ export default function NCListAdapterF(pluginManager) {
|
|
|
5
5
|
name: 'NCListAdapter',
|
|
6
6
|
displayName: 'NCList adapter',
|
|
7
7
|
configSchema,
|
|
8
|
+
adapterMetadata: {
|
|
9
|
+
category: 'Uncommon',
|
|
10
|
+
},
|
|
8
11
|
getAdapterClass: () => import('./NCListAdapter').then(r => r.default),
|
|
9
12
|
}));
|
|
10
13
|
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class LegacyJBrowsePlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import NCListAdapterF from './NCListAdapter';
|
|
3
|
-
import JBrowse1TextSearchAdapterF from './JBrowse1TextSearchAdapter';
|
|
4
|
-
import JBrowse1ConnectionF from './JBrowse1Connection';
|
|
5
2
|
import GuessNCListF from './GuessNCList';
|
|
3
|
+
import JBrowse1ConnectionF from './JBrowse1Connection';
|
|
4
|
+
import JBrowse1TextSearchAdapterF from './JBrowse1TextSearchAdapter';
|
|
5
|
+
import NCListAdapterF from './NCListAdapter';
|
|
6
6
|
export default class LegacyJBrowsePlugin extends Plugin {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-legacy-jbrowse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@gmod/nclist": "^
|
|
39
|
+
"@gmod/nclist": "^2.0.0",
|
|
40
40
|
"crc": "^4.0.0",
|
|
41
|
-
"generic-
|
|
42
|
-
"get-value": "^3.0.
|
|
41
|
+
"generic-filehandle2": "^1.0.0",
|
|
42
|
+
"get-value": "^3.0.0",
|
|
43
43
|
"set-value": "^4.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"distModule": "esm/index.js",
|
|
56
56
|
"srcModule": "src/index.ts",
|
|
57
57
|
"module": "esm/index.js",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
|
|
59
59
|
}
|