@sjcrh/proteinpaint-client 2.180.0 → 2.180.1

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 (927) hide show
  1. package/dist/2dmaf-TA6JJ2OR.js +1371 -0
  2. package/dist/AIProjectAdmin-SAYM2UUO.js +830 -0
  3. package/dist/AppHeader-7TNVJJA7.js +833 -0
  4. package/dist/BoxPlot-IAROTQ5L.js +1184 -0
  5. package/dist/CorrelationVolcano-ZFSDE4PA.js +617 -0
  6. package/dist/DifferentialAnalysis-X44YRQNQ.js +238 -0
  7. package/dist/Disco-YI2INE5R.js +3199 -0
  8. package/dist/Disco-YI2INE5R.js.map +7 -0
  9. package/dist/Disco.UI-YWYNQSRV.js +242 -0
  10. package/dist/DmrPlot-5V5QL4VS.js +151 -0
  11. package/dist/GB-3P67R4TI.js +1125 -0
  12. package/dist/HicApp-GKI7GS7Y.js +2248 -0
  13. package/dist/NumBinaryEditor-FNIEMKOY.js +266 -0
  14. package/dist/NumBinaryEditor.unit.spec-CDHPXF7F.js +284 -0
  15. package/dist/NumContEditor-XICKQ4Y6.js +105 -0
  16. package/dist/NumContEditor.unit.spec-DVFH4SZT.js +167 -0
  17. package/dist/NumCustomBinEditor-ZMND7YMB.js +36 -0
  18. package/dist/NumCustomBinEditor.unit.spec-WLWD4FV2.js +282 -0
  19. package/dist/NumDiscreteEditor-H2GG4COK.js +170 -0
  20. package/dist/NumDiscreteEditor.unit.spec-OEREZ6HB.js +200 -0
  21. package/dist/NumRegularBinEditor-YGMQV7ZW.js +36 -0
  22. package/dist/NumRegularBinEditor.unit.spec-ZUTXFGGA.js +225 -0
  23. package/dist/NumSplineEditor-VPKCUM2U.js +188 -0
  24. package/dist/NumSplineEditor.unit.spec-IDEB3KAY.js +197 -0
  25. package/dist/NumericDensity-5DDVJBBW.js +36 -0
  26. package/dist/NumericDensity.unit.spec-KTOY3EON.js +219 -0
  27. package/dist/NumericHandler-XBY7A7TV.js +37 -0
  28. package/dist/NumericHandler.unit.spec-KKBJDLZY.js +217 -0
  29. package/dist/RunChart2-F4652KYJ.js +756 -0
  30. package/dist/SC-GKNVRMYL.js +725 -0
  31. package/dist/Volcano-ZHQFH2MP.js +1092 -0
  32. package/dist/WSIViewer-MU3YXF7I.js +46972 -0
  33. package/dist/WsiSamplesPlot-ZP3EAQLW.js +163 -0
  34. package/dist/adSandbox-7FIAWUBA.js +36 -0
  35. package/dist/alphaGenome-ACWK2XZL.js +173 -0
  36. package/dist/app-6V52ULRQ.js +47 -0
  37. package/dist/app-PP7JFYBG.js +35 -0
  38. package/dist/app.js +20 -20
  39. package/dist/bam-AESS7MP3.js +849 -0
  40. package/dist/barchart-BKWC5UXM.js +45 -0
  41. package/dist/barchart.data-BMH62H5G.js +22 -0
  42. package/dist/barchart.events-ZJSQB3KV.js +45 -0
  43. package/dist/barchart.integration.spec-6QOIOO6T.js +1675 -0
  44. package/dist/block-PH3K3TGJ.js +6300 -0
  45. package/dist/block.init-7LT7FK7V.js +36 -0
  46. package/dist/block.mds.expressionrank-RH25BI5W.js +357 -0
  47. package/dist/block.mds.geneboxplot-YX5SF65Z.js +826 -0
  48. package/dist/block.mds.junction-MXYEREFH.js +1543 -0
  49. package/dist/block.mds.svcnv-C5HEGIAK.js +6799 -0
  50. package/dist/block.svg-LZOSOJPZ.js +162 -0
  51. package/dist/block.tk.aicheck-YMMJJWD7.js +281 -0
  52. package/dist/block.tk.ase-IPQUSAE7.js +363 -0
  53. package/dist/block.tk.bam-HJLFTBGN.js +1904 -0
  54. package/dist/block.tk.bedgraphdot-5ZBNIQFY.js +382 -0
  55. package/dist/block.tk.bigwig.ui-V2GLBUU5.js +209 -0
  56. package/dist/block.tk.hicstraw-3NJLYMEJ.js +821 -0
  57. package/dist/block.tk.junction-C4CAACOA.js +2362 -0
  58. package/dist/block.tk.junction.textmatrixui-NJCGCHZ5.js +197 -0
  59. package/dist/block.tk.ld-PNX72F42.js +97 -0
  60. package/dist/block.tk.menu-AZ44SBLU.js +1027 -0
  61. package/dist/block.tk.pgv-AGD3EYGQ.js +942 -0
  62. package/dist/brainImaging-5DO3465Z.js +421 -0
  63. package/dist/chat-346IEKTC.js +147 -0
  64. package/dist/chunk-2GGOU75N.js +2672 -0
  65. package/dist/chunk-2GGOU75N.js.map +7 -0
  66. package/dist/chunk-2K5DSRBJ.js +84 -0
  67. package/dist/chunk-2K5DSRBJ.js.map +7 -0
  68. package/dist/chunk-2NVHNNBT.js +286 -0
  69. package/dist/chunk-2Q52VJDX.js +153 -0
  70. package/dist/chunk-2Q52VJDX.js.map +7 -0
  71. package/dist/chunk-2ZEGV5AG.js +370 -0
  72. package/dist/chunk-3W2QIOL2.js +4202 -0
  73. package/dist/chunk-3W2QIOL2.js.map +7 -0
  74. package/dist/chunk-46COTHPZ.js +1275 -0
  75. package/dist/chunk-46COTHPZ.js.map +7 -0
  76. package/dist/chunk-4D4SESA7.js +1413 -0
  77. package/dist/chunk-4D4SESA7.js.map +7 -0
  78. package/dist/chunk-4UAWJRR6.js +526 -0
  79. package/dist/chunk-4VGSBYQC.js +6364 -0
  80. package/dist/chunk-5MB65WAE.js +534 -0
  81. package/dist/chunk-6RUSW7HY.js +480 -0
  82. package/dist/chunk-6RUSW7HY.js.map +7 -0
  83. package/dist/chunk-6RXCKL6A.js +158 -0
  84. package/dist/chunk-72YYKDTX.js +330 -0
  85. package/dist/chunk-72YYKDTX.js.map +7 -0
  86. package/dist/chunk-7Q5X253Q.js +423 -0
  87. package/dist/chunk-7Q5X253Q.js.map +7 -0
  88. package/dist/chunk-A2UFOQ3B.js +170 -0
  89. package/dist/chunk-A4RBXF53.js +158 -0
  90. package/dist/chunk-AQ4OP4GR.js +39 -0
  91. package/dist/chunk-AUWK22ER.js +504 -0
  92. package/dist/chunk-AXOTFMIM.js +26 -0
  93. package/dist/chunk-CFXUDZWK.js +95 -0
  94. package/dist/chunk-CRRWBY4C.js +229 -0
  95. package/dist/chunk-D6VDBY2S.js +217 -0
  96. package/dist/chunk-DN52ILXL.js +293 -0
  97. package/dist/chunk-DTCFNQKZ.js +215 -0
  98. package/dist/chunk-ED3HWBZF.js +46 -0
  99. package/dist/chunk-EWTGCHU5.js +100 -0
  100. package/dist/chunk-FJ6KNGDS.js +226 -0
  101. package/dist/chunk-FVWCYGJL.js +121 -0
  102. package/dist/chunk-GM6H3CUI.js +177 -0
  103. package/dist/chunk-GQVM3NTV.js +615 -0
  104. package/dist/chunk-H3RU5NUZ.js +1155 -0
  105. package/dist/chunk-HEKX7RAT.js +406 -0
  106. package/dist/chunk-HGHRMQQO.js +203 -0
  107. package/dist/chunk-HIV4NSWS.js +205 -0
  108. package/dist/chunk-HMXYZXDN.js +1147 -0
  109. package/dist/chunk-IA6ZJ6ZS.js +629 -0
  110. package/dist/chunk-INROHUDU.js +272 -0
  111. package/dist/chunk-JEN6TGBR.js +228 -0
  112. package/dist/chunk-JGRIKYJE.js +92 -0
  113. package/dist/chunk-JGRIKYJE.js.map +7 -0
  114. package/dist/chunk-JGU7ERLS.js +2784 -0
  115. package/dist/chunk-K2CTY4BE.js +381 -0
  116. package/dist/chunk-K7PK3JQJ.js +194 -0
  117. package/dist/chunk-KDKY7S5G.js +1764 -0
  118. package/dist/chunk-KDKY7S5G.js.map +7 -0
  119. package/dist/chunk-KFRJ5LNK.js +334 -0
  120. package/dist/chunk-KKQON43X.js +102 -0
  121. package/dist/chunk-KKQON43X.js.map +7 -0
  122. package/dist/chunk-L4QG7XZE.js +46 -0
  123. package/dist/chunk-L4QG7XZE.js.map +7 -0
  124. package/dist/chunk-LAVSN35L.js +48 -0
  125. package/dist/chunk-LUW252RA.js +302 -0
  126. package/dist/chunk-MBYEA2R3.js +129 -0
  127. package/dist/chunk-NF34NHZM.js +4945 -0
  128. package/dist/chunk-NF34NHZM.js.map +7 -0
  129. package/dist/chunk-O55HHVQS.js +276 -0
  130. package/dist/chunk-O55HHVQS.js.map +7 -0
  131. package/dist/chunk-OGZPMUPF.js +446 -0
  132. package/dist/chunk-OJSG5RK5.js +52 -0
  133. package/dist/chunk-OM22RN7S.js +438 -0
  134. package/dist/chunk-OTK7UQ7K.js +252 -0
  135. package/dist/chunk-PJCALFS6.js +749 -0
  136. package/dist/chunk-Q3SI7IQ7.js +142 -0
  137. package/dist/chunk-RGAJYIKI.js +34 -0
  138. package/dist/chunk-RMQMUFIK.js +36 -0
  139. package/dist/chunk-RTKRLATH.js +247 -0
  140. package/dist/chunk-RTKRLATH.js.map +7 -0
  141. package/dist/chunk-SAHCLNNL.js +19974 -0
  142. package/dist/chunk-SAHCLNNL.js.map +7 -0
  143. package/dist/chunk-SMD5GI24.js +1087 -0
  144. package/dist/chunk-SMKRNNHY.js +462 -0
  145. package/dist/chunk-SNMJEDHY.js +815 -0
  146. package/dist/chunk-SOYDFNWV.js +1656 -0
  147. package/dist/chunk-SOYDFNWV.js.map +7 -0
  148. package/dist/chunk-T4PUAROY.js +368 -0
  149. package/dist/chunk-TEA3NTUR.js +31 -0
  150. package/dist/chunk-TECXLSHZ.js +147 -0
  151. package/dist/chunk-TV74I3Y5.js +43 -0
  152. package/dist/chunk-TV74I3Y5.js.map +7 -0
  153. package/dist/chunk-VDNVTMJ3.js +14 -0
  154. package/dist/chunk-VPRXRWOR.js +2815 -0
  155. package/dist/chunk-VQHUYWD6.js +261 -0
  156. package/dist/chunk-VQHUYWD6.js.map +7 -0
  157. package/dist/chunk-WVJKEXT7.js +98 -0
  158. package/dist/chunk-XEBPIJHM.js +168 -0
  159. package/dist/chunk-XEBPIJHM.js.map +7 -0
  160. package/dist/chunk-XQMDLYEK.js +119 -0
  161. package/dist/chunk-XQMDLYEK.js.map +7 -0
  162. package/dist/chunk-YBRYGRGG.js +237 -0
  163. package/dist/chunk-YBRYGRGG.js.map +7 -0
  164. package/dist/chunk-YFCDOHEK.js +146 -0
  165. package/dist/chunk-YMY73A3W.js +1201 -0
  166. package/dist/chunk-YUPIKHOC.js +107 -0
  167. package/dist/chunk-Z3BKMKQR.js +2370 -0
  168. package/dist/chunk-Z3BKMKQR.js.map +7 -0
  169. package/dist/chunk-Z5XHVPCP.js +386 -0
  170. package/dist/chunk-Z5XHVPCP.js.map +7 -0
  171. package/dist/chunk-ZGWYEVXK.js +54 -0
  172. package/dist/chunk-ZMY7LBL6.js +55 -0
  173. package/dist/condition-NJCZST5Q.js +330 -0
  174. package/dist/controls-F4X2WXQB.js +39 -0
  175. package/dist/controls.config-XGY3VBIY.js +37 -0
  176. package/dist/correlation-6VR3QLD5.js +96 -0
  177. package/dist/cuminc-ENV7RGH2.js +1147 -0
  178. package/dist/cuminc.integration.spec-SBZ4BINE.js +676 -0
  179. package/dist/customdata.inputui-DRCIAHVC.js +285 -0
  180. package/dist/dataDownload-E22OVEWA.js +328 -0
  181. package/dist/dataDownload.integration.spec-SHXBOHP7.js +191 -0
  182. package/dist/databrowser.ui-EY4MYHIN.js +419 -0
  183. package/dist/dictionary-RXSFDNVZ.js +98 -0
  184. package/dist/dnaMethylation-LBLLHMD4.js +36 -0
  185. package/dist/dnaMethylation.integration.spec-SCZSVS4Q.js +179 -0
  186. package/dist/e2pca-7Y4E37LV.js +348 -0
  187. package/dist/ep-3CMYYJHS.js +1254 -0
  188. package/dist/expclust.gdc.spec-PBOZFONS.js +305 -0
  189. package/dist/facet-VWQJBZCD.js +519 -0
  190. package/dist/geneExpClustering-FBKONWXK.js +246 -0
  191. package/dist/geneExpression-3K67HK7E.js +312 -0
  192. package/dist/geneExpression-3O5CGX4X.js +36 -0
  193. package/dist/geneExpression.unit.spec-PAWYATIF.js +100 -0
  194. package/dist/geneORA-4I7AQCHS.js +276 -0
  195. package/dist/geneVariant-6RSUL5BT.js +37 -0
  196. package/dist/geneVariant-IONFAQDH.js +39 -0
  197. package/dist/geneVariant.integration.spec-D5JQMXWA.js +196 -0
  198. package/dist/genefusion.ui-5TEA3V7M.js +249 -0
  199. package/dist/geneset-FPSUFQYL.js +194 -0
  200. package/dist/genomeBrowser.spec-37JOBDU3.js +279 -0
  201. package/dist/grin2-A7DYEQOC.js +1554 -0
  202. package/dist/grin2-YVFBDIJR.js +1031 -0
  203. package/dist/gsea-OQH53X4W.js +45 -0
  204. package/dist/hierCluster-2AQPDWQN.js +58 -0
  205. package/dist/hierCluster-H4EP5RK6.js +62 -0
  206. package/dist/hierCluster.config-OMHLRSMT.js +38 -0
  207. package/dist/hierCluster.integration.spec-EZC3DXH5.js +374 -0
  208. package/dist/hierCluster.integration.spec-EZC3DXH5.js.map +7 -0
  209. package/dist/hierCluster.interactivity-VD23UMI7.js +52 -0
  210. package/dist/hierCluster.renderers-ZKODOVW5.js +21 -0
  211. package/dist/imagePlot-5RQLP27H.js +139 -0
  212. package/dist/importPlot-R4LOYFA3.js +8 -0
  213. package/dist/launch.adhoc-7NRKGIIF.js +40 -0
  214. package/dist/leftlabel.sample-BSDNBLN4.js +256 -0
  215. package/dist/legacyDataset-4PBBW67M.js +119 -0
  216. package/dist/lollipop-L62KZOCL.js +166 -0
  217. package/dist/maf-4TQPFF46.js +442 -0
  218. package/dist/maftimeline-XIAKNULE.js +591 -0
  219. package/dist/matrix-H72HOOI5.js +57 -0
  220. package/dist/matrix-W6ARLZHT.js +62 -0
  221. package/dist/matrix.cells-AP4ENHAY.js +28 -0
  222. package/dist/matrix.config-HJURMAA2.js +39 -0
  223. package/dist/matrix.controls-77T2V4MM.js +37 -0
  224. package/dist/matrix.data-OPJXBHQF.js +25 -0
  225. package/dist/matrix.groups-RF5XZTIX.js +26 -0
  226. package/dist/matrix.integration.spec-NXFIEBAV.js +3070 -0
  227. package/dist/matrix.interactivity-KYV3I5NA.js +40 -0
  228. package/dist/matrix.layout-BKCT6WFO.js +42 -0
  229. package/dist/matrix.legend-DMR5WO2B.js +22 -0
  230. package/dist/matrix.renderers-YA45F4J3.js +36 -0
  231. package/dist/matrix.serieses-LIJYLDRY.js +21 -0
  232. package/dist/matrix.sort-MJXBZP5Z.js +27 -0
  233. package/dist/matrix.sort.unit.spec-XZ66MEFK.js +470 -0
  234. package/dist/matrix.sorterUi-RYZPGKNR.js +18 -0
  235. package/dist/matrix.sorterUi.unit.spec-5HLSSQDG.js +340 -0
  236. package/dist/mavb-6BDLX76H.js +730 -0
  237. package/dist/mds.fimo-JWUDO2YS.js +516 -0
  238. package/dist/mds.samplescatterplot-H5ZHOO3F.js +1548 -0
  239. package/dist/mds.survivalplot-6LJPCDUC.js +481 -0
  240. package/dist/oncomatrix-5TAYUFN7.js +293 -0
  241. package/dist/oncomatrix.spec-4J6ZQSCA.js +446 -0
  242. package/dist/plot.2dvaf-NEKUHMQA.js +375 -0
  243. package/dist/plot.app-CDA4NVBW.js +39 -0
  244. package/dist/plot.barplot-WPNGNPFU.js +100 -0
  245. package/dist/plot.boxplot-FBHMTSOE.js +150 -0
  246. package/dist/plot.brainImaging-53CS65FP.js +51 -0
  247. package/dist/plot.disco-477IKREB.js +101 -0
  248. package/dist/plot.dzi-37H4EUKF.js +33 -0
  249. package/dist/plot.ssgq-WR3HFXR4.js +137 -0
  250. package/dist/plot.vaf2cov-FCGREDI7.js +257 -0
  251. package/dist/plot.wsi-HO3DYKJ6.js +36 -0
  252. package/dist/polar-LRVTYG4P.js +184 -0
  253. package/dist/profile.spec-K2JOABV3.js +78 -0
  254. package/dist/profileBarchart-IYWOBHGP.js +265 -0
  255. package/dist/profileForms-4VCEGMGS.js +367 -0
  256. package/dist/profilePlot-N246QTWM.js +52 -0
  257. package/dist/profileRadar-2ENLQG7V.js +261 -0
  258. package/dist/profileRadarFacility-FTNZELJ7.js +261 -0
  259. package/dist/proteomeAbundance-AM4N7PLI.js +19 -0
  260. package/dist/proteomeAbundance-K5AR6HO5.js +63 -0
  261. package/dist/proteomeAbundance-K5AR6HO5.js.map +7 -0
  262. package/dist/qualitative-I3GVVQ6U.js +41 -0
  263. package/dist/regression-XBZL2KMJ.js +54 -0
  264. package/dist/regression.inputs-UCM5THYS.js +46 -0
  265. package/dist/regression.inputs.term-24JWPAVV.js +46 -0
  266. package/dist/regression.inputs.values.table-QOHYUCIJ.js +43 -0
  267. package/dist/regression.integration.spec-JJXWPLID.js +784 -0
  268. package/dist/regression.results-T34IDQTC.js +38 -0
  269. package/dist/regression.spec-E74GPU5O.js +706 -0
  270. package/dist/report-U65OAFJR.js +220 -0
  271. package/dist/sampleScatter.spec-3LFSRARK.js +200 -0
  272. package/dist/sampleView-MX7LX3EJ.js +46 -0
  273. package/dist/samplelst-V4I6WIOC.js +109 -0
  274. package/dist/samplematrix-LNZJNTRE.js +2196 -0
  275. package/dist/sc-T2BPIFZ4.js +84 -0
  276. package/dist/scatter-PER7W2GO.js +800 -0
  277. package/dist/scatter.integration.spec-EUSA7IOP.js +1194 -0
  278. package/dist/scatter.integration.spec-EUSA7IOP.js.map +7 -0
  279. package/dist/selectGenomeWithTklst-UEJZV63V.js +132 -0
  280. package/dist/singleCellCellType-OLXPVJE6.js +36 -0
  281. package/dist/singleCellCellType.unit.spec-MQH6HMRC.js +177 -0
  282. package/dist/singleCellGeneExpression-P2K6EAGJ.js +36 -0
  283. package/dist/singleCellGeneExpression.unit.spec-LMCCDVIY.js +163 -0
  284. package/dist/singleCellPlot-CP5QDUSH.js +51 -0
  285. package/dist/singlecell-57YOSKNP.js +84 -0
  286. package/dist/singlecell-FGDYQAVM.js +1570 -0
  287. package/dist/snp-BYMKURQO.js +36 -0
  288. package/dist/snp.unit.spec-6UGQYGQR.js +174 -0
  289. package/dist/snplocus-AYSJ7PSU.js +206 -0
  290. package/dist/spliceevent.a53ss.diagram-BB73A4HM.js +149 -0
  291. package/dist/spliceevent.exonskip.diagram-VWIAD5DQ.js +275 -0
  292. package/dist/spliceevent.noeventdiagram-QACCAJS4.js +458 -0
  293. package/dist/ssGSEA-REHCYQ7Z.js +36 -0
  294. package/dist/ssGSEA.unit.spec-XJNHMFF5.js +86 -0
  295. package/dist/summarizeCnvGeneexp-NDEEB7PV.js +158 -0
  296. package/dist/summarizeGeneexpSurvival-ZCGBEB4C.js +105 -0
  297. package/dist/summarizeMutationCnv-OOMN2AVW.js +159 -0
  298. package/dist/summarizeMutationDiagnosis-B6TF3KU5.js +38 -0
  299. package/dist/summarizeMutationSurvival-Y2J6T2CS.js +97 -0
  300. package/dist/summary-O5LSGPWD.js +45 -0
  301. package/dist/summary.integration.spec-EH7FMP7B.js +412 -0
  302. package/dist/summaryInput-ZWURF7E2.js +218 -0
  303. package/dist/sunburst-ZDE5Q2SJ.js +282 -0
  304. package/dist/survival-DTUOFMGJ.js +44 -0
  305. package/dist/survival-XKLFNJF2.js +56 -0
  306. package/dist/survival.integration.spec-J352BAT4.js +787 -0
  307. package/dist/svgraph-NZQ6Z4HS.js +1385 -0
  308. package/dist/svmr-BPDWKVL2.js +3840 -0
  309. package/dist/table-6FOITCXA.js +198 -0
  310. package/dist/termCollection-HFDUSCPL.js +36 -0
  311. package/dist/termCollection-SWYRSREU.js +177 -0
  312. package/dist/termCollection.unit.spec-ZSAAQS26.js +206 -0
  313. package/dist/tk-D2YVENB3.js +44 -0
  314. package/dist/tp.ui-XALNLDLX.js +1457 -0
  315. package/dist/tvs.density-HSVPDDGA.js +18 -0
  316. package/dist/tvs.dt-TOZ47QR3.js +37 -0
  317. package/dist/tvs.dtcnv.categorical-OZFNQFCX.js +38 -0
  318. package/dist/tvs.dtcnv.continuous-XCZJ7JOD.js +70 -0
  319. package/dist/tvs.dtfusion-G3BI6YSH.js +38 -0
  320. package/dist/tvs.dtsnvindel-ETMWTQLL.js +38 -0
  321. package/dist/tvs.dtsv-66AEHBQE.js +38 -0
  322. package/dist/tvs.numeric-AU4U3UXI.js +21 -0
  323. package/dist/tvs.samplelst-TMUNONJI.js +102 -0
  324. package/dist/tvs.termCollection-HZ2ZVONI.js +151 -0
  325. package/dist/violin-P4A4BLKJ.js +44 -0
  326. package/dist/violin.integration.spec-DSSHXEES.js +1417 -0
  327. package/dist/violin.interactivity-FRXW7MH4.js +36 -0
  328. package/dist/violin.renderer-LQAFOSRK.js +38 -0
  329. package/dist/vocabulary-ELXLTPKE.js +39 -0
  330. package/dist/vocabulary-ELXLTPKE.js.map +7 -0
  331. package/package.json +3 -3
  332. package/dist/2dmaf-XRPOTQDU.js +0 -1371
  333. package/dist/AIProjectAdmin-Y6HPDEG6.js +0 -830
  334. package/dist/AppHeader-BBVIL4Y2.js +0 -833
  335. package/dist/BoxPlot-CRLSHBKA.js +0 -1184
  336. package/dist/CorrelationVolcano-CMY7UGYT.js +0 -617
  337. package/dist/DifferentialAnalysis-OIBUAY4O.js +0 -238
  338. package/dist/Disco-UNPSOUQ4.js +0 -3198
  339. package/dist/Disco-UNPSOUQ4.js.map +0 -7
  340. package/dist/Disco.UI-ODDXIAWH.js +0 -242
  341. package/dist/DmrPlot-JKNCSNGQ.js +0 -151
  342. package/dist/GB-TDX5IHWX.js +0 -1125
  343. package/dist/HicApp-TCV4FS7E.js +0 -2248
  344. package/dist/NumBinaryEditor-6HTFH5FY.js +0 -266
  345. package/dist/NumBinaryEditor.unit.spec-WQ3JNUQ5.js +0 -284
  346. package/dist/NumContEditor-SPHMFOFQ.js +0 -105
  347. package/dist/NumContEditor.unit.spec-O5X3I64X.js +0 -167
  348. package/dist/NumCustomBinEditor-TOYSQP4N.js +0 -36
  349. package/dist/NumCustomBinEditor.unit.spec-C3RGLZ66.js +0 -282
  350. package/dist/NumDiscreteEditor-YH4GA2QU.js +0 -170
  351. package/dist/NumDiscreteEditor.unit.spec-Q4YWXUDI.js +0 -200
  352. package/dist/NumRegularBinEditor-VOMG7SEN.js +0 -36
  353. package/dist/NumRegularBinEditor.unit.spec-DGK6OCYA.js +0 -225
  354. package/dist/NumSplineEditor-ZQUZHKX7.js +0 -188
  355. package/dist/NumSplineEditor.unit.spec-WIELA3UO.js +0 -197
  356. package/dist/NumericDensity-STVC5FR2.js +0 -36
  357. package/dist/NumericDensity.unit.spec-TNGOEAPS.js +0 -219
  358. package/dist/NumericHandler-42Y7UO3B.js +0 -37
  359. package/dist/NumericHandler.unit.spec-NX3FLHTT.js +0 -217
  360. package/dist/RunChart2-UVFQH4NJ.js +0 -756
  361. package/dist/SC-GGR54SO2.js +0 -725
  362. package/dist/Volcano-SWO5S4LF.js +0 -1092
  363. package/dist/WSIViewer-67IUYLCN.js +0 -46972
  364. package/dist/WsiSamplesPlot-ZOABZBI4.js +0 -163
  365. package/dist/adSandbox-CBLQAQJF.js +0 -36
  366. package/dist/alphaGenome-XJFQ24PG.js +0 -173
  367. package/dist/app-I3VGBBL5.js +0 -35
  368. package/dist/app-KKQRY35L.js +0 -47
  369. package/dist/bam-R5Q7E4PV.js +0 -849
  370. package/dist/barchart-D4GZAPHJ.js +0 -45
  371. package/dist/barchart.data-RSXEAMID.js +0 -22
  372. package/dist/barchart.events-HTZSPF6D.js +0 -45
  373. package/dist/barchart.integration.spec-NNJYJC44.js +0 -1675
  374. package/dist/block-6AULTYNF.js +0 -6300
  375. package/dist/block.init-WYBRJUDH.js +0 -36
  376. package/dist/block.mds.expressionrank-E7I2DP3V.js +0 -357
  377. package/dist/block.mds.geneboxplot-HMI6X526.js +0 -826
  378. package/dist/block.mds.junction-GH6LIIZG.js +0 -1543
  379. package/dist/block.mds.svcnv-X4PDPNI5.js +0 -6799
  380. package/dist/block.svg-W6KDKWAC.js +0 -162
  381. package/dist/block.tk.aicheck-YKZF7QPX.js +0 -281
  382. package/dist/block.tk.ase-YP2TEE7F.js +0 -363
  383. package/dist/block.tk.bam-UTZHNWLU.js +0 -1904
  384. package/dist/block.tk.bedgraphdot-ZYZNYH43.js +0 -382
  385. package/dist/block.tk.bigwig.ui-J7EJKZSB.js +0 -209
  386. package/dist/block.tk.hicstraw-EABGSDZT.js +0 -821
  387. package/dist/block.tk.junction-6PCAR65K.js +0 -2362
  388. package/dist/block.tk.junction.textmatrixui-3XCI6TUK.js +0 -197
  389. package/dist/block.tk.ld-POXNFUUP.js +0 -97
  390. package/dist/block.tk.menu-O2RTQNVA.js +0 -1027
  391. package/dist/block.tk.pgv-3YUGYTAM.js +0 -942
  392. package/dist/brainImaging-ZXQ6427A.js +0 -421
  393. package/dist/chat-26P2POKL.js +0 -147
  394. package/dist/chunk-2AAQVP35.js +0 -276
  395. package/dist/chunk-2AAQVP35.js.map +0 -7
  396. package/dist/chunk-2PBPUWVG.js +0 -4202
  397. package/dist/chunk-2PBPUWVG.js.map +0 -7
  398. package/dist/chunk-2YV6SLSN.js +0 -504
  399. package/dist/chunk-3RQDXPMF.js +0 -158
  400. package/dist/chunk-4U3X37P7.js +0 -368
  401. package/dist/chunk-5EUYO5JM.js +0 -293
  402. package/dist/chunk-5OHXYXLD.js +0 -46
  403. package/dist/chunk-5OHXYXLD.js.map +0 -7
  404. package/dist/chunk-5SB27JYT.js +0 -46
  405. package/dist/chunk-5TUM3XRB.js +0 -203
  406. package/dist/chunk-5UDKSRQK.js +0 -370
  407. package/dist/chunk-6DOPV4YR.js +0 -406
  408. package/dist/chunk-6FFL7DNW.js +0 -217
  409. package/dist/chunk-753JYY5R.js +0 -421
  410. package/dist/chunk-753JYY5R.js.map +0 -7
  411. package/dist/chunk-7BPHFWNS.js +0 -4945
  412. package/dist/chunk-7BPHFWNS.js.map +0 -7
  413. package/dist/chunk-AEMDVK4L.js +0 -146
  414. package/dist/chunk-AX6FH7EI.js +0 -26
  415. package/dist/chunk-BEWDIM6H.js +0 -42
  416. package/dist/chunk-BEWDIM6H.js.map +0 -7
  417. package/dist/chunk-BIUYEBET.js +0 -526
  418. package/dist/chunk-C5FRQK4N.js +0 -1087
  419. package/dist/chunk-CSHYN3WA.js +0 -302
  420. package/dist/chunk-DHQHLBGH.js +0 -205
  421. package/dist/chunk-DIBNJ6DG.js +0 -229
  422. package/dist/chunk-DONWY7TP.js +0 -39
  423. package/dist/chunk-DU4EIQ4C.js +0 -2683
  424. package/dist/chunk-DU4EIQ4C.js.map +0 -7
  425. package/dist/chunk-EAHT56LQ.js +0 -177
  426. package/dist/chunk-EOLAW55O.js +0 -2327
  427. package/dist/chunk-EOLAW55O.js.map +0 -7
  428. package/dist/chunk-EPGSHRD6.js +0 -20018
  429. package/dist/chunk-EPGSHRD6.js.map +0 -7
  430. package/dist/chunk-F6XC3L7V.js +0 -386
  431. package/dist/chunk-F6XC3L7V.js.map +0 -7
  432. package/dist/chunk-FG4ZGAE2.js +0 -147
  433. package/dist/chunk-FNQIF4YM.js +0 -48
  434. package/dist/chunk-FP2WUSUV.js +0 -100
  435. package/dist/chunk-FXNFDZBK.js +0 -2815
  436. package/dist/chunk-FY7D5KJW.js +0 -1413
  437. package/dist/chunk-FY7D5KJW.js.map +0 -7
  438. package/dist/chunk-GJD6CXOH.js +0 -95
  439. package/dist/chunk-GQV2V5MQ.js +0 -129
  440. package/dist/chunk-GRP5BFV6.js +0 -228
  441. package/dist/chunk-H5D3CMXT.js +0 -101
  442. package/dist/chunk-H5D3CMXT.js.map +0 -7
  443. package/dist/chunk-HES3EG3O.js +0 -31
  444. package/dist/chunk-IHA4FMNL.js +0 -55
  445. package/dist/chunk-IQIXGTQV.js +0 -84
  446. package/dist/chunk-IQIXGTQV.js.map +0 -7
  447. package/dist/chunk-IZ5H6KD4.js +0 -246
  448. package/dist/chunk-IZ5H6KD4.js.map +0 -7
  449. package/dist/chunk-JGDUGTKX.js +0 -14
  450. package/dist/chunk-JY6S3IJC.js +0 -107
  451. package/dist/chunk-K52HSRLL.js +0 -241
  452. package/dist/chunk-K52HSRLL.js.map +0 -7
  453. package/dist/chunk-K535LGE2.js +0 -1559
  454. package/dist/chunk-K535LGE2.js.map +0 -7
  455. package/dist/chunk-LDUAVBGW.js +0 -438
  456. package/dist/chunk-LFBEDMIT.js +0 -98
  457. package/dist/chunk-LHC3X2DP.js +0 -54
  458. package/dist/chunk-LPFM2MNU.js +0 -252
  459. package/dist/chunk-LWCFNUOW.js +0 -34
  460. package/dist/chunk-MAR6R3H5.js +0 -281
  461. package/dist/chunk-MAR6R3H5.js.map +0 -7
  462. package/dist/chunk-MNBFX3MS.js +0 -226
  463. package/dist/chunk-NR77BCU4.js +0 -1275
  464. package/dist/chunk-NR77BCU4.js.map +0 -7
  465. package/dist/chunk-O6TX37JQ.js +0 -815
  466. package/dist/chunk-OLOAKFZF.js +0 -170
  467. package/dist/chunk-P6NMCAVI.js +0 -52
  468. package/dist/chunk-PG3ROZWE.js +0 -615
  469. package/dist/chunk-PMIJURAQ.js +0 -286
  470. package/dist/chunk-PNCNPXIS.js +0 -256
  471. package/dist/chunk-PNCNPXIS.js.map +0 -7
  472. package/dist/chunk-R37DKXUQ.js +0 -194
  473. package/dist/chunk-RE2RAH2N.js +0 -462
  474. package/dist/chunk-RHGTRDHQ.js +0 -158
  475. package/dist/chunk-RWKOMJLI.js +0 -95
  476. package/dist/chunk-RWKOMJLI.js.map +0 -7
  477. package/dist/chunk-SGIUQ7YG.js +0 -446
  478. package/dist/chunk-TF4BMI2M.js +0 -1731
  479. package/dist/chunk-TF4BMI2M.js.map +0 -7
  480. package/dist/chunk-UEG7TL6D.js +0 -2784
  481. package/dist/chunk-UWX7W22M.js +0 -121
  482. package/dist/chunk-UYXGGZ2H.js +0 -381
  483. package/dist/chunk-V2P4V5FW.js +0 -629
  484. package/dist/chunk-VCKBMP7I.js +0 -1147
  485. package/dist/chunk-W7MBUYQV.js +0 -119
  486. package/dist/chunk-W7MBUYQV.js.map +0 -7
  487. package/dist/chunk-WD6TQESQ.js +0 -6364
  488. package/dist/chunk-XAATLZAS.js +0 -272
  489. package/dist/chunk-XORHQSNN.js +0 -534
  490. package/dist/chunk-XQRMLNMB.js +0 -749
  491. package/dist/chunk-XR5JON5N.js +0 -215
  492. package/dist/chunk-Y6SRLOZE.js +0 -142
  493. package/dist/chunk-YBR2WSWS.js +0 -482
  494. package/dist/chunk-YBR2WSWS.js.map +0 -7
  495. package/dist/chunk-YKJ3M52W.js +0 -1201
  496. package/dist/chunk-YL3RPMSG.js +0 -334
  497. package/dist/chunk-YURMUZ3J.js +0 -1155
  498. package/dist/chunk-ZLWXHJGG.js +0 -36
  499. package/dist/chunk-ZZMWPGNS.js +0 -169
  500. package/dist/chunk-ZZMWPGNS.js.map +0 -7
  501. package/dist/condition-47CFP6GZ.js +0 -330
  502. package/dist/controls-DDPU6QBE.js +0 -39
  503. package/dist/controls.config-EUYUFIWU.js +0 -37
  504. package/dist/correlation-N5XS6W7Y.js +0 -96
  505. package/dist/cuminc-4SQGINGP.js +0 -1147
  506. package/dist/cuminc.integration.spec-ICVP6TZW.js +0 -676
  507. package/dist/customdata.inputui-WCLXB62B.js +0 -285
  508. package/dist/dataDownload-EEX7RXDI.js +0 -328
  509. package/dist/dataDownload.integration.spec-MQMIVZF5.js +0 -191
  510. package/dist/databrowser.ui-52R3KPJE.js +0 -419
  511. package/dist/dictionary-RWFUSM5I.js +0 -98
  512. package/dist/dnaMethylation-76BZMYQV.js +0 -36
  513. package/dist/dnaMethylation.integration.spec-IJ3BYHWM.js +0 -179
  514. package/dist/e2pca-JXHX2G5O.js +0 -348
  515. package/dist/ep-HQBXQ2CU.js +0 -1254
  516. package/dist/expclust.gdc.spec-RUJ75H7G.js +0 -305
  517. package/dist/facet-IYOEFMXX.js +0 -519
  518. package/dist/geneExpClustering-A5ORFMCR.js +0 -246
  519. package/dist/geneExpression-4JPAG342.js +0 -312
  520. package/dist/geneExpression-CS6IC5YK.js +0 -36
  521. package/dist/geneExpression.unit.spec-M2RR57VN.js +0 -100
  522. package/dist/geneORA-KWTJGRSC.js +0 -276
  523. package/dist/geneVariant-6Z6JD7RE.js +0 -37
  524. package/dist/geneVariant-E3WFTPEJ.js +0 -39
  525. package/dist/geneVariant.integration.spec-OHLRA5LC.js +0 -196
  526. package/dist/genefusion.ui-BMWB6LTV.js +0 -249
  527. package/dist/geneset-XVG5WUP3.js +0 -194
  528. package/dist/genomeBrowser.spec-ZPHQTNZZ.js +0 -279
  529. package/dist/grin2-5MJE7WTM.js +0 -1554
  530. package/dist/grin2-XRWBTJ6P.js +0 -1031
  531. package/dist/gsea-ANUS3EB7.js +0 -45
  532. package/dist/hierCluster-F6AIINGR.js +0 -62
  533. package/dist/hierCluster-L365C2BW.js +0 -58
  534. package/dist/hierCluster.config-EAWIWY7G.js +0 -38
  535. package/dist/hierCluster.integration.spec-A6XLBEKB.js +0 -393
  536. package/dist/hierCluster.integration.spec-A6XLBEKB.js.map +0 -7
  537. package/dist/hierCluster.interactivity-RXKLKZJ7.js +0 -52
  538. package/dist/hierCluster.renderers-BHZNOML3.js +0 -21
  539. package/dist/imagePlot-HQJHYBMI.js +0 -139
  540. package/dist/importPlot-VD36EEYJ.js +0 -8
  541. package/dist/launch.adhoc-HCFMHPEH.js +0 -40
  542. package/dist/leftlabel.sample-CVG2KHY6.js +0 -256
  543. package/dist/legacyDataset-ALQDNTCK.js +0 -119
  544. package/dist/lollipop-WVMHA434.js +0 -166
  545. package/dist/maf-YFCW36CW.js +0 -442
  546. package/dist/maftimeline-B3ONLQLI.js +0 -591
  547. package/dist/matrix-FT5H2YVT.js +0 -57
  548. package/dist/matrix-XTQWNP6X.js +0 -62
  549. package/dist/matrix.cells-ZZGFKNTN.js +0 -28
  550. package/dist/matrix.config-T3F2KQJ3.js +0 -39
  551. package/dist/matrix.controls-AKDR7NUM.js +0 -37
  552. package/dist/matrix.data-FBQXHU2L.js +0 -25
  553. package/dist/matrix.groups-GSQFQZS2.js +0 -26
  554. package/dist/matrix.integration.spec-TNU3PHTT.js +0 -3070
  555. package/dist/matrix.interactivity-PF5EQ2VW.js +0 -40
  556. package/dist/matrix.layout-62CXYNJU.js +0 -42
  557. package/dist/matrix.legend-AAP2CDEZ.js +0 -22
  558. package/dist/matrix.renderers-S44INICR.js +0 -36
  559. package/dist/matrix.serieses-B5OJKZZZ.js +0 -21
  560. package/dist/matrix.sort-25APWUH3.js +0 -27
  561. package/dist/matrix.sort.unit.spec-MT5TJ6TP.js +0 -470
  562. package/dist/matrix.sorterUi-FDWJKGJM.js +0 -18
  563. package/dist/matrix.sorterUi.unit.spec-7RHMXULV.js +0 -340
  564. package/dist/mavb-RHCYQSK7.js +0 -730
  565. package/dist/mds.fimo-TM7YLN4F.js +0 -516
  566. package/dist/mds.samplescatterplot-LSNRX5LC.js +0 -1548
  567. package/dist/mds.survivalplot-PKEVTEC3.js +0 -481
  568. package/dist/mutationSignature-ZALSVJXI.js +0 -74
  569. package/dist/mutationSignature-ZALSVJXI.js.map +0 -7
  570. package/dist/numericDictTermCluster-3GDDFYJW.js +0 -72
  571. package/dist/numericDictTermCluster-3GDDFYJW.js.map +0 -7
  572. package/dist/oncomatrix-VA5BGIMU.js +0 -293
  573. package/dist/oncomatrix.spec-ZKSSTD3F.js +0 -446
  574. package/dist/plot.2dvaf-PRDECBWZ.js +0 -375
  575. package/dist/plot.app-LMUCBS2S.js +0 -39
  576. package/dist/plot.barplot-NI46LKJN.js +0 -100
  577. package/dist/plot.boxplot-RNJK3TH5.js +0 -150
  578. package/dist/plot.brainImaging-5PQKFCME.js +0 -51
  579. package/dist/plot.disco-NB6EWBO7.js +0 -101
  580. package/dist/plot.dzi-PGWTT7LB.js +0 -33
  581. package/dist/plot.ssgq-XLIV4C3J.js +0 -137
  582. package/dist/plot.vaf2cov-QRDE7BXH.js +0 -257
  583. package/dist/plot.wsi-KLYQYZUC.js +0 -36
  584. package/dist/polar-LXW6OMOZ.js +0 -184
  585. package/dist/profile.spec-Z622PMSX.js +0 -78
  586. package/dist/profileBarchart-3OCMQPHU.js +0 -265
  587. package/dist/profileForms-QNS26EYF.js +0 -367
  588. package/dist/profilePlot-E5LWDBSK.js +0 -52
  589. package/dist/profileRadar-JVISDMFQ.js +0 -261
  590. package/dist/profileRadarFacility-L3H7NERH.js +0 -261
  591. package/dist/qualitative-7KOKJDCI.js +0 -41
  592. package/dist/regression-H5SLMJTU.js +0 -54
  593. package/dist/regression.inputs-T4CB7HO6.js +0 -46
  594. package/dist/regression.inputs.term-CSO55NIV.js +0 -46
  595. package/dist/regression.inputs.values.table-3ORSYPRI.js +0 -43
  596. package/dist/regression.integration.spec-AODFYXEV.js +0 -784
  597. package/dist/regression.results-FVWF776Y.js +0 -38
  598. package/dist/regression.spec-D2SYDVSK.js +0 -706
  599. package/dist/report-DBHQIHVX.js +0 -220
  600. package/dist/sampleScatter.spec-NMQJ5WIE.js +0 -200
  601. package/dist/sampleView-OCADT4BV.js +0 -46
  602. package/dist/samplelst-GWEMRR4J.js +0 -109
  603. package/dist/samplematrix-QJ6PHCJ4.js +0 -2196
  604. package/dist/sc-NVPIXDG2.js +0 -84
  605. package/dist/scatter-H7HUQRKE.js +0 -800
  606. package/dist/scatter.integration.spec-QGQIYVYE.js +0 -1141
  607. package/dist/scatter.integration.spec-QGQIYVYE.js.map +0 -7
  608. package/dist/selectGenomeWithTklst-W6FA72HM.js +0 -132
  609. package/dist/singleCellCellType-OQEFL3EY.js +0 -36
  610. package/dist/singleCellCellType.unit.spec-BAIWJSUP.js +0 -177
  611. package/dist/singleCellGeneExpression-QPVTXR5W.js +0 -36
  612. package/dist/singleCellGeneExpression.unit.spec-Q5TS6VB5.js +0 -163
  613. package/dist/singleCellPlot-T2YNDBTX.js +0 -51
  614. package/dist/singlecell-B3NERPJ5.js +0 -1570
  615. package/dist/singlecell-PAOWCTF5.js +0 -84
  616. package/dist/snp-DAIHQXTJ.js +0 -36
  617. package/dist/snp.unit.spec-MXTEPR3Z.js +0 -174
  618. package/dist/snplocus-PMAVBMTK.js +0 -206
  619. package/dist/spliceevent.a53ss.diagram-G6W7EY3Q.js +0 -149
  620. package/dist/spliceevent.exonskip.diagram-YHUNDN4M.js +0 -275
  621. package/dist/spliceevent.noeventdiagram-FN3PORQA.js +0 -458
  622. package/dist/ssGSEA-5H4QBOY2.js +0 -36
  623. package/dist/ssGSEA.unit.spec-UBZGATIZ.js +0 -86
  624. package/dist/summarizeCnvGeneexp-IR7HMUG3.js +0 -158
  625. package/dist/summarizeGeneexpSurvival-INZXCZ37.js +0 -105
  626. package/dist/summarizeMutationCnv-GZFJTCRN.js +0 -159
  627. package/dist/summarizeMutationDiagnosis-OAUXQ6HD.js +0 -38
  628. package/dist/summarizeMutationSurvival-PT2BGPWD.js +0 -97
  629. package/dist/summary-SAVKS777.js +0 -45
  630. package/dist/summary.integration.spec-LWO7Y4OP.js +0 -412
  631. package/dist/summaryInput-SEIB7F3A.js +0 -218
  632. package/dist/sunburst-HCF2V66V.js +0 -282
  633. package/dist/survival-65IBMTWU.js +0 -44
  634. package/dist/survival-RIV2T7KO.js +0 -56
  635. package/dist/survival.integration.spec-2V2O4H7K.js +0 -787
  636. package/dist/svgraph-XV52FOMN.js +0 -1385
  637. package/dist/svmr-BDAHM7UH.js +0 -3840
  638. package/dist/table-5N2CRI36.js +0 -198
  639. package/dist/termCollection-GYMOT2EE.js +0 -36
  640. package/dist/termCollection-TZY6DOSP.js +0 -177
  641. package/dist/termCollection.unit.spec-VWHQ72DD.js +0 -206
  642. package/dist/tk-IOJVJ34S.js +0 -44
  643. package/dist/tp.ui-JHPHESWM.js +0 -1457
  644. package/dist/tvs.density-AQ5GD437.js +0 -18
  645. package/dist/tvs.dt-JPB46UPH.js +0 -37
  646. package/dist/tvs.dtcnv.categorical-37TA7GCY.js +0 -38
  647. package/dist/tvs.dtcnv.continuous-X4K3RPYG.js +0 -70
  648. package/dist/tvs.dtfusion-77SKDRRH.js +0 -38
  649. package/dist/tvs.dtsnvindel-2QGQ455S.js +0 -38
  650. package/dist/tvs.dtsv-QBCE5IHM.js +0 -38
  651. package/dist/tvs.numeric-PLNP7MBV.js +0 -21
  652. package/dist/tvs.samplelst-NRSYJ64L.js +0 -102
  653. package/dist/tvs.termCollection-BK36KZL2.js +0 -151
  654. package/dist/violin-DCKEHIVC.js +0 -44
  655. package/dist/violin.integration.spec-IIYDX5DT.js +0 -1417
  656. package/dist/violin.interactivity-RS6D5YPY.js +0 -36
  657. package/dist/violin.renderer-XIQTOVEK.js +0 -38
  658. package/dist/vocabulary-6437MWB6.js +0 -39
  659. /package/dist/{2dmaf-XRPOTQDU.js.map → 2dmaf-TA6JJ2OR.js.map} +0 -0
  660. /package/dist/{AIProjectAdmin-Y6HPDEG6.js.map → AIProjectAdmin-SAYM2UUO.js.map} +0 -0
  661. /package/dist/{AppHeader-BBVIL4Y2.js.map → AppHeader-7TNVJJA7.js.map} +0 -0
  662. /package/dist/{BoxPlot-CRLSHBKA.js.map → BoxPlot-IAROTQ5L.js.map} +0 -0
  663. /package/dist/{CorrelationVolcano-CMY7UGYT.js.map → CorrelationVolcano-ZFSDE4PA.js.map} +0 -0
  664. /package/dist/{DifferentialAnalysis-OIBUAY4O.js.map → DifferentialAnalysis-X44YRQNQ.js.map} +0 -0
  665. /package/dist/{Disco.UI-ODDXIAWH.js.map → Disco.UI-YWYNQSRV.js.map} +0 -0
  666. /package/dist/{DmrPlot-JKNCSNGQ.js.map → DmrPlot-5V5QL4VS.js.map} +0 -0
  667. /package/dist/{GB-TDX5IHWX.js.map → GB-3P67R4TI.js.map} +0 -0
  668. /package/dist/{HicApp-TCV4FS7E.js.map → HicApp-GKI7GS7Y.js.map} +0 -0
  669. /package/dist/{NumBinaryEditor-6HTFH5FY.js.map → NumBinaryEditor-FNIEMKOY.js.map} +0 -0
  670. /package/dist/{NumBinaryEditor.unit.spec-WQ3JNUQ5.js.map → NumBinaryEditor.unit.spec-CDHPXF7F.js.map} +0 -0
  671. /package/dist/{NumContEditor-SPHMFOFQ.js.map → NumContEditor-XICKQ4Y6.js.map} +0 -0
  672. /package/dist/{NumContEditor.unit.spec-O5X3I64X.js.map → NumContEditor.unit.spec-DVFH4SZT.js.map} +0 -0
  673. /package/dist/{NumCustomBinEditor-TOYSQP4N.js.map → NumCustomBinEditor-ZMND7YMB.js.map} +0 -0
  674. /package/dist/{NumCustomBinEditor.unit.spec-C3RGLZ66.js.map → NumCustomBinEditor.unit.spec-WLWD4FV2.js.map} +0 -0
  675. /package/dist/{NumDiscreteEditor-YH4GA2QU.js.map → NumDiscreteEditor-H2GG4COK.js.map} +0 -0
  676. /package/dist/{NumDiscreteEditor.unit.spec-Q4YWXUDI.js.map → NumDiscreteEditor.unit.spec-OEREZ6HB.js.map} +0 -0
  677. /package/dist/{NumRegularBinEditor-VOMG7SEN.js.map → NumRegularBinEditor-YGMQV7ZW.js.map} +0 -0
  678. /package/dist/{NumRegularBinEditor.unit.spec-DGK6OCYA.js.map → NumRegularBinEditor.unit.spec-ZUTXFGGA.js.map} +0 -0
  679. /package/dist/{NumSplineEditor-ZQUZHKX7.js.map → NumSplineEditor-VPKCUM2U.js.map} +0 -0
  680. /package/dist/{NumSplineEditor.unit.spec-WIELA3UO.js.map → NumSplineEditor.unit.spec-IDEB3KAY.js.map} +0 -0
  681. /package/dist/{NumericDensity-STVC5FR2.js.map → NumericDensity-5DDVJBBW.js.map} +0 -0
  682. /package/dist/{NumericDensity.unit.spec-TNGOEAPS.js.map → NumericDensity.unit.spec-KTOY3EON.js.map} +0 -0
  683. /package/dist/{NumericHandler-42Y7UO3B.js.map → NumericHandler-XBY7A7TV.js.map} +0 -0
  684. /package/dist/{NumericHandler.unit.spec-NX3FLHTT.js.map → NumericHandler.unit.spec-KKBJDLZY.js.map} +0 -0
  685. /package/dist/{RunChart2-UVFQH4NJ.js.map → RunChart2-F4652KYJ.js.map} +0 -0
  686. /package/dist/{SC-GGR54SO2.js.map → SC-GKNVRMYL.js.map} +0 -0
  687. /package/dist/{Volcano-SWO5S4LF.js.map → Volcano-ZHQFH2MP.js.map} +0 -0
  688. /package/dist/{WSIViewer-67IUYLCN.js.map → WSIViewer-MU3YXF7I.js.map} +0 -0
  689. /package/dist/{WsiSamplesPlot-ZOABZBI4.js.map → WsiSamplesPlot-ZP3EAQLW.js.map} +0 -0
  690. /package/dist/{adSandbox-CBLQAQJF.js.map → adSandbox-7FIAWUBA.js.map} +0 -0
  691. /package/dist/{alphaGenome-XJFQ24PG.js.map → alphaGenome-ACWK2XZL.js.map} +0 -0
  692. /package/dist/{app-I3VGBBL5.js.map → app-6V52ULRQ.js.map} +0 -0
  693. /package/dist/{app-KKQRY35L.js.map → app-PP7JFYBG.js.map} +0 -0
  694. /package/dist/{bam-R5Q7E4PV.js.map → bam-AESS7MP3.js.map} +0 -0
  695. /package/dist/{barchart-D4GZAPHJ.js.map → barchart-BKWC5UXM.js.map} +0 -0
  696. /package/dist/{barchart.data-RSXEAMID.js.map → barchart.data-BMH62H5G.js.map} +0 -0
  697. /package/dist/{barchart.events-HTZSPF6D.js.map → barchart.events-ZJSQB3KV.js.map} +0 -0
  698. /package/dist/{barchart.integration.spec-NNJYJC44.js.map → barchart.integration.spec-6QOIOO6T.js.map} +0 -0
  699. /package/dist/{block-6AULTYNF.js.map → block-PH3K3TGJ.js.map} +0 -0
  700. /package/dist/{block.init-WYBRJUDH.js.map → block.init-7LT7FK7V.js.map} +0 -0
  701. /package/dist/{block.mds.expressionrank-E7I2DP3V.js.map → block.mds.expressionrank-RH25BI5W.js.map} +0 -0
  702. /package/dist/{block.mds.geneboxplot-HMI6X526.js.map → block.mds.geneboxplot-YX5SF65Z.js.map} +0 -0
  703. /package/dist/{block.mds.junction-GH6LIIZG.js.map → block.mds.junction-MXYEREFH.js.map} +0 -0
  704. /package/dist/{block.mds.svcnv-X4PDPNI5.js.map → block.mds.svcnv-C5HEGIAK.js.map} +0 -0
  705. /package/dist/{block.svg-W6KDKWAC.js.map → block.svg-LZOSOJPZ.js.map} +0 -0
  706. /package/dist/{block.tk.aicheck-YKZF7QPX.js.map → block.tk.aicheck-YMMJJWD7.js.map} +0 -0
  707. /package/dist/{block.tk.ase-YP2TEE7F.js.map → block.tk.ase-IPQUSAE7.js.map} +0 -0
  708. /package/dist/{block.tk.bam-UTZHNWLU.js.map → block.tk.bam-HJLFTBGN.js.map} +0 -0
  709. /package/dist/{block.tk.bedgraphdot-ZYZNYH43.js.map → block.tk.bedgraphdot-5ZBNIQFY.js.map} +0 -0
  710. /package/dist/{block.tk.bigwig.ui-J7EJKZSB.js.map → block.tk.bigwig.ui-V2GLBUU5.js.map} +0 -0
  711. /package/dist/{block.tk.hicstraw-EABGSDZT.js.map → block.tk.hicstraw-3NJLYMEJ.js.map} +0 -0
  712. /package/dist/{block.tk.junction-6PCAR65K.js.map → block.tk.junction-C4CAACOA.js.map} +0 -0
  713. /package/dist/{block.tk.junction.textmatrixui-3XCI6TUK.js.map → block.tk.junction.textmatrixui-NJCGCHZ5.js.map} +0 -0
  714. /package/dist/{block.tk.ld-POXNFUUP.js.map → block.tk.ld-PNX72F42.js.map} +0 -0
  715. /package/dist/{block.tk.menu-O2RTQNVA.js.map → block.tk.menu-AZ44SBLU.js.map} +0 -0
  716. /package/dist/{block.tk.pgv-3YUGYTAM.js.map → block.tk.pgv-AGD3EYGQ.js.map} +0 -0
  717. /package/dist/{brainImaging-ZXQ6427A.js.map → brainImaging-5DO3465Z.js.map} +0 -0
  718. /package/dist/{chat-26P2POKL.js.map → chat-346IEKTC.js.map} +0 -0
  719. /package/dist/{chunk-PMIJURAQ.js.map → chunk-2NVHNNBT.js.map} +0 -0
  720. /package/dist/{chunk-5UDKSRQK.js.map → chunk-2ZEGV5AG.js.map} +0 -0
  721. /package/dist/{chunk-BIUYEBET.js.map → chunk-4UAWJRR6.js.map} +0 -0
  722. /package/dist/{chunk-WD6TQESQ.js.map → chunk-4VGSBYQC.js.map} +0 -0
  723. /package/dist/{chunk-XORHQSNN.js.map → chunk-5MB65WAE.js.map} +0 -0
  724. /package/dist/{chunk-RHGTRDHQ.js.map → chunk-6RXCKL6A.js.map} +0 -0
  725. /package/dist/{chunk-OLOAKFZF.js.map → chunk-A2UFOQ3B.js.map} +0 -0
  726. /package/dist/{chunk-3RQDXPMF.js.map → chunk-A4RBXF53.js.map} +0 -0
  727. /package/dist/{chunk-DONWY7TP.js.map → chunk-AQ4OP4GR.js.map} +0 -0
  728. /package/dist/{chunk-2YV6SLSN.js.map → chunk-AUWK22ER.js.map} +0 -0
  729. /package/dist/{chunk-AX6FH7EI.js.map → chunk-AXOTFMIM.js.map} +0 -0
  730. /package/dist/{chunk-GJD6CXOH.js.map → chunk-CFXUDZWK.js.map} +0 -0
  731. /package/dist/{chunk-DIBNJ6DG.js.map → chunk-CRRWBY4C.js.map} +0 -0
  732. /package/dist/{chunk-6FFL7DNW.js.map → chunk-D6VDBY2S.js.map} +0 -0
  733. /package/dist/{chunk-5EUYO5JM.js.map → chunk-DN52ILXL.js.map} +0 -0
  734. /package/dist/{chunk-XR5JON5N.js.map → chunk-DTCFNQKZ.js.map} +0 -0
  735. /package/dist/{chunk-5SB27JYT.js.map → chunk-ED3HWBZF.js.map} +0 -0
  736. /package/dist/{chunk-FP2WUSUV.js.map → chunk-EWTGCHU5.js.map} +0 -0
  737. /package/dist/{chunk-MNBFX3MS.js.map → chunk-FJ6KNGDS.js.map} +0 -0
  738. /package/dist/{chunk-UWX7W22M.js.map → chunk-FVWCYGJL.js.map} +0 -0
  739. /package/dist/{chunk-EAHT56LQ.js.map → chunk-GM6H3CUI.js.map} +0 -0
  740. /package/dist/{chunk-PG3ROZWE.js.map → chunk-GQVM3NTV.js.map} +0 -0
  741. /package/dist/{chunk-YURMUZ3J.js.map → chunk-H3RU5NUZ.js.map} +0 -0
  742. /package/dist/{chunk-6DOPV4YR.js.map → chunk-HEKX7RAT.js.map} +0 -0
  743. /package/dist/{chunk-5TUM3XRB.js.map → chunk-HGHRMQQO.js.map} +0 -0
  744. /package/dist/{chunk-DHQHLBGH.js.map → chunk-HIV4NSWS.js.map} +0 -0
  745. /package/dist/{chunk-VCKBMP7I.js.map → chunk-HMXYZXDN.js.map} +0 -0
  746. /package/dist/{chunk-V2P4V5FW.js.map → chunk-IA6ZJ6ZS.js.map} +0 -0
  747. /package/dist/{chunk-XAATLZAS.js.map → chunk-INROHUDU.js.map} +0 -0
  748. /package/dist/{chunk-GRP5BFV6.js.map → chunk-JEN6TGBR.js.map} +0 -0
  749. /package/dist/{chunk-UEG7TL6D.js.map → chunk-JGU7ERLS.js.map} +0 -0
  750. /package/dist/{chunk-UYXGGZ2H.js.map → chunk-K2CTY4BE.js.map} +0 -0
  751. /package/dist/{chunk-R37DKXUQ.js.map → chunk-K7PK3JQJ.js.map} +0 -0
  752. /package/dist/{chunk-YL3RPMSG.js.map → chunk-KFRJ5LNK.js.map} +0 -0
  753. /package/dist/{chunk-FNQIF4YM.js.map → chunk-LAVSN35L.js.map} +0 -0
  754. /package/dist/{chunk-CSHYN3WA.js.map → chunk-LUW252RA.js.map} +0 -0
  755. /package/dist/{chunk-GQV2V5MQ.js.map → chunk-MBYEA2R3.js.map} +0 -0
  756. /package/dist/{chunk-SGIUQ7YG.js.map → chunk-OGZPMUPF.js.map} +0 -0
  757. /package/dist/{chunk-P6NMCAVI.js.map → chunk-OJSG5RK5.js.map} +0 -0
  758. /package/dist/{chunk-LDUAVBGW.js.map → chunk-OM22RN7S.js.map} +0 -0
  759. /package/dist/{chunk-LPFM2MNU.js.map → chunk-OTK7UQ7K.js.map} +0 -0
  760. /package/dist/{chunk-XQRMLNMB.js.map → chunk-PJCALFS6.js.map} +0 -0
  761. /package/dist/{chunk-Y6SRLOZE.js.map → chunk-Q3SI7IQ7.js.map} +0 -0
  762. /package/dist/{chunk-LWCFNUOW.js.map → chunk-RGAJYIKI.js.map} +0 -0
  763. /package/dist/{chunk-ZLWXHJGG.js.map → chunk-RMQMUFIK.js.map} +0 -0
  764. /package/dist/{chunk-C5FRQK4N.js.map → chunk-SMD5GI24.js.map} +0 -0
  765. /package/dist/{chunk-RE2RAH2N.js.map → chunk-SMKRNNHY.js.map} +0 -0
  766. /package/dist/{chunk-O6TX37JQ.js.map → chunk-SNMJEDHY.js.map} +0 -0
  767. /package/dist/{chunk-4U3X37P7.js.map → chunk-T4PUAROY.js.map} +0 -0
  768. /package/dist/{chunk-HES3EG3O.js.map → chunk-TEA3NTUR.js.map} +0 -0
  769. /package/dist/{chunk-FG4ZGAE2.js.map → chunk-TECXLSHZ.js.map} +0 -0
  770. /package/dist/{chunk-JGDUGTKX.js.map → chunk-VDNVTMJ3.js.map} +0 -0
  771. /package/dist/{chunk-FXNFDZBK.js.map → chunk-VPRXRWOR.js.map} +0 -0
  772. /package/dist/{chunk-LFBEDMIT.js.map → chunk-WVJKEXT7.js.map} +0 -0
  773. /package/dist/{chunk-AEMDVK4L.js.map → chunk-YFCDOHEK.js.map} +0 -0
  774. /package/dist/{chunk-YKJ3M52W.js.map → chunk-YMY73A3W.js.map} +0 -0
  775. /package/dist/{chunk-JY6S3IJC.js.map → chunk-YUPIKHOC.js.map} +0 -0
  776. /package/dist/{chunk-LHC3X2DP.js.map → chunk-ZGWYEVXK.js.map} +0 -0
  777. /package/dist/{chunk-IHA4FMNL.js.map → chunk-ZMY7LBL6.js.map} +0 -0
  778. /package/dist/{condition-47CFP6GZ.js.map → condition-NJCZST5Q.js.map} +0 -0
  779. /package/dist/{controls-DDPU6QBE.js.map → controls-F4X2WXQB.js.map} +0 -0
  780. /package/dist/{controls.config-EUYUFIWU.js.map → controls.config-XGY3VBIY.js.map} +0 -0
  781. /package/dist/{correlation-N5XS6W7Y.js.map → correlation-6VR3QLD5.js.map} +0 -0
  782. /package/dist/{cuminc-4SQGINGP.js.map → cuminc-ENV7RGH2.js.map} +0 -0
  783. /package/dist/{cuminc.integration.spec-ICVP6TZW.js.map → cuminc.integration.spec-SBZ4BINE.js.map} +0 -0
  784. /package/dist/{customdata.inputui-WCLXB62B.js.map → customdata.inputui-DRCIAHVC.js.map} +0 -0
  785. /package/dist/{dataDownload-EEX7RXDI.js.map → dataDownload-E22OVEWA.js.map} +0 -0
  786. /package/dist/{dataDownload.integration.spec-MQMIVZF5.js.map → dataDownload.integration.spec-SHXBOHP7.js.map} +0 -0
  787. /package/dist/{databrowser.ui-52R3KPJE.js.map → databrowser.ui-EY4MYHIN.js.map} +0 -0
  788. /package/dist/{dictionary-RWFUSM5I.js.map → dictionary-RXSFDNVZ.js.map} +0 -0
  789. /package/dist/{dnaMethylation-76BZMYQV.js.map → dnaMethylation-LBLLHMD4.js.map} +0 -0
  790. /package/dist/{dnaMethylation.integration.spec-IJ3BYHWM.js.map → dnaMethylation.integration.spec-SCZSVS4Q.js.map} +0 -0
  791. /package/dist/{e2pca-JXHX2G5O.js.map → e2pca-7Y4E37LV.js.map} +0 -0
  792. /package/dist/{ep-HQBXQ2CU.js.map → ep-3CMYYJHS.js.map} +0 -0
  793. /package/dist/{expclust.gdc.spec-RUJ75H7G.js.map → expclust.gdc.spec-PBOZFONS.js.map} +0 -0
  794. /package/dist/{facet-IYOEFMXX.js.map → facet-VWQJBZCD.js.map} +0 -0
  795. /package/dist/{geneExpClustering-A5ORFMCR.js.map → geneExpClustering-FBKONWXK.js.map} +0 -0
  796. /package/dist/{geneExpression-4JPAG342.js.map → geneExpression-3K67HK7E.js.map} +0 -0
  797. /package/dist/{geneExpression-CS6IC5YK.js.map → geneExpression-3O5CGX4X.js.map} +0 -0
  798. /package/dist/{geneExpression.unit.spec-M2RR57VN.js.map → geneExpression.unit.spec-PAWYATIF.js.map} +0 -0
  799. /package/dist/{geneORA-KWTJGRSC.js.map → geneORA-4I7AQCHS.js.map} +0 -0
  800. /package/dist/{geneVariant-6Z6JD7RE.js.map → geneVariant-6RSUL5BT.js.map} +0 -0
  801. /package/dist/{geneVariant-E3WFTPEJ.js.map → geneVariant-IONFAQDH.js.map} +0 -0
  802. /package/dist/{geneVariant.integration.spec-OHLRA5LC.js.map → geneVariant.integration.spec-D5JQMXWA.js.map} +0 -0
  803. /package/dist/{genefusion.ui-BMWB6LTV.js.map → genefusion.ui-5TEA3V7M.js.map} +0 -0
  804. /package/dist/{geneset-XVG5WUP3.js.map → geneset-FPSUFQYL.js.map} +0 -0
  805. /package/dist/{genomeBrowser.spec-ZPHQTNZZ.js.map → genomeBrowser.spec-37JOBDU3.js.map} +0 -0
  806. /package/dist/{grin2-5MJE7WTM.js.map → grin2-A7DYEQOC.js.map} +0 -0
  807. /package/dist/{grin2-XRWBTJ6P.js.map → grin2-YVFBDIJR.js.map} +0 -0
  808. /package/dist/{gsea-ANUS3EB7.js.map → gsea-OQH53X4W.js.map} +0 -0
  809. /package/dist/{hierCluster-F6AIINGR.js.map → hierCluster-2AQPDWQN.js.map} +0 -0
  810. /package/dist/{hierCluster-L365C2BW.js.map → hierCluster-H4EP5RK6.js.map} +0 -0
  811. /package/dist/{hierCluster.config-EAWIWY7G.js.map → hierCluster.config-OMHLRSMT.js.map} +0 -0
  812. /package/dist/{hierCluster.interactivity-RXKLKZJ7.js.map → hierCluster.interactivity-VD23UMI7.js.map} +0 -0
  813. /package/dist/{hierCluster.renderers-BHZNOML3.js.map → hierCluster.renderers-ZKODOVW5.js.map} +0 -0
  814. /package/dist/{imagePlot-HQJHYBMI.js.map → imagePlot-5RQLP27H.js.map} +0 -0
  815. /package/dist/{importPlot-VD36EEYJ.js.map → importPlot-R4LOYFA3.js.map} +0 -0
  816. /package/dist/{launch.adhoc-HCFMHPEH.js.map → launch.adhoc-7NRKGIIF.js.map} +0 -0
  817. /package/dist/{leftlabel.sample-CVG2KHY6.js.map → leftlabel.sample-BSDNBLN4.js.map} +0 -0
  818. /package/dist/{legacyDataset-ALQDNTCK.js.map → legacyDataset-4PBBW67M.js.map} +0 -0
  819. /package/dist/{lollipop-WVMHA434.js.map → lollipop-L62KZOCL.js.map} +0 -0
  820. /package/dist/{maf-YFCW36CW.js.map → maf-4TQPFF46.js.map} +0 -0
  821. /package/dist/{maftimeline-B3ONLQLI.js.map → maftimeline-XIAKNULE.js.map} +0 -0
  822. /package/dist/{matrix-FT5H2YVT.js.map → matrix-H72HOOI5.js.map} +0 -0
  823. /package/dist/{matrix-XTQWNP6X.js.map → matrix-W6ARLZHT.js.map} +0 -0
  824. /package/dist/{matrix.cells-ZZGFKNTN.js.map → matrix.cells-AP4ENHAY.js.map} +0 -0
  825. /package/dist/{matrix.config-T3F2KQJ3.js.map → matrix.config-HJURMAA2.js.map} +0 -0
  826. /package/dist/{matrix.controls-AKDR7NUM.js.map → matrix.controls-77T2V4MM.js.map} +0 -0
  827. /package/dist/{matrix.data-FBQXHU2L.js.map → matrix.data-OPJXBHQF.js.map} +0 -0
  828. /package/dist/{matrix.groups-GSQFQZS2.js.map → matrix.groups-RF5XZTIX.js.map} +0 -0
  829. /package/dist/{matrix.integration.spec-TNU3PHTT.js.map → matrix.integration.spec-NXFIEBAV.js.map} +0 -0
  830. /package/dist/{matrix.interactivity-PF5EQ2VW.js.map → matrix.interactivity-KYV3I5NA.js.map} +0 -0
  831. /package/dist/{matrix.layout-62CXYNJU.js.map → matrix.layout-BKCT6WFO.js.map} +0 -0
  832. /package/dist/{matrix.legend-AAP2CDEZ.js.map → matrix.legend-DMR5WO2B.js.map} +0 -0
  833. /package/dist/{matrix.renderers-S44INICR.js.map → matrix.renderers-YA45F4J3.js.map} +0 -0
  834. /package/dist/{matrix.serieses-B5OJKZZZ.js.map → matrix.serieses-LIJYLDRY.js.map} +0 -0
  835. /package/dist/{matrix.sort-25APWUH3.js.map → matrix.sort-MJXBZP5Z.js.map} +0 -0
  836. /package/dist/{matrix.sort.unit.spec-MT5TJ6TP.js.map → matrix.sort.unit.spec-XZ66MEFK.js.map} +0 -0
  837. /package/dist/{matrix.sorterUi-FDWJKGJM.js.map → matrix.sorterUi-RYZPGKNR.js.map} +0 -0
  838. /package/dist/{matrix.sorterUi.unit.spec-7RHMXULV.js.map → matrix.sorterUi.unit.spec-5HLSSQDG.js.map} +0 -0
  839. /package/dist/{mavb-RHCYQSK7.js.map → mavb-6BDLX76H.js.map} +0 -0
  840. /package/dist/{mds.fimo-TM7YLN4F.js.map → mds.fimo-JWUDO2YS.js.map} +0 -0
  841. /package/dist/{mds.samplescatterplot-LSNRX5LC.js.map → mds.samplescatterplot-H5ZHOO3F.js.map} +0 -0
  842. /package/dist/{mds.survivalplot-PKEVTEC3.js.map → mds.survivalplot-6LJPCDUC.js.map} +0 -0
  843. /package/dist/{oncomatrix-VA5BGIMU.js.map → oncomatrix-5TAYUFN7.js.map} +0 -0
  844. /package/dist/{oncomatrix.spec-ZKSSTD3F.js.map → oncomatrix.spec-4J6ZQSCA.js.map} +0 -0
  845. /package/dist/{plot.2dvaf-PRDECBWZ.js.map → plot.2dvaf-NEKUHMQA.js.map} +0 -0
  846. /package/dist/{plot.app-LMUCBS2S.js.map → plot.app-CDA4NVBW.js.map} +0 -0
  847. /package/dist/{plot.barplot-NI46LKJN.js.map → plot.barplot-WPNGNPFU.js.map} +0 -0
  848. /package/dist/{plot.boxplot-RNJK3TH5.js.map → plot.boxplot-FBHMTSOE.js.map} +0 -0
  849. /package/dist/{plot.brainImaging-5PQKFCME.js.map → plot.brainImaging-53CS65FP.js.map} +0 -0
  850. /package/dist/{plot.disco-NB6EWBO7.js.map → plot.disco-477IKREB.js.map} +0 -0
  851. /package/dist/{plot.dzi-PGWTT7LB.js.map → plot.dzi-37H4EUKF.js.map} +0 -0
  852. /package/dist/{plot.ssgq-XLIV4C3J.js.map → plot.ssgq-WR3HFXR4.js.map} +0 -0
  853. /package/dist/{plot.vaf2cov-QRDE7BXH.js.map → plot.vaf2cov-FCGREDI7.js.map} +0 -0
  854. /package/dist/{plot.wsi-KLYQYZUC.js.map → plot.wsi-HO3DYKJ6.js.map} +0 -0
  855. /package/dist/{polar-LXW6OMOZ.js.map → polar-LRVTYG4P.js.map} +0 -0
  856. /package/dist/{profile.spec-Z622PMSX.js.map → profile.spec-K2JOABV3.js.map} +0 -0
  857. /package/dist/{profileBarchart-3OCMQPHU.js.map → profileBarchart-IYWOBHGP.js.map} +0 -0
  858. /package/dist/{profileForms-QNS26EYF.js.map → profileForms-4VCEGMGS.js.map} +0 -0
  859. /package/dist/{profilePlot-E5LWDBSK.js.map → profilePlot-N246QTWM.js.map} +0 -0
  860. /package/dist/{profileRadar-JVISDMFQ.js.map → profileRadar-2ENLQG7V.js.map} +0 -0
  861. /package/dist/{profileRadarFacility-L3H7NERH.js.map → profileRadarFacility-FTNZELJ7.js.map} +0 -0
  862. /package/dist/{qualitative-7KOKJDCI.js.map → proteomeAbundance-AM4N7PLI.js.map} +0 -0
  863. /package/dist/{regression-H5SLMJTU.js.map → qualitative-I3GVVQ6U.js.map} +0 -0
  864. /package/dist/{regression.inputs-T4CB7HO6.js.map → regression-XBZL2KMJ.js.map} +0 -0
  865. /package/dist/{regression.inputs.term-CSO55NIV.js.map → regression.inputs-UCM5THYS.js.map} +0 -0
  866. /package/dist/{regression.inputs.values.table-3ORSYPRI.js.map → regression.inputs.term-24JWPAVV.js.map} +0 -0
  867. /package/dist/{regression.results-FVWF776Y.js.map → regression.inputs.values.table-QOHYUCIJ.js.map} +0 -0
  868. /package/dist/{regression.integration.spec-AODFYXEV.js.map → regression.integration.spec-JJXWPLID.js.map} +0 -0
  869. /package/dist/{sampleView-OCADT4BV.js.map → regression.results-T34IDQTC.js.map} +0 -0
  870. /package/dist/{regression.spec-D2SYDVSK.js.map → regression.spec-E74GPU5O.js.map} +0 -0
  871. /package/dist/{report-DBHQIHVX.js.map → report-U65OAFJR.js.map} +0 -0
  872. /package/dist/{sampleScatter.spec-NMQJ5WIE.js.map → sampleScatter.spec-3LFSRARK.js.map} +0 -0
  873. /package/dist/{singleCellCellType-OQEFL3EY.js.map → sampleView-MX7LX3EJ.js.map} +0 -0
  874. /package/dist/{samplelst-GWEMRR4J.js.map → samplelst-V4I6WIOC.js.map} +0 -0
  875. /package/dist/{samplematrix-QJ6PHCJ4.js.map → samplematrix-LNZJNTRE.js.map} +0 -0
  876. /package/dist/{sc-NVPIXDG2.js.map → sc-T2BPIFZ4.js.map} +0 -0
  877. /package/dist/{scatter-H7HUQRKE.js.map → scatter-PER7W2GO.js.map} +0 -0
  878. /package/dist/{selectGenomeWithTklst-W6FA72HM.js.map → selectGenomeWithTklst-UEJZV63V.js.map} +0 -0
  879. /package/dist/{singleCellGeneExpression-QPVTXR5W.js.map → singleCellCellType-OLXPVJE6.js.map} +0 -0
  880. /package/dist/{singleCellCellType.unit.spec-BAIWJSUP.js.map → singleCellCellType.unit.spec-MQH6HMRC.js.map} +0 -0
  881. /package/dist/{singleCellPlot-T2YNDBTX.js.map → singleCellGeneExpression-P2K6EAGJ.js.map} +0 -0
  882. /package/dist/{singleCellGeneExpression.unit.spec-Q5TS6VB5.js.map → singleCellGeneExpression.unit.spec-LMCCDVIY.js.map} +0 -0
  883. /package/dist/{snp-DAIHQXTJ.js.map → singleCellPlot-CP5QDUSH.js.map} +0 -0
  884. /package/dist/{singlecell-PAOWCTF5.js.map → singlecell-57YOSKNP.js.map} +0 -0
  885. /package/dist/{singlecell-B3NERPJ5.js.map → singlecell-FGDYQAVM.js.map} +0 -0
  886. /package/dist/{ssGSEA-5H4QBOY2.js.map → snp-BYMKURQO.js.map} +0 -0
  887. /package/dist/{snp.unit.spec-MXTEPR3Z.js.map → snp.unit.spec-6UGQYGQR.js.map} +0 -0
  888. /package/dist/{snplocus-PMAVBMTK.js.map → snplocus-AYSJ7PSU.js.map} +0 -0
  889. /package/dist/{spliceevent.a53ss.diagram-G6W7EY3Q.js.map → spliceevent.a53ss.diagram-BB73A4HM.js.map} +0 -0
  890. /package/dist/{spliceevent.exonskip.diagram-YHUNDN4M.js.map → spliceevent.exonskip.diagram-VWIAD5DQ.js.map} +0 -0
  891. /package/dist/{spliceevent.noeventdiagram-FN3PORQA.js.map → spliceevent.noeventdiagram-QACCAJS4.js.map} +0 -0
  892. /package/dist/{summarizeMutationDiagnosis-OAUXQ6HD.js.map → ssGSEA-REHCYQ7Z.js.map} +0 -0
  893. /package/dist/{ssGSEA.unit.spec-UBZGATIZ.js.map → ssGSEA.unit.spec-XJNHMFF5.js.map} +0 -0
  894. /package/dist/{summarizeCnvGeneexp-IR7HMUG3.js.map → summarizeCnvGeneexp-NDEEB7PV.js.map} +0 -0
  895. /package/dist/{summarizeGeneexpSurvival-INZXCZ37.js.map → summarizeGeneexpSurvival-ZCGBEB4C.js.map} +0 -0
  896. /package/dist/{summarizeMutationCnv-GZFJTCRN.js.map → summarizeMutationCnv-OOMN2AVW.js.map} +0 -0
  897. /package/dist/{summary-SAVKS777.js.map → summarizeMutationDiagnosis-B6TF3KU5.js.map} +0 -0
  898. /package/dist/{summarizeMutationSurvival-PT2BGPWD.js.map → summarizeMutationSurvival-Y2J6T2CS.js.map} +0 -0
  899. /package/dist/{survival-65IBMTWU.js.map → summary-O5LSGPWD.js.map} +0 -0
  900. /package/dist/{summary.integration.spec-LWO7Y4OP.js.map → summary.integration.spec-EH7FMP7B.js.map} +0 -0
  901. /package/dist/{summaryInput-SEIB7F3A.js.map → summaryInput-ZWURF7E2.js.map} +0 -0
  902. /package/dist/{sunburst-HCF2V66V.js.map → sunburst-ZDE5Q2SJ.js.map} +0 -0
  903. /package/dist/{termCollection-GYMOT2EE.js.map → survival-DTUOFMGJ.js.map} +0 -0
  904. /package/dist/{survival-RIV2T7KO.js.map → survival-XKLFNJF2.js.map} +0 -0
  905. /package/dist/{survival.integration.spec-2V2O4H7K.js.map → survival.integration.spec-J352BAT4.js.map} +0 -0
  906. /package/dist/{svgraph-XV52FOMN.js.map → svgraph-NZQ6Z4HS.js.map} +0 -0
  907. /package/dist/{svmr-BDAHM7UH.js.map → svmr-BPDWKVL2.js.map} +0 -0
  908. /package/dist/{table-5N2CRI36.js.map → table-6FOITCXA.js.map} +0 -0
  909. /package/dist/{tk-IOJVJ34S.js.map → termCollection-HFDUSCPL.js.map} +0 -0
  910. /package/dist/{termCollection-TZY6DOSP.js.map → termCollection-SWYRSREU.js.map} +0 -0
  911. /package/dist/{termCollection.unit.spec-VWHQ72DD.js.map → termCollection.unit.spec-ZSAAQS26.js.map} +0 -0
  912. /package/dist/{tvs.density-AQ5GD437.js.map → tk-D2YVENB3.js.map} +0 -0
  913. /package/dist/{tp.ui-JHPHESWM.js.map → tp.ui-XALNLDLX.js.map} +0 -0
  914. /package/dist/{tvs.dt-JPB46UPH.js.map → tvs.density-HSVPDDGA.js.map} +0 -0
  915. /package/dist/{tvs.numeric-PLNP7MBV.js.map → tvs.dt-TOZ47QR3.js.map} +0 -0
  916. /package/dist/{tvs.dtcnv.categorical-37TA7GCY.js.map → tvs.dtcnv.categorical-OZFNQFCX.js.map} +0 -0
  917. /package/dist/{tvs.dtcnv.continuous-X4K3RPYG.js.map → tvs.dtcnv.continuous-XCZJ7JOD.js.map} +0 -0
  918. /package/dist/{tvs.dtfusion-77SKDRRH.js.map → tvs.dtfusion-G3BI6YSH.js.map} +0 -0
  919. /package/dist/{tvs.dtsnvindel-2QGQ455S.js.map → tvs.dtsnvindel-ETMWTQLL.js.map} +0 -0
  920. /package/dist/{tvs.dtsv-QBCE5IHM.js.map → tvs.dtsv-66AEHBQE.js.map} +0 -0
  921. /package/dist/{violin-DCKEHIVC.js.map → tvs.numeric-AU4U3UXI.js.map} +0 -0
  922. /package/dist/{tvs.samplelst-NRSYJ64L.js.map → tvs.samplelst-TMUNONJI.js.map} +0 -0
  923. /package/dist/{tvs.termCollection-BK36KZL2.js.map → tvs.termCollection-HZ2ZVONI.js.map} +0 -0
  924. /package/dist/{violin.interactivity-RS6D5YPY.js.map → violin-P4A4BLKJ.js.map} +0 -0
  925. /package/dist/{violin.integration.spec-IIYDX5DT.js.map → violin.integration.spec-DSSHXEES.js.map} +0 -0
  926. /package/dist/{violin.renderer-XIQTOVEK.js.map → violin.interactivity-FRXW7MH4.js.map} +0 -0
  927. /package/dist/{vocabulary-6437MWB6.js.map → violin.renderer-LQAFOSRK.js.map} +0 -0
