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