@sjcrh/proteinpaint-client 2.76.1 → 2.76.2

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 (216) hide show
  1. package/dist/{2dmaf-593951c7.js → 2dmaf-f240211f.js} +1 -1
  2. package/dist/{AppHeader-29b88e14.js → AppHeader-c9432a24.js} +1 -1
  3. package/dist/{ColorScale-3d3c42dc.js → ColorScale-b991fc9e.js} +1 -1
  4. package/dist/{DEanalysis-f81e0f19.js → DEanalysis-bbfad00d.js} +1 -1
  5. package/dist/{Disco-db386f7a.js → Disco-b7c9bf72.js} +1 -1
  6. package/dist/{Disco.UI-8ed9cb39.js → Disco.UI-a5296c36.js} +1 -1
  7. package/dist/{DragControls-d6250d18.js → DragControls-ca3fa0cf.js} +1 -1
  8. package/dist/{DziViewer-9352e224.js → DziViewer-28915c11.js} +1 -1
  9. package/dist/{FilterRxComp-0f35b322.js → FilterRxComp-02e68f1b.js} +1 -1
  10. package/dist/{FilterStateless-b1c6ee04.js → FilterStateless-16a33070.js} +1 -1
  11. package/dist/{HicApp-14b94b20.js → HicApp-e713aa40.js} +1 -1
  12. package/dist/{OrbitControls-45f56ed4.js → OrbitControls-2466d420.js} +1 -1
  13. package/dist/{WSIViewer-80f60272.js → WSIViewer-957695a8.js} +1 -1
  14. package/dist/{adSandbox-94424b88.js → adSandbox-27d93bc0.js} +1 -1
  15. package/dist/app-42f69951.js +1 -0
  16. package/dist/{app-2cd97738.js → app-6fb77603.js} +1 -1
  17. package/dist/{app-686b9547.js → app-d215327f.js} +1 -1
  18. package/dist/app.js +1 -1
  19. package/dist/{bam-6631640f.js → bam-d67e5315.js} +1 -1
  20. package/dist/{barchart-3c5d734c.js → barchart-2898d229.js} +1 -1
  21. package/dist/{barchart.events-df44e666.js → barchart.events-426d737a.js} +1 -1
  22. package/dist/{bars.renderer-b232d882.js → bars.renderer-71935d34.js} +1 -1
  23. package/dist/{block-4134e823.js → block-75d4ff92.js} +1 -1
  24. package/dist/block.lazyload-d2951c91.js +1 -0
  25. package/dist/{block.legend-d2b7f1cb.js → block.legend-93d85a6e.js} +1 -1
  26. package/dist/{block.mds-ebe7b58d.js → block.mds-84b9d1c1.js} +1 -1
  27. package/dist/{block.mds.cnv-99f0a414.js → block.mds.cnv-a991ed79.js} +1 -1
  28. package/dist/{block.mds.expressionrank-96bf864b.js → block.mds.expressionrank-33b858de.js} +1 -1
  29. package/dist/{block.mds.expressionstat-dcab3fd1.js → block.mds.expressionstat-3093599f.js} +1 -1
  30. package/dist/{block.mds.geneboxplot-e5b2a4ce.js → block.mds.geneboxplot-b8391d18.js} +1 -1
  31. package/dist/{block.mds.junction-534eef9b.js → block.mds.junction-69708c7f.js} +1 -1
  32. package/dist/{block.mds.svcnv-de6a3c7d.js → block.mds.svcnv-322baea6.js} +1 -1
  33. package/dist/{block.mds.svcnv.share-2c2c16db.js → block.mds.svcnv.share-c5c38237.js} +1 -1
  34. package/dist/{block.mds2-373fcb4d.js → block.mds2-de4811dd.js} +1 -1
  35. package/dist/{block.svg-be5d741d.js → block.svg-ac9fec2d.js} +1 -1
  36. package/dist/{block.tk.aicheck-f2da5e81.js → block.tk.aicheck-ac4b8d4d.js} +1 -1
  37. package/dist/{block.tk.ase-ef848944.js → block.tk.ase-6dc0f9f1.js} +1 -1
  38. package/dist/{block.tk.bam-11fcba17.js → block.tk.bam-8f68b41d.js} +1 -1
  39. package/dist/{block.tk.bedgraphdot-a81b0709.js → block.tk.bedgraphdot-d8878860.js} +1 -1
  40. package/dist/{block.tk.bigwig.ui-f8e5ba71.js → block.tk.bigwig.ui-f6ed051c.js} +1 -1
  41. package/dist/{block.tk.hicstraw-e7072b25.js → block.tk.hicstraw-725bdc8a.js} +1 -1
  42. package/dist/{block.tk.junction-1c9a7854.js → block.tk.junction-f8b0b51d.js} +1 -1
  43. package/dist/{block.tk.junction.textmatrixui-ffecbb16.js → block.tk.junction.textmatrixui-252e7d7e.js} +1 -1
  44. package/dist/{block.tk.ld-274c3a82.js → block.tk.ld-11acf730.js} +1 -1
  45. package/dist/{block.tk.menu-e970cd4a.js → block.tk.menu-5e04436d.js} +1 -1
  46. package/dist/{block.tk.pgv-f4d4dbf7.js → block.tk.pgv-fef17dc4.js} +1 -1
  47. package/dist/{boxplot-44d3b48f.js → boxplot-4c9a5479.js} +1 -1
  48. package/dist/{brainImaging-2eaa419d.js → brainImaging-7716bc66.js} +1 -1
  49. package/dist/{brush-bb4ae2fb.js → brush-9faa7ae7.js} +1 -1
  50. package/dist/{categorical-db9b0175.js → categorical-1dea48ba.js} +1 -1
  51. package/dist/{condition-4e788f7d.js → condition-ebac4f75.js} +1 -1
  52. package/dist/{controls-3c1691d7.js → controls-268e40e6.js} +1 -1
  53. package/dist/{controls.btns-5b1240c8.js → controls.btns-5bf9e7d7.js} +1 -1
  54. package/dist/controls.config-2f0fa061.js +1 -0
  55. package/dist/{cuminc-c4db28f0.js → cuminc-8dffb765.js} +1 -1
  56. package/dist/{customdata.inputui-f9234d1f.js → customdata.inputui-b229d3a0.js} +1 -1
  57. package/dist/{dataDownload-a4dfa2d0.js → dataDownload-452ae3cd.js} +1 -1
  58. package/dist/{databrowser.ui-a64bab0c.js → databrowser.ui-2197fc73.js} +1 -1
  59. package/dist/{density-69a732f6.js → density-09feb0c9.js} +1 -1
  60. package/dist/{dictionary-e2232e84.js → dictionary-a132a3cc.js} +1 -1
  61. package/dist/{drag-d8daa62f.js → drag-2e9c80bb.js} +1 -1
  62. package/dist/{e2pca-f9324654.js → e2pca-4f1648e3.js} +1 -1
  63. package/dist/{ep-a5c1ee3a.js → ep-1d4c58b4.js} +1 -1
  64. package/dist/{facet-98971c68.js → facet-fa4fe49c.js} +1 -1
  65. package/dist/{fusion.parse-466ded6d.js → fusion.parse-7dfd6988.js} +1 -1
  66. package/dist/{geneExpClustering-66c05fb1.js → geneExpClustering-ed9121b8.js} +1 -1
  67. package/dist/{geneExpression-ff46a389.js → geneExpression-394672ff.js} +1 -1
  68. package/dist/{geneExpression-b5d0261f.js → geneExpression-66208299.js} +1 -1
  69. package/dist/geneExpression-c61e8f1c.js +1 -0
  70. package/dist/{geneORA-f1a90d02.js → geneORA-9456872c.js} +1 -1
  71. package/dist/{geneVariant-1cf17b3b.js → geneVariant-beaf9adb.js} +1 -1
  72. package/dist/{geneVariant-d0b9e1cb.js → geneVariant-f17cda85.js} +1 -1
  73. package/dist/{genefusion.ui-89a727ea.js → genefusion.ui-9238ec7f.js} +1 -1
  74. package/dist/{genesearch-41cb55ce.js → genesearch-ffd88bf2.js} +1 -1
  75. package/dist/{geneset-b63496eb.js → geneset-0315daf8.js} +1 -1
  76. package/dist/{genomeBrowser-ec8fbddc.js → genomeBrowser-608b924e.js} +1 -1
  77. package/dist/{genomeBrowser.controls-2dcaf4f5.js → genomeBrowser.controls-2601cab5.js} +1 -1
  78. package/dist/{groupsetting-3fef59f9.js → groupsetting-e3a4ecd5.js} +1 -1
  79. package/dist/{gsea-3075c82c.js → gsea-0c0cf8de.js} +1 -1
  80. package/dist/{hierCluster-33a828a1.js → hierCluster-7ab62ca5.js} +1 -1
  81. package/dist/hierCluster.config-f4daaf92.js +1 -0
  82. package/dist/{hierCluster.interactivity-6d453881.js → hierCluster.interactivity-7f475259.js} +1 -1
  83. package/dist/{hierCluster.renderers-6279d7fb.js → hierCluster.renderers-19b79639.js} +1 -1
  84. package/dist/{html.legend-fac5cb07.js → html.legend-80b2b3ec.js} +1 -1
  85. package/dist/{imagePlot-38254245.js → imagePlot-1ef24562.js} +1 -1
  86. package/dist/{lasso-e8b9500e.js → lasso-1a02a545.js} +1 -1
  87. package/dist/launch.adhoc-e124c993.js +1 -0
  88. package/dist/{leftlabel.sample-afcdcefd.js → leftlabel.sample-59f99ef5.js} +1 -1
  89. package/dist/{legacyDataset-3b08c91a.js → legacyDataset-fbaa5ebb.js} +1 -1
  90. package/dist/{log-4d84c357.js → log-c26b6cfd.js} +1 -1
  91. package/dist/{lollipop-64c5cdfc.js → lollipop-3aebe5d3.js} +1 -1
  92. package/dist/{maf-fd4ffbd0.js → maf-c439c851.js} +1 -1
  93. package/dist/{maftimeline-3e892da7.js → maftimeline-0da64e54.js} +1 -1
  94. package/dist/{matrix-e371888a.js → matrix-38cd47c3.js} +1 -1
  95. package/dist/{matrix.cells-eb4110a7.js → matrix.cells-a018d731.js} +1 -1
  96. package/dist/{matrix.cluster-0df274ed.js → matrix.cluster-a6e713e8.js} +1 -1
  97. package/dist/{matrix.config-3ef822b9.js → matrix.config-2c550b5d.js} +1 -1
  98. package/dist/matrix.controls-42ad4912.js +1 -0
  99. package/dist/{matrix.data-27b8e3a9.js → matrix.data-2b814c9f.js} +1 -1
  100. package/dist/{matrix.dom-1bbe1f39.js → matrix.dom-1e0da5b3.js} +1 -1
  101. package/dist/{matrix.groups-67606700.js → matrix.groups-824a7244.js} +1 -1
  102. package/dist/{matrix.interactivity-cdcc56c9.js → matrix.interactivity-1cb56534.js} +1 -1
  103. package/dist/{matrix.layout-857cd336.js → matrix.layout-47e44357.js} +1 -1
  104. package/dist/{matrix.legend-09f6dc57.js → matrix.legend-9af0c757.js} +1 -1
  105. package/dist/{matrix.renderers-d392fb69.js → matrix.renderers-337ce240.js} +1 -1
  106. package/dist/{matrix.serieses-b03b62aa.js → matrix.serieses-7b7184c9.js} +1 -1
  107. package/dist/{matrix.sort-9440c86a.js → matrix.sort-1ac05842.js} +1 -1
  108. package/dist/{matrix.sorterUi-2c5eb35f.js → matrix.sorterUi-1c60c145.js} +1 -1
  109. package/dist/{mavb-9d86df89.js → mavb-da8d1a0a.js} +1 -1
  110. package/dist/{mds.fimo-bffccb9f.js → mds.fimo-8604c3f8.js} +1 -1
  111. package/dist/{mds.samplescatterplot-b3908cc7.js → mds.samplescatterplot-3f09ae0e.js} +1 -1
  112. package/dist/{mds.survivalplot-9ad7dabc.js → mds.survivalplot-1d8f2b7e.js} +1 -1
  113. package/dist/{metaboliteIntensity-ec3176f4.js → metaboliteIntensity-bbb23c76.js} +1 -1
  114. package/dist/niceNumLabels-29a7c6ca.js +1 -0
  115. package/dist/{nodrag-ab7d5a9f.js → nodrag-b2737073.js} +1 -1
  116. package/dist/{notify-59f61230.js → notify-0cb8904f.js} +1 -1
  117. package/dist/{numeric-4853b665.js → numeric-24dacbee.js} +1 -1
  118. package/dist/{numeric.binary-1dd9a2b4.js → numeric.binary-f382cc98.js} +1 -1
  119. package/dist/{numeric.continuous-ed132eea.js → numeric.continuous-6feb34a7.js} +1 -1
  120. package/dist/{numeric.discrete-d780d076.js → numeric.discrete-ed10bbc1.js} +1 -1
  121. package/dist/{numeric.spline-abe07708.js → numeric.spline-a35cfbf0.js} +1 -1
  122. package/dist/{numeric.toggle-647423dd.js → numeric.toggle-2f98d6e5.js} +1 -1
  123. package/dist/oncomatrix-c0b2d635.js +1 -0
  124. package/dist/{parseData-567f3d70.js → parseData-292648dd.js} +1 -1
  125. package/dist/{plot.2dvaf-4016e75e.js → plot.2dvaf-6ae22dc1.js} +1 -1
  126. package/dist/plot.app-2a805759.js +1 -0
  127. package/dist/plot.barplot-34841e70.js +1 -0
  128. package/dist/{plot.boxplot-76229491.js → plot.boxplot-87ac2ce9.js} +1 -1
  129. package/dist/{plot.brainImaging-39b80a1c.js → plot.brainImaging-32a484b6.js} +1 -1
  130. package/dist/{plot.disco-9a544f9a.js → plot.disco-1fdfee3c.js} +1 -1
  131. package/dist/{plot.dzi-f1658ebf.js → plot.dzi-e3d0f610.js} +1 -1
  132. package/dist/{plot.ssgq-aeb2dabc.js → plot.ssgq-d33113d5.js} +1 -1
  133. package/dist/{plot.vaf2cov-ba8332ed.js → plot.vaf2cov-9f4f1776.js} +1 -1
  134. package/dist/{plot.wsi-2d802557.js → plot.wsi-dea124a7.js} +1 -1
  135. package/dist/{profileBarchart-72adc533.js → profileBarchart-58f0a8c0.js} +1 -1
  136. package/dist/{profileHome-37fd52e5.js → profileHome-7f404152.js} +1 -1
  137. package/dist/{profilePlot-0b897a05.js → profilePlot-4db8ca78.js} +1 -1
  138. package/dist/{profilePolar-a7248d48.js → profilePolar-50b8e40e.js} +1 -1
  139. package/dist/{profileRadar-1ba5d8fd.js → profileRadar-fff0b004.js} +1 -1
  140. package/dist/{profileRadarFacility-452e76ef.js → profileRadarFacility-d6d34c15.js} +1 -1
  141. package/dist/{profileSummary-7f0eacf0.js → profileSummary-04b8b15b.js} +1 -1
  142. package/dist/{recover-74f2e965.js → recover-299ffdb3.js} +1 -1
  143. package/dist/{regression.inputs-ff00f74e.js → regression.inputs-14df7c31.js} +1 -1
  144. package/dist/{regression.inputs.values.table-1753d56b.js → regression.inputs.values.table-d79efa9e.js} +1 -1
  145. package/dist/{regression.results-6f85a5dc.js → regression.results-4767144e.js} +1 -1
  146. package/dist/{renderPvalueTable-17558d6a.js → renderPvalueTable-002cc8ff.js} +1 -1
  147. package/dist/{sampleScatter-97917406.js → sampleScatter-55d9eb74.js} +1 -1
  148. package/dist/{sampleScatter.rendererThree-4649d1ec.js → sampleScatter.rendererThree-ef289434.js} +2 -2
  149. package/dist/{sampleView-f86dc5ea.js → sampleView-1dff3fca.js} +1 -1
  150. package/dist/{samplelst-4a5512df.js → samplelst-d2db0f24.js} +1 -1
  151. package/dist/{samplematrix-1192e5e2.js → samplematrix-0841387f.js} +1 -1
  152. package/dist/{scatter-cc1b0d07.js → scatter-f8285107.js} +1 -1
  153. package/dist/{select2Terms-d4f6ed9e.js → select2Terms-d48d037e.js} +1 -1
  154. package/dist/{selectGenomeWithTklst-b5cfd153.js → selectGenomeWithTklst-9af86d31.js} +1 -1
  155. package/dist/{singleCellCellType-d8c58253.js → singleCellCellType-fd1606b8.js} +1 -1
  156. package/dist/{singleCellGeneExpression-b7209531.js → singleCellGeneExpression-537f1157.js} +1 -1
  157. package/dist/{singleCellPlot-e6f83b2a.js → singleCellPlot-eff5760b.js} +1 -1
  158. package/dist/{singlecell-321dd973.js → singlecell-38336cbc.js} +1 -1
  159. package/dist/{singlecell-879235b3.js → singlecell-87b4b9a9.js} +1 -1
  160. package/dist/{snp-b046b7e6.js → snp-b81ef740.js} +1 -1
  161. package/dist/snp-f6123244.js +1 -0
  162. package/dist/{snplocus-61ff1c10.js → snplocus-acafb1ba.js} +1 -1
  163. package/dist/{spliceevent.a53ss.diagram-1a84db58.js → spliceevent.a53ss.diagram-5f8352eb.js} +1 -1
  164. package/dist/{spliceevent.exonskip.diagram-da10648b.js → spliceevent.exonskip.diagram-0d30a735.js} +1 -1
  165. package/dist/spliceevent.exonskip.getdefault-237c481c.js +1 -0
  166. package/dist/{spliceevent.noeventdiagram-1d6d790d.js → spliceevent.noeventdiagram-df9ce4bc.js} +1 -1
  167. package/dist/{spliceevent.phrase-2ca0ce59.js → spliceevent.phrase-a8401d53.js} +1 -1
  168. package/dist/{stattable-c5f12d9c.js → stattable-46cde32c.js} +1 -1
  169. package/dist/{style.gdc-5b7d90c6.js → style.gdc-72d730f2.js} +1 -1
  170. package/dist/{summary-0624f5e6.js → summary-a6c15c9e.js} +1 -1
  171. package/dist/{sunburst-30295714.js → sunburst-fe95832e.js} +1 -1
  172. package/dist/{survival-fcc7719f.js → survival-52714cd3.js} +1 -1
  173. package/dist/survival-57ff3c03.js +1 -0
  174. package/dist/{svg.download-e89a7369.js → svg.download-f4aa48e4.js} +1 -1
  175. package/dist/{svg.legend-c93f2980.js → svg.legend-749348e0.js} +1 -1
  176. package/dist/{svgraph-6ab3011b.js → svgraph-b46f1f92.js} +1 -1
  177. package/dist/{svmr-3ad3d600.js → svmr-9a76c6d4.js} +1 -1
  178. package/dist/{table-f50a9344.js → table-0daf2b89.js} +1 -1
  179. package/dist/{table-4d3a771e.js → table-bf40249b.js} +1 -1
  180. package/dist/{termInfo-d0a9e65f.js → termInfo-491b10af.js} +1 -1
  181. package/dist/{termdb.bins-01e8cce6.js → termdb.bins-39d11f24.js} +1 -1
  182. package/dist/termsetting-492eefa7.js +1 -0
  183. package/dist/{tk-e74c9beb.js → tk-ac524564.js} +1 -1
  184. package/dist/{toggleButtons-04c5ad7c.js → toggleButtons-c4d6f260.js} +1 -1
  185. package/dist/{tp.ui-7b24f0ef.js → tp.ui-0a476325.js} +1 -1
  186. package/dist/tvs.density-034b506d.js +1 -0
  187. package/dist/{tvs.geneVariant-418ed4ff.js → tvs.geneVariant-c59c8b54.js} +1 -1
  188. package/dist/{tvs.numeric-de14101f.js → tvs.numeric-aa1f892f.js} +1 -1
  189. package/dist/{tvs.samplelst-15bb62f1.js → tvs.samplelst-515f27b9.js} +1 -1
  190. package/dist/{uiUtils-ff2d4a6a.js → uiUtils-ea7dfea2.js} +1 -1
  191. package/dist/{variantBrowser-261373bf.js → variantBrowser-14d5c3f6.js} +1 -1
  192. package/dist/{vcf-145bf5dd.js → vcf-d357ce08.js} +1 -1
  193. package/dist/{violin-e647aac9.js → violin-74d26b75.js} +1 -1
  194. package/dist/{violin.interactivity-30a239fe.js → violin.interactivity-bf40ddde.js} +1 -1
  195. package/dist/{violin.renderer-e29d2700.js → violin.renderer-469fa0ff.js} +1 -1
  196. package/dist/{violinRenderer-08b3b58c.js → violinRenderer-14fa200d.js} +1 -1
  197. package/dist/{viridis-d86ad99b.js → viridis-cc59f478.js} +1 -1
  198. package/dist/{y-06b0d47c.js → y-59cbff5e.js} +1 -1
  199. package/dist/{zoom-d6ef6f3f.js → zoom-f445cfef.js} +1 -1
  200. package/package.json +1 -1
  201. package/dist/app-f031940d.js +0 -1
  202. package/dist/block.lazyload-eda77d9b.js +0 -1
  203. package/dist/controls.config-81cd5749.js +0 -1
  204. package/dist/geneExpression-5685eae2.js +0 -1
  205. package/dist/hierCluster.config-fa799d06.js +0 -1
  206. package/dist/launch.adhoc-2799109b.js +0 -1
  207. package/dist/matrix.controls-42bb2063.js +0 -1
  208. package/dist/niceNumLabels-5f45218a.js +0 -1
  209. package/dist/oncomatrix-7ac995a2.js +0 -1
  210. package/dist/plot.app-d6fe76e2.js +0 -1
  211. package/dist/plot.barplot-d2fc5020.js +0 -1
  212. package/dist/snp-541ec14d.js +0 -1
  213. package/dist/spliceevent.exonskip.getdefault-8028e522.js +0 -1
  214. package/dist/survival-816e055a.js +0 -1
  215. package/dist/termsetting-ad8c4f3a.js +0 -1
  216. package/dist/tvs.density-b2790080.js +0 -1