@@ -0,0 +1,4945 @@
1
+ import {
2
+ rehydrateFilter
3
+ } from "./chunk-SKMFMGCD.js";
4
+ import {
5
+ showLDlegend
6
+ } from "./chunk-46COTHPZ.js";
7
+ import {
8
+ legend_newrow
9
+ } from "./chunk-4VGSBYQC.js";
10
+ import {
11
+ urlmap_default
12
+ } from "./chunk-AQ4OP4GR.js";
13
+ import {
14
+ ColorScale,
15
+ Tabs,
16
+ axisstyle,
17
+ fillTermWrapper,
18
+ fillbar,
19
+ makeNumericAxisConfig,
20
+ makeSsmLink,
21
+ make_radios,
22
+ newSandboxDiv,
23
+ renderCnvConfig,
24
+ renderTable,
25
+ shapeSelector,
26
+ shapes,
27
+ table2col,
28
+ to_textfile
29
+ } from "./chunk-SAHCLNNL.js";
30
+ import {
31
+ genomic2gm
32
+ } from "./chunk-HJ6L54YS.js";
33
+ import {
34
+ Menu
35
+ } from "./chunk-CXMZYVZT.js";
36
+ import {
37
+ dofetch3,
38
+ guessSsmid,
39
+ ssmIdFieldsSeparator,
40
+ summarize_mclass
41
+ } from "./chunk-KDKY7S5G.js";
42
+ import {
43
+ icons
44
+ } from "./chunk-73VHTIHG.js";
45
+ import {
46
+ niceNumLabels
47
+ } from "./chunk-GM6H3CUI.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-SOYDFNWV.js";
65
+ import {
66
+ convertUnits
67
+ } from "./chunk-TV74I3Y5.js";
68
+ import {
69
+ arc_default
70
+ } from "./chunk-CTVZMQ5J.js";
71
+ import {
72
+ axisLeft,
73
+ axisRight
74
+ } from "./chunk-LOZEKOES.js";
75
+ import {
76
+ format,
77
+ linear
78
+ } from "./chunk-733PDAIR.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-NZQ6Z4HS.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-WR3HFXR4.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-WR3HFXR4.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-477IKREB.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-ZDE5Q2SJ.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).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-BSDNBLN4.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("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").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").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").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("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("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("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("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").style("text-align", "right").style("opacity", 0.7).text(block.mclassOverride ? block.mclassOverride.className || "Mutation" : "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").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").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").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").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").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").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").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).style("padding", "5px 10px").style("margin", "1px").style("border-radius", "0px").on("click", () => {
3695
+ div.classed("sja_menuoption", false);
3696
+ div.style("background-color", "white");
3697
+ if (called == false) {
3698
+ called = true;
3699
+ renderShapePicker({
3700
+ holder: div.append("div").style("margin-top", "10px"),
3701
+ callback: (val) => opt.callback(val, tk),
3702
+ tk
3703
+ });
3704
+ }
3705
+ });
3706
+ } else {
3707
+ tk.legend.tip.d.append("div").attr("class", "sja_menuoption").style("border-radius", "0px").text(opt.label).on("click", () => {
3708
+ opt.callback();
3709
+ reload(tk);
3710
+ });
3711
+ }
3712
+ }
3713
+ }
3714
+ }
3715
+ function printCategory({ holder, key, color, count, label, click }) {
3716
+ const div = holder.append("div").attr("class", "sja_clb").style("display", "inline-block").on("click", click);
3717
+ div.append("div").style("display", "inline-block").attr("class", "sja_mcdot").style("background", color).html(count > 1 ? count : "&nbsp;");
3718
+ 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);
3719
+ }
3720
+
3721
+ // mds3/filterName.js
3722
+ function getFilterName(f) {
3723
+ if (!Array.isArray(f?.lst)) return "Invalid filter";
3724
+ const lst = f.lst.filter((i) => i.tag != "cohortFilter");
3725
+ if (lst.length == 0) return "No filter";
3726
+ if (lst.length == 1 && lst[0].type == "tvs") {
3727
+ const tvs = lst[0].tvs;
3728
+ if (!tvs) throw "f.lst[0].tvs{} missing";
3729
+ switch (tvs?.term?.type) {
3730
+ case "categorical":
3731
+ if (!Array.isArray(tvs.values)) throw "f.lst[0].tvs.values not array";
3732
+ const catKey = tvs.values[0]?.key;
3733
+ if (catKey == void 0) throw "f.lst[0].tvs.values[0].key missing";
3734
+ const catValue = tvs.term.values?.[catKey]?.label || catKey;
3735
+ if (tvs.values.length == 1) {
3736
+ if ((tvs.term.name + catValue).length < 20) {
3737
+ return tvs.term.name + (tvs.isnot ? "!=" : ": ") + catValue;
3738
+ }
3739
+ return (tvs.isnot ? "!" : "") + (catValue.length < 15 ? catValue : catValue.substring(0, 13) + "...");
3740
+ }
3741
+ return `${tvs.isnot ? "!" : ""}${catValue.length < 12 ? catValue : catValue.substring(0, 10) + "..."} (${tvs.values.length})`;
3742
+ case "integer":
3743
+ case "float":
3744
+ case "geneExpression":
3745
+ case "metaboliteIntensity":
3746
+ case "proteomeAbundance":
3747
+ return getNumericRangeLabel(tvs);
3748
+ case "samplelst":
3749
+ return Object.keys(tvs.term.values)[0];
3750
+ default:
3751
+ for (const dtt of dtTerms) {
3752
+ if (dtt.type == tvs.term.type) {
3753
+ return (tvs.term.parentTerm?.name || "?") + " " + dtt.name;
3754
+ }
3755
+ }
3756
+ throw "unknown tvs term type";
3757
+ }
3758
+ }
3759
+ return "Filter (" + lst.length + ")";
3760
+ }
3761
+ function getNumericRangeLabel(tvs) {
3762
+ if (!Array.isArray(tvs.ranges)) throw "tvs.ranges not array";
3763
+ if (!tvs.ranges[0]) throw "tvs.ranges[] blank array";
3764
+ const r = tvs.ranges[0];
3765
+ let startName, stopName;
3766
+ const vc = tvs.term.valueConversion;
3767
+ if (vc) {
3768
+ if ("start" in r) startName = convertUnits(r.start, vc.fromUnit, vc.toUnit, vc.scaleFactor, true);
3769
+ if ("stop" in r) stopName = convertUnits(r.stop, vc.fromUnit, vc.toUnit, vc.scaleFactor, true);
3770
+ } else {
3771
+ if (tvs.term.type == "integer") {
3772
+ if ("start" in r) startName = Math.round(r.start);
3773
+ if ("stop" in r) stopName = Math.round(r.stop);
3774
+ } else {
3775
+ if ("start" in r) startName = r.start;
3776
+ if ("stop" in r) stopName = r.stop;
3777
+ if ("start" in r && "stop" in r) {
3778
+ ;
3779
+ [startName, stopName] = niceNumLabels([startName, stopName]);
3780
+ }
3781
+ }
3782
+ }
3783
+ let label;
3784
+ if (tvs.isnot) {
3785
+ if (r.startunbounded) label = `x ${r.stopinclusive ? ">" : ">="} ${stopName}`;
3786
+ else if (r.stopunbounded) label = `x ${r.startinclusive ? "<" : "<="} ${startName}`;
3787
+ else label = `!(${startName} ${stopName})`;
3788
+ } else {
3789
+ if (r.startunbounded) label = `x ${r.stopinclusive ? "<=" : "<"} ${stopName}`;
3790
+ else if (r.stopunbounded) label = `x ${r.startinclusive ? ">=" : ">"} ${startName}`;
3791
+ else label = `${startName}${r.startinclusive ? "<=" : "<"}x${r.stopinclusive ? "<=" : "<"}${stopName}`;
3792
+ }
3793
+ if (tvs.ranges.length > 1) label += "...";
3794
+ return label;
3795
+ }
3796
+
3797
+ // mds3/makeTk.js
3798
+ var callbacknames = [
3799
+ "onClose",
3800
+ // this only takes effect if tk shows the "Close" handle, e.g. on subtk
3801
+ "click_snvindel",
3802
+ "callbackOnRender",
3803
+ "disc_mouseover",
3804
+ "disc_mouseout"
3805
+ ];
3806
+ async function makeTk(tk, block) {
3807
+ tk.subtk2height = {
3808
+ skewer: 0,
3809
+ leftlabels: 0,
3810
+ cnv: 0
3811
+ };
3812
+ tk.leftlabels = {
3813
+ g: tk.gleft.append("g"),
3814
+ // all labels are rendered here, except track label
3815
+ doms: {},
3816
+ // keys: label name, value: label dom
3817
+ // to avoid having to delete all labels upon tk rendering
3818
+ laby: 0,
3819
+ // cumulative height, 0 for no labels
3820
+ xoff: 0,
3821
+ maxwidth: 0
3822
+ // set default 0 in case track runs into err, can still render tk
3823
+ };
3824
+ tk._finish = loadTk_finish_closure(tk, block);
3825
+ tk.cache = {};
3826
+ tk.itemtip = new Menu();
3827
+ tk.hovertip = new Menu();
3828
+ tk.menutip = new Menu({ padding: "" });
3829
+ tk.load = _load(tk, block);
3830
+ tk.mnamegetter = (m) => {
3831
+ if (tk.mds.queries?.snvindel?.vcfid4skewerName && m.vcf_id) return m.vcf_id;
3832
+ const s = m.mname;
3833
+ if (!s) return "";
3834
+ if (s.length > 25) {
3835
+ return s.substr(0, 20) + "...";
3836
+ }
3837
+ return s;
3838
+ };
3839
+ await get_ds(tk, block);
3840
+ await mayInitTermdb(tk, block);
3841
+ await mayInit_variant2samples(tk, block);
3842
+ mayaddGetter_m2csq(tk, block);
3843
+ mayInitSkewer(tk);
3844
+ mayInitCnv(tk);
3845
+ if (tk.filterObj) await Promise.all(rehydrateFilter(tk.filterObj, tk.mds.termdb.vocabApi));
3846
+ tk.tklabel.text(tk.mds.label || tk.name);
3847
+ tk.clear = () => {
3848
+ if (tk.skewer) tk.skewer.g.selectAll("*").remove();
3849
+ };
3850
+ initLegend(tk, block);
3851
+ init_mclass(tk);
3852
+ tk.color4disc = (m) => {
3853
+ if (tk.mutationColorBy) {
3854
+ if (tk.mutationColorBy == "hardcode") {
3855
+ if (m.color) return m.color;
3856
+ }
3857
+ }
3858
+ if (tk.mds.queries?.ld?.mOverlay?.data) {
3859
+ const m0 = tk.mds.queries.ld.mOverlay.m;
3860
+ if (m.chr == m0.chr && m.pos == m0.pos && m.ref == m0.ref && m.alt == m0.alt) {
3861
+ return tk.mds.queries.ld.overlay.color_1;
3862
+ }
3863
+ for (const m1 of tk.mds.queries.ld.mOverlay.data) {
3864
+ if (m1.pos == m.pos && m1.alleles == m.ref + "." + m.alt) {
3865
+ return tk.mds.queries.ld.colorScale(m1.r2);
3866
+ }
3867
+ }
3868
+ return tk.mds.queries.ld.overlay.color_0;
3869
+ }
3870
+ if (tk.vcfinfofilter && tk.vcfinfofilter.setidx4mclass != void 0) {
3871
+ const mcset = tk.vcfinfofilter.lst[tk.vcfinfofilter.setidx4mclass];
3872
+ const [err, vlst] = getter_mcset_key(mcset, m);
3873
+ if (err || vlst == void 0) return "black";
3874
+ for (const v of vlst) {
3875
+ if (mcset.categories[v]) {
3876
+ return mcset.categories[v].color;
3877
+ } else {
3878
+ return "black";
3879
+ }
3880
+ }
3881
+ }
3882
+ if (mclass[m.class]) {
3883
+ return mclass[m.class].color;
3884
+ }
3885
+ return "black";
3886
+ };
3887
+ parseUrl(tk);
3888
+ if (tk.hlssmid) {
3889
+ tk.skewer.hlssmid = new Set(tk.hlssmid.split(","));
3890
+ delete tk.hlssmid;
3891
+ }
3892
+ try {
3893
+ validateSelectSamples(tk);
3894
+ } catch (e) {
3895
+ console.error(e);
3896
+ }
3897
+ tk.duplicateTk = (filter) => {
3898
+ const tkarg = {
3899
+ type: "mds3",
3900
+ dslabel: tk.dslabel,
3901
+ filter0: tk.filter0,
3902
+ showCloseLeftlabel: true,
3903
+ filterObj: filter || structuredClone(tk.filterObj),
3904
+ allow2selectSamples: tk.allow2selectSamples,
3905
+ onClose: tk.onClose,
3906
+ callbackOnRender: tk.callbackOnRender,
3907
+ hardcodeCnvOnly: tk.hardcodeCnvOnly,
3908
+ token: tk.token
3909
+ // for testing
3910
+ };
3911
+ if (tk.cnv?.presetMax) tkarg.cnv = { presetMax: tk.cnv.presetMax };
3912
+ if (tk.legend.mclass?.hiddenvalues?.size) {
3913
+ tkarg.legend = { mclass: { hiddenvalues: /* @__PURE__ */ new Set() } };
3914
+ for (const v of tk.legend.mclass.hiddenvalues) tkarg.legend.mclass.hiddenvalues.add(v);
3915
+ }
3916
+ return tkarg;
3917
+ };
3918
+ for (const n of callbacknames) {
3919
+ if (tk[n] && typeof tk[n] != "function") throw `.${n}() is not function`;
3920
+ }
3921
+ }
3922
+ function loadTk_finish_closure(tk, block) {
3923
+ return (data) => {
3924
+ tk.legend?.headTd.text(tk.name + (tk.filterObj ? " - " + getFilterName(tk.filterObj) : ""));
3925
+ if (tk.cnv) {
3926
+ tk.cnv.g.transition().attr("transform", `translate(0,${tk.subtk2height.skewer})`);
3927
+ }
3928
+ if (data) {
3929
+ if (data.error) {
3930
+ tk.subtk2height.skewer = 40;
3931
+ } else {
3932
+ let totalCount = 0;
3933
+ if (data.skewer) totalCount = data.skewer.length;
3934
+ if (data.cnv) totalCount += data.cnv.length;
3935
+ if (data.cnvDensity) totalCount += data.cnvDensity.segmentCount;
3936
+ if (totalCount == 0) {
3937
+ let context = "view range";
3938
+ if (block.usegm && block.gmmode != "genomic") context = block.usegm.name || block.usegm.isoform;
3939
+ 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");
3940
+ tk.subtk2height.skewer = 40;
3941
+ }
3942
+ }
3943
+ }
3944
+ tk.height_main = Math.max(
3945
+ tk.subtk2height.leftlabels,
3946
+ // won't be added if tk crashed
3947
+ tk.subtk2height.skewer + tk.subtk2height.cnv
3948
+ ) + tk.toppad + tk.bottompad;
3949
+ if (data) {
3950
+ updateLegend(data, tk, block);
3951
+ }
3952
+ tk.leftLabelMaxwidth = Math.max(
3953
+ tk.leftlabels.maxwidth + tk.leftlabels.xoff,
3954
+ // 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
3955
+ Number.isFinite(tk.skewer?.maxwidth) ? tk.skewer.maxwidth : 0
3956
+ );
3957
+ block.tkcloakoff(tk, { error: data ? data.error : null });
3958
+ block.block_setheight();
3959
+ block.setllabel();
3960
+ tk.callbackOnRender?.(tk, block);
3961
+ };
3962
+ }
3963
+ function parseUrl(tk) {
3964
+ const urlp = urlmap_default();
3965
+ if (tk.skewer) {
3966
+ if (urlp.has("hlaachange")) {
3967
+ tk.hlaachange = urlp.get("hlaachange");
3968
+ }
3969
+ if (urlp.has("hlssmid")) {
3970
+ tk.hlssmid = urlp.get("hlssmid").split(",");
3971
+ }
3972
+ }
3973
+ }
3974
+ function mayInitSkewer(tk) {
3975
+ if (!tk.mds.has_skewer) return;
3976
+ tk.skewer = {
3977
+ // both skewer and numeric mode will render elements into tk.skewer.g
3978
+ // will also attach skewer.discKickSelection
3979
+ g: tk.glider.append("g"),
3980
+ // border color of a box over a highlighted data
3981
+ hlBoxColor: tk.mds.hlBoxColor || "red",
3982
+ // default to show dot labels
3983
+ hideDotLabels: false,
3984
+ // true for pointing up
3985
+ pointup: true
3986
+ };
3987
+ setSkewerMode(tk);
3988
+ }
3989
+ function mayInitCnv(tk) {
3990
+ let cfg;
3991
+ if (tk.mds.termdbConfig?.queries?.cnv) {
3992
+ cfg = tk.mds.termdbConfig.queries.cnv;
3993
+ } else if (tk.custom_variants?.find((i) => i.dt == dtcnv)) {
3994
+ let useValue = false, useCat = false;
3995
+ for (const m of tk.custom_variants) {
3996
+ if (m.dt == dtcnv) {
3997
+ if (Number.isFinite(m.value)) useValue = true;
3998
+ else useCat = true;
3999
+ }
4000
+ }
4001
+ if (useValue && useCat) throw "custom cnv should be either using numeric value or not, but cannot be mixture";
4002
+ if (useValue) {
4003
+ cfg = {
4004
+ cnvGainCutoff: 0,
4005
+ // use 0 for not filtering and show all events
4006
+ cnvLossCutoff: 0
4007
+ };
4008
+ } else if (useCat) {
4009
+ cfg = {};
4010
+ } else {
4011
+ throw "custom cnv is neither value or category, should not happen";
4012
+ }
4013
+ } else {
4014
+ return;
4015
+ }
4016
+ if (!tk.cnv) tk.cnv = {};
4017
+ tk.cnv.g = tk.glider.append("g");
4018
+ tk.cnv.cnvMaxLength = cfg.cnvMaxLength;
4019
+ tk.cnv.cnvGainCutoff = cfg.cnvGainCutoff;
4020
+ tk.cnv.cnvLossCutoff = cfg.cnvLossCutoff;
4021
+ tk.cnv.absoluteValueRenderMax = cfg.absoluteValueRenderMax || 5;
4022
+ tk.cnv.gainColor = cfg.gainColor || "#D6683C";
4023
+ tk.cnv.lossColor = cfg.lossColor || "#67a9cf";
4024
+ tk.cnv.density = {
4025
+ barheight: 60
4026
+ };
4027
+ }
4028
+ function setSkewerMode(tk) {
4029
+ tk.skewer.viewModes = tk.skewerModes;
4030
+ delete tk.skewerModes;
4031
+ if (!tk.skewer.viewModes) tk.skewer.viewModes = [];
4032
+ const vm = tk.skewer.viewModes;
4033
+ if (!Array.isArray(vm)) throw "skewerModes[] is not array";
4034
+ if (tk.mds.skewerModes) {
4035
+ for (const n of tk.mds.skewerModes) vm.push(n);
4036
+ }
4037
+ if (!vm.find((n) => n.type == "skewer")) vm.push({ type: "skewer" });
4038
+ for (const n of vm) {
4039
+ if (typeof n != "object") throw "one of skewerModes[] is not object";
4040
+ if (n.type == "skewer") {
4041
+ if (!n.label) n.label = "lollipops";
4042
+ } else if (n.type == "numeric") {
4043
+ if (n.byAttribute) {
4044
+ if (!n.label) n.label = n.byAttribute;
4045
+ } else if (n.byInfo) {
4046
+ } else {
4047
+ throw "unknown data method for a type=numeric mode";
4048
+ }
4049
+ } else {
4050
+ throw "unknown type from a skewerModes[]";
4051
+ }
4052
+ }
4053
+ if (!vm.find((n) => n.inuse)) vm[0].inuse = true;
4054
+ }
4055
+ function init_mclass(tk) {
4056
+ if (tk.mds.hiddenmclass) {
4057
+ for (const c of tk.mds.hiddenmclass) tk.legend.mclass.hiddenvalues.add(c);
4058
+ }
4059
+ }
4060
+ async function get_ds(tk, block) {
4061
+ if (tk.dslabel) {
4062
+ const data = await dofetch3("getDataset", { body: { genome: block.genome.name, dsname: tk.dslabel } });
4063
+ if (data.error) throw "Error: " + data.error;
4064
+ if (!data.ds) throw "data.ds{} missing";
4065
+ if (!data.ds.isMds3) throw "A legacy dataset cannot be loaded as a mds3 track";
4066
+ tk.mds = data.ds;
4067
+ tk.name = data.ds.label;
4068
+ return;
4069
+ }
4070
+ if (!tk.name) tk.name = "Custom data";
4071
+ tk.mds = {};
4072
+ if (tk.bcf) {
4073
+ if (!tk.bcf.file && !tk.bcf.url) throw "file or url missing for tk.bcf{}";
4074
+ tk.mds.has_skewer = true;
4075
+ await getbcfheader_customtk(tk, block.genome);
4076
+ } else if (tk.custom_variants) {
4077
+ validateCustomVariants(tk, block);
4078
+ mayDeriveSkewerOccurrence4samples(tk);
4079
+ mayAddInfoField(tk);
4080
+ } else {
4081
+ throw "unknown data source for custom track";
4082
+ }
4083
+ mayProcessSampleAnnotation(tk);
4084
+ }
4085
+ function mayProcessSampleAnnotation(tk) {
4086
+ if (!tk.sampleAnnotation) return;
4087
+ if (!Array.isArray(tk.sampleAnnotation.terms)) throw "sampleAnnotation.terms is not array";
4088
+ if (!tk.mds.termdb) tk.mds.termdb = {};
4089
+ tk.mds.termdb.terms = tk.sampleAnnotation.terms;
4090
+ tk.mds.termdb.annotations = tk.sampleAnnotation.annotations;
4091
+ }
4092
+ async function mayInitTermdb(tk, block) {
4093
+ const tdb = tk.mds.termdb;
4094
+ if (!tdb) return;
4095
+ {
4096
+ const arg = {};
4097
+ if (tk.mds.label) {
4098
+ arg.vocab = {
4099
+ genome: block.genome.name,
4100
+ dslabel: tk.mds.label
4101
+ };
4102
+ } else if (tdb.terms) {
4103
+ arg.vocab = {
4104
+ terms: tdb.terms,
4105
+ sampleannotation: tdb.annotations
4106
+ };
4107
+ } else {
4108
+ throw "do not know how to init vocab";
4109
+ }
4110
+ const _ = await import("./vocabulary-ELXLTPKE.js");
4111
+ tdb.vocabApi = _.vocabInit(arg);
4112
+ if (!tdb.vocabApi.app) {
4113
+ tdb.vocabApi.app = { opts: { genome: block.genome } };
4114
+ }
4115
+ }
4116
+ tk.mds.termdbConfig = await tdb.vocabApi.getTermdbConfig();
4117
+ if (tk.mds.termdb.allowCaseDetails) {
4118
+ tk.mds.termdb.allowCaseDetails.get = async (acase) => {
4119
+ };
4120
+ }
4121
+ }
4122
+ function mayaddGetter_m2csq(tk, block) {
4123
+ if (!tk.mds.queries?.snvindel?.m2csq) return;
4124
+ tk.mds.queries.snvindel.m2csq.get = async (m) => {
4125
+ const body = { genome: block.genome.name, dslabel: tk.mds.label, m2csq: 1 };
4126
+ if (tk.mds.queries.snvindel.m2csq.by == "ssm_id") {
4127
+ body.ssm_id = m.ssm_id;
4128
+ } else {
4129
+ return { error: "unknown query method" };
4130
+ }
4131
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4132
+ if (tk.token) headers["X-Auth-Token"] = tk.token;
4133
+ return await dofetch3("mds3", { body, headers }, { serverData: tk.cache });
4134
+ };
4135
+ }
4136
+ async function mayInit_variant2samples(tk, block) {
4137
+ if (!tk.mds.variant2samples) return;
4138
+ if (tk.custom_variants) {
4139
+ addV2Sgetter_custom(tk, block);
4140
+ } else {
4141
+ addV2Sgetter_native(tk, block);
4142
+ }
4143
+ if (tk.mds.variant2samples.twLst) {
4144
+ if (!Array.isArray(tk.mds.variant2samples.twLst)) throw "v2s.twLst[] not array";
4145
+ if (!tk.mds.termdb?.vocabApi) throw "mds.termdb.vocabApi should be present for initiating v2s.twLst";
4146
+ for (const t of tk.mds.variant2samples.twLst) await fillTermWrapper(t, tk.mds.termdb.vocabApi);
4147
+ }
4148
+ }
4149
+ function addV2Sgetter_custom(tk, block) {
4150
+ tk.mds.variant2samples.get = (arg) => {
4151
+ if (arg.querytype == tk.mds.variant2samples.type_samples) {
4152
+ const samples = [];
4153
+ for (const m of arg.mlst) {
4154
+ if (!m.samples) continue;
4155
+ for (const s of m.samples) {
4156
+ const s2 = JSON.parse(JSON.stringify(s));
4157
+ s2.ssm_id = m.ssm_id;
4158
+ samples.push(s2);
4159
+ }
4160
+ }
4161
+ return { samples };
4162
+ }
4163
+ if (arg.querytype == tk.mds.variant2samples.type_summary) {
4164
+ throw "todo: summary";
4165
+ }
4166
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4167
+ throw "todo: sunburst";
4168
+ }
4169
+ throw "unknown querytype";
4170
+ };
4171
+ tk.mds.getSamples = () => {
4172
+ const id2sample = /* @__PURE__ */ new Map();
4173
+ for (const m of tk.custom_variants) {
4174
+ if (!m.samples) continue;
4175
+ for (const s of m.samples) {
4176
+ if (id2sample.has(s.sample_id)) {
4177
+ id2sample.get(s.sample_id).ssm_id_lst.push(m.ssm_id);
4178
+ } else {
4179
+ const s2 = JSON.parse(JSON.stringify(s));
4180
+ s2.ssm_id_lst = [m.ssm_id];
4181
+ id2sample.set(s.sample_id, s2);
4182
+ }
4183
+ }
4184
+ }
4185
+ return { samples: [...id2sample.values()] };
4186
+ };
4187
+ }
4188
+ function addV2Sgetter_native(tk, block) {
4189
+ tk.mds.variant2samples.get = async (arg) => {
4190
+ const par = {
4191
+ genome: block.genome.name,
4192
+ variant2samples: 1,
4193
+ get: arg.querytype,
4194
+ hardcodeCnvOnly: tk.hardcodeCnvOnly
4195
+ };
4196
+ if (tk.cnv) {
4197
+ if (tk.cnv.cnvMaxLength) par.cnvMaxLength = tk.cnv.cnvMaxLength;
4198
+ if (tk.cnv.cnvGainCutoff) par.cnvGainCutoff = tk.cnv.cnvGainCutoff;
4199
+ if (tk.cnv.cnvLossCutoff) par.cnvLossCutoff = tk.cnv.cnvLossCutoff;
4200
+ }
4201
+ if (tk.mds.label) {
4202
+ par.dslabel = tk.mds.label;
4203
+ } else if (tk.bcf) {
4204
+ if (tk.bcf.file) par.bcffile = tk.bcf.file;
4205
+ else if (tk.bcf.url) par.bcfurl = tk.bcf.url;
4206
+ else throw "tk.bcf{}: file/url missing";
4207
+ } else {
4208
+ throw "no dslabel or tk.bcf";
4209
+ }
4210
+ if (arg.groupSsmBySample) {
4211
+ par.groupSsmBySample = 1;
4212
+ }
4213
+ if (arg.mlst) {
4214
+ if (tk.mds.variant2samples.variantkey == "ssm_id") {
4215
+ par.ssm_id_lst = arg.mlst.map((i) => i.ssm_id).join(",");
4216
+ } else {
4217
+ throw "unknown variantkey for variant2samples";
4218
+ }
4219
+ }
4220
+ if (arg.isoform) {
4221
+ par.isoform = arg.isoform;
4222
+ }
4223
+ if (arg.rglst) {
4224
+ par.rglst = arg.rglst;
4225
+ }
4226
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4227
+ if (tk.set_id) par.set_id = tk.set_id;
4228
+ if (tk.token) headers["X-Auth-Token"] = tk.token;
4229
+ if (tk.filter0) par.filter0 = tk.filter0;
4230
+ if (tk.filterObj) par.filterObj = tk.filterObj;
4231
+ if (arg.tid2value) par.tid2value = arg.tid2value;
4232
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4233
+ if (tk.mds.variant2samples.sunburst_twLst) {
4234
+ par.twLst = tk.mds.variant2samples.sunburst_twLst;
4235
+ }
4236
+ } else if (arg.querytype == tk.mds.variant2samples.type_samples) {
4237
+ if (tk.mds.variant2samples.twLst) par.twLst = tk.mds.variant2samples.twLst;
4238
+ } else if (arg.querytype == tk.mds.variant2samples.type_summary) {
4239
+ if (tk.mds.variant2samples.twLst) par.twLst = tk.mds.variant2samples.twLst;
4240
+ } else {
4241
+ throw "unknown querytype";
4242
+ }
4243
+ par.skewerRim = tk.mds.queries.snvindel?.skewerRim;
4244
+ if (tk.legend?.formatFilter) {
4245
+ const filter = {};
4246
+ for (const k in tk.legend.formatFilter) {
4247
+ if (tk.legend.formatFilter[k].hiddenvalues.size) {
4248
+ filter[k] = [...tk.legend.formatFilter[k].hiddenvalues];
4249
+ }
4250
+ }
4251
+ if (Object.keys(filter).length) {
4252
+ par.formatFilter = filter;
4253
+ }
4254
+ }
4255
+ if (tk.legend?.mclass?.hiddenvalues?.size) {
4256
+ par.hiddenmclasslst = JSON.stringify([...tk.legend.mclass.hiddenvalues]);
4257
+ }
4258
+ const data = await dofetch3("mds3", { body: par, headers }, { serverData: tk.cache });
4259
+ if (data.error) throw data.error;
4260
+ const r = data.variant2samples;
4261
+ if (!r) throw "result error";
4262
+ if (arg.querytype == tk.mds.variant2samples.type_sunburst) {
4263
+ if (!Array.isArray(r.nodes)) throw "nodes[] not array from return";
4264
+ } else if (arg.querytype == tk.mds.variant2samples.type_samples) {
4265
+ if (!Array.isArray(r.samples)) throw "samples[] not array from return";
4266
+ } else if (arg.querytype == tk.mds.variant2samples.type_summary) {
4267
+ if (!Array.isArray(r.summary)) throw "summary[] not array from return";
4268
+ } else {
4269
+ throw "unknown querytype";
4270
+ }
4271
+ return r;
4272
+ };
4273
+ tk.mds.getSamples = async (arg = {}) => {
4274
+ if (arg.isSummary) {
4275
+ arg.querytype = tk.mds.variant2samples.type_summary;
4276
+ } else {
4277
+ arg.querytype = tk.mds.variant2samples.type_samples;
4278
+ arg.groupSsmBySample = 1;
4279
+ }
4280
+ rangequery_rglst(tk, block, arg);
4281
+ return await tk.mds.variant2samples.get(arg);
4282
+ };
4283
+ }
4284
+ function _load(tk, block) {
4285
+ return async () => {
4286
+ return await loadTk(tk, block);
4287
+ };
4288
+ }
4289
+ function getter_mcset_key(mcset, m) {
4290
+ if (mcset.altalleleinfo) {
4291
+ if (!m.altinfo) return ["no .altinfo"];
4292
+ const value = m.altinfo[mcset.altalleleinfo.key];
4293
+ if (value == void 0) {
4294
+ if (mcset.numericfilter) {
4295
+ return [null, [0]];
4296
+ }
4297
+ return [null, void 0];
4298
+ }
4299
+ let vlst = Array.isArray(value) ? value : [value];
4300
+ if (mcset.altalleleinfo.separator) {
4301
+ vlst = vlst[0].split(mcset.altalleleinfo.separator);
4302
+ }
4303
+ return [null, vlst];
4304
+ }
4305
+ if (mcset.locusinfo) {
4306
+ if (!m.info) return ["no .info"];
4307
+ const value = m.info[mcset.locusinfo.key];
4308
+ if (value == void 0) {
4309
+ if (mcset.numericfilter) {
4310
+ return [null, [0]];
4311
+ }
4312
+ return [null, void 0];
4313
+ }
4314
+ let vlst = Array.isArray(value) ? value : [value];
4315
+ if (mcset.locusinfo.separator) {
4316
+ vlst = vlst[0].split(mcset.locusinfo.separator);
4317
+ }
4318
+ return [null, vlst];
4319
+ }
4320
+ return ["no trigger"];
4321
+ }
4322
+ function validateCustomVariants(tk, block) {
4323
+ for (const m of tk.custom_variants) {
4324
+ if (m.dt == dtsnvindel) {
4325
+ tk.mds.has_skewer = true;
4326
+ validateCustomSnvindel(m);
4327
+ continue;
4328
+ }
4329
+ if (m.dt == dtfusionrna || m.dt == dtsv) {
4330
+ tk.mds.has_skewer = true;
4331
+ validateCustomSvfusion(m, block);
4332
+ continue;
4333
+ }
4334
+ if (m.dt == dtcnv) {
4335
+ m.ssm_id = [m.chr, m.start, m.stop, m.class].join(ssmIdFieldsSeparator);
4336
+ continue;
4337
+ }
4338
+ throw "unknown dt for a custom variant";
4339
+ }
4340
+ }
4341
+ function validateCustomSnvindel(m) {
4342
+ if (!m.chr) throw ".chr missing for custom snvindel";
4343
+ if (!Number.isInteger(m.pos)) throw ".pos not integer for custom snvindel";
4344
+ if (!m.ssm_id) {
4345
+ m.ssm_id = [m.chr, m.pos, m.ref && m.alt ? m.ref + ssmIdFieldsSeparator + m.alt : m.mname].join(
4346
+ ssmIdFieldsSeparator
4347
+ );
4348
+ }
4349
+ }
4350
+ function validateCustomSvfusion(m, block) {
4351
+ if (m.pairlst) {
4352
+ } else {
4353
+ if (!m.chr1) throw ".chr1 missing for custom sv/fusion";
4354
+ if (!Number.isInteger(m.pos1)) throw ".pos1 not integer for custom svfusion";
4355
+ if (m.strand1 != "+" && m.strand1 != "-") throw ".strand1 not +/- for custom svfusion";
4356
+ if (!m.chr2) throw ".chr1 missing for custom sv/fusion";
4357
+ if (!Number.isInteger(m.pos2)) throw ".pos1 not integer for custom svfusion";
4358
+ if (m.strand2 != "+" && m.strand2 != "-") throw ".strand1 not +/- for custom svfusion";
4359
+ m.pairlst = [
4360
+ {
4361
+ a: {
4362
+ chr: m.chr1,
4363
+ pos: m.pos1,
4364
+ strand: m.strand1,
4365
+ name: m.gene1 || ""
4366
+ },
4367
+ b: {
4368
+ chr: m.chr2,
4369
+ pos: m.pos2,
4370
+ strand: m.strand2,
4371
+ name: m.gene2 || ""
4372
+ }
4373
+ }
4374
+ ];
4375
+ delete m.chr1;
4376
+ delete m.pos1;
4377
+ delete m.strand1;
4378
+ delete m.gene1;
4379
+ delete m.chr2;
4380
+ delete m.pos2;
4381
+ delete m.strand2;
4382
+ delete m.gene2;
4383
+ }
4384
+ const fields = [m.dt];
4385
+ const hits = block.seekcoord(m.pairlst[0].a.chr, m.pairlst[0].a.pos);
4386
+ if (hits.length && hits[0].x > 0 && hits[0].x < block.width) {
4387
+ fields.push(...[m.pairlst[0].a.chr, m.pairlst[0].a.pos, m.pairlst[0].a.strand, 0, m.pairlst[0].a.name]);
4388
+ m.mname = m.pairlst[0].b.name || "";
4389
+ m.chr = m.pairlst[0].a.chr;
4390
+ m.pos = m.pairlst[0].a.pos;
4391
+ m.pairlstIdx = 0;
4392
+ } else {
4393
+ const hits2 = block.seekcoord(m.pairlst[0].b.chr, m.pairlst[0].b.pos);
4394
+ if (hits2.length && hits2[0].x > 0 && hits2[0].x < block.width) {
4395
+ fields.push(...[m.pairlst[0].b.chr, m.pairlst[0].b.pos, m.pairlst[0].b.strand, 1, m.pairlst[0].b.name]);
4396
+ m.mname = m.pairlst[0].a.name || "";
4397
+ m.chr = m.pairlst[0].b.chr;
4398
+ m.pos = m.pairlst[0].b.pos;
4399
+ m.pairlstIdx = 1;
4400
+ } else {
4401
+ }
4402
+ }
4403
+ m.ssm_id = fields.join(ssmIdFieldsSeparator);
4404
+ }
4405
+ function mayDeriveSkewerOccurrence4samples(tk) {
4406
+ if (tk.custom_variants.find((i) => i.occurrence != void 0)) {
4407
+ return;
4408
+ }
4409
+ for (const i of tk.custom_variants) {
4410
+ if (i.sample) {
4411
+ i.sample_id = i.sample;
4412
+ delete i.sample;
4413
+ }
4414
+ }
4415
+ if (!tk.custom_variants.find((i) => i.sample_id)) {
4416
+ return;
4417
+ }
4418
+ const ungrouped = [];
4419
+ const key2m = /* @__PURE__ */ new Map();
4420
+ for (const m of tk.custom_variants) {
4421
+ if (m.dt != dtsnvindel) {
4422
+ m.occurrence = 1;
4423
+ m.samples = [{ sample_id: m.sample_id }];
4424
+ delete m.sample_id;
4425
+ ungrouped.push(m);
4426
+ continue;
4427
+ }
4428
+ const key = [m.mname, m.chr, m.pos, m.ref, m.alt].join(ssmIdFieldsSeparator);
4429
+ const m2 = key2m.get(key);
4430
+ if (m2) {
4431
+ m2.occurrence++;
4432
+ m2.samples.push({
4433
+ sample_id: m.sample_id
4434
+ });
4435
+ } else {
4436
+ m.occurrence = 1;
4437
+ m.samples = [
4438
+ {
4439
+ sample_id: m.sample_id
4440
+ }
4441
+ ];
4442
+ delete m.sample_id;
4443
+ key2m.set(key, m);
4444
+ }
4445
+ }
4446
+ tk.custom_variants = ungrouped;
4447
+ for (const m of key2m.values()) tk.custom_variants.push(m);
4448
+ if (!tk.mds.variant2samples) tk.mds.variant2samples = {};
4449
+ const v = tk.mds.variant2samples;
4450
+ v.type_samples = "samples";
4451
+ v.type_summary = "summary";
4452
+ v.type_sunburst = "sunburst";
4453
+ }
4454
+ function mayAddInfoField(tk) {
4455
+ if (!tk.custom_variants.some((i) => i.info)) return;
4456
+ const info = {};
4457
+ for (const m of tk.custom_variants) {
4458
+ if (typeof m.info != "object") continue;
4459
+ for (const k in m.info) {
4460
+ const v = m.info[k];
4461
+ if (v == null || v == void 0) continue;
4462
+ if (!info[k]) info[k] = { ID: k, Number: ".", Type: "String", categories: {} };
4463
+ if (!info[k].categories[v]) info[k].categories[v] = {};
4464
+ }
4465
+ }
4466
+ for (const k in info) {
4467
+ const colors = getColors(Object.keys(info[k].categories).length);
4468
+ for (const c in info[k].categories) {
4469
+ info[k].categories[c].color = colors(c);
4470
+ }
4471
+ }
4472
+ tk.mds.bcf = { info };
4473
+ }
4474
+ async function getbcfheader_customtk(tk, genome) {
4475
+ const arg = { genome: genome.name };
4476
+ if (tk.bcf.file) {
4477
+ arg.file = tk.bcf.file;
4478
+ } else {
4479
+ arg.url = tk.bcf.url;
4480
+ if (tk.bcf.indexURL) arg.indexURL = tk.bcf.indexURL;
4481
+ }
4482
+ const data = await dofetch3("bcfheader", { body: arg });
4483
+ if (data.error) throw data.error;
4484
+ const [info, format2, samples, errs] = data.header;
4485
+ if (errs) throw "Error parsing VCF meta lines: " + errs.join("; ");
4486
+ tk.mds.bcf = {
4487
+ info,
4488
+ format: format2
4489
+ // can be null
4490
+ };
4491
+ if (samples?.length) {
4492
+ tk.mds.bcf.samples = samples;
4493
+ tk.mds.variant2samples = {
4494
+ //twLst:[], // TODO should not be required
4495
+ type_samples: "samples",
4496
+ variantkey: "ssm_id"
4497
+ };
4498
+ }
4499
+ if (!tk.mds.queries) tk.mds.queries = {};
4500
+ tk.mds.queries.snvindel = { forTrack: true };
4501
+ }
4502
+ function validateSelectSamples(tk) {
4503
+ const a = tk.allow2selectSamples;
4504
+ if (!a) return;
4505
+ if (!a.buttonText) a.buttonText = "Select samples";
4506
+ if (typeof a.buttonText != "string") throw "allow2selectSamples.buttonText value is not string";
4507
+ if (!a.attributes) a.attributes = [{ from: "sample_id", to: "sample_id" }];
4508
+ if (!Array.isArray(a.attributes)) throw "allow2selectSamples.attributes[] is not array";
4509
+ if (a.attributes.length == 0) throw "allow2selectSamples.attributes[] blank array";
4510
+ for (const i of a.attributes) {
4511
+ if (typeof i.from != "string" || !i.from) throw "allow2selectSamples.attributes.from is not string";
4512
+ if (typeof i.to != "string" || !i.to) throw "allow2selectSamples.attributes.to is not string";
4513
+ }
4514
+ if (typeof a.callback != "function") throw "allow2selectSamples.callback() is not function";
4515
+ a._cart = [];
4516
+ }
4517
+
4518
+ // mds3/cnv.js
4519
+ var maxRowHeight = 10;
4520
+ var maxTkHeight = 200;
4521
+ function getRowHeight(rows, tk) {
4522
+ let maxh = maxTkHeight;
4523
+ if (tk.subtk2height.skewer == 0) {
4524
+ maxh *= 2;
4525
+ }
4526
+ const v = maxh / rows.length;
4527
+ if (v > maxRowHeight) return [maxRowHeight, 1];
4528
+ if (v > 3) return [Math.floor(v), 1];
4529
+ if (v > 1) return [Math.floor(v), 0];
4530
+ return [v, 0];
4531
+ }
4532
+ function may_render_cnv(data, tk, block) {
4533
+ if (!tk.cnv) return;
4534
+ tk.cnv?.g.selectAll("*").remove();
4535
+ delete tk.cnv.cnvLst;
4536
+ delete tk.cnv.cnvInDensity;
4537
+ delete tk.cnv.cnvMsg;
4538
+ if (data.cnv) {
4539
+ if (!Array.isArray(data.cnv.cnvs)) throw "data.cnv.cnvs[] not array";
4540
+ tk.cnv.cnvMsg = data.cnv.cnvMsg;
4541
+ renderSegments(data, tk, block);
4542
+ return;
4543
+ }
4544
+ if (data.cnvDensity) {
4545
+ tk.cnv.cnvInDensity = true;
4546
+ tk.cnv.cnvMsg = data.cnvDensity.cnvMsg;
4547
+ renderDensity(data, tk, block);
4548
+ return;
4549
+ }
4550
+ tk.subtk2height.cnv = 0;
4551
+ if (tk.cnv) tk.cnv.cnvLst = [];
4552
+ }
4553
+ function renderDensity(data, tk, block) {
4554
+ tk.cnv.g.append("image").attr("width", block.width).attr("height", tk.cnv.density.barheight).attr("xlink:href", data.cnvDensity.gain.src);
4555
+ 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);
4556
+ axisstyle({
4557
+ axis: tk.cnv.g.append("g").attr("transform", `translate(-1,0)`).call(
4558
+ axisRight().scale(linear().domain([0, data.cnvDensity.max]).range([tk.cnv.density.barheight, 0])).tickValues([0, data.cnvDensity.max])
4559
+ ),
4560
+ color: "black",
4561
+ showline: true
4562
+ });
4563
+ axisstyle({
4564
+ axis: tk.cnv.g.append("g").attr("transform", `translate(-1,${tk.cnv.density.barheight})`).call(
4565
+ axisRight().scale(linear().domain([0, data.cnvDensity.max]).range([0, tk.cnv.density.barheight])).tickValues([0, data.cnvDensity.max])
4566
+ ),
4567
+ color: "black",
4568
+ showline: true
4569
+ });
4570
+ tk.cnv.g.append("text").text("Gain").attr("font-size", block.labelfontsize * 0.9).attr("x", 5).attr("y", tk.cnv.density.barheight / 2);
4571
+ 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);
4572
+ tk.subtk2height.cnv = tk.cnv.density.barheight * 2;
4573
+ }
4574
+ function renderSegments(data, tk, block) {
4575
+ const [cnvBySample, cnvLst, absoluteMax] = prepData(data, tk, block);
4576
+ tk.cnv.cnvLst = cnvLst;
4577
+ tk.cnv.absoluteMax = absoluteMax;
4578
+ tk.cnv.colorScale = linear(
4579
+ tk.cnv.presetMax ? [-tk.cnv.presetMax, 0, tk.cnv.presetMax] : [-absoluteMax, 0, absoluteMax],
4580
+ [tk.cnv.lossColor, "white", tk.cnv.gainColor]
4581
+ ).clamp(true);
4582
+ const [rowheight, rowspace] = getRowHeight(cnvBySample || cnvLst, tk);
4583
+ if (cnvBySample) {
4584
+ for (const sample of cnvBySample) {
4585
+ for (const c of sample.cnvs) {
4586
+ plotOneSegment(c, sample.y * (rowheight + rowspace), rowheight, tk, block, sample);
4587
+ }
4588
+ }
4589
+ } else {
4590
+ for (const c of cnvLst) {
4591
+ plotOneSegment(c, c.y * (rowheight + rowspace), rowheight, tk, block);
4592
+ }
4593
+ }
4594
+ const rowc = (cnvBySample || cnvLst).length;
4595
+ tk.subtk2height.cnv = rowc * rowheight + (rowc - 1) * rowspace;
4596
+ }
4597
+ function prepData(data, tk, block) {
4598
+ let maxAbsoluteValue = 0;
4599
+ const sample2cnv = /* @__PURE__ */ new Map();
4600
+ const cnvLst = [];
4601
+ for (const v of data.cnv.cnvs) {
4602
+ if (!v.chr) continue;
4603
+ if (!Number.isInteger(v.start) || !Number.isInteger(v.stop)) continue;
4604
+ const t1 = block.seekcoord(v.chr, v.start)[0];
4605
+ if (!t1) continue;
4606
+ const t2 = block.seekcoord(v.chr, v.stop)[0];
4607
+ if (!t2) continue;
4608
+ const j = structuredClone(v);
4609
+ if (t1.x > t2.x) {
4610
+ j.x1 = t2.x;
4611
+ j.x2 = t1.x;
4612
+ } else {
4613
+ j.x1 = t1.x;
4614
+ j.x2 = t2.x;
4615
+ }
4616
+ if (Number.isFinite(v.value)) maxAbsoluteValue = Math.max(maxAbsoluteValue, Math.abs(v.value));
4617
+ cnvLst.push(j);
4618
+ if (Array.isArray(v.samples)) {
4619
+ for (const s of v.samples) {
4620
+ if (!sample2cnv.has(s.sample_id)) sample2cnv.set(s.sample_id, []);
4621
+ sample2cnv.get(s.sample_id).push(structuredClone(j));
4622
+ }
4623
+ }
4624
+ }
4625
+ let samples;
4626
+ if (sample2cnv.size) {
4627
+ samples = [];
4628
+ for (const [s, cnvs] of sample2cnv) {
4629
+ cnvs.sort((a, b) => a.x1 - b.x1);
4630
+ samples.push({
4631
+ sample_id: s,
4632
+ cnvs,
4633
+ x1: Math.min(...cnvs.map((i) => i.x1)),
4634
+ x2: Math.max(...cnvs.map((i) => i.x2))
4635
+ });
4636
+ }
4637
+ samples.sort((a, b) => a.x1 - b.x1);
4638
+ for (let i = 0; i < samples.length; i++) samples[i].y = i;
4639
+ } else {
4640
+ cnvLst.sort((a, b) => a.x1 - b.x1);
4641
+ stackRows(cnvLst, 0);
4642
+ }
4643
+ return [samples, cnvLst, Math.min(tk.cnv.absoluteValueRenderMax, maxAbsoluteValue)];
4644
+ }
4645
+ function plotOneSegment(c, y, rowheight, tk, block, sample) {
4646
+ const x1 = Math.max(0, c.x1), x2 = Math.min(c.x2, block.width);
4647
+ 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) => {
4648
+ event2.target.setAttribute("stroke", "black");
4649
+ tk.hovertip.clear().show(event2.clientX, event2.clientY);
4650
+ const table = table2col({ holder: tk.hovertip.d });
4651
+ table_cnv({ mlst: [c], tk }, table);
4652
+ if (sample) {
4653
+ const [t1, t2] = table.addRow();
4654
+ t1.text("Sample");
4655
+ t2.text(sample.sample_id);
4656
+ }
4657
+ }).on("mouseout", (event2) => {
4658
+ event2.target.setAttribute("stroke", "");
4659
+ tk.hovertip.hide();
4660
+ }).on("click", async (event2) => {
4661
+ tk.itemtip.clear().show(event2.clientX, event2.clientY);
4662
+ await itemtable_oneItem({
4663
+ mlst: [c],
4664
+ tk,
4665
+ block,
4666
+ div: tk.itemtip.d
4667
+ });
4668
+ return;
4669
+ const table = table2col({ holder: tk.itemtip.d });
4670
+ const cnv = structuredClone(c);
4671
+ if (sample) {
4672
+ cnv.samples = [{ sample_id: sample.sample_id }];
4673
+ }
4674
+ table_cnv({ mlst: [cnv], tk }, table, true);
4675
+ });
4676
+ }
4677
+ function stackRows(lst, spacing) {
4678
+ const stacks = [];
4679
+ for (const item of lst) {
4680
+ for (let i = 0; i < stacks.length; i++) {
4681
+ if (stacks[i] + spacing < item.x1) {
4682
+ stacks[i] = item.x2;
4683
+ item.y = i;
4684
+ break;
4685
+ }
4686
+ }
4687
+ if (!("y" in item)) {
4688
+ item.y = stacks.length;
4689
+ stacks.push(item.x2);
4690
+ }
4691
+ }
4692
+ }
4693
+
4694
+ // mds3/tk.js
4695
+ async function loadTk(tk, block) {
4696
+ block.tkcloakon(tk);
4697
+ block.block_setheight();
4698
+ try {
4699
+ if (!tk.mds || tk.uninitialized) {
4700
+ await makeTk(tk, block);
4701
+ }
4702
+ const data = await getTkData(tk, block);
4703
+ if (tk.uninitialized) {
4704
+ tk.clear();
4705
+ delete tk.uninitialized;
4706
+ }
4707
+ may_render_skewer(data, tk, block);
4708
+ may_render_cnv(data, tk, block);
4709
+ await make_leftlabels(data, tk, block);
4710
+ tk._finish(data);
4711
+ } catch (e) {
4712
+ if (tk.clear) tk.clear();
4713
+ if (tk.subtk2height) tk.subtk2height.skewer = 50;
4714
+ if (tk._finish) tk._finish({ error: e.message || e });
4715
+ if (e.stack) console.log(e.stack);
4716
+ return;
4717
+ }
4718
+ }
4719
+ function getParameter(tk, block) {
4720
+ const par = {
4721
+ genome: block.genome.name,
4722
+ // instructs server to return data types associated with tracks
4723
+ // including skewer or non-skewer
4724
+ forTrack: 1,
4725
+ // may not pass skewerRim if it is not in use (turn off)
4726
+ skewerRim: tk.mds.queries?.snvindel?.skewerRim,
4727
+ // instructions for counting rim counts per variant
4728
+ hardcodeCnvOnly: tk.hardcodeCnvOnly
4729
+ };
4730
+ const headers = { "Content-Type": "application/json", Accept: "application/json" };
4731
+ par.skewer = 1;
4732
+ if (tk.set_id) {
4733
+ par.set_id = tk.set_id;
4734
+ }
4735
+ if (tk.filter0) {
4736
+ par.filter0 = tk.filter0;
4737
+ }
4738
+ if (tk.filterObj) {
4739
+ if (tk.filterObj?.lst.length) {
4740
+ par.filterObj = tk.filterObj;
4741
+ }
4742
+ }
4743
+ if (tk.token) {
4744
+ headers["X-Auth-Token"] = tk.token;
4745
+ }
4746
+ if (tk.mds.label) {
4747
+ par.dslabel = tk.mds.label;
4748
+ } else {
4749
+ if (tk.bcf) {
4750
+ if (tk.bcf.file) {
4751
+ par.bcffile = tk.bcf.file;
4752
+ } else if (tk.bcf.url) {
4753
+ par.bcfurl = tk.bcf.url;
4754
+ if (tk.bcf.indexURL) par.bcfindexURL = tk.bcf.indexURL;
4755
+ } else {
4756
+ throw ".file and .url missing for tk.bcf{}";
4757
+ }
4758
+ }
4759
+ }
4760
+ rangequery_rglst(tk, block, par);
4761
+ if (tk.legend?.mclass.hiddenvalues.size) {
4762
+ par.hiddenmclasslst = JSON.stringify([...tk.legend.mclass.hiddenvalues]);
4763
+ }
4764
+ if (tk.legend?.bcfInfo) {
4765
+ const infoFilter = {};
4766
+ for (const k in tk.legend.bcfInfo) {
4767
+ if (tk.legend.bcfInfo[k].hiddenvalues.size) {
4768
+ infoFilter[k] = [...tk.legend.bcfInfo[k].hiddenvalues];
4769
+ }
4770
+ }
4771
+ if (Object.keys(infoFilter).length) {
4772
+ par.infoFilter = infoFilter;
4773
+ }
4774
+ }
4775
+ if (tk.legend?.formatFilter) {
4776
+ const filter = {};
4777
+ for (const k in tk.legend.formatFilter) {
4778
+ if (tk.legend.formatFilter[k].hiddenvalues.size) {
4779
+ filter[k] = [...tk.legend.formatFilter[k].hiddenvalues];
4780
+ }
4781
+ }
4782
+ if (Object.keys(filter).length) {
4783
+ par.formatFilter = filter;
4784
+ }
4785
+ }
4786
+ if (tk.cnv) {
4787
+ if (tk.cnv.cnvMaxLength) par.cnvMaxLength = tk.cnv.cnvMaxLength;
4788
+ if (tk.cnv.cnvGainCutoff) par.cnvGainCutoff = tk.cnv.cnvGainCutoff;
4789
+ if (tk.cnv.cnvLossCutoff) par.cnvLossCutoff = tk.cnv.cnvLossCutoff;
4790
+ par.cnvDensity = {
4791
+ width: block.width,
4792
+ barheight: tk.cnv.density.barheight,
4793
+ pcolor: tk.cnv.gainColor,
4794
+ ncolor: tk.cnv.lossColor
4795
+ };
4796
+ }
4797
+ return [par, headers];
4798
+ }
4799
+ async function getTkData(tk, block) {
4800
+ let data;
4801
+ if (tk.custom_variants) {
4802
+ data = await dataFromCustomVariants(tk, block);
4803
+ } else {
4804
+ const [body, headers] = getParameter(tk, block);
4805
+ data = await dofetch3("mds3", { body, headers });
4806
+ }
4807
+ if (data.error) throw data.error;
4808
+ return data;
4809
+ }
4810
+ function rangequery_rglst(tk, block, par) {
4811
+ if (typeof par != "object") throw "par{} is not object";
4812
+ let rglst = [];
4813
+ if (block.usegm) {
4814
+ const r = {
4815
+ chr: block.rglst[0].chr,
4816
+ reverse: block.rglst[0].reverse,
4817
+ width: 0,
4818
+ start: null,
4819
+ stop: null
4820
+ };
4821
+ for (let i = block.startidx; i <= block.stopidx; i++) {
4822
+ const j = block.rglst[i];
4823
+ r.width += j.width + block.regionspace;
4824
+ r.start = r.start == null ? j.start : Math.min(r.start, j.start);
4825
+ r.stop = r.stop == null ? j.stop : Math.max(r.stop, j.stop);
4826
+ }
4827
+ rglst.push(r);
4828
+ if (block.gmmode == "genomic") {
4829
+ } else {
4830
+ par.isoform = block.usegm.isoform;
4831
+ par.gene = block.usegm.name;
4832
+ }
4833
+ } else {
4834
+ rglst = block.tkarg_rglst(tk);
4835
+ }
4836
+ let xoff = 0;
4837
+ for (const r of rglst) {
4838
+ r.xoff = 0;
4839
+ xoff += r.width + block.regionspace;
4840
+ }
4841
+ if (block.subpanels.length == tk.subpanels.length) {
4842
+ for (const r of block.subpanels) {
4843
+ rglst.push({
4844
+ chr: r.chr,
4845
+ start: r.start,
4846
+ stop: r.stop,
4847
+ width: r.width,
4848
+ exonsf: r.exonsf,
4849
+ xoff
4850
+ });
4851
+ xoff += r.width + r.leftpad;
4852
+ }
4853
+ }
4854
+ par.rglst = rglst;
4855
+ par.regionspace = block.regionspace;
4856
+ par.devicePixelRatio = window.devicePixelRatio > 1 ? window.devicePixelRatio : 1;
4857
+ }
4858
+ async function dataFromCustomVariants(tk, block) {
4859
+ const data = {
4860
+ // these holder will contain subset of tk.custom_variants[] that are in view range
4861
+ skewer: [],
4862
+ // for non-cnv data
4863
+ cnv: {
4864
+ cnvs: []
4865
+ // for cnv segments
4866
+ }
4867
+ // adds mclass2variantcount[] later
4868
+ };
4869
+ let bbstart = null, bbstop;
4870
+ for (let i = block.startidx; i <= block.stopidx; i++) {
4871
+ if (bbstart == null) {
4872
+ bbstart = block.rglst[i].start;
4873
+ bbstop = block.rglst[i].stop;
4874
+ } else {
4875
+ bbstart = Math.min(bbstart, block.rglst[i].start);
4876
+ bbstop = Math.max(bbstop, block.rglst[i].stop);
4877
+ }
4878
+ }
4879
+ for (const m of tk.custom_variants) {
4880
+ if (tk.legend?.bcfInfo) {
4881
+ let skip = false;
4882
+ for (const infoKey in tk.legend.bcfInfo) {
4883
+ if (tk.legend.bcfInfo[infoKey].hiddenvalues?.size) {
4884
+ const v = m.info?.[infoKey] || unannotatedKey;
4885
+ if (tk.legend?.bcfInfo[infoKey].hiddenvalues.has(v)) {
4886
+ skip = true;
4887
+ break;
4888
+ }
4889
+ }
4890
+ }
4891
+ if (skip) continue;
4892
+ }
4893
+ if (m.dt == dtcnv) {
4894
+ if (m.chr != block.rglst[0].chr) continue;
4895
+ if (Math.max(m.start, bbstart) > Math.min(m.stop, bbstop)) continue;
4896
+ data.cnv.cnvs.push(m);
4897
+ } else if (m.dt == dtsnvindel || m.dt == dtsv || m.dt == dtfusionrna) {
4898
+ if (m.chr != block.rglst[0].chr) continue;
4899
+ if (m.pos <= bbstart || m.pos >= bbstop) continue;
4900
+ if (!m.class) m.class = "X";
4901
+ if (!mclass[m.class]) m.class = "X";
4902
+ if (tk.legend?.mclass.hiddenvalues.has(m.class)) continue;
4903
+ data.skewer.push(m);
4904
+ } else {
4905
+ throw "unknown custom data dt";
4906
+ }
4907
+ }
4908
+ data.mclass2variantcount = summarize_mclass([...data.skewer, ...data.cnv.cnvs]);
4909
+ if (data.cnv.cnvs.length == 0) delete data.cnv;
4910
+ const set = /* @__PURE__ */ new Set();
4911
+ if (data.skewer?.some((i) => i.samples)) {
4912
+ for (const m of data.skewer) {
4913
+ if (m.samples) {
4914
+ for (const s of m.samples) set.add(s.sample_id);
4915
+ }
4916
+ }
4917
+ }
4918
+ if (data.cnv?.cnvs?.some((i) => i.samples)) {
4919
+ for (const m of data.cnv.cnvs) {
4920
+ if (m.samples) {
4921
+ for (const s of m.samples) set.add(s.sample_id);
4922
+ }
4923
+ }
4924
+ }
4925
+ if (set.size) data.sampleTotalNumber = set.size;
4926
+ await mayDoLDoverlay(tk, data.skewer);
4927
+ return data;
4928
+ }
4929
+ async function mayDoLDoverlay(tk) {
4930
+ if (!tk.mds.queries?.ld?.mOverlay) return;
4931
+ if (!tk.mds.termdb?.vocabApi) return;
4932
+ delete tk.mds.queries.ld.mOverlay.data;
4933
+ const data = await tk.mds.termdb.vocabApi.getLDdata(tk.mds.queries.ld.mOverlay.ldtkname, tk.mds.queries.ld.mOverlay.m);
4934
+ if (data.error || !Array.isArray(data.lst)) return;
4935
+ tk.mds.queries.ld.mOverlay.data = data.lst;
4936
+ }
4937
+
4938
+ export {
4939
+ displaySampleTable,
4940
+ getFilterName,
4941
+ makelabel,
4942
+ loadTk,
4943
+ rangequery_rglst
4944
+ };
4945
+ //# sourceMappingURL=chunk-NF34NHZM.js.map