jbrowse-plugin-tview 2.0.6 → 2.1.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.
Files changed (73) hide show
  1. package/README.md +157 -4
  2. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.d.ts +132 -0
  3. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js +152 -0
  4. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js.map +1 -0
  5. package/dist/LaunchTView/TviewGetPlanRpc/index.d.ts +3 -0
  6. package/dist/LaunchTView/TviewGetPlanRpc/index.js +5 -0
  7. package/dist/LaunchTView/TviewGetPlanRpc/index.js.map +1 -0
  8. package/dist/LaunchTView/align.d.ts +93 -9
  9. package/dist/LaunchTView/align.js +290 -15
  10. package/dist/LaunchTView/align.js.map +1 -1
  11. package/dist/LaunchTView/alleles.d.ts +57 -0
  12. package/dist/LaunchTView/alleles.js +94 -0
  13. package/dist/LaunchTView/alleles.js.map +1 -0
  14. package/dist/LaunchTView/components/ArrayReport.d.ts +10 -0
  15. package/dist/LaunchTView/components/ArrayReport.js +59 -0
  16. package/dist/LaunchTView/components/ArrayReport.js.map +1 -0
  17. package/dist/LaunchTView/components/LaunchTViewDialog.js +74 -37
  18. package/dist/LaunchTView/components/LaunchTViewDialog.js.map +1 -1
  19. package/dist/LaunchTView/fetchTviewPlan.d.ts +20 -13
  20. package/dist/LaunchTView/fetchTviewPlan.js +27 -27
  21. package/dist/LaunchTView/fetchTviewPlan.js.map +1 -1
  22. package/dist/LaunchTView/launchView.d.ts +25 -0
  23. package/dist/LaunchTView/launchView.js +20 -0
  24. package/dist/LaunchTView/launchView.js.map +1 -0
  25. package/dist/LaunchTView/readLayout.d.ts +85 -0
  26. package/dist/LaunchTView/readLayout.js +96 -0
  27. package/dist/LaunchTView/readLayout.js.map +1 -0
  28. package/dist/LaunchTView/repeats.d.ts +68 -0
  29. package/dist/LaunchTView/repeats.js +200 -0
  30. package/dist/LaunchTView/repeats.js.map +1 -0
  31. package/dist/LaunchTView/sampleTree.d.ts +37 -0
  32. package/dist/LaunchTView/sampleTree.js +65 -0
  33. package/dist/LaunchTView/sampleTree.js.map +1 -0
  34. package/dist/LaunchTView/tview.d.ts +67 -44
  35. package/dist/LaunchTView/tview.js +190 -121
  36. package/dist/LaunchTView/tview.js.map +1 -1
  37. package/dist/LaunchTView/useTviewMsa.d.ts +13 -9
  38. package/dist/LaunchTView/useTviewMsa.js +15 -11
  39. package/dist/LaunchTView/useTviewMsa.js.map +1 -1
  40. package/dist/TViewPanel/coords.d.ts +9 -1
  41. package/dist/TViewPanel/coords.js +22 -2
  42. package/dist/TViewPanel/coords.js.map +1 -1
  43. package/dist/TViewPanel/init.d.ts +56 -0
  44. package/dist/TViewPanel/init.js +59 -0
  45. package/dist/TViewPanel/init.js.map +1 -0
  46. package/dist/TViewPanel/model.d.ts +47 -31
  47. package/dist/TViewPanel/model.js +73 -51
  48. package/dist/TViewPanel/model.js.map +1 -1
  49. package/dist/index.js +5 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/jbrowse-plugin-tview.umd.production.min.js +22 -22
  52. package/dist/jbrowse-plugin-tview.umd.production.min.js.map +4 -4
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/package.json +5 -2
  56. package/src/LaunchTView/TviewGetPlanRpc/TviewGetPlan.ts +264 -0
  57. package/src/LaunchTView/TviewGetPlanRpc/index.ts +14 -0
  58. package/src/LaunchTView/align.ts +343 -17
  59. package/src/LaunchTView/alleles.ts +132 -0
  60. package/src/LaunchTView/components/ArrayReport.tsx +64 -0
  61. package/src/LaunchTView/components/LaunchTViewDialog.tsx +122 -39
  62. package/src/LaunchTView/fetchTviewPlan.ts +42 -42
  63. package/src/LaunchTView/launchView.ts +50 -0
  64. package/src/LaunchTView/readLayout.ts +145 -0
  65. package/src/LaunchTView/repeats.ts +218 -0
  66. package/src/LaunchTView/sampleTree.ts +73 -0
  67. package/src/LaunchTView/tview.ts +259 -157
  68. package/src/LaunchTView/useTviewMsa.ts +20 -17
  69. package/src/TViewPanel/coords.ts +23 -1
  70. package/src/TViewPanel/init.ts +127 -0
  71. package/src/TViewPanel/model.ts +82 -61
  72. package/src/index.ts +5 -1
  73. package/src/version.ts +1 -1
