jbrowse-plugin-tview 2.2.3 → 3.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 (110) hide show
  1. package/README.md +325 -106
  2. package/dist/AddHighlightModel/index.js +2 -13
  3. package/dist/AddHighlightModel/index.js.map +1 -1
  4. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.d.ts +44 -64
  5. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js +57 -81
  6. package/dist/LaunchTView/TviewGetPlanRpc/TviewGetPlan.js.map +1 -1
  7. package/dist/LaunchTView/TviewGetPlanRpc/index.d.ts +1 -1
  8. package/dist/LaunchTView/align.d.ts +11 -17
  9. package/dist/LaunchTView/align.js +190 -150
  10. package/dist/LaunchTView/align.js.map +1 -1
  11. package/dist/LaunchTView/alleles.d.ts +51 -0
  12. package/dist/LaunchTView/alleles.js +213 -0
  13. package/dist/LaunchTView/alleles.js.map +1 -1
  14. package/dist/LaunchTView/fetchTviewPlan.d.ts +5 -37
  15. package/dist/LaunchTView/fetchTviewPlan.js +7 -28
  16. package/dist/LaunchTView/fetchTviewPlan.js.map +1 -1
  17. package/dist/LaunchTView/index.js +45 -16
  18. package/dist/LaunchTView/index.js.map +1 -1
  19. package/dist/LaunchTView/launch.d.ts +50 -0
  20. package/dist/LaunchTView/launch.js +48 -0
  21. package/dist/LaunchTView/launch.js.map +1 -0
  22. package/dist/LaunchTView/launchView.d.ts +3 -8
  23. package/dist/LaunchTView/launchView.js +18 -12
  24. package/dist/LaunchTView/launchView.js.map +1 -1
  25. package/dist/LaunchTView/modifications.d.ts +64 -0
  26. package/dist/LaunchTView/modifications.js +131 -0
  27. package/dist/LaunchTView/modifications.js.map +1 -0
  28. package/dist/LaunchTView/readLayout.d.ts +35 -39
  29. package/dist/LaunchTView/readLayout.js +44 -24
  30. package/dist/LaunchTView/readLayout.js.map +1 -1
  31. package/dist/LaunchTView/repeatStats.d.ts +1 -1
  32. package/dist/LaunchTView/repeatStats.js +6 -21
  33. package/dist/LaunchTView/repeatStats.js.map +1 -1
  34. package/dist/LaunchTView/tview.d.ts +34 -23
  35. package/dist/LaunchTView/tview.js +133 -78
  36. package/dist/LaunchTView/tview.js.map +1 -1
  37. package/dist/TViewPanel/components/TViewPanel.js +9 -4
  38. package/dist/TViewPanel/components/TViewPanel.js.map +1 -1
  39. package/dist/TViewPanel/genome.d.ts +11 -0
  40. package/dist/TViewPanel/genome.js +32 -0
  41. package/dist/TViewPanel/genome.js.map +1 -0
  42. package/dist/TViewPanel/init.d.ts +38 -19
  43. package/dist/TViewPanel/init.js +66 -39
  44. package/dist/TViewPanel/init.js.map +1 -1
  45. package/dist/TViewPanel/initMenu.d.ts +28 -0
  46. package/dist/TViewPanel/initMenu.js +79 -0
  47. package/dist/TViewPanel/initMenu.js.map +1 -0
  48. package/dist/TViewPanel/model.d.ts +1090 -334
  49. package/dist/TViewPanel/model.js +295 -89
  50. package/dist/TViewPanel/model.js.map +1 -1
  51. package/dist/TViewPanel/modifications.d.ts +25 -0
  52. package/dist/TViewPanel/modifications.js +94 -0
  53. package/dist/TViewPanel/modifications.js.map +1 -0
  54. package/dist/index.d.ts +0 -1
  55. package/dist/index.js +0 -1
  56. package/dist/index.js.map +1 -1
  57. package/dist/jbrowse-plugin-tview.umd.production.min.js +125 -88
  58. package/dist/jbrowse-plugin-tview.umd.production.min.js.map +4 -4
  59. package/dist/version.d.ts +1 -1
  60. package/dist/version.js +1 -1
  61. package/package.json +8 -8
  62. package/src/AddHighlightModel/index.tsx +8 -14
  63. package/src/LaunchTView/TviewGetPlanRpc/TviewGetPlan.ts +119 -157
  64. package/src/LaunchTView/TviewGetPlanRpc/index.ts +0 -1
  65. package/src/LaunchTView/align.ts +225 -176
  66. package/src/LaunchTView/alleles.ts +272 -0
  67. package/src/LaunchTView/fetchTviewPlan.ts +11 -54
  68. package/src/LaunchTView/index.ts +74 -16
  69. package/src/LaunchTView/launch.ts +98 -0
  70. package/src/LaunchTView/launchView.ts +28 -20
  71. package/src/LaunchTView/modifications.ts +200 -0
  72. package/src/LaunchTView/readLayout.ts +65 -41
  73. package/src/LaunchTView/repeatStats.ts +7 -23
  74. package/src/LaunchTView/tview.ts +165 -91
  75. package/src/TViewPanel/components/TViewPanel.tsx +30 -5
  76. package/src/TViewPanel/genome.ts +41 -0
  77. package/src/TViewPanel/init.ts +104 -51
  78. package/src/TViewPanel/initMenu.ts +126 -0
  79. package/src/TViewPanel/model.ts +346 -97
  80. package/src/TViewPanel/modifications.ts +132 -0
  81. package/src/index.ts +0 -2
  82. package/src/version.ts +1 -1
  83. package/dist/AddHighlightModel/GenomeMouseoverHighlight.d.ts +0 -6
  84. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js +0 -23
  85. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +0 -1
  86. package/dist/AddHighlightModel/HighlightComponents.d.ts +0 -7
  87. package/dist/AddHighlightModel/HighlightComponents.js +0 -11
  88. package/dist/AddHighlightModel/HighlightComponents.js.map +0 -1
  89. package/dist/LaunchTView/components/ArrayReport.d.ts +0 -10
  90. package/dist/LaunchTView/components/ArrayReport.js +0 -59
  91. package/dist/LaunchTView/components/ArrayReport.js.map +0 -1
  92. package/dist/LaunchTView/components/LaunchTViewDialog.d.ts +0 -6
  93. package/dist/LaunchTView/components/LaunchTViewDialog.js +0 -124
  94. package/dist/LaunchTView/components/LaunchTViewDialog.js.map +0 -1
  95. package/dist/LaunchTView/sampleTree.d.ts +0 -37
  96. package/dist/LaunchTView/sampleTree.js +0 -65
  97. package/dist/LaunchTView/sampleTree.js.map +0 -1
  98. package/dist/LaunchTView/useTviewMsa.d.ts +0 -18
  99. package/dist/LaunchTView/useTviewMsa.js +0 -24
  100. package/dist/LaunchTView/useTviewMsa.js.map +0 -1
  101. package/dist/TViewPanel/coords.d.ts +0 -25
  102. package/dist/TViewPanel/coords.js +0 -56
  103. package/dist/TViewPanel/coords.js.map +0 -1
  104. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +0 -46
  105. package/src/AddHighlightModel/HighlightComponents.tsx +0 -25
  106. package/src/LaunchTView/components/ArrayReport.tsx +0 -64
  107. package/src/LaunchTView/components/LaunchTViewDialog.tsx +0 -212
  108. package/src/LaunchTView/sampleTree.ts +0 -73
  109. package/src/LaunchTView/useTviewMsa.ts +0 -39
  110. package/src/TViewPanel/coords.ts +0 -65
