@sjcrh/proteinpaint-client 2.77.0 → 2.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/{2dmaf-acb8cfdd.js → 2dmaf-7dddba15.js} +1 -1
  2. package/dist/{AppHeader-315dbd3a.js → AppHeader-67cea623.js} +1 -1
  3. package/dist/{ColorScale-4b4ea8a2.js → ColorScale-7a36cc17.js} +1 -1
  4. package/dist/{DEanalysis-28ddd620.js → DEanalysis-417e1f88.js} +1 -1
  5. package/dist/{Disco-3c427131.js → Disco-30abd4cb.js} +1 -1
  6. package/dist/{Disco.UI-b071cf7a.js → Disco.UI-ea58ee03.js} +1 -1
  7. package/dist/{DragControls-7961799c.js → DragControls-a5072cfd.js} +1 -1
  8. package/dist/{DziViewer-aa5b5706.js → DziViewer-af3c5a76.js} +1 -1
  9. package/dist/FilterRxComp-cb149666.js +1 -0
  10. package/dist/FilterStateless-bdd1416d.js +1 -0
  11. package/dist/{HicApp-674a148d.js → HicApp-fe8682af.js} +1 -1
  12. package/dist/{OrbitControls-58ca2292.js → OrbitControls-0d20d46b.js} +1 -1
  13. package/dist/{WSIViewer-afe97e2e.js → WSIViewer-64e55fb8.js} +1 -1
  14. package/dist/{adSandbox-791d704e.js → adSandbox-5753745b.js} +1 -1
  15. package/dist/app-488d9fd6.js +1 -0
  16. package/dist/{app-bd9f016b.js → app-5aa892cb.js} +1 -1
  17. package/dist/app-d9433820.js +1 -0
  18. package/dist/app.js +1 -1
  19. package/dist/bam-4e0df8b6.js +1 -0
  20. package/dist/{barchart-e3dcfc5f.js → barchart-687ae584.js} +1 -1
  21. package/dist/{barchart.events-cecb7bf5.js → barchart.events-9e2c1acf.js} +1 -1
  22. package/dist/{bars.renderer-58e38632.js → bars.renderer-95f7250f.js} +1 -1
  23. package/dist/{block-944afb9f.js → block-2f22e7fd.js} +1 -1
  24. package/dist/block.lazyload-143ae987.js +1 -0
  25. package/dist/{block.legend-3dbc41a8.js → block.legend-aa831169.js} +1 -1
  26. package/dist/{block.mds-b3967ce5.js → block.mds-64d95cf9.js} +1 -1
  27. package/dist/{block.mds.cnv-6de3115e.js → block.mds.cnv-2520897d.js} +1 -1
  28. package/dist/{block.mds.expressionrank-553613e8.js → block.mds.expressionrank-582ed7bc.js} +1 -1
  29. package/dist/{block.mds.expressionstat-2c396bb9.js → block.mds.expressionstat-483c9bc9.js} +1 -1
  30. package/dist/{block.mds.geneboxplot-552fe571.js → block.mds.geneboxplot-c1276cba.js} +1 -1
  31. package/dist/{block.mds.junction-1e25c13d.js → block.mds.junction-4a132819.js} +1 -1
  32. package/dist/{block.mds.svcnv-462d762d.js → block.mds.svcnv-a532eca7.js} +1 -1
  33. package/dist/{block.mds.svcnv.share-766e4b22.js → block.mds.svcnv.share-6575b7cf.js} +1 -1
  34. package/dist/{block.mds2-6e04432d.js → block.mds2-9ce41a23.js} +1 -1
  35. package/dist/{block.svg-40b47da8.js → block.svg-adb13c76.js} +1 -1
  36. package/dist/{block.tk.aicheck-cc42cbaf.js → block.tk.aicheck-ef6b634b.js} +1 -1
  37. package/dist/{block.tk.ase-da848c5f.js → block.tk.ase-1b119031.js} +1 -1
  38. package/dist/{block.tk.bam-8053c97e.js → block.tk.bam-2aa824aa.js} +1 -1
  39. package/dist/{block.tk.bedgraphdot-79cb0faf.js → block.tk.bedgraphdot-983fe4b3.js} +1 -1
  40. package/dist/{block.tk.bigwig.ui-a8decec7.js → block.tk.bigwig.ui-fb6401ee.js} +1 -1
  41. package/dist/{block.tk.hicstraw-3d1e9d41.js → block.tk.hicstraw-c6732591.js} +1 -1
  42. package/dist/{block.tk.junction-81eae755.js → block.tk.junction-429b654c.js} +1 -1
  43. package/dist/{block.tk.junction.textmatrixui-4c45b69a.js → block.tk.junction.textmatrixui-15bd752c.js} +1 -1
  44. package/dist/{block.tk.ld-997fca31.js → block.tk.ld-fba14536.js} +1 -1
  45. package/dist/{block.tk.menu-d3e7ccbb.js → block.tk.menu-1299ae5e.js} +1 -1
  46. package/dist/{block.tk.pgv-ae1d1f59.js → block.tk.pgv-c946527f.js} +1 -1
  47. package/dist/{boxplot-fed0a86b.js → boxplot-dbf30a19.js} +1 -1
  48. package/dist/{brainImaging-b455fd0c.js → brainImaging-b2865ba3.js} +1 -1
  49. package/dist/{brush-06989a5e.js → brush-1a123226.js} +1 -1
  50. package/dist/{categorical-82722704.js → categorical-f67752ed.js} +1 -1
  51. package/dist/{condition-f68cc8d1.js → condition-dcc70001.js} +1 -1
  52. package/dist/{controls-1d99916a.js → controls-f4648f7f.js} +1 -1
  53. package/dist/controls.btns-26bb6ef1.js +1 -0
  54. package/dist/{controls.config-00ce9f0b.js → controls.config-9870bdea.js} +1 -1
  55. package/dist/{cuminc-879690b0.js → cuminc-2273cdd3.js} +1 -1
  56. package/dist/{customdata.inputui-c563c695.js → customdata.inputui-fb1b24dc.js} +1 -1
  57. package/dist/{dataDownload-087ac205.js → dataDownload-b94871d0.js} +1 -1
  58. package/dist/{databrowser.ui-9f98f6b3.js → databrowser.ui-8ace51c3.js} +1 -1
  59. package/dist/{density-e0aff1d0.js → density-e023c28f.js} +1 -1
  60. package/dist/{dictionary-fe0ea1d6.js → dictionary-321e19f9.js} +1 -1
  61. package/dist/{drag-e11d6644.js → drag-1b98e43e.js} +1 -1
  62. package/dist/{e2pca-b3250d5c.js → e2pca-00e78fdc.js} +1 -1
  63. package/dist/{ep-9ca01df0.js → ep-b0d6177c.js} +1 -1
  64. package/dist/{facet-397afad5.js → facet-26292a3d.js} +1 -1
  65. package/dist/{filter-b3d3964e.js → filter-67d51c09.js} +1 -1
  66. package/dist/{fusion.parse-e5312047.js → fusion.parse-7e3a6071.js} +1 -1
  67. package/dist/{geneExpClustering-4383ff2c.js → geneExpClustering-a2cf1bb9.js} +1 -1
  68. package/dist/{geneExpression-52678025.js → geneExpression-d1d5a7ca.js} +1 -1
  69. package/dist/{geneExpression-cfb86b5d.js → geneExpression-dc10af2c.js} +1 -1
  70. package/dist/{geneExpression-2422f66b.js → geneExpression-e4a5a2cd.js} +1 -1
  71. package/dist/{geneORA-81220ec0.js → geneORA-248baba7.js} +1 -1
  72. package/dist/{geneVariant-18f9591a.js → geneVariant-447d6af9.js} +1 -1
  73. package/dist/{geneVariant-4d22b146.js → geneVariant-7366f3d1.js} +1 -1
  74. package/dist/{genefusion.ui-e38778dd.js → genefusion.ui-e219424a.js} +1 -1
  75. package/dist/{genesearch-0587c713.js → genesearch-d8780180.js} +1 -1
  76. package/dist/{geneset-604d0529.js → geneset-1f67d4c9.js} +1 -1
  77. package/dist/genomeBrowser-52c639b4.js +1 -0
  78. package/dist/{genomeBrowser.controls-204f007e.js → genomeBrowser.controls-3a7a1c94.js} +1 -1
  79. package/dist/{groupsetting-53dfd5e5.js → groupsetting-697a1503.js} +1 -1
  80. package/dist/{gsea-a1b04406.js → gsea-d3286c53.js} +1 -1
  81. package/dist/hierCluster-00268175.js +1 -0
  82. package/dist/{html.legend-6807e9ad.js → html.legend-0abd27ff.js} +1 -1
  83. package/dist/{imagePlot-f96cdc61.js → imagePlot-f6398b6e.js} +1 -1
  84. package/dist/{lasso-845446b8.js → lasso-48317f42.js} +1 -1
  85. package/dist/launch.adhoc-98dc0421.js +1 -0
  86. package/dist/{leftlabel.sample-3a6037c2.js → leftlabel.sample-591bc38d.js} +1 -1
  87. package/dist/legacyDataset-354f1a29.js +1 -0
  88. package/dist/{log-0ea548ec.js → log-1001ca83.js} +1 -1
  89. package/dist/{lollipop-75e11e9a.js → lollipop-40c4c5cb.js} +1 -1
  90. package/dist/{maf-e4af10d7.js → maf-10526648.js} +1 -1
  91. package/dist/{maftimeline-cc2e866c.js → maftimeline-a77349ad.js} +1 -1
  92. package/dist/matrix-1190d4b3.js +1 -0
  93. package/dist/matrix-bc0ccf83.js +1 -0
  94. package/dist/{mavb-b2dd74f6.js → mavb-0d28dd97.js} +1 -1
  95. package/dist/{mds.fimo-f19840cd.js → mds.fimo-929b9e65.js} +1 -1
  96. package/dist/{mds.samplescatterplot-254f1de6.js → mds.samplescatterplot-5a4ee6b6.js} +1 -1
  97. package/dist/{mds.survivalplot-f440db10.js → mds.survivalplot-b04947ee.js} +1 -1
  98. package/dist/metaboliteIntensity-f407ad0c.js +1 -0
  99. package/dist/niceNumLabels-621ef5c3.js +1 -0
  100. package/dist/{nodrag-f6c0801c.js → nodrag-b2866dd8.js} +1 -1
  101. package/dist/{notify-da3afe99.js → notify-91f0bc5d.js} +1 -1
  102. package/dist/{numeric-1d0318e8.js → numeric-eb1d29b3.js} +1 -1
  103. package/dist/{numeric.binary-88bf9e0d.js → numeric.binary-da92d665.js} +1 -1
  104. package/dist/numeric.continuous-92d1dea8.js +1 -0
  105. package/dist/numeric.discrete-cd8f09b1.js +1 -0
  106. package/dist/{numeric.spline-b3968b77.js → numeric.spline-9a9987b6.js} +1 -1
  107. package/dist/{numeric.toggle-ab8b79be.js → numeric.toggle-8f68f077.js} +1 -1
  108. package/dist/{oncomatrix-5f4326a8.js → oncomatrix-c29e6de9.js} +1 -1
  109. package/dist/{parseData-62083461.js → parseData-3bf0ef9f.js} +1 -1
  110. package/dist/{plot.2dvaf-eccd8ef3.js → plot.2dvaf-9e59c7d1.js} +1 -1
  111. package/dist/plot.app-fc3608a9.js +1 -0
  112. package/dist/plot.barplot-122296f7.js +1 -0
  113. package/dist/{plot.boxplot-0c538ebe.js → plot.boxplot-99c5aac5.js} +1 -1
  114. package/dist/{plot.brainImaging-ee3a0272.js → plot.brainImaging-a7bb79d6.js} +1 -1
  115. package/dist/{plot.disco-c9249cbd.js → plot.disco-ccdf741c.js} +1 -1
  116. package/dist/{plot.dzi-dfd72ddf.js → plot.dzi-aafdf56b.js} +1 -1
  117. package/dist/plot.ssgq-146075f5.js +1 -0
  118. package/dist/{plot.vaf2cov-4081decd.js → plot.vaf2cov-41e13dd9.js} +1 -1
  119. package/dist/{plot.wsi-f6325d95.js → plot.wsi-2327ad63.js} +1 -1
  120. package/dist/{profileBarchart-f4da0483.js → profileBarchart-46616916.js} +1 -1
  121. package/dist/profileHome-121aaddb.js +1 -0
  122. package/dist/profilePlot-a2591a28.js +1 -0
  123. package/dist/{profilePolar-996784ad.js → profilePolar-006a56b1.js} +1 -1
  124. package/dist/{profileRadar-79299186.js → profileRadar-3320d932.js} +1 -1
  125. package/dist/{profileRadarFacility-00e31213.js → profileRadarFacility-7a9cea80.js} +1 -1
  126. package/dist/{profileSummary-df75e6ff.js → profileSummary-7a747b4e.js} +1 -1
  127. package/dist/recover-edcdde38.js +1 -0
  128. package/dist/{regression.inputs-e647b716.js → regression.inputs-d5d44e49.js} +1 -1
  129. package/dist/{regression.inputs.values.table-b283619d.js → regression.inputs.values.table-daf7bcda.js} +1 -1
  130. package/dist/regression.results-31a8884d.js +1 -0
  131. package/dist/{renderPvalueTable-0ed37e90.js → renderPvalueTable-05c29ccf.js} +1 -1
  132. package/dist/sampleScatter-f6c04130.js +1 -0
  133. package/dist/{sampleScatter.rendererThree-aa51e3c8.js → sampleScatter.rendererThree-448689c6.js} +2 -2
  134. package/dist/{sampleView-e4819da2.js → sampleView-0931e571.js} +1 -1
  135. package/dist/{samplelst-9d9ff205.js → samplelst-27115b0e.js} +1 -1
  136. package/dist/{samplematrix-3556e5c0.js → samplematrix-2bb2480b.js} +1 -1
  137. package/dist/{scatter-ff17f653.js → scatter-a8d7c2a0.js} +1 -1
  138. package/dist/select2Terms-480025f5.js +1 -0
  139. package/dist/{selectGenomeWithTklst-84f4ff79.js → selectGenomeWithTklst-71344af2.js} +1 -1
  140. package/dist/{singleCellCellType-a2ce9bfa.js → singleCellCellType-b4061c59.js} +1 -1
  141. package/dist/{singleCellGeneExpression-a2b45c7a.js → singleCellGeneExpression-547149f2.js} +1 -1
  142. package/dist/singleCellPlot-2f5ad46a.js +1 -0
  143. package/dist/{singlecell-a5b8a39b.js → singlecell-1c3bee25.js} +1 -1
  144. package/dist/{singlecell-63cb06d8.js → singlecell-281a74a6.js} +1 -1
  145. package/dist/snp-32b8cbd8.js +1 -0
  146. package/dist/{snp-6e312b4c.js → snp-6bbefa83.js} +1 -1
  147. package/dist/snplocus-84450f3d.js +1 -0
  148. package/dist/{spliceevent.a53ss.diagram-aa2df5d7.js → spliceevent.a53ss.diagram-c04f46f1.js} +1 -1
  149. package/dist/{spliceevent.exonskip.diagram-0b792984.js → spliceevent.exonskip.diagram-a514c12e.js} +1 -1
  150. package/dist/spliceevent.exonskip.getdefault-a9a45dfc.js +1 -0
  151. package/dist/{spliceevent.noeventdiagram-e6e29a6e.js → spliceevent.noeventdiagram-b1be922c.js} +1 -1
  152. package/dist/{spliceevent.phrase-5f65a5f4.js → spliceevent.phrase-57659f7c.js} +1 -1
  153. package/dist/{stattable-775a5af5.js → stattable-7fa50fd2.js} +1 -1
  154. package/dist/{style.gdc-519a42d8.js → style.gdc-6b6a2e0c.js} +1 -1
  155. package/dist/{summary-5866c75f.js → summary-54587ccf.js} +1 -1
  156. package/dist/{sunburst-f928bfd2.js → sunburst-c24faf27.js} +1 -1
  157. package/dist/{survival-405514f6.js → survival-21e6637b.js} +1 -1
  158. package/dist/survival-538cddc2.js +1 -0
  159. package/dist/{svg.download-cd895635.js → svg.download-0dd56dfd.js} +1 -1
  160. package/dist/{svg.legend-812ea603.js → svg.legend-21629769.js} +1 -1
  161. package/dist/{svgraph-037fd7b6.js → svgraph-76e34d5e.js} +1 -1
  162. package/dist/{svmr-3bd143c3.js → svmr-89b80ea2.js} +1 -1
  163. package/dist/table-10183501.js +1 -0
  164. package/dist/{table-e013d8fc.js → table-bb97b5c9.js} +1 -1
  165. package/dist/{termInfo-e16f90f2.js → termInfo-4d954045.js} +1 -1
  166. package/dist/termdb.bins-06fd21c1.js +1 -0
  167. package/dist/termsetting-c12f1c69.js +1 -0
  168. package/dist/{tk-25ae65c4.js → tk-b96367f7.js} +1 -1
  169. package/dist/{toggleButtons-2144daab.js → toggleButtons-bb9aca2f.js} +1 -1
  170. package/dist/{tp.ui-38bc5890.js → tp.ui-f01b186b.js} +1 -1
  171. package/dist/tvs.density-064e5767.js +1 -0
  172. package/dist/{tvs.geneVariant-f99fe353.js → tvs.geneVariant-3fac6bed.js} +1 -1
  173. package/dist/{tvs.numeric-d9108473.js → tvs.numeric-86aacc82.js} +1 -1
  174. package/dist/{tvs.samplelst-3b8ee998.js → tvs.samplelst-1b00d7b6.js} +1 -1
  175. package/dist/{uiUtils-57f4b1ba.js → uiUtils-5aad7e13.js} +1 -1
  176. package/dist/{variantBrowser-56ebc7e1.js → variantBrowser-2c465d02.js} +1 -1
  177. package/dist/{vcf-e43b533a.js → vcf-55bf2c83.js} +1 -1
  178. package/dist/{violin-1352dab2.js → violin-edbe9a63.js} +1 -1
  179. package/dist/violin.interactivity-57637244.js +1 -0
  180. package/dist/{violin.renderer-4273257d.js → violin.renderer-4cab7448.js} +1 -1
  181. package/dist/{violinRenderer-7f46e468.js → violinRenderer-24abe5fd.js} +1 -1
  182. package/dist/{viridis-87a8b605.js → viridis-8a8f3e12.js} +1 -1
  183. package/dist/{y-cac91178.js → y-6fe1bb7b.js} +1 -1
  184. package/dist/{zoom-001c2f01.js → zoom-6a36fb2b.js} +1 -1
  185. package/package.json +6 -5
  186. package/dist/FilterRxComp-e8de560c.js +0 -1
  187. package/dist/FilterStateless-75514d37.js +0 -1
  188. package/dist/app-3d14cbe4.js +0 -1
  189. package/dist/app-8b5b982a.js +0 -1
  190. package/dist/bam-fa90bae8.js +0 -1
  191. package/dist/block.lazyload-4c4e81ff.js +0 -1
  192. package/dist/controls.btns-237b3154.js +0 -1
  193. package/dist/genomeBrowser-9f0e8a60.js +0 -1
  194. package/dist/hierCluster-edaaacc5.js +0 -1
  195. package/dist/hierCluster.config-a84f69a3.js +0 -1
  196. package/dist/hierCluster.interactivity-dd917fd3.js +0 -1
  197. package/dist/hierCluster.renderers-4d33e96a.js +0 -1
  198. package/dist/launch.adhoc-cb00917b.js +0 -1
  199. package/dist/legacyDataset-c9bab1e6.js +0 -1
  200. package/dist/matrix-8b3341c4.js +0 -1
  201. package/dist/matrix.cells-4dd055e7.js +0 -1
  202. package/dist/matrix.cluster-7ab94fb5.js +0 -1
  203. package/dist/matrix.config-b3b56456.js +0 -1
  204. package/dist/matrix.controls-6e0e9692.js +0 -1
  205. package/dist/matrix.data-baabaf57.js +0 -1
  206. package/dist/matrix.dom-cb1f4872.js +0 -1
  207. package/dist/matrix.groups-9990aade.js +0 -1
  208. package/dist/matrix.interactivity-3f3cf44d.js +0 -1
  209. package/dist/matrix.layout-50bc2ea5.js +0 -1
  210. package/dist/matrix.legend-024e2d50.js +0 -1
  211. package/dist/matrix.renderers-1aed44e5.js +0 -1
  212. package/dist/matrix.serieses-dc18fcc2.js +0 -1
  213. package/dist/matrix.sort-89b98e83.js +0 -1
  214. package/dist/matrix.sorterUi-0ad98ef0.js +0 -1
  215. package/dist/metaboliteIntensity-4d905d93.js +0 -1
  216. package/dist/niceNumLabels-ef07b7ad.js +0 -1
  217. package/dist/numeric.continuous-d27197cf.js +0 -1
  218. package/dist/numeric.discrete-b826f33b.js +0 -1
  219. package/dist/plot.app-4dc30ebc.js +0 -1
  220. package/dist/plot.barplot-331715f6.js +0 -1
  221. package/dist/plot.ssgq-b5f68395.js +0 -1
  222. package/dist/profileHome-11b7d146.js +0 -1
  223. package/dist/profilePlot-5dd1fe71.js +0 -1
  224. package/dist/recover-4888c2a9.js +0 -1
  225. package/dist/regression.results-f61b4a25.js +0 -1
  226. package/dist/sampleScatter-b96546e9.js +0 -1
  227. package/dist/select2Terms-eb437c2a.js +0 -1
  228. package/dist/singleCellPlot-e7e57b0f.js +0 -1
  229. package/dist/snp-41aa88d1.js +0 -1
  230. package/dist/snplocus-0653ba82.js +0 -1
  231. package/dist/spliceevent.exonskip.getdefault-af1943e3.js +0 -1
  232. package/dist/survival-10dd3d28.js +0 -1
  233. package/dist/table-be2a9975.js +0 -1
  234. package/dist/termdb.bins-a60aaa77.js +0 -1
  235. package/dist/termsetting-7467350f.js +0 -1
  236. package/dist/tvs.density-060d3006.js +0 -1
  237. package/dist/violin.interactivity-2502dcd8.js +0 -1
