@jbrowse/plugin-legacy-jbrowse 3.6.5 → 4.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/esm/JBrowse1Connection/configSchema.d.ts +3 -3
- package/esm/JBrowse1Connection/get-value.d.ts +10 -0
- package/esm/JBrowse1Connection/get-value.js +84 -0
- package/esm/JBrowse1Connection/index.js +2 -2
- package/esm/JBrowse1Connection/jb1ConfigLoad.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ConfigLoad.js +2 -2
- package/esm/JBrowse1Connection/jb1ConfigParse.d.ts +1 -1
- package/esm/JBrowse1Connection/jb1ConfigParse.js +12 -10
- package/esm/JBrowse1Connection/jb1ToJb2.d.ts +2 -3
- package/esm/JBrowse1Connection/jb1ToJb2.js +43 -45
- package/esm/JBrowse1Connection/model.d.ts +16 -24
- package/esm/JBrowse1Connection/model.js +8 -14
- package/esm/JBrowse1Connection/util.d.ts +1 -1
- package/esm/JBrowse1Connection/util.js +13 -3
- package/esm/JBrowse1TextSearchAdapter/HttpMap.js +16 -1
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +1 -1
- package/esm/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +3 -1
- package/esm/JBrowse1TextSearchAdapter/configSchema.d.ts +2 -2
- package/esm/JBrowse1TextSearchAdapter/index.js +2 -2
- package/esm/NCListAdapter/NCListAdapter.d.ts +1 -1
- package/esm/NCListAdapter/NCListAdapter.js +6 -5
- package/esm/NCListAdapter/NCListFeature.js +3 -0
- package/esm/NCListAdapter/configSchema.d.ts +2 -2
- package/esm/NCListAdapter/index.js +2 -2
- package/esm/index.js +5 -8
- package/package.json +25 -33
- package/dist/GuessNCList/index.d.ts +0 -2
- package/dist/GuessNCList/index.js +0 -18
- package/dist/JBrowse1Connection/configSchema.d.ts +0 -27
- package/dist/JBrowse1Connection/configSchema.js +0 -23
- package/dist/JBrowse1Connection/index.d.ts +0 -2
- package/dist/JBrowse1Connection/index.js +0 -19
- package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +0 -36
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +0 -253
- package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +0 -4
- package/dist/JBrowse1Connection/jb1ConfigParse.js +0 -341
- package/dist/JBrowse1Connection/jb1ToJb2.d.ts +0 -49
- package/dist/JBrowse1Connection/jb1ToJb2.js +0 -408
- package/dist/JBrowse1Connection/model.d.ts +0 -75
- package/dist/JBrowse1Connection/model.js +0 -82
- package/dist/JBrowse1Connection/types.d.ts +0 -91
- package/dist/JBrowse1Connection/types.js +0 -2
- package/dist/JBrowse1Connection/util.d.ts +0 -8
- package/dist/JBrowse1Connection/util.js +0 -86
- package/dist/JBrowse1TextSearchAdapter/HttpMap.d.ts +0 -19
- package/dist/JBrowse1TextSearchAdapter/HttpMap.js +0 -65
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.d.ts +0 -28
- package/dist/JBrowse1TextSearchAdapter/JBrowse1TextSearchAdapter.js +0 -58
- package/dist/JBrowse1TextSearchAdapter/configSchema.d.ts +0 -21
- package/dist/JBrowse1TextSearchAdapter/configSchema.js +0 -24
- package/dist/JBrowse1TextSearchAdapter/index.d.ts +0 -2
- package/dist/JBrowse1TextSearchAdapter/index.js +0 -49
- package/dist/NCListAdapter/NCListAdapter.d.ts +0 -17
- package/dist/NCListAdapter/NCListAdapter.js +0 -48
- package/dist/NCListAdapter/NCListFeature.d.ts +0 -16
- package/dist/NCListAdapter/NCListFeature.js +0 -58
- package/dist/NCListAdapter/configSchema.d.ts +0 -15
- package/dist/NCListAdapter/configSchema.js +0 -21
- package/dist/NCListAdapter/index.d.ts +0 -2
- package/dist/NCListAdapter/index.js +0 -52
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -23
|
@@ -1,86 +0,0 @@
|
|
|
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.isTrack = isTrack;
|
|
7
|
-
exports.isSource = isSource;
|
|
8
|
-
exports.deepUpdate = deepUpdate;
|
|
9
|
-
exports.fillTemplate = fillTemplate;
|
|
10
|
-
exports.structuredClone = structuredClone;
|
|
11
|
-
const get_value_1 = __importDefault(require("get-value"));
|
|
12
|
-
function isTrack(arg) {
|
|
13
|
-
return (arg === null || arg === void 0 ? void 0 : arg.label) && typeof arg.label === 'string';
|
|
14
|
-
}
|
|
15
|
-
function isSource(arg) {
|
|
16
|
-
return (arg === null || arg === void 0 ? void 0 : arg.url) && typeof arg.url === 'string';
|
|
17
|
-
}
|
|
18
|
-
function deepUpdate(a, b) {
|
|
19
|
-
for (const prop of Object.keys(b)) {
|
|
20
|
-
if (prop in a &&
|
|
21
|
-
typeof b[prop] === 'object' &&
|
|
22
|
-
typeof a[prop] === 'object') {
|
|
23
|
-
deepUpdate(a[prop], b[prop]);
|
|
24
|
-
}
|
|
25
|
-
else if (a[prop] === undefined || b[prop] !== undefined) {
|
|
26
|
-
a[prop] = b[prop];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return a;
|
|
30
|
-
}
|
|
31
|
-
function fillTemplate(template, fillWith) {
|
|
32
|
-
return template.replaceAll(/{([\s\w.]+)}/g, (match, varName) => {
|
|
33
|
-
varName = varName.replaceAll(/\s+/g, '');
|
|
34
|
-
const fill = (0, get_value_1.default)(fillWith, varName);
|
|
35
|
-
if (fill !== undefined) {
|
|
36
|
-
return typeof fill === 'function' ? fill(varName) : fill;
|
|
37
|
-
}
|
|
38
|
-
if (fillWith.callback) {
|
|
39
|
-
const v = fillWith.callback.call(this, varName);
|
|
40
|
-
if (v !== undefined) {
|
|
41
|
-
return v;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return match;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function structuredClone(src) {
|
|
48
|
-
if (!src ||
|
|
49
|
-
typeof src !== 'object' ||
|
|
50
|
-
Object.prototype.toString.call(src) === '[object Function]') {
|
|
51
|
-
return src;
|
|
52
|
-
}
|
|
53
|
-
if (src.nodeType && 'cloneNode' in src) {
|
|
54
|
-
return src.cloneNode(true);
|
|
55
|
-
}
|
|
56
|
-
if (src instanceof Date) {
|
|
57
|
-
return new Date(src);
|
|
58
|
-
}
|
|
59
|
-
if (src instanceof RegExp) {
|
|
60
|
-
return new RegExp(src);
|
|
61
|
-
}
|
|
62
|
-
let r;
|
|
63
|
-
if (Array.isArray(src)) {
|
|
64
|
-
r = [];
|
|
65
|
-
for (let i = 0, l = src.length; i < l; ++i) {
|
|
66
|
-
if (i in src) {
|
|
67
|
-
r[i] = structuredClone(src[i]);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
r = src.constructor ? new src.constructor() : {};
|
|
73
|
-
}
|
|
74
|
-
return mixin(r, src, a => structuredClone(a));
|
|
75
|
-
}
|
|
76
|
-
function mixin(dest, source, copyFunc) {
|
|
77
|
-
const empty = {};
|
|
78
|
-
for (const name in source) {
|
|
79
|
-
const s = source[name];
|
|
80
|
-
if (!(name in dest) ||
|
|
81
|
-
(dest[name] !== s && (!(name in empty) || empty[name] !== s))) {
|
|
82
|
-
dest[name] = copyFunc ? copyFunc(s) : s;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return dest;
|
|
86
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default class HttpMap {
|
|
2
|
-
url: string;
|
|
3
|
-
constructor(args: {
|
|
4
|
-
url: string;
|
|
5
|
-
});
|
|
6
|
-
readMeta(): Promise<{
|
|
7
|
-
hashHexCharacters: number;
|
|
8
|
-
compress: any;
|
|
9
|
-
tracks: any;
|
|
10
|
-
}>;
|
|
11
|
-
getHashHexCharacters(): Promise<number>;
|
|
12
|
-
getCompress(): Promise<any>;
|
|
13
|
-
getTrackNames(): Promise<any>;
|
|
14
|
-
get(key: string): Promise<any>;
|
|
15
|
-
getBucket(key: string): Promise<any>;
|
|
16
|
-
loadFile(id: string): Promise<any>;
|
|
17
|
-
hexToDirPath(hex: string): Promise<string>;
|
|
18
|
-
hash(data: string): string;
|
|
19
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
const crc32_1 = __importDefault(require("crc/crc32"));
|
|
7
|
-
class HttpMap {
|
|
8
|
-
constructor(args) {
|
|
9
|
-
this.url = args.url.endsWith('/') ? args.url : `${args.url}/`;
|
|
10
|
-
}
|
|
11
|
-
async readMeta() {
|
|
12
|
-
const meta = await this.loadFile('meta.json');
|
|
13
|
-
const { compress, track_names: tracks } = meta;
|
|
14
|
-
const hashHexCharacters = Math.ceil(meta.hash_bits / 4);
|
|
15
|
-
return { hashHexCharacters, compress, tracks };
|
|
16
|
-
}
|
|
17
|
-
async getHashHexCharacters() {
|
|
18
|
-
const meta = await this.readMeta();
|
|
19
|
-
return meta.hashHexCharacters;
|
|
20
|
-
}
|
|
21
|
-
async getCompress() {
|
|
22
|
-
const meta = await this.readMeta();
|
|
23
|
-
return meta.compress;
|
|
24
|
-
}
|
|
25
|
-
async getTrackNames() {
|
|
26
|
-
const meta = await this.readMeta();
|
|
27
|
-
return meta.tracks;
|
|
28
|
-
}
|
|
29
|
-
async get(key) {
|
|
30
|
-
const bucket = await this.getBucket(key);
|
|
31
|
-
return bucket[key];
|
|
32
|
-
}
|
|
33
|
-
async getBucket(key) {
|
|
34
|
-
const bucketIdent = this.hash(key);
|
|
35
|
-
const hexToDirPath = await this.hexToDirPath(bucketIdent);
|
|
36
|
-
return this.loadFile(hexToDirPath);
|
|
37
|
-
}
|
|
38
|
-
async loadFile(id) {
|
|
39
|
-
const response = await fetch(`${this.url}${id}`);
|
|
40
|
-
if (!response.ok) {
|
|
41
|
-
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
42
|
-
}
|
|
43
|
-
return response.json();
|
|
44
|
-
}
|
|
45
|
-
async hexToDirPath(hex) {
|
|
46
|
-
const hashHexCharacters = await this.getHashHexCharacters();
|
|
47
|
-
if (hashHexCharacters) {
|
|
48
|
-
const compress = await this.getCompress();
|
|
49
|
-
while (hex.length < 8) {
|
|
50
|
-
hex = `0${hex}`;
|
|
51
|
-
}
|
|
52
|
-
hex = hex.slice(8 - hashHexCharacters);
|
|
53
|
-
const dirpath = [];
|
|
54
|
-
for (let i = 0; i < hex.length; i += 3) {
|
|
55
|
-
dirpath.push(hex.slice(i, i + 3));
|
|
56
|
-
}
|
|
57
|
-
return `${dirpath.join('/')}.json${compress ? 'z' : ''}`;
|
|
58
|
-
}
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
hash(data) {
|
|
62
|
-
return (0, crc32_1.default)(data).toString(16).toLowerCase().replace('-', 'n');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.default = HttpMap;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
2
|
-
import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import HttpMap from './HttpMap';
|
|
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';
|
|
8
|
-
export interface TooManyHits {
|
|
9
|
-
name: string;
|
|
10
|
-
hitLimit: number;
|
|
11
|
-
}
|
|
12
|
-
interface SearchResults {
|
|
13
|
-
prefix: ({
|
|
14
|
-
name: string;
|
|
15
|
-
} | string)[];
|
|
16
|
-
exact: [string, number, string, string, number, number][];
|
|
17
|
-
}
|
|
18
|
-
export type NamesIndexRecord = string | (string | number)[];
|
|
19
|
-
type IndexFile = Record<string, SearchResults>;
|
|
20
|
-
export default class JBrowse1TextSearchAdapter extends BaseAdapter implements BaseTextSearchAdapter {
|
|
21
|
-
httpMap: HttpMap;
|
|
22
|
-
tracksNames?: string[];
|
|
23
|
-
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
24
|
-
loadIndexFile(query: string): Promise<IndexFile>;
|
|
25
|
-
searchIndex(args: BaseTextSearchArgs): Promise<BaseResult[]>;
|
|
26
|
-
formatResults(results: SearchResults, tracks: string[], searchType?: string): BaseResult[];
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
const BaseResults_1 = __importDefault(require("@jbrowse/core/TextSearch/BaseResults"));
|
|
7
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
8
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
-
const HttpMap_1 = __importDefault(require("./HttpMap"));
|
|
10
|
-
class JBrowse1TextSearchAdapter extends BaseAdapter_1.BaseAdapter {
|
|
11
|
-
constructor(config, getSubAdapter, pluginManager) {
|
|
12
|
-
super(config, getSubAdapter, pluginManager);
|
|
13
|
-
const namesIndex = (0, configuration_1.readConfObject)(config, 'namesIndexLocation');
|
|
14
|
-
const { baseUri, uri } = namesIndex;
|
|
15
|
-
this.httpMap = new HttpMap_1.default({
|
|
16
|
-
url: baseUri ? new URL(uri, baseUri).href : uri,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
async loadIndexFile(query) {
|
|
20
|
-
return this.httpMap.getBucket(query);
|
|
21
|
-
}
|
|
22
|
-
async searchIndex(args) {
|
|
23
|
-
const { searchType, queryString } = args;
|
|
24
|
-
const tracks = this.tracksNames || (await this.httpMap.getTrackNames());
|
|
25
|
-
const str = queryString.toLowerCase();
|
|
26
|
-
const entries = await this.loadIndexFile(str);
|
|
27
|
-
return entries[str]
|
|
28
|
-
? this.formatResults(entries[str], tracks, searchType)
|
|
29
|
-
: [];
|
|
30
|
-
}
|
|
31
|
-
formatResults(results, tracks, searchType) {
|
|
32
|
-
return [
|
|
33
|
-
...(searchType === 'exact'
|
|
34
|
-
? []
|
|
35
|
-
: results.prefix.map(result => new BaseResults_1.default({
|
|
36
|
-
label: typeof result === 'object' ? result.name : result,
|
|
37
|
-
matchedAttribute: 'name',
|
|
38
|
-
matchedObject: { result: result },
|
|
39
|
-
}))),
|
|
40
|
-
...results.exact.map(result => {
|
|
41
|
-
const name = result[0];
|
|
42
|
-
const trackIndex = result[1];
|
|
43
|
-
const refName = result[3];
|
|
44
|
-
const start = result[4];
|
|
45
|
-
const end = result[5];
|
|
46
|
-
const locstring = `${refName || name}:${start}-${end}`;
|
|
47
|
-
return new BaseResults_1.default({
|
|
48
|
-
locString: locstring,
|
|
49
|
-
label: name,
|
|
50
|
-
matchedAttribute: 'name',
|
|
51
|
-
matchedObject: result,
|
|
52
|
-
trackId: tracks[trackIndex],
|
|
53
|
-
});
|
|
54
|
-
}),
|
|
55
|
-
].filter(result => result.getLabel() !== 'too many matches');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = JBrowse1TextSearchAdapter;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
namesIndexLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
description: string;
|
|
9
|
-
};
|
|
10
|
-
tracks: {
|
|
11
|
-
type: string;
|
|
12
|
-
defaultValue: never[];
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
assemblyNames: {
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: never[];
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "textSearchAdapterId">>;
|
|
21
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
function x() { }
|
|
5
|
-
exports.default = (0, configuration_1.ConfigurationSchema)('JBrowse1TextSearchAdapter', {
|
|
6
|
-
namesIndexLocation: {
|
|
7
|
-
type: 'fileLocation',
|
|
8
|
-
defaultValue: { uri: '/volvox/names', locationType: 'UriLocation' },
|
|
9
|
-
description: 'the location of the JBrowse1 names index data directory',
|
|
10
|
-
},
|
|
11
|
-
tracks: {
|
|
12
|
-
type: 'stringArray',
|
|
13
|
-
defaultValue: [],
|
|
14
|
-
description: 'List of tracks covered by text search adapter',
|
|
15
|
-
},
|
|
16
|
-
assemblyNames: {
|
|
17
|
-
type: 'stringArray',
|
|
18
|
-
defaultValue: [],
|
|
19
|
-
description: 'List of assemblies covered by text search adapter',
|
|
20
|
-
},
|
|
21
|
-
}, {
|
|
22
|
-
explicitlyTyped: true,
|
|
23
|
-
explicitIdentifier: 'textSearchAdapterId',
|
|
24
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
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 = JBrowse1TextSearchAdapterF;
|
|
40
|
-
const TextSearchAdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function JBrowse1TextSearchAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addTextSearchAdapterType(() => new TextSearchAdapterType_1.default({
|
|
44
|
-
name: 'JBrowse1TextSearchAdapter',
|
|
45
|
-
configSchema: configSchema_1.default,
|
|
46
|
-
description: 'A JBrowse 1 text search adapter',
|
|
47
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./JBrowse1TextSearchAdapter'))).then(t => t.default),
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import NCListFeature from './NCListFeature';
|
|
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';
|
|
9
|
-
export default class NCListAdapter extends BaseFeatureDataAdapter {
|
|
10
|
-
private nclist;
|
|
11
|
-
private configRefNames?;
|
|
12
|
-
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
13
|
-
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
14
|
-
wrapFeature(ncFeature: any): NCListFeature;
|
|
15
|
-
hasDataForRefName(refName: string): Promise<boolean>;
|
|
16
|
-
getRefNames(): Promise<string[]>;
|
|
17
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
const nclist_1 = __importDefault(require("@gmod/nclist"));
|
|
7
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
8
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
9
|
-
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
10
|
-
const generic_filehandle2_1 = require("generic-filehandle2");
|
|
11
|
-
const NCListFeature_1 = __importDefault(require("./NCListFeature"));
|
|
12
|
-
class NCListAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
13
|
-
constructor(config, getSubAdapter, pluginManager) {
|
|
14
|
-
super(config, getSubAdapter, pluginManager);
|
|
15
|
-
const refNames = this.getConf('refNames');
|
|
16
|
-
const rootUrlTemplate = this.getConf('rootUrlTemplate');
|
|
17
|
-
this.configRefNames = refNames;
|
|
18
|
-
this.nclist = new nclist_1.default({
|
|
19
|
-
baseUrl: '',
|
|
20
|
-
urlTemplate: rootUrlTemplate.uri,
|
|
21
|
-
readFile: (url) => new generic_filehandle2_1.RemoteFile(String(rootUrlTemplate.baseUri
|
|
22
|
-
? new URL(url, rootUrlTemplate.baseUri).toString()
|
|
23
|
-
: url)).readFile(),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
getFeatures(region, opts = {}) {
|
|
27
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
28
|
-
const { stopToken } = opts;
|
|
29
|
-
for await (const feature of this.nclist.getFeatures(region, opts)) {
|
|
30
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
31
|
-
observer.next(this.wrapFeature(feature));
|
|
32
|
-
}
|
|
33
|
-
observer.complete();
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
wrapFeature(ncFeature) {
|
|
37
|
-
return new NCListFeature_1.default(ncFeature, undefined, `${this.id}-${ncFeature.id()}`);
|
|
38
|
-
}
|
|
39
|
-
async hasDataForRefName(refName) {
|
|
40
|
-
var _a;
|
|
41
|
-
const root = await this.nclist.getDataRoot(refName);
|
|
42
|
-
return !!((_a = root === null || root === void 0 ? void 0 : root.stats) === null || _a === void 0 ? void 0 : _a.featureCount);
|
|
43
|
-
}
|
|
44
|
-
async getRefNames() {
|
|
45
|
-
return this.configRefNames || [];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.default = NCListAdapter;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
-
export default class NCListFeature implements Feature {
|
|
3
|
-
private ncFeature;
|
|
4
|
-
private parentHandle?;
|
|
5
|
-
private uniqueId;
|
|
6
|
-
constructor(ncFeature: any, parent?: Feature, id?: string);
|
|
7
|
-
set(): void;
|
|
8
|
-
jb2TagToJb1Tag(tag: string): string;
|
|
9
|
-
jb1TagToJb2Tag(tag: string): string;
|
|
10
|
-
get(attrName: string): any;
|
|
11
|
-
tags(): string[];
|
|
12
|
-
id(): string;
|
|
13
|
-
parent(): Feature | undefined;
|
|
14
|
-
children(): Feature[] | undefined;
|
|
15
|
-
toJSON(): SimpleFeatureSerialized;
|
|
16
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jb2ToJb1 = { refName: 'seq_id' };
|
|
4
|
-
const jb1ToJb2 = { seq_id: 'refName' };
|
|
5
|
-
class NCListFeature {
|
|
6
|
-
constructor(ncFeature, parent, id) {
|
|
7
|
-
this.ncFeature = ncFeature;
|
|
8
|
-
this.uniqueId = id || ncFeature.id();
|
|
9
|
-
this.parentHandle = parent;
|
|
10
|
-
}
|
|
11
|
-
set() {
|
|
12
|
-
throw new Error('not implemented');
|
|
13
|
-
}
|
|
14
|
-
jb2TagToJb1Tag(tag) {
|
|
15
|
-
const mapped = jb2ToJb1[tag] || tag;
|
|
16
|
-
return mapped.toLowerCase();
|
|
17
|
-
}
|
|
18
|
-
jb1TagToJb2Tag(tag) {
|
|
19
|
-
const t = tag.toLowerCase();
|
|
20
|
-
return jb1ToJb2[t] || t;
|
|
21
|
-
}
|
|
22
|
-
get(attrName) {
|
|
23
|
-
const attr = this.ncFeature.get(this.jb2TagToJb1Tag(attrName));
|
|
24
|
-
if (attr && attrName === 'subfeatures') {
|
|
25
|
-
return attr.map((subfeature) => new NCListFeature(subfeature, this));
|
|
26
|
-
}
|
|
27
|
-
return attr;
|
|
28
|
-
}
|
|
29
|
-
tags() {
|
|
30
|
-
return this.ncFeature.tags().map((t) => this.jb1TagToJb2Tag(t));
|
|
31
|
-
}
|
|
32
|
-
id() {
|
|
33
|
-
return this.uniqueId;
|
|
34
|
-
}
|
|
35
|
-
parent() {
|
|
36
|
-
return this.parentHandle;
|
|
37
|
-
}
|
|
38
|
-
children() {
|
|
39
|
-
return this.get('subfeatures');
|
|
40
|
-
}
|
|
41
|
-
toJSON() {
|
|
42
|
-
const data = { uniqueId: this.id() };
|
|
43
|
-
for (const tag of this.ncFeature.tags()) {
|
|
44
|
-
const mappedTag = this.jb1TagToJb2Tag(tag);
|
|
45
|
-
const value = this.ncFeature.get(tag);
|
|
46
|
-
if (mappedTag === 'subfeatures') {
|
|
47
|
-
data.subfeatures = (value || []).map((f) => {
|
|
48
|
-
return new NCListFeature(f, this).toJSON();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
data[mappedTag] = value;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = NCListFeature;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const NCListAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
rootUrlTemplate: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
refNames: {
|
|
10
|
-
type: string;
|
|
11
|
-
defaultValue: never[];
|
|
12
|
-
description: string;
|
|
13
|
-
};
|
|
14
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
15
|
-
export default NCListAdapter;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
function x() { }
|
|
5
|
-
const NCListAdapter = (0, configuration_1.ConfigurationSchema)('NCListAdapter', {
|
|
6
|
-
rootUrlTemplate: {
|
|
7
|
-
type: 'fileLocation',
|
|
8
|
-
defaultValue: {
|
|
9
|
-
uri: '/path/to/my/{refseq}/trackData.json',
|
|
10
|
-
locationType: 'UriLocation',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
refNames: {
|
|
14
|
-
type: 'stringArray',
|
|
15
|
-
defaultValue: [],
|
|
16
|
-
description: 'List of refNames used by the NCList used for aliasing',
|
|
17
|
-
},
|
|
18
|
-
}, {
|
|
19
|
-
explicitlyTyped: true,
|
|
20
|
-
});
|
|
21
|
-
exports.default = NCListAdapter;
|
|
@@ -1,52 +0,0 @@
|
|
|
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 = NCListAdapterF;
|
|
40
|
-
const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function NCListAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => new pluggableElementTypes_1.AdapterType({
|
|
44
|
-
name: 'NCListAdapter',
|
|
45
|
-
displayName: 'NCList adapter',
|
|
46
|
-
configSchema: configSchema_1.default,
|
|
47
|
-
adapterMetadata: {
|
|
48
|
-
category: 'Uncommon',
|
|
49
|
-
},
|
|
50
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./NCListAdapter'))).then(r => r.default),
|
|
51
|
-
}));
|
|
52
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
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
|
-
class LegacyJBrowsePlugin extends Plugin_1.default {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.name = 'LegacyJBrowsePlugin';
|
|
15
|
-
}
|
|
16
|
-
install(pluginManager) {
|
|
17
|
-
(0, NCListAdapter_1.default)(pluginManager);
|
|
18
|
-
(0, GuessNCList_1.default)(pluginManager);
|
|
19
|
-
(0, JBrowse1TextSearchAdapter_1.default)(pluginManager);
|
|
20
|
-
(0, JBrowse1Connection_1.default)(pluginManager);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.default = LegacyJBrowsePlugin;
|