@sjcrh/proteinpaint-client 2.182.0 → 2.183.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 (1004) hide show
  1. package/dist/2dmaf-6ZTETSC5.js +1371 -0
  2. package/dist/AIProjectAdmin-ZT3XKBBT.js +830 -0
  3. package/dist/AIProjectAdmin-ZT3XKBBT.js.map +7 -0
  4. package/dist/AppHeader-U7SJPIBS.js +833 -0
  5. package/dist/BoxPlot-QGHLZ67V.js +1217 -0
  6. package/dist/BoxPlot-QGHLZ67V.js.map +7 -0
  7. package/dist/CorrelationVolcano-7SE4CTBW.js +617 -0
  8. package/dist/DE-PZ7RHPBS.js +93 -0
  9. package/dist/DEinput-UZEQIU2V.js +297 -0
  10. package/dist/DifferentialAnalysis-L6BOEYVO.js +238 -0
  11. package/dist/Disco-6FDT6KRM.js +3235 -0
  12. package/dist/Disco-6FDT6KRM.js.map +7 -0
  13. package/dist/Disco.UI-HKOUAD4P.js +242 -0
  14. package/dist/DmrPlot-3R24PTXP.js +640 -0
  15. package/dist/GB-SZVYZASR.js +1125 -0
  16. package/dist/HicApp-SEEJETVE.js +2248 -0
  17. package/dist/NumBinaryEditor-SDQFJ3FW.js +268 -0
  18. package/dist/NumBinaryEditor.unit.spec-76ZZXTYC.js +284 -0
  19. package/dist/NumContEditor-G75O4YZE.js +105 -0
  20. package/dist/NumContEditor.unit.spec-BFUZRBPL.js +167 -0
  21. package/dist/NumCustomBinEditor-ILTPHCEF.js +36 -0
  22. package/dist/NumCustomBinEditor.unit.spec-GFIYV55V.js +282 -0
  23. package/dist/NumDiscreteEditor-5K3OKUOE.js +177 -0
  24. package/dist/NumDiscreteEditor.unit.spec-NZ4KWPFK.js +200 -0
  25. package/dist/NumRegularBinEditor-7ZJ2MEMY.js +36 -0
  26. package/dist/NumRegularBinEditor.unit.spec-QGVJET65.js +225 -0
  27. package/dist/NumSplineEditor-KE4UPODZ.js +190 -0
  28. package/dist/NumSplineEditor.unit.spec-YQOOZA7S.js +197 -0
  29. package/dist/NumericDensity-RL42P4QC.js +36 -0
  30. package/dist/NumericDensity.unit.spec-Y6RMTYC7.js +219 -0
  31. package/dist/NumericHandler-4QIX324I.js +37 -0
  32. package/dist/NumericHandler.unit.spec-T6F5QYP6.js +217 -0
  33. package/dist/RunChart2-ASGCKKER.js +756 -0
  34. package/dist/RunChart2-ASGCKKER.js.map +7 -0
  35. package/dist/SC-H2YCKSBH.js +682 -0
  36. package/dist/SC-H2YCKSBH.js.map +7 -0
  37. package/dist/Volcano-QBYYJYVW.js +1185 -0
  38. package/dist/Volcano-QBYYJYVW.js.map +7 -0
  39. package/dist/WSIViewer-NDHWFVAB.js +47974 -0
  40. package/dist/WSIViewer-NDHWFVAB.js.map +7 -0
  41. package/dist/WsiSamplesPlot-CXGWPCDL.js +163 -0
  42. package/dist/adSandbox-DE4VRO4Z.js +36 -0
  43. package/dist/alphaGenome-FSIGC5ZT.js +173 -0
  44. package/dist/app-KZGKWQMU.js +47 -0
  45. package/dist/app-MQRJ7FVL.js +35 -0
  46. package/dist/app.js +22 -22
  47. package/dist/bam-BDWTA4O3.js +857 -0
  48. package/dist/barchart-4Q6LVJY4.js +45 -0
  49. package/dist/barchart.data-EXENRVMU.js +22 -0
  50. package/dist/barchart.events-XRGND6I7.js +45 -0
  51. package/dist/barchart.integration.spec-VQITP4YH.js +1675 -0
  52. package/dist/bars.renderer-S7A7I6BQ.js +12 -0
  53. package/dist/block-2MABX5QO.js +6200 -0
  54. package/dist/block-2MABX5QO.js.map +7 -0
  55. package/dist/block.init-NCNSE3HD.js +36 -0
  56. package/dist/block.mds.expressionrank-JYZARS7T.js +357 -0
  57. package/dist/block.mds.geneboxplot-FD2MCIHV.js +826 -0
  58. package/dist/block.mds.junction-LOHVQBIU.js +1543 -0
  59. package/dist/block.mds.svcnv-Z7SAYPQL.js +6799 -0
  60. package/dist/block.svg-LNJOKQNN.js +162 -0
  61. package/dist/block.tk.aicheck-IXCMMAGV.js +281 -0
  62. package/dist/block.tk.ase-WYRYFP6N.js +363 -0
  63. package/dist/block.tk.bam-EIVBNGAL.js +1904 -0
  64. package/dist/block.tk.bedgraphdot-3FHLNCU7.js +382 -0
  65. package/dist/block.tk.bigwig.ui-YDQU5PC4.js +209 -0
  66. package/dist/block.tk.hicstraw-S3ROL3CV.js +821 -0
  67. package/dist/block.tk.junction-DL7RNWX3.js +2362 -0
  68. package/dist/block.tk.junction.textmatrixui-Z6I7IEDY.js +197 -0
  69. package/dist/block.tk.ld-XHVU6L56.js +97 -0
  70. package/dist/block.tk.menu-FPLAEEFY.js +1027 -0
  71. package/dist/block.tk.pgv-6ZZ2QGNO.js +942 -0
  72. package/dist/brainImaging-VSOOMITW.js +421 -0
  73. package/dist/chat-LW23PIG5.js +148 -0
  74. package/dist/chunk-2A2KM5DU.js +117 -0
  75. package/dist/chunk-2A2KM5DU.js.map +7 -0
  76. package/dist/chunk-2K5DSRBJ.js +84 -0
  77. package/dist/chunk-2K5DSRBJ.js.map +7 -0
  78. package/dist/chunk-2LULD7RN.js +31 -0
  79. package/dist/chunk-36DYWBU7.js +514 -0
  80. package/dist/chunk-36DYWBU7.js.map +7 -0
  81. package/dist/chunk-3AGB6HL4.js +158 -0
  82. package/dist/chunk-3AVDNIDN.js +55 -0
  83. package/dist/chunk-3DCABJHB.js +381 -0
  84. package/dist/chunk-3JMB3OSC.js +102 -0
  85. package/dist/chunk-3UEMY45Y.js +215 -0
  86. package/dist/chunk-4RR4KPRJ.js +1205 -0
  87. package/dist/chunk-5HCB4HNL.js +147 -0
  88. package/dist/chunk-5RFB7TYT.js +92 -0
  89. package/dist/chunk-5UMPBVA6.js +534 -0
  90. package/dist/chunk-6C2SBTLR.js +407 -0
  91. package/dist/chunk-6ITDJ5UR.js +261 -0
  92. package/dist/chunk-6ITDJ5UR.js.map +7 -0
  93. package/dist/chunk-6LAE5AVA.js +13624 -0
  94. package/dist/chunk-77ZJGPK2.js +289 -0
  95. package/dist/chunk-77ZJGPK2.js.map +7 -0
  96. package/dist/chunk-7FKIAQ4K.js +17 -0
  97. package/dist/chunk-7FKIAQ4K.js.map +7 -0
  98. package/dist/chunk-7RN3L2BX.js +1788 -0
  99. package/dist/chunk-7RN3L2BX.js.map +7 -0
  100. package/dist/chunk-7VV43ICF.js +272 -0
  101. package/dist/chunk-A6TQGNDQ.js +421 -0
  102. package/dist/chunk-A6TQGNDQ.js.map +7 -0
  103. package/dist/chunk-A742TQD2.js +615 -0
  104. package/dist/chunk-A7E3JZ5P.js +56 -0
  105. package/dist/chunk-A7E3JZ5P.js.map +7 -0
  106. package/dist/chunk-AFLFPYJI.js +480 -0
  107. package/dist/chunk-APOHXHKH.js +526 -0
  108. package/dist/chunk-APOHXHKH.js.map +7 -0
  109. package/dist/chunk-AQ4OP4GR.js +39 -0
  110. package/dist/chunk-BAY47D5E.js +226 -0
  111. package/dist/chunk-CFHKYLDY.js +26 -0
  112. package/dist/chunk-CTAKX5CT.js +129 -0
  113. package/dist/chunk-CVBQWXLH.js +455 -0
  114. package/dist/chunk-CVBQWXLH.js.map +7 -0
  115. package/dist/chunk-D4QFQQWJ.js +170 -0
  116. package/dist/chunk-DGMK7SXX.js +203 -0
  117. package/dist/chunk-DNCSPTOQ.js +446 -0
  118. package/dist/chunk-DTDQKGIQ.js +2672 -0
  119. package/dist/chunk-E4NVHKWD.js +142 -0
  120. package/dist/chunk-E6KEZENR.js +4207 -0
  121. package/dist/chunk-EY2KBPHJ.js +261 -0
  122. package/dist/chunk-EY2KBPHJ.js.map +7 -0
  123. package/dist/chunk-FRBYOOWT.js +229 -0
  124. package/dist/chunk-FVWCYGJL.js +121 -0
  125. package/dist/chunk-HWHG63LH.js +148 -0
  126. package/dist/chunk-HWHG63LH.js.map +7 -0
  127. package/dist/chunk-HYZG6OPC.js +467 -0
  128. package/dist/chunk-HYZG6OPC.js.map +7 -0
  129. package/dist/chunk-I4IKRKYJ.js +2815 -0
  130. package/dist/chunk-IEQSUAIO.js +6364 -0
  131. package/dist/chunk-IET6P5MV.js +335 -0
  132. package/dist/chunk-IET6P5MV.js.map +7 -0
  133. package/dist/chunk-JMPSZMDD.js +52 -0
  134. package/dist/chunk-JXOL73PT.js +2784 -0
  135. package/dist/chunk-K62XUHA4.js +100 -0
  136. package/dist/chunk-KQMEJUWI.js +815 -0
  137. package/dist/chunk-L4QG7XZE.js +46 -0
  138. package/dist/chunk-L4QG7XZE.js.map +7 -0
  139. package/dist/chunk-L4YGMXLX.js +37 -0
  140. package/dist/chunk-L4YGMXLX.js.map +7 -0
  141. package/dist/chunk-LI7FE335.js +371 -0
  142. package/dist/chunk-M7W2GYSM.js +4961 -0
  143. package/dist/chunk-M7W2GYSM.js.map +7 -0
  144. package/dist/chunk-MV6O4I2B.js +441 -0
  145. package/dist/chunk-MXNSW55L.js +148 -0
  146. package/dist/chunk-NB7NLFGZ.js +228 -0
  147. package/dist/chunk-NGGWK6HX.js +302 -0
  148. package/dist/chunk-OGGFS66K.js +1087 -0
  149. package/dist/chunk-OSM7YS23.js +276 -0
  150. package/dist/chunk-OSM7YS23.js.map +7 -0
  151. package/dist/chunk-OXJ2TWDO.js +20644 -0
  152. package/dist/chunk-OXJ2TWDO.js.map +7 -0
  153. package/dist/chunk-Q7PYFSNU.js +107 -0
  154. package/dist/chunk-QMI222IJ.js +386 -0
  155. package/dist/chunk-QRIRWDIW.js +252 -0
  156. package/dist/chunk-R6L6NVEC.js +14 -0
  157. package/dist/chunk-RLTLYKHO.js +34 -0
  158. package/dist/chunk-S5ZI6N2I.js +293 -0
  159. package/dist/chunk-S7T7OZC7.js +158 -0
  160. package/dist/chunk-SEQLC4AD.js +177 -0
  161. package/dist/chunk-TEZLFSOV.js +54 -0
  162. package/dist/chunk-TFI7ZZJG.js +50 -0
  163. package/dist/chunk-TFI7ZZJG.js.map +7 -0
  164. package/dist/chunk-TV74I3Y5.js +43 -0
  165. package/dist/chunk-TV74I3Y5.js.map +7 -0
  166. package/dist/chunk-UEMTP6ZC.js +824 -0
  167. package/dist/chunk-UJU3Q7QJ.js +119 -0
  168. package/dist/chunk-V245THQC.js +2370 -0
  169. package/dist/chunk-V245THQC.js.map +7 -0
  170. package/dist/chunk-V6DLLX4N.js +176 -0
  171. package/dist/chunk-V6DLLX4N.js.map +7 -0
  172. package/dist/chunk-VIPMLSZP.js +217 -0
  173. package/dist/chunk-VQPS4SXU.js +97 -0
  174. package/dist/chunk-VQPS4SXU.js.map +7 -0
  175. package/dist/chunk-VUUZJANK.js +1150 -0
  176. package/dist/chunk-VYIO7T6J.js +82 -0
  177. package/dist/chunk-VYIO7T6J.js.map +7 -0
  178. package/dist/chunk-W345H42C.js +273 -0
  179. package/dist/chunk-W345H42C.js.map +7 -0
  180. package/dist/chunk-WGHO2NCP.js +205 -0
  181. package/dist/chunk-WGL6FIUE.js +330 -0
  182. package/dist/chunk-WGL6FIUE.js.map +7 -0
  183. package/dist/chunk-WPHOEG56.js +194 -0
  184. package/dist/chunk-WS5XVKPJ.js +470 -0
  185. package/dist/chunk-X6URQAFD.js +1271 -0
  186. package/dist/chunk-XYFDBYOY.js +1658 -0
  187. package/dist/chunk-XYFDBYOY.js.map +7 -0
  188. package/dist/chunk-Y6RCKITI.js +1155 -0
  189. package/dist/chunk-Y6RCKITI.js.map +7 -0
  190. package/dist/chunk-YALAQWX4.js +368 -0
  191. package/dist/chunk-YK5NFMHR.js +269 -0
  192. package/dist/chunk-YK5NFMHR.js.map +7 -0
  193. package/dist/chunk-YY4CKQJ6.js +95 -0
  194. package/dist/chunk-Z3KV6SC2.js +629 -0
  195. package/dist/chunk-ZGT4XP5J.js +1426 -0
  196. package/dist/chunk-ZGT4XP5J.js.map +7 -0
  197. package/dist/condition-JKQIRMMW.js +330 -0
  198. package/dist/controls-324AGOZG.js +39 -0
  199. package/dist/controls.config-TA4NNARU.js +37 -0
  200. package/dist/correlation-3Z36TKC2.js +96 -0
  201. package/dist/cuminc-4DY2CSZF.js +1147 -0
  202. package/dist/cuminc.integration.spec-SFQPLMSF.js +676 -0
  203. package/dist/customdata.inputui-IKGPEBXV.js +287 -0
  204. package/dist/customdata.inputui-IKGPEBXV.js.map +7 -0
  205. package/dist/dataDownload-3AE2N7KI.js +328 -0
  206. package/dist/dataDownload.integration.spec-DKOT6BJP.js +191 -0
  207. package/dist/databrowser.ui-ATODRS5P.js +419 -0
  208. package/dist/dictionary-WHDZBW5M.js +109 -0
  209. package/dist/dictionary-WHDZBW5M.js.map +7 -0
  210. package/dist/dnaMethylation-TVA5YMOR.js +36 -0
  211. package/dist/dnaMethylation.integration.spec-JTWQR6XY.js +165 -0
  212. package/dist/dnaMethylation.integration.spec-JTWQR6XY.js.map +7 -0
  213. package/dist/e2pca-KHVDNFEZ.js +348 -0
  214. package/dist/ep-B5GAAMNM.js +1254 -0
  215. package/dist/expclust.gdc.spec-EDPX7V6K.js +305 -0
  216. package/dist/facet-ZCSXKXIO.js +519 -0
  217. package/dist/geneExpClustering-ERNCMAED.js +246 -0
  218. package/dist/geneExpression-HUOXWETT.js +36 -0
  219. package/dist/geneExpression-X2KXJPND.js +312 -0
  220. package/dist/geneExpression.unit.spec-5QQB4ISW.js +100 -0
  221. package/dist/geneORA-B5UK77KL.js +276 -0
  222. package/dist/geneVariant-7MGUAIZ6.js +39 -0
  223. package/dist/geneVariant-FK3KZJ2K.js +37 -0
  224. package/dist/geneVariant.integration.spec-C6TYWKIC.js +196 -0
  225. package/dist/genefusion.ui-VKAINMY7.js +249 -0
  226. package/dist/geneset-673KAZVX.js +194 -0
  227. package/dist/genomeBrowser.spec-T6TQCJ3O.js +279 -0
  228. package/dist/grin2-376BD4XY.js +1554 -0
  229. package/dist/grin2-OALS75LC.js +1031 -0
  230. package/dist/gsea-25LD2LGP.js +45 -0
  231. package/dist/hierCluster-7KU3K52V.js +58 -0
  232. package/dist/hierCluster-M5VVWKQK.js +62 -0
  233. package/dist/hierCluster.config-EDO3SH2P.js +38 -0
  234. package/dist/hierCluster.integration.spec-UOX7J2XD.js +374 -0
  235. package/dist/hierCluster.interactivity-FEFZDXML.js +52 -0
  236. package/dist/hierCluster.renderers-A6MEGO2B.js +21 -0
  237. package/dist/imagePlot-FPXZ2H5Z.js +139 -0
  238. package/dist/importPlot-VKWPSFEK.js +8 -0
  239. package/dist/isoformExpression-2R2TOB6P.js +38 -0
  240. package/dist/isoformExpression.unit.spec-ZKFKOPKT.js +206 -0
  241. package/dist/isoformExpression.unit.spec-ZKFKOPKT.js.map +7 -0
  242. package/dist/jspdf.es.min-FC3BCETM.js +40 -0
  243. package/dist/launch.adhoc-242RS6DW.js +40 -0
  244. package/dist/leftlabel.sample-OJW3AE64.js +257 -0
  245. package/dist/legacyDataset-PBCPC5I7.js +119 -0
  246. package/dist/lollipop-TRQ3LK7Y.js +166 -0
  247. package/dist/maf-ZBOLN2FE.js +450 -0
  248. package/dist/maftimeline-GVX7NJP7.js +591 -0
  249. package/dist/matrix-73KRNXLM.js +57 -0
  250. package/dist/matrix-US3OXYRY.js +62 -0
  251. package/dist/matrix.cells-U7AQNEBP.js +28 -0
  252. package/dist/matrix.config-Q57D7C3F.js +39 -0
  253. package/dist/matrix.controls-AWXDRSWP.js +37 -0
  254. package/dist/matrix.data-EEIY6AO4.js +25 -0
  255. package/dist/matrix.dom-6QL3AJMW.js +11 -0
  256. package/dist/matrix.groups-CUB6UWC5.js +26 -0
  257. package/dist/matrix.integration.spec-PQH67KRM.js +3070 -0
  258. package/dist/matrix.interactivity-JW4AXAWO.js +40 -0
  259. package/dist/matrix.layout-I56KRVCO.js +42 -0
  260. package/dist/matrix.legend-42LQGAGX.js +22 -0
  261. package/dist/matrix.renderers-IX3FCNBK.js +36 -0
  262. package/dist/matrix.serieses-4B2WB526.js +21 -0
  263. package/dist/matrix.sort-BJACNR7G.js +27 -0
  264. package/dist/matrix.sort.unit.spec-3KKDKIPY.js +470 -0
  265. package/dist/matrix.sorterUi-W6XFYZY2.js +18 -0
  266. package/dist/matrix.sorterUi.unit.spec-CMJ7EBIW.js +340 -0
  267. package/dist/mavb-ROAE6WYA.js +730 -0
  268. package/dist/mds.fimo-UGK5OWCF.js +516 -0
  269. package/dist/mds.samplescatterplot-5KFUAYSB.js +1548 -0
  270. package/dist/mds.survivalplot-2EVNZUX5.js +481 -0
  271. package/dist/oncomatrix-UGFXSXQJ.js +293 -0
  272. package/dist/oncomatrix.spec-FEP7BR7L.js +446 -0
  273. package/dist/plot.2dvaf-WXGLWCOC.js +375 -0
  274. package/dist/plot.app-IZAFRTBU.js +39 -0
  275. package/dist/plot.barplot-Z4VWOPFJ.js +100 -0
  276. package/dist/plot.boxplot-QU2KZSB7.js +150 -0
  277. package/dist/plot.brainImaging-U643YIK7.js +51 -0
  278. package/dist/plot.disco-3BV6YEBC.js +101 -0
  279. package/dist/plot.disco-3BV6YEBC.js.map +7 -0
  280. package/dist/plot.dzi-DWXPOOQE.js +33 -0
  281. package/dist/plot.ssgq-GXB2GZO3.js +137 -0
  282. package/dist/plot.vaf2cov-EKRIADPB.js +257 -0
  283. package/dist/plot.wsi-E2LLE6HI.js +36 -0
  284. package/dist/polar-MZLIUXHO.js +184 -0
  285. package/dist/polar2-IUVHNQM4.js +226 -0
  286. package/dist/profile.spec-JRW6KYUI.js +78 -0
  287. package/dist/profileBarchart-N7HJMYZ5.js +265 -0
  288. package/dist/profileForms-Q5TPGPQP.js +438 -0
  289. package/dist/profilePlot-TXTUYDVE.js +52 -0
  290. package/dist/profileRadar-ICEASI7W.js +261 -0
  291. package/dist/profileRadarFacility-NFMRNJYX.js +261 -0
  292. package/dist/profileRadarFacility-NFMRNJYX.js.map +7 -0
  293. package/dist/proteinView-K3JFNORQ.js +633 -0
  294. package/dist/proteinView-K3JFNORQ.js.map +7 -0
  295. package/dist/proteomeAbundance-DE4NVBCN.js +21 -0
  296. package/dist/proteomeAbundance-LTB3QR3G.js +63 -0
  297. package/dist/qualitative-DFGWQURY.js +41 -0
  298. package/dist/regression-TTQTAEGD.js +54 -0
  299. package/dist/regression.inputs-2LU2XRGC.js +46 -0
  300. package/dist/regression.inputs.term-G57GL57T.js +46 -0
  301. package/dist/regression.inputs.values.table-JSEM3PXL.js +43 -0
  302. package/dist/regression.integration.spec-XJQJAIC3.js +782 -0
  303. package/dist/regression.integration.spec-XJQJAIC3.js.map +7 -0
  304. package/dist/regression.results-3YNM6LLQ.js +38 -0
  305. package/dist/regression.spec-S6WFCPSW.js +706 -0
  306. package/dist/report-YRAV4MY4.js +220 -0
  307. package/dist/sampleScatter.spec-MBJ4XNTX.js +200 -0
  308. package/dist/sampleView-IUR3ZEN7.js +46 -0
  309. package/dist/samplelst-C2NBFGH6.js +109 -0
  310. package/dist/samplematrix-AOK2HHSB.js +2196 -0
  311. package/dist/sc-XT3Z5XJI.js +84 -0
  312. package/dist/scatter-SAHKZRFL.js +800 -0
  313. package/dist/scatter.integration.spec-6KRDNHHH.js +1194 -0
  314. package/dist/scatter.integration.spec-6KRDNHHH.js.map +7 -0
  315. package/dist/selectGenomeWithTklst-2YVZ4JWV.js +132 -0
  316. package/dist/singleCellCellType-NFN5GQJM.js +36 -0
  317. package/dist/singleCellCellType.unit.spec-CR4IJ4DA.js +158 -0
  318. package/dist/singleCellCellType.unit.spec-CR4IJ4DA.js.map +7 -0
  319. package/dist/singleCellGeneExpression-7AQGLXTR.js +36 -0
  320. package/dist/singleCellGeneExpression.unit.spec-QYNWSV2G.js +151 -0
  321. package/dist/singleCellGeneExpression.unit.spec-QYNWSV2G.js.map +7 -0
  322. package/dist/singleCellPlot-IWFEG44C.js +51 -0
  323. package/dist/singlecell-3QNV4OMZ.js +1570 -0
  324. package/dist/singlecell-EATPLH66.js +84 -0
  325. package/dist/snp-UP7WL7WG.js +36 -0
  326. package/dist/snp.unit.spec-Y5NWQ442.js +174 -0
  327. package/dist/snplocus-WAQK2AZG.js +206 -0
  328. package/dist/spliceevent.a53ss.diagram-FFK27UIB.js +149 -0
  329. package/dist/spliceevent.exonskip.diagram-KWEF2OZJ.js +275 -0
  330. package/dist/spliceevent.noeventdiagram-PU4TI7OM.js +458 -0
  331. package/dist/ssGSEA-N6QOAVLW.js +36 -0
  332. package/dist/ssGSEA.unit.spec-KQBNZNNP.js +86 -0
  333. package/dist/summarizeCnvGeneexp-NWX4M6LZ.js +161 -0
  334. package/dist/summarizeCnvGeneexp-NWX4M6LZ.js.map +7 -0
  335. package/dist/summarizeGeneexpSurvival-N5VTE2G6.js +106 -0
  336. package/dist/summarizeGeneexpSurvival-N5VTE2G6.js.map +7 -0
  337. package/dist/summarizeMutationCnv-VV7CVAA7.js +162 -0
  338. package/dist/summarizeMutationCnv-VV7CVAA7.js.map +7 -0
  339. package/dist/summarizeMutationDiagnosis-5RHSG7L6.js +38 -0
  340. package/dist/summarizeMutationSurvival-22YYXGS5.js +97 -0
  341. package/dist/summary-P3WIKJS7.js +47 -0
  342. package/dist/summary.integration.spec-ULGRPICW.js +412 -0
  343. package/dist/summaryInput-IH4EVNF5.js +218 -0
  344. package/dist/sunburst-VJJ3UVYC.js +282 -0
  345. package/dist/sunburst-VJJ3UVYC.js.map +7 -0
  346. package/dist/survival-2ZE3N62A.js +44 -0
  347. package/dist/survival-ASCLKIII.js +56 -0
  348. package/dist/survival.integration.spec-C5YXOY77.js +787 -0
  349. package/dist/svg2pdf.es.min-CYTPRWNB.js +3157 -0
  350. package/dist/svgraph-AYR2UPNK.js +1385 -0
  351. package/dist/svmr-MOMW5DNY.js +3840 -0
  352. package/dist/table-PQB6KCEY.js +198 -0
  353. package/dist/termCollection-5AY2AWT4.js +36 -0
  354. package/dist/termCollection-OQMUUTW6.js +177 -0
  355. package/dist/termCollection.unit.spec-BUAXYIJK.js +206 -0
  356. package/dist/tk-EJLFFA5H.js +44 -0
  357. package/dist/tp.ui-WUW6A7KP.js +1457 -0
  358. package/dist/tvs.density-HSVPDDGA.js +18 -0
  359. package/dist/tvs.dt-MVJXQMNU.js +37 -0
  360. package/dist/tvs.dtcnv.categorical-FIIDWVK7.js +38 -0
  361. package/dist/tvs.dtcnv.continuous-JPQU3JA2.js +70 -0
  362. package/dist/tvs.dtfusion-BW35GOQM.js +38 -0
  363. package/dist/tvs.dtsnvindel-AEMFZ4EH.js +38 -0
  364. package/dist/tvs.dtsv-JHTU7UFD.js +38 -0
  365. package/dist/tvs.numeric-ICUGA4WY.js +21 -0
  366. package/dist/tvs.samplelst-VD2NFFFS.js +102 -0
  367. package/dist/tvs.termCollection-IKE5Q74D.js +151 -0
  368. package/dist/violin-DPMJLHQG.js +44 -0
  369. package/dist/violin.integration.spec-A4PNR4ES.js +1423 -0
  370. package/dist/violin.integration.spec-A4PNR4ES.js.map +7 -0
  371. package/dist/violin.interactivity-TS4DYUE5.js +36 -0
  372. package/dist/violin.renderer-53L4PXUT.js +38 -0
  373. package/dist/vocabulary-4MPFHKYC.js +39 -0
  374. package/package.json +3 -3
  375. package/dist/2dmaf-SLBAWGPG.js +0 -1371
  376. package/dist/AIProjectAdmin-6SH5X3AF.js +0 -830
  377. package/dist/AIProjectAdmin-6SH5X3AF.js.map +0 -7
  378. package/dist/AppHeader-MVYNRMC7.js +0 -833
  379. package/dist/BoxPlot-HLGWW3IK.js +0 -1295
  380. package/dist/BoxPlot-HLGWW3IK.js.map +0 -7
  381. package/dist/CorrelationVolcano-TZCYC3NI.js +0 -617
  382. package/dist/DE-2J2SK5UT.js +0 -93
  383. package/dist/DEinput-QM3GOQHM.js +0 -297
  384. package/dist/DifferentialAnalysis-DS7CQOT6.js +0 -238
  385. package/dist/Disco-U5I6NJUT.js +0 -3199
  386. package/dist/Disco-U5I6NJUT.js.map +0 -7
  387. package/dist/Disco.UI-J2B7GGEZ.js +0 -242
  388. package/dist/DmrPlot-D5W76QPY.js +0 -640
  389. package/dist/GB-LM5SGUG4.js +0 -1125
  390. package/dist/HicApp-YNBGAGKM.js +0 -2248
  391. package/dist/NumBinaryEditor-4QA5DQJT.js +0 -268
  392. package/dist/NumBinaryEditor.unit.spec-YWSIFTOJ.js +0 -284
  393. package/dist/NumContEditor-ZPLVZFLH.js +0 -105
  394. package/dist/NumContEditor.unit.spec-NBCFOCOX.js +0 -167
  395. package/dist/NumCustomBinEditor-TXEYRVPL.js +0 -36
  396. package/dist/NumCustomBinEditor.unit.spec-SQM63H4B.js +0 -282
  397. package/dist/NumDiscreteEditor-6C4OWX62.js +0 -177
  398. package/dist/NumDiscreteEditor.unit.spec-4HC4AGAM.js +0 -200
  399. package/dist/NumRegularBinEditor-VQAS3OXK.js +0 -36
  400. package/dist/NumRegularBinEditor.unit.spec-RGVEPB3Z.js +0 -225
  401. package/dist/NumSplineEditor-SXOJICHU.js +0 -190
  402. package/dist/NumSplineEditor.unit.spec-HF5E6ANH.js +0 -197
  403. package/dist/NumericDensity-LMLPMOSE.js +0 -36
  404. package/dist/NumericDensity.unit.spec-3ZI5EVON.js +0 -219
  405. package/dist/NumericHandler-Q6F6ANOS.js +0 -37
  406. package/dist/NumericHandler.unit.spec-E6Z5HUNZ.js +0 -217
  407. package/dist/RunChart2-XSNWNAIL.js +0 -756
  408. package/dist/RunChart2-XSNWNAIL.js.map +0 -7
  409. package/dist/SC-RA46YM57.js +0 -733
  410. package/dist/SC-RA46YM57.js.map +0 -7
  411. package/dist/Volcano-75UDYPVB.js +0 -1187
  412. package/dist/Volcano-75UDYPVB.js.map +0 -7
  413. package/dist/WSIViewer-GYUUXCSJ.js +0 -47933
  414. package/dist/WSIViewer-GYUUXCSJ.js.map +0 -7
  415. package/dist/WsiSamplesPlot-KMI5S2EL.js +0 -163
  416. package/dist/adSandbox-JTK5XEQL.js +0 -36
  417. package/dist/alphaGenome-JRAV6WIY.js +0 -173
  418. package/dist/app-JKDZL23V.js +0 -35
  419. package/dist/app-OEARXM6E.js +0 -47
  420. package/dist/bam-CYEPLBK4.js +0 -857
  421. package/dist/barchart-GG5UFDG4.js +0 -45
  422. package/dist/barchart.data-KXA66FAL.js +0 -22
  423. package/dist/barchart.events-P2USOIR7.js +0 -45
  424. package/dist/barchart.integration.spec-5QSPQQLJ.js +0 -1675
  425. package/dist/bars.renderer-T5R3UIBW.js +0 -12
  426. package/dist/block-6DVPQBSH.js +0 -6200
  427. package/dist/block-6DVPQBSH.js.map +0 -7
  428. package/dist/block.init-ZHX6DFWF.js +0 -36
  429. package/dist/block.mds.expressionrank-YMGYXXYT.js +0 -357
  430. package/dist/block.mds.geneboxplot-IAILQYX4.js +0 -826
  431. package/dist/block.mds.junction-BRNFNQMU.js +0 -1543
  432. package/dist/block.mds.svcnv-OHKC7YPO.js +0 -6799
  433. package/dist/block.svg-PNGK45HW.js +0 -162
  434. package/dist/block.tk.aicheck-SCIOJ4WN.js +0 -281
  435. package/dist/block.tk.ase-BABJ73GG.js +0 -363
  436. package/dist/block.tk.bam-LZWJ5BCQ.js +0 -1904
  437. package/dist/block.tk.bedgraphdot-7NQLC3XJ.js +0 -382
  438. package/dist/block.tk.bigwig.ui-VNY4SFD5.js +0 -209
  439. package/dist/block.tk.hicstraw-36A7VDRM.js +0 -821
  440. package/dist/block.tk.junction-D373YEMK.js +0 -2362
  441. package/dist/block.tk.junction.textmatrixui-FFII7J3X.js +0 -197
  442. package/dist/block.tk.ld-XGB6KMDO.js +0 -97
  443. package/dist/block.tk.menu-PEZANZBZ.js +0 -1027
  444. package/dist/block.tk.pgv-MU5BPTT2.js +0 -942
  445. package/dist/brainImaging-LVJON47N.js +0 -421
  446. package/dist/chat-5FDIAQJ4.js +0 -148
  447. package/dist/chunk-22NJUYET.js +0 -281
  448. package/dist/chunk-22NJUYET.js.map +0 -7
  449. package/dist/chunk-2J3566TA.js +0 -215
  450. package/dist/chunk-2OSEZCWZ.js +0 -205
  451. package/dist/chunk-2SRMRC6L.js +0 -421
  452. package/dist/chunk-2SRMRC6L.js.map +0 -7
  453. package/dist/chunk-5OHXYXLD.js +0 -46
  454. package/dist/chunk-5OHXYXLD.js.map +0 -7
  455. package/dist/chunk-6MSCYO7K.js +0 -119
  456. package/dist/chunk-75EBDB7G.js +0 -21
  457. package/dist/chunk-75EBDB7G.js.map +0 -7
  458. package/dist/chunk-7A7NMCQ3.js +0 -534
  459. package/dist/chunk-7FEHI46K.js +0 -20456
  460. package/dist/chunk-7FEHI46K.js.map +0 -7
  461. package/dist/chunk-AETE4F7R.js +0 -252
  462. package/dist/chunk-AZYDW5T7.js +0 -441
  463. package/dist/chunk-B6HCIAM3.js +0 -34
  464. package/dist/chunk-BEWDIM6H.js +0 -42
  465. package/dist/chunk-BEWDIM6H.js.map +0 -7
  466. package/dist/chunk-CCIZJAXB.js +0 -2815
  467. package/dist/chunk-DHZL3FBC.js +0 -107
  468. package/dist/chunk-DONWY7TP.js +0 -39
  469. package/dist/chunk-DVDDXOWT.js +0 -815
  470. package/dist/chunk-E6DRQJJT.js +0 -480
  471. package/dist/chunk-ESKU6LNC.js +0 -36
  472. package/dist/chunk-ESKU6LNC.js.map +0 -7
  473. package/dist/chunk-F6V4AYWP.js +0 -177
  474. package/dist/chunk-FBAJTPBU.js +0 -302
  475. package/dist/chunk-FGMPKWT5.js +0 -371
  476. package/dist/chunk-FK4MYVW2.js +0 -261
  477. package/dist/chunk-FK4MYVW2.js.map +0 -7
  478. package/dist/chunk-FMBJ4SKC.js +0 -98
  479. package/dist/chunk-FMBJ4SKC.js.map +0 -7
  480. package/dist/chunk-FOEZG4VX.js +0 -505
  481. package/dist/chunk-FOEZG4VX.js.map +0 -7
  482. package/dist/chunk-FQRLSKJC.js +0 -226
  483. package/dist/chunk-G6ELKVBG.js +0 -629
  484. package/dist/chunk-GKK3CZ6H.js +0 -4207
  485. package/dist/chunk-GO5SIPFE.js +0 -194
  486. package/dist/chunk-GPOECA3V.js +0 -386
  487. package/dist/chunk-GTOY3JJO.js +0 -288
  488. package/dist/chunk-GTOY3JJO.js.map +0 -7
  489. package/dist/chunk-GW7DHJYH.js +0 -439
  490. package/dist/chunk-GW7DHJYH.js.map +0 -7
  491. package/dist/chunk-H2D7EVUA.js +0 -158
  492. package/dist/chunk-H2K5KZP7.js +0 -95
  493. package/dist/chunk-H5XFH3FV.js +0 -153
  494. package/dist/chunk-H5XFH3FV.js.map +0 -7
  495. package/dist/chunk-HAMDFQIX.js +0 -228
  496. package/dist/chunk-HH4QLSTK.js +0 -4952
  497. package/dist/chunk-HH4QLSTK.js.map +0 -7
  498. package/dist/chunk-IBTPGSYI.js +0 -526
  499. package/dist/chunk-IBTPGSYI.js.map +0 -7
  500. package/dist/chunk-IC7SUXJD.js +0 -82
  501. package/dist/chunk-IC7SUXJD.js.map +0 -7
  502. package/dist/chunk-IGEQI6MR.js +0 -1561
  503. package/dist/chunk-IGEQI6MR.js.map +0 -7
  504. package/dist/chunk-IIRU6VK2.js +0 -2672
  505. package/dist/chunk-ILF2GKBY.js +0 -1205
  506. package/dist/chunk-IP4T477W.js +0 -92
  507. package/dist/chunk-IQIXGTQV.js +0 -84
  508. package/dist/chunk-IQIXGTQV.js.map +0 -7
  509. package/dist/chunk-IXT4U5CE.js +0 -91
  510. package/dist/chunk-IXT4U5CE.js.map +0 -7
  511. package/dist/chunk-JHOGX5VE.js +0 -272
  512. package/dist/chunk-JOXUBWN3.js +0 -381
  513. package/dist/chunk-K57RR3FD.js +0 -142
  514. package/dist/chunk-K6JLCMVL.js +0 -129
  515. package/dist/chunk-KISFQDQE.js +0 -258
  516. package/dist/chunk-KISFQDQE.js.map +0 -7
  517. package/dist/chunk-KSFSM46X.js +0 -100
  518. package/dist/chunk-KVG7FTTK.js +0 -470
  519. package/dist/chunk-LEDPPLQK.js +0 -158
  520. package/dist/chunk-LUTT3MBZ.js +0 -1150
  521. package/dist/chunk-MDL2HG3N.js +0 -257
  522. package/dist/chunk-MDL2HG3N.js.map +0 -7
  523. package/dist/chunk-MNRYCG2S.js +0 -1271
  524. package/dist/chunk-MPJHDHBA.js +0 -2784
  525. package/dist/chunk-MXI3NXRB.js +0 -407
  526. package/dist/chunk-O4PXELXF.js +0 -615
  527. package/dist/chunk-ORPCSG6T.js +0 -14
  528. package/dist/chunk-OUKDZKSZ.js +0 -334
  529. package/dist/chunk-OUKDZKSZ.js.map +0 -7
  530. package/dist/chunk-P5HLYAHP.js +0 -1087
  531. package/dist/chunk-PIACSJPH.js +0 -148
  532. package/dist/chunk-PQABAAEZ.js +0 -31
  533. package/dist/chunk-PSMDCZET.js +0 -46
  534. package/dist/chunk-PSMDCZET.js.map +0 -7
  535. package/dist/chunk-RFIVPTMS.js +0 -217
  536. package/dist/chunk-RSU37SVQ.js +0 -54
  537. package/dist/chunk-RTC4U4PH.js +0 -2327
  538. package/dist/chunk-RTC4U4PH.js.map +0 -7
  539. package/dist/chunk-RZ5JP44H.js +0 -276
  540. package/dist/chunk-RZ5JP44H.js.map +0 -7
  541. package/dist/chunk-SPAIFVM2.js +0 -1155
  542. package/dist/chunk-SPAIFVM2.js.map +0 -7
  543. package/dist/chunk-T2HYA2KL.js +0 -55
  544. package/dist/chunk-TCPU43TU.js +0 -1741
  545. package/dist/chunk-TCPU43TU.js.map +0 -7
  546. package/dist/chunk-TE3DK3A6.js +0 -147
  547. package/dist/chunk-TIQPSXFJ.js +0 -237
  548. package/dist/chunk-TIQPSXFJ.js.map +0 -7
  549. package/dist/chunk-TN5GSG34.js +0 -26
  550. package/dist/chunk-UBGTQMOO.js +0 -52
  551. package/dist/chunk-UBS5UVIY.js +0 -13624
  552. package/dist/chunk-UE5ZYM63.js +0 -48
  553. package/dist/chunk-UE5ZYM63.js.map +0 -7
  554. package/dist/chunk-UQACPOCM.js +0 -102
  555. package/dist/chunk-UR3C4SCH.js +0 -446
  556. package/dist/chunk-UWX7W22M.js +0 -121
  557. package/dist/chunk-VJ37HKM6.js +0 -368
  558. package/dist/chunk-VLTDUJRM.js +0 -293
  559. package/dist/chunk-W6UUEAEP.js +0 -6364
  560. package/dist/chunk-X6UPDFDX.js +0 -229
  561. package/dist/chunk-XD6BFNMR.js +0 -172
  562. package/dist/chunk-XD6BFNMR.js.map +0 -7
  563. package/dist/chunk-XDI4UFCZ.js +0 -467
  564. package/dist/chunk-XDI4UFCZ.js.map +0 -7
  565. package/dist/chunk-XOBD3EAM.js +0 -1425
  566. package/dist/chunk-XOBD3EAM.js.map +0 -7
  567. package/dist/chunk-Y3TDC7NU.js +0 -170
  568. package/dist/chunk-YOTWMCT5.js +0 -824
  569. package/dist/chunk-YUMPQ3CJ.js +0 -203
  570. package/dist/condition-VHP2L4GM.js +0 -330
  571. package/dist/controls-N5Q7U7JR.js +0 -39
  572. package/dist/controls.config-NJMW4SLR.js +0 -37
  573. package/dist/correlation-3LDASF5I.js +0 -96
  574. package/dist/cuminc-UWJ23W6C.js +0 -1147
  575. package/dist/cuminc.integration.spec-OZYYET3W.js +0 -676
  576. package/dist/customdata.inputui-2FVCVSE4.js +0 -285
  577. package/dist/customdata.inputui-2FVCVSE4.js.map +0 -7
  578. package/dist/dataDownload-4S4PE5HX.js +0 -328
  579. package/dist/dataDownload.integration.spec-B57LEKFZ.js +0 -191
  580. package/dist/databrowser.ui-N6GHEQ2P.js +0 -419
  581. package/dist/dictionary-UP46QRYZ.js +0 -98
  582. package/dist/dictionary-UP46QRYZ.js.map +0 -7
  583. package/dist/dnaMethylation-BOGAUAWA.js +0 -36
  584. package/dist/dnaMethylation.integration.spec-UAHBJSSJ.js +0 -179
  585. package/dist/dnaMethylation.integration.spec-UAHBJSSJ.js.map +0 -7
  586. package/dist/e2pca-L5EBQJNP.js +0 -348
  587. package/dist/ep-Z67ORKUX.js +0 -1254
  588. package/dist/expclust.gdc.spec-SP7VOL64.js +0 -305
  589. package/dist/facet-HDB4VDGU.js +0 -519
  590. package/dist/geneExpClustering-6ZPOLTDJ.js +0 -246
  591. package/dist/geneExpression-T6YIG4XQ.js +0 -312
  592. package/dist/geneExpression-T7QUHV5S.js +0 -36
  593. package/dist/geneExpression.unit.spec-DO52L5IB.js +0 -100
  594. package/dist/geneORA-KOUDUWUO.js +0 -276
  595. package/dist/geneVariant-FVR76F6I.js +0 -39
  596. package/dist/geneVariant-I5QUITKG.js +0 -37
  597. package/dist/geneVariant.integration.spec-D4IRM7B5.js +0 -196
  598. package/dist/genefusion.ui-35IYSZD7.js +0 -249
  599. package/dist/geneset-7ZHJ5KWK.js +0 -194
  600. package/dist/genomeBrowser.spec-VXASVLNH.js +0 -279
  601. package/dist/grin2-7NM56COO.js +0 -1554
  602. package/dist/grin2-IY26UUQI.js +0 -1031
  603. package/dist/gsea-TORO46C6.js +0 -45
  604. package/dist/hierCluster-3BKEGW6P.js +0 -58
  605. package/dist/hierCluster-HM3LOM6V.js +0 -62
  606. package/dist/hierCluster.config-LDO5IGQ5.js +0 -38
  607. package/dist/hierCluster.integration.spec-XO5R6CQT.js +0 -374
  608. package/dist/hierCluster.interactivity-NVQ6262K.js +0 -52
  609. package/dist/hierCluster.renderers-SWPPNBLU.js +0 -21
  610. package/dist/imagePlot-V4WLAPV6.js +0 -139
  611. package/dist/importPlot-NZKQEOX4.js +0 -8
  612. package/dist/isoformExpression-TIZBIGNL.js +0 -38
  613. package/dist/isoformExpression.unit.spec-WHH5LPFG.js +0 -124
  614. package/dist/isoformExpression.unit.spec-WHH5LPFG.js.map +0 -7
  615. package/dist/jspdf.es.min-DO4YWL2R.js +0 -40
  616. package/dist/launch.adhoc-JYEN42NM.js +0 -40
  617. package/dist/leftlabel.sample-43DL3J3H.js +0 -257
  618. package/dist/legacyDataset-QRSNRVUA.js +0 -119
  619. package/dist/lollipop-NMWZ4FVF.js +0 -166
  620. package/dist/maf-DS3EOVGV.js +0 -450
  621. package/dist/maftimeline-ZB2753S7.js +0 -591
  622. package/dist/matrix-RCGQWQ3C.js +0 -57
  623. package/dist/matrix-WTTEK4FT.js +0 -62
  624. package/dist/matrix.cells-UO5ASQ35.js +0 -28
  625. package/dist/matrix.config-3UQAT3QR.js +0 -39
  626. package/dist/matrix.controls-PRZ77K5L.js +0 -37
  627. package/dist/matrix.data-4W73RQ3H.js +0 -25
  628. package/dist/matrix.dom-IZFFS4RQ.js +0 -11
  629. package/dist/matrix.groups-5VMPI7SA.js +0 -26
  630. package/dist/matrix.integration.spec-2F5LDLC2.js +0 -3070
  631. package/dist/matrix.interactivity-MIPZ6ELV.js +0 -40
  632. package/dist/matrix.layout-EO5LVYRO.js +0 -42
  633. package/dist/matrix.legend-QBFBFEUG.js +0 -22
  634. package/dist/matrix.renderers-ERJXVCQL.js +0 -36
  635. package/dist/matrix.serieses-E23EPXHA.js +0 -21
  636. package/dist/matrix.sort-I4UGMEXR.js +0 -27
  637. package/dist/matrix.sort.unit.spec-CRGF6CSE.js +0 -470
  638. package/dist/matrix.sorterUi-YLSYTYLE.js +0 -18
  639. package/dist/matrix.sorterUi.unit.spec-ENG3ICOO.js +0 -340
  640. package/dist/mavb-5WR7OJHI.js +0 -730
  641. package/dist/mds.fimo-3ZRH7BBJ.js +0 -516
  642. package/dist/mds.samplescatterplot-RPXR2FVK.js +0 -1548
  643. package/dist/mds.survivalplot-WSSMYUZD.js +0 -481
  644. package/dist/oncomatrix-JKYPUJQR.js +0 -293
  645. package/dist/oncomatrix.spec-OEGU4DYK.js +0 -446
  646. package/dist/plot.2dvaf-ZGARLQNK.js +0 -375
  647. package/dist/plot.app-TKUJH3LK.js +0 -39
  648. package/dist/plot.barplot-FEIPGDZ2.js +0 -100
  649. package/dist/plot.boxplot-6RASUMZB.js +0 -150
  650. package/dist/plot.brainImaging-ZJPFWX2W.js +0 -51
  651. package/dist/plot.disco-2KTKB3XX.js +0 -101
  652. package/dist/plot.disco-2KTKB3XX.js.map +0 -7
  653. package/dist/plot.dzi-PC34YI6Y.js +0 -33
  654. package/dist/plot.ssgq-Z4UNJKWO.js +0 -137
  655. package/dist/plot.vaf2cov-NZ4WULKT.js +0 -257
  656. package/dist/plot.wsi-YYXFAZWY.js +0 -36
  657. package/dist/polar-X2GPIBLB.js +0 -184
  658. package/dist/polar2-TZ553QQH.js +0 -226
  659. package/dist/profile.spec-VB6VMFLY.js +0 -78
  660. package/dist/profileBarchart-SKJSTC7B.js +0 -265
  661. package/dist/profileForms-RLOGSMAQ.js +0 -438
  662. package/dist/profilePlot-267ZS3RG.js +0 -52
  663. package/dist/profileRadar-KGOBHCSF.js +0 -261
  664. package/dist/profileRadarFacility-MCJKSHUM.js +0 -261
  665. package/dist/profileRadarFacility-MCJKSHUM.js.map +0 -7
  666. package/dist/proteomeAbundance-JUYAYO5I.js +0 -63
  667. package/dist/proteomeAbundance-PGHZSVAF.js +0 -19
  668. package/dist/qualitative-3IECKKJM.js +0 -41
  669. package/dist/regression-J6FFRPXN.js +0 -54
  670. package/dist/regression.inputs-T7LWBSYZ.js +0 -46
  671. package/dist/regression.inputs.term-TT7PNX6G.js +0 -46
  672. package/dist/regression.inputs.values.table-SHFUNKCS.js +0 -43
  673. package/dist/regression.integration.spec-QKHMJTHA.js +0 -784
  674. package/dist/regression.integration.spec-QKHMJTHA.js.map +0 -7
  675. package/dist/regression.results-D4WX6VIV.js +0 -38
  676. package/dist/regression.spec-7SW55L7X.js +0 -706
  677. package/dist/report-QYOZ4BRF.js +0 -220
  678. package/dist/sampleScatter.spec-JCHFMGNF.js +0 -200
  679. package/dist/sampleView-7RPKNAZC.js +0 -46
  680. package/dist/samplelst-4WNPHZVG.js +0 -109
  681. package/dist/samplematrix-CG52DSXJ.js +0 -2196
  682. package/dist/sc-OJSWILSA.js +0 -84
  683. package/dist/scatter-LG2RMMEC.js +0 -800
  684. package/dist/scatter.integration.spec-QPANYTKW.js +0 -1194
  685. package/dist/scatter.integration.spec-QPANYTKW.js.map +0 -7
  686. package/dist/selectGenomeWithTklst-QXRVE6N4.js +0 -132
  687. package/dist/singleCellCellType-XBSRL33U.js +0 -36
  688. package/dist/singleCellCellType.unit.spec-YZX4CSXA.js +0 -177
  689. package/dist/singleCellCellType.unit.spec-YZX4CSXA.js.map +0 -7
  690. package/dist/singleCellGeneExpression-64ECP62X.js +0 -36
  691. package/dist/singleCellGeneExpression.unit.spec-CFHFXMA6.js +0 -163
  692. package/dist/singleCellGeneExpression.unit.spec-CFHFXMA6.js.map +0 -7
  693. package/dist/singleCellPlot-E5F62JY6.js +0 -51
  694. package/dist/singlecell-FCY5EOUV.js +0 -84
  695. package/dist/singlecell-S7B5V7NK.js +0 -1570
  696. package/dist/snp-ACKX4GRX.js +0 -36
  697. package/dist/snp.unit.spec-QBGHKKUD.js +0 -174
  698. package/dist/snplocus-7EUOW7J7.js +0 -206
  699. package/dist/spliceevent.a53ss.diagram-ALQZA35Z.js +0 -149
  700. package/dist/spliceevent.exonskip.diagram-UF7WJA5R.js +0 -275
  701. package/dist/spliceevent.noeventdiagram-4HPGRNRR.js +0 -458
  702. package/dist/ssGSEA-FDRBBBLJ.js +0 -36
  703. package/dist/ssGSEA.unit.spec-EZEOWJVV.js +0 -86
  704. package/dist/summarizeCnvGeneexp-FTL2MGAJ.js +0 -158
  705. package/dist/summarizeCnvGeneexp-FTL2MGAJ.js.map +0 -7
  706. package/dist/summarizeGeneexpSurvival-DDIF4UW6.js +0 -105
  707. package/dist/summarizeGeneexpSurvival-DDIF4UW6.js.map +0 -7
  708. package/dist/summarizeMutationCnv-L3GL5YDY.js +0 -159
  709. package/dist/summarizeMutationCnv-L3GL5YDY.js.map +0 -7
  710. package/dist/summarizeMutationDiagnosis-LALOJTHV.js +0 -38
  711. package/dist/summarizeMutationSurvival-TSNTSOBZ.js +0 -97
  712. package/dist/summary-YRHVS64T.js +0 -47
  713. package/dist/summary.integration.spec-766YQLQA.js +0 -412
  714. package/dist/summaryInput-VQ2X6GSX.js +0 -218
  715. package/dist/sunburst-XFOONS6K.js +0 -282
  716. package/dist/sunburst-XFOONS6K.js.map +0 -7
  717. package/dist/survival-FQXZH2MM.js +0 -44
  718. package/dist/survival-TVA3ZWVP.js +0 -56
  719. package/dist/survival.integration.spec-WFIOPD6A.js +0 -787
  720. package/dist/svg2pdf.es.min-EZ4UYRSH.js +0 -3157
  721. package/dist/svgraph-4BFBO7EL.js +0 -1385
  722. package/dist/svmr-ML7GAIIA.js +0 -3840
  723. package/dist/table-SMLMUWPP.js +0 -198
  724. package/dist/termCollection-22CPTISZ.js +0 -36
  725. package/dist/termCollection-EE6AOIVA.js +0 -177
  726. package/dist/termCollection.unit.spec-4DIW3CJ3.js +0 -206
  727. package/dist/tk-ITZCKOQ5.js +0 -44
  728. package/dist/tp.ui-R6HVKCBC.js +0 -1457
  729. package/dist/tvs.density-AQ5GD437.js +0 -18
  730. package/dist/tvs.dt-2263TBEJ.js +0 -37
  731. package/dist/tvs.dtcnv.categorical-TRRHL33N.js +0 -38
  732. package/dist/tvs.dtcnv.continuous-GREYNF52.js +0 -70
  733. package/dist/tvs.dtfusion-XOX46L3M.js +0 -38
  734. package/dist/tvs.dtsnvindel-IDMXT53F.js +0 -38
  735. package/dist/tvs.dtsv-ZDWFYH2C.js +0 -38
  736. package/dist/tvs.numeric-ZN2R7BH3.js +0 -21
  737. package/dist/tvs.samplelst-GAP76HRH.js +0 -102
  738. package/dist/tvs.termCollection-GQ65UKSI.js +0 -151
  739. package/dist/violin-JGDL62YA.js +0 -44
  740. package/dist/violin.integration.spec-W4NN7LBY.js +0 -1417
  741. package/dist/violin.integration.spec-W4NN7LBY.js.map +0 -7
  742. package/dist/violin.interactivity-H4RP4K5U.js +0 -36
  743. package/dist/violin.renderer-QPHLACDC.js +0 -38
  744. package/dist/vocabulary-7JACY4J2.js +0 -39
  745. /package/dist/{2dmaf-SLBAWGPG.js.map → 2dmaf-6ZTETSC5.js.map} +0 -0
  746. /package/dist/{AppHeader-MVYNRMC7.js.map → AppHeader-U7SJPIBS.js.map} +0 -0
  747. /package/dist/{CorrelationVolcano-TZCYC3NI.js.map → CorrelationVolcano-7SE4CTBW.js.map} +0 -0
  748. /package/dist/{DE-2J2SK5UT.js.map → DE-PZ7RHPBS.js.map} +0 -0
  749. /package/dist/{DEinput-QM3GOQHM.js.map → DEinput-UZEQIU2V.js.map} +0 -0
  750. /package/dist/{DifferentialAnalysis-DS7CQOT6.js.map → DifferentialAnalysis-L6BOEYVO.js.map} +0 -0
  751. /package/dist/{Disco.UI-J2B7GGEZ.js.map → Disco.UI-HKOUAD4P.js.map} +0 -0
  752. /package/dist/{DmrPlot-D5W76QPY.js.map → DmrPlot-3R24PTXP.js.map} +0 -0
  753. /package/dist/{GB-LM5SGUG4.js.map → GB-SZVYZASR.js.map} +0 -0
  754. /package/dist/{HicApp-YNBGAGKM.js.map → HicApp-SEEJETVE.js.map} +0 -0
  755. /package/dist/{NumBinaryEditor-4QA5DQJT.js.map → NumBinaryEditor-SDQFJ3FW.js.map} +0 -0
  756. /package/dist/{NumBinaryEditor.unit.spec-YWSIFTOJ.js.map → NumBinaryEditor.unit.spec-76ZZXTYC.js.map} +0 -0
  757. /package/dist/{NumContEditor-ZPLVZFLH.js.map → NumContEditor-G75O4YZE.js.map} +0 -0
  758. /package/dist/{NumContEditor.unit.spec-NBCFOCOX.js.map → NumContEditor.unit.spec-BFUZRBPL.js.map} +0 -0
  759. /package/dist/{NumCustomBinEditor-TXEYRVPL.js.map → NumCustomBinEditor-ILTPHCEF.js.map} +0 -0
  760. /package/dist/{NumCustomBinEditor.unit.spec-SQM63H4B.js.map → NumCustomBinEditor.unit.spec-GFIYV55V.js.map} +0 -0
  761. /package/dist/{NumDiscreteEditor-6C4OWX62.js.map → NumDiscreteEditor-5K3OKUOE.js.map} +0 -0
  762. /package/dist/{NumDiscreteEditor.unit.spec-4HC4AGAM.js.map → NumDiscreteEditor.unit.spec-NZ4KWPFK.js.map} +0 -0
  763. /package/dist/{NumRegularBinEditor-VQAS3OXK.js.map → NumRegularBinEditor-7ZJ2MEMY.js.map} +0 -0
  764. /package/dist/{NumRegularBinEditor.unit.spec-RGVEPB3Z.js.map → NumRegularBinEditor.unit.spec-QGVJET65.js.map} +0 -0
  765. /package/dist/{NumSplineEditor-SXOJICHU.js.map → NumSplineEditor-KE4UPODZ.js.map} +0 -0
  766. /package/dist/{NumSplineEditor.unit.spec-HF5E6ANH.js.map → NumSplineEditor.unit.spec-YQOOZA7S.js.map} +0 -0
  767. /package/dist/{NumericDensity-LMLPMOSE.js.map → NumericDensity-RL42P4QC.js.map} +0 -0
  768. /package/dist/{NumericDensity.unit.spec-3ZI5EVON.js.map → NumericDensity.unit.spec-Y6RMTYC7.js.map} +0 -0
  769. /package/dist/{NumericHandler-Q6F6ANOS.js.map → NumericHandler-4QIX324I.js.map} +0 -0
  770. /package/dist/{NumericHandler.unit.spec-E6Z5HUNZ.js.map → NumericHandler.unit.spec-T6F5QYP6.js.map} +0 -0
  771. /package/dist/{WsiSamplesPlot-KMI5S2EL.js.map → WsiSamplesPlot-CXGWPCDL.js.map} +0 -0
  772. /package/dist/{adSandbox-JTK5XEQL.js.map → adSandbox-DE4VRO4Z.js.map} +0 -0
  773. /package/dist/{alphaGenome-JRAV6WIY.js.map → alphaGenome-FSIGC5ZT.js.map} +0 -0
  774. /package/dist/{app-JKDZL23V.js.map → app-KZGKWQMU.js.map} +0 -0
  775. /package/dist/{app-OEARXM6E.js.map → app-MQRJ7FVL.js.map} +0 -0
  776. /package/dist/{bam-CYEPLBK4.js.map → bam-BDWTA4O3.js.map} +0 -0
  777. /package/dist/{barchart-GG5UFDG4.js.map → barchart-4Q6LVJY4.js.map} +0 -0
  778. /package/dist/{barchart.data-KXA66FAL.js.map → barchart.data-EXENRVMU.js.map} +0 -0
  779. /package/dist/{barchart.events-P2USOIR7.js.map → barchart.events-XRGND6I7.js.map} +0 -0
  780. /package/dist/{barchart.integration.spec-5QSPQQLJ.js.map → barchart.integration.spec-VQITP4YH.js.map} +0 -0
  781. /package/dist/{bars.renderer-T5R3UIBW.js.map → bars.renderer-S7A7I6BQ.js.map} +0 -0
  782. /package/dist/{block.init-ZHX6DFWF.js.map → block.init-NCNSE3HD.js.map} +0 -0
  783. /package/dist/{block.mds.expressionrank-YMGYXXYT.js.map → block.mds.expressionrank-JYZARS7T.js.map} +0 -0
  784. /package/dist/{block.mds.geneboxplot-IAILQYX4.js.map → block.mds.geneboxplot-FD2MCIHV.js.map} +0 -0
  785. /package/dist/{block.mds.junction-BRNFNQMU.js.map → block.mds.junction-LOHVQBIU.js.map} +0 -0
  786. /package/dist/{block.mds.svcnv-OHKC7YPO.js.map → block.mds.svcnv-Z7SAYPQL.js.map} +0 -0
  787. /package/dist/{block.svg-PNGK45HW.js.map → block.svg-LNJOKQNN.js.map} +0 -0
  788. /package/dist/{block.tk.aicheck-SCIOJ4WN.js.map → block.tk.aicheck-IXCMMAGV.js.map} +0 -0
  789. /package/dist/{block.tk.ase-BABJ73GG.js.map → block.tk.ase-WYRYFP6N.js.map} +0 -0
  790. /package/dist/{block.tk.bam-LZWJ5BCQ.js.map → block.tk.bam-EIVBNGAL.js.map} +0 -0
  791. /package/dist/{block.tk.bedgraphdot-7NQLC3XJ.js.map → block.tk.bedgraphdot-3FHLNCU7.js.map} +0 -0
  792. /package/dist/{block.tk.bigwig.ui-VNY4SFD5.js.map → block.tk.bigwig.ui-YDQU5PC4.js.map} +0 -0
  793. /package/dist/{block.tk.hicstraw-36A7VDRM.js.map → block.tk.hicstraw-S3ROL3CV.js.map} +0 -0
  794. /package/dist/{block.tk.junction-D373YEMK.js.map → block.tk.junction-DL7RNWX3.js.map} +0 -0
  795. /package/dist/{block.tk.junction.textmatrixui-FFII7J3X.js.map → block.tk.junction.textmatrixui-Z6I7IEDY.js.map} +0 -0
  796. /package/dist/{block.tk.ld-XGB6KMDO.js.map → block.tk.ld-XHVU6L56.js.map} +0 -0
  797. /package/dist/{block.tk.menu-PEZANZBZ.js.map → block.tk.menu-FPLAEEFY.js.map} +0 -0
  798. /package/dist/{block.tk.pgv-MU5BPTT2.js.map → block.tk.pgv-6ZZ2QGNO.js.map} +0 -0
  799. /package/dist/{brainImaging-LVJON47N.js.map → brainImaging-VSOOMITW.js.map} +0 -0
  800. /package/dist/{chat-5FDIAQJ4.js.map → chat-LW23PIG5.js.map} +0 -0
  801. /package/dist/{chunk-PQABAAEZ.js.map → chunk-2LULD7RN.js.map} +0 -0
  802. /package/dist/{chunk-LEDPPLQK.js.map → chunk-3AGB6HL4.js.map} +0 -0
  803. /package/dist/{chunk-T2HYA2KL.js.map → chunk-3AVDNIDN.js.map} +0 -0
  804. /package/dist/{chunk-JOXUBWN3.js.map → chunk-3DCABJHB.js.map} +0 -0
  805. /package/dist/{chunk-UQACPOCM.js.map → chunk-3JMB3OSC.js.map} +0 -0
  806. /package/dist/{chunk-2J3566TA.js.map → chunk-3UEMY45Y.js.map} +0 -0
  807. /package/dist/{chunk-ILF2GKBY.js.map → chunk-4RR4KPRJ.js.map} +0 -0
  808. /package/dist/{chunk-TE3DK3A6.js.map → chunk-5HCB4HNL.js.map} +0 -0
  809. /package/dist/{chunk-IP4T477W.js.map → chunk-5RFB7TYT.js.map} +0 -0
  810. /package/dist/{chunk-7A7NMCQ3.js.map → chunk-5UMPBVA6.js.map} +0 -0
  811. /package/dist/{chunk-MXI3NXRB.js.map → chunk-6C2SBTLR.js.map} +0 -0
  812. /package/dist/{chunk-UBS5UVIY.js.map → chunk-6LAE5AVA.js.map} +0 -0
  813. /package/dist/{chunk-JHOGX5VE.js.map → chunk-7VV43ICF.js.map} +0 -0
  814. /package/dist/{chunk-O4PXELXF.js.map → chunk-A742TQD2.js.map} +0 -0
  815. /package/dist/{chunk-E6DRQJJT.js.map → chunk-AFLFPYJI.js.map} +0 -0
  816. /package/dist/{chunk-DONWY7TP.js.map → chunk-AQ4OP4GR.js.map} +0 -0
  817. /package/dist/{chunk-FQRLSKJC.js.map → chunk-BAY47D5E.js.map} +0 -0
  818. /package/dist/{chunk-TN5GSG34.js.map → chunk-CFHKYLDY.js.map} +0 -0
  819. /package/dist/{chunk-K6JLCMVL.js.map → chunk-CTAKX5CT.js.map} +0 -0
  820. /package/dist/{chunk-Y3TDC7NU.js.map → chunk-D4QFQQWJ.js.map} +0 -0
  821. /package/dist/{chunk-YUMPQ3CJ.js.map → chunk-DGMK7SXX.js.map} +0 -0
  822. /package/dist/{chunk-UR3C4SCH.js.map → chunk-DNCSPTOQ.js.map} +0 -0
  823. /package/dist/{chunk-IIRU6VK2.js.map → chunk-DTDQKGIQ.js.map} +0 -0
  824. /package/dist/{chunk-K57RR3FD.js.map → chunk-E4NVHKWD.js.map} +0 -0
  825. /package/dist/{chunk-GKK3CZ6H.js.map → chunk-E6KEZENR.js.map} +0 -0
  826. /package/dist/{chunk-X6UPDFDX.js.map → chunk-FRBYOOWT.js.map} +0 -0
  827. /package/dist/{chunk-UWX7W22M.js.map → chunk-FVWCYGJL.js.map} +0 -0
  828. /package/dist/{chunk-CCIZJAXB.js.map → chunk-I4IKRKYJ.js.map} +0 -0
  829. /package/dist/{chunk-W6UUEAEP.js.map → chunk-IEQSUAIO.js.map} +0 -0
  830. /package/dist/{chunk-UBGTQMOO.js.map → chunk-JMPSZMDD.js.map} +0 -0
  831. /package/dist/{chunk-MPJHDHBA.js.map → chunk-JXOL73PT.js.map} +0 -0
  832. /package/dist/{chunk-KSFSM46X.js.map → chunk-K62XUHA4.js.map} +0 -0
  833. /package/dist/{chunk-DVDDXOWT.js.map → chunk-KQMEJUWI.js.map} +0 -0
  834. /package/dist/{chunk-FGMPKWT5.js.map → chunk-LI7FE335.js.map} +0 -0
  835. /package/dist/{chunk-AZYDW5T7.js.map → chunk-MV6O4I2B.js.map} +0 -0
  836. /package/dist/{chunk-PIACSJPH.js.map → chunk-MXNSW55L.js.map} +0 -0
  837. /package/dist/{chunk-HAMDFQIX.js.map → chunk-NB7NLFGZ.js.map} +0 -0
  838. /package/dist/{chunk-FBAJTPBU.js.map → chunk-NGGWK6HX.js.map} +0 -0
  839. /package/dist/{chunk-P5HLYAHP.js.map → chunk-OGGFS66K.js.map} +0 -0
  840. /package/dist/{chunk-DHZL3FBC.js.map → chunk-Q7PYFSNU.js.map} +0 -0
  841. /package/dist/{chunk-GPOECA3V.js.map → chunk-QMI222IJ.js.map} +0 -0
  842. /package/dist/{chunk-AETE4F7R.js.map → chunk-QRIRWDIW.js.map} +0 -0
  843. /package/dist/{chunk-ORPCSG6T.js.map → chunk-R6L6NVEC.js.map} +0 -0
  844. /package/dist/{chunk-B6HCIAM3.js.map → chunk-RLTLYKHO.js.map} +0 -0
  845. /package/dist/{chunk-VLTDUJRM.js.map → chunk-S5ZI6N2I.js.map} +0 -0
  846. /package/dist/{chunk-H2D7EVUA.js.map → chunk-S7T7OZC7.js.map} +0 -0
  847. /package/dist/{chunk-F6V4AYWP.js.map → chunk-SEQLC4AD.js.map} +0 -0
  848. /package/dist/{chunk-RSU37SVQ.js.map → chunk-TEZLFSOV.js.map} +0 -0
  849. /package/dist/{chunk-YOTWMCT5.js.map → chunk-UEMTP6ZC.js.map} +0 -0
  850. /package/dist/{chunk-6MSCYO7K.js.map → chunk-UJU3Q7QJ.js.map} +0 -0
  851. /package/dist/{chunk-RFIVPTMS.js.map → chunk-VIPMLSZP.js.map} +0 -0
  852. /package/dist/{chunk-LUTT3MBZ.js.map → chunk-VUUZJANK.js.map} +0 -0
  853. /package/dist/{chunk-2OSEZCWZ.js.map → chunk-WGHO2NCP.js.map} +0 -0
  854. /package/dist/{chunk-GO5SIPFE.js.map → chunk-WPHOEG56.js.map} +0 -0
  855. /package/dist/{chunk-KVG7FTTK.js.map → chunk-WS5XVKPJ.js.map} +0 -0
  856. /package/dist/{chunk-MNRYCG2S.js.map → chunk-X6URQAFD.js.map} +0 -0
  857. /package/dist/{chunk-VJ37HKM6.js.map → chunk-YALAQWX4.js.map} +0 -0
  858. /package/dist/{chunk-H2K5KZP7.js.map → chunk-YY4CKQJ6.js.map} +0 -0
  859. /package/dist/{chunk-G6ELKVBG.js.map → chunk-Z3KV6SC2.js.map} +0 -0
  860. /package/dist/{condition-VHP2L4GM.js.map → condition-JKQIRMMW.js.map} +0 -0
  861. /package/dist/{controls-N5Q7U7JR.js.map → controls-324AGOZG.js.map} +0 -0
  862. /package/dist/{controls.config-NJMW4SLR.js.map → controls.config-TA4NNARU.js.map} +0 -0
  863. /package/dist/{correlation-3LDASF5I.js.map → correlation-3Z36TKC2.js.map} +0 -0
  864. /package/dist/{cuminc-UWJ23W6C.js.map → cuminc-4DY2CSZF.js.map} +0 -0
  865. /package/dist/{cuminc.integration.spec-OZYYET3W.js.map → cuminc.integration.spec-SFQPLMSF.js.map} +0 -0
  866. /package/dist/{dataDownload-4S4PE5HX.js.map → dataDownload-3AE2N7KI.js.map} +0 -0
  867. /package/dist/{dataDownload.integration.spec-B57LEKFZ.js.map → dataDownload.integration.spec-DKOT6BJP.js.map} +0 -0
  868. /package/dist/{databrowser.ui-N6GHEQ2P.js.map → databrowser.ui-ATODRS5P.js.map} +0 -0
  869. /package/dist/{dnaMethylation-BOGAUAWA.js.map → dnaMethylation-TVA5YMOR.js.map} +0 -0
  870. /package/dist/{e2pca-L5EBQJNP.js.map → e2pca-KHVDNFEZ.js.map} +0 -0
  871. /package/dist/{ep-Z67ORKUX.js.map → ep-B5GAAMNM.js.map} +0 -0
  872. /package/dist/{expclust.gdc.spec-SP7VOL64.js.map → expclust.gdc.spec-EDPX7V6K.js.map} +0 -0
  873. /package/dist/{facet-HDB4VDGU.js.map → facet-ZCSXKXIO.js.map} +0 -0
  874. /package/dist/{geneExpClustering-6ZPOLTDJ.js.map → geneExpClustering-ERNCMAED.js.map} +0 -0
  875. /package/dist/{geneExpression-T7QUHV5S.js.map → geneExpression-HUOXWETT.js.map} +0 -0
  876. /package/dist/{geneExpression-T6YIG4XQ.js.map → geneExpression-X2KXJPND.js.map} +0 -0
  877. /package/dist/{geneExpression.unit.spec-DO52L5IB.js.map → geneExpression.unit.spec-5QQB4ISW.js.map} +0 -0
  878. /package/dist/{geneORA-KOUDUWUO.js.map → geneORA-B5UK77KL.js.map} +0 -0
  879. /package/dist/{geneVariant-FVR76F6I.js.map → geneVariant-7MGUAIZ6.js.map} +0 -0
  880. /package/dist/{geneVariant-I5QUITKG.js.map → geneVariant-FK3KZJ2K.js.map} +0 -0
  881. /package/dist/{geneVariant.integration.spec-D4IRM7B5.js.map → geneVariant.integration.spec-C6TYWKIC.js.map} +0 -0
  882. /package/dist/{genefusion.ui-35IYSZD7.js.map → genefusion.ui-VKAINMY7.js.map} +0 -0
  883. /package/dist/{geneset-7ZHJ5KWK.js.map → geneset-673KAZVX.js.map} +0 -0
  884. /package/dist/{genomeBrowser.spec-VXASVLNH.js.map → genomeBrowser.spec-T6TQCJ3O.js.map} +0 -0
  885. /package/dist/{grin2-7NM56COO.js.map → grin2-376BD4XY.js.map} +0 -0
  886. /package/dist/{grin2-IY26UUQI.js.map → grin2-OALS75LC.js.map} +0 -0
  887. /package/dist/{gsea-TORO46C6.js.map → gsea-25LD2LGP.js.map} +0 -0
  888. /package/dist/{hierCluster-3BKEGW6P.js.map → hierCluster-7KU3K52V.js.map} +0 -0
  889. /package/dist/{hierCluster-HM3LOM6V.js.map → hierCluster-M5VVWKQK.js.map} +0 -0
  890. /package/dist/{hierCluster.config-LDO5IGQ5.js.map → hierCluster.config-EDO3SH2P.js.map} +0 -0
  891. /package/dist/{hierCluster.integration.spec-XO5R6CQT.js.map → hierCluster.integration.spec-UOX7J2XD.js.map} +0 -0
  892. /package/dist/{hierCluster.interactivity-NVQ6262K.js.map → hierCluster.interactivity-FEFZDXML.js.map} +0 -0
  893. /package/dist/{hierCluster.renderers-SWPPNBLU.js.map → hierCluster.renderers-A6MEGO2B.js.map} +0 -0
  894. /package/dist/{imagePlot-V4WLAPV6.js.map → imagePlot-FPXZ2H5Z.js.map} +0 -0
  895. /package/dist/{importPlot-NZKQEOX4.js.map → importPlot-VKWPSFEK.js.map} +0 -0
  896. /package/dist/{isoformExpression-TIZBIGNL.js.map → isoformExpression-2R2TOB6P.js.map} +0 -0
  897. /package/dist/{jspdf.es.min-DO4YWL2R.js.map → jspdf.es.min-FC3BCETM.js.map} +0 -0
  898. /package/dist/{launch.adhoc-JYEN42NM.js.map → launch.adhoc-242RS6DW.js.map} +0 -0
  899. /package/dist/{leftlabel.sample-43DL3J3H.js.map → leftlabel.sample-OJW3AE64.js.map} +0 -0
  900. /package/dist/{legacyDataset-QRSNRVUA.js.map → legacyDataset-PBCPC5I7.js.map} +0 -0
  901. /package/dist/{lollipop-NMWZ4FVF.js.map → lollipop-TRQ3LK7Y.js.map} +0 -0
  902. /package/dist/{maf-DS3EOVGV.js.map → maf-ZBOLN2FE.js.map} +0 -0
  903. /package/dist/{maftimeline-ZB2753S7.js.map → maftimeline-GVX7NJP7.js.map} +0 -0
  904. /package/dist/{matrix-RCGQWQ3C.js.map → matrix-73KRNXLM.js.map} +0 -0
  905. /package/dist/{matrix-WTTEK4FT.js.map → matrix-US3OXYRY.js.map} +0 -0
  906. /package/dist/{matrix.cells-UO5ASQ35.js.map → matrix.cells-U7AQNEBP.js.map} +0 -0
  907. /package/dist/{matrix.config-3UQAT3QR.js.map → matrix.config-Q57D7C3F.js.map} +0 -0
  908. /package/dist/{matrix.controls-PRZ77K5L.js.map → matrix.controls-AWXDRSWP.js.map} +0 -0
  909. /package/dist/{matrix.data-4W73RQ3H.js.map → matrix.data-EEIY6AO4.js.map} +0 -0
  910. /package/dist/{matrix.dom-IZFFS4RQ.js.map → matrix.dom-6QL3AJMW.js.map} +0 -0
  911. /package/dist/{matrix.groups-5VMPI7SA.js.map → matrix.groups-CUB6UWC5.js.map} +0 -0
  912. /package/dist/{matrix.integration.spec-2F5LDLC2.js.map → matrix.integration.spec-PQH67KRM.js.map} +0 -0
  913. /package/dist/{matrix.interactivity-MIPZ6ELV.js.map → matrix.interactivity-JW4AXAWO.js.map} +0 -0
  914. /package/dist/{matrix.layout-EO5LVYRO.js.map → matrix.layout-I56KRVCO.js.map} +0 -0
  915. /package/dist/{matrix.legend-QBFBFEUG.js.map → matrix.legend-42LQGAGX.js.map} +0 -0
  916. /package/dist/{matrix.renderers-ERJXVCQL.js.map → matrix.renderers-IX3FCNBK.js.map} +0 -0
  917. /package/dist/{matrix.serieses-E23EPXHA.js.map → matrix.serieses-4B2WB526.js.map} +0 -0
  918. /package/dist/{matrix.sort-I4UGMEXR.js.map → matrix.sort-BJACNR7G.js.map} +0 -0
  919. /package/dist/{matrix.sort.unit.spec-CRGF6CSE.js.map → matrix.sort.unit.spec-3KKDKIPY.js.map} +0 -0
  920. /package/dist/{matrix.sorterUi-YLSYTYLE.js.map → matrix.sorterUi-W6XFYZY2.js.map} +0 -0
  921. /package/dist/{matrix.sorterUi.unit.spec-ENG3ICOO.js.map → matrix.sorterUi.unit.spec-CMJ7EBIW.js.map} +0 -0
  922. /package/dist/{mavb-5WR7OJHI.js.map → mavb-ROAE6WYA.js.map} +0 -0
  923. /package/dist/{mds.fimo-3ZRH7BBJ.js.map → mds.fimo-UGK5OWCF.js.map} +0 -0
  924. /package/dist/{mds.samplescatterplot-RPXR2FVK.js.map → mds.samplescatterplot-5KFUAYSB.js.map} +0 -0
  925. /package/dist/{mds.survivalplot-WSSMYUZD.js.map → mds.survivalplot-2EVNZUX5.js.map} +0 -0
  926. /package/dist/{oncomatrix-JKYPUJQR.js.map → oncomatrix-UGFXSXQJ.js.map} +0 -0
  927. /package/dist/{oncomatrix.spec-OEGU4DYK.js.map → oncomatrix.spec-FEP7BR7L.js.map} +0 -0
  928. /package/dist/{plot.2dvaf-ZGARLQNK.js.map → plot.2dvaf-WXGLWCOC.js.map} +0 -0
  929. /package/dist/{plot.app-TKUJH3LK.js.map → plot.app-IZAFRTBU.js.map} +0 -0
  930. /package/dist/{plot.barplot-FEIPGDZ2.js.map → plot.barplot-Z4VWOPFJ.js.map} +0 -0
  931. /package/dist/{plot.boxplot-6RASUMZB.js.map → plot.boxplot-QU2KZSB7.js.map} +0 -0
  932. /package/dist/{plot.brainImaging-ZJPFWX2W.js.map → plot.brainImaging-U643YIK7.js.map} +0 -0
  933. /package/dist/{plot.dzi-PC34YI6Y.js.map → plot.dzi-DWXPOOQE.js.map} +0 -0
  934. /package/dist/{plot.ssgq-Z4UNJKWO.js.map → plot.ssgq-GXB2GZO3.js.map} +0 -0
  935. /package/dist/{plot.vaf2cov-NZ4WULKT.js.map → plot.vaf2cov-EKRIADPB.js.map} +0 -0
  936. /package/dist/{plot.wsi-YYXFAZWY.js.map → plot.wsi-E2LLE6HI.js.map} +0 -0
  937. /package/dist/{polar-X2GPIBLB.js.map → polar-MZLIUXHO.js.map} +0 -0
  938. /package/dist/{polar2-TZ553QQH.js.map → polar2-IUVHNQM4.js.map} +0 -0
  939. /package/dist/{profile.spec-VB6VMFLY.js.map → profile.spec-JRW6KYUI.js.map} +0 -0
  940. /package/dist/{profileBarchart-SKJSTC7B.js.map → profileBarchart-N7HJMYZ5.js.map} +0 -0
  941. /package/dist/{profileForms-RLOGSMAQ.js.map → profileForms-Q5TPGPQP.js.map} +0 -0
  942. /package/dist/{profilePlot-267ZS3RG.js.map → profilePlot-TXTUYDVE.js.map} +0 -0
  943. /package/dist/{profileRadar-KGOBHCSF.js.map → profileRadar-ICEASI7W.js.map} +0 -0
  944. /package/dist/{proteomeAbundance-PGHZSVAF.js.map → proteomeAbundance-DE4NVBCN.js.map} +0 -0
  945. /package/dist/{proteomeAbundance-JUYAYO5I.js.map → proteomeAbundance-LTB3QR3G.js.map} +0 -0
  946. /package/dist/{qualitative-3IECKKJM.js.map → qualitative-DFGWQURY.js.map} +0 -0
  947. /package/dist/{regression-J6FFRPXN.js.map → regression-TTQTAEGD.js.map} +0 -0
  948. /package/dist/{regression.inputs-T7LWBSYZ.js.map → regression.inputs-2LU2XRGC.js.map} +0 -0
  949. /package/dist/{regression.inputs.term-TT7PNX6G.js.map → regression.inputs.term-G57GL57T.js.map} +0 -0
  950. /package/dist/{regression.inputs.values.table-SHFUNKCS.js.map → regression.inputs.values.table-JSEM3PXL.js.map} +0 -0
  951. /package/dist/{regression.results-D4WX6VIV.js.map → regression.results-3YNM6LLQ.js.map} +0 -0
  952. /package/dist/{regression.spec-7SW55L7X.js.map → regression.spec-S6WFCPSW.js.map} +0 -0
  953. /package/dist/{report-QYOZ4BRF.js.map → report-YRAV4MY4.js.map} +0 -0
  954. /package/dist/{sampleScatter.spec-JCHFMGNF.js.map → sampleScatter.spec-MBJ4XNTX.js.map} +0 -0
  955. /package/dist/{sampleView-7RPKNAZC.js.map → sampleView-IUR3ZEN7.js.map} +0 -0
  956. /package/dist/{samplelst-4WNPHZVG.js.map → samplelst-C2NBFGH6.js.map} +0 -0
  957. /package/dist/{samplematrix-CG52DSXJ.js.map → samplematrix-AOK2HHSB.js.map} +0 -0
  958. /package/dist/{sc-OJSWILSA.js.map → sc-XT3Z5XJI.js.map} +0 -0
  959. /package/dist/{scatter-LG2RMMEC.js.map → scatter-SAHKZRFL.js.map} +0 -0
  960. /package/dist/{selectGenomeWithTklst-QXRVE6N4.js.map → selectGenomeWithTklst-2YVZ4JWV.js.map} +0 -0
  961. /package/dist/{singleCellCellType-XBSRL33U.js.map → singleCellCellType-NFN5GQJM.js.map} +0 -0
  962. /package/dist/{singleCellGeneExpression-64ECP62X.js.map → singleCellGeneExpression-7AQGLXTR.js.map} +0 -0
  963. /package/dist/{singleCellPlot-E5F62JY6.js.map → singleCellPlot-IWFEG44C.js.map} +0 -0
  964. /package/dist/{singlecell-S7B5V7NK.js.map → singlecell-3QNV4OMZ.js.map} +0 -0
  965. /package/dist/{singlecell-FCY5EOUV.js.map → singlecell-EATPLH66.js.map} +0 -0
  966. /package/dist/{snp-ACKX4GRX.js.map → snp-UP7WL7WG.js.map} +0 -0
  967. /package/dist/{snp.unit.spec-QBGHKKUD.js.map → snp.unit.spec-Y5NWQ442.js.map} +0 -0
  968. /package/dist/{snplocus-7EUOW7J7.js.map → snplocus-WAQK2AZG.js.map} +0 -0
  969. /package/dist/{spliceevent.a53ss.diagram-ALQZA35Z.js.map → spliceevent.a53ss.diagram-FFK27UIB.js.map} +0 -0
  970. /package/dist/{spliceevent.exonskip.diagram-UF7WJA5R.js.map → spliceevent.exonskip.diagram-KWEF2OZJ.js.map} +0 -0
  971. /package/dist/{spliceevent.noeventdiagram-4HPGRNRR.js.map → spliceevent.noeventdiagram-PU4TI7OM.js.map} +0 -0
  972. /package/dist/{ssGSEA-FDRBBBLJ.js.map → ssGSEA-N6QOAVLW.js.map} +0 -0
  973. /package/dist/{ssGSEA.unit.spec-EZEOWJVV.js.map → ssGSEA.unit.spec-KQBNZNNP.js.map} +0 -0
  974. /package/dist/{summarizeMutationDiagnosis-LALOJTHV.js.map → summarizeMutationDiagnosis-5RHSG7L6.js.map} +0 -0
  975. /package/dist/{summarizeMutationSurvival-TSNTSOBZ.js.map → summarizeMutationSurvival-22YYXGS5.js.map} +0 -0
  976. /package/dist/{summary-YRHVS64T.js.map → summary-P3WIKJS7.js.map} +0 -0
  977. /package/dist/{summary.integration.spec-766YQLQA.js.map → summary.integration.spec-ULGRPICW.js.map} +0 -0
  978. /package/dist/{summaryInput-VQ2X6GSX.js.map → summaryInput-IH4EVNF5.js.map} +0 -0
  979. /package/dist/{survival-FQXZH2MM.js.map → survival-2ZE3N62A.js.map} +0 -0
  980. /package/dist/{survival-TVA3ZWVP.js.map → survival-ASCLKIII.js.map} +0 -0
  981. /package/dist/{survival.integration.spec-WFIOPD6A.js.map → survival.integration.spec-C5YXOY77.js.map} +0 -0
  982. /package/dist/{svg2pdf.es.min-EZ4UYRSH.js.map → svg2pdf.es.min-CYTPRWNB.js.map} +0 -0
  983. /package/dist/{svgraph-4BFBO7EL.js.map → svgraph-AYR2UPNK.js.map} +0 -0
  984. /package/dist/{svmr-ML7GAIIA.js.map → svmr-MOMW5DNY.js.map} +0 -0
  985. /package/dist/{table-SMLMUWPP.js.map → table-PQB6KCEY.js.map} +0 -0
  986. /package/dist/{termCollection-22CPTISZ.js.map → termCollection-5AY2AWT4.js.map} +0 -0
  987. /package/dist/{termCollection-EE6AOIVA.js.map → termCollection-OQMUUTW6.js.map} +0 -0
  988. /package/dist/{termCollection.unit.spec-4DIW3CJ3.js.map → termCollection.unit.spec-BUAXYIJK.js.map} +0 -0
  989. /package/dist/{tk-ITZCKOQ5.js.map → tk-EJLFFA5H.js.map} +0 -0
  990. /package/dist/{tp.ui-R6HVKCBC.js.map → tp.ui-WUW6A7KP.js.map} +0 -0
  991. /package/dist/{tvs.density-AQ5GD437.js.map → tvs.density-HSVPDDGA.js.map} +0 -0
  992. /package/dist/{tvs.dt-2263TBEJ.js.map → tvs.dt-MVJXQMNU.js.map} +0 -0
  993. /package/dist/{tvs.dtcnv.categorical-TRRHL33N.js.map → tvs.dtcnv.categorical-FIIDWVK7.js.map} +0 -0
  994. /package/dist/{tvs.dtcnv.continuous-GREYNF52.js.map → tvs.dtcnv.continuous-JPQU3JA2.js.map} +0 -0
  995. /package/dist/{tvs.dtfusion-XOX46L3M.js.map → tvs.dtfusion-BW35GOQM.js.map} +0 -0
  996. /package/dist/{tvs.dtsnvindel-IDMXT53F.js.map → tvs.dtsnvindel-AEMFZ4EH.js.map} +0 -0
  997. /package/dist/{tvs.dtsv-ZDWFYH2C.js.map → tvs.dtsv-JHTU7UFD.js.map} +0 -0
  998. /package/dist/{tvs.numeric-ZN2R7BH3.js.map → tvs.numeric-ICUGA4WY.js.map} +0 -0
  999. /package/dist/{tvs.samplelst-GAP76HRH.js.map → tvs.samplelst-VD2NFFFS.js.map} +0 -0
  1000. /package/dist/{tvs.termCollection-GQ65UKSI.js.map → tvs.termCollection-IKE5Q74D.js.map} +0 -0
  1001. /package/dist/{violin-JGDL62YA.js.map → violin-DPMJLHQG.js.map} +0 -0
  1002. /package/dist/{violin.interactivity-H4RP4K5U.js.map → violin.interactivity-TS4DYUE5.js.map} +0 -0
  1003. /package/dist/{violin.renderer-QPHLACDC.js.map → violin.renderer-53L4PXUT.js.map} +0 -0
  1004. /package/dist/{vocabulary-7JACY4J2.js.map → vocabulary-4MPFHKYC.js.map} +0 -0
@@ -0,0 +1,4961 @@
1
+ import {
2
+ rehydrateFilter
3
+ } from "./chunk-SKMFMGCD.js";
4
+ import {
5
+ showLDlegend
6
+ } from "./chunk-X6URQAFD.js";
7
+ import {
8
+ legend_newrow
9
+ } from "./chunk-IEQSUAIO.js";
10
+ import {
11
+ urlmap_default
12
+ } from "./chunk-AQ4OP4GR.js";
13
+ import {
14
+ ColorScale,
15
+ Tabs,
16
+ axisstyle,
17
+ fillTermWrapper,
18
+ fillbar,
19
+ makeNumericAxisConfig,
20
+ makeSsmLink,
21
+ make_radios,
22
+ newSandboxDiv,
23
+ renderCnvConfig,
24
+ renderTable,
25
+ shapeSelector,
26
+ shapes,
27
+ table2col,
28
+ to_textfile
29
+ } from "./chunk-OXJ2TWDO.js";
30
+ import {
31
+ genomic2gm
32
+ } from "./chunk-HJ6L54YS.js";
33
+ import {
34
+ dofetch3,
35
+ guessSsmid,
36
+ ssmIdFieldsSeparator,
37
+ summarize_mclass
38
+ } from "./chunk-7RN3L2BX.js";
39
+ import {
40
+ Menu
41
+ } from "./chunk-A6TQGNDQ.js";
42
+ import {
43
+ icons
44
+ } from "./chunk-5EF5U7MX.js";
45
+ import {
46
+ niceNumLabels
47
+ } from "./chunk-SEQLC4AD.js";
48
+ import {
49
+ bplen,
50
+ dt2label,
51
+ dtTerms,
52
+ dtcloss,
53
+ dtcnv,
54
+ dtdel,
55
+ dtfusionrna,
56
+ dtitd,
57
+ dtnloss,
58
+ dtsnvindel,
59
+ dtsv,
60
+ getColors,
61
+ gmmode,
62
+ mclass,
63
+ mds3tkMclass
64
+ } from "./chunk-XYFDBYOY.js";
65
+ import {
66
+ convertUnits
67
+ } from "./chunk-TV74I3Y5.js";
68
+ import {
69
+ arc_default
70
+ } from "./chunk-IH7ILDJS.js";
71
+ import {
72
+ axisLeft,
73
+ axisRight
74
+ } from "./chunk-LOZEKOES.js";
75
+ import {
76
+ format,
77
+ linear
78
+ } from "./chunk-OAWQ6LOO.js";
79
+ import {
80
+ select_default
81
+ } from "./chunk-NDWTN4U5.js";
82
+ import {
83
+ rgb,
84
+ rgb_default
85
+ } from "./chunk-OMR2DT66.js";
86
+
87
+ // mds3/itemtable.js
88
+ async function itemtable(arg) {
89
+ if (arg.mlst.find((m) => m.dt != dtsnvindel && m.dt != dtfusionrna && m.dt != dtsv && m.dt != dtcnv)) {
90
+ throw "mlst[] contains unknown dt";
91
+ }
92
+ if (arg.mlst.length == 1) {
93
+ await itemtable_oneItem(arg);
94
+ } else {
95
+ await itemtable_multiItems(arg);
96
+ }
97
+ mayMoveTipDiv2left(arg);
98
+ }
99
+ function mayMoveTipDiv2left(arg) {
100
+ if (!arg.tipDiv) {
101
+ return;
102
+ }
103
+ const tableDoms = [];
104
+ for (const d of arg.div.selectAll("div").selectAll("table")) {
105
+ if (d) tableDoms.push(d);
106
+ }
107
+ if (!tableDoms.length) return;
108
+ let maxColumnCount = 0;
109
+ for (const table of tableDoms) {
110
+ const thead = table.firstChild;
111
+ if (thead.tagName != "THEAD") continue;
112
+ const tr = thead.firstChild;
113
+ if (tr.tagName != "TR") continue;
114
+ maxColumnCount = Math.max(maxColumnCount, tr.childNodes?.length);
115
+ }
116
+ if (maxColumnCount > 5) {
117
+ arg.tipDiv.style("left", "50px");
118
+ }
119
+ }
120
+ async function itemtable_oneItem(arg) {
121
+ const table = table2col({ holder: arg.div });
122
+ const m = arg.mlst[0];
123
+ if (m.dt == dtsnvindel) {
124
+ table_snvindel(arg, table);
125
+ } else if (m.dt == dtsv || m.dt == dtfusionrna) {
126
+ await table_svfusion(arg, table);
127
+ } else if (m.dt == dtcnv) {
128
+ table_cnv(arg, table);
129
+ } else {
130
+ throw "itemtable_oneItem: unknown dt";
131
+ }
132
+ arg.singleSampleDiv = table;
133
+ if (arg.tk.mds.variant2samples) {
134
+ if (m.occurrence) {
135
+ await init_sampletable(arg);
136
+ }
137
+ }
138
+ }
139
+ async function itemtable_multiItems(arg) {
140
+ const goBackButton = arg.div.append("div").style("margin", "10px").append("button").style("display", "none");
141
+ goBackButton.html("≪ Back to list").on("click", () => {
142
+ tableDiv.style("display", "");
143
+ goBackButton.style("display", "none");
144
+ singleVariantDiv.style("display", "none");
145
+ });
146
+ const singleVariantDiv = arg.div.append("div").style("display", "none");
147
+ const columns = [
148
+ {
149
+ label: `Click a ${dt2label[arg.mlst[0].dt]} to see details`,
150
+ fillCell: (td, i) => {
151
+ const m = arg.mlst[i];
152
+ if (m.dt == dtsnvindel) {
153
+ td.append("span").text(arg.tk.mnamegetter(m));
154
+ td.append("span").text(mclass[m.class].label).style("font-size", ".8em").style("margin-left", "10px").style("color", mclass[m.class].color);
155
+ td.append("span").text(`${m.chr}:${m.pos + 1}${m.ref ? ", " + m.ref + ">" + m.alt : ""}`).style("font-size", ".8em").style("margin-left", "10px");
156
+ } else if (m.dt == dtsv || m.dt == dtfusionrna) {
157
+ td.append("span").text(mclass[m.class].label).style("font-size", ".7em").style("margin-right", "8px");
158
+ printSvPair(m.pairlst[0], td);
159
+ } else if (m.dt == dtcnv) {
160
+ const cs = cnv2str(m, arg.tk);
161
+ td.html(cs.value + "  " + cs.pos);
162
+ } else {
163
+ td.text("error: unknown m.dt");
164
+ }
165
+ }
166
+ }
167
+ ];
168
+ const hasOccurrence = arg.mlst.some((i) => i.occurrence);
169
+ if (hasOccurrence) {
170
+ columns.push({ label: "Occurrence" });
171
+ }
172
+ let infoFields = null;
173
+ if (arg.tk.mds.bcf?.info) {
174
+ infoFields = [];
175
+ for (const k in arg.tk.mds.bcf.info) {
176
+ if (arg.tk.mds.bcf.info[k].categories) {
177
+ infoFields.push(k);
178
+ columns.push({ label: arg.tk.mds.bcf.info[k].name || k });
179
+ }
180
+ }
181
+ if (infoFields.length == 0) infoFields = null;
182
+ }
183
+ let numViewMode;
184
+ if (arg.tk.skewer) {
185
+ numViewMode = arg.tk.skewer.viewModes.find((i) => i.inuse && i.type == "numeric" && i.byAttribute != "occurrence");
186
+ if (numViewMode) {
187
+ columns.push({ label: numViewMode.label });
188
+ }
189
+ }
190
+ arg.mlst.sort((i, j) => i.__x - j.__x);
191
+ const rows = [];
192
+ for (const m of arg.mlst) {
193
+ const row = [{}];
194
+ if (hasOccurrence) {
195
+ row.push({ value: "occurrence" in m ? m.occurrence : "" });
196
+ }
197
+ if (infoFields) {
198
+ for (const k of infoFields) {
199
+ const v = m.info?.[k];
200
+ if (v == void 0) {
201
+ row.push({});
202
+ } else {
203
+ const o = arg.tk.mds.bcf.info[k].categories[v];
204
+ if (o?.color) {
205
+ row.push({ html: `<span style="background:${o.color}">&nbsp;&nbsp;</span> ${o.label || v}` });
206
+ } else {
207
+ row.push({ value: v });
208
+ }
209
+ }
210
+ }
211
+ }
212
+ if (numViewMode) {
213
+ row.push({ value: m.__value_use });
214
+ }
215
+ rows.push(row);
216
+ }
217
+ const tableDiv = arg.div.append("div");
218
+ renderTable({
219
+ div: tableDiv,
220
+ columns,
221
+ rows,
222
+ resize: true,
223
+ noButtonCallback: (i) => {
224
+ tableDiv.style("display", "none");
225
+ goBackButton.style("display", "");
226
+ singleVariantDiv.style("display", "").selectAll("*").remove();
227
+ const a2 = Object.assign({}, arg);
228
+ a2.mlst = [arg.mlst[i]];
229
+ a2.div = singleVariantDiv;
230
+ itemtable(a2);
231
+ },
232
+ singleMode: true,
233
+ noRadioBtn: true
234
+ });
235
+ if (!arg.doNotListSample4multim && arg.tk.mds.variant2samples) {
236
+ const totalOccurrence = arg.mlst.reduce((i, j) => i + (j.occurrence || 0), 0);
237
+ if (totalOccurrence) {
238
+ arg.div.append("div").style("margin-top", "10px").append("span").attr("class", "sja_clbtext").text("List all samples").on("click", async (event2) => {
239
+ event2.target.remove();
240
+ tableDiv.remove();
241
+ await init_sampletable(arg);
242
+ mayMoveTipDiv2left(arg);
243
+ });
244
+ }
245
+ }
246
+ }
247
+ async function table_snvindel({ mlst, tk, block }, table) {
248
+ const m = mlst[0];
249
+ {
250
+ const [td1, td2] = table.addRow();
251
+ td1.text(block.mclassOverride ? block.mclassOverride.className : "Consequence");
252
+ print_mname(td2, m);
253
+ }
254
+ {
255
+ const [td1, td2] = table.addRow();
256
+ td1.text(m.ref && m.alt ? "Mutation" : "Position");
257
+ print_snv(td2, m, tk, block);
258
+ }
259
+ if (m.occurrence > 1) {
260
+ const [td1, td2] = table.addRow();
261
+ td1.text("Occurrence");
262
+ td2.text(m.occurrence);
263
+ }
264
+ table_snvindel_mayInsertNumericValueRow(m, tk, table);
265
+ table_snvindel_mayInsertHtmlSections(m, tk, table);
266
+ table_snvindel_mayInsertLD(m, tk, table);
267
+ if (m.info) {
268
+ for (const key in m.info) {
269
+ if (key == "CSQ") {
270
+ continue;
271
+ }
272
+ const [td1, td2] = table.addRow();
273
+ td1.text(key).attr("data-testid", "sjpp-mds3tk-singlemtablerow4infokey");
274
+ const infoValue = m.info[key];
275
+ const infoField = tk.mds?.bcf?.info?.[key];
276
+ if (Array.isArray(infoValue)) {
277
+ for (const v of infoValue) {
278
+ renderInfoTd(m, infoField, v, td2, tk);
279
+ }
280
+ } else {
281
+ renderInfoTd(m, infoField, infoValue, td2, tk);
282
+ }
283
+ if (infoField?.Description) {
284
+ td2.append("span").style("margin-left", "10px").style("font-size", ".8em").style("opacity", 0.6).text(infoField.Description);
285
+ }
286
+ }
287
+ }
288
+ }
289
+ function table_snvindel_mayInsertNumericValueRow(m, tk, table) {
290
+ const currentMode = tk.skewer.viewModes.find((i) => i.inuse);
291
+ if (currentMode.type != "numeric" || currentMode.byAttribute == "occurrence") return;
292
+ if (currentMode.tooltipPrintValue) {
293
+ const tmp = currentMode.tooltipPrintValue(m);
294
+ if (Array.isArray(tmp)) {
295
+ for (const s of tmp) {
296
+ const [td12, td22] = table.addRow();
297
+ td12.text(s.k);
298
+ td22.text(s.v);
299
+ }
300
+ } else {
301
+ console.log("unknown return value");
302
+ }
303
+ return;
304
+ }
305
+ const [td1, td2] = table.addRow();
306
+ td1.text(currentMode.label);
307
+ td2.text(m.__value_missing ? "NA" : m.__value_use);
308
+ }
309
+ function table_snvindel_mayInsertHtmlSections(m, tk, table) {
310
+ if (!m.htmlSections) return;
311
+ if (!Array.isArray(m.htmlSections)) throw "htmlSections[] is not array";
312
+ for (const section of m.htmlSections) {
313
+ const [td1, td2] = table.addRow();
314
+ if (section.key && section.html) {
315
+ td1.text(section.key);
316
+ td2.html(section.html);
317
+ }
318
+ }
319
+ }
320
+ function renderInfoTd(m, infoField, infoValue, td, tk) {
321
+ if (!infoField) {
322
+ td.append("span").text(infoValue);
323
+ return;
324
+ }
325
+ if (infoField.urlBase) {
326
+ td.append("a").text(infoValue).attr("href", infoField.urlBase + infoValue).attr("target", "_blank");
327
+ return;
328
+ }
329
+ const color = infoField.categories?.[infoValue]?.color;
330
+ if (color) {
331
+ td.append("span").html("&nbsp;&nbsp;").style("background", color).style("margin-right", "5px");
332
+ }
333
+ td.append("span").text(infoField.categories?.[infoValue]?.label || infoValue);
334
+ }
335
+ function print_mname(div, m) {
336
+ div.append("span").text(m.mname);
337
+ div.append("span").style("margin-left", "5px").style("color", mclass[m.class].color).style("font-size", ".8em").text(mclass[m.class].label.toUpperCase());
338
+ }
339
+ function print_snv(holder, m, tk, block) {
340
+ const ssmNameDom = holder.append("span").text(`${m.chr}:${m.pos + 1} ${m.ref && m.alt ? m.ref + ">" + m.alt : ""}`);
341
+ const urlConfig = tk.mds.termdbConfig?.urlTemplates?.ssm || tk.mds.queries?.snvindel?.ssmUrl;
342
+ if (urlConfig) {
343
+ const separateUrls = makeSsmLink(urlConfig, m, ssmNameDom, block.genome.name);
344
+ if (separateUrls?.length) {
345
+ holder.append("span").style("margin-left", "10px").html(separateUrls.join(" "));
346
+ }
347
+ }
348
+ }
349
+ async function table_svfusion(arg, table) {
350
+ await makeSvgraph(
351
+ arg.mlst[0],
352
+ table.scrollDiv.insert("div", ":first-child"),
353
+ // insert to top
354
+ arg.block
355
+ );
356
+ {
357
+ const [c1, c2] = table.addRow();
358
+ c1.text("Data type");
359
+ c2.text(mclass[arg.mlst[0].class].label);
360
+ }
361
+ {
362
+ const [c1, c2] = table.addRow();
363
+ c1.text("Break points");
364
+ for (const pair of arg.mlst[0].pairlst) {
365
+ printSvPair(pair, c2.append("div"));
366
+ }
367
+ }
368
+ }
369
+ function table_cnv(arg, table) {
370
+ const cs = cnv2str(arg.mlst[0], arg.tk);
371
+ {
372
+ const [c1, c2] = table.addRow();
373
+ c1.text("Copy number change");
374
+ c2.html(cs.value);
375
+ }
376
+ {
377
+ const [c1, c2] = table.addRow();
378
+ c1.text("Position");
379
+ c2.html(cs.pos);
380
+ }
381
+ }
382
+ function cnv2str(m, tk) {
383
+ const cs = {};
384
+ if (Number.isFinite(m.value)) {
385
+ if (tk.cnv.colorScale) {
386
+ cs.value = `<span style="background:${tk.cnv.colorScale(m.value)}">&nbsp;&nbsp;</span> ${m.value}`;
387
+ } else {
388
+ cs.value = m.value;
389
+ }
390
+ } else {
391
+ cs.value = `<span style="background:${mclass[m.class].color}">&nbsp;&nbsp;</span>
392
+ ${tk.mds.termdbConfig?.mclass?.[m.class]?.label || mclass[m.class].label}`;
393
+ }
394
+ cs.pos = `${m.chr}:${m.start}-${m.stop} <span style="font-size:.8em">${bplen(m.stop - m.start)}</span>`;
395
+ return cs;
396
+ }
397
+ function printSvPair(pair, div) {
398
+ if (pair.a.name) div.append("span").text(pair.a.name).style("font-weight", "bold").style("margin-right", "5px");
399
+ div.append("span").text(
400
+ `${pair.a.chr}:${pair.a.pos + 1} ${pair.a.strand == "+" ? "forward" : "reverse"} > ${pair.b.chr}:${pair.b.pos + 1} ${pair.b.strand == "+" ? "forward" : "reverse"}`
401
+ );
402
+ if (pair.b.name) div.append("span").text(pair.b.name).style("font-weight", "bold").style("margin-left", "5px");
403
+ }
404
+ async function makeSvgraph(m, div, block) {
405
+ div.attr("data-testid", "sjpp-mds3tk-singlesvfusiongraph");
406
+ const wait = div.append("div").text("Loading...");
407
+ try {
408
+ if (!m.pairlst) throw ".pairlst[] missing";
409
+ const svpair = {
410
+ a: {
411
+ chr: m.pairlst[0].a.chr,
412
+ position: m.pairlst[0].a.pos,
413
+ strand: m.pairlst[0].a.strand
414
+ },
415
+ b: {
416
+ chr: m.pairlst[0].b.chr,
417
+ position: m.pairlst[0].b.pos,
418
+ strand: m.pairlst[0].b.strand
419
+ }
420
+ };
421
+ await getGm(svpair.a, block, m.pairlst[0].a.name, m.pairlst[0].a.isoform);
422
+ await getGm(svpair.b, block, m.pairlst[0].b.name, m.pairlst[0].b.isoform);
423
+ wait.remove();
424
+ const _ = await import("./svgraph-AYR2UPNK.js");
425
+ _.default({
426
+ pairlst: [svpair],
427
+ genome: block.genome,
428
+ holder: div
429
+ });
430
+ } catch (e) {
431
+ wait.text(e.message || e);
432
+ }
433
+ }
434
+ async function getGm(p, block, geneName, isoform) {
435
+ if (isoform) {
436
+ p.name = geneName;
437
+ p.gm = { isoform };
438
+ return;
439
+ }
440
+ const d = await dofetch3("isoformbycoord", { body: { genome: block.genome.name, chr: p.chr, pos: p.position } });
441
+ if (d.error) throw d.error;
442
+ const u = d.lst.find((i) => i.isdefault && geneName == i.name) || d.lst[0];
443
+ if (u) {
444
+ p.name = u.name;
445
+ p.gm = { isoform: u.isoform };
446
+ }
447
+ }
448
+ function table_snvindel_mayInsertLD(m, tk, table) {
449
+ if (!tk.mds.queries?.ld) return;
450
+ const [td1, td2] = table.addRow();
451
+ td1.text("LD overlay");
452
+ const m0 = tk.mds.queries.ld.mOverlay?.m;
453
+ if (m0) {
454
+ const row = td2.append("div").style("margin-bottom", "5px");
455
+ if (m.ssm_id == m0.ssm_id) {
456
+ row.html(
457
+ tk.mds.queries.ld.mOverlay.ldtkname + " r<sup>2</sup> values against this variant are displayed on all the other variants."
458
+ );
459
+ } else {
460
+ let r2 = null;
461
+ for (const v of tk.mds.queries.ld.mOverlay.data || []) {
462
+ if (v.pos == m.pos && v.alleles == m.ref + "." + m.alt) {
463
+ r2 = v.r2;
464
+ break;
465
+ }
466
+ }
467
+ if (r2 == null) {
468
+ row.html("No r<sup>2</sup> value is found.");
469
+ } else {
470
+ row.html(tk.mds.queries.ld.mOverlay.ldtkname + " r<sup>2</sup> = " + r2);
471
+ }
472
+ }
473
+ }
474
+ td2.append("div").html("Click a button to overlay LD r<sup>2</sup> values against this variant:").style("font-size", ".8em").style("opacity", 0.5);
475
+ for (const o of tk.mds.queries.ld.tracks) {
476
+ const btn = td2.append("button").text(o.name);
477
+ if (m0 && m0.ssm_id == m.ssm_id) {
478
+ if (o.name == tk.mds.queries.ld.mOverlay.ldtkname) {
479
+ btn.property("disabled", true);
480
+ continue;
481
+ }
482
+ }
483
+ btn.on("click", () => {
484
+ tk.itemtip.hide();
485
+ tk.mds.queries.ld.mOverlay = {
486
+ ldtkname: o.name,
487
+ m: {
488
+ chr: m.chr,
489
+ pos: m.pos,
490
+ ref: m.ref,
491
+ alt: m.alt,
492
+ ssm_id: m.ssm_id
493
+ // required for highlighting
494
+ }
495
+ };
496
+ tk.load();
497
+ });
498
+ }
499
+ }
500
+
501
+ // mds3/sampletable.js
502
+ async function init_sampletable(arg) {
503
+ const wait = arg.div.append("div").text("Loading...").style("padding", "10px").style("color", "#8AB1D4").style("font-size", "1.25em").style("font-weight", "bold");
504
+ arg.tid2value_orig = /* @__PURE__ */ new Set();
505
+ if (arg.tid2value) Object.keys(arg.tid2value).forEach(arg.tid2value_orig.add, arg.tid2value_orig);
506
+ try {
507
+ arg.querytype = arg.tk.mds.variant2samples.type_samples;
508
+ const out = await arg.tk.mds.variant2samples.get(arg);
509
+ await displaySampleTable(out.samples, arg);
510
+ wait.remove();
511
+ } catch (e) {
512
+ wait.text("Error: " + (e.message || e));
513
+ if (e.stack) console.log(e.stack);
514
+ }
515
+ }
516
+ async function displaySampleTable(samples, args) {
517
+ if (samples.length == 1) {
518
+ return await make_singleSampleTable(samples[0], args);
519
+ }
520
+ const [columns, rows] = await samples2columnsRows(samples, args.tk);
521
+ const params = { rows, columns, div: args.div, resize: rows.length > 10, dataTestId: "sjpp_mds3tk_sampletable" };
522
+ params.columnButtons = [];
523
+ if (args.tk.mds.queries?.singleSampleMutation) {
524
+ const width = window.innerWidth;
525
+ const height = screen.height;
526
+ const colButton = {
527
+ text: "Disco",
528
+ dataTestId: "sja_sample_table_disco_button",
529
+ callback: async (event2, i) => {
530
+ args.tk.itemtip.hide();
531
+ args.tk.menutip.hide();
532
+ let thisMutation;
533
+ if (samples[i].ssm_id_lst?.[0]) {
534
+ thisMutation = (args.tk.skewer.rawmlst || args.tk.custom_variants).find(
535
+ (m) => m.ssm_id == samples[i].ssm_id_lst[0]
536
+ );
537
+ }
538
+ await createDiscoInSandbox(args.tk, args.block, samples[i], thisMutation);
539
+ }
540
+ };
541
+ params.columnButtons.push(colButton);
542
+ }
543
+ if (args.tk.mds.queries?.singleSampleGenomeQuantification) {
544
+ for (const k in args.tk.mds.queries.singleSampleGenomeQuantification) {
545
+ const btn = {
546
+ text: k,
547
+ dataTestId: `${k}_button`,
548
+ callback: async (event2, i) => {
549
+ const sandbox = newSandboxDiv(args.tk.newChartHolder || args.block.holder0);
550
+ sandbox.header.text(samples[i].sample_id);
551
+ await (await import("./plot.ssgq-GXB2GZO3.js")).plotSingleSampleGenomeQuantification(
552
+ args.tk.mds,
553
+ args.tk.mds.label,
554
+ k,
555
+ samples[i],
556
+ sandbox.body.append("div").style("margin", "20px"),
557
+ args.block.genome,
558
+ args.block.usegm?.name
559
+ );
560
+ }
561
+ };
562
+ params.columnButtons.push(btn);
563
+ }
564
+ }
565
+ if (args.tk.allow2selectSamples) {
566
+ params.buttons = [
567
+ {
568
+ text: args.tk.allow2selectSamples.buttonText,
569
+ class: args.tk.allow2selectSamples.class,
570
+ callback: (sampleIdxLst) => {
571
+ feedSample2selectCallback(args.tk, args.block, samples, sampleIdxLst);
572
+ args.tk.itemtip.hide();
573
+ args.tk.menutip.hide();
574
+ }
575
+ }
576
+ ];
577
+ }
578
+ return renderTable(params);
579
+ }
580
+ async function feedSample2selectCallback(tk, block, _samples, sampleIdxLst) {
581
+ const s = [..._samples];
582
+ const samples = sampleIdxLst.map((i) => s[i]);
583
+ tk.allow2selectSamples.callback({
584
+ samples: await tk.mds.termdb.vocabApi.convertSampleId(samples, tk.allow2selectSamples.attributes),
585
+ source: "Samples with " + block2source(block)
586
+ });
587
+ }
588
+ async function make_singleSampleTable(s, arg) {
589
+ const table = arg.singleSampleDiv || table2col({ holder: arg.div });
590
+ if (s.sample_id) {
591
+ const [cell1, cell2] = table.addRow();
592
+ cell1.text(arg.tk.mds.termdbConfig?.lollipop?.sample || "Sample");
593
+ let m;
594
+ if (s.ssm_id_lst?.[0]) {
595
+ m = arg.tk.skewer.rawmlst.find((i) => i.ssm_id == s.ssm_id_lst[0]);
596
+ }
597
+ printSampleName(s, arg.tk, cell2, arg.block, m);
598
+ }
599
+ if ("caseIsOpenAccess" in s) {
600
+ const [cell1, cell2] = table.addRow();
601
+ cell1.text("Access");
602
+ cell2.text(s.caseIsOpenAccess ? "Open" : "Controlled");
603
+ }
604
+ if (arg.tk.mds.variant2samples.twLst) {
605
+ for (const tw of arg.tk.mds.variant2samples.twLst) {
606
+ const [cell1, cell2] = table.addRow();
607
+ cell1.text(tw.term.name).style("text-overflow", "ellipsis");
608
+ cell2.style("text-overflow", "ellipsis");
609
+ if (tw.term.id in s) {
610
+ if (Array.isArray(s[tw.term.id])) {
611
+ cell2.html(value2urlsOrText(s[tw.term.id], tw));
612
+ } else {
613
+ const v = twDisplayValueFromSample(s, tw);
614
+ cell2.html(value2urlsOrText(v, tw));
615
+ }
616
+ }
617
+ }
618
+ }
619
+ if (s.ssmid2format) {
620
+ for (const ssmid of s.ssm_id_lst) {
621
+ if (s.ssm_id_lst.length > 1) {
622
+ const [td1, td] = table.addRow();
623
+ td.style("padding-top", "20px");
624
+ const m = arg.tk.skewer.rawmlst.find((i) => i.ssm_id == ssmid);
625
+ if (m) {
626
+ if (m.dt == dtsnvindel) {
627
+ print_snv(td, m, arg.tk, arg.block);
628
+ } else if (m.dt == dtsv || m.dt == dtfusionrna) {
629
+ printSvPair(m.pairlst[0], td);
630
+ } else {
631
+ td.text(ssmid);
632
+ }
633
+ } else {
634
+ td.text(ssmid);
635
+ }
636
+ } else {
637
+ }
638
+ for (const formatkey in s.ssmid2format[ssmid]) {
639
+ const value = s.ssmid2format[ssmid][formatkey];
640
+ const [t1, t2] = table.addRow();
641
+ const fobj = arg.tk.mds?.bcf?.format?.[formatkey];
642
+ t1.text(fobj?.Description || formatkey).attr("data-testid", "sjpp-mds3tk-singlemtablerow4formatkey").attr("__key__", formatkey);
643
+ t2.html(printFormat(fobj, value));
644
+ }
645
+ }
646
+ }
647
+ }
648
+ function twDisplayValueFromSample(s, tw) {
649
+ if (!(tw.term.id in s)) return "";
650
+ const v = s[tw.term.id];
651
+ if (tw.term.values?.[v]?.label) return tw.term.values[v].label;
652
+ const vc = tw.term.valueConversion;
653
+ if (vc) return convertUnits(v, vc.fromUnit, vc.toUnit, vc.scaleFactor);
654
+ return v;
655
+ }
656
+ function printSampleName(sample, tk, div, block, thisMutation) {
657
+ const temp = tk.mds.termdbConfig?.urlTemplates?.sample;
658
+ if (temp) {
659
+ const a = div.append("a");
660
+ a.attr("href", temp.base + (sample[temp.namekey] || sample.sample_id));
661
+ a.attr("target", "_blank");
662
+ a.text(sample.sample_id);
663
+ a.style("word-break", "break-word");
664
+ } else {
665
+ div.append("span").attr("class", "pp_mds3_singleSampleNameSpan").text(sample.sample_id);
666
+ }
667
+ const extraRow = div.append("div");
668
+ if (tk.allow2selectSamples) {
669
+ const t = tk.allow2selectSamples.buttonText;
670
+ const btn = extraRow.append("button").attr("data-testid", "sjpp-mds3tk-selectsamplebtn").style("margin-right", "10px").text(t.endsWith("s") ? t.substring(0, t.length - 1) : t).on("click", () => {
671
+ feedSample2selectCallback(tk, block, [sample], [0]);
672
+ tk.itemtip.hide();
673
+ tk.menutip.hide();
674
+ });
675
+ if (tk.allow2selectSamples.class) btn.attr("class", tk.allow2selectSamples.class);
676
+ }
677
+ if (tk.mds.queries?.singleSampleMutation) {
678
+ extraRow.append("button").style("margin-right", "10px").text("Disco plot").attr("data-testid", "proteinpaint_disc_table_disco_button").on("click", async () => {
679
+ tk.itemtip.hide();
680
+ await createDiscoInSandbox(tk, block, sample, thisMutation);
681
+ });
682
+ }
683
+ if (tk.mds.queries?.singleSampleGenomeQuantification) {
684
+ for (const k in tk.mds.queries.singleSampleGenomeQuantification) {
685
+ extraRow.append("button").text(k).on("click", async () => {
686
+ const sandbox = newSandboxDiv(tk.newChartHolder || block.holder0);
687
+ sandbox.header.text(sample.sample_id);
688
+ await (await import("./plot.ssgq-GXB2GZO3.js")).plotSingleSampleGenomeQuantification(
689
+ tk.mds,
690
+ tk.mds.label,
691
+ k,
692
+ sample,
693
+ sandbox.body.append("div").style("margin", "20px"),
694
+ block.genome,
695
+ block.usegm?.name
696
+ /* to pass current gene name to launch ssgb at that gene
697
+ do not use thisMutation.gene, as "gene" is not guaranteed attribute on mutations
698
+ */
699
+ );
700
+ });
701
+ }
702
+ }
703
+ }
704
+ async function createDiscoInSandbox(tk, block, sample, thisMutation) {
705
+ const sandbox = newSandboxDiv(tk.newChartHolder || block.holder0);
706
+ const headerTexts = [sample.sample_id];
707
+ if (thisMutation) {
708
+ headerTexts.push(", with ");
709
+ if (block.usegm) {
710
+ headerTexts.push(block.usegm.name);
711
+ } else {
712
+ headerTexts.push(thisMutation.isoform);
713
+ }
714
+ headerTexts.push(" " + thisMutation.mname);
715
+ }
716
+ sandbox.header.text(headerTexts.join(""));
717
+ try {
718
+ ;
719
+ (await import("./plot.disco-3BV6YEBC.js")).default(
720
+ tk.mds.termdbConfig,
721
+ tk.mds.label,
722
+ sample,
723
+ sandbox.body,
724
+ block.genome,
725
+ {
726
+ downloadImgName: headerTexts.join("") + " Disco"
727
+ // file name of svg downloaded from disco
728
+ }
729
+ );
730
+ } catch (e) {
731
+ sandbox.body.append("div").text("Error: " + (e.message || e));
732
+ if (e.stack) console.log(e.stack);
733
+ }
734
+ }
735
+ async function samples2columnsRows(samples, tk) {
736
+ const has_caseAccess = samples.some((i) => "caseIsOpenAccess" in i), has_ssm = samples.some((i) => i.ssm_id) || samples.some((i) => i.ssm_id_lst), has_format = samples.some((i) => i.ssmid2format) && tk.mds?.bcf?.format;
737
+ const displayedFormatKeySet = /* @__PURE__ */ new Set();
738
+ const columns = [{ label: tk.mds.termdbConfig?.lollipop?.sample || "Sample" }], rows = [];
739
+ if (has_caseAccess) {
740
+ columns.push({ label: "Access" });
741
+ }
742
+ if (tk.mds.variant2samples.twLst) {
743
+ for (const tw of tk.mds.variant2samples.twLst) {
744
+ const cell = { label: tw.term.name };
745
+ columns.push(cell);
746
+ }
747
+ }
748
+ if (has_ssm) {
749
+ columns.push({
750
+ label: "Mutations",
751
+ isSsm: true
752
+ // flag for text file downloader to do detect and do special treatment on this field
753
+ });
754
+ }
755
+ if (has_format) {
756
+ for (const s of samples) {
757
+ if (!s.ssmid2format) continue;
758
+ for (const sm in s.ssmid2format) {
759
+ for (const k in s.ssmid2format[sm]) displayedFormatKeySet.add(k);
760
+ }
761
+ }
762
+ for (const f in tk.mds.bcf.format) {
763
+ if (!displayedFormatKeySet.has(f)) continue;
764
+ const fobj = tk.mds.bcf.format[f];
765
+ columns.push({
766
+ label: fobj.Description || f
767
+ });
768
+ }
769
+ }
770
+ for (const sample of samples) {
771
+ const row = [{ value: sample.sample_id }];
772
+ let ssm_id_lst = sample.ssm_id_lst;
773
+ if (!ssm_id_lst && sample.ssm_id) ssm_id_lst = [sample.ssm_id];
774
+ {
775
+ const temp = tk.mds.termdbConfig?.urlTemplates?.sample;
776
+ if (temp) {
777
+ row[0].url = temp.base + (sample[temp.namekey] || sample.sample_id);
778
+ }
779
+ }
780
+ if (has_caseAccess) {
781
+ row.push({ value: sample.caseIsOpenAccess ? "Open" : "Controlled" });
782
+ }
783
+ if (tk.mds.variant2samples.twLst) {
784
+ for (const tw of tk.mds.variant2samples.twLst) {
785
+ const v = twDisplayValueFromSample(sample, tw);
786
+ const v2 = value2urlsOrText(v, tw);
787
+ if (tw.baseURL || tw.pmidOrDoi) {
788
+ row.push({ html: v2 });
789
+ } else {
790
+ row.push({ value: v });
791
+ }
792
+ }
793
+ }
794
+ if (has_ssm) {
795
+ if (ssm_id_lst) {
796
+ const htmls = [];
797
+ for (const ssm_id of ssm_id_lst) {
798
+ const m = findMbyId(ssm_id, tk);
799
+ const oneHtml = [];
800
+ if (m) {
801
+ let showClass;
802
+ if (m.dt == dtsnvindel) {
803
+ if (tk.mds.queries && tk.mds.queries.snvindel && tk.mds.queries.snvindel.url) {
804
+ oneHtml.push(`<a href=${tk.mds.queries.snvindel.url.base + m.ssm_id} target=_blank>${m.mname}</a>`);
805
+ } else {
806
+ oneHtml.push(m.mname);
807
+ }
808
+ showClass = true;
809
+ } else if (m.dt == dtsv || m.dt == dtfusionrna) {
810
+ const p = sample._pairlst?.[0] || m.pairlst[0];
811
+ oneHtml.push(
812
+ `${p.a.name || ""} ${p.a.chr}:${p.a.pos} ${p.a.strand == "+" ? "forward" : "reverse"} > ${p.b.name || ""} ${p.b.chr}:${p.b.pos} ${p.b.strand == "+" ? "forward" : "reverse"}`
813
+ );
814
+ showClass = true;
815
+ } else if (m.dt == dtcnv) {
816
+ const v = cnv2str(m, tk);
817
+ oneHtml.push(v.value + " " + v.pos);
818
+ showClass = Number.isFinite(m.value);
819
+ } else {
820
+ throw "unknown dt";
821
+ }
822
+ if (showClass) {
823
+ oneHtml.push(
824
+ `<span style="color:${rgb(mclass[m.class].color).darker()};font-size:0.8em;">${mclass[m.class].label}</span>`
825
+ );
826
+ }
827
+ htmls.push(`<span style="white-space:nowrap">${oneHtml.join(" ")}</span>`);
828
+ } else {
829
+ htmls.push(ssm_id + "?");
830
+ }
831
+ }
832
+ row.push({ html: htmls.join("<br>") });
833
+ } else {
834
+ row.push({ value: "" });
835
+ }
836
+ }
837
+ if (has_format) {
838
+ if (!ssm_id_lst) throw "ssm_id_lst missing, cannot show format";
839
+ for (const fkey in tk.mds.bcf.format) {
840
+ if (!displayedFormatKeySet.has(fkey)) continue;
841
+ if (!sample.ssmid2format) {
842
+ row.push({ value: "" });
843
+ continue;
844
+ }
845
+ const fobj = tk.mds.bcf.format[fkey];
846
+ const htmls = [];
847
+ for (const ssmid of ssm_id_lst) {
848
+ const value = sample.ssmid2format?.[ssmid]?.[fkey];
849
+ if (value == void 0) {
850
+ htmls.push("&nbsp;");
851
+ } else {
852
+ htmls.push(printFormat(fobj, value));
853
+ }
854
+ }
855
+ row.push({ html: `<span style="white-space:nowrap">${htmls.join("<br>")}</span>` });
856
+ }
857
+ }
858
+ rows.push(row);
859
+ }
860
+ return [columns, rows];
861
+ }
862
+ function value2urlsOrText(v, tw) {
863
+ if (tw.baseURL) {
864
+ if (Array.isArray(v)) return v.map((i) => `<a href=${tw.baseURL + i} target=_blank>${i}</a>`).join("<br>");
865
+ return `<a href=${tw.baseURL + v} target=_blank>${v}</a>`;
866
+ }
867
+ if (tw.pmidOrDoi) {
868
+ const h = [];
869
+ for (const i of Array.isArray(v) ? v : [v]) {
870
+ if (i.startsWith("doi: ")) {
871
+ h.push(`<a href=https://doi.org/${i.slice(5)} target=_blank>${i}</a>`);
872
+ } else {
873
+ h.push(`<a href=https://pubmed.ncbi.nlm.nih.gov/${i} target=_blank>${i}</a>`);
874
+ }
875
+ }
876
+ return h.join("<br>");
877
+ }
878
+ if (Array.isArray(v)) return v.join("<br>");
879
+ return v;
880
+ }
881
+ function findMbyId(str, tk) {
882
+ const lst = tk.skewer?.rawmlst || tk.custom_variants;
883
+ if (lst) {
884
+ const m = lst.find((i) => i.ssm_id == str);
885
+ if (m) return m;
886
+ }
887
+ if (tk.cnv) {
888
+ if (tk.cnv.cnvLst) {
889
+ const m = tk.cnv.cnvLst.find((i) => i.ssm_id == str);
890
+ if (m) return m;
891
+ } else {
892
+ const m = guessSsmid(str);
893
+ if (m.dt == dtcnv) {
894
+ return {
895
+ dt: dtcnv,
896
+ chr: m.l[0],
897
+ start: m.l[1],
898
+ stop: m.l[2],
899
+ class: m.l[3],
900
+ value: m.l[4]
901
+ };
902
+ }
903
+ }
904
+ }
905
+ return null;
906
+ }
907
+ function printFormat(fobj, value) {
908
+ if (fobj && value && fobj.Number == "R" && fobj.Type == "Integer") {
909
+ const lst = value.split(",").map(Number);
910
+ if (lst.length == 2) {
911
+ const [ref, alt] = lst;
912
+ if (ref >= 0 && alt >= 0 && ref + alt > 0) {
913
+ return `${fillbar(null, { f: alt / (alt + ref) })} <span style="font-size:.8em">${alt}/${alt + ref}</span>`;
914
+ }
915
+ }
916
+ }
917
+ return value;
918
+ }
919
+ function block2source(b) {
920
+ if (b.gmmode == "genomic") {
921
+ const r = b.rglst[0];
922
+ return "mutations from " + r.chr + ":" + r.start + "-" + r.stop;
923
+ }
924
+ if (b.usegm) return "mutations in " + b.usegm.name;
925
+ return "mutations";
926
+ }
927
+
928
+ // mds3/clickVariant.js
929
+ var minoccur4sunburst = 10;
930
+ async function click_variant(d, tk, block, tippos, eventTarget) {
931
+ try {
932
+ if (tk.click_snvindel) {
933
+ tk.skewer.hlssmid = new Set(d.mlst.map((i) => i.ssm_id));
934
+ mayHighlightDiskBySsmid(tk);
935
+ tk.click_snvindel(d.mlst[0]);
936
+ return;
937
+ }
938
+ if ("occurrence" in d && d.occurrence >= minoccur4sunburst && tk.mds.variant2samples && tk.mds.variant2samples.sunburst_twLst) {
939
+ await click2sunburst(d, tk, block, tippos);
940
+ return;
941
+ }
942
+ await variant_details({ mlst: d.mlst, tk, block, tippos });
943
+ } catch (e) {
944
+ block.error(e.message || e);
945
+ if (e.stack) console.log(e.stack);
946
+ }
947
+ }
948
+ async function click2sunburst(d, tk, block, tippos) {
949
+ tk.glider.style("cursor", "wait");
950
+ const data = await tk.mds.variant2samples.get({
951
+ mlst: d.mlst,
952
+ querytype: tk.mds.variant2samples.type_sunburst
953
+ });
954
+ tk.glider.style("cursor", "auto");
955
+ if (!dataGood4sunburst(data)) {
956
+ await variant_details({ mlst: d.mlst, tk, block, tippos });
957
+ return;
958
+ }
959
+ const arg = {
960
+ nodes: data.nodes,
961
+ occurrence: d.occurrence,
962
+ boxyoff: tk.yoff,
963
+ boxheight: Math.min(800, tk.height),
964
+ // guard against very tall track
965
+ boxwidth: block.width,
966
+ svgheight: Number.parseFloat(block.svg.attr("height")),
967
+ g: tk.skewer.g.append("g"),
968
+ pica: tk.pica,
969
+ click_listbutton: (x, y) => {
970
+ variant_details({ mlst: d.mlst, tk, block, tippos });
971
+ },
972
+ click_ring: async (event2, d2) => {
973
+ tk.itemtip.clear();
974
+ const param = {
975
+ mlst: d.mlst,
976
+ tk,
977
+ block,
978
+ div: tk.itemtip.d,
979
+ tid2value: {}
980
+ };
981
+ param.tid2value[d2.data.id0] = d2.data.v0;
982
+ if (d2.data.id1) param.tid2value[d2.data.id1] = d2.data.v1;
983
+ if (d2.data.id2) param.tid2value[d2.data.id2] = d2.data.v2;
984
+ param.mlst = d.mlst.map((m) => {
985
+ if (tk.mds.variant2samples.variantkey == "ssm_id") {
986
+ return { ssm_id: m.ssm_id, occurrence: 0 };
987
+ }
988
+ throw "unknown variant2samples.variantkey";
989
+ });
990
+ param.mlst[0].occurrence = d2.value;
991
+ const x = event2.clientX;
992
+ const y = event2.clientY;
993
+ await init_sampletable(param);
994
+ tk.itemtip.show2(x, y);
995
+ }
996
+ };
997
+ if (d.aa) {
998
+ arg.cx = d.aa.x;
999
+ arg.cy = skewer_sety(d, tk) + d.yoffset * (tk.skewer.pointup ? -1 : 1);
1000
+ } else {
1001
+ arg.cx = d.x;
1002
+ arg.cy = d.y + (tk.skewer.pointup ? 1 : -1) * tk.skewer.stem1 / 2;
1003
+ }
1004
+ if (d.mlst.length == 1) {
1005
+ arg.chartlabel = d.mlst[0].mname;
1006
+ } else {
1007
+ const mnameSet = new Set(d.mlst.map((i) => i.mname));
1008
+ if (mnameSet.size == 1) {
1009
+ arg.chartlabel = [...mnameSet][0];
1010
+ } else {
1011
+ arg.chartlabel = d.mlst.reduce((i, j) => j.occurrence > i.occurrence ? j : i).mname + " etc";
1012
+ }
1013
+ }
1014
+ const _ = await import("./sunburst-VJJ3UVYC.js");
1015
+ _.default(arg);
1016
+ }
1017
+ function dataGood4sunburst(data) {
1018
+ if (!Array.isArray(data.nodes)) throw "nodes not array";
1019
+ if (data.nodes.length == 0) throw "nodes empty array";
1020
+ if (data.nodes.length == 1) return false;
1021
+ for (let i = 1; i < data.nodes.length; i++) {
1022
+ const n = data.nodes[i];
1023
+ if (!n.name) throw "node name missing";
1024
+ if (!Number.isInteger(n.cohortsize)) {
1025
+ }
1026
+ }
1027
+ return true;
1028
+ }
1029
+ async function variant_details(arg) {
1030
+ arg.tk.itemtip.clear().show(arg.tippos.left - 10, arg.tippos.top - 10);
1031
+ arg.div = arg.tk.itemtip.d;
1032
+ arg.tipDiv = arg.tk.itemtip.d;
1033
+ await itemtable(arg);
1034
+ }
1035
+
1036
+ // mds3/skewer.render.shapes.ts
1037
+ function renderSkewerShapes(tk, skewer, shapeG) {
1038
+ shapeG.filter((d) => d.dt == dtsnvindel || d.dt == dtsv || d.dt == dtfusionrna).append("path").attr("d", (d) => shapes[d.shape].calculatePath(getPathDimensions(d.shape, d.radius, skewer.pointup))).attr("fill", (d) => !shapes[d.shape].isFilled ? "none" : d.mlst?.[0] ? tk.color4disc(d.mlst[0]) : tk.color4disc(d)).attr(
1039
+ "stroke",
1040
+ (d) => (d.dt == dtfusionrna || d.dt == dtsv) && d?.mlst[0] ? tk.color4disc(d.mlst[0]) : shapes[d.shape].isFilled ? "white" : d.mlst?.[0] ? tk.color4disc(d.mlst[0]) : tk.color4disc(d)
1041
+ );
1042
+ const defs = shapeG.append("defs").selectAll("clipPath").data(shapeG.data()).enter().append("clipPath").attr(
1043
+ "id",
1044
+ (d) => `clip-path-${d?.mlst ? `${d.mlst[0].mname}-${d.mlst[0].__x}-${d.yoffset}` : `${d.mname}-${d.__x}-${d._y}`}`
1045
+ );
1046
+ defs.each(function(d) {
1047
+ const { width, height } = getPathDimensions(d.shape, d.radius, skewer.pointup);
1048
+ if (!width || !height) return;
1049
+ select_default(this).append("rect").attr("x", d.useNterm != shapes[d.shape].isFilled ? -(width / 2) : 0).attr("y", -(height / 2)).attr("width", d.useNterm != shapes[d.shape].isFilled ? width / 2 : width).attr("height", height);
1050
+ });
1051
+ shapeG.filter((d) => d.dt == dtfusionrna || d.dt == dtsv).append("g").attr(
1052
+ "clip-path",
1053
+ (d) => `url(#clip-path-${d?.mlst ? `${d.mlst[0].mname}-${d.mlst[0].__x}-${d.yoffset}` : `${d.mname}-${d.__x}-${d._y}`}`
1054
+ ).append("path").attr("d", (d) => shapes[d.shape].calculatePath(getPathDimensions(d.shape, d.radius, skewer.pointup))).attr("fill", (d) => shapes[d.shape].isFilled ? "white" : tk.color4disc(d.mlst[0])).attr("stroke", "none");
1055
+ }
1056
+ function renderShapeKick(skewer, elem) {
1057
+ const kick = elem.append("path").attr("d", (d) => {
1058
+ if (!d.shape) d.shape = d.groups[0].shape;
1059
+ const radius = d.radius * 1.01 || d.maxradius + 2;
1060
+ return shapes[d.shape].calculatePath(getPathDimensions(d.shape, radius, skewer.pointup));
1061
+ }).attr("stroke-width", 1.75);
1062
+ return kick;
1063
+ }
1064
+ function getPathDimensions(key, radius, pointup = true) {
1065
+ switch (key) {
1066
+ case "filledCircle":
1067
+ return { radius: radius * 0.95 };
1068
+ case "emptyCircle":
1069
+ return { radius };
1070
+ case "filledVerticalRectangle":
1071
+ return { width: radius * 1.5, height: radius * 2.1 };
1072
+ case "emptyVerticalRectangle":
1073
+ return { width: radius * 1.4, height: radius * 2 };
1074
+ case "filledTriangle":
1075
+ return { width: radius * 2.1, height: radius * 2.1, isUp: pointup };
1076
+ case "emptyTriangle":
1077
+ return { width: radius * 2, height: radius * 2, isUp: pointup };
1078
+ case "filledSquare":
1079
+ return { width: radius * 1.7, height: radius * 1.7 };
1080
+ case "emptySquare":
1081
+ return { width: radius * 1.7, height: radius * 1.7 };
1082
+ default:
1083
+ throw "Invalid shape key. Add shape [getPathDimensions() skewer.render.shapes.ts]";
1084
+ }
1085
+ }
1086
+ function setNumBaseline(key, pointup) {
1087
+ if (key.includes("Triangle")) {
1088
+ if (pointup) return "central";
1089
+ else return `text-after-edge`;
1090
+ } else return "";
1091
+ }
1092
+
1093
+ // mds3/skewer.render.js
1094
+ var modefold = 0;
1095
+ var modeshow = 1;
1096
+ var middlealignshift = 0.3;
1097
+ var disclabelspacing = 1;
1098
+ var textlensf = 0.6;
1099
+ function skewer_make(tk, block) {
1100
+ const ss = tk.skewer;
1101
+ for (const d of ss.data) {
1102
+ d.x0 = d.x;
1103
+ if (d.xoffset != void 0) {
1104
+ d.x = d.x0 + d.xoffset;
1105
+ }
1106
+ for (const g of d.groups) {
1107
+ g.aa = d;
1108
+ }
1109
+ }
1110
+ const dotwidth = Math.max(14, block.width / 110);
1111
+ let mdc = 0;
1112
+ for (const d of ss.data) {
1113
+ for (const g of d.groups) {
1114
+ mdc = Math.max(mdc, g.occurrence);
1115
+ }
1116
+ }
1117
+ let mrd = 0;
1118
+ const w = Math.pow(dotwidth / 2, 2) * Math.PI;
1119
+ if (mdc <= 10) mrd = w * mdc * 0.9;
1120
+ else if (mdc <= 100) mrd = w * 10;
1121
+ else if (mdc <= 1e3) mrd = w * 14;
1122
+ else mrd = w * 20;
1123
+ const sf_discradius = linear().domain([1, mdc * 0.5, mdc * 0.6, mdc * 0.7, mdc * 0.8, mdc]).range([w, w + (mrd - w) * 0.8, w + (mrd - w) * 0.85, w + (mrd - w) * 0.9, w + (mrd - w) * 0.95, mrd]);
1124
+ let globalmaxradius = dotwidth / 2;
1125
+ ss.maxheight = 0;
1126
+ for (const d of ss.data) {
1127
+ if (d.showmode == void 0) d.showmode = modefold;
1128
+ if (d.slabelrotate == void 0) d.slabelrotate = false;
1129
+ d.maxradius = 0;
1130
+ d.maxrimwidth = 0;
1131
+ d.width = 0;
1132
+ d.slabelwidth = 0;
1133
+ for (const r of d.groups) {
1134
+ if (r.occurrence <= 1) {
1135
+ r.radius = dotwidth / 2;
1136
+ } else {
1137
+ const digc = r.occurrence.toString().length;
1138
+ r.radius = Math.max(Math.sqrt(sf_discradius(r.occurrence) / Math.PI), digc * 5);
1139
+ }
1140
+ d.maxradius = Math.max(d.maxradius, r.radius);
1141
+ globalmaxradius = Math.max(globalmaxradius, r.radius);
1142
+ r.rimwidth = r.rim1count + r.rim2count == 0 ? 0 : Math.max(2, r.radius / 6);
1143
+ d.maxrimwidth = Math.max(d.maxrimwidth, r.rimwidth);
1144
+ }
1145
+ let totalheight = 0;
1146
+ for (const r of d.groups) {
1147
+ r.yoffset = totalheight + r.radius + r.rimwidth;
1148
+ totalheight += (r.radius + r.rimwidth) * 2;
1149
+ }
1150
+ ss.maxheight = Math.max(ss.maxheight, totalheight);
1151
+ }
1152
+ if (!tk.shapes) {
1153
+ if (!tk.shapeBy) {
1154
+ tk.shapes = {};
1155
+ Object.keys(mclass).forEach((v) => tk.shapes[v] = "filledCircle");
1156
+ }
1157
+ }
1158
+ ss.selection = ss.g.selectAll().data(ss.data).enter().append("g").attr("class", "sja_skg").each(function(d) {
1159
+ d.skewer = this;
1160
+ });
1161
+ const discg = ss.selection.selectAll().data((d) => d.groups).enter().append("g").attr(
1162
+ "transform",
1163
+ (d) => "translate(0," + (d.aa.showmode == modefold ? 0 : d.yoffset * (tk.skewer.pointup ? -1 : 1)) + ")"
1164
+ ).attr("class", "sja_aa_discg").each(function(d) {
1165
+ d.g = this;
1166
+ if (!d.shape) {
1167
+ d.shape = tk.shapes[d.mlst[0].class];
1168
+ }
1169
+ if (!d.shape.includes("Circle")) {
1170
+ renderSkewerShapes(tk, ss, select_default(this));
1171
+ } else {
1172
+ const discdot = select_default(this).append("circle");
1173
+ discdot.filter((d2) => d2.dt == dtsnvindel || d2.dt == dtsv || d2.dt == dtfusionrna).attr("fill", (d2) => !shapes[d2.shape].isFilled ? "white" : tk.color4disc(d2.mlst[0])).attr("stroke", (d2) => !shapes[d2.shape].isFilled ? tk.color4disc(d2.mlst[0]) : "white").attr("r", (d2) => d2.radius - 0.5);
1174
+ select_default(this).filter((d2) => d2.dt == dtfusionrna || d2.dt == dtsv).append("path").attr("fill", (d2) => !shapes[d2.shape].isFilled ? tk.color4disc(d2.mlst[0]) : "white").attr("stroke", "none").attr(
1175
+ "d",
1176
+ (d2) => arc_default()({
1177
+ innerRadius: 0,
1178
+ outerRadius: d2.radius - 2,
1179
+ /**** Always show the colored area on the correct side ****
1180
+ * Preserves showing the colored:white areas regardless if
1181
+ * the shape is filled or not
1182
+ */
1183
+ startAngle: d2.useNterm == shapes[d2.shape].isFilled ? 0 : Math.PI,
1184
+ endAngle: d2.useNterm == shapes[d2.shape].isFilled ? Math.PI : Math.PI * 2
1185
+ })
1186
+ );
1187
+ }
1188
+ });
1189
+ const textslc = discg.filter((d) => d.occurrence > 1).append("text").text((d) => d.occurrence).attr("class", "sja_aa_discnum").attr("fill-opacity", (d) => d.aa.showmode == modefold ? 0 : 1).attr("stroke-opacity", (d) => d.aa.showmode == modefold ? 0 : 1).attr("dominant-baseline", (d) => tk.shapes ? setNumBaseline(d.shape, tk.skewer.pointup) : "").attr("text-anchor", "middle").each((d) => {
1190
+ const s = d.radius * 1.5;
1191
+ d.discnumfontsize = Math.min(s / (d.occurrence.toString().length * textlensf), s);
1192
+ }).attr("font-size", (d) => d.discnumfontsize).attr("y", (d) => d.discnumfontsize * middlealignshift);
1193
+ textslc.filter((d) => d.dt == dtsnvindel).attr("fill", (d) => tk.shapes && !shapes[d.shape].isFilled ? "black" : "white");
1194
+ textslc.filter((d) => d.dt == dtsv || d.dt == dtfusionrna).attr("stroke", (d) => tk.color4disc(d.mlst[0])).attr("stroke-width", 0.8).attr("font-weight", "bold").attr("fill", "white");
1195
+ const textlab = discg.append("text").text((d) => d.mnameCompact || tk.mnamegetter(d.mlst[0])).attr("font-size", (d) => {
1196
+ d._labfontsize = Math.max(12, d.radius * 1.2);
1197
+ return d._labfontsize;
1198
+ }).each(function(d) {
1199
+ const lw = this.getBBox().width;
1200
+ d._label_width = lw;
1201
+ if (d.aa.groups.length == 1) {
1202
+ d.aa.slabelrotate = true;
1203
+ d.aa.slabelwidth = lw;
1204
+ ss.maxheight = Math.max(ss.maxheight, (d.radius + d.rimwidth) * 2 + 2 + lw);
1205
+ }
1206
+ }).attr("fill", (d) => tk.color4disc(d.mlst[0])).attr("x", (d) => d.radius + d.rimwidth + 1).attr("y", (d) => d._labfontsize * middlealignshift).classed("sja_aa_disclabel", true).attr("fill-opacity", (d) => d.aa.showmode == modefold ? 0 : 1).attr("transform", "scale(1) rotate(0)").on("mousedown", (event2) => {
1207
+ event2.stopPropagation();
1208
+ }).on("click", (event2, d) => {
1209
+ fold_glyph([d.aa], tk);
1210
+ unfold_update(tk, block);
1211
+ }).on("mouseover", (event2, d) => {
1212
+ event2.target.setAttribute("font-size", d._labfontsize * 1.1);
1213
+ showHoverTipOnDisk(event2, d, tk);
1214
+ }).on("mouseout", (event2, d) => {
1215
+ event2.target.setAttribute("font-size", d._labfontsize);
1216
+ tk.hovertip.hide();
1217
+ });
1218
+ ss.hlBoxG = discg.append("g");
1219
+ for (const d of ss.data) {
1220
+ let leftw = 0, rightw = 0;
1221
+ for (const g of d.groups) {
1222
+ leftw = Math.max(leftw, g.radius + g.rimwidth);
1223
+ rightw = Math.max(rightw, g.radius + g.rimwidth + disclabelspacing + g._label_width);
1224
+ }
1225
+ d.width = leftw + rightw;
1226
+ }
1227
+ let kick;
1228
+ if (tk.shapes) {
1229
+ kick = renderShapeKick(ss, discg);
1230
+ } else {
1231
+ kick = discg.append("circle").attr("r", (d) => d.radius - 0.5);
1232
+ }
1233
+ kick.attr("stroke", (d) => tk.color4disc(d.mlst[0])).classed("sja_aa_disckick", true).attr("fill", "white").attr("fill-opacity", 0).attr("stroke-opacity", 0).attr("data-testid", (d) => `sjpp-mds3skewerdisckick-${d.mlst[0].mname}`).on("mousedown", (event2) => {
1234
+ event2.stopPropagation();
1235
+ }).on("mouseover", (event2, d) => {
1236
+ showHoverTipOnDisk(event2, d, tk);
1237
+ if (tk.disc_mouseover) {
1238
+ tk.disc_mouseover(d, event2.target);
1239
+ }
1240
+ }).on("mouseout", (event2, d) => {
1241
+ tk.hovertip.hide();
1242
+ if (tk.disc_mouseout) {
1243
+ tk.disc_mouseout(d);
1244
+ }
1245
+ }).on("click", async (event2, d) => {
1246
+ click_variant(d, tk, block, event2.target.getBoundingClientRect(), event2.target);
1247
+ });
1248
+ const rimfunc = arc_default().innerRadius((d) => d.radius).outerRadius((d) => d.radius + d.rimwidth).startAngle(0).endAngle((d) => {
1249
+ d.rim1_startangle = Math.PI * 2 * d.rim1count / d.occurrence;
1250
+ return d.rim1_startangle;
1251
+ });
1252
+ discg.filter((d) => d.rim1count > 0).append("path").attr("d", rimfunc).attr("fill", (d) => tk.color4disc(d.mlst[0])).attr("class", "sja_aa_discrim").attr("fill-opacity", 0);
1253
+ const rimfunc2 = arc_default().innerRadius((d) => d.radius + 0.5).outerRadius((d) => d.radius + 0.5 + d.rimwidth).startAngle((d) => d.rim1_startangle).endAngle((d) => d.rim1_startangle + Math.PI * 2 * d.rim2count / d.occurrence);
1254
+ discg.filter((d) => d.rim2count > 0).append("path").attr("d", rimfunc2).attr("stroke", (d) => tk.color4disc(d.mlst[0])).attr("fill", "none").attr("class", "sja_aa_discrim").attr("stroke-opacity", 0);
1255
+ {
1256
+ let lapcount = 0;
1257
+ let lastx = 0;
1258
+ for (const d of ss.data) {
1259
+ if (d.x - d.maxradius - d.maxrimwidth < lastx) {
1260
+ lapcount++;
1261
+ }
1262
+ lastx = Math.max(lastx, d.x + d.width - d.maxradius - d.maxrimwidth);
1263
+ }
1264
+ ss.stem1 = lapcount == 0 ? 0 : dotwidth;
1265
+ ss.stem2 = linear().domain([0, 1, ss.data.length]).range([0, dotwidth, dotwidth * 3])(lapcount);
1266
+ }
1267
+ const hbaseline = dotwidth * 0.7;
1268
+ let maxm = 0;
1269
+ for (const d of ss.data) {
1270
+ for (const g of d.groups) {
1271
+ maxm = Math.max(maxm, g.occurrence);
1272
+ }
1273
+ }
1274
+ ss.stem3 = Math.max(2, hbaseline + dotwidth * Math.min(5, maxm));
1275
+ let foldedKick;
1276
+ if (tk.shapes) {
1277
+ foldedKick = renderShapeKick(ss, ss.selection);
1278
+ foldedKick.attr(
1279
+ "transform",
1280
+ (d) => `translate(0, ${(tk.skewer.pointup ? -1 : 1) * d.maxradius})
1281
+ scale(${d.showmode == modefold ? "1,1" : "0.01,0.01"})`
1282
+ );
1283
+ } else {
1284
+ foldedKick = ss.selection.append("circle").attr("r", (d) => d.maxradius + 1).attr("cy", (d) => (tk.skewer.pointup ? -1 : 1) * d.maxradius).attr("transform", (d) => `scale(${d.showmode == modefold ? "1,1" : "0.01,0.01"})`);
1285
+ }
1286
+ foldedKick.attr("class", "sja_aa_skkick").attr("fill", "white").attr("fill-opacity", 0).attr("stroke", "none").on("mouseover", (event2, d) => {
1287
+ let cumh = 0;
1288
+ let boxw = 0;
1289
+ const hpad = 5;
1290
+ const tiph = tk.skewer.pointup ? 7 : 14;
1291
+ for (const g of d.groups) {
1292
+ g.pica_fontsize = Math.max(11, g.radius);
1293
+ cumh += g.pica_fontsize + 1;
1294
+ tk.pica.g.append("text").text((g.mnameCompact || g.mlst[0].mname) + (g.occurrence > 1 ? " x" + g.occurrence : "")).attr("font-size", g.pica_fontsize).each(function() {
1295
+ boxw = Math.max(boxw, this.getBBox().width);
1296
+ }).remove();
1297
+ }
1298
+ boxw += hpad * 2;
1299
+ const boxh = cumh + 5;
1300
+ tk.pica.g.append("rect").attr("y", tk.skewer.pointup ? -boxh : 0).attr("width", boxw).attr("height", boxh).attr("fill", "white").attr("fill-opacity", 0.8).attr("stroke", "#ccc").attr("shape-rendering", "crispEdges");
1301
+ cumh = 0;
1302
+ const _g = tk.pica.g.selectAll().data(d.groups).enter().append("g").attr("transform", (g, i) => {
1303
+ cumh += g.pica_fontsize + 1;
1304
+ return "translate(" + hpad + "," + cumh * (tk.skewer.pointup ? -1 : 1) + ")";
1305
+ });
1306
+ _g.append("text").text((g) => g.mnameCompact || g.mlst[0].mname).attr("font-size", (g) => g.pica_fontsize).each(function(g) {
1307
+ g.pica_mlabelwidth = this.getBBox().width;
1308
+ }).attr("fill", (d2) => tk.color4disc(d2.mlst[0])).attr("dominant-baseline", tk.skewer.pointup ? "hanging" : "auto");
1309
+ const firstlabw = d.groups[0].pica_mlabelwidth;
1310
+ tk.pica.x = d.x - hpad - firstlabw / 2;
1311
+ tk.pica.y = d.y + (tk.skewer.pointup ? -1 : 1) * (d.maxradius * 2 + tiph + 2);
1312
+ tk.pica.g.attr("transform", "translate(" + tk.pica.x + "," + tk.pica.y + ")");
1313
+ _g.filter((g) => g.occurrence > 1).append("text").text((g) => "x" + g.occurrence).attr("x", (g) => g.pica_mlabelwidth + 5).attr("font-size", (g) => g.pica_fontsize).attr("dominant-baseline", tk.skewer.pointup ? "hanging" : "auto").attr("fill", "#9e9e9e");
1314
+ const handle = tk.pica.g.append("g").attr("transform", "translate(" + (hpad + firstlabw / 2) + "," + (tk.skewer.pointup ? 1 : -1) + ")");
1315
+ handle.append("line").attr("y2", (tk.skewer.pointup ? 1 : -1) * tiph).attr("stroke", "#858585").attr("shape-rendering", "crispEdges");
1316
+ handle.append("line").attr("x1", -1).attr("x2", -1).attr("y2", (tk.skewer.pointup ? 1 : -1) * tiph).attr("stroke", "white").attr("shape-rendering", "crispEdges");
1317
+ handle.append("line").attr("x1", 1).attr("x2", 1).attr("y2", (tk.skewer.pointup ? 1 : -1) * tiph).attr("stroke", "white").attr("shape-rendering", "crispEdges");
1318
+ }).on("mouseout", (event2, d) => {
1319
+ tk.pica.g.selectAll("*").remove();
1320
+ }).on("click", (event2, d) => {
1321
+ tk.pica.g.selectAll("*").remove();
1322
+ unfold_glyph([d], tk, block);
1323
+ });
1324
+ let mm = 0;
1325
+ for (const d of ss.data) {
1326
+ mm = Math.max(mm, d.occurrence);
1327
+ }
1328
+ const sf_foldyoff = linear().domain([1, mm]).range([hbaseline, ss.stem3 - globalmaxradius]);
1329
+ ss.selection.attr("transform", (d) => {
1330
+ d.foldyoffset = sf_foldyoff(d.occurrence);
1331
+ d.y = skewer_sety(d, tk);
1332
+ return "translate(" + d.x + "," + d.y + ")";
1333
+ });
1334
+ ss.selection.append("path").attr("class", "sja_aa_stem").attr("d", (d) => skewer_setstem(d, tk)).attr("stroke", (d) => tk.color4disc(d.groups[0].mlst[0])).attr("fill", "none");
1335
+ const mgsk = ss.selection.filter((d) => d.groups.length > 1);
1336
+ mgsk.append("rect").attr("class", "sja_aa_ssk_bg").attr("shape-rendering", "crispEdges").attr("fill-opacity", 0).attr("height", ss.stem1).attr("fill", (d) => tk.color4disc(d.groups[0].mlst[0])).attr("width", (d) => {
1337
+ d.ssk_width = Math.max(d.occurrence.toString().length * 8 + 6, 2 * (d.maxradius + d.maxrimwidth));
1338
+ return d.ssk_width;
1339
+ }).attr("x", (d) => -d.ssk_width / 2);
1340
+ mgsk.append("text").attr("class", "sja_aa_ssk_text").attr("fill", "white").attr("fill-opacity", 0).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "central").text((d) => d.occurrence).each((d) => {
1341
+ d.ssk_fontsize = Math.min(ss.stem1, d.ssk_width / (d.occurrence.toString().length * textlensf));
1342
+ }).attr("font-size", (d) => d.ssk_fontsize);
1343
+ mgsk.append("rect").attr("class", "sja_aa_ssk_kick").attr("fill", "white").attr("fill-opacity", 0).attr("stroke", "none").attr("height", ss.stem1).attr("x", (d) => -d.ssk_width / 2).attr("width", (d) => d.ssk_width).on("mouseover", (event2, d) => {
1344
+ const p = select_default(event2.target.parentNode);
1345
+ p.selectAll(".sja_aa_disckick").transition().attr("stroke-opacity", 1);
1346
+ p.select(".sja_aa_ssk_bg").transition().attr("fill-opacity", 1).attr("stroke-opacity", 1);
1347
+ p.select(".sja_aa_ssk_text").transition().attr("fill-opacity", 1);
1348
+ }).on("mouseout", function(event2, d) {
1349
+ const p = select_default(event2.target.parentNode);
1350
+ p.selectAll(".sja_aa_disckick").transition().attr("stroke-opacity", 0);
1351
+ p.select(".sja_aa_ssk_bg").transition().attr("fill-opacity", 0).attr("stroke-opacity", 0);
1352
+ p.select(".sja_aa_ssk_text").transition().attr("fill-opacity", 0);
1353
+ }).on("click", async (event2, d) => {
1354
+ click_variant(d, tk, block, event2.target.getBoundingClientRect(), null, event2.target);
1355
+ });
1356
+ }
1357
+ function skewer_sety(d, tk) {
1358
+ if (tk.skewer.pointup) {
1359
+ if (d.showmode == modefold) {
1360
+ return tk.skewer.maxheight + tk.skewer.stem1 + tk.skewer.stem2 + tk.skewer.stem3 - d.foldyoffset;
1361
+ }
1362
+ return tk.skewer.maxheight;
1363
+ }
1364
+ if (d.showmode == modefold) return d.foldyoffset;
1365
+ return tk.skewer.stem1 + tk.skewer.stem2 + tk.skewer.stem3;
1366
+ }
1367
+ function skewer_setstem(d, tk) {
1368
+ if (tk.skewer.pointup) {
1369
+ if (d.showmode == modefold) {
1370
+ return "M0,0v0l0,0v" + d.foldyoffset;
1371
+ }
1372
+ return "M0,0v" + tk.skewer.stem1 + "l" + (d.x0 - d.x) + "," + tk.skewer.stem2 + "v" + tk.skewer.stem3;
1373
+ }
1374
+ if (d.showmode == modefold) {
1375
+ return "M0,0v0l0,0v-" + d.foldyoffset;
1376
+ }
1377
+ return "M0,0v-" + tk.skewer.stem1 + "l" + (d.x0 - d.x) + ",-" + tk.skewer.stem2 + "v-" + tk.skewer.stem3;
1378
+ }
1379
+ function settle_glyph(tk, block) {
1380
+ if (tk.skewer.data.length == 0) return;
1381
+ const x1 = 0;
1382
+ const x2 = block.width;
1383
+ let sumwidth = 0;
1384
+ const allinview = [];
1385
+ const beyondviewitems = [];
1386
+ for (const d of tk.skewer.data) {
1387
+ if (d.x0 < x1 || d.x0 > x2) {
1388
+ delete d.xoffset;
1389
+ beyondviewitems.push(d);
1390
+ } else {
1391
+ sumwidth += d.slabelrotate ? (d.groups[0].radius + d.groups[0].rimwidth) * 2 : d.width;
1392
+ allinview.push(d);
1393
+ }
1394
+ }
1395
+ fold_glyph(beyondviewitems, tk);
1396
+ let expandlst = [];
1397
+ const foldlst = [];
1398
+ if (sumwidth < x2 - x1) {
1399
+ expandlst = allinview;
1400
+ } else {
1401
+ allinview.sort((a, b) => {
1402
+ if (b.occurrence == a.occurrence) {
1403
+ if (b.groups.length == a.groups.length) {
1404
+ return Math.abs(a.x0 * 2 - x1 - x2) - Math.abs(b.x0 * 2 - x1 - x2);
1405
+ } else {
1406
+ return b.groups.length - a.groups.length;
1407
+ }
1408
+ }
1409
+ return b.occurrence - a.occurrence;
1410
+ });
1411
+ let width = 0;
1412
+ let allowpx = (x2 - x1) * 0.8;
1413
+ let stop = false;
1414
+ for (const d of allinview) {
1415
+ if (stop) {
1416
+ delete d.xoffset;
1417
+ foldlst.push(d);
1418
+ d.showmode = modefold;
1419
+ } else {
1420
+ if (width + d.width < allowpx) {
1421
+ expandlst.push(d);
1422
+ width += d.width;
1423
+ } else {
1424
+ stop = true;
1425
+ delete d.xoffset;
1426
+ foldlst.push(d);
1427
+ d.showmode = modefold;
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ fold_glyph(foldlst, tk);
1433
+ unfold_glyph(expandlst, tk, block);
1434
+ }
1435
+ function unfold_glyph(newlst, tk, block) {
1436
+ const dur = 1e3;
1437
+ const expanded = /* @__PURE__ */ new Set();
1438
+ const folded = /* @__PURE__ */ new Set();
1439
+ for (const d of newlst) {
1440
+ if (d.showmode == modeshow) {
1441
+ expanded.add(d.x0);
1442
+ } else {
1443
+ d.showmode = modeshow;
1444
+ folded.add(d.x0);
1445
+ d.y = skewer_sety(d, tk);
1446
+ }
1447
+ }
1448
+ if (expanded.size) {
1449
+ const set = tk.skewer.selection.filter((d) => expanded.has(d.x0));
1450
+ set.selectAll(".sja_aa_discrim").attr("fill-opacity", 1).attr("stroke-opacity", 1);
1451
+ }
1452
+ if (folded.size) {
1453
+ const set = tk.skewer.selection.filter((d) => folded.has(d.x0));
1454
+ set.transition().duration(dur).attr("transform", (d) => "translate(" + d.x + "," + d.y + ")");
1455
+ set.selectAll(".sja_aa_discg").transition().duration(dur).attr("transform", (d) => {
1456
+ d.y = d.yoffset * (tk.skewer.pointup ? -1 : 1);
1457
+ return "translate(0," + d.y + ")";
1458
+ });
1459
+ set.selectAll(".sja_aa_disckick").transition().duration(dur).attr("transform", "scale(1)").on("end", () => {
1460
+ set.selectAll(".sja_aa_ssk_kick").attr("transform", "scale(1)").attr("y", tk.skewer.pointup ? 0 : -tk.skewer.stem1);
1461
+ set.selectAll(".sja_aa_disckick").classed("sjpp-active", true);
1462
+ });
1463
+ set.selectAll(".sja_aa_discnum").transition().duration(dur).attr("fill-opacity", 1).attr("stroke-opacity", 1);
1464
+ set.filter((d) => d.groups.length > 1).selectAll(".sja_aa_disclabel").transition().duration(dur).attr("fill-opacity", 1).attr("transform", "scale(1)");
1465
+ set.selectAll(".sja_aa_discrim").transition().duration(dur).attr("fill-opacity", 1).attr("stroke-opacity", 1);
1466
+ set.selectAll(".sja_aa_ssk_bg").attr("transform", "scale(1)").attr("y", tk.skewer.pointup ? 0 : -tk.skewer.stem1);
1467
+ set.selectAll(".sja_aa_ssk_text").attr("transform", "scale(1)").attr("y", (tk.skewer.pointup ? 1 : -1) * tk.skewer.stem1 / 2);
1468
+ set.selectAll(".sja_aa_skkick").transition().duration(0).attr(
1469
+ "transform",
1470
+ (d) => `${d.shape && !d.shape.includes("Circle") ? `translate(0, ${(tk.skewer.pointup ? -1 : 1) * d.maxradius})` : ""} scale(0.01, 0.01)`
1471
+ // safari fix
1472
+ ).on("end", () => {
1473
+ set.selectAll(".sja_aa_skkick").classed("sjpp-active", false);
1474
+ });
1475
+ let counter = 0;
1476
+ set.selectAll(".sja_aa_stem").transition().duration(dur).attr("d", (d) => skewer_setstem(d, tk)).each(() => ++counter).on("end", () => {
1477
+ if (!--counter) {
1478
+ unfold_update(tk, block);
1479
+ }
1480
+ });
1481
+ } else {
1482
+ unfold_update(tk, block);
1483
+ }
1484
+ }
1485
+ function unfold_update(tk, block) {
1486
+ const dur = 1e3;
1487
+ const alllst = [];
1488
+ const hash = /* @__PURE__ */ new Set();
1489
+ const x1 = 0;
1490
+ const x2 = block.width;
1491
+ for (const d of tk.skewer.data) {
1492
+ if (d.x0 < x1 || d.x0 > x2) continue;
1493
+ if (d.showmode == modeshow) {
1494
+ d.x = d.x0;
1495
+ alllst.push(d);
1496
+ hash.add(d.x0);
1497
+ }
1498
+ }
1499
+ if (alllst.length == 0) {
1500
+ return;
1501
+ }
1502
+ horiplace(alllst, tk, block);
1503
+ for (const d of alllst) {
1504
+ d.xoffset = d.x - d.x0;
1505
+ }
1506
+ for (let i = 0; i < alllst.length; i++) {
1507
+ const d = alllst[i];
1508
+ if (d.groups.length > 1) continue;
1509
+ const disc = d.groups[0];
1510
+ if (tk.slabel_forcerotate) {
1511
+ d.slabelrotate = true;
1512
+ } else {
1513
+ const next = alllst[i + 1];
1514
+ const rightx = next ? next.x - next.maxradius - next.maxrimwidth : x2;
1515
+ d.slabelrotate = rightx - d.x - disc.radius - disc.rimwidth - 1 < d.slabelwidth;
1516
+ }
1517
+ d.width = (disc.radius + disc.rimwidth) * 2 + (d.slabelrotate ? 0 : 2 + d.slabelwidth);
1518
+ }
1519
+ const set = tk.skewer.selection.filter((d) => hash.has(d.x0));
1520
+ set.transition().duration(dur).attr("transform", (d) => "translate(" + d.x + "," + d.y + ")");
1521
+ set.selectAll(".sja_aa_stem").transition().duration(dur).attr("d", (d) => skewer_setstem(d, tk));
1522
+ set.filter((d) => d.groups.length == 1).selectAll(".sja_aa_disclabel").transition().duration(dur).attr("fill-opacity", 1).attr(
1523
+ "transform",
1524
+ (d) => "scale(1) rotate(" + (d.aa.slabelrotate ? (tk.skewer.pointup ? "-" : "") + "90" : "0") + ")"
1525
+ );
1526
+ tk.slabel_forcerotate = false;
1527
+ }
1528
+ function horiplace(items, tk, block) {
1529
+ const xoffset0 = 0;
1530
+ const x2 = block.width;
1531
+ let xoffset = xoffset0;
1532
+ let overlap = false;
1533
+ for (const i of items) {
1534
+ if (i.x0 < xoffset0 || i.x0 > x2) continue;
1535
+ if (i.groups.length == 1) {
1536
+ i.slabelrotate = true;
1537
+ const disc = i.groups[0];
1538
+ i.width = (disc.radius + disc.rimwidth) * 2;
1539
+ }
1540
+ const x = i.x - i.maxradius - i.maxrimwidth;
1541
+ if (x < xoffset) {
1542
+ overlap = true;
1543
+ }
1544
+ if (x + i.width > x2) {
1545
+ overlap = true;
1546
+ }
1547
+ xoffset = Math.max(xoffset, x + i.width);
1548
+ }
1549
+ if (!overlap) {
1550
+ return false;
1551
+ }
1552
+ xoffset = xoffset0;
1553
+ for (const i of items) {
1554
+ if (i.x0 < xoffset0 || i.x0 > x2) continue;
1555
+ i.x = xoffset + i.maxradius + i.maxrimwidth;
1556
+ xoffset += i.width;
1557
+ }
1558
+ horiplace0(items, block.width);
1559
+ }
1560
+ function horiplace0(items, allwidth) {
1561
+ for (let i = 0; i < items.length; i++) {
1562
+ if (items[i].x0 < 0) continue;
1563
+ if (items[i].x0 > allwidth) break;
1564
+ while (1) {
1565
+ let currsum = 0, newsum = 0;
1566
+ for (let j = i; j < items.length; j++) {
1567
+ const t = items[j];
1568
+ if (t.x0 > allwidth) {
1569
+ return;
1570
+ }
1571
+ currsum += Math.abs(t.x - t.x0);
1572
+ t.x++;
1573
+ newsum += Math.abs(t.x - t.x0);
1574
+ }
1575
+ if (items[i].x >= items[i].x0) {
1576
+ for (let j = i; j < items.length; j++) {
1577
+ items[j].x--;
1578
+ }
1579
+ break;
1580
+ }
1581
+ const z = items[items.length - 1];
1582
+ if (z.x + z.width / 2 >= allwidth) {
1583
+ return;
1584
+ }
1585
+ if (newsum <= currsum) {
1586
+ } else {
1587
+ for (let j = i; j < items.length; j++) {
1588
+ if (items[j].x0 > allwidth) {
1589
+ break;
1590
+ }
1591
+ items[j].x--;
1592
+ }
1593
+ break;
1594
+ }
1595
+ }
1596
+ }
1597
+ }
1598
+ function fold_glyph(lst, tk) {
1599
+ if (lst.length == 0) return;
1600
+ const dur = 1e3;
1601
+ const hash = /* @__PURE__ */ new Set();
1602
+ for (const d of lst) {
1603
+ d.x = d.x0;
1604
+ hash.add(d.x0);
1605
+ d.showmode = modefold;
1606
+ d.y = skewer_sety(d, tk);
1607
+ }
1608
+ const set = tk.skewer.selection.filter((d) => hash.has(d.x0));
1609
+ set.transition().duration(dur).attr("transform", (d) => "translate(" + d.x + "," + d.y + ")");
1610
+ set.selectAll(".sja_aa_stem").transition().duration(dur).attr("d", (d) => skewer_setstem(d, tk));
1611
+ set.selectAll(".sja_aa_discg").transition().duration(dur).attr("transform", (d) => "translate(0," + (tk.skewer.pointup ? "-" : "") + d.aa.maxradius + ")");
1612
+ set.selectAll(".sja_aa_disckick").transition().duration(0).attr("transform", "scale(0)").on("end", () => {
1613
+ set.selectAll(".sja_aa_disckick").classed("sjpp-active", false);
1614
+ });
1615
+ set.selectAll(".sja_aa_discnum").transition().duration(dur).attr("fill-opacity", 0).attr("stroke-opacity", 0);
1616
+ set.selectAll(".sja_aa_disclabel").transition().duration(dur).attr("fill-opacity", 0).attr("transform", "scale(0)");
1617
+ set.selectAll(".sja_aa_discrim").transition().duration(dur).attr("fill-opacity", 0).attr("stroke-opacity", 0);
1618
+ set.selectAll(".sja_aa_ssk_kick").attr("transform", "scale(0)");
1619
+ set.selectAll(".sja_aa_ssk_bg").attr("transform", "scale(0)");
1620
+ set.selectAll(".sja_aa_ssk_text").attr("transform", "scale(0)");
1621
+ set.selectAll(".sja_aa_skkick").transition().duration(dur).attr("transform", (d) => `${d.shape ? `translate(0, ${(tk.skewer.pointup ? -1 : 1) * d.maxradius})` : ""} scale(1)`).on("end", () => {
1622
+ set.selectAll(".sja_aa_skkick").classed("sjpp-active", true);
1623
+ });
1624
+ }
1625
+ function mayHighlightDiskBySsmid(tk) {
1626
+ tk.skewer.hlBoxG.selectAll("*").remove();
1627
+ if (!tk.skewer.hlssmid) return;
1628
+ tk.skewer.hlBoxG.filter((g) => {
1629
+ if (g.mlst) {
1630
+ return g.mlst.find((m) => tk.skewer.hlssmid.has(m.ssm_id));
1631
+ }
1632
+ return tk.skewer.hlssmid.has(g.ssm_id);
1633
+ }).append("rect").attr("x", (g) => -g.radius).attr("y", (g) => -g.radius).attr("width", (g) => g.radius * 2).attr("height", (g) => g.radius * 2).attr("stroke", tk.skewer.hlBoxColor).attr("stroke-width", (g) => g.radius > 10 ? 1.5 : 1).attr("fill", "none").attr("class", "sja_mds3_skewer_ssmhlbox");
1634
+ }
1635
+ function showHoverTipOnDisk(event2, d, tk) {
1636
+ tk.hovertip.clear().show(event2.clientX, event2.clientY);
1637
+ if (!d.mlst?.[0]) {
1638
+ tk.hovertip.d.append("div").text("d.mlst[] missing or blank");
1639
+ return;
1640
+ }
1641
+ const m = mclass[d.mlst[0]?.class] || { color: "black", label: "_unknown" };
1642
+ tk.hovertip.d.append("div").style("font-size", ".9em").html(`<span style="background:${m.color}">&nbsp;&nbsp;</span> ${m.label}`);
1643
+ if (d.mlst[0].occurrence) {
1644
+ const c = d.mlst.reduce((t, i) => t + i.occurrence, 0);
1645
+ tk.hovertip.d.append("div").text(`${c} sample${c > 1 ? "s" : ""}`);
1646
+ }
1647
+ if (d.mlst.length > 1) {
1648
+ tk.hovertip.d.append("div").text(`${d.mlst.length} ${d.mlst[0].dt == dtsnvindel ? "variants" : "alterations"}`);
1649
+ }
1650
+ }
1651
+
1652
+ // mds3/datagroup.js
1653
+ var minbpwidth = 4;
1654
+ function make_datagroup(tk, rawmlst, block) {
1655
+ mlst_pretreat(rawmlst, tk, block);
1656
+ const x2mlst = /* @__PURE__ */ new Map();
1657
+ for (const m of rawmlst) {
1658
+ if (m.__x == void 0) continue;
1659
+ if (!x2mlst.has(m.__x)) {
1660
+ x2mlst.set(m.__x, []);
1661
+ }
1662
+ x2mlst.get(m.__x).push(m);
1663
+ }
1664
+ const datagroup = [];
1665
+ if (block.exonsf >= minbpwidth) {
1666
+ for (const [x, mlst] of x2mlst) {
1667
+ datagroup.push({
1668
+ chr: mlst[0].chr,
1669
+ pos: mlst[0].pos,
1670
+ mlst,
1671
+ x
1672
+ });
1673
+ }
1674
+ } else {
1675
+ if (block.usegm && block.usegm.coding && block.gmmode != gmmode.genomic) {
1676
+ const aa2mlst = /* @__PURE__ */ new Map();
1677
+ for (const [x, mlst] of x2mlst) {
1678
+ if (mlst[0].chr != block.usegm.chr) {
1679
+ continue;
1680
+ }
1681
+ let aapos = void 0;
1682
+ for (const m of mlst) {
1683
+ if (Number.isFinite(m.aapos)) aapos = m.aapos;
1684
+ }
1685
+ if (aapos == void 0) {
1686
+ aapos = genomic2gm(mlst[0].pos, block.usegm).aapos;
1687
+ }
1688
+ if (aapos == void 0) {
1689
+ console.error("data item cannot map to aaposition");
1690
+ console.log(mlst[0]);
1691
+ continue;
1692
+ }
1693
+ x2mlst.delete(x);
1694
+ if (!aa2mlst.has(aapos)) {
1695
+ aa2mlst.set(aapos, []);
1696
+ }
1697
+ let notmet = true;
1698
+ for (const lst of aa2mlst.get(aapos)) {
1699
+ if (Math.abs(lst[0].__x - mlst[0].__x) <= block.exonsf * 3) {
1700
+ for (const m of mlst) {
1701
+ lst.push(m);
1702
+ }
1703
+ notmet = false;
1704
+ break;
1705
+ }
1706
+ }
1707
+ if (notmet) {
1708
+ aa2mlst.get(aapos).push(mlst);
1709
+ }
1710
+ }
1711
+ for (const llst of aa2mlst.values()) {
1712
+ for (const mlst of llst) {
1713
+ let m = null;
1714
+ for (const m2 of mlst) {
1715
+ if (Number.isFinite(m2.rnapos)) m = m2;
1716
+ }
1717
+ if (m == null) {
1718
+ console.log("trying to map mlst to codon, but no rnapos found");
1719
+ for (const m2 of mlst) {
1720
+ console.log(m2);
1721
+ }
1722
+ continue;
1723
+ }
1724
+ datagroup.push({
1725
+ chr: mlst[0].chr,
1726
+ pos: m.pos,
1727
+ mlst,
1728
+ x: mlst[0].__x
1729
+ });
1730
+ }
1731
+ }
1732
+ }
1733
+ const pxbin = [];
1734
+ const binpx = 2;
1735
+ for (const [x, mlst] of x2mlst) {
1736
+ const i = Math.floor(x / binpx);
1737
+ if (!pxbin[i]) {
1738
+ pxbin[i] = [];
1739
+ }
1740
+ pxbin[i] = [...pxbin[i], ...mlst];
1741
+ }
1742
+ for (const mlst of pxbin) {
1743
+ if (!mlst) continue;
1744
+ const xsum = mlst.reduce((i, j) => i + j.__x, 0);
1745
+ datagroup.push({
1746
+ isbin: true,
1747
+ chr: mlst[0].chr,
1748
+ pos: mlst[0].pos,
1749
+ mlst,
1750
+ x: xsum / mlst.length
1751
+ });
1752
+ }
1753
+ }
1754
+ datagroup.sort((a, b) => a.x - b.x);
1755
+ return datagroup;
1756
+ }
1757
+ function mlst_pretreat(rawmlst, tk, block) {
1758
+ let nogenomicpos = 0, outofcds = 0, nochr = 0;
1759
+ const unmapped = [];
1760
+ const usemlst = [];
1761
+ for (const m of rawmlst) {
1762
+ delete m.__x;
1763
+ if (block.gmmode == gmmode.protein && block.usegm.codingstart && block.usegm.codingstop) {
1764
+ if (m.pos < block.usegm.codingstart || m.pos > block.usegm.codingstop) {
1765
+ outofcds++;
1766
+ continue;
1767
+ }
1768
+ }
1769
+ if (!m.chr) {
1770
+ nochr++;
1771
+ continue;
1772
+ }
1773
+ if (!Number.isInteger(m.pos)) {
1774
+ nogenomicpos++;
1775
+ continue;
1776
+ }
1777
+ const hits = block.seekcoord(m.chr, m.pos);
1778
+ if (hits.length == 0) {
1779
+ unmapped.push(m);
1780
+ continue;
1781
+ }
1782
+ if (hits.length == 1) {
1783
+ m.__x = hits[0].x;
1784
+ } else {
1785
+ m.__x = hits[0].x;
1786
+ }
1787
+ if (m.__x < -1 || m.__x > block.width + 1) {
1788
+ continue;
1789
+ }
1790
+ usemlst.push(m);
1791
+ }
1792
+ if (nogenomicpos + nochr > 0) {
1793
+ block.tkerror(tk, nogenomicpos + nochr + " items have no chromosome or genomic position");
1794
+ }
1795
+ if (unmapped.length) {
1796
+ console.error(unmapped.length + " items not mapped to any region");
1797
+ for (const m of unmapped) console.log(m);
1798
+ }
1799
+ dsqueryresult_snvindelfusionitd(usemlst, tk, block);
1800
+ }
1801
+ function dsqueryresult_snvindelfusionitd(lst, tk, block) {
1802
+ for (const m of lst) {
1803
+ if (block.usegm) {
1804
+ const t = genomic2gm(m.pos, block.usegm);
1805
+ m.rnapos = t.rnapos;
1806
+ m.aapos = t.aapos;
1807
+ }
1808
+ if (m.dt == dtsnvindel) {
1809
+ continue;
1810
+ }
1811
+ if (m.dt == dtsv || m.dt == dtfusionrna) {
1812
+ if (m.pairlstIdx == 0) {
1813
+ m.useNterm = true;
1814
+ } else {
1815
+ m.useNterm = false;
1816
+ }
1817
+ continue;
1818
+ }
1819
+ throw "unknown dt: " + m.dt;
1820
+ }
1821
+ }
1822
+
1823
+ // mds3/leftlabel.js
1824
+ var labyspace = 5;
1825
+ async function make_leftlabels(data, tk, block) {
1826
+ let laby = 0;
1827
+ makeVariantLabel(data, tk, block, laby);
1828
+ if (tk.leftlabels.doms.variants) {
1829
+ laby += labyspace + block.labelfontsize;
1830
+ }
1831
+ if ("sampleTotalNumber" in data || tk.leftlabels.doms.samples) {
1832
+ const _ = await import("./leftlabel.sample-OJW3AE64.js");
1833
+ _.makeSampleLabel(data, tk, block, laby);
1834
+ laby += labyspace + block.labelfontsize;
1835
+ if (tk.filterObj) {
1836
+ _.makeSampleFilterLabel(data, tk, block, laby);
1837
+ }
1838
+ if (tk.leftlabels.doms.filterObj) {
1839
+ laby += labyspace + block.labelfontsize;
1840
+ }
1841
+ }
1842
+ if (tk.showCloseLeftlabel) {
1843
+ if (!tk.leftlabels.doms.close) {
1844
+ tk.leftlabels.doms.close = makelabel(tk, block, laby).text("Close").on("click", () => {
1845
+ for (const [i, t] of block.tklst.entries()) {
1846
+ if (t.tkid == tk.tkid) {
1847
+ block.tk_remove(i);
1848
+ }
1849
+ }
1850
+ tk.onClose?.();
1851
+ });
1852
+ }
1853
+ laby += labyspace + block.labelfontsize;
1854
+ }
1855
+ tk.leftlabels.laby = laby;
1856
+ positionLeftlabelg(tk, block);
1857
+ setLeftlabelsMaxWidth(tk);
1858
+ tk.subtk2height.leftlabels = laby + 20;
1859
+ }
1860
+ function setLeftlabelsMaxWidth(tk) {
1861
+ tk.leftlabels.maxwidth = tk.tklabel.node().getBBox().width;
1862
+ for (const k in tk.leftlabels.doms) {
1863
+ tk.leftlabels.maxwidth = Math.max(tk.leftlabels.maxwidth, tk.leftlabels.doms[k].node().getBBox().width);
1864
+ }
1865
+ }
1866
+ function positionLeftlabelg(tk, block) {
1867
+ if (tk.leftlabels.laby == 0) {
1868
+ return;
1869
+ }
1870
+ tk.leftlabels.xoff = 0;
1871
+ if (tk.skewer) {
1872
+ const nm = tk.skewer.viewModes.find((i) => i.inuse);
1873
+ if (nm.type == "numeric") {
1874
+ const lly = tk.leftlabels.laby + labyspace + block.labelfontsize;
1875
+ if (lly > nm.toplabelheight + 5) {
1876
+ tk.leftlabels.xoff = nm.axisWidth;
1877
+ }
1878
+ }
1879
+ }
1880
+ tk.leftlabels.g.transition().attr("transform", `translate(-${tk.leftlabels.xoff},${labyspace + block.labelfontsize})`);
1881
+ }
1882
+ function makelabel(tk, block, y) {
1883
+ const text = tk.leftlabels.g.append("text").attr("font-size", block.labelfontsize).attr("y", block.labelfontsize / 2 + y).attr("text-anchor", "end").attr("dominant-baseline", "central").attr("class", "sja_clbtext2").attr("fill", "black").attr("x", block.tkleftlabel_xshift).attr("tabindex", 0).on("keydown", function(event2) {
1884
+ if (event2.target != textElem) return;
1885
+ if (event2.key == "Enter") textElem.dispatchEvent(new Event("click"));
1886
+ });
1887
+ const textElem = text.node();
1888
+ return text;
1889
+ }
1890
+
1891
+ // mds3/numericmode.js
1892
+ var disclabelspacing2 = 1;
1893
+ var middlealignshift2 = 0.3;
1894
+ var labyspace2 = 5;
1895
+ var clustercrowdlimit = 7;
1896
+ var maxclusterwidth = 100;
1897
+ var stemColor = "#ededed";
1898
+ var defaultLabel = "Numeric value";
1899
+ function renderNumericMode(nm, data, tk, block) {
1900
+ const datagroup = make_datagroup(tk, data.skewer || tk.skewer.rawmlst, block).filter(
1901
+ (g) => g.x >= 0 && g.x <= block.width
1902
+ );
1903
+ nm.data = datagroup;
1904
+ if (!nm.axisg) nm.axisg = tk.gleft.append("g");
1905
+ if (!nm.axisheight) nm.axisheight = 150;
1906
+ clearTk(tk);
1907
+ numeric_make(nm, tk, block);
1908
+ mayHighlightByLDoverlay(tk);
1909
+ return nm.toplabelheight + nm.maxradius + nm.axisheight + nm.maxradius + nm.stem1 + nm.stem2 + nm.stem3 + nm.bottomlabelheight;
1910
+ }
1911
+ function clearTk(tk) {
1912
+ tk.skewer.g.selectAll("*").remove();
1913
+ if (tk.skewer.nmg) tk.skewer.nmg.selectAll("*").remove();
1914
+ }
1915
+ function numeric_make(nm, tk, block) {
1916
+ if (!nm.axisSetting) {
1917
+ nm.axisSetting = { auto: 1 };
1918
+ }
1919
+ const data = nm.data;
1920
+ for (const d of data) {
1921
+ d.x0 = d.x;
1922
+ if (d.xoffset != void 0) {
1923
+ d.x = d.x0 + d.xoffset;
1924
+ }
1925
+ }
1926
+ const dotwidth = Math.max(14, block.width / 110);
1927
+ nm.dotwidth = dotwidth;
1928
+ nm.maxradius = 0;
1929
+ for (const d of data) {
1930
+ for (const m of d.mlst) {
1931
+ m.radius = dotwidth / 2;
1932
+ nm.maxradius = Math.max(m.radius, nm.maxradius);
1933
+ m.rimwidth = 0;
1934
+ m.aa = d;
1935
+ }
1936
+ }
1937
+ const showstem = adjustview(data, nm, tk, block);
1938
+ setup_axis_scale(data, nm, tk);
1939
+ const numscale = linear().domain([nm.minvalue, nm.maxvalue]).range([0, nm.axisheight]);
1940
+ for (const d of data) {
1941
+ for (const m of d.mlst) {
1942
+ if (m.__value_missing) {
1943
+ m._y = 0;
1944
+ } else {
1945
+ if (m.__value_use < nm.minvalue) {
1946
+ m._y = 0;
1947
+ } else if (m.__value_use > nm.maxvalue) {
1948
+ m._y = nm.axisheight;
1949
+ } else {
1950
+ m._y = numscale(m.__value_use);
1951
+ }
1952
+ }
1953
+ }
1954
+ }
1955
+ if (showstem) {
1956
+ nm.stem1 = 5;
1957
+ nm.stem2 = 20;
1958
+ nm.stem3 = 10;
1959
+ } else {
1960
+ nm.stem1 = 0;
1961
+ nm.stem2 = 0;
1962
+ nm.stem3 = 0;
1963
+ }
1964
+ for (const d of data) {
1965
+ for (const m of d.mlst) {
1966
+ tk.glider.append("text").text(tk.mnamegetter(m)).attr("font-size", m.radius * 2 - 2).each(function() {
1967
+ m.labwidth = this.getBBox().width;
1968
+ }).remove();
1969
+ }
1970
+ }
1971
+ for (const d of data) {
1972
+ for (const m of d.mlst) {
1973
+ delete m.labattop;
1974
+ delete m.labatbottom;
1975
+ }
1976
+ }
1977
+ if (!tk.skewer.hideDotLabels) {
1978
+ if (showstem) {
1979
+ for (const d of data) {
1980
+ if (d.mlst.length == 1) {
1981
+ const m = d.mlst[0];
1982
+ m.labattop = true;
1983
+ } else {
1984
+ if ((d.width - d.fixedgew) / (d.mlst.length - 1) < clustercrowdlimit) {
1985
+ } else {
1986
+ for (const m of d.mlst) {
1987
+ m.labattop = true;
1988
+ }
1989
+ }
1990
+ }
1991
+ }
1992
+ } else {
1993
+ verticallabplace(data);
1994
+ }
1995
+ }
1996
+ nm.toplabelheight = 0;
1997
+ nm.bottomlabelheight = 0;
1998
+ if (nm.showsamplebar || nm.showgenotypebyvalue) {
1999
+ for (const d of data) {
2000
+ for (const m of d.mlst) {
2001
+ nm.toplabelheight = Math.max(nm.toplabelheight, m.labwidth);
2002
+ }
2003
+ }
2004
+ } else {
2005
+ for (const d of data) {
2006
+ for (const m of d.mlst) {
2007
+ if (m.labattop) {
2008
+ nm.toplabelheight = Math.max(nm.toplabelheight, m._y + m.labwidth - nm.axisheight);
2009
+ } else if (m.labatbottom) {
2010
+ nm.bottomlabelheight = Math.max(nm.bottomlabelheight, m.labwidth - m._y);
2011
+ }
2012
+ if (m.shapeCircle) {
2013
+ m.shape = "emptyCircle";
2014
+ delete m.shapeCircle;
2015
+ } else if (m.shapeTriangle) {
2016
+ m.shape = "filledTriangle";
2017
+ delete m.shapeTriangle;
2018
+ } else if (!m.shape) m.shape = "filledCircle";
2019
+ }
2020
+ }
2021
+ }
2022
+ {
2023
+ let h = block.labelfontsize + labyspace2 + block.labelfontsize;
2024
+ if (tk.label_stratify) {
2025
+ h += tk.label_stratify.length * (labyspace2 + block.labelfontsize);
2026
+ }
2027
+ nm.toplabelheight = Math.max(nm.toplabelheight, h);
2028
+ }
2029
+ render_axis(tk, nm, block);
2030
+ tk.skewer.g.append("line").attr("y1", nm.toplabelheight + nm.maxradius).attr("y2", nm.toplabelheight + nm.maxradius).attr("x2", block.width).attr("stroke", stemColor).attr("shape-rendering", "crispEdges");
2031
+ tk.skewer.g.append("line").attr("y1", nm.toplabelheight + nm.maxradius + nm.axisheight).attr("y2", nm.toplabelheight + nm.maxradius + nm.axisheight).attr("x2", block.width).attr("stroke", stemColor).attr("shape-rendering", "crispEdges");
2032
+ tk.skewer.nmg = tk.skewer.g.selectAll().data(data).enter().append("g").attr("class", "sja_skg2").each(function(d) {
2033
+ d.g = this;
2034
+ });
2035
+ tk.skewer.nmg.attr(
2036
+ "transform",
2037
+ (d) => "translate(" + d.x + "," + (nm.toplabelheight + disclabelspacing2 + nm.maxradius + nm.axisheight + nm.maxradius) + ")"
2038
+ );
2039
+ if (showstem) {
2040
+ tk.skewer.nmg.append("path").attr("class", "sja_aa_stem").attr("d", (d) => setStem(d, nm)).attr("stroke", (d) => tk.color4disc(d.mlst[0])).attr("fill", (d) => d.mlst.length == 1 ? "none" : stemColor);
2041
+ }
2042
+ const discg = tk.skewer.nmg.selectAll().data((d) => d.mlst).enter().append("g").attr("class", "sja_aa_discg").each(function(m) {
2043
+ m.g = this;
2044
+ if (!m.shape.includes("Circle")) {
2045
+ renderSkewerShapes(tk, nm, select_default(this));
2046
+ } else {
2047
+ select_default(this).append("circle").attr("fill", (m2) => shapes[m2.shape].isFilled ? tk.color4disc(m2) : "none").attr("stroke", (m2) => shapes[m2.shape].isFilled ? "white" : tk.color4disc(m2)).attr("r", (m2) => m2.radius - 0.5).attr("class", "sja_aa_disk_fill");
2048
+ }
2049
+ });
2050
+ discg.attr("transform", (m) => {
2051
+ return "translate(" + m.xoff + "," + (m._y + nm.maxradius) * -1 + ")";
2052
+ });
2053
+ tk.skewer.hlBoxG = discg.append("g");
2054
+ const kick = renderShapeKick(nm, discg);
2055
+ kick.attr("stroke", (m) => tk.color4disc(m)).attr("fill", "white").attr("class", "sja_aa_disckick").attr("fill-opacity", 0).attr("stroke-opacity", 0).on("mousedown", (event2) => {
2056
+ event2.preventDefault();
2057
+ }).on("mouseover", (event2, m) => {
2058
+ m_mouseover(m, nm, tk);
2059
+ }).on("mouseout", (event2, m) => {
2060
+ m_mouseout(m, tk);
2061
+ }).on("click", (event2, m) => {
2062
+ click_variant({ mlst: [m] }, tk, block, event2.target.getBoundingClientRect(), event2.target);
2063
+ });
2064
+ const textlabels = discg.filter((m) => m.labattop || m.labatbottom).append("text").each(function(m) {
2065
+ m.__svg_textlabel = this;
2066
+ }).text((m) => tk.mnamegetter(m)).attr("font-size", (m) => {
2067
+ m._labfontsize = Math.max(12, m.radius * 1.2);
2068
+ return m._labfontsize;
2069
+ }).attr("fill", (m) => tk.color4disc(m)).attr(
2070
+ "x",
2071
+ (m) => nm.showsamplebar || nm.showgenotypebyvalue ? nm.axisheight + nm.maxradius + 4 : m.radius + m.rimwidth + disclabelspacing2
2072
+ ).attr("y", (m) => m._labfontsize * middlealignshift2).attr("class", "sja_aa_disclabel").attr("transform", (m) => "rotate(" + (m.labattop ? "-" : "") + "90)").on("mousedown", (event2) => {
2073
+ event2.preventDefault();
2074
+ }).on("mouseover", (event2, m) => m_mouseover(m, nm, tk)).on("mouseout", (event2, m) => m_mouseout(m, tk)).on("click", (event2, m) => {
2075
+ click_variant({ mlst: [m] }, tk, block, event2.target.getBoundingClientRect(), event2.target.previousSibling);
2076
+ });
2077
+ }
2078
+ function adjustview(data, nm, tk, block) {
2079
+ let sumwidth = 0;
2080
+ for (const d of data) {
2081
+ let w = 0;
2082
+ for (const m of d.mlst) {
2083
+ w += 2 * (m.radius + m.rimwidth);
2084
+ }
2085
+ if (d.mlst.length == 1) {
2086
+ d.width = w;
2087
+ } else {
2088
+ d.width = Math.min(maxclusterwidth, w);
2089
+ const m0 = d.mlst[0];
2090
+ const m1 = d.mlst[d.mlst.length - 1];
2091
+ d.fixedgew = m0.radius + m0.rimwidth + m1.radius + m1.rimwidth;
2092
+ }
2093
+ sumwidth += d.width;
2094
+ }
2095
+ if (sumwidth <= block.width) {
2096
+ let cum = 0;
2097
+ for (const d of data) {
2098
+ d.x = cum + d.mlst[0].radius + d.mlst[0].rimwidth;
2099
+ cum += d.width;
2100
+ if (d.mlst.length == 1) {
2101
+ d.stemw = 0;
2102
+ } else {
2103
+ d.stemw = d.width - d.fixedgew;
2104
+ }
2105
+ }
2106
+ horiplace1(data, block.width);
2107
+ for (const d of data) {
2108
+ d.xoffset = d.x - d.x0;
2109
+ if (d.mlst.length == 1) {
2110
+ d.mlst[0].xoff = 0;
2111
+ d.stemw = 0;
2112
+ } else {
2113
+ d.stemw = d.width - d.fixedgew;
2114
+ const span = d.stemw / (d.mlst.length - 1);
2115
+ for (let i = 0; i < d.mlst.length; i++) {
2116
+ d.mlst[i].xoff = span * i;
2117
+ }
2118
+ }
2119
+ }
2120
+ return true;
2121
+ }
2122
+ for (const d of data) {
2123
+ d.x = d.x0;
2124
+ d.xoffset = 0;
2125
+ for (const m of d.mlst) {
2126
+ m.xoff = 0;
2127
+ }
2128
+ }
2129
+ return false;
2130
+ }
2131
+ function horiplace1(items, allwidth) {
2132
+ for (let i = 0; i < items.length; i++) {
2133
+ if (items[i].x0 < 0) continue;
2134
+ if (items[i].x0 > allwidth) break;
2135
+ while (1) {
2136
+ let currsum = 0, newsum = 0;
2137
+ for (let j = i; j < items.length; j++) {
2138
+ const t = items[j];
2139
+ if (t.x0 > allwidth) {
2140
+ return;
2141
+ }
2142
+ currsum += Math.abs(t.x - t.x0 - t.stemw / 2);
2143
+ t.x++;
2144
+ newsum += Math.abs(t.x - t.x0 - t.stemw / 2);
2145
+ }
2146
+ if (items[i].x > items[i].x0 - items[i].stemw / 2) {
2147
+ for (let j = i; j < items.length; j++) {
2148
+ items[j].x--;
2149
+ }
2150
+ break;
2151
+ }
2152
+ const z = items[items.length - 1];
2153
+ if (z.x + z.width / 2 >= allwidth) {
2154
+ return;
2155
+ }
2156
+ if (newsum <= currsum) {
2157
+ } else {
2158
+ for (let j = i; j < items.length; j++) {
2159
+ if (items[j].x0 > allwidth) {
2160
+ break;
2161
+ }
2162
+ items[j].x--;
2163
+ }
2164
+ break;
2165
+ }
2166
+ }
2167
+ }
2168
+ }
2169
+ function verticallabplace(data) {
2170
+ const mlst = [];
2171
+ for (const d of data) {
2172
+ for (const m of d.mlst) {
2173
+ mlst.push({
2174
+ m,
2175
+ w: 2 * (m.radius + m.rimwidth),
2176
+ x: d.x0,
2177
+ y: m._y
2178
+ });
2179
+ }
2180
+ }
2181
+ mlst.sort((i, j) => j.y - i.y);
2182
+ for (let i = 0; i < mlst.length; i++) {
2183
+ const big = mlst[i];
2184
+ let overlapwithdisc = false;
2185
+ for (let j = 0; j < i; j++) {
2186
+ const small = mlst[j];
2187
+ if (Math.abs(big.x - small.x) < (big.w + small.w) / 2 - 2) {
2188
+ overlapwithdisc = true;
2189
+ break;
2190
+ }
2191
+ }
2192
+ if (!overlapwithdisc) {
2193
+ big.m.labattop = true;
2194
+ }
2195
+ }
2196
+ for (let i = mlst.length - 1; i >= 0; i--) {
2197
+ const big = mlst[i];
2198
+ if (big.m.labattop) continue;
2199
+ let overlapwithlabeleddisc = false;
2200
+ for (let j = mlst.length - 1; j > i; j--) {
2201
+ const small = mlst[j];
2202
+ if (small.m.labatbottom && Math.abs(small.x - big.x) < (small.w + big.w) / 2 - 2) {
2203
+ overlapwithlabeleddisc = true;
2204
+ break;
2205
+ }
2206
+ }
2207
+ if (!overlapwithlabeleddisc) {
2208
+ big.m.labatbottom = true;
2209
+ }
2210
+ }
2211
+ }
2212
+ function setStem(d, nm) {
2213
+ if (d.mlst.length == 1) {
2214
+ return "M0,0v" + nm.stem1 + "l" + -d.xoffset + "," + nm.stem2 + "v" + nm.stem3;
2215
+ }
2216
+ return "M0,0v" + nm.stem1 + // vertical down
2217
+ "l" + -d.xoffset + "," + nm.stem2 + // slope 1
2218
+ "v" + nm.stem3 + // vertical down
2219
+ //+'h1' // to right 1
2220
+ "v-" + nm.stem3 + // veritical up
2221
+ "l" + (d.stemw + d.xoffset - 1) + ",-" + nm.stem2 + // slope 2
2222
+ "v-" + nm.stem1;
2223
+ }
2224
+ function m_mouseover(m, nm, tk) {
2225
+ if (m.__svg_textlabel) {
2226
+ select_default(m.__svg_textlabel).attr("font-size", m._labfontsize * 1.1);
2227
+ }
2228
+ tk.pica.g.attr(
2229
+ "transform",
2230
+ "translate(" + (m.aa.x + m.xoff) + "," + (nm.toplabelheight + nm.maxradius + nm.axisheight - m._y) + ")"
2231
+ );
2232
+ const linelen = 10;
2233
+ const boxpad = 4;
2234
+ const fontsize = m._labfontsize || 13;
2235
+ const color = tk.color4disc(m);
2236
+ const words = [];
2237
+ if (nm.tooltipPrintValue) {
2238
+ const out = nm.tooltipPrintValue(m);
2239
+ if (Array.isArray(out)) {
2240
+ words.push(...out.map((i) => `${i.k} = ${i.v}`));
2241
+ }
2242
+ } else {
2243
+ words.push(nm.label + " = " + (m.__value_missing ? "NA" : m.__value_use));
2244
+ }
2245
+ if (tk.mds.queries?.ld?.mOverlay?.data) {
2246
+ if (m.ssm_id == tk.mds.queries.ld.mOverlay.m.ssm_id) {
2247
+ } else {
2248
+ let r2 = "?";
2249
+ for (const v of tk.mds.queries.ld.mOverlay.data) {
2250
+ if (v.pos == m.pos && v.alleles == m.ref + "." + m.alt) {
2251
+ r2 = v.r2;
2252
+ break;
2253
+ }
2254
+ }
2255
+ words.push("r2 = " + r2);
2256
+ }
2257
+ }
2258
+ if (!m.labattop && !m.labatbottom) {
2259
+ words.push(tk.mnamegetter(m));
2260
+ }
2261
+ let textw = 0;
2262
+ for (const w of words) {
2263
+ tk.pica.g.append("text").attr("font-size", fontsize).text(w).each(function() {
2264
+ textw = Math.max(textw, this.getBBox().width);
2265
+ }).remove();
2266
+ }
2267
+ const boxw = boxpad * 2 + textw;
2268
+ let boxx, linex1, onleft = true;
2269
+ if (boxw + linelen > m.aa.x + m.xoff) {
2270
+ onleft = false;
2271
+ linex1 = m.radius + m.rimwidth;
2272
+ boxx = linex1 + linelen;
2273
+ } else {
2274
+ linex1 = -m.radius - m.rimwidth - linelen;
2275
+ boxx = linex1 - boxw;
2276
+ }
2277
+ const boxh = fontsize * words.length;
2278
+ tk.pica.g.append("rect").attr("x", boxx - 2).attr("y", -2 - boxpad - boxh / 2).attr("width", 4 + boxw).attr("height", 4 + boxpad * 2 + boxh).attr("fill", "white");
2279
+ tk.pica.g.append("line").attr("x1", linex1).attr("x2", linex1 + linelen).attr("stroke", "white").attr("stroke-width", 3).attr("shape-rendering", "crispEdges");
2280
+ tk.pica.g.append("line").attr("x1", linex1).attr("x2", linex1 + linelen).attr("stroke", color).attr("shape-rendering", "crispEdges");
2281
+ tk.pica.g.append("rect").attr("x", boxx).attr("y", -boxpad - boxh / 2).attr("width", boxw).attr("height", boxpad * 2 + boxh).attr("fill", "none").attr("stroke", color).attr("shape-rendering", "crispEdges");
2282
+ let y = (fontsize - boxh) / 2;
2283
+ for (const w of words) {
2284
+ tk.pica.g.append("text").text(w).attr("text-anchor", onleft ? "end" : "start").attr("font-size", fontsize).attr("x", onleft ? linex1 - boxpad : boxx + boxpad).attr("y", y).attr("fill", color).attr("dominant-baseline", "central");
2285
+ y += fontsize;
2286
+ }
2287
+ }
2288
+ function m_mouseout(m, tk) {
2289
+ if (m.__svg_textlabel) {
2290
+ select_default(m.__svg_textlabel).attr("font-size", m._labfontsize);
2291
+ }
2292
+ tk.pica.g.selectAll("*").remove();
2293
+ }
2294
+ function setup_axis_scale(data, nm, tk) {
2295
+ for (const g of data) {
2296
+ for (const m of g.mlst) {
2297
+ delete m.__value_use;
2298
+ delete m.__value_missing;
2299
+ }
2300
+ }
2301
+ if (nm.byAttribute) {
2302
+ for (const g of data) {
2303
+ for (const m of g.mlst) {
2304
+ const v = m[nm.byAttribute];
2305
+ if (Number.isFinite(v)) {
2306
+ m.__value_use = v;
2307
+ } else {
2308
+ m.__value_missing = true;
2309
+ }
2310
+ }
2311
+ }
2312
+ } else if (nm.byInfo) {
2313
+ for (const g of data) {
2314
+ for (const m of g.mlst) {
2315
+ const v = m?.info?.[nm.byInfo];
2316
+ if (Number.isFinite(v)) {
2317
+ m.__value_use = v;
2318
+ } else {
2319
+ m.__value_missing = true;
2320
+ }
2321
+ }
2322
+ }
2323
+ } else {
2324
+ throw "unknown method of getting value";
2325
+ }
2326
+ if (nm.axisSetting.auto) {
2327
+ nm.minvalue = null;
2328
+ nm.maxvalue = null;
2329
+ for (const g of data) {
2330
+ for (const m of g.mlst) {
2331
+ if ("__value_use" in m) {
2332
+ if (nm.minvalue == null) {
2333
+ nm.minvalue = m.__value_use;
2334
+ nm.maxvalue = m.__value_use;
2335
+ } else {
2336
+ nm.minvalue = Math.min(nm.minvalue, m.__value_use);
2337
+ nm.maxvalue = Math.max(nm.maxvalue, m.__value_use);
2338
+ }
2339
+ }
2340
+ }
2341
+ }
2342
+ } else if (nm.axisSetting.fixed) {
2343
+ nm.minvalue = nm.axisSetting.fixed.min;
2344
+ nm.maxvalue = nm.axisSetting.fixed.max;
2345
+ } else {
2346
+ throw "unknown axisSetting";
2347
+ }
2348
+ }
2349
+ function render_axis(tk, nm, block) {
2350
+ nm.axisg.attr("transform", "translate(0," + (nm.toplabelheight + nm.maxradius) + ")").selectAll("*").remove();
2351
+ const thisscale = linear().domain([nm.minvalue, nm.maxvalue]).range([nm.axisheight, 0]);
2352
+ const thisaxis = axisLeft().scale(thisscale).ticks(4);
2353
+ if (nm.isinteger) {
2354
+ thisaxis.tickFormat(format("d"));
2355
+ if (nm.maxvalue - nm.minvalue < 3) {
2356
+ thisaxis.ticks(nm.maxvalue - nm.minvalue);
2357
+ }
2358
+ }
2359
+ axisstyle({
2360
+ axis: nm.axisg.call(thisaxis),
2361
+ showline: true,
2362
+ fontsize: nm.dotwidth
2363
+ });
2364
+ nm.axisWidth = 0;
2365
+ nm.axisg.selectAll("text").each(function() {
2366
+ nm.axisWidth = Math.max(nm.axisWidth, this.getBBox().width);
2367
+ });
2368
+ nm.axisWidth += 15;
2369
+ let w;
2370
+ nm.axisg.append("text").attr("fill", "black").attr("font-size", nm.dotwidth).attr("dominant-baseline", "central").attr("text-anchor", "end").attr("class", "sjpp-mds3-nm-axislabel sja_clbtext2").attr("data-testid", "sjpp-mds3-nm-axislabel").attr("y", nm.axisheight / 2).attr("x", -nm.axisWidth).text(nm.label || defaultLabel).each(function() {
2371
+ w = this.getBBox().width;
2372
+ }).on("click", (event2) => {
2373
+ tk.menutip.clear().showunder(event2.target).d.append("div").text("Cancel").attr("class", "sja_menuoption").attr("data-testid", "sjpp-cancel-numeric-axis-option").style("border-radius", "0px").on("click", () => {
2374
+ tk.menutip.hide();
2375
+ nm.inuse = false;
2376
+ tk.skewer.viewModes.find((i) => i.type == "skewer").inuse = true;
2377
+ may_render_skewer({ skewer: tk.skewer.rawmlst }, tk, block);
2378
+ positionLeftlabelg(tk, block);
2379
+ tk._finish();
2380
+ });
2381
+ makeNumericAxisConfig({
2382
+ holder: tk.menutip.d.append("div").style("margin", "10px"),
2383
+ noPercentile: true,
2384
+ callback: (s) => {
2385
+ nm.axisSetting = s;
2386
+ clearTk(tk);
2387
+ numeric_make(nm, tk, block);
2388
+ },
2389
+ setting: nm.axisSetting
2390
+ });
2391
+ });
2392
+ tk.skewer.maxwidth = nm.axisWidth + w;
2393
+ }
2394
+ function mayHighlightByLDoverlay(tk) {
2395
+ const m = tk.mds.queries?.ld?.mOverlay?.m;
2396
+ if (!m) return;
2397
+ tk.skewer.hlssmid = /* @__PURE__ */ new Set([m.ssm_id]);
2398
+ mayHighlightDiskBySsmid(tk);
2399
+ }
2400
+
2401
+ // mds3/skewer.js
2402
+ var minMnameCount2compact = 10;
2403
+ function may_render_skewer(data, tk, block) {
2404
+ if (!tk.skewer) {
2405
+ return;
2406
+ }
2407
+ tk.skewer.maxwidth = 0;
2408
+ updateViewModes(tk, data.skewer);
2409
+ hlaachange2ssmid(tk, data.skewer);
2410
+ const currentMode = tk.skewer.viewModes.find((n) => n.inuse);
2411
+ if (!currentMode) throw "no mode!!";
2412
+ if (data.skewer) {
2413
+ tk.skewer.rawmlst = data.skewer;
2414
+ data.skewer.forEach((d) => {
2415
+ if (!d.id) d.id = Math.random().toString();
2416
+ });
2417
+ } else {
2418
+ tk.skewer.rawmlst.forEach((d) => {
2419
+ if (!d.id) d.id = Math.random().toString();
2420
+ });
2421
+ }
2422
+ if (currentMode.type == "numeric") {
2423
+ tk.subtk2height.skewer = renderNumericMode(currentMode, data, tk, block);
2424
+ mayHighlightDiskBySsmid(tk);
2425
+ return;
2426
+ }
2427
+ if (currentMode.type != "skewer") throw 'mode.type is not "skewer"';
2428
+ if (data && !data.skewer && block.usegm && block.gmmode != "genomic" && block.pannedpx != void 0) {
2429
+ tkdata_update_x(tk, block);
2430
+ tk.skewer.selection.attr("transform", (d) => "translate(" + d.x + "," + d.y + ")");
2431
+ settle_glyph(tk, block);
2432
+ } else {
2433
+ tk.skewer.g.selectAll("*").remove();
2434
+ tk.skewer.data = make_skewer_data(tk, block);
2435
+ skewer_make(tk, block);
2436
+ }
2437
+ if (!tk.skewer.data || tk.skewer.data.length == 0) {
2438
+ tk.subtk2height.skewer = 0;
2439
+ tk.skewer.g.selectAll("*").remove();
2440
+ return;
2441
+ }
2442
+ if (tk.skewer.hlssmid) {
2443
+ const fold = [];
2444
+ const unfold = [];
2445
+ for (const d of tk.skewer.data) {
2446
+ let has = false;
2447
+ for (const g of d.groups) {
2448
+ for (const m of g.mlst) {
2449
+ if (tk.skewer.hlssmid.has(m.ssm_id)) {
2450
+ has = true;
2451
+ break;
2452
+ }
2453
+ }
2454
+ }
2455
+ if (has) {
2456
+ unfold.push(d);
2457
+ } else {
2458
+ fold.push(d);
2459
+ }
2460
+ }
2461
+ fold_glyph(fold, tk);
2462
+ unfold_glyph(unfold, tk, block);
2463
+ mayHighlightDiskBySsmid(tk);
2464
+ } else {
2465
+ settle_glyph(tk, block);
2466
+ }
2467
+ tk.subtk2height.skewer = tk.skewer.maxheight + tk.skewer.stem1 + tk.skewer.stem2 + tk.skewer.stem3;
2468
+ }
2469
+ function hlaachange2ssmid(tk, mlst) {
2470
+ if (!tk.hlaachange || !mlst) return;
2471
+ const set = new Set(tk.hlaachange.split(","));
2472
+ delete tk.hlaachange;
2473
+ tk.skewer.hlssmid = /* @__PURE__ */ new Set();
2474
+ for (const m of mlst) {
2475
+ if (set.has(m.mname)) tk.skewer.hlssmid.add(m.ssm_id);
2476
+ }
2477
+ }
2478
+ function tkdata_update_x(tk, block) {
2479
+ for (const d of tk.skewer.data) {
2480
+ if (d.isbin) {
2481
+ let sumx = 0;
2482
+ for (const m of d.mlst) {
2483
+ const hits = block.seekcoord(m.chr, m.pos);
2484
+ if (m.usehitidx != void 0 && hits[m.usehitidx]) {
2485
+ sumx += hits[m.usehitidx].x;
2486
+ } else if (hits.length == 1) {
2487
+ sumx += hits[0].x;
2488
+ } else {
2489
+ console.log("cannot map item");
2490
+ console.log(m);
2491
+ }
2492
+ }
2493
+ d.x0 = sumx / d.mlst.length;
2494
+ d.x = d.x0 + (d.xoffset != void 0 ? d.xoffset : 0);
2495
+ } else {
2496
+ const hits = block.seekcoord(d.chr, d.pos);
2497
+ if (hits.length > 0) {
2498
+ d.x0 = hits[0].x;
2499
+ d.x = d.x0 + (d.xoffset != void 0 ? d.xoffset : 0);
2500
+ } else {
2501
+ console.log("cannot map group of item");
2502
+ console.log(d);
2503
+ }
2504
+ }
2505
+ }
2506
+ }
2507
+ function make_skewer_data(tk, block) {
2508
+ const datagroup = make_datagroup(tk, tk.skewer.rawmlst, block);
2509
+ for (const g of datagroup) {
2510
+ g.groups = mlst2disc(g.mlst, tk);
2511
+ }
2512
+ if (tk.skewer.data && block.pannedpx != void 0) {
2513
+ const pastmode = {};
2514
+ for (const g of tk.skewer.data) {
2515
+ pastmode[g.chr + "." + g.pos] = {
2516
+ mode: g.showmode,
2517
+ xoffset: g.xoffset,
2518
+ slabelrotate: g.slabelrotate
2519
+ // no effect
2520
+ };
2521
+ }
2522
+ for (const g of datagroup) {
2523
+ const k = g.chr + "." + g.pos;
2524
+ if (pastmode[k]) {
2525
+ g.showmode = pastmode[k].mode;
2526
+ g.xoffset = pastmode[k].xoffset;
2527
+ g.slabelrotate = pastmode[k].slabelrotate;
2528
+ }
2529
+ }
2530
+ }
2531
+ for (const d of datagroup) {
2532
+ d.occurrence = d.groups.reduce((i, j) => i + j.occurrence, 0);
2533
+ }
2534
+ return datagroup;
2535
+ }
2536
+ function mlst2disc(mlst, tk) {
2537
+ const k2g = /* @__PURE__ */ new Map();
2538
+ for (const m of mlst) {
2539
+ if (!Number.isInteger(m.dt)) continue;
2540
+ if (!k2g.has(m.dt)) k2g.set(m.dt, /* @__PURE__ */ new Map());
2541
+ switch (m.dt) {
2542
+ case dtsnvindel:
2543
+ if (!k2g.get(m.dt).has(m.class)) k2g.get(m.dt).set(m.class, /* @__PURE__ */ new Map());
2544
+ const n = m.mname || "";
2545
+ if (!k2g.get(m.dt).get(m.class).has(n)) {
2546
+ k2g.get(m.dt).get(m.class).set(n, []);
2547
+ }
2548
+ k2g.get(m.dt).get(m.class).get(n).push(m);
2549
+ break;
2550
+ case dtsv:
2551
+ case dtfusionrna:
2552
+ if (!k2g.get(m.dt).has(m.class)) {
2553
+ k2g.get(m.dt).set(m.class, {
2554
+ use5: /* @__PURE__ */ new Map(),
2555
+ use3: /* @__PURE__ */ new Map()
2556
+ });
2557
+ }
2558
+ if (m.useNterm) {
2559
+ if (!k2g.get(m.dt).get(m.class).use5.has(m.mname)) {
2560
+ k2g.get(m.dt).get(m.class).use5.set(m.mname, []);
2561
+ }
2562
+ k2g.get(m.dt).get(m.class).use5.get(m.mname).push(m);
2563
+ } else {
2564
+ if (!k2g.get(m.dt).get(m.class).use3.has(m.mname)) {
2565
+ k2g.get(m.dt).get(m.class).use3.set(m.mname, []);
2566
+ }
2567
+ k2g.get(m.dt).get(m.class).use3.get(m.mname).push(m);
2568
+ }
2569
+ break;
2570
+ case dtitd:
2571
+ case dtdel:
2572
+ case dtnloss:
2573
+ case dtcloss:
2574
+ if (!k2g.has(m.dt)) {
2575
+ k2g.set(m.dt, []);
2576
+ }
2577
+ k2g.get(m.dt).push(m);
2578
+ break;
2579
+ default:
2580
+ console.log("unknown datatype: " + m.dt);
2581
+ console.log(m);
2582
+ return;
2583
+ }
2584
+ }
2585
+ const groups = [];
2586
+ for (const [dt, tmp] of k2g) {
2587
+ switch (dt) {
2588
+ case dtsnvindel:
2589
+ for (const [thisClass, mname2lst] of tmp) {
2590
+ if (mname2lst.size > minMnameCount2compact) {
2591
+ const mlst2 = [];
2592
+ for (const l2 of mname2lst.values()) mlst2.push(...l2);
2593
+ groups.push({
2594
+ dt,
2595
+ mlst: mlst2,
2596
+ mnameCompact: mclass[thisClass].label
2597
+ });
2598
+ } else {
2599
+ for (const mlst2 of mname2lst.values()) {
2600
+ groups.push({ dt, mlst: mlst2 });
2601
+ }
2602
+ }
2603
+ }
2604
+ break;
2605
+ case dtsv:
2606
+ case dtfusionrna:
2607
+ for (const classset of tmp.values()) {
2608
+ if (classset.use5.size > minMnameCount2compact) {
2609
+ const mlst2 = [];
2610
+ for (const l2 of classset.use5.values()) mlst2.push(...l2);
2611
+ groups.push({ dt, mlst: mlst2, useNterm: true, mnameCompact: dt == dtsv ? "SV" : "fusion" });
2612
+ } else {
2613
+ for (const mlst2 of classset.use5.values()) {
2614
+ groups.push({ dt, mlst: mlst2, useNterm: true });
2615
+ }
2616
+ }
2617
+ if (classset.use3.size > minMnameCount2compact) {
2618
+ const mlst2 = [];
2619
+ for (const l2 of classset.use3.values()) mlst2.push(...l2);
2620
+ groups.push({ dt, mlst: mlst2, useNterm: false, mnameCompact: dt == dtsv ? "SV" : "fusion" });
2621
+ } else {
2622
+ for (const mlst2 of classset.use3.values()) {
2623
+ groups.push({ dt, mlst: mlst2, useNterm: false });
2624
+ }
2625
+ }
2626
+ }
2627
+ break;
2628
+ case dtitd:
2629
+ case dtdel:
2630
+ case dtnloss:
2631
+ case dtcloss:
2632
+ groups.push({
2633
+ dt,
2634
+ mlst: tmp
2635
+ });
2636
+ }
2637
+ }
2638
+ for (const g of groups) {
2639
+ let rim1count = 0, rim2count = 0;
2640
+ for (const m of g.mlst) {
2641
+ rim1count += m.rim1count || 0;
2642
+ rim2count += m.rim2count || 0;
2643
+ }
2644
+ g.rim1count = rim1count;
2645
+ g.rim2count = rim2count;
2646
+ }
2647
+ if (mlst.some((m) => Number.isFinite(m.occurrence))) {
2648
+ for (const g of groups) g.occurrence = g.mlst.reduce((i, j) => i + j.occurrence, 0);
2649
+ } else {
2650
+ for (const g of groups) g.occurrence = g.mlst.length;
2651
+ }
2652
+ groups.sort((a, b) => {
2653
+ return b.occurrence - a.occurrence;
2654
+ });
2655
+ return groups;
2656
+ }
2657
+ function updateViewModes(tk, mlst) {
2658
+ detectNumericMode(tk, mlst);
2659
+ detectAlternativeSkewerModes(tk, mlst);
2660
+ for (const n of tk.skewer.viewModes) {
2661
+ if (n.type == "numeric" && !n.inuse && n.axisg) {
2662
+ n.axisg.remove();
2663
+ delete n.axisg;
2664
+ }
2665
+ }
2666
+ }
2667
+ function detectAlternativeSkewerModes(tk) {
2668
+ }
2669
+ function detectNumericMode(tk, mlst) {
2670
+ if (mlst && mlst.find((i) => Number.isFinite(i.occurrence))) {
2671
+ if (!tk.skewer.viewModes.find((n) => n.type == "numeric" && n.byAttribute == "occurrence")) {
2672
+ tk.skewer.viewModes.push({
2673
+ type: "numeric",
2674
+ byAttribute: "occurrence",
2675
+ label: "Occurrence",
2676
+ isinteger: true
2677
+ });
2678
+ }
2679
+ }
2680
+ }
2681
+
2682
+ // mds3/leftlabel.variant.js
2683
+ function makeVariantLabel(data, tk, block, laby) {
2684
+ if (!tk.skewer && !tk.cnv) return;
2685
+ if (!tk.leftlabels.doms.variants) {
2686
+ tk.leftlabels.doms.variants = makelabel(tk, block, laby);
2687
+ tk.leftlabels.doms.variants.attr("data-testid", "sja_variants_label");
2688
+ if (data.variantAlerts?.length) tk.leftlabels.doms.variants.attr("fill", "red");
2689
+ }
2690
+ const [labeltext, totalcount, showcount] = getVariantLabelText(data, tk, block);
2691
+ if (totalcount == 0) {
2692
+ tk.leftlabels.doms.variants.text(labeltext).attr("class", "").style("opacity", 0.7).on("click", null);
2693
+ return;
2694
+ }
2695
+ if (showcount == 0) {
2696
+ tk.leftlabels.doms.variants.text(labeltext).attr("class", "").style("opacity", 0.5).on("click", null);
2697
+ return;
2698
+ }
2699
+ tk.leftlabels.doms.variants.style("opacity", 1).attr("class", "sja_clbtext2").text(labeltext).on("click", (event2) => {
2700
+ tk.menutip.clear().showunder(event2.target);
2701
+ menu_variants(data, tk, block);
2702
+ });
2703
+ }
2704
+ function getVariantLabelText(data, tk, block) {
2705
+ let totalcount = 0, showcount = 0;
2706
+ const dtset = /* @__PURE__ */ new Set();
2707
+ if (tk.custom_variants) {
2708
+ totalcount = tk.custom_variants.length;
2709
+ for (const m of tk.custom_variants) dtset.add(m.dt);
2710
+ } else {
2711
+ if (tk.skewer?.rawmlst) {
2712
+ totalcount += tk.skewer.rawmlst.length;
2713
+ for (const m of tk.skewer.rawmlst) dtset.add(m.dt);
2714
+ }
2715
+ if (data.cnv) {
2716
+ totalcount += data.cnv.cnvs.length;
2717
+ for (const m of data.cnv.cnvs) dtset.add(m.dt);
2718
+ } else if (data.cnvDensity) {
2719
+ totalcount += data.cnvDensity.segmentCount;
2720
+ dtset.add(dtcnv);
2721
+ }
2722
+ }
2723
+ if (totalcount == 0) return ["No data", 0, 0];
2724
+ if (tk.skewer) {
2725
+ const currentMode = tk.skewer.viewModes.find((i) => i.inuse);
2726
+ if (currentMode.type == "skewer") {
2727
+ showcount = tk.skewer.data.filter((i) => i.x >= 0 && i.x <= block.width).reduce((i, j) => i + j.mlst.length, 0);
2728
+ } else if (currentMode.type == "numeric") {
2729
+ showcount = currentMode.data.filter((i) => i.x >= 0 && i.x <= block.width).reduce((i, j) => i + j.mlst.length, 0);
2730
+ } else {
2731
+ throw "unknown mode type";
2732
+ }
2733
+ }
2734
+ if (data.cnv) {
2735
+ showcount += data.cnv.cnvs.length;
2736
+ } else if (data.cnvDensity) {
2737
+ showcount += data.cnvDensity.segmentCount;
2738
+ }
2739
+ let vn = "variant";
2740
+ if (dtset.size == 1) {
2741
+ const dt = [...dtset][0];
2742
+ if (dt == dtsnvindel) {
2743
+ } else {
2744
+ vn = dt2label[dt];
2745
+ }
2746
+ }
2747
+ if (showcount == 0) {
2748
+ return [`0 out of ${totalcount} ${vn}${totalcount > 1 ? "s" : ""}`, totalcount, showcount];
2749
+ }
2750
+ return [
2751
+ showcount < totalcount ? showcount + " of " + totalcount + " " + vn + "s" : showcount + " " + vn + (showcount > 1 ? "s" : ""),
2752
+ totalcount,
2753
+ showcount
2754
+ ];
2755
+ }
2756
+ function menu_variants(data, tk, block) {
2757
+ if (data.variantAlerts?.length) {
2758
+ for (const m of data.variantAlerts) {
2759
+ tk.menutip.d.append("div").style("margin", "10px").attr("data-testid", "sjpp-mds3tk-variantalerts").style("font-size", ".8em").style("color", "red").text(m);
2760
+ }
2761
+ }
2762
+ if ((!tk.skewer?.rawmlst || tk.skewer.rawmlst?.length == 0) && tk.cnv?.cnvInDensity) {
2763
+ tk.menutip.d.append("div").attr("data-testid", "sjpp-mds3tk-variantleftlabel-cnvdensitymsg").style("margin", "10px").text("Viewing CNV segment density, no information on individual segments.");
2764
+ if (tk.cnv.cnvMsg) {
2765
+ tk.menutip.d.append("div").style("margin", "10px").text(tk.cnv.cnvMsg);
2766
+ }
2767
+ return;
2768
+ }
2769
+ const listDiv = tk.menutip.d.append("div").text("List").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sjpp_mds3tk_variantleftlabel_list").attr("tabindex", 0).on("click", () => {
2770
+ listVariantData(tk, block);
2771
+ });
2772
+ listDiv.node().focus();
2773
+ setTimeout(() => listDiv.node().blur(), 2e3);
2774
+ if (tk.skewer && !tk.hardcodeCnvOnly) {
2775
+ if (tk.skewer.hlssmid) {
2776
+ tk.menutip.d.append("div").text("Cancel highlight").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sjpp-cancel-highlight-option").attr("tabindex", 0).on("click", () => {
2777
+ delete tk.skewer.hlssmid;
2778
+ tk.skewer.hlBoxG.selectAll("*").remove();
2779
+ const currentMode = tk.skewer.viewModes.find((i) => i.inuse);
2780
+ if (currentMode.type == "skewer") {
2781
+ settle_glyph(tk, block);
2782
+ } else if (currentMode.type == "numeric") {
2783
+ } else {
2784
+ throw "unknown mode type";
2785
+ }
2786
+ tk.menutip.hide();
2787
+ });
2788
+ }
2789
+ const vm = tk.skewer.viewModes.find((n) => n.inuse);
2790
+ if (vm.type == "skewer") {
2791
+ const expandCount = tk.skewer.data.reduce((i, j) => i + j.showmode, 0);
2792
+ if (expandCount > 0) {
2793
+ tk.menutip.d.append("div").text("Collapse").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sja_collapse_menuoption").attr("tabindex", 0).on("click", () => {
2794
+ fold_glyph(tk.skewer.data, tk);
2795
+ tk.menutip.hide();
2796
+ });
2797
+ } else if (expandCount == 0) {
2798
+ tk.menutip.d.append("div").text("Expand").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sja_expand_menuoption").attr("tabindex", 0).on("click", () => {
2799
+ settle_glyph(tk, block);
2800
+ tk.menutip.hide();
2801
+ });
2802
+ }
2803
+ tk.menutip.d.append("div").text(tk.skewer.pointup ? "Point down" : "Point up").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sjpp-pointup-option").attr("tabindex", 0).on("click", () => {
2804
+ tk.skewer.pointup = !tk.skewer.pointup;
2805
+ tk.load();
2806
+ tk.menutip.hide();
2807
+ });
2808
+ if (tk.filterObj) {
2809
+ let called = false;
2810
+ const div = tk.menutip.d.append("div").text("Change variant shape").style("vertical-align", "middle").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sja-change-skewer-shape-option").attr("tabindex", 0).on("click", () => {
2811
+ if (called == false) {
2812
+ called = true;
2813
+ renderShapePicker({
2814
+ holder: div.append("div").style("margin-top", "10px"),
2815
+ callback: (shape) => {
2816
+ Object.keys(tk.shapes).forEach((key) => {
2817
+ tk.shapes[key] = shape;
2818
+ });
2819
+ tk.load();
2820
+ tk.menutip.hide();
2821
+ },
2822
+ tk
2823
+ });
2824
+ }
2825
+ });
2826
+ }
2827
+ } else if (vm.type == "numeric") {
2828
+ tk.menutip.d.append("div").text(tk.skewer.hideDotLabels ? "Show all variant labels" : "Hide all variant labels").attr("class", "sja_menuoption sja_sharp_border").attr("data-testid", "sjpp-show-hide-variant-labels-option").attr("tabindex", 0).on("click", () => {
2829
+ tk.skewer.hideDotLabels = !tk.skewer.hideDotLabels;
2830
+ tk.load();
2831
+ tk.menutip.hide();
2832
+ });
2833
+ }
2834
+ }
2835
+ if (!tk.custom_variants) {
2836
+ tk.menutip.d.append("div").text("Download").attr("class", "sja_menuoption sja_sharp_border").attr("tabindex", 0).attr("data-testid", "sjpp_mds3tk_variantdownload_menuoption").on("click", () => {
2837
+ downloadVariants(tk, block);
2838
+ tk.menutip.hide();
2839
+ });
2840
+ }
2841
+ tk.menutip.d.on("keydown", function(event2) {
2842
+ if (event2.key != "Enter" || !event2.target.className.includes("sja_menuoption")) return;
2843
+ event2.target.dispatchEvent(new KeyboardEvent("click"));
2844
+ });
2845
+ mayAddSkewerModeOption(tk, block);
2846
+ }
2847
+ async function listVariantData(tk, block) {
2848
+ tk.menutip.clear();
2849
+ const dt2mlst = /* @__PURE__ */ new Map();
2850
+ if (tk.skewer) {
2851
+ const currentMode = tk.skewer.viewModes.find((i2) => i2.inuse);
2852
+ let data;
2853
+ if (currentMode.type == "skewer") {
2854
+ data = tk.skewer.data.filter((i2) => i2.x >= 0 && i2.x <= block.width);
2855
+ } else if (currentMode.type == "numeric") {
2856
+ data = currentMode.data;
2857
+ } else {
2858
+ throw "unknown mode type";
2859
+ }
2860
+ for (const g of data) {
2861
+ for (const m of g.mlst) {
2862
+ if (!dt2mlst.has(m.dt)) dt2mlst.set(m.dt, []);
2863
+ dt2mlst.get(m.dt).push(m);
2864
+ }
2865
+ }
2866
+ }
2867
+ if (tk.cnv?.cnvLst?.length) {
2868
+ dt2mlst.set(dtcnv, tk.cnv.cnvLst);
2869
+ }
2870
+ if (dt2mlst.size == 1) {
2871
+ const div = tk.menutip.d.append("div").style("margin", "10px");
2872
+ await itemtable({
2873
+ div,
2874
+ mlst: dt2mlst.get([...dt2mlst.keys()][0]),
2875
+ tk,
2876
+ block,
2877
+ doNotListSample4multim: true
2878
+ });
2879
+ return;
2880
+ }
2881
+ const tabs = [];
2882
+ for (const [dt, mlst] of dt2mlst) {
2883
+ tabs.push({ label: mlst.length + " " + dt2label[dt] });
2884
+ }
2885
+ new Tabs({
2886
+ holder: tk.menutip.d.append("div").attr("class", "sja_pp_vlb_dttabdiv").style("margin", "10px"),
2887
+ tabs
2888
+ }).main();
2889
+ let i = 0;
2890
+ for (const [dt, mlst] of dt2mlst) {
2891
+ itemtable({
2892
+ div: tabs[i++].contentHolder.append("div").style("margin-left", "10px"),
2893
+ mlst,
2894
+ tk,
2895
+ block,
2896
+ doNotListSample4multim: true
2897
+ });
2898
+ }
2899
+ }
2900
+ function renderShapePicker(arg) {
2901
+ const lollipopShapes = {
2902
+ filledCircle: shapes.filledCircle,
2903
+ emptyCircle: shapes.emptyCircle,
2904
+ filledVerticalRectangle: shapes.filledVerticalRectangle,
2905
+ emptyVerticalRectangle: shapes.emptyVerticalRectangle,
2906
+ filledTriangle: shapes.filledTriangle,
2907
+ emptyTriangle: shapes.emptyTriangle,
2908
+ filledSquare: shapes.filledSquare,
2909
+ emptySquare: shapes.emptySquare
2910
+ };
2911
+ const { holder, callback, tk } = arg;
2912
+ const shapePaths = Object.values(lollipopShapes).map((shape) => shape.path);
2913
+ const selectorCallback = (val) => {
2914
+ const shape = Object.keys(lollipopShapes)[val];
2915
+ callback(shape, tk);
2916
+ };
2917
+ const opts = { backgroundColor: "" };
2918
+ shapeSelector(holder, selectorCallback, shapePaths, opts);
2919
+ }
2920
+ function mayAddSkewerModeOption(tk, block) {
2921
+ if (!tk.skewer) return;
2922
+ if (tk.skewer.viewModes.length <= 1) {
2923
+ return;
2924
+ }
2925
+ const options = [];
2926
+ for (const [idx, v] of tk.skewer.viewModes.entries()) {
2927
+ const o = {
2928
+ label: getViewmodeName(v),
2929
+ value: idx
2930
+ };
2931
+ if (v.inuse) o.checked = true;
2932
+ options.push(o);
2933
+ }
2934
+ make_radios({
2935
+ holder: tk.menutip.d.append("div").attr("class", "sja_pp_vlb_viewmoderadiodiv").style("margin", "10px"),
2936
+ styles: {
2937
+ display: "block"
2938
+ },
2939
+ options,
2940
+ callback: async (idx) => {
2941
+ for (const i of tk.skewer.viewModes) i.inuse = false;
2942
+ tk.skewer.viewModes[idx].inuse = true;
2943
+ may_render_skewer({ skewer: tk.skewer.rawmlst }, tk, block);
2944
+ positionLeftlabelg(tk, block);
2945
+ tk._finish();
2946
+ }
2947
+ });
2948
+ }
2949
+ function getViewmodeName(n) {
2950
+ if (!n) return "MISSING!!";
2951
+ if (n.type == "skewer") return "As lollipops";
2952
+ if (n.type == "numeric") return n.label + " as Y axis";
2953
+ return "unknown mode";
2954
+ }
2955
+ async function downloadVariants(tk, block) {
2956
+ if (!tk.mds.variant2samples) {
2957
+ console.log("TODO: variant-only");
2958
+ return;
2959
+ }
2960
+ const arg = {
2961
+ querytype: "samples"
2962
+ };
2963
+ rangequery_rglst(tk, block, arg);
2964
+ const samples = (await tk.mds.variant2samples.get(arg)).samples;
2965
+ const [columns, rows] = await samples2columnsRows(samples, tk);
2966
+ const headerline = [];
2967
+ for (const c of columns) {
2968
+ if (c.isSsm) {
2969
+ headerline.push("AAchange");
2970
+ headerline.push("Consequence");
2971
+ headerline.push("Mutation");
2972
+ continue;
2973
+ }
2974
+ if (c.isMaf) {
2975
+ headerline.push("Alternative allele depth in tumor");
2976
+ headerline.push("Total depth in tumor");
2977
+ continue;
2978
+ }
2979
+ headerline.push(c.label);
2980
+ }
2981
+ const lines = [];
2982
+ for (const [sidx, sample] of samples.entries()) {
2983
+ let ssm_id_lst;
2984
+ if (Array.isArray(sample.ssm_id_lst)) {
2985
+ ssm_id_lst = sample.ssm_id_lst;
2986
+ } else if (sample.ssm_id) {
2987
+ ssm_id_lst = [sample.ssm_id];
2988
+ } else {
2989
+ console.log("sample obj lacks ssm_id and ssm_id_lst");
2990
+ continue;
2991
+ }
2992
+ for (const ssmid of ssm_id_lst) {
2993
+ const m = findMbyId(ssmid, tk);
2994
+ if (!m) {
2995
+ console.log("ssm not found by id: " + ssmid);
2996
+ continue;
2997
+ }
2998
+ const line = [];
2999
+ for (const [cidx, c] of columns.entries()) {
3000
+ if (c.isSsm) {
3001
+ if (m.dt == dtsnvindel) {
3002
+ line.push(m.mname);
3003
+ line.push(mclass[m.class].label);
3004
+ line.push(m.chr + ":" + (m.pos + 1) + " " + m.ref + ">" + m.alt);
3005
+ } else if (m.dt == dtsv || m.dt == dtfusionrna) {
3006
+ line.push("");
3007
+ line.push(mclass[m.class].label);
3008
+ line.push(
3009
+ m.pairlst[0].a.chr + ":" + m.pairlst[0].a.pos + ">" + m.pairlst[0].b.chr + ":" + m.pairlst[0].b.pos
3010
+ );
3011
+ } else if (m.dt == dtcnv) {
3012
+ line.push(Number.isFinite(m.value) ? m.value : "");
3013
+ line.push(mclass[m.class].label);
3014
+ line.push(m.chr + ":" + (m.start + 1) + "-" + (m.stop + 1));
3015
+ } else {
3016
+ throw "unknown m.dt";
3017
+ }
3018
+ continue;
3019
+ }
3020
+ const cell = rows[sidx][cidx];
3021
+ if (cell.bySsmid) {
3022
+ if (ssmid in cell.bySsmid) {
3023
+ const v = cell.bySsmid[ssmid];
3024
+ if (c.isMaf) {
3025
+ line.push(v.altTumor);
3026
+ line.push(v.totalTumor);
3027
+ } else {
3028
+ line.push(v);
3029
+ }
3030
+ } else {
3031
+ line.push("");
3032
+ }
3033
+ continue;
3034
+ }
3035
+ if (c.isMaf) {
3036
+ line.push(cell.altTumor);
3037
+ line.push(cell.totalTumor);
3038
+ continue;
3039
+ }
3040
+ line.push(cell.value);
3041
+ }
3042
+ lines.push(line.join(" "));
3043
+ }
3044
+ }
3045
+ to_textfile(
3046
+ block2source(block) + " " + (/* @__PURE__ */ new Date()).toLocaleDateString() + ".txt",
3047
+ headerline.join(" ") + "\n" + lines.join("\n")
3048
+ );
3049
+ }
3050
+
3051
+ // mds3/legend.js
3052
+ var unknown_infoCategory_color = "black";
3053
+ var unannotatedKey = "Unannotated";
3054
+ function initLegend(tk, block) {
3055
+ if (!block.legend) return;
3056
+ if (!tk.legend) tk.legend = {};
3057
+ tk.legend.tip = new Menu({ padding: "0px" });
3058
+ const [tr, td, td0] = legend_newrow(block, tk.name);
3059
+ tk.legend.headTd = td0;
3060
+ tk.tr_legend = tr;
3061
+ const table = td.append("table").style("border-spacing", "5px").style("border-collapse", "separate");
3062
+ tk.legend.table = table;
3063
+ create_mclass(tk, block);
3064
+ may_create_variantShapeName(tk);
3065
+ may_create_infoFields(tk);
3066
+ may_create_formatFilter(tk);
3067
+ may_create_skewerRim(tk);
3068
+ may_create_ld(tk);
3069
+ may_create_cnv(tk);
3070
+ }
3071
+ function create_mclass(tk, block) {
3072
+ if (!tk.legend.mclass) tk.legend.mclass = {};
3073
+ if (!tk.legend.mclass.hiddenvalues) tk.legend.mclass.hiddenvalues = /* @__PURE__ */ new Set();
3074
+ tk.legend.mclass.row = tk.legend.table.append("tr");
3075
+ if (tk.hardcodeCnvOnly) {
3076
+ tk.legend.mclass.row.style("display", "none");
3077
+ }
3078
+ tk.legend.mclass.row.append("td").attr("data-testid", "sjpp-mds3tk-legend-mclass").style("text-align", "right").style("opacity", 0.7).text(block.mclassOverride?.className || "Mutation");
3079
+ tk.legend.mclass.holder = tk.legend.mclass.row.append("td");
3080
+ }
3081
+ function may_create_variantShapeName(tk) {
3082
+ if (!tk.legend.customShapeLabels || !tk.custom_variants) return;
3083
+ if (!tk.legend.variantShapeName) tk.legend.variantShapeName = [];
3084
+ for (const data of tk.custom_variants) {
3085
+ if (!data.shape) data.shape = "filledCircle";
3086
+ const shapeObj = tk.legend.variantShapeName.find((v) => v.key == data.shape);
3087
+ if (!shapeObj) {
3088
+ tk.legend.variantShapeName.push({
3089
+ key: data.shape,
3090
+ origShape: data.shape,
3091
+ num: 1
3092
+ });
3093
+ } else {
3094
+ shapeObj.num = ++shapeObj.num;
3095
+ }
3096
+ }
3097
+ if (tk.legend.customShapeLabels) {
3098
+ for (const shape in tk.legend.customShapeLabels) {
3099
+ if (!tk.legend.variantShapeName.find((i) => i.key == shape)) {
3100
+ tk.legend.variantShapeName.push({
3101
+ key: shape,
3102
+ origShape: shape,
3103
+ num: 0
3104
+ });
3105
+ }
3106
+ }
3107
+ }
3108
+ tk.legend.variantShapeName.sort((a, b) => b.num - a.num);
3109
+ const width = 12;
3110
+ const height = 12;
3111
+ const shapesWrapper = tk.legend.table.append("tr").append("td").attr("colspan", 2);
3112
+ for (const shapeObj of Object.values(tk.legend.variantShapeName)) {
3113
+ const getArgs = () => {
3114
+ return shapeObj.key.includes("Circle") ? { radius: width / 2 - 0.5 } : shapeObj.key.includes("Rectangle") ? { width: width / 2 + 2.5, height: height - 0.5 } : { width: width - 0.5, height: height - 0.5 };
3115
+ };
3116
+ shapeObj.wrapper = shapesWrapper.append("div");
3117
+ const svg = shapeObj.wrapper.append("span").append("svg").attr("width", width).attr("height", height);
3118
+ shapeObj.shapeG = svg.append("g").attr("transform", `translate(${width / 2}, ${height / 2})`).append("path").attr("d", shapes[shapeObj.key].calculatePath(getArgs(shapeObj))).attr("fill", shapes[shapeObj.key].isFilled ? "grey" : "white").attr("stroke", shapes[shapeObj.key].isFilled ? "none" : "grey");
3119
+ shapeObj.wrapper.append("span").html(`&nbsp;n=`);
3120
+ shapeObj.numDiv = shapeObj.wrapper.append("span").text(shapeObj.num);
3121
+ shapeObj.wrapper.append("span").text(`, ${tk.legend.customShapeLabels[shapeObj.key]}`);
3122
+ }
3123
+ }
3124
+ function may_create_infoFields(tk) {
3125
+ if (!tk.mds.bcf?.info) return;
3126
+ const infoFields4legend = [];
3127
+ for (const key in tk.mds.bcf.info) {
3128
+ const field = tk.mds.bcf.info[key];
3129
+ if (field.categories) {
3130
+ infoFields4legend.push(key);
3131
+ }
3132
+ }
3133
+ if (!infoFields4legend.length) return;
3134
+ if (!tk.legend.bcfInfo) tk.legend.bcfInfo = {};
3135
+ for (const key of infoFields4legend) {
3136
+ const row = tk.legend.table.append("tr");
3137
+ row.append("td").attr("data-testid", `sjpp-mds3tk-legend-bcfinfo-${key}`).style("text-align", "right").style("opacity", 0.7).text(tk.mds.bcf.info[key].name || key);
3138
+ tk.legend.bcfInfo[key] = {
3139
+ hiddenvalues: /* @__PURE__ */ new Set(),
3140
+ row,
3141
+ // column 2 <td>: content holder
3142
+ holder: row.append("td")
3143
+ };
3144
+ }
3145
+ }
3146
+ function may_create_formatFilter(tk) {
3147
+ if (!tk.mds.bcf?.format) return;
3148
+ const formatFields4legend = [];
3149
+ for (const k in tk.mds.bcf.format) {
3150
+ if (tk.mds.bcf.format[k].isFilter) formatFields4legend.push(k);
3151
+ }
3152
+ if (!formatFields4legend.length) return;
3153
+ if (!tk.legend.formatFilter) tk.legend.formatFilter = {};
3154
+ for (const key of formatFields4legend) {
3155
+ const row = tk.legend.table.append("tr");
3156
+ row.append("td").attr("data-testid", `sjpp-mds3tk-legend-bcfformat-${key}`).style("text-align", "right").style("opacity", 0.7).text(tk.mds.bcf.format[key].Description);
3157
+ tk.legend.formatFilter[key] = {
3158
+ hiddenvalues: /* @__PURE__ */ new Set(),
3159
+ row,
3160
+ // column 2 <td>: content holder
3161
+ holder: row.append("td")
3162
+ };
3163
+ }
3164
+ }
3165
+ function may_update_formatFilter(data, tk) {
3166
+ if (!tk.legend.formatFilter) return;
3167
+ if (!data.skewer) {
3168
+ console.log("data.skewer[] is not present and cannot show INFO legend");
3169
+ return;
3170
+ }
3171
+ for (const formatKey in tk.legend.formatFilter) {
3172
+ tk.legend.formatFilter[formatKey].holder.selectAll("*").remove();
3173
+ const category2variantCount = /* @__PURE__ */ new Map();
3174
+ let unannotatedCount = 0;
3175
+ for (const m of data.skewer) {
3176
+ if (!m.formatK2count?.[formatKey]) continue;
3177
+ for (const category in m.formatK2count[formatKey].v2c) {
3178
+ category2variantCount.set(
3179
+ category,
3180
+ m.formatK2count[formatKey].v2c[category] + (category2variantCount.get(category) || 0)
3181
+ );
3182
+ }
3183
+ unannotatedCount += m.formatK2count[formatKey].unannotatedCount || 0;
3184
+ }
3185
+ const show_lst = [...category2variantCount];
3186
+ show_lst.sort((i, j) => j[1] - i[1]);
3187
+ if (unannotatedCount) {
3188
+ show_lst.push([unannotatedKey, unannotatedCount]);
3189
+ }
3190
+ for (const [category, count] of show_lst) {
3191
+ const cell = tk.legend.formatFilter[formatKey].holder.append("div").attr("class", "sja_clb").style("display", "inline-block").on("click", () => {
3192
+ const opts = [
3193
+ {
3194
+ label: "Hide",
3195
+ isVisible: () => true,
3196
+ callback: () => {
3197
+ tk.legend.formatFilter[formatKey].hiddenvalues.add(category);
3198
+ }
3199
+ },
3200
+ {
3201
+ label: "Show only",
3202
+ isVisible: () => true,
3203
+ callback: () => {
3204
+ for (const c2 of show_lst) {
3205
+ tk.legend.formatFilter[formatKey].hiddenvalues.add(c2[0]);
3206
+ }
3207
+ tk.legend.formatFilter[formatKey].hiddenvalues.delete(category);
3208
+ }
3209
+ },
3210
+ {
3211
+ label: "Show all",
3212
+ isVisible: () => tk.legend.formatFilter[formatKey].hiddenvalues.size,
3213
+ callback: () => {
3214
+ tk.legend.formatFilter[formatKey].hiddenvalues.clear();
3215
+ }
3216
+ }
3217
+ ];
3218
+ createLegendTipMenu(opts, tk, cell.node());
3219
+ });
3220
+ cell.append("div").style("display", "inline-block").attr("class", "sja_mcdot").style("background", "#aaa").style("margin-right", "5px").html(count > 1 ? count : "&nbsp;");
3221
+ cell.append("div").style("display", "inline-block").text(category);
3222
+ }
3223
+ for (const c of tk.legend.formatFilter[formatKey].hiddenvalues) {
3224
+ let loading = false;
3225
+ tk.legend.formatFilter[formatKey].holder.append("div").style("display", "inline-block").attr("class", "sja_clb").style("text-decoration", "line-through").style("opacity", 0.7).text(c).on("click", async () => {
3226
+ if (loading) return;
3227
+ loading = true;
3228
+ tk.legend.formatFilter[formatKey].hiddenvalues.delete(c);
3229
+ reload(tk);
3230
+ });
3231
+ }
3232
+ }
3233
+ }
3234
+ function reload(tk) {
3235
+ tk.legend.tip.hide();
3236
+ tk.load();
3237
+ }
3238
+ function updateLegend(data, tk, block) {
3239
+ if (!tk.legend) {
3240
+ return;
3241
+ }
3242
+ tk.legend.mclass.currentData = data.mclass2variantcount;
3243
+ update_mclass(tk);
3244
+ may_update_variantShapeName(data, tk);
3245
+ may_update_infoFields(data, tk);
3246
+ may_update_formatFilter(data, tk);
3247
+ may_update_skewerRim(data, tk);
3248
+ may_update_ld(tk);
3249
+ may_update_cnv(tk);
3250
+ }
3251
+ function may_update_variantShapeName(data, tk) {
3252
+ if (!tk.legend.customShapeLabels) return;
3253
+ Object.values(tk.legend.variantShapeName).forEach((s) => {
3254
+ if (!s.ids) {
3255
+ s.ids = data.skewer.filter((d) => d.shape == s.key).map((i) => i.id);
3256
+ }
3257
+ s.num = 0;
3258
+ });
3259
+ for (const d of data.skewer) {
3260
+ let shapeObj = tk.legend.variantShapeName.find((s) => s.ids.some((i) => i == d.id));
3261
+ if (!shapeObj) {
3262
+ shapeObj = tk.legend.variantShapeName.find((s) => s.key == d.shape || s.origShape == d.shape);
3263
+ shapeObj.ids.push(d.id);
3264
+ }
3265
+ shapeObj.num = ++shapeObj.num;
3266
+ }
3267
+ Object.values(tk.legend.variantShapeName).forEach((s) => {
3268
+ s.wrapper.style("display", s.num ? "block" : "none");
3269
+ s.numDiv.text(s.num);
3270
+ });
3271
+ }
3272
+ function may_update_infoFields(data, tk) {
3273
+ if (!tk.legend.bcfInfo) return;
3274
+ if (!data.skewer) {
3275
+ console.log("data.skewer[] is not present and cannot show INFO legend");
3276
+ return;
3277
+ }
3278
+ for (const infoKey in tk.legend.bcfInfo) {
3279
+ tk.legend.bcfInfo[infoKey].holder.selectAll("*").remove();
3280
+ if (tk.mds.bcf.info[infoKey].Type == "String") {
3281
+ const category2variantCount = /* @__PURE__ */ new Map();
3282
+ for (const m of data.skewer) {
3283
+ const category = m.info?.[infoKey] || unannotatedKey;
3284
+ if (Array.isArray(category)) {
3285
+ for (const c of category) {
3286
+ category2variantCount.set(c, 1 + (category2variantCount.get(c) || 0));
3287
+ }
3288
+ } else {
3289
+ category2variantCount.set(category, 1 + (category2variantCount.get(category) || 0));
3290
+ }
3291
+ }
3292
+ const show_lst = [...category2variantCount].sort((i, j) => j[1] - i[1]);
3293
+ for (const [category, count] of show_lst) {
3294
+ printCategory({
3295
+ holder: tk.legend.bcfInfo[infoKey].holder,
3296
+ key: category,
3297
+ color: tk.mds.bcf.info[infoKey].categories?.[category]?.color || unknown_infoCategory_color,
3298
+ label: tk.mds.bcf.info[infoKey].categories?.[category]?.label || category,
3299
+ count,
3300
+ click: (event2) => {
3301
+ const opts = [
3302
+ {
3303
+ label: "Hide",
3304
+ isVisible: () => true,
3305
+ callback: () => {
3306
+ tk.legend.bcfInfo[infoKey].hiddenvalues.add(category);
3307
+ }
3308
+ },
3309
+ {
3310
+ label: "Show only",
3311
+ isVisible: () => true,
3312
+ callback: () => {
3313
+ for (const c2 of show_lst) {
3314
+ tk.legend.bcfInfo[infoKey].hiddenvalues.add(c2[0]);
3315
+ }
3316
+ tk.legend.bcfInfo[infoKey].hiddenvalues.delete(category);
3317
+ }
3318
+ },
3319
+ {
3320
+ label: "Show all",
3321
+ isVisible: () => tk.legend.bcfInfo[infoKey].hiddenvalues.size,
3322
+ callback: () => {
3323
+ tk.legend.bcfInfo[infoKey].hiddenvalues.clear();
3324
+ }
3325
+ }
3326
+ ];
3327
+ createLegendTipMenu(opts, tk, event2.target);
3328
+ const desc = tk.mds.bcf.info[infoKey].categories?.[category]?.desc;
3329
+ if (desc) {
3330
+ tk.legend.tip.d.append("div").style("padding", "10px").style("font-size", ".8em").style("width", "150px").html(desc);
3331
+ }
3332
+ }
3333
+ });
3334
+ }
3335
+ for (const c of tk.legend.bcfInfo[infoKey].hiddenvalues) {
3336
+ let loading = false;
3337
+ tk.legend.bcfInfo[infoKey].holder.append("div").style("display", "inline-block").attr("class", "sja_clb").style("text-decoration", "line-through").text(c).on("click", async () => {
3338
+ if (loading) return;
3339
+ loading = true;
3340
+ tk.legend.bcfInfo[infoKey].hiddenvalues.delete(c);
3341
+ reload(tk);
3342
+ });
3343
+ }
3344
+ }
3345
+ }
3346
+ }
3347
+ function update_mclass(tk) {
3348
+ if (tk.hardcodeCnvOnly) return;
3349
+ if (!tk.legend.mclass.currentData || tk.legend.mclass.currentData.length == 0) return;
3350
+ tk.legend.mclass.holder.selectAll("*").remove();
3351
+ const showlst = [], hiddenlst = [];
3352
+ for (const [k, count] of tk.legend.mclass.currentData) {
3353
+ const v = { k, count };
3354
+ if (tk.legend.mclass.hiddenvalues.has(k)) {
3355
+ hiddenlst.push(v);
3356
+ } else {
3357
+ showlst.push(v);
3358
+ }
3359
+ }
3360
+ showlst.sort((i, j) => j.count - i.count);
3361
+ hiddenlst.sort((i, j) => j.count - i.count);
3362
+ for (const k of tk.legend.mclass.hiddenvalues) {
3363
+ if (!hiddenlst.find((i) => i.k == k)) {
3364
+ hiddenlst.push({ k });
3365
+ }
3366
+ }
3367
+ for (const c of showlst) {
3368
+ const { label, desc, color } = mds3tkMclass(c.k);
3369
+ printCategory({
3370
+ holder: tk.legend.mclass.holder,
3371
+ key: c.k,
3372
+ label: tk.mds.termdbConfig?.mclass?.[c.k]?.label || label,
3373
+ color,
3374
+ count: c.count,
3375
+ click: () => {
3376
+ const opts = [
3377
+ {
3378
+ label: "Hide",
3379
+ isVisible: () => true,
3380
+ callback: () => {
3381
+ tk.legend.mclass.hiddenvalues.add(c.k);
3382
+ }
3383
+ },
3384
+ {
3385
+ label: "Show only",
3386
+ isVisible: () => true,
3387
+ callback: () => {
3388
+ for (const c2 of showlst) {
3389
+ tk.legend.mclass.hiddenvalues.add(c2.k);
3390
+ }
3391
+ tk.legend.mclass.hiddenvalues.delete(c.k);
3392
+ }
3393
+ },
3394
+ {
3395
+ label: "Show all",
3396
+ isVisible: () => hiddenlst.length,
3397
+ callback: () => {
3398
+ tk.legend.mclass.hiddenvalues.clear();
3399
+ }
3400
+ },
3401
+ {
3402
+ isChangeShape: true,
3403
+ isVisible: () => {
3404
+ if (c.k == dtcnv) return false;
3405
+ return !tk.skewer.viewModes.find((v) => v.type === "numeric")?.inuse ? tk.mds?.termdbConfig?.tracks?.allowSkewerChanges ?? true : false;
3406
+ },
3407
+ callback: (val, tk2) => {
3408
+ tk2.shapes[c.k] = val;
3409
+ tk2.load();
3410
+ tk2.legend.tip.hide();
3411
+ }
3412
+ },
3413
+ {
3414
+ isChangeColor: true,
3415
+ value: color,
3416
+ isVisible: () => {
3417
+ return c.k != dtcnv;
3418
+ },
3419
+ callback: (colorValue) => {
3420
+ if (!mclass[c.k].origColor) mclass[c.k].origColor = mclass[c.k].color;
3421
+ mclass[c.k].color = colorValue;
3422
+ },
3423
+ reset: {
3424
+ isVisible: () => mclass[c.k].origColor,
3425
+ callback: () => mclass[c.k].color = mclass[c.k].origColor
3426
+ }
3427
+ }
3428
+ ];
3429
+ createLegendTipMenu(opts, tk, event.target);
3430
+ const descDiv = tk.legend.tip.d.append("div").style("padding", "10px").style("font-size", ".8em").style("width", "150px");
3431
+ descDiv.append("span").style("color", color).text(label.toUpperCase());
3432
+ descDiv.append("div").style("color", "black").html(desc);
3433
+ }
3434
+ });
3435
+ }
3436
+ for (const c of hiddenlst) {
3437
+ let loading = false;
3438
+ tk.legend.mclass.holder.append("div").style("display", "inline-block").attr("class", "sja_clb").style("text-decoration", "line-through").style("opacity", 0.7).text((c.count ? "(" + c.count + ") " : "") + (Number.isInteger(c.k) ? dt2label[c.k] : mclass[c.k].label)).on("click", async (event2) => {
3439
+ if (loading) return;
3440
+ loading = true;
3441
+ tk.legend.mclass.hiddenvalues.delete(c.k);
3442
+ event2.target.innerHTML = "Updating...";
3443
+ await tk.load();
3444
+ });
3445
+ }
3446
+ }
3447
+ function may_create_skewerRim(tk, block) {
3448
+ if (!tk.mds.queries?.snvindel?.skewerRim) return;
3449
+ const R = tk.legend.skewerRim = {};
3450
+ if (!tk.mds.queries.snvindel.skewerRim.hiddenvaluelst) tk.mds.queries.snvindel.skewerRim.hiddenvaluelst = [];
3451
+ R.row = tk.legend.table.append("tr");
3452
+ R.headerTd = R.row.append("td").attr("data-testid", `sjpp-mds3tk-legend-skewerRim`).style("text-align", "right").style("opacity", 0.7);
3453
+ R.holder = R.row.append("td");
3454
+ }
3455
+ function getSkewerRimLegendHeaderName(tk) {
3456
+ const sk = tk.mds.queries.snvindel.skewerRim;
3457
+ if (sk.type == "format") {
3458
+ if (!sk.formatKey) throw "skewerRim.formatKey missing";
3459
+ return tk.mds.bcf?.format?.[sk.formatKey]?.Description || sk.formatKey;
3460
+ }
3461
+ return "unknown skewerRim.type";
3462
+ }
3463
+ function may_update_skewerRim(data, tk) {
3464
+ if (!data.skewer) return;
3465
+ const sk = tk.mds.queries?.snvindel?.skewerRim;
3466
+ if (!sk) return;
3467
+ let rim1total = 0, noRimTotal = 0;
3468
+ for (const m of data.skewer) {
3469
+ const r1 = m.rim1count || 0;
3470
+ rim1total += r1;
3471
+ noRimTotal += m.occurrence - r1;
3472
+ }
3473
+ const R = tk.legend.skewerRim;
3474
+ R.headerTd.text(getSkewerRimLegendHeaderName(tk));
3475
+ R.holder.selectAll("*").remove();
3476
+ if (rim1total > 0) {
3477
+ R.holder.append("div").attr("class", "sja_clb").style("display", "inline-block").html(`${getRimSvg(1)}${sk.rim1value}, n=${rim1total}`).on("click", (event2) => {
3478
+ tk.legend.tip.clear().showunder(event2.target).d.append("div").attr("class", "sja_menuoption").attr("data-testid", `sjpp-hide-${sk.rim1value}-option`).text("Hide").on("click", () => {
3479
+ sk.hiddenvaluelst.push(sk.rim1value);
3480
+ reload(tk);
3481
+ });
3482
+ });
3483
+ }
3484
+ if (noRimTotal > 0) {
3485
+ R.holder.append("div").attr("class", "sja_clb").style("display", "inline-block").html(`${getRimSvg()}${sk.noRimValue}, n=${noRimTotal}`).on("click", (event2) => {
3486
+ tk.legend.tip.clear().showunder(event2.target).d.append("div").attr("class", "sja_menuoption").attr("data-testid", "sjpp-hide-no-rim-option").text("Hide").on("click", () => {
3487
+ sk.hiddenvaluelst.push(sk.noRimValue);
3488
+ reload(tk);
3489
+ });
3490
+ });
3491
+ }
3492
+ for (const c of sk.hiddenvaluelst) {
3493
+ let loading = false;
3494
+ R.holder.append("div").style("display", "inline-block").attr("class", "sja_clb").style("text-decoration", "line-through").style("opacity", 0.7).text(c).on("click", async (event2) => {
3495
+ if (loading) return;
3496
+ loading = true;
3497
+ sk.hiddenvaluelst.splice(sk.hiddenvaluelst.indexOf(c), 1);
3498
+ event2.target.innerHTML = "Updating...";
3499
+ await tk.load();
3500
+ });
3501
+ }
3502
+ }
3503
+ function getRimSvg(rim) {
3504
+ return '<svg width="19" height="19" style="margin-right: 5px;"><circle cx="7" cy="12" r="7" fill="#b1b1b1"></circle>' + (rim == 1 ? '<path d="M6.735557395310443e-16,-11A11,11 0 0,1 11,0L9,0A9,9 0 0,0 5.51091059616309e-16,-9Z" transform="translate(7,12)" fill="#858585" stroke="none"></path>' : rim == 2 ? "" : "") + // blank for no rim
3505
+ "</svg>";
3506
+ }
3507
+ function may_create_ld(tk, block) {
3508
+ if (!tk.mds.queries?.ld) return;
3509
+ tk.mds.queries.ld.colorScale = rgb_default(tk.mds.queries.ld.overlay.color_0, tk.mds.queries.ld.overlay.color_1);
3510
+ const R = tk.legend.ld = {};
3511
+ R.row = tk.legend.table.append("tr");
3512
+ R.headerTd = R.row.append("td").attr("data-testid", `sjpp-mds3tk-legend-ld`).style("text-align", "right").style("opacity", 0.7);
3513
+ R.holder = R.row.append("td");
3514
+ R.showHolder = R.holder.append("div").style("display", "none");
3515
+ showLDlegend(R.showHolder, tk.mds.queries.ld.colorScale);
3516
+ R.showHolder.append("span").text("Cancel overlay").style("font-size", ".7em").attr("class", "sja_clbtext").on("click", () => {
3517
+ delete tk.mds.queries.ld.mOverlay;
3518
+ if (tk.skewer?.hlssmid) delete tk.skewer.hlssmid;
3519
+ tk.load();
3520
+ });
3521
+ }
3522
+ function may_update_ld(tk) {
3523
+ if (!tk.mds.queries?.ld?.mOverlay) {
3524
+ if (tk.legend.ld) {
3525
+ tk.legend.ld.headerTd.html("");
3526
+ tk.legend.ld.showHolder.style("display", "none");
3527
+ }
3528
+ return;
3529
+ }
3530
+ tk.legend.ld.headerTd.html(tk.mds.queries.ld.mOverlay.ldtkname + " LD r<sup>2</sup>");
3531
+ tk.legend.ld.showHolder.style("display", "block");
3532
+ }
3533
+ function may_create_cnv(tk, block) {
3534
+ if (!tk.cnv) return;
3535
+ const R = tk.legend.cnv = {};
3536
+ R.row = tk.legend.table.append("tr");
3537
+ R.headerTd = R.row.append("td").attr("data-testid", `sjpp-mds3tk-legend-cnv`).style("text-align", "right").style("opacity", 0.7).text("CNV");
3538
+ R.holder = R.row.append("td").style("padding-left", "10px");
3539
+ if (Number.isFinite(tk.cnv.cnvGainCutoff)) {
3540
+ R.colorscaleHolder = R.holder.append("div");
3541
+ R.colorscaleHolder.append("span").text("Loss").style("font-size", ".8em").style("opacity", 0.6);
3542
+ const csHolder = R.colorscaleHolder.append("span");
3543
+ R.colorscaleHolder.append("span").text("Gain").style("font-size", ".8em").style("opacity", 0.6);
3544
+ const axisheight = 20;
3545
+ const barheight = 15;
3546
+ const xpad = 10;
3547
+ const axiswidth = 150;
3548
+ R.colorScale = new ColorScale({
3549
+ barwidth: axiswidth,
3550
+ barheight,
3551
+ colors: [tk.cnv.lossColor, "white", tk.cnv.gainColor],
3552
+ domain: [-1, 0, 1],
3553
+ // actual domain added during update
3554
+ fontSize: 12,
3555
+ holder: csHolder,
3556
+ height: axisheight + barheight,
3557
+ width: xpad * 2 + axiswidth,
3558
+ position: `${xpad},${axisheight}`,
3559
+ ticks: 4,
3560
+ tickSize: 6,
3561
+ topTicks: true,
3562
+ numericInputs: {
3563
+ callback: (obj) => {
3564
+ if (obj.cutoffMode == "auto") {
3565
+ delete tk.cnv.presetMax;
3566
+ } else if (obj.cutoffMode == "fixed") {
3567
+ tk.cnv.presetMax = Math.abs(obj.max);
3568
+ } else {
3569
+ throw "unknown cutoffMode value";
3570
+ }
3571
+ tk.load();
3572
+ }
3573
+ }
3574
+ });
3575
+ } else {
3576
+ R.cnvCategoryHolder = R.holder.append("span").attr("data-testid", "sjpp-mds3cnvlegend-categoryholder");
3577
+ }
3578
+ R.noCnv = R.holder.append("div").text("No data").style("opacity", 0.6);
3579
+ const menu = new Menu();
3580
+ R.cnvFilterPrompt = R.holder.append("div").style("display", "inline-block").style("margin-left", "10px").style("font-size", ".9em").attr("class", "sja_clbtext").on("click", () => {
3581
+ menu.clear().showunder(R.cnvFilterPrompt.node());
3582
+ const arg = {
3583
+ holder: menu.d.append("div"),
3584
+ cnvGainCutoff: tk.cnv.cnvGainCutoff,
3585
+ cnvLossCutoff: tk.cnv.cnvLossCutoff,
3586
+ cnvMaxLength: tk.cnv.cnvMaxLength,
3587
+ callback: (config) => {
3588
+ Object.assign(tk.cnv, config);
3589
+ menu.hide();
3590
+ tk.load();
3591
+ }
3592
+ };
3593
+ renderCnvConfig(arg);
3594
+ });
3595
+ }
3596
+ function may_update_cnv(tk) {
3597
+ if (!tk.cnv) return;
3598
+ if (!tk.cnv.cnvLst || tk.cnv.cnvLst.length == 0) {
3599
+ tk.legend.cnv.colorscaleHolder?.style("display", "none");
3600
+ tk.legend.cnv.cnvCategoryHolder?.style("display", "none");
3601
+ tk.legend.cnv.noCnv.style("display", tk.cnv.cnvInDensity ? "none" : "inline-block");
3602
+ } else {
3603
+ tk.legend.cnv.noCnv.style("display", "none");
3604
+ if (Number.isFinite(tk.cnv.cnvGainCutoff)) {
3605
+ tk.legend.cnv.colorscaleHolder.style("display", "inline-block");
3606
+ tk.legend.cnv.colorScale.colors = [tk.cnv.lossColor, "white", tk.cnv.gainColor];
3607
+ tk.legend.cnv.colorScale.domain = tk.cnv.presetMax ? [-tk.cnv.presetMax, 0, tk.cnv.presetMax] : [-tk.cnv.absoluteMax, 0, tk.cnv.absoluteMax];
3608
+ tk.legend.cnv.colorScale.updateScale();
3609
+ } else {
3610
+ if (!tk.hardcodeCnvOnly) {
3611
+ } else {
3612
+ tk.legend.cnv.cnvCategoryHolder.style("display", "inline-block").selectAll("*").remove();
3613
+ const class2count = /* @__PURE__ */ new Map();
3614
+ for (const c of tk.cnv.cnvLst) {
3615
+ if (!c.class) continue;
3616
+ class2count.set(c.class, 1 + (class2count.get(c.class) || 0));
3617
+ }
3618
+ for (const [cls, count] of [...class2count].sort((i, j) => j[1] - i[1])) {
3619
+ printCategory({
3620
+ holder: tk.legend.cnv.cnvCategoryHolder,
3621
+ key: cls,
3622
+ label: mclass[cls].label,
3623
+ color: mclass[cls].color,
3624
+ count,
3625
+ click: (event2) => {
3626
+ const opts = [
3627
+ {
3628
+ label: "Hide",
3629
+ isVisible: () => true,
3630
+ callback: () => {
3631
+ tk.legend.mclass.hiddenvalues.add(cls);
3632
+ }
3633
+ },
3634
+ {
3635
+ isChangeColor: true,
3636
+ value: mclass[cls].color,
3637
+ isVisible: () => true,
3638
+ callback: (colorValue) => {
3639
+ if (!mclass[cls].origColor) mclass[cls].origColor = mclass[cls].color;
3640
+ mclass[cls].color = colorValue;
3641
+ },
3642
+ reset: {
3643
+ isVisible: () => mclass[cls].origColor,
3644
+ callback: () => mclass[cls].color = mclass[cls].origColor
3645
+ }
3646
+ }
3647
+ ];
3648
+ createLegendTipMenu(opts, tk, event2.target);
3649
+ }
3650
+ });
3651
+ }
3652
+ for (const cls of tk.legend.mclass.hiddenvalues) {
3653
+ let loading = false;
3654
+ tk.legend.cnv.cnvCategoryHolder.append("div").style("display", "inline-block").attr("class", "sja_clb").style("text-decoration", "line-through").style("opacity", 0.7).text(mclass[cls].label).on("click", async (event2) => {
3655
+ if (loading) return;
3656
+ loading = true;
3657
+ tk.legend.mclass.hiddenvalues.delete(cls);
3658
+ event2.target.innerHTML = "Updating...";
3659
+ await tk.load();
3660
+ });
3661
+ }
3662
+ }
3663
+ }
3664
+ }
3665
+ const lst = [];
3666
+ if (Number.isFinite(tk.cnv.cnvGainCutoff)) {
3667
+ lst.push(`CNV gain \u2265 ${tk.cnv.cnvGainCutoff}`);
3668
+ }
3669
+ if (Number.isFinite(tk.cnv.cnvLossCutoff)) {
3670
+ lst.push(`CNV loss \u2264 ${tk.cnv.cnvLossCutoff}`);
3671
+ }
3672
+ if (Number.isFinite(tk.cnv.cnvMaxLength)) {
3673
+ lst.push(`CNV length \u2264 ${bplen(tk.cnv.cnvMaxLength)}`);
3674
+ } else {
3675
+ lst.push("no length limit");
3676
+ }
3677
+ tk.legend.cnv.cnvFilterPrompt.text(`Filter: ${lst.join("; ")}`);
3678
+ }
3679
+ function createLegendTipMenu(opts, tk, elem) {
3680
+ tk.legend.tip.clear().showunder(elem);
3681
+ for (const opt of opts) {
3682
+ if (opt.isVisible()) {
3683
+ if (opt.isChangeColor) {
3684
+ tk.legend.tip.d.append("div").style("padding", "5px 10px").style("display", "inline-block").text("Color:").append("input").attr("type", "color").property("value", rgb(opt.value).formatHex()).on("change", (event2) => {
3685
+ const color = event2.target.value;
3686
+ opt.callback(color);
3687
+ reload(tk);
3688
+ });
3689
+ if (opt.reset && opt.reset?.isVisible()) {
3690
+ const resetDiv = tk.legend.tip.d.append("div").style("display", "inline-block");
3691
+ const handler = () => {
3692
+ opt.reset.callback();
3693
+ reload(tk);
3694
+ };
3695
+ icons["restart"](resetDiv, { handler, title: "Reset to original color" });
3696
+ }
3697
+ } else if (opt.isChangeShape) {
3698
+ let called = false;
3699
+ const div = tk.legend.tip.d.append("div").text("Change shape").style("vertical-align", "middle").classed("sja_menuoption", true).attr("data-testid", "sjpp-change-shape-option").style("padding", "5px 10px").style("margin", "1px").style("border-radius", "0px").on("click", () => {
3700
+ div.classed("sja_menuoption", false);
3701
+ div.attr("data-testid", "sjpp-shape-picker");
3702
+ div.style("background-color", "white");
3703
+ if (called == false) {
3704
+ called = true;
3705
+ renderShapePicker({
3706
+ holder: div.append("div").style("margin-top", "10px"),
3707
+ callback: (val) => opt.callback(val, tk),
3708
+ tk
3709
+ });
3710
+ }
3711
+ });
3712
+ } else {
3713
+ tk.legend.tip.d.append("div").attr("class", "sja_menuoption").attr("data-testid", `sjpp-legend-option-${opt.label.toLowerCase().replace(/\s/g, "-")}`).style("border-radius", "0px").text(opt.label).on("click", () => {
3714
+ opt.callback();
3715
+ reload(tk);
3716
+ });
3717
+ }
3718
+ }
3719
+ }
3720
+ }
3721
+ function printCategory({ holder, key, color, count, label, click }) {
3722
+ const div = holder.append("div").attr("class", "sja_clb").style("display", "inline-block").on("click", click);
3723
+ div.append("div").style("display", "inline-block").attr("class", "sja_mcdot").style("background", color).html(count > 1 ? count : "&nbsp;");
3724
+ div.append("div").style("display", "inline-block").style("color", color).style("padding-left", "5px").attr("data-testid", "sjpp-mds3tk-legenditemlabel").attr("__key__", key).text(label);
3725
+ }
3726
+
3727
+ // mds3/filterName.js
3728
+ function getFilterName(f) {
3729
+ if (!Array.isArray(f?.lst)) return "Invalid filter";
3730
+ const lst = f.lst.filter((i) => i.tag != "cohortFilter");
3731
+ if (lst.length == 0) return "No filter";
3732
+ if (lst.length == 1 && lst[0].type == "tvs") {
3733
+ const tvs = lst[0].tvs;
3734
+ if (!tvs) throw "f.lst[0].tvs{} missing";
3735
+ switch (tvs?.term?.type) {
3736
+ case "categorical":
3737
+ if (!Array.isArray(tvs.values)) throw "f.lst[0].tvs.values not array";
3738
+ const catKey = tvs.values[0]?.key;
3739
+ if (catKey == void 0) throw "f.lst[0].tvs.values[0].key missing";
3740
+ const catValue = tvs.term.values?.[catKey]?.label || catKey;
3741
+ if (tvs.values.length == 1) {
3742
+ if ((tvs.term.name + catValue).length < 20) {
3743
+ return tvs.term.name + (tvs.isnot ? "!=" : ": ") + catValue;
3744
+ }
3745
+ return (tvs.isnot ? "!" : "") + (catValue.length < 15 ? catValue : catValue.substring(0, 13) + "...");
3746
+ }
3747
+ return `${tvs.isnot ? "!" : ""}${catValue.length < 12 ? catValue : catValue.substring(0, 10) + "..."} (${tvs.values.length})`;
3748
+ case "integer":
3749
+ case "float":
3750
+ case "geneExpression":
3751
+ case "metaboliteIntensity":
3752
+ case "proteomeAbundance":
3753
+ return getNumericRangeLabel(tvs);
3754
+ case "samplelst":
3755
+ return Object.keys(tvs.term.values)[0];
3756
+ default:
3757
+ for (const dtt of dtTerms) {
3758
+ if (dtt.type == tvs.term.type) {
3759
+ return (tvs.term.parentTerm?.name || "?") + " " + dtt.name;
3760
+ }
3761
+ }
3762
+ throw "unknown tvs term type";
3763
+ }
3764
+ }
3765
+ return "Filter (" + lst.length + ")";
3766
+ }
3767
+ function getNumericRangeLabel(tvs) {
3768
+ if (!Array.isArray(tvs.ranges)) throw "tvs.ranges not array";
3769
+ if (!tvs.ranges[0]) throw "tvs.ranges[] blank array";
3770
+ const r = tvs.ranges[0];
3771
+ let startName, stopName;
3772
+ const vc = tvs.term.valueConversion;
3773
+ if (vc) {
3774
+ if ("start" in r) startName = convertUnits(r.start, vc.fromUnit, vc.toUnit, vc.scaleFactor, true);
3775
+ if ("stop" in r) stopName = convertUnits(r.stop, vc.fromUnit, vc.toUnit, vc.scaleFactor, true);
3776
+ } else {
3777
+ if (tvs.term.type == "integer") {
3778
+ if ("start" in r) startName = Math.round(r.start);
3779
+ if ("stop" in r) stopName = Math.round(r.stop);
3780
+ } else {
3781
+ if ("start" in r) startName = r.start;
3782
+ if ("stop" in r) stopName = r.stop;
3783
+ if ("start" in r && "stop" in r) {
3784
+ ;
3785
+ [startName, stopName] = niceNumLabels([startName, stopName]);
3786
+ }
3787
+ }
3788
+ }
3789
+ let label;
3790
+ if (tvs.isnot) {
3791
+ if (r.startunbounded) label = `x ${r.stopinclusive ? ">" : ">="} ${stopName}`;
3792
+ else if (r.stopunbounded) label = `x ${r.startinclusive ? "<" : "<="} ${startName}`;
3793
+ else label = `!(${startName} ${stopName})`;
3794
+ } else {
3795
+ if (r.startunbounded) label = `x ${r.stopinclusive ? "<=" : "<"} ${stopName}`;
3796
+ else if (r.stopunbounded) label = `x ${r.startinclusive ? ">=" : ">"} ${startName}`;
3797
+ else label = `${startName}${r.startinclusive ? "<=" : "<"}x${r.stopinclusive ? "<=" : "<"}${stopName}`;
3798
+ }
3799
+ if (tvs.ranges.length > 1) label += "...";
3800
+ return label;
3801
+ }
3802
+
3803
+ // mds3/makeTk.js
3804
+ var callbacknames = [
3805
+ "onClose",
3806
+ // this only takes effect if tk shows the "Close" handle, e.g. on subtk
3807
+ "click_snvindel",
3808
+ "callbackOnRender",
3809
+ "disc_mouseover",
3810
+ "disc_mouseout"
3811
+ ];
3812
+ async function makeTk(tk, block) {
3813
+ tk.subtk2height = {
3814
+ skewer: 0,
3815
+ leftlabels: 0,
3816
+ cnv: 0
3817
+ };
3818
+ tk.leftlabels = {
3819
+ g: tk.gleft.append("g"),
3820
+ // all labels are rendered here, except track label
3821
+ doms: {},
3822
+ // keys: label name, value: label dom
3823
+ // to avoid having to delete all labels upon tk rendering
3824
+ laby: 0,
3825
+ // cumulative height, 0 for no labels
3826
+ xoff: 0,
3827
+ maxwidth: 0
3828
+ // set default 0 in case track runs into err, can still render tk
3829
+ };
3830
+ tk._finish = loadTk_finish_closure(tk, block);
3831
+ tk.cache = {};
3832
+ tk.itemtip = new Menu();
3833
+ tk.hovertip = new Menu();
3834
+ tk.menutip = new Menu({ padding: "" });
3835
+ tk.load = _load(tk, block);
3836
+ tk.mnamegetter = (m) => {
3837
+ if (tk.mds.queries?.snvindel?.vcfid4skewerName && m.vcf_id) return m.vcf_id;
3838
+ const s = m.mname;
3839
+ if (!s) return "";
3840
+ if (s.length > 25) {
3841
+ return s.substr(0, 20) + "...";
3842
+ }
3843
+ return s;
3844
+ };
3845
+ await get_ds(tk, block);
3846
+ await mayInitTermdb(tk, block);
3847
+ await mayInit_variant2samples(tk, block);
3848
+ mayaddGetter_m2csq(tk, block);
3849
+ mayInitSkewer(tk);
3850
+ mayInitCnv(tk);
3851
+ if (tk.filterObj) await Promise.all(rehydrateFilter(tk.filterObj, tk.mds.termdb.vocabApi));
3852
+ tk.tklabel.text(tk.mds.label || tk.name);
3853
+ tk.clear = () => {
3854
+ if (tk.skewer) tk.skewer.g.selectAll("*").remove();
3855
+ };
3856
+ initLegend(tk, block);
3857
+ init_mclass(tk);
3858
+ tk.color4disc = (m) => {
3859
+ if (tk.mutationColorBy) {
3860
+ if (tk.mutationColorBy == "hardcode") {
3861
+ if (m.color) return m.color;
3862
+ }
3863
+ }
3864
+ if (tk.mds.queries?.ld?.mOverlay?.data) {
3865
+ const m0 = tk.mds.queries.ld.mOverlay.m;
3866
+ if (m.chr == m0.chr && m.pos == m0.pos && m.ref == m0.ref && m.alt == m0.alt) {
3867
+ return tk.mds.queries.ld.overlay.color_1;
3868
+ }
3869
+ for (const m1 of tk.mds.queries.ld.mOverlay.data) {
3870
+ if (m1.pos == m.pos && m1.alleles == m.ref + "." + m.alt) {
3871
+ return tk.mds.queries.ld.colorScale(m1.r2);
3872
+ }
3873
+ }
3874
+ return tk.mds.queries.ld.overlay.color_0;
3875
+ }
3876
+ if (tk.vcfinfofilter && tk.vcfinfofilter.setidx4mclass != void 0) {
3877
+ const mcset = tk.vcfinfofilter.lst[tk.vcfinfofilter.setidx4mclass];
3878
+ const [err, vlst] = getter_mcset_key(mcset, m);
3879
+ if (err || vlst == void 0) return "black";
3880
+ for (const v of vlst) {
3881
+ if (mcset.categories[v]) {
3882
+ return mcset.categories[v].color;
3883
+ } else {
3884
+ return "black";
3885
+ }
3886
+ }
3887
+ }
3888
+ if (mclass[m.class]) {
3889
+ return mclass[m.class].color;
3890
+ }
3891
+ return "black";
3892
+ };
3893
+ parseUrl(tk);
3894
+ if (tk.hlssmid) {
3895
+ tk.skewer.hlssmid = new Set(tk.hlssmid.split(","));
3896
+ delete tk.hlssmid;
3897
+ }
3898
+ try {
3899
+ validateSelectSamples(tk);
3900
+ } catch (e) {
3901
+ console.error(e);
3902
+ }
3903
+ tk.duplicateTk = (filter) => {
3904
+ const tkarg = {
3905
+ type: "mds3",
3906
+ dslabel: tk.dslabel,
3907
+ filter0: tk.filter0,
3908
+ showCloseLeftlabel: true,
3909
+ filterObj: filter || structuredClone(tk.filterObj),
3910
+ allow2selectSamples: tk.allow2selectSamples,
3911
+ onClose: tk.onClose,
3912
+ callbackOnRender: tk.callbackOnRender,
3913
+ hardcodeCnvOnly: tk.hardcodeCnvOnly,
3914
+ token: tk.token
3915
+ // for testing
3916
+ };
3917
+ if (tk.cnv?.presetMax) tkarg.cnv = { presetMax: tk.cnv.presetMax };
3918
+ if (tk.legend.mclass?.hiddenvalues?.size) {
3919
+ tkarg.legend = { mclass: { hiddenvalues: /* @__PURE__ */ new Set() } };
3920
+ for (const v of tk.legend.mclass.hiddenvalues) tkarg.legend.mclass.hiddenvalues.add(v);
3921
+ }
3922
+ return tkarg;
3923
+ };
3924
+ for (const n of callbacknames) {
3925
+ if (tk[n] && typeof tk[n] != "function") throw `.${n}() is not function`;
3926
+ }
3927
+ }
3928
+ function loadTk_finish_closure(tk, block) {
3929
+ return (data) => {
3930
+ tk.legend?.headTd.text(tk.name + (tk.filterObj ? " - " + getFilterName(tk.filterObj) : ""));
3931
+ if (tk.cnv) {
3932
+ tk.cnv.g.transition().attr("transform", `translate(0,${tk.subtk2height.skewer})`);
3933
+ }
3934
+ if (data) {
3935
+ if (data.error) {
3936
+ tk.subtk2height.skewer = 40;
3937
+ } else {
3938
+ let totalCount = 0;
3939
+ if (data.skewer) totalCount = data.skewer.length;
3940
+ if (data.cnv) totalCount += data.cnv.length;
3941
+ if (data.cnvDensity) totalCount += data.cnvDensity.segmentCount;
3942
+ if (totalCount == 0) {
3943
+ let context = "view range";
3944
+ if (block.usegm && block.gmmode != "genomic") context = block.usegm.name || block.usegm.isoform;
3945
+ tk.skewer.g.append("text").text("No data in " + context).attr("y", 25).attr("x", block.width / 2).attr("text-anchor", "middle").attr("dominant-baseline", "center");
3946
+ tk.subtk2height.skewer = 40;
3947
+ }
3948
+ }
3949
+ }
3950
+ tk.height_main = Math.max(
3951
+ tk.subtk2height.leftlabels,
3952
+ // won't be added if tk crashed
3953
+ tk.subtk2height.skewer + tk.subtk2height.cnv
3954
+ ) + tk.toppad + tk.bottompad;
3955
+ if (data) {
3956
+ updateLegend(data, tk, block);
3957
+ }
3958
+ tk.leftLabelMaxwidth = Math.max(
3959
+ tk.leftlabels.maxwidth + tk.leftlabels.xoff,
3960
+ // tk.skewer.maxwidth is undefined if makeTk had exception. must yield valid value for leftLabelMaxwidth for block to show properly with err msg in tk body
3961
+ Number.isFinite(tk.skewer?.maxwidth) ? tk.skewer.maxwidth : 0
3962
+ );
3963
+ block.tkcloakoff(tk, { error: data ? data.error : null });
3964
+ block.block_setheight();
3965
+ block.setllabel();
3966
+ tk.callbackOnRender?.(tk, block);
3967
+ };
3968
+ }
3969
+ function parseUrl(tk) {
3970
+ const urlp = urlmap_default();
3971
+ if (tk.skewer) {
3972
+ if (urlp.has("hlaachange")) {
3973
+ tk.hlaachange = urlp.get("hlaachange");
3974
+ }
3975
+ if (urlp.has("hlssmid")) {
3976
+ tk.hlssmid = urlp.get("hlssmid").split(",");
3977
+ }
3978
+ }
3979
+ }
3980
+ function mayInitSkewer(tk) {
3981
+ if (!tk.mds.has_skewer) return;
3982
+ tk.skewer = {
3983
+ // both skewer and numeric mode will render elements into tk.skewer.g
3984
+ // will also attach skewer.discKickSelection
3985
+ g: tk.glider.append("g"),
3986
+ // border color of a box over a highlighted data
3987
+ hlBoxColor: tk.mds.hlBoxColor || "red",
3988
+ // default to show dot labels
3989
+ hideDotLabels: false,
3990
+ // true for pointing up
3991
+ pointup: true
3992
+ };
3993
+ setSkewerMode(tk);
3994
+ }
3995
+ function mayInitCnv(tk) {
3996
+ let cfg;
3997
+ if (tk.mds.termdbConfig?.queries?.cnv) {
3998
+ if (tk.mds.termdbConfig.queries.cnv.requiresHardcodeCnvOnlyFlag) {
3999
+ if (tk.hardcodeCnvOnly) {
4000
+ cfg = tk.mds.termdbConfig.queries.cnv;
4001
+ } else {
4002
+ }
4003
+ } else {
4004
+ cfg = tk.mds.termdbConfig.queries.cnv;
4005
+ }
4006
+ } else if (tk.custom_variants?.find((i) => i.dt == dtcnv)) {
4007
+ let useValue = false, useCat = false;
4008
+ for (const m of tk.custom_variants) {
4009
+ if (m.dt == dtcnv) {
4010
+ if (Number.isFinite(m.value)) useValue = true;
4011
+ else useCat = true;
4012
+ }
4013
+ }
4014
+ if (useValue && useCat) throw "custom cnv should be either using numeric value or not, but cannot be mixture";
4015
+ if (useValue) {
4016
+ cfg = {
4017
+ cnvGainCutoff: 0,
4018
+ // use 0 for not filtering and show all events
4019
+ cnvLossCutoff: 0
4020
+ };
4021
+ } else if (useCat) {
4022
+ cfg = {};
4023
+ } else {
4024
+ throw "custom cnv is neither value or category, should not happen";
4025
+ }
4026
+ }
4027
+ if (!cfg) return;
4028
+ if (!tk.cnv) tk.cnv = {};
4029
+ tk.cnv.g = tk.glider.append("g");
4030
+ tk.cnv.cnvMaxLength = cfg.cnvMaxLength;
4031
+ tk.cnv.cnvGainCutoff = cfg.cnvGainCutoff;
4032
+ tk.cnv.cnvLossCutoff = cfg.cnvLossCutoff;
4033
+ tk.cnv.absoluteValueRenderMax = cfg.absoluteValueRenderMax || 5;
4034
+ tk.cnv.gainColor = cfg.gainColor || "#D6683C";
4035
+ tk.cnv.lossColor = cfg.lossColor || "#67a9cf";
4036
+ tk.cnv.density = {
4037
+ barheight: 60
4038
+ };
4039
+ }
4040
+ function setSkewerMode(tk) {
4041
+ tk.skewer.viewModes = tk.skewerModes;
4042
+ delete tk.skewerModes;
4043
+ if (!tk.skewer.viewModes) tk.skewer.viewModes = [];
4044
+ const vm = tk.skewer.viewModes;
4045
+ if (!Array.isArray(vm)) throw "skewerModes[] is not array";
4046
+ if (tk.mds.skewerModes) {
4047
+ for (const n of tk.mds.skewerModes) vm.push(n);
4048
+ }
4049
+ if (!vm.find((n) => n.type == "skewer")) vm.push({ type: "skewer" });
4050
+ for (const n of vm) {
4051
+ if (typeof n != "object") throw "one of skewerModes[] is not object";
4052
+ if (n.type == "skewer") {
4053
+ if (!n.label) n.label = "lollipops";
4054
+ } else if (n.type == "numeric") {
4055
+ if (n.byAttribute) {
4056
+ if (!n.label) n.label = n.byAttribute;
4057
+ } else if (n.byInfo) {
4058
+ } else {
4059
+ throw "unknown data method for a type=numeric mode";
4060
+ }
4061
+ } else {
4062
+ throw "unknown type from a skewerModes[]";
4063
+ }
4064
+ }
4065
+ if (!vm.find((n) => n.inuse)) vm[0].inuse = true;
4066
+ }
4067
+ function init_mclass(tk) {
4068
+ if (tk.mds.hiddenmclass) {
4069
+ for (const c of tk.mds.hiddenmclass) tk.legend.mclass.hiddenvalues.add(c);
4070
+ }
4071
+ }
4072
+ async function get_ds(tk, block) {
4073
+ if (tk.dslabel) {
4074
+ const data = await dofetch3("getDataset", { body: { genome: block.genome.name, dsname: tk.dslabel } });
4075
+ if (data.error) throw "Error: " + data.error;
4076
+ if (!data.ds) throw "data.ds{} missing";
4077
+ if (!data.ds.isMds3) throw "A legacy dataset cannot be loaded as a mds3 track";
4078
+ tk.mds = data.ds;
4079
+ tk.name = data.ds.label;
4080
+ return;
4081
+ }
4082
+ if (!tk.name) tk.name = "Custom data";
4083
+ tk.mds = {};
4084
+ if (tk.bcf) {
4085
+ if (!tk.bcf.file && !tk.bcf.url) throw "file or url missing for tk.bcf{}";
4086
+ tk.mds.has_skewer = true;
4087
+ await getbcfheader_customtk(tk, block.genome);
4088
+ } else if (tk.custom_variants) {
4089
+ validateCustomVariants(tk, block);
4090
+ mayDeriveSkewerOccurrence4samples(tk);
4091
+ mayAddInfoField(tk);
4092
+ } else {
4093
+ throw "unknown data source for custom track";
4094
+ }
4095
+ mayProcessSampleAnnotation(tk);
4096
+ }
4097
+ function mayProcessSampleAnnotation(tk) {
4098
+ if (!tk.sampleAnnotation) return;
4099
+ if (!Array.isArray(tk.sampleAnnotation.terms)) throw "sampleAnnotation.terms is not array";
4100
+ if (!tk.mds.termdb) tk.mds.termdb = {};
4101
+ tk.mds.termdb.terms = tk.sampleAnnotation.terms;
4102
+ tk.mds.termdb.annotations = tk.sampleAnnotation.annotations;
4103
+ }
4104
+ async function mayInitTermdb(tk, block) {
4105
+ const tdb = tk.mds.termdb;
4106
+ if (!tdb) return;
4107
+ {
4108
+ const arg = {};
4109
+ if (tk.mds.label) {
4110
+ arg.vocab = {
4111
+ genome: block.genome.name,
4112
+ dslabel: tk.mds.label
4113
+ };
4114
+ } else if (tdb.terms) {
4115
+ arg.vocab = {
4116
+ terms: tdb.terms,
4117
+ sampleannotation: tdb.annotations
4118
+ };
4119
+ } else {
4120
+ throw "do not know how to init vocab";
4121
+ }
4122
+ const _ = await import("./vocabulary-4MPFHKYC.js");
4123
+ tdb.vocabApi = _.vocabInit(arg);
4124
+ if (!tdb.vocabApi.app) {
4125
+ tdb.vocabApi.app = { opts: { genome: block.genome } };
4126
+ }
4127
+ }
4128
+ tk.mds.termdbConfig = await tdb.vocabApi.getTermdbConfig();
4129
+ if (tk.mds.termdb.allowCaseDetails) {
4130
+ tk.mds.termdb.allowCaseDetails.get = async (acase) => {
4131
+ };
4132
+ }
4133
+ }
4134
+ function mayaddGetter_m2csq(tk, block) {
4135
+ if (!tk.mds.queries?.snvindel?.m2csq) return;
4136
+ tk.mds.queries.snvindel.m2csq.get = async (m) => {
4137
+ const body = { genome: block.genome.name, dslabel: tk.mds.label, m2csq: 1 };
4138
+ if (tk.mds.queries.snvindel.m2csq.by == "ssm_id") {
4139
+ body.ssm_id = m.ssm_id;
4140
+ } else {
4141
+ return { error: "unknown query method" };
4142
+ }
4143
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4144
+ if (tk.token) headers["X-Auth-Token"] = tk.token;
4145
+ return await dofetch3("mds3", { body, headers }, { serverData: tk.cache });
4146
+ };
4147
+ }
4148
+ async function mayInit_variant2samples(tk, block) {
4149
+ if (!tk.mds.variant2samples) return;
4150
+ if (tk.custom_variants) {
4151
+ addV2Sgetter_custom(tk, block);
4152
+ } else {
4153
+ addV2Sgetter_native(tk, block);
4154
+ }
4155
+ if (tk.mds.variant2samples.twLst) {
4156
+ if (!Array.isArray(tk.mds.variant2samples.twLst)) throw "v2s.twLst[] not array";
4157
+ if (!tk.mds.termdb?.vocabApi) throw "mds.termdb.vocabApi should be present for initiating v2s.twLst";
4158
+ for (const t of tk.mds.variant2samples.twLst) await fillTermWrapper(t, tk.mds.termdb.vocabApi);
4159
+ }
4160
+ }
4161
+ function addV2Sgetter_custom(tk, block) {
4162
+ tk.mds.variant2samples.get = (arg) => {
4163
+ if (arg.querytype == tk.mds.variant2samples.type_samples) {
4164
+ const samples = [];
4165
+ for (const m of arg.mlst) {
4166
+ if (!m.samples) continue;
4167
+ for (const s of m.samples) {
4168
+ const s2 = JSON.parse(JSON.stringify(s));
4169
+ s2.ssm_id = m.ssm_id;
4170
+ samples.push(s2);
4171
+ }
4172
+ }
4173
+ return { samples };
4174
+ }
4175
+ if (arg.querytype == tk.mds.variant2samples.type_summary) {
4176
+ throw "todo: summary";
4177
+ }
4178
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4179
+ throw "todo: sunburst";
4180
+ }
4181
+ throw "unknown querytype";
4182
+ };
4183
+ tk.mds.getSamples = () => {
4184
+ const id2sample = /* @__PURE__ */ new Map();
4185
+ for (const m of tk.custom_variants) {
4186
+ if (!m.samples) continue;
4187
+ for (const s of m.samples) {
4188
+ if (id2sample.has(s.sample_id)) {
4189
+ id2sample.get(s.sample_id).ssm_id_lst.push(m.ssm_id);
4190
+ } else {
4191
+ const s2 = JSON.parse(JSON.stringify(s));
4192
+ s2.ssm_id_lst = [m.ssm_id];
4193
+ id2sample.set(s.sample_id, s2);
4194
+ }
4195
+ }
4196
+ }
4197
+ return { samples: [...id2sample.values()] };
4198
+ };
4199
+ }
4200
+ function addV2Sgetter_native(tk, block) {
4201
+ tk.mds.variant2samples.get = async (arg) => {
4202
+ const par = {
4203
+ genome: block.genome.name,
4204
+ variant2samples: 1,
4205
+ get: arg.querytype,
4206
+ hardcodeCnvOnly: tk.hardcodeCnvOnly
4207
+ };
4208
+ if (tk.cnv) {
4209
+ if (tk.cnv.cnvMaxLength) par.cnvMaxLength = tk.cnv.cnvMaxLength;
4210
+ if (tk.cnv.cnvGainCutoff) par.cnvGainCutoff = tk.cnv.cnvGainCutoff;
4211
+ if (tk.cnv.cnvLossCutoff) par.cnvLossCutoff = tk.cnv.cnvLossCutoff;
4212
+ }
4213
+ if (tk.mds.label) {
4214
+ par.dslabel = tk.mds.label;
4215
+ } else if (tk.bcf) {
4216
+ if (tk.bcf.file) par.bcffile = tk.bcf.file;
4217
+ else if (tk.bcf.url) par.bcfurl = tk.bcf.url;
4218
+ else throw "tk.bcf{}: file/url missing";
4219
+ } else {
4220
+ throw "no dslabel or tk.bcf";
4221
+ }
4222
+ if (arg.groupSsmBySample) {
4223
+ par.groupSsmBySample = 1;
4224
+ }
4225
+ if (arg.mlst) {
4226
+ if (tk.mds.variant2samples.variantkey == "ssm_id") {
4227
+ par.ssm_id_lst = arg.mlst.map((i) => i.ssm_id).join(",");
4228
+ } else {
4229
+ throw "unknown variantkey for variant2samples";
4230
+ }
4231
+ }
4232
+ if (arg.isoform) {
4233
+ par.isoform = arg.isoform;
4234
+ }
4235
+ if (arg.rglst) {
4236
+ par.rglst = arg.rglst;
4237
+ }
4238
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4239
+ if (tk.set_id) par.set_id = tk.set_id;
4240
+ if (tk.token) headers["X-Auth-Token"] = tk.token;
4241
+ if (tk.filter0) par.filter0 = tk.filter0;
4242
+ if (tk.filterObj) par.filterObj = tk.filterObj;
4243
+ if (arg.tid2value) par.tid2value = arg.tid2value;
4244
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4245
+ if (tk.mds.variant2samples.sunburst_twLst) {
4246
+ par.twLst = tk.mds.variant2samples.sunburst_twLst;
4247
+ }
4248
+ } else if (arg.querytype == tk.mds.variant2samples.type_samples) {
4249
+ if (tk.mds.variant2samples.twLst) par.twLst = tk.mds.variant2samples.twLst;
4250
+ } else if (arg.querytype == tk.mds.variant2samples.type_summary) {
4251
+ if (tk.mds.variant2samples.twLst) par.twLst = tk.mds.variant2samples.twLst;
4252
+ } else {
4253
+ throw "unknown querytype";
4254
+ }
4255
+ par.skewerRim = tk.mds.queries.snvindel?.skewerRim;
4256
+ if (tk.legend?.formatFilter) {
4257
+ const filter = {};
4258
+ for (const k in tk.legend.formatFilter) {
4259
+ if (tk.legend.formatFilter[k].hiddenvalues.size) {
4260
+ filter[k] = [...tk.legend.formatFilter[k].hiddenvalues];
4261
+ }
4262
+ }
4263
+ if (Object.keys(filter).length) {
4264
+ par.formatFilter = filter;
4265
+ }
4266
+ }
4267
+ if (tk.legend?.mclass?.hiddenvalues?.size) {
4268
+ par.hiddenmclasslst = JSON.stringify([...tk.legend.mclass.hiddenvalues]);
4269
+ }
4270
+ const data = await dofetch3("mds3", { body: par, headers }, { serverData: tk.cache });
4271
+ if (data.error) throw data.error;
4272
+ const r = data.variant2samples;
4273
+ if (!r) throw "result error";
4274
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4275
+ if (!Array.isArray(r.nodes)) throw "nodes[] not array from return";
4276
+ } else if (arg.querytype == tk.mds.variant2samples.type_samples) {
4277
+ if (!Array.isArray(r.samples)) throw "samples[] not array from return";
4278
+ } else if (arg.querytype == tk.mds.variant2samples.type_summary) {
4279
+ if (!Array.isArray(r.summary)) throw "summary[] not array from return";
4280
+ } else {
4281
+ throw "unknown querytype";
4282
+ }
4283
+ return r;
4284
+ };
4285
+ tk.mds.getSamples = async (arg = {}) => {
4286
+ if (arg.isSummary) {
4287
+ arg.querytype = tk.mds.variant2samples.type_summary;
4288
+ } else {
4289
+ arg.querytype = tk.mds.variant2samples.type_samples;
4290
+ arg.groupSsmBySample = 1;
4291
+ }
4292
+ rangequery_rglst(tk, block, arg);
4293
+ return await tk.mds.variant2samples.get(arg);
4294
+ };
4295
+ }
4296
+ function _load(tk, block) {
4297
+ return async () => {
4298
+ return await loadTk(tk, block);
4299
+ };
4300
+ }
4301
+ function getter_mcset_key(mcset, m) {
4302
+ if (mcset.altalleleinfo) {
4303
+ if (!m.altinfo) return ["no .altinfo"];
4304
+ const value = m.altinfo[mcset.altalleleinfo.key];
4305
+ if (value == void 0) {
4306
+ if (mcset.numericfilter) {
4307
+ return [null, [0]];
4308
+ }
4309
+ return [null, void 0];
4310
+ }
4311
+ let vlst = Array.isArray(value) ? value : [value];
4312
+ if (mcset.altalleleinfo.separator) {
4313
+ vlst = vlst[0].split(mcset.altalleleinfo.separator);
4314
+ }
4315
+ return [null, vlst];
4316
+ }
4317
+ if (mcset.locusinfo) {
4318
+ if (!m.info) return ["no .info"];
4319
+ const value = m.info[mcset.locusinfo.key];
4320
+ if (value == void 0) {
4321
+ if (mcset.numericfilter) {
4322
+ return [null, [0]];
4323
+ }
4324
+ return [null, void 0];
4325
+ }
4326
+ let vlst = Array.isArray(value) ? value : [value];
4327
+ if (mcset.locusinfo.separator) {
4328
+ vlst = vlst[0].split(mcset.locusinfo.separator);
4329
+ }
4330
+ return [null, vlst];
4331
+ }
4332
+ return ["no trigger"];
4333
+ }
4334
+ function validateCustomVariants(tk, block) {
4335
+ for (const m of tk.custom_variants) {
4336
+ if (m.dt == dtsnvindel) {
4337
+ tk.mds.has_skewer = true;
4338
+ validateCustomSnvindel(m);
4339
+ continue;
4340
+ }
4341
+ if (m.dt == dtfusionrna || m.dt == dtsv) {
4342
+ tk.mds.has_skewer = true;
4343
+ validateCustomSvfusion(m, block);
4344
+ continue;
4345
+ }
4346
+ if (m.dt == dtcnv) {
4347
+ m.ssm_id = [m.chr, m.start, m.stop, m.class].join(ssmIdFieldsSeparator);
4348
+ continue;
4349
+ }
4350
+ throw "unknown dt for a custom variant";
4351
+ }
4352
+ }
4353
+ function validateCustomSnvindel(m) {
4354
+ if (!m.chr) throw ".chr missing for custom snvindel";
4355
+ if (!Number.isInteger(m.pos)) throw ".pos not integer for custom snvindel";
4356
+ if (!m.ssm_id) {
4357
+ m.ssm_id = [m.chr, m.pos, m.ref && m.alt ? m.ref + ssmIdFieldsSeparator + m.alt : m.mname].join(
4358
+ ssmIdFieldsSeparator
4359
+ );
4360
+ }
4361
+ }
4362
+ function validateCustomSvfusion(m, block) {
4363
+ if (m.pairlst) {
4364
+ } else {
4365
+ if (!m.chr1) throw ".chr1 missing for custom sv/fusion";
4366
+ if (!Number.isInteger(m.pos1)) throw ".pos1 not integer for custom svfusion";
4367
+ if (m.strand1 != "+" && m.strand1 != "-") throw ".strand1 not +/- for custom svfusion";
4368
+ if (!m.chr2) throw ".chr1 missing for custom sv/fusion";
4369
+ if (!Number.isInteger(m.pos2)) throw ".pos1 not integer for custom svfusion";
4370
+ if (m.strand2 != "+" && m.strand2 != "-") throw ".strand1 not +/- for custom svfusion";
4371
+ m.pairlst = [
4372
+ {
4373
+ a: {
4374
+ chr: m.chr1,
4375
+ pos: m.pos1,
4376
+ strand: m.strand1,
4377
+ isoform: m.isoform1,
4378
+ name: m.gene1 || ""
4379
+ },
4380
+ b: {
4381
+ chr: m.chr2,
4382
+ pos: m.pos2,
4383
+ strand: m.strand2,
4384
+ isoform: m.isoform2,
4385
+ name: m.gene2 || ""
4386
+ }
4387
+ }
4388
+ ];
4389
+ delete m.chr1;
4390
+ delete m.pos1;
4391
+ delete m.strand1;
4392
+ delete m.gene1;
4393
+ delete m.chr2;
4394
+ delete m.pos2;
4395
+ delete m.strand2;
4396
+ delete m.gene2;
4397
+ delete m.isoform1;
4398
+ delete m.isoform2;
4399
+ }
4400
+ const fields = [m.dt];
4401
+ const hits = block.seekcoord(m.pairlst[0].a.chr, m.pairlst[0].a.pos);
4402
+ if (hits.length && hits[0].x > 0 && hits[0].x < block.width) {
4403
+ fields.push(...[m.pairlst[0].a.chr, m.pairlst[0].a.pos, m.pairlst[0].a.strand, 0, m.pairlst[0].a.name]);
4404
+ m.mname = m.pairlst[0].b.name || "";
4405
+ m.chr = m.pairlst[0].a.chr;
4406
+ m.pos = m.pairlst[0].a.pos;
4407
+ m.pairlstIdx = 0;
4408
+ } else {
4409
+ const hits2 = block.seekcoord(m.pairlst[0].b.chr, m.pairlst[0].b.pos);
4410
+ if (hits2.length && hits2[0].x > 0 && hits2[0].x < block.width) {
4411
+ fields.push(...[m.pairlst[0].b.chr, m.pairlst[0].b.pos, m.pairlst[0].b.strand, 1, m.pairlst[0].b.name]);
4412
+ m.mname = m.pairlst[0].a.name || "";
4413
+ m.chr = m.pairlst[0].b.chr;
4414
+ m.pos = m.pairlst[0].b.pos;
4415
+ m.pairlstIdx = 1;
4416
+ } else {
4417
+ }
4418
+ }
4419
+ m.ssm_id = fields.join(ssmIdFieldsSeparator);
4420
+ }
4421
+ function mayDeriveSkewerOccurrence4samples(tk) {
4422
+ if (tk.custom_variants.find((i) => i.occurrence != void 0)) {
4423
+ return;
4424
+ }
4425
+ for (const i of tk.custom_variants) {
4426
+ if (i.sample) {
4427
+ i.sample_id = i.sample;
4428
+ delete i.sample;
4429
+ }
4430
+ }
4431
+ if (!tk.custom_variants.find((i) => i.sample_id)) {
4432
+ return;
4433
+ }
4434
+ const ungrouped = [];
4435
+ const key2m = /* @__PURE__ */ new Map();
4436
+ for (const m of tk.custom_variants) {
4437
+ if (m.dt != dtsnvindel) {
4438
+ m.occurrence = 1;
4439
+ m.samples = [{ sample_id: m.sample_id }];
4440
+ delete m.sample_id;
4441
+ ungrouped.push(m);
4442
+ continue;
4443
+ }
4444
+ const key = [m.mname, m.chr, m.pos, m.ref, m.alt].join(ssmIdFieldsSeparator);
4445
+ const m2 = key2m.get(key);
4446
+ if (m2) {
4447
+ m2.occurrence++;
4448
+ m2.samples.push({
4449
+ sample_id: m.sample_id
4450
+ });
4451
+ } else {
4452
+ m.occurrence = 1;
4453
+ m.samples = [
4454
+ {
4455
+ sample_id: m.sample_id
4456
+ }
4457
+ ];
4458
+ delete m.sample_id;
4459
+ key2m.set(key, m);
4460
+ }
4461
+ }
4462
+ tk.custom_variants = ungrouped;
4463
+ for (const m of key2m.values()) tk.custom_variants.push(m);
4464
+ if (!tk.mds.variant2samples) tk.mds.variant2samples = {};
4465
+ const v = tk.mds.variant2samples;
4466
+ v.type_samples = "samples";
4467
+ v.type_summary = "summary";
4468
+ v.type_sunburst = "sunburst";
4469
+ }
4470
+ function mayAddInfoField(tk) {
4471
+ if (!tk.custom_variants.some((i) => i.info)) return;
4472
+ const info = {};
4473
+ for (const m of tk.custom_variants) {
4474
+ if (typeof m.info != "object") continue;
4475
+ for (const k in m.info) {
4476
+ const v = m.info[k];
4477
+ if (v == null || v == void 0) continue;
4478
+ if (!info[k]) info[k] = { ID: k, Number: ".", Type: "String", categories: {} };
4479
+ if (!info[k].categories[v]) info[k].categories[v] = {};
4480
+ }
4481
+ }
4482
+ for (const k in info) {
4483
+ const colors = getColors(Object.keys(info[k].categories).length);
4484
+ for (const c in info[k].categories) {
4485
+ info[k].categories[c].color = colors(c);
4486
+ }
4487
+ }
4488
+ tk.mds.bcf = { info };
4489
+ }
4490
+ async function getbcfheader_customtk(tk, genome) {
4491
+ const arg = { genome: genome.name };
4492
+ if (tk.bcf.file) {
4493
+ arg.file = tk.bcf.file;
4494
+ } else {
4495
+ arg.url = tk.bcf.url;
4496
+ if (tk.bcf.indexURL) arg.indexURL = tk.bcf.indexURL;
4497
+ }
4498
+ const data = await dofetch3("bcfheader", { body: arg });
4499
+ if (data.error) throw data.error;
4500
+ const [info, format2, samples, errs] = data.header;
4501
+ if (errs) throw "Error parsing VCF meta lines: " + errs.join("; ");
4502
+ tk.mds.bcf = {
4503
+ info,
4504
+ format: format2
4505
+ // can be null
4506
+ };
4507
+ if (samples?.length) {
4508
+ tk.mds.bcf.samples = samples;
4509
+ tk.mds.variant2samples = {
4510
+ //twLst:[], // TODO should not be required
4511
+ type_samples: "samples",
4512
+ variantkey: "ssm_id"
4513
+ };
4514
+ }
4515
+ if (!tk.mds.queries) tk.mds.queries = {};
4516
+ tk.mds.queries.snvindel = { forTrack: true };
4517
+ }
4518
+ function validateSelectSamples(tk) {
4519
+ const a = tk.allow2selectSamples;
4520
+ if (!a) return;
4521
+ if (!a.buttonText) a.buttonText = "Select samples";
4522
+ if (typeof a.buttonText != "string") throw "allow2selectSamples.buttonText value is not string";
4523
+ if (!a.attributes) a.attributes = [{ from: "sample_id", to: "sample_id" }];
4524
+ if (!Array.isArray(a.attributes)) throw "allow2selectSamples.attributes[] is not array";
4525
+ if (a.attributes.length == 0) throw "allow2selectSamples.attributes[] blank array";
4526
+ for (const i of a.attributes) {
4527
+ if (typeof i.from != "string" || !i.from) throw "allow2selectSamples.attributes.from is not string";
4528
+ if (typeof i.to != "string" || !i.to) throw "allow2selectSamples.attributes.to is not string";
4529
+ }
4530
+ if (typeof a.callback != "function") throw "allow2selectSamples.callback() is not function";
4531
+ a._cart = [];
4532
+ }
4533
+
4534
+ // mds3/cnv.js
4535
+ var maxRowHeight = 10;
4536
+ var maxTkHeight = 200;
4537
+ function getRowHeight(rows, tk) {
4538
+ let maxh = maxTkHeight;
4539
+ if (tk.subtk2height.skewer == 0) {
4540
+ maxh *= 2;
4541
+ }
4542
+ const v = maxh / rows.length;
4543
+ if (v > maxRowHeight) return [maxRowHeight, 1];
4544
+ if (v > 3) return [Math.floor(v), 1];
4545
+ if (v > 1) return [Math.floor(v), 0];
4546
+ return [v, 0];
4547
+ }
4548
+ function may_render_cnv(data, tk, block) {
4549
+ if (!tk.cnv) return;
4550
+ tk.cnv?.g.selectAll("*").remove();
4551
+ delete tk.cnv.cnvLst;
4552
+ delete tk.cnv.cnvInDensity;
4553
+ delete tk.cnv.cnvMsg;
4554
+ if (data.cnv) {
4555
+ if (!Array.isArray(data.cnv.cnvs)) throw "data.cnv.cnvs[] not array";
4556
+ tk.cnv.cnvMsg = data.cnv.cnvMsg;
4557
+ renderSegments(data, tk, block);
4558
+ return;
4559
+ }
4560
+ if (data.cnvDensity) {
4561
+ tk.cnv.cnvInDensity = true;
4562
+ tk.cnv.cnvMsg = data.cnvDensity.cnvMsg;
4563
+ renderDensity(data, tk, block);
4564
+ return;
4565
+ }
4566
+ tk.subtk2height.cnv = 0;
4567
+ if (tk.cnv) tk.cnv.cnvLst = [];
4568
+ }
4569
+ function renderDensity(data, tk, block) {
4570
+ tk.cnv.g.append("image").attr("width", block.width).attr("height", tk.cnv.density.barheight).attr("xlink:href", data.cnvDensity.gain.src).attr("data-testid", "sjpp-mds3tk-cnvdensityimg");
4571
+ tk.cnv.g.append("image").attr("width", block.width).attr("height", tk.cnv.density.barheight).attr("xlink:href", data.cnvDensity.loss.src).attr("y", tk.cnv.density.barheight);
4572
+ axisstyle({
4573
+ axis: tk.cnv.g.append("g").attr("transform", `translate(-1,0)`).call(
4574
+ axisRight().scale(linear().domain([0, data.cnvDensity.max]).range([tk.cnv.density.barheight, 0])).tickValues([0, data.cnvDensity.max])
4575
+ ),
4576
+ color: "black",
4577
+ showline: true
4578
+ });
4579
+ axisstyle({
4580
+ axis: tk.cnv.g.append("g").attr("transform", `translate(-1,${tk.cnv.density.barheight})`).call(
4581
+ axisRight().scale(linear().domain([0, data.cnvDensity.max]).range([0, tk.cnv.density.barheight])).tickValues([0, data.cnvDensity.max])
4582
+ ),
4583
+ color: "black",
4584
+ showline: true
4585
+ });
4586
+ tk.cnv.g.append("text").text("Gain").attr("font-size", block.labelfontsize * 0.9).attr("x", 5).attr("y", tk.cnv.density.barheight / 2);
4587
+ tk.cnv.g.append("text").text("Loss").attr("font-size", block.labelfontsize * 0.9).attr("x", 5).attr("y", tk.cnv.density.barheight * 1.5);
4588
+ tk.subtk2height.cnv = tk.cnv.density.barheight * 2;
4589
+ }
4590
+ function renderSegments(data, tk, block) {
4591
+ const [cnvBySample, cnvLst, absoluteMax] = prepData(data, tk, block);
4592
+ tk.cnv.cnvLst = cnvLst;
4593
+ tk.cnv.absoluteMax = absoluteMax;
4594
+ tk.cnv.colorScale = linear(
4595
+ tk.cnv.presetMax ? [-tk.cnv.presetMax, 0, tk.cnv.presetMax] : [-absoluteMax, 0, absoluteMax],
4596
+ [tk.cnv.lossColor, "white", tk.cnv.gainColor]
4597
+ ).clamp(true);
4598
+ const [rowheight, rowspace] = getRowHeight(cnvBySample || cnvLst, tk);
4599
+ if (cnvBySample) {
4600
+ for (const sample of cnvBySample) {
4601
+ for (const c of sample.cnvs) {
4602
+ plotOneSegment(c, sample.y * (rowheight + rowspace), rowheight, tk, block, sample);
4603
+ }
4604
+ }
4605
+ } else {
4606
+ for (const c of cnvLst) {
4607
+ plotOneSegment(c, c.y * (rowheight + rowspace), rowheight, tk, block);
4608
+ }
4609
+ }
4610
+ const rowc = (cnvBySample || cnvLst).length;
4611
+ tk.subtk2height.cnv = rowc * rowheight + (rowc - 1) * rowspace;
4612
+ }
4613
+ function prepData(data, tk, block) {
4614
+ let maxAbsoluteValue = 0;
4615
+ const sample2cnv = /* @__PURE__ */ new Map();
4616
+ const cnvLst = [];
4617
+ for (const v of data.cnv.cnvs) {
4618
+ if (!v.chr) continue;
4619
+ if (!Number.isInteger(v.start) || !Number.isInteger(v.stop)) continue;
4620
+ const t1 = block.seekcoord(v.chr, v.start)[0];
4621
+ if (!t1) continue;
4622
+ const t2 = block.seekcoord(v.chr, v.stop)[0];
4623
+ if (!t2) continue;
4624
+ const j = structuredClone(v);
4625
+ if (t1.x > t2.x) {
4626
+ j.x1 = t2.x;
4627
+ j.x2 = t1.x;
4628
+ } else {
4629
+ j.x1 = t1.x;
4630
+ j.x2 = t2.x;
4631
+ }
4632
+ if (Number.isFinite(v.value)) maxAbsoluteValue = Math.max(maxAbsoluteValue, Math.abs(v.value));
4633
+ cnvLst.push(j);
4634
+ if (Array.isArray(v.samples)) {
4635
+ for (const s of v.samples) {
4636
+ if (!sample2cnv.has(s.sample_id)) sample2cnv.set(s.sample_id, []);
4637
+ sample2cnv.get(s.sample_id).push(structuredClone(j));
4638
+ }
4639
+ }
4640
+ }
4641
+ let samples;
4642
+ if (sample2cnv.size) {
4643
+ samples = [];
4644
+ for (const [s, cnvs] of sample2cnv) {
4645
+ cnvs.sort((a, b) => a.x1 - b.x1);
4646
+ samples.push({
4647
+ sample_id: s,
4648
+ cnvs,
4649
+ x1: Math.min(...cnvs.map((i) => i.x1)),
4650
+ x2: Math.max(...cnvs.map((i) => i.x2))
4651
+ });
4652
+ }
4653
+ samples.sort((a, b) => a.x1 - b.x1);
4654
+ for (let i = 0; i < samples.length; i++) samples[i].y = i;
4655
+ } else {
4656
+ cnvLst.sort((a, b) => a.x1 - b.x1);
4657
+ stackRows(cnvLst, 0);
4658
+ }
4659
+ return [samples, cnvLst, Math.min(tk.cnv.absoluteValueRenderMax, maxAbsoluteValue)];
4660
+ }
4661
+ function plotOneSegment(c, y, rowheight, tk, block, sample) {
4662
+ const x1 = Math.max(0, c.x1), x2 = Math.min(c.x2, block.width);
4663
+ tk.cnv.g.append("rect").attr("x", x1).attr("y", y).attr("width", x2 - x1).attr("height", Math.max(rowheight, 1)).attr("fill", Number.isFinite(c.value) ? tk.cnv.colorScale(c.value) : mclass[c.class].color).on("mouseover", (event2) => {
4664
+ event2.target.setAttribute("stroke", "black");
4665
+ tk.hovertip.clear().show(event2.clientX, event2.clientY);
4666
+ const table = table2col({ holder: tk.hovertip.d });
4667
+ table_cnv({ mlst: [c], tk }, table);
4668
+ if (sample) {
4669
+ const [t1, t2] = table.addRow();
4670
+ t1.text("Sample");
4671
+ t2.text(sample.sample_id);
4672
+ }
4673
+ }).on("mouseout", (event2) => {
4674
+ event2.target.setAttribute("stroke", "");
4675
+ tk.hovertip.hide();
4676
+ }).on("click", async (event2) => {
4677
+ tk.itemtip.clear().show(event2.clientX, event2.clientY);
4678
+ await itemtable_oneItem({
4679
+ mlst: [c],
4680
+ tk,
4681
+ block,
4682
+ div: tk.itemtip.d
4683
+ });
4684
+ return;
4685
+ const table = table2col({ holder: tk.itemtip.d });
4686
+ const cnv = structuredClone(c);
4687
+ if (sample) {
4688
+ cnv.samples = [{ sample_id: sample.sample_id }];
4689
+ }
4690
+ table_cnv({ mlst: [cnv], tk }, table, true);
4691
+ });
4692
+ }
4693
+ function stackRows(lst, spacing) {
4694
+ const stacks = [];
4695
+ for (const item of lst) {
4696
+ for (let i = 0; i < stacks.length; i++) {
4697
+ if (stacks[i] + spacing < item.x1) {
4698
+ stacks[i] = item.x2;
4699
+ item.y = i;
4700
+ break;
4701
+ }
4702
+ }
4703
+ if (!("y" in item)) {
4704
+ item.y = stacks.length;
4705
+ stacks.push(item.x2);
4706
+ }
4707
+ }
4708
+ }
4709
+
4710
+ // mds3/tk.js
4711
+ async function loadTk(tk, block) {
4712
+ block.tkcloakon(tk);
4713
+ block.block_setheight();
4714
+ try {
4715
+ if (!tk.mds || tk.uninitialized) {
4716
+ await makeTk(tk, block);
4717
+ }
4718
+ const data = await getTkData(tk, block);
4719
+ if (tk.uninitialized) {
4720
+ tk.clear();
4721
+ delete tk.uninitialized;
4722
+ }
4723
+ may_render_skewer(data, tk, block);
4724
+ may_render_cnv(data, tk, block);
4725
+ await make_leftlabels(data, tk, block);
4726
+ tk._finish(data);
4727
+ } catch (e) {
4728
+ if (tk.clear) tk.clear();
4729
+ if (tk.subtk2height) tk.subtk2height.skewer = 50;
4730
+ if (tk._finish) tk._finish({ error: e.message || e });
4731
+ if (e.stack) console.log(e.stack);
4732
+ return;
4733
+ }
4734
+ }
4735
+ function getParameter(tk, block) {
4736
+ const par = {
4737
+ genome: block.genome.name,
4738
+ // instructs server to return data types associated with tracks
4739
+ // including skewer or non-skewer
4740
+ forTrack: 1,
4741
+ // may not pass skewerRim if it is not in use (turn off)
4742
+ skewerRim: tk.mds.queries?.snvindel?.skewerRim,
4743
+ // instructions for counting rim counts per variant
4744
+ hardcodeCnvOnly: tk.hardcodeCnvOnly
4745
+ };
4746
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4747
+ par.skewer = 1;
4748
+ if (tk.set_id) {
4749
+ par.set_id = tk.set_id;
4750
+ }
4751
+ if (tk.filter0) {
4752
+ par.filter0 = tk.filter0;
4753
+ }
4754
+ if (tk.filterObj) {
4755
+ if (tk.filterObj?.lst.length) {
4756
+ par.filterObj = tk.filterObj;
4757
+ }
4758
+ }
4759
+ if (tk.token) {
4760
+ headers["X-Auth-Token"] = tk.token;
4761
+ }
4762
+ if (tk.mds.label) {
4763
+ par.dslabel = tk.mds.label;
4764
+ } else {
4765
+ if (tk.bcf) {
4766
+ if (tk.bcf.file) {
4767
+ par.bcffile = tk.bcf.file;
4768
+ } else if (tk.bcf.url) {
4769
+ par.bcfurl = tk.bcf.url;
4770
+ if (tk.bcf.indexURL) par.bcfindexURL = tk.bcf.indexURL;
4771
+ } else {
4772
+ throw ".file and .url missing for tk.bcf{}";
4773
+ }
4774
+ }
4775
+ }
4776
+ rangequery_rglst(tk, block, par);
4777
+ if (tk.legend?.mclass.hiddenvalues.size) {
4778
+ par.hiddenmclasslst = JSON.stringify([...tk.legend.mclass.hiddenvalues]);
4779
+ }
4780
+ if (tk.legend?.bcfInfo) {
4781
+ const infoFilter = {};
4782
+ for (const k in tk.legend.bcfInfo) {
4783
+ if (tk.legend.bcfInfo[k].hiddenvalues.size) {
4784
+ infoFilter[k] = [...tk.legend.bcfInfo[k].hiddenvalues];
4785
+ }
4786
+ }
4787
+ if (Object.keys(infoFilter).length) {
4788
+ par.infoFilter = infoFilter;
4789
+ }
4790
+ }
4791
+ if (tk.legend?.formatFilter) {
4792
+ const filter = {};
4793
+ for (const k in tk.legend.formatFilter) {
4794
+ if (tk.legend.formatFilter[k].hiddenvalues.size) {
4795
+ filter[k] = [...tk.legend.formatFilter[k].hiddenvalues];
4796
+ }
4797
+ }
4798
+ if (Object.keys(filter).length) {
4799
+ par.formatFilter = filter;
4800
+ }
4801
+ }
4802
+ if (tk.cnv) {
4803
+ if (tk.cnv.cnvMaxLength) par.cnvMaxLength = tk.cnv.cnvMaxLength;
4804
+ if (tk.cnv.cnvGainCutoff) par.cnvGainCutoff = tk.cnv.cnvGainCutoff;
4805
+ if (tk.cnv.cnvLossCutoff) par.cnvLossCutoff = tk.cnv.cnvLossCutoff;
4806
+ par.cnvDensity = {
4807
+ width: block.width,
4808
+ barheight: tk.cnv.density.barheight,
4809
+ pcolor: tk.cnv.gainColor,
4810
+ ncolor: tk.cnv.lossColor
4811
+ };
4812
+ }
4813
+ return [par, headers];
4814
+ }
4815
+ async function getTkData(tk, block) {
4816
+ let data;
4817
+ if (tk.custom_variants) {
4818
+ data = await dataFromCustomVariants(tk, block);
4819
+ } else {
4820
+ const [body, headers] = getParameter(tk, block);
4821
+ data = await dofetch3("mds3", { body, headers });
4822
+ }
4823
+ if (data.error) throw data.error;
4824
+ return data;
4825
+ }
4826
+ function rangequery_rglst(tk, block, par) {
4827
+ if (typeof par != "object") throw "par{} is not object";
4828
+ let rglst = [];
4829
+ if (block.usegm) {
4830
+ const r = {
4831
+ chr: block.rglst[0].chr,
4832
+ reverse: block.rglst[0].reverse,
4833
+ width: 0,
4834
+ start: null,
4835
+ stop: null
4836
+ };
4837
+ for (let i = block.startidx; i <= block.stopidx; i++) {
4838
+ const j = block.rglst[i];
4839
+ r.width += j.width + block.regionspace;
4840
+ r.start = r.start == null ? j.start : Math.min(r.start, j.start);
4841
+ r.stop = r.stop == null ? j.stop : Math.max(r.stop, j.stop);
4842
+ }
4843
+ rglst.push(r);
4844
+ if (block.gmmode == "genomic") {
4845
+ } else {
4846
+ par.isoform = block.usegm.isoform;
4847
+ par.gene = block.usegm.name;
4848
+ }
4849
+ } else {
4850
+ rglst = block.tkarg_rglst(tk);
4851
+ }
4852
+ let xoff = 0;
4853
+ for (const r of rglst) {
4854
+ r.xoff = 0;
4855
+ xoff += r.width + block.regionspace;
4856
+ }
4857
+ if (block.subpanels.length == tk.subpanels.length) {
4858
+ for (const r of block.subpanels) {
4859
+ rglst.push({
4860
+ chr: r.chr,
4861
+ start: r.start,
4862
+ stop: r.stop,
4863
+ width: r.width,
4864
+ exonsf: r.exonsf,
4865
+ xoff
4866
+ });
4867
+ xoff += r.width + r.leftpad;
4868
+ }
4869
+ }
4870
+ par.rglst = rglst;
4871
+ par.regionspace = block.regionspace;
4872
+ par.devicePixelRatio = window.devicePixelRatio > 1 ? window.devicePixelRatio : 1;
4873
+ }
4874
+ async function dataFromCustomVariants(tk, block) {
4875
+ const data = {
4876
+ // these holder will contain subset of tk.custom_variants[] that are in view range
4877
+ skewer: [],
4878
+ // for non-cnv data
4879
+ cnv: {
4880
+ cnvs: []
4881
+ // for cnv segments
4882
+ }
4883
+ // adds mclass2variantcount[] later
4884
+ };
4885
+ let bbstart = null, bbstop;
4886
+ for (let i = block.startidx; i <= block.stopidx; i++) {
4887
+ if (bbstart == null) {
4888
+ bbstart = block.rglst[i].start;
4889
+ bbstop = block.rglst[i].stop;
4890
+ } else {
4891
+ bbstart = Math.min(bbstart, block.rglst[i].start);
4892
+ bbstop = Math.max(bbstop, block.rglst[i].stop);
4893
+ }
4894
+ }
4895
+ for (const m of tk.custom_variants) {
4896
+ if (tk.legend?.bcfInfo) {
4897
+ let skip = false;
4898
+ for (const infoKey in tk.legend.bcfInfo) {
4899
+ if (tk.legend.bcfInfo[infoKey].hiddenvalues?.size) {
4900
+ const v = m.info?.[infoKey] || unannotatedKey;
4901
+ if (tk.legend?.bcfInfo[infoKey].hiddenvalues.has(v)) {
4902
+ skip = true;
4903
+ break;
4904
+ }
4905
+ }
4906
+ }
4907
+ if (skip) continue;
4908
+ }
4909
+ if (m.dt == dtcnv) {
4910
+ if (m.chr != block.rglst[0].chr) continue;
4911
+ if (Math.max(m.start, bbstart) > Math.min(m.stop, bbstop)) continue;
4912
+ data.cnv.cnvs.push(m);
4913
+ } else if (m.dt == dtsnvindel || m.dt == dtsv || m.dt == dtfusionrna) {
4914
+ if (m.chr != block.rglst[0].chr) continue;
4915
+ if (m.pos <= bbstart || m.pos >= bbstop) continue;
4916
+ if (!m.class) m.class = "X";
4917
+ if (!mclass[m.class]) m.class = "X";
4918
+ if (tk.legend?.mclass.hiddenvalues.has(m.class)) continue;
4919
+ data.skewer.push(m);
4920
+ } else {
4921
+ throw "unknown custom data dt";
4922
+ }
4923
+ }
4924
+ data.mclass2variantcount = summarize_mclass([...data.skewer, ...data.cnv.cnvs]);
4925
+ if (data.cnv.cnvs.length == 0) delete data.cnv;
4926
+ const set = /* @__PURE__ */ new Set();
4927
+ if (data.skewer?.some((i) => i.samples)) {
4928
+ for (const m of data.skewer) {
4929
+ if (m.samples) {
4930
+ for (const s of m.samples) set.add(s.sample_id);
4931
+ }
4932
+ }
4933
+ }
4934
+ if (data.cnv?.cnvs?.some((i) => i.samples)) {
4935
+ for (const m of data.cnv.cnvs) {
4936
+ if (m.samples) {
4937
+ for (const s of m.samples) set.add(s.sample_id);
4938
+ }
4939
+ }
4940
+ }
4941
+ if (set.size) data.sampleTotalNumber = set.size;
4942
+ await mayDoLDoverlay(tk, data.skewer);
4943
+ return data;
4944
+ }
4945
+ async function mayDoLDoverlay(tk) {
4946
+ if (!tk.mds.queries?.ld?.mOverlay) return;
4947
+ if (!tk.mds.termdb?.vocabApi) return;
4948
+ delete tk.mds.queries.ld.mOverlay.data;
4949
+ const data = await tk.mds.termdb.vocabApi.getLDdata(tk.mds.queries.ld.mOverlay.ldtkname, tk.mds.queries.ld.mOverlay.m);
4950
+ if (data.error || !Array.isArray(data.lst)) return;
4951
+ tk.mds.queries.ld.mOverlay.data = data.lst;
4952
+ }
4953
+
4954
+ export {
4955
+ displaySampleTable,
4956
+ getFilterName,
4957
+ makelabel,
4958
+ loadTk,
4959
+ rangequery_rglst
4960
+ };
4961
+ //# sourceMappingURL=chunk-M7W2GYSM.js.map