@@ -1 +0,0 @@
1
- import{h as t,d as e,M as s,o as r,n as o,y as i}from"./app-3d14cbe4.js";import{r as a,s as n}from"./recover-4888c2a9.js";import{v as p}from"./FilterRxComp-e8de560c.js";import{n as c}from"./sampleScatter-b96546e9.js";import{summaryInit as l}from"./summary-5866c75f.js";import"./termsetting-7467350f.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./FilterStateless-75514d37.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";import"./toggleButtons-2144daab.js";import"./table-be2a9975.js";import"./genesearch-0587c713.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./controls-1d99916a.js";import"./controls.btns-237b3154.js";import"./controls.config-00ce9f0b.js";import"./zoom-001c2f01.js";import"./pointer-c7475677.js";import"./nodrag-f6c0801c.js";import"./lasso-845446b8.js";import"./drag-e11d6644.js";import"./shapes-21ebfec4.js";import"./sampleView-e4819da2.js";import"./select2Terms-eb437c2a.js";import"./svg.download-cd895635.js";import"./sampleScatter.rendererThree-aa51e3c8.js";import"./axis-747c801e.js";import"./line-264f8f9e.js";import"./constant-426a1483.js";import"./violin-1352dab2.js";import"./violin.renderer-4273257d.js";import"./brush-06989a5e.js";import"./basis-3870f5ba.js";import"./log-0ea548ec.js";import"./html.legend-6807e9ad.js";import"./violin.interactivity-2502dcd8.js";import"./niceNumLabels-ef07b7ad.js";import"./barchart-e3dcfc5f.js";import"./bars.settings-64bb4642.js";import"./bars.renderer-58e38632.js";import"./svg.legend-812ea603.js";import"./barchart.events-cecb7bf5.js";function m(t){switch(t){case"../plots/DEanalysis.js":return import("./DEanalysis-28ddd620.js");case"../plots/Disco.js":return import("./Disco-3c427131.js");case"../plots/DziViewer.js":return import("./DziViewer-aa5b5706.js");case"../plots/WSIViewer.js":return import("./WSIViewer-afe97e2e.js");case"../plots/barchart.data.js":return import("./FilterRxComp-e8de560c.js").then((function(t){return t.j}));case"../plots/barchart.events.js":return import("./barchart.events-cecb7bf5.js");case"../plots/barchart.js":return import("./barchart-e3dcfc5f.js");case"../plots/bars.renderer.js":return import("./bars.renderer-58e38632.js");case"../plots/bars.settings.js":return import("./bars.settings-64bb4642.js");case"../plots/boxplot.js":return import("./boxplot-fed0a86b.js");case"../plots/brainImaging.js":return import("./brainImaging-b455fd0c.js");case"../plots/controls.btns.js":return import("./controls.btns-237b3154.js");case"../plots/controls.config.js":return import("./controls.config-00ce9f0b.js");case"../plots/controls.js":return import("./controls-1d99916a.js");case"../plots/cuminc.js":return import("./cuminc-879690b0.js");case"../plots/dataDownload.js":return import("./dataDownload-087ac205.js");case"../plots/dictionary.js":return import("./dictionary-fe0ea1d6.js");case"../plots/facet.js":return import("./facet-397afad5.js");case"../plots/geneExpression.js":return import("./geneExpression-52678025.js");case"../plots/geneORA.js":return import("./geneORA-81220ec0.js");case"../plots/geneset.js":return import("./geneset-604d0529.js");case"../plots/genomeBrowser.controls.js":return import("./genomeBrowser.controls-204f007e.js");case"../plots/genomeBrowser.js":return import("./genomeBrowser-9f0e8a60.js");case"../plots/gsea.js":return import("./gsea-a1b04406.js");case"../plots/hierCluster.config.js":return import("./hierCluster.config-a84f69a3.js");case"../plots/hierCluster.interactivity.js":return import("./hierCluster.interactivity-dd917fd3.js").then((function(t){return t.i}));case"../plots/hierCluster.js":return import("./hierCluster-edaaacc5.js");case"../plots/hierCluster.renderers.js":return import("./hierCluster.renderers-4d33e96a.js").then((function(t){return t.r}));case"../plots/imagePlot.js":return import("./imagePlot-f96cdc61.js");case"../plots/matrix.cells.js":return import("./matrix.cells-4dd055e7.js");case"../plots/matrix.cluster.js":return import("./matrix.cluster-7ab94fb5.js");case"../plots/matrix.config.js":return import("./matrix.config-b3b56456.js");case"../plots/matrix.controls.js":return import("./matrix.controls-6e0e9692.js");case"../plots/matrix.data.js":return import("./matrix.data-baabaf57.js").then((function(t){return t.m}));case"../plots/matrix.dom.js":return import("./matrix.dom-cb1f4872.js");case"../plots/matrix.groups.js":return import("./matrix.groups-9990aade.js").then((function(t){return t.m}));case"../plots/matrix.interactivity.js":return import("./matrix.interactivity-3f3cf44d.js");case"../plots/matrix.js":return import("./matrix-8b3341c4.js");case"../plots/matrix.layout.js":return import("./matrix.layout-50bc2ea5.js").then((function(t){return t.m}));case"../plots/matrix.legend.js":return import("./matrix.legend-024e2d50.js").then((function(t){return t.m}));case"../plots/matrix.renderers.js":return import("./matrix.renderers-1aed44e5.js");case"../plots/matrix.serieses.js":return import("./matrix.serieses-dc18fcc2.js").then((function(t){return t.m}));case"../plots/matrix.sort.js":return import("./matrix.sort-89b98e83.js");case"../plots/matrix.sorterUi.js":return import("./matrix.sorterUi-0ad98ef0.js");case"../plots/plot.app.js":return import("./plot.app-4dc30ebc.js");case"../plots/plot.brainImaging.js":return import("./plot.brainImaging-ee3a0272.js");case"../plots/plot.disco.js":return import("./plot.disco-c9249cbd.js");case"../plots/plot.ssgq.js":return import("./plot.ssgq-b5f68395.js");case"../plots/profileBarchart.js":return import("./profileBarchart-f4da0483.js");case"../plots/profilePlot.js":return import("./profilePlot-5dd1fe71.js");case"../plots/profilePolar.js":return import("./profilePolar-996784ad.js");case"../plots/profileRadar.js":return import("./profileRadar-79299186.js");case"../plots/profileRadarFacility.js":return import("./profileRadarFacility-00e31213.js");case"../plots/profileSummary.js":return import("./profileSummary-df75e6ff.js");case"../plots/regression.inputs.js":return import("./regression.inputs-e647b716.js").then((function(t){return t.b}));case"../plots/regression.inputs.term.js":return import("./regression.inputs-e647b716.js").then((function(t){return t.a}));case"../plots/regression.inputs.values.table.js":return import("./regression.inputs.values.table-b283619d.js");case"../plots/regression.js":return import("./regression.inputs-e647b716.js").then((function(t){return t.r}));case"../plots/regression.results.js":return import("./regression.results-f61b4a25.js").then((function(t){return t.r}));case"../plots/sampleScatter.interactivity.js":return import("./sampleScatter-b96546e9.js").then((function(t){return t.a}));case"../plots/sampleScatter.js":return import("./sampleScatter-b96546e9.js").then((function(t){return t.b}));case"../plots/sampleScatter.renderer.js":return import("./sampleScatter-b96546e9.js").then((function(t){return t.s}));case"../plots/sampleScatter.rendererThree.js":return import("./sampleScatter.rendererThree-aa51e3c8.js").then((function(t){return t.c}));case"../plots/sampleView.js":return import("./sampleView-e4819da2.js");case"../plots/scatter.js":return import("./scatter-ff17f653.js");case"../plots/singleCellPlot.js":return import("./singleCellPlot-e7e57b0f.js");case"../plots/stattable.js":return import("./stattable-775a5af5.js");case"../plots/summary.js":return import("./summary-5866c75f.js");case"../plots/survival.js":return import("./survival-405514f6.js");case"../plots/table.js":return import("./table-e013d8fc.js");case"../plots/variantBrowser.js":return import("./variantBrowser-56ebc7e1.js");case"../plots/violin.interactivity.js":return import("./violin.interactivity-2502dcd8.js");case"../plots/violin.js":return import("./violin-1352dab2.js");case"../plots/violin.renderer.js":return import("./violin.renderer-4273257d.js");default:return new Promise((function(e,s){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t)))}))}}class d{constructor(t){this.type="plot";u(this);this.initUi(t)}reactsTo(t){if(t.type.includes("cache_termq"))return true;if(t.type.endsWith("_group"))return true;if(t.type.startsWith("plot_"))return t.id===this.id;if(t.type.startsWith("filter"))return true;if(t.type.startsWith("cohort"))return true;if(t.type=="app_refresh")return true;if(t.type.endsWith("customTerm"))return true}getState(t){const e=t.plots.find((t=>t.id===this.id));if(!e){throw`No plot with id='${this.id}' found. Did you set this.id before this.api = getComponentApi(this)?`}return{config:e,groups:t.groups,_scope_:t._scope_}}async main(){this.dom.errdiv.style("display","none");if(!this.components)await this.setComponents(this.opts)}async setComponents(t){this.components={recover:await a({app:this.app,holder:this.dom.localRecoverDiv,getState:t=>this.getState(t),reactsTo:t=>t.id==this.id&&(t.type=="plot_edit"||t.type=="plot_nestedEdits")&&t._track_!="none",plot_id:this.id,maxHistoryLen:10})};const s=await m(`../plots/${t.chartType}.js`);this.components.chart=await s.componentInit({app:this.app,holder:this.dom.viz,header:this.dom.paneTitleDiv,id:this.id,plotDiv:e(this.dom.holder.app_div.node().parentNode)})}destroy(){this.dom.holder.app_div.selectAll("*").remove();this.dom.holder.app_div.remove();for(const t in this.dom){delete this.dom[t]}}}const j=t(d);function u(t){t.initUi=function(e){const r=e.holder;r.header.style("padding",0);try{t.dom={tip:new s({padding:"0px"}),holder:r,paneTitleDiv:r.header.append("div").style("display","inline-block").style("color","#555").style("padding-left","7px").style("vertical-align","sub"),localRecoverDiv:r.header.append("div").style("display","inline-block"),body:r.body.style("white-space","nowrap").style("overflow-x","auto"),errdiv:r.body.append("div").style("display","none").style("padding","5px").style("background-color","rgba(255,100,100,0.2)"),viz:r.body.append("div")}}catch(e){t.dom.errdiv.style("display","none").text(e)}}}class h{constructor(t){if(t.addLoginCallback){t.addLoginCallback((()=>this.api.dispatch({type:"app_refresh"})))}this.type="app";this.dom={holder:t.holder,topbar:t.holder.append("div"),errdiv:t.holder.append("div"),plotDiv:t.holder.append("div")};this.plotIdToSandboxId={}}validateOpts(t={}){if(!t.holder)throw`missing opts.holder in the MassApp constructor argument`;if(!t.callbacks)t.callbacks={};if(!t.state.vocab)t.state.vocab={};if(typeof t.state.vocab!="object")throw"opts.state.vocab{} is not an object";if(t.state.genome){t.state.vocab.genome=t.state.genome;delete t.state.genome}if(t.state.dslabel){t.state.vocab.dslabel=t.state.dslabel;delete t.state.dslabel}return t}async preApiFreeze(t){try{t.tip=new s({padding:"5px"});t.tip.d.on("keyup",(e=>{if(e.key=="Escape")t.tip.hide()}));t.printError=t=>this.printError(t);const e=this.opts.state.vocab;t.vocabApi=await p({app:t,state:{vocab:this.opts.state.vocab},fetchOpts:this.opts.fetchOpts,getDatasetAccessToken:this.opts.getDatasetAccessToken});t.hasWebGL=function(){try{var t=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl")))}catch(t){return false}};this.opts.state.vocab=t.vocabApi.vocab}catch(t){throw t}}async init(){try{const t="debounceInterval"in this.opts?this.opts.debounceInterval:0;if(this.opts.embeddedSessionState){Object.assign(this.opts.state,this.opts.embeddedSessionState)}this.store=await n({app:this.api,state:this.opts.state,debounceInterval:t});this.state=await this.store.copyState();this.components={};if(this.state.nav.header_mode!="hidden"){this.components.nav=await c({app:this.api,holder:this.dom.topbar,header_mode:this.state&&this.state.nav&&this.state.nav.header_mode,vocab:this.state.vocab,massSessionDuration:this.state.termdbConfig.massSessionDuration})}this.components.plots={};await this.api.dispatch()}catch(t){this.printError(t);throw t}}async main(){await this.api.vocabApi.main();const t={};let e;for(const s of this.state.plots){if(this.components.plots&&!(s.id in this.components.plots)){e=o(this.dom.plotDiv,{close:()=>{this.api.dispatch({type:"plot_delete",id:s.id})},plotId:s.id,beforePlotId:s.insertBefore||null,style:{width:"98.5%"}});if(s.chartType=="summary")t[s.id]=l(Object.assign({app:this.api,holder:e},s));else t[s.id]=j(Object.assign({app:this.api,holder:e},s))}}const s=Object.keys(t).length;if(s){await Promise.all(Object.values(t));for(const e in t){this.components.plots[e]=await t[e]}}for(const t in this.components.plots){if(!this.state.plots.find((e=>e.id===t))){this.components.plots[t].destroy();delete this.components.plots[t]}}}printError(t){i(this.dom.errdiv||this.opts.holder,"Error: "+(t.message||t));if(t.stack)console.log(t.stack);this.bus.emit("error")}}const f=r(h);export{f as appInit};
@@ -1 +0,0 @@
1
- import{M as e,u as t,k as s,b as n,D as i,z as a,y as l,f as o,aj as r}from"./app-3d14cbe4.js";import{a as c,s as d}from"./genesearch-0587c713.js";import{T as p}from"./toggleButtons-2144daab.js";import{r as f}from"./table-be2a9975.js";import{m as u}from"./checkbox-96437f4d.js";import"./tslib.es6-c3c2d88f.js";const y=new e({padding:""});const m="hg38";const h="GDC";const g=60;const b=[{title:"Entity ID",key:"entity_id"},{title:"Experimental Strategy",key:"experimental_strategy"},{title:"Tissue Type",key:"tissue_type"},{title:"Tumor Descriptor",key:"tumor_descriptor"},{title:"Size",key:"file_size",width:"10vw"}];const k="You are attempting to access a Sequence Read file that you are not authorized to access. <a href=https://gdc.cancer.gov/access-data/obtaining-access-controlled-data target=_blank>Please request dbGaP Access to the project</a>.";async function v({genomes:e,holder:r,filter0:v,hideTokenInput:S=false,callbacks:A={},stream2download:F=false,inputValue:I,debugmode:T=false}){if(A.postRender&&typeof A.postRender!="function")throw"callbacks.postRender is not function";const $={dom:{tip:y}};const j=e[m];if(!j)throw"missing genome for "+m;const E={bam_files:[],runFlags:{runflag_caseFileList:1,runflag_gdcInput:1}};const C=t();const N=r.append("div").style("margin-left","30px").style("display","none");N.append("button").html("&#171; Back To Input Form").on("click",(()=>{N.style("display","none");B.style("display","none").selectAll("*").remove();G.style("display","block")}));const G=r.append("div").style("margin-left","30px");const M=G.append("div");const B=r.append("div").style("display","none");if(!S)H();const D=await V();const O=G.append("div").style("padding","3px 10px").style("display","none");const[z,U,P]=Q();const R=I||C.get("gdc_id");if(R){D.property("value",R).node().dispatchEvent(new Event("search"))}else{delete E.runFlags.runflag_gdcInput;L()}function L(){if(!A.postRender)return;if(Object.keys(E.runFlags).length==0){A.postRender($)}}function H(){const e=M.insert("div").attr("class","sja-gdcbam-tokendiv");e.insert("div").style("display","inline-block").style("width","15vw").text("GDC Token File");const t=e.insert("div").style("display","inline-block");const s=t.append("input").attr("type","file").attr("aria-label","GDC token file");const n=t.append("span").style("margin-left","20px").style("display","none");s.on("change",(e=>{const t=e.target.files[0];if(!t){s.property("value","");return}if(!t.size){s.property("value","");w(n,"Blank file "+t.name);return}const i=new FileReader;i.onload=e=>{const t=e.target.result.trim();if(t.length<100){s.property("value","");w(n,"Does not look like a toke file (content too short)");return}if(t.length>1e3){s.property("value","");w(n,"Does not look like a toke file (content too long)");return}E.gdc_token=t};i.onerror=function(){s.property("value","");w(n,"Error reading file "+t.name);return};w(n);i.readAsText(t,"utf8")}));setTimeout((()=>s.node().focus()),1100)}async function V(){const e=M.insert("div");e.append("div").style("display","inline-block").style("width","15vw").style("padding-top","5px").text("Enter Search String").style("vertical-align","top");const t=e.append("div").style("display","inline-block");const a=t.append("input").attr("type","search").attr("size",45).attr("aria-label","Specify File Name / File UUID / Case ID / Case UUID").style("padding","3px 10px").property("placeholder","File Name / File UUID / Case ID / Case UUID").attr("class","sja-gdcbam-input").on("search",y).on("keyup",(e=>{if(s(e)){y();return}l.style("display","").text("Press ENTER to search");o.style("display","none")}));const l=t.append("span").style("padding-left","10px").style("display","none");const o=t.append("span").attr("class","sja-gdcbam-gdcid_error_div").style("display","none").style("padding","2px 5px");t.append("br");const r=t.append("div").attr("class","sja-gdcbam-listCaseFileHandle").style("margin","5px").style("display","inline-block").text("Looking for BAM files from current cohort...");q(r);const c=t.append("div").style("display","none").style("width","500px").style("margin","20px 3px").html(k);const d=G.append("div").style("display","none").style("margin","20px 20px 20px 40px");const p=d.append("div").attr("class","sja-gdcbam-onefiletable").style("display","none");const u=d.append("div").attr("class","sja-gdcbam-multifiletable").style("display","none");$.update=e=>{y(null,e?.filter0||v);q(r,e?.filter0||v)};async function y(e,t){U.selectAll("*").remove();P.style("display","none");z.style("display","inline-block");o.style("display","none");l.style("display","none");try{await m(Object.keys(t||{}).length?t:v||null)}catch(e){w(o,e.message||e);d.style("display","none");O.style("display","none")}L()}async function m(e){const t=a.property("value").trim();if(!t.length){d.style("display","none");U.selectAll("*").remove();O.style("display","none");return}a.attr("disabled",1);l.style("display","").text("Loading...");E.runFlags.runflag_gdcInput=1;const s={gdc_id:t};if(e)s.filter0=e;let i;try{i=await n("gdcbam",{body:s})}catch(e){throw e}finally{delete E.runFlags.runflag_gdcInput}a.attr("disabled",null);l.style("display","none");E.bam_files=[];if(i.error)throw"Error: "+i.error;if(!Array.isArray(i.file_metadata))throw"Error: .file_metadata[] missing";if(i.file_metadata.length==0){if(i.numFilesSkippedByWorkflow){throw`File${i.numFilesSkippedByWorkflow>1?"s":""} not viewable due to workflow type.`}throw"No viewable BAM files found"}c.style("display",i.userHasNoAccess?"block":"none");E.case_id=i.file_metadata[0].case_id;if(i.file_metadata.length==1){h(i)}else{g(i.file_metadata)}w(o);E.runFlags.ssmSearch=1;try{await X()}catch(e){throw e}finally{delete E.runFlags.ssmSearch}}function h(e,t){d.style("display","block");p.style("display","block").selectAll("*").remove();u.style("display","none");const s=e.file_metadata[0];const n={file_id:s.file_uuid,track_name:s.entity_id,about:[]};E.bam_files.push(n);const a=i({holder:p});for(const e of b){const[t,i]=a.addRow();t.text(e.title);i.html(e.url?`<a href=${e.url}${s.file_uuid} target=_blank>${s[e.key]}</a>`:s[e.key]);n.about.push({k:e.title,v:s[e.key]})}p.select("input").node()?.focus()}function g(e){const t=b.map((e=>({label:e.title,width:e.width})));const s=[];for(const[t,n]of e.entries()){const e=[];for(const t of b){if(t.url){e.push({html:`<a href=${e.url}${n.file_uuid} target=_blank>${n[e.key]}</a>`})}else{e.push({value:n[t.key]})}}s.push(e)}d.style("display","block");u.style("display","block").selectAll("*").remove();p.style("display","none");f({rows:s,columns:t,div:u,singleMode:F?true:false,noButtonCallback:(t,s)=>{const n=e[t];if(F){E.bam_files=[{file_id:n.file_uuid,track_name:`${n.tissue_type}, ${n.tumor_descriptor}, ${n.experimental_strategy}, ${n.entity_id}`,about:b.map((e=>({k:e.title,v:n[e.key]})))}]}else{if(s.checked){E.bam_files.push({file_id:n.file_uuid,track_name:`${n.tissue_type}, ${n.tumor_descriptor}, ${n.experimental_strategy}, ${n.entity_id}`,about:b.map((e=>({k:e.title,v:n[e.key]})))})}else{E.bam_files=E.bam_files.filter((e=>e.file_id!=n.file_uuid))}}}})}return a}async function q(e,t){E.runFlags.runflag_caseFileList=1;try{await W(e,t)}catch(t){e.text(t.message||t)}finally{delete E.runFlags.runflag_caseFileList}L()}async function W(e,t){const s=Object.keys(t||{}).length?t:v||null;const i={};if(s)i.filter0=s;const a=await n("gdcbam",{body:i});if(a.error)throw a.error;if(typeof a.case2files!="object")throw"wrong return";if(!a.restapihost)throw"data.restapihost is missing";E.restapihost=a.restapihost;e.text(`Or, Browse ${a.total} Available BAM Files`);const l=new Map;for(const e in a.case2files){for(const t of a.case2files[e]){const e=t.experimental_strategy;if(!l.has(e)){l.set(e,{count:1,checked:true})}else{l.get(e).count+=1}}}e.classed("sja_clbtext",true).attr("tabindex",0).on("keyup",(e=>{if(e.key=="Enter"){e.target.click()}})).on("click",(e=>{y.clear().showunder(e.target);{const e=y.d.append("div").style("margin","10px");for(const[s,n]of l){u({holder:e,labeltext:`${s}, ${n.count}`,divstyle:{display:"inline","margin-right":"15px"},checked:n.checked,callback:()=>{n.checked=!n.checked;o(t)}})}}const t=y.d.append("div").style("margin","10px").attr("class","sjpp_show_scrollbar").style("height","300px").style("resize","vertical");o(t)}));function o(e){e.selectAll("*").remove();const t=e.append("table").style("border-spacing","0px");const s=t.append("tr").style("position","sticky").style("top","0px").style("background-color","white").style("color","#888");s.append("td").text("CASE");s.append("td").text("BAM FILES, SELECT ONE TO VIEW");for(const e in a.case2files){const s=t.append("tr").attr("class","sja_clb_gray");s.append("td").style("vertical-align","top").style("color","#888").text(e);const n=s.append("td");for(const t of a.case2files[e]){if(!l.get(t.experimental_strategy).checked)continue;n.append("div").attr("class","sja_clbtext").attr("tabindex",0).html(`${t.tissue_type}, ${t.tumor_descriptor=="Not Applicable"?"":t.tumor_descriptor+", "}${t.experimental_strategy} <span style="font-size:.8em">${t.file_size}</span>`).on("click",(()=>{y.hide();D.property("value",t.file_uuid).node().dispatchEvent(new Event("search"))})).on("keyup",(e=>{if(e.key=="Enter")e.target.click()}))}}t.select(".sja_clbtext")?.node()?.focus()}}async function X(){delete E.ssmInput;O.style("display","block").selectAll("*").remove();const e=O.append("p").text("Searching for mutations...");const t=await n("termdb/singleSampleMutation",{body:{sample:"___"+E.case_id,genome:m,dslabel:h}});if(t.error)throw t.error;const s=t.mlst.filter((e=>e.dt==1));if(s.length==0){e.text("No mutations from this case.");if(F){const e=[{label:"Gene or position",callback:()=>E.useSsmOrGene="gene"},{label:"Unmapped reads",callback:()=>E.useSsmOrGene="unmapped"}];new p({holder:O,tabs:e}).main();await J(e[0].contentHolder);e[1].contentHolder.append("p").text("Only download unmapped reads from this BAM file.")}else{await J(O.append("div"))}return}e.remove();const i=[{label:`${s.length} variants${t.dt2total?.[0]?" ("+t.dt2total[0].total+" total)":""}`,callback:()=>{E.useSsmOrGene="ssm"}},{label:"Gene or position",callback:()=>{E.useSsmOrGene="gene"}}];if(F){i.push({label:"Unmapped reads",callback:()=>E.useSsmOrGene="unmapped"})}new p({holder:O,tabs:i}).main();Y(i[0].contentHolder,s);await J(i[1].contentHolder);if(i[2])i[2].contentHolder.append("p").text("Only download unmapped reads from this BAM file.")}function Y(e,t){const s=[{label:"Gene",width:"10vw"},{label:"Mutation"},{label:"Consequence"},{label:"Position"}];const n=new Map;for(const e of t){if(!n.has(e.gene))n.set(e.gene,[]);n.get(e.gene).push(e)}const i=[];for(const[e,t]of n){for(const s of t){const t=[];t.push({value:e,data:s});t.push({value:s.mname});t.push({value:a[s.class]?.label||"Unknown"});t.push({value:s.chr+":"+s.pos+" "+s.ref+">"+s.alt});i.push(t)}}f({rows:i,columns:s,div:e,noButtonCallback:(e,t)=>{const s=i[e][0].data;E.ssmInput={chr:s.chr,pos:s.pos-1,ref:s.ref,alt:s.alt}},singleMode:true});if(C.has("gdc_ssm")){for(const[e,t]of n){for(const e of t){if(e.mname==C.get("gdc_ssm")){E.ssmInput={chr:e.chr,pos:e.pos-1,ref:e.ref,alt:e.alt}}}}}e.select("input").node().focus()}async function J(e){const t=e.append("div").style("display","grid").style("grid-template-columns","300px auto");t.append("div").text("Enter gene, position, SNP, or variant");E.coordInput=c(await K(t));_(e)}async function K(e){const t={genome:j,tip:y,row:e.append("div"),allowVariant:true};if(C.has("gdc_pos")){const e=C.get("gdc_pos").split(/[:\-]/);if(e.length==3){t.defaultCoord={chr:e[0],start:Number(e[1]),stop:Number(e[2])}}}else if(C.has("gdc_var")){const e=await d(C.get("gdc_var"),j);if(e){t.defaultCoord=e}}return t}function Q(){const e=G.append("div");const t=e.insert("div").style("display","inline-block").append("button").style("margin","20px 20px 20px 40px").style("padding","10px 25px").style("border-radius","35px").text("Submit").on("click",(async()=>{try{s.selectAll("*").remove();x(E,j,S);t.text("Loading ...");t.property("disabled",true);await Z()}catch(e){if(e=="Permission denied"){n.style("display","inline-block");t.style("display","none")}else{s.selectAll("*").remove();l(s,e)}}t.text("Submit");t.property("disabled",false)}));const s=e.insert("div").style("display","inline-block");const n=e.insert("div").style("display","none").style("margin","20px");n.append("div").text("Access Alert").style("font-size","1.5em").style("opacity",.4);n.append("div").style("border-top","solid 1px #eee").style("border-bottom","solid 1px #eee").style("padding","20px 0px").style("margin-top","5px").html(k);return[t,s,n]}async function Z(){const e=E;const t={nobox:1,genome:j,holder:B,debugmode:T};if(e.useSsmOrGene=="unmapped"){t.unmapped=1}else{if(e.position){t.chr=e.position.chr;t.start=e.position.start;t.stop=e.position.stop}else if(e.variant){t.chr=e.variant.chr;t.start=e.variant.pos-g;t.stop=e.variant.pos+g}else{throw"SV_EXPAND here"}}const s={"Content-Type":"application/json",Accept:"application/json"};if(e.gdc_token){s["X-Auth-Token"]=e.gdc_token}for(const[i,a]of e.bam_files.entries()){z.text(`Slicing BAM File ${i+1} of ${e.bam_files.length}...`);const l={downloadgdc:1,gdcFileUUID:a.file_id};if(t.unmapped){l.gdcFilePosition="unmapped";l.unmapped=1}else{l.gdcFilePosition=t.chr+":"+t.start+"-"+t.stop;l.regions=[{chr:t.chr,start:t.start,stop:t.stop}]}if(F){s.compression=false;const e=`${E.restapihost}/slicing/view/${a.file_id}?region=${l.gdcFilePosition}`;const n=await fetch(e,{method:"GET",headers:s});const i=await n.blob();const o=document.createElement("a");o.href=URL.createObjectURL(i);if(t.unmapped){o.download=a.track_name+".unmapped.bam"}else{o.download=`${a.track_name}.${t.chr}.${t.start}.${t.stop}.bam`}o.style.display="none";document.body.appendChild(o);o.click();document.body.removeChild(o);return}const o=await n("tkbam",{headers:s,body:l});if(o.error)throw o.error;{const e=a.about.find((e=>e.k=="Slice file size"));if(e)e.v=o.size;else a.about.push({k:"Slice file size",v:o.size})}if(o.time){const e=a.about.find((e=>e.k=="Stream time"));if(e)e.v=Math.round(o.time)+" seconds";else a.about.push({k:"Stream time",v:Math.round(o.time)+" seconds"})}if(o.truncated){if(!a.about.find((e=>e.k=="Truncated")))a.about.push({k:"Truncated",v:"BAM slice size exceeds limit and is truncated"})}else{const e=a.about.findIndex((e=>e.k=="Truncated"));if(e>0)a.about.splice(e,1)}}G.style("display","none");N.style("display","block");B.style("display","block");t.tklst=[];for(const s of e.bam_files){const n={type:"bam",name:s.track_name||"Sample BAM slice",gdcToken:e.gdc_token,gdcFile:{uuid:s.file_id,position:t.chr+":"+t.start+"-"+t.stop},aboutThisFile:s.about};if(e.variant){n.variants=[e.variant]}t.tklst.push(n)}o(j,t.tklst);const i=await import("./block-944afb9f.js").then((function(e){return e.c}));new i.Block(t)}return $}function _(e){e.append("div").style("opacity",.6).html(`<ul>\n\t\t<li>Enter gene, position, SNP, or variant.\n\t\tThe BAM file will be sliced at the given position and visualized.</li>\n\t\t<li>Position</li>\n\t\t<ul><li>Example: chr17:7676339-7676767</li>\n\t\t <li>Coordinates are hg38 and 1-based.</li>\n\t\t</ul>\n\t\t<li>SNP example: rs28934574</li>\n\t\t<li>Variant:</li>\n\t\t<ul>\n\t\t <li>Example: chr2.208248388.C.T</li>\n\t\t <li>Fields are separated by periods. Coordinate is hg38 and 1-based. Reference and alternative alleles are on forward strand.</li>\n\t\t</ul>\n\t\t<li>Supported HGVS formats for variants:</li>\n\t\t<ul>\n\t\t <li>SNV: chr2:g.208248388C>T</li>\n\t\t <li>MNV: chr2:g.119955155_119955159delinsTTTTT</li>\n\t\t <li>Insertion: chr5:g.171410539_171410540insTCTG</li>\n\t\t <li>Deletion: chr10:g.8073734delTTTAGA</li>\n\t\t</ul>\n\t\t</ul>`)}function w(e,t){e.style("display","inline-block").style("color",t?"red":"green").html(t?"&#10060; "+t:"&#10003;")}function x(e,t,s=false){if(!s){if(!e.gdc_token)throw"GDC token missing";if(typeof e.gdc_token!=="string")throw"GDC token is not string"}if(!e.bam_files.length)throw"No BAM file selected";for(const t of e.bam_files){if(!t.file_id)throw"file uuid is missing";if(typeof t.file_id!=="string")throw"file uuid is not string"}if(e.useSsmOrGene=="unmapped"){return}delete e.position;delete e.variant;if(e.useSsmOrGene=="ssm"){const t=e.ssmInput;if(!t)throw"No variant selected";if(!t.chr)throw"ssmInput.chr missing";if(!Number.isInteger(t.pos))throw"ssmInput.pos not integer";if(!t.ref)throw"ssmInput.ref missing";if(!t.alt)throw"ssmInput.alt missing";e.variant=t;return}const n=e.coordInput;if(!n.chr)throw"No valid position or variant was entered";const[i,a]=r(t,[n.chr]);if(i+a==0)throw"Invalid chromosome name: "+n.chr;const l=i?"chr"+n.chr:n.chr;if(Number.isInteger(n.pos)){if(!n.ref)throw"Reference allele missing from variant string";if(!n.alt)throw"Alternative allele missing from variant string";e.variant={chr:l,pos:n.pos-1,ref:n.ref,alt:n.alt}}else{if(!Number.isInteger(n.start)||!Number.isInteger(n.stop))throw"non-integer start/stop";e.position={chr:l,start:n.start,stop:n.stop}}}export{v as bamsliceui};
@@ -1 +0,0 @@
1
- let n;async function t(t){if(!n){const t=await import("./block-944afb9f.js").then((function(n){return n.c}));n=t.Block}return new n(t)}export{t as b};
@@ -1 +0,0 @@
1
- import{h as t,K as e,L as n}from"./app-3d14cbe4.js";class o{constructor(t){this.type="controlsTopBar"}async init(){const t=this.opts;this.dom={holder:t.holder,burger_div:t.holder.append("div"),button_bar:t.holder.append("div")};const n=this.opts.debug;this.features=await e({burgerbtn:i({holder:this.dom.burger_div,callback:t.callback,debug:n}),downloadbtn:a({id:t.id,holder:this.dom.holder.insert("div"),callback:t.downloadHandler,debug:n}),helpbtn:s({id:t.id,holder:this.dom.holder.insert("div"),callback:t.helpHandler,debug:n})})}getState(t){return{config:t.plots.find((t=>t.id===this.id)),isOpen:this.opts.isOpen()}}main(){const t=this.state.config;const e=this.opts.isOpen();this.dom.button_bar.style("display",e?"inline-block":"block").style("float",e?"right":"none");for(const n in this.features){this.features[n].main(e,t)}}}const l=t(o);function i(t){const e={dom:{btn:t.holder.style("margin","10px").style("margin-left","20px").style("font-family","verdana").style("font-size","28px").style("cursor","pointer").style("transition","0.5s").html("&#8801;").on("click",t.callback).attr("aria-label","Settings")}};const n={main(t){e.dom.btn.style("display",t?"inline-block":"block")}};if(t.debug)n.Inner=e;return Object.freeze(n)}function s(t){const e=t.holder.style("margin","20px");n["help"](e,{handler:t.callback,title:"Documentation"});const o={plotTypes:["profilePolar","profileBarchart","profileRadar","profileRadarFacility"],dom:{btn:e}};const l={main(t,e){if(o.plotTypes.includes(e.chartType))o.dom.btn.style("display",t?"inline-block":"block");else o.dom.btn.style("display","none")}};if(t.debug)l.Inner=o;return Object.freeze(l)}function a(t){const e=t.holder.style("margin-left","20px").attr("aria-label","Download plot image");n["download"](e,{handler:t.callback});const o={plotTypes:["summary","boxplot","scatter"],dom:{btn:e}};const l={main(t,e){o.dom.btn.style("display",t?"inline-block":"block")}};if(t.debug)l.Inner=o;return Object.freeze(l)}export{l as topBarInit};
@@ -1 +0,0 @@
1
- import{M as t,h as e,P as s,y as a,b as o,f as i}from"./app-3d14cbe4.js";import{a as n}from"./genesearch-0587c713.js";import"./termsetting-7467350f.js";import{g as r}from"./FilterRxComp-e8de560c.js";import{mayUpdateGroupTestMethodsIdx as l,gbControlsInit as c}from"./genomeBrowser.controls-204f007e.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./table-be2a9975.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./checkbox-96437f4d.js";import"./FilterStateless-75514d37.js";import"./toggleButtons-2144daab.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";const p=new t({padding:"0px"});class f{constructor(){this.type="genomeBrowser"}async init(){const e=this.opts.holder.append("div");this.opts.header.append("div").style("opacity",.6).style("padding-left","10px").style("font-size","0.75em").text("GENOME BROWSER");const s=e.append("div");const a=e.append("div").style("margin-left","25px");a.append("span").html("&nbsp;");this.dom={tip:new t,holder:e,errDiv:s,loadingDiv:a.append("span").text("Loading..."),controlsDiv:e.append("div").style("margin-left","25px"),blockHolder:e.append("div")};this.components={gbControls:await c({app:this.app,id:this.id,holder:this.dom.controlsDiv})}}getState(t){const e=t.plots.find((t=>t.id===this.id));if(!e)throw`No plot with id='${this.id}' found`;return{config:e,termdbConfig:t.termdbConfig,filter:r(t.termfilter.filter)}}async main(){this.dom.loadingDiv.style("display","inline");try{if(this.state.config?.snvindel?.details){await this.launchCustomMds3tk()}else if(this.state.config?.trackLst){await this.launchBlockWithTracks(this.state.config.trackLst)}else{const t={type:"mds3",dslabel:this.app.opts.state.vocab.dslabel,newChartHolder:this.opts.plotDiv};if(this.state.filter?.lst?.length>0){t.filterObj=structuredClone(this.state.filter)}await this.launchBlockWithTracks([t])}this.updateLDtrack()}catch(t){a(this.dom.errDiv,t.message||t);if(t.stack)console.log(t.stack)}this.dom.loadingDiv.style("display","none")}async launchCustomMds3tk(){const t=await this.preComputeData();this.mayDisplaySampleCountInControls(t);if(this.blockInstance){const e=this.blockInstance.tklst.find((t=>t.type=="mds3"));e.custom_variants=t.mlst;b(this,e.skewer.viewModes.find((t=>t.type=="numeric")));e.load();return}const e={type:"numeric",inuse:true,byAttribute:"nm_axis_value"};b(this,e);const s={type:"mds3",dslabel:this.app.opts.state.vocab.dslabel,name:"Variants",custom_variants:t.mlst,skewerModes:[e]};await this.launchBlockWithTracks([s])}mayDisplaySampleCountInControls(t){if(Number.isInteger(t.totalSampleCount_group1)||Number.isInteger(t.totalSampleCount_group2)){const e={appState:{plots:[{id:this.components.gbControls.id,_partialData:{groupSampleCounts:[t.totalSampleCount_group1,t.totalSampleCount_group2],pop2average:t.pop2average}}]}};this.components.gbControls.update(e)}}async preComputeData(){const t={genome:this.app.opts.state.vocab.genome,dslabel:this.app.opts.state.vocab.dslabel,for:"mds3variantData",chr:this.state.config.geneSearchResult.chr,start:this.state.config.geneSearchResult.start,stop:this.state.config.geneSearchResult.stop,details:this.state.config.snvindel.details,filter:this.state.filter,variantFilter:this.state.config.variantFilter?.filter};const e=await o("termdb",{body:t});if(e.error)throw e.error;return e}async launchBlockWithTracks(t){this.dom.blockHolder.selectAll("*").remove();const e={holder:this.dom.blockHolder,genome:this.app.opts.genome,nobox:true,tklst:await this.getTracks2show(t),debugmode:true};if(this.state.termdbConfig?.queries.defaultBlock2GeneMode&&this.state.config.geneSearchResult.geneSymbol){e.query=this.state.config.geneSearchResult.geneSymbol;const t=await import("./app-3d14cbe4.js").then((function(t){return t.c3}));await t.default(e);this.blockInstance=e.__blockInstance;this.opts.header.text(e.query);return}e.chr=this.state.config.geneSearchResult.chr;e.start=this.state.config.geneSearchResult.start;e.stop=this.state.config.geneSearchResult.stop;i(this.app.opts.genome,e.tklst);e.onCoordinateChange=async t=>{await this.app.dispatch({type:"plot_edit",id:this.id,config:{geneSearchResult:{chr:t[0].chr,start:t[0].start,stop:t[0].stop}}})};const s=await import("./block-944afb9f.js").then((function(t){return t.c}));this.blockInstance=new s.Block(e)}async getTracks2show(t){const e=[];for(const s of t){if(s.isfacet){const t=JSON.parse(JSON.stringify(s));if(!this.app.opts.genome.tkset)this.app.opts.genome.tkset=[];if(!t.tklst)throw".tklst[] missing from a facet table";if(!Array.isArray(t.tklst))throw".tklst[] not an array from a facet table";for(const s of t.tklst){if(!s.assay)throw".assay missing from a facet track";if(!s.sample)throw".sample missing from a facet track";s.tkid=Math.random().toString();if(s.defaultShown)e.push(s)}this.app.opts.genome.tkset.push(t)}else{e.push(s)}}return e}updateLDtrack(){if(!this.state.config.ld)return;if(!this.blockInstance)return;for(const t of this.state.config.ld.tracks){const e=this.blockInstance.tklst.findIndex((e=>e.file==t.file0));if(t.shown){if(e==-1){const e={type:"ld",name:t.name,file:t.file0};const s=this.blockInstance.block_addtk_template(e);this.blockInstance.tk_load(s)}continue}if(e==-1)continue;this.blockInstance.tk_remove(e)}}}const d=e(f);const h=d;async function m(t,e){try{return await g(e.vocabApi,t)}catch(t){throw`${t} [genomeBrowser getPlotConfig()]`}}function u(t,e){const s=e.app.opts.genome;if(typeof s!="object")throw"chartsInstance.app.opts.genome not an object and needed for gene search box";const a={tip:p,genome:s,row:t.append("div").style("margin","10px"),callback:async()=>{try{const t=await g(e.app.vocabApi);t.chartType="genomeBrowser";t.geneSearchResult=o;const s={config:t};e.prepPlot(s)}catch(e){t.append("div").text("Error: "+(e.message||e));console.log(e)}}};if(!e.state.termdbConfig.queries.defaultBlock2GeneMode){a.defaultCoord=e.state.termdbConfig.queries.defaultCoord}else{a.searchOnly="gene"}const o=n(a)}async function g(t,e){const a=await t.getMds3queryDetails();const o=await t.get_variantFilter();if(o?.filter){a.variantFilter=o}const i=e?s(a,e):a;if(i.snvindel?.details){l({state:{config:i}},i.snvindel.details)}return i}function b(t,e){delete e.tooltipPrintValue;const[s,a]=t.state.config.snvindel.details.groups;if(s&&a){if(s.type=="info"||a.type=="info"){e.label="Value difference";return}const o=t.state.config.snvindel.details.groupTestMethods[t.state.config.snvindel.details.groupTestMethodsIdx];e.label=o.axisLabel||o.name;if(o.name=="Allele frequency difference"){e.tooltipPrintValue=t=>[{k:"AF diff",v:t.nm_axis_value}]}else if(o.name=="Fisher's exact test"){e.tooltipPrintValue=t=>[{k:"p-value",v:t.p_value}]}else;return}if(s.type=="info"){const a=t.state.config.variantFilter?.terms?.find((t=>t.id==s.infoKey));e.label=a?.name||s.infoKey;e.tooltipPrintValue=t=>[{k:e.label,v:t.info[s.infoKey]}];return}if(s.type=="filter"){e.label="Allele frequency";e.tooltipPrintValue=t=>[{k:"Allele frequency",v:t.nm_axis_value}];return}if(s.type=="population"){e.label="Allele frequency";e.tooltipPrintValue=t=>[{k:"Allele frequency",v:t.nm_axis_value}];return}throw"unknown type of the only group"}export{h as componentInit,d as genomeBrowserInit,m as getPlotConfig,u as makeChartBtnMenu};
@@ -1 +0,0 @@
1
- import{Matrix as e}from"./matrix-8b3341c4.js";import{F as t,b as r,I as s,bR as i,h as a}from"./app-3d14cbe4.js";import{r as o}from"./hierCluster.renderers-4d33e96a.js";import{c as l,d as n,i as c}from"./hierCluster.interactivity-dd917fd3.js";import{k as m}from"./termsetting-7467350f.js";import{g as d,c as h}from"./FilterRxComp-e8de560c.js";export{getPlotConfig}from"./hierCluster.config-a84f69a3.js";import"./matrix.dom-cb1f4872.js";import"./matrix.interactivity-3f3cf44d.js";import"./table-be2a9975.js";import"./tslib.es6-c3c2d88f.js";import"./pointer-c7475677.js";import"./matrix.renderers-1aed44e5.js";import"./matrix.cluster-7ab94fb5.js";import"./matrix.controls-6e0e9692.js";import"./controls.config-00ce9f0b.js";import"path";import"./matrix.sorterUi-0ad98ef0.js";import"./radiobutton-09bff425.js";import"./checkbox-96437f4d.js";import"./recover-4888c2a9.js";import"./FilterStateless-75514d37.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";import"./toggleButtons-2144daab.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./genesearch-0587c713.js";import"./rehydrateFilter-12d118cb.js";import"./svg.legend-812ea603.js";import"./matrix.data-baabaf57.js";import"./matrix.layout-50bc2ea5.js";import"./axis-747c801e.js";import"./matrix.serieses-dc18fcc2.js";import"./matrix.cells-4dd055e7.js";import"./matrix.legend-024e2d50.js";import"./legacy-d3-polyfill-bdb2d792.js";import"./matrix.groups-9990aade.js";import"./filter-b3d3964e.js";import"./matrix.sort-89b98e83.js";import"./matrix.config-b3b56456.js";function p(e,t){let r;let s;if(t===undefined){for(const t of e){if(t!=null){if(r===undefined){if(t>=t)r=s=t}else{if(r>t)r=t;if(s<t)s=t}}}}else{let i=-1;for(let a of e){if((a=t(a,++i,e))!=null){if(r===undefined){if(a>=a)r=s=a}else{if(r>a)r=a;if(s<a)s=a}}}}return[r,s]}class f extends e{constructor(e){super(e);this.type="hierCluster";this.chartType="hierCluster"}async init(e){await super.init(e);this.maySetSandboxHeader();this.hcClipId=this.seriesClipId+"-hc";this.dom.hcClipRect=this.dom.svg.select("defs").append("clipPath").attr("id",this.hcClipId).attr("clipPathUnits","userSpaceOnUse").append("rect").attr("display","block");this.dom.topDendrogram=this.dom.svg.insert("g","g").attr("clip-path",`url(#${this.hcClipId})`).append("g").attr("class","sjpp-matrix-dendrogram").attr("data-testid","hierCluster_top_dendrogram").on("click",(e=>{const t=this.getClusterFromTopDendrogram(e);if(t){this.clickedClusterIds=this.getAllChildrenClusterIds(t);this.clickedClusterIds.push(t);const r=this.hierClusterData.clustering.col.mergedClusters.get(t);const s=r.children.map((e=>e.name));this.addSelectedSamplesOptions(s,e)}else{delete this.clickedClusterIds}if(this.clickedLeftClusterIds){delete this.clickedLeftClusterIds;this.plotDendrogramHclust()}else this.plotDendrogramHclust("top")}));this.dom.leftDendrogram=this.dom.svg.insert("g","g").attr("class","sjpp-matrix-dendrogram").attr("data-testid","hierCluster_left_dendrogram").on("click",(e=>{const t=this.getClusterFromLeftDendrogram(e);if(t){this.clickedLeftClusterIds=this.getAllChildrenClusterIds(t,true);this.clickedLeftClusterIds.push(t);const r=this.hierClusterData.clustering.row.mergedClusters.get(t);const s=r.children.map((e=>e.name));this.addSelectedRowsOptions(s,e)}else{delete this.clickedLeftClusterIds}if(this.clickedClusterIds){delete this.clickedClusterIds;this.plotDendrogramHclust()}else this.plotDendrogramHclust("left")}))}async setHierClusterData(e={}){this.prevServerData=this.currServerData;const r=new AbortController;const[s,i]=await this.api.detectStale((()=>this.requestData({signal:r.signal})),{abortCtrl:r});if(i)throw`stale sequenceId`;if(s.error)throw s.error;this.currServerData=structuredClone(s);if(!t(this.prevServerData,this.currServerData)){delete this.clickedClusterIds}const a=this.settings.hierCluster;const o=this.hcTermGroup.lst;if(!s.clustering){if(s.gene){throw`Cannot do clustering: data is only available for 1 gene (${s.gene}). Try again by adding more genes.`}}this.hierClusterData=s;const l=this.hierClusterData.clustering;this.setHierColorScale(l);this.settings.hierCluster.zScoreCap;const n={};for(const[e,t]of l.col.order.entries()){n[t.name]={sample:t.name};for(const[r,s]of l.row.order.entries()){const i=o.find((e=>e.term.name===s.name));const c=l.matrix[r][e];n[t.name][i.$id]={key:i.term.name,values:[{sample:t.name,dt:m[this.state.config.dataType],label:a.termGroupName,value:c}]}}}this.hcTermNameOrder=l.row.order.map((e=>e.name));this.hcTermSorter=(e,t)=>{const r=this.hcTermNameOrder.indexOf(e.tw.term.name);const s=this.hcTermNameOrder.indexOf(t.tw.term.name);if(r==-1&&s==-1)return 0;if(r==-1)return 1;if(s==-1)return-1;return r-s};this.hcSampleNameOrder=l.col.order.map((e=>e.name));this.hcSampleSorter=(e,t)=>{const r=this.hcSampleNameOrder.indexOf(e.sample);const s=this.hcSampleNameOrder.indexOf(t.sample);if(r==-1&&s==-1)return 0;if(r==-1)return 1;if(s==-1)return-1;return r-s};const c={};for(const e of o){if(s.byTermId[e.term.name])c[e.$id]=s.byTermId[e.term.name]}this.hierClusterSamples={refs:{byTermId:c,bySampleId:s.bySampleId},lst:l.col.order.map((e=>n[e.name])),samples:n}}async requestData({signal:e}){const t=this.currRequestOpts?.hierCluster||this.getHCRequestBody(this.state);const s=await r("termdb/cluster",{body:t,signal:e});return s}getHCRequestBody(e){this.hcTermGroup=this.config.termgroups.find((e=>e.type=="hierCluster"))||this.termOrder?.find((e=>e.grp.type=="hierCluster"))?.grp;const t=e.config.settings.hierCluster;const r={type:"tvslst",in:true,join:"and",lst:e.config.legendValueFilter.lst.filter((e=>!e.tvs.legendFilterType))};const s=this.getClusterRowTermsAsParameter();if(!s.length)throw"no data";if(!l.find((e=>e.value==t.clusterMethod)))throw"Invalid cluster method";if(!n.find((e=>e.value==t.distanceMethod)))throw"Invalid distance method";const i={genome:e.vocab.genome,dslabel:e.vocab.dslabel,dataType:e.config.dataType,clusterMethod:t.clusterMethod,distanceMethod:t.distanceMethod,terms:s,filter:d(h([e.filter,r])),filter0:e.filter0};return i}combineData(){if(!this.hierClusterSamples)return;const e=this.data;const t={};const r=[];for(const s in this.hierClusterSamples.samples){const i=this.hierClusterSamples.samples[s];t[s]=i;r.push(i);if(s in e.samples)Object.assign(i,e.samples[s]);const a=this.hierClusterSamples.refs.bySampleId[s]||{};if(!i._ref_)i._ref_=a;else Object.assign(i._ref_,a)}const s=this.hierClusterSamples.refs.byTermId;for(const t of Object.keys(s)){e.refs.byTermId[t]=Object.assign({},e.refs.byTermId[t]||{},s[t])}this.data={samples:t,lst:r,refs:e.refs}}setHierColorScale(e){const t=this.settings.hierCluster;const r=s(i[t.colorScale].domain,i[t.colorScale].range).clamp(true);const a=[];for(const t of e.matrix){a.push(...p(t))}const o=Math.min(t.zScoreCap,Math.max(...p(a).map(Math.abs)));const[l,n]=[-o,o];this.hierClusterValues={scale:r,min:l,max:n}}getValueColor(e){const t=this.settings.hierCluster.zScoreCap;return this.hierClusterValues.scale((e- -t)/(t*2))}getClusterRowTermsAsParameter(){const e=[...this.hcTermGroup.lst.map((e=>e.term))];e.sort(((e,t)=>e.name<t.name?-1:1));return e}}for(const e of[o,c]){for(const t in e)f.prototype[t]=e[t]}const u=a(f);const g=u;export{f as HierCluster,g as componentInit,u as hierClusterInit};
@@ -1 +0,0 @@
1
- import{P as e}from"./app-3d14cbe4.js";import{getPlotConfig as t}from"./matrix.config-b3b56456.js";import{T as r,f as s}from"./termsetting-7467350f.js";import"./matrix.sort-89b98e83.js";import"./tslib.es6-c3c2d88f.js";import"path";async function i(i={},a){i.chartType="hierCluster";const o=await t(i,a);delete o.genes;o.settings.hierCluster={dataType:o.dataType,clusterSamples:true,clusterMethod:"average",distanceMethod:"euclidean",zScoreCap:5,xDendrogramHeight:100,yDendrogramHeight:200,colorScale:"blueWhiteRed"};const n=a.vocabApi.termdbConfig.hierCluster||{};e(o.settings.hierCluster,n.settings,i.settings?.hierCluster||{});{const e=o.settings.hierCluster.colorScale;if(!e)throw"colorScale missing"}o.settings.matrix.collabelpos="top";const p=o.settings.hierCluster.termGroupName;const m=o.termgroups.find((e=>e.type=="hierCluster"||e.name==p))||{name:p};m.type="hierCluster";if(!m.lst?.length){if(!Array.isArray(i.terms))throw"opts.terms[] not array (may show geneset edit ui)";const e=[];for(const t of i.terms){const i=t.term?t:{term:t};if(!i.term.type){if(o.dataType==r.GENE_EXPRESSION||o.dataType==r.METABOLITE_INTENSITY){i.term.type=o.dataType}else{throw`term type missing and cannot be assigned by dataType`}}else if(!["geneExpression","metaboliteIntensity","float"].includes(i.term.type)){throw"term type not supported in hierCluster"}else if(o.dataType&&i.term.type!==o.dataType){throw`cannot have term type ${i.term.type} in ${o.dataType} term group`}e.push(s(i,a.vocabApi))}m.lst=await Promise.all(e);if(o.termgroups.indexOf(m)==-1)o.termgroups.unshift(m)}o.settings.matrix.maxSample=1e5;return o}export{i as getPlotConfig};
@@ -1 +0,0 @@
1
- import{r as e}from"./table-be2a9975.js";const t=[{label:"Average",value:"average",title:`Cluster by average value`},{label:`Complete`,value:"complete",title:`Use the complete clustering method`},{label:`Single`,value:"single",title:`Use the single clustering method`},{label:`Ward.D`,value:"ward.D",title:`Use the ward.D clustering method`},{label:`Ward.D2`,value:"ward.D2",title:`Use the ward.D2 clustering method`},{label:`Mcquitty`,value:"mcquitty",title:`Use the Mcquity clustering method`}];const l=[{label:"Euclidean",value:"euclidean",title:`Calculate distance using euclidean method`},{label:"Maximum",value:"maximum",title:`Maximum distance between two components of x and y`},{label:"Manhattan",value:"manhattan",title:`Calculate distance using the absolute distance between the two vectors`},{label:"Canberra",value:"canberra",title:`Calculate distance using Canberra method`}];function s(e,t){const l=t?this.hierClusterData.clustering.row.mergedClusters:this.hierClusterData.clustering.col.mergedClusters;const s=l.get(e).childrenClusters||[];let a=[...s];for(const e of s){a=a.concat(this.getAllChildrenClusterIds(e,t))}return a}function a(e,t){const l=this.settings.matrix.controlLabels;const s=this.opts.allow2selectSamples;const a=[{label:"Zoom in",callback:()=>{this.triggerZoomBranch(this,e)}},{label:`List ${e.length} ${l.samples}`,callback:()=>this.showTable4selectedSamples(e)}];if(s){a.push({label:s.buttonText||`Select ${l.samples}`,callback:async()=>{s.callback({samples:e.map((e=>({"cases.case_id":e}))),source:s.defaultSelectionLabel||`Selected ${l.samples} from gene expression`})}})}else{if(this.state.nav&&this.state.nav.header_mode!=="hidden"){const t=e.map((e=>this.sampleOrder.find((t=>t.row.sample==e)).row));for(const e of t){if(!e.sampleId)e.sampleId=e.sample}a.push({label:"Add to a group",callback:async()=>{const e={name:"Group",items:t};this.addGroup(e)}})}}this.mouseout();this.dom.tip.hide();this.dom.dendroClickMenu.d.selectAll("*").remove();this.dom.dendroClickMenu.d.selectAll("div").data(a).enter().append("div").attr("class","sja_menuoption").style("border-radius","0px").html((e=>e.label)).attr("data-testid",(e=>`hierCluster_dendro_menu_${e.label.split(" ")[0]}`)).on("click",(e=>{this.dom.dendroClickMenu.d.selectAll("*").remove();e.target.__data__.callback()}));this.dom.dendroClickMenu.show(t.clientX,t.clientY)}function i(e,t){const l=this.config.dataType=="geneExpression"?"genes":this.config.dataType=="metaboliteIntensity"?"metabolites":"items";const s=[{label:`List ${e.length} ${l}`,callback:()=>this.showTable4selectedRows(e,l)}];if(this.app.opts.genome.termdbs){s.push({label:`Gene set overrepresentation analysis`,disabled:e.length<15||e.length>500,callback:()=>{if(e.length<15||e.length>500)return;this.dom.dendroClickMenu.d.selectAll("*").remove();const t=e;const l={sample_genes:t.toString(),genome:this.app.vocabApi.opts.state.vocab.genome};const s={chartType:"geneORA",geneORAparams:l};this.app.dispatch({type:"plot_create",config:s})}})}this.mouseout();this.dom.tip.hide();this.dom.dendroClickMenu.d.selectAll("*").remove();this.dom.dendroClickMenu.d.selectAll("div").data(s).enter().append("div").attr("class",(e=>e.disabled?"sja_menuoption_not_interactive":"sja_menuoption")).style("opacity",(e=>e.disabled?.5:1)).style("border-radius","0px").html((e=>e.disabled?`${e.label} <span style="font-size: 0.6em; display: block; margin-left: 2px; margin-top: 2px;">Only available when 15 - 500 genes selected</span>`:e.label)).attr("data-testid",(e=>`hierCluster_dendro_menu_${e.label.split(" ")[0]}`)).on("click",(e=>{if(e.target.__data__?.callback)e.target.__data__.callback()}));this.dom.dendroClickMenu.show(t.clientX,t.clientY)}function n(e,t){if(e.zoomArea){e.zoomArea.remove();delete e.zoomArea}const l={startCell:e.serieses[0].cells.find((e=>e.sample==t[0])),endCell:e.serieses[0].cells.find((e=>e.sample==t[t.length-1]))};const s=e.settings.matrix;const a=e.dimensions;const i=l.startCell.totalIndex<l.endCell.totalIndex?l.startCell:l.endCell;const n=Math.floor(i.totalIndex+Math.abs(l.endCell.totalIndex-l.startCell.totalIndex)/2);const o=e.sampleOrder[n];const r=e.computedSettings.colw||e.settings.matrix.colw;const c=s.colwMax/r;const d=s.colwMin/r;const h=Math.max(1,s.zoomLevel*a.mainw/Math.max(l.endCell.x-l.startCell.x,2*a.colw)*.7);const m=Math.max(d,Math.min(h,c));e.app.dispatch({type:"plot_edit",id:e.id,config:{settings:{matrix:{zoomLevel:m,zoomCenterPct:.5,zoomIndex:n,zoomGrpIndex:o.grpIndex}}}});e.resetInteractions()}function o(t){const l=this.state.termdbConfig.urlTemplates;const s=l?.sample?t.map((e=>[{value:this.hierClusterData.bySampleId[e].label,url:`${l.sample.base}${e}`}])):t.map((e=>[{value:this.hierClusterData.bySampleId[e].label}]));const a=[{label:this.settings.matrix.controlLabels.Sample}];e({rows:s,columns:a,div:this.dom.dendroClickMenu.clear().d.append("div").style("margin","10px"),showLines:true,maxHeight:"35vh",resize:true})}function r(t,l){const s=this.state.termdbConfig.urlTemplates;const a=s?.gene&&this.config.dataType=="geneExpression"&&this.hierClusterData.byTermId?t.map((e=>this.hierClusterData.byTermId[e]?.gencodeId?[{value:e,url:`${s.gene.base}${this.hierClusterData.byTermId[e].gencodeId}`}]:[{value:e}])):t.map((e=>[{value:e}]));const i=[{label:l}];e({rows:a,columns:i,div:this.dom.dendroClickMenu.clear().d.append("div").style("margin","10px"),showLines:true,maxHeight:"35vh",resize:true})}async function c(e){e.plotId=this.id;await this.app.vocabApi.addGroup(e);this.dom.tip.hide()}function d(e){if(e.target.tagName=="image")this.imgBox=e.target.getBoundingClientRect();else return;const t=e.clientY-this.imgBox.y-e.target.clientTop;const l=this.dimensions.xMin;const s=e.clientX-this.imgBox.x-e.target.clientLeft+l;for(const[e,l]of this.hierClusterData.clustering.col.mergedClusters){const{x1:a,y1:i,x2:n,y2:o,clusterY:r}=l.clusterPosition;if(a<=s&&s<=n&&r-5<t&&t<r+5||r<=t&&t<=i&&a-5<s&&s<a+5||r<=t&&t<=o&&n-5<s&&s<n+5){return e}}}function h(e){if(e.target.tagName=="image")this.imgBox=e.target.getBoundingClientRect();else return;const t=e.clientY-this.imgBox.y-e.target.clientTop;const l=this.dimensions.xMin;const s=e.clientX-this.imgBox.x-e.target.clientLeft+l;for(const[e,l]of this.hierClusterData.clustering.row.mergedClusters){const{x1:a,y1:i,x2:n,y2:o,clusterX:r}=l.clusterPosition;if(i<=t&&t<=o&&r-5<s&&s<r+5||r<=s&&s<=a&&i-5<t&&t<i+5||r<=s&&s<=n&&o-5<t&&t<o+5){return e}}}function m(e,s){const a=this.config.settings.matrix.controlLabels;const i=`Cluster ${a.Samples}`;e.append("button").datum({label:`Clustering`,rows:[{label:i,title:`Option to enable ${a.samples} clustering, instead of enable ${a.samples} sorting.`,type:"checkbox",chartType:"hierCluster",settingsKey:"clusterSamples",boxLabel:`Cluster ${a.samples} (Disable ${a.samples} sorting)`,callback:e=>{if(!e){this.config.settings.hierCluster.yDendrogramHeight=0;this.config.settings.hierCluster.clusterSamples=false}else{this.config.divideBy=null;this.config.settings.hierCluster.yDendrogramHeight=200;this.config.settings.hierCluster.clusterSamples=true}this.app.dispatch({type:"plot_edit",id:this.id,config:this.config})}},{label:`Clustering Method`,title:`Sets which clustering method to use`,type:"radio",chartType:"hierCluster",settingsKey:"clusterMethod",options:t},{label:`Distance Method`,title:`Sets which distance method to use for clustering`,type:"radio",chartType:"hierCluster",settingsKey:"distanceMethod",options:l},{label:`Column Dendrogram Height`,title:`The maximum height to render the column dendrogram`,type:"number",chartType:"hierCluster",settingsKey:"yDendrogramHeight",getDisplayStyle(e){return e.settings.hierCluster.clusterSamples?"table-row":"none"}},{label:`Row Dendrogram Width`,title:`The maximum width to render the row dendrogram`,type:"number",chartType:"hierCluster",settingsKey:"xDendrogramHeight"},{label:`z-score Cap`,title:`Cap the z-score scale to not exceed this absolute value`,type:"number",chartType:"hierCluster",settingsKey:"zScoreCap"},{label:`Color Scheme`,title:`Sets which color scheme to use`,type:"radio",chartType:"hierCluster",settingsKey:"colorScale",options:[{label:"Blue-White-Red",value:"blueWhiteRed",title:`color scheme Blue-White-Red`},{label:"Green-Black-Red",value:"greenBlackRed",title:`color scheme Green-Black-Red`},{label:"Blue-Yellow-Red",value:"blueYellowRed",title:`color scheme Blue-Yellow-Red`},{label:"Green-White-Red",value:"greenWhiteRed",title:`color scheme Green-White-Red`},{label:"Blue-Black-Yellow",value:"blueBlackYellow",title:`color scheme Blue-Black-Yellow`}]}]}).html((e=>e.label)).style("margin","2px 0").on("click",s)}var u=Object.freeze({__proto__:null,getAllChildrenClusterIds:s,addSelectedSamplesOptions:a,addSelectedRowsOptions:i,triggerZoomBranch:n,showTable4selectedSamples:o,showTable4selectedRows:r,addGroup:c,getClusterFromTopDendrogram:d,getClusterFromLeftDendrogram:h,setClusteringBtn:m});export{t as c,l as d,u as i};
@@ -1 +0,0 @@
1
- import{T as e}from"./termsetting-7467350f.js";function t(){if(!this.dom.header)return;switch(this.config.dataType){case e.GENE_EXPRESSION:this.dom.header.text("Gene Expression Clustering");break;case e.METABOLITE_INTENSITY:this.dom.header.text("Metabolite Intensity Clustering");break;default:throw`dataType '${this.config.dataType}' not recognized`}}function n(e){const t=this.dimensions;const n=this.config.settings.matrix;t.seriesXoffset;const s=window.devicePixelRatio<=1?1:window.devicePixelRatio;const r=this.hierClusterData.clustering;const a=r.row;const c=r.col;const h=this.settings.matrix.clusterRowh,{xDendrogramHeight:l,yDendrogramHeight:d}=this.settings.hierCluster,g=this.dimensions.dx;if(e!=="left"){if(!this.settings.hierCluster.clusterSamples){this.dom.topDendrogram.selectAll("*").remove()}else{const e=o(c.height,d);const t=d+1e-7;const r=g*c.inputOrder.length;const a=new OffscreenCanvas(r*s,t*s);const h=a.getContext("2d");h.scale(s,s);h.imageSmoothingEnabled=false;h.imageSmoothingQuality="high";h.strokeStyle="black";const u=new Map;for(const[t,n]of c.merge.entries()){const s=t+1;const o=[];const r=[];let a,l,m,p;if(n.n1<0){const[e,t]=i(n.n1,c.inputOrder,c.order);a=g*(t+.5);m=d;o.push({name:e})}else{if(!u.has(n.n1))throw"pair.n1 is positive but not seen before";const e=u.get(n.n1);a=e.x;m=e.y;o.push(...e.children);r.push(n.n1)}if(n.n2<0){const[e,t]=i(n.n2,c.inputOrder,c.order);l=g*(t+.5);p=d;o.push({name:e})}else{if(!u.has(n.n2))throw"pair.n1 is positive but not seen before";const e=u.get(n.n2);l=e.x;p=e.y;o.push(...e.children);r.push(n.n2)}const f=d-c.height[t].height*e;const x=this.clickedClusterIds?.includes(s);h.strokeStyle=x?"red":"black";h.beginPath();h.moveTo(a,m);h.lineTo(a,f);h.lineTo(l,f);h.lineTo(l,p);h.stroke();h.closePath();u.set(s,{x:(a+l)/2,y:f,children:o,childrenClusters:r,clusterPosition:{x1:a,x2:l,y1:m,y2:p,clusterY:f}})}this.renderImage(this.dom.topDendrogram,a,r,t,l+.5*g,n.margin.top+n.scrollHeight);c.mergedClusters=u}}if(e!=="top"){const e=o(a.height,l);const t=l+1e-7;const r=h*a.inputOrder.length;const c=new OffscreenCanvas(t*s,r*s);const g=c.getContext("2d");g.scale(s,s);g.imageSmoothingEnabled=false;g.imageSmoothingQuality="high";g.strokeStyle="black";const u=new Map;for(const[t,n]of a.merge.entries()){const s=t+1;const o=[];const r=[];let c,d,m,p;if(n.n1<0){const[e,t]=i(n.n1,a.inputOrder,a.order);m=h*(t+.5);c=l;o.push({name:e})}else{if(!u.has(n.n1))throw"pair.n1 is positive but not seen before";const e=u.get(n.n1);c=e.x;m=e.y;o.push(...e.children);r.push(n.n1)}if(n.n2<0){const[e,t]=i(n.n2,a.inputOrder,a.order);p=h*(t+.5);d=l;o.push({name:e})}else{if(!u.has(n.n2))throw"pair.n1 is positive but not seen before";const e=u.get(n.n2);d=e.x;p=e.y;o.push(...e.children);r.push(n.n2)}const f=l-a.height[t].height*e;const x=this.clickedLeftClusterIds?.includes(s);g.strokeStyle=x?"red":"black";g.beginPath();g.moveTo(c,m);g.lineTo(f,m);g.lineTo(f,p);g.lineTo(d,p);g.stroke();g.closePath();u.set(s,{x:f,y:(m+p)/2,children:o,childrenClusters:r,clusterPosition:{x1:c,x2:d,y1:m,y2:p,clusterX:f}})}const m=this.termOrder.find((e=>e.grp.type=="hierCluster"||e.grp.name==this.hcTermGroup.name));const p=m.grpIndex*n.rowgspace+m.prevGrpTotalIndex*n.rowh+m.totalHtAdjustments+n.margin.top+n.scrollHeight+d;this.renderImage(this.dom.leftDendrogram,c,t,r,0,p);a.mergedClusters=u}}async function s(e,t,n,s,o,i){const r=new FileReader;r.addEventListener("load",(()=>{e.selectAll("*").remove();e.append("image").attr("x",o+.033).attr("y",i+.033).attr("xlink:href",r.result).attr("width",n).attr("height",s)}),false);const a=await t.convertToBlob({quality:1});r.readAsDataURL(a)}function o(e,t){let n=e[0].height;for(const t of e)n=Math.max(n,t.height);return t/n}function i(e,t,n){const s=t[-e-1];if(!s)throw"minus not in inputOrder";const o=n.findIndex((e=>e.name==s));if(o==-1)throw"name not found in hc$order";return[s,o]}var r=Object.freeze({__proto__:null,maySetSandboxHeader:t,plotDendrogramHclust:n,renderImage:s});export{r};
@@ -1 +0,0 @@
1
- import{_ as t}from"./tslib.es6-c3c2d88f.js";import{appInit as e}from"./plot.app-4dc30ebc.js";import{ai as o,z as s}from"./app-3d14cbe4.js";import"./recover-4888c2a9.js";import"./termsetting-7467350f.js";import"path";import"./FilterRxComp-e8de560c.js";import"./table-be2a9975.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./FilterStateless-75514d37.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";import"./toggleButtons-2144daab.js";import"./genesearch-0587c713.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";function n(s,n,i){return t(this,void 0,void 0,(function*(){const[t,c]=yield r(s);if(c===null||c===void 0?void 0:c.length){return o(c,i)}const p={holder:i,vocabApi:{vocab:{terms:[]},main:()=>{},getTermdbConfig:()=>({})},state:{args:{data:t,genome:n},plots:[{chartType:"Disco",subfolder:"disco",extension:"ts"}]}};const u=yield e(p);return u}))}function r(e){return t(this,void 0,void 0,(function*(){if(Array.isArray(e.mlst)){return[e.mlst,null]}const t=[];const o=[];if(e.snvText)i(e.snvText,t,o);if(e.svText)c(e.svText,t,o);if(e.cnvText)p(e.cnvText,t,o);return[t,o]}))}function i(t,e,o){for(const s of t.trim().split("\n")){const t=s.trim().split("\t");if(t.length!=5){o.push("snv input not equal to 5 columns");continue}let n;try{n={dt:1,chr:t[0],position:Number(t[1]),gene:t[2],mname:t[3],class:u(t[4],o)}}catch(t){o.push(t);continue}e.push(n)}}function c(t,e,o){for(const s of t.trim().split("\n")){const t=s.trim().split("\t");if(t.length<4||t.length>6){o.push("sv input not equal to 4 or 6 columns");continue}let n;try{const e=t.length;if(e==4){n={dt:2,chrA:t[0],posA:Number(t[1]),chrB:t[2],posB:Number(t[3])}}else{n={dt:2,chrA:t[0],posA:Number(t[1]),geneA:t[2],chrB:t[3],posB:Number(t[4]),geneB:t[5]}}}catch(t){o.push(t);continue}e.push(n)}}function p(t,e,o){for(const s of t.trim().split("\n")){const t=s.trim().split("\t");if(t.length!=4){o.push("cnv input not equal to 4 columns");continue}let n;try{n={dt:4,chr:t[0],start:Number(t[1]),stop:Number(t[2]),value:Number(t[3])}}catch(t){o.push(t);continue}e.push(n)}}function u(t,e){const o=t.toLowerCase();const n=Object.values(s).find((t=>t.key.toLowerCase()===o||t.label.toLowerCase()===o));if(n){return n.key}else{e.push(`Invalid mutation class: ${t}`)}}export{n as launch};
@@ -1 +0,0 @@
1
- import{aM as t,aL as o,a8 as r}from"./app-3d14cbe4.js";import{s as e}from"./legacy-d3-polyfill-bdb2d792.js";function n(n){if(n.geneexpression){if(n.geneexpression.maf){try{n.geneexpression.maf.get=new Function(...n.geneexpression.maf.get)}catch(t){return"invalid Javascript for get() of expression.maf of "+n.label}}}if(n.cohort){if(n.cohort.raw&&n.cohort.tosampleannotation){if(!n.cohort.key4annotation){return"cohort.tosampleannotation in use by .key4annotation missing of "+n.label}if(!n.cohort.annotation){n.cohort.annotation={}}let t=0;for(const o of n.cohort.raw){const r=o[n.cohort.tosampleannotation.samplekey];if(r){const t={};for(const r in o){t[r]=o[r]}n.cohort.annotation[r]=t}else{t++}}if(t)return t+" rows has no sample name from sample annotation of "+n.label;delete n.cohort.tosampleannotation}if(n.cohort.levels){if(n.cohort.raw){const r=t(n.cohort.raw,n.cohort.levels);n.cohort.root=o()(r);n.cohort.root.sum((t=>t.value))}}if(n.cohort.raw){delete n.cohort.raw}n.cohort.suncolor=r(e)}if(n.snvindel_attributes){for(const t of n.snvindel_attributes){if(t.get){try{t.get=new Function(...t.get)}catch(o){return"invalid Javascript for getter of "+JSON.stringify(t)}}else if(t.lst){for(const o of t.lst){if(o.get){try{o.get=new Function(...o.get)}catch(t){return"invalid Javascript for getter of "+JSON.stringify(o)}}}}}}if(n.stratify){if(!Array.isArray(n.stratify)){return"stratify is not an array in "+n.label}for(const t of n.stratify){if(!t.label){return"stratify method lacks label in "+n.label}if(t.bycohort){if(!n.cohort){return"stratify method "+t.label+" using cohort but no cohort in "+n.label}}else{if(!t.attr1){return"stratify method "+t.label+" not using cohort but no attr1 in "+n.label}if(!t.attr1.label){return".attr1.label missing in "+t.label+" in "+n.label}if(!t.attr1.k){return".attr1.k missing in "+t.label+" in "+n.label}}}}if(n.url4variant){for(const t of n.url4variant){t.makelabel=new Function(...t.makelabel);t.makeurl=new Function(...t.makeurl)}}}export{n as validate_oldds};
@@ -1 +0,0 @@
1
- import{V as t,P as e,F as s,h as i,z as o,B as n,O as r}from"./app-3d14cbe4.js";import{setMatrixDom as a}from"./matrix.dom-cb1f4872.js";import{setInteractivity as l}from"./matrix.interactivity-3f3cf44d.js";import{setRenderers as p}from"./matrix.renderers-1aed44e5.js";import{MatrixCluster as d}from"./matrix.cluster-7ab94fb5.js";import{MatrixControls as c}from"./matrix.controls-6e0e9692.js";import{s as m}from"./svg.legend-812ea603.js";import{m as h}from"./matrix.data-baabaf57.js";import{m as g}from"./matrix.layout-50bc2ea5.js";import{m as u}from"./matrix.serieses-dc18fcc2.js";import{m as f}from"./matrix.legend-024e2d50.js";import{m as b}from"./matrix.groups-9990aade.js";import{setComputedConfig as y}from"./matrix.config-b3b56456.js";export{getPlotConfig}from"./matrix.config-b3b56456.js";import{l as v}from"./termsetting-7467350f.js";import"./table-be2a9975.js";import"./tslib.es6-c3c2d88f.js";import"./pointer-c7475677.js";import"./controls.config-00ce9f0b.js";import"path";import"./matrix.sorterUi-0ad98ef0.js";import"./radiobutton-09bff425.js";import"./checkbox-96437f4d.js";import"./recover-4888c2a9.js";import"./FilterRxComp-e8de560c.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./FilterStateless-75514d37.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";import"./toggleButtons-2144daab.js";import"./genesearch-0587c713.js";import"./rehydrateFilter-12d118cb.js";import"./axis-747c801e.js";import"./matrix.cells-4dd055e7.js";import"./legacy-d3-polyfill-bdb2d792.js";import"./filter-b3d3964e.js";import"./matrix.sort-89b98e83.js";let x;function j(t,e){const s=structuredClone(t);if(!x)x={CatTWValues:k,CatTWPredefinedGS:k,CatTWCustomGS:k,NumTWRegularBin:k,NumTWCustomBin:k,NumTWCont:C};const i={vocabApi:e.vocabApi,addons:x};for(const t of s){const e=[];for(const s of t.lst){e.push(s.type in i.addons?v.init(s,i):s)}t.lst=e}return s}const k={setCellProps:{value:function(t,e,s,i,o,n,r,a,l,p,d){var c,m,h;const g=this.getTw();const u=e.key;const f=g.term.values||{};t.label="label"in e?e.label:((c=f[u])===null||c===void 0?void 0:c.label)?f[u].label:u;t.fill=e.color||((m=f[e.key])===null||m===void 0?void 0:m.color);t.order=o.ref.bins?o.ref.bins.findIndex((t=>t.name==u)):0;t.x=t.totalIndex*l+t.grpIndex*i.colgspace;t.y=a*d;const b=((h=g.legend)===null||h===void 0?void 0:h.group)||g.$id;return{ref:o.ref,group:b,value:u,entry:{key:u,label:t.label,fill:t.fill}}}}};const C={setCellProps:{value:function(e,s,i,o,n,r,a,l,p,d,c){var m,h,g,u,f;const b=this.getTw();const y=s.key;const v=b.term.values||{};e.label="label"in s?s.label:((m=v[y])===null||m===void 0?void 0:m.label)?v[y].label:y;e.fill=s.color||((h=v[s.key])===null||h===void 0?void 0:h.color);if(!b.settings)b.settings={};if(!b.settings.barh)b.settings.barh=o.barh;if(!("gap"in b.settings))b.settings.gap=4;const x=(g=b.term.values)===null||g===void 0?void 0:g[e.key];if(x===null||x===void 0?void 0:x.uncomputable){e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=l*c;e.height=b.settings.barh;e.fill="transparent";e.label=x.label;const t=((u=b.legend)===null||u===void 0?void 0:u.group)||b.$id;return{ref:n.ref,group:t,value:x.label||x.key,entry:{key:y,label:e.label,fill:e.fill}}}e.fill="#555";if(o.transpose){e.height=n.scale(e.key);e.x=b.settings.gap}else{const i=e.term.valueConversion;let r=i?e.key*i.scaleFactor:e.key;if(this.q.convert2ZScore){r=(r-n.mean)/n.std;e.fill=r>0?"#FF6666":"#6666FF";e.zscoreLabel=` (z-score: ${r.toFixed(2)})`}e.label="label"in s?s.label:((f=v[y])===null||f===void 0?void 0:f.label)?v[y].label:this.term.unit?`${e.key.toFixed(2)} ${this.term.unit}`:e.key.toFixed(2);e.height=r>=0?n.scales.pos(r):n.scales.neg(r);e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=r>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!i?"":t(e.key,i.fromUnit,i.toUnit,i.scaleFactor)}}}};class T{constructor(t){this.type="matrix";this.holderTitle="Sample Matrix";this.optionalFeatures=JSON.parse(sessionStorage.getItem("optionalFeatures")||`{}`)?.matrix||[];l(this);p(this)}async init(t){const s=this.opts;if(s.reactsTo)this.reactsTo=s.reactsTo;this.setDom=a;this.setDom(s);this.config=t.plots.find((t=>t.id===this.id));this.settings=Object.assign({},this.config.settings.matrix);this.computed={};if(this.dom.header)this.dom.header.html(this.holderTitle);this.setControls(t);this.clusterRenderer=new d({holder:this.dom.cluster,app:this.app,parent:this});this.legendRenderer=m({holder:this.dom.legendG,rectFillFxn:t=>t.color,iconStroke:"#aaa",handlers:{legend:{click:this.legendClick}},settings:{isExcludedAttr:"isExcluded"},note:"CLICK A ROW LABEL OR ITEM TO APPLY FILTERING"});this.customTipApi=this.dom.tip.getCustomApi({d:this.dom.menubody,clear:t=>{if(t?.target)this.dom.menutop.style("display","none");this.dom.menubody.selectAll("*").remove();return this.customTipApi},show:()=>{this.dom.menubody.style("display","block")},hide:()=>{}});this.setPill(t);const i={mclass:o,dt2label:n,morigin:r};for(const s in i){const o=i[s];this[s]=e({},o,t.termdbConfig[s]||{},t.termdbConfig.matrix?.[s]||{})}}setControls(t){this.controlsRenderer=new c({app:this.app,id:this.id,parent:this,holder:this.dom.controls,getSvg:()=>this.dom.svg.node()},t)}getState(t){const e=t.plots.find((t=>t.id===this.id));const s=t.termfilter.filter0;this.prevFilter0=this.state?.filter0;return{isVisible:true,config:e,filter:t.termfilter.filter,filter0:s,hasVerifiedToken:this.app.vocabApi.hasVerifiedToken(),tokenVerificationMessage:this.app.vocabApi.tokenVerificationMessage,vocab:t.vocab,termdbConfig:t.termdbConfig,clusterMethod:e.settings.hierCluster?.clusterMethod,distanceMethod:e.settings.hierCluster?.distanceMethod,clusterSamples:e.settings.hierCluster?.clusterSamples,nav:t.nav}}async main(){try{this.config=structuredClone(this.state.config);if(this.mayRequireToken())return;this.termGroups=j(this.config.termgroups,this.app);const t=this.settings.transpose;Object.assign(this.settings,structuredClone(this.config.settings),this.controlsRenderer.getSettings());this.dom.loadingDiv.selectAll("*").remove();this.dom.loadingDiv.html("").style("display","").style("position","relative").style("left","45%");this.dom.svg.style("opacity",.1).style("pointer-events","none");delete this.clickedChildren;try{y(this.config);const t=[];if(this.setHierClusterData)t.push(this.setHierClusterData());t.push(this.setData());this.dom.loadingDiv.html("Processing data ...");await Promise.all(t);this.applyLegendValueFilter();if(this.combineData)this.combineData();this.app.save({type:"plot_edit",id:this.id,config:this.config})}catch(t){if(t=="no data"){this.showNoMatchingDataMessage();return}else if(t=="stale sequenceId"||t.name=="AbortError"){return}else{this.dom.svg.style("display","none");throw t}}this.dom.loadingDiv.html("Updating ...").style("display","");this.termOrder=this.getTermOrder(this.data);this.sampleGroups=this.getSampleGroups(this.hierClusterSamples||this.data);this.sampleOrder=this.getSampleOrder(this.data);if(!this.sampleOrder?.length&&!this.config.legendGrpFilter?.lst.length&&!this.config.legendValueFilter?.lst.length){this.showNoMatchingDataMessage();this.controlsRenderer.main();return}this.setLayout();if(this.setHierColorScale)this.setHierColorScale(this.hierClusterData.clustering);this.serieses=this.getSerieses(this.data);this.dom.loadingDiv.html("Rendering ...");if(this.plotDendrogramHclust)this.plotDendrogramHclust();this.render();this.mayDisplayCohortMessage();this.dom.svg.style("display","").style("opacity",1).style("pointer-events","");const[e,s]=!this.settings.matrix.transpose?["sampleGrps","termGrps"]:["termGrps","sampleGrps"];const i=this.dimensions;this.clusterRenderer.main({settings:this.settings.matrix,xGrps:this[e],yGrps:this[s],dimensions:i});this.legendRenderer(this.legendData,{settings:Object.assign({},this.settings.legend,{svgw:Math.max(400,i.mainw+i.xOffset-this.settings.matrix.margin.right),svgh:i.mainh+i.yOffset,dimensions:i,padleft:this.settings.legend.padleft})});await this.adjustSvgDimensions(t);this.controlsRenderer.main()}catch(t){const e=this.app.vocabApi.tokenVerificationMessage;this.mayRequireToken(e);if(!e){this.app.tip.hide();this.dom.loadingDiv.style("display","none");throw t}}this.resetInteractions()}showNoMatchingDataMessage(){this.forcedSampleCount=0;this.dom.svg.style("opacity",.001).style("display","none");if(this.termOrder&&this.dimensions)this.controlsRenderer.main({sampleCount:0});this.dom.loadingDiv.html("");const t=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");t.append("div").style("margin","5px 10px").html("No matching cohort sample data for the current gene list.");if(this.settings.matrix.showHints?.includes("genesetEdit")){const e=t.append("div").style("margin","5px 10px");e.append("span").html("You may change the selected cohort,");if(this.config.legendGrpFilter?.lst.length||this.config.legendValueFilter?.lst.length){e.append("br");e.append("span").html("show hidden ");e.append("span").html("CNV").style("cursor","pointer").style("text-decoration","underline").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="CNV"))?.node().click()}));e.append("span").html(" or ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Mutation").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Mutation"))?.node().click()}));e.append("span").html(" data,")}e.append("br");e.append("span").html("or edit the gene list from the ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}this.dom.svg.style("display","none")}mayDisplayCohortMessage(){const t=!this.prevFilter0||s(this.state.filter0,this.prevFilter0)?"":"The gene list is persisted across cohorts.";if(t){this.dom.loadingDiv.html("");const e=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");e.append("div").html(t);if(this.settings.matrix.showHints?.includes("genesetEdit")){const t=e.append("div");t.append("span").html(" You may edit the gene list from the ");t.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}}this.dom.loadingDiv.style("display",t?"":"none")}sampleKey(t){return t.row.sample}sampleLabel(t){return t.label||t.row._ref_.label||""}sampleGrpKey(t){return t.grp.name}sampleGrpLabel(t){return t.grp.label||t.grp.name||""}termKey(t){return t.tw.$id}termLabel(t){return t.label}termGrpKey(t){return t.grp.name}termGrpLabel(t){return t.grp.label||t.grp.name||[{text:"⋮",dx:3,cls:"sjpp-exclude-svg-download"}]}}for(const t of[h,b,g,u,f]){for(const e in t){T.prototype[e]=t[e]}}const w=i(T);const D=w;function G(t,e){e.dom.tip.clear();const s=t.append("div");if(e.state.termdbConfig.matrixplots){for(const t of e.state.termdbConfig.matrixplots){s.append("div").attr("class","sja_menuoption sja_sharp_border").text(t.name).on("click",(async()=>{e.dom.tip.hide();const s=await e.app.vocabApi.getMatrixByName(t.name);e.app.dispatch({type:"plot_create",config:s})}))}}s.append("div").datum({label:"Term tree & search",clickTo:e.showTree_selectlst,chartType:"matrix",usecase:{target:"matrix",detail:"termgroups"},processSelection:t=>[{name:"",lst:t.map((t=>({term:t})))}]}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>e.showTree_selectlst(s)));s.append("div").datum({label:"Text input",chartType:"matrix",clickTo:S,usecase:{target:"matrix",detail:"termgroups"},placeholder:"term\tgroup",processInput:async t=>{const s=t.split("\n").map((t=>t.split("\t")));const i=s.map((t=>t[0])).filter((t=>!!t));const o=await e.app.vocabApi.getTermTypes(i);const n={};for(const[t,e]of s){if(!(t in o))continue;if(!(e in n))n[e]={name:e,lst:[]};n[e].lst.push({term:o[t]})}return Object.values(n)}}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>S(s,e)))}function S(t,e){e.dom.tip.clear();e.dom.submenu=e.dom.tip.d.append("div").style("text-align","center");e.dom.submenu.append("span").html(t.label);e.dom.submenu.append("button").style("margin","0 5px").html("Submit").on("click",(async()=>{const i=await t.processInput(s.property("value"));e.dom.tip.hide();const o={type:"plot_create",id:I(),config:{chartType:t.usecase.target,[t.usecase.detail]:i}};e.app.dispatch(o)}));const s=e.dom.submenu.append("div").style("text-align","left").append("textarea").attr("placeholder",t.placeholder).style("width","300px").style("height","300px").style("margin","5px").style("padding","5px").on("keydown",(t=>{const e=t.keyCode||t.which;if(e==9){t.preventDefault();const e=t.target;const s=e.selectionStart;e.value=e.value.substring(0,e.selectionStart)+"\t"+e.value.substring(e.selectionEnd);e.selectionEnd=s+1}}))}const F="_CHART_AUTOID_";let M=Date.now();function I(){return F+M++}export{T as Matrix,D as componentInit,G as makeChartBtnMenu,w as matrixInit};
@@ -1 +0,0 @@
1
- import{ak as e,at as l,ap as t,R as s,as as a,bR as n,V as r}from"./app-3d14cbe4.js";import{T as o}from"./termsetting-7467350f.js";import"./tslib.es6-c3c2d88f.js";import"path";function i(e,l,t,s,a,n,o,i,c,g,d,u){const f=t.key;const p=l.term.values||{};e.label="label"in t?t.label:p[f]?.label?p[f].label:f;e.fill=t.color||p[t.key]?.color;e.order=n.ref.bins?n.ref.bins.findIndex((e=>e.name==f)):0;if(l.q?.mode=="continuous"){if(!l.settings)l.settings={};if(!l.settings.barh)l.settings.barh=a.barh;if(!("gap"in l.settings))l.settings.gap=4;const s=l.term.values?.[e.key];if(s?.uncomputable){e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;e.height=l.settings.barh;e.fill="transparent";l.legend?.group||l.$id;return}e.fill="#555";if(a.transpose){e.height=n.scale(e.key);e.x=l.settings.gap}else{const s=e.term.valueConversion;let o=s?e.key*s.scaleFactor:e.key;if(l.q.convert2ZScore){o=(o-n.mean)/n.std;e.fill=o>0?"#FF6666":"#6666FF";e.zscoreLabel=` (z-score: ${o.toFixed(2)})`}e.label="label"in t?t.label:p[f]?.label?p[f].label:l.term.unit?`${e.key.toFixed(2)} ${l.term.unit}`:e.key.toFixed(2);e.height=o>=0?n.scales.pos(o):n.scales.neg(o);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=o>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!s?"":r(e.key,s.fromUnit,s.toUnit,s.scaleFactor)}}else{e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const t=l.legend?.group||l.$id;return{ref:n.ref,group:t,value:f,entry:{key:f,label:e.label,fill:e.fill}}}}function c(e,l,t,s,a,n,o,i,c,g,d,u){const f=l.q?.mode=="continuous"?t.value:t.key;e.key=f;e.label=l.q?.mode=="continuous"?l.term.unit?`${f} ${l.term.unit}`:f:l.term.values?.[f].label?l.term.values?.[f].label:"Exit code: "+f;e.fill=f==1?"#a1a3a6":"#a3c88b";e.order=0;if(l.q?.mode=="continuous"){if(!l.settings)l.settings={};if(!l.settings.barh)l.settings.barh=a.barh;if(!("gap"in l.settings))l.settings.gap=4;e.exitCodeKey=l.term.values?.[t.key].label||"Exit code: "+t.key;e.fill=t.key==1?"#a1a3a6":"#a3c88b";if(a.transpose){e.height=n.scale(e.key);e.x=l.settings.gap}else{const t=e.term.valueConversion;let s=t?e.key*t.scaleFactor:e.key;if(l.q.convert2ZScore){s=(s-n.mean)/n.std;e.zscoreLabel=` (z-score: ${s.toFixed(2)})`}e.label=l.term.unit?`${e.key.toFixed(2)} ${l.term.unit}`:e.key.toFixed(2);e.height=s>=0?n.scales.pos(s):n.scales.neg(s);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=s>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!t?"":r(e.key,t.fromUnit,t.toUnit,t.scaleFactor)}}else{const s=e.term.valueConversion;e.timeToEventKey=s?r(t.value,s.fromUnit,s.toUnit,s.scaleFactor):t.value.toFixed(2);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const o=l.legend?.group||l.$id;return{ref:n.ref,group:o,value:f,entry:{key:f,label:e.label,fill:e.fill}}}}function g(e,l,t,s,a,n,r,o,i,c,g,d){const u=l.term.values||{};const f=t.key;e.label="label"in t?t.label:u[f]?.label?u[f].label:f;e.fill=t.color||u[f]?.color;e.x=e.totalIndex*c+e.grpIndex*a.colgspace;e.y=i*d;const p=l.legend?.group||l.$id;return{ref:n.ref,group:p,value:t.key,entry:{key:f,label:e.label,fill:e.fill}}}function d(n,r,o,i,c,g,d,u,f,p,b,x){const h=o.renderedValues||o.filteredValues||o.values||[o.value];const y=r.q?.values&&r.q?.values[i.class]?.color;if(r.q?.type=="predefined-groupset"||r.q?.type=="custom-groupset"){n.label=i;n.fill=["Mutated","Protein-changing","Truncating"].includes(i)?"#FF0000":["Wildtype","Rest"].includes(o.key)?"#0000FF":o.key=="Not tested"?"#00FF00":"#000000";n.value={value:i,dt:r.q.dt,origin:r.q.origin};n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*x;const e=r.legend?.group||r.q.origin?`${r.q.origin[0].toUpperCase()+r.q.origin.slice(1)} ${d.dt2label[r.q.dt]}`:d.dt2label[r.q.dt];return{ref:g.ref,group:e,value:o.key,order:-2,entry:{key:o.key,label:n.label,fill:n.fill,dt:r.q.dt,origin:r.q.origin}}}else{n.label=i.label||d.mclass[i.class].label;n.fill=d.getValueColor?.(i.value)||y||i.color||d.mclass[i.class]?.color;n.class=i.class;n.value=i;const o=d.dimensions.colw;if(c.cellEncoding==""){n.height=c.rowh/h.length;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*x}else if(i.dt==e||i.dt==l){if(c.cellEncoding=="single"){n.height=c.rowh;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=0}else{const e=3;n.height=c.rowh/e;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*.33333}}else if(i.dt==t||i.dt==s){n.height=c.rowh;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=0}else{throw`cannot set cell props for dt='${i.dt}'`}if(i.class=="Blank"||i.class=="WT"){n.label=`${d.dt2label[i.dt]} ${n.label}`}const u=d.state.termdbConfig.assayAvailability?.byDt;const b=i.class=="CNV_loss"?-2:i.class.startsWith("CNV_")?-1:0;if(i.dt==t){if(g.scales&&i.class.startsWith("CNV_")){g.scales.max;const{maxLoss:e,maxGain:l,minLoss:t,minGain:s}=g.scales;i.scaledValue=i.value<0?i.value/t:i.value/l;n.fill=i.value<0?g.scales.loss(i.scaledValue):g.scales.gain(i.scaledValue);return{ref:g.ref,group:"CNV",value:i.class,order:-1,entry:{key:i.class,label:n.label,scale:i.class=="CNV_loss"?g.scales.loss:g.scales.gain,domain:i.class=="CNV_loss"?[0,-t]:[0,l],minLabel:0,maxLabel:i.class=="CNV_loss"?t:l,order:b,dt:i.dt,origin:i.origin}}}else{const e="CNV";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}}else if(i.dt==l&&u?.[l]){const e="Fusion RNA";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}else if(i.dt==a&&u?.[a]){const e="Structural Variation";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}else if(i.dt==s){return{ref:g.ref,group:d.config.settings.hierCluster?.termGroupName||"Gene Expression",value:i.class,order:-1,entry:{key:i.class,label:"",scale:d.geneExpValues.scale,domain:[0,.5,1],minLabel:d.geneExpValues.min,maxLabel:d.geneExpValues.max,order:b,dt:i.dt,origin:i.origin}}}else{const e=d.settings.matrix.controlLabels;const l=r.legend?.group||(i.origin?`${i.origin[0].toUpperCase()+i.origin.slice(1)} ${e.Mutations}`:e.Mutations);return{ref:g.ref,group:l,value:i.class,order:-2,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}}}function u(e,l,t,s,a,r,o,i,c,g,d,u){t.renderedValues||t.filteredValues||t.values||[t.value];e.label=s.value;e.fill=o.getValueColor?.(s.value);e.value=s;const f=o.dimensions.colw;e.height=a.clusterRowh;e.width=f;e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const p=o.config.settings.hierCluster?.termGroupName?o.config.settings.hierCluster?.termGroupName:l.term.type=="geneExpression"?"Expression":l.term.type=="metaboliteIntensity"?"Intensity":"Heatmap color scale";return{ref:r.ref,group:p,order:-1,entry:{label:"",scale:o.hierClusterValues.scale,domain:n[o.settings.hierCluster.colorScale].domain,minLabel:o.hierClusterValues.min,maxLabel:o.hierClusterValues.max,order:0,dt:s.dt}}}function f(e,l,t){const s=Object.assign({},e);s.fill=l.cellbg;s.height=l.rowh;s.width=t.colw;s.x=s.totalIndex*t.dx+s.grpIndex*l.colgspace;s.y=0;return s}const p={categorical:g,condition:g,integer:i,float:i,survival:c,geneVariant:d,hierCluster:u,[o.GENE_EXPRESSION]:i,[o.METABOLITE_INTENSITY]:i};const b={geneVariant:x,integer:h,float:h,categorical:y,condition:y,survival:h,[o.GENE_EXPRESSION]:h,[o.METABOLITE_INTENSITY]:h};function x(e,l,s,a){if(e.find((e=>e.value.dt==t)))return;const n=Object.assign({},l);n.fill=s.cellbg;n.height=s.rowh;n.width=a.colw;n.x=n.totalIndex*a.dx+n.grpIndex*s.colgspace;n.y=0;return n}function h(e,l,t,s){const a=l.tw.q;if(a.mode!="continuous"){if(e.length)return;y(e,l,t,s)}else{if(a?.mode!="continuous")return;const e=l.tw.settings;const n=e?e.barh+2*e.gap:t.rowh;if(l.height>=n)return;const r=Object.assign({},l);r.fill=t.cellbg;r.height=n||t.rowh;r.width=s.colw;r.x=r.totalIndex*s.dx+r.grpIndex*t.colgspace;r.y=0;return r}}function y(e,l,t,s){if(e.length)return;const a=Object.assign({},l);a.fill=t.cellbg;a.height=t.rowh;a.width=s.colw;a.x=a.totalIndex*s.dx+a.grpIndex*t.colgspace;a.y=0;return a}export{f as getEmptyCell,b as maySetEmptyCell,p as setCellProps,d as setGeneVariantCellProps,u as setHierClusterCellProps};
@@ -1 +0,0 @@
1
- import{d as t}from"./app-3d14cbe4.js";class s{constructor(t){this.parent=t.parent;t.svg;this.patternId=`sjpp-matrix-grid-pattern-${this.parent.id}`;this.patternIdSuffix=0;this.dom={holder:t.holder,clusterbg:t.holder.insert("g","g").attr("class","sjpp-matrix-clusterbg").on("mouseover",this.mouseout),outlines:t.holder.append("g").attr("class","sjpp-matrix-clusteroutlines")};e(this)}main(t){this.currData=t;this.settings=t.settings;this.xGrps=t.xGrps;this.xGrpKey=!this.settings.transpose?"samplegrp":"termgrp";this.yGrps=t.yGrps;this.yGrpKey=!this.settings.transpose?"termgrp":"samplegrp";this.clusters=this.processData();this.render(this.clusters)}processData(){const t=this.settings;const s=this.currData.dimensions;const e=[];this.totalWidth=t.zoomLevel==1?-4:0;for(const r of this.xGrps){const n=s.dx;const o=r.prevGrpTotalIndex*n+t.colgspace*r.grpIndex+r.totalHtAdjustments;const a=n*(r.processedLst||r.grp.lst).length+r.grpTotals.htAdjustment-t.colspace;this.totalWidth+=a+2*Math.max(1,t.colspace);for(const n of this.yGrps){const i=n.prevGrpTotalIndex*s.dy+n.grpIndex*t.rowgspace+n.totalHtAdjustments;const c=s.dy*(n.processedLst||n.grp.lst).length+n.grpTotals.htAdjustment-t.rowspace;const p=1;const l=1;e.push({xg:r,yg:n,x:o-p,y:i-l,width:a+2*p,height:c+2*l})}}return e}}function e(s){s.render=function(t){const r=s.settings;const a=s.currData.dimensions;const i=s.dom.outlines.attr("transform")?r.duration:0;s.translateElems(0,r,a,i);if(r.prevShowGrid!=r.showGrid){s.dom.outlines.selectAll("*").remove()}if(r.showGrid!="pattern"){e(t)}else{const e=s.dom.outlines.selectAll("g").data(t,(t=>t.xg.grp.name+";;"+t.yg.grp.name));e.exit().remove();e.each(o);e.enter().append("g").each(n)}r.prevShowGrid=r.showGrid;s.parent.delayedMouseoutHandler()};s.translateElems=function(t,e,r,n=0){const o=!n?s.dom.outlines:s.dom.outlines.transition().duration(n);o.attr("transform",`translate(${r.xOffset+r.seriesXoffset+t},${r.yOffset})`)};function e(t,e,n){const o=s.dom.outlines.selectAll("rect").data(t,(t=>t.xg.grp.name+";;"+t.yg.grp.name));o.exit().remove();o.each(r);o.enter().append("rect").each(r)}function r(e){const r=s.settings;t(this).transition().duration("x"in this?r.duration:0).attr("x",e.x).attr("y",e.y).attr("width",e.width).attr("height",e.height).attr("shape-rendering","crispEdges").attr("fill",!r.showGrid?r.cellbg:r.gridStroke).attr("stroke",r.outlineStroke).attr("stroke-width",1)}function n(e){const r=t(this);const n=r.append("pattern").attr("id",`${s.patternId}-${s.patternIdSuffix++}`).attr("patternUnits","userSpaceOnUse").attr("patternUnits","userSpaceOnUse");n.append("line");n.append("line");r.append("rect");r.append("rect");o.call(this,e)}function o(e){const r=s.settings;const n=s.parent.dimensions;const o=t(this);const c=a(o,r,n);const p=o.node().querySelectorAll("rect");i.call(p[0],e,Object.assign({},r,{fill:r.cellbg}));const l=r.showGrid?`url(#${c})`:"none";i.call(p[1],e,Object.assign({},r,{fill:l,stroke:r.gridStroke}))}function a(s,e,r,n){const o=s.select("pattern").attr("x",0).attr("y",0).attr("width",r.colw+e.colspace).attr("height",e.rowh+e.rowspace);const a=.5*e.rowspace;const i=e.rowh+a;const[c,p]=o.node().querySelectorAll("line");t(c).attr("x1",0).attr("y1",i).attr("x2",r.colw+e.colspace).attr("y2",i).attr("stroke",e.gridStroke).attr("stroke-width",e.rowspace);const l=.5*e.colspace;const d=r.colw+l;t(p).attr("x1",d).attr("y1",0).attr("x2",d).attr("y2",e.rowh).attr("stroke",e.gridStroke).attr("stroke-width",e.colspace);return o.attr("id")}function i(s,e){const r=t(this);r.transition().duration(r.attr("x")?e.duration:0).attr("x",s.x).attr("y",s.y).attr("width",s.width).attr("height",s.height).attr("shape-rendering","crispEdges").attr("fill",e.fill||"none").attr("stroke",e.stroke||"none")}}export{s as MatrixCluster};
@@ -1 +0,0 @@
1
- import{bM as e,bN as t,bO as s,bP as a,bQ as i,P as l,z as o,ap as r}from"./app-3d14cbe4.js";import{getSortOptions as n}from"./matrix.sort-89b98e83.js";import{b as m,f as p}from"./termsetting-7467350f.js";import"./tslib.es6-c3c2d88f.js";import"path";async function c(o={},r){const c={Samples:"Samples",samples:"samples",Sample:"Sample",sample:"sample",Terms:"Variables",terms:"variables",Term:"Variable",term:"Variable",Mutations:"Mutations"};const d={termgroups:[],samplegroups:[],divideBy:null,legendValueFilter:{isAtomic:true,type:"tvslst",in:true,join:"and",lst:[]},legendGrpFilter:{isAtomic:true,type:"tvslst",in:true,join:"and",lst:[]},settings:{matrix:{svgCanvasSwitch:1e3,useMinPixelWidth:true,cellEncoding:"",margin:{top:10,right:5,bottom:20,left:50},maxGenes:o.settings?.maxGenes||50,maxSample:o.settings?.maxSample||1e3,sampleNameFilter:"",sortSamplesBy:"a",sortPriority:undefined,sortSampleGrpsBy:"name",sortSamplesTieBreakers:[{$id:"sample",sortSamples:{}}],sortTermsBy:"sampleCount",samplecount4gene:o.chartType=="hierCluster"?"":"abs",geneVariantCountSamplesSkipMclass:[],cellbg:"#ececec",showGrid:"",addMutationCNVButtons:false,truncatingMutations:e,proteinChangingMutations:t,synonymousMutations:s,mutationClasses:a,CNVClasses:i,gridStroke:"#fff",outlineStroke:"#ccc",beamStroke:"#f00",colw:0,colwMin:.1/window.devicePixelRatio,colwMax:16,colspace:1,colgspace:8,colglabelpos:true,collabelpos:"bottom",collabelvisible:true,collabelgap:5,collabelpad:1,collabelmaxchars:32,rowh:18,rowhMin:1,rowhMax:20,rowspace:1,rowgspace:8,rowlabelpos:"left",rowlabelgap:5,rowlabelvisible:true,rowlabelpad:1,rowlabelmaxchars:32,legendGrpLabelMaxChars:26,grpLabelFontSize:12,minLabelFontSize:6,maxLabelFontSize:14,transpose:false,sampleLabelOffset:120,sampleGrpLabelOffset:120,sampleGrpLabelMaxChars:32,termLabelOffset:80,termGrpLabelOffset:80,termGrpLabelMaxChars:32,duration:0,zoomLevel:1,zoomCenterPct:0,zoomIndex:0,zoomGrpIndex:0,zoomMin:.5,zoomIncrement:.1,zoomStep:1,imgWMax:6e4/window.devicePixelRatio,scrollHeight:12,controlLabels:c,cnvUnit:"log2ratio",ignoreCnvValues:false,barh:32,showHints:[]}}};const f=d.settings;const u=Math.max(f.matrix.rowh+f.matrix.rowspace-3*f.matrix.rowlabelpad,12);f.legend={ontop:false,lineh:25,padx:5,padleft:0,padright:20,padbtm:30,fontsize:u,iconh:u-2,iconw:u-2,hangleft:1,linesep:false};const g=r.vocabApi.termdbConfig.matrix||{};l(d.settings.matrix,g.settings);if(g.legendGrpFilter)d.legendGrpFilter=g.legendGrpFilter;if(g.legendValueFilter)d.legendValueFilter=g.legendValueFilter;if(o.name){const e=await r.vocabApi.getMatrixByName(o.name);if(!e)throw"error from getMatrixByName()";if(e.error)throw e.error;l(d,e)}const h=o?.settings?.matrix;if(h){if((h.sortSamplesBy=="custom"||h.sortSamplesBy=="asListed")&&h.sortOptions?.custom.label=="against alteration type"){h.sortSamplesBy="a"}if(h.sortOptions){delete h.sortOptions.custom;delete h.sortOptions.asListed}}l(d,o);const b=d.settings.matrix;b.sortOptions=n(r.vocabApi.termdbConfig,c,b);b.duration=0;b.colw=0;if(b.sortSamplesBy!="asListed"&&!b.sortOptions?.[b.sortSamplesBy])b.sortSamplesBy="a";else if(["selectedTerms","class","dt","hits"].includes(b.sortSamplesBy))b.sortSamplesBy="a";if(b.samplecount4gene===true||b.samplecount4gene===1)b.samplecount4gene="abs";if(window.location.hostname=="localhost"){if(window.location.hash=="#canvas")b.svgCanvasSwitch=0}const y=[];for(const e of d.termgroups){e.lst=JSON.parse(JSON.stringify(e.lst));for(const t of e.lst){if(!t.term?.type||m(t.term.type)){if(!t.id){if(!t.term.id)throw`missing tw.id and tw.term.id`;t.id=t.term.id}delete t.term}y.push(p(t,r.vocabApi))}}if(d.divideBy)y.push(p(d.divideBy,r.vocabApi));await Promise.all(y);return d}function d(e){const t=e.settings.matrix;const s=[...t.mutationClasses,...t.CNVClasses];t.filterByClass={isAtomic:true};for(const a of e.legendGrpFilter.lst){if(!a.dt)continue;s.filter((e=>a.dt.includes(o[e].dt))).forEach((e=>{t.filterByClass[e]="value"}))}for(const s of e.legendValueFilter.lst){if(!s.legendGrpName||s.tvs?.term?.type!=="geneVariant")continue;if(s.tvs.values?.[0].mclasslst)s.tvs.values[0].mclasslst.forEach((e=>{t.filterByClass[e]=s.legendFilterType?.endsWith("_hard")?"case":"value"}));else if(s.tvs.values)s.tvs.values.forEach((e=>{t.filterByClass[key]="value"}));else throw`unhandled tvs from legendValueFilter`}t.hiddenVariants=Object.keys(t.filterByClass).filter((e=>e!=="isAtomic"));const a=new Set(t.hiddenVariants.filter((e=>o[e]?.dt===r)));t.hiddenCNVs=[...a];t.showMatrixCNV=!a.size?"all":a.size==t.CNVClasses.length?"none":"bySelection";t.allMatrixCNVHidden=a.size==t.CNVClasses.length;const i=new Set(t.hiddenVariants.filter((e=>t.mutationClasses.find((t=>t===e)))));t.hiddenMutations=[...i];const l=new Set(t.proteinChangingMutations);const n=new Set(t.truncatingMutations);t.showMatrixMutation=!i.size?"all":i.size==t.mutationClasses.length?"none":i.size===t.mutationClasses.length-l.size&&[...i].every((e=>!l.has(e)))?"onlyPC":i.size===t.mutationClasses.length-n.size&&[...i].every((e=>!n.has(e)))?"onlyTruncating":"bySelection";t.allMatrixMutationHidden=i.size==t.mutationClasses.length;const m=t.sortOptions.a?.sortPriority.find((e=>e.types.length==1&&e.types[0]=="geneVariant"))?.tiebreakers||[];t.sortByMutation=m.find((e=>e.filter?.values[0]?.dt===1))?.isOrdered?"consequence":"presence";t.sortByCNV=m.find((e=>e.filter?.values[0]?.dt===4))?.disabled!==true}export{c as getPlotConfig,d as setComputedConfig};
@@ -1 +0,0 @@
1
- import{initByInput as t}from"./controls.config-00ce9f0b.js";import{d as e,M as a,U as s,ak as n,B as i,z as o,ap as l,at as r,as as p,L as c}from"./app-3d14cbe4.js";import{getSorterUi as d}from"./matrix.sorterUi-0ad98ef0.js";import{i as m,f as h,T as u,g}from"./termsetting-7467350f.js";import{m as y}from"./radiobutton-09bff425.js";import{m as b}from"./checkbox-96437f4d.js";import{G as f}from"./recover-4888c2a9.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./FilterRxComp-e8de560c.js";import"./table-be2a9975.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-a60aaa77.js";import"./FilterStateless-75514d37.js";import"./app-bd9f016b.js";import"./termInfo-e16f90f2.js";import"./toggleButtons-2144daab.js";import"./genesearch-0587c713.js";import"./rehydrateFilter-12d118cb.js";function x(t){if(!t.holder)throw`zoom requires an opts.holder`;if(typeof t.callback!="function")throw`zoom requires an opts.callback function`;const e={min:1,max:100,value:25,step:10,increment:1,numberInputWidth:"35px",showJumpBtns:false};const a=Object.assign({},e,t.settings||{});t.holder.attr("title",t.title||null).style("vertical-align","top").style("text-align","center").on("mouseenter",(()=>{o.style("display","inline-block").style("overflow","visible")})).on("mouseleave",(()=>{o.style("display","none").style("overflow","hidden")}));const s=t.holder.append("label");s.append("span").text("Zoom");const n=s.append("input").attr("title","Enter a desired zoom level").attr("type","number").attr("min",a.min).attr("max",a.max).attr("step",a.increment).style("min-width",a.numberInputWidth).style("width",t.width||"fit-content").style("margin","3px 5px").property("value",a.value).on("change",(e=>{const a=Number(e.target.value);c.update({value:a});t.callback(a)}));s.append("span").text("unit"in t?t.unit:"%");const i=t.holder.node().getBoundingClientRect();t.holder.style("max-height",i.height+"px").style("max-width",i.width+"px");t.holder.append("br");const o=t.holder.append("div").style("display","none");const l=!t.showJumpBtns?null:t.holder.append("button").attr("title","Zoom in").style("width","25px").html("-").on("click",(()=>{const e=Math.max(a.step*Math.ceil((a.value-a.step)/a.step),a.min);c.update({value:e});t.callback(e)}));const r=o.append("input").attr("title","Slide to desired zoom level").attr("type","range").attr("min",a.min).attr("max",a.max).attr("step",a.increment).style("margin","2px 5px").style("padding",0).style("vertical-align","middle").property("value",a.value).html("-").on("input",(t=>{n.property("value",t.target.value)})).on("change",(e=>{const a=Number(e.target.value);c.update({value:a});t.callback(a)}));const p=!t.showJumpBtns?null:t.holder.append("button").attr("title","Zoom out").style("width","25px").html("+").on("click",(()=>{const e=Math.min(a.step*Math.floor((a.value+a.step)/a.step),a.max);c.update({value:e});t.callback(e)}));o.append("span").style("text-decoration","underline").style("cursor","pointer").style("title","use the default zoom value").text("Reset").on("click",t.reset);const c={update(e={}){const s=t.holder.node().getBoundingClientRect();if(!s.height||!s.width){t.holder.style("max-height","").style("max-width","");const e=t.holder.node().getBoundingClientRect();t.holder.style("max-height",e.height+"px").style("max-width",e.width+"px")}Object.assign(a,e);r.property("value",a.value).attr("min",a.min).attr("max",a.max).attr("step",a.increment);n.property("value",a.value).attr("min",a.min).attr("max",a.max).attr("step",a.increment);l?.property("disabled",a.value<=a.min);p?.property("disabled",a.value>=a.max)}};if(t.debug)c.Inner={settings:a,number:n,slider:r,minusBtn:l,plusBtn:p};return c}function v(t){if(!t.holder)throw`missing svgScroll.opts.holder argument`;const a={height:12,zoomLevel:1,opacity:.3};const s=Object.assign({},a,t);function n(t){g.x=t.clientX;e("body").on("mousemove.sjppSvgScroll",i).on("mouseup.sjppSvgScroll",o)}function i(t){if(!("x"in g))return;const e=t.clientX-g.x;if(g.sliderX+g.sliderWidth+e>s.visibleWidth-1){return}if(g.sliderX+e<0){return}h.attr("x",g.sliderX+e);s.callback(g.dxFactor*e,"move")}function o(t){if(!("x"in g))return;const a=t.clientX-g.x;s.callback(g.dxFactor*Math.min(g.maxDx,Math.max(a,g.minDx)),"up");delete g.x;e("body").on("mousemove.sjppSvgScroll",null).on("mouseup.sjppSvgScroll",null)}function l(t){g.x=t.clientX;const e=t.clientX<u.getBoundingClientRect().x?-1:1;o({clientX:Math.floor(g.x+e*g.arrowDx)})}s.holder.attr("display","none").attr("opacity",s.opacity).on("mouseover",(()=>s.holder.attr("opacity",1))).on("mouseout",(()=>s.holder.attr("opacity",s.opacity)));const r=s.holder.append("rect").style("height",s.height).style("stroke","none").style("fill","#fff").on("click",l);const p=s.holder.append("line").style("stroke","#ccc").style("stroke-width",1).on("click",l);const c=s.holder.append("path").attr("y",-s.height).attr("d",`M0,${s.height/2}L${s.height},0L${s.height},${s.height}Z`).style("stroke","#ccc").style("stroke-width",1).style("fill","#ccc").on("click",(t=>{g.x=t.clientX;o({clientX:Math.round(g.x-g.arrowDx)})}));const d=s.holder.append("path").attr("y",-s.height).style("stroke","#ccc").style("stroke-width",1).style("fill","#ccc").attr("d",`M0,0L${s.height},${s.height/2}L0,${s.height}Z`).on("click",(t=>{g.x=t.clientX;o({clientX:Math.round(g.x+g.arrowDx)})}));const m=s.height-4;const h=s.holder.append("rect").attr("y",2).attr("height",m).attr("stroke","#aaa").attr("stroke-width",1).attr("fill","#ccc").attr("rx",m/2).on("mousedown",n).on("mousemove",i).on("mouseup",o);const u=h.node();const g={};const y={update(t){const e={v:s.visibleWidth,t:s.totalWidth,z:s.zoomCenter};Object.assign(s,t);const a=s.totalWidth;const n=s.visibleWidth;if(a<=n){s.holder.attr("display","none");return}s.holder.attr("transform",`translate(${s.x},${s.y})`).attr("display","");r.attr("width",n);p.attr("x1",0).attr("x2",n).attr("y1",s.height/2).attr("y2",s.height/2);c.attr("transform",`translate(0,0)`);d.attr("transform",`translate(${n-s.height},0)`);if(n!=e.v||a!=e.t){g.sliderWidth=n*n/a;g.dxFactor=(a-n)/(n-g.sliderWidth)}const i=n*(s.zoomCenter/a);g.sliderX=Math.max(0,Math.min(i-g.sliderWidth/2,n-g.sliderWidth-1));h.attr("width",g.sliderWidth).attr("x",g.sliderX);g.maxDx=s.visibleWidth-g.sliderX-g.sliderWidth;g.minDx=-g.sliderX;g.arrowDx=Math.round(.1*s.visibleWidth);delete g.x}};return y}const w=new a({padding:""});class C{constructor(t,e){this.type="matrixControls";this.opts=t;this.parent=t.parent;this.overrides={};this.opts.holder.style("margin","10px 10px 20px 10px").style("white-space","nowrap");const a=this.parent.getState(e);const s=a.config.settings.matrix;if(this.parent.setClusteringBtn)this.parent.setClusteringBtn(this.opts.holder,((t,e)=>this.callback(t,e)));this.setSamplesBtn(s);this.setGenesBtn(s);if(s.addMutationCNVButtons&&this.parent.chartType!=="hierCluster"){this.setMutationBtn();this.setCNVBtn()}this.setVariablesBtn(s);this.setDimensionsBtn(s);this.setLegendBtn(s);this.setDownloadBtn(s);this.setZoomInput();this.setDragToggle({holder:this.opts.holder.append("div").style("display","inline-block"),target:this.parent.dom.seriesesG});this.setSvgScroll(a);this.keyboardNavHandler=async t=>{if(t.target.tagName=="BUTTON")this.keyEventTarget=t.target;if(t.key=="Escape"){this.parent.app.tip.hide()}else if(t.key=="Enter"||t.key=="ArrowDown"){const e=t.target.tagName=="BUTTON"?this.parent.app.tip.d.node().querySelectorAll("input, select"):t.target.querySelectorAll("input, select");for(const t of e){if(t.checkVisibility?.()||!t.checkVisibility&&t.getBoundingClientRect().height){t.focus();return false}}}else if(t.key=="Tab"&&t.shiftKey||t.key=="Backspace"||t.key=="ArrowUp"){this.keyEventTarget.focus();return false}};this.btns=this.opts.holder.selectAll(":scope>button").filter((t=>t&&t.label)).on(`keyup.matrix-${this.parent.id}`,this.keyboardNavHandler)}setSamplesBtn(t){const e=t.controlLabels;const a=this;const s=this.parent;const n=[{label:`Maximum # ${e.Samples}`,title:`Limit the number of displayed ${e.samples}`,type:"number",chartType:"matrix",settingsKey:"maxSample",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:`Sort ${e.Sample} Groups`,title:`Set how to sort ${e.sample} groups`,type:"radio",chartType:"matrix",settingsKey:"sortSampleGrpsBy",options:[{label:"Predefined or Group Name",value:"name",title:`Sort by group name`},{label:`${e.Sample} Count`,value:"sampleCount",title:`Sort by the number of samples in the group`},{label:`Hits`,value:"hits",title:`Sort by the total number of variants for every ${e.sample} in the group`}],getDisplayStyle(t){return t.divideBy&&!t.hierCluster?"table-row":"none"}},{label:`${e.Sample} Group Label Character Limit`,title:`Truncate the ${e.sample} group label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"sampleGrpLabelMaxChars",getDisplayStyle(t){return t.divideBy&&!t.hierCluster?"table-row":"none"}},{label:`${e.Sample} Label Character Limit`,title:`Truncate the ${e.sample} label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"collabelmaxchars"},{label:`Group ${e.Samples} By`,title:`Select a variable with discrete values to group ${e.samples}`,type:"term",chartType:"matrix",configKey:"divideBy",vocabApi:this.opts.app.vocabApi,state:{vocab:this.opts.vocab},processInput:async t=>{if(t?.term&&m(t.term)){t.q={...t.q,mode:"discrete"}}if(t)await h(t,this.opts.app.vocabApi);return t},processConfig:t=>{if(this.parent.chartType=="hierCluster"&&t["divideBy"]){t.settings={hierCluster:{yDendrogramHeight:0,clusterSamples:false}}}if(this.parent.config.divideBy)t.legendValueFilter=this.parent.mayRemoveTvsEntry(this.parent.config.divideBy)},getBodyParams:()=>{const t=this.parent.termOrder.filter((t=>t.tw.term.type==="geneVariant")).map((t=>t.tw.term.chr?`${t.tw.term.chr}:${t.tw.term.start}-${t.tw.term.stop}`:t.tw.term.gene||t.tw.term.name));return{currentGeneNames:t}}}];n.push({label:`Sort ${e.Sample} Priority`,title:`Set how to sort ${e.samples}`,type:"custom",init(t){const e=s.config.settings.matrix;if(!a.activeTab)a.activeTab="basic";t.dom.inputTd.style("padding","5px");const n=t.dom.inputTd.append("div").style("margin-bottom","5px");const i=n.append("div").style("display","inline-block").style("padding-right","5px").style("border-right","2px solid black").style("text-decoration",a.activeTab=="basic"?"underline":"").style("cursor","pointer").html("Basic").on("click",(()=>{a.activeTab="basic";i.style("text-decoration","underline");o.style("text-decoration","");l.style("display","");h.style("display","none")}));const o=n.append("div").style("display","inline-block").style("margin-left","5px").style("text-decoration",a.activeTab=="advanced"?"underline":"").style("cursor","pointer").html("Advanced").on("click",(()=>{a.activeTab="advanced";i.style("text-decoration","");o.style("text-decoration","underline");l.style("display","none");h.style("display","")}));const l=t.dom.inputTd.append("div").style("display",a.activeTab=="basic"?"":"none");const r=l.append("div");r.append("span").html("SSM");const{inputs:p}=y({holder:r.append("span"),options:[{label:"by consequence",value:"consequence",checked:e.sortByMutation==="consequence"},{label:"by presence",value:"presence",checked:e.sortByMutation==="presence"}],styles:{display:"inline-block"},callback:t=>{const e=s.config.settings.matrix.sortOptions;const a=e.a;const n=a.sortPriority[0].tiebreakers[1];n.disabled=!t;n.isOrdered=t==="consequence";s.app.dispatch({type:"plot_edit",id:s.id,config:{settings:{matrix:{sortByMutation:t,sortOptions:e}}}})}});p.style("margin","2px 0 0 2px").style("vertical-align","top");const c=l.append("div").style("display",e.showMatrixCNV!="none"&&!e.allMatrixCNVHidden?"block":"none");c.append("span").html("CNV");const m=b({holder:c.append("span"),divstyle:{display:"inline-block"},checked:e.sortByCNV,labeltext:"sort by CNV",callback:()=>{const t=m.property("checked");const e=s.config.settings.matrix.sortOptions;const a=e.a;const n=a.sortPriority[0].tiebreakers[2];n.disabled=!t;n.isOrdered=t;s.app.dispatch({type:"plot_edit",id:s.id,config:{settings:{matrix:{sortByCNV:t,sortOptions:e}}}})}});const h=t.dom.inputTd.append("div").style("display",a.activeTab=="advanced"?"":"none");t.dom.row.on("mouseover",(function(){this.style.backgroundColor="#fff";this.style.textShadow="none"}));if(!a.sorterUi){a.sorterUi=d({controls:this,holder:h,tip:this.parent.app.tip})}else{a.sorterUi.main(this.parent.config.settings.matrix,{holder:h})}return{main:t=>{const e=t.settings.matrix;p.property("checked",(t=>t.value==e.sortByMutation));m.property("checked",e.sortByCNV);c.style("display",e.showMatrixCNV!="none"&&!e.allMatrixCNVHidden?"block":"none")}}}});this.opts.holder.append("button").datum({label:e.Samples||`Samples`,getCount:()=>"sampleCount"in this.overrides?this.overrides.sampleCount:this.parent.sampleOrder?.length||0,rows:n,customInputs:this.updateSamplesControls}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setGenesBtn(t){const e=t.controlLabels;const a=[{label:`&nbsp;Stacked <span style="font-size:.7em;color:#555;">Show stacked rectangles in the same matrix cell to render variants for the same ${e.sample} and gene</span>`,value:"",title:`Show stacked rectangles in the same matrix cell to render variants for the same ${e.sample} and gene`},{label:`&nbsp;OncoPrint <span style="font-size:.7em;color:#555;">Show overlapping rectangles in the same matrix cell to render variants for the same ${e.sample} and gene</span>`,value:"oncoprint",title:`Show overlapping rectangles in the same matrix cell to render variants for the same ${e.sample} and gene`}];if(t.addMutationCNVButtons&&this.parent.chartType!=="hierCluster")a.unshift({label:`&nbsp;Single <span style="font-size:.7em;color:#555;">Show a single rectangle in a matrix cell to render the most severe variant (truncating > indels > missense > synonymous) for the same ${e.sample} and gene</span>`,value:"single",title:`Show a single rectangle in a matrix cell to render the most severe variant (truncating > indels > missense > synonymous) for the same ${e.sample} and gene`});this.opts.holder.append("button").datum({label:"Genes",getCount:()=>this.parent.termOrder?.filter((t=>t.tw.term.type=="geneVariant"||t.tw.term.type==u.GENE_EXPRESSION)).length||0,customInputs:this.appendGeneInputs,rows:[{label:`Display ${e.Sample} Counts for Gene`,title:`Include the ${e.sample} count in the gene label`,type:"radio",chartType:"matrix",settingsKey:"samplecount4gene",options:[{label:"Absolute",value:"abs"},{label:`Percent`,value:"pct"},{label:`None`,value:""}]},{label:"Genomic Alterations Rendering",title:`Set how to indicate a ${e.sample}'s applicable variant types in the same matrix cell`,type:"radio",chartType:"matrix",settingsKey:"cellEncoding",options:a,styles:{padding:"5px 0px",margin:0},labelDisplay:"block",callback:this.parent.geneStyleControlCallback},{label:"Sort Genes",title:"Set how to order the genes as rows",type:"radio",chartType:"matrix",settingsKey:"sortTermsBy",options:[{label:"By Input Data Order",value:"asListed"},{label:`By ${e.sample} Count`,value:"sampleCount"}],styles:{padding:0,"padding-right":"10px",margin:0}}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setVariablesBtn(t){t.controlLabels;this.opts.holder.append("button").datum({label:t.controlLabels.Terms||`Variables`,rows:[{label:`Row Group Label Max Length`,title:`Truncate the row group label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"termGrpLabelMaxChars"},{label:`Row Label Max Length`,title:`Truncate the row label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"rowlabelmaxchars"}],customInputs:this.appendDictInputs}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setDimensionsBtn(t){const e=t.controlLabels;this.opts.holder.append("button").datum({label:"Cell Layout",tables:[{rows:[{label:"Grid",title:"Show grid lines, which creates borders around each matrix cells. "+" Note that grid lines are hidden when the auto-computed width <= 2, or when either the column and row spacing is set to 0.",type:"checkbox",boxLabel:"show",processInput:t=>t===true?"rect":t==="rect",chartType:"matrix",settingsKey:"showGrid",colspan:2,align:"center"},{label:"Outline Color",title:"Set a border color for the whole matrix",type:"color",chartType:"matrix",settingsKey:"outlineStroke",colspan:2,align:"center"},{label:"Beam Color",title:"Set a color for the beam highlighter",type:"color",chartType:"matrix",settingsKey:"beamStroke",colspan:2,align:"center"},{label:"Grid Line Color",title:"Set the grid color, equivalent to applying the same border color for each matrix cell",type:"color",chartType:"matrix",settingsKey:"gridStroke",colspan:2,align:"center"},{label:"Background Color",title:`Set the background color when there are no alterations or annotation data for a ${e.sample}`,type:"color",chartType:"matrix",settingsKey:"cellbg",colspan:2,align:"center"},{label:`Use Canvas If # ${e.sample} Exceeds`,title:`Switch from SVG to canvas rendering when the number of ${e.samples} exceeds this number`,type:"number",chartType:"matrix",settingsKey:"svgCanvasSwitch",colspan:2,align:"center",width:60,min:0,max:1e4,step:1},{label:"Canvas Min. Pixel Width",title:"Set a minimum pixel width for a matrix cell when using canvas, may affect the perceived sharpness of the canvas image",type:"checkbox",boxLabel:"apply",chartType:"matrix",settingsKey:"useMinPixelWidth",colspan:2,align:"center",getDisplayStyle:()=>this.parent.settings.matrix.useCanvas?"":"none"}]},{header:["Cells","Columns","Rows"],rows:[{label:"Row Height",title:"Set the height of a matrix row",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{label:"N/A"},{settingsKey:"rowh",min:8,max:30,step:1}],getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:"Min Col. Width",title:"Set the minimum width of the auto-computed matrix column width",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colwMin",min:.1,max:16,step:.2},{label:"N/A"}]},{label:"Max Col. Width",title:"Set the maximum width of the auto-computed matrix column width",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colwMax",min:1,max:24,step:.2},{label:"N/A"}]},{label:"Spacing",title:"Set the column spacing. Note that this will be set to 0 when the auto-computed width < 2.",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colspace",min:0,max:20,step:1},{settingsKey:"rowspace",min:0,max:20,step:1}],getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:"Group spacing",title:"Set the spacing between column and row groups.",type:"number",width:50,align:"center",chartType:"matrix",inputs:[this.parent.chartType=="hierCluster"?{label:"N/A"}:{settingsKey:"colgspace",min:0,max:20,step:1},{settingsKey:"rowgspace",min:0,max:20,step:1}]}]},{header:["Labels","Columns","Rows"],rows:[{label:"Offset",title:"Set the gap between the label text and matrix edge",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"collabelgap",min:0,max:20,step:1},{settingsKey:"rowlabelgap",min:0,max:20,step:1}]},{label:"Spacing",title:"Set the gap between labels",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"collabelpad",min:0,max:20,step:1},{settingsKey:"rowlabelpad",min:0,max:20,step:1}]},{label:"Min font size",title:"Set the minimum auto-computed font size for labels. Note that labels will be hidden if the auto-computed values falls below this minimum.",type:"number",width:50,align:"center",colspan:2,chartType:"matrix",settingsKey:"minLabelFontSize",min:0,max:24,step:.1},{label:"Max font size",title:"Set the maximum auto-computed font size for labels",type:"number",width:50,align:"center",colspan:2,chartType:"matrix",settingsKey:"maxLabelFontSize",min:0,max:24,step:.1},{label:"Group label<br/>position",title:"Set which side of the matrix to display group labels",type:"radio",width:50,chartType:"matrix",labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},inputs:[{settingsKey:"collabelpos",options:[{label:"Top",value:"bottom",title:`Display ${e.sample} group labels at the bottom`},{label:"Bottom",value:"top",title:`Display ${e.sample} group labels on top`}]},{settingsKey:"rowlabelpos",options:[{label:"Left",value:"right",title:`Display gene or variable group labels on the left side`},{label:"Right",value:"left",title:`Display gene or variable group labels on the right side`}]}]}]}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setLegendBtn(t){this.opts.holder.append("button").style("margin","2px 0").datum({label:"Legend Layout",rows:[{label:"Font Size",title:"Set the font size for the legend text",type:"number",chartType:"legend",settingsKey:"fontsize"},{label:"Line Height",title:"Set the line height for a legend group",type:"number",chartType:"legend",settingsKey:"lineh"},{label:"Icon Height",title:"Set the icon height for a legend item",type:"number",chartType:"legend",settingsKey:"iconh"},{label:"Icon Width",title:"Set the icon width for a legend item",type:"number",chartType:"legend",settingsKey:"iconw"},{label:"Item Left Pad",title:"Set a left margin for each legend item",type:"number",chartType:"legend",settingsKey:"padx"},{label:"Left Margin",title:"Set a left margin for the whole legend",type:"number",chartType:"legend",settingsKey:"padleft"},{label:"Left Indent",title:`Set a left margin for the first legend item in each group, and should be set to the length of the longest group label.`+` The left indent will align the legend group label text to the right.`,type:"number",chartType:"legend",settingsKey:"hangleft"},{label:"Item Layout",title:"Option to separate each legend item into a new line, instead of a horizontal layout in the same line.",type:"checkbox",chartType:"legend",settingsKey:"linesep",boxLabel:"Line separated"}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setMutationBtn(){this.opts.holder.append("button").style("margin","2px 0").datum({label:"Mutation",updateBtn:t=>{const e=this.parent.config.settings.matrix;t.style("text-decoration",e.allMatrixMutationHidden?"line-through":"").style("text-decoration-thickness",e.allMatrixMutationHidden?"2px":"")},rows:[{title:`Show mutation options`,type:"radio",chartType:"matrix",settingsKey:"showMatrixMutation",options:[{label:"Show all mutations",value:"all"},{label:`Show only truncating mutations`,value:"onlyTruncating"},{label:`Show only protein-changing mutations`,value:"onlyPC"},{label:`Do not show mutations`,value:"none"},{label:`Show selected mutation`,value:"bySelection"}],labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},callback:this.parent.mutationControlCallback}],customInputs:this.generateMutationItems}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setCNVBtn(){this.opts.holder.append("button").style("margin","2px 0").datum({label:"CNV",updateBtn:t=>{const e=this.parent.config.settings.matrix;const a=e.allMatrixCNVHidden;t.style("text-decoration",a?"line-through":"").style("text-decoration-thickness",a?"2px":"")},rows:[{title:`Show CNV options`,type:"radio",chartType:"matrix",settingsKey:"showMatrixCNV",options:[{label:"Show all CNV",value:"all"},{label:`Do not show CNV`,value:"none"},{label:`Show selected CNV`,value:"bySelection"}],labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},callback:this.parent.CNVControlCallback}],customInputs:this.generateCNVItems}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setDownloadBtn(t){this.opts.holder.append("button").style("margin","2px 0").text("Download").on("focus",(()=>this.parent.app.tip.hide())).on("click.sjpp-matrix-download",(t=>{const e=this.parent;if(!e.dom.downloadMenu)e.dom.downloadMenu=new a({padding:""});const c=e.dom.downloadMenu.clear();const d=c.d.append("div");d.append("div").attr("class","sja_menuoption sja_sharp_border").text(`SVG image`).on("click.sjpp-matrix-download",(()=>{s(this.opts.getSvg(),"matrix",{apply_dom_styles:true});e.dom.downloadMenu.destroy()}));d.append("div").attr("class","sja_menuoption sja_sharp_border").text(`TSV data`).on("click.sjpp-matrix-download",(()=>{const t=e.data.lst;const a=e.termOrder.map((t=>t.tw));const s=e.state.termdbConfig.assayAvailability;const c=e.settings.matrix.controlLabels;if(e.config.divideBy?.id&&!a.find((t=>t.id==e.config.divideBy.id))){a.push(e.config.divideBy)}const d=[];for(const e of t){for(const t of a){if(t.$id in e){d.push(e);break}}}const m=[c.Sample];for(const t of a)m.push(t.term.name);const h=[m];for(const t of d){const e=[t._ref_.label];for(const c of a){if(!t[c.$id]){e.push("")}else{if(c.term.type=="geneVariant"){const a=[];for(const e of t[c.$id].renderedValues){const t=s?.byDt?.[parseInt(e.dt)];if(e.dt==n){a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+`${o[e.class]?.label}`+(e.mname?`,${e.mname}`:""))}else if(e.dt==l){const s=e.value?`${t?"":"CNV:"}${e.value}`:e.class=="CNV_amp"?"CNV gain":e.class=="CNV_loss"?"CNV loss":o[e.class]?.label;a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+s)}else if(e.dt==r||e.dt==p){a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+`${o[e.class]?.label}`+(e.gene&&e.mname?`(${e.gene}::${e.mname})`:""))}else{a.push(`DO NOT SUPPORT dt='${e.dt}'`)}}e.push(a.join("|"))}else if(c.term.type==u.GENE_EXPRESSION||c.term.type==u.METABOLITE_INTENSITY){e.push(t[c.$id]?.renderedValues?.[0]?.value||"")}else{e.push(t[c.$id]?.renderedValues?.[0]||t[c.$id]?.value||"")}}}h.push(e)}const g=h.map((t=>t.join("\t"))).join("\n");const y=document.createElement("a");document.body.appendChild(y);y.addEventListener("click",(function(){const t=(new Date).toISOString().split("T")[0];y.download=e.config.settings?.hierCluster?.termGroupName?.startsWith("Gene Expression")?`GeneExpression.${t}.tsv`:e.chartType=="hierCluster"?`HierCluster.${t}.tsv`:`${e.app.vocabApi.termdbConfig.matrix?.appName||"Matrix"}.${t}.tsv`;y.href=URL.createObjectURL(new Blob([g],{type:"text/tab-separated-values"}));document.body.removeChild(y)}),false);y.click();e.dom.downloadMenu.destroy()}));c.showunder(t.target)}))}main(t={}){this.overrides=t;this.parent.app.tip.hide();this.btns.text((t=>(t.getCount?`${t.getCount()} `:"")+t.label)).each((function(t){if(t.updateBtn)t.updateBtn(e(this))}));const a=this.parent.config.settings.matrix;const s=this.parent.dimensions;if(this.zoomApi)this.zoomApi.update({value:a.zoomLevel.toFixed(1),min:a.colwMin/a.colw,max:a.colwMax/a.colw,increment:a.zoomIncrement,step:a.zoomStep||1});if(this.svgScrollApi&&s){this.svgScrollApi.update({x:s.xOffset,y:s.yOffset-a.scrollHeight,totalWidth:s.zoomedMainW,visibleWidth:s.mainw,zoomCenter:a.zoomCenterPct*s.mainw-s.seriesXoffset})}if(this.dragToggleApi){this.dragToggleApi.update(a.mouseMode?{mouseMode:a.mouseMode}:{})}}getSettings(){return{mouseMode:this.dragToggleApi.getSettings().mouseMode}}async callback(e,a){const s=this.opts.app;const n=this.opts.parent;const i=a.tables||[a];e.target.focus();s.tip.clear();const o=s.tip.d.append("table").attr("class","sjpp-controls-table");for(const e of i){if(e.header){o.append("tr").selectAll("th").data(e.header).enter().append("th").html((t=>t))}for(const a of e.rows){const e=o.append("tr");const i=await t[a.type](Object.assign({},{holder:e,dispatch:s.dispatch,id:n.id,debug:this.opts.debug,parent:n},a));i.main(n.config)}if(e.customInputs)e.customInputs(this,s,n,o);o.selectAll("select, input, button").attr("tabindex",0).on("keydown",self.keyboardNavHandler)}s.tip.showunder(e.target)}prependInfo(t,e,a){const s=t.append("tr");s.append("td").text(e).attr("class","sja-termdb-config-row-label");s.append("td").text(a)}async appendGeneInputs(e,a,s,n){w.clear();if(!s.selectedGroup)s.selectedGroup=0;if(s.opts.customInputs?.genes){for(const a of s.opts.customInputs.genes){a.chartType="matrix";const i=n.append("tr");if(a.title)i.attr("aria-label",a.title);const o=await t[a.type](Object.assign({},{holder:i,id:s.id,debug:e.opts.debug,parent:s},a));o.main(s.config)}}e.addGenesetInput(event,a,s,n.append("tr"))}addGenesetInput(t,e,a,s){const n=this.btns.filter((t=>t.label=="Genes"))?.node();const i=e.tip;const o=a.config.termgroups;let l;const r=t=>{t.selectAll("*").remove();const a=l.lst.map((t=>({gene:t.name})));new f({holder:t,genome:e.opts.genome,geneList:a,customInputs:this.parent.opts.customInputs?.geneset,mode:l.mode,minNumGenes:l.mode=="geneExpression"?3:1,vocabApi:this.opts.app.vocabApi,callback:async({geneList:t,groupName:a})=>{if(!l)throw`missing selectedGroup`;i.hide();const s=l.status=="new"?{name:a,lst:[]}:o[l.index];if(l.status=="new")o.push(s);const n=l.mode=="geneExpression"?"geneExpression":"geneVariant";const r=s.lst.filter((t=>t.term.type!=n));const p=await Promise.all(t.map((async t=>{const e={gene:t.symbol||t.gene,name:t.symbol||t.gene,type:n};let a=s.lst.find((e=>e.term.name==t.symbol||e.term.name==t.gene));if(!a){a={term:e,q:{}};a.$id=await g(this.opts.app.vocabApi.getTwMinCopy(a))}else if(!a.$id){a.$id=await g(this.opts.app.vocabApi.getTwMinCopy({term:e}))}return a})));s.lst=[...r,...p];if(!s.lst.length)o.splice(l.index,1);e.dispatch({type:"plot_edit",id:this.parent.id,config:{termgroups:o}})},backBtn:{target:"Genes Menu",callback:()=>{n.click()}}})};const p=o.filter((t=>t.type!="hierCluster"||t.lst.find((t=>t.term.type=="geneExpression")))).length;s.append("td").attr("class","sja-termdb-config-row-label").html("Gene Set");if(p>0){const t=s.append("td").style("display","block").style("padding","5px 0px");const e=t.append("div").append("label");e.append("button").html(p>1?"Edit Selected Group":"Edit Current Group").on("click",(()=>{i.clear();this.setMenuBackBtn(i.d.append("div").style("padding","5px"),(()=>n.click()));const t=i.d.append("div");r(t)}));if(p>1){const{groups:t,groupSelect:a}=this.setTermGroupSelector(e,o);l=t.find((t=>t.selected));a.on("change",(()=>{l=t[a.property("value")]}))}else{const t=a.config.settings.hierCluster;const e=o.find((t=>t.type!="hierCluster"||t.lst.find((t=>t.term.type=="geneExpression"))));l={index:0,name:e.name,type:e.type,lst:e.lst.filter((t=>t.term.type.startsWith("gene"))).map((t=>({name:t.term.name}))),mode:this.parent.chartType=="hierCluster"&&(e.type=="hierCluster"||e.name==t?.termGroupName)?t.dataType:this.parent.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:"",selected:true}}}const c=s.append("td").style("display","block").style("padding","5px 0px");const d=c.append("div").append("label");const m=d.append("button").html("Create New Group").property("disabled",true).on("click",(()=>{i.clear();this.setMenuBackBtn(i.d.append("div"),(()=>n.click()));const t=h.property("value");a.config.settings.hierCluster;l={index:o.length,name:t,label:t,lst:[],status:"new",mode:a.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:""};r(i.d.append("div"))}));const h=d.append("input").style("margin","2px 5px").style("width","210px").attr("placeholder","Group Name").on("input",(()=>{m.property("disabled",!h.property("value"))})).on("keyup",(t=>{if(t.key=="Enter"&&!m.property("disabled")){m.node().click()}}))}setMenuBackBtn(t,e){t.attr("tabindex",0).style("padding","5px").style("text-decoration","underline").style("cursor","pointer").style("margin-bottom","12px").html(`&#171; Back to Genes`).on("click",e).on("keyup",(t=>{if(t.key=="Enter")t.target.click()}))}setTermGroupSelector(t,e){const a=e.find((t=>t.lst.find((t=>t.term.type.startsWith("gene")))));const s=this.parent.config.settings.hierCluster;const n=e.map(((t,e)=>({index:e,name:t.name,type:t.type,lst:t.lst.filter((t=>t.term.type.startsWith("gene"))).map((t=>({name:t.term.name}))),mode:this.parent.chartType=="hierCluster"&&(t.type=="hierCluster"||t.name==s?.termGroupName)?s.dataType:this.parent.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:"",selected:this.parent.chartType=="hierCluster"&&(t.type=="hierCluster"||t.name&&t.name==s?.termGroupName)||t===a})));const i=t.append("select").style("width","218px").style("margin","2px 5px");for(const[t,e]of n.entries()){if(e.label)continue;if(e.name)e.label=e.name;else e.label=`Unlabeled group #${t+1}`}i.selectAll("option").data(n).enter().append("option").property("selected",(t=>t.selected)).attr("value",((t,e)=>e)).html((t=>t.label));return{groups:n,groupSelect:i}}appendDictInputs(t,e,a,s){w.clear();if(!a.selectedGroup)a.selectedGroup=t.chartType=="hierCluster"?1:0;e.tip.d.append("hr");t.addDictMenu(e,a,e.tip.d.append("div"))}generateCNVItems(t,e,a,s){s.attr("class",null);const i=a.config.settings.matrix;const o=a.legendData.find((t=>t.dt?.includes(n)));if(i.showMatrixCNV!=="none"&&(i.allMatrixMutationHidden||!o||o.crossedOut||!o.items.find((t=>!t.greyedOut&&!t.crossedOut)))){s.select("input[type='radio'][value='none']").property("disabled",true);s.select("input[type='radio'][value='none'] + span").style("opacity","0.5").on("mouseup",null)}if(i.addMutationCNVButtons&&a.chartType!=="hierCluster"&&i.showMatrixCNV=="bySelection")a.CNVControlCallback("bySelection")}generateMutationItems(t,e,a,s){s.attr("class",null);const n=a.config.settings.matrix;const i=a.legendData.find((t=>t.dt?.includes(l)));if(n.showMatrixMutation!=="none"&&(n.allMatrixCNVHidden||!i||i.crossedOut||!i.items.find((t=>!t.greyedOut&&!t.crossedOut)))){s.select("input[type='radio'][value='none']").property("disabled",true);s.select("input[type='radio'][value='none'] + span").style("opacity","0.5").on("mouseup",null)}if(n.addMutationCNVButtons&&a.chartType!=="hierCluster"&&n.showMatrixMutation=="bySelection")a.mutationControlCallback("bySelection")}updateSamplesControls(t,e,a,s){if(a.chartType=="hierCluster"&&a.config.settings.hierCluster.clusterSamples){const t=a.config.settings.matrix.controlLabels;const e=s.select(`tr[title='Set how to sort ${t.samples}']`);e.style("display","none")}}async addDictMenu(t,e,a,s=undefined){const n=await import("./app-bd9f016b.js");n.appInit({holder:s||t.tip.d,vocabApi:this.parent.app.vocabApi,focus:"off",state:{vocab:this.parent.state.vocab,activeCohort:this.parent.activeCohort,nav:{header_mode:"search_only"},tree:{usecase:{target:"matrix",detail:"termgroups"}}},tree:{submit_lst:e=>{this.submit_lst(e);t.tip.hide()}},search:{focus:"off"}})}async submit_lst(t){const e=await Promise.all(t.map((async t=>{const e=structuredClone(t);const a="id"in e?{id:e.id,term:e}:{term:e};await h(a,this.opts.app.vocabApi);return a})));this.parent.settings.matrix;const a=structuredClone(this.parent.config.termgroups);const s=a.findIndex((t=>t.name=="Variables"));if(s!==-1){const t=a[s];t.lst.push(...e);this.parent.app.dispatch({type:"plot_nestedEdits",id:this.parent.id,edits:[{nestedKeys:["termgroups",s,"lst"],value:t.lst}]})}else{const t={name:"Variables",lst:e};a.push(t);this.parent.app.dispatch({type:"plot_edit",id:this.parent.id,config:{termgroups:a}})}}setZoomInput(){const t=this.opts.holder.append("div").style("display","inline-block").style("margin-left","50px");const e=this.parent.config.settings.matrix;this.zoomApi=x({holder:t,title:"Zoom factor relative to the ideal column width, as computed for the number of columns versus available screen width",unit:"",width:"80px",settings:{value:1,min:.1,max:10,increment:e.zoomIncrement,step:e.zoomStep||5},callback:t=>{const e=this.parent;e.dimensions;e.settings.matrix;const a=e.getVisibleCenterCell(0);e.app.dispatch({type:"plot_edit",id:e.id,config:{settings:{matrix:{zoomLevel:t,zoomCenterPct:.5,zoomIndex:a.totalIndex,zoomGrpIndex:a.grpIndex}}}})},reset:()=>{this.parent.settings.matrix;this.parent.dimensions;this.parent.app.dispatch({type:"plot_edit",id:this.parent.id,config:{settings:{matrix:{zoomLevel:1,zoomCenterPct:0}}}})}})}setDragToggle(t={}){const e={mouseMode:"select",activeBgColor:"rgb(255, 255, 255)"};t.target.style("cursor","default");const a={opts:Object.assign({},e,t),dom:{selectBtn:t.holder.append("button").attr("aria-label","Click the matrix to select data").style("display","inline-block").style("width","25px").style("height","24.5px").style("background-color",e.activeBgColor).on("click",(()=>n("select"))),grabBtn:t.holder.append("button").attr("aria-label","Click the matrix to drag and move").style("display","inline-block").style("width","25px").style("height","24.5px").on("click",(()=>n("pan")))}};c.arrowPointer(a.dom.selectBtn,{width:14,height:14,transform:"translate(50,50)"});c.grab(a.dom.grabBtn,{width:14,height:14,transform:"translate(30,50)"});const s=this;function n(e){a.opts.mouseMode=e;s.parent.settings.matrix.mouseMode=e;t.target.style("cursor",e=="select"?"default":"grab");a.dom.selectBtn.style("background-color",e=="select"?a.opts.activeBgColor:"");a.dom.grabBtn.style("background-color",e=="pan"?a.opts.activeBgColor:"")}this.dragToggleApi={update(t={}){Object.assign(a.opts,t);n(a.opts.mouseMode)},getSettings(){return{mouseMode:a.opts.mouseMode}}}}setSvgScroll(t){this.svgScrollApi=v({holder:this.parent.dom.scroll,height:t.config.settings.matrix.scrollHeight,callback:(t,e)=>{const a=this.parent;const s=a.settings.matrix;const n=a.dimensions;if(e=="move"){a.dom.seriesesG.attr("transform",`translate(${n.xOffset+n.seriesXoffset-t},${n.yOffset})`);a.clusterRenderer.translateElems(-t,s,n);a.layout.top.attr.adjustBoxTransform(-t);a.layout.btm.attr.adjustBoxTransform(-t);if(a.dom.topDendrogram){a.dom.topDendrogram.attr("transform",`translate(${a.topDendroX-t},0)`)}}else if(e=="up"){const e=a.getVisibleCenterCell(-t);a.app.dispatch({type:"plot_edit",id:a.id,config:{settings:{matrix:{zoomCenterPct:.5,zoomIndex:e.totalIndex,zoomGrpIndex:e.grpIndex}}}})}}})}}export{C as MatrixControls};
@@ -1 +0,0 @@
1
- import{h as t}from"./FilterRxComp-e8de560c.js";function e(t=""){const e=t||this.state.tokenVerificationMessage;if(!e&&this.state.hasVerifiedToken){this.dom.errdiv.style("display","none").html();this.dom.controls.style("display",this.opts.controls?"inline-block":"");this.dom.svg.style("display","");return false}else{this.dom.errdiv.style("display","").html(e||"Requires login");this.dom.controls.style("display","none");this.dom.svg.style("display","none");return true}}function s(t){const e=[];const s=this.chartType=="hierCluster"?t.config.termgroups.filter((t=>t.type!="hierCluster")):t.config.termgroups;for(const t of s){e.push(...i(t.lst))}if(t.config.divideBy)e.push(r(structuredClone(t.config.divideBy)));const o={terms:e,filter:t.filter,filter0:t.filter0,maxGenes:t.config.settings.matrix.maxGenes};if(this.chartType=="hierCluster"){o.isHierCluster=1}return o}function i(t){const e=structuredClone(t);e.forEach(r);e.sort(o);return e}function r(t){if(!t?.term)return;delete t.term.category2samplecount;delete t.term.values;return t}function o(t,e){const s=t?.$id||t.term?.id||t?.term?.name;const i=e?.$id||e.term?.id||e?.term?.name;return s<i?-1:1}async function l(t){const e=this.currRequestOpts?.matrix||this.getMatrixRequestOpts(this.state);this.numTerms=e.terms.length;const s=new AbortController;e.signal=s.signal;e.loadingDiv=this.chartType!="hierCluster"&&this.dom.loadingDiv;const[i,r]=await this.api.detectStale((()=>this.app.vocabApi.getAnnotatedSampleData(e,t)),{abortCtrl:s});if(r)throw`stale sequenceId`;this.data=i;this.origData=structuredClone(this.data);this.sampleIdMap={};for(const t of this.data.lst){this.sampleIdMap[t.sample]=t._ref_.label}}function n(){const e=this;if(!e.config.legendValueFilter.lst.length&&!e.config.legendGrpFilter.lst.length)return;for(const t of e.config.legendGrpFilter.lst){if(t.dt){const s=new Set;for(const i of e.origData.lst){for(const e of Object.values(i)){if(e.values){const i=[];for(const r of e.values){if(!(t.dt.includes(r.dt)&&(!t.origin||r.origin==t.origin))){i.push(r)}else{s.add(r.class)}}e.values=i}}}t.filteredOutCats=[...s];for(const s of Object.values(e.origData.samples)){for(const e of Object.values(s)){if(e.values)e.values=e.values.filter((e=>!(t.dt.includes(e.dt)&&(!t.origin||e.origin==t.origin))))}}}}const s=Object.values(e.data.refs.byTermId).filter((t=>t.term?.type=="geneVariant")).map((t=>t.$id));const i={samples:{},lst:[],refs:e.data.refs};const r=structuredClone(e.config.legendValueFilter);r.lst=r.lst.filter((t=>!t.tvs.legendFilterType||t.tvs.legendFilterType!=="geneVariant_soft"));for(const o of e.origData.lst){const l=t(o,r,s);if(l||e.chartType=="hierCluster"){i.samples[o.sample]=o;i.lst.push(o)}}for(const t of e.config.legendValueFilter.lst){if(t.tvs.legendFilterType!=="geneVariant_soft")continue;const e=t.tvs.values[0];const s=new Set;for(const t of i.lst){for(const i of Object.values(t)){if(i.values){const t=[];for(const r of i.values){if(!(r.dt==e.dt&&(!e.origin||r.origin==e.origin)&&e.mclasslst.includes(r.class))){t.push(r)}else{s.add(r.class)}}i.values=t}}}t.filteredOutCats=[...s];for(const t of Object.values(i.samples)){for(const s of Object.values(t)){if(s.values)s.values=s.values.filter((t=>!(t.dt==e.dt&&(!e.origin||t.origin==e.origin)&&e.mclasslst.includes(t.class))))}}}if(e.chartType!=="hierCluster"&&s.length&&e.app.vocabApi.vocab?.dslabel=="GDC")a(i);e.data=i}function a(t){for(const e of t.lst){let s=true;for(const[i,r]of Object.entries(e)){if(!r.values)continue;const e=t.refs.byTermId[i].term.type;if(e!="geneVariant")continue;if(r.values.length)s=false}if(s){t.lst=t.lst.filter((t=>t.sample!==e.sample));delete t.samples[parseInt(e.sample)]}}return t}var c=Object.freeze({__proto__:null,mayRequireToken:e,getMatrixRequestOpts:s,setData:l,applyLegendValueFilter:n});export{c as m};
@@ -1 +0,0 @@
1
- import{M as e,d as s}from"./app-3d14cbe4.js";function t(t){const o=t.controls?t.holder:t.holder.append("div");o.style("position","relative");const i=this.opts.controls||o.append("div");const p=o.append("div").style("position","relative").style("top",this.opts.controls?0:"50px").style("left","50px");const a=o.append("div").attr("class","sja_errorbar").style("display","none");const n=o.append("svg").style("margin","20px 10px").style("overflow","visible").on("mousemove.label",this.svgMousemove).on("mouseup.label",this.svgMouseup);this.seriesClipId=`sjpp_clip_${this.id}`;const l=n.append("g").attr("class","sjpp-matrix-maing").on("mouseover",this.showCellInfo).on("mousemove",this.showCellInfo).on("mouseout",this.mouseout);const r=l.append("g").attr("clip-path",`url(#${this.seriesClipId})`);const d=l.append("g");const m=l.append("g");const u=new e({padding:"5px"});this.dom={header:t.header,holder:o,contentNode:t.holder.node().closest(".sjpp-output-sandbox-content")||t.holder.node().parentNode,errdiv:a,controls:i,loadingDiv:p,svg:n,clipRect:n.append("defs").append("clipPath").attr("id",this.seriesClipId).attr("clipPathUnits","userSpaceOnUse").append("rect").attr("display","block"),mainG:l,cluster:r.append("g").attr("class","sjpp-matrix-cluster-g").on("mousedown",this.seriesesGMousedown).on("mousemove",this.seriesesGMousemove),seriesesG:r.append("g").attr("class","sjpp-matrix-serieses-g").attr("data-testid","sjpp_matrix_mainG_serieses").on("mousedown",this.seriesesGMousedown),highlightBeamG:r.append("g").attr("class","sjpp-matrix-highlight-beam"),sampleLabelsPG:d,sampleGrpLabelG:d.append("g").attr("class","sjpp-matrix-series-group-label-g").on("click",this.showSampleGroupMenu).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),sampleLabelG:d.append("g").attr("class","sjpp-matrix-series-label-g").on("click",(e=>this.mouseclick(e))),termLabelsPG:m,termGrpLabelG:m.append("g").attr("class","sjpp-matrix-term-group-label-g").on("mouseover",this.termGrpLabelMouseover).on("mouseout",this.termGrpLabelMouseout).on("mousedown",this.termGrpLabelMousedown).on("mousemove",this.termGrpLabelMousemove).on("mouseup",this.termGrpLabelMouseup).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),termLabelG:m.append("g").attr("class","sjpp-matrix-term-label-g").on("mouseover",this.termLabelMouseover).on("mouseout",this.termLabelMouseout).on("mousedown",this.termLabelMousedown).on("mousemove",this.termLabelMousemove).on("mouseup",this.termLabelMouseup).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),scroll:l.append("g"),legendG:l.append("g").attr("class","sjpp-matrix-legend-g").on("mouseover",this.legendLabelMouseover).on("mouseout",this.legendLabelMouseout).on("mouseup",this.legendLabelMouseup),tip:u,menutop:u.d.append("div"),menubody:u.d.append("div"),clickMenu:new e({padding:"0px"}),brushMenu:new e({padding:"0px"}),dendroClickMenu:new e({padding:"0px"}),legendMenu:new e({padding:"0px"}),matrixCellHoverOver:new e({padding:"0px"})};this.dom.colBeam=this.dom.highlightBeamG.append("rect").style("display","none").style("stroke-width","0.5px").style("fill","transparent").style("pointer-events","none");this.dom.rowBeam=this.dom.highlightBeamG.append("rect").style("display","none").style("stroke-width","0.5px").style("fill","transparent").style("pointer-events","none");this.dom.tip.onHide=()=>{this.lastActiveLabel=this.activeLabel;delete this.activeLabel};s("body").on(`mousedown.matrixZoom-${this.id}`,this.resetInteractions);window.onscroll=this.delayedMouseoutHandler;const h=this.dom.holder.node().closest(".sjpp-output-sandbox-content");if(h)h.onscroll=this.delayedMouseoutHandler}export{t as setMatrixDom};
@@ -1 +0,0 @@
1
- import{s as e}from"./filter-b3d3964e.js";import{getTermSorter as t,getMclassSorter as s,getSampleSorter as n,getSampleGroupSorter as i}from"./matrix.sort-89b98e83.js";import{ap as l,ak as r,at as o,R as a}from"./app-3d14cbe4.js";function u(e){const n=this.settings.matrix;this.termSorter=t(this,n);const i=[];let l=0,r=0,o=0;this.mclassSorter=s(this);for(const[s,a]of this.termGroups.entries()){const u=[];for(const[t,s]of a.lst.entries()){const i={samples:0,hits:0};const l=new Set;for(const t of e.lst){if(l.has(t.sample))continue;l.add(t.sample);const e=t[s.$id];if(e){const{filteredValues:l,countedValues:r,renderedValues:o}=this.classifyValues(e,s,a,n,t);e.filteredValues=l;e.countedValues=r;e.renderedValues=o;if(e.countedValues?.length){const t=s.term.values?.[e.value];if(t?.uncountable)continue;i.samples+=1;i.hits+=e.countedValues.length;if(s.q?.mode=="continuous"){const t=e.value;if(!("minval"in i)||i.minval>t)i.minval=t;if(!("maxval"in i)||i.maxval<t)i.maxval=t}}}}if(a.type!="hierCluster"||i.samples)u.push({tw:s,counts:i,index:t});if(a.type=="hierCluster")o++}const c=a.sortTermsBy||a.type=="hierCluster"?t(this,n,a):this.termSorter;const d=u.filter((e=>{if("minNumSamples"in e.tw)return e.tw.minNumSamples<=e.counts.samples;if(!a.settings)return true;return!("minNumSamples"in a.settings)||e.counts.samples>=a.settings.minNumSamples})).sort(c);if(!d.length)continue;for(const[t,n]of d.entries()){const{tw:o,counts:u}=n;const c=e.refs.byTermId[n.tw.$id]||{};i.push({grp:a,grpIndex:s,visibleGrpIndex:r,tw:o,index:t,lstIndex:n.index,processedLst:d,prevGrpTotalIndex:l,totalIndex:l+t,ref:c,allCounts:u})}l+=d.length;r+=1}this.numTerms=i.length;this.numClusterTerms=o;return i}function c(e){const t=this.settings.matrix;const s={id:this.config.divideBy?.$id,name:this.config.divideBy?"Not annotated":"",lst:[]};const l=new Map;const r=this.config.divideBy?.term||{};const o=this.config.divideBy?.$id||"-";const a=this.config.divideBy?.exclude||[];const u=r.values||{};const c=e.refs.byTermId[o]||{};for(const n of e.lst){if(o in n){const e=n[o].key;const s=e in u&&u[e].label?u[e].label:e;if(!l.has(e)){const n={name:`${s}`,id:e,lst:[],tw:this.config.divideBy,legendGroups:{},isExcluded:a.includes(e)};if(c.bins&&t.sortSampleGrpsBy=="name")n.order=c.bins.findIndex((t=>t.name==e));else delete n.order;l.set(e,n)}l.get(e).lst.push(n)}else{s.lst.push(n)}}const d=[...l.values()];const p=l.size;if(p>100&&d.filter((e=>e.lst.length<3)).length>.8*p){const e=t.controlLabels;throw`Did not group ${e.samples} by "${r.name}": too many ${e.sample} groups (${p}), with the majority of groups having <= 2 ${e.samples} per group.`}if(s.lst.length&&!l.size){l.set(undefined,s);d.push(...l.values())}this.asListedSampleOrder=[];for(const e of d){this.asListedSampleOrder.push(...e.lst.map((e=>e.sample)))}const f=this.termOrder.filter((e=>e.tw.sortSamples&&e.tw.term.type!="geneVariant"));const m=n(this,t,e.lst,{skipSorter:(e,t)=>!e.types?.includes("geneVariant")&&f.find((e=>e.tw.$id===t.$id))});const h=e.lst.sort(m);const g=h.slice(0,t.maxSample);const v=e=>g.includes(e);const y=(e,t)=>e+(typeof t=="object"&&t.countedValues?.length?1:0);const x=(e,t)=>e+(Object.values(t).reduce(y,0)?1:0);const S=n(this,t,e.lst);for(const e of d){e.lst=e.lst.filter(v);e.totalCountedValues=e.lst.reduce(x,0);e.lst.sort(S)}const V=i(this);return d.sort(V)}function d(e){this.settings.matrix;this.visibleSampleGrps=new Set;const t=[];let s=0,n=0;for(const[e,i]of this.sampleGroups.entries()){if(!i.lst.length)continue;if(i.isExcluded)n++;let l=i.lst;for(const[r,o]of l.entries()){t.push({grp:i,grpIndex:e-n,row:o,index:r,prevGrpTotalIndex:s,totalIndex:s+r,totalHtAdjustments:0,grpTotals:{htAdjustment:0},processedLst:l})}if(!i.isExcluded)s+=l.length;this.visibleSampleGrps.add(i)}this.unfilteredSampleOrder=t;return t.filter((e=>!e.grp.isExcluded))}function p(t,s,n,i,u){const c="value"in t?[t.value]:t.values;if(!c)return{filteredValues:null,countedValues:null,renderedValues:null};const d=[s.valueFilter||n.valueFilter].filter((e=>e&&true));if(d.length&&d[0].type!=="tvs"&&d[0].type!=="tvslst")throw`unknown matrix value filter type='${d.type}'`;let p=!d.length?c:c.filter((t=>e(t,d[0],s.term,u)));const f=[];if(s.term.type=="geneVariant"&&s.q?.type=="values"){p.sort(this.mclassSorter);if(i.cellEncoding=="")f.push(...p);else{const e=[];for(const t of[l,r,o,a]){const s=t==a?p.find((e=>e.dt===t)):p.find((e=>e.dt===t&&e.class!=="WT"&&e.class!=="Blank"));if(s)f.push(s);const n=p.filter((e=>e.dt===t));e.push(...n)}p=e}}else{f.push(...p)}return{filteredValues:p,countedValues:p.filter((e=>{if(s.term.type=="geneVariant"){if(s.q?.type=="predefined-groupset"||s.q?.type=="custom-groupset"){const t=s.q.type=="predefined-groupset"?s.term.groupsetting.lst[s.q.predefined_groupset_idx]:s.q.customset;if(!t)throw"groupset not found";const n=t.groups[0];if(e!=n.name)return false}else{if(e.class=="WT"||e.class=="Blank"||i.geneVariantCountSamplesSkipMclass.includes(e.class))return false}}return true})),renderedValues:f}}function f(e,t){return e.class===t.class?0:e.class==="Blank"?1:t.class=="Blank"?-1:e.class<t.class?-1:1}var m=Object.freeze({__proto__:null,getTermOrder:u,getSampleGroups:c,getSampleOrder:d,classifyValues:p,stackSiblingCellsByClass:f});export{m};