@jbrowse/plugin-bed 2.17.0 → 3.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/dist/BedAdapter/BedAdapter.d.ts +15 -5
- package/dist/BedAdapter/BedAdapter.js +7 -10
- 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/BedAdapter/index.js +17 -7
- 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 +49 -0
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +18 -0
- package/dist/BedGraphTabixAdapter/BedGraphTabixAdapter.js +108 -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 +49 -0
- package/dist/BedTabixAdapter/BedTabixAdapter.d.ts +6 -5
- package/dist/BedTabixAdapter/BedTabixAdapter.js +12 -5
- 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/BedTabixAdapter/index.js +17 -7
- package/dist/BedpeAdapter/BedpeAdapter.d.ts +3 -3
- package/dist/BedpeAdapter/BedpeAdapter.js +7 -64
- 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/BedpeAdapter/index.js +17 -7
- package/dist/BedpeAdapter/util.d.ts +2 -0
- package/dist/BedpeAdapter/util.js +55 -0
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +5 -4
- package/dist/BigBedAdapter/BigBedAdapter.js +13 -8
- package/dist/BigBedAdapter/configSchema.d.ts +0 -9
- package/dist/BigBedAdapter/configSchema.js +2 -14
- package/dist/BigBedAdapter/index.d.ts +1 -1
- package/dist/BigBedAdapter/index.js +17 -7
- package/dist/GuessAdapter/index.d.ts +2 -0
- package/dist/GuessAdapter/index.js +68 -0
- package/dist/generateBedMethylFeature.d.ts +3 -3
- package/dist/generateBedMethylFeature.js +6 -6
- package/dist/generateRepeatMaskerFeature.js +2 -1
- package/dist/generateUcscTranscript.d.ts +1 -1
- package/dist/generateUcscTranscript.js +4 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -72
- package/dist/util.d.ts +171 -6
- package/dist/util.js +65 -61
- package/esm/BedAdapter/BedAdapter.d.ts +15 -5
- package/esm/BedAdapter/BedAdapter.js +8 -11
- 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 +105 -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 +13 -6
- 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 +3 -3
- package/esm/BedpeAdapter/BedpeAdapter.js +6 -62
- 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/BedpeAdapter/util.d.ts +2 -0
- package/esm/BedpeAdapter/util.js +52 -0
- package/esm/BigBedAdapter/BigBedAdapter.d.ts +5 -4
- package/esm/BigBedAdapter/BigBedAdapter.js +14 -9
- package/esm/BigBedAdapter/configSchema.d.ts +0 -9
- package/esm/BigBedAdapter/configSchema.js +2 -14
- package/esm/BigBedAdapter/index.d.ts +1 -1
- package/esm/GuessAdapter/index.d.ts +2 -0
- package/esm/GuessAdapter/index.js +65 -0
- package/esm/generateBedMethylFeature.d.ts +3 -3
- package/esm/generateBedMethylFeature.js +6 -6
- package/esm/generateRepeatMaskerFeature.js +2 -1
- package/esm/generateUcscTranscript.d.ts +1 -1
- package/esm/generateUcscTranscript.js +4 -6
- package/esm/index.d.ts +1 -1
- package/esm/index.js +9 -72
- package/esm/util.d.ts +171 -6
- package/esm/util.js +65 -61
- package/package.json +5 -5
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}, { explicitlyTyped: true });
|
|
34
|
+
exports.default = BedGraphTabixAdapter;
|
|
@@ -0,0 +1,49 @@
|
|
|
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,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,12 @@ 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
|
-
const tabix_1 = require("@gmod/tabix");
|
|
12
|
-
// locals
|
|
12
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
13
13
|
const util_2 = require("../util");
|
|
14
14
|
class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
15
15
|
constructor(config, getSubAdapter, pluginManager) {
|
|
@@ -50,6 +50,7 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
50
50
|
: undefined;
|
|
51
51
|
}
|
|
52
52
|
getFeatures(query, opts = {}) {
|
|
53
|
+
const { stopToken } = opts;
|
|
53
54
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
54
55
|
const meta = await this.bed.getMetadata();
|
|
55
56
|
const { columnNumbers } = meta;
|
|
@@ -57,8 +58,14 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
57
58
|
const colStart = columnNumbers.start - 1;
|
|
58
59
|
const colEnd = columnNumbers.end - 1;
|
|
59
60
|
const names = await this.getNames();
|
|
61
|
+
let start = performance.now();
|
|
62
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
60
63
|
await this.bed.getLines(query.refName, query.start, query.end, {
|
|
61
64
|
lineCallback: (line, fileOffset) => {
|
|
65
|
+
if (performance.now() - start > 200) {
|
|
66
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
67
|
+
start = performance.now();
|
|
68
|
+
}
|
|
62
69
|
observer.next(new util_1.SimpleFeature((0, util_2.featureData)({
|
|
63
70
|
line,
|
|
64
71
|
colRef,
|
|
@@ -70,10 +77,10 @@ class BedTabixAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
70
77
|
names,
|
|
71
78
|
})));
|
|
72
79
|
},
|
|
73
|
-
|
|
80
|
+
stopToken: opts.stopToken,
|
|
74
81
|
});
|
|
75
82
|
observer.complete();
|
|
76
|
-
}, opts.
|
|
83
|
+
}, opts.stopToken);
|
|
77
84
|
}
|
|
78
85
|
freeResources() { }
|
|
79
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;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
4
|
-
|
|
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
5
|
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
6
6
|
protected bedpeFeatures?: Promise<{
|
|
7
7
|
header: string;
|
|
@@ -3,76 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
6
|
+
const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
|
|
7
7
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
8
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
9
|
const io_1 = require("@jbrowse/core/util/io");
|
|
9
10
|
const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
10
|
-
const
|
|
11
|
-
const interval_tree_1 = __importDefault(require("@flatten-js/interval-tree"));
|
|
12
|
-
const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
|
|
13
|
-
function featureData(line, uniqueId, flip, names) {
|
|
14
|
-
const l = line.split('\t');
|
|
15
|
-
const ref1 = l[flip ? 3 : 0];
|
|
16
|
-
const start1 = +l[flip ? 4 : 1];
|
|
17
|
-
const end1 = +l[flip ? 5 : 2];
|
|
18
|
-
const ref2 = l[!flip ? 3 : 0];
|
|
19
|
-
const start2 = +l[!flip ? 4 : 1];
|
|
20
|
-
const end2 = +l[!flip ? 5 : 2];
|
|
21
|
-
const name = l[6];
|
|
22
|
-
const score = +l[7];
|
|
23
|
-
const strand1 = parseStrand(l[8]);
|
|
24
|
-
const strand2 = parseStrand(l[9]);
|
|
25
|
-
const extra = l.slice(10);
|
|
26
|
-
const rest = names
|
|
27
|
-
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
28
|
-
: extra;
|
|
29
|
-
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
30
|
-
return new util_1.SimpleFeature({
|
|
31
|
-
...rest,
|
|
32
|
-
start: start1,
|
|
33
|
-
end: end1,
|
|
34
|
-
type: 'paired_feature',
|
|
35
|
-
refName: ref1,
|
|
36
|
-
strand: strand1,
|
|
37
|
-
name,
|
|
38
|
-
score,
|
|
39
|
-
uniqueId,
|
|
40
|
-
mate: {
|
|
41
|
-
refName: ref2,
|
|
42
|
-
start: start2,
|
|
43
|
-
end: end2,
|
|
44
|
-
strand: strand2,
|
|
45
|
-
},
|
|
46
|
-
...(ALT ? { ALT: [ALT] } : {}), // ALT is an array in VCF
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function parseStrand(strand) {
|
|
50
|
-
if (strand === '+') {
|
|
51
|
-
return 1;
|
|
52
|
-
}
|
|
53
|
-
if (strand === '-') {
|
|
54
|
-
return -1;
|
|
55
|
-
}
|
|
56
|
-
if (strand === '.') {
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
11
|
+
const util_2 = require("./util");
|
|
61
12
|
class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
62
13
|
constructor() {
|
|
63
14
|
super(...arguments);
|
|
64
15
|
this.intervalTrees = {};
|
|
65
16
|
}
|
|
66
17
|
async loadDataP(opts) {
|
|
67
|
-
const
|
|
68
|
-
const bedLoc = this.getConf('bedpeLocation');
|
|
69
|
-
const loc = (0, io_1.openLocation)(bedLoc, pm);
|
|
70
|
-
const buffer = await (0, util_1.fetchAndMaybeUnzip)(loc, opts);
|
|
71
|
-
// 512MB max chrome string length is 512MB
|
|
72
|
-
if (buffer.length > 536870888) {
|
|
73
|
-
throw new Error('Data exceeds maximum string length (512MB)');
|
|
74
|
-
}
|
|
75
|
-
const data = new TextDecoder('utf8', { fatal: true }).decode(buffer);
|
|
18
|
+
const data = await (0, util_1.fetchAndMaybeUnzipText)((0, io_1.openLocation)(this.getConf('bedpeLocation'), this.pluginManager), opts);
|
|
76
19
|
const lines = data.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
77
20
|
const headerLines = [];
|
|
78
21
|
let i = 0;
|
|
@@ -140,8 +83,8 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
140
83
|
const { feats1, feats2 } = await this.loadData();
|
|
141
84
|
const names = await this.getNames();
|
|
142
85
|
const intervalTree = new interval_tree_1.default();
|
|
143
|
-
const ret1 = (_b = (_a = feats1[refName]) === null || _a === void 0 ? void 0 : _a.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r1`, false, names))) !== null && _b !== void 0 ? _b : [];
|
|
144
|
-
const ret2 = (_d = (_c = feats2[refName]) === null || _c === void 0 ? void 0 : _c.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r2`, true, names))) !== null && _d !== void 0 ? _d : [];
|
|
86
|
+
const ret1 = (_b = (_a = feats1[refName]) === null || _a === void 0 ? void 0 : _a.map((f, i) => (0, util_2.featureData)(f, `${this.id}-${refName}-${i}-r1`, false, names))) !== null && _b !== void 0 ? _b : [];
|
|
87
|
+
const ret2 = (_d = (_c = feats2[refName]) === null || _c === void 0 ? void 0 : _c.map((f, i) => (0, util_2.featureData)(f, `${this.id}-${refName}-${i}-r2`, true, names))) !== null && _d !== void 0 ? _d : [];
|
|
145
88
|
for (const obj of [...ret1, ...ret2]) {
|
|
146
89
|
intervalTree.insert([obj.get('start'), obj.get('end')], obj);
|
|
147
90
|
}
|
|
@@ -164,7 +107,7 @@ class BedpeAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
164
107
|
observer.next(f);
|
|
165
108
|
});
|
|
166
109
|
observer.complete();
|
|
167
|
-
}, opts.
|
|
110
|
+
}, opts.stopToken);
|
|
168
111
|
}
|
|
169
112
|
freeResources() { }
|
|
170
113
|
}
|
|
@@ -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;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
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
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.featureData = featureData;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const svTypes = new Set(['DUP', 'TRA', 'INV', 'CNV', 'DEL']);
|
|
6
|
+
function featureData(line, uniqueId, flip, names) {
|
|
7
|
+
const l = line.split('\t');
|
|
8
|
+
const ref1 = l[flip ? 3 : 0];
|
|
9
|
+
const start1 = +l[flip ? 4 : 1];
|
|
10
|
+
const end1 = +l[flip ? 5 : 2];
|
|
11
|
+
const ref2 = l[!flip ? 3 : 0];
|
|
12
|
+
const start2 = +l[!flip ? 4 : 1];
|
|
13
|
+
const end2 = +l[!flip ? 5 : 2];
|
|
14
|
+
const name = l[6];
|
|
15
|
+
const score = +l[7];
|
|
16
|
+
const strand1 = parseStrand(l[8]);
|
|
17
|
+
const strand2 = parseStrand(l[9]);
|
|
18
|
+
const extra = l.slice(10);
|
|
19
|
+
const rest = names
|
|
20
|
+
? Object.fromEntries(names.slice(10).map((n, idx) => [n, extra[idx]]))
|
|
21
|
+
: {};
|
|
22
|
+
const ALT = svTypes.has(extra[0]) ? `<${extra[0]}>` : undefined;
|
|
23
|
+
return new util_1.SimpleFeature({
|
|
24
|
+
...rest,
|
|
25
|
+
start: start1,
|
|
26
|
+
end: end1,
|
|
27
|
+
type: 'paired_feature',
|
|
28
|
+
refName: ref1,
|
|
29
|
+
strand: strand1,
|
|
30
|
+
name,
|
|
31
|
+
score,
|
|
32
|
+
uniqueId,
|
|
33
|
+
mate: {
|
|
34
|
+
refName: ref2,
|
|
35
|
+
start: start2,
|
|
36
|
+
end: end2,
|
|
37
|
+
strand: strand2,
|
|
38
|
+
},
|
|
39
|
+
...(ALT ? { ALT: [ALT] } : {}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function parseStrand(strand) {
|
|
43
|
+
if (strand === '+') {
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
else if (strand === '-') {
|
|
47
|
+
return -1;
|
|
48
|
+
}
|
|
49
|
+
else if (strand === '.') {
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
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
9
|
private cachedP?;
|
|
9
10
|
configurePre(opts?: BaseOptions): Promise<{
|
|
@@ -6,11 +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 util_1 = require("@jbrowse/core/util");
|
|
12
12
|
const rxjs_2 = require("rxjs");
|
|
13
|
-
// locals
|
|
14
13
|
const util_2 = require("../util");
|
|
15
14
|
class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
16
15
|
async configurePre(opts) {
|
|
@@ -67,12 +66,13 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
async getFeaturesHelper({ query, opts, observer, allowRedispatch, originalQuery = query, }) {
|
|
70
|
-
|
|
69
|
+
var _a;
|
|
70
|
+
const { stopToken } = opts;
|
|
71
71
|
const scoreColumn = this.getConf('scoreColumn');
|
|
72
72
|
const aggregateField = this.getConf('aggregateField');
|
|
73
73
|
const { parser, bigbed } = await this.configure(opts);
|
|
74
74
|
const feats = await bigbed.getFeatures(query.refName, query.start, query.end, {
|
|
75
|
-
|
|
75
|
+
stopToken,
|
|
76
76
|
basesPerSpan: query.end - query.start,
|
|
77
77
|
});
|
|
78
78
|
if (allowRedispatch && feats.length) {
|
|
@@ -106,8 +106,13 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
106
106
|
throw new Error('found uniqueId undefined');
|
|
107
107
|
}
|
|
108
108
|
for (const feat of feats) {
|
|
109
|
-
const
|
|
110
|
-
|
|
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 });
|
|
111
116
|
const aggr = data[aggregateField];
|
|
112
117
|
if (!parentAggregation[aggr]) {
|
|
113
118
|
parentAggregation[aggr] = [];
|
|
@@ -116,7 +121,7 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
116
121
|
const f = (0, util_2.featureData2)({
|
|
117
122
|
...rest,
|
|
118
123
|
scoreColumn,
|
|
119
|
-
|
|
124
|
+
splitLine,
|
|
120
125
|
parser,
|
|
121
126
|
uniqueId,
|
|
122
127
|
start: feat.start,
|
|
@@ -169,7 +174,7 @@ class BigBedAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
169
174
|
catch (e) {
|
|
170
175
|
observer.error(e);
|
|
171
176
|
}
|
|
172
|
-
}, opts.
|
|
177
|
+
}, opts.stopToken);
|
|
173
178
|
}
|
|
174
179
|
freeResources() { }
|
|
175
180
|
}
|