@@ -5,10 +5,24 @@
5
5
  * shared event stops being readable. Aligning the inserted sequences against
6
6
  * each other fixes that.
7
7
  *
8
- * This is deliberately local to one reference position: the insertion still
9
- * occupies "as many columns as the widest gapped sequence", which is the only
10
- * thing buildColumnToRefPos knows about, so the column <-> reference mapping is
11
- * untouched.
8
+ * There are two ways to do it, and which one applies is a property of the
9
+ * inserted sequence rather than a setting:
10
+ *
11
+ * - **Aperiodic** (`alignInsertions`): one center-star alignment over the whole
12
+ * inserted sequence. Right for a novel insertion, a mobile element, anything
13
+ * whose bases only make sense read straight through.
14
+ * - **Periodic** (`alignPeriodicInsertions`): a tandem array, where the whole
15
+ * inserted sequence is n copies of one unit. Aligning those base-to-base is
16
+ * both unaffordable and wrong — it is free to align copy 5 of one read to
17
+ * copy 3 of another, and the difference that matters (how many copies) ends
18
+ * up expressed as where the row stops. Aligning unit-to-unit instead puts
19
+ * copy k of every read in the same columns, so copy number reads as a count
20
+ * of blocks and a divergent copy stands out as a column inside its block.
21
+ *
22
+ * Both are local to one reference position: the insertion still occupies "as
23
+ * many columns as the widest gapped sequence", which is the only thing
24
+ * buildColumnToRefPos knows about, so the column <-> reference mapping is
25
+ * untouched either way.
12
26
  */
13
27
  const MATCH = 2;
14
28
  const MISMATCH = -2;
@@ -17,6 +31,30 @@ const GAP = -3;
17
31
  // back to left-justified layout rather than stall on a pathological site
18
32
  const MAX_LEN = 200;
19
33
  const MAX_DISTINCT = 30;
34
+ // Shortest unit that earns a unit-per-block layout. The scan below starts at 1
35
+ // so it reports the TRUE minimal period, which is what makes a homopolymer come
36
+ // back as 1 and get declined here: `AAAA...` is periodic at every lag, and
37
+ // laying it out as 2bp blocks would be an arbitrary reading of one run of A.
38
+ const MIN_UNIT_PERIOD = 2;
39
+ // Longest unit the scan looks for. Covers STRs and the common VNTR range; the
40
+ // megabase-unit arrays (LPA KIV-2 at 5.5kb) need more copies than a read holds
41
+ // before they are periodic at all, so they are out of reach here regardless.
42
+ const MAX_PERIOD = 300;
43
+ // Copies needed before a sequence counts as an array. Two copies of anything is
44
+ // a duplication, not a tandem repeat, and at two the period is unidentifiable
45
+ // from the sequence alone.
46
+ const MIN_COPIES = 3;
47
+ // Fraction of positions that must agree at lag p for p to be the period. Loose
48
+ // enough for the ~5-15% divergence between copies of a real VNTR unit and for
49
+ // long-read error on top of it.
50
+ const PERIODIC_MATCH = 0.8;
51
+ // The period scan is O(len * maxPeriod), so it runs on a prefix rather than the
52
+ // whole insert. An array that is periodic in its first 3kb is periodic.
53
+ const PROBE_LEN = 3000;
54
+ // Backstops on the unit-level work, in the same spirit as MAX_LEN/MAX_DISTINCT:
55
+ // decline and leave the site to the aperiodic path rather than stall on it.
56
+ const MAX_UNITS = 1000;
57
+ const MAX_PERIODIC_CELLS = 20_000_000;
20
58
  function subst(a, b) {
21
59
  return a === b ? MATCH : MISMATCH;
22
60
  }
