jbrowse-plugin-tview 2.2.0 → 2.2.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/README.md +72 -28
- package/dist/LaunchTView/align.d.ts +13 -8
- package/dist/LaunchTView/align.js +42 -14
- package/dist/LaunchTView/align.js.map +1 -1
- package/dist/LaunchTView/alleles.d.ts +66 -27
- package/dist/LaunchTView/alleles.js +169 -79
- package/dist/LaunchTView/alleles.js.map +1 -1
- package/dist/LaunchTView/repeatStats.d.ts +11 -3
- package/dist/LaunchTView/repeatStats.js +60 -11
- package/dist/LaunchTView/repeatStats.js.map +1 -1
- package/dist/LaunchTView/tview.js +11 -7
- package/dist/LaunchTView/tview.js.map +1 -1
- package/dist/jbrowse-plugin-tview.umd.production.min.js +24 -24
- package/dist/jbrowse-plugin-tview.umd.production.min.js.map +4 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +16 -15
- package/src/LaunchTView/align.ts +44 -15
- package/src/LaunchTView/alleles.ts +194 -86
- package/src/LaunchTView/repeatStats.ts +68 -13
- package/src/LaunchTView/tview.ts +11 -13
- package/src/version.ts +1 -1
|
@@ -35,98 +35,188 @@ export function extractAllele(read, start, end) {
|
|
|
35
35
|
}
|
|
36
36
|
return ret;
|
|
37
37
|
}
|
|
38
|
-
/** Reference positions an array owns, including the insertion slot at its right edge. */
|
|
39
|
-
export function arrayInsertionKeys(array) {
|
|
40
|
-
const ret = [];
|
|
41
|
-
for (let pos = array.start; pos <= array.end; pos++) {
|
|
42
|
-
ret.push(pos);
|
|
43
|
-
}
|
|
44
|
-
return ret;
|
|
45
|
-
}
|
|
46
38
|
/**
|
|
47
|
-
* How far outside an array an insertion
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
39
|
+
* How far outside an array an insertion is looked for, in reference bases.
|
|
40
|
+
*
|
|
41
|
+
* GIAB's adotto tandem repeat catalog buffers every interval by +/-25bp before
|
|
42
|
+
* merging, to leave room for the alignment ambiguity that comes with capturing
|
|
43
|
+
* variation inside a repeat, and measured what the buffer misses: re-expanding
|
|
44
|
+
* every region by a further 10bp would move only 0.2% of its boundaries
|
|
45
|
+
* (English et al., Nat Biotechnol 42, 2024, doi:10.1038/s41587-024-02225-z). A
|
|
46
|
+
* whole copy is the floor for a unit longer than that, since a copy is the
|
|
47
|
+
* aligner's room to slide a repeat indel. Both cover the misplacements measured
|
|
48
|
+
* in this trio: ATXN3 at 1bp, FMR1 at 2bp of a 3bp unit, ABCA7 at 19bp of a
|
|
53
49
|
* 25bp one.
|
|
50
|
+
*
|
|
51
|
+
* It bounds the search, not the answer. Whether an insertion actually moves is
|
|
52
|
+
* decided exactly, by `shiftInsertion`, so this being generous costs nothing.
|
|
54
53
|
*/
|
|
55
|
-
const
|
|
54
|
+
const FLANK_BP = 25;
|
|
55
|
+
/** the read's aligned base at a reference position, if it has one there */
|
|
56
|
+
function readBase(read, pos) {
|
|
57
|
+
const i = pos - read.start;
|
|
58
|
+
return i >= 0 && i < read.refChars.length ? read.refChars[i] : undefined;
|
|
59
|
+
}
|
|
56
60
|
/**
|
|
57
|
-
* How much of
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* boundary.
|
|
61
|
+
* How much of an insertion the array's unit has to explain before it counts as
|
|
62
|
+
* the array's. The repeat alleles the aligner anchored just outside an array in
|
|
63
|
+
* the trio score 0.9 and up, and unrelated sequence scores 0.67 or below, so
|
|
64
|
+
* this sits in open space rather than on a boundary.
|
|
62
65
|
*/
|
|
63
|
-
const
|
|
66
|
+
const BELONGS_IDENTITY = 0.8;
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
68
|
+
* `ins`, inserted before reference position `from`, rewritten as an insertion
|
|
69
|
+
* before `to` — or undefined when the read's own bases do not allow it.
|
|
67
70
|
*
|
|
68
|
-
* An
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* the array, and at ABCA7 a 1207bp allele 19 bases outside.
|
|
71
|
+
* An insertion has no unique position. `S` before a base `b` and `rotate(S)`
|
|
72
|
+
* after it spell the same read, so an aligner is free to anchor an expansion
|
|
73
|
+
* outside the array it belongs to, and at ATXN3 it did exactly that for most of
|
|
74
|
+
* the reads carrying one. Walking an indel through that equivalence class is
|
|
75
|
+
* the standard normalization for it (Tan, Abecasis & Kang, "Unified
|
|
76
|
+
* representation of genetic variants", Bioinformatics 31, 2015,
|
|
77
|
+
* doi:10.1093/bioinformatics/btv112, which walks left; this walks toward the
|
|
78
|
+
* array, the same operation with the array as the canonical anchor).
|
|
77
79
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* The step is tested against the **read's** aligned base rather than the
|
|
81
|
+
* reference's, which is what makes the rewrite exact: the row still renders
|
|
82
|
+
* base for base as it did, and the only thing that changes is the reference
|
|
83
|
+
* position the bases are filed under. A step onto a deletion has no base to
|
|
84
|
+
* swap with and stops.
|
|
85
|
+
*
|
|
86
|
+
* Being exact, it is also incomplete, and measurably so. An aligner does not
|
|
87
|
+
* only choose among equivalent placements — it chooses the highest-scoring one,
|
|
88
|
+
* which for a repeat allele carrying an interruption is often not equivalent to
|
|
89
|
+
* any placement inside the array. FMR1's misplaced read is exactly that: 32bp
|
|
90
|
+
* of the locus's own CGG anchored two bases early, starting on a `C` where the
|
|
91
|
+
* read has a `G`, so no rewrite of it exists. Hence `reanchorInsertions` treats
|
|
92
|
+
* this as the preferred spelling and not as the test of whether to move.
|
|
83
93
|
*/
|
|
84
|
-
export function
|
|
94
|
+
export function shiftInsertion(read, from, to, ins) {
|
|
95
|
+
let seq = ins;
|
|
96
|
+
for (let pos = from; pos < to; pos++) {
|
|
97
|
+
const head = seq[0];
|
|
98
|
+
if (readBase(read, pos) !== head) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
seq = seq.slice(1) + head;
|
|
102
|
+
}
|
|
103
|
+
for (let pos = from - 1; pos >= to; pos--) {
|
|
104
|
+
const tail = seq.at(-1);
|
|
105
|
+
if (readBase(read, pos) !== tail) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
seq = tail + seq.slice(0, -1);
|
|
109
|
+
}
|
|
110
|
+
return seq;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The window around each array that its insertions may be re-anchored from.
|
|
114
|
+
*
|
|
115
|
+
* Two arrays may not claim one position: `extractAllele` reads the slot at an
|
|
116
|
+
* array's `end`, so a shared slot would be counted into two alleles. Neighbours
|
|
117
|
+
* split the reference between them down the middle — a property of the
|
|
118
|
+
* reference alone, so unlike the interval it replaces, no read can move it.
|
|
119
|
+
*/
|
|
120
|
+
export function flankWindows(arrays) {
|
|
85
121
|
const ordered = [...arrays].sort((a, b) => a.start - b.start);
|
|
86
|
-
// the widened end of the array to the left, which the next one may not reach
|
|
87
|
-
let previousEnd = -Infinity;
|
|
88
122
|
return ordered.map((array, i) => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const floor = Math.max(array.start - margin, previousEnd + 1);
|
|
97
|
-
const ceiling = Math.min(array.end + margin, (ordered[i + 1]?.start ?? Infinity) - 1);
|
|
98
|
-
let { start, end } = array;
|
|
99
|
-
// memoized per distinct insert: one locus routinely has dozens of reads
|
|
100
|
-
// carrying the same allele at the same site
|
|
101
|
-
const belongs = new Map();
|
|
102
|
-
const isUnit = (ins) => {
|
|
103
|
-
let ret = belongs.get(ins);
|
|
104
|
-
if (ret === undefined) {
|
|
105
|
-
ret = unitIdentity(ins, array.unit) >= ABSORB_IDENTITY;
|
|
106
|
-
belongs.set(ins, ret);
|
|
107
|
-
}
|
|
108
|
-
return ret;
|
|
123
|
+
const pad = Math.max(FLANK_BP, array.period);
|
|
124
|
+
const previous = ordered[i - 1];
|
|
125
|
+
const next = ordered[i + 1];
|
|
126
|
+
return {
|
|
127
|
+
array,
|
|
128
|
+
from: Math.max(array.start - pad, previous ? Math.floor((previous.end + array.start) / 2) + 1 : -Infinity),
|
|
129
|
+
to: Math.min(array.end + pad, next ? Math.floor((array.end + next.start) / 2) : Infinity),
|
|
109
130
|
};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** the array whose window `pos` falls in, if any */
|
|
134
|
+
function windowAt(pos, windows) {
|
|
135
|
+
for (const window of windows) {
|
|
136
|
+
if (pos < window.from) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
if (pos <= window.to) {
|
|
140
|
+
return window;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Re-file each read's insertions under the array they belong to, one read at a
|
|
147
|
+
* time.
|
|
148
|
+
*
|
|
149
|
+
* Measuring an allele over a reference interval fixes the "one array reports as
|
|
150
|
+
* several sites" problem for indels the aligner placed *inside* the interval.
|
|
151
|
+
* It does not fix the ones placed just outside: there the insertion is part of
|
|
152
|
+
* no allele — it becomes its own run of insertion columns — and the read
|
|
153
|
+
* carrying it is measured as though it had the reference allele. Both halves of
|
|
154
|
+
* that are wrong, and neither is rare: at ATXN3 the aligner anchored 60 of 162
|
|
155
|
+
* reads' expansions one base outside the array.
|
|
156
|
+
*
|
|
157
|
+
* Doing this per read is the whole point. Widening the shared interval instead
|
|
158
|
+
* — which is what this replaces — made one read's misplacement everyone's: a
|
|
159
|
+
* single spurious copy anchored two bases early moved the array's left edge for
|
|
160
|
+
* every row, and the reference's own copy count with it. Re-anchoring touches
|
|
161
|
+
* only the read that carries the insertion, so a read can be wrong on its own.
|
|
162
|
+
*
|
|
163
|
+
* Nothing here consults the other reads, or how many of them agree. A single
|
|
164
|
+
* read's expansion is as real as fifty, which is what measuring over an
|
|
165
|
+
* interval buys and what a vote would give back. What decides an insertion is
|
|
166
|
+
* its own sequence: `unitIdentity` against the array's unit, since the aligner
|
|
167
|
+
* is free to place a repeat allele outside the array but is not free to make
|
|
168
|
+
* unrelated sequence out of the array's unit.
|
|
169
|
+
*/
|
|
170
|
+
export function reanchorInsertions(reads, arrays) {
|
|
171
|
+
const windows = flankWindows(arrays);
|
|
172
|
+
if (!windows.length) {
|
|
173
|
+
return reads;
|
|
174
|
+
}
|
|
175
|
+
// memoized per array and distinct insert: one locus routinely has dozens of
|
|
176
|
+
// reads carrying the same allele at the same site
|
|
177
|
+
const belongs = new Map();
|
|
178
|
+
const isUnit = (window, ins) => {
|
|
179
|
+
const key = `${window.array.start}:${ins}`;
|
|
180
|
+
let ret = belongs.get(key);
|
|
181
|
+
if (ret === undefined) {
|
|
182
|
+
ret =
|
|
183
|
+
// a whole copy at least: a base or two of read error beside an array
|
|
184
|
+
// says nothing about where its allele ends, and the identity of a
|
|
185
|
+
// fragment shorter than the unit is not a measurement of anything
|
|
186
|
+
ins.length >= window.array.period &&
|
|
187
|
+
unitIdentity(ins, window.array.unit) >= BELONGS_IDENTITY;
|
|
188
|
+
belongs.set(key, ret);
|
|
189
|
+
}
|
|
190
|
+
return ret;
|
|
191
|
+
};
|
|
192
|
+
return reads.map(read => {
|
|
193
|
+
if (!read.insertions.size) {
|
|
194
|
+
return read;
|
|
195
|
+
}
|
|
196
|
+
let moved = false;
|
|
197
|
+
const next = new Map();
|
|
198
|
+
// Insertions are re-filed in genomic order of where the aligner put them,
|
|
199
|
+
// so two events landing in one slot keep their order along the read.
|
|
200
|
+
for (const [pos, ins] of [...read.insertions].sort((a, b) => a[0] - b[0])) {
|
|
201
|
+
const window = windowAt(pos, windows);
|
|
202
|
+
const { start, end } = window?.array ?? {};
|
|
203
|
+
const target = window === undefined || (pos >= start && pos <= end)
|
|
204
|
+
? undefined
|
|
205
|
+
: isUnit(window, ins)
|
|
206
|
+
? pos < start
|
|
207
|
+
? start
|
|
208
|
+
: end
|
|
209
|
+
: undefined;
|
|
210
|
+
// an exact rewrite is preferred where one exists, so a row that can be
|
|
211
|
+
// re-spelled reads base for base as the aligner wrote it; where none
|
|
212
|
+
// exists the bases move as written, which preserves the length the
|
|
213
|
+
// measurement is made of
|
|
214
|
+
const at = target ?? pos;
|
|
215
|
+
moved ||= target !== undefined;
|
|
216
|
+
const seq = target === undefined ? ins : (shiftInsertion(read, pos, target, ins) ?? ins);
|
|
217
|
+
next.set(at, (next.get(at) ?? '') + seq);
|
|
127
218
|
}
|
|
128
|
-
|
|
129
|
-
return { ...array, start, end };
|
|
219
|
+
return moved ? { ...read, insertions: next } : read;
|
|
130
220
|
});
|
|
131
221
|
}
|
|
132
222
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alleles.js","sourceRoot":"","sources":["../../src/LaunchTView/alleles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAkCnD,MAAM,WAAW,GAAG,GAAG,CAAA;AACvB,MAAM,MAAM,GAAG,GAAG,CAAA;AAElB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB,EAAE,KAAa,EAAE,GAAW;IACxE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAA;IAC9C,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;QACrC,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,IAAI,GAA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
|
@@ -6,7 +6,15 @@ export interface Tally {
|
|
|
6
6
|
/** Each distinct value with how many rows carried it, smallest value first. */
|
|
7
7
|
export declare function tally(values: number[]): Tally[];
|
|
8
8
|
/**
|
|
9
|
-
* The copy counts a sample carries,
|
|
9
|
+
* The copy counts a sample carries, each with the reads that fell on it or in
|
|
10
|
+
* its skirt.
|
|
11
|
+
*
|
|
12
|
+
* Reads scatter around an allele — slippage in the molecule, slippage in the
|
|
13
|
+
* aligner — so a rule that reported only exact agreement credited an allele
|
|
14
|
+
* with a fraction of the reads that actually support it, and left the rest
|
|
15
|
+
* looking like disagreement. Counts are gathered strongest first, so an allele
|
|
16
|
+
* is established before anything can be read as its shoulder, and a value joins
|
|
17
|
+
* one only if it is both near it and much weaker than it.
|
|
10
18
|
*
|
|
11
19
|
* This is a report of what the reads say, not a genotype call: it does not know
|
|
12
20
|
* a ploidy, so a homozygote and a haploid locus both come back as one number,
|
|
@@ -17,11 +25,11 @@ export interface SampleArrayStats {
|
|
|
17
25
|
sample: string;
|
|
18
26
|
/** rows that reached both ends of the interval, i.e. that were measured */
|
|
19
27
|
spanning: number;
|
|
20
|
-
/**
|
|
28
|
+
/** the alleles found, each with the reads counted into it */
|
|
21
29
|
modes: Tally[];
|
|
22
30
|
/** every copy count seen, with its support */
|
|
23
31
|
copies: Tally[];
|
|
24
|
-
/** rows
|
|
32
|
+
/** rows counted into no allele at all */
|
|
25
33
|
offMode: number;
|
|
26
34
|
}
|
|
27
35
|
export interface ArrayStats {
|
|
@@ -12,17 +12,42 @@ import { renderRow } from './tview';
|
|
|
12
12
|
/**
|
|
13
13
|
* Least support an allele needs before it is reported as one of a sample's,
|
|
14
14
|
* as a fraction of that sample's spanning reads.
|
|
15
|
-
*
|
|
16
|
-
* Reads scatter around an allele — slippage in the read, slippage in the
|
|
17
|
-
* aligner — so the counts either side of a real allele are populated too, and
|
|
18
|
-
* a rule that took the top two would report the shoulder of one allele as the
|
|
19
|
-
* other. A fraction of coverage rather than a distance in copies is what lets
|
|
20
|
-
* two alleles a single copy apart both be reported, which at FMR1 is the
|
|
21
|
-
* mother's genotype and at ATXN3 the father's.
|
|
22
15
|
*/
|
|
23
16
|
const MIN_ALLELE_FRACTION = 0.15;
|
|
24
17
|
/** ...and never on one read, at any coverage. */
|
|
25
18
|
const MIN_ALLELE_READS = 2;
|
|
19
|
+
/**
|
|
20
|
+
* How far from an allele a read's copy count may fall and still be counted as
|
|
21
|
+
* that allele's, as a fraction of the allele's own size.
|
|
22
|
+
*
|
|
23
|
+
* Proportional rather than fixed because slippage scales with the array: the
|
|
24
|
+
* reads either side of an 89-copy allele scatter further than those either side
|
|
25
|
+
* of an 8-copy one. cuteSV refines a cluster of structural-variant signatures
|
|
26
|
+
* the same way, by a bandwidth taken as a fraction of the cluster's own mean
|
|
27
|
+
* length (Jiang et al., Genome Biol 21, 2020, doi:10.1186/s13059-020-02107-y);
|
|
28
|
+
* its constants are fractions of a length in bases and do not carry over to a
|
|
29
|
+
* count of copies, so this one is measured here instead. At 0.1 no call in the
|
|
30
|
+
* trio moves, merges or is lost, and the reads left out of one drop by three
|
|
31
|
+
* quarters.
|
|
32
|
+
*/
|
|
33
|
+
const SHOULDER_SPREAD = 0.1;
|
|
34
|
+
/**
|
|
35
|
+
* ...and how much support such a read may carry, relative to the allele it
|
|
36
|
+
* would join, before it is an allele of its own instead.
|
|
37
|
+
*
|
|
38
|
+
* This is the load-bearing half, and distance alone cannot replace it. At FMR1
|
|
39
|
+
* the mother carries two alleles one copy apart and at HTT a single allele has
|
|
40
|
+
* a shoulder one copy either side, so no bandwidth tells those two apart.
|
|
41
|
+
* Relative support does: a slippage shoulder in the trio runs at a fraction of
|
|
42
|
+
* its allele, and the mother's second allele runs at 87% of her first. The
|
|
43
|
+
* measured shelf is wide — 0.2 leaves reads uncounted, 0.4 starts merging the
|
|
44
|
+
* mother's two alleles into one.
|
|
45
|
+
*
|
|
46
|
+
* That shelf is 21 sample-locus calls in one trio, which is a shelf and not a
|
|
47
|
+
* proof: a locus carrying three real alleles within a copy of each other would
|
|
48
|
+
* defeat the rule, and this trio has none.
|
|
49
|
+
*/
|
|
50
|
+
const SHOULDER_SUPPORT = 0.3;
|
|
26
51
|
/** Each distinct value with how many rows carried it, smallest value first. */
|
|
27
52
|
export function tally(values) {
|
|
28
53
|
const counts = new Map();
|
|
@@ -34,7 +59,15 @@ export function tally(values) {
|
|
|
34
59
|
.sort((a, b) => a.value - b.value);
|
|
35
60
|
}
|
|
36
61
|
/**
|
|
37
|
-
* The copy counts a sample carries,
|
|
62
|
+
* The copy counts a sample carries, each with the reads that fell on it or in
|
|
63
|
+
* its skirt.
|
|
64
|
+
*
|
|
65
|
+
* Reads scatter around an allele — slippage in the molecule, slippage in the
|
|
66
|
+
* aligner — so a rule that reported only exact agreement credited an allele
|
|
67
|
+
* with a fraction of the reads that actually support it, and left the rest
|
|
68
|
+
* looking like disagreement. Counts are gathered strongest first, so an allele
|
|
69
|
+
* is established before anything can be read as its shoulder, and a value joins
|
|
70
|
+
* one only if it is both near it and much weaker than it.
|
|
38
71
|
*
|
|
39
72
|
* This is a report of what the reads say, not a genotype call: it does not know
|
|
40
73
|
* a ploidy, so a homozygote and a haploid locus both come back as one number,
|
|
@@ -42,7 +75,21 @@ export function tally(values) {
|
|
|
42
75
|
*/
|
|
43
76
|
export function alleleModes(copies) {
|
|
44
77
|
const floor = Math.max(MIN_ALLELE_READS, MIN_ALLELE_FRACTION * copies.length);
|
|
45
|
-
|
|
78
|
+
const peaks = [];
|
|
79
|
+
for (const t of tally(copies).sort((a, b) => b.reads - a.reads || a.value - b.value)) {
|
|
80
|
+
const distance = (peak) => Math.abs(t.value - peak.value);
|
|
81
|
+
const host = peaks
|
|
82
|
+
.filter(peak => distance(peak) <= Math.max(1, SHOULDER_SPREAD * peak.value) &&
|
|
83
|
+
t.reads <= SHOULDER_SUPPORT * peak.reads)
|
|
84
|
+
.sort((a, b) => distance(a) - distance(b))[0];
|
|
85
|
+
if (host) {
|
|
86
|
+
host.reads += t.reads;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
peaks.push({ ...t });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return peaks.filter(p => p.reads >= floor).sort((a, b) => a.value - b.value);
|
|
46
93
|
}
|
|
47
94
|
function sampleOfRow(name) {
|
|
48
95
|
const i = name.indexOf('|');
|
|
@@ -65,13 +112,15 @@ function arrayStats(array, plan, samples) {
|
|
|
65
112
|
.filter(([name]) => sampleOfRow(name) === sample)
|
|
66
113
|
.map(([, n]) => n);
|
|
67
114
|
const modes = alleleModes(copies);
|
|
68
|
-
const called = new Set(modes.map(m => m.value));
|
|
69
115
|
return {
|
|
70
116
|
sample,
|
|
71
117
|
spanning: copies.length,
|
|
72
118
|
modes,
|
|
73
119
|
copies: tally(copies),
|
|
74
|
-
|
|
120
|
+
// an allele carries the reads in its skirt as well as those exactly on
|
|
121
|
+
// it, so what is left over is counted off the alleles rather than off
|
|
122
|
+
// the distinct values they were called at
|
|
123
|
+
offMode: copies.length - modes.reduce((a, m) => a + m.reads, 0),
|
|
75
124
|
};
|
|
76
125
|
}),
|
|
77
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeatStats.js","sourceRoot":"","sources":["../../src/LaunchTView/repeatStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKnC
|
|
1
|
+
{"version":3,"file":"repeatStats.js","sourceRoot":"","sources":["../../src/LaunchTView/repeatStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAKnC;;;GAGG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAA;AAEhC,iDAA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align';
|
|
2
|
-
import {
|
|
2
|
+
import { buildArrayBlocks, reanchorInsertions } from './alleles';
|
|
3
3
|
import { ABSENT, SPANNED_GAP, byStart, clipInsertions, getReadNames, parseRead, } from './readLayout';
|
|
4
4
|
import { findReferenceArrays, mergeArrays } from './repeats';
|
|
5
5
|
import { newickSafe } from './sampleTree';
|
|
@@ -209,19 +209,23 @@ export function planTviewMsa({ features, refName, start, end, sequence, sampleOf
|
|
|
209
209
|
}
|
|
210
210
|
: undefined;
|
|
211
211
|
const clipped = clipInsertions(referenceRead ? [referenceRead, ...parsed] : parsed, start, end);
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
// The intervals come from the reference and nothing here moves them. What
|
|
213
|
+
// moves is each read's insertions, re-filed under the array they belong to
|
|
214
|
+
// before anything is measured or laid out — see reanchorInsertions. Both
|
|
215
|
+
// steps below read the re-anchored reads, so an insertion the array took over
|
|
216
|
+
// is rendered inside its block and not also as a column of its own.
|
|
217
|
+
const intervals = sequence
|
|
218
|
+
? mergeArrays(findReferenceArrays(sequence, start))
|
|
217
219
|
: [];
|
|
220
|
+
const anchored = reanchorInsertions(clipped, intervals);
|
|
221
|
+
const arrays = buildArrayBlocks(anchored, intervals);
|
|
218
222
|
const ownedByArray = new Set();
|
|
219
223
|
for (const array of arrays) {
|
|
220
224
|
for (let pos = array.start; pos <= array.end; pos++) {
|
|
221
225
|
ownedByArray.add(pos);
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
|
-
const aligned = alignInsertionColumns(
|
|
228
|
+
const aligned = alignInsertionColumns(anchored, ownedByArray);
|
|
225
229
|
// With several arrays in view the subject is the one the rows disagree most
|
|
226
230
|
// about, since ordering rows by two copy numbers at once is not a thing rows
|
|
227
231
|
// can do and an array every row agrees on orders nothing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tview.js","sourceRoot":"","sources":["../../src/LaunchTView/tview.ts"],"names":[],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