@jbrowse/plugin-bed 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/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
|
@@ -5,12 +5,11 @@ import { SimpleFeature, fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
|
5
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
6
6
|
import { parseLineByLine } from '@jbrowse/core/util/parseLineByLine';
|
|
7
7
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
8
|
-
import { featureData } from
|
|
9
|
-
class BedAdapter extends BaseFeatureDataAdapter {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
import { featureData } from "../util.js";
|
|
9
|
+
export default class BedAdapter extends BaseFeatureDataAdapter {
|
|
10
|
+
bedFeatures;
|
|
11
|
+
intervalTrees = {};
|
|
12
|
+
static capabilities = ['getFeatures', 'getRefNames'];
|
|
14
13
|
async loadDataP(opts) {
|
|
15
14
|
const bedLoc = this.getConf('bedLocation');
|
|
16
15
|
const buffer = await fetchAndMaybeUnzip(openLocation(bedLoc, this.pluginManager), opts);
|
|
@@ -29,7 +28,7 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
29
28
|
features[refName].push(line);
|
|
30
29
|
}
|
|
31
30
|
return true;
|
|
32
|
-
}, opts
|
|
31
|
+
}, opts?.statusCallback);
|
|
33
32
|
const header = headerLines.join('\n');
|
|
34
33
|
const autoSql = this.getConf('autoSql');
|
|
35
34
|
const parser = new BED({ autoSql });
|
|
@@ -73,7 +72,7 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
73
72
|
}
|
|
74
73
|
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
75
74
|
const defline = defs.at(-1);
|
|
76
|
-
return
|
|
75
|
+
return defline?.includes('\t')
|
|
77
76
|
? defline
|
|
78
77
|
.slice(1)
|
|
79
78
|
.split('\t')
|
|
@@ -118,7 +117,7 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
118
117
|
return ObservableCreate(async (observer) => {
|
|
119
118
|
const { start, end, refName } = query;
|
|
120
119
|
const intervalTree = await this.loadFeatureIntervalTree(refName);
|
|
121
|
-
const features = intervalTree
|
|
120
|
+
const features = intervalTree?.search([start, end]);
|
|
122
121
|
if (features) {
|
|
123
122
|
for (const f of features) {
|
|
124
123
|
observer.next(f);
|
|
@@ -128,5 +127,3 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
128
127
|
}, opts.stopToken);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
BedAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
132
|
-
export default BedAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BedAdapter: import("
|
|
1
|
+
declare const BedAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bedLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -37,5 +37,5 @@ declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchem
|
|
|
37
37
|
description: string;
|
|
38
38
|
defaultValue: number;
|
|
39
39
|
};
|
|
40
|
-
}, import("
|
|
40
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
41
41
|
export default BedAdapter;
|
package/esm/BedAdapter/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BedAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BedAdapter',
|
|
6
6
|
displayName: 'BED adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BedAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
@@ -5,10 +5,8 @@ import { openLocation } from '@jbrowse/core/util/io';
|
|
|
5
5
|
import { parseLineByLine } from '@jbrowse/core/util/parseLineByLine';
|
|
6
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
7
7
|
export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.intervalTrees = {};
|
|
11
|
-
}
|
|
8
|
+
bedFeatures;
|
|
9
|
+
intervalTrees = {};
|
|
12
10
|
async getNames() {
|
|
13
11
|
const { header, columnNames } = await this.loadData();
|
|
14
12
|
if (columnNames.length) {
|
|
@@ -16,7 +14,7 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
16
14
|
}
|
|
17
15
|
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
18
16
|
const defline = defs.at(-1);
|
|
19
|
-
return
|
|
17
|
+
return defline?.includes('\t')
|
|
20
18
|
? defline
|
|
21
19
|
.slice(1)
|
|
22
20
|
.split('\t')
|
|
@@ -24,13 +22,12 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
24
22
|
: undefined;
|
|
25
23
|
}
|
|
26
24
|
async loadFeatureIntervalTreeHelper(refName) {
|
|
27
|
-
var _a;
|
|
28
25
|
const { features } = await this.loadData();
|
|
29
26
|
const lines = features[refName];
|
|
30
27
|
if (!lines) {
|
|
31
28
|
return undefined;
|
|
32
29
|
}
|
|
33
|
-
const names = (
|
|
30
|
+
const names = (await this.getNames())?.slice(3) || [];
|
|
34
31
|
const intervalTree = new IntervalTree();
|
|
35
32
|
for (let i = 0, l = lines.length; i < l; i++) {
|
|
36
33
|
const line = lines[i];
|
|
@@ -110,7 +107,7 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
110
107
|
return ObservableCreate(async (observer) => {
|
|
111
108
|
const { start, end, refName } = query;
|
|
112
109
|
const intervalTree = await this.loadFeatureIntervalTree(refName);
|
|
113
|
-
for (const feature of
|
|
110
|
+
for (const feature of intervalTree?.search([start, end]) || []) {
|
|
114
111
|
observer.next(feature);
|
|
115
112
|
}
|
|
116
113
|
observer.complete();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BedGraphAdapter: import("
|
|
1
|
+
declare const BedGraphAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bedGraphLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: {
|
|
@@ -11,5 +11,5 @@ declare const BedGraphAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
11
11
|
description: string;
|
|
12
12
|
defaultValue: never[];
|
|
13
13
|
};
|
|
14
|
-
}, import("
|
|
14
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
15
15
|
export default BedGraphAdapter;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BedGraphAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BedGraphAdapter',
|
|
6
6
|
displayName: 'BedGraph adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BedGraphAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
@@ -4,6 +4,7 @@ import { SimpleFeature } from '@jbrowse/core/util';
|
|
|
4
4
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
5
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
6
|
export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
7
|
+
configured;
|
|
7
8
|
async configurePre() {
|
|
8
9
|
const pm = this.pluginManager;
|
|
9
10
|
const bedGraphGzLocation = this.getConf('bedGraphGzLocation');
|
|
@@ -42,7 +43,7 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
42
43
|
const header = await bedGraph.getHeader();
|
|
43
44
|
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
44
45
|
const defline = defs.at(-1);
|
|
45
|
-
return
|
|
46
|
+
return defline?.includes('\t')
|
|
46
47
|
? defline
|
|
47
48
|
.slice(1)
|
|
48
49
|
.split('\t')
|
|
@@ -59,7 +60,6 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
59
60
|
}
|
|
60
61
|
getFeatures(query, opts = {}) {
|
|
61
62
|
return ObservableCreate(async (observer) => {
|
|
62
|
-
var _a;
|
|
63
63
|
const { bedGraph } = await this.configure();
|
|
64
64
|
const meta = await bedGraph.getMetadata();
|
|
65
65
|
const { columnNumbers } = meta;
|
|
@@ -67,7 +67,7 @@ export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
|
67
67
|
const colStart = columnNumbers.start - 1;
|
|
68
68
|
const colEnd = columnNumbers.end - 1;
|
|
69
69
|
const same = colStart === colEnd;
|
|
70
|
-
const names = (
|
|
70
|
+
const names = (await this.getNames())?.slice(same ? 2 : 3) || [];
|
|
71
71
|
await bedGraph.getLines(query.refName, query.start + (same ? -1 : 0), query.end, {
|
|
72
72
|
lineCallback: (line, fileOffset) => {
|
|
73
73
|
const cols = line.split('\t');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BedGraphTabixAdapter: import("
|
|
1
|
+
declare const BedGraphTabixAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bedGraphGzLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: {
|
|
@@ -6,9 +6,9 @@ declare const BedGraphTabixAdapter: import("@jbrowse/core/configuration/configur
|
|
|
6
6
|
locationType: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
index: import("
|
|
9
|
+
index: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
10
|
indexType: {
|
|
11
|
-
model: import("mobx-state-tree").ISimpleType<string>;
|
|
11
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
12
12
|
type: string;
|
|
13
13
|
defaultValue: string;
|
|
14
14
|
};
|
|
@@ -19,11 +19,11 @@ declare const BedGraphTabixAdapter: import("@jbrowse/core/configuration/configur
|
|
|
19
19
|
locationType: string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
}, import("
|
|
22
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
23
|
columnNames: {
|
|
24
24
|
type: string;
|
|
25
25
|
description: string;
|
|
26
26
|
defaultValue: never[];
|
|
27
27
|
};
|
|
28
|
-
}, import("
|
|
28
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
29
29
|
export default BedGraphTabixAdapter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
import { types } from 'mobx-state-tree';
|
|
2
|
+
import { types } from '@jbrowse/mobx-state-tree';
|
|
3
3
|
function x() { }
|
|
4
4
|
const BedGraphTabixAdapter = ConfigurationSchema('BedGraphTabixAdapter', {
|
|
5
5
|
bedGraphGzLocation: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BedGraphTabixAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BedGraphTabixAdapter',
|
|
6
6
|
displayName: 'BedGraphTabix adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BedGraphTabixAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
@@ -5,8 +5,14 @@ import { SimpleFeature, updateStatus } from '@jbrowse/core/util';
|
|
|
5
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
6
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
7
7
|
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
8
|
-
import { featureData } from
|
|
9
|
-
class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
8
|
+
import { featureData } from "../util.js";
|
|
9
|
+
export default class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
10
|
+
parser;
|
|
11
|
+
bed;
|
|
12
|
+
columnNames;
|
|
13
|
+
scoreColumn;
|
|
14
|
+
static capabilities = ['getFeatures', 'getRefNames'];
|
|
15
|
+
setupP;
|
|
10
16
|
constructor(config, getSubAdapter, pluginManager) {
|
|
11
17
|
super(config, getSubAdapter, pluginManager);
|
|
12
18
|
const bedGzLoc = this.getConf('bedGzLocation');
|
|
@@ -54,7 +60,7 @@ class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
54
60
|
const header = await this.getHeader();
|
|
55
61
|
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
56
62
|
const defline = defs.at(-1);
|
|
57
|
-
return
|
|
63
|
+
return defline?.includes('\t')
|
|
58
64
|
? defline
|
|
59
65
|
.slice(1)
|
|
60
66
|
.split('\t')
|
|
@@ -74,7 +80,7 @@ class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
74
80
|
checkStopToken(stopToken);
|
|
75
81
|
await updateStatus('Downloading features', statusCallback, () => this.bed.getLines(query.refName, query.start, query.end, {
|
|
76
82
|
lineCallback: (line, fileOffset) => {
|
|
77
|
-
if (performance.now() - start >
|
|
83
|
+
if (performance.now() - start > 500) {
|
|
78
84
|
checkStopToken(stopToken);
|
|
79
85
|
start = performance.now();
|
|
80
86
|
}
|
|
@@ -95,5 +101,3 @@ class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
95
101
|
}, stopToken);
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
BedTabixAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
99
|
-
export default BedTabixAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BedTabixAdapter: import("
|
|
1
|
+
declare const BedTabixAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bedGzLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: {
|
|
@@ -6,9 +6,9 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
6
6
|
locationType: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
index: import("
|
|
9
|
+
index: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
10
|
indexType: {
|
|
11
|
-
model: import("mobx-state-tree").ISimpleType<string>;
|
|
11
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
12
12
|
type: string;
|
|
13
13
|
defaultValue: string;
|
|
14
14
|
};
|
|
@@ -19,7 +19,7 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
19
19
|
locationType: string;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
}, import("
|
|
22
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
23
|
columnNames: {
|
|
24
24
|
type: string;
|
|
25
25
|
description: string;
|
|
@@ -35,5 +35,5 @@ declare const BedTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
35
35
|
description: string;
|
|
36
36
|
defaultValue: string;
|
|
37
37
|
};
|
|
38
|
-
}, import("
|
|
38
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
39
39
|
export default BedTabixAdapter;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BedTabixAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BedTabixAdapter',
|
|
6
6
|
displayName: 'BED tabix adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BedTabixAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
@@ -3,12 +3,11 @@ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'
|
|
|
3
3
|
import { fetchAndMaybeUnzipText } from '@jbrowse/core/util';
|
|
4
4
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
5
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
|
-
import { featureData } from
|
|
7
|
-
class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
6
|
+
import { featureData } from "./util.js";
|
|
7
|
+
export default class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
8
|
+
bedpeFeatures;
|
|
9
|
+
intervalTrees = {};
|
|
10
|
+
static capabilities = ['getFeatures', 'getRefNames'];
|
|
12
11
|
async loadDataP(opts) {
|
|
13
12
|
const data = await fetchAndMaybeUnzipText(openLocation(this.getConf('bedpeLocation'), this.pluginManager), opts);
|
|
14
13
|
const lines = data.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
@@ -66,7 +65,7 @@ class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
|
66
65
|
}
|
|
67
66
|
const defs = header.split(/\n|\r\n|\r/).filter(f => !!f);
|
|
68
67
|
const defline = defs.at(-1);
|
|
69
|
-
return
|
|
68
|
+
return defline?.includes('\t')
|
|
70
69
|
? defline
|
|
71
70
|
.slice(1)
|
|
72
71
|
.split('\t')
|
|
@@ -74,12 +73,11 @@ class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
|
74
73
|
: undefined;
|
|
75
74
|
}
|
|
76
75
|
async loadFeatureTreeP(refName) {
|
|
77
|
-
var _a, _b, _c, _d;
|
|
78
76
|
const { feats1, feats2 } = await this.loadData();
|
|
79
77
|
const names = await this.getNames();
|
|
80
78
|
const intervalTree = new IntervalTree();
|
|
81
|
-
const ret1 =
|
|
82
|
-
const ret2 =
|
|
79
|
+
const ret1 = feats1[refName]?.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r1`, false, names)) ?? [];
|
|
80
|
+
const ret2 = feats2[refName]?.map((f, i) => featureData(f, `${this.id}-${refName}-${i}-r2`, true, names)) ?? [];
|
|
83
81
|
for (const obj of [...ret1, ...ret2]) {
|
|
84
82
|
intervalTree.insert([obj.get('start'), obj.get('end')], obj);
|
|
85
83
|
}
|
|
@@ -98,12 +96,10 @@ class BedpeAdapter extends BaseFeatureDataAdapter {
|
|
|
98
96
|
return ObservableCreate(async (observer) => {
|
|
99
97
|
const { start, end, refName } = query;
|
|
100
98
|
const intervalTree = await this.loadFeatureTree(refName);
|
|
101
|
-
for (const f of
|
|
99
|
+
for (const f of intervalTree?.search([start, end]) || []) {
|
|
102
100
|
observer.next(f);
|
|
103
101
|
}
|
|
104
102
|
observer.complete();
|
|
105
103
|
}, opts.stopToken);
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
|
-
BedpeAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
109
|
-
export default BedpeAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BedpeAdapter: import("
|
|
1
|
+
declare const BedpeAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bedpeLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -12,5 +12,5 @@ declare const BedpeAdapter: import("@jbrowse/core/configuration/configurationSch
|
|
|
12
12
|
description: string;
|
|
13
13
|
defaultValue: never[];
|
|
14
14
|
};
|
|
15
|
-
}, import("
|
|
15
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
16
16
|
export default BedpeAdapter;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BedpeAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BedpeAdapter',
|
|
6
6
|
displayName: 'BEDPE adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BedpeAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
package/esm/BedpeAdapter/util.js
CHANGED
|
@@ -9,7 +9,7 @@ export function featureData(line, uniqueId, flip, names) {
|
|
|
9
9
|
const start2 = +l[!flip ? 4 : 1];
|
|
10
10
|
const end2 = +l[!flip ? 5 : 2];
|
|
11
11
|
const name = l[6];
|
|
12
|
-
const score = +l[7];
|
|
12
|
+
const score = l[7] ? +l[7] : undefined;
|
|
13
13
|
const strand1 = parseStrand(l[8]);
|
|
14
14
|
const strand2 = parseStrand(l[9]);
|
|
15
15
|
const extra = l.slice(10);
|
|
@@ -9,7 +9,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
9
9
|
private cachedP?;
|
|
10
10
|
configurePre(opts?: BaseOptions): Promise<{
|
|
11
11
|
bigbed: BigBed;
|
|
12
|
-
header: import("@gmod/bbi
|
|
12
|
+
header: import("@gmod/bbi").BigWigHeaderWithRefNames;
|
|
13
13
|
parser: BED;
|
|
14
14
|
}>;
|
|
15
15
|
configure(opts?: BaseOptions): Promise<{
|
|
@@ -5,8 +5,9 @@ import { SimpleFeature, doesIntersect2, max, min, updateStatus, } from '@jbrowse
|
|
|
5
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
6
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
7
7
|
import { firstValueFrom, toArray } from 'rxjs';
|
|
8
|
-
import { featureData2 } from
|
|
8
|
+
import { featureData2 } from "../util.js";
|
|
9
9
|
export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
10
|
+
cachedP;
|
|
10
11
|
async configurePre(opts) {
|
|
11
12
|
const pm = this.pluginManager;
|
|
12
13
|
const bigbed = new BigBed({
|
|
@@ -90,7 +91,6 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
90
91
|
basesPerSpan: query.end - query.start,
|
|
91
92
|
}));
|
|
92
93
|
await updateStatus('Processing features', statusCallback, async () => {
|
|
93
|
-
var _a;
|
|
94
94
|
const parentAggregation = {};
|
|
95
95
|
const parentAggregationFlat = [];
|
|
96
96
|
if (feats.some(f => f.uniqueId === undefined)) {
|
|
@@ -101,7 +101,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
101
101
|
query.refName,
|
|
102
102
|
`${feat.start}`,
|
|
103
103
|
`${feat.end}`,
|
|
104
|
-
...(
|
|
104
|
+
...(feat.rest?.split('\t') || []),
|
|
105
105
|
];
|
|
106
106
|
const data = parser.parseLine(splitLine, {
|
|
107
107
|
uniqueId: feat.uniqueId,
|
|
@@ -150,8 +150,8 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
150
150
|
await this.getFeaturesHelper({
|
|
151
151
|
query: {
|
|
152
152
|
...query,
|
|
153
|
-
start: minStart -
|
|
154
|
-
end: maxEnd +
|
|
153
|
+
start: minStart - 500_000,
|
|
154
|
+
end: maxEnd + 500_000,
|
|
155
155
|
},
|
|
156
156
|
opts,
|
|
157
157
|
observer,
|
|
@@ -162,18 +162,17 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
Object.entries(parentAggregation).map(([name, subfeatures]) => {
|
|
165
|
-
var _a, _b, _c;
|
|
166
165
|
const s = min(subfeatures.map(f => f.start));
|
|
167
166
|
const e = max(subfeatures.map(f => f.end));
|
|
168
167
|
if (doesIntersect2(s, e, originalQuery.start, originalQuery.end)) {
|
|
169
168
|
const subs = subfeatures.sort((a, b) => a.uniqueId.localeCompare(b.uniqueId));
|
|
170
169
|
if (subs.some((a, i) => subs.some((b, j) => i !== j && doesIntersect2(a.start, a.end, b.start, b.end)))) {
|
|
171
170
|
observer.next(new SimpleFeature({
|
|
172
|
-
id: `${this.id}-${
|
|
171
|
+
id: `${this.id}-${subs[0]?.uniqueId}-parent`,
|
|
173
172
|
data: {
|
|
174
173
|
type: 'gene',
|
|
175
174
|
subfeatures: subs,
|
|
176
|
-
strand:
|
|
175
|
+
strand: subs[0]?.strand || 1,
|
|
177
176
|
name,
|
|
178
177
|
start: s,
|
|
179
178
|
end: e,
|
|
@@ -188,7 +187,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
188
187
|
data: {
|
|
189
188
|
type: 'gene',
|
|
190
189
|
subfeatures: [sub],
|
|
191
|
-
strand:
|
|
190
|
+
strand: subs[0]?.strand || 1,
|
|
192
191
|
name,
|
|
193
192
|
start: sub.start,
|
|
194
193
|
end: sub.end,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const BigBedAdapter: import("
|
|
1
|
+
declare const BigBedAdapter: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
bigBedLocation: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: {
|
|
@@ -16,5 +16,5 @@ declare const BigBedAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
16
16
|
description: string;
|
|
17
17
|
defaultValue: string;
|
|
18
18
|
};
|
|
19
|
-
}, import("
|
|
19
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
20
20
|
export default BigBedAdapter;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
|
-
import configSchema from
|
|
2
|
+
import configSchema from "./configSchema.js";
|
|
3
3
|
export default function BigBedAdapterF(pluginManager) {
|
|
4
4
|
pluginManager.addAdapterType(() => new AdapterType({
|
|
5
5
|
name: 'BigBedAdapter',
|
|
6
6
|
displayName: 'BigBed adapter',
|
|
7
7
|
configSchema,
|
|
8
|
-
getAdapterClass: () => import(
|
|
8
|
+
getAdapterClass: () => import("./BigBedAdapter.js").then(r => r.default),
|
|
9
9
|
}));
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function isRepeatMaskerDescriptionField(desc) {
|
|
2
|
-
const ret = desc
|
|
3
|
-
return [0, 1, 2, 3, 5, 6].every(s =>
|
|
2
|
+
const ret = desc?.trim().split(' ');
|
|
3
|
+
return [0, 1, 2, 3, 5, 6].every(s => ret?.[s] !== undefined ? !Number.isNaN(+ret[s]) : false);
|
|
4
4
|
}
|
|
5
5
|
function makeRepeatTrackDescription(description) {
|
|
6
6
|
if (isRepeatMaskerDescriptionField(description)) {
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MinimalFeature } from './types.ts';
|
|
2
2
|
export declare function isUcscTranscript({ thickStart, blockCount, strand, }: {
|
|
3
3
|
thickStart?: number;
|
|
4
4
|
blockCount?: number;
|
|
5
5
|
strand?: number;
|
|
6
6
|
}): boolean | 0 | undefined;
|
|
7
|
-
|
|
7
|
+
interface UcscTranscriptInput {
|
|
8
|
+
uniqueId: string;
|
|
9
|
+
strand?: number;
|
|
10
|
+
thickStart: number;
|
|
11
|
+
thickEnd: number;
|
|
12
|
+
refName: string;
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
subfeatures: MinimalFeature[];
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
interface UcscTranscriptOutput {
|
|
8
19
|
uniqueId: string;
|
|
9
20
|
strand: number;
|
|
10
21
|
type: string;
|
|
11
22
|
refName: string;
|
|
12
|
-
subfeatures: {
|
|
13
|
-
type: string;
|
|
14
|
-
start: number;
|
|
15
|
-
end: number;
|
|
16
|
-
refName: string;
|
|
17
|
-
}[];
|
|
18
23
|
start: number;
|
|
19
24
|
end: number;
|
|
20
|
-
|
|
25
|
+
subfeatures: MinimalFeature[];
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export declare function generateUcscTranscript(data: UcscTranscriptInput): UcscTranscriptOutput;
|
|
29
|
+
export {};
|