@@ -1 +1 @@
1
- import{n as e,a as t,d as n,b as r,c as u,y as a}from"./nodrag-ab7d5a9f.js";import{_ as i,d as o}from"./app-2cd97738.js";import{p as c}from"./pointer-c7475677.js";var l=e=>()=>e;function f(e,{sourceEvent:t,subject:n,target:r,identifier:u,active:a,x:i,y:o,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:true,configurable:true},sourceEvent:{value:t,enumerable:true,configurable:true},subject:{value:n,enumerable:true,configurable:true},target:{value:r,enumerable:true,configurable:true},identifier:{value:u,enumerable:true,configurable:true},active:{value:a,enumerable:true,configurable:true},x:{value:i,enumerable:true,configurable:true},y:{value:o,enumerable:true,configurable:true},dx:{value:c,enumerable:true,configurable:true},dy:{value:l,enumerable:true,configurable:true},_:{value:f}})}f.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function s(e){return!e.ctrlKey&&!e.button}function d(){return this.parentNode}function g(e,t){return t==null?{x:e.x,y:e.y}:t}function h(){return navigator.maxTouchPoints||"ontouchstart"in this}function v(){var v=s,b=d,m=g,p=h,y={},x=i("start","drag","end"),w=0,j,T,_,k,E=0;function P(t){t.on("mousedown.drag",X).filter(p).on("touchstart.drag",D).on("touchmove.drag",K,e).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function X(e,u){if(k||!v.call(this,e,u))return;var a=N(this,b.call(this,e,u),e,u,"mouse");if(!a)return;o(e.view).on("mousemove.drag",Y,t).on("mouseup.drag",q,t);n(e.view);r(e);_=false;j=e.clientX;T=e.clientY;a("start",e)}function Y(e){u(e);if(!_){var t=e.clientX-j,n=e.clientY-T;_=t*t+n*n>E}y.mouse("drag",e)}function q(e){o(e.view).on("mousemove.drag mouseup.drag",null);a(e.view,_);u(e);y.mouse("end",e)}function D(e,t){if(!v.call(this,e,t))return;var n=e.changedTouches,u=b.call(this,e,t),a=n.length,i,o;for(i=0;i<a;++i){if(o=N(this,u,e,t,n[i].identifier,n[i])){r(e);o("start",e,n[i])}}}function K(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r){if(a=y[t[r].identifier]){u(e);a("drag",e,t[r])}}}function M(e){var t=e.changedTouches,n=t.length,u,a;if(k)clearTimeout(k);k=setTimeout((function(){k=null}),500);for(u=0;u<n;++u){if(a=y[t[u].identifier]){r(e);a("end",e,t[u])}}}function N(e,t,n,r,u,a){var i=x.copy(),o=c(a||n,t),l,s,d;if((d=m.call(e,new f("beforestart",{sourceEvent:n,target:P,identifier:u,active:w,x:o[0],y:o[1],dx:0,dy:0,dispatch:i}),r))==null)return;l=d.x-o[0]||0;s=d.y-o[1]||0;return function n(a,g,h){var v=o,b;switch(a){case"start":y[u]=n,b=w++;break;case"end":delete y[u],--w;case"drag":o=c(h||g,t),b=w;break}i.call(a,e,new f(a,{sourceEvent:g,subject:d,target:P,identifier:u,active:b,x:o[0]+l,y:o[1]+s,dx:o[0]-v[0],dy:o[1]-v[1],dispatch:i}),r)}}P.filter=function(e){return arguments.length?(v=typeof e==="function"?e:l(!!e),P):v};P.container=function(e){return arguments.length?(b=typeof e==="function"?e:l(e),P):b};P.subject=function(e){return arguments.length?(m=typeof e==="function"?e:l(e),P):m};P.touchable=function(e){return arguments.length?(p=typeof e==="function"?e:l(!!e),P):p};P.on=function(){var e=x.on.apply(x,arguments);return e===x?P:e};P.clickDistance=function(e){return arguments.length?(E=(e=+e)*e,P):Math.sqrt(E)};return P}export{v as d};
1
+ import{n as e,a as t,d as n,b as r,c as u,y as a}from"./nodrag-b2737073.js";import{_ as i,d as o}from"./app-6fb77603.js";import{p as c}from"./pointer-c7475677.js";var l=e=>()=>e;function f(e,{sourceEvent:t,subject:n,target:r,identifier:u,active:a,x:i,y:o,dx:c,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:true,configurable:true},sourceEvent:{value:t,enumerable:true,configurable:true},subject:{value:n,enumerable:true,configurable:true},target:{value:r,enumerable:true,configurable:true},identifier:{value:u,enumerable:true,configurable:true},active:{value:a,enumerable:true,configurable:true},x:{value:i,enumerable:true,configurable:true},y:{value:o,enumerable:true,configurable:true},dx:{value:c,enumerable:true,configurable:true},dy:{value:l,enumerable:true,configurable:true},_:{value:f}})}f.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function s(e){return!e.ctrlKey&&!e.button}function d(){return this.parentNode}function g(e,t){return t==null?{x:e.x,y:e.y}:t}function h(){return navigator.maxTouchPoints||"ontouchstart"in this}function v(){var v=s,b=d,m=g,p=h,y={},x=i("start","drag","end"),w=0,j,T,_,k,E=0;function P(t){t.on("mousedown.drag",X).filter(p).on("touchstart.drag",D).on("touchmove.drag",K,e).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function X(e,u){if(k||!v.call(this,e,u))return;var a=N(this,b.call(this,e,u),e,u,"mouse");if(!a)return;o(e.view).on("mousemove.drag",Y,t).on("mouseup.drag",q,t);n(e.view);r(e);_=false;j=e.clientX;T=e.clientY;a("start",e)}function Y(e){u(e);if(!_){var t=e.clientX-j,n=e.clientY-T;_=t*t+n*n>E}y.mouse("drag",e)}function q(e){o(e.view).on("mousemove.drag mouseup.drag",null);a(e.view,_);u(e);y.mouse("end",e)}function D(e,t){if(!v.call(this,e,t))return;var n=e.changedTouches,u=b.call(this,e,t),a=n.length,i,o;for(i=0;i<a;++i){if(o=N(this,u,e,t,n[i].identifier,n[i])){r(e);o("start",e,n[i])}}}function K(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r){if(a=y[t[r].identifier]){u(e);a("drag",e,t[r])}}}function M(e){var t=e.changedTouches,n=t.length,u,a;if(k)clearTimeout(k);k=setTimeout((function(){k=null}),500);for(u=0;u<n;++u){if(a=y[t[u].identifier]){r(e);a("end",e,t[u])}}}function N(e,t,n,r,u,a){var i=x.copy(),o=c(a||n,t),l,s,d;if((d=m.call(e,new f("beforestart",{sourceEvent:n,target:P,identifier:u,active:w,x:o[0],y:o[1],dx:0,dy:0,dispatch:i}),r))==null)return;l=d.x-o[0]||0;s=d.y-o[1]||0;return function n(a,g,h){var v=o,b;switch(a){case"start":y[u]=n,b=w++;break;case"end":delete y[u],--w;case"drag":o=c(h||g,t),b=w;break}i.call(a,e,new f(a,{sourceEvent:g,subject:d,target:P,identifier:u,active:b,x:o[0]+l,y:o[1]+s,dx:o[0]-v[0],dy:o[1]-v[1],dispatch:i}),r)}}P.filter=function(e){return arguments.length?(v=typeof e==="function"?e:l(!!e),P):v};P.container=function(e){return arguments.length?(b=typeof e==="function"?e:l(e),P):b};P.subject=function(e){return arguments.length?(m=typeof e==="function"?e:l(e),P):m};P.touchable=function(e){return arguments.length?(p=typeof e==="function"?e:l(!!e),P):p};P.on=function(){var e=x.on.apply(x,arguments);return e===x?P:e};P.clickDistance=function(e){return arguments.length?(E=(e=+e)*e,P):Math.sqrt(E)};return P}export{v as d};
@@ -1 +1 @@
1
- import{Z as t,j as e,bL as n,M as a,a9 as o,I as r,U as s,d as l,ag as i}from"./app-2cd97738.js";import{d as p}from"./tp.ui-7b24f0ef.js";import{p as c}from"./viridis-d86ad99b.js";import{a as d,b as u}from"./axis-747c801e.js";import"./block.lazyload-eda77d9b.js";const m="#ccc";function f(n,a){const o=t({x:100,y:100});o.header.text("PCA - expression plot");const r=o.body.append("div").style("margin","20px");const s=o.body.append("div").style("margin","20px");const l=r.append("input").attr("size",30).attr("placeholder","PCA/SNE matrix file path").style("margin","10px").property("value","xiang/sep20/set1");const i=r.append("input").attr("size",30).attr("placeholder","numerical db file path").style("margin","10px").property("value","xiang/sep20/set1.db");r.append("button").text("Submit").on("click",(()=>{s.selectAll("*").remove();const t=l.property("value");if(t==""){s.text("No PCA file");return}const o=i.property("value");if(o==""){s.text("No db file");return}p(n+"/textfile").post(JSON.stringify({file:t,jwt:a}),(t=>{if(t.error){s.text("Error getting file: "+t.error);return}const[r,l]=h({holder:s,text:t.text});if(r){e(s,r);return}b({holder:s.append("div"),numdata2plot:l,hostURL:n,jwt:a,obj:{dbfile:o}})}))}));r.append("button").text("Clear").on("click",(()=>{l.property("value","");i.property("value","")}));r.append("span").style("padding-left","10px").html("<a href=https://docs.google.com/document/d/1Midt0rYs1iIJveUMjeng9si3q31YelcNe_PI3Njce9E/edit?usp=sharing target=_blank>Help</a>")}function h(t){const e=[];const p=t.text.split(/\r?\n/);for(let n=0;n<p.length;n++){const a=p[n];if(!a)continue;const o=a.split("\t");const r=o[0];const s=Number.parseFloat(o[1]);const l=Number.parseFloat(o[2]);if(Number.isNaN(s)){return["invalid x value at line "+(n+1)]}if(Number.isNaN(l)){return["invalid y value at line "+(n+1)]}const i={sample:r,x:s,y:l};if(t.mdanno){if(t.mdanno.annotation[r]){i.attr=[];for(const e in t.mdanno.annotation[r]){if(t.mdanno.mdh[e]){const n=t.mdanno.annotation[r][e];if(t.mdanno.mdh[e].values[n]){i.attr.push({k:t.mdanno.mdh[e].label,v:t.mdanno.mdh[e].values[n].label})}else{i.attr.push({k:t.mdanno.mdh[e].label,v:n})}}else{i.attr.push({k:e,v:"unknown term key"})}}}}e.push(i)}if(e.length==0){return["no samples"]}let f;if(t.obj&&t.obj.colorscale&&t.obj.colorscale.from&&t.obj.colorscale.to){f=n(t.obj.colorscale.from,t.obj.colorscale.to)}else{f=c}let h=e[0].x,b=e[0].x,x=e[0].y,g=e[0].y;for(const t of e){h=Math.min(h,t.x);b=Math.max(b,t.x);x=Math.min(x,t.y);g=Math.max(g,t.y)}const v=t.holder.append("div").style("display","inline-block");const y=new a({padding:"5px"});const j=v.append("svg");let k=30,w=50,N=100,M=30,A=20,z=500,C=500;const S=j.append("g");const E=j.append("g");const Y=j.append("g");const L=Y.selectAll().data(e).enter().append("g");const P=L.append("circle").attr("fill","#aaa").attr("stroke","none").on("mouseover",((t,e)=>{t.target.setAttribute("stroke","white");y.clear();y.show(t.clientX,t.clientY);const n=[{k:"name",v:e.sample}];if(e.value!=undefined){n.push({k:"value",v:e.value})}if(e.attr){for(const t of e.attr){n.push(t)}}o(y.d,n)})).on("mouseout",((t,e)=>{t.target.setAttribute("stroke","none");y.hide()}));if(t.obj){t.obj.circles=P}const U=r().domain([h,b]);const I=r().domain([x,g]);function J(){const t=3;w=z/20+20;j.attr("width",N+A+z+M).attr("height",k+C+A+w);S.attr("transform","translate("+(N+A)+","+(k+C+A)+")");E.attr("transform","translate("+N+","+k+")");Y.attr("transform","translate("+(N+A)+","+k+")");U.range([0,z]);I.range([C,0]);i({axis:S.call(d().scale(U)),color:"black",fontsize:z/40,showline:true});i({axis:E.call(u().scale(I)),color:"black",fontsize:C/40,showline:true});L.attr("transform",(t=>"translate("+U(t.x)+","+I(t.y)+")"));P.attr("r",t)}J();const X=v.append("div").style("position","relative");{const e=t.toprow||X;e.append("button").style("margin-right","20px").text("SVG").on("click",(()=>s(j.node(),"plot")))}const _=X.append("div").style("margin","10px 10px 10px 30px");if(t.obj){t.obj.legendholder=_}X.append("div").style("position","absolute").style("right","0px").style("top","0px").attr("class","sja_clbtext").text("drag to resize").on("mousedown",(t=>{t.preventDefault();const e=l(document.body);const n=t.clientX;const a=t.clientY;const o=z;const r=C;e.on("mousemove",(t=>{z=o+t.clientX-n;C=r+t.clientY-a;J()}));e.on("mouseup",(t=>{e.on("mousemove",null).on("mouseup",null)}))}));let q=false;const F=(t,e)=>{const n=new Map;let a=t[0].value,o=t[0].value;for(const e of t){n.set(e.sample,e.value);a=Math.max(a,e.value);o=Math.min(o,e.value)}let r,s;if(q){r=t.reduce(((t,e)=>t+e.value),0)/t.length;s=Math.sqrt(t.reduce(((t,e)=>t+Math.pow(e.value-r,2)),0)/t.length);console.log(r,s);o=a=0;t.forEach((t=>{const e=(t.value-r)/s;o=Math.min(o,e);a=Math.max(a,e)}))}P.attr("fill",(t=>{if(n.has(t.sample)){let e=n.get(t.sample);t.value=e;if(q){e=(e-r)/s;t.value=e}const l=(e-o)/(a-o);return f(l)}t.value=undefined;return m}));L.each((function(t){if(t.value!=undefined){this.parentNode.appendChild(this)}}));_.selectAll("*").remove();_.append("span").html(e+"&nbsp;");_.append("span").html("min: "+o+"&nbsp;");const l=[];for(let t=0;t<=1;t+=.1){l.push(f(t))}_.append("div").style("display","inline-block").style("width","150px").style("height","20px").style("background","linear-gradient(to right,"+l.join(",")+")").style("border","solid 1px "+m);_.append("span").html("&nbsp;max: "+a);const i=_.append("div").style("margin-top","10px");const p=Math.random().toString();i.append("input").attr("type","checkbox").style("margin-right","10px").property("checked",q).attr("id",p).on("change",(()=>{q=!q;F(t,e)}));i.append("label").attr("for",p).text("apply Z-score")};return[null,F]}function b(t){const e=t.holder.append("input").attr("placeholder","search gene").attr("padding-right","20px");const n=t.holder.append("span");e.on("keyup",(a=>{n.text("");if(a.code!="Enter")return;const o=e.property("value");if(!o)return;e.property("value","");p(t.hostURL+"/dbdata").post(JSON.stringify({db:t.obj.dbfile,tablename:"data",keyname:"gene",key:o.toLowerCase(),jwt:t.jwt}),(e=>{if(e.error){n.text("error getting data: "+e.error);return}if(!e.rows){n.text(".rows missing");return}if(e.rows.length==0){n.text("no match for "+o);return}t.obj.expressiondata=e.rows;t.obj.searchedgene=o;t.numdata2plot(e.rows,o);if(t.callback){t.callback()}}))}))}export{b as e2pca_genesearchui,f as e2pca_inputui,h as e2pca_plot};
1
+ import{Z as t,j as e,bL as n,M as a,a9 as o,I as r,U as s,d as l,ag as i}from"./app-6fb77603.js";import{d as p}from"./tp.ui-0a476325.js";import{p as c}from"./viridis-cc59f478.js";import{a as d,b as u}from"./axis-747c801e.js";import"./block.lazyload-d2951c91.js";const m="#ccc";function f(n,a){const o=t({x:100,y:100});o.header.text("PCA - expression plot");const r=o.body.append("div").style("margin","20px");const s=o.body.append("div").style("margin","20px");const l=r.append("input").attr("size",30).attr("placeholder","PCA/SNE matrix file path").style("margin","10px").property("value","xiang/sep20/set1");const i=r.append("input").attr("size",30).attr("placeholder","numerical db file path").style("margin","10px").property("value","xiang/sep20/set1.db");r.append("button").text("Submit").on("click",(()=>{s.selectAll("*").remove();const t=l.property("value");if(t==""){s.text("No PCA file");return}const o=i.property("value");if(o==""){s.text("No db file");return}p(n+"/textfile").post(JSON.stringify({file:t,jwt:a}),(t=>{if(t.error){s.text("Error getting file: "+t.error);return}const[r,l]=h({holder:s,text:t.text});if(r){e(s,r);return}x({holder:s.append("div"),numdata2plot:l,hostURL:n,jwt:a,obj:{dbfile:o}})}))}));r.append("button").text("Clear").on("click",(()=>{l.property("value","");i.property("value","")}));r.append("span").style("padding-left","10px").html("<a href=https://docs.google.com/document/d/1Midt0rYs1iIJveUMjeng9si3q31YelcNe_PI3Njce9E/edit?usp=sharing target=_blank>Help</a>")}function h(t){const e=[];const p=t.text.split(/\r?\n/);for(let n=0;n<p.length;n++){const a=p[n];if(!a)continue;const o=a.split("\t");const r=o[0];const s=Number.parseFloat(o[1]);const l=Number.parseFloat(o[2]);if(Number.isNaN(s)){return["invalid x value at line "+(n+1)]}if(Number.isNaN(l)){return["invalid y value at line "+(n+1)]}const i={sample:r,x:s,y:l};if(t.mdanno){if(t.mdanno.annotation[r]){i.attr=[];for(const e in t.mdanno.annotation[r]){if(t.mdanno.mdh[e]){const n=t.mdanno.annotation[r][e];if(t.mdanno.mdh[e].values[n]){i.attr.push({k:t.mdanno.mdh[e].label,v:t.mdanno.mdh[e].values[n].label})}else{i.attr.push({k:t.mdanno.mdh[e].label,v:n})}}else{i.attr.push({k:e,v:"unknown term key"})}}}}e.push(i)}if(e.length==0){return["no samples"]}let f;if(t.obj&&t.obj.colorscale&&t.obj.colorscale.from&&t.obj.colorscale.to){f=n(t.obj.colorscale.from,t.obj.colorscale.to)}else{f=c}let h=e[0].x,x=e[0].x,b=e[0].y,g=e[0].y;for(const t of e){h=Math.min(h,t.x);x=Math.max(x,t.x);b=Math.min(b,t.y);g=Math.max(g,t.y)}const v=t.holder.append("div").style("display","inline-block");const y=new a({padding:"5px"});const j=v.append("svg");let k=30,w=50,N=100,M=30,A=20,z=500,C=500;const S=j.append("g");const E=j.append("g");const Y=j.append("g");const L=Y.selectAll().data(e).enter().append("g");const P=L.append("circle").attr("fill","#aaa").attr("stroke","none").on("mouseover",((t,e)=>{t.target.setAttribute("stroke","white");y.clear();y.show(t.clientX,t.clientY);const n=[{k:"name",v:e.sample}];if(e.value!=undefined){n.push({k:"value",v:e.value})}if(e.attr){for(const t of e.attr){n.push(t)}}o(y.d,n)})).on("mouseout",((t,e)=>{t.target.setAttribute("stroke","none");y.hide()}));if(t.obj){t.obj.circles=P}const U=r().domain([h,x]);const I=r().domain([b,g]);function J(){const t=3;w=z/20+20;j.attr("width",N+A+z+M).attr("height",k+C+A+w);S.attr("transform","translate("+(N+A)+","+(k+C+A)+")");E.attr("transform","translate("+N+","+k+")");Y.attr("transform","translate("+(N+A)+","+k+")");U.range([0,z]);I.range([C,0]);i({axis:S.call(d().scale(U)),color:"black",fontsize:z/40,showline:true});i({axis:E.call(u().scale(I)),color:"black",fontsize:C/40,showline:true});L.attr("transform",(t=>"translate("+U(t.x)+","+I(t.y)+")"));P.attr("r",t)}J();const X=v.append("div").style("position","relative");{const e=t.toprow||X;e.append("button").style("margin-right","20px").text("SVG").on("click",(()=>s(j.node(),"plot")))}const _=X.append("div").style("margin","10px 10px 10px 30px");if(t.obj){t.obj.legendholder=_}X.append("div").style("position","absolute").style("right","0px").style("top","0px").attr("class","sja_clbtext").text("drag to resize").on("mousedown",(t=>{t.preventDefault();const e=l(document.body);const n=t.clientX;const a=t.clientY;const o=z;const r=C;e.on("mousemove",(t=>{z=o+t.clientX-n;C=r+t.clientY-a;J()}));e.on("mouseup",(t=>{e.on("mousemove",null).on("mouseup",null)}))}));let q=false;const F=(t,e)=>{const n=new Map;let a=t[0].value,o=t[0].value;for(const e of t){n.set(e.sample,e.value);a=Math.max(a,e.value);o=Math.min(o,e.value)}let r,s;if(q){r=t.reduce(((t,e)=>t+e.value),0)/t.length;s=Math.sqrt(t.reduce(((t,e)=>t+Math.pow(e.value-r,2)),0)/t.length);console.log(r,s);o=a=0;t.forEach((t=>{const e=(t.value-r)/s;o=Math.min(o,e);a=Math.max(a,e)}))}P.attr("fill",(t=>{if(n.has(t.sample)){let e=n.get(t.sample);t.value=e;if(q){e=(e-r)/s;t.value=e}const l=(e-o)/(a-o);return f(l)}t.value=undefined;return m}));L.each((function(t){if(t.value!=undefined){this.parentNode.appendChild(this)}}));_.selectAll("*").remove();_.append("span").html(e+"&nbsp;");_.append("span").html("min: "+o+"&nbsp;");const l=[];for(let t=0;t<=1;t+=.1){l.push(f(t))}_.append("div").style("display","inline-block").style("width","150px").style("height","20px").style("background","linear-gradient(to right,"+l.join(",")+")").style("border","solid 1px "+m);_.append("span").html("&nbsp;max: "+a);const i=_.append("div").style("margin-top","10px");const p=Math.random().toString();i.append("input").attr("type","checkbox").style("margin-right","10px").property("checked",q).attr("id",p).on("change",(()=>{q=!q;F(t,e)}));i.append("label").attr("for",p).text("apply Z-score")};return[null,F]}function x(t){const e=t.holder.append("input").attr("placeholder","search gene").attr("padding-right","20px");const n=t.holder.append("span");e.on("keyup",(a=>{n.text("");if(a.code!="Enter")return;const o=e.property("value");if(!o)return;e.property("value","");p(t.hostURL+"/dbdata").post(JSON.stringify({db:t.obj.dbfile,tablename:"data",keyname:"gene",key:o.toLowerCase(),jwt:t.jwt}),(e=>{if(e.error){n.text("error getting data: "+e.error);return}if(!e.rows){n.text(".rows missing");return}if(e.rows.length==0){n.text("no match for "+o);return}t.obj.expressiondata=e.rows;t.obj.searchedgene=o;t.numdata2plot(e.rows,o);if(t.callback){t.callback()}}))}))}export{x as e2pca_genesearchui,f as e2pca_inputui,h as e2pca_plot};
@@ -1 +1 @@
1
- import{s as t}from"./legacy-d3-polyfill-bdb2d792.js";import{ah as e,aM as a,aL as s,r as i,I as o,d as r,a9 as n,a8 as h,Z as l,M as d,c1 as p,bY as c,ag as f,p as g,ac as m,U as x,ab as u}from"./app-2cd97738.js";import{d as b}from"./arc-3d6751aa.js";import{p as y}from"./partition-db811f6b.js";import{p as v}from"./pointer-c7475677.js";import{l as w}from"./log-4d84c357.js";import{c as k}from"./axis-747c801e.js";import"./constant-426a1483.js";import"./math-2fb199c6.js";function _(t,n,h){if(!t.p.cohort){return}t.grab.min=Math.min(n,h);t.grab.max=Math.max(n,h);let l=t.data.filter((e=>e.value>=t.grab.min&&e.value<=t.grab.max));if(l.length==0){if(t.grab.sun){t.grab.sun.g.remove()}return}if(t.p.cohort.annotation){const e=[];for(const a of l){const s={};for(const t in a){if(t!="circle"){s[t]=a[t]}}const i=t.p.cohort.annotation[a[t.p.sampletype]];if(i){for(const t in i){s[t]=i[t]}}e.push(s)}l=e}const d=t.grab;if(d.sun){d.sun.g.remove()}else{d.sun={x:0,y:0}}const p=d.sun;p.g=d.holder.append("g").attr("transform","translate("+p.x+","+p.y+")").on("mouseover",(()=>{t.dottip.hide()}));let c=0;for(const e of l){if(e[t.p.cohort.levels[0].k]!=undefined){c++}}if(c==0){p.g.append("text").text("0/"+l.length).attr("font-size",40).attr("font-family",e).attr("stroke","white").attr("stroke-width",3).attr("text-anchor","middle");p.g.append("text").text("0/"+l.length).attr("font-size",40).attr("font-family",e).attr("fill",t.p.hlcolor).attr("text-anchor","middle").attr("fill-opacity",.8).on("click",(()=>{M(p,d,t)}));return}if(t.samplecart){d.selectedsamples=l.map((t=>t.sample_name?t.sample_name:t.sample));t.samplecart.setBtns({samplelst:d.selectedsamples,basket:"Gene Expression",id:t.genename+(!t.grab||!l.length?"":" FPKM:"+t.grab.min+"-"+t.grab.max),container:t.samplecartWrapper,reselectable:true})}const f=Math.min(t.width,t.height)*.3;const g=p.g.append("g");let m;let x;const u=b().startAngle((t=>t.x0)).endAngle((t=>t.x1)).innerRadius((t=>{if(!t.parent){x=Math.sqrt(t.y1)-f/15;return x}return Math.sqrt(t.y0)})).outerRadius((t=>{t.outradius=Math.sqrt(t.y1);if(t.parent&&!t.parent.parent){m=t.outradius}return t.outradius}));const v=a(l,t.p.cohort.levels);const w=s()(v);w.sum((t=>t.value));w.sort(((t,e)=>e.value-t.value));y().size([Math.PI*2,f*f])(w);p.ring=p.g.selectAll().data(w.descendants()).enter().append("path").attr("d",u).attr("stroke","white").attr("fill-opacity",1).attr("fill-rule","evenodd").attr("fill",(e=>{if(!e.parent)return"white";let a;if(e.children){a=e.id}else{if(!e.parent.parent){a=e.id}else{a=e.parent.id}}e._color=t.p.cohort.suncolor(a);return e._color})).on("mouseover",((t,e)=>{if(!e.parent)return;D.text(e.data.name);C.text(e.data.name);L.text(e.value);Y.text(e.data.full||"");t.target.setAttribute("fill",i(e._color).darker(.5).toString())})).on("mouseout",((e,a)=>{D.text(d.min+" - "+d.max).attr("font-size",X);C.text(d.min+" - "+d.max).attr("font-size",X);L.text(c==l.length?l.length:c+"/"+l.length);Y.text(t.p.datatype);e.target.setAttribute("fill",a._color)})).on("click",((e,a)=>{if(!t.samplecart){return}const s=[];for(const t of a.data.lst){s.push(t.sample_name?t.sample_name:t.sample)}t.samplecart.setBtns({samplelst:s,basket:"Gene Expression",note:a.data.name+" samples with "+t.genename+" "+t.p.datatype+" between "+t.grab.min+" and "+t.grab.max,id:t.genename+(!t.grab||!a.data.lst.length||!a.data.lst[0]?"":" FPKM:"+t.grab.min+"-"+t.grab.max)+" "+a.data.lst[0].ancestor_dx,container:t.samplecartWrapper,reselectable:true})}));g.append("circle").attr("r",m).attr("fill","white").attr("fill-opacity",.7);const k=[],_=[],z=[],F=[];for(const t of w.leaves()){const e=(t.x0+t.x1)/2;if(e<=Math.PI/2)k.push(t);else if(e<=Math.PI)_.push(t);else if(e<=Math.PI*1.5)z.push(t);else F.push(t)}k.sort(((t,e)=>e.x0-t.x0));_.sort(((t,e)=>t.x0-e.x0));z.sort(((t,e)=>e.x0-t.x0));F.sort(((t,e)=>t.x0-e.x0));const j=[...k,..._,...z,...F];const B=[];const P=[];const A=Math.max(13,t.dotsize*.7);p.g.selectAll().data(j).enter().append("text").text((t=>(t.parent.data.name?t.parent.data.name=="root"?"":t.parent.data.name+", ":"")+t.data.name)).attr("font-size",A).attr("font-family",e).attr("stroke","white").attr("stroke-width",3).attr("fill","none").each((function(t){const e=this.getBBox().height;const a=(t.x0+t.x1)/2;let s=f+5;let i=-s*Math.cos(a);if(a<=Math.PI){let t=true;for(const o of P){if(i>=o[0]&&i<=o[1]){t=false;if(a<=Math.PI/2){i=o[0]-2;s=-i/Math.cos(a);o[0]=i-e}else{i=2+o[1];s=-i/Math.cos(a);o[1]=i+e}break}}if(t){if(a<=Math.PI/2){P.push([i-e,i])}else{P.push([i,i+e])}}}else{let t=true;for(const o of B){if(i>=o[0]&&i<=o[1]){t=false;if(a<=Math.PI*1.5){i=2+o[1];s=-i/Math.cos(a);o[1]=i+e}else{i=o[0]-2;s=-i/Math.cos(a);o[0]=i-e}break}}if(t){if(a<=Math.PI*1.5){B.push([i,i+e])}else{B.push([i-e,i])}}}t.labely=i;t.labelx=s*Math.sin(a)})).attr("x",(t=>t.labelx)).attr("y",(t=>t.labely)).attr("text-anchor",(t=>(t.x0+t.x1)/2<=Math.PI?"start":"end")).attr("dominant-baseline",(t=>{var e=(t.x0+t.x1)/2;if(e<=Math.PI/2||e>=Math.PI*1.5)return"";return"hanging"}));p.g.selectAll().data(j).enter().append("text").text((t=>(t.parent.parent?t.parent.data.name+", ":"")+t.data.name)).attr("font-size",A).attr("font-family",e).attr("fill","#858585").attr("x",(t=>t.labelx)).attr("y",(t=>t.labely)).attr("text-anchor",(t=>(t.x0+t.x1)/2<=Math.PI?"start":"end")).attr("dominant-baseline",(t=>{var e=(t.x0+t.x1)/2;if(e<=Math.PI/2||e>=Math.PI*1.5)return"";return"hanging"}));p.g.selectAll().data(j).enter().append("line").attr("x1",(t=>t.outradius*Math.sin((t.x0+t.x1)/2))).attr("y1",(t=>-t.outradius*Math.cos((t.x0+t.x1)/2))).attr("x2",(t=>t.labelx)).attr("y2",(t=>t.labely)).attr("stroke","#858585");const I=Math.max(18,x*.6);const R=Math.max(14,x*.2);let N=-3;let X;p.g.append("text").text(t.p.sampletype.toUpperCase()).attr("font-size",R).attr("font-family",e).attr("y",-I).attr("fill",t.p.hlcolor).attr("text-anchor","middle");const L=p.g.append("text").text(c==l.length?l.length:c+"/"+l.length).attr("font-size",I).attr("font-family",e).attr("y",N).attr("fill",t.p.hlcolor).attr("text-anchor","middle").attr("fill-opacity",.8);N=5;const Y=p.g.append("text").text(t.p.datatype).attr("font-size",R).attr("font-family",e).attr("y",N).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("fill","#b5b5b5");const U=d.min+" - "+d.max;const S=o().domain([5,15]).range([x,x*2]);const C=p.g.append("text").text(U).attr("font-size",1).each((function(){var t=this.getBBox();X=Math.min(S(U.length)/t.width,x*.4/t.height)})).attr("font-size",X).attr("font-family",e).attr("y",N+R).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("stroke","white").attr("stroke-width",3).attr("fill","none");const D=p.g.append("text").text(U).attr("font-size",X).attr("font-family",e).attr("y",N+R).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("fill","#858585");p.g.append("circle").attr("r",x+f/15).attr("fill","white").attr("fill-opacity",0).on("click",(()=>{if(p.busy)return;M(p,d,t)})).on("mousedown",(t=>{const e=p.x,a=p.y,s=t.clientX,i=t.clientY,o=r(document.body);o.on("mousemove",(t=>{t.preventDefault();p.busy=true;p.x=e+t.clientX-s;p.y=a+t.clientY-i;p.g.attr("transform","translate("+p.x+","+p.y+")")})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null);setTimeout((()=>p.busy=false),10)}))}))}function M(t,e,a){if(t.ring){t.ring.transition().attr("fill-opacity",0)}t.g.transition().attr("transform","scale(.5,.5)").on("end",(()=>{t.g.remove();e.shade.attr("transform","translate(0,1000)")}));e.shadebox.transition().duration(500).attr("stroke-opacity",0).attr("fill-opacity",0);e.shadehandle1.transition().duration(500).attr("fill-opacity",0);e.shadehandle2.transition().duration(500).attr("fill-opacity",0);delete e.x;if(a.selectsample_button){a.selectsample_button.style("display","none").text("")}}function z(t,a,s,i,o){for(const e of t.boxplots){if(e.id==i)return}o.style("border-color",t.boxcolor);for(const e of t.boxplots){e.highlight=false;e.label.attr("fill",t.boxcolor);e.label2.attr("fill",t.boxcolor)}let r=[[0,t.height]];for(const e of t.boxplots){const t=e.yoff;const a=e.height;for(const e of r){if(Math.max(t,e[0])<Math.min(t+a,e[1])){if(t+a<e[1]){r.push([t+a+1,e[1]])}e[1]=t-1}}}const h=t.sf_boxlabelfontsize(Math.log(a.length));const l=t.sf_boxheight(a.length);let d=0;for(const t of r){if(t[1]-t[0]>Math.max(l,h)){d=t[0]+3;break}}const p=t.boxbag.append("g").attr("transform","translate(0,"+d+")");const c={labeltext:s,lst:a,holder:p,yoff:d,highlight:false,id:i,handle:o,height:Math.max(l,h),lookuphash:{}};for(const e of a){c.lookuphash[e[t.p.sampletype]]=1}t.boxplots.push(c);const f=a[Math.floor((a.length-1)*.91)].value,g=a[Math.floor((a.length-1)*.75)].value,m=a[Math.floor((a.length-1)*.5)].value,x=a[Math.floor((a.length-1)*.25)].value,u=a[Math.floor((a.length-1)*.09)].value;c.percentile={9:f==0?1e-4:f,25:g==0?1e-4:g,50:m==0?1e-4:m,75:x==0?1e-4:x,91:u==0?1e-4:u};c.hline=p.append("line").attr("y1",l/2).attr("y2",l/2).attr("stroke",t.boxcolor).attr("stroke-dasharray","5,3").attr("shape-rendering","crispEdges");c.hline.transition().duration(t.dur).attr("x1",Math.max(0,t.x_scale(f))).attr("x2",Math.max(0,t.x_scale(u)));c.label=p.append("text").attr("y",l/2).attr("font-size",h).attr("font-family",e).attr("text-anchor","end").attr("dominant-baseline","middle").attr("fill",c.highlight?t.p.hlcolor:t.boxcolor).style("cursor","default").text(s).on("mousedown",(e=>B(t,c,e))).on("click",(()=>j(t,c))).each((function(){c.labelwidth=this.getBBox().width})).attr("x",t.width+t.width2+c.labelwidth);c.label.transition().duration(t.dur).attr("x",t.width+t.width2-t.width2_-3);c.label2=p.append("text").attr("x",t.width+t.width2+c.labelwidth).attr("y",l/2).attr("font-size",h).attr("font-family",e).attr("dominant-baseline","middle").attr("fill",c.highlight?t.p.hlcolor:t.boxcolor).style("cursor","default").text(a.length).on("mousedown",(()=>B(t,c))).on("click",(()=>j(t,c)));c.label2.transition().duration(t.dur).attr("x",t.width+t.width2-t.width2_+3);c.connline=p.append("line").attr("y1",l/2).attr("y2",l/2).attr("stroke",t.boxcolor).attr("stroke-dasharray","1,3").attr("shape-rendering","crispEdges");c.connline.transition().duration(t.dur).attr("x1",Math.max(0,t.x_scale(c.percentile[91]))).attr("x2",Math.max(0,t.width+t.width2-c.labelwidth-t.width2_-3));c.box=p.append("rect").attr("height",l).attr("shape-rendering","crispEdges").attr("fill","white").attr("stroke",t.boxcolor).on("click",(()=>F(t,c))).on("mousedown",(t=>{const e=t.target;e.setAttribute("fill","#FFeeee");e.setAttribute("stroke","#D10000")})).on("mouseover",(e=>{t.dottip.show(e.clientX,e.clientY).clear();const a=[{k:"Group",v:c.labeltext||"All samples"},{k:"1st quartile",v:c.percentile[25]},{k:"Median",v:c.percentile[50]},{k:"3rd quartile",v:c.percentile[75]}];n(t.dottip.d.append("div"),a)})).on("mouseout",(()=>{t.dottip.hide()}));c.box.transition().duration(t.dur).attr("x",Math.max(0,t.x_scale(c.percentile[25]))).attr("width",Math.max(0,t.x_scale(c.percentile[75]))-Math.max(0,t.x_scale(c.percentile[25])));c.vlines=p.selectAll().data([c.percentile[9],c.percentile[25],c.percentile[50],c.percentile[75],c.percentile[91]]).enter().append("line").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",l).attr("stroke",t.boxcolor).attr("shape-rendering","crispEdges");c.vlines.transition().duration(t.dur).attr("x1",(e=>Math.max(0,t.x_scale(e)))).attr("x2",(e=>Math.max(0,t.x_scale(e))));if(s!=""){j(t,c)}}function F(t,e){let a=null;if(typeof e=="object"){a=e}else{for(const s of t.boxplots){if(s.id==e)a=s}}if(!a){console.log("cannot remove boxplot");return}a.handle.style("border-color","transparent");if(a.label.attr("fill")==t.p.hlcolor){j(t,a)}a.holder.transition().attr("transform","translate("+(t.width+20)+","+a.yoff+")").each((()=>a.holder.remove()));for(let e=0;e<t.boxplots.length;e++){if(t.boxplots[e].id==a.id){t.boxplots.splice(e,1);return}}}function j(t,e){if(t.busy)return;for(const a of t.boxplots){if(a.id!=e.id)a.highlight=false}e.highlight=!e.highlight;t.epdot.transition().duration(1e3).attr("r",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?t.dotsize*.7:t.dotsize/2;return e.highlight?t.dotsize*.2:t.dotsize/2})).attr("stroke",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?t.p.hlcolor:"black";return"black"})).attr("stroke-opacity",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?.4:.2;return e.highlight?.1:.2}));for(const e of t.boxplots){e.label.attr("fill",e.highlight?t.p.hlcolor:t.boxcolor);e.label2.attr("fill",e.highlight?t.p.hlcolor:t.boxcolor)}}function B(t,e,a){a.preventDefault();const s=a.clientY,i=e.yoff;const o=r(document.body);o.on("mousemove",(a=>{t.busy=true;e.yoff=i+a.clientY-s;e.holder.attr("transform","translate(0,"+e.yoff+")")})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null);setTimeout((()=>t.busy=false),100)}))}const P=300,A=500,I=400,R=700;const N=.6;const X=.2;class L{constructor(i){this.p=i.expp;if(this.p.cohort){if(!this.p.cohort.suncolor){this.p.cohort.suncolor=h(t)}}this.boxcolor="#006600";this.boxplots=[];this.const_all="All "+this.p.sampletype+"s";this.uselog=false;this.dotmoved=false;this.genename=i.genename;this.presize=i.presize;this.dsname=i.dsname;this.genome=i.genome;this.hostURL=i.block?i.block.hostURL:i.hostURL;this.samplecart=i.samplecart;if(i.block){const t=i.block.holder.node().getBoundingClientRect();this.presize={x:t.left+i.block.leftheadw+i.block.width+20,y:t.top,width:Math.min(A,Math.max(P,document.body.scrollWidth-t.left-t.width-100)),height:Math.min(R,Math.max(I,document.body.clientHeight-270))}}this.source=i.source;this.data=i.data;this.data.sort(((t,e)=>e.value-t.value));this.minvalue=0;this.maxvalue=0;if(this.data.length>0){this.minvalue=this.maxvalue=this.data[0].value}this.sampletype2value={};for(const t of this.data){const e=t.value;this.minvalue=Math.min(this.minvalue,e);this.maxvalue=Math.max(this.maxvalue,e);this.sampletype2value[t[this.p.sampletype]]=e}if(this.p.scaleminvalue!=undefined){this.minvalue=this.p.scaleminvalue}this.pane=l({x:this.presize.x,y:this.presize.y});this.pane.pane.classed("sja_ep_pane",true);this.dottip=new d({padding:"10px"});if(i.block){const t=r(this.pane.header.node().previousSibling);t.on("click",(()=>{this.epaintfold(i.block)}))}this.pane.body.style("padding","10px");const c=t=>{this.pane.body.append("p").text(t)};if(this.data.length==0){this.pane.header.text(this.p.name);c("No expression data for "+this.genename);return}this.pane.header.text(this.genename+" "+this.p.name+(this.dsname?" from "+this.dsname:""));S(this);this.treediv=this.pane.body.append("div").style("display","none").style("margin","20px 0px 30px 0px").style("padding","10px").style("background-color","#FFFFE8");this.treediv.append("div").style("font-size",".7em").style("color","#858585").style("text-align","center").text("Click on a row to show/hide boxplot");this.svg=this.pane.body.append("svg");if(this.samplecart){this.samplecartWrapper=this.pane.body.append("div");this.samplecart.setBtns({samplelst:this.grab&&this.grab.selectedsamples?this.grab.selectedsamples:[],basket:"Gene Expression",id:this.genename+(!this.grab?"":" FPKM:"+this.grab.min+"-"+this.grab.max),container:this.samplecartWrapper,reselectable:true,replaceable:false})}this.pane.body.append("div").style("text-align","right").append("span").text("drag to resize").attr("font-size",".8em").attr("font-family",e).attr("class","sja_clbtext").on("mousedown",(t=>{t.preventDefault();const e=t.clientX;const a=t.clientY;const s=this.width;const i=this.height;const o=r(document.body);o.on("mousemove",(t=>{this.render(s+t.clientX-e,i+t.clientY-a)}));o.on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null)}))}));this.sf_boxheight=o().domain([0,this.data.length]);this.sf_boxlabelfontsize=o();this.boxplots=[];if(this.svgg){this.svgg.remove()}this.svgg=this.svg.append("g");this.axisg=this.svgg.append("g");this.grabbar=this.svgg.append("rect").attr("x",0).attr("y",0).attr("fill","white").attr("fill-opacity",0).on("mousedown",(t=>{if(!this.p.cohort){console.log("no .p.cohort");return}this.busy=true;const e=v(t,this.grabbar.node())[0];const a=Number.parseFloat(this.x_scale.invert(e).toFixed(1));this.grab.x=e;this.grab.width=1;this.grab.shade.attr("transform","translate("+e+","+this.grab.y+")");this.grab.shadebox.attr("width",2).attr("height",this.grab.height).attr("stroke-opacity",.7).attr("fill-opacity",.1);this.grab.shadehandle1.attr("fill-opacity",.5);this.grab.shadehandle2.attr("x",2).attr("fill-opacity",.5);_(this,a,Number.parseFloat(this.x_scale.invert(e+1).toFixed(1)));const s=r(document.body);s.on("mousemove",(t=>{t.preventDefault();let s=v(t,this.grabbar.node())[0];s=Math.max(-this.dotsize,s);s=Math.min(this.width+this.dotsize,s);this.grab.width=Math.max(1,Math.abs(s-e));this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);if(s<e){this.grab.x=s;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")")}_(this,a,Number.parseFloat(this.x_scale.invert(s).toFixed(1)))}));s.on("mouseup",(()=>{this.busy=false;s.on("mousemove",null).on("mouseup",null)}))}));this.verticalline=this.svgg.append("line").attr("stroke",this.boxcolor).attr("stroke-opacity",.1).attr("shape-rendering","crispEdges");this.dur=2e3;this.boxbag=this.svgg.append("g");this.graph=this.svgg.append("g");this.sung=this.svgg.append("g");this.grab={shade:this.sung.append("g"),holder:this.sung.append("g")};this.grab.shadebox=this.grab.shade.append("rect").attr("stroke",this.p.hlcolor).attr("stroke-width",1).attr("fill",this.p.hlcolor).style("cursor","move").on("mousedown",(t=>{if(!this.p.cohort){return}this.busy=true;let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.x+=a-e;e=a;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")");_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.grab.shadehandle1=this.grab.shade.append("rect").attr("x",-5).attr("width",5).attr("height",40).attr("fill",this.p.hlcolor).attr("fill-opacity",0).style("cursor","ew-resize").on("mousedown",(t=>{this.busy=true;let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.width+=e-a;if(this.grab.width<=0){this.grab.width-=e-a;return}this.grab.x+=a-e;e=a;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")");this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.grab.shadehandle2=this.grab.shade.append("rect").attr("x",0).attr("width",5).attr("height",40).attr("fill",this.p.hlcolor).attr("fill-opacity",0).style("cursor","ew-resize").on("mousedown",(t=>{let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.width+=a-e;if(this.grab.width<=0){this.grab.width-=a-e;return}e=a;this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.epdotg=this.graph.selectAll().data(this.data).enter().append("g");this.epdot=this.epdotg.append("circle").attr("fill",this.p.hlcolor).attr("fill-opacity",0).attr("stroke","black").attr("stroke-width",2).attr("stroke-opacity",X).each((function(t){t.circle=this})).on("mouseover",((t,e)=>{if(this.busy)return;e.circle.setAttribute("transform","scale(1.5)");this.dottip.clear();const a=[{k:this.p.datatype,v:'<span style="font-size:150%">'+e.value+"</span>"}];if(this.p.attrlst){for(const t of this.p.attrlst){a.push({k:t.label||t.k,v:e[t.k]})}}const s=this.getsampleinfo(e,a);n(this.dottip.d,a).style("zoom",.7);this.dottip.show(t.clientX,t.clientY);if(s){this.dottip.d.append("div").text("Full details").attr("class","sja_menuoption").on("click",(()=>{U(e,this.p.cohort,t.clientX-100,t.clientY-100)}))}})).on("mouseout",((t,e)=>{e.circle.setAttribute("transform","scale(1)")})).on("mousedown",((t,e)=>{t.preventDefault();const a=t.clientY;const s=r(document.body);const i=this.data[Math.floor(this.data.length/2)].value;if(e.value<i){const t=this.dotgraph_y;s.on("mousemove",(e=>{this.busy=true;this.dotmoved=true;this.dotgraph_y=t+e.clientY-a;this.graph.attr("transform","translate(0,"+this.dotgraph_y+")")}))}else{const t=this.heightmove;s.on("mousemove",(e=>{this.dotmoved=true;this.heightmove=t+a-e.clientY;const s=this.heightmove/this.data.length;this.epdotg.attr("transform",((t,e)=>{t._y=this.height-this.heightmove+e*s;return"translate("+Math.max(0,this.x_scale(t.value))+","+t._y+")"}))}))}s.on("mouseup",(()=>{setTimeout((()=>this.busy=false),50);s.on("mousemove",null).on("mouseup",null)}))}));this.render();const f=this.treediv.append("div").style("margin","10px").style("padding","2px").style("border","solid 1px transparent").html("All samples&nbsp;&nbsp;"+this.data.length).attr("class","sja_clb").on("click",(()=>{let t=true;for(const e of this.boxplots){if(e.id=="all")t=false}if(t){z(this,this.data,"","all",f)}else{F(this,"all")}}));if(this.p.cohort){if(this.p.cohort&&this.p.cohort.annotation&&this.p.cohort.key4annotation){for(const t of this.data){const e=t[this.p.cohort.key4annotation];if(e){const a=this.p.cohort.annotation[e];if(a){if(this.p.cohort.levels){for(const e of this.p.cohort.levels){t[e.k]=a[e.k];if(e.full){t[e.full]=a[e.full]}}}else{for(const e in a){t[e]=a[e]}}}}}}const t=this.treediv.append("div").style("margin","10px").style("height","400px").style("overflow-y","scroll").style("resize","vertical");const e=a(this.data,this.p.cohort.levels);const i=p(s()(e));i.sum((t=>t.value));i.eachBefore((e=>{if(!e.parent)return;const a=t.append("div").style("margin","2px").style("padding","2px").style("border","solid 1px transparent").attr("class","sja_clb");for(let t=1;t<e.depth;t++){a.append("span").style("color","#ccc").style("padding","0px 15px").text("|")}const s=e.data.data;a.append("span").html(s.name+"&nbsp;");if(s.full){a.append("span").html(s.full+"&nbsp;").style("font-size",".7em").style("color","#858585")}if(s.lst&&s.lst.length){a.append("span").text(s.lst.length);a.on("click",(()=>{let t=true;for(const e of this.boxplots){if(e.id==s.id)t=false}if(t){z(this,s.lst,s.name,s.id,a)}else{F(this,s.id)}}))}}))}else{this.treediv.append("div").style("margin","10px").text("Cannot stratify sample: no cohort information.")}z(this,this.data,"","all",f)}epaintfold(t){if(!this.handle){const e=this.genome.datasets[this.dsname];if(!e){alert("invalid dataset name: "+this.dsname);return}this.handle=t.ds2handle[this.dsname].handle.append("div").classed("sja_opaque8",true).style("background-color","#999").style("color","white").style("padding","2px 4px").style("margin-left","1px").text("e");this.handle.on("click",(()=>{this.pane.pane.style("display","block");c(this.handle,this.pane.pane);this.handle.style("display","none")}))}this.handle.style("display","inline-block");c(this.pane.pane,this.handle);this.pane.pane.style("display","none")}makescale_ep(){const t=this.axish-2;if(this.uselog){this.x_scale=w().domain([1,this.maxvalue]).range([0,this.width])}else{this.x_scale=o().domain([this.minvalue,this.maxvalue]).range([0,this.width])}const e=k().scale(this.x_scale).tickSizeInner(this.tickh);if(this.uselog){e.ticks(6,",.0f")}else{let a;this.axisg.append("text").text(Math.ceil(this.maxvalue)).attr("font-size",t-this.tickh).each((function(){a=this.getBBox().width})).remove();e.ticks(Math.floor(this.width/(a+20)))}if(this.axis){this.axis.remove()}this.axis=this.axisg.append("g").attr("transform","translate(0,"+t+")").call(e);f({axis:this.axis,fontsize:t-this.tickh,showline:true})}render(t,a){if(!t){t=this.presize.width;a=this.presize.height}this.width=t;this.width2=t*.05;this.dotsize=Math.max(13,t/30);this.height=a;this.sf_boxheight.range([10,this.height/8]);const s=Math.min(this.data.length*.7,300);this.sf_boxlabelfontsize.domain([0,Math.log(s),Math.log(this.data.length)]).range([8,this.sf_boxheight(s)/2,1+this.sf_boxheight(s)/2]);this.heightmove=this.height;this.rowheight_reset();this.svgg.attr("transform","translate("+this.dotsize+",0)");this.axish=Math.max(18,this.width*.04);this.tickh=this.axish*.3;this.makescale_ep();this.grabbar.attr("width",this.width);this.grabbar.attr("height",this.axish);const i=this.svgg.append("text").text(this.data.length).attr("font-family",e).attr("font-size",this.sf_boxlabelfontsize(Math.log(this.data.length)));this.width2_=i.node().getBBox().width+3;i.remove();const o=this.svgg.append("text").text("COUNT").attr("font-size",1).attr("font-family",e);const r=Math.max(8,(this.width2_-3)/o.node().getBBox().width);o.remove();this.axispad=5+r+this.dotsize/2;this.verticalline.attr("x1",this.width+this.width2-this.width2_).attr("y1",this.axish+5).attr("x2",this.width+this.width2-this.width2_).attr("y2",this.axish+this.height+this.axispad);this.dotgraph_y=this.axish+this.axispad;this.dotgraph_y_default=this.dotgraph_y;this.boxbag.attr("transform","translate(0,"+this.dotgraph_y+")");this.graph.attr("transform","translate(0,"+this.dotgraph_y+")");this.sung.attr("transform","translate(0,"+this.dotgraph_y+")");this.grab.y=-this.dotgraph_y-10;this.grab.height=this.height+this.dotgraph_y+30;this.grab.holder.attr("transform","translate("+this.width/2+","+this.height/2+")");this.grab.shadehandle1.attr("y",12+this.axish);this.grab.shadehandle2.attr("y",12+this.axish);this.epdotg.attr("transform",((t,e)=>{t._y=e*this.rowheight;return"translate(0,"+t._y+")"}));this.epdot.attr("r",this.dotsize/2);this.epdotg.attr("transform",(t=>"translate("+Math.max(0,this.x_scale(t.value))+","+t._y+")"));if(this.grab.x){let t=this.x_scale(this.grab.min),e=this.x_scale(this.grab.max);this.grab.x=t;this.grab.width=e-t;this.grab.shade.attr("transform","translate("+t+","+this.grab.y+")");this.grab.shadebox.attr("width",this.grab.width).attr("height",this.grab.height);this.grab.shadehandle2.attr("x",this.grab.width);_(this,this.grab.min,this.grab.max)}for(const t of this.boxplots){const e=this.sf_boxlabelfontsize(Math.log(t.lst.length));const a=this.sf_boxheight(t.lst.length);t.holder.attr("transform","translate(0,"+t.yoff+")");t.hline.attr("y1",a/2).attr("y2",a/2).attr("x1",Math.max(0,this.x_scale(t.percentile[9]))).attr("x2",Math.max(0,this.x_scale(t.percentile[91])));t.label.attr("x",this.width+this.width2-this.width2_-3).attr("y",a/2).attr("font-size",e);t.label2.attr("x",this.width+this.width2-this.width2_+3).attr("y",a/2).attr("font-size",e);t.connline.attr("y1",a/2).attr("y2",a/2).attr("x1",Math.max(0,this.x_scale(t.percentile[91]))).attr("x2",Math.max(0,this.width+this.width2-t.labelwidth-this.width2_-3));t.box.attr("height",a).attr("x",Math.max(0,this.x_scale(t.percentile[25]))).attr("width",Math.max(0,this.x_scale(t.percentile[75]))-Math.max(0,this.x_scale(t.percentile[25])));t.vlines.attr("x1",(t=>Math.max(0,this.x_scale(t)))).attr("x2",(t=>Math.max(0,this.x_scale(t)))).attr("y1",0).attr("y2",a)}this.svg.attr("width",this.width+this.width2+this.dotsize).attr("height",this.height+this.axish+this.axispad+this.dotsize/2)}getsampleinfo(t,e){if(this.p.cohort){if(this.p.cohort.annotation&&this.p.cohort.key4annotation){const a=t[this.p.cohort.key4annotation];if(a){e.push({k:this.p.cohort.key4annotation,v:a});const t=this.p.cohort.annotation[a];if(t){let a=0;for(const e in t)a++;if(this.p.cohort.levels){for(const a of this.p.cohort.levels){e.push({k:a.label||a.k,v:t[a.k]==undefined?"":t[a.k]})}return a>this.p.cohort.levels.length}let s=0;for(const i in t){e.push({k:i,v:t[i]});if(++s==a)return true}return false}}}else if(this.p.cohort.levels){for(const a of this.p.cohort.levels){const s=t[a.k];if(!s)continue;e.push({k:a.label||a.k,v:t[a.k]+(a.full?t[a.full]?' <span style="font-size:.8em;color:#858585">'+t[a.full]+"</span>":"":"")})}return false}}for(const a in t){if(a=="circle"||a=="_y")continue;if(typeof a=="string"){const s=t[a];if(s){e.push({k:a,v:s})}}}return false}rowheight_reset(){if(this.data){this.rowheight=this.height/this.data.length;return}this.rowheight=0}dot_appendtext(t,a){const s=[];t.append("text").text((t=>a.get(t[this.p.sampletype]))).attr("font-family",e).attr("font-size",this.dotsize).each((function(t){t.bb=this.getBBox()})).each((t=>{const e=this.x_scale(t.value);const a=e-this.dotsize>t.bb.width;let i=t._y-t.bb.height/2,o=i+t.bb.height;for(const e of s){if(e.onleft==a&&Math.max(e.y1,i)<Math.min(e.y2,o)){i=e.y2;o=i+t.bb.height}}delete t.bb;t.mafrect={y1:i,y2:o,onleft:a};s.push(t.mafrect)})).attr("class","sja_svgtext").attr("dominant-baseline","central").attr("fill",this.p.hlcolor).attr("text-anchor",(t=>t.mafrect.onleft?"end":"start")).attr("x",(t=>(t.mafrect.onleft?-1:1)*this.dotsize)).attr("y",(t=>t.mafrect.y1-t._y+this.dotsize/2)).on("click",((t,e)=>{r(e.circle).attr("stroke-width",1).attr("stroke-opacity",X).attr("stroke","black").attr("r",this.dotsize/2);e.showtext=false;r(t.target).remove()})).attr("font-size",1).transition().attr("font-size",this.dotsize)}may_hl(t,e){if(!this.data)return;const a=new Set;let s=true;for(const e of t){const t=e[this.p.sampletype];if(!t)continue;a.add(t);if(this.sampletype2value[t]){s=false}}if(s)return;this.epdot.filter((t=>a.has(t[this.p.sampletype]))).attr("r",e?this.dotsize*.8:this.dotsize/2).attr("stroke",e?this.p.hlcolor:"black").attr("stroke-opacity",e?N:X);const i=this.p.maf;if(!i)return;const o=new Map;for(const e of t){const t=e[this.p.sampletype];const a=this.p.maf.get(e);if(!a)continue;if(typeof a=="string"){o.set(t,a)}else{o.set(t,a.v2==0?"No "+this.p.maf.label+": site not covered":this.p.maf.label+": "+(a.f*100).toFixed(0)+"% ("+a.v1+"/"+a.v2+")")}}const r=this.epdotg.filter((t=>o.has(t[this.p.sampletype])&&!t.showtext));if(e){this.dot_appendtext(r,o)}else{r.select("text").remove()}}}function Y(t,e){const a=t.genome.datasets[t.dsname];if(a.dbexpression){const s={db:a.dbexpression.dbfile,tablename:a.dbexpression.tablename,keyname:a.dbexpression.keyname,key:e};fetch(new Request(t.hostURL+"/dbdata",{method:"POST",body:JSON.stringify(s)})).then((t=>t.json())).then((s=>{if(s.error)throw{message:s.error};if(a.dbexpression.tidy){a.dbexpression.tidy(s.rows)}const i=t.pane.pane.node().getBoundingClientRect();new L({hostURL:t.hostURL,data:s.rows,expp:t.p,presize:{x:i.left+30,y:i.top+50,width:t.width,height:t.height},genome:t.genome,dsname:t.dsname,genename:e,samplecart:t.samplecart})})).catch((t=>{window.alert(t.message);if(t.stack)console.log(t.stack)}));return}fetch(new Request(t.hostURL+"/dsdata",{method:"POST",body:JSON.stringify({genome:t.genome.name,dsname:t.dsname,expressiononly:1,genename:e})})).then((t=>t.json())).then((a=>{if(a.error)throw{message:a.error};const s=t.pane.pane.node().getBoundingClientRect();new L({hostURL:t.hostURL,data:a.data[0].lst,expp:t.p,presize:{x:s.left+30,y:s.top+50,width:t.width,height:t.height},genome:t.genome,dsname:t.dsname,genename:e,samplecart:t.samplecart})})).catch((t=>{window.alert(t.message);if(t.stack)console.log(t.stack)}))}function U(t,e,a,s){const i=l({x:a,y:s});const o=t[e.key4annotation];i.header.text(o);const r=[];const h=e.annotation[o];for(const t in h){r.push({k:t,v:h[t]})}n(i.body,r)}function S(t){const e=t.pane.body.append("div").style("margin-bottom","10px");e.append("button").text("Cohort").on("click",(()=>{if(t.treediv.style("display")=="none"){g(t.treediv)}else{m(t.treediv)}}));e.append("button").text("Log10").on("click",(()=>{const e=700;t.uselog=!t.uselog;t.makescale_ep();t.epdotg.transition().duration(e).attr("transform",((e,a)=>"translate("+(t.uselog&&e.value==0?0:Math.max(0,t.x_scale(e.value)))+","+e._y+")"));for(const a of t.boxplots){a.vlines.transition().duration(e).attr("x1",(e=>Math.max(0,t.x_scale(e)))).attr("x2",(e=>Math.max(0,t.x_scale(e))));a.box.transition().duration(e).attr("x",Math.max(0,t.x_scale(a.percentile[25]))).attr("width",Math.max(0,t.x_scale(a.percentile[75]))-Math.max(0,t.x_scale(a.percentile[25])));a.hline.transition().duration(e).attr("x1",Math.max(0,t.x_scale(a.percentile[9]))).attr("x2",Math.max(0,t.x_scale(a.percentile[91])));a.connline.transition().duration(e).attr("x1",Math.max(0,t.x_scale(a.percentile[91]))).attr("x2",t.width+t.width2-a.labelwidth-t.width2_-3)}if(t.grab.x){let a=t.x_scale(t.grab.min),s=t.x_scale(t.grab.max);t.grab.x=a;t.grab.width=s-a;t.grab.shade.transition().duration(e).attr("transform","translate("+a+","+t.grab.y+")");t.grab.shadebox.transition().duration(e).attr("width",t.grab.width);t.grab.shadehandle2.transition().duration(e).attr("x",t.grab.width)}}));e.append("button").text("SVG").on("click",(()=>{x(t.svg.node(),t.genename+"_expression")}));e.append("button").text("Data").on("click",(()=>{const e=[t.p.sampletype,t.p.datatype];const a=[];if(t.p.attrlst){for(const s of t.p.attrlst){e.push(s.k);a.push(s.k)}}if(t.p.cohort){for(const s of t.p.cohort.levels){e.push(s.k);a.push(s.k)}}const s=[];for(const e of t.data){const i=[e[t.p.sampletype],e.value];for(const t of a){i.push(e[t]||"")}s.push(i.join("\t"))}u(t.genename+" "+t.p.name+" data",[{text:e.join("\t")+"\n"+s.join("\n")}])}));e.append("input").attr("placeholder","Sample").style("width","60px").style("margin-left","5px").on("keyup",(e=>{const a=e.target.value;if(a==""){t.epdot.attr("r",t.dotsize/2).attr("stroke","black").attr("stroke-opacity",X);return}const s=a.toLowerCase();const i=new Set;for(const e in t.sampletype2value){if(e.toLowerCase().indexOf(s)!=-1){i.add(e)}}t.epdot.filter((e=>i.has(e[t.p.sampletype]))).attr("r",t.dotsize).attr("stroke",t.p.hlcolor).attr("stroke-opacity",N);t.epdot.filter((e=>!i.has(e[t.p.sampletype]))).attr("r",t.dotsize/2).attr("stroke","black").attr("stroke-opacity",X)}));e.append("input").attr("placeholder","Gene").style("width","60px").style("margin-left","5px").on("keyup",(e=>{const a=e.target.value;if(e.code=="Enter"){Y(t,a);e.target.value="";return}}));if(t.p.gtexlink){e.append("span").html("&nbsp;<a target=_blank href=https://www.gtexportal.org/home/gene/"+t.genename+">GTeX normal</a>")}}export{L as default};
1
+ import{s as t}from"./legacy-d3-polyfill-bdb2d792.js";import{ah as e,aM as a,aL as s,r as i,I as o,d as r,a9 as n,a8 as h,Z as l,M as d,c1 as p,bY as c,ag as f,p as g,ac as m,U as x,ab as u}from"./app-6fb77603.js";import{d as b}from"./arc-3d6751aa.js";import{p as y}from"./partition-db811f6b.js";import{p as v}from"./pointer-c7475677.js";import{l as w}from"./log-c26b6cfd.js";import{c as k}from"./axis-747c801e.js";import"./constant-426a1483.js";import"./math-2fb199c6.js";function _(t,n,h){if(!t.p.cohort){return}t.grab.min=Math.min(n,h);t.grab.max=Math.max(n,h);let l=t.data.filter((e=>e.value>=t.grab.min&&e.value<=t.grab.max));if(l.length==0){if(t.grab.sun){t.grab.sun.g.remove()}return}if(t.p.cohort.annotation){const e=[];for(const a of l){const s={};for(const t in a){if(t!="circle"){s[t]=a[t]}}const i=t.p.cohort.annotation[a[t.p.sampletype]];if(i){for(const t in i){s[t]=i[t]}}e.push(s)}l=e}const d=t.grab;if(d.sun){d.sun.g.remove()}else{d.sun={x:0,y:0}}const p=d.sun;p.g=d.holder.append("g").attr("transform","translate("+p.x+","+p.y+")").on("mouseover",(()=>{t.dottip.hide()}));let c=0;for(const e of l){if(e[t.p.cohort.levels[0].k]!=undefined){c++}}if(c==0){p.g.append("text").text("0/"+l.length).attr("font-size",40).attr("font-family",e).attr("stroke","white").attr("stroke-width",3).attr("text-anchor","middle");p.g.append("text").text("0/"+l.length).attr("font-size",40).attr("font-family",e).attr("fill",t.p.hlcolor).attr("text-anchor","middle").attr("fill-opacity",.8).on("click",(()=>{M(p,d,t)}));return}if(t.samplecart){d.selectedsamples=l.map((t=>t.sample_name?t.sample_name:t.sample));t.samplecart.setBtns({samplelst:d.selectedsamples,basket:"Gene Expression",id:t.genename+(!t.grab||!l.length?"":" FPKM:"+t.grab.min+"-"+t.grab.max),container:t.samplecartWrapper,reselectable:true})}const f=Math.min(t.width,t.height)*.3;const g=p.g.append("g");let m;let x;const u=b().startAngle((t=>t.x0)).endAngle((t=>t.x1)).innerRadius((t=>{if(!t.parent){x=Math.sqrt(t.y1)-f/15;return x}return Math.sqrt(t.y0)})).outerRadius((t=>{t.outradius=Math.sqrt(t.y1);if(t.parent&&!t.parent.parent){m=t.outradius}return t.outradius}));const v=a(l,t.p.cohort.levels);const w=s()(v);w.sum((t=>t.value));w.sort(((t,e)=>e.value-t.value));y().size([Math.PI*2,f*f])(w);p.ring=p.g.selectAll().data(w.descendants()).enter().append("path").attr("d",u).attr("stroke","white").attr("fill-opacity",1).attr("fill-rule","evenodd").attr("fill",(e=>{if(!e.parent)return"white";let a;if(e.children){a=e.id}else{if(!e.parent.parent){a=e.id}else{a=e.parent.id}}e._color=t.p.cohort.suncolor(a);return e._color})).on("mouseover",((t,e)=>{if(!e.parent)return;D.text(e.data.name);C.text(e.data.name);L.text(e.value);Y.text(e.data.full||"");t.target.setAttribute("fill",i(e._color).darker(.5).toString())})).on("mouseout",((e,a)=>{D.text(d.min+" - "+d.max).attr("font-size",X);C.text(d.min+" - "+d.max).attr("font-size",X);L.text(c==l.length?l.length:c+"/"+l.length);Y.text(t.p.datatype);e.target.setAttribute("fill",a._color)})).on("click",((e,a)=>{if(!t.samplecart){return}const s=[];for(const t of a.data.lst){s.push(t.sample_name?t.sample_name:t.sample)}t.samplecart.setBtns({samplelst:s,basket:"Gene Expression",note:a.data.name+" samples with "+t.genename+" "+t.p.datatype+" between "+t.grab.min+" and "+t.grab.max,id:t.genename+(!t.grab||!a.data.lst.length||!a.data.lst[0]?"":" FPKM:"+t.grab.min+"-"+t.grab.max)+" "+a.data.lst[0].ancestor_dx,container:t.samplecartWrapper,reselectable:true})}));g.append("circle").attr("r",m).attr("fill","white").attr("fill-opacity",.7);const k=[],_=[],z=[],F=[];for(const t of w.leaves()){const e=(t.x0+t.x1)/2;if(e<=Math.PI/2)k.push(t);else if(e<=Math.PI)_.push(t);else if(e<=Math.PI*1.5)z.push(t);else F.push(t)}k.sort(((t,e)=>e.x0-t.x0));_.sort(((t,e)=>t.x0-e.x0));z.sort(((t,e)=>e.x0-t.x0));F.sort(((t,e)=>t.x0-e.x0));const j=[...k,..._,...z,...F];const B=[];const P=[];const A=Math.max(13,t.dotsize*.7);p.g.selectAll().data(j).enter().append("text").text((t=>(t.parent.data.name?t.parent.data.name=="root"?"":t.parent.data.name+", ":"")+t.data.name)).attr("font-size",A).attr("font-family",e).attr("stroke","white").attr("stroke-width",3).attr("fill","none").each((function(t){const e=this.getBBox().height;const a=(t.x0+t.x1)/2;let s=f+5;let i=-s*Math.cos(a);if(a<=Math.PI){let t=true;for(const o of P){if(i>=o[0]&&i<=o[1]){t=false;if(a<=Math.PI/2){i=o[0]-2;s=-i/Math.cos(a);o[0]=i-e}else{i=2+o[1];s=-i/Math.cos(a);o[1]=i+e}break}}if(t){if(a<=Math.PI/2){P.push([i-e,i])}else{P.push([i,i+e])}}}else{let t=true;for(const o of B){if(i>=o[0]&&i<=o[1]){t=false;if(a<=Math.PI*1.5){i=2+o[1];s=-i/Math.cos(a);o[1]=i+e}else{i=o[0]-2;s=-i/Math.cos(a);o[0]=i-e}break}}if(t){if(a<=Math.PI*1.5){B.push([i,i+e])}else{B.push([i-e,i])}}}t.labely=i;t.labelx=s*Math.sin(a)})).attr("x",(t=>t.labelx)).attr("y",(t=>t.labely)).attr("text-anchor",(t=>(t.x0+t.x1)/2<=Math.PI?"start":"end")).attr("dominant-baseline",(t=>{var e=(t.x0+t.x1)/2;if(e<=Math.PI/2||e>=Math.PI*1.5)return"";return"hanging"}));p.g.selectAll().data(j).enter().append("text").text((t=>(t.parent.parent?t.parent.data.name+", ":"")+t.data.name)).attr("font-size",A).attr("font-family",e).attr("fill","#858585").attr("x",(t=>t.labelx)).attr("y",(t=>t.labely)).attr("text-anchor",(t=>(t.x0+t.x1)/2<=Math.PI?"start":"end")).attr("dominant-baseline",(t=>{var e=(t.x0+t.x1)/2;if(e<=Math.PI/2||e>=Math.PI*1.5)return"";return"hanging"}));p.g.selectAll().data(j).enter().append("line").attr("x1",(t=>t.outradius*Math.sin((t.x0+t.x1)/2))).attr("y1",(t=>-t.outradius*Math.cos((t.x0+t.x1)/2))).attr("x2",(t=>t.labelx)).attr("y2",(t=>t.labely)).attr("stroke","#858585");const I=Math.max(18,x*.6);const R=Math.max(14,x*.2);let N=-3;let X;p.g.append("text").text(t.p.sampletype.toUpperCase()).attr("font-size",R).attr("font-family",e).attr("y",-I).attr("fill",t.p.hlcolor).attr("text-anchor","middle");const L=p.g.append("text").text(c==l.length?l.length:c+"/"+l.length).attr("font-size",I).attr("font-family",e).attr("y",N).attr("fill",t.p.hlcolor).attr("text-anchor","middle").attr("fill-opacity",.8);N=5;const Y=p.g.append("text").text(t.p.datatype).attr("font-size",R).attr("font-family",e).attr("y",N).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("fill","#b5b5b5");const U=d.min+" - "+d.max;const S=o().domain([5,15]).range([x,x*2]);const C=p.g.append("text").text(U).attr("font-size",1).each((function(){var t=this.getBBox();X=Math.min(S(U.length)/t.width,x*.4/t.height)})).attr("font-size",X).attr("font-family",e).attr("y",N+R).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("stroke","white").attr("stroke-width",3).attr("fill","none");const D=p.g.append("text").text(U).attr("font-size",X).attr("font-family",e).attr("y",N+R).attr("dominant-baseline","hanging").attr("text-anchor","middle").attr("fill","#858585");p.g.append("circle").attr("r",x+f/15).attr("fill","white").attr("fill-opacity",0).on("click",(()=>{if(p.busy)return;M(p,d,t)})).on("mousedown",(t=>{const e=p.x,a=p.y,s=t.clientX,i=t.clientY,o=r(document.body);o.on("mousemove",(t=>{t.preventDefault();p.busy=true;p.x=e+t.clientX-s;p.y=a+t.clientY-i;p.g.attr("transform","translate("+p.x+","+p.y+")")})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null);setTimeout((()=>p.busy=false),10)}))}))}function M(t,e,a){if(t.ring){t.ring.transition().attr("fill-opacity",0)}t.g.transition().attr("transform","scale(.5,.5)").on("end",(()=>{t.g.remove();e.shade.attr("transform","translate(0,1000)")}));e.shadebox.transition().duration(500).attr("stroke-opacity",0).attr("fill-opacity",0);e.shadehandle1.transition().duration(500).attr("fill-opacity",0);e.shadehandle2.transition().duration(500).attr("fill-opacity",0);delete e.x;if(a.selectsample_button){a.selectsample_button.style("display","none").text("")}}function z(t,a,s,i,o){for(const e of t.boxplots){if(e.id==i)return}o.style("border-color",t.boxcolor);for(const e of t.boxplots){e.highlight=false;e.label.attr("fill",t.boxcolor);e.label2.attr("fill",t.boxcolor)}let r=[[0,t.height]];for(const e of t.boxplots){const t=e.yoff;const a=e.height;for(const e of r){if(Math.max(t,e[0])<Math.min(t+a,e[1])){if(t+a<e[1]){r.push([t+a+1,e[1]])}e[1]=t-1}}}const h=t.sf_boxlabelfontsize(Math.log(a.length));const l=t.sf_boxheight(a.length);let d=0;for(const t of r){if(t[1]-t[0]>Math.max(l,h)){d=t[0]+3;break}}const p=t.boxbag.append("g").attr("transform","translate(0,"+d+")");const c={labeltext:s,lst:a,holder:p,yoff:d,highlight:false,id:i,handle:o,height:Math.max(l,h),lookuphash:{}};for(const e of a){c.lookuphash[e[t.p.sampletype]]=1}t.boxplots.push(c);const f=a[Math.floor((a.length-1)*.91)].value,g=a[Math.floor((a.length-1)*.75)].value,m=a[Math.floor((a.length-1)*.5)].value,x=a[Math.floor((a.length-1)*.25)].value,u=a[Math.floor((a.length-1)*.09)].value;c.percentile={9:f==0?1e-4:f,25:g==0?1e-4:g,50:m==0?1e-4:m,75:x==0?1e-4:x,91:u==0?1e-4:u};c.hline=p.append("line").attr("y1",l/2).attr("y2",l/2).attr("stroke",t.boxcolor).attr("stroke-dasharray","5,3").attr("shape-rendering","crispEdges");c.hline.transition().duration(t.dur).attr("x1",Math.max(0,t.x_scale(f))).attr("x2",Math.max(0,t.x_scale(u)));c.label=p.append("text").attr("y",l/2).attr("font-size",h).attr("font-family",e).attr("text-anchor","end").attr("dominant-baseline","middle").attr("fill",c.highlight?t.p.hlcolor:t.boxcolor).style("cursor","default").text(s).on("mousedown",(e=>B(t,c,e))).on("click",(()=>j(t,c))).each((function(){c.labelwidth=this.getBBox().width})).attr("x",t.width+t.width2+c.labelwidth);c.label.transition().duration(t.dur).attr("x",t.width+t.width2-t.width2_-3);c.label2=p.append("text").attr("x",t.width+t.width2+c.labelwidth).attr("y",l/2).attr("font-size",h).attr("font-family",e).attr("dominant-baseline","middle").attr("fill",c.highlight?t.p.hlcolor:t.boxcolor).style("cursor","default").text(a.length).on("mousedown",(()=>B(t,c))).on("click",(()=>j(t,c)));c.label2.transition().duration(t.dur).attr("x",t.width+t.width2-t.width2_+3);c.connline=p.append("line").attr("y1",l/2).attr("y2",l/2).attr("stroke",t.boxcolor).attr("stroke-dasharray","1,3").attr("shape-rendering","crispEdges");c.connline.transition().duration(t.dur).attr("x1",Math.max(0,t.x_scale(c.percentile[91]))).attr("x2",Math.max(0,t.width+t.width2-c.labelwidth-t.width2_-3));c.box=p.append("rect").attr("height",l).attr("shape-rendering","crispEdges").attr("fill","white").attr("stroke",t.boxcolor).on("click",(()=>F(t,c))).on("mousedown",(t=>{const e=t.target;e.setAttribute("fill","#FFeeee");e.setAttribute("stroke","#D10000")})).on("mouseover",(e=>{t.dottip.show(e.clientX,e.clientY).clear();const a=[{k:"Group",v:c.labeltext||"All samples"},{k:"1st quartile",v:c.percentile[25]},{k:"Median",v:c.percentile[50]},{k:"3rd quartile",v:c.percentile[75]}];n(t.dottip.d.append("div"),a)})).on("mouseout",(()=>{t.dottip.hide()}));c.box.transition().duration(t.dur).attr("x",Math.max(0,t.x_scale(c.percentile[25]))).attr("width",Math.max(0,t.x_scale(c.percentile[75]))-Math.max(0,t.x_scale(c.percentile[25])));c.vlines=p.selectAll().data([c.percentile[9],c.percentile[25],c.percentile[50],c.percentile[75],c.percentile[91]]).enter().append("line").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",l).attr("stroke",t.boxcolor).attr("shape-rendering","crispEdges");c.vlines.transition().duration(t.dur).attr("x1",(e=>Math.max(0,t.x_scale(e)))).attr("x2",(e=>Math.max(0,t.x_scale(e))));if(s!=""){j(t,c)}}function F(t,e){let a=null;if(typeof e=="object"){a=e}else{for(const s of t.boxplots){if(s.id==e)a=s}}if(!a){console.log("cannot remove boxplot");return}a.handle.style("border-color","transparent");if(a.label.attr("fill")==t.p.hlcolor){j(t,a)}a.holder.transition().attr("transform","translate("+(t.width+20)+","+a.yoff+")").each((()=>a.holder.remove()));for(let e=0;e<t.boxplots.length;e++){if(t.boxplots[e].id==a.id){t.boxplots.splice(e,1);return}}}function j(t,e){if(t.busy)return;for(const a of t.boxplots){if(a.id!=e.id)a.highlight=false}e.highlight=!e.highlight;t.epdot.transition().duration(1e3).attr("r",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?t.dotsize*.7:t.dotsize/2;return e.highlight?t.dotsize*.2:t.dotsize/2})).attr("stroke",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?t.p.hlcolor:"black";return"black"})).attr("stroke-opacity",(a=>{if(a[t.p.sampletype]in e.lookuphash)return e.highlight?.4:.2;return e.highlight?.1:.2}));for(const e of t.boxplots){e.label.attr("fill",e.highlight?t.p.hlcolor:t.boxcolor);e.label2.attr("fill",e.highlight?t.p.hlcolor:t.boxcolor)}}function B(t,e,a){a.preventDefault();const s=a.clientY,i=e.yoff;const o=r(document.body);o.on("mousemove",(a=>{t.busy=true;e.yoff=i+a.clientY-s;e.holder.attr("transform","translate(0,"+e.yoff+")")})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null);setTimeout((()=>t.busy=false),100)}))}const P=300,A=500,I=400,R=700;const N=.6;const X=.2;class L{constructor(i){this.p=i.expp;if(this.p.cohort){if(!this.p.cohort.suncolor){this.p.cohort.suncolor=h(t)}}this.boxcolor="#006600";this.boxplots=[];this.const_all="All "+this.p.sampletype+"s";this.uselog=false;this.dotmoved=false;this.genename=i.genename;this.presize=i.presize;this.dsname=i.dsname;this.genome=i.genome;this.hostURL=i.block?i.block.hostURL:i.hostURL;this.samplecart=i.samplecart;if(i.block){const t=i.block.holder.node().getBoundingClientRect();this.presize={x:t.left+i.block.leftheadw+i.block.width+20,y:t.top,width:Math.min(A,Math.max(P,document.body.scrollWidth-t.left-t.width-100)),height:Math.min(R,Math.max(I,document.body.clientHeight-270))}}this.source=i.source;this.data=i.data;this.data.sort(((t,e)=>e.value-t.value));this.minvalue=0;this.maxvalue=0;if(this.data.length>0){this.minvalue=this.maxvalue=this.data[0].value}this.sampletype2value={};for(const t of this.data){const e=t.value;this.minvalue=Math.min(this.minvalue,e);this.maxvalue=Math.max(this.maxvalue,e);this.sampletype2value[t[this.p.sampletype]]=e}if(this.p.scaleminvalue!=undefined){this.minvalue=this.p.scaleminvalue}this.pane=l({x:this.presize.x,y:this.presize.y});this.pane.pane.classed("sja_ep_pane",true);this.dottip=new d({padding:"10px"});if(i.block){const t=r(this.pane.header.node().previousSibling);t.on("click",(()=>{this.epaintfold(i.block)}))}this.pane.body.style("padding","10px");const c=t=>{this.pane.body.append("p").text(t)};if(this.data.length==0){this.pane.header.text(this.p.name);c("No expression data for "+this.genename);return}this.pane.header.text(this.genename+" "+this.p.name+(this.dsname?" from "+this.dsname:""));S(this);this.treediv=this.pane.body.append("div").style("display","none").style("margin","20px 0px 30px 0px").style("padding","10px").style("background-color","#FFFFE8");this.treediv.append("div").style("font-size",".7em").style("color","#858585").style("text-align","center").text("Click on a row to show/hide boxplot");this.svg=this.pane.body.append("svg");if(this.samplecart){this.samplecartWrapper=this.pane.body.append("div");this.samplecart.setBtns({samplelst:this.grab&&this.grab.selectedsamples?this.grab.selectedsamples:[],basket:"Gene Expression",id:this.genename+(!this.grab?"":" FPKM:"+this.grab.min+"-"+this.grab.max),container:this.samplecartWrapper,reselectable:true,replaceable:false})}this.pane.body.append("div").style("text-align","right").append("span").text("drag to resize").attr("font-size",".8em").attr("font-family",e).attr("class","sja_clbtext").on("mousedown",(t=>{t.preventDefault();const e=t.clientX;const a=t.clientY;const s=this.width;const i=this.height;const o=r(document.body);o.on("mousemove",(t=>{this.render(s+t.clientX-e,i+t.clientY-a)}));o.on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null)}))}));this.sf_boxheight=o().domain([0,this.data.length]);this.sf_boxlabelfontsize=o();this.boxplots=[];if(this.svgg){this.svgg.remove()}this.svgg=this.svg.append("g");this.axisg=this.svgg.append("g");this.grabbar=this.svgg.append("rect").attr("x",0).attr("y",0).attr("fill","white").attr("fill-opacity",0).on("mousedown",(t=>{if(!this.p.cohort){console.log("no .p.cohort");return}this.busy=true;const e=v(t,this.grabbar.node())[0];const a=Number.parseFloat(this.x_scale.invert(e).toFixed(1));this.grab.x=e;this.grab.width=1;this.grab.shade.attr("transform","translate("+e+","+this.grab.y+")");this.grab.shadebox.attr("width",2).attr("height",this.grab.height).attr("stroke-opacity",.7).attr("fill-opacity",.1);this.grab.shadehandle1.attr("fill-opacity",.5);this.grab.shadehandle2.attr("x",2).attr("fill-opacity",.5);_(this,a,Number.parseFloat(this.x_scale.invert(e+1).toFixed(1)));const s=r(document.body);s.on("mousemove",(t=>{t.preventDefault();let s=v(t,this.grabbar.node())[0];s=Math.max(-this.dotsize,s);s=Math.min(this.width+this.dotsize,s);this.grab.width=Math.max(1,Math.abs(s-e));this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);if(s<e){this.grab.x=s;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")")}_(this,a,Number.parseFloat(this.x_scale.invert(s).toFixed(1)))}));s.on("mouseup",(()=>{this.busy=false;s.on("mousemove",null).on("mouseup",null)}))}));this.verticalline=this.svgg.append("line").attr("stroke",this.boxcolor).attr("stroke-opacity",.1).attr("shape-rendering","crispEdges");this.dur=2e3;this.boxbag=this.svgg.append("g");this.graph=this.svgg.append("g");this.sung=this.svgg.append("g");this.grab={shade:this.sung.append("g"),holder:this.sung.append("g")};this.grab.shadebox=this.grab.shade.append("rect").attr("stroke",this.p.hlcolor).attr("stroke-width",1).attr("fill",this.p.hlcolor).style("cursor","move").on("mousedown",(t=>{if(!this.p.cohort){return}this.busy=true;let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.x+=a-e;e=a;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")");_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.grab.shadehandle1=this.grab.shade.append("rect").attr("x",-5).attr("width",5).attr("height",40).attr("fill",this.p.hlcolor).attr("fill-opacity",0).style("cursor","ew-resize").on("mousedown",(t=>{this.busy=true;let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.width+=e-a;if(this.grab.width<=0){this.grab.width-=e-a;return}this.grab.x+=a-e;e=a;this.grab.shade.attr("transform","translate("+this.grab.x+","+this.grab.y+")");this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.grab.shadehandle2=this.grab.shade.append("rect").attr("x",0).attr("width",5).attr("height",40).attr("fill",this.p.hlcolor).attr("fill-opacity",0).style("cursor","ew-resize").on("mousedown",(t=>{let e=t.clientX;const a=r(document.body);a.on("mousemove",(t=>{t.preventDefault();const a=t.clientX;this.grab.width+=a-e;if(this.grab.width<=0){this.grab.width-=a-e;return}e=a;this.grab.shadebox.attr("width",this.grab.width);this.grab.shadehandle2.attr("x",this.grab.width);_(this,Number.parseFloat(this.x_scale.invert(this.grab.x).toFixed(1)),Number.parseFloat(this.x_scale.invert(this.grab.x+this.grab.width).toFixed(1)))})).on("mouseup",(()=>{this.busy=false;a.on("mousemove",null).on("mouseup",null)}))}));this.epdotg=this.graph.selectAll().data(this.data).enter().append("g");this.epdot=this.epdotg.append("circle").attr("fill",this.p.hlcolor).attr("fill-opacity",0).attr("stroke","black").attr("stroke-width",2).attr("stroke-opacity",X).each((function(t){t.circle=this})).on("mouseover",((t,e)=>{if(this.busy)return;e.circle.setAttribute("transform","scale(1.5)");this.dottip.clear();const a=[{k:this.p.datatype,v:'<span style="font-size:150%">'+e.value+"</span>"}];if(this.p.attrlst){for(const t of this.p.attrlst){a.push({k:t.label||t.k,v:e[t.k]})}}const s=this.getsampleinfo(e,a);n(this.dottip.d,a).style("zoom",.7);this.dottip.show(t.clientX,t.clientY);if(s){this.dottip.d.append("div").text("Full details").attr("class","sja_menuoption").on("click",(()=>{U(e,this.p.cohort,t.clientX-100,t.clientY-100)}))}})).on("mouseout",((t,e)=>{e.circle.setAttribute("transform","scale(1)")})).on("mousedown",((t,e)=>{t.preventDefault();const a=t.clientY;const s=r(document.body);const i=this.data[Math.floor(this.data.length/2)].value;if(e.value<i){const t=this.dotgraph_y;s.on("mousemove",(e=>{this.busy=true;this.dotmoved=true;this.dotgraph_y=t+e.clientY-a;this.graph.attr("transform","translate(0,"+this.dotgraph_y+")")}))}else{const t=this.heightmove;s.on("mousemove",(e=>{this.dotmoved=true;this.heightmove=t+a-e.clientY;const s=this.heightmove/this.data.length;this.epdotg.attr("transform",((t,e)=>{t._y=this.height-this.heightmove+e*s;return"translate("+Math.max(0,this.x_scale(t.value))+","+t._y+")"}))}))}s.on("mouseup",(()=>{setTimeout((()=>this.busy=false),50);s.on("mousemove",null).on("mouseup",null)}))}));this.render();const f=this.treediv.append("div").style("margin","10px").style("padding","2px").style("border","solid 1px transparent").html("All samples&nbsp;&nbsp;"+this.data.length).attr("class","sja_clb").on("click",(()=>{let t=true;for(const e of this.boxplots){if(e.id=="all")t=false}if(t){z(this,this.data,"","all",f)}else{F(this,"all")}}));if(this.p.cohort){if(this.p.cohort&&this.p.cohort.annotation&&this.p.cohort.key4annotation){for(const t of this.data){const e=t[this.p.cohort.key4annotation];if(e){const a=this.p.cohort.annotation[e];if(a){if(this.p.cohort.levels){for(const e of this.p.cohort.levels){t[e.k]=a[e.k];if(e.full){t[e.full]=a[e.full]}}}else{for(const e in a){t[e]=a[e]}}}}}}const t=this.treediv.append("div").style("margin","10px").style("height","400px").style("overflow-y","scroll").style("resize","vertical");const e=a(this.data,this.p.cohort.levels);const i=p(s()(e));i.sum((t=>t.value));i.eachBefore((e=>{if(!e.parent)return;const a=t.append("div").style("margin","2px").style("padding","2px").style("border","solid 1px transparent").attr("class","sja_clb");for(let t=1;t<e.depth;t++){a.append("span").style("color","#ccc").style("padding","0px 15px").text("|")}const s=e.data.data;a.append("span").html(s.name+"&nbsp;");if(s.full){a.append("span").html(s.full+"&nbsp;").style("font-size",".7em").style("color","#858585")}if(s.lst&&s.lst.length){a.append("span").text(s.lst.length);a.on("click",(()=>{let t=true;for(const e of this.boxplots){if(e.id==s.id)t=false}if(t){z(this,s.lst,s.name,s.id,a)}else{F(this,s.id)}}))}}))}else{this.treediv.append("div").style("margin","10px").text("Cannot stratify sample: no cohort information.")}z(this,this.data,"","all",f)}epaintfold(t){if(!this.handle){const e=this.genome.datasets[this.dsname];if(!e){alert("invalid dataset name: "+this.dsname);return}this.handle=t.ds2handle[this.dsname].handle.append("div").classed("sja_opaque8",true).style("background-color","#999").style("color","white").style("padding","2px 4px").style("margin-left","1px").text("e");this.handle.on("click",(()=>{this.pane.pane.style("display","block");c(this.handle,this.pane.pane);this.handle.style("display","none")}))}this.handle.style("display","inline-block");c(this.pane.pane,this.handle);this.pane.pane.style("display","none")}makescale_ep(){const t=this.axish-2;if(this.uselog){this.x_scale=w().domain([1,this.maxvalue]).range([0,this.width])}else{this.x_scale=o().domain([this.minvalue,this.maxvalue]).range([0,this.width])}const e=k().scale(this.x_scale).tickSizeInner(this.tickh);if(this.uselog){e.ticks(6,",.0f")}else{let a;this.axisg.append("text").text(Math.ceil(this.maxvalue)).attr("font-size",t-this.tickh).each((function(){a=this.getBBox().width})).remove();e.ticks(Math.floor(this.width/(a+20)))}if(this.axis){this.axis.remove()}this.axis=this.axisg.append("g").attr("transform","translate(0,"+t+")").call(e);f({axis:this.axis,fontsize:t-this.tickh,showline:true})}render(t,a){if(!t){t=this.presize.width;a=this.presize.height}this.width=t;this.width2=t*.05;this.dotsize=Math.max(13,t/30);this.height=a;this.sf_boxheight.range([10,this.height/8]);const s=Math.min(this.data.length*.7,300);this.sf_boxlabelfontsize.domain([0,Math.log(s),Math.log(this.data.length)]).range([8,this.sf_boxheight(s)/2,1+this.sf_boxheight(s)/2]);this.heightmove=this.height;this.rowheight_reset();this.svgg.attr("transform","translate("+this.dotsize+",0)");this.axish=Math.max(18,this.width*.04);this.tickh=this.axish*.3;this.makescale_ep();this.grabbar.attr("width",this.width);this.grabbar.attr("height",this.axish);const i=this.svgg.append("text").text(this.data.length).attr("font-family",e).attr("font-size",this.sf_boxlabelfontsize(Math.log(this.data.length)));this.width2_=i.node().getBBox().width+3;i.remove();const o=this.svgg.append("text").text("COUNT").attr("font-size",1).attr("font-family",e);const r=Math.max(8,(this.width2_-3)/o.node().getBBox().width);o.remove();this.axispad=5+r+this.dotsize/2;this.verticalline.attr("x1",this.width+this.width2-this.width2_).attr("y1",this.axish+5).attr("x2",this.width+this.width2-this.width2_).attr("y2",this.axish+this.height+this.axispad);this.dotgraph_y=this.axish+this.axispad;this.dotgraph_y_default=this.dotgraph_y;this.boxbag.attr("transform","translate(0,"+this.dotgraph_y+")");this.graph.attr("transform","translate(0,"+this.dotgraph_y+")");this.sung.attr("transform","translate(0,"+this.dotgraph_y+")");this.grab.y=-this.dotgraph_y-10;this.grab.height=this.height+this.dotgraph_y+30;this.grab.holder.attr("transform","translate("+this.width/2+","+this.height/2+")");this.grab.shadehandle1.attr("y",12+this.axish);this.grab.shadehandle2.attr("y",12+this.axish);this.epdotg.attr("transform",((t,e)=>{t._y=e*this.rowheight;return"translate(0,"+t._y+")"}));this.epdot.attr("r",this.dotsize/2);this.epdotg.attr("transform",(t=>"translate("+Math.max(0,this.x_scale(t.value))+","+t._y+")"));if(this.grab.x){let t=this.x_scale(this.grab.min),e=this.x_scale(this.grab.max);this.grab.x=t;this.grab.width=e-t;this.grab.shade.attr("transform","translate("+t+","+this.grab.y+")");this.grab.shadebox.attr("width",this.grab.width).attr("height",this.grab.height);this.grab.shadehandle2.attr("x",this.grab.width);_(this,this.grab.min,this.grab.max)}for(const t of this.boxplots){const e=this.sf_boxlabelfontsize(Math.log(t.lst.length));const a=this.sf_boxheight(t.lst.length);t.holder.attr("transform","translate(0,"+t.yoff+")");t.hline.attr("y1",a/2).attr("y2",a/2).attr("x1",Math.max(0,this.x_scale(t.percentile[9]))).attr("x2",Math.max(0,this.x_scale(t.percentile[91])));t.label.attr("x",this.width+this.width2-this.width2_-3).attr("y",a/2).attr("font-size",e);t.label2.attr("x",this.width+this.width2-this.width2_+3).attr("y",a/2).attr("font-size",e);t.connline.attr("y1",a/2).attr("y2",a/2).attr("x1",Math.max(0,this.x_scale(t.percentile[91]))).attr("x2",Math.max(0,this.width+this.width2-t.labelwidth-this.width2_-3));t.box.attr("height",a).attr("x",Math.max(0,this.x_scale(t.percentile[25]))).attr("width",Math.max(0,this.x_scale(t.percentile[75]))-Math.max(0,this.x_scale(t.percentile[25])));t.vlines.attr("x1",(t=>Math.max(0,this.x_scale(t)))).attr("x2",(t=>Math.max(0,this.x_scale(t)))).attr("y1",0).attr("y2",a)}this.svg.attr("width",this.width+this.width2+this.dotsize).attr("height",this.height+this.axish+this.axispad+this.dotsize/2)}getsampleinfo(t,e){if(this.p.cohort){if(this.p.cohort.annotation&&this.p.cohort.key4annotation){const a=t[this.p.cohort.key4annotation];if(a){e.push({k:this.p.cohort.key4annotation,v:a});const t=this.p.cohort.annotation[a];if(t){let a=0;for(const e in t)a++;if(this.p.cohort.levels){for(const a of this.p.cohort.levels){e.push({k:a.label||a.k,v:t[a.k]==undefined?"":t[a.k]})}return a>this.p.cohort.levels.length}let s=0;for(const i in t){e.push({k:i,v:t[i]});if(++s==a)return true}return false}}}else if(this.p.cohort.levels){for(const a of this.p.cohort.levels){const s=t[a.k];if(!s)continue;e.push({k:a.label||a.k,v:t[a.k]+(a.full?t[a.full]?' <span style="font-size:.8em;color:#858585">'+t[a.full]+"</span>":"":"")})}return false}}for(const a in t){if(a=="circle"||a=="_y")continue;if(typeof a=="string"){const s=t[a];if(s){e.push({k:a,v:s})}}}return false}rowheight_reset(){if(this.data){this.rowheight=this.height/this.data.length;return}this.rowheight=0}dot_appendtext(t,a){const s=[];t.append("text").text((t=>a.get(t[this.p.sampletype]))).attr("font-family",e).attr("font-size",this.dotsize).each((function(t){t.bb=this.getBBox()})).each((t=>{const e=this.x_scale(t.value);const a=e-this.dotsize>t.bb.width;let i=t._y-t.bb.height/2,o=i+t.bb.height;for(const e of s){if(e.onleft==a&&Math.max(e.y1,i)<Math.min(e.y2,o)){i=e.y2;o=i+t.bb.height}}delete t.bb;t.mafrect={y1:i,y2:o,onleft:a};s.push(t.mafrect)})).attr("class","sja_svgtext").attr("dominant-baseline","central").attr("fill",this.p.hlcolor).attr("text-anchor",(t=>t.mafrect.onleft?"end":"start")).attr("x",(t=>(t.mafrect.onleft?-1:1)*this.dotsize)).attr("y",(t=>t.mafrect.y1-t._y+this.dotsize/2)).on("click",((t,e)=>{r(e.circle).attr("stroke-width",1).attr("stroke-opacity",X).attr("stroke","black").attr("r",this.dotsize/2);e.showtext=false;r(t.target).remove()})).attr("font-size",1).transition().attr("font-size",this.dotsize)}may_hl(t,e){if(!this.data)return;const a=new Set;let s=true;for(const e of t){const t=e[this.p.sampletype];if(!t)continue;a.add(t);if(this.sampletype2value[t]){s=false}}if(s)return;this.epdot.filter((t=>a.has(t[this.p.sampletype]))).attr("r",e?this.dotsize*.8:this.dotsize/2).attr("stroke",e?this.p.hlcolor:"black").attr("stroke-opacity",e?N:X);const i=this.p.maf;if(!i)return;const o=new Map;for(const e of t){const t=e[this.p.sampletype];const a=this.p.maf.get(e);if(!a)continue;if(typeof a=="string"){o.set(t,a)}else{o.set(t,a.v2==0?"No "+this.p.maf.label+": site not covered":this.p.maf.label+": "+(a.f*100).toFixed(0)+"% ("+a.v1+"/"+a.v2+")")}}const r=this.epdotg.filter((t=>o.has(t[this.p.sampletype])&&!t.showtext));if(e){this.dot_appendtext(r,o)}else{r.select("text").remove()}}}function Y(t,e){const a=t.genome.datasets[t.dsname];if(a.dbexpression){const s={db:a.dbexpression.dbfile,tablename:a.dbexpression.tablename,keyname:a.dbexpression.keyname,key:e};fetch(new Request(t.hostURL+"/dbdata",{method:"POST",body:JSON.stringify(s)})).then((t=>t.json())).then((s=>{if(s.error)throw{message:s.error};if(a.dbexpression.tidy){a.dbexpression.tidy(s.rows)}const i=t.pane.pane.node().getBoundingClientRect();new L({hostURL:t.hostURL,data:s.rows,expp:t.p,presize:{x:i.left+30,y:i.top+50,width:t.width,height:t.height},genome:t.genome,dsname:t.dsname,genename:e,samplecart:t.samplecart})})).catch((t=>{window.alert(t.message);if(t.stack)console.log(t.stack)}));return}fetch(new Request(t.hostURL+"/dsdata",{method:"POST",body:JSON.stringify({genome:t.genome.name,dsname:t.dsname,expressiononly:1,genename:e})})).then((t=>t.json())).then((a=>{if(a.error)throw{message:a.error};const s=t.pane.pane.node().getBoundingClientRect();new L({hostURL:t.hostURL,data:a.data[0].lst,expp:t.p,presize:{x:s.left+30,y:s.top+50,width:t.width,height:t.height},genome:t.genome,dsname:t.dsname,genename:e,samplecart:t.samplecart})})).catch((t=>{window.alert(t.message);if(t.stack)console.log(t.stack)}))}function U(t,e,a,s){const i=l({x:a,y:s});const o=t[e.key4annotation];i.header.text(o);const r=[];const h=e.annotation[o];for(const t in h){r.push({k:t,v:h[t]})}n(i.body,r)}function S(t){const e=t.pane.body.append("div").style("margin-bottom","10px");e.append("button").text("Cohort").on("click",(()=>{if(t.treediv.style("display")=="none"){g(t.treediv)}else{m(t.treediv)}}));e.append("button").text("Log10").on("click",(()=>{const e=700;t.uselog=!t.uselog;t.makescale_ep();t.epdotg.transition().duration(e).attr("transform",((e,a)=>"translate("+(t.uselog&&e.value==0?0:Math.max(0,t.x_scale(e.value)))+","+e._y+")"));for(const a of t.boxplots){a.vlines.transition().duration(e).attr("x1",(e=>Math.max(0,t.x_scale(e)))).attr("x2",(e=>Math.max(0,t.x_scale(e))));a.box.transition().duration(e).attr("x",Math.max(0,t.x_scale(a.percentile[25]))).attr("width",Math.max(0,t.x_scale(a.percentile[75]))-Math.max(0,t.x_scale(a.percentile[25])));a.hline.transition().duration(e).attr("x1",Math.max(0,t.x_scale(a.percentile[9]))).attr("x2",Math.max(0,t.x_scale(a.percentile[91])));a.connline.transition().duration(e).attr("x1",Math.max(0,t.x_scale(a.percentile[91]))).attr("x2",t.width+t.width2-a.labelwidth-t.width2_-3)}if(t.grab.x){let a=t.x_scale(t.grab.min),s=t.x_scale(t.grab.max);t.grab.x=a;t.grab.width=s-a;t.grab.shade.transition().duration(e).attr("transform","translate("+a+","+t.grab.y+")");t.grab.shadebox.transition().duration(e).attr("width",t.grab.width);t.grab.shadehandle2.transition().duration(e).attr("x",t.grab.width)}}));e.append("button").text("SVG").on("click",(()=>{x(t.svg.node(),t.genename+"_expression")}));e.append("button").text("Data").on("click",(()=>{const e=[t.p.sampletype,t.p.datatype];const a=[];if(t.p.attrlst){for(const s of t.p.attrlst){e.push(s.k);a.push(s.k)}}if(t.p.cohort){for(const s of t.p.cohort.levels){e.push(s.k);a.push(s.k)}}const s=[];for(const e of t.data){const i=[e[t.p.sampletype],e.value];for(const t of a){i.push(e[t]||"")}s.push(i.join("\t"))}u(t.genename+" "+t.p.name+" data",[{text:e.join("\t")+"\n"+s.join("\n")}])}));e.append("input").attr("placeholder","Sample").style("width","60px").style("margin-left","5px").on("keyup",(e=>{const a=e.target.value;if(a==""){t.epdot.attr("r",t.dotsize/2).attr("stroke","black").attr("stroke-opacity",X);return}const s=a.toLowerCase();const i=new Set;for(const e in t.sampletype2value){if(e.toLowerCase().indexOf(s)!=-1){i.add(e)}}t.epdot.filter((e=>i.has(e[t.p.sampletype]))).attr("r",t.dotsize).attr("stroke",t.p.hlcolor).attr("stroke-opacity",N);t.epdot.filter((e=>!i.has(e[t.p.sampletype]))).attr("r",t.dotsize/2).attr("stroke","black").attr("stroke-opacity",X)}));e.append("input").attr("placeholder","Gene").style("width","60px").style("margin-left","5px").on("keyup",(e=>{const a=e.target.value;if(e.code=="Enter"){Y(t,a);e.target.value="";return}}));if(t.p.gtexlink){e.append("span").html("&nbsp;<a target=_blank href=https://www.gtexportal.org/home/gene/"+t.genename+">GTeX normal</a>")}}export{L as default};
@@ -1 +1 @@
1
- import{h as t,P as e,M as s}from"./app-2cd97738.js";import{f as o,i as a}from"./termsetting-ad8c4f3a.js";import{controlsInit as i}from"./controls-3c1691d7.js";import{s as r}from"./select2Terms-d4f6ed9e.js";import{b as l,a as n,d as c}from"./recover-74f2e965.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./controls.btns-5b1240c8.js";import"./controls.config-81cd5749.js";import"./FilterRxComp-0f35b322.js";import"./table-f50a9344.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-01e8cce6.js";import"./FilterStateless-b1c6ee04.js";import"./app-686b9547.js";import"./termInfo-d0a9e65f.js";import"./toggleButtons-04c5ad7c.js";import"./genesearch-41cb55ce.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";class p{constructor(t){this.type="facet";const e=t.holder;const o=e.append("div").style("display","inline-block");const a=e.append("div").style("display","inline-block");this.dom={holder:t.holder.style("padding","20px"),header:t.header,controlsHolder:o,mainDiv:a,tip:t.tip||new s}}async init(t){await this.setControls()}getState(t){const e=t.plots.find((t=>t.id===this.id));if(this.dom.header)this.dom.header.html(`${e.columnTw.term.name} <span style="font-size:.8em">(COLUMN)</span> ${e.rowTw.term.name} <span style="font-size:.8em">(ROW) &nbsp; FACET TABLE</span>`);return{config:e,vocab:t.vocab,termfilter:t.termfilter,groups:t.groups}}async main(){this.config=JSON.parse(JSON.stringify(this.state.config));await this.renderTable()}async renderTable(){const t=this.config;this.dom.mainDiv.selectAll("*").remove();this.dom.tip.clear().hide();const e=this.dom.mainDiv.append("table");const s=e.append("tbody");const o=s.append("tr").style("text-align","center");o.append("th");const a=this.app.vocabApi.hasVerifiedToken();if(a){e.style("border-spacing","0px");const{result:a,categories:i,categories2:r}=await this.getSampleTableData(t);if(!i.length||!r.length){this.showNoSampleMessage(this.dom.mainDiv);return}for(const e of i){const s=t.columnTw.term.values?.[e]?.label||e;this.addHeader(o,s)}this.renderSampleTable(s,t,a,i,r)}else{e.style("border-spacing","5px");const{rows:a,filteredCols:i}=await this.getStaticTableData(t);if(!a.size||!i.length){this.showNoSampleMessage(this.dom.mainDiv);return}for(const e of i){const s=t.columnTw.term.values?.[e.seriesId]?.label||e.seriesId;this.addHeader(o,s)}this.renderStaticTable(s,t,a,i)}}renderSampleTable(t,e,s,o,a){const i={};for(const n of a){i[n]={};const c=t.append("tr");const p=e.rowTw.term.values?.[n]?.label||n;this.addRowLabel(c,p);for(const p of o){const d=s.lst.filter((t=>t[e.columnTw.$id]?.key==p&&t[e.rowTw.$id]?.key==n));i[n][p]={samples:d,selected:false};const m=c.append("td");if(!d.length)m.classed("highlightable-cell",true);if(d.length>0){const e=o.indexOf(p)+2;m.classed("sja_menuoption",true).style("text-align","center").style("border","2.5px solid white").text(d.length).on("mouseover",(()=>{this.highlightColRow(t,c,e,"#fffec8")})).on("mouseout",(()=>{this.highlightColRow(t,c,e,"transparent")})).on("click",(()=>{const t=i[n][p].selected=!i[n][p].selected;if(t){m.style("border","1px solid blue")}else{m.style("border","2.5px solid white")}for(const t of a){for(const e of o){if(i[t][e].selected){l.style("display","");r.text("Choose how to use samples:");return}}}l.style("display","none");r.text("Click on cells to select samples")}))}}}const r=this.dom.mainDiv.append("div").attr("data-testid","sjpp-facet-start-prompt").style("margin","20px 0px 0px 15px").style("opacity","0.7").text("Click on cells to select samples");const l=this.dom.mainDiv.append("div").style("margin","20px 0px 0px 25px").style("display","none");const n=[{text:"Show samples view",callback:()=>{const t=this.getSelectedSamples(o,a,i);this.app.dispatch({type:"plot_create",config:{chartType:"sampleView",samples:t.map((t=>({sampleId:t.sample,sampleName:s.refs.bySampleId[t.sample].label})))}})}},{text:"List samples",callback:()=>{const t=this.getSelectedSamples(o,a,i);const r=t.map((t=>[s.refs.bySampleId[t.sample].label,t[e.columnTw.$id].key,t[e.rowTw.$id].key]));this.dom.tip.clear().showunder(l.node());const n=this.dom.tip.d.append("table").append("tbody");const c=n.append("tr").style("text-align","center");c.append("th").text("Sample");c.append("th").text(e.columnTw.term.name);c.append("th").text(e.rowTw.term.name);for(const t of r){const e=n.append("tr");e.append("td").text(t[0]);e.append("td").text(t[1]);e.append("td").text(t[2])}}},{text:"Create group",callback:()=>{this.addGroup(o,a,i)}}];for(const t of n){this.addBtn(l,t)}}highlightColRow=(t,e,s,o)=>{t.selectAll(`td.highlightable-cell:nth-child(${s})`).style("background-color",`${o}`).style("border",`2.5px solid ${o}`);t.select(`th:nth-child(${s})`).style("background-color",`${o}`).style("border",`2.5px solid ${o}`);e.style("background-color",`${o}`)};addBtn(t,e){return t.append("button").classed("sja_menuoption",true).style("padding","0px 10px").style("margin","0px 5px").text(e.text).on("click",e.callback)}addGroup(t,e,s){const o={name:"Group",items:this.getSelectedSamples(t,e,s)};const a=l(n([o]));c(this.app,a,this.state.groups);return a}getSelectedSamples(t,e,s){const o=[];for(const a of e){for(const e of t){if(s[a][e].selected){o.push(...s[a][e].samples)}}}return o}async getSampleTableData(t){const e=await this.app.vocabApi.getAnnotatedSampleData({filter:this.state.termfilter.filter,terms:[t.columnTw,t.rowTw]});const s=this.getCategories(t.columnTw,e.lst);const o=this.getCategories(t.rowTw,e.lst);return{result:e,categories:s,categories2:o}}getCategories(t,e){let s=[];for(const o of e){let e=o[t.$id]?.key;if(e){if(!isNaN(e))e=Number(e);s.push(e)}}const o=new Set(s);s=Array.from(o).sort();if(a(t.term)){Object.values(t.term.values).forEach((t=>{if(t?.uncomputable){const e=s.indexOf(t.label);if(e>-1)s.splice(e,1)}}));s=this.orderColNames(s)}return s}orderColNames(t){const e=[];const s=[];for(const o of t){const t=o.split(" to ");const a=t[0].replace(/[\>\≥\<\≤]/g,"");const i=Number(a);if(!isNaN(i)){const s=!t[1]&&(o.includes("<")||o.includes("≤"))?i-1:!t[1]&&(o.includes("≥")||o.includes(">"))?i+1:i;e.push({key:s,label:o})}else s.push(a)}return[...e.sort(((t,e)=>t.key-e.key)).map((t=>t.label)),...s.sort()]}renderStaticTable(t,e,s){for(const o of s){const s=t.append("tr");const a=e.rowTw.term.values?.[o[0]]?.label||o[0];this.addRowLabel(s,a);for(const t of o[1]){const e=t[1].value>0?t[1].value:"";s.append("td").style("background-color","#FAFAFA").style("text-align","center").text(e)}}}async getStaticTableData(t){const e={term:t.columnTw,term2:t.rowTw,filter:this.state.termfilter.filter};if(this.state.termfilter.filter0)e.filter0=this.state.termfilter.filter0;await this.getDescrStats(e.term);await this.getDescrStats(e.term2);const s=await this.app.vocabApi.getNestedChartSeriesData(e);const o=new Map;const a=s.data.refs.cols.map((t=>s.data.charts[0].serieses.find((e=>e.seriesId==t))));s.data.refs.rows.forEach((t=>{o.set(t,new Map);for(const e of a){o.get(t).set(e.seriesId,{value:e.data.find((e=>e.dataId==t))?.total||0,selected:false})}}));return{rows:o,filteredCols:a}}async getDescrStats(t){if(a(t.term)){const e=await this.app.vocabApi.getDescrStats(t,this.state.termfilter);if(e.error)throw e.error;t.q.descrStats=e.values}}showNoSampleMessage(t){t.append("div").style("padding","0px 50px").style("font-size","1.15em").text("No overlapping samples");return}addHeader(t,e){t.append("th").attr("data-testid","sjpp-facet-col-header").style("border","2.5px solid white").style("padding","0px 25px").text(e)}addRowLabel(t,e){t.append("td").attr("data-testid","sjpp-facet-row-label").style("border","2.5px solid white").style("font-weight","bold").text(e)}async setControls(){const t=[{type:"term",configKey:"columnTw",chartType:this.type,usecase:{target:this.type},title:"Facet column categories",label:"Columns",vocabApi:this.app.vocabApi,numericEditMenuVersion:["discrete"]},{type:"term",configKey:"rowTw",chartType:this.type,usecase:{target:this.type},title:"Facet row categories",label:"Rows",vocabApi:this.app.vocabApi,numericEditMenuVersion:["discrete"]}];this.components={controls:await i({app:this.app,id:this.id,holder:this.dom.controlsHolder,inputs:t})}}}function d(t,e){const s=(t,s)=>{const o={chartType:"facet",columnTw:{term:t},rowTw:{term:s}};if(a(t))o.columnTw.term.q={mode:"discrete"};if(a(s))o.rowTw.term.q={mode:"discrete"};e.app.dispatch({type:"plot_create",config:o})};r(e.dom.tip,e.app,"facet","",s)}const m=t(p);const h=m;async function f(t,s){const a={settings:{}};if(!t.columnTw)throw".columnTw{} missing";await o(t.columnTw,s.vocabApi);if(!t.rowTw)throw".rowTw{} missing";await o(t.rowTw,s.vocabApi);const i=e(a,t);return i}export{h as componentInit,m as facetInit,f as getPlotConfig,d as makeChartBtnMenu};
1
+ import{h as t,P as e,M as s}from"./app-6fb77603.js";import{f as o,i as a}from"./termsetting-492eefa7.js";import{controlsInit as i}from"./controls-268e40e6.js";import{s as r}from"./select2Terms-d48d037e.js";import{b as l,a as n,d as c}from"./recover-299ffdb3.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./controls.btns-5bf9e7d7.js";import"./controls.config-2f0fa061.js";import"./FilterRxComp-02e68f1b.js";import"./table-0daf2b89.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-39d11f24.js";import"./FilterStateless-16a33070.js";import"./app-d215327f.js";import"./termInfo-491b10af.js";import"./toggleButtons-c4d6f260.js";import"./genesearch-ffd88bf2.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";class p{constructor(t){this.type="facet";const e=t.holder;const o=e.append("div").style("display","inline-block");const a=e.append("div").style("display","inline-block");this.dom={holder:t.holder.style("padding","20px"),header:t.header,controlsHolder:o,mainDiv:a,tip:t.tip||new s}}async init(t){await this.setControls()}getState(t){const e=t.plots.find((t=>t.id===this.id));if(this.dom.header)this.dom.header.html(`${e.columnTw.term.name} <span style="font-size:.8em">(COLUMN)</span> ${e.rowTw.term.name} <span style="font-size:.8em">(ROW) &nbsp; FACET TABLE</span>`);return{config:e,vocab:t.vocab,termfilter:t.termfilter,groups:t.groups}}async main(){this.config=JSON.parse(JSON.stringify(this.state.config));await this.renderTable()}async renderTable(){const t=this.config;this.dom.mainDiv.selectAll("*").remove();this.dom.tip.clear().hide();const e=this.dom.mainDiv.append("table");const s=e.append("tbody");const o=s.append("tr").style("text-align","center");o.append("th");const a=this.app.vocabApi.hasVerifiedToken();if(a){e.style("border-spacing","0px");const{result:a,categories:i,categories2:r}=await this.getSampleTableData(t);if(!i.length||!r.length){this.showNoSampleMessage(this.dom.mainDiv);return}for(const e of i){const s=t.columnTw.term.values?.[e]?.label||e;this.addHeader(o,s)}this.renderSampleTable(s,t,a,i,r)}else{e.style("border-spacing","5px");const{rows:a,filteredCols:i}=await this.getStaticTableData(t);if(!a.size||!i.length){this.showNoSampleMessage(this.dom.mainDiv);return}for(const e of i){const s=t.columnTw.term.values?.[e.seriesId]?.label||e.seriesId;this.addHeader(o,s)}this.renderStaticTable(s,t,a,i)}}renderSampleTable(t,e,s,o,a){const i={};for(const n of a){i[n]={};const c=t.append("tr");const p=e.rowTw.term.values?.[n]?.label||n;this.addRowLabel(c,p);for(const p of o){const d=s.lst.filter((t=>t[e.columnTw.$id]?.key==p&&t[e.rowTw.$id]?.key==n));i[n][p]={samples:d,selected:false};const m=c.append("td");if(!d.length)m.classed("highlightable-cell",true);if(d.length>0){const e=o.indexOf(p)+2;m.classed("sja_menuoption",true).style("text-align","center").style("border","2.5px solid white").text(d.length).on("mouseover",(()=>{this.highlightColRow(t,c,e,"#fffec8")})).on("mouseout",(()=>{this.highlightColRow(t,c,e,"transparent")})).on("click",(()=>{const t=i[n][p].selected=!i[n][p].selected;if(t){m.style("border","1px solid blue")}else{m.style("border","2.5px solid white")}for(const t of a){for(const e of o){if(i[t][e].selected){l.style("display","");r.text("Choose how to use samples:");return}}}l.style("display","none");r.text("Click on cells to select samples")}))}}}const r=this.dom.mainDiv.append("div").attr("data-testid","sjpp-facet-start-prompt").style("margin","20px 0px 0px 15px").style("opacity","0.7").text("Click on cells to select samples");const l=this.dom.mainDiv.append("div").style("margin","20px 0px 0px 25px").style("display","none");const n=[{text:"Show samples view",callback:()=>{const t=this.getSelectedSamples(o,a,i);this.app.dispatch({type:"plot_create",config:{chartType:"sampleView",samples:t.map((t=>({sampleId:t.sample,sampleName:s.refs.bySampleId[t.sample].label})))}})}},{text:"List samples",callback:()=>{const t=this.getSelectedSamples(o,a,i);const r=t.map((t=>[s.refs.bySampleId[t.sample].label,t[e.columnTw.$id].key,t[e.rowTw.$id].key]));this.dom.tip.clear().showunder(l.node());const n=this.dom.tip.d.append("table").append("tbody");const c=n.append("tr").style("text-align","center");c.append("th").text("Sample");c.append("th").text(e.columnTw.term.name);c.append("th").text(e.rowTw.term.name);for(const t of r){const e=n.append("tr");e.append("td").text(t[0]);e.append("td").text(t[1]);e.append("td").text(t[2])}}},{text:"Create group",callback:()=>{this.addGroup(o,a,i)}}];for(const t of n){this.addBtn(l,t)}}highlightColRow=(t,e,s,o)=>{t.selectAll(`td.highlightable-cell:nth-child(${s})`).style("background-color",`${o}`).style("border",`2.5px solid ${o}`);t.select(`th:nth-child(${s})`).style("background-color",`${o}`).style("border",`2.5px solid ${o}`);e.style("background-color",`${o}`)};addBtn(t,e){return t.append("button").classed("sja_menuoption",true).style("padding","0px 10px").style("margin","0px 5px").text(e.text).on("click",e.callback)}addGroup(t,e,s){const o={name:"Group",items:this.getSelectedSamples(t,e,s)};const a=l(n([o]));c(this.app,a,this.state.groups);return a}getSelectedSamples(t,e,s){const o=[];for(const a of e){for(const e of t){if(s[a][e].selected){o.push(...s[a][e].samples)}}}return o}async getSampleTableData(t){const e=await this.app.vocabApi.getAnnotatedSampleData({filter:this.state.termfilter.filter,terms:[t.columnTw,t.rowTw]});const s=this.getCategories(t.columnTw,e.lst);const o=this.getCategories(t.rowTw,e.lst);return{result:e,categories:s,categories2:o}}getCategories(t,e){let s=[];for(const o of e){let e=o[t.$id]?.key;if(e){if(!isNaN(e))e=Number(e);s.push(e)}}const o=new Set(s);s=Array.from(o).sort();if(a(t.term)){Object.values(t.term.values).forEach((t=>{if(t?.uncomputable){const e=s.indexOf(t.label);if(e>-1)s.splice(e,1)}}));s=this.orderColNames(s)}return s}orderColNames(t){const e=[];const s=[];for(const o of t){const t=o.split(" to ");const a=t[0].replace(/[\>\≥\<\≤]/g,"");const i=Number(a);if(!isNaN(i)){const s=!t[1]&&(o.includes("<")||o.includes("≤"))?i-1:!t[1]&&(o.includes("≥")||o.includes(">"))?i+1:i;e.push({key:s,label:o})}else s.push(a)}return[...e.sort(((t,e)=>t.key-e.key)).map((t=>t.label)),...s.sort()]}renderStaticTable(t,e,s){for(const o of s){const s=t.append("tr");const a=e.rowTw.term.values?.[o[0]]?.label||o[0];this.addRowLabel(s,a);for(const t of o[1]){const e=t[1].value>0?t[1].value:"";s.append("td").style("background-color","#FAFAFA").style("text-align","center").text(e)}}}async getStaticTableData(t){const e={term:t.columnTw,term2:t.rowTw,filter:this.state.termfilter.filter};if(this.state.termfilter.filter0)e.filter0=this.state.termfilter.filter0;await this.getDescrStats(e.term);await this.getDescrStats(e.term2);const s=await this.app.vocabApi.getNestedChartSeriesData(e);const o=new Map;const a=s.data.refs.cols.map((t=>s.data.charts[0].serieses.find((e=>e.seriesId==t))));s.data.refs.rows.forEach((t=>{o.set(t,new Map);for(const e of a){o.get(t).set(e.seriesId,{value:e.data.find((e=>e.dataId==t))?.total||0,selected:false})}}));return{rows:o,filteredCols:a}}async getDescrStats(t){if(a(t.term)){const e=await this.app.vocabApi.getDescrStats(t,this.state.termfilter);if(e.error)throw e.error;t.q.descrStats=e.values}}showNoSampleMessage(t){t.append("div").style("padding","0px 50px").style("font-size","1.15em").text("No overlapping samples");return}addHeader(t,e){t.append("th").attr("data-testid","sjpp-facet-col-header").style("border","2.5px solid white").style("padding","0px 25px").text(e)}addRowLabel(t,e){t.append("td").attr("data-testid","sjpp-facet-row-label").style("border","2.5px solid white").style("font-weight","bold").text(e)}async setControls(){const t=[{type:"term",configKey:"columnTw",chartType:this.type,usecase:{target:this.type},title:"Facet column categories",label:"Columns",vocabApi:this.app.vocabApi,numericEditMenuVersion:["discrete"]},{type:"term",configKey:"rowTw",chartType:this.type,usecase:{target:this.type},title:"Facet row categories",label:"Rows",vocabApi:this.app.vocabApi,numericEditMenuVersion:["discrete"]}];this.components={controls:await i({app:this.app,id:this.id,holder:this.dom.controlsHolder,inputs:t})}}}function d(t,e){const s=(t,s)=>{const o={chartType:"facet",columnTw:{term:t},rowTw:{term:s}};if(a(t))o.columnTw.term.q={mode:"discrete"};if(a(s))o.rowTw.term.q={mode:"discrete"};e.app.dispatch({type:"plot_create",config:o})};r(e.dom.tip,e.app,"facet","",s)}const m=t(p);const h=m;async function f(t,s){const a={settings:{}};if(!t.columnTw)throw".columnTw{} missing";await o(t.columnTw,s.vocabApi);if(!t.rowTw)throw".rowTw{} missing";await o(t.rowTw,s.vocabApi);const i=e(a,t);return i}export{h as componentInit,m as facetInit,f as getPlotConfig,d as makeChartBtnMenu};
@@ -1 +1 @@
1
- import{x as i}from"./app-2cd97738.js";async function o({line:o,genome:t,positionType:r}){const n=o.split(",");let e=null,s=null,m=null,p=null,a=null,l=null,N=null,c=null;if(r=="codon"){e=Number.parseInt(n[2].trim());if(Number.isNaN(e))throw"N-term codon position is not integer";s=Number.parseInt(n[5].trim());if(Number.isNaN(s))throw"C-term codon position is not integer"}else if(r=="rna"){m=Number.parseInt(n[2].trim());if(Number.isNaN(m))throw"N-term RNA position is not integer";p=Number.parseInt(n[5].trim());if(Number.isNaN(p))throw"C-term RNA position is not integer"}else if(r=="genomic"){let o=n[2].trim().split(":");if(o.length!=2)throw"N-term genomic position format is not chr:position";a=o[0];N=Number.parseInt(o[1]);if(Number.isNaN(N))throw"invalid N-term genomic position";N--;const r=i(t,a,N,N);if(r)throw"N-term genomic position error: "+r;o=n[5].trim().split(":");if(o.length!=2)throw"C-term genomic position format is not chr:position";l=o[0];c=Number.parseInt(o[1]);if(Number.isNaN(c))throw": invalid C-term genomic position";c--;const e=i(block.genome,l,c,c);if(e)throw"C-term genomic position error: "+e}else{throw"unknown positionType"}const u=n[1].trim().toUpperCase();const f=n[4].trim().toUpperCase();const h={class:"Fuserna",dt:2,isoform:u,pairlst:[{a:{name:n[0].trim(),isoform:u,codon:e,rnaposition:m,chr:a,position:N},b:{name:n[3].trim(),isoform:f,codon:s,rnaposition:p,chr:l,position:c}}]};if(n[6]){const i=Number.parseInt(n[6].trim());if(!Number.isNaN(i)){h.pairlst[0].interstitial={aalen:i}}}return h}export{o as parseFusion};
1
+ import{x as i}from"./app-6fb77603.js";async function o({line:o,genome:t,positionType:r}){const n=o.split(",");let e=null,s=null,m=null,p=null,a=null,l=null,N=null,c=null;if(r=="codon"){e=Number.parseInt(n[2].trim());if(Number.isNaN(e))throw"N-term codon position is not integer";s=Number.parseInt(n[5].trim());if(Number.isNaN(s))throw"C-term codon position is not integer"}else if(r=="rna"){m=Number.parseInt(n[2].trim());if(Number.isNaN(m))throw"N-term RNA position is not integer";p=Number.parseInt(n[5].trim());if(Number.isNaN(p))throw"C-term RNA position is not integer"}else if(r=="genomic"){let o=n[2].trim().split(":");if(o.length!=2)throw"N-term genomic position format is not chr:position";a=o[0];N=Number.parseInt(o[1]);if(Number.isNaN(N))throw"invalid N-term genomic position";N--;const r=i(t,a,N,N);if(r)throw"N-term genomic position error: "+r;o=n[5].trim().split(":");if(o.length!=2)throw"C-term genomic position format is not chr:position";l=o[0];c=Number.parseInt(o[1]);if(Number.isNaN(c))throw": invalid C-term genomic position";c--;const e=i(block.genome,l,c,c);if(e)throw"C-term genomic position error: "+e}else{throw"unknown positionType"}const u=n[1].trim().toUpperCase();const f=n[4].trim().toUpperCase();const b={class:"Fuserna",dt:2,isoform:u,pairlst:[{a:{name:n[0].trim(),isoform:u,codon:e,rnaposition:m,chr:a,position:N},b:{name:n[3].trim(),isoform:f,codon:s,rnaposition:p,chr:l,position:c}}]};if(n[6]){const i=Number.parseInt(n[6].trim());if(!Number.isNaN(i)){b.pairlst[0].interstitial={aalen:i}}}return b}export{o as parseFusion};
@@ -1 +1 @@
1
- import{appInit as e}from"./plot.app-d6fe76e2.js";import{d as t,P as r}from"./app-2cd97738.js";import{T as s,f as i}from"./termsetting-ad8c4f3a.js";import{v as o}from"./FilterRxComp-0f35b322.js";import"./recover-74f2e965.js";import"./FilterStateless-b1c6ee04.js";import"./app-686b9547.js";import"./termInfo-d0a9e65f.js";import"./tslib.es6-c3c2d88f.js";import"./toggleButtons-04c5ad7c.js";import"path";import"./table-f50a9344.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-01e8cce6.js";import"./genesearch-41cb55ce.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";const n="hg38";const p="GDC";async function a(a,l,c){try{const l=c[n];if(!l)throw n+" missing";const d=a.settings||{};if(typeof d!="object")throw"arg.settings{} not object";if(!d.hierCluster)d.hierCluster={};if(typeof d.hierCluster!="object")throw"arg.settings.hierCluster{} not object";if(!Number.isInteger(d.hierCluster.maxGenes))d.hierCluster.maxGenes=1e3;if(a.filter0&&typeof a.filter0!="object")throw"arg.filter0 not object";const f=await o({state:{vocab:{genome:n,dslabel:p}}});f.getTermdbConfig();const m=await e({debug:a.debug,holder:t(a.holder).select(".sja_root_holder"),genome:l,state:{genome:n,dslabel:p,termfilter:{filter0:a.filter0},plots:[{chartType:"geneset",toolName:"Gene Expression Clustering",settings:{maxGenes:d.hierCluster.maxGenes}}]},app:a.opts?.app||{},hierCluster:r({reactsTo(e){if(e.type.startsWith("plot_"))return e.id===this.id;if(e.type.startsWith("filter"))return true;if(e.type=="app_refresh")return true},callbacks:{"firstRender.gdcHierCluster":async e=>{e.on("firstRender.gdcHierCluster",null);if(!g)return;m.dispatch({type:"plot_delete",id:g.id});g=undefined}}},a.opts?.hierCluster||{}),matrix:a.opts?.matrix||{},geneset:{mode:"geneExpression",genome:l,genes:a.genes,reactsTo(e){if(e.type.startsWith("plot_"))return e.id===this.id;if(e.type.startsWith("filter"))return true;if(e.type=="app_refresh")return true},showWaitMessage(e){e.style("margin","20px");e.append("div").text("Loading genes that are top variably expressed in current cohort...");e.append("div").style("font-size",".8em").html(`\n\t\t\t\t\t\tOnly up to 1000 cases with gene expression data will be used to select genes.<br>\n\t\t\t\t\t\tGenes are selected from all protein-coding genes, may take over 1 minute.\n\t\t\t\t\t`)},async callback(e,t){if(!e)return;g=e;if(!u){const e=m.getState().plots.find((e=>e.chartType=="hierCluster"));if(e)u=m.getComponents(`plots.${e.id}`)}const r=[{name:"Gene Expression",type:"hierCluster",lst:t},...a.termgroups||[]];if(u){m.dispatch({type:"plot_edit",id:u.id,config:{termgroups:r}})}else{m.dispatch({type:"plot_create",config:{chartType:"hierCluster",termgroups:r,divideBy:a.divideBy||undefined,settings:d,dataType:s.GENE_EXPRESSION}})}}},recover:{undoHtml:"Undo",redoHtml:"Redo",resetHtml:"Restore",hide(e){return e.plots[0]?.chartType!="hierCluster"},adjustTrackedState:e=>{const t=structuredClone(e);delete t.termfilter.filter0;if(t.plots){for(const e of t.plots){if(!e.termgroups)continue;for(const t of e.termgroups){if(!t.lst)continue;for(const e of t.lst){if(!e?.term)continue;delete e.term.category2samplecount;delete e.term.values}}}}return t}}});let u,g;const h={type:"hierCluster",update:async e=>{const t=m.getState().plots.find((e=>e.chartType=="hierCluster"));if(!u){if(t)u=m.getComponents(`plots.${t.id}`)}if(e.genes){const r=t.termgroups.find((e=>e.type=="hierCluster"));m.dispatch({type:"plot_edit",id:u.id,config:{termgroups:[{name:r.name,type:"hierCluster",lst:await Promise.all(e.genes.map((async e=>await i({term:{gene:e.gene,type:"geneExpression",name:e.gene}},f))))}]}})}else if("filter0"in e){m.dispatch({type:"filter_replace",filter0:e.filter0})}else if(u){m.dispatch({type:"plot_edit",id:u.id,config:e})}}};return h}catch(e){throw e}}export{a as init};
1
+ import{appInit as e}from"./plot.app-2a805759.js";import{d as t,P as r}from"./app-6fb77603.js";import{T as s,f as i}from"./termsetting-492eefa7.js";import{v as o}from"./FilterRxComp-02e68f1b.js";import"./recover-299ffdb3.js";import"./FilterStateless-16a33070.js";import"./app-d215327f.js";import"./termInfo-491b10af.js";import"./tslib.es6-c3c2d88f.js";import"./toggleButtons-c4d6f260.js";import"path";import"./table-0daf2b89.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-39d11f24.js";import"./genesearch-ffd88bf2.js";import"./checkbox-96437f4d.js";import"./rehydrateFilter-12d118cb.js";const n="hg38";const p="GDC";async function a(a,l,f){try{const l=f[n];if(!l)throw n+" missing";const d=a.settings||{};if(typeof d!="object")throw"arg.settings{} not object";if(!d.hierCluster)d.hierCluster={};if(typeof d.hierCluster!="object")throw"arg.settings.hierCluster{} not object";if(!Number.isInteger(d.hierCluster.maxGenes))d.hierCluster.maxGenes=1e3;if(a.filter0&&typeof a.filter0!="object")throw"arg.filter0 not object";const c=await o({state:{vocab:{genome:n,dslabel:p}}});c.getTermdbConfig();const m=await e({debug:a.debug,holder:t(a.holder).select(".sja_root_holder"),genome:l,state:{genome:n,dslabel:p,termfilter:{filter0:a.filter0},plots:[{chartType:"geneset",toolName:"Gene Expression Clustering",settings:{maxGenes:d.hierCluster.maxGenes}}]},app:a.opts?.app||{},hierCluster:r({reactsTo(e){if(e.type.startsWith("plot_"))return e.id===this.id;if(e.type.startsWith("filter"))return true;if(e.type=="app_refresh")return true},callbacks:{"firstRender.gdcHierCluster":async e=>{e.on("firstRender.gdcHierCluster",null);if(!g)return;m.dispatch({type:"plot_delete",id:g.id});g=undefined}}},a.opts?.hierCluster||{}),matrix:a.opts?.matrix||{},geneset:{mode:"geneExpression",genome:l,genes:a.genes,reactsTo(e){if(e.type.startsWith("plot_"))return e.id===this.id;if(e.type.startsWith("filter"))return true;if(e.type=="app_refresh")return true},showWaitMessage(e){e.style("margin","20px");e.append("div").text("Loading genes that are top variably expressed in current cohort...");e.append("div").style("font-size",".8em").html(`\n\t\t\t\t\t\tOnly up to 1000 cases with gene expression data will be used to select genes.<br>\n\t\t\t\t\t\tGenes are selected from all protein-coding genes, may take over 1 minute.\n\t\t\t\t\t`)},async callback(e,t){if(!e)return;g=e;if(!u){const e=m.getState().plots.find((e=>e.chartType=="hierCluster"));if(e)u=m.getComponents(`plots.${e.id}`)}const r=[{name:"Gene Expression",type:"hierCluster",lst:t},...a.termgroups||[]];if(u){m.dispatch({type:"plot_edit",id:u.id,config:{termgroups:r}})}else{m.dispatch({type:"plot_create",config:{chartType:"hierCluster",termgroups:r,divideBy:a.divideBy||undefined,settings:d,dataType:s.GENE_EXPRESSION}})}}},recover:{undoHtml:"Undo",redoHtml:"Redo",resetHtml:"Restore",hide(e){return e.plots[0]?.chartType!="hierCluster"},adjustTrackedState:e=>{const t=structuredClone(e);delete t.termfilter.filter0;if(t.plots){for(const e of t.plots){if(!e.termgroups)continue;for(const t of e.termgroups){if(!t.lst)continue;for(const e of t.lst){if(!e?.term)continue;delete e.term.category2samplecount;delete e.term.values}}}}return t}}});let u,g;const h={type:"hierCluster",update:async e=>{const t=m.getState().plots.find((e=>e.chartType=="hierCluster"));if(!u){if(t)u=m.getComponents(`plots.${t.id}`)}if(e.genes){const r=t.termgroups.find((e=>e.type=="hierCluster"));m.dispatch({type:"plot_edit",id:u.id,config:{termgroups:[{name:r.name,type:"hierCluster",lst:await Promise.all(e.genes.map((async e=>await i({term:{gene:e.gene,type:"geneExpression",name:e.gene}},c))))}]}})}else if("filter0"in e){m.dispatch({type:"filter_replace",filter0:e.filter0})}else if(u){m.dispatch({type:"plot_edit",id:u.id,config:e})}}};return h}catch(e){throw e}}export{a as init};
@@ -1 +1 @@
1
- import{_ as e}from"./tslib.es6-c3c2d88f.js";import{P as t}from"./app-2cd97738.js";function n(e){switch(e){case"./numeric.binary.ts":return import("./numeric.binary-1dd9a2b4.js");case"./numeric.continuous.ts":return import("./numeric.continuous-ed132eea.js");case"./numeric.discrete.ts":return import("./numeric.discrete-d780d076.js");case"./numeric.spline.ts":return import("./numeric.spline-abe07708.js");case"./numeric.toggle.ts":return import("./numeric.toggle-647423dd.js");default:return new Promise((function(t,n){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}function r(t){return e(this,void 0,void 0,(function*(){const e=t.opts.numericEditMenuVersion;const n=e.length>1?"toggle":e[0];const r=yield o(n);return yield r.getHandler(t)}))}function i(n,r,i=null){var o;return e(this,void 0,void 0,(function*(){if(typeof n.term!=="object")throw"tw.term is not an object";if(!n.term.gene&&!n.term.name)throw"no gene or name present";if(!n.term.gene)n.term.gene=n.term.name;if(!n.term.gene||typeof n.term.gene!="string")throw"geneExpression tw.term.gene must be non-empty string";if(!n.term.name)n.term.name=n.term.gene;if(!((o=n.q)===null||o===void 0?void 0:o.mode))n.q={mode:"continuous"};if(i)t(n.q,i);if(n.q.mode!=="continuous"&&!n.term.bins){yield r.setTermBins(n)}return n}))}function o(t){return e(this,void 0,void 0,(function*(){try{return yield n(`./numeric.${t}.ts`)}catch(e){if(e.stack)console.log(e.stack);throw`Type numeric.${t} does not exist [handlers/numeric.ts importSubtype()]`}}))}export{i as fillTW,r as getHandler};
1
+ import{_ as e}from"./tslib.es6-c3c2d88f.js";import{P as t}from"./app-6fb77603.js";function n(e){switch(e){case"./numeric.binary.ts":return import("./numeric.binary-f382cc98.js");case"./numeric.continuous.ts":return import("./numeric.continuous-6feb34a7.js");case"./numeric.discrete.ts":return import("./numeric.discrete-ed10bbc1.js");case"./numeric.spline.ts":return import("./numeric.spline-a35cfbf0.js");case"./numeric.toggle.ts":return import("./numeric.toggle-2f98d6e5.js");default:return new Promise((function(t,n){(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e)))}))}}function r(t){return e(this,void 0,void 0,(function*(){const e=t.opts.numericEditMenuVersion;const n=e.length>1?"toggle":e[0];const r=yield o(n);return yield r.getHandler(t)}))}function i(n,r,i=null){var o;return e(this,void 0,void 0,(function*(){if(typeof n.term!=="object")throw"tw.term is not an object";if(!n.term.gene&&!n.term.name)throw"no gene or name present";if(!n.term.gene)n.term.gene=n.term.name;if(!n.term.gene||typeof n.term.gene!="string")throw"geneExpression tw.term.gene must be non-empty string";if(!n.term.name)n.term.name=n.term.gene;if(!((o=n.q)===null||o===void 0?void 0:o.mode))n.q={mode:"continuous"};if(i)t(n.q,i);if(n.q.mode!=="continuous"&&!n.term.bins){yield r.setTermBins(n)}return n}))}function o(t){return e(this,void 0,void 0,(function*(){try{return yield n(`./numeric.${t}.ts`)}catch(e){if(e.stack)console.log(e.stack);throw`Type numeric.${t} does not exist [handlers/numeric.ts importSubtype()]`}}))}export{i as fillTW,r as getHandler};
@@ -1 +1 @@
1
- import{P as t,h as e,b as o,bL as n}from"./app-2cd97738.js";const r={clusterMethod:"average",distanceMethod:"euclidean"};const i=["average","complete","mcquitty"];const a=["euclidean","maximum","manhattan","canberra"];class d{constructor(){this.type="geneExpression"}async init(t){const e=this.opts.holder.append("div");this.dom={holder:e,controlsDiv:e.append("div"),canvas:e.append("canvas"),colorScaleDiv:e.append("div")};this.makeControls();this.components={}}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}}async main(){const t=this.getParam();const e=await o("mds3",{body:t});g(e,this)}getParam(){console.log(this.state.config.genes);const t={genome:this.app.opts.state.vocab.genome,dslabel:this.app.opts.state.vocab.dslabel,geneExpression:1,genes:this.state.config.genes,clusterMethod:this.state.config.clusterMethod};return t}makeControls(){const t=this.dom.controlsDiv.append("select");for(const e of i)t.append("option").text(e);this.dom.clusterMethodSelect=t;t.on("change",(()=>{this.app.dispatch({type:"plot_edit",id:this.id,config:{clusterMethod:i[t.property("selectedIndex")]}})}))}}async function s(e,o){try{const o=structuredClone(r);return t(o,e)}catch(t){throw`${t} [geneExpression getPlotConfig()]`}}const c=e(d);const l=c;function h(t,e){t.append("div").attr("class","sja_menuoption sja_sharp_border").text("Clustering analysis").on("click",(()=>{e.dom.tip.hide();e.prepPlot({config:{chartType:"geneExpression"}})}))}function g(t,e){e.dom.clusterMethodSelect.property("selectedIndex",i.indexOf(e.state.config.clusterMethod));e.dom.distanceMethodSelect.property("selectedIndex",a.indexOf(e.state.config.distanceMethod));const o=t.clustering;console.log(o);o.d={minColor:"#0c306b",maxColor:"#ffcc00",xDendrogramHeight:150,yDendrogramHeight:150};o.d.colorScale=n(o.d.minColor,o.d.maxColor);const r=e.dom.canvas.node().getContext("2d");o.d.rowHeight=y(o);o.d.colWidth=u(o);w(r,o);e.dom.canvas.attr("width",o.d.xDendrogramHeight+o.d.xLabHeight+o.d.colWidth*o.matrix[0].length).attr("height",o.d.yDendrogramHeight+o.d.yLabHeight+o.d.rowHeight*o.matrix.length);f(o,r);p(o,r);x(r,o);M(e,o)}function x(t,e){try{e.row_dendro.map(m)}catch(t){throw"row_dendro error: "+t}try{e.col_dendro.map(m)}catch(t){throw"col_dendro error: "+t}for(const t of e.row_dendro){let e=t.x1;t.x1=t.y1;t.y1=e;e=t.x2;t.x2=t.y2;t.y2=e}{let t=0;for(const o of e.row_dendro)t=Math.max(t,o.x1,o.x2);const o=e.d.xDendrogramHeight/t;for(const n of e.row_dendro){n.x1=o*(t-n.x1);n.x2=o*(t-n.x2);n.y1*=e.d.rowHeight;n.y2*=e.d.rowHeight}}{let t=0;for(const o of e.col_dendro)t=Math.max(t,o.y1,o.y2);const o=e.d.yDendrogramHeight/t;for(const n of e.col_dendro){n.y1=o*(t-n.y1);n.y2=o*(t-n.y2);n.x1*=e.d.colWidth;n.x2*=e.d.colWidth}}t.strokeStyle="black";let o=e.d.yDendrogramHeight+e.d.yLabHeight;for(const n of e.row_dendro){t.beginPath();const e=Math.min(n.x1,n.x2),r=Math.max(n.x1,n.x2),i=Math.min(n.y1,n.y2),a=Math.max(n.y1,n.y2);t.moveTo(e,i+o);t.lineTo(e,a+o);if(n.x1>n.x2&&n.y1>n.y2||n.x1<n.x2&&n.y1<n.y2){t.lineTo(r,a+o)}else{t.moveTo(e,i+o);t.lineTo(r,i+o)}t.stroke();t.closePath()}o=e.d.xDendrogramHeight+e.d.xLabHeight;for(const n of e.col_dendro){t.beginPath();const e=Math.min(n.x1,n.x2),r=Math.max(n.x1,n.x2),i=Math.min(n.y1,n.y2),a=Math.max(n.y1,n.y2);t.moveTo(o+e,i);t.lineTo(o+r,i);if(n.x1>n.x2&&n.y1>n.y2||n.x1<n.x2&&n.y1<n.y2){t.lineTo(o+r,a)}else{t.moveTo(o+e,i);t.lineTo(o+e,a)}t.stroke();t.closePath()}}function m(t){if(t.r1<0)throw`r.r1<0 ${t.r1}`;if(t.r2<0)throw`r.r2<0 ${t.r2}`;if(t.x1<1)throw`r.x1<1 ${t.x1}`;if(t.x2<1)throw`r.x2<1 ${t.x2}`;t.x1-=.5;t.x2-=.5;if(t.y1<0)throw`r.y1<0 ${t.y1}`;if(t.y2<0)throw`r.y2<0 ${t.y2}`}function f(t,e){if(t.d.xLabHeight){e.font=t.d.rowHeight+"px Arial";e.textAlign="end";e.fillStyle="black";for(const[o,n]of t.row_names_index.entries()){e.fillText(t.geneNameLst[n-1],t.d.xDendrogramHeight+t.d.xLabHeight,t.d.yDendrogramHeight+t.d.yLabHeight+t.d.rowHeight*(o+1))}}}function p(t,e){for(let o=0;o<t.row_names_index.length;o++){const n=t.matrix[t.row_names_index[o]-1];const[r,i]=H(n);for(let a=0;a<t.col_names_index.length;a++){const d=n[t.col_names_index[a]-1];e.fillStyle=t.d.colorScale((d-r)/(i-r));e.fillRect(t.d.xDendrogramHeight+t.d.xLabHeight+t.d.colWidth*a,t.d.yDendrogramHeight+t.d.yLabHeight+t.d.rowHeight*o,t.d.colWidth,t.d.rowHeight)}}}function y(t){const e=500/t.matrix.length;if(e>20)return 20;if(e<10)return 10;return Math.ceil(e)}function u(t){const e=2e3/t.matrix[0].length;if(e>10)return 10;return Math.ceil(e)}function w(t,e){if(e.geneNameLst&&e.d.rowHeight>=7){t.font=e.d.rowHeight+"px Arial";let o=0;for(const n of e.geneNameLst){o=Math.max(o,t.measureText(n).width)}e.d.xLabHeight=o}else{e.d.xLabHeight=0}if(e.sampleNameLst&&e.d.colWidth>=7){t.font=e.d.colWidth+"px Arial";let o=0;for(const n of e.sampleNameLst){o=Math.max(o,t.measureText(n).width)}e.d.yLabHeight=o}else{e.d.yLabHeight=0}}function H(t){let e=null,o;for(const n of t){if(e==null){e=n;o=n}else{e=Math.min(e,n);o=Math.max(o,n)}}return[e,o]}function M(t,e){t.dom.colorScaleDiv.selectAll("*").remove();const o=100,n=20;t.dom.colorScaleDiv.append("span").text("Min");const r=t.dom.colorScaleDiv.append("svg");t.dom.colorScaleDiv.append("span").text("Max");const i=r.append("defs").append("linearGradient").attr("id","grad");i.append("stop").attr("offset","0%").attr("stop-color",e.d.minColor);i.append("stop").attr("offset","100%").attr("stop-color",e.d.maxColor);r.append("rect").attr("width",o).attr("height",n).attr("fill","url(#grad)");r.attr("width",o).attr("height",n)}export{l as componentInit,c as geneExpressionInit,s as getPlotConfig,h as makeChartBtnMenu};
1
+ import{P as t,h as e,b as o,bL as n}from"./app-6fb77603.js";const r={clusterMethod:"average",distanceMethod:"euclidean"};const i=["average","complete","mcquitty"];const a=["euclidean","maximum","manhattan","canberra"];class d{constructor(){this.type="geneExpression"}async init(t){const e=this.opts.holder.append("div");this.dom={holder:e,controlsDiv:e.append("div"),canvas:e.append("canvas"),colorScaleDiv:e.append("div")};this.makeControls();this.components={}}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}}async main(){const t=this.getParam();const e=await o("mds3",{body:t});g(e,this)}getParam(){console.log(this.state.config.genes);const t={genome:this.app.opts.state.vocab.genome,dslabel:this.app.opts.state.vocab.dslabel,geneExpression:1,genes:this.state.config.genes,clusterMethod:this.state.config.clusterMethod};return t}makeControls(){const t=this.dom.controlsDiv.append("select");for(const e of i)t.append("option").text(e);this.dom.clusterMethodSelect=t;t.on("change",(()=>{this.app.dispatch({type:"plot_edit",id:this.id,config:{clusterMethod:i[t.property("selectedIndex")]}})}))}}async function s(e,o){try{const o=structuredClone(r);return t(o,e)}catch(t){throw`${t} [geneExpression getPlotConfig()]`}}const c=e(d);const l=c;function h(t,e){t.append("div").attr("class","sja_menuoption sja_sharp_border").text("Clustering analysis").on("click",(()=>{e.dom.tip.hide();e.prepPlot({config:{chartType:"geneExpression"}})}))}function g(t,e){e.dom.clusterMethodSelect.property("selectedIndex",i.indexOf(e.state.config.clusterMethod));e.dom.distanceMethodSelect.property("selectedIndex",a.indexOf(e.state.config.distanceMethod));const o=t.clustering;console.log(o);o.d={minColor:"#0c306b",maxColor:"#ffcc00",xDendrogramHeight:150,yDendrogramHeight:150};o.d.colorScale=n(o.d.minColor,o.d.maxColor);const r=e.dom.canvas.node().getContext("2d");o.d.rowHeight=y(o);o.d.colWidth=u(o);w(r,o);e.dom.canvas.attr("width",o.d.xDendrogramHeight+o.d.xLabHeight+o.d.colWidth*o.matrix[0].length).attr("height",o.d.yDendrogramHeight+o.d.yLabHeight+o.d.rowHeight*o.matrix.length);f(o,r);p(o,r);x(r,o);b(e,o)}function x(t,e){try{e.row_dendro.map(m)}catch(t){throw"row_dendro error: "+t}try{e.col_dendro.map(m)}catch(t){throw"col_dendro error: "+t}for(const t of e.row_dendro){let e=t.x1;t.x1=t.y1;t.y1=e;e=t.x2;t.x2=t.y2;t.y2=e}{let t=0;for(const o of e.row_dendro)t=Math.max(t,o.x1,o.x2);const o=e.d.xDendrogramHeight/t;for(const n of e.row_dendro){n.x1=o*(t-n.x1);n.x2=o*(t-n.x2);n.y1*=e.d.rowHeight;n.y2*=e.d.rowHeight}}{let t=0;for(const o of e.col_dendro)t=Math.max(t,o.y1,o.y2);const o=e.d.yDendrogramHeight/t;for(const n of e.col_dendro){n.y1=o*(t-n.y1);n.y2=o*(t-n.y2);n.x1*=e.d.colWidth;n.x2*=e.d.colWidth}}t.strokeStyle="black";let o=e.d.yDendrogramHeight+e.d.yLabHeight;for(const n of e.row_dendro){t.beginPath();const e=Math.min(n.x1,n.x2),r=Math.max(n.x1,n.x2),i=Math.min(n.y1,n.y2),a=Math.max(n.y1,n.y2);t.moveTo(e,i+o);t.lineTo(e,a+o);if(n.x1>n.x2&&n.y1>n.y2||n.x1<n.x2&&n.y1<n.y2){t.lineTo(r,a+o)}else{t.moveTo(e,i+o);t.lineTo(r,i+o)}t.stroke();t.closePath()}o=e.d.xDendrogramHeight+e.d.xLabHeight;for(const n of e.col_dendro){t.beginPath();const e=Math.min(n.x1,n.x2),r=Math.max(n.x1,n.x2),i=Math.min(n.y1,n.y2),a=Math.max(n.y1,n.y2);t.moveTo(o+e,i);t.lineTo(o+r,i);if(n.x1>n.x2&&n.y1>n.y2||n.x1<n.x2&&n.y1<n.y2){t.lineTo(o+r,a)}else{t.moveTo(o+e,i);t.lineTo(o+e,a)}t.stroke();t.closePath()}}function m(t){if(t.r1<0)throw`r.r1<0 ${t.r1}`;if(t.r2<0)throw`r.r2<0 ${t.r2}`;if(t.x1<1)throw`r.x1<1 ${t.x1}`;if(t.x2<1)throw`r.x2<1 ${t.x2}`;t.x1-=.5;t.x2-=.5;if(t.y1<0)throw`r.y1<0 ${t.y1}`;if(t.y2<0)throw`r.y2<0 ${t.y2}`}function f(t,e){if(t.d.xLabHeight){e.font=t.d.rowHeight+"px Arial";e.textAlign="end";e.fillStyle="black";for(const[o,n]of t.row_names_index.entries()){e.fillText(t.geneNameLst[n-1],t.d.xDendrogramHeight+t.d.xLabHeight,t.d.yDendrogramHeight+t.d.yLabHeight+t.d.rowHeight*(o+1))}}}function p(t,e){for(let o=0;o<t.row_names_index.length;o++){const n=t.matrix[t.row_names_index[o]-1];const[r,i]=H(n);for(let a=0;a<t.col_names_index.length;a++){const d=n[t.col_names_index[a]-1];e.fillStyle=t.d.colorScale((d-r)/(i-r));e.fillRect(t.d.xDendrogramHeight+t.d.xLabHeight+t.d.colWidth*a,t.d.yDendrogramHeight+t.d.yLabHeight+t.d.rowHeight*o,t.d.colWidth,t.d.rowHeight)}}}function y(t){const e=500/t.matrix.length;if(e>20)return 20;if(e<10)return 10;return Math.ceil(e)}function u(t){const e=2e3/t.matrix[0].length;if(e>10)return 10;return Math.ceil(e)}function w(t,e){if(e.geneNameLst&&e.d.rowHeight>=7){t.font=e.d.rowHeight+"px Arial";let o=0;for(const n of e.geneNameLst){o=Math.max(o,t.measureText(n).width)}e.d.xLabHeight=o}else{e.d.xLabHeight=0}if(e.sampleNameLst&&e.d.colWidth>=7){t.font=e.d.colWidth+"px Arial";let o=0;for(const n of e.sampleNameLst){o=Math.max(o,t.measureText(n).width)}e.d.yLabHeight=o}else{e.d.yLabHeight=0}}function H(t){let e=null,o;for(const n of t){if(e==null){e=n;o=n}else{e=Math.min(e,n);o=Math.max(o,n)}}return[e,o]}function b(t,e){t.dom.colorScaleDiv.selectAll("*").remove();const o=100,n=20;t.dom.colorScaleDiv.append("span").text("Min");const r=t.dom.colorScaleDiv.append("svg");t.dom.colorScaleDiv.append("span").text("Max");const i=r.append("defs").append("linearGradient").attr("id","grad");i.append("stop").attr("offset","0%").attr("stop-color",e.d.minColor);i.append("stop").attr("offset","100%").attr("stop-color",e.d.maxColor);r.append("rect").attr("width",o).attr("height",n).attr("fill","url(#grad)");r.attr("width",o).attr("height",n)}export{l as componentInit,c as geneExpressionInit,s as getPlotConfig,h as makeChartBtnMenu};
@@ -0,0 +1 @@
1
+ import{_ as e}from"./tslib.es6-c3c2d88f.js";import{M as t}from"./app-6fb77603.js";import{a as s}from"./genesearch-ffd88bf2.js";import{T as a}from"./termsetting-492eefa7.js";import"path";class o{init(e){this.callback=e.callback;this.app=e.app;const a=s({tip:new t({padding:"0px"}),genome:e.genomeObj,row:e.holder,searchOnly:"gene",callback:()=>this.selectGene(a.geneSymbol)})}selectGene(t){return e(this,void 0,void 0,(function*(){if(!t)throw new Error("No gene selected");this.callback({gene:t,type:a.GENE_EXPRESSION,name:t})}))}}export{o as SearchHandler};
@@ -1 +1 @@
1
- import{r as e}from"./table-f50a9344.js";import{M as t,P as s,h as a,n as i,d as n,D as l,b as o}from"./app-2cd97738.js";import{controlsInit as r}from"./controls-3c1691d7.js";import"./tslib.es6-c3c2d88f.js";import"./controls.btns-5b1240c8.js";import"./controls.config-81cd5749.js";import"./termsetting-ad8c4f3a.js";import"path";new t;class p{constructor(){this.type="geneORA"}async init(e){if(!this.opts.holder||!this.opts.header){const e=i(n(this.opts.holder.node().parentNode));this.opts.header=e.header;this.opts.holder=e.body}const t=this.opts.holder.append("div").style("display","inline-block");const s=this.opts.holder.append("div").style("display","inline-block").style("margin-left","50px");const a=s.append("div").style("display","inline-block");const l=s.append("div").style("display","inline-block").style("vertical-align","top").style("margin-top","50px");const o=this.opts.holder.append("div").style("margin-left","50px");this.dom={holder:a,header:this.opts.header,controlsDiv:t,detailsDiv:l,tableDiv:o}}async setControls(){this.dom.controlsDiv.selectAll("*").remove();const e=[{label:"P-value filter cutoff (linear scale)",type:"number",chartType:"geneORA",settingsKey:"pvalue",title:"P-value significance",min:0,max:1},{label:"P-value filter type",type:"radio",chartType:"geneORA",settingsKey:"adjusted_original_pvalue",title:"Toggle between original and adjusted pvalues for volcano plot",options:[{label:"adjusted",value:"adjusted"},{label:"original",value:"original"}]},{label:"Gene set size filter cutoff",type:"number",chartType:"geneORA",settingsKey:"gene_set_size_cutoff",title:"Gene set size cutoff",min:0,max:2e4}];const t={label:"Gene set group",type:"dropdown",chartType:"geneORA",settingsKey:"pathway",title:"Display table showing original and adjusted pvalues corresponding to each significant pathway",boxLabel:"",options:[{label:"BP: subset of GO",value:"BP: subset of GO"},{label:"MF: subset of GO",value:"MF: subset of GO"},{label:"CC: subset of GO",value:"CC: subset of GO"},{label:"WikiPathways subset of CP",value:"WikiPathways subset of CP"},{label:"REACTOME subset of CP",value:"REACTOME subset of CP"},{label:"H: hallmark gene sets",value:"H: hallmark gene sets"}]};if(!this.settings.pathway){t.options.unshift({label:"-",value:"-"});this.settings.pathway="-"}e.push(t);this.components={controls:await r({app:this.app,id:this.id,holder:this.dom.controlsDiv,inputs:e})};this.components.controls.on("downloadClick.geneORA",(()=>{downloadTable(this.table_rows,this.table_cols)}))}getState(e){const t=e.plots.find((e=>e.id===this.id));if(!t)throw`No plot with id='${this.id}' found`;return{config:t}}async main(){this.config=JSON.parse(JSON.stringify(this.state.config));this.settings=this.config.settings.geneORA;await this.setControls();this.dom.header.style("opacity",.6).style("padding-left","10px").style("font-size","0.75em").text("GENE SET OVERREPRESENTATION ANALYSIS");d(this)}}async function d(t){if(t.settings.pathway!="-"){t.dom.detailsDiv.selectAll("*").remove();t.dom.tableDiv.selectAll("*").remove();t.config.geneORAparams.geneSetGroup=t.settings.pathway;const s=t.dom.detailsDiv.append("div").text("Loading...");let a;try{a=await f(t.config.geneORAparams);s.remove();if(a.error){throw a.error}}catch(e){alert("Error: "+e);return}const i=l({holder:t.dom.detailsDiv});const[n,o]=i.addRow();o.style("text-align","center").style("font-size","0.8em").style("opacity","0.8").text("COUNT");const r=[{label:"Sample genes",values:t.config.geneORAparams.sample_genes.split(",").length},{label:"Gene sets analyzed",values:a.num_pathways}];if(t.config.geneORAparams.background_genes){r.push({label:"Background genes",values:t.config.geneORAparams.background_genes.split(",").length})}for(const e of r){const[t,s]=i.addRow();t.text(e.label);s.style("text-align","end").text(e.values)}t.gene_ora_table_cols=[{label:"Gene set group"},{label:"Original p-value (linear scale)"},{label:"Adjusted p-value (linear scale)"},{label:"Gene set hits"},{label:"Gene set size"}];t.gene_ora_table_rows=[];for(const e of a.pathways){if(t.settings.adjusted_original_pvalue=="adjusted"&&t.settings.pvalue>=e.p_value_adjusted&&t.settings.gene_set_size_cutoff>e.gene_set_size){t.gene_ora_table_rows.push([{value:e.pathway_name},{value:e.p_value_original.toPrecision(4)},{value:e.p_value_adjusted.toPrecision(4)},{value:e.gene_set_hits},{value:e.gene_set_size}])}else if(t.settings.adjusted_original_pvalue=="original"&&t.settings.pvalue>=e.p_value_original&&t.settings.gene_set_size_cutoff>e.gene_set_size){t.gene_ora_table_rows.push([{value:e.pathway_name},{value:e.p_value_original.toPrecision(4)},{value:e.p_value_adjusted.toPrecision(4)},{value:e.gene_set_hits},{value:e.gene_set_size}])}}const p=t.dom.tableDiv.append("div");e({columns:t.gene_ora_table_cols,rows:t.gene_ora_table_rows,div:p,showLines:true,maxHeight:"30vh",resize:true})}}async function c(e,t){try{const t={settings:{geneORA:{pvalue:1,adjusted_original_pvalue:"adjusted",pathway:undefined,gene_set_size_cutoff:2e3},controls:{isOpen:true}}};return s(t,e)}catch(e){throw`${e} [geneORA getPlotConfig()]`}}const g=a(p);const u=g;function h(e,t){t.prepPlot({config:{chartType:"geneORA"}})}async function f(e){return await o("genesetOverrepresentation",{body:e})}export{u as componentInit,g as geneORAInit,c as getPlotConfig,h as makeChartBtnMenu};
1
+ import{r as e}from"./table-0daf2b89.js";import{M as t,P as s,h as a,n as i,d as n,D as l,b as o}from"./app-6fb77603.js";import{controlsInit as r}from"./controls-268e40e6.js";import"./tslib.es6-c3c2d88f.js";import"./controls.btns-5bf9e7d7.js";import"./controls.config-2f0fa061.js";import"./termsetting-492eefa7.js";import"path";new t;class p{constructor(){this.type="geneORA"}async init(e){if(!this.opts.holder||!this.opts.header){const e=i(n(this.opts.holder.node().parentNode));this.opts.header=e.header;this.opts.holder=e.body}const t=this.opts.holder.append("div").style("display","inline-block");const s=this.opts.holder.append("div").style("display","inline-block").style("margin-left","50px");const a=s.append("div").style("display","inline-block");const l=s.append("div").style("display","inline-block").style("vertical-align","top").style("margin-top","50px");const o=this.opts.holder.append("div").style("margin-left","50px");this.dom={holder:a,header:this.opts.header,controlsDiv:t,detailsDiv:l,tableDiv:o}}async setControls(){this.dom.controlsDiv.selectAll("*").remove();const e=[{label:"P-value filter cutoff (linear scale)",type:"number",chartType:"geneORA",settingsKey:"pvalue",title:"P-value significance",min:0,max:1},{label:"P-value filter type",type:"radio",chartType:"geneORA",settingsKey:"adjusted_original_pvalue",title:"Toggle between original and adjusted pvalues for volcano plot",options:[{label:"adjusted",value:"adjusted"},{label:"original",value:"original"}]},{label:"Gene set size filter cutoff",type:"number",chartType:"geneORA",settingsKey:"gene_set_size_cutoff",title:"Gene set size cutoff",min:0,max:2e4}];const t={label:"Gene set group",type:"dropdown",chartType:"geneORA",settingsKey:"pathway",title:"Display table showing original and adjusted pvalues corresponding to each significant pathway",boxLabel:"",options:[{label:"BP: subset of GO",value:"BP: subset of GO"},{label:"MF: subset of GO",value:"MF: subset of GO"},{label:"CC: subset of GO",value:"CC: subset of GO"},{label:"WikiPathways subset of CP",value:"WikiPathways subset of CP"},{label:"REACTOME subset of CP",value:"REACTOME subset of CP"},{label:"H: hallmark gene sets",value:"H: hallmark gene sets"}]};if(!this.settings.pathway){t.options.unshift({label:"-",value:"-"});this.settings.pathway="-"}e.push(t);this.components={controls:await r({app:this.app,id:this.id,holder:this.dom.controlsDiv,inputs:e})};this.components.controls.on("downloadClick.geneORA",(()=>{downloadTable(this.table_rows,this.table_cols)}))}getState(e){const t=e.plots.find((e=>e.id===this.id));if(!t)throw`No plot with id='${this.id}' found`;return{config:t}}async main(){this.config=JSON.parse(JSON.stringify(this.state.config));this.settings=this.config.settings.geneORA;await this.setControls();this.dom.header.style("opacity",.6).style("padding-left","10px").style("font-size","0.75em").text("GENE SET OVERREPRESENTATION ANALYSIS");d(this)}}async function d(t){if(t.settings.pathway!="-"){t.dom.detailsDiv.selectAll("*").remove();t.dom.tableDiv.selectAll("*").remove();t.config.geneORAparams.geneSetGroup=t.settings.pathway;const s=t.dom.detailsDiv.append("div").text("Loading...");let a;try{a=await f(t.config.geneORAparams);s.remove();if(a.error){throw a.error}}catch(e){alert("Error: "+e);return}const i=l({holder:t.dom.detailsDiv});const[n,o]=i.addRow();o.style("text-align","center").style("font-size","0.8em").style("opacity","0.8").text("COUNT");const r=[{label:"Sample genes",values:t.config.geneORAparams.sample_genes.split(",").length},{label:"Gene sets analyzed",values:a.num_pathways}];if(t.config.geneORAparams.background_genes){r.push({label:"Background genes",values:t.config.geneORAparams.background_genes.split(",").length})}for(const e of r){const[t,s]=i.addRow();t.text(e.label);s.style("text-align","end").text(e.values)}t.gene_ora_table_cols=[{label:"Gene set group"},{label:"Original p-value (linear scale)"},{label:"Adjusted p-value (linear scale)"},{label:"Gene set hits"},{label:"Gene set size"}];t.gene_ora_table_rows=[];for(const e of a.pathways){if(t.settings.adjusted_original_pvalue=="adjusted"&&t.settings.pvalue>=e.p_value_adjusted&&t.settings.gene_set_size_cutoff>e.gene_set_size){t.gene_ora_table_rows.push([{value:e.pathway_name},{value:e.p_value_original.toPrecision(4)},{value:e.p_value_adjusted.toPrecision(4)},{value:e.gene_set_hits},{value:e.gene_set_size}])}else if(t.settings.adjusted_original_pvalue=="original"&&t.settings.pvalue>=e.p_value_original&&t.settings.gene_set_size_cutoff>e.gene_set_size){t.gene_ora_table_rows.push([{value:e.pathway_name},{value:e.p_value_original.toPrecision(4)},{value:e.p_value_adjusted.toPrecision(4)},{value:e.gene_set_hits},{value:e.gene_set_size}])}}const p=t.dom.tableDiv.append("div");e({columns:t.gene_ora_table_cols,rows:t.gene_ora_table_rows,div:p,showLines:true,maxHeight:"30vh",resize:true})}}async function g(e,t){try{const t={settings:{geneORA:{pvalue:1,adjusted_original_pvalue:"adjusted",pathway:undefined,gene_set_size_cutoff:2e3},controls:{isOpen:true}}};return s(t,e)}catch(e){throw`${e} [geneORA getPlotConfig()]`}}const c=a(p);const u=c;function h(e,t){t.prepPlot({config:{chartType:"geneORA"}})}async function f(e){return await o("genesetOverrepresentation",{body:e})}export{u as componentInit,c as geneORAInit,g as getPlotConfig,h as makeChartBtnMenu};
@@ -1 +1 @@
1
- import{_ as e,c as t}from"./tslib.es6-c3c2d88f.js";import{B as i,P as n,bT as o,ak as s,z as r,ap as d,at as p}from"./app-2cd97738.js";import{o as l,s as a}from"./termsetting-ad8c4f3a.js";import{m as u}from"./radiobutton-09bff425.js";import{GroupSettingMethods as c}from"./groupsetting-3fef59f9.js";import"path";function f(t){return{getPillName(e){return l(t,e)},getPillStatus(){var e,n,o,s;if(t.q.type=="predefined-groupset"||t.q.type=="custom-groupset"){const s=[];s.push(i[t.q.dt]);const r=(n=(e=t.vocabApi.termdbConfig.assayAvailability)===null||e===void 0?void 0:e.byDt[t.q.dt])===null||n===void 0?void 0:n.byOrigin;if(r)s.push(((o=r[t.q.origin])===null||o===void 0?void 0:o.label)||t.q.origin);if(t.q.type=="predefined-groupset"){const e=t.term.groupsetting.lst[t.q.predefined_groupset_idx];s.push(e.name)}else if(t.q.type=="custom-groupset"){const e=t.q.customset.groups.length;s.push(`Divided into ${e} groups`)}else{throw"unknown setting for groupsetting"}return{text:s.join(" - ")}}else{return{text:((s=t.q.exclude)===null||s===void 0?void 0:s.length)?"matching variants":"any variant class"}}},showEditMenu(i){return e(this,void 0,void 0,(function*(){yield v(t,i)}))},postMain(){var i,n;return e(this,void 0,void 0,(function*(){const e=((n=(i=t.opts).getBodyParams)===null||n===void 0?void 0:n.call(i))||{};const o=yield t.vocabApi.getCategories(t.term,t.filter,e);t.category2samplecount=o.lst}))}}}function g(e,t,i=null){var s,r,d,p;if(!e.term.id)e.term.id=e.term.name;if(!e.term.kind){const t=e.term;if(t.gene||t.name&&!t.chr)t.kind="gene";else if(t.chr)t.kind="coord";else throw"unable to assign geneVariant term.kind"}if(e.term.kind=="gene"){if(!e.term.gene)e.term.gene=e.term.name;if(!e.term.name)e.term.name=e.term.gene;if(!e.term.gene||!e.term.name)throw"missing gene/name"}else if(e.term.kind=="coord"){if(!e.term.chr||!Number.isInteger(e.term.start)||!Number.isInteger(e.term.stop))throw"no position specified";if(!e.term.name){e.term.name=`${e.term.chr}:${e.term.start+1}-${e.term.stop}`}}else{throw"cannot recognize tw.term.kind"}if(!Object.keys(e.q).includes("type"))e.q.type="values";if(i){i.isAtomic=true;n(e.q,i)}if(!e.term.groupsetting)e.term.groupsetting=o;if(e.q.type=="predefined-groupset"||e.q.type=="custom-groupset"){if(!e.q.dt){const i=m(t.termdbConfig.queries);e.q.dt=i[0]}const i=(r=(s=t.termdbConfig.assayAvailability)===null||s===void 0?void 0:s.byDt[e.q.dt])===null||r===void 0?void 0:r.byOrigin;if(i&&!e.q.origin)e.q.origin="somatic";if(e.q.type=="predefined-groupset"){if(!Number.isInteger(e.q.predefined_groupset_idx)){const t=y(e.q.dt);e.q.predefined_groupset_idx=t[0]}}}{const i=(d=t.termdbConfig.customTwQByType)===null||d===void 0?void 0:d.geneVariant;if(i&&e.term.name){Object.assign(e.q,i.default||{},((p=i.byGene)===null||p===void 0?void 0:p[e.term.name])||{},e.q)}}if("cnvMaxLength"in e.q){if(!Number.isInteger(e.q.cnvMaxLength))throw"cnvMaxLength is not integer"}else{e.q.cnvMaxLength=2e6}if("cnvGainCutoff"in e.q){if(!Number.isFinite(e.q.cnvGainCutoff))throw"cnvGainCutoff is not finite";if(e.q.cnvGainCutoff&&e.q.cnvGainCutoff<0)throw"cnvGainCutoff is not positive"}else{e.q.cnvGainCutoff=.2}if("cnvLossCutoff"in e.q){if(!Number.isFinite(e.q.cnvLossCutoff))throw"cnvLossCutoff is not finite";if(e.q.cnvLossCutoff&&e.q.cnvLossCutoff>0)throw"cnvLossCutoff is not negative"}else{e.q.cnvLossCutoff=-.2}a(e.q,e.term)}function v(n,o){var d,p;return e(this,void 0,void 0,(function*(){const l=o.append("div").style("padding","8px");l.append("div").style("font-size","1.2rem").text(n.term.name);const a=l.append("div").style("margin-top","10px");const f=l.append("div").style("display","none").style("margin","5px 0px 0px 30px").style("vertical-align","top");const g=f.append("div");const v=f.append("div").style("margin-top","15px");const b=f.append("div").style("margin-top","15px");const h=l.append("div").style("display","none").style("margin-left","20px").style("vertical-align","top");a.append("div").style("font-weight","bold").text("Group variants");const x=n.q.type=="predefined-groupset"||n.q.type=="custom-groupset";const k=u({holder:a,options:[{label:"No variant grouping",value:"noGroup",checked:!x},{label:"Assign variants to groups",value:"group",checked:x}],callback:t=>e(this,void 0,void 0,(function*(){if(t=="group"){yield C()}else{q(n);delete n.q.dt;delete n.q.origin;f.style("display","none");h.style("display","none")}}))});if(((d=n.usecase)===null||d===void 0?void 0:d.detail)=="term0"||((p=n.usecase)===null||p===void 0?void 0:p.detail)=="term2"){a.style("display","none");f.style("margin","10px 0px 0px 00px")}const _=k.inputs.filter((e=>e.checked));if(_.property("value")=="group")yield C();function C(){return e(this,void 0,void 0,(function*(){f.style("display","inline-block");w();j();const e=y(n.q.dt);if(n.q.dt==s){O(e);yield I()}else{A(e)}}))}function w(){g.selectAll("*").remove();g.append("div").style("font-weight","bold").text("Variant type");const t=m(n.vocabApi.termdbConfig.queries);if(!n.q.dt)n.q.dt=t[0];u({holder:g,options:t.map((e=>({label:i[e],value:e,checked:e==n.q.dt}))),callback:t=>e(this,void 0,void 0,(function*(){n.q.dt=t;q(n);yield C()}))})}function j(){var t,i;const o=(i=(t=n.vocabApi.termdbConfig.assayAvailability)===null||t===void 0?void 0:t.byDt[n.q.dt])===null||i===void 0?void 0:i.byOrigin;if(!o){delete n.q.origin;v.style("display","none");return}if(!n.q.origin)n.q.origin="somatic";v.style("display","block");v.selectAll("*").remove();v.append("div").style("font-weight","bold").text("Variant origin");u({holder:v,options:["somatic","germline"].map((e=>({label:o[e].label,value:e,checked:e==n.q.origin}))),callback:t=>e(this,void 0,void 0,(function*(){n.q.origin=t;q(n);yield C()}))})}function O(t){b.selectAll("*").remove();b.append("div").style("font-weight","bold").text("Variant grouping");if(n.q.type!="predefined-groupset"&&n.q.type!="custom-groupset"){n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:t[0]})}const i=u({holder:b,options:[{label:"Predefined groups",value:"predefined",checked:n.q.type=="predefined-groupset"},{label:"Custom groups",value:"custom",checked:n.q.type=="custom-groupset"}],callback:i=>e(this,void 0,void 0,(function*(){if(i=="predefined"){n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:t[0]})}else{o.style("display","none");L()}yield C()}))});const o=i.divs.filter((e=>e.value=="predefined")).append("div").style("margin","5px 0px 0px 30px");const s=i.inputs.filter((e=>e.checked));if(s.property("value")=="predefined"){const i=n.q;u({holder:o,options:t.map((e=>{const t=n.term.groupsetting.lst[e];return{label:t.name,value:e,checked:e==i.predefined_groupset_idx}})),callback:t=>e(this,void 0,void 0,(function*(){i.predefined_groupset_idx=t;yield C()}))})}else{o.style("display","none")}}function A(e){h.style("display","none");delete n.groupSettingInstance;b.selectAll("*").remove();b.append("div").style("font-weight","bold").text("Variant grouping");n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:e[0]});const t=n.term.groupsetting.lst[n.q.predefined_groupset_idx];b.append("div").style("margin","5px 0px 0px 10px").text(t.name)}function G(e){if(e.type=="values"){const i=t(e,["type"]);return i}else if(e.type=="predefined-groupset"){const i=t(e,["type","predefined_groupset_idx"]);return i}else{const i=t(e,["type","customset"]);return i}}function L(){const e=n.category2samplecount.find((e=>e.dt==n.q.dt));const t=e.classes.byOrigin?e.classes.byOrigin[n.q.origin]:e.classes;const i=[{name:"Group 1",type:"values",values:Object.keys(t).map((e=>({key:e,label:r[e].label})))},{name:"Group 2",type:"values",values:[]}];n.q=Object.assign(Object.assign({},G(n.q)),{type:"custom-groupset",customset:{groups:i}})}function I(){return e(this,void 0,void 0,(function*(){h.style("display","inline-block");h.selectAll("*").remove();n.groupSettingInstance=new c(n,{holder:h,hideApply:true});yield n.groupSettingInstance.main()}))}l.append("button").style("margin-top","20px").style("display","block").text("Apply").on("click",(()=>{if((n.q.type=="predefined-groupset"||n.q.type=="custom-groupset")&&n.groupSettingInstance)n.groupSettingInstance.processDraggables();n.runCallback()}))}))}function m(e){const t=[];for(const i of Object.keys(e)){if(i=="snvindel")t.push(s);else if(i=="cnv")t.push(d);else if(i=="svfusion")t.push(p);else continue}return t}function y(e){const t=e==s?[0,1,2]:e==d?[3]:e==p?[4]:[];if(!t.length)throw"groupset_idxs is empty";return t}function q(e){e.q.type="values";delete e.q.predefined_groupset_idx;delete e.q.customset;delete e.groupSettingInstance}export{g as fillTW,f as getHandler};
1
+ import{_ as e,c as t}from"./tslib.es6-c3c2d88f.js";import{B as i,P as n,bT as o,ak as s,z as r,ap as d,at as p}from"./app-6fb77603.js";import{o as l,s as a}from"./termsetting-492eefa7.js";import{m as u}from"./radiobutton-09bff425.js";import{GroupSettingMethods as c}from"./groupsetting-e3a4ecd5.js";import"path";function f(t){return{getPillName(e){return l(t,e)},getPillStatus(){var e,n,o,s;if(t.q.type=="predefined-groupset"||t.q.type=="custom-groupset"){const s=[];s.push(i[t.q.dt]);const r=(n=(e=t.vocabApi.termdbConfig.assayAvailability)===null||e===void 0?void 0:e.byDt[t.q.dt])===null||n===void 0?void 0:n.byOrigin;if(r)s.push(((o=r[t.q.origin])===null||o===void 0?void 0:o.label)||t.q.origin);if(t.q.type=="predefined-groupset"){const e=t.term.groupsetting.lst[t.q.predefined_groupset_idx];s.push(e.name)}else if(t.q.type=="custom-groupset"){const e=t.q.customset.groups.length;s.push(`Divided into ${e} groups`)}else{throw"unknown setting for groupsetting"}return{text:s.join(" - ")}}else{return{text:((s=t.q.exclude)===null||s===void 0?void 0:s.length)?"matching variants":"any variant class"}}},showEditMenu(i){return e(this,void 0,void 0,(function*(){yield v(t,i)}))},postMain(){var i,n;return e(this,void 0,void 0,(function*(){const e=((n=(i=t.opts).getBodyParams)===null||n===void 0?void 0:n.call(i))||{};const o=yield t.vocabApi.getCategories(t.term,t.filter,e);t.category2samplecount=o.lst}))}}}function g(e,t,i=null){var s,r,d,p;if(!e.term.id)e.term.id=e.term.name;if(!e.term.kind){const t=e.term;if(t.gene||t.name&&!t.chr)t.kind="gene";else if(t.chr)t.kind="coord";else throw"unable to assign geneVariant term.kind"}if(e.term.kind=="gene"){if(!e.term.gene)e.term.gene=e.term.name;if(!e.term.name)e.term.name=e.term.gene;if(!e.term.gene||!e.term.name)throw"missing gene/name"}else if(e.term.kind=="coord"){if(!e.term.chr||!Number.isInteger(e.term.start)||!Number.isInteger(e.term.stop))throw"no position specified";if(!e.term.name){e.term.name=`${e.term.chr}:${e.term.start+1}-${e.term.stop}`}}else{throw"cannot recognize tw.term.kind"}if(!Object.keys(e.q).includes("type"))e.q.type="values";if(i){i.isAtomic=true;n(e.q,i)}if(!e.term.groupsetting)e.term.groupsetting=o;if(e.q.type=="predefined-groupset"||e.q.type=="custom-groupset"){if(!e.q.dt){const i=m(t.termdbConfig.queries);e.q.dt=i[0]}const i=(r=(s=t.termdbConfig.assayAvailability)===null||s===void 0?void 0:s.byDt[e.q.dt])===null||r===void 0?void 0:r.byOrigin;if(i&&!e.q.origin)e.q.origin="somatic";if(e.q.type=="predefined-groupset"){if(!Number.isInteger(e.q.predefined_groupset_idx)){const t=y(e.q.dt);e.q.predefined_groupset_idx=t[0]}}}{const i=(d=t.termdbConfig.customTwQByType)===null||d===void 0?void 0:d.geneVariant;if(i&&e.term.name){Object.assign(e.q,i.default||{},((p=i.byGene)===null||p===void 0?void 0:p[e.term.name])||{},e.q)}}if("cnvMaxLength"in e.q){if(!Number.isInteger(e.q.cnvMaxLength))throw"cnvMaxLength is not integer"}else{e.q.cnvMaxLength=2e6}if("cnvGainCutoff"in e.q){if(!Number.isFinite(e.q.cnvGainCutoff))throw"cnvGainCutoff is not finite";if(e.q.cnvGainCutoff&&e.q.cnvGainCutoff<0)throw"cnvGainCutoff is not positive"}else{e.q.cnvGainCutoff=.2}if("cnvLossCutoff"in e.q){if(!Number.isFinite(e.q.cnvLossCutoff))throw"cnvLossCutoff is not finite";if(e.q.cnvLossCutoff&&e.q.cnvLossCutoff>0)throw"cnvLossCutoff is not negative"}else{e.q.cnvLossCutoff=-.2}a(e.q,e.term)}function v(n,o){var d,p;return e(this,void 0,void 0,(function*(){const l=o.append("div").style("padding","8px");l.append("div").style("font-size","1.2rem").text(n.term.name);const a=l.append("div").style("margin-top","10px");const f=l.append("div").style("display","none").style("margin","5px 0px 0px 30px").style("vertical-align","top");const g=f.append("div");const v=f.append("div").style("margin-top","15px");const b=f.append("div").style("margin-top","15px");const h=l.append("div").style("display","none").style("margin-left","20px").style("vertical-align","top");a.append("div").style("font-weight","bold").text("Group variants");const x=n.q.type=="predefined-groupset"||n.q.type=="custom-groupset";const k=u({holder:a,options:[{label:"No variant grouping",value:"noGroup",checked:!x},{label:"Assign variants to groups",value:"group",checked:x}],callback:t=>e(this,void 0,void 0,(function*(){if(t=="group"){yield C()}else{q(n);delete n.q.dt;delete n.q.origin;f.style("display","none");h.style("display","none")}}))});if(((d=n.usecase)===null||d===void 0?void 0:d.detail)=="term0"||((p=n.usecase)===null||p===void 0?void 0:p.detail)=="term2"){a.style("display","none");f.style("margin","10px 0px 0px 00px")}const _=k.inputs.filter((e=>e.checked));if(_.property("value")=="group")yield C();function C(){return e(this,void 0,void 0,(function*(){f.style("display","inline-block");w();j();const e=y(n.q.dt);if(n.q.dt==s){O(e);yield I()}else{A(e)}}))}function w(){g.selectAll("*").remove();g.append("div").style("font-weight","bold").text("Variant type");const t=m(n.vocabApi.termdbConfig.queries);if(!n.q.dt)n.q.dt=t[0];u({holder:g,options:t.map((e=>({label:i[e],value:e,checked:e==n.q.dt}))),callback:t=>e(this,void 0,void 0,(function*(){n.q.dt=t;q(n);yield C()}))})}function j(){var t,i;const o=(i=(t=n.vocabApi.termdbConfig.assayAvailability)===null||t===void 0?void 0:t.byDt[n.q.dt])===null||i===void 0?void 0:i.byOrigin;if(!o){delete n.q.origin;v.style("display","none");return}if(!n.q.origin)n.q.origin="somatic";v.style("display","block");v.selectAll("*").remove();v.append("div").style("font-weight","bold").text("Variant origin");u({holder:v,options:["somatic","germline"].map((e=>({label:o[e].label,value:e,checked:e==n.q.origin}))),callback:t=>e(this,void 0,void 0,(function*(){n.q.origin=t;q(n);yield C()}))})}function O(t){b.selectAll("*").remove();b.append("div").style("font-weight","bold").text("Variant grouping");if(n.q.type!="predefined-groupset"&&n.q.type!="custom-groupset"){n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:t[0]})}const i=u({holder:b,options:[{label:"Predefined groups",value:"predefined",checked:n.q.type=="predefined-groupset"},{label:"Custom groups",value:"custom",checked:n.q.type=="custom-groupset"}],callback:i=>e(this,void 0,void 0,(function*(){if(i=="predefined"){n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:t[0]})}else{o.style("display","none");L()}yield C()}))});const o=i.divs.filter((e=>e.value=="predefined")).append("div").style("margin","5px 0px 0px 30px");const s=i.inputs.filter((e=>e.checked));if(s.property("value")=="predefined"){const i=n.q;u({holder:o,options:t.map((e=>{const t=n.term.groupsetting.lst[e];return{label:t.name,value:e,checked:e==i.predefined_groupset_idx}})),callback:t=>e(this,void 0,void 0,(function*(){i.predefined_groupset_idx=t;yield C()}))})}else{o.style("display","none")}}function A(e){h.style("display","none");delete n.groupSettingInstance;b.selectAll("*").remove();b.append("div").style("font-weight","bold").text("Variant grouping");n.q=Object.assign(Object.assign({},G(n.q)),{type:"predefined-groupset",predefined_groupset_idx:e[0]});const t=n.term.groupsetting.lst[n.q.predefined_groupset_idx];b.append("div").style("margin","5px 0px 0px 10px").text(t.name)}function G(e){if(e.type=="values"){const i=t(e,["type"]);return i}else if(e.type=="predefined-groupset"){const i=t(e,["type","predefined_groupset_idx"]);return i}else{const i=t(e,["type","customset"]);return i}}function L(){const e=n.category2samplecount.find((e=>e.dt==n.q.dt));const t=e.classes.byOrigin?e.classes.byOrigin[n.q.origin]:e.classes;const i=[{name:"Group 1",type:"values",values:Object.keys(t).map((e=>({key:e,label:r[e].label})))},{name:"Group 2",type:"values",values:[]}];n.q=Object.assign(Object.assign({},G(n.q)),{type:"custom-groupset",customset:{groups:i}})}function I(){return e(this,void 0,void 0,(function*(){h.style("display","inline-block");h.selectAll("*").remove();n.groupSettingInstance=new c(n,{holder:h,hideApply:true});yield n.groupSettingInstance.main()}))}l.append("button").style("margin-top","20px").style("display","block").text("Apply").on("click",(()=>{if((n.q.type=="predefined-groupset"||n.q.type=="custom-groupset")&&n.groupSettingInstance)n.groupSettingInstance.processDraggables();n.runCallback()}))}))}function m(e){const t=[];for(const i of Object.keys(e)){if(i=="snvindel")t.push(s);else if(i=="cnv")t.push(d);else if(i=="svfusion")t.push(p);else continue}return t}function y(e){const t=e==s?[0,1,2]:e==d?[3]:e==p?[4]:[];if(!t.length)throw"groupset_idxs is empty";return t}function q(e){e.q.type="values";delete e.q.predefined_groupset_idx;delete e.q.customset;delete e.groupSettingInstance}export{g as fillTW,f as getHandler};
@@ -1 +1 @@
1
- import{_ as e}from"./tslib.es6-c3c2d88f.js";import{M as t}from"./app-2cd97738.js";import{a as n}from"./genesearch-41cb55ce.js";class o{init(e){this.callback=e.callback;const o=n({tip:new t({padding:"0px"}),genome:e.genomeObj,row:e.holder,callback:()=>this.selectGene(o)})}selectGene(t){return e(this,void 0,void 0,(function*(){if(t.geneSymbol){this.callback({kind:"gene",id:t.geneSymbol,gene:t.geneSymbol,name:t.geneSymbol,type:"geneVariant"})}else if(t.chr&&t.start&&t.stop){const{chr:e,start:n,stop:o}=t;const s=`${e}:${n+1}-${o}`;this.callback({kind:"coord",id:s,chr:e,start:n,stop:o,name:s,type:"geneVariant"})}else{throw"no gene or position specified"}}))}}export{o as SearchHandler};
1
+ import{_ as e}from"./tslib.es6-c3c2d88f.js";import{M as t}from"./app-6fb77603.js";import{a as n}from"./genesearch-ffd88bf2.js";class o{init(e){this.callback=e.callback;const o=n({tip:new t({padding:"0px"}),genome:e.genomeObj,row:e.holder,callback:()=>this.selectGene(o)})}selectGene(t){return e(this,void 0,void 0,(function*(){if(t.geneSymbol){this.callback({kind:"gene",id:t.geneSymbol,gene:t.geneSymbol,name:t.geneSymbol,type:"geneVariant"})}else if(t.chr&&t.start&&t.stop){const{chr:e,start:n,stop:o}=t;const s=`${e}:${n+1}-${o}`;this.callback({kind:"coord",id:s,chr:e,start:n,stop:o,name:s,type:"geneVariant"})}else{throw"no gene or position specified"}}))}}export{o as SearchHandler};
@@ -1 +1 @@
1
- import{a as e,e as t,b as n,c as s}from"./uiUtils-ff2d4a6a.js";import{j as o,d as a,aT as p}from"./app-2cd97738.js";import{T as i}from"./toggleButtons-04c5ad7c.js";import"./tslib.es6-c3c2d88f.js";function r(t,n){const s=t.append("div").style("margin","20px 20px 20px 40px").style("font-family","'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif").style("place-items","center left").style("overflow","hidden").classed("sjpp-app-ui",true);const o={};l(s,o);const a=s.append("div").style("display","flex").style("align-items","center").style("margin","10px");c(a,n,o);d(a,o);const p=s.append("div").style("display","flex").style("align-items","center").style("margin","40px 0px 40px 130px");m(p,o,t);e(p,o,".genefusion_input").style("margin","0px 10px");y(s);return o}function l(e,n){const s=t({div:e,cols:50,placeholder:"Example: PAX5,chr9,37002646,-::JAK2,chr9,5081726,+"}).style("border","1px solid rgb(138, 177, 212)").style("margin","0px 0px 0px 20px").classed("genefusion_input",true).on("keyup",(async()=>{n.data=s.property("value").trim()}))}async function c(e,t,s){const o=e.append("div").style("margin-left","40px");const a=n(o,t).style("border","1px solid rgb(138, 177, 212)");s.genome=a.node()}async function d(e,t){const n=e.append("div");const s=n.append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text("Codon position").property("value","codon");s.append("option").text("RNA position").property("value","rna");s.append("option").text("Genomic position").property("value","genomic").attr("selected",true);t.posType=s.node()}function m(e,t,n){const p=s({div:e,text:"Submit"});const i=e.append("div");p.style("display","block").on("click",(()=>{if(!t.data||t.data==undefined){const e=i.append("div").style("display","inline-block").style("max-width","20vw");o(e,"Please provide data");setTimeout((()=>e.remove()),3e3)}else{a(".sjpp-app-ui").remove();const e={host:sessionStorage.getItem("hostURL"),nobox:true,noheader:true,parseurl:false,genome:t.genome.options[t.genome.selectedIndex].text};u(t,n,e)}}))}function y(e){e.append("div").style("margin","10px").style("opacity","0.65").html(`Limited to two-gene fusion products.<br>\n\t\tOne product per line.<br>\n\t\tEach line has eight fields. four fields for each gene. For each gene join the following fields separated by a comma:\n\t\t<ol><li>Gene symbol</li>\n\t\t<li>Chromosome</li>\n\t\t<li>Position</li>\n\t\t<li>Strand</li>\n\t\t</ol>\n\t\tSeparate the two genes by a double colon (::). <br><br>\n\t\tExample: <br>\n\t\t<p style="margin-left: 10px">\n\t\tPAX5,chr9,37002646,-::JAK2,chr9,5081726,+<br>\n\t\tZCCHC7,chr9,37257786,-::PAX5,chr9,37024824,-<br>\n\t\tBCR,chr22,23524427,+::ABL1,chr9,133729449,+<p>`)}function u(e,t,n){if(e.data.split(/[\r\n]/).length==1){const s=e.data.trim().split("::");const o=s[0].split(",");const a=s[1].split(",");return x(t,n,o,a)}const s=t.append("div").append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text(`Select Fusion (${e.data.split(/[\r\n]/).length})`);const o=t.append("div").style("margin","20px");const a=new Map;for(const t of e.data.split(/[\r\n]/)){const e=t.trim().split("::");const n=e[0].split(",");const s=e[1].split(",");a.set(`${n[0]}-${s[0]}`,[n,s])}for(const e of a){s.append("option").property("value",e[0]).text(e[0])}s.on("change",(()=>{o.selectAll("*").remove();const e=a.get(s.property("value"));x(o,n,e[0],e[1])}))}function x(e,t,n,s){const o=[{label:n[0],callback:async(e,o)=>{p(o.contentHolder);const a={holder:o.contentHolder.append("div").style("margin","20px").node(),gene:n[0],tracks:[{type:"mds3",name:n[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,a));delete o.callback}},{label:s[0],callback:async(e,o)=>{p(o.contentHolder);const a={holder:o.contentHolder.append("div").style("margin","20px").node(),gene:s[0],tracks:[{type:"mds3",name:s[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,a));delete o.callback}}];new i({holder:e,tabs:o}).main()}export{r as init_geneFusionUI};
1
+ import{a as e,e as t,b as n,c as s}from"./uiUtils-ea7dfea2.js";import{j as o,d as a,aT as p}from"./app-6fb77603.js";import{T as i}from"./toggleButtons-c4d6f260.js";import"./tslib.es6-c3c2d88f.js";function r(t,n){const s=t.append("div").style("margin","20px 20px 20px 40px").style("font-family","'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif").style("place-items","center left").style("overflow","hidden").classed("sjpp-app-ui",true);const o={};l(s,o);const a=s.append("div").style("display","flex").style("align-items","center").style("margin","10px");d(a,n,o);c(a,o);const p=s.append("div").style("display","flex").style("align-items","center").style("margin","40px 0px 40px 130px");m(p,o,t);e(p,o,".genefusion_input").style("margin","0px 10px");y(s);return o}function l(e,n){const s=t({div:e,cols:50,placeholder:"Example: PAX5,chr9,37002646,-::JAK2,chr9,5081726,+"}).style("border","1px solid rgb(138, 177, 212)").style("margin","0px 0px 0px 20px").classed("genefusion_input",true).on("keyup",(async()=>{n.data=s.property("value").trim()}))}async function d(e,t,s){const o=e.append("div").style("margin-left","40px");const a=n(o,t).style("border","1px solid rgb(138, 177, 212)");s.genome=a.node()}async function c(e,t){const n=e.append("div");const s=n.append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text("Codon position").property("value","codon");s.append("option").text("RNA position").property("value","rna");s.append("option").text("Genomic position").property("value","genomic").attr("selected",true);t.posType=s.node()}function m(e,t,n){const p=s({div:e,text:"Submit"});const i=e.append("div");p.style("display","block").on("click",(()=>{if(!t.data||t.data==undefined){const e=i.append("div").style("display","inline-block").style("max-width","20vw");o(e,"Please provide data");setTimeout((()=>e.remove()),3e3)}else{a(".sjpp-app-ui").remove();const e={host:sessionStorage.getItem("hostURL"),nobox:true,noheader:true,parseurl:false,genome:t.genome.options[t.genome.selectedIndex].text};u(t,n,e)}}))}function y(e){e.append("div").style("margin","10px").style("opacity","0.65").html(`Limited to two-gene fusion products.<br>\n\t\tOne product per line.<br>\n\t\tEach line has eight fields. four fields for each gene. For each gene join the following fields separated by a comma:\n\t\t<ol><li>Gene symbol</li>\n\t\t<li>Chromosome</li>\n\t\t<li>Position</li>\n\t\t<li>Strand</li>\n\t\t</ol>\n\t\tSeparate the two genes by a double colon (::). <br><br>\n\t\tExample: <br>\n\t\t<p style="margin-left: 10px">\n\t\tPAX5,chr9,37002646,-::JAK2,chr9,5081726,+<br>\n\t\tZCCHC7,chr9,37257786,-::PAX5,chr9,37024824,-<br>\n\t\tBCR,chr22,23524427,+::ABL1,chr9,133729449,+<p>`)}function u(e,t,n){if(e.data.split(/[\r\n]/).length==1){const s=e.data.trim().split("::");const o=s[0].split(",");const a=s[1].split(",");return x(t,n,o,a)}const s=t.append("div").append("select").style("border-radius","5px").style("padding","5px 10px").style("margin","1px 10px 1px 10px");s.append("option").text(`Select Fusion (${e.data.split(/[\r\n]/).length})`);const o=t.append("div").style("margin","20px");const a=new Map;for(const t of e.data.split(/[\r\n]/)){const e=t.trim().split("::");const n=e[0].split(",");const s=e[1].split(",");a.set(`${n[0]}-${s[0]}`,[n,s])}for(const e of a){s.append("option").property("value",e[0]).text(e[0])}s.on("change",(()=>{o.selectAll("*").remove();const e=a.get(s.property("value"));x(o,n,e[0],e[1])}))}function x(e,t,n,s){const o=[{label:n[0],callback:async(e,o)=>{p(o.contentHolder);const a={holder:o.contentHolder.append("div").style("margin","20px").node(),gene:n[0],tracks:[{type:"mds3",name:n[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,a));delete o.callback}},{label:s[0],callback:async(e,o)=>{p(o.contentHolder);const a={holder:o.contentHolder.append("div").style("margin","20px").node(),gene:s[0],tracks:[{type:"mds3",name:s[0],custom_variants:[{gene1:n[0],chr1:n[1],pos1:parseInt(n[2]),strand1:n[3],gene2:s[0],chr2:s[1],pos2:parseInt(s[2]),strand2:s[3],dt:2,class:"Fuserna"}]}]};runproteinpaint(Object.assign(t,a));delete o.callback}}];new i({holder:e,tabs:o}).main()}export{r as init_geneFusionUI};
@@ -1 +1 @@
1
- import{_ as e}from"./tslib.es6-c3c2d88f.js";import{k as t,c as n,a as r,b as o,w as i,x as s}from"./app-2cd97738.js";function l(s){const l=s.tip,c=s.row;const u={};if((s===null||s===void 0?void 0:s.searchOnly)=="snp"&&!s.genome.hasSNP){c.append("span").text('Cannot support .searchOnly = "snp". Genome lacks SNP');return u}let d,f=150;if("placeholder"in s){d=s.placeholder}else if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){d="Gene";f=100}else{d=(s===null||s===void 0?void 0:s.searchOnly)=="snp"?"Position":"Gene, position";if(s.genome.hasSNP){d+=", dbSNP";f+=40}if(s.allowVariant){d+=", variant";f+=40}}const p=c.append("input").attr("type","text").attr("placeholder",d).attr("aria-label","Gene symbol, position, or alias").attr("class","sja_genesearchinput").style("width",f+"px").on("focus",(e=>{e.target.select()})).on("keyup",(r=>e(this,void 0,void 0,(function*(){const e=r.target;const o=e.value.trim();if(s.emptyInputCallback&&o.length==0&&t(r)){l.hide();s.emptyInputCallback();m.word.text("");m.mark.html("");return}if(o.length<=1)return l.hide();m.mark.html("");m.word.style("font-size","0.7em");if(s.hideHelp){m.word.text("")}else{m.word.text("Press ENTER to search, ESC to cancel")}if(t(r)){e.blur();l.hide();if((s===null||s===void 0?void 0:s.searchOnly)!="snp"){const e=l.d.select(".sja_menuoption[isgene='1']");if(e.size()){const t=e.datum();(s===null||s===void 0?void 0:s.searchOnly)=="gene"?b({geneSymbol:t},t):yield v(t);return}}if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){b(null,"Gene not found");return}if(s.allowVariant){const e=yield a(o,s.genome);if(e){b(e,o);return}}const t=l.d.select(".sja_menuoption[issnp='1']");if(t.size()){const e=t.datum();b({chr:e.chrom,start:e.chromStart,stop:e.chromEnd,ref:e.ref,alt:e.alt},e.name||o);return}if((s===null||s===void 0?void 0:s.searchOnly)=="snp"){b(null,"Variant not found");return}const r=n(o,s.genome);if(r){b(r,"Valid coordinate");return}b(null,"No match");return}if(r.code=="Escape"){l.hide();if(u.chr){b(u,u.fromWhat)}else if(s.defaultCoord){const t=s.defaultCoord;e.value=t.chr+(t.isVariant?"."+t.pos+"."+t.ref+"."+t.alt:":"+t.start+"-"+t.stop)}e.blur();return}if(r.key=="ArrowDown"){l.d.selectAll(".sja_menuoption").attr("tabindex",0).on("keyup",(e=>{if(e.key=="Enter"){e.target.click()}else if(e.key=="ArrowDown"){if(e.target.nextSibling)e.target.nextSibling.focus()}else if(e.key=="ArrowUp"){if(e.target.previousSibling)e.target.previousSibling.focus()}}));l.d.select(".sja_menuoption").node().focus();return}g()}))));if(!s.focusOff)p.node().focus();const m={mark:c.append("span").style("margin-left","5px"),word:c.append("span").style("margin-left","5px").style("font-size",".8em").style("opacity",.6)};function h(){var t,r;return e(this,void 0,void 0,(function*(){const i=p.property("value").trim();if(!i)return;l.showunder(p.node()).clear();if((s===null||s===void 0?void 0:s.searchOnly)!="snp"){const n=yield o("genelookup",{body:{genome:s.genome.name,input:i}});if(n.error)throw n.error;if((t=n.hits)===null||t===void 0?void 0:t.length){l.d.selectAll("div").data(n.hits).join("div").text((e=>e)).attr("class","sja_menuoption").style("border-radius","0px").attr("isgene",1).on("click",((t,n)=>e(this,void 0,void 0,(function*(){if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){b({geneSymbol:n},n);l.hide()}else{yield v(n)}}))));return}}if((s===null||s===void 0?void 0:s.searchOnly)=="gene")return;if(s.allowVariant){const e=yield a(i,s.genome);if(e)return}const c=yield o("snp",{body:{byName:true,genome:s.genome.name,lst:[i]}});if(c.error)throw c.error;if(c.results.length){y(l,c.results);return}const u=n(i,s.genome,true);if(u){if((s===null||s===void 0?void 0:s.searchOnly)=="snp"){if(!((r=u.actualposition)===null||r===void 0?void 0:r.len))return;const e=u.chr;const t=u.actualposition.position-1;const n=t+u.actualposition.len;const i=[{start:t,stop:n}];const a=yield o("snp",{body:{byCoord:true,genome:s.genome.name,chr:e,ranges:i}});if(a.error)throw a.error;if(a.results.length){const e=u.actualposition.len==1?a.results.filter((e=>e.chromStart==t)):a.results;y(l,e)}}return}}))}const g=r.debounce(h,500);function y(e,t){e.d.selectAll("div").data(t).join("div").text((e=>{const t=`${e.chrom}:${e.chromStart+1}`;const n=`${e.ref}>${e.alt.join(",")}`;return`${e.name} (${t} ${n})`})).attr("class","sja_menuoption").style("border-radius","0px").attr("issnp",1).on("click",((t,n)=>{b({chr:n.chrom,start:n.chromStart,stop:n.chromEnd,ref:n.ref,alt:n.alt},n.name);e.hide()}))}function v(t){var n;return e(this,void 0,void 0,(function*(){l.hide();const e=yield o("genelookup",{body:{genome:s.genome.name,input:t,deep:1}});if(e.error)throw e.error;if(!((n=e.gmlst)===null||n===void 0?void 0:n.length))throw"cannot retrieve gene coordinates";const r=i(e.gmlst);if(r.length==1){b(r[0],t,t);return}l.showunder(p.node()).clear();l.d.selectAll("div").data(r).join("div").attr("class","sja_menuoption").style("border-radius","0px").text((e=>e.name+" "+e.chr+":"+e.start+"-"+e.stop)).on("click",((e,n)=>{l.hide();b(n,t+", "+n.name,n.name)}))}))}if(s.defaultCoord){const e=s.defaultCoord;if(e.isVariant){p.property("value",e.chr+"."+e.pos+"."+e.ref+"."+e.alt);u.pos=e.pos;u.ref=e.ref;u.alt=e.alt}else{p.property("value",e.chr+":"+e.start+"-"+e.stop);u.start=e.start;u.stop=e.stop}u.chr=e.chr}function b(t,n,r){return e(this,void 0,void 0,(function*(){if(t){for(const e in u)delete u[e];if(t.isVariant){u.chr=t.chr;u.pos=t.pos;u.ref=t.ref;u.alt=t.alt}else if(t.chr){p.property("value",t.chr+":"+t.start+"-"+t.stop);u.chr=t.chr;u.start=t.start;u.stop=t.stop;if(t.ref)u.ref=t.ref;if(t.alt)u.alt=t.alt}else if(t.geneSymbol){p.property("value",t.geneSymbol);u.geneSymbol=t.geneSymbol}m.mark.style("color","green").html("&check;");if(r){u.geneSymbol=r}}else{m.mark.style("color","red").html("&cross;")}m.word.text(n||"");u.fromWhat=n;if(t&&s.callback){yield s.callback()}}))}if(s.geneSymbol){p.property("value",s.geneSymbol);setTimeout((()=>b({geneSymbol:s.geneSymbol},s.geneSymbol)),10)}return u}function a(t,n){return e(this,void 0,void 0,(function*(){const e=c(t,n);if(e){return e}return yield u(t,n)}))}function c(e,t){const n=e.split(".");if(n.length!=4)return;const r=n[0];const o=Number(n[1]);const i=s(t,r,o,o);if(i)return;return{isVariant:true,chr:r,pos:o,ref:n[2],alt:n[3]}}function u(t,n){return e(this,void 0,void 0,(function*(){const e=t.split(":g.");if(e.length!=2){return}const r=e[0];if(e[1].includes("delins")){return yield m(r,e[1],n)}if(e[1].includes("del")){return yield p(r,e[1],n)}if(e[1].includes("ins")){return f(r,e[1])}return d(r,e[1])}))}function d(e,t){const n=t.match(/^(\d+)([ATCG])>([ATCG])$/);if(!n||n.length!=4){return}const r=Number(n[1]);if(!Number.isInteger(r))return;return{isVariant:true,chr:e,pos:r,ref:n[2],alt:n[3]}}function f(e,t){const[n,r]=t.split("ins");if(!r)return;const o=Number(n.split("_")[0]);if(!Number.isInteger(o))return;return{isVariant:true,chr:e,pos:o+1,ref:"-",alt:r}}function p(t,n,r){return e(this,void 0,void 0,(function*(){const[e,o]=n.split("del");if(o){const n=Number(e.split("_")[0]);if(!Number.isInteger(n))return;return{isVariant:true,chr:t,pos:n,ref:o,alt:"-"}}const[i,s]=e.split("_");const l=Number(i);const a=s?Number(s):l+1;if(!Number.isInteger(l)||!Number.isInteger(a))return;const c=yield h(t,l,a,r);return{isVariant:true,chr:t,ref:c,alt:"-"}}))}function m(t,n,r){return e(this,void 0,void 0,(function*(){const e=n.match(/^(\d+)_(\d+)delins([ATCG]+)$/);if(!e||e.length!=4){return}const o=Number(e[1]),i=Number(e[2]),s=e[3];if(!Number.isInteger(o)||!Number.isInteger(i))return;const l=yield h(t,o,i,r);return{isVariant:true,chr:t,pos:o,ref:l,alt:s}}))}function h(t,n,r,i){return e(this,void 0,void 0,(function*(){const e={coord:t+":"+n+"-"+r,genome:i.name};const s=yield o("ntseq",{body:e});return s.seq}))}export{l as a,a as s};
1
+ import{_ as e}from"./tslib.es6-c3c2d88f.js";import{k as t,c as n,a as r,b as o,w as i,x as s}from"./app-6fb77603.js";function l(s){const l=s.tip,c=s.row;const u={};if((s===null||s===void 0?void 0:s.searchOnly)=="snp"&&!s.genome.hasSNP){c.append("span").text('Cannot support .searchOnly = "snp". Genome lacks SNP');return u}let d,f=150;if("placeholder"in s){d=s.placeholder}else if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){d="Gene";f=100}else{d=(s===null||s===void 0?void 0:s.searchOnly)=="snp"?"Position":"Gene, position";if(s.genome.hasSNP){d+=", dbSNP";f+=40}if(s.allowVariant){d+=", variant";f+=40}}const p=c.append("input").attr("type","text").attr("placeholder",d).attr("aria-label","Gene symbol, position, or alias").attr("class","sja_genesearchinput").style("width",f+"px").on("focus",(e=>{e.target.select()})).on("keyup",(r=>e(this,void 0,void 0,(function*(){const e=r.target;const o=e.value.trim();if(s.emptyInputCallback&&o.length==0&&t(r)){l.hide();s.emptyInputCallback();m.word.text("");m.mark.html("");return}if(o.length<=1)return l.hide();m.mark.html("");m.word.style("font-size","0.7em");if(s.hideHelp){m.word.text("")}else{m.word.text("Press ENTER to search, ESC to cancel")}if(t(r)){e.blur();l.hide();if((s===null||s===void 0?void 0:s.searchOnly)!="snp"){const e=l.d.select(".sja_menuoption[isgene='1']");if(e.size()){const t=e.datum();(s===null||s===void 0?void 0:s.searchOnly)=="gene"?b({geneSymbol:t},t):yield v(t);return}}if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){b(null,"Gene not found");return}if(s.allowVariant){const e=yield a(o,s.genome);if(e){b(e,o);return}}const t=l.d.select(".sja_menuoption[issnp='1']");if(t.size()){const e=t.datum();b({chr:e.chrom,start:e.chromStart,stop:e.chromEnd,ref:e.ref,alt:e.alt},e.name||o);return}if((s===null||s===void 0?void 0:s.searchOnly)=="snp"){b(null,"Variant not found");return}const r=n(o,s.genome);if(r){b(r,"Valid coordinate");return}b(null,"No match");return}if(r.code=="Escape"){l.hide();if(u.chr){b(u,u.fromWhat)}else if(s.defaultCoord){const t=s.defaultCoord;e.value=t.chr+(t.isVariant?"."+t.pos+"."+t.ref+"."+t.alt:":"+t.start+"-"+t.stop)}e.blur();return}if(r.key=="ArrowDown"){l.d.selectAll(".sja_menuoption").attr("tabindex",0).on("keyup",(e=>{if(e.key=="Enter"){e.target.click()}else if(e.key=="ArrowDown"){if(e.target.nextSibling)e.target.nextSibling.focus()}else if(e.key=="ArrowUp"){if(e.target.previousSibling)e.target.previousSibling.focus()}}));l.d.select(".sja_menuoption").node().focus();return}g()}))));if(!s.focusOff)p.node().focus();const m={mark:c.append("span").style("margin-left","5px"),word:c.append("span").style("margin-left","5px").style("font-size",".8em").style("opacity",.6)};function h(){var t,r;return e(this,void 0,void 0,(function*(){const i=p.property("value").trim();if(!i)return;l.showunder(p.node()).clear();if((s===null||s===void 0?void 0:s.searchOnly)!="snp"){const n=yield o("genelookup",{body:{genome:s.genome.name,input:i}});if(n.error)throw n.error;if((t=n.hits)===null||t===void 0?void 0:t.length){l.d.selectAll("div").data(n.hits).join("div").text((e=>e)).attr("class","sja_menuoption").style("border-radius","0px").attr("isgene",1).on("click",((t,n)=>e(this,void 0,void 0,(function*(){if((s===null||s===void 0?void 0:s.searchOnly)=="gene"){b({geneSymbol:n},n);l.hide()}else{yield v(n)}}))));return}}if((s===null||s===void 0?void 0:s.searchOnly)=="gene")return;if(s.allowVariant){const e=yield a(i,s.genome);if(e)return}const c=yield o("snp",{body:{byName:true,genome:s.genome.name,lst:[i]}});if(c.error)throw c.error;if(c.results.length){y(l,c.results);return}const u=n(i,s.genome,true);if(u){if((s===null||s===void 0?void 0:s.searchOnly)=="snp"){if(!((r=u.actualposition)===null||r===void 0?void 0:r.len))return;const e=u.chr;const t=u.actualposition.position-1;const n=t+u.actualposition.len;const i=[{start:t,stop:n}];const a=yield o("snp",{body:{byCoord:true,genome:s.genome.name,chr:e,ranges:i}});if(a.error)throw a.error;if(a.results.length){const e=u.actualposition.len==1?a.results.filter((e=>e.chromStart==t)):a.results;y(l,e)}}return}}))}const g=r.debounce(h,500);function y(e,t){e.d.selectAll("div").data(t).join("div").text((e=>{const t=`${e.chrom}:${e.chromStart+1}`;const n=`${e.ref}>${e.alt.join(",")}`;return`${e.name} (${t} ${n})`})).attr("class","sja_menuoption").style("border-radius","0px").attr("issnp",1).on("click",((t,n)=>{b({chr:n.chrom,start:n.chromStart,stop:n.chromEnd,ref:n.ref,alt:n.alt},n.name);e.hide()}))}function v(t){var n;return e(this,void 0,void 0,(function*(){l.hide();const e=yield o("genelookup",{body:{genome:s.genome.name,input:t,deep:1}});if(e.error)throw e.error;if(!((n=e.gmlst)===null||n===void 0?void 0:n.length))throw"cannot retrieve gene coordinates";const r=i(e.gmlst);if(r.length==1){b(r[0],t,t);return}l.showunder(p.node()).clear();l.d.selectAll("div").data(r).join("div").attr("class","sja_menuoption").style("border-radius","0px").text((e=>e.name+" "+e.chr+":"+e.start+"-"+e.stop)).on("click",((e,n)=>{l.hide();b(n,t+", "+n.name,n.name)}))}))}if(s.defaultCoord){const e=s.defaultCoord;if(e.isVariant){p.property("value",e.chr+"."+e.pos+"."+e.ref+"."+e.alt);u.pos=e.pos;u.ref=e.ref;u.alt=e.alt}else{p.property("value",e.chr+":"+e.start+"-"+e.stop);u.start=e.start;u.stop=e.stop}u.chr=e.chr}function b(t,n,r){return e(this,void 0,void 0,(function*(){if(t){for(const e in u)delete u[e];if(t.isVariant){u.chr=t.chr;u.pos=t.pos;u.ref=t.ref;u.alt=t.alt}else if(t.chr){p.property("value",t.chr+":"+t.start+"-"+t.stop);u.chr=t.chr;u.start=t.start;u.stop=t.stop;if(t.ref)u.ref=t.ref;if(t.alt)u.alt=t.alt}else if(t.geneSymbol){p.property("value",t.geneSymbol);u.geneSymbol=t.geneSymbol}m.mark.style("color","green").html("&check;");if(r){u.geneSymbol=r}}else{m.mark.style("color","red").html("&cross;")}m.word.text(n||"");u.fromWhat=n;if(t&&s.callback){yield s.callback()}}))}if(s.geneSymbol){p.property("value",s.geneSymbol);setTimeout((()=>b({geneSymbol:s.geneSymbol},s.geneSymbol)),10)}return u}function a(t,n){return e(this,void 0,void 0,(function*(){const e=c(t,n);if(e){return e}return yield u(t,n)}))}function c(e,t){const n=e.split(".");if(n.length!=4)return;const r=n[0];const o=Number(n[1]);const i=s(t,r,o,o);if(i)return;return{isVariant:true,chr:r,pos:o,ref:n[2],alt:n[3]}}function u(t,n){return e(this,void 0,void 0,(function*(){const e=t.split(":g.");if(e.length!=2){return}const r=e[0];if(e[1].includes("delins")){return yield m(r,e[1],n)}if(e[1].includes("del")){return yield p(r,e[1],n)}if(e[1].includes("ins")){return f(r,e[1])}return d(r,e[1])}))}function d(e,t){const n=t.match(/^(\d+)([ATCG])>([ATCG])$/);if(!n||n.length!=4){return}const r=Number(n[1]);if(!Number.isInteger(r))return;return{isVariant:true,chr:e,pos:r,ref:n[2],alt:n[3]}}function f(e,t){const[n,r]=t.split("ins");if(!r)return;const o=Number(n.split("_")[0]);if(!Number.isInteger(o))return;return{isVariant:true,chr:e,pos:o+1,ref:"-",alt:r}}function p(t,n,r){return e(this,void 0,void 0,(function*(){const[e,o]=n.split("del");if(o){const n=Number(e.split("_")[0]);if(!Number.isInteger(n))return;return{isVariant:true,chr:t,pos:n,ref:o,alt:"-"}}const[i,s]=e.split("_");const l=Number(i);const a=s?Number(s):l+1;if(!Number.isInteger(l)||!Number.isInteger(a))return;const c=yield h(t,l,a,r);return{isVariant:true,chr:t,ref:c,alt:"-"}}))}function m(t,n,r){return e(this,void 0,void 0,(function*(){const e=n.match(/^(\d+)_(\d+)delins([ATCG]+)$/);if(!e||e.length!=4){return}const o=Number(e[1]),i=Number(e[2]),s=e[3];if(!Number.isInteger(o)||!Number.isInteger(i))return;const l=yield h(t,o,i,r);return{isVariant:true,chr:t,pos:o,ref:l,alt:s}}))}function h(t,n,r,i){return e(this,void 0,void 0,(function*(){const e={coord:t+":"+n+"-"+r,genome:i.name};const s=yield o("ntseq",{body:e});return s.seq}))}export{l as a,a as s};