@jbrowse/plugin-bed 4.3.0 → 5.0.0-beta.10
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.d.ts +5 -22
- package/esm/BedAdapter/BedAdapter.js +29 -93
- package/esm/BedAdapter/configSchema.d.ts +59 -32
- package/esm/BedAdapter/configSchema.js +64 -14
- package/esm/BedAdapter/index.js +4 -2
- package/esm/BedGraphAdapter/BedGraphAdapter.d.ts +5 -12
- package/esm/BedGraphAdapter/BedGraphAdapter.js +33 -89
- package/esm/BedGraphAdapter/configSchema.d.ts +35 -11
- package/esm/BedGraphAdapter/configSchema.js +43 -13
- package/esm/BedGraphAdapter/index.js +3 -2
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.d.ts +5 -5
- package/esm/BedGraphTabixAdapter/BedGraphTabixAdapter.js +65 -57
- package/esm/BedGraphTabixAdapter/configSchema.d.ts +46 -22
- package/esm/BedGraphTabixAdapter/configSchema.js +50 -34
- package/esm/BedGraphTabixAdapter/index.js +3 -2
- package/esm/BedTabixAdapter/BedTabixAdapter.d.ts +34 -38
- package/esm/BedTabixAdapter/BedTabixAdapter.js +82 -72
- package/esm/BedTabixAdapter/configSchema.d.ts +55 -31
- package/esm/BedTabixAdapter/configSchema.js +58 -35
- package/esm/BedTabixAdapter/index.js +4 -2
- package/esm/BedpeAdapter/BedpeAdapter.d.ts +6 -13
- package/esm/BedpeAdapter/BedpeAdapter.js +26 -74
- package/esm/BedpeAdapter/configSchema.d.ts +31 -12
- package/esm/BedpeAdapter/configSchema.js +37 -13
- package/esm/BedpeAdapter/index.js +4 -2
- package/esm/BedpeAdapter/util.js +25 -25
- package/esm/BigBedAdapter/BigBedAdapter.d.ts +8 -7
- package/esm/BigBedAdapter/BigBedAdapter.js +99 -107
- package/esm/BigBedAdapter/configSchema.d.ts +38 -16
- package/esm/BigBedAdapter/configSchema.js +46 -13
- package/esm/BigBedAdapter/index.js +3 -2
- package/esm/BigBedTextSearchAdapter/BigBedTextSearchAdapter.d.ts +27 -0
- package/esm/BigBedTextSearchAdapter/BigBedTextSearchAdapter.js +128 -0
- package/esm/BigBedTextSearchAdapter/configSchema.d.ts +51 -0
- package/esm/BigBedTextSearchAdapter/configSchema.js +57 -0
- package/esm/BigBedTextSearchAdapter/index.d.ts +2 -0
- package/esm/BigBedTextSearchAdapter/index.js +11 -0
- package/esm/StarFusionAdapter/StarFusionAdapter.d.ts +14 -0
- package/esm/StarFusionAdapter/StarFusionAdapter.js +66 -0
- package/esm/StarFusionAdapter/configSchema.d.ts +30 -0
- package/esm/StarFusionAdapter/configSchema.js +43 -0
- package/esm/StarFusionAdapter/index.d.ts +2 -0
- package/esm/StarFusionAdapter/index.js +12 -0
- package/esm/adapterUtil.d.ts +5 -0
- package/esm/adapterUtil.js +43 -0
- package/esm/bedGraphUtil.d.ts +11 -0
- package/esm/bedGraphUtil.js +20 -0
- package/esm/copyExcept.d.ts +1 -0
- package/esm/copyExcept.js +11 -0
- package/esm/generateBedMethylFeature.d.ts +1 -1
- package/esm/generateBedMethylFeature.js +24 -6
- package/esm/generateRastairMethylFeature.d.ts +28 -0
- package/esm/generateRastairMethylFeature.js +38 -0
- package/esm/generateRepeatMaskerFeature.d.ts +17 -51
- package/esm/generateRepeatMaskerFeature.js +27 -37
- package/esm/generateUcscTranscript.d.ts +15 -7
- package/esm/generateUcscTranscript.js +106 -29
- package/esm/index.d.ts +2 -0
- package/esm/index.js +12 -8
- package/esm/util.d.ts +32 -27
- package/esm/util.js +139 -98
- package/package.json +10 -13
- package/esm/GuessAdapter/index.d.ts +0 -2
- package/esm/GuessAdapter/index.js +0 -71
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { parseStrand } from './util.js';
|
|
2
|
+
// Rastair (https://www.rastair.com) emits a headered BED/TSV of per-CpG
|
|
3
|
+
// methylation calls from TAPS / mod-C→T data. Its layout differs from modkit
|
|
4
|
+
// bedMethyl, so it's identified by the header column names rather than
|
|
5
|
+
// positionally: #chr start end name beta_est strand unmod mod no_snp snp
|
|
6
|
+
// coverage genotype gt_p_score gt_conf_score
|
|
7
|
+
const RASTAIR_COLUMNS = ['beta_est', 'unmod', 'mod', 'coverage'];
|
|
8
|
+
export function isRastairMethylFeature(names) {
|
|
9
|
+
return RASTAIR_COLUMNS.every(col => names.includes(col));
|
|
10
|
+
}
|
|
11
|
+
export function generateRastairMethylFeature({ splitLine, names, uniqueId, refName, start, end, }) {
|
|
12
|
+
const col = (name) => splitLine[names.indexOf(name)];
|
|
13
|
+
// beta_est is a 0-1 fraction; the shared bedMethyl display path expects a
|
|
14
|
+
// 0-100 percentage (modkit fraction_modified), so scale to match
|
|
15
|
+
const fraction_modified = Number(col('beta_est')) * 100;
|
|
16
|
+
return {
|
|
17
|
+
uniqueId,
|
|
18
|
+
refName,
|
|
19
|
+
start,
|
|
20
|
+
end,
|
|
21
|
+
// rastair reports modified C (5mC); use modkit's 'm' code so it groups and
|
|
22
|
+
// colors as 5mC methylation in the shared bedMethyl display path
|
|
23
|
+
code: 'm',
|
|
24
|
+
source: 'm',
|
|
25
|
+
score: fraction_modified,
|
|
26
|
+
fraction_modified,
|
|
27
|
+
strand: parseStrand(col('strand')),
|
|
28
|
+
n_valid_cov: col('coverage'),
|
|
29
|
+
n_mod: col('mod'),
|
|
30
|
+
n_canonical: col('unmod'),
|
|
31
|
+
beta_est: col('beta_est'),
|
|
32
|
+
no_snp: col('no_snp'),
|
|
33
|
+
snp: col('snp'),
|
|
34
|
+
coverage: col('coverage'),
|
|
35
|
+
genotype: col('genotype'),
|
|
36
|
+
gt_conf_score: col('gt_conf_score'),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -1,51 +1,17 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
query_chr: string | undefined;
|
|
19
|
-
query_begin: string | undefined;
|
|
20
|
-
query_end: string | undefined;
|
|
21
|
-
query_remaining: string | undefined;
|
|
22
|
-
orientation: string | undefined;
|
|
23
|
-
matching_repeat_name: string | undefined;
|
|
24
|
-
matching_repeat_class: string | undefined;
|
|
25
|
-
matching_repeat_begin: string | undefined;
|
|
26
|
-
matching_repeat_end: string | undefined;
|
|
27
|
-
matching_repeat_remaining: string | undefined;
|
|
28
|
-
repeat_id: string | undefined;
|
|
29
|
-
description?: undefined;
|
|
30
|
-
} | {
|
|
31
|
-
uniqueId: string;
|
|
32
|
-
refName: string;
|
|
33
|
-
start: number;
|
|
34
|
-
end: number;
|
|
35
|
-
description: undefined;
|
|
36
|
-
bitsw_score?: undefined;
|
|
37
|
-
percent_div?: undefined;
|
|
38
|
-
percent_del?: undefined;
|
|
39
|
-
percent_ins?: undefined;
|
|
40
|
-
query_chr?: undefined;
|
|
41
|
-
query_begin?: undefined;
|
|
42
|
-
query_end?: undefined;
|
|
43
|
-
query_remaining?: undefined;
|
|
44
|
-
orientation?: undefined;
|
|
45
|
-
matching_repeat_name?: undefined;
|
|
46
|
-
matching_repeat_class?: undefined;
|
|
47
|
-
matching_repeat_begin?: undefined;
|
|
48
|
-
matching_repeat_end?: undefined;
|
|
49
|
-
matching_repeat_remaining?: undefined;
|
|
50
|
-
repeat_id?: undefined;
|
|
51
|
-
};
|
|
1
|
+
export declare function parseRepeatMaskerDescription(desc: unknown): {
|
|
2
|
+
bitsw_score: string;
|
|
3
|
+
percent_div: string;
|
|
4
|
+
percent_del: string;
|
|
5
|
+
percent_ins: string;
|
|
6
|
+
query_chr: string;
|
|
7
|
+
query_begin: string;
|
|
8
|
+
query_end: string;
|
|
9
|
+
query_remaining: string;
|
|
10
|
+
orientation: string;
|
|
11
|
+
matching_repeat_name: string;
|
|
12
|
+
matching_repeat_class: string;
|
|
13
|
+
matching_repeat_begin: string;
|
|
14
|
+
matching_repeat_end: string;
|
|
15
|
+
matching_repeat_remaining: string;
|
|
16
|
+
repeat_id: string;
|
|
17
|
+
} | undefined;
|
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
const NUMERIC_PARTS = [0, 1, 2, 3, 5, 6];
|
|
2
|
+
// RepeatMasker .out-derived description: 15 space-separated fields, numeric at
|
|
3
|
+
// positions 0,1,2,3,5,6. A literal rather than an object built from the field
|
|
4
|
+
// list, since this runs on every line of a RepeatMasker track.
|
|
5
|
+
export function parseRepeatMaskerDescription(desc) {
|
|
2
6
|
if (typeof desc !== 'string') {
|
|
3
|
-
return
|
|
7
|
+
return undefined;
|
|
4
8
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const p = desc.trim().split(' ');
|
|
10
|
+
for (const i of NUMERIC_PARTS) {
|
|
11
|
+
const v = p[i];
|
|
12
|
+
if (v === undefined || Number.isNaN(+v)) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
8
15
|
}
|
|
9
|
-
}
|
|
10
|
-
function makeRepeatTrackDescription(description) {
|
|
11
|
-
if (isRepeatMaskerDescriptionField(description)) {
|
|
12
|
-
const [bitsw_score, percent_div, percent_del, percent_ins, query_chr, query_begin, query_end, query_remaining, orientation, matching_repeat_name, matching_repeat_class, matching_repeat_begin, matching_repeat_end, matching_repeat_remaining, repeat_id,] = description.trim().split(' ');
|
|
13
|
-
return {
|
|
14
|
-
bitsw_score,
|
|
15
|
-
percent_div,
|
|
16
|
-
percent_del,
|
|
17
|
-
percent_ins,
|
|
18
|
-
query_chr,
|
|
19
|
-
query_begin,
|
|
20
|
-
query_end,
|
|
21
|
-
query_remaining,
|
|
22
|
-
orientation,
|
|
23
|
-
matching_repeat_name,
|
|
24
|
-
matching_repeat_class,
|
|
25
|
-
matching_repeat_begin,
|
|
26
|
-
matching_repeat_end,
|
|
27
|
-
matching_repeat_remaining,
|
|
28
|
-
repeat_id,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return { description };
|
|
32
|
-
}
|
|
33
|
-
export function generateRepeatMaskerFeature({ uniqueId, refName, start, end, description, ...rest }) {
|
|
34
|
-
const { subfeatures, ...rest2 } = rest;
|
|
35
16
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
bitsw_score: p[0] ?? '',
|
|
18
|
+
percent_div: p[1] ?? '',
|
|
19
|
+
percent_del: p[2] ?? '',
|
|
20
|
+
percent_ins: p[3] ?? '',
|
|
21
|
+
query_chr: p[4] ?? '',
|
|
22
|
+
query_begin: p[5] ?? '',
|
|
23
|
+
query_end: p[6] ?? '',
|
|
24
|
+
query_remaining: p[7] ?? '',
|
|
25
|
+
orientation: p[8] ?? '',
|
|
26
|
+
matching_repeat_name: p[9] ?? '',
|
|
27
|
+
matching_repeat_class: p[10] ?? '',
|
|
28
|
+
matching_repeat_begin: p[11] ?? '',
|
|
29
|
+
matching_repeat_end: p[12] ?? '',
|
|
30
|
+
matching_repeat_remaining: p[13] ?? '',
|
|
31
|
+
repeat_id: p[14] ?? '',
|
|
42
32
|
};
|
|
43
33
|
}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { MinimalFeature } from './types.ts';
|
|
2
|
-
|
|
3
|
-
thickStart?:
|
|
4
|
-
|
|
2
|
+
interface UcscTranscriptCheck {
|
|
3
|
+
thickStart?: number;
|
|
4
|
+
thickEnd?: number;
|
|
5
|
+
blockCount?: number;
|
|
5
6
|
strand?: number;
|
|
6
|
-
}
|
|
7
|
+
}
|
|
8
|
+
interface ValidUcscTranscriptCheck {
|
|
9
|
+
thickStart: number;
|
|
10
|
+
thickEnd: number;
|
|
11
|
+
blockCount: number;
|
|
12
|
+
strand: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function isUcscTranscript(input: UcscTranscriptCheck): input is ValidUcscTranscriptCheck;
|
|
7
15
|
interface UcscTranscriptInput {
|
|
8
16
|
uniqueId: string;
|
|
9
|
-
strand
|
|
17
|
+
strand: number;
|
|
10
18
|
thickStart: number;
|
|
11
19
|
thickEnd: number;
|
|
12
20
|
refName: string;
|
|
@@ -15,10 +23,10 @@ interface UcscTranscriptInput {
|
|
|
15
23
|
subfeatures: MinimalFeature[];
|
|
16
24
|
[key: string]: unknown;
|
|
17
25
|
}
|
|
18
|
-
interface UcscTranscriptOutput {
|
|
26
|
+
interface UcscTranscriptOutput extends MinimalFeature {
|
|
19
27
|
uniqueId: string;
|
|
20
28
|
strand: number;
|
|
21
|
-
type:
|
|
29
|
+
type: 'mRNA' | 'transcript';
|
|
22
30
|
refName: string;
|
|
23
31
|
start: number;
|
|
24
32
|
end: number;
|
|
@@ -1,35 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { copyExcept } from './copyExcept.js';
|
|
2
|
+
// type guard: narrows input fields to required when true
|
|
3
|
+
// strand===0 means unstranded — likely not a gene
|
|
4
|
+
//
|
|
5
|
+
// Blocks are what make a transcript, and UCSC's own format definition calls
|
|
6
|
+
// them exons. Thickness says whether the transcript CODES, which is a separate
|
|
7
|
+
// axis: an lncRNA, a spliced EST and any other 12-column feature with
|
|
8
|
+
// thickStart===thickEnd is a transcript by every structural measure, so it is
|
|
9
|
+
// not tested here. `generateUcscTranscript` reads the same equality to emit
|
|
10
|
+
// exons and no CDS.
|
|
11
|
+
//
|
|
12
|
+
// This does conflate a spliced alignment with a transcript, deliberately: a
|
|
13
|
+
// bigPsl track (`est`, `intronEst`, `mrna`, `xenoMrna`, IsoSeq) has an empty
|
|
14
|
+
// thick range too, so it promotes where the same alignment as GFF3
|
|
15
|
+
// `cDNA_match` does not. BED12 carries no column that separates one from an
|
|
16
|
+
// lncRNA, and the promotion stays honest without one — no CDS children, so the
|
|
17
|
+
// sequence panel withholds CDS and protein and HGVS stays `n.`, and the type
|
|
18
|
+
// is `transcript` rather than `mRNA`.
|
|
19
|
+
export function isUcscTranscript(input) {
|
|
20
|
+
return (input.thickStart !== undefined &&
|
|
21
|
+
input.thickEnd !== undefined &&
|
|
22
|
+
input.blockCount !== undefined &&
|
|
23
|
+
input.blockCount > 0 &&
|
|
24
|
+
input.strand !== undefined &&
|
|
25
|
+
input.strand !== 0);
|
|
5
26
|
}
|
|
27
|
+
// phase = (3 - cumulative_cds_width % 3) % 3, computed in transcriptional order
|
|
6
28
|
function calculatePhasesFromCds(cdsRegions, strand) {
|
|
7
29
|
const sorted = [...cdsRegions].sort((a, b) => strand > 0 ? a.start - b.start : b.start - a.start);
|
|
8
30
|
const phaseMap = new Map();
|
|
9
31
|
let cumulativeWidth = 0;
|
|
10
32
|
for (const cds of sorted) {
|
|
11
|
-
|
|
12
|
-
phaseMap.set(cds.start, phase);
|
|
33
|
+
phaseMap.set(cds.start, (3 - (cumulativeWidth % 3)) % 3);
|
|
13
34
|
cumulativeWidth += cds.end - cds.start;
|
|
14
35
|
}
|
|
15
36
|
return phaseMap;
|
|
16
37
|
}
|
|
38
|
+
// convert UCSC exonFrames (0,1,2) to GFF phase: frame 0→0, frame 1→2, frame 2→1
|
|
39
|
+
// UCSC frame = bases from start of codon; GFF phase = bases to skip to reach next codon
|
|
40
|
+
// https://genome.ucsc.edu/FAQ/FAQformat.html#format1 (bigGenePred exonFrames)
|
|
41
|
+
// https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md (phase)
|
|
17
42
|
function frameToPhase(frame) {
|
|
18
43
|
return (3 - frame) % 3;
|
|
19
44
|
}
|
|
45
|
+
function parseFrames(frames) {
|
|
46
|
+
return typeof frames === 'string'
|
|
47
|
+
? frames.replace(/,$/, '').split(',').map(Number)
|
|
48
|
+
: frames;
|
|
49
|
+
}
|
|
50
|
+
const TRANSCRIPT_OWN = new Set([
|
|
51
|
+
'strand',
|
|
52
|
+
'uniqueId',
|
|
53
|
+
'start',
|
|
54
|
+
'end',
|
|
55
|
+
'thickStart',
|
|
56
|
+
'thickEnd',
|
|
57
|
+
'refName',
|
|
58
|
+
'subfeatures',
|
|
59
|
+
'chrom',
|
|
60
|
+
'chromStart',
|
|
61
|
+
'chromEnd',
|
|
62
|
+
'chromStarts',
|
|
63
|
+
'blockStarts',
|
|
64
|
+
'blockSizes',
|
|
65
|
+
'blockCount',
|
|
66
|
+
]);
|
|
20
67
|
export function generateUcscTranscript(data) {
|
|
21
|
-
const { strand
|
|
22
|
-
const
|
|
23
|
-
|
|
68
|
+
const { strand, uniqueId, start, end, thickStart, thickEnd, refName, subfeatures: oldSubfeatures, } = data;
|
|
69
|
+
const rest = copyExcept(data, TRANSCRIPT_OWN);
|
|
70
|
+
// exonFrames from bigGenePred - the @gmod/bed parser returns it in genomic order.
|
|
71
|
+
// _exonFrames fallback supports BED files that use the underscore-prefixed column
|
|
72
|
+
// name, which the parser leaves as raw text because it is not a standard column.
|
|
73
|
+
const exonFrames = parseFrames(rest.exonFrames ?? rest._exonFrames);
|
|
24
74
|
const feats = oldSubfeatures
|
|
25
75
|
.filter(child => child.type === 'block')
|
|
26
76
|
.sort((a, b) => a.start - b.start);
|
|
27
77
|
const fiveUTR = strand > 0 ? 'five_prime_UTR' : 'three_prime_UTR';
|
|
28
78
|
const threeUTR = strand > 0 ? 'three_prime_UTR' : 'five_prime_UTR';
|
|
29
|
-
|
|
30
|
-
|
|
79
|
+
// thickStart===thickEnd is UCSC for no coding region, and the block walk
|
|
80
|
+
// below cannot express that: a thick point inside a block would emit a
|
|
81
|
+
// zero-length CDS carrying a phase, and one outside every block would make
|
|
82
|
+
// the whole transcript UTR.
|
|
83
|
+
//
|
|
84
|
+
// cdsStartStat and cdsEndStat `none` alone do not mean non-coding: UCSC's
|
|
85
|
+
// GENCODE bigGenePred (gencodeV44.bb through V50) writes `none` on every
|
|
86
|
+
// transcript, and reading it as non-coding stripped the CDS from all 370,886
|
|
87
|
+
// of V50's coding ones, TP53 included. exonFrames tells them apart there:
|
|
88
|
+
// every coding transcript has a block with a frame, every other one has -1
|
|
89
|
+
// throughout.
|
|
90
|
+
const { cdsEndStat, cdsStartStat } = rest;
|
|
91
|
+
if (thickStart === thickEnd ||
|
|
92
|
+
(cdsStartStat === 'none' &&
|
|
93
|
+
cdsEndStat === 'none' &&
|
|
94
|
+
!exonFrames?.some(frame => frame >= 0))) {
|
|
31
95
|
return {
|
|
32
|
-
...
|
|
96
|
+
...rest,
|
|
33
97
|
uniqueId,
|
|
34
98
|
strand,
|
|
35
99
|
type: 'transcript',
|
|
@@ -39,15 +103,15 @@ export function generateUcscTranscript(data) {
|
|
|
39
103
|
subfeatures: feats.map(e => ({ ...e, type: 'exon' })),
|
|
40
104
|
};
|
|
41
105
|
}
|
|
106
|
+
// If exonFrames not available, calculate phases from CDS regions
|
|
42
107
|
let calculatedPhases;
|
|
43
108
|
if (!exonFrames) {
|
|
44
109
|
const cdsRegions = [];
|
|
45
110
|
for (const block of feats) {
|
|
46
|
-
|
|
47
|
-
if (thickStart < end && thickEnd > start) {
|
|
111
|
+
if (thickStart < block.end && thickEnd > block.start) {
|
|
48
112
|
cdsRegions.push({
|
|
49
|
-
start: Math.max(start, thickStart),
|
|
50
|
-
end: Math.min(end, thickEnd),
|
|
113
|
+
start: Math.max(block.start, thickStart),
|
|
114
|
+
end: Math.min(block.end, thickEnd),
|
|
51
115
|
});
|
|
52
116
|
}
|
|
53
117
|
}
|
|
@@ -55,20 +119,28 @@ export function generateUcscTranscript(data) {
|
|
|
55
119
|
}
|
|
56
120
|
const subfeatures = [];
|
|
57
121
|
for (const [i, feat] of feats.entries()) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
subfeatures.push({ type: fiveUTR, start, end, refName });
|
|
122
|
+
const { start: bStart, end: bEnd } = feat;
|
|
123
|
+
if (thickStart >= bEnd) {
|
|
124
|
+
// entire block is 5' UTR
|
|
125
|
+
subfeatures.push({ type: fiveUTR, start: bStart, end: bEnd, refName });
|
|
62
126
|
}
|
|
63
|
-
else if (thickEnd <=
|
|
64
|
-
|
|
127
|
+
else if (thickEnd <= bStart) {
|
|
128
|
+
// entire block is 3' UTR
|
|
129
|
+
subfeatures.push({ type: threeUTR, start: bStart, end: bEnd, refName });
|
|
65
130
|
}
|
|
66
131
|
else {
|
|
67
|
-
|
|
68
|
-
|
|
132
|
+
// block overlaps CDS region - may have UTR on either side
|
|
133
|
+
if (bStart < thickStart) {
|
|
134
|
+
subfeatures.push({
|
|
135
|
+
type: fiveUTR,
|
|
136
|
+
start: bStart,
|
|
137
|
+
end: thickStart,
|
|
138
|
+
refName,
|
|
139
|
+
});
|
|
69
140
|
}
|
|
70
|
-
const cdsStart = Math.max(
|
|
71
|
-
const cdsEnd = Math.min(
|
|
141
|
+
const cdsStart = Math.max(bStart, thickStart);
|
|
142
|
+
const cdsEnd = Math.min(bEnd, thickEnd);
|
|
143
|
+
// Get phase from exonFrames (with conversion) or calculated phases
|
|
72
144
|
let phase = 0;
|
|
73
145
|
if (exonFrames) {
|
|
74
146
|
const frame = exonFrames[i];
|
|
@@ -86,13 +158,18 @@ export function generateUcscTranscript(data) {
|
|
|
86
158
|
end: cdsEnd,
|
|
87
159
|
refName,
|
|
88
160
|
});
|
|
89
|
-
if (
|
|
90
|
-
subfeatures.push({
|
|
161
|
+
if (bEnd > thickEnd) {
|
|
162
|
+
subfeatures.push({
|
|
163
|
+
type: threeUTR,
|
|
164
|
+
start: thickEnd,
|
|
165
|
+
end: bEnd,
|
|
166
|
+
refName,
|
|
167
|
+
});
|
|
91
168
|
}
|
|
92
169
|
}
|
|
93
170
|
}
|
|
94
171
|
return {
|
|
95
|
-
...
|
|
172
|
+
...rest,
|
|
96
173
|
uniqueId,
|
|
97
174
|
strand,
|
|
98
175
|
type: 'mRNA',
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
2
|
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
+
export { default as BedTabixAdapter } from './BedTabixAdapter/BedTabixAdapter.ts';
|
|
4
|
+
export { default as bedTabixConfigSchema } from './BedTabixAdapter/configSchema.ts';
|
|
3
5
|
export default class BedPlugin extends Plugin {
|
|
4
6
|
name: string;
|
|
5
7
|
install(pluginManager: PluginManager): void;
|
package/esm/index.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import BedAdapterF from
|
|
3
|
-
import BedGraphAdapterF from
|
|
4
|
-
import BedGraphTabixAdapterF from
|
|
5
|
-
import BedTabixAdapterF from
|
|
6
|
-
import BedpeAdapterF from
|
|
7
|
-
import BigBedAdapterF from
|
|
8
|
-
import
|
|
2
|
+
import BedAdapterF from './BedAdapter/index.js';
|
|
3
|
+
import BedGraphAdapterF from './BedGraphAdapter/index.js';
|
|
4
|
+
import BedGraphTabixAdapterF from './BedGraphTabixAdapter/index.js';
|
|
5
|
+
import BedTabixAdapterF from './BedTabixAdapter/index.js';
|
|
6
|
+
import BedpeAdapterF from './BedpeAdapter/index.js';
|
|
7
|
+
import BigBedAdapterF from './BigBedAdapter/index.js';
|
|
8
|
+
import BigBedTextSearchAdapterF from './BigBedTextSearchAdapter/index.js';
|
|
9
|
+
import StarFusionAdapterF from './StarFusionAdapter/index.js';
|
|
10
|
+
export { default as BedTabixAdapter } from './BedTabixAdapter/BedTabixAdapter.js';
|
|
11
|
+
export { default as bedTabixConfigSchema } from './BedTabixAdapter/configSchema.js';
|
|
9
12
|
export default class BedPlugin extends Plugin {
|
|
10
13
|
name = 'BedPlugin';
|
|
11
14
|
install(pluginManager) {
|
|
12
15
|
BigBedAdapterF(pluginManager);
|
|
16
|
+
BigBedTextSearchAdapterF(pluginManager);
|
|
13
17
|
BedAdapterF(pluginManager);
|
|
14
18
|
BedpeAdapterF(pluginManager);
|
|
19
|
+
StarFusionAdapterF(pluginManager);
|
|
15
20
|
BedTabixAdapterF(pluginManager);
|
|
16
21
|
BedGraphAdapterF(pluginManager);
|
|
17
22
|
BedGraphTabixAdapterF(pluginManager);
|
|
18
|
-
GuessAdapterF(pluginManager);
|
|
19
23
|
}
|
|
20
24
|
}
|
package/esm/util.d.ts
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import BED from '@gmod/bed';
|
|
1
2
|
import type { MinimalFeature } from './types.ts';
|
|
2
|
-
import type
|
|
3
|
+
import type { StatusCallback } from '@jbrowse/core/util';
|
|
4
|
+
export interface FeatureData {
|
|
5
|
+
uniqueId: string;
|
|
6
|
+
refName: string;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
strand?: number;
|
|
10
|
+
score?: number;
|
|
11
|
+
type?: string;
|
|
12
|
+
subfeatures?: MinimalFeature[];
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare function bucketBedLines(buffer: Uint8Array, statusCallback?: StatusCallback): {
|
|
16
|
+
header: string;
|
|
17
|
+
features: Record<string, string[]>;
|
|
18
|
+
};
|
|
3
19
|
export declare function makeBlocks({ start, uniqueId, refName, chromStarts, blockCount, blockSizes, blockStarts, }: {
|
|
4
20
|
blockCount: number;
|
|
5
21
|
start: number;
|
|
@@ -8,36 +24,27 @@ export declare function makeBlocks({ start, uniqueId, refName, chromStarts, bloc
|
|
|
8
24
|
chromStarts?: number[];
|
|
9
25
|
blockSizes?: number[];
|
|
10
26
|
blockStarts?: number[];
|
|
11
|
-
}):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
27
|
+
}): MinimalFeature[];
|
|
28
|
+
export declare function parseNamesFromHeader(header: string): string[] | undefined;
|
|
29
|
+
export declare function resolveColumnNames(columnNames: string[], getHeader: () => Promise<string>): Promise<string[] | undefined>;
|
|
30
|
+
export declare function makeParser({ autoSql, columnNames, }: {
|
|
31
|
+
autoSql?: string;
|
|
32
|
+
columnNames?: string[];
|
|
33
|
+
}): BED;
|
|
34
|
+
export declare function bedFeatureLocus({ splitLine, colRef, colStart, colEnd, oneBased, hasEndColumn, }: {
|
|
35
|
+
splitLine: string[];
|
|
20
36
|
colRef: number;
|
|
21
37
|
colStart: number;
|
|
22
38
|
colEnd: number;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
names?: string[];
|
|
27
|
-
disableGeneHeuristic?: boolean;
|
|
28
|
-
}): FeatureData;
|
|
29
|
-
interface FeatureData {
|
|
30
|
-
uniqueId: string;
|
|
39
|
+
oneBased?: boolean;
|
|
40
|
+
hasEndColumn?: boolean;
|
|
41
|
+
}): {
|
|
31
42
|
refName: string;
|
|
32
43
|
start: number;
|
|
33
44
|
end: number;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
subfeatures?: MinimalFeature[];
|
|
38
|
-
[key: string]: unknown;
|
|
39
|
-
}
|
|
40
|
-
export declare function featureData2({ splitLine, refName, start, end, parser, uniqueId, scoreColumn, names, disableGeneHeuristic, }: {
|
|
45
|
+
};
|
|
46
|
+
export declare function parseStrand(strand: string | number | undefined): number;
|
|
47
|
+
export declare function featureData({ splitLine, refName, start, end, parser, uniqueId, scoreColumn, names, disableGeneHeuristic, }: {
|
|
41
48
|
splitLine: string[];
|
|
42
49
|
refName: string;
|
|
43
50
|
start: number;
|
|
@@ -48,5 +55,3 @@ export declare function featureData2({ splitLine, refName, start, end, parser, u
|
|
|
48
55
|
names?: string[];
|
|
49
56
|
disableGeneHeuristic?: boolean;
|
|
50
57
|
}): FeatureData;
|
|
51
|
-
export declare function arrayify(f?: string | number[]): number[] | undefined;
|
|
52
|
-
export {};
|