package/README.md CHANGED
@@ -1,38 +1,121 @@
1
1
  # jbrowse-plugin-tview
2
2
 
3
- Loads BAM/CRAM read pileups into
4
- [react-msaview](https://github.com/GMOD/react-msaview) for a `samtools tview`
5
- style interface inside JBrowse 2.
3
+ Loads BAM/CRAM reads into [react-msaview](https://github.com/GMOD/react-msaview)
4
+ as a multiple alignment, for a `samtools tview` style view inside JBrowse 2.
5
+
6
+ Because the reads are laid out as a multiple alignment, a non-reference
7
+ insertion gets columns of its own instead of a marker: every read that inserts
8
+ at a site contributes its bases there, and the other reads are padded so the
9
+ reference columns still line up. The reference is the top row, and a copy of it
10
+ is pinned above the alignment. A base that matches it draws as a dot, so the
11
+ colours in a row mark where that read differs. Rows are grouped in a band per
12
+ sample, and labelled brackets above the alignment mark the insertion sites and
13
+ tandem arrays.
6
14
 
7
- Because the reads are laid out as a multiple alignment, non-reference insertions
8
- get their own columns instead of being collapsed into a marker: every read that
9
- inserts at a position contributes its bases, and reads without that insertion
10
- are padded so the reference columns still line up.
15
+ ## Gallery
16
+
17
+ Each picture opens full size, and the ones of the GIAB trio also open as a
18
+ [live demo](#live-demos).
19
+
20
+ <table>
21
+ <tr>
22
+ <td width="50%" valign="top">
23
+
24
+ <a href="img/insertion-alu.png"><img src="img/insertion-alu.png" width="380" alt="An Alu insertion in HG002, as a JBrowse pileup above and a tview below"></a>
25
+
26
+ An Alu insertion in HG002: a box per read in the pileup, 294 aligned columns in
27
+ the tview. [Live demo][tview-demo-alu]
28
+
29
+ </td>
30
+ <td width="50%" valign="top">
31
+
32
+ <a href="img/insertion-alu-trio.png"><img src="img/insertion-alu-trio.png" width="380" alt="The same Alu insertion in the GIAB trio, one band per sample"></a>
33
+
34
+ The NPHP4 Alu in a band per sample: the son and the father have it, the mother
35
+ does not. [Live demo][tview-demo-alu-trio]
36
+
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <td width="50%" valign="top">
41
+
42
+ <a href="img/tview-insertion.png"><img src="img/tview-insertion.png" width="380" alt="A 1bp insertion in the volvox test reads, with its bracket and residue letters"></a>
43
+
44
+ A 1bp insertion up close: one bracketed column, and a dot for each base that
45
+ matches the reference.
46
+
47
+ </td>
48
+ <td width="50%" valign="top">
49
+
50
+ <a href="img/repeat-atxn3-hg004.png"><img src="img/repeat-atxn3-hg004.png" width="380" alt="The ATXN3 CTG repeat in HG004, a block per copy, rows sorted by copy count"></a>
51
+
52
+ ATXN3 in HG004, a block per CTG copy, rows sorted from 21 copies down to the
53
+ reference's 8. [Live demo][tview-demo-atxn3-hg004]
54
+
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td colspan="2" valign="top">
59
+
60
+ <a href="img/repeat-abca7-vntr.png"><img src="img/repeat-abca7-vntr.png" width="780" alt="The ABCA7 VNTR in HG003, a block per 25bp copy, with each row's copy count as a bar and a number"></a>
61
+
62
+ The ABCA7 VNTR in HG003, a block per 25bp copy, rows sorted from 134 copies
63
+ down, each with its count as a bar and a number. [Live demo][tview-demo-abca7]
64
+
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <td width="50%" valign="top">
69
+
70
+ <a href="img/tview-modifications-bases.png"><img src="img/tview-modifications-bases.png" width="380" alt="Nanopore reads with 5mC calls, each called base filled from blue at 0% to red at 100%, over the base colours"></a>
71
+
72
+ **Over base colors**: each called base filled from blue (0%) to red (100%), and
73
+ every other mismatch in its base colour.
74
+
75
+ </td>
76
+ <td width="50%" valign="top">
77
+
78
+ <a href="img/tview-modifications.png"><img src="img/tview-modifications.png" width="380" alt="The same reads with only the called bases filled"></a>
79
+
80
+ **Without base colors**: only the called bases are filled, one of them in an
81
+ inserted column.
82
+
83
+ </td>
84
+ </tr>
85
+ </table>
11
86
 
12
87
  ## Live demos
13
88
 
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.
89
+ Real human data, nothing to install. Each link opens reads from the GIAB
90
+ Ashkenazi trio (PacBio HiFi, GRCh37, streamed from GIAB's FTP) at an Alu
91
+ insertion or a tandem repeat.
18
92
 
19
93
  <!-- demo-links -->
20
94
 
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
-
95
+ | locus | window | what it shows | open |
96
+ | ---------------- | ----------------------------- | ----------------------------------------------------------------- | -------------------------------- |
97
+ | NPHP4 Alu, HG002 | chr1:5,934,190..5,934,390 | an Alu insertion in about half the reads, aligned base by base | [launch][tview-demo-alu] |
98
+ | NPHP4 Alu | chr1:5,934,190..5,934,390 | a band per sample: the son and the father have it, the mother not | [launch][tview-demo-alu-trio] |
99
+ | 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] |
100
+ | HTT | chr4:3,076,570..3,076,730 | the CAG tract, with a shoulder either side of one allele | [launch][tview-demo-htt] |
101
+ | ATXN3 | chr14:92,537,320..92,537,420 | the locus that reports as four arrays when anchored on insertions | [launch][tview-demo-atxn3] |
102
+ | ATXN3, HG004 | chr14:92,537,320..92,537,420 | the mother alone, a CTG ladder of two steps | [launch][tview-demo-atxn3-hg004] |
103
+ | ABCA7 | chr19:1,049,460..1,050,000 | a 25bp VNTR whose alleles run past 2kb | [launch][tview-demo-abca7] |
104
+
105
+ [tview-demo-alu]:
106
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%22%3A%22alu%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chr1%3A5%2C934%2C190..5%2C934%2C390%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%3A160%7D%7D%5D%7D%2C%7B%22id%22%3A%22tview%22%2C%22type%22%3A%22TView%22%2C%22displayName%22%3A%22alu%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr1%3A5%2C934%2C190..5%2C934%2C390%22%2C%22tracks%22%3A%5B%7B%22trackId%22%3A%22HG002%22%2C%22sample%22%3A%22HG002_son%22%7D%5D%2C%22connectedViewId%22%3A%22lgv%22%2C%22height%22%3A900%2C%22colWidth%22%3A3%2C%22rowHeight%22%3A8%2C%22treeAreaWidth%22%3A220%7D%5D%7D
107
+ [tview-demo-alu-trio]:
108
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%22%3A%22alu-trio%22%2C%22views%22%3A%5B%7B%22id%22%3A%22lgv%22%2C%22type%22%3A%22LinearGenomeView%22%2C%22loc%22%3A%22chr1%3A5%2C934%2C190..5%2C934%2C390%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%22alu-trio%22%2C%22assembly%22%3A%22hg19%22%2C%22loc%22%3A%22chr1%3A5%2C934%2C190..5%2C934%2C390%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%3A3%2C%22rowHeight%22%3A5%2C%22treeAreaWidth%22%3A220%7D%5D%7D
28
109
  [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
110
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%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%3A220%7D%5D%7D
30
111
  [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
112
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%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%3A220%7D%5D%7D
32
113
  [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
114
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%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%3A220%7D%5D%7D
115
+ [tview-demo-atxn3-hg004]:
116
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%22%3A%22atxn3-hg004%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%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-hg004%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%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%3A220%7D%5D%7D
34
117
  [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
118
+ https://jbrowse.org/code/jb2/main/index.html?config=/demos/tview/config.json&session=spec-%7B%22sessionName%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%3A900%2C%22colWidth%22%3A1%2C%22rowHeight%22%3A16%7D%5D%7D
36
119
 
37
120
  <!-- /demo-links -->
38
121
 
@@ -40,52 +123,115 @@ Nothing to accept and nothing to install: click one and wait for the reads,
40
123
  which take a few seconds since they arrive by range request and the alignment is
41
124
  built in a worker.
42
125
 
126
+ The links open the build a maintainer last uploaded with `pnpm demos:upload`,
127
+ which can be older than the figures in this README and look different from them.
128
+
43
129
  The demo lives at [jbrowse.org/demos/tview/](https://jbrowse.org/demos/tview/) —
44
130
  the config and the plugin bundle both, and that folder opens the first of them —
45
131
  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
-
58
- ## Gallery
59
-
60
- ![tview expanding a non-reference insertion](img/tview-insertion.png)
61
-
62
- The same reads at `ctgA:15,140..15,190`, twice. In the pileup above, the 1bp
63
- insertion at 15,163 is collapsed into a column of purple `(1)` markers. In the
64
- tview panel below it gets a real column (highlighted): reads carrying the
65
- insertion show their base, reads that span the position without it show `-`, and
66
- reads that do not cover it show `.` — so every row stays the same width and the
67
- reference columns still line up.
68
-
69
- Regenerate with `pnpm figure`; the tandem-repeat figures below come from
70
- `pnpm figures:repeats`.
132
+ nightly because the plugin needs a JBrowse v5 host (see
133
+ [Requirements](#requirements)). Hosting it there rather than pointing at a
134
+ config on GitHub and a bundle on a CDN is what makes it one click: jbrowse-web
135
+ asks a visitor to confirm a **cross origin** config that names a UMD plugin,
136
+ which is the right thing for it to do and put a dialog headed "Warning" in front
137
+ of a README link. Served from the origin the JBrowse is on, the question does
138
+ not arise.
139
+
140
+ Hosting the bundle there also frees the demo from npm releases:
141
+ `pnpm demos:upload` puts the **built** bundle there. Each link is the session
142
+ spec its figure below was taken from, so after an upload the demo, the
143
+ screenshot and the numbers are three renderings of one window.
144
+
145
+ ## Insertions
146
+
147
+ ![An Alu insertion in HG002 at chr1:5,934,288, as a JBrowse pileup above, where each read's copy is a purple box with its length, and as a tview below, where its bases have columns](img/insertion-alu.png)
148
+
149
+ An Alu in an intron of NPHP4, in HG002's PacBio HiFi reads. JBrowse's pileup
150
+ above draws each read's copy as a purple box labelled with its length, 282 to
151
+ 285bp in the reads on screen. The tview below aligns the copies to each other in
152
+ 294 columns, with the poly-A tail in green at the right-hand end, and the rows
153
+ without the insertion are blank across them. [Open this one
154
+ live][tview-demo-alu].
155
+
156
+ The GIAB HG002 structural-variant benchmark (v0.6, GRCh37) calls this a
157
+ heterozygous 283bp insertion after 1:5,934,288. It was found by taking that
158
+ benchmark's heterozygous insertions of 280 to 330bp outside tandem repeats and
159
+ segmental duplications, and counting, in each of the trio's BAMs, the reads that
160
+ span each one and the reads with an insertion of 200bp or more within 100bp of
161
+ it. Here 22 of HG002's 44 spanning reads have it, 24 of his father's 54 do, and
162
+ none of his mother's 31 do, which is what [the same window in all
163
+ three][tview-demo-alu-trio] shows.
164
+
165
+ Each insertion site is as wide as the longest sequence inserted there, after the
166
+ sequences are aligned to each other:
167
+
168
+ - **Inserted sequences are aligned to the commonest one.** At each site, the
169
+ sequence the most reads carry is the centre, ties going to the length nearest
170
+ the median, and every other distinct sequence is aligned to it. The alignment
171
+ is banded, so its time grows with length times divergence rather than with
172
+ length squared. A site whose alignments would take more than a fixed budget of
173
+ work is left left-justified. A site whose inserted sequence is copies of one
174
+ unit is laid out a copy per block instead (see
175
+ [Tandem repeats](#tandem-repeats)).
176
+ - **Insertions are left-normalized.** An aligner can anchor the same `CA`
177
+ inserted in a `CACACA` run at either end of it. Each read's insertion is moved
178
+ left through the read's own bases for as long as the read spells the same
179
+ sequence, so reads carrying one event share one site. An insertion a tandem
180
+ array owns stays where the array put it.
181
+ - **Near-duplicate sites are merged.** Left-normalization only moves an
182
+ insertion where the read's bases allow it, so a read with a sequencing error
183
+ at the boundary, or one the aligner anchored a base or two off, keeps a site
184
+ of its own, and every other row gets a run of gaps as wide as the insertion.
185
+ An insertion of 10bp or more is moved to a site up to 25bp away that more
186
+ reads use, when its length is within 20% of theirs and the move adds at most
187
+ two mismatches against the reference to its row. The row still spells the
188
+ read; what changes is which of its bases count as inserted. At the Alu above,
189
+ one read has a base the others do not just before its copy, and the aligner
190
+ put the copy a base early, at a 287-column site of its own; it now joins the
191
+ other 21. Without the reference sequence nothing is merged, since there is
192
+ nothing to count a mismatch against.
193
+ - **A read that does not span a site is absent there.** In the alignment's text,
194
+ a read that spans a site without inserting has `-` in its columns, and a read
195
+ that does not span it has `.`.
196
+
197
+ ![The volvox test reads at ctgA:15,140..15,190 in a tview, where the inserted bases have a column of their own](img/tview-insertion.png)
198
+
199
+ The volvox test reads at `ctgA:15,140..15,190`. The 1bp insertion after 15,163
200
+ is a column of its own, bracketed as "+1bp after ctgA:15,163": the reads with
201
+ the insertion show their base there, a C in all but one. Bases that match the
202
+ reference are dots on grey, and a row is white where its read has no base.
203
+
204
+ Each insertion site has a bracket in the Highlights strip above the alignment,
205
+ labelled with the size and the reference base it follows, such as
206
+ `+1bp after ctgA:15,163`. The size is the length most of the reads at the site
207
+ insert: HG002's reads have 280 to 287bp of the Alu above, and the bracket over
208
+ its 294 columns is labelled `+283bp`. Each tandem array has a bracket labelled
209
+ with its unit and the reference's copy count, such as
210
+ `(GCG)x21 in the reference`. In a noisy window only the 100 sites carrying the
211
+ most inserted sequence get a bracket. A one-column bracket draws as a triangle,
212
+ and where brackets crowd, some are drawn without their label. Hovering a bracket
213
+ outlines its columns, a click selects them, and a double click zooms to them.
71
214
 
72
215
  ## How it is built
73
216
 
74
217
  The alignment is built in an **RPC worker** (`TviewGetPlan`), so the reads never
75
218
  cross to the main thread — the fetch, the pairwise alignments and the string
76
- building all happen there and only the FASTA comes back. That is also what makes
77
- several files one call: their rows are squared up against the same reference
78
- interval, so an array's copies are counted once, over rows from all of them.
219
+ building all happen there, and what comes back is the alignment, a table of what
220
+ each row is, the brackets and any base modification calls. That is also what
221
+ makes several files one call: their rows are squared up against the same
222
+ reference interval, so an array's copies are counted once, over rows from all of
223
+ them.
79
224
 
80
225
  ## Tandem repeats
81
226
 
82
- ![ABCA7 VNTR alleles in HG003](img/repeat-abca7-vntr.png)
227
+ ![ABCA7 VNTR alleles in HG003, one row per read with its copy count as a bar and a number beside it](img/repeat-abca7-vntr.png)
83
228
 
84
- The ABCA7 VNTR in one PacBio HiFi sample, a copy per block of columns. Every row
85
- carries its copy count, and the rows sort by it, so the genotype is the step in
86
- the ladder — the two alleles the table below reports for HG003, with a scatter
87
- of reads between them. Laid out base by base this is 2.2kb of sequence with
88
- nothing to line it up against. [Open this one live][tview-demo-abca7].
229
+ The ABCA7 VNTR in one PacBio HiFi sample, a copy per block of columns. Each
230
+ row's copy count is the bar and the number beside it, and the rows sort by it,
231
+ so the genotype is the step in the ladder — the two alleles the table below
232
+ reports for HG003, with a few reads off them. Laid out base by base this is
233
+ 2.2kb of sequence with nothing to line it up against. [Open this one
234
+ live][tview-demo-abca7].
89
235
 
90
236
  ### An array is an interval, not an insertion
91
237
 
@@ -132,10 +278,13 @@ At a detected array:
132
278
 
133
279
  - **copy k of every row occupies the same block**, so one divergent copy shows
134
280
  up as a column rather than shifting every copy after it.
135
- - **each row is labelled with its copy count** (`readname|n=32`), which is the
136
- measurement, rather than leaving it to be read off where the row ends.
137
- - **rows are ordered longest allele first**, so the alleles form a ladder.
138
- - the default column width shrinks to fit the array on screen.
281
+ - **each row's copy count is drawn beside it**, as a bar in the `copies` panel
282
+ and a number in the `n` panel, which is the measurement, rather than leaving
283
+ it to be read off where the row ends.
284
+ - **rows sort by copy count, most copies first**, within each sample's band, so
285
+ the alleles form a ladder.
286
+ - the column width starts at whatever puts the whole alignment in about 3,000px,
287
+ between 1 and 10px, so a long array is mostly on screen.
139
288
 
140
289
  **Blocks are array order, not homology.** Copies are counted from the left edge
141
290
  of the interval, and arrays expand and contract anywhere inside themselves, so
@@ -221,13 +370,14 @@ them beside it is what the count depends on.
221
370
 
222
371
  ### Several samples at once
223
372
 
224
- ![FMR1 CGG in the GIAB trio](img/repeat-fmr1-trio.png)
373
+ ![FMR1 CGG in the GIAB trio, rows in a band per sample with the reference band on top](img/repeat-fmr1-trio.png)
225
374
 
226
375
  The FMR1 CGG repeat in the GIAB Ashkenazi trio, all three files in one
227
- alignment. Rows are grouped into a clade per sample by a synthetic tree, which
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.
376
+ alignment. Rows are grouped in a band per sample, labelled in the gutter beside
377
+ the read names, with the reference in a band of its own on top, and the rows in
378
+ each band sort by copy count. A band is named after the `sample` its track was
379
+ given in the view's `init`, or after the track. [Open this one
380
+ live][tview-demo-fmr1].
231
381
 
232
382
  The copy numbers are checkable, which is the point of this locus: FMR1 is on the
233
383
  X, so the two male samples come back with one allele each and the mother with
@@ -235,50 +385,107 @@ two, and the son's single allele is one of his mother's, as an X-linked allele
235
385
  has to be. The counts are in the genotype table above, where they are measured
236
386
  rather than typed.
237
387
 
238
- Two things about this figure are settings rather than data, and both are there
239
- because a column costs the same whether 124 rows use it or one does:
388
+ Three things about this figure are settings rather than data:
240
389
 
241
- - **Columns only one row has a base in are hidden** — the toolbar's "hide
242
- columns w/ N% gaps", set to whatever percent means "one row" for the number of
243
- rows there are. That is read error, and it is a fifth of the columns at some
244
- of these loci; the rows that carry one keep an insertion marker where it was.
245
- What each figure is made of:
390
+ - **Columns only one row has a base in are hidden**, with react-msaview's gap
391
+ threshold set to whatever percent means "one row" for the number of rows there
392
+ are, because a column takes the same width whether 124 rows use it or one
393
+ does. That is read error, and it is a fifth of the columns at some of these
394
+ loci; the rows that carry one keep an insertion marker where it was. What each
395
+ figure is made of:
246
396
 
247
397
  <!-- repeat-figures -->
248
398
 
249
- | figure | rows | columns | columns one row has | hidden |
250
- | ---------------------------------- | ---- | ------- | ------------------- | ------ |
251
- | [fmr1](img/repeat-fmr1-trio.png) | 124 | 218 | 24 | 11% |
252
- | [htt](img/repeat-htt-trio.png) | 182 | 222 | 25 | 11% |
253
- | [atxn3](img/repeat-atxn3-trio.png) | 157 | 159 | 18 | 11% |
254
- | [abca7](img/repeat-abca7-vntr.png) | 16 | 3630 | 1253 | 35% |
399
+ | figure | rows | columns | columns one row has | hidden |
400
+ | ----------------------------------------- | ---- | ------- | ------------------- | ------ |
401
+ | [fmr1](img/repeat-fmr1-trio.png) | 124 | 218 | 24 | 11% |
402
+ | [htt](img/repeat-htt-trio.png) | 182 | 222 | 25 | 11% |
403
+ | [atxn3](img/repeat-atxn3-trio.png) | 157 | 159 | 18 | 11% |
404
+ | [atxn3-hg004](img/repeat-atxn3-hg004.png) | 53 | 145 | 4 | 3% |
405
+ | [abca7](img/repeat-abca7-vntr.png) | 16 | 3630 | 1253 | 35% |
255
406
 
256
407
  <!-- /repeat-figures -->
257
408
 
409
+ - **The label column is 220px**, so the read names are cut in the middle. The
410
+ view fits the column to the widest name unless told otherwise.
258
411
  - **The window is sized to the alignment**, because a JBrowse view taller than
259
- its window loses its last rows with nothing on screen to say so — and rows are
260
- ordered longest allele first, so what falls off the bottom is a whole sample.
261
- `pnpm figures:repeats` now grows the window to the content and warns when it
262
- cannot.
412
+ its window loses its last rows with nothing on screen to say so, and what
413
+ falls off the bottom is the last band, a whole sample. `pnpm figures:giab`
414
+ grows the window to the content and warns when it cannot.
263
415
 
264
- ## Usage
416
+ ## Base modifications
417
+
418
+ When the reads carry MM/ML tags, the view places each read's most probable call
419
+ at each base on that base, inserted bases included. Hovering a cell names the
420
+ call, such as `5mC 97%`. Each called base is filled on a scale from blue (0%) to
421
+ red (100%) of its call's probability, with a legend, and the view's menu gains a
422
+ **Base modifications** submenu:
423
+
424
+ - **Over base colors**, the default, keeps the base colour of every mismatch
425
+ with no call. A mismatching T is red too, so a red cell is a call where it
426
+ holds a dot, a C or a G.
427
+ - **Without base colors** fills the called bases and nothing else.
428
+
429
+ ![Nanopore reads with 5mC calls at 20:13,226..13,275, the called bases filled red over the base colours, one of them in an insertion column](img/tview-modifications-bases.png)
265
430
 
266
- - Install the plugin
267
- - Open the track menu (vertical `...`) on an alignments track
268
- - Click "Launch tview for visible region"
269
- - Tick any other open alignments track to fold its reads into the same alignment
431
+ Seven nanopore reads from `public/methylation_clip.bam`. The red G in the second
432
+ read sits in the column bracketed after 20:13,243, a base the reference does not
433
+ have; the read is on the reverse strand, so its called C reads as a G.
270
434
 
271
- The launched view stays connected to the genome view it came from: hovering or
272
- clicking an alignment column highlights the corresponding genome position, and
273
- clicking navigates there. "Zoom to base level on click?" in the view menu
274
- switches between centering and zooming.
435
+ The calls have limits:
275
436
 
276
- The visible region is capped at 20kb, since one column per base gets unwieldy
277
- beyond that.
437
+ - **At most 50,000 calls per view.** Past that the least probable are left out,
438
+ and the menu says how many.
439
+ - **A row whose letters are not one unbroken run of its read's sequence gets no
440
+ calls**, since a call projected onto it could land on the wrong base. That
441
+ happens inside a tandem array, where a read's insertion was re-filed into the
442
+ array or the row has no allele for a block. The menu counts these rows as "not
443
+ annotated".
444
+ - **One call per base.** A base called as both 5mC and 5hmC shows the more
445
+ probable of the two.
446
+
447
+ ## Usage
448
+
449
+ Install the plugin, then open a tview in one of three ways:
450
+
451
+ - **From an alignments track.** The track menu (vertical `...`) has **Launch
452
+ tview for visible region**, which opens the view at once over the region in
453
+ view. It is disabled, with the reason beneath it, when the region is wider
454
+ than 20,000bp or spans more than one region.
455
+ - **From a selection.** Drag across the genome view's ruler to select a region,
456
+ then choose **Launch** -> **Tview of all alignments tracks**, which reads
457
+ every alignments track open in that view into one alignment.
458
+ - **From a session or a link**, with no click path (see below).
459
+
460
+ The view's own menu (the hamburger on its title bar) changes what it shows:
461
+
462
+ - **Tracks** ticks which alignments tracks the view reads: those open in the
463
+ genome view it came from, and any others it already reads. At least one stays
464
+ ticked.
465
+ - **Show the connected view's current region** rebuilds the view over whatever
466
+ the genome view is showing now, with the same limits as the track menu.
467
+ - **Zoom to base level on click?** switches a click on a column between centring
468
+ the genome view there and zooming it to that base.
469
+ - **Base modifications** appears when the reads carry calls (see above).
470
+
471
+ The view stays connected to the genome view it came from:
472
+
473
+ - Hovering a column highlights that position in the genome view, and a click
474
+ keeps it highlighted and moves the genome view there.
475
+ - Hovering the genome view highlights that base of the reference row in the
476
+ alignment.
477
+ - The **Position** ruler above the alignment numbers the columns in the genome's
478
+ coordinates, and so do its tooltips and the **Go to row or column** box. A
479
+ column the reference has no base in, such as an inserted one, gets no tick.
480
+
481
+ While it builds, the view says what it is waiting for. When it cannot load a
482
+ region, it shows why in place of the alignment, with a retry button where
483
+ retrying can help. Besides the 20,000bp limit, an alignment is refused past 25
484
+ million cells (rows times columns), since every read is a full-width row.
278
485
 
279
486
  ### As a session, with no click path
280
487
 
281
- A tview is a locus, an assembly and the files to read it from, so it can be
488
+ A tview is a locus, an assembly and the tracks to read it from, so it can be
282
489
  declared rather than driven. In a `defaultSession` or a saved session that is
283
490
  the view's `init` block:
284
491
 
@@ -309,31 +516,40 @@ plugin's:
309
516
  }
310
517
  ```
311
518
 
519
+ `assembly`, `loc` and `tracks` are required, and a spec missing one fails with
520
+ "A TView spec needs an assembly name, a loc string and a tracks array of
521
+ trackIds". A track is a trackId or `{ trackId, sample }`, where `sample` names
522
+ its band. Every other key is passed to the view as is, such as
523
+ `connectedViewId`, `colWidth` or `rowHeight`, and the view is titled with its
524
+ locus unless `displayName` says otherwise.
525
+
312
526
  Either way the view resolves it itself, which is also how a restored session
313
- gets its alignment back: react-msaview drops an MSA over 50kb from snapshots and
314
- there is no file to reload from, so `init` is what persists.
527
+ gets its alignment back: the alignment is never written into the session, so
528
+ `init` is what persists, and the view rebuilds from it.
315
529
 
316
530
  `public/repeats.json` is a working example — the GIAB trio on hosted hg19, with
317
531
  a tview at FMR1 open on load.
318
532
 
319
533
  ## Requirements
320
534
 
321
- Needs a JBrowse build shipping `@jbrowse/core` >=4.3 with MUI 9 — currently
322
- jbrowse-web nightly. On JBrowse 4.3.0 the bundle fails to load, because
323
- react-msaview 6.x needs `@jbrowse/mobx-state-tree` 5.13 APIs and MUI 9 icon
324
- internals that the 4.3.0 release does not ship.
535
+ A JBrowse v5 host: `@jbrowse/core` 5.0.0 or later. No v5 is released yet (npm's
536
+ `latest` is 4.3.0), so today that means
537
+ [JBrowse Web nightly](https://jbrowse.org/code/jb2/main/) or a `5.0.0-beta`
538
+ build from npm's `next` tag; this version was built and tested against
539
+ 5.0.0-beta.23.
325
540
 
326
541
  ## Development
327
542
 
328
543
  ```bash
329
544
  pnpm install
330
- pnpm start # dev server on :9000, serves dist/out.js with CORS
545
+ pnpm start # dev server on :9000 (or $PORT), serves dist/out.js with CORS
331
546
  pnpm test # unit tests
332
547
  pnpm test:e2e # puppeteer tests (creates .test-jbrowse on first run)
333
548
  pnpm lint
334
549
  pnpm build
335
550
 
336
- pnpm figures:repeats # the tandem-repeat figures in img/
551
+ pnpm figure # the figures in img/ from the fixtures in public/
552
+ pnpm figures:giab # the figures in img/ from the GIAB trio
337
553
  pnpm report:repeats # copy numbers at known loci, from live GIAB data
338
554
  pnpm demos # public/demo.json and the live-demo links above
339
555
  pnpm demos:upload # ...and push both to jbrowse.org/demos/tview/
@@ -352,10 +568,13 @@ whoever trims one of the long ones. It needs AWS credentials for the bucket, so
352
568
  it is a thing a maintainer runs and not a thing CI does — and it is the only
353
569
  step between a change here and what the links open.
354
570
 
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.
571
+ The figures are defined in `scripts/lib/figures.mjs` as session specs and taken
572
+ by `scripts/lib/capture.mjs`, which starts its own dev server on port 9000, or
573
+ on `FIGURE_PORT` when it is set (with esbuild's own server 400 above it). On
574
+ another port it writes a copy of the config naming the bundle there and deletes
575
+ it afterwards. The harness prints what each figure holds (rows, columns, hidden
576
+ columns, brackets, whether residue letters are drawn) and warns when a repeat
577
+ figure came out with no copy counts or with rows or columns that did not fit.
359
578
 
360
579
  `report:repeats` is not a test. It fetches from GIAB and UCSC and prints what
361
580
  the plan builder measured at each locus, per sample, so the numbers can be read
@@ -1,19 +1,8 @@
1
1
  import React from 'react';
2
2
  import { getSession } from '@jbrowse/core/util';
3
- import HighlightComponents from './HighlightComponents';
3
+ import MsaToGenomeHighlight from './MsaToGenomeHighlight';
4
4
  import { isTView } from '../TViewPanel/model';
5
5
  export default function AddHighlightComponentsModelF(pluginManager) {
6
- pluginManager.addToExtensionPoint('LinearGenomeView-TracksContainerComponent',
7
- // @ts-expect-error
8
- (rest, { model }) => {
9
- // skip entirely unless a TView is connected to this genome view
10
- const { views } = getSession(model);
11
- return views.some(v => isTView(v) && v.connectedViewId === model.id)
12
- ? [
13
- ...rest,
14
- React.createElement(HighlightComponents, { key: "tview_highlights", model: model }),
15
- ]
16
- : rest;
17
- });
6
+ pluginManager.contributeToExtensionPoint('LinearGenomeView-TracksContainerComponent', ({ model }) => getSession(model).views.some(v => isTView(v) && v.connectedViewId === model.id) ? (React.createElement(MsaToGenomeHighlight, { key: "tview_highlights", model: model })) : undefined);
18
7
  }
19
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AddHighlightModel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAK7C,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,aAA4B;IAE5B,aAAa,CAAC,mBAAmB,CAC/B,2CAA2C;IAC3C,mBAAmB;IACnB,CAAC,IAAuB,EAAE,EAAE,KAAK,EAAoC,EAAE,EAAE;QACvE,gEAAgE;QAChE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;QACnC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,KAAK,KAAK,CAAC,EAAE,CAAC;YAClE,CAAC,CAAC;gBACE,GAAG,IAAI;gBACP,oBAAC,mBAAmB,IAAC,GAAG,EAAC,kBAAkB,EAAC,KAAK,EAAE,KAAK,GAAI;aAC7D;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CACF,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AddHighlightModel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,oBAAoB,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAI7C,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAClD,aAA4B;IAE5B,aAAa,CAAC,0BAA0B,CACtC,2CAA2C,EAC3C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACZ,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAC1B,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,KAAK,KAAK,CAAC,EAAE,CAClD,CAAC,CAAC,CAAC,CACF,oBAAC,oBAAoB,IAAC,GAAG,EAAC,kBAAkB,EAAC,KAAK,EAAE,KAAK,GAAI,CAC9D,CAAC,CAAC,CAAC,SAAS,CAChB,CAAA;AACH,CAAC"}