@jbrowse/plugin-bed 2.17.0 → 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 +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/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 +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/BedpeAdapter/BedpeAdapter.d.ts +4 -2
- package/dist/BedpeAdapter/BedpeAdapter.js +4 -5
- 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 +5 -4
- package/dist/BigBedAdapter/BigBedAdapter.js +13 -8
- 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 +3 -3
- package/dist/generateBedMethylFeature.js +3 -5
- package/dist/generateUcscTranscript.d.ts +1 -1
- package/dist/generateUcscTranscript.js +0 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -4
- 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 +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 +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 +4 -2
- package/esm/BedpeAdapter/BedpeAdapter.js +5 -6
- 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 +5 -4
- package/esm/BigBedAdapter/BigBedAdapter.js +14 -9
- 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 +3 -3
- package/esm/generateBedMethylFeature.js +3 -5
- package/esm/generateUcscTranscript.d.ts +1 -1
- package/esm/generateUcscTranscript.js +0 -6
- package/esm/index.d.ts +1 -1
- package/esm/index.js +8 -4
- package/esm/util.d.ts +171 -6
- package/esm/util.js +65 -61
- package/package.json +2 -2
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import BED from '@gmod/bed';
|
|
2
|
-
import { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
1
|
+
import type BED from '@gmod/bed';
|
|
3
2
|
export declare function makeBlocks({ start, uniqueId, refName, chromStarts, blockCount, blockSizes, blockStarts, }: {
|
|
4
3
|
blockCount: number;
|
|
5
4
|
start: number;
|
|
@@ -24,9 +23,92 @@ export declare function featureData({ line, colRef, colStart, colEnd, scoreColum
|
|
|
24
23
|
parser: BED;
|
|
25
24
|
uniqueId: string;
|
|
26
25
|
names?: string[];
|
|
27
|
-
}):
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
}): {
|
|
27
|
+
uniqueId: string;
|
|
28
|
+
refName: string;
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
code: string | undefined;
|
|
32
|
+
score: number;
|
|
33
|
+
strand: string | undefined;
|
|
34
|
+
color: string | undefined;
|
|
35
|
+
source: string | undefined;
|
|
36
|
+
n_valid_cov: string | undefined;
|
|
37
|
+
fraction_modified: string | undefined;
|
|
38
|
+
n_mod: string | undefined;
|
|
39
|
+
n_canonical: string | undefined;
|
|
40
|
+
n_other_mod: string | undefined;
|
|
41
|
+
n_delete: string | undefined;
|
|
42
|
+
n_fail: string | undefined;
|
|
43
|
+
n_diff: string | undefined;
|
|
44
|
+
n_nocall: string | undefined;
|
|
45
|
+
} | {
|
|
46
|
+
uniqueId: string;
|
|
47
|
+
refName: string;
|
|
48
|
+
start: number;
|
|
49
|
+
end: number;
|
|
50
|
+
bitsw_score: string | undefined;
|
|
51
|
+
percent_div: string | undefined;
|
|
52
|
+
percent_del: string | undefined;
|
|
53
|
+
percent_ins: string | undefined;
|
|
54
|
+
query_chr: string | undefined;
|
|
55
|
+
query_begin: string | undefined;
|
|
56
|
+
query_end: string | undefined;
|
|
57
|
+
query_remaining: string | undefined;
|
|
58
|
+
orientation: string | undefined;
|
|
59
|
+
matching_repeat_name: string | undefined;
|
|
60
|
+
matching_repeat_class: string | undefined;
|
|
61
|
+
matching_repeat_begin: string | undefined;
|
|
62
|
+
matching_repeat_end: string | undefined;
|
|
63
|
+
matching_repeat_remaining: string | undefined;
|
|
64
|
+
repeat_id: string | undefined;
|
|
65
|
+
description?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
uniqueId: string;
|
|
68
|
+
refName: string;
|
|
69
|
+
start: number;
|
|
70
|
+
end: number;
|
|
71
|
+
description: undefined;
|
|
72
|
+
bitsw_score?: undefined;
|
|
73
|
+
percent_div?: undefined;
|
|
74
|
+
percent_del?: undefined;
|
|
75
|
+
percent_ins?: undefined;
|
|
76
|
+
query_chr?: undefined;
|
|
77
|
+
query_begin?: undefined;
|
|
78
|
+
query_end?: undefined;
|
|
79
|
+
query_remaining?: undefined;
|
|
80
|
+
orientation?: undefined;
|
|
81
|
+
matching_repeat_name?: undefined;
|
|
82
|
+
matching_repeat_class?: undefined;
|
|
83
|
+
matching_repeat_begin?: undefined;
|
|
84
|
+
matching_repeat_end?: undefined;
|
|
85
|
+
matching_repeat_remaining?: undefined;
|
|
86
|
+
repeat_id?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
uniqueId: string;
|
|
89
|
+
strand: number;
|
|
90
|
+
type: string;
|
|
91
|
+
refName: string;
|
|
92
|
+
subfeatures: import("./types").MinimalFeature[];
|
|
93
|
+
start: number;
|
|
94
|
+
end: number;
|
|
95
|
+
} | {
|
|
96
|
+
uniqueId: string;
|
|
97
|
+
score: number | undefined;
|
|
98
|
+
start: number;
|
|
99
|
+
end: number;
|
|
100
|
+
strand: any;
|
|
101
|
+
refName: string;
|
|
102
|
+
subfeatures: {
|
|
103
|
+
uniqueId: string;
|
|
104
|
+
start: number;
|
|
105
|
+
end: number;
|
|
106
|
+
refName: string;
|
|
107
|
+
type: string;
|
|
108
|
+
}[] | undefined;
|
|
109
|
+
};
|
|
110
|
+
export declare function featureData2({ splitLine, refName, start, end, parser, uniqueId, scoreColumn, names, }: {
|
|
111
|
+
splitLine: string[];
|
|
30
112
|
refName: string;
|
|
31
113
|
start: number;
|
|
32
114
|
end: number;
|
|
@@ -34,5 +116,88 @@ export declare function featureData2({ line, refName, start, end, parser, unique
|
|
|
34
116
|
uniqueId: string;
|
|
35
117
|
scoreColumn: string;
|
|
36
118
|
names?: string[];
|
|
37
|
-
}):
|
|
119
|
+
}): {
|
|
120
|
+
uniqueId: string;
|
|
121
|
+
refName: string;
|
|
122
|
+
start: number;
|
|
123
|
+
end: number;
|
|
124
|
+
code: string | undefined;
|
|
125
|
+
score: number;
|
|
126
|
+
strand: string | undefined;
|
|
127
|
+
color: string | undefined;
|
|
128
|
+
source: string | undefined;
|
|
129
|
+
n_valid_cov: string | undefined;
|
|
130
|
+
fraction_modified: string | undefined;
|
|
131
|
+
n_mod: string | undefined;
|
|
132
|
+
n_canonical: string | undefined;
|
|
133
|
+
n_other_mod: string | undefined;
|
|
134
|
+
n_delete: string | undefined;
|
|
135
|
+
n_fail: string | undefined;
|
|
136
|
+
n_diff: string | undefined;
|
|
137
|
+
n_nocall: string | undefined;
|
|
138
|
+
} | {
|
|
139
|
+
uniqueId: string;
|
|
140
|
+
refName: string;
|
|
141
|
+
start: number;
|
|
142
|
+
end: number;
|
|
143
|
+
bitsw_score: string | undefined;
|
|
144
|
+
percent_div: string | undefined;
|
|
145
|
+
percent_del: string | undefined;
|
|
146
|
+
percent_ins: string | undefined;
|
|
147
|
+
query_chr: string | undefined;
|
|
148
|
+
query_begin: string | undefined;
|
|
149
|
+
query_end: string | undefined;
|
|
150
|
+
query_remaining: string | undefined;
|
|
151
|
+
orientation: string | undefined;
|
|
152
|
+
matching_repeat_name: string | undefined;
|
|
153
|
+
matching_repeat_class: string | undefined;
|
|
154
|
+
matching_repeat_begin: string | undefined;
|
|
155
|
+
matching_repeat_end: string | undefined;
|
|
156
|
+
matching_repeat_remaining: string | undefined;
|
|
157
|
+
repeat_id: string | undefined;
|
|
158
|
+
description?: undefined;
|
|
159
|
+
} | {
|
|
160
|
+
uniqueId: string;
|
|
161
|
+
refName: string;
|
|
162
|
+
start: number;
|
|
163
|
+
end: number;
|
|
164
|
+
description: undefined;
|
|
165
|
+
bitsw_score?: undefined;
|
|
166
|
+
percent_div?: undefined;
|
|
167
|
+
percent_del?: undefined;
|
|
168
|
+
percent_ins?: undefined;
|
|
169
|
+
query_chr?: undefined;
|
|
170
|
+
query_begin?: undefined;
|
|
171
|
+
query_end?: undefined;
|
|
172
|
+
query_remaining?: undefined;
|
|
173
|
+
orientation?: undefined;
|
|
174
|
+
matching_repeat_name?: undefined;
|
|
175
|
+
matching_repeat_class?: undefined;
|
|
176
|
+
matching_repeat_begin?: undefined;
|
|
177
|
+
matching_repeat_end?: undefined;
|
|
178
|
+
matching_repeat_remaining?: undefined;
|
|
179
|
+
repeat_id?: undefined;
|
|
180
|
+
} | {
|
|
181
|
+
uniqueId: string;
|
|
182
|
+
strand: number;
|
|
183
|
+
type: string;
|
|
184
|
+
refName: string;
|
|
185
|
+
subfeatures: import("./types").MinimalFeature[];
|
|
186
|
+
start: number;
|
|
187
|
+
end: number;
|
|
188
|
+
} | {
|
|
189
|
+
uniqueId: string;
|
|
190
|
+
score: number | undefined;
|
|
191
|
+
start: number;
|
|
192
|
+
end: number;
|
|
193
|
+
strand: any;
|
|
194
|
+
refName: string;
|
|
195
|
+
subfeatures: {
|
|
196
|
+
uniqueId: string;
|
|
197
|
+
start: number;
|
|
198
|
+
end: number;
|
|
199
|
+
refName: string;
|
|
200
|
+
type: string;
|
|
201
|
+
}[] | undefined;
|
|
202
|
+
};
|
|
38
203
|
export declare function arrayify(f?: string | number[]): number[] | undefined;
|
package/dist/util.js
CHANGED
|
@@ -5,61 +5,60 @@ exports.featureData = featureData;
|
|
|
5
5
|
exports.featureData2 = featureData2;
|
|
6
6
|
exports.arrayify = arrayify;
|
|
7
7
|
const generateBedMethylFeature_1 = require("./generateBedMethylFeature");
|
|
8
|
-
const generateUcscTranscript_1 = require("./generateUcscTranscript");
|
|
9
8
|
const generateRepeatMaskerFeature_1 = require("./generateRepeatMaskerFeature");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const generateUcscTranscript_1 = require("./generateUcscTranscript");
|
|
10
|
+
function defaultParser(fields, splitLine) {
|
|
11
|
+
let hasBlockCount = false;
|
|
12
|
+
const r = [];
|
|
13
|
+
for (let i = 0; i < splitLine.length; i++) {
|
|
14
|
+
if (fields[i] === 'blockCount') {
|
|
15
|
+
hasBlockCount = true;
|
|
16
|
+
}
|
|
17
|
+
r.push([fields[i], splitLine[i]]);
|
|
13
18
|
}
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const obj = Object.fromEntries(r);
|
|
20
|
+
if (hasBlockCount) {
|
|
21
|
+
const { blockStarts, blockCount, chromStarts, thickEnd, thickStart, blockSizes, ...rest } = obj;
|
|
22
|
+
return {
|
|
23
|
+
...rest,
|
|
24
|
+
blockStarts: arrayify(blockStarts),
|
|
25
|
+
chromStarts: arrayify(chromStarts),
|
|
26
|
+
blockSizes: arrayify(blockSizes),
|
|
27
|
+
thickStart: thickStart ? +thickStart : undefined,
|
|
28
|
+
thickEnd: thickEnd ? +thickEnd : undefined,
|
|
29
|
+
blockCount: blockCount ? +blockCount : undefined,
|
|
30
|
+
};
|
|
16
31
|
}
|
|
17
32
|
else {
|
|
18
|
-
return
|
|
33
|
+
return obj;
|
|
19
34
|
}
|
|
20
35
|
}
|
|
21
|
-
function defaultParser(fields, line) {
|
|
22
|
-
const obj = Object.fromEntries(line.split('\t').map((f, i) => [fields[i], f]));
|
|
23
|
-
const { blockStarts, blockCount, chromStarts, thickEnd, thickStart, blockSizes, ...rest } = obj;
|
|
24
|
-
return {
|
|
25
|
-
...rest,
|
|
26
|
-
blockStarts: arrayify(blockStarts),
|
|
27
|
-
chromStarts: arrayify(chromStarts),
|
|
28
|
-
blockSizes: arrayify(blockSizes),
|
|
29
|
-
thickStart: thickStart ? +thickStart : undefined,
|
|
30
|
-
thickEnd: thickEnd ? +thickEnd : undefined,
|
|
31
|
-
blockCount: blockCount ? +blockCount : undefined,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
36
|
function makeBlocks({ start, uniqueId, refName, chromStarts, blockCount, blockSizes, blockStarts, }) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
37
|
+
const subfeatures = [];
|
|
38
|
+
const starts = chromStarts || blockStarts || [];
|
|
39
|
+
for (let b = 0; b < blockCount; b++) {
|
|
40
|
+
const bmin = (starts[b] || 0) + start;
|
|
41
|
+
const bsize = blockSizes === null || blockSizes === void 0 ? void 0 : blockSizes[b];
|
|
42
|
+
if (bsize && bsize > 0) {
|
|
43
|
+
const bmax = bmin + bsize;
|
|
44
|
+
subfeatures.push({
|
|
45
|
+
uniqueId: `${uniqueId}-${b}`,
|
|
46
|
+
start: bmin,
|
|
47
|
+
end: bmax,
|
|
48
|
+
refName,
|
|
49
|
+
type: 'block',
|
|
50
|
+
});
|
|
51
51
|
}
|
|
52
|
-
return subfeatures;
|
|
53
52
|
}
|
|
54
|
-
return
|
|
53
|
+
return subfeatures;
|
|
55
54
|
}
|
|
56
55
|
function featureData({ line, colRef, colStart, colEnd, scoreColumn, parser, uniqueId, names, }) {
|
|
57
56
|
const splitLine = line.split('\t');
|
|
58
57
|
const refName = splitLine[colRef];
|
|
59
|
-
const start =
|
|
60
|
-
const end =
|
|
58
|
+
const start = Number.parseInt(splitLine[colStart], 10);
|
|
59
|
+
const end = Number.parseInt(splitLine[colEnd], 10) + (colStart === colEnd ? 1 : 0);
|
|
61
60
|
return featureData2({
|
|
62
|
-
|
|
61
|
+
splitLine,
|
|
63
62
|
refName,
|
|
64
63
|
start,
|
|
65
64
|
end,
|
|
@@ -69,34 +68,35 @@ function featureData({ line, colRef, colStart, colEnd, scoreColumn, parser, uniq
|
|
|
69
68
|
names,
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
|
-
function featureData2({
|
|
73
|
-
const splitLine = line.split('\t');
|
|
71
|
+
function featureData2({ splitLine, refName, start, end, parser, uniqueId, scoreColumn, names, }) {
|
|
74
72
|
const data = names
|
|
75
|
-
? defaultParser(names,
|
|
76
|
-
: parser.parseLine(
|
|
73
|
+
? defaultParser(names, splitLine)
|
|
74
|
+
: parser.parseLine(splitLine, { uniqueId });
|
|
77
75
|
const { strand: strand2, score: score2, chrom: _1, chromStart: _2, chromEnd: _3, ...rest } = data;
|
|
78
|
-
const { chromStarts, blockSizes, blockStarts, type, blockCount, thickStart, thickEnd, description, ...rest2 } = rest;
|
|
79
76
|
const score = scoreColumn ? +data[scoreColumn] : score2 ? +score2 : undefined;
|
|
80
|
-
const strand = typeof strand2 === 'string' ?
|
|
81
|
-
const subfeatures =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
const strand = typeof strand2 === 'string' ? (strand2 === '-' ? -1 : 1) : strand2;
|
|
78
|
+
const subfeatures = rest.blockCount
|
|
79
|
+
? makeBlocks({
|
|
80
|
+
start,
|
|
81
|
+
uniqueId,
|
|
82
|
+
refName,
|
|
83
|
+
chromStarts: rest.chromStarts,
|
|
84
|
+
blockCount: rest.blockCount,
|
|
85
|
+
blockSizes: rest.blockSizes,
|
|
86
|
+
blockStarts: rest.blockStarts,
|
|
87
|
+
})
|
|
88
|
+
: undefined;
|
|
90
89
|
if ((0, generateBedMethylFeature_1.isBedMethylFeature)({ splitLine, start, end })) {
|
|
91
90
|
return (0, generateBedMethylFeature_1.generateBedMethylFeature)({
|
|
92
|
-
|
|
91
|
+
splitLine,
|
|
93
92
|
uniqueId,
|
|
94
93
|
refName,
|
|
95
94
|
start,
|
|
96
95
|
end,
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
|
-
else if ((0, generateRepeatMaskerFeature_1.isRepeatMaskerDescriptionField)(description)) {
|
|
98
|
+
else if ((0, generateRepeatMaskerFeature_1.isRepeatMaskerDescriptionField)(rest.description)) {
|
|
99
|
+
const { chromStarts, blockSizes, blockStarts, type, blockCount, thickStart, thickEnd, description, ...rest2 } = rest;
|
|
100
100
|
return (0, generateRepeatMaskerFeature_1.generateRepeatMaskerFeature)({
|
|
101
101
|
...rest2,
|
|
102
102
|
uniqueId,
|
|
@@ -110,7 +110,13 @@ function featureData2({ line, refName, start, end, parser, uniqueId, scoreColumn
|
|
|
110
110
|
subfeatures,
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
else if (
|
|
113
|
+
else if (subfeatures &&
|
|
114
|
+
(0, generateUcscTranscript_1.isUcscTranscript)({
|
|
115
|
+
strand,
|
|
116
|
+
blockCount: rest.blockCount,
|
|
117
|
+
thickStart: rest.thickStart,
|
|
118
|
+
})) {
|
|
119
|
+
const { chromStarts, blockSizes, type, blockCount, thickStart, thickEnd, description, } = rest;
|
|
114
120
|
return (0, generateUcscTranscript_1.generateUcscTranscript)({
|
|
115
121
|
...rest,
|
|
116
122
|
description,
|
|
@@ -133,8 +139,6 @@ function featureData2({ line, refName, start, end, parser, uniqueId, scoreColumn
|
|
|
133
139
|
return {
|
|
134
140
|
...rest,
|
|
135
141
|
uniqueId,
|
|
136
|
-
description,
|
|
137
|
-
type,
|
|
138
142
|
score,
|
|
139
143
|
start,
|
|
140
144
|
end,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import BED from '@gmod/bed';
|
|
2
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
-
import { Region, Feature } from '@jbrowse/core/util';
|
|
4
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import BED from '@gmod/bed';
|
|
3
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
|
+
import type { Feature, Region } from '@jbrowse/core/util';
|
|
5
6
|
export default class BedAdapter extends BaseFeatureDataAdapter {
|
|
6
7
|
protected bedFeatures?: Promise<{
|
|
7
8
|
header: string;
|
|
@@ -16,12 +17,21 @@ export default class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
16
17
|
protected intervalTrees: Record<string, Promise<IntervalTree | undefined> | undefined>;
|
|
17
18
|
static capabilities: string[];
|
|
18
19
|
private loadDataP;
|
|
19
|
-
|
|
20
|
+
loadData(opts?: BaseOptions): Promise<{
|
|
21
|
+
header: string;
|
|
22
|
+
features: Record<string, string[]>;
|
|
23
|
+
parser: BED;
|
|
24
|
+
columnNames: string[];
|
|
25
|
+
scoreColumn: string;
|
|
26
|
+
colRef: number;
|
|
27
|
+
colStart: number;
|
|
28
|
+
colEnd: number;
|
|
29
|
+
}>;
|
|
20
30
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
21
31
|
getHeader(opts?: BaseOptions): Promise<string>;
|
|
22
32
|
getNames(): Promise<string[] | undefined>;
|
|
23
33
|
private loadFeatureIntervalTreeHelper;
|
|
24
|
-
|
|
34
|
+
loadFeatureIntervalTree(refName: string): Promise<IntervalTree<any> | undefined>;
|
|
25
35
|
getFeatures(query: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
26
36
|
freeResources(): void;
|
|
27
37
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import IntervalTree from '@flatten-js/interval-tree';
|
|
1
2
|
import BED from '@gmod/bed';
|
|
2
|
-
import { BaseFeatureDataAdapter
|
|
3
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import { SimpleFeature, fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
3
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
4
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
5
|
-
import { fetchAndMaybeUnzip, SimpleFeature, } from '@jbrowse/core/util';
|
|
6
|
-
import IntervalTree from '@flatten-js/interval-tree';
|
|
7
|
-
// locals
|
|
8
7
|
import { featureData } from '../util';
|
|
9
8
|
class BedAdapter extends BaseFeatureDataAdapter {
|
|
10
9
|
constructor() {
|
|
@@ -15,7 +14,6 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
15
14
|
const pm = this.pluginManager;
|
|
16
15
|
const bedLoc = this.getConf('bedLocation');
|
|
17
16
|
const buffer = await fetchAndMaybeUnzip(openLocation(bedLoc, pm), opts);
|
|
18
|
-
// 512MB max chrome string length is 512MB
|
|
19
17
|
if (buffer.length > 536870888) {
|
|
20
18
|
throw new Error('Data exceeds maximum string length (512MB)');
|
|
21
19
|
}
|
|
@@ -94,9 +92,10 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
94
92
|
}
|
|
95
93
|
const names = await this.getNames();
|
|
96
94
|
const intervalTree = new IntervalTree();
|
|
97
|
-
|
|
95
|
+
for (let i = 0; i < lines.length; i++) {
|
|
96
|
+
const line = lines[i];
|
|
98
97
|
const uniqueId = `${this.id}-${refName}-${i}`;
|
|
99
|
-
|
|
98
|
+
const feat = new SimpleFeature(featureData({
|
|
100
99
|
line,
|
|
101
100
|
colRef,
|
|
102
101
|
colStart,
|
|
@@ -106,9 +105,7 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
106
105
|
uniqueId,
|
|
107
106
|
names,
|
|
108
107
|
}));
|
|
109
|
-
|
|
110
|
-
for (const obj of ret) {
|
|
111
|
-
intervalTree.insert([obj.get('start'), obj.get('end')], obj);
|
|
108
|
+
intervalTree.insert([feat.get('start'), feat.get('end')], feat);
|
|
112
109
|
}
|
|
113
110
|
return intervalTree;
|
|
114
111
|
}
|
|
@@ -129,7 +126,7 @@ class BedAdapter extends BaseFeatureDataAdapter {
|
|
|
129
126
|
observer.next(f);
|
|
130
127
|
});
|
|
131
128
|
observer.complete();
|
|
132
|
-
}, opts.
|
|
129
|
+
}, opts.stopToken);
|
|
133
130
|
}
|
|
134
131
|
freeResources() { }
|
|
135
132
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
/**
|
|
3
|
-
* #slot
|
|
4
|
-
*/
|
|
5
2
|
bedLocation: {
|
|
6
3
|
type: string;
|
|
7
4
|
defaultValue: {
|
|
@@ -9,49 +6,31 @@ declare const BedAdapter: import("@jbrowse/core/configuration/configurationSchem
|
|
|
9
6
|
locationType: string;
|
|
10
7
|
};
|
|
11
8
|
};
|
|
12
|
-
/**
|
|
13
|
-
* #slot
|
|
14
|
-
*/
|
|
15
9
|
columnNames: {
|
|
16
10
|
type: string;
|
|
17
11
|
description: string;
|
|
18
12
|
defaultValue: never[];
|
|
19
13
|
};
|
|
20
|
-
/**
|
|
21
|
-
* #slot
|
|
22
|
-
*/
|
|
23
14
|
scoreColumn: {
|
|
24
15
|
type: string;
|
|
25
16
|
description: string;
|
|
26
17
|
defaultValue: string;
|
|
27
18
|
};
|
|
28
|
-
/**
|
|
29
|
-
* #slot
|
|
30
|
-
*/
|
|
31
19
|
autoSql: {
|
|
32
20
|
type: string;
|
|
33
21
|
description: string;
|
|
34
22
|
defaultValue: string;
|
|
35
23
|
};
|
|
36
|
-
/**
|
|
37
|
-
* #slot
|
|
38
|
-
*/
|
|
39
24
|
colRef: {
|
|
40
25
|
type: string;
|
|
41
26
|
description: string;
|
|
42
27
|
defaultValue: number;
|
|
43
28
|
};
|
|
44
|
-
/**
|
|
45
|
-
* #slot
|
|
46
|
-
*/
|
|
47
29
|
colStart: {
|
|
48
30
|
type: string;
|
|
49
31
|
description: string;
|
|
50
32
|
defaultValue: number;
|
|
51
33
|
};
|
|
52
|
-
/**
|
|
53
|
-
* #slot
|
|
54
|
-
*/
|
|
55
34
|
colEnd: {
|
|
56
35
|
type: string;
|
|
57
36
|
description: string;
|
|
@@ -1,59 +1,35 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config BedAdapter
|
|
4
|
-
*/
|
|
5
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
6
3
|
const BedAdapter = ConfigurationSchema('BedAdapter', {
|
|
7
|
-
/**
|
|
8
|
-
* #slot
|
|
9
|
-
*/
|
|
10
4
|
bedLocation: {
|
|
11
5
|
type: 'fileLocation',
|
|
12
6
|
defaultValue: { uri: '/path/to/my.bed.gz', locationType: 'UriLocation' },
|
|
13
7
|
},
|
|
14
|
-
/**
|
|
15
|
-
* #slot
|
|
16
|
-
*/
|
|
17
8
|
columnNames: {
|
|
18
9
|
type: 'stringArray',
|
|
19
10
|
description: 'List of column names',
|
|
20
11
|
defaultValue: [],
|
|
21
12
|
},
|
|
22
|
-
/**
|
|
23
|
-
* #slot
|
|
24
|
-
*/
|
|
25
13
|
scoreColumn: {
|
|
26
14
|
type: 'string',
|
|
27
15
|
description: 'The column to use as a "score" attribute',
|
|
28
16
|
defaultValue: '',
|
|
29
17
|
},
|
|
30
|
-
/**
|
|
31
|
-
* #slot
|
|
32
|
-
*/
|
|
33
18
|
autoSql: {
|
|
34
19
|
type: 'string',
|
|
35
20
|
description: 'The autoSql definition for the data fields in the file',
|
|
36
21
|
defaultValue: '',
|
|
37
22
|
},
|
|
38
|
-
/**
|
|
39
|
-
* #slot
|
|
40
|
-
*/
|
|
41
23
|
colRef: {
|
|
42
24
|
type: 'number',
|
|
43
25
|
description: 'The column to use as a "refName" attribute',
|
|
44
26
|
defaultValue: 0,
|
|
45
27
|
},
|
|
46
|
-
/**
|
|
47
|
-
* #slot
|
|
48
|
-
*/
|
|
49
28
|
colStart: {
|
|
50
29
|
type: 'number',
|
|
51
30
|
description: 'The column to use as a "start" attribute',
|
|
52
31
|
defaultValue: 1,
|
|
53
32
|
},
|
|
54
|
-
/**
|
|
55
|
-
* #slot
|
|
56
|
-
*/
|
|
57
33
|
colEnd: {
|
|
58
34
|
type: 'number',
|
|
59
35
|
description: 'The column to use as a "end" attribute',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BedAdapterF(pluginManager: PluginManager): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { Feature, Region } from '@jbrowse/core/util';
|
|
5
|
+
export default class BedGraphAdapter extends BaseFeatureDataAdapter {
|
|
6
|
+
protected bedFeatures?: Promise<{
|
|
7
|
+
header: string;
|
|
8
|
+
features: Record<string, string[]>;
|
|
9
|
+
columnNames: string[];
|
|
10
|
+
}>;
|
|
11
|
+
protected intervalTrees: Record<string, Promise<IntervalTree | undefined> | undefined>;
|
|
12
|
+
getNames(): Promise<string[] | undefined>;
|
|
13
|
+
private loadFeatureIntervalTreeHelper;
|
|
14
|
+
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
15
|
+
private loadDataP;
|
|
16
|
+
loadFeatureIntervalTree(refName: string): Promise<IntervalTree<any> | undefined>;
|
|
17
|
+
loadData(opts?: BaseOptions): Promise<{
|
|
18
|
+
header: string;
|
|
19
|
+
features: Record<string, string[]>;
|
|
20
|
+
columnNames: string[];
|
|
21
|
+
}>;
|
|
22
|
+
getFeatures(query: Region, _opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
23
|
+
freeResources(): void;
|
|
24
|
+
}
|