@@ -91,19 +129,244 @@ function emit({ slots, atCenter }, slotWidths) {
91
129
  return ret + last + '-'.repeat(slotWidths[atCenter.length] - last.length);
92
130
  }
93
131
  /**
94
- * Center-star multiple alignment of the sequences inserted at one reference
95
- * position. Returns each distinct input mapped to a gapped version, all of the
96
- * same length. Returns an empty map when there is nothing to gain (a single
97
- * distinct sequence) or when the site is too large to be worth aligning; the
98
- * caller then keeps the sequences as-is and left-justifies them.
132
+ * The smallest lag at which a sequence repeats, or undefined when it does not.
133
+ *
134
+ * Scanning up from 1 returns the true minimal period, which is what separates a
135
+ * tandem array from a homopolymer: `AAAA...` matches at every lag and comes back
136
+ * as 1, and a 30bp unit comes back as 30 rather than as 60 or 90.
99
137
  */
100
- export function alignInsertions(seqs) {
138
+ export function detectPeriod(seq) {
139
+ const probe = seq.length > PROBE_LEN ? seq.slice(0, PROBE_LEN) : seq;
140
+ const maxPeriod = Math.min(MAX_PERIOD, Math.floor(probe.length / MIN_COPIES));
141
+ for (let p = 1; p <= maxPeriod; p++) {
142
+ const n = probe.length - p;
143
+ let matches = 0;
144
+ for (let i = 0; i < n; i++) {
145
+ if (probe[i] === probe[i + p]) {
146
+ matches++;
147
+ }
148
+ }
149
+ if (matches / n >= PERIODIC_MATCH) {
150
+ return p;
151
+ }
152
+ }
153
+ return undefined;
154
+ }
155
+ /**
156
+ * Majority base at each offset within the unit, over the whole-length copies of
157
+ * `seq`. The consensus is what every copy of every read is aligned to, so it has
158
+ * to be one fixed string for the site — deriving it per read would let two reads
159
+ * disagree about where a unit starts.
160
+ */
161
+ export function consensusUnit(seq, period) {
162
+ const copies = Math.floor(seq.length / period);
163
+ let ret = '';
164
+ for (let j = 0; j < period; j++) {
165
+ const counts = new Map();
166
+ for (let k = 0; k < copies; k++) {
167
+ const c = seq[k * period + j];
168
+ counts.set(c, (counts.get(c) ?? 0) + 1);
169
+ }
170
+ // ties break lexicographically so the consensus is a function of the input
171
+ // and not of Map iteration order
172
+ ret += [...counts].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1))[0][0];
173
+ }
174
+ return ret;
175
+ }
176
+ /**
177
+ * Align one copy of the consensus unit against `seq` starting at `from`: global
178
+ * on the consensus, since a copy is a whole copy, and free at the window's right
179
+ * edge, since the copy ends wherever it ends. `consumed` is where the next copy
180
+ * starts, which is what lets an indel inside one copy stay inside it rather than
181
+ * shifting every copy after it.
182
+ */
183
+ function alignUnitAt(consensus, seq, from) {
184
+ const n = consensus.length;
185
+ const m = Math.min(2 * n, seq.length - from);
186
+ const stride = m + 1;
187
+ const score = new Int32Array((n + 1) * stride);
188
+ for (let i = 1; i <= n; i++) {
189
+ score[i * stride] = i * GAP;
190
+ }
191
+ for (let j = 1; j <= m; j++) {
192
+ score[j] = j * GAP;
193
+ }
194
+ for (let i = 1; i <= n; i++) {
195
+ for (let j = 1; j <= m; j++) {
196
+ score[i * stride + j] = Math.max(score[(i - 1) * stride + j - 1] +
197
+ subst(consensus[i - 1], seq[from + j - 1]), score[(i - 1) * stride + j] + GAP, score[i * stride + j - 1] + GAP);
198
+ }
199
+ }
200
+ // the copy ends at whichever window position scores best once the consensus
201
+ // is spent
202
+ let consumed = 0;
203
+ let best = score[n * stride];
204
+ for (let j = 1; j <= m; j++) {
205
+ const s = score[n * stride + j];
206
+ if (s > best) {
207
+ best = s;
208
+ consumed = j;
209
+ }
210
+ }
211
+ // a copy that consumed nothing would not advance the cursor
212
+ if (consumed === 0) {
213
+ return undefined;
214
+ }
215
+ const outCenter = [];
216
+ const outOther = [];
217
+ let i = n;
218
+ let j = consumed;
219
+ while (i > 0 || j > 0) {
220
+ const cur = score[i * stride + j];
221
+ const diagonal = i > 0 &&
222
+ j > 0 &&
223
+ cur ===
224
+ score[(i - 1) * stride + j - 1] +
225
+ subst(consensus[i - 1], seq[from + j - 1]);
226
+ if (diagonal) {
227
+ outCenter.push(consensus[i - 1]);
228
+ outOther.push(seq[from + j - 1]);
229
+ i--;
230
+ j--;
231
+ }
232
+ else if (i > 0 && cur === score[(i - 1) * stride + j] + GAP) {
233
+ outCenter.push(consensus[i - 1]);
234
+ outOther.push('-');
235
+ i--;
236
+ }
237
+ else {
238
+ outCenter.push('-');
239
+ outOther.push(seq[from + j - 1]);
240
+ j--;
241
+ }
242
+ }
243
+ return {
244
+ center: outCenter.reverse().join(''),
245
+ other: outOther.reverse().join(''),
246
+ consumed,
247
+ };
248
+ }
249
+ /** Every copy in `seq`, each as a pairwise alignment against the consensus. */
250
+ function splitIntoUnits(seq, consensus) {
251
+ const units = [];
252
+ let cursor = 0;
253
+ while (cursor < seq.length) {
254
+ const unit = alignUnitAt(consensus, seq, cursor);
255
+ if (!unit || units.length >= MAX_UNITS) {
256
+ return undefined;
257
+ }
258
+ units.push(unit);
259
+ cursor += unit.consumed;
260
+ }
261
+ return units;
262
+ }
263
+ /**
264
+ * Unit-per-block alignment of the sequences inserted at one reference position.
265
+ *
266
+ * Copy k of every sequence lands in the same block of columns, and a block is
267
+ * as wide as the widest version of that copy across the site, so a sequence with
268
+ * fewer copies runs out of blocks rather than drifting out of register. Returns
269
+ * undefined when the site is not a tandem array, or is too big to lay out this
270
+ * way; the caller falls back to `alignInsertions`.
271
+ *
272
+ * **Blocks are array order, not homology.** Copies are anchored at the left edge
273
+ * of the insertion and counted rightward, so block k is "the kth copy along",
274
+ * and arrays grow and shrink by unequal crossing over anywhere inside them —
275
+ * block 9 of a 12-copy allele and block 9 of a 20-copy allele need not be the
276
+ * same copy. What the layout does buy is that copies stay in register, so a
277
+ * single divergent copy shows up as a column instead of shifting every copy
278
+ * after it. Reading down one row is sound; reading across two is a hypothesis.
279
+ */
280
+ export function alignPeriodicInsertions(seqs) {
281
+ const distinct = [...new Set(seqs)];
282
+ const longest = distinct.reduce((a, b) => (b.length > a.length ? b : a), '');
283
+ const period = detectPeriod(longest);
284
+ if (period === undefined || period < MIN_UNIT_PERIOD) {
285
+ return undefined;
286
+ }
287
+ return alignToUnit(distinct, consensusUnit(longest, period));
288
+ }
289
+ /**
290
+ * Unit-per-block alignment against a unit the caller already knows.
291
+ *
292
+ * Separated from `alignPeriodicInsertions` because where the unit comes from is
293
+ * the whole difference between the two ways of finding an array. Measured off
294
+ * the inserted sequences, it can only be derived from one of them — the longest,
295
+ * which is a guess that one chimeric read overturns for the whole site. Measured
296
+ * off the reference, it is a property of the locus, so every read is laid out
297
+ * against the same unit whatever the reads happen to be.
298
+ */
299
+ export function alignToUnit(seqs, consensus) {
300
+ const distinct = [...new Set(seqs)].filter(s => s.length > 0);
301
+ const period = consensus.length;
302
+ if (!distinct.length || period < MIN_UNIT_PERIOD) {
303
+ return undefined;
304
+ }
305
+ const totalUnits = distinct.reduce((a, s) => a + Math.ceil(s.length / period), 0);
306
+ if (totalUnits * (period + 1) * (2 * period + 1) > MAX_PERIODIC_CELLS) {
307
+ return undefined;
308
+ }
309
+ const splits = new Map();
310
+ for (const seq of distinct) {
311
+ const units = splitIntoUnits(seq, consensus);
312
+ if (!units) {
313
+ return undefined;
314
+ }
315
+ splits.set(seq, units.map(u => splitAgainstCenter(u, period)));
316
+ }
317
+ const maxUnits = Math.max(...[...splits.values()].map(u => u.length));
318
+ const slotWidths = [];
319
+ for (let k = 0; k < maxUnits; k++) {
320
+ const widths = Array.from({ length: period + 1 }, () => 0);
321
+ for (const unitSplits of splits.values()) {
322
+ const split = unitSplits[k];
323
+ if (split) {
324
+ for (let j = 0; j <= period; j++) {
325
+ widths[j] = Math.max(widths[j], split.slots[j].length);
326
+ }
327
+ }
328
+ }
329
+ slotWidths.push(widths);
330
+ }
331
+ const unitWidths = slotWidths.map(w => period + w.reduce((a, b) => a + b, 0));
332
+ const gapped = new Map();
333
+ const copies = new Map();
334
+ for (const [seq, unitSplits] of splits) {
335
+ let row = '';
336
+ for (let k = 0; k < maxUnits; k++) {
337
+ const split = unitSplits[k];
338
+ row += split ? emit(split, slotWidths[k]) : '-'.repeat(unitWidths[k]);
339
+ }
340
+ gapped.set(seq, row);
341
+ copies.set(seq, unitSplits.length);
342
+ }
343
+ return { period, gapped, copies, unitWidths };
344
+ }
345
+ /**
346
+ * Lay out the sequences inserted at one reference position, by whichever of the
347
+ * two alignments the sequence itself calls for. The single place that decision
348
+ * is made, so a caller reading the period cannot disagree with the layout it
349
+ * gets.
350
+ *
351
+ * A tandem array goes unit-per-block, which is both the readable answer and the
352
+ * affordable one — the size caps here are what the base-to-base alignment costs,
353
+ * and an expansion is always past them. Everything else gets the center-star
354
+ * alignment, or is left alone (`gapped` empty) when there is nothing to gain
355
+ * from a single distinct sequence, or the site is too large to be worth it.
356
+ */
357
+ export function alignInsertionSite(seqs) {
101
358
  const distinct = [...new Set(seqs)];
359
+ // an array is worth unrolling even when every read agrees on it: the copies
360
+ // still have to be squared up with each other before they can be counted
361
+ const periodic = alignPeriodicInsertions(distinct);
362
+ if (periodic) {
363
+ return { gapped: periodic.gapped, periodic };
364
+ }
102
365
  const longest = distinct.reduce((a, b) => (b.length > a.length ? b : a), '');
103
366
  if (distinct.length < 2 ||
104
367
  distinct.length > MAX_DISTINCT ||
105
368
  longest.length > MAX_LEN) {
106
- return new Map();
369
+ return { gapped: new Map() };
107
370
  }
108
371
  const centerLen = longest.length;
109
372
  const others = distinct.filter(s => s !== longest);
@@ -113,9 +376,21 @@ export function alignInsertions(seqs) {
113
376
  atCenter: longest,
114
377
  };
115
378
  const slotWidths = Array.from({ length: centerLen + 1 }, (_, j) => splits.reduce((max, s) => Math.max(max, s.slots[j].length), 0));
116
- return new Map([
117
- [longest, emit(centerSplit, slotWidths)],
118
- ...others.map((seq, i) => [seq, emit(splits[i], slotWidths)]),
119
- ]);
379
+ return {
380
+ gapped: new Map([
381
+ [longest, emit(centerSplit, slotWidths)],
382
+ ...others.map((seq, i) => [
383
+ seq,
384
+ emit(splits[i], slotWidths),
385
+ ]),
386
+ ]),
387
+ };
388
+ }
389
+ /**
390
+ * The gapped sequences alone, for callers with no use for the period. Every
391
+ * decision lives in `alignInsertionSite`.
392
+ */
393
+ export function alignInsertions(seqs) {
394
+ return alignInsertionSite(seqs).gapped;
120
395
  }
