jbrowse-plugin-tview 2.2.0 → 2.2.3

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 CHANGED
@@ -9,6 +9,52 @@ get their own columns instead of being collapsed into a marker: every read that
9
9
  inserts at a position contributes its bases, and reads without that insertion
10
10
  are padded so the reference columns still line up.
11
11
 
12
+ ## Live demos
13
+
14
+ Real human data, nothing to install. Each link opens the GIAB Ashkenazi trio —
15
+ PacBio HiFi, GRCh37, streamed from GIAB's FTP — at a tandem repeat locus, with
16
+ the array already unrolled a copy per block and every row labelled with its copy
17
+ count.
18
+
19
+ <!-- demo-links -->
20
+
21
+ | locus | window | what it shows | open |
22
+ | ----- | ----------------------------- | ----------------------------------------------------------------- | -------------------------- |
23
+ | FMR1 | chrX:146,993,530..146,993,670 | CGG on the X, so two of the three samples carry one allele | [launch][tview-demo-fmr1] |
24
+ | HTT | chr4:3,076,570..3,076,730 | the CAG tract, with a shoulder either side of one allele | [launch][tview-demo-htt] |
25
+ | ATXN3 | chr14:92,537,320..92,537,420 | the locus that reports as four arrays when anchored on insertions | [launch][tview-demo-atxn3] |
26
+ | ABCA7 | chr19:1,049,460..1,050,000 | a 25bp VNTR whose alleles run past 2kb | [launch][tview-demo-abca7] |
27
+
28
+ [tview-demo-fmr1]:
29
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22name%22%3A%22fmr1%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chrX%3A146%2C993%2C530..146%2C993%2C670%22%2C%22assembly%22%3A%22hg19%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%5D%7D%2C%7B%22id%22%3A%22tview%22%2C%22type%22%3A%22TView%22%2C%22displayName%22%3A%22fmr1%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chrX%3A146%2C993%2C530..146%2C993%2C670%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22sample%22%3A%22HG002_son%22%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22sample%22%3A%22HG003_father%22%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22sample%22%3A%22HG004_mother%22%7D%5D%2C%22connectedViewId%22%3A%22lgv%22%2C%22height%22%3A900%2C%22colWidth%22%3A6%2C%22rowHeight%22%3A8%2C%22treeAreaWidth%22%3A330%2C%22labelsAlignRight%22%3Atrue%2C%22colorSchemeName%22%3A%22jbrowse_dna%22%2C%22drawTree%22%3Atrue%7D%5D%7D
30
+ [tview-demo-htt]:
31
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22name%22%3A%22htt%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chr4%3A3%2C076%2C570..3%2C076%2C730%22%2C%22assembly%22%3A%22hg19%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%5D%7D%2C%7B%22id%22%3A%22tview%22%2C%22type%22%3A%22TView%22%2C%22displayName%22%3A%22htt%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr4%3A3%2C076%2C570..3%2C076%2C730%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22sample%22%3A%22HG002_son%22%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22sample%22%3A%22HG003_father%22%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22sample%22%3A%22HG004_mother%22%7D%5D%2C%22connectedViewId%22%3A%22lgv%22%2C%22height%22%3A900%2C%22colWidth%22%3A6%2C%22rowHeight%22%3A8%2C%22treeAreaWidth%22%3A330%2C%22labelsAlignRight%22%3Atrue%2C%22colorSchemeName%22%3A%22jbrowse_dna%22%2C%22drawTree%22%3Atrue%7D%5D%7D
32
+ [tview-demo-atxn3]:
33
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22name%22%3A%22atxn3%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chr14%3A92%2C537%2C320..92%2C537%2C420%22%2C%22assembly%22%3A%22hg19%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%5D%7D%2C%7B%22id%22%3A%22tview%22%2C%22type%22%3A%22TView%22%2C%22displayName%22%3A%22atxn3%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr14%3A92%2C537%2C320..92%2C537%2C420%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22sample%22%3A%22HG002_son%22%7D%2C%7B%22trackId%22%3A%22HG003%22%2C%22sample%22%3A%22HG003_father%22%7D%2C%7B%22trackId%22%3A%22HG004%22%2C%22sample%22%3A%22HG004_mother%22%7D%5D%2C%22connectedViewId%22%3A%22lgv%22%2C%22height%22%3A900%2C%22colWidth%22%3A7%2C%22rowHeight%22%3A8%2C%22treeAreaWidth%22%3A330%2C%22labelsAlignRight%22%3Atrue%2C%22colorSchemeName%22%3A%22jbrowse_dna%22%2C%22drawTree%22%3Atrue%7D%5D%7D
34
+ [tview-demo-abca7]:
35
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22name%22%3A%22abca7%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chr19%3A1%2C049%2C460..1%2C050%2C000%22%2C%22assembly%22%3A%22hg19%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG003%22%2C%22displaySnapshot%22%3A%7B%22height%22%3A55%7D%7D%5D%7D%2C%7B%22id%22%3A%22tview%22%2C%22type%22%3A%22TView%22%2C%22displayName%22%3A%22abca7%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr19%3A1%2C049%2C460..1%2C050%2C000%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG003%22%2C%22sample%22%3A%22HG003_father%22%7D%5D%2C%22connectedViewId%22%3A%22lgv%22%2C%22height%22%3A580%2C%22colWidth%22%3A1%2C%22rowHeight%22%3A22%2C%22treeAreaWidth%22%3A480%2C%22labelsAlignRight%22%3Atrue%2C%22colorSchemeName%22%3A%22jbrowse_dna%22%2C%22drawTree%22%3Afalse%7D%5D%7D
36
+
37
+ <!-- /demo-links -->
38
+
39
+ Nothing to accept and nothing to install: click one and wait for the reads,
40
+ which take a few seconds since they arrive by range request and the alignment is
41
+ built in a worker.
42
+
43
+ The demo lives at [jbrowse.org/demos/tview/](https://jbrowse.org/demos/tview/) —
44
+ the config and the plugin bundle both, and that folder opens the first of them —
45
+ and runs in [JBrowse Web nightly](https://jbrowse.org/code/jb2/main/), the
46
+ nightly because `@jbrowse/core` 4.3.0 does not ship the MUI 9 internals this
47
+ bundle needs. Hosting it there rather than pointing at a config on GitHub and a
48
+ bundle on a CDN is what makes it one click: jbrowse-web asks a visitor to
49
+ confirm a **cross origin** config that names a UMD plugin, which is the right
50
+ thing for it to do and put a dialog headed "Warning" in front of a README link.
51
+ Served from the origin the JBrowse is on, the question does not arise.
52
+
53
+ It also means the demo is not waiting on a release. `pnpm demos:upload` puts the
54
+ **built** bundle there, so what a link opens is the code the figures below were
55
+ taken from, and each link is the same session spec its figure was taken from —
56
+ so the demo, the screenshot and the numbers are three renderings of one window.
57
+
12
58
  ## Gallery
13
59
 
14
60
  ![tview expanding a non-reference insertion](img/tview-insertion.png)
@@ -39,7 +85,7 @@ The ABCA7 VNTR in one PacBio HiFi sample, a copy per block of columns. Every row
39
85
  carries its copy count, and the rows sort by it, so the genotype is the step in
40
86
  the ladder — the two alleles the table below reports for HG003, with a scatter
41
87
  of reads between them. Laid out base by base this is 2.2kb of sequence with
42
- nothing to line it up against.
88
+ nothing to line it up against. [Open this one live][tview-demo-abca7].
43
89
 
44
90
  ### An array is an interval, not an insertion
45
91
 
@@ -54,15 +100,24 @@ inside, minus what it deleted. Everything else follows from that:
54
100
  so an aligner anchors different reads at different positions; measured over an
55
101
  interval those choices cancel. ATXN3 in HG002 reported as four separate arrays
56
102
  when anchored on insertions, splitting one locus's alleles across four counts.
57
- - **The interval grows to the allele.** Measuring over an interval settles the
103
+ - **The allele comes to the interval.** Measuring over an interval settles the
58
104
  indels an aligner placed _inside_ it. It settles nothing about the ones it
59
105
  placed just outside, and an aligner will happily anchor an expansion at the
60
106
  base before the array starts: there the insertion belongs to no allele, so it
61
107
  becomes a run of columns of its own and the read carrying it is counted as if
62
- it matched the reference. An array therefore widens over an insertion within
63
- one copy of its edge whose sequence is the array's own unit. At ATXN3 that is
64
- 60 of 162 reads, and it is the difference between HG004 reading as 8/8 with
65
- three odd reads and reading as 8/21.
108
+ it matched the reference. Each read's insertions are therefore re-filed under
109
+ the array they belong to before anything is measured — within a flank of 25bp
110
+ or one copy, whichever is larger, and only where the array's own unit explains
111
+ the inserted sequence. At ATXN3 that is most of the reads carrying an
112
+ expansion, and it is the difference between HG004 reading as 8/8 with three
113
+ odd reads and reading as 8/21.
114
+
115
+ Re-filing a read's insertions is not the same as moving the interval, and the
116
+ difference is the point. The interval is a property of the reference, so one
117
+ read's misplacement stays that read's; widening it instead made a single
118
+ spurious copy anchored two bases early move the array's left edge for every
119
+ row, and the reference's own copy count with it.
120
+
66
121
  - **Every spanning read is counted**, including the ones that match the
67
122
  reference exactly — usually the commonest allele, and invisible to anything
68
123
  keyed on insertions.
@@ -93,10 +148,17 @@ is sound; reading across two is a hypothesis.
93
148
  known loci with the same plan builder the view runs. **Every number in this
94
149
  section is written by `pnpm readme:repeats` and checked by
95
150
  `pnpm readme:repeats --check`**, so it is a rendering of a measurement rather
96
- than a figure typed once that nothing afterwards could contradict.
97
-
98
- A copy count is reported as one of a sample's alleles when at least 15% of that
99
- sample's spanning reads carry it, and never on one read. That is a report of
151
+ than a figure typed once that nothing afterwards could contradict. The
152
+ `Measurements` workflow runs that check weekly and whenever the plan builder
153
+ changes; it is kept out of Integration and out of `preversion` because a GIAB
154
+ outage is not a reason a commit cannot land or a release cannot go out.
155
+
156
+ An allele is a copy count carrying at least 15% of a sample's spanning reads,
157
+ and never one read. Reads scatter around an allele, so a count also collects the
158
+ reads in its skirt: those within a tenth of its size that carry less than a
159
+ third of its support. Both halves are needed — no distance separates FMR1's
160
+ mother's two alleles, which are one copy apart, from HTT's single allele with a
161
+ shoulder one copy either side, and relative support does. That is a report of
100
162
  what the reads say and not a genotype call — it knows no ploidy, so a homozygote
101
163
  and a haploid locus both come back as one number. Read that way, every locus
102
164
  with variation to check is Mendelian:
@@ -109,9 +171,9 @@ with variation to check is Mendelian:
109
171
  | ATXN3 (CTG) | 8 | 15 / 17 | 8 / 21 | 17 / 21 |
110
172
  | TCF4 CTG18.1 | 38 | 25 / 46 | 28 / 38 | 28 / 46 |
111
173
  | DMPK (CTG) | 21 | 12 / 14 | 6 / 12 | 12 |
112
- | FMR1 (CGG), X | 22 | 31 | 32 / 33 | 33 |
174
+ | FMR1 (CGG), X | 21 | 30 | 31 / 32 | 32 |
113
175
  | C9orf72 (GGGGCC) | 4 | 3 | 3 | 3 |
114
- | ABCA7 VNTR | 20 | 21 / 89 | 22 / 26 | 22 |
176
+ | ABCA7 VNTR | 19 | 20 / 88 | 21 / 25 | 21 |
115
177
 
116
178
  <!-- /repeat-genotypes -->
117
179
 
@@ -137,13 +199,13 @@ mother with two, with the son's allele one of hers.
137
199
 
138
200
  | locus | array | spanning reads | on an allele | off one |
139
201
  | ---------------- | ------------------ | -------------- | ------------ | ------- |
140
- | HTT (CAG) | 97bp of 3bp unit | 176 | 148 | 28 |
141
- | ATXN3 (CTG) | 25bp of 3bp unit | 151 | 118 | 33 |
142
- | TCF4 CTG18.1 | 113bp of 3bp unit | 169 | 114 | 55 |
143
- | DMPK (CTG) | 62bp of 3bp unit | 129 | 118 | 11 |
144
- | FMR1 (CGG), X | 64bp of 3bp unit | 123 | 109 | 14 |
145
- | C9orf72 (GGGGCC) | 23bp of 6bp unit | 210 | 209 | 1 |
146
- | ABCA7 VNTR | 485bp of 25bp unit | 27 | 19 | 8 |
202
+ | HTT (CAG) | 97bp of 3bp unit | 176 | 176 | 0 |
203
+ | ATXN3 (CTG) | 24bp of 3bp unit | 154 | 149 | 5 |
204
+ | TCF4 CTG18.1 | 113bp of 3bp unit | 169 | 141 | 28 |
205
+ | DMPK (CTG) | 62bp of 3bp unit | 129 | 129 | 0 |
206
+ | FMR1 (CGG), X | 62bp of 3bp unit | 123 | 122 | 1 |
207
+ | C9orf72 (GGGGCC) | 23bp of 6bp unit | 210 | 210 | 0 |
208
+ | ABCA7 VNTR | 466bp of 25bp unit | 27 | 20 | 7 |
147
209
 
148
210
  <!-- /repeat-spread -->
149
211
 
@@ -151,18 +213,27 @@ The off-allele reads at ABCA7 are the same handful the row before it is measured
151
213
  on, which is what "noisy" means at that locus rather than a proportion to
152
214
  compare with the STRs above.
153
215
 
216
+ They are still real sequence. HG003's long alleles were read back at base level:
217
+ the 1,207bp and 764bp insertions the aligner anchored 19bp outside the array are
218
+ the VNTR's own 25bp unit, entered at offset 6 — expansions, not a chimeric join
219
+ or a mismapping, which is why re-filing them under the array rather than leaving
220
+ them beside it is what the count depends on.
221
+
154
222
  ### Several samples at once
155
223
 
156
224
  ![FMR1 CGG in the GIAB trio](img/repeat-fmr1-trio.png)
157
225
 
158
226
  The FMR1 CGG repeat in the GIAB Ashkenazi trio, all three files in one
159
227
  alignment. Rows are grouped into a clade per sample by a synthetic tree, which
160
- turns on react-msaview's collapse and show-only controls for free.
228
+ turns on react-msaview's collapse and show-only controls for free. [Open this
229
+ one live][tview-demo-fmr1] and those controls are the point: collapse a clade
230
+ and the other two samples close up against each other.
161
231
 
162
232
  The copy numbers are checkable, which is the point of this locus: FMR1 is on the
163
- X, so the two male samples come back with one allele each (HG002 33, HG003 31)
164
- and the mother with two (32 and 33) — and the son's single allele is one of his
165
- mother's, as an X-linked allele has to be.
233
+ X, so the two male samples come back with one allele each and the mother with
234
+ two, and the son's single allele is one of his mother's, as an X-linked allele
235
+ has to be. The counts are in the genotype table above, where they are measured
236
+ rather than typed.
166
237
 
167
238
  Two things about this figure are settings rather than data, and both are there
168
239
  because a column costs the same whether 124 rows use it or one does:
@@ -177,10 +248,10 @@ because a column costs the same whether 124 rows use it or one does:
177
248
 
178
249
  | figure | rows | columns | columns one row has | hidden |
179
250
  | ---------------------------------- | ---- | ------- | ------------------- | ------ |
180
- | [fmr1](img/repeat-fmr1-trio.png) | 124 | 222 | 29 | 13% |
251
+ | [fmr1](img/repeat-fmr1-trio.png) | 124 | 218 | 24 | 11% |
181
252
  | [htt](img/repeat-htt-trio.png) | 182 | 222 | 25 | 11% |
182
- | [atxn3](img/repeat-atxn3-trio.png) | 157 | 159 | 15 | 9% |
183
- | [abca7](img/repeat-abca7-vntr.png) | 16 | 3614 | 1239 | 34% |
253
+ | [atxn3](img/repeat-atxn3-trio.png) | 157 | 159 | 18 | 11% |
254
+ | [abca7](img/repeat-abca7-vntr.png) | 16 | 3630 | 1253 | 35% |
184
255
 
185
256
  <!-- /repeat-figures -->
186
257
 
@@ -249,7 +320,7 @@ a tview at FMR1 open on load.
249
320
 
250
321
  Needs a JBrowse build shipping `@jbrowse/core` >=4.3 with MUI 9 — currently
251
322
  jbrowse-web nightly. On JBrowse 4.3.0 the bundle fails to load, because
252
- react-msaview 5.x needs `@jbrowse/mobx-state-tree` 5.13 APIs and MUI 9 icon
323
+ react-msaview 6.x needs `@jbrowse/mobx-state-tree` 5.13 APIs and MUI 9 icon
253
324
  internals that the 4.3.0 release does not ship.
254
325
 
255
326
  ## Development
@@ -263,14 +334,55 @@ pnpm lint
263
334
  pnpm build
264
335
 
265
336
  pnpm figures:repeats # the tandem-repeat figures in img/
266
- pnpm qc:repeats # copy numbers at known loci, from live GIAB data
337
+ pnpm report:repeats # copy numbers at known loci, from live GIAB data
338
+ pnpm demos # public/demo.json and the live-demo links above
339
+ pnpm demos:upload # ...and push both to jbrowse.org/demos/tview/
267
340
  ```
268
341
 
269
- `qc:repeats` is not a test. It fetches from GIAB and UCSC and prints what the
270
- plan builder measured at each locus, per sample, so the numbers can be read
342
+ `demos` regenerates the hosted config from `public/repeats.json` and the links
343
+ from the same figure definitions, so the demo, the screenshot and the numbers
344
+ are three renderings of one window. It needs no network, so `pnpm demos --check`
345
+ runs in Integration on every push, where the measured tables have to wait for
346
+ the weekly Measurements run.
347
+
348
+ `demos:upload` builds first, then writes `config.json`, `plugin.js` and an
349
+ `index.html` under `s3://jbrowse.org/demos/tview/` and invalidates that path.
350
+ The index is only there so the folder itself is a link rather than a 404 for
351
+ whoever trims one of the long ones. It needs AWS credentials for the bucket, so
352
+ it is a thing a maintainer runs and not a thing CI does — and it is the only
353
+ step between a change here and what the links open.
354
+
355
+ A figure is only as good as what it draws: react-msaview stops drawing tree
356
+ labels below `minLetterRowHeight`, and the copy counts are in those labels, so
357
+ `figures:repeats` asks the view what it actually drew and warns when a figure
358
+ came out without them.
359
+
360
+ `report:repeats` is not a test. It fetches from GIAB and UCSC and prints what
361
+ the plan builder measured at each locus, per sample, so the numbers can be read
271
362
  against what the locus is known to carry — Mendelian consistency across the
272
363
  trio, hemizygosity on the X, published allele ranges. The loci and samples live
273
- in `test/liveRepeatsData.ts`.
364
+ in `scripts/lib/giabTrio.mjs`, which the figures are defined against too, so a
365
+ figure and the numbers beside it cannot be of different windows.
366
+
367
+ It measures whatever it is pointed at, and can photograph it with the same
368
+ harness the figures above use:
369
+
370
+ ```bash
371
+ pnpm report:repeats \
372
+ --bam HG002=https://host/HG002.bam \
373
+ --loc chrX:146,993,530..146,993,670 \
374
+ --genome hg19 --ref-name X \
375
+ --figure img/fmr1.png
376
+ ```
377
+
378
+ `--genome` is a UCSC genome: the reference bases come from the UCSC API and, for
379
+ `--figure`, the browser's assembly is built from UCSC's 2bit and chromAlias, so
380
+ `--ref-name` is only about what the BAM calls the same sequence.
381
+ `--fasta <indexed.fa>` reads them off disk instead, which is what a reference
382
+ UCSC does not host needs — there are no aliases to be had that way, so the locus
383
+ has to be written the way the FASTA names it. A figure can only be taken of
384
+ files the browser can load: a url, or a path under the repo, which is what the
385
+ dev server serves.
274
386
 
275
387
  `pnpm start` serves the repo root, so a JBrowse instance unpacked at
276
388
  `.test-jbrowse` can load the plugin from the same origin via
@@ -40,15 +40,20 @@ export declare function detectPeriod(seq: string): number | undefined;
40
40
  */
41
41
  export declare function consensusUnit(seq: string, period: number): string;
42
42
  /**
43
- * How much of `seq` is explained by `unit` repeated end to end: the fraction of
44
- * `seq`'s bases that align to a matching base of the tiling.
43
+ * How much of `seq` is explained by `unit` repeated end to end, scored at three
44
+ * places along it and reported as the worst of them.
45
45
  *
46
- * Free at both ends of the tiling, since an inserted run of copies can start
47
- * and stop mid-copy, and global on `seq`, since the question is about all of it.
48
- * That is what separates "more copies of this array" from "something else that
49
- * landed next to it" without asking the sequence to be in phase with the unit:
50
- * measured against the trio, the repeat alleles the aligner anchored just
51
- * outside an array score 0.94-1.00 and unrelated sequence of the same length
46
+ * Each window is aligned free at both ends of the tiling, since an inserted run
47
+ * of copies can start and stop mid-copy, and global on the window, since the
48
+ * question is about all of it. That is what separates "more copies of this
49
+ * array" from "something else that landed next to it" without asking the
50
+ * sequence to be in phase with the unit — the ABCA7 read that carries 1207bp of
51
+ * VNTR anchored outside the array begins six bases into a copy, and the FMR1
52
+ * one begins on the wrong base of the unit and carries the locus's own AGG
53
+ * interruptions.
54
+ *
55
+ * Measured against the trio: the repeat alleles the aligner anchored just
56
+ * outside an array score 0.9 and up, and unrelated sequence of the same length
52
57
  * scores 0.67 or below.
53
58
  */
54
59
  export declare function unitIdentity(seq: string, unit: string): number;
@@ -89,6 +94,13 @@ export declare function alignPeriodicInsertions(seqs: string[]): PeriodicAlignme
89
94
  * which is a guess that one chimeric read overturns for the whole site. Measured
90
95
  * off the reference, it is a property of the locus, so every read is laid out
91
96
  * against the same unit whatever the reads happen to be.
97
+ *
98
+ * An empty sequence is one of the alleles, not a missing one: a row that
99
+ * deletes the whole array carries nought copies of it, which is a measurement
100
+ * and the most extreme contraction there is. It splits into no units and so
101
+ * lays out as a row of gaps the width of the block, which is what a deletion
102
+ * should look like. Dropping it instead left that row indistinguishable from
103
+ * one that never reached the array at all.
92
104
  */
93
105
  export declare function alignToUnit(seqs: string[], consensus: string): PeriodicAlignment | undefined;
94
106
  export interface InsertionAlignment {
@@ -260,24 +260,32 @@ function splitIntoUnits(seq, consensus) {
260
260
  }
261
261
  return units;
262
262
  }
263
- // The tiled alignment below is O(len * len), so it scores a prefix rather than
264
- // the whole insert. A sequence that is copies of the unit for its first 300
265
- // bases is copies of the unit.
263
+ // The tiled alignment below is O(len^2), so it scores windows of the insert
264
+ // rather than all of it.
266
265
  const IDENTITY_PROBE_LEN = 300;
267
266
  /**
268
- * How much of `seq` is explained by `unit` repeated end to end: the fraction of
269
- * `seq`'s bases that align to a matching base of the tiling.
267
+ * Head, middle and tail of `seq`, or the whole of it when it is short enough to
268
+ * score outright.
270
269
  *
271
- * Free at both ends of the tiling, since an inserted run of copies can start
272
- * and stop mid-copy, and global on `seq`, since the question is about all of it.
273
- * That is what separates "more copies of this array" from "something else that
274
- * landed next to it" without asking the sequence to be in phase with the unit:
275
- * measured against the trio, the repeat alleles the aligner anchored just
276
- * outside an array score 0.94-1.00 and unrelated sequence of the same length
277
- * scores 0.67 or below.
270
+ * Scoring only the head is how a prefix probe lies: `unit x 12` followed by a
271
+ * kilobase of something else scores 1.00 on its first 300 bases and is not the
272
+ * array's. Three windows cost the same and cannot be fooled that way, because
273
+ * the sequence has to still be the unit where it ends as well as where it
274
+ * starts.
278
275
  */
279
- export function unitIdentity(seq, unit) {
280
- const probe = seq.length > IDENTITY_PROBE_LEN ? seq.slice(0, IDENTITY_PROBE_LEN) : seq;
276
+ function probeWindows(seq) {
277
+ if (seq.length <= IDENTITY_PROBE_LEN) {
278
+ return [seq];
279
+ }
280
+ const middle = Math.floor((seq.length - IDENTITY_PROBE_LEN) / 2);
281
+ return [
282
+ seq.slice(0, IDENTITY_PROBE_LEN),
283
+ seq.slice(middle, middle + IDENTITY_PROBE_LEN),
284
+ seq.slice(-IDENTITY_PROBE_LEN),
285
+ ];
286
+ }
287
+ /** the fraction of `probe`'s bases that match `unit` tiled end to end */
288
+ function tiledIdentity(probe, unit) {
281
289
  const n = probe.length;
282
290
  if (!n || !unit.length) {
283
291
  return 0;
@@ -319,6 +327,26 @@ export function unitIdentity(seq, unit) {
319
327
  }
320
328
  return bestMatches / n;
321
329
  }
330
+ /**
331
+ * How much of `seq` is explained by `unit` repeated end to end, scored at three
332
+ * places along it and reported as the worst of them.
333
+ *
334
+ * Each window is aligned free at both ends of the tiling, since an inserted run
335
+ * of copies can start and stop mid-copy, and global on the window, since the
336
+ * question is about all of it. That is what separates "more copies of this
337
+ * array" from "something else that landed next to it" without asking the
338
+ * sequence to be in phase with the unit — the ABCA7 read that carries 1207bp of
339
+ * VNTR anchored outside the array begins six bases into a copy, and the FMR1
340
+ * one begins on the wrong base of the unit and carries the locus's own AGG
341
+ * interruptions.
342
+ *
343
+ * Measured against the trio: the repeat alleles the aligner anchored just
344
+ * outside an array score 0.9 and up, and unrelated sequence of the same length
345
+ * scores 0.67 or below.
346
+ */
347
+ export function unitIdentity(seq, unit) {
348
+ return Math.min(...probeWindows(seq).map(w => tiledIdentity(w, unit)));
349
+ }
322
350
  /**
323
351
  * Unit-per-block alignment of the sequences inserted at one reference position.
324
352
  *
@@ -354,11 +382,18 @@ export function alignPeriodicInsertions(seqs) {
354
382
  * which is a guess that one chimeric read overturns for the whole site. Measured
355
383
  * off the reference, it is a property of the locus, so every read is laid out
356
384
  * against the same unit whatever the reads happen to be.
385
+ *
386
+ * An empty sequence is one of the alleles, not a missing one: a row that
387
+ * deletes the whole array carries nought copies of it, which is a measurement
388
+ * and the most extreme contraction there is. It splits into no units and so
389
+ * lays out as a row of gaps the width of the block, which is what a deletion
390
+ * should look like. Dropping it instead left that row indistinguishable from
391
+ * one that never reached the array at all.
357
392
  */
358
393
  export function alignToUnit(seqs, consensus) {
359
- const distinct = [...new Set(seqs)].filter(s => s.length > 0);
394
+ const distinct = [...new Set(seqs)];
360
395
  const period = consensus.length;
361
- if (!distinct.length || period < MIN_UNIT_PERIOD) {
396
+ if (!distinct.some(s => s.length) || period < MIN_UNIT_PERIOD) {
362
397
  return undefined;
363
398
  }
364
399
  const totalUnits = distinct.reduce((a, s) => a + Math.ceil(s.length / period), 0);
@@ -1 +1 @@
1
- {"version":3,"file":"align.js","sourceRoot":"","sources":["../../src/LaunchTView/align.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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,+EAA+E;AAC/E,gFAAgF;AAChF,2E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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
44
  /**
50
- * Widen each array to cover the insertions the aligner anchored just outside it
51
- * that are made of the array's own unit.
45
+ * `ins`, inserted before reference position `from`, rewritten as an insertion
46
+ * before `to` — or undefined when the read's own bases do not allow it.
52
47
  *
53
- * An allele is measured over a reference interval, which fixes the "one array
54
- * reports as several sites" problem for indels the aligner placed *inside* the
55
- * interval. It does not fix the ones it placed just outside: an aligner is free
56
- * to anchor an expansion at the base before the array starts, and there the
57
- * insertion is not part of any allele — it is left to become its own run of
58
- * insertion columns, and the read it belongs to is measured as if it carried
59
- * the reference allele. Both halves of that are wrong, and they are not rare:
60
- * at ATXN3 the aligner anchored 60 of 162 reads' expansions one base outside
61
- * the array, and at ABCA7 a 1207bp allele 19 bases outside.
48
+ * An insertion has no unique position. `S` before a base `b` and `rotate(S)`
49
+ * after it spell the same read, so an aligner is free to anchor an expansion
50
+ * outside the array it belongs to, and at ATXN3 it did exactly that for most of
51
+ * the reads carrying one. Walking an indel through that equivalence class is
52
+ * the standard normalization for it (Tan, Abecasis & Kang, "Unified
53
+ * representation of genetic variants", Bioinformatics 31, 2015,
54
+ * doi:10.1093/bioinformatics/btv112, which walks left; this walks toward the
55
+ * array, the same operation with the array as the canonical anchor).
62
56
  *
63
- * What is absorbed is decided by the inserted sequence, not by the count of
64
- * reads carrying it — a single read's expansion is as real as fifty, and the
65
- * whole point of measuring over an interval is that it does not need a vote.
66
- * Widening the interval costs every row the few reference bases in between,
67
- * which they all pay equally, so the counts stay comparable.
57
+ * The step is tested against the **read's** aligned base rather than the
58
+ * reference's, which is what makes the rewrite exact: the row still renders
59
+ * base for base as it did, and the only thing that changes is the reference
60
+ * position the bases are filed under. A step onto a deletion has no base to
61
+ * swap with and stops.
62
+ *
63
+ * Being exact, it is also incomplete, and measurably so. An aligner does not
64
+ * only choose among equivalent placements — it chooses the highest-scoring one,
65
+ * which for a repeat allele carrying an interruption is often not equivalent to
66
+ * any placement inside the array. FMR1's misplaced read is exactly that: 32bp
67
+ * of the locus's own CGG anchored two bases early, starting on a `C` where the
68
+ * read has a `G`, so no rewrite of it exists. Hence `reanchorInsertions` treats
69
+ * this as the preferred spelling and not as the test of whether to move.
68
70
  */
69
- export declare function absorbAdjacentInsertions(reads: ReadLayout[], arrays: ReferenceArray[]): {
70
- start: number;
71
- end: number;
72
- period: number;
73
- unit: string;
74
- }[];
71
+ export declare function shiftInsertion(read: ReadLayout, from: number, to: number, ins: string): string | undefined;
72
+ /** an array with the span of reference positions whose insertions it may claim */
73
+ interface FlankWindow {
74
+ array: ReferenceArray;
75
+ from: number;
76
+ to: number;
77
+ }
78
+ /**
79
+ * The window around each array that its insertions may be re-anchored from.
80
+ *
81
+ * Two arrays may not claim one position: `extractAllele` reads the slot at an
82
+ * array's `end`, so a shared slot would be counted into two alleles. Neighbours
83
+ * split the reference between them down the middle — a property of the
84
+ * reference alone, so unlike the interval it replaces, no read can move it.
85
+ */
86
+ export declare function flankWindows(arrays: ReferenceArray[]): FlankWindow[];
87
+ /**
88
+ * Re-file each read's insertions under the array they belong to, one read at a
89
+ * time.
90
+ *
91
+ * Measuring an allele over a reference interval fixes the "one array reports as
92
+ * several sites" problem for indels the aligner placed *inside* the interval.
93
+ * It does not fix the ones placed just outside: there the insertion is part of
94
+ * no allele — it becomes its own run of insertion columns — and the read
95
+ * carrying it is measured as though it had the reference allele. Both halves of
96
+ * that are wrong, and neither is rare: at ATXN3 the aligner anchored 60 of 162
97
+ * reads' expansions one base outside the array.
98
+ *
99
+ * Doing this per read is the whole point. Widening the shared interval instead
100
+ * — which is what this replaces — made one read's misplacement everyone's: a
101
+ * single spurious copy anchored two bases early moved the array's left edge for
102
+ * every row, and the reference's own copy count with it. Re-anchoring touches
103
+ * only the read that carries the insertion, so a read can be wrong on its own.
104
+ *
105
+ * Nothing here consults the other reads, or how many of them agree. A single
106
+ * read's expansion is as real as fifty, which is what measuring over an
107
+ * interval buys and what a vote would give back. What decides an insertion is
108
+ * its own sequence: `unitIdentity` against the array's unit, since the aligner
109
+ * is free to place a repeat allele outside the array but is not free to make
110
+ * unrelated sequence out of the array's unit.
111
+ */
112
+ export declare function reanchorInsertions(reads: ReadLayout[], arrays: ReferenceArray[]): ReadLayout[];
75
113
  /**
76
114
  * Lay every row's allele out unit-per-block, one block per array.
77
115
  *
@@ -81,3 +119,4 @@ export declare function absorbAdjacentInsertions(reads: ReadLayout[], arrays: Re
81
119
  * rows disagree.
82
120
  */
83
121
  export declare function buildArrayBlocks(reads: ReadLayout[], arrays: ReferenceArray[]): ArrayBlock[];
122
+ export {};