@jbrowse/plugin-sequence 3.7.0 → 4.0.1
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/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +1 -1
- package/esm/BgzipFastaAdapter/BgzipFastaAdapter.js +1 -1
- package/esm/BgzipFastaAdapter/configSchema.d.ts +2 -2
- package/esm/BgzipFastaAdapter/index.js +2 -2
- package/esm/ChromSizesAdapter/ChromSizesAdapter.js +1 -0
- package/esm/ChromSizesAdapter/configSchema.d.ts +2 -2
- package/esm/ChromSizesAdapter/index.js +2 -2
- package/esm/DivSequenceRenderer/components/DivSequenceRendering.js +24 -7
- package/esm/DivSequenceRenderer/components/Sequence.js +20 -10
- package/esm/DivSequenceRenderer/components/Translation.js +27 -19
- package/esm/DivSequenceRenderer/configSchema.d.ts +2 -2
- package/esm/DivSequenceRenderer/index.js +6 -12
- package/esm/IndexedFastaAdapter/IndexedFastaAdapter.js +15 -23
- package/esm/IndexedFastaAdapter/configSchema.d.ts +2 -2
- package/esm/IndexedFastaAdapter/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/configSchema.d.ts +4 -4
- package/esm/LinearReferenceSequenceDisplay/configSchema.js +1 -1
- package/esm/LinearReferenceSequenceDisplay/index.js +2 -2
- package/esm/LinearReferenceSequenceDisplay/model.d.ts +1047 -104
- package/esm/LinearReferenceSequenceDisplay/model.js +16 -4
- package/esm/ReferenceSequenceTrack/configSchema.d.ts +6 -6
- package/esm/ReferenceSequenceTrack/configSchema.js +3 -3
- package/esm/ReferenceSequenceTrack/index.js +13 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +2 -2
- package/esm/SequenceSearchAdapter/SequenceSearchAdapter.js +3 -9
- package/esm/SequenceSearchAdapter/configSchema.d.ts +2 -2
- package/esm/SequenceSearchAdapter/index.js +2 -2
- package/esm/TwoBitAdapter/TwoBitAdapter.js +1 -0
- package/esm/TwoBitAdapter/configSchema.d.ts +2 -2
- package/esm/TwoBitAdapter/index.js +2 -2
- package/esm/UnindexedFastaAdapter/UnindexedFastaAdapter.js +1 -0
- package/esm/UnindexedFastaAdapter/configSchema.d.ts +2 -2
- package/esm/UnindexedFastaAdapter/index.js +2 -2
- package/esm/index.js +11 -14
- package/esm/saveTrackFormats/fasta.d.ts +4 -0
- package/esm/saveTrackFormats/fasta.js +13 -0
- package/package.json +28 -34
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +0 -7
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +0 -22
- package/dist/BgzipFastaAdapter/configSchema.d.ts +0 -32
- package/dist/BgzipFastaAdapter/configSchema.js +0 -54
- package/dist/BgzipFastaAdapter/index.d.ts +0 -2
- package/dist/BgzipFastaAdapter/index.js +0 -54
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +0 -15
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +0 -40
- package/dist/ChromSizesAdapter/configSchema.d.ts +0 -10
- package/dist/ChromSizesAdapter/configSchema.js +0 -27
- package/dist/ChromSizesAdapter/index.d.ts +0 -2
- package/dist/ChromSizesAdapter/index.js +0 -52
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +0 -18
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +0 -44
- package/dist/DivSequenceRenderer/components/Sequence.d.ts +0 -10
- package/dist/DivSequenceRenderer/components/Sequence.js +0 -25
- package/dist/DivSequenceRenderer/components/Translation.d.ts +0 -14
- package/dist/DivSequenceRenderer/components/Translation.js +0 -49
- package/dist/DivSequenceRenderer/configSchema.d.ts +0 -8
- package/dist/DivSequenceRenderer/configSchema.js +0 -12
- package/dist/DivSequenceRenderer/index.d.ts +0 -2
- package/dist/DivSequenceRenderer/index.js +0 -30
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +0 -25
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +0 -112
- package/dist/IndexedFastaAdapter/configSchema.d.ts +0 -25
- package/dist/IndexedFastaAdapter/configSchema.js +0 -40
- package/dist/IndexedFastaAdapter/index.d.ts +0 -2
- package/dist/IndexedFastaAdapter/index.js +0 -54
- package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +0 -9
- package/dist/LinearReferenceSequenceDisplay/configSchema.js +0 -12
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +0 -2
- package/dist/LinearReferenceSequenceDisplay/index.js +0 -21
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +0 -338
- package/dist/LinearReferenceSequenceDisplay/model.js +0 -132
- package/dist/ReferenceSequenceTrack/configSchema.d.ts +0 -37
- package/dist/ReferenceSequenceTrack/configSchema.js +0 -83
- package/dist/ReferenceSequenceTrack/index.d.ts +0 -2
- package/dist/ReferenceSequenceTrack/index.js +0 -20
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.d.ts +0 -8
- package/dist/SequenceSearchAdapter/SequenceSearchAdapter.js +0 -84
- package/dist/SequenceSearchAdapter/configSchema.d.ts +0 -24
- package/dist/SequenceSearchAdapter/configSchema.js +0 -28
- package/dist/SequenceSearchAdapter/index.d.ts +0 -2
- package/dist/SequenceSearchAdapter/index.js +0 -54
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +0 -28
- package/dist/TwoBitAdapter/TwoBitAdapter.js +0 -85
- package/dist/TwoBitAdapter/configSchema.d.ts +0 -18
- package/dist/TwoBitAdapter/configSchema.js +0 -43
- package/dist/TwoBitAdapter/index.d.ts +0 -2
- package/dist/TwoBitAdapter/index.js +0 -52
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.d.ts +0 -31
- package/dist/UnindexedFastaAdapter/UnindexedFastaAdapter.js +0 -86
- package/dist/UnindexedFastaAdapter/configSchema.d.ts +0 -23
- package/dist/UnindexedFastaAdapter/configSchema.js +0 -40
- package/dist/UnindexedFastaAdapter/index.d.ts +0 -2
- package/dist/UnindexedFastaAdapter/index.js +0 -54
- package/dist/createExtensionPoints.d.ts +0 -2
- package/dist/createExtensionPoints.js +0 -86
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -35
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
4
|
-
const util_1 = require("@jbrowse/core/util");
|
|
5
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
6
|
-
const rxjs_2 = require("rxjs");
|
|
7
|
-
const operators_1 = require("rxjs/operators");
|
|
8
|
-
class SequenceSearchAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
9
|
-
async configure() {
|
|
10
|
-
var _a;
|
|
11
|
-
const adapter = await ((_a = this.getSubAdapter) === null || _a === void 0 ? void 0 : _a.call(this, this.getConf('sequenceAdapter')));
|
|
12
|
-
if (!adapter) {
|
|
13
|
-
throw new Error('Error getting subadapter');
|
|
14
|
-
}
|
|
15
|
-
return adapter.dataAdapter;
|
|
16
|
-
}
|
|
17
|
-
async getRefNames() {
|
|
18
|
-
const adapter = await this.configure();
|
|
19
|
-
return adapter.getRefNames();
|
|
20
|
-
}
|
|
21
|
-
getFeatures(query, opts) {
|
|
22
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
23
|
-
var _a;
|
|
24
|
-
const sequenceAdapter = await this.configure();
|
|
25
|
-
const hw = 10000;
|
|
26
|
-
const queryEnd = query.end + hw;
|
|
27
|
-
const queryStart = Math.max(0, query.start - hw);
|
|
28
|
-
if (queryEnd < 0 || queryStart > queryEnd) {
|
|
29
|
-
observer.complete();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const ret = sequenceAdapter.getFeatures({
|
|
33
|
-
...query,
|
|
34
|
-
start: queryStart,
|
|
35
|
-
end: queryEnd,
|
|
36
|
-
}, opts);
|
|
37
|
-
const feats = await (0, rxjs_2.firstValueFrom)(ret.pipe((0, operators_1.toArray)()));
|
|
38
|
-
const residues = ((_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq')) || '';
|
|
39
|
-
const search = this.getConf('search');
|
|
40
|
-
const searchForward = this.getConf('searchForward');
|
|
41
|
-
const searchReverse = this.getConf('searchReverse');
|
|
42
|
-
const caseInsensitive = this.getConf('caseInsensitive');
|
|
43
|
-
const re = new RegExp(search, `g${caseInsensitive ? 'i' : ''}`);
|
|
44
|
-
if (search) {
|
|
45
|
-
if (searchForward) {
|
|
46
|
-
const matches = residues.matchAll(re);
|
|
47
|
-
for (const match of matches) {
|
|
48
|
-
const s = queryStart + match.index;
|
|
49
|
-
const e = queryStart + match.index + match[0].length;
|
|
50
|
-
if ((0, util_1.doesIntersect2)(s, e, query.start, query.end)) {
|
|
51
|
-
observer.next(new util_1.SimpleFeature({
|
|
52
|
-
uniqueId: `${this.id}-${s}-${match[0]}-pos`,
|
|
53
|
-
refName: query.refName,
|
|
54
|
-
start: s,
|
|
55
|
-
end: e,
|
|
56
|
-
name: match[0],
|
|
57
|
-
strand: 1,
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (searchReverse) {
|
|
63
|
-
const matches = (0, util_1.revcom)(residues).matchAll(re);
|
|
64
|
-
for (const match of matches) {
|
|
65
|
-
const e = queryEnd - match.index;
|
|
66
|
-
const s = queryEnd - match.index - match[0].length;
|
|
67
|
-
if ((0, util_1.doesIntersect2)(s, e, query.start, query.end)) {
|
|
68
|
-
observer.next(new util_1.SimpleFeature({
|
|
69
|
-
uniqueId: `${this.id}-${s}-${match[0]}-neg`,
|
|
70
|
-
refName: query.refName,
|
|
71
|
-
start: s,
|
|
72
|
-
end: e,
|
|
73
|
-
name: match[0],
|
|
74
|
-
strand: -1,
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
observer.complete();
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.default = SequenceSearchAdapter;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
search: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
sequenceAdapter: {
|
|
8
|
-
type: string;
|
|
9
|
-
defaultValue: null;
|
|
10
|
-
};
|
|
11
|
-
searchForward: {
|
|
12
|
-
type: string;
|
|
13
|
-
defaultValue: boolean;
|
|
14
|
-
};
|
|
15
|
-
searchReverse: {
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: boolean;
|
|
18
|
-
};
|
|
19
|
-
caseInsensitive: {
|
|
20
|
-
type: string;
|
|
21
|
-
defaultValue: boolean;
|
|
22
|
-
};
|
|
23
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
24
|
-
export default configSchema;
|
|
@@ -1,28 +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 configSchema = (0, configuration_1.ConfigurationSchema)('SequenceSearchAdapter', {
|
|
6
|
-
search: {
|
|
7
|
-
type: 'string',
|
|
8
|
-
defaultValue: '',
|
|
9
|
-
description: 'Search string or regex to search for',
|
|
10
|
-
},
|
|
11
|
-
sequenceAdapter: {
|
|
12
|
-
type: 'frozen',
|
|
13
|
-
defaultValue: null,
|
|
14
|
-
},
|
|
15
|
-
searchForward: {
|
|
16
|
-
type: 'boolean',
|
|
17
|
-
defaultValue: true,
|
|
18
|
-
},
|
|
19
|
-
searchReverse: {
|
|
20
|
-
type: 'boolean',
|
|
21
|
-
defaultValue: true,
|
|
22
|
-
},
|
|
23
|
-
caseInsensitive: {
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
defaultValue: true,
|
|
26
|
-
},
|
|
27
|
-
}, { explicitlyTyped: true });
|
|
28
|
-
exports.default = configSchema;
|
|
@@ -1,54 +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 = SequenceSearchAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function SequenceSearchAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => {
|
|
44
|
-
return new AdapterType_1.default({
|
|
45
|
-
name: 'SequenceSearchAdapter',
|
|
46
|
-
displayName: 'Sequence search adapter',
|
|
47
|
-
adapterMetadata: {
|
|
48
|
-
hiddenFromGUI: true,
|
|
49
|
-
},
|
|
50
|
-
configSchema: configSchema_1.default,
|
|
51
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./SequenceSearchAdapter'))).then(r => r.default),
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TwoBitFile } from '@gmod/twobit';
|
|
2
|
-
import { BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import type { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
|
-
import type { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
5
|
-
export default class TwoBitAdapter extends BaseSequenceAdapter {
|
|
6
|
-
protected setupP?: Promise<{
|
|
7
|
-
twobit: TwoBitFile;
|
|
8
|
-
chromSizesData: Record<string, number> | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
private initChromSizes;
|
|
11
|
-
setupPre(): Promise<{
|
|
12
|
-
twobit: TwoBitFile;
|
|
13
|
-
chromSizesData: {
|
|
14
|
-
[k: string]: number;
|
|
15
|
-
} | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
setup(): Promise<{
|
|
18
|
-
twobit: TwoBitFile;
|
|
19
|
-
chromSizesData: Record<string, number> | undefined;
|
|
20
|
-
}>;
|
|
21
|
-
getRefNames(): Promise<string[]>;
|
|
22
|
-
getRegions(): Promise<{
|
|
23
|
-
refName: string;
|
|
24
|
-
start: number;
|
|
25
|
-
end: number;
|
|
26
|
-
}[]>;
|
|
27
|
-
getFeatures({ refName, start, end }: NoAssemblyRegion): import("rxjs").Observable<Feature>;
|
|
28
|
-
}
|
|
@@ -1,85 +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 twobit_1 = require("@gmod/twobit");
|
|
7
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
8
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
10
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
11
|
-
const simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
|
|
12
|
-
class TwoBitAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
13
|
-
async initChromSizes() {
|
|
14
|
-
const conf = (0, configuration_1.readConfObject)(this.config, 'chromSizesLocation');
|
|
15
|
-
if (conf.uri !== '/path/to/default.chrom.sizes' && conf.uri !== '') {
|
|
16
|
-
const file = (0, io_1.openLocation)(conf, this.pluginManager);
|
|
17
|
-
const data = await file.readFile('utf8');
|
|
18
|
-
return Object.fromEntries(data
|
|
19
|
-
.split(/\n|\r\n|\r/)
|
|
20
|
-
.filter(line => !!line.trim())
|
|
21
|
-
.map(line => {
|
|
22
|
-
const [name, length] = line.split('\t');
|
|
23
|
-
return [name, +length];
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
async setupPre() {
|
|
29
|
-
return {
|
|
30
|
-
twobit: new twobit_1.TwoBitFile({
|
|
31
|
-
filehandle: (0, io_1.openLocation)(this.getConf('twoBitLocation'), this.pluginManager),
|
|
32
|
-
}),
|
|
33
|
-
chromSizesData: await this.initChromSizes(),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async setup() {
|
|
37
|
-
if (!this.setupP) {
|
|
38
|
-
this.setupP = this.setupPre().catch((e) => {
|
|
39
|
-
this.setupP = undefined;
|
|
40
|
-
throw e;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return this.setupP;
|
|
44
|
-
}
|
|
45
|
-
async getRefNames() {
|
|
46
|
-
const { chromSizesData, twobit } = await this.setup();
|
|
47
|
-
return chromSizesData
|
|
48
|
-
? Object.keys(chromSizesData)
|
|
49
|
-
: twobit.getSequenceNames();
|
|
50
|
-
}
|
|
51
|
-
async getRegions() {
|
|
52
|
-
const { chromSizesData, twobit } = await this.setup();
|
|
53
|
-
if (chromSizesData) {
|
|
54
|
-
return Object.keys(chromSizesData).map(refName => ({
|
|
55
|
-
refName,
|
|
56
|
-
start: 0,
|
|
57
|
-
end: chromSizesData[refName],
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
const refSizes = await twobit.getSequenceSizes();
|
|
62
|
-
return Object.keys(refSizes).map(refName => ({
|
|
63
|
-
refName,
|
|
64
|
-
start: 0,
|
|
65
|
-
end: refSizes[refName],
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
getFeatures({ refName, start, end }) {
|
|
70
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
71
|
-
const { twobit } = await this.setup();
|
|
72
|
-
const size = await twobit.getSequenceSize(refName);
|
|
73
|
-
const regionEnd = size !== undefined ? Math.min(size, end) : end;
|
|
74
|
-
const seq = await twobit.getSequence(refName, start, regionEnd);
|
|
75
|
-
if (seq) {
|
|
76
|
-
observer.next(new simpleFeature_1.default({
|
|
77
|
-
id: `${refName} ${start}-${regionEnd}`,
|
|
78
|
-
data: { refName, start, end: regionEnd, seq },
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
observer.complete();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.default = TwoBitAdapter;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare const TwoBitAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
twoBitLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
chromSizesLocation: {
|
|
10
|
-
type: string;
|
|
11
|
-
defaultValue: {
|
|
12
|
-
uri: string;
|
|
13
|
-
locationType: string;
|
|
14
|
-
};
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
18
|
-
export default TwoBitAdapter;
|
|
@@ -1,43 +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 TwoBitAdapter = (0, configuration_1.ConfigurationSchema)('TwoBitAdapter', {
|
|
6
|
-
twoBitLocation: {
|
|
7
|
-
type: 'fileLocation',
|
|
8
|
-
defaultValue: {
|
|
9
|
-
uri: '/path/to/my.2bit',
|
|
10
|
-
locationType: 'UriLocation',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
chromSizesLocation: {
|
|
14
|
-
type: 'fileLocation',
|
|
15
|
-
defaultValue: {
|
|
16
|
-
uri: '/path/to/default.chrom.sizes',
|
|
17
|
-
locationType: 'UriLocation',
|
|
18
|
-
},
|
|
19
|
-
description: 'An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time',
|
|
20
|
-
},
|
|
21
|
-
}, {
|
|
22
|
-
explicitlyTyped: true,
|
|
23
|
-
preProcessSnapshot: snap => {
|
|
24
|
-
return snap.uri
|
|
25
|
-
? {
|
|
26
|
-
...snap,
|
|
27
|
-
twoBitLocation: {
|
|
28
|
-
uri: snap.uri,
|
|
29
|
-
baseUri: snap.baseUri,
|
|
30
|
-
},
|
|
31
|
-
...(snap.chromSizes
|
|
32
|
-
? {
|
|
33
|
-
chromSizesLocation: {
|
|
34
|
-
uri: snap.chromSizes,
|
|
35
|
-
baseUri: snap.baseUri,
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
: {}),
|
|
39
|
-
}
|
|
40
|
-
: snap;
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
exports.default = TwoBitAdapter;
|
|
@@ -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 = TwoBitAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function TwoBitAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
44
|
-
name: 'TwoBitAdapter',
|
|
45
|
-
displayName: 'TwoBit adapter',
|
|
46
|
-
configSchema: configSchema_1.default,
|
|
47
|
-
adapterMetadata: {
|
|
48
|
-
hiddenFromGUI: true,
|
|
49
|
-
},
|
|
50
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./TwoBitAdapter'))).then(r => r.default),
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
4
|
-
import type { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
5
|
-
declare function parseSmallFasta(text: string): Map<string, {
|
|
6
|
-
readonly description: string;
|
|
7
|
-
readonly sequence: string;
|
|
8
|
-
}>;
|
|
9
|
-
export default class UnindexedFastaAdapter extends BaseSequenceAdapter {
|
|
10
|
-
protected setupP?: Promise<{
|
|
11
|
-
fasta: ReturnType<typeof parseSmallFasta>;
|
|
12
|
-
}>;
|
|
13
|
-
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
14
|
-
getRegions(opts?: BaseOptions): Promise<{
|
|
15
|
-
refName: string;
|
|
16
|
-
start: number;
|
|
17
|
-
end: number;
|
|
18
|
-
}[]>;
|
|
19
|
-
setupPre(_opts?: BaseOptions): Promise<{
|
|
20
|
-
fasta: Map<any, {
|
|
21
|
-
readonly description: string;
|
|
22
|
-
readonly sequence: string;
|
|
23
|
-
}>;
|
|
24
|
-
}>;
|
|
25
|
-
getHeader(): Promise<string | null>;
|
|
26
|
-
setup(opts?: BaseOptions): Promise<{
|
|
27
|
-
fasta: ReturnType<typeof parseSmallFasta>;
|
|
28
|
-
}>;
|
|
29
|
-
getFeatures(region: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
5
|
-
const util_1 = require("@jbrowse/core/util");
|
|
6
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
7
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
8
|
-
function parseSmallFasta(text) {
|
|
9
|
-
return new Map(text
|
|
10
|
-
.split('>')
|
|
11
|
-
.filter(t => /\S/.test(t))
|
|
12
|
-
.map(entryText => {
|
|
13
|
-
const [defLine, ...seqLines] = entryText.split('\n');
|
|
14
|
-
const [id, ...description] = defLine.split(' ');
|
|
15
|
-
const sequence = seqLines.join('').replace(/\s/g, '');
|
|
16
|
-
return [
|
|
17
|
-
id,
|
|
18
|
-
{
|
|
19
|
-
description: description.join(' '),
|
|
20
|
-
sequence,
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
class UnindexedFastaAdapter extends BaseAdapter_1.BaseSequenceAdapter {
|
|
26
|
-
async getRefNames(opts) {
|
|
27
|
-
const { fasta } = await this.setup(opts);
|
|
28
|
-
return [...fasta.keys()];
|
|
29
|
-
}
|
|
30
|
-
async getRegions(opts) {
|
|
31
|
-
const { fasta } = await this.setup(opts);
|
|
32
|
-
return [...fasta.entries()].map(([refName, data]) => ({
|
|
33
|
-
refName,
|
|
34
|
-
start: 0,
|
|
35
|
-
end: data.sequence.length,
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
async setupPre(_opts) {
|
|
39
|
-
const fastaLocation = this.getConf('fastaLocation');
|
|
40
|
-
const res = parseSmallFasta(await (0, io_1.openLocation)(fastaLocation, this.pluginManager).readFile('utf8'));
|
|
41
|
-
return {
|
|
42
|
-
fasta: new Map([...res.entries()].map(([refName, val]) => {
|
|
43
|
-
return [
|
|
44
|
-
(0, configuration_1.readConfObject)(this.config, 'rewriteRefNames', { refName }) ||
|
|
45
|
-
refName,
|
|
46
|
-
val,
|
|
47
|
-
];
|
|
48
|
-
})),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
async getHeader() {
|
|
52
|
-
const loc = this.getConf('metadataLocation');
|
|
53
|
-
return loc.uri === '' || loc.uri === '/path/to/fa.metadata.yaml'
|
|
54
|
-
? null
|
|
55
|
-
: (0, io_1.openLocation)(loc, this.pluginManager).readFile('utf8');
|
|
56
|
-
}
|
|
57
|
-
async setup(opts) {
|
|
58
|
-
if (!this.setupP) {
|
|
59
|
-
this.setupP = this.setupPre(opts).catch((e) => {
|
|
60
|
-
this.setupP = undefined;
|
|
61
|
-
throw e;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return this.setupP;
|
|
65
|
-
}
|
|
66
|
-
getFeatures(region, opts) {
|
|
67
|
-
const { refName, start, end } = region;
|
|
68
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
69
|
-
const { fasta } = await this.setup(opts);
|
|
70
|
-
const entry = fasta.get(refName);
|
|
71
|
-
if (entry) {
|
|
72
|
-
observer.next(new util_1.SimpleFeature({
|
|
73
|
-
id: `${refName}-${start}-${end}`,
|
|
74
|
-
data: {
|
|
75
|
-
refName,
|
|
76
|
-
start,
|
|
77
|
-
end,
|
|
78
|
-
seq: entry.sequence.slice(start, end),
|
|
79
|
-
},
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
observer.complete();
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.default = UnindexedFastaAdapter;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare const UnindexedFastaAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
rewriteRefNames: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: string;
|
|
5
|
-
contextVariable: string[];
|
|
6
|
-
};
|
|
7
|
-
fastaLocation: {
|
|
8
|
-
type: string;
|
|
9
|
-
defaultValue: {
|
|
10
|
-
uri: string;
|
|
11
|
-
locationType: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
metadataLocation: {
|
|
15
|
-
description: string;
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: {
|
|
18
|
-
uri: string;
|
|
19
|
-
locationType: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
|
-
export default UnindexedFastaAdapter;
|
|
@@ -1,40 +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 UnindexedFastaAdapter = (0, configuration_1.ConfigurationSchema)('UnindexedFastaAdapter', {
|
|
6
|
-
rewriteRefNames: {
|
|
7
|
-
type: 'string',
|
|
8
|
-
defaultValue: '',
|
|
9
|
-
contextVariable: ['refName'],
|
|
10
|
-
},
|
|
11
|
-
fastaLocation: {
|
|
12
|
-
type: 'fileLocation',
|
|
13
|
-
defaultValue: {
|
|
14
|
-
uri: '/path/to/seq.fa',
|
|
15
|
-
locationType: 'UriLocation',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
metadataLocation: {
|
|
19
|
-
description: 'Optional metadata file',
|
|
20
|
-
type: 'fileLocation',
|
|
21
|
-
defaultValue: {
|
|
22
|
-
uri: '/path/to/fa.metadata.yaml',
|
|
23
|
-
locationType: 'UriLocation',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}, {
|
|
27
|
-
explicitlyTyped: true,
|
|
28
|
-
preProcessSnapshot: snap => {
|
|
29
|
-
return snap.uri
|
|
30
|
-
? {
|
|
31
|
-
...snap,
|
|
32
|
-
fastaLocation: {
|
|
33
|
-
uri: snap.uri,
|
|
34
|
-
baseUri: snap.baseUri,
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
: snap;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
exports.default = UnindexedFastaAdapter;
|
|
@@ -1,54 +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 = UnindexedFastaAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function UnindexedFastaAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => {
|
|
44
|
-
return new AdapterType_1.default({
|
|
45
|
-
name: 'UnindexedFastaAdapter',
|
|
46
|
-
displayName: 'Unindexed FASTA adapter',
|
|
47
|
-
configSchema: configSchema_1.default,
|
|
48
|
-
adapterMetadata: {
|
|
49
|
-
hiddenFromGUI: true,
|
|
50
|
-
},
|
|
51
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./UnindexedFastaAdapter'))).then(r => r.default),
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|