121
396
  //# sourceMappingURL=align.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/LaunchTView/align.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,KAAK,GAAG,CAAC,CAAA;AACf,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAA;AACnB,MAAM,GAAG,GAAG,CAAC,CAAC,CAAA;AAEd,+EAA+E;AAC/E,yEAAyE;AACzE,MAAM,OAAO,GAAG,GAAG,CAAA;AACnB,MAAM,YAAY,GAAG,EAAE,CAAA;AAEvB,SAAS,KAAK,CAAC,CAAqB,EAAE,CAAqB;IACzD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAA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,CAAC;SACH,CAAC;KACH,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAc;IAC5C,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;AACxC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { ReadLayout } from './readLayout';
2
+ import type { ReferenceArray } from './repeats';
3
+ /**
4
+ * A tandem array laid out as one block of columns per copy, replacing the
5
+ * reference columns the array covers.
6
+ *
7
+ * The interval comes from the reference and the unit comes with it, so every
8
+ * row is measured over the same span against the same unit. That is what makes
9
+ * the counts comparable: a read's allele is what it has between here and here,
10
+ * whatever the aligner did with the gap, and the reference is just the row whose
11
+ * allele the coordinates are named after.
12
+ */
13
+ export interface ArrayBlock {
14
+ /** reference position the array starts at, inclusive */
15
+ start: number;
16
+ /** reference position the array ends at, exclusive */
17
+ end: number;
18
+ period: number;
19
+ unit: string;
20
+ /** columns the block occupies */
21
+ width: number;
22
+ /** columns each copy occupies, left to right; sums to `width` */
23
+ unitWidths: number[];
24
+ /** gapped block, by row name; only rows whose allele could be measured */
25
+ rowByName: Map<string, string>;
26
+ /** copies carried, by row name */
27
+ copiesByName: Map<string, number>;
28
+ /** allele length in bp, by row name */
29
+ lengthByName: Map<string, number>;
30
+ }
31
+ /**
32
+ * What one row has between two reference positions: its matched bases, plus
33
+ * whatever it inserted inside, minus whatever it deleted.
34
+ *
35
+ * This is the measurement the insertion-anchored reading cannot make. An indel
36
+ * inside an array has no unique placement, so two reads carrying the same allele
37
+ * can disagree about which reference position it is inserted at and by how much;
38
+ * summed over the interval, those choices cancel and both come back the same
39
+ * length. Undefined when the row does not reach both edges — copies cannot be
40
+ * counted from a read that stops inside the array, and guessing from a partial
41
+ * one is how a truncated read reads as a contracted allele.
42
+ */
43
+ export declare function extractAllele(read: ReadLayout, start: number, end: number): string | undefined;
44
+ /** Reference positions an array owns, including the insertion slot at its right edge. */
45
+ export declare function arrayInsertionKeys(array: {
46
+ start: number;
47
+ end: number;
48
+ }): number[];
49
+ /**
50
+ * Lay every row's allele out unit-per-block, one block per array.
51
+ *
52
+ * Arrays whose alleles are all one length still get a block: squaring the copies
53
+ * up against each other is what turns "this row is 63 bases long" into "this row
54
+ * has 21 copies and the 12th one differs", and that is true whether or not the
55
+ * rows disagree.
56
+ */
57
+ export declare function buildArrayBlocks(reads: ReadLayout[], arrays: ReferenceArray[]): ArrayBlock[];
@@ -0,0 +1,94 @@
1
+ import { alignToUnit } from './align';
2
+ const SPANNED_GAP = '-';
3
+ const ABSENT = '.';
4
+ /**
5
+ * What one row has between two reference positions: its matched bases, plus
6
+ * whatever it inserted inside, minus whatever it deleted.
7
+ *
8
+ * This is the measurement the insertion-anchored reading cannot make. An indel
9
+ * inside an array has no unique placement, so two reads carrying the same allele
10
+ * can disagree about which reference position it is inserted at and by how much;
11
+ * summed over the interval, those choices cancel and both come back the same
12
+ * length. Undefined when the row does not reach both edges — copies cannot be
13
+ * counted from a read that stops inside the array, and guessing from a partial
14
+ * one is how a truncated read reads as a contracted allele.
15
+ */
16
+ export function extractAllele(read, start, end) {
17
+ const last = read.start + read.refChars.length;
18
+ if (read.start > start || last < end) {
19
+ return undefined;
20
+ }
21
+ let ret = '';
22
+ for (let pos = start; pos <= end; pos++) {
23
+ ret += read.insertions.get(pos) ?? '';
24
+ if (pos < end) {
25
+ const char = read.refChars[pos - read.start];
26
+ if (char === ABSENT) {
27
+ // an N op skips the position rather than deleting it, so the row has no
28
+ // allele here at all rather than a shorter one
29
+ return undefined;
30
+ }
31
+ if (char !== SPANNED_GAP) {
32
+ ret += char;
33
+ }
34
+ }
35
+ }
36
+ return ret;
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
+ /**
47
+ * Lay every row's allele out unit-per-block, one block per array.
48
+ *
49
+ * Arrays whose alleles are all one length still get a block: squaring the copies
50
+ * up against each other is what turns "this row is 63 bases long" into "this row
51
+ * has 21 copies and the 12th one differs", and that is true whether or not the
52
+ * rows disagree.
53
+ */
54
+ export function buildArrayBlocks(reads, arrays) {
55
+ const ret = [];
56
+ for (const array of arrays) {
57
+ const alleleByName = new Map();
58
+ for (const read of reads) {
59
+ const allele = extractAllele(read, array.start, array.end);
60
+ if (allele !== undefined) {
61
+ alleleByName.set(read.name, allele);
62
+ }
63
+ }
64
+ const aligned = alignToUnit([...alleleByName.values()], array.unit);
65
+ if (!aligned) {
66
+ continue;
67
+ }
68
+ const rowByName = new Map();
69
+ const copiesByName = new Map();
70
+ const lengthByName = new Map();
71
+ for (const [name, allele] of alleleByName) {
72
+ const row = aligned.gapped.get(allele);
73
+ const copies = aligned.copies.get(allele);
74
+ if (row !== undefined && copies !== undefined) {
75
+ rowByName.set(name, row);
76
+ copiesByName.set(name, copies);
77
+ lengthByName.set(name, allele.length);
78
+ }
79
+ }
80
+ ret.push({
81
+ start: array.start,
82
+ end: array.end,
83
+ period: aligned.period,
84
+ unit: array.unit,
85
+ width: aligned.unitWidths.reduce((a, b) => a + b, 0),
86
+ unitWidths: aligned.unitWidths,
87
+ rowByName,
88
+ copiesByName,
89
+ lengthByName,
90
+ });
91
+ }
92
+ return ret;
93
+ }
94
+ //# sourceMappingURL=alleles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alleles.js","sourceRoot":"","sources":["../../src/LaunchTView/alleles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAkCrC,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,C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AE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpD,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS;YACT,YAAY;YACZ,YAAY;SACb,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { TviewPlanResult } from '../TviewGetPlanRpc';
3
+ /**
4
+ * What the reads say about the arrays before the view is opened, since the
5
+ * number is often the whole reason for opening it and a picture of 400 columns
6
+ * is a slow way to read one off.
7
+ */
8
+ export default function ArrayReport({ data }: {
9
+ data: TviewPlanResult;
10
+ }): React.JSX.Element | null;
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { Typography } from '@mui/material';
3
+ /** allele lengths seen, commonest first, as `63bp x12` */
4
+ function alleleTally(lengths) {
5
+ const counts = new Map();
6
+ for (const [, length] of lengths) {
7
+ counts.set(length, (counts.get(length) ?? 0) + 1);
8
+ }
9
+ return [...counts]
10
+ .sort((a, b) => b[1] - a[1] || a[0] - b[0])
11
+ .map(([length, n]) => `${length}bp x${n}`);
12
+ }
13
+ /**
14
+ * What the reads say about the arrays before the view is opened, since the
15
+ * number is often the whole reason for opening it and a picture of 400 columns
16
+ * is a slow way to read one off.
17
+ */
18
+ export default function ArrayReport({ data }) {
19
+ const { arrays, subjectIndex, region } = data;
20
+ const subject = subjectIndex === undefined ? undefined : arrays[subjectIndex];
21
+ if (!subject) {
22
+ return arrays.length ? null : (React.createElement(Typography, { variant: "body2" }, "No tandem array in the reference here, so the reads are laid out base by base."));
23
+ }
24
+ const copies = subject.copies;
25
+ return (React.createElement(React.Fragment, null,
26
+ React.createElement(Typography, { variant: "subtitle2" },
27
+ "Tandem array at ",
28
+ region.refName,
29
+ ":",
30
+ subject.start.toLocaleString('en-US'),
31
+ "-",
32
+ subject.end.toLocaleString('en-US'),
33
+ ", ",
34
+ subject.period,
35
+ "bp unit",
36
+ ' ',
37
+ subject.unit),
38
+ React.createElement(Typography, { variant: "body2" },
39
+ copies.length,
40
+ " of ",
41
+ data.rowCount,
42
+ " rows span it end to end and carry",
43
+ ' ',
44
+ Math.min(...copies.map(c => c[1])),
45
+ "\u2013",
46
+ Math.max(...copies.map(c => c[1])),
47
+ " copies. Allele lengths:",
48
+ ' ',
49
+ alleleTally(subject.lengths).join(', '),
50
+ "."),
51
+ React.createElement(Typography, { variant: "body2" }, "Each copy gets its own block of columns, so one divergent copy shows up as a column rather than shifting every copy after it. Blocks are array order, not homology: copies are counted from the left edge, and arrays expand and contract anywhere inside themselves, so the 9th copy of one row need not be the 9th of another. Read down a row, not across two."),
52
+ arrays.length > 1 ? (React.createElement(Typography, { variant: "body2" },
53
+ arrays.length - 1,
54
+ " shorter",
55
+ ' ',
56
+ arrays.length === 2 ? 'array is' : 'arrays are',
57
+ " also laid out per copy; rows are ordered by this one.")) : null));
58
+ }
59
+ //# sourceMappingURL=ArrayReport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrayReport.js","sourceRoot":"","sources":["../../../src/LaunchTView/components/ArrayReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI1C,0DAA0D;AAC1D,SAAS,WAAW,CAAC,OAA2B;IAC9C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IACxC,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACnD,CAAC;IACD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