@jbrowse/plugin-bed 2.16.1 → 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/BedAdapter/BedAdapter.d.ts +15 -5
- package/dist/BedAdapter/BedAdapter.js +17 -13
- package/dist/BedAdapter/configSchema.d.ts +0 -21
- package/dist/BedAdapter/configSchema.js +1 -25
- package/dist/BedAdapter/index.d.ts +1 -1
- package/dist/BedGraphAdapter/BedGraphAdapter.d.ts +24 -0
- package/dist/BedGraphAdapter/BedGraphAdapter.js +130 -0
- package/dist/BedGraphAdapter/configSchema.d.ts +15 -0
- package/dist/BedGraphAdapter/configSchema.js +19 -0
- package/dist/BedGraphAdapter/index.d.ts +2 -0
- package/dist/BedGraphAdapter/index.js +39 -0
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +18 -0
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.js +105 -0
- package/dist/BedGraphTabixAdapter/configSchema.d.ts +29 -0
- package/dist/BedGraphTabixAdapter/configSchema.js +34 -0
- package/dist/BedGraphTabixAdapter/index.d.ts +2 -0
- package/dist/BedGraphTabixAdapter/index.js +39 -0
- package/dist/BedTabixAdapter/BedTabixAdapter.d.ts +6 -5
- package/dist/BedTabixAdapter/BedTabixAdapter.js +23 -9
- package/dist/BedTabixAdapter/configSchema.d.ts +0 -18
- package/dist/BedTabixAdapter/configSchema.js +1 -22
- package/dist/BedTabixAdapter/index.d.ts +1 -1
- package/dist/BedpeAdapter/BedpeAdapter.d.ts +4 -2
- package/dist/BedpeAdapter/BedpeAdapter.js +7 -9
- package/dist/BedpeAdapter/configSchema.d.ts +0 -7
- package/dist/BedpeAdapter/configSchema.js +1 -12
- package/dist/BedpeAdapter/index.d.ts +1 -1
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +14 -6
- package/dist/BigBedAdapter/BigBedAdapter.js +72 -62
- package/dist/BigBedAdapter/configSchema.d.ts +0 -9
- package/dist/BigBedAdapter/configSchema.js +1 -13
- package/dist/BigBedAdapter/index.d.ts +1 -1
- package/dist/generateBedMethylFeature.d.ts +31 -0
- package/dist/generateBedMethylFeature.js +30 -0
- package/dist/generateRepeatMaskerFeature.d.ts +51 -0
- package/dist/generateRepeatMaskerFeature.js +41 -0
- package/dist/generateUcscTranscript.d.ts +15 -0
- package/dist/generateUcscTranscript.js +95 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -4
- package/dist/types.d.ts +18 -0
- package/dist/types.js +2 -0
- package/dist/util.d.ts +184 -29
- package/dist/util.js +134 -156
- package/esm/BedAdapter/BedAdapter.d.ts +15 -5
- package/esm/BedAdapter/BedAdapter.js +18 -14
- package/esm/BedAdapter/configSchema.d.ts +0 -21
- package/esm/BedAdapter/configSchema.js +1 -25
- package/esm/BedAdapter/index.d.ts +1 -1
- package/esm/BedGraphAdapter/BedGraphAdapter.d.ts +24 -0
- package/esm/BedGraphAdapter/BedGraphAdapter.js +124 -0
- package/esm/BedGraphAdapter/configSchema.d.ts +15 -0
- package/esm/BedGraphAdapter/configSchema.js +17 -0
- package/esm/BedGraphAdapter/index.d.ts +2 -0
- package/esm/BedGraphAdapter/index.js +10 -0
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +18 -0
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +102 -0
- package/esm/BedGraphTabixAdapter/configSchema.d.ts +29 -0
- package/esm/BedGraphTabixAdapter/configSchema.js +32 -0
- package/esm/BedGraphTabixAdapter/index.d.ts +2 -0
- package/esm/BedGraphTabixAdapter/index.js +10 -0
- package/esm/BedTabixAdapter/BedTabixAdapter.d.ts +6 -5
- package/esm/BedTabixAdapter/BedTabixAdapter.js +23 -9
- package/esm/BedTabixAdapter/configSchema.d.ts +0 -18
- package/esm/BedTabixAdapter/configSchema.js +1 -22
- package/esm/BedTabixAdapter/index.d.ts +1 -1
- package/esm/BedpeAdapter/BedpeAdapter.d.ts +4 -2
- package/esm/BedpeAdapter/BedpeAdapter.js +8 -10
- package/esm/BedpeAdapter/configSchema.d.ts +0 -7
- package/esm/BedpeAdapter/configSchema.js +1 -12
- package/esm/BedpeAdapter/index.d.ts +1 -1
- package/esm/BigBedAdapter/BigBedAdapter.d.ts +14 -6
- package/esm/BigBedAdapter/BigBedAdapter.js +74 -64
- package/esm/BigBedAdapter/configSchema.d.ts +0 -9
- package/esm/BigBedAdapter/configSchema.js +1 -13
- package/esm/BigBedAdapter/index.d.ts +1 -1
- package/esm/generateBedMethylFeature.d.ts +31 -0
- package/esm/generateBedMethylFeature.js +26 -0
- package/esm/generateRepeatMaskerFeature.d.ts +51 -0
- package/esm/generateRepeatMaskerFeature.js +37 -0
- package/esm/generateUcscTranscript.d.ts +15 -0
- package/esm/generateUcscTranscript.js +91 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +8 -4
- package/esm/types.d.ts +18 -0
- package/esm/types.js +1 -0
- package/esm/util.d.ts +184 -29
- package/esm/util.js +132 -154
- package/package.json +2 -2
|
@@ -0,0 +1,39 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.default = BedGraphTabixAdapterF;
|
|
30
|
+
const AdapterType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
31
|
+
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
32
|
+
function BedGraphTabixAdapterF(pluginManager) {
|
|
33
|
+
pluginManager.addAdapterType(() => new AdapterType_1.default({
|
|
34
|
+
name: 'BedGraphTabixAdapter',
|
|
35
|
+
displayName: 'BedGraphTabix adapter',
|
|
36
|
+
configSchema: configSchema_1.default,
|
|
37
|
+
getAdapterClass: () => Promise.resolve().then(() => __importStar(require('./BedGraphTabixAdapter'))).then(r => r.default),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { Region, Feature } from '@jbrowse/core/util';
|
|
3
1
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
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';
|
|
7
8
|
export default class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
8
9
|
private parser;
|
|
9
10
|
protected bed: TabixIndexedFile;
|
|
@@ -4,12 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const bed_1 = __importDefault(require("@gmod/bed"));
|
|
7
|
+
const tabix_1 = require("@gmod/tabix");
|
|
7
8
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
10
|
const io_1 = require("@jbrowse/core/util/io");
|
|
9
11
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const util_1 = require("../util");
|
|
12
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
13
|
+
const util_2 = require("../util");
|
|
13
14
|
class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
14
15
|
constructor(config, getSubAdapter, pluginManager) {
|
|
15
16
|
super(config, getSubAdapter, pluginManager);
|
|
@@ -49,24 +50,37 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
49
50
|
: undefined;
|
|
50
51
|
}
|
|
51
52
|
getFeatures(query, opts = {}) {
|
|
53
|
+
const { stopToken } = opts;
|
|
52
54
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
53
55
|
const meta = await this.bed.getMetadata();
|
|
54
56
|
const { columnNumbers } = meta;
|
|
55
57
|
const colRef = columnNumbers.ref - 1;
|
|
56
58
|
const colStart = columnNumbers.start - 1;
|
|
57
59
|
const colEnd = columnNumbers.end - 1;
|
|
58
|
-
// colSame handles special case for tabix where a single column is both
|
|
59
|
-
// the start and end, this is assumed to be covering the base at this
|
|
60
|
-
// position (e.g. tabix -s 1 -b 2 -e 2) begin and end are same
|
|
61
60
|
const names = await this.getNames();
|
|
61
|
+
let start = performance.now();
|
|
62
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
62
63
|
await this.bed.getLines(query.refName, query.start, query.end, {
|
|
63
64
|
lineCallback: (line, fileOffset) => {
|
|
64
|
-
|
|
65
|
+
if (performance.now() - start > 200) {
|
|
66
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
67
|
+
start = performance.now();
|
|
68
|
+
}
|
|
69
|
+
observer.next(new util_1.SimpleFeature((0, util_2.featureData)({
|
|
70
|
+
line,
|
|
71
|
+
colRef,
|
|
72
|
+
colStart,
|
|
73
|
+
colEnd,
|
|
74
|
+
scoreColumn: this.scoreColumn,
|
|
75
|
+
parser: this.parser,
|
|
76
|
+
uniqueId: `${this.id}-${fileOffset}`,
|
|
77
|
+
names,
|
|
78
|
+
})));
|
|
65
79
|
},
|
|
66
|
-
|
|
80
|
+
stopToken: opts.stopToken,
|
|
67
81
|
});
|
|
68
82
|
observer.complete();
|
|
69
|
-
}, opts.
|
|
83
|
+
}, opts.stopToken);
|
|
70
84
|
}
|
|
71
85
|
freeResources() { }
|
|
72
86
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const BedTabixAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
bedGzLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -10,17 +7,11 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
9
|
index: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
13
|
-
/**
|
|
14
|
-
* #slot index.indexType
|
|
15
|
-
*/
|
|
16
10
|
indexType: {
|
|
17
11
|
model: import("mobx-state-tree").ISimpleType<string>;
|
|
18
12
|
type: string;
|
|
19
13
|
defaultValue: string;
|
|
20
14
|
};
|
|
21
|
-
/**
|
|
22
|
-
* #slot index.location
|
|
23
|
-
*/
|
|
24
15
|
location: {
|
|
25
16
|
type: string;
|
|
26
17
|
defaultValue: {
|
|
@@ -29,25 +20,16 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
29
20
|
};
|
|
30
21
|
};
|
|
31
22
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
32
|
-
/**
|
|
33
|
-
* #slot
|
|
34
|
-
*/
|
|
35
23
|
columnNames: {
|
|
36
24
|
type: string;
|
|
37
25
|
description: string;
|
|
38
26
|
defaultValue: never[];
|
|
39
27
|
};
|
|
40
|
-
/**
|
|
41
|
-
* #slot
|
|
42
|
-
*/
|
|
43
28
|
scoreColumn: {
|
|
44
29
|
type: string;
|
|
45
30
|
description: string;
|
|
46
31
|
defaultValue: string;
|
|
47
32
|
};
|
|
48
|
-
/**
|
|
49
|
-
* #slot
|
|
50
|
-
*/
|
|
51
33
|
autoSql: {
|
|
52
34
|
type: string;
|
|
53
35
|
description: string;
|
|
@@ -2,30 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
4
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
-
|
|
6
|
-
* #config BedTabixAdapter
|
|
7
|
-
*/
|
|
8
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5
|
+
function x() { }
|
|
9
6
|
const BedTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedTabixAdapter', {
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
*/
|
|
13
7
|
bedGzLocation: {
|
|
14
8
|
type: 'fileLocation',
|
|
15
9
|
defaultValue: { uri: '/path/to/my.bed.gz', locationType: 'UriLocation' },
|
|
16
10
|
},
|
|
17
11
|
index: (0, configuration_1.ConfigurationSchema)('TabixIndex', {
|
|
18
|
-
/**
|
|
19
|
-
* #slot index.indexType
|
|
20
|
-
*/
|
|
21
12
|
indexType: {
|
|
22
13
|
model: mobx_state_tree_1.types.enumeration('IndexType', ['TBI', 'CSI']),
|
|
23
14
|
type: 'stringEnum',
|
|
24
15
|
defaultValue: 'TBI',
|
|
25
16
|
},
|
|
26
|
-
/**
|
|
27
|
-
* #slot index.location
|
|
28
|
-
*/
|
|
29
17
|
location: {
|
|
30
18
|
type: 'fileLocation',
|
|
31
19
|
defaultValue: {
|
|
@@ -34,25 +22,16 @@ const BedTabixAdapter = (0, configuration_1.ConfigurationSchema)('BedTabixAdapte
|
|
|
34
22
|
},
|
|
35
23
|
},
|
|
36
24
|
}),
|
|
37
|
-
/**
|
|
38
|
-
* #slot
|
|
39
|
-
*/
|
|
40
25
|
columnNames: {
|
|
41
26
|
type: 'stringArray',
|
|
42
27
|
description: 'List of column names',
|
|
43
28
|
defaultValue: [],
|
|
44
29
|
},
|
|
45
|
-
/**
|
|
46
|
-
* #slot
|
|
47
|
-
*/
|
|
48
30
|
scoreColumn: {
|
|
49
31
|
type: 'string',
|
|
50
32
|
description: 'The column to use as a "score" attribute',
|
|
51
33
|
defaultValue: '',
|
|
52
34
|
},
|
|
53
|
-
/**
|
|
54
|
-
* #slot
|
|
55
|
-
*/
|
|
56
35
|
autoSql: {
|
|
57
36
|
type: 'string',
|
|
58
37
|
description: 'The autoSql definition for the data fields in the file',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BedTabixAdapterF(pluginManager: PluginManager): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { Region, Feature, SimpleFeature } from '@jbrowse/core/util';
|
|
3
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
+
import { SimpleFeature } from '@jbrowse/core/util';
|
|
4
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
|
+
import type { Feature, Region } from '@jbrowse/core/util';
|
|
4
6
|
export declare function featureData(line: string, uniqueId: string, flip: boolean, names?: string[]): SimpleFeature;
|
|
5
7
|
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
6
8
|
protected bedpeFeatures?: Promise<{
|
|
@@ -4,12 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.featureData = featureData;
|
|
7
|
+
const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
|
|
7
8
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
10
|
const io_1 = require("@jbrowse/core/util/io");
|
|
9
11
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
10
|
-
const util_1 = require("@jbrowse/core/util");
|
|
11
|
-
const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
|
|
12
|
-
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
13
12
|
const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
|
|
14
13
|
function featureData(line, uniqueId, flip, names) {
|
|
15
14
|
const l = line.split('\t');
|
|
@@ -44,7 +43,7 @@ function featureData(line, uniqueId, flip, names) {
|
|
|
44
43
|
end: end2,
|
|
45
44
|
strand: strand2,
|
|
46
45
|
},
|
|
47
|
-
...(ALT ? { ALT: [ALT] } : {}),
|
|
46
|
+
...(ALT ? { ALT: [ALT] } : {}),
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
function parseStrand(strand) {
|
|
@@ -64,12 +63,11 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
64
63
|
super(...arguments);
|
|
65
64
|
this.intervalTrees = {};
|
|
66
65
|
}
|
|
67
|
-
async loadDataP(opts
|
|
66
|
+
async loadDataP(opts) {
|
|
68
67
|
const pm = this.pluginManager;
|
|
69
68
|
const bedLoc = this.getConf('bedpeLocation');
|
|
70
|
-
const
|
|
71
|
-
const buffer = (0, util_1.
|
|
72
|
-
// 512MB max chrome string length is 512MB
|
|
69
|
+
const loc = (0, io_1.openLocation)(bedLoc, pm);
|
|
70
|
+
const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
|
|
73
71
|
if (buffer.length > 536870888) {
|
|
74
72
|
throw new Error('Data exceeds maximum string length (512MB)');
|
|
75
73
|
}
|
|
@@ -165,7 +163,7 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
165
163
|
observer.next(f);
|
|
166
164
|
});
|
|
167
165
|
observer.complete();
|
|
168
|
-
}, opts.
|
|
166
|
+
}, opts.stopToken);
|
|
169
167
|
}
|
|
170
168
|
freeResources() { }
|
|
171
169
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
* can be plaintext or gzipped, not indexed so loaded into memory on startup
|
|
5
|
-
*/
|
|
6
2
|
bedpeLocation: {
|
|
7
3
|
type: string;
|
|
8
4
|
defaultValue: {
|
|
@@ -10,9 +6,6 @@ declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSch
|
|
|
10
6
|
locationType: string;
|
|
11
7
|
};
|
|
12
8
|
};
|
|
13
|
-
/**
|
|
14
|
-
* #slot
|
|
15
|
-
*/
|
|
16
9
|
columnNames: {
|
|
17
10
|
type: string;
|
|
18
11
|
description: string;
|
|
@@ -1,16 +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 BedpeAdapter
|
|
6
|
-
* intended for SVs in a single assembly
|
|
7
|
-
*/
|
|
8
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
9
5
|
const BedpeAdapter = (0, configuration_1.ConfigurationSchema)('BedpeAdapter', {
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
* can be plaintext or gzipped, not indexed so loaded into memory on startup
|
|
13
|
-
*/
|
|
14
6
|
bedpeLocation: {
|
|
15
7
|
type: 'fileLocation',
|
|
16
8
|
defaultValue: {
|
|
@@ -18,9 +10,6 @@ const BedpeAdapter = (0, configuration_1.ConfigurationSchema)('BedpeAdapter', {
|
|
|
18
10
|
locationType: 'UriLocation',
|
|
19
11
|
},
|
|
20
12
|
},
|
|
21
|
-
/**
|
|
22
|
-
* #slot
|
|
23
|
-
*/
|
|
24
13
|
columnNames: {
|
|
25
14
|
type: 'stringArray',
|
|
26
15
|
description: 'List of column names',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BedpeAdapterF(pluginManager: PluginManager): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { BigBed } from '@gmod/bbi';
|
|
2
2
|
import BED from '@gmod/bed';
|
|
3
|
-
import { BaseFeatureDataAdapter
|
|
4
|
-
import {
|
|
5
|
-
import { Feature } from '@jbrowse/core/util';
|
|
6
|
-
import {
|
|
3
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
6
|
+
import type { Region } from '@jbrowse/core/util/types';
|
|
7
|
+
import type { Observer } from 'rxjs';
|
|
7
8
|
export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
8
|
-
private
|
|
9
|
+
private cachedP?;
|
|
9
10
|
configurePre(opts?: BaseOptions): Promise<{
|
|
10
11
|
bigbed: BigBed;
|
|
11
12
|
header: import("@gmod/bbi").Header;
|
|
@@ -17,6 +18,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
17
18
|
parser: BED;
|
|
18
19
|
}>;
|
|
19
20
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
21
|
+
getData(): Promise<Feature[]>;
|
|
20
22
|
getHeader(opts?: BaseOptions): Promise<{
|
|
21
23
|
version: number;
|
|
22
24
|
fileType: string;
|
|
@@ -25,7 +27,13 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
25
27
|
[k: string]: string;
|
|
26
28
|
};
|
|
27
29
|
}>;
|
|
28
|
-
getFeaturesHelper(query
|
|
30
|
+
getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery, }: {
|
|
31
|
+
query: Region;
|
|
32
|
+
opts: BaseOptions;
|
|
33
|
+
observer: Observer<Feature>;
|
|
34
|
+
allowRedispatch: boolean;
|
|
35
|
+
originalQuery?: Region;
|
|
36
|
+
}): Promise<void>;
|
|
29
37
|
getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
30
38
|
freeResources(): void;
|
|
31
39
|
}
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const bbi_1 = require("@gmod/bbi");
|
|
7
7
|
const bed_1 = __importDefault(require("@gmod/bed"));
|
|
8
8
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
9
10
|
const io_1 = require("@jbrowse/core/util/io");
|
|
10
11
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
11
|
-
const
|
|
12
|
-
// locals
|
|
12
|
+
const rxjs_2 = require("rxjs");
|
|
13
13
|
const util_2 = require("../util");
|
|
14
14
|
class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
15
15
|
async configurePre(opts) {
|
|
@@ -18,22 +18,42 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
18
18
|
filehandle: (0, io_1.openLocation)(this.getConf('bigBedLocation'), pm),
|
|
19
19
|
});
|
|
20
20
|
const header = await bigbed.getHeader(opts);
|
|
21
|
-
const parser = new bed_1.default({
|
|
22
|
-
|
|
21
|
+
const parser = new bed_1.default({
|
|
22
|
+
autoSql: header.autoSql,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
bigbed,
|
|
26
|
+
header,
|
|
27
|
+
parser,
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
async configure(opts) {
|
|
25
|
-
if (!this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
31
|
+
if (!this.cachedP) {
|
|
32
|
+
this.cachedP = this.configurePre(opts).catch((e) => {
|
|
33
|
+
this.cachedP = undefined;
|
|
28
34
|
throw e;
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
|
-
return this.
|
|
37
|
+
return this.cachedP;
|
|
32
38
|
}
|
|
33
39
|
async getRefNames(opts) {
|
|
34
40
|
const { header } = await this.configure(opts);
|
|
35
41
|
return Object.keys(header.refsByName);
|
|
36
42
|
}
|
|
43
|
+
async getData() {
|
|
44
|
+
const refNames = await this.getRefNames();
|
|
45
|
+
const features = [];
|
|
46
|
+
for (const refName of refNames) {
|
|
47
|
+
const f = await (0, rxjs_2.firstValueFrom)(this.getFeatures({
|
|
48
|
+
assemblyName: 'unknown',
|
|
49
|
+
refName,
|
|
50
|
+
start: 0,
|
|
51
|
+
end: Number.MAX_SAFE_INTEGER,
|
|
52
|
+
}).pipe((0, rxjs_2.toArray)()));
|
|
53
|
+
features.push(f);
|
|
54
|
+
}
|
|
55
|
+
return features.flat();
|
|
56
|
+
}
|
|
37
57
|
async getHeader(opts) {
|
|
38
58
|
const { parser, header } = await this.configure(opts);
|
|
39
59
|
const { version, fileType } = header;
|
|
@@ -45,13 +65,14 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
45
65
|
fields: Object.fromEntries(fields.map(({ name, comment }) => [name, comment])),
|
|
46
66
|
};
|
|
47
67
|
}
|
|
48
|
-
async getFeaturesHelper(query, opts, observer, allowRedispatch, originalQuery = query) {
|
|
49
|
-
|
|
68
|
+
async getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery = query, }) {
|
|
69
|
+
var _a;
|
|
70
|
+
const { stopToken } = opts;
|
|
50
71
|
const scoreColumn = this.getConf('scoreColumn');
|
|
51
72
|
const aggregateField = this.getConf('aggregateField');
|
|
52
73
|
const { parser, bigbed } = await this.configure(opts);
|
|
53
74
|
const feats = await bigbed.getFeatures(query.refName, query.start, query.end, {
|
|
54
|
-
|
|
75
|
+
stopToken,
|
|
55
76
|
basesPerSpan: query.end - query.start,
|
|
56
77
|
});
|
|
57
78
|
if (allowRedispatch && feats.length) {
|
|
@@ -66,7 +87,17 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
66
87
|
}
|
|
67
88
|
}
|
|
68
89
|
if (maxEnd > query.end || minStart < query.start) {
|
|
69
|
-
await this.getFeaturesHelper({
|
|
90
|
+
await this.getFeaturesHelper({
|
|
91
|
+
query: {
|
|
92
|
+
...query,
|
|
93
|
+
start: minStart,
|
|
94
|
+
end: maxEnd,
|
|
95
|
+
},
|
|
96
|
+
opts,
|
|
97
|
+
observer,
|
|
98
|
+
allowRedispatch: false,
|
|
99
|
+
originalQuery: query,
|
|
100
|
+
});
|
|
70
101
|
return;
|
|
71
102
|
}
|
|
72
103
|
}
|
|
@@ -75,62 +106,36 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
75
106
|
throw new Error('found uniqueId undefined');
|
|
76
107
|
}
|
|
77
108
|
for (const feat of feats) {
|
|
78
|
-
const
|
|
109
|
+
const splitLine = [
|
|
110
|
+
query.refName,
|
|
111
|
+
`${feat.start}`,
|
|
112
|
+
`${feat.end}`,
|
|
113
|
+
...(((_a = feat.rest) === null || _a === void 0 ? void 0 : _a.split('\t')) || []),
|
|
114
|
+
];
|
|
115
|
+
const data = parser.parseLine(splitLine, { uniqueId: feat.uniqueId });
|
|
79
116
|
const aggr = data[aggregateField];
|
|
80
117
|
if (!parentAggregation[aggr]) {
|
|
81
118
|
parentAggregation[aggr] = [];
|
|
82
119
|
}
|
|
83
|
-
const { uniqueId, type, chromStart, chromStarts, blockStarts
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const f = (0, util_2.ucscProcessedTranscript)({
|
|
97
|
-
...rest,
|
|
98
|
-
uniqueId,
|
|
99
|
-
type,
|
|
100
|
-
start: feat.start,
|
|
101
|
-
end: feat.end,
|
|
102
|
-
refName: query.refName,
|
|
103
|
-
score: scoreColumn ? +data[scoreColumn] : score,
|
|
104
|
-
chromStarts,
|
|
105
|
-
blockCount,
|
|
106
|
-
blockSizes,
|
|
107
|
-
thickStart,
|
|
108
|
-
thickEnd,
|
|
109
|
-
subfeatures,
|
|
110
|
-
});
|
|
111
|
-
if (aggr) {
|
|
112
|
-
parentAggregation[aggr].push(f);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
if ((0, util_1.doesIntersect2)(f.start, f.end, originalQuery.start, originalQuery.end)) {
|
|
116
|
-
observer.next(new util_1.SimpleFeature({ id: `${this.id}-${uniqueId}`, data: f }));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
120
|
+
const { uniqueId, type, chrom, chromStart, chromEnd, description, chromStarts: chromStarts2, blockStarts: blockStarts2, blockSizes: blockSizes2, score: score2, blockCount, thickStart, thickEnd, strand, ...rest } = data;
|
|
121
|
+
const f = (0, util_2.featureData2)({
|
|
122
|
+
...rest,
|
|
123
|
+
scoreColumn,
|
|
124
|
+
splitLine,
|
|
125
|
+
parser,
|
|
126
|
+
uniqueId,
|
|
127
|
+
start: feat.start,
|
|
128
|
+
end: feat.end,
|
|
129
|
+
refName: query.refName,
|
|
130
|
+
});
|
|
131
|
+
if (aggr) {
|
|
132
|
+
parentAggregation[aggr].push(f);
|
|
119
133
|
}
|
|
120
134
|
else {
|
|
121
|
-
if ((0, util_1.doesIntersect2)(
|
|
135
|
+
if ((0, util_1.doesIntersect2)(f.start, f.end, originalQuery.start, originalQuery.end)) {
|
|
122
136
|
observer.next(new util_1.SimpleFeature({
|
|
123
137
|
id: `${this.id}-${uniqueId}`,
|
|
124
|
-
data:
|
|
125
|
-
...rest,
|
|
126
|
-
uniqueId,
|
|
127
|
-
type,
|
|
128
|
-
start: feat.start,
|
|
129
|
-
score: scoreColumn ? +data[scoreColumn] : score,
|
|
130
|
-
end: feat.end,
|
|
131
|
-
refName: query.refName,
|
|
132
|
-
subfeatures,
|
|
133
|
-
},
|
|
138
|
+
data: f,
|
|
134
139
|
}));
|
|
135
140
|
}
|
|
136
141
|
}
|
|
@@ -159,12 +164,17 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
159
164
|
getFeatures(query, opts = {}) {
|
|
160
165
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
161
166
|
try {
|
|
162
|
-
await this.getFeaturesHelper(
|
|
167
|
+
await this.getFeaturesHelper({
|
|
168
|
+
query,
|
|
169
|
+
opts,
|
|
170
|
+
observer,
|
|
171
|
+
allowRedispatch: true,
|
|
172
|
+
});
|
|
163
173
|
}
|
|
164
174
|
catch (e) {
|
|
165
175
|
observer.error(e);
|
|
166
176
|
}
|
|
167
|
-
}, opts.
|
|
177
|
+
}, opts.stopToken);
|
|
168
178
|
}
|
|
169
179
|
freeResources() { }
|
|
170
180
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const BigBedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
bigBedLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,17 +6,11 @@ declare const BigBedAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
scoreColumn: {
|
|
16
10
|
type: string;
|
|
17
11
|
description: string;
|
|
18
12
|
defaultValue: string;
|
|
19
13
|
};
|
|
20
|
-
/**
|
|
21
|
-
* #slot
|
|
22
|
-
*/
|
|
23
14
|
aggregateField: {
|
|
24
15
|
type: string;
|
|
25
16
|
description: string;
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
|
|
5
|
-
* #config BigBedAdapter
|
|
6
|
-
*/
|
|
7
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
4
|
+
function x() { }
|
|
8
5
|
const BigBedAdapter = (0, configuration_1.ConfigurationSchema)('BigBedAdapter', {
|
|
9
|
-
/**
|
|
10
|
-
* #slot
|
|
11
|
-
*/
|
|
12
6
|
bigBedLocation: {
|
|
13
7
|
type: 'fileLocation',
|
|
14
8
|
defaultValue: { uri: '/path/to/my.bb', locationType: 'UriLocation' },
|
|
15
9
|
},
|
|
16
|
-
/**
|
|
17
|
-
* #slot
|
|
18
|
-
*/
|
|
19
10
|
scoreColumn: {
|
|
20
11
|
type: 'string',
|
|
21
12
|
description: 'The column to use as a "score" attribute',
|
|
22
13
|
defaultValue: '',
|
|
23
14
|
},
|
|
24
|
-
/**
|
|
25
|
-
* #slot
|
|
26
|
-
*/
|
|
27
15
|
aggregateField: {
|
|
28
16
|
type: 'string',
|
|
29
17
|
description: 'An attribute to aggregate features with',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BigBedAdapterF(pluginManager: PluginManager): void;
|