@jbrowse/plugin-bed 3.7.0 → 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/BedAdapter/BedAdapter.js +8 -11
- package/esm/BedAdapter/configSchema.d.ts +2 -2
- package/esm/BedAdapter/index.js +2 -2
- package/esm/BedGraphAdapter/BedGraphAdapter.js +5 -8
- package/esm/BedGraphAdapter/configSchema.d.ts +2 -2
- package/esm/BedGraphAdapter/index.js +2 -2
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +3 -3
- package/esm/BedGraphTabixAdapter/configSchema.d.ts +5 -5
- package/esm/BedGraphTabixAdapter/configSchema.js +1 -1
- package/esm/BedGraphTabixAdapter/index.js +2 -2
- package/esm/BedTabixAdapter/BedTabixAdapter.js +10 -6
- package/esm/BedTabixAdapter/configSchema.d.ts +5 -5
- package/esm/BedTabixAdapter/configSchema.js +1 -1
- package/esm/BedTabixAdapter/index.js +2 -2
- package/esm/BedpeAdapter/BedpeAdapter.js +9 -13
- package/esm/BedpeAdapter/configSchema.d.ts +2 -2
- package/esm/BedpeAdapter/index.js +2 -2
- package/esm/BedpeAdapter/util.js +1 -1
- package/esm/BigBedAdapter/BigBedAdapter.d.ts +1 -1
- package/esm/BigBedAdapter/BigBedAdapter.js +8 -9
- package/esm/BigBedAdapter/configSchema.d.ts +2 -2
- package/esm/BigBedAdapter/index.js +2 -2
- package/esm/generateRepeatMaskerFeature.js +2 -2
- package/esm/generateUcscTranscript.d.ts +18 -9
- package/esm/generateUcscTranscript.js +67 -84
- package/esm/index.js +8 -11
- package/esm/types.d.ts +2 -11
- package/esm/util.d.ts +11 -174
- package/esm/util.js +49 -48
- package/package.json +26 -33
- package/dist/BedAdapter/BedAdapter.d.ts +0 -36
- package/dist/BedAdapter/BedAdapter.js +0 -137
- package/dist/BedAdapter/configSchema.d.ts +0 -41
- package/dist/BedAdapter/configSchema.js +0 -58
- package/dist/BedAdapter/index.d.ts +0 -2
- package/dist/BedAdapter/index.js +0 -49
- package/dist/BedGraphAdapter/BedGraphAdapter.d.ts +0 -23
- package/dist/BedGraphAdapter/BedGraphAdapter.js +0 -122
- package/dist/BedGraphAdapter/configSchema.d.ts +0 -15
- package/dist/BedGraphAdapter/configSchema.js +0 -32
- package/dist/BedGraphAdapter/index.d.ts +0 -2
- package/dist/BedGraphAdapter/index.js +0 -49
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +0 -17
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.js +0 -107
- package/dist/BedGraphTabixAdapter/configSchema.d.ts +0 -29
- package/dist/BedGraphTabixAdapter/configSchema.js +0 -53
- package/dist/BedGraphTabixAdapter/index.d.ts +0 -2
- package/dist/BedGraphTabixAdapter/index.js +0 -49
- package/dist/BedTabixAdapter/BedTabixAdapter.d.ts +0 -43
- package/dist/BedTabixAdapter/BedTabixAdapter.js +0 -104
- package/dist/BedTabixAdapter/configSchema.d.ts +0 -39
- package/dist/BedTabixAdapter/configSchema.js +0 -63
- package/dist/BedTabixAdapter/index.d.ts +0 -2
- package/dist/BedTabixAdapter/index.js +0 -49
- package/dist/BedpeAdapter/BedpeAdapter.d.ts +0 -22
- package/dist/BedpeAdapter/BedpeAdapter.js +0 -111
- package/dist/BedpeAdapter/configSchema.d.ts +0 -16
- package/dist/BedpeAdapter/configSchema.js +0 -33
- package/dist/BedpeAdapter/index.d.ts +0 -2
- package/dist/BedpeAdapter/index.js +0 -49
- package/dist/BedpeAdapter/util.d.ts +0 -2
- package/dist/BedpeAdapter/util.js +0 -55
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +0 -46
- package/dist/BigBedAdapter/BigBedAdapter.js +0 -230
- package/dist/BigBedAdapter/configSchema.d.ts +0 -20
- package/dist/BigBedAdapter/configSchema.js +0 -37
- package/dist/BigBedAdapter/index.d.ts +0 -2
- package/dist/BigBedAdapter/index.js +0 -49
- package/dist/GuessAdapter/index.d.ts +0 -2
- package/dist/GuessAdapter/index.js +0 -68
- package/dist/generateBedMethylFeature.d.ts +0 -31
- package/dist/generateBedMethylFeature.js +0 -32
- package/dist/generateRepeatMaskerFeature.d.ts +0 -51
- package/dist/generateRepeatMaskerFeature.js +0 -42
- package/dist/generateUcscTranscript.d.ts +0 -20
- package/dist/generateUcscTranscript.js +0 -123
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -29
- package/dist/types.d.ts +0 -18
- package/dist/types.js +0 -2
- package/dist/util.d.ts +0 -213
- package/dist/util.js +0 -157
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tabix_1 = require("@gmod/tabix");
|
|
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
|
-
class BedGraphAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
9
|
-
async configurePre() {
|
|
10
|
-
const pm = this.pluginManager;
|
|
11
|
-
const bedGraphGzLocation = this.getConf('bedGraphGzLocation');
|
|
12
|
-
const location = this.getConf(['index', 'location']);
|
|
13
|
-
const indexType = this.getConf(['index', 'indexType']);
|
|
14
|
-
const filehandle = (0, io_1.openLocation)(bedGraphGzLocation, pm);
|
|
15
|
-
const isCSI = indexType === 'CSI';
|
|
16
|
-
const bedGraph = new tabix_1.TabixIndexedFile({
|
|
17
|
-
filehandle,
|
|
18
|
-
csiFilehandle: isCSI ? (0, io_1.openLocation)(location, pm) : undefined,
|
|
19
|
-
tbiFilehandle: !isCSI ? (0, io_1.openLocation)(location, pm) : undefined,
|
|
20
|
-
chunkCacheSize: 50 * 2 ** 20,
|
|
21
|
-
});
|
|
22
|
-
const columnNames = this.getConf('columnNames');
|
|
23
|
-
const header = await bedGraph.getHeader();
|
|
24
|
-
return {
|
|
25
|
-
columnNames,
|
|
26
|
-
bedGraph,
|
|
27
|
-
header,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async configure() {
|
|
31
|
-
if (!this.configured) {
|
|
32
|
-
this.configured = this.configurePre().catch((e) => {
|
|
33
|
-
this.configured = undefined;
|
|
34
|
-
throw e;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return this.configured;
|
|
38
|
-
}
|
|
39
|
-
async getNames() {
|
|
40
|
-
const { bedGraph, columnNames } = await this.configure();
|
|
41
|
-
if (columnNames.length) {
|
|
42
|
-
return columnNames;
|
|
43
|
-
}
|
|
44
|
-
const header = await bedGraph.getHeader();
|
|
45
|
-
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
46
|
-
const defline = defs.at(-1);
|
|
47
|
-
return (defline === null || defline === void 0 ? void 0 : defline.includes('\t'))
|
|
48
|
-
? defline
|
|
49
|
-
.slice(1)
|
|
50
|
-
.split('\t')
|
|
51
|
-
.map(f => f.trim())
|
|
52
|
-
: undefined;
|
|
53
|
-
}
|
|
54
|
-
async getRefNames(opts = {}) {
|
|
55
|
-
const { bedGraph } = await this.configure();
|
|
56
|
-
return bedGraph.getReferenceSequenceNames(opts);
|
|
57
|
-
}
|
|
58
|
-
async getHeader() {
|
|
59
|
-
const { bedGraph } = await this.configure();
|
|
60
|
-
return bedGraph.getHeader();
|
|
61
|
-
}
|
|
62
|
-
getFeatures(query, opts = {}) {
|
|
63
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
64
|
-
var _a;
|
|
65
|
-
const { bedGraph } = await this.configure();
|
|
66
|
-
const meta = await bedGraph.getMetadata();
|
|
67
|
-
const { columnNumbers } = meta;
|
|
68
|
-
const colRef = columnNumbers.ref - 1;
|
|
69
|
-
const colStart = columnNumbers.start - 1;
|
|
70
|
-
const colEnd = columnNumbers.end - 1;
|
|
71
|
-
const same = colStart === colEnd;
|
|
72
|
-
const names = ((_a = (await this.getNames())) === null || _a === void 0 ? void 0 : _a.slice(same ? 2 : 3)) || [];
|
|
73
|
-
await bedGraph.getLines(query.refName, query.start + (same ? -1 : 0), query.end, {
|
|
74
|
-
lineCallback: (line, fileOffset) => {
|
|
75
|
-
const cols = line.split('\t');
|
|
76
|
-
const refName = cols[colRef];
|
|
77
|
-
const start = +cols[colStart];
|
|
78
|
-
const end = +(same ? start + 1 : cols[colEnd]);
|
|
79
|
-
const rest = cols.slice(colEnd + 1);
|
|
80
|
-
if (Number.isNaN(start) || Number.isNaN(end)) {
|
|
81
|
-
throw new Error(`start/end NaN on line "${line}", with colStart:${colStart} and colEnd:${colEnd}. run "tabix -p bed" to ensure bed preset`);
|
|
82
|
-
}
|
|
83
|
-
for (let j = 0; j < rest.length; j++) {
|
|
84
|
-
const uniqueId = `${this.id}-${fileOffset}-${j}`;
|
|
85
|
-
const score = Math.abs(+rest[j]);
|
|
86
|
-
const source = names[j] || `col${j}`;
|
|
87
|
-
if (score) {
|
|
88
|
-
observer.next(new util_1.SimpleFeature({
|
|
89
|
-
id: uniqueId,
|
|
90
|
-
data: {
|
|
91
|
-
refName,
|
|
92
|
-
start,
|
|
93
|
-
end,
|
|
94
|
-
score,
|
|
95
|
-
source,
|
|
96
|
-
},
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
...opts,
|
|
102
|
-
});
|
|
103
|
-
observer.complete();
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.default = BedGraphAdapter;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
declare const BedGraphTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
bedGraphGzLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
|
-
indexType: {
|
|
11
|
-
model: import("mobx-state-tree").ISimpleType<string>;
|
|
12
|
-
type: string;
|
|
13
|
-
defaultValue: string;
|
|
14
|
-
};
|
|
15
|
-
location: {
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: {
|
|
18
|
-
uri: string;
|
|
19
|
-
locationType: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
|
-
columnNames: {
|
|
24
|
-
type: string;
|
|
25
|
-
description: string;
|
|
26
|
-
defaultValue: never[];
|
|
27
|
-
};
|
|
28
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
29
|
-
export default BedGraphTabixAdapter;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
-
function x() { }
|
|
6
|
-
const BedGraphTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedGraphTabixAdapter', {
|
|
7
|
-
bedGraphGzLocation: {
|
|
8
|
-
type: 'fileLocation',
|
|
9
|
-
defaultValue: {
|
|
10
|
-
uri: '/path/to/my.bedgraph',
|
|
11
|
-
locationType: 'UriLocation',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
index: (0, configuration_1.ConfigurationSchema)('VcfIndex', {
|
|
15
|
-
indexType: {
|
|
16
|
-
model: mobx_state_tree_1.types.enumeration('IndexType', ['TBI', 'CSI']),
|
|
17
|
-
type: 'stringEnum',
|
|
18
|
-
defaultValue: 'TBI',
|
|
19
|
-
},
|
|
20
|
-
location: {
|
|
21
|
-
type: 'fileLocation',
|
|
22
|
-
defaultValue: {
|
|
23
|
-
uri: '/path/to/my.vcf.gz.tbi',
|
|
24
|
-
locationType: 'UriLocation',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
columnNames: {
|
|
29
|
-
type: 'stringArray',
|
|
30
|
-
description: 'List of column names',
|
|
31
|
-
defaultValue: [],
|
|
32
|
-
},
|
|
33
|
-
}, {
|
|
34
|
-
explicitlyTyped: true,
|
|
35
|
-
preProcessSnapshot: snap => {
|
|
36
|
-
return snap.uri
|
|
37
|
-
? {
|
|
38
|
-
...snap,
|
|
39
|
-
bedGraphGzLocation: {
|
|
40
|
-
uri: snap.uri,
|
|
41
|
-
baseUri: snap.baseUri,
|
|
42
|
-
},
|
|
43
|
-
index: {
|
|
44
|
-
location: {
|
|
45
|
-
uri: `${snap.uri}.tbi`,
|
|
46
|
-
baseUri: snap.baseUri,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
: snap;
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
exports.default = BedGraphTabixAdapter;
|
|
@@ -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 = BedGraphTabixAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function BedGraphTabixAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
44
|
-
name: 'BedGraphTabixAdapter',
|
|
45
|
-
displayName: 'BedGraphTabix adapter',
|
|
46
|
-
configSchema: configSchema_1.default,
|
|
47
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BedGraphTabixAdapter'))).then(r => r.default),
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { TabixIndexedFile } from '@gmod/tabix';
|
|
2
|
-
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
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, Region } from '@jbrowse/core/util';
|
|
8
|
-
export default class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
9
|
-
private parser;
|
|
10
|
-
protected bed: TabixIndexedFile;
|
|
11
|
-
protected columnNames: string[];
|
|
12
|
-
protected scoreColumn: string;
|
|
13
|
-
static capabilities: string[];
|
|
14
|
-
setupP?: Promise<{
|
|
15
|
-
meta: Awaited<ReturnType<TabixIndexedFile['getMetadata']>>;
|
|
16
|
-
}>;
|
|
17
|
-
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
18
|
-
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
19
|
-
getHeader(opts?: BaseOptions): Promise<string>;
|
|
20
|
-
getMetadataPre2(_opts?: BaseOptions): Promise<{
|
|
21
|
-
meta: Awaited<ReturnType<TabixIndexedFile["getMetadata"]>>;
|
|
22
|
-
}>;
|
|
23
|
-
getMetadataPre(): Promise<{
|
|
24
|
-
meta: {
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
refNameToId: Record<string, number>;
|
|
27
|
-
refIdToName: string[];
|
|
28
|
-
metaChar: string | undefined;
|
|
29
|
-
columnNumbers: {
|
|
30
|
-
ref: number;
|
|
31
|
-
start: number;
|
|
32
|
-
end: number;
|
|
33
|
-
};
|
|
34
|
-
coordinateType: string;
|
|
35
|
-
format: string;
|
|
36
|
-
};
|
|
37
|
-
}>;
|
|
38
|
-
getMetadata(opts?: BaseOptions): Promise<{
|
|
39
|
-
meta: Awaited<ReturnType<TabixIndexedFile["getMetadata"]>>;
|
|
40
|
-
}>;
|
|
41
|
-
getNames(): Promise<string[] | undefined>;
|
|
42
|
-
getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
43
|
-
}
|
|
@@ -1,104 +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 bed_1 = __importDefault(require("@gmod/bed"));
|
|
7
|
-
const tabix_1 = require("@gmod/tabix");
|
|
8
|
-
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
10
|
-
const io_1 = require("@jbrowse/core/util/io");
|
|
11
|
-
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
12
|
-
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
13
|
-
const util_2 = require("../util");
|
|
14
|
-
class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
15
|
-
constructor(config, getSubAdapter, pluginManager) {
|
|
16
|
-
super(config, getSubAdapter, pluginManager);
|
|
17
|
-
const bedGzLoc = this.getConf('bedGzLocation');
|
|
18
|
-
const type = this.getConf(['index', 'indexType']);
|
|
19
|
-
const loc = this.getConf(['index', 'location']);
|
|
20
|
-
const autoSql = this.getConf('autoSql');
|
|
21
|
-
const pm = this.pluginManager;
|
|
22
|
-
this.bed = new tabix_1.TabixIndexedFile({
|
|
23
|
-
filehandle: (0, io_1.openLocation)(bedGzLoc, pm),
|
|
24
|
-
csiFilehandle: type === 'CSI' ? (0, io_1.openLocation)(loc, pm) : undefined,
|
|
25
|
-
tbiFilehandle: type !== 'CSI' ? (0, io_1.openLocation)(loc, pm) : undefined,
|
|
26
|
-
chunkCacheSize: 50 * 2 ** 20,
|
|
27
|
-
});
|
|
28
|
-
this.columnNames = this.getConf('columnNames');
|
|
29
|
-
this.scoreColumn = this.getConf('scoreColumn');
|
|
30
|
-
this.parser = new bed_1.default({ autoSql });
|
|
31
|
-
}
|
|
32
|
-
async getRefNames(opts = {}) {
|
|
33
|
-
return this.bed.getReferenceSequenceNames(opts);
|
|
34
|
-
}
|
|
35
|
-
async getHeader(opts) {
|
|
36
|
-
return this.bed.getHeader(opts);
|
|
37
|
-
}
|
|
38
|
-
async getMetadataPre2(_opts) {
|
|
39
|
-
if (!this.setupP) {
|
|
40
|
-
this.setupP = this.getMetadataPre().catch((e) => {
|
|
41
|
-
this.setupP = undefined;
|
|
42
|
-
throw e;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return this.setupP;
|
|
46
|
-
}
|
|
47
|
-
async getMetadataPre() {
|
|
48
|
-
const meta = await this.bed.getMetadata();
|
|
49
|
-
return { meta };
|
|
50
|
-
}
|
|
51
|
-
async getMetadata(opts) {
|
|
52
|
-
const { statusCallback = () => { } } = opts || {};
|
|
53
|
-
return (0, util_1.updateStatus)('Downloading index', statusCallback, () => this.getMetadataPre2(opts));
|
|
54
|
-
}
|
|
55
|
-
async getNames() {
|
|
56
|
-
if (this.columnNames.length) {
|
|
57
|
-
return this.columnNames;
|
|
58
|
-
}
|
|
59
|
-
const header = await this.getHeader();
|
|
60
|
-
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
61
|
-
const defline = defs.at(-1);
|
|
62
|
-
return (defline === null || defline === void 0 ? void 0 : defline.includes('\t'))
|
|
63
|
-
? defline
|
|
64
|
-
.slice(1)
|
|
65
|
-
.split('\t')
|
|
66
|
-
.map(f => f.trim())
|
|
67
|
-
: undefined;
|
|
68
|
-
}
|
|
69
|
-
getFeatures(query, opts) {
|
|
70
|
-
const { stopToken, statusCallback = () => { } } = opts || {};
|
|
71
|
-
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
72
|
-
const { meta } = await this.getMetadata();
|
|
73
|
-
const { columnNumbers } = meta;
|
|
74
|
-
const colRef = columnNumbers.ref - 1;
|
|
75
|
-
const colStart = columnNumbers.start - 1;
|
|
76
|
-
const colEnd = columnNumbers.end - 1;
|
|
77
|
-
const names = await this.getNames();
|
|
78
|
-
let start = performance.now();
|
|
79
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
80
|
-
await (0, util_1.updateStatus)('Downloading features', statusCallback, () => this.bed.getLines(query.refName, query.start, query.end, {
|
|
81
|
-
lineCallback: (line, fileOffset) => {
|
|
82
|
-
if (performance.now() - start > 200) {
|
|
83
|
-
(0, stopToken_1.checkStopToken)(stopToken);
|
|
84
|
-
start = performance.now();
|
|
85
|
-
}
|
|
86
|
-
observer.next(new util_1.SimpleFeature((0, util_2.featureData)({
|
|
87
|
-
line,
|
|
88
|
-
colRef,
|
|
89
|
-
colStart,
|
|
90
|
-
colEnd,
|
|
91
|
-
scoreColumn: this.scoreColumn,
|
|
92
|
-
parser: this.parser,
|
|
93
|
-
uniqueId: `${this.id}-${fileOffset}`,
|
|
94
|
-
names,
|
|
95
|
-
})));
|
|
96
|
-
},
|
|
97
|
-
stopToken,
|
|
98
|
-
}));
|
|
99
|
-
observer.complete();
|
|
100
|
-
}, stopToken);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
BedTabixAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
104
|
-
exports.default = BedTabixAdapter;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
declare const BedTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
bedGzLocation: {
|
|
3
|
-
type: string;
|
|
4
|
-
defaultValue: {
|
|
5
|
-
uri: string;
|
|
6
|
-
locationType: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
|
-
indexType: {
|
|
11
|
-
model: import("mobx-state-tree").ISimpleType<string>;
|
|
12
|
-
type: string;
|
|
13
|
-
defaultValue: string;
|
|
14
|
-
};
|
|
15
|
-
location: {
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: {
|
|
18
|
-
uri: string;
|
|
19
|
-
locationType: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
|
-
columnNames: {
|
|
24
|
-
type: string;
|
|
25
|
-
description: string;
|
|
26
|
-
defaultValue: never[];
|
|
27
|
-
};
|
|
28
|
-
scoreColumn: {
|
|
29
|
-
type: string;
|
|
30
|
-
description: string;
|
|
31
|
-
defaultValue: string;
|
|
32
|
-
};
|
|
33
|
-
autoSql: {
|
|
34
|
-
type: string;
|
|
35
|
-
description: string;
|
|
36
|
-
defaultValue: string;
|
|
37
|
-
};
|
|
38
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
39
|
-
export default BedTabixAdapter;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
-
function x() { }
|
|
6
|
-
const BedTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedTabixAdapter', {
|
|
7
|
-
bedGzLocation: {
|
|
8
|
-
type: 'fileLocation',
|
|
9
|
-
defaultValue: {
|
|
10
|
-
uri: '/path/to/my.bed.gz',
|
|
11
|
-
locationType: 'UriLocation',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
index: (0, configuration_1.ConfigurationSchema)('TabixIndex', {
|
|
15
|
-
indexType: {
|
|
16
|
-
model: mobx_state_tree_1.types.enumeration('IndexType', ['TBI', 'CSI']),
|
|
17
|
-
type: 'stringEnum',
|
|
18
|
-
defaultValue: 'TBI',
|
|
19
|
-
},
|
|
20
|
-
location: {
|
|
21
|
-
type: 'fileLocation',
|
|
22
|
-
defaultValue: {
|
|
23
|
-
uri: '/path/to/my.bed.gz.tbi',
|
|
24
|
-
locationType: 'UriLocation',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
columnNames: {
|
|
29
|
-
type: 'stringArray',
|
|
30
|
-
description: 'List of column names',
|
|
31
|
-
defaultValue: [],
|
|
32
|
-
},
|
|
33
|
-
scoreColumn: {
|
|
34
|
-
type: 'string',
|
|
35
|
-
description: 'The column to use as a "score" attribute',
|
|
36
|
-
defaultValue: '',
|
|
37
|
-
},
|
|
38
|
-
autoSql: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'The autoSql definition for the data fields in the file',
|
|
41
|
-
defaultValue: '',
|
|
42
|
-
},
|
|
43
|
-
}, {
|
|
44
|
-
explicitlyTyped: true,
|
|
45
|
-
preProcessSnapshot: snap => {
|
|
46
|
-
return snap.uri
|
|
47
|
-
? {
|
|
48
|
-
...snap,
|
|
49
|
-
bedGzLocation: {
|
|
50
|
-
uri: snap.uri,
|
|
51
|
-
baseUri: snap.baseUri,
|
|
52
|
-
},
|
|
53
|
-
index: {
|
|
54
|
-
location: {
|
|
55
|
-
uri: `${snap.uri}.tbi`,
|
|
56
|
-
baseUri: snap.baseUri,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
: snap;
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
exports.default = BedTabixAdapter;
|
|
@@ -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 = BedTabixAdapterF;
|
|
40
|
-
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
41
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
42
|
-
function BedTabixAdapterF(pluginManager) {
|
|
43
|
-
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
44
|
-
name: 'BedTabixAdapter',
|
|
45
|
-
displayName: 'BED tabix adapter',
|
|
46
|
-
configSchema: configSchema_1.default,
|
|
47
|
-
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BedTabixAdapter'))).then(r => r.default),
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IntervalTree } from '@flatten-js/interval-tree';
|
|
2
|
-
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
-
import type { Feature, Region } from '@jbrowse/core/util';
|
|
5
|
-
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
6
|
-
protected bedpeFeatures?: Promise<{
|
|
7
|
-
header: string;
|
|
8
|
-
feats1: Record<string, string[]>;
|
|
9
|
-
feats2: Record<string, string[]>;
|
|
10
|
-
columnNames: string[];
|
|
11
|
-
}>;
|
|
12
|
-
protected intervalTrees: Record<string, Promise<IntervalTree<Feature> | undefined> | undefined>;
|
|
13
|
-
static capabilities: string[];
|
|
14
|
-
private loadDataP;
|
|
15
|
-
private loadData;
|
|
16
|
-
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
17
|
-
getHeader(opts?: BaseOptions): Promise<string>;
|
|
18
|
-
getNames(): Promise<string[] | undefined>;
|
|
19
|
-
private loadFeatureTreeP;
|
|
20
|
-
private loadFeatureTree;
|
|
21
|
-
getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
22
|
-
}
|