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