@sjcrh/proteinpaint-client 2.76.2 → 2.77.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2dmaf-f240211f.js → 2dmaf-dbeff225.js} +1 -1
- package/dist/{AppHeader-c9432a24.js → AppHeader-1fc7f7bd.js} +1 -1
- package/dist/{ColorScale-b991fc9e.js → ColorScale-23c17654.js} +1 -1
- package/dist/{DEanalysis-bbfad00d.js → DEanalysis-a3cf1900.js} +1 -1
- package/dist/{Disco-b7c9bf72.js → Disco-b26a0556.js} +1 -1
- package/dist/{Disco.UI-a5296c36.js → Disco.UI-891c4c35.js} +1 -1
- package/dist/{DragControls-ca3fa0cf.js → DragControls-2fabac26.js} +1 -1
- package/dist/{DziViewer-28915c11.js → DziViewer-5b830c31.js} +1 -1
- package/dist/FilterRxComp-fb608459.js +1 -0
- package/dist/FilterStateless-fc4e4e1b.js +1 -0
- package/dist/{HicApp-e713aa40.js → HicApp-5ed85d49.js} +1 -1
- package/dist/{OrbitControls-2466d420.js → OrbitControls-604f40af.js} +1 -1
- package/dist/{WSIViewer-957695a8.js → WSIViewer-dcce2a10.js} +1 -1
- package/dist/{adSandbox-27d93bc0.js → adSandbox-5fa90964.js} +1 -1
- package/dist/app-0de0ae35.js +1 -0
- package/dist/{app-d215327f.js → app-7f695ce7.js} +1 -1
- package/dist/app-977b083f.js +1 -0
- package/dist/app.js +1 -1
- package/dist/{bam-d67e5315.js → bam-06a5a6a2.js} +1 -1
- package/dist/{barchart-2898d229.js → barchart-978fb21a.js} +1 -1
- package/dist/{barchart.events-426d737a.js → barchart.events-9b482604.js} +1 -1
- package/dist/{bars.renderer-71935d34.js → bars.renderer-d7461d5d.js} +1 -1
- package/dist/{block-75d4ff92.js → block-3db9c74c.js} +1 -1
- package/dist/block.lazyload-19a55cac.js +1 -0
- package/dist/{block.legend-93d85a6e.js → block.legend-97401467.js} +1 -1
- package/dist/{block.mds-84b9d1c1.js → block.mds-dc409568.js} +1 -1
- package/dist/{block.mds.cnv-a991ed79.js → block.mds.cnv-cdabd3f6.js} +1 -1
- package/dist/{block.mds.expressionrank-33b858de.js → block.mds.expressionrank-d768640f.js} +1 -1
- package/dist/{block.mds.expressionstat-3093599f.js → block.mds.expressionstat-7e40426f.js} +1 -1
- package/dist/{block.mds.geneboxplot-b8391d18.js → block.mds.geneboxplot-dae9cfa3.js} +1 -1
- package/dist/{block.mds.junction-69708c7f.js → block.mds.junction-3bc8baea.js} +1 -1
- package/dist/{block.mds.svcnv-322baea6.js → block.mds.svcnv-456dc845.js} +1 -1
- package/dist/{block.mds.svcnv.share-c5c38237.js → block.mds.svcnv.share-4776459b.js} +1 -1
- package/dist/{block.mds2-de4811dd.js → block.mds2-cc586d9d.js} +1 -1
- package/dist/{block.svg-ac9fec2d.js → block.svg-adf47e3a.js} +1 -1
- package/dist/{block.tk.aicheck-ac4b8d4d.js → block.tk.aicheck-f284f080.js} +1 -1
- package/dist/{block.tk.ase-6dc0f9f1.js → block.tk.ase-0477c9f4.js} +1 -1
- package/dist/{block.tk.bam-8f68b41d.js → block.tk.bam-d4c998d4.js} +1 -1
- package/dist/{block.tk.bedgraphdot-d8878860.js → block.tk.bedgraphdot-0177d836.js} +1 -1
- package/dist/{block.tk.bigwig.ui-f6ed051c.js → block.tk.bigwig.ui-95531269.js} +1 -1
- package/dist/{block.tk.hicstraw-725bdc8a.js → block.tk.hicstraw-06e97317.js} +1 -1
- package/dist/{block.tk.junction-f8b0b51d.js → block.tk.junction-18b6b825.js} +1 -1
- package/dist/{block.tk.junction.textmatrixui-252e7d7e.js → block.tk.junction.textmatrixui-ffdbdf81.js} +1 -1
- package/dist/{block.tk.ld-11acf730.js → block.tk.ld-2b56500f.js} +1 -1
- package/dist/{block.tk.menu-5e04436d.js → block.tk.menu-707a4226.js} +1 -1
- package/dist/{block.tk.pgv-fef17dc4.js → block.tk.pgv-63c956c4.js} +1 -1
- package/dist/{boxplot-4c9a5479.js → boxplot-1f229616.js} +1 -1
- package/dist/{brainImaging-7716bc66.js → brainImaging-a0c72fad.js} +1 -1
- package/dist/{brush-9faa7ae7.js → brush-4c775f74.js} +1 -1
- package/dist/{categorical-1dea48ba.js → categorical-25b06bc5.js} +1 -1
- package/dist/{condition-ebac4f75.js → condition-70084a85.js} +1 -1
- package/dist/{controls-268e40e6.js → controls-1f3ac9d0.js} +1 -1
- package/dist/controls.btns-5b44e5d0.js +1 -0
- package/dist/{controls.config-2f0fa061.js → controls.config-b0339f96.js} +1 -1
- package/dist/{cuminc-8dffb765.js → cuminc-6d1de932.js} +1 -1
- package/dist/{customdata.inputui-b229d3a0.js → customdata.inputui-5ad0f25c.js} +1 -1
- package/dist/{dataDownload-452ae3cd.js → dataDownload-a60d80e4.js} +1 -1
- package/dist/databrowser.ui-a5c8194c.js +1 -0
- package/dist/{density-09feb0c9.js → density-30dbad8b.js} +1 -1
- package/dist/{dictionary-a132a3cc.js → dictionary-d8435ddc.js} +1 -1
- package/dist/{drag-2e9c80bb.js → drag-ad04f964.js} +1 -1
- package/dist/{e2pca-4f1648e3.js → e2pca-02adebbd.js} +1 -1
- package/dist/{ep-1d4c58b4.js → ep-b2e464fe.js} +1 -1
- package/dist/{facet-fa4fe49c.js → facet-e7612200.js} +1 -1
- package/dist/{filter-b3d3964e.js → filter-67d51c09.js} +1 -1
- package/dist/{fusion.parse-7dfd6988.js → fusion.parse-68670e99.js} +1 -1
- package/dist/{geneExpClustering-ed9121b8.js → geneExpClustering-d96c27ef.js} +1 -1
- package/dist/geneExpression-072e0be1.js +1 -0
- package/dist/{geneExpression-394672ff.js → geneExpression-4901955e.js} +1 -1
- package/dist/{geneExpression-66208299.js → geneExpression-65346c08.js} +1 -1
- package/dist/{geneORA-9456872c.js → geneORA-e3d6619e.js} +1 -1
- package/dist/geneVariant-9fc29f37.js +1 -0
- package/dist/{geneVariant-beaf9adb.js → geneVariant-f6bbc247.js} +1 -1
- package/dist/{genefusion.ui-9238ec7f.js → genefusion.ui-a5a08183.js} +1 -1
- package/dist/{genesearch-ffd88bf2.js → genesearch-5fa13afa.js} +1 -1
- package/dist/{geneset-0315daf8.js → geneset-c36036bd.js} +1 -1
- package/dist/genomeBrowser-d4515002.js +1 -0
- package/dist/{genomeBrowser.controls-2601cab5.js → genomeBrowser.controls-b89629b0.js} +1 -1
- package/dist/{groupsetting-e3a4ecd5.js → groupsetting-a3de9ec7.js} +1 -1
- package/dist/{gsea-0c0cf8de.js → gsea-af1a7cec.js} +1 -1
- package/dist/{hierCluster-7ab62ca5.js → hierCluster-8aa2265a.js} +1 -1
- package/dist/hierCluster.config-11a176e2.js +1 -0
- package/dist/{hierCluster.interactivity-7f475259.js → hierCluster.interactivity-103b2f0f.js} +1 -1
- package/dist/{hierCluster.renderers-19b79639.js → hierCluster.renderers-48bdf7a6.js} +1 -1
- package/dist/{html.legend-80b2b3ec.js → html.legend-455f7881.js} +1 -1
- package/dist/{imagePlot-1ef24562.js → imagePlot-862c7baf.js} +1 -1
- package/dist/{lasso-1a02a545.js → lasso-e12204af.js} +1 -1
- package/dist/launch.adhoc-b8af0ace.js +1 -0
- package/dist/leftlabel.sample-784c5aeb.js +1 -0
- package/dist/{legacyDataset-fbaa5ebb.js → legacyDataset-501a0298.js} +1 -1
- package/dist/{log-c26b6cfd.js → log-d560d2a5.js} +1 -1
- package/dist/{lollipop-3aebe5d3.js → lollipop-aa25084e.js} +1 -1
- package/dist/{maf-c439c851.js → maf-13befc91.js} +1 -1
- package/dist/{maftimeline-0da64e54.js → maftimeline-f9ee156e.js} +1 -1
- package/dist/{matrix-38cd47c3.js → matrix-971b44da.js} +1 -1
- package/dist/{matrix.cells-a018d731.js → matrix.cells-92037b17.js} +1 -1
- package/dist/{matrix.cluster-a6e713e8.js → matrix.cluster-0bca59fd.js} +1 -1
- package/dist/{matrix.config-2c550b5d.js → matrix.config-b8d8faef.js} +1 -1
- package/dist/matrix.controls-07c6128c.js +1 -0
- package/dist/{matrix.data-2b814c9f.js → matrix.data-1090f6c7.js} +1 -1
- package/dist/{matrix.dom-1e0da5b3.js → matrix.dom-1154156c.js} +1 -1
- package/dist/{matrix.groups-824a7244.js → matrix.groups-f10a8c05.js} +1 -1
- package/dist/{matrix.interactivity-1cb56534.js → matrix.interactivity-99de0399.js} +1 -1
- package/dist/{matrix.layout-47e44357.js → matrix.layout-405db70f.js} +1 -1
- package/dist/{matrix.legend-9af0c757.js → matrix.legend-d06de359.js} +1 -1
- package/dist/{matrix.renderers-337ce240.js → matrix.renderers-2211c4b2.js} +1 -1
- package/dist/{matrix.serieses-7b7184c9.js → matrix.serieses-f0803a76.js} +1 -1
- package/dist/{matrix.sort-1ac05842.js → matrix.sort-3d376f1a.js} +1 -1
- package/dist/{matrix.sorterUi-1c60c145.js → matrix.sorterUi-469ed804.js} +1 -1
- package/dist/{mavb-da8d1a0a.js → mavb-e5cbd894.js} +1 -1
- package/dist/{mds.fimo-8604c3f8.js → mds.fimo-f9215ef6.js} +1 -1
- package/dist/{mds.samplescatterplot-3f09ae0e.js → mds.samplescatterplot-6fce6594.js} +1 -1
- package/dist/{mds.survivalplot-1d8f2b7e.js → mds.survivalplot-16e9e8c5.js} +1 -1
- package/dist/{metaboliteIntensity-bbb23c76.js → metaboliteIntensity-b47fb792.js} +1 -1
- package/dist/{niceNumLabels-29a7c6ca.js → niceNumLabels-1bd7a93b.js} +1 -1
- package/dist/{nodrag-b2737073.js → nodrag-0fa60f70.js} +1 -1
- package/dist/{notify-0cb8904f.js → notify-42149e65.js} +1 -1
- package/dist/{numeric-24dacbee.js → numeric-5b626171.js} +1 -1
- package/dist/{numeric.binary-f382cc98.js → numeric.binary-07e15211.js} +1 -1
- package/dist/numeric.continuous-76dd29ba.js +1 -0
- package/dist/numeric.discrete-6d697c68.js +1 -0
- package/dist/{numeric.spline-a35cfbf0.js → numeric.spline-cf331bad.js} +1 -1
- package/dist/{numeric.toggle-2f98d6e5.js → numeric.toggle-332c2578.js} +1 -1
- package/dist/oncomatrix-7c84c94b.js +1 -0
- package/dist/{parseData-292648dd.js → parseData-05ab5f81.js} +1 -1
- package/dist/{plot.2dvaf-6ae22dc1.js → plot.2dvaf-1debbf12.js} +1 -1
- package/dist/plot.app-0b02df66.js +1 -0
- package/dist/{plot.barplot-34841e70.js → plot.barplot-45b57df9.js} +1 -1
- package/dist/{plot.boxplot-87ac2ce9.js → plot.boxplot-06cef6e2.js} +1 -1
- package/dist/{plot.brainImaging-32a484b6.js → plot.brainImaging-07795744.js} +1 -1
- package/dist/{plot.disco-1fdfee3c.js → plot.disco-9c631d77.js} +1 -1
- package/dist/{plot.dzi-e3d0f610.js → plot.dzi-a9a81de5.js} +1 -1
- package/dist/{plot.ssgq-d33113d5.js → plot.ssgq-02ffde06.js} +1 -1
- package/dist/{plot.vaf2cov-9f4f1776.js → plot.vaf2cov-c111c5fb.js} +1 -1
- package/dist/{plot.wsi-dea124a7.js → plot.wsi-6ccc7bb2.js} +1 -1
- package/dist/{profileBarchart-58f0a8c0.js → profileBarchart-0c97e8c9.js} +1 -1
- package/dist/{profileHome-7f404152.js → profileHome-2255d66d.js} +1 -1
- package/dist/profilePlot-ba7e03ab.js +1 -0
- package/dist/{profilePolar-50b8e40e.js → profilePolar-d38d502f.js} +1 -1
- package/dist/{profileRadar-fff0b004.js → profileRadar-f95cfa87.js} +1 -1
- package/dist/{profileRadarFacility-d6d34c15.js → profileRadarFacility-7e200a91.js} +1 -1
- package/dist/profileSummary-8c41a731.js +1 -0
- package/dist/{recover-299ffdb3.js → recover-6f2f3379.js} +1 -1
- package/dist/{regression.inputs-14df7c31.js → regression.inputs-b515101d.js} +1 -1
- package/dist/{regression.inputs.values.table-d79efa9e.js → regression.inputs.values.table-f8a0cad9.js} +1 -1
- package/dist/{regression.results-4767144e.js → regression.results-91a486f0.js} +1 -1
- package/dist/{renderPvalueTable-002cc8ff.js → renderPvalueTable-d4d2624c.js} +1 -1
- package/dist/sampleScatter-7c2773de.js +1 -0
- package/dist/{sampleScatter.rendererThree-ef289434.js → sampleScatter.rendererThree-b6db5a09.js} +2 -2
- package/dist/{sampleView-1dff3fca.js → sampleView-8885e86b.js} +1 -1
- package/dist/{samplelst-d2db0f24.js → samplelst-83e593da.js} +1 -1
- package/dist/{samplematrix-0841387f.js → samplematrix-a8b3f845.js} +1 -1
- package/dist/{scatter-f8285107.js → scatter-34d52e2d.js} +1 -1
- package/dist/{select2Terms-d48d037e.js → select2Terms-d9320d21.js} +1 -1
- package/dist/{selectGenomeWithTklst-9af86d31.js → selectGenomeWithTklst-fed6a2ea.js} +1 -1
- package/dist/shapes-21ebfec4.js +1 -0
- package/dist/singleCellCellType-e6848f45.js +1 -0
- package/dist/{singleCellGeneExpression-537f1157.js → singleCellGeneExpression-d3a5394e.js} +1 -1
- package/dist/singleCellPlot-3cad6bd8.js +1 -0
- package/dist/{singlecell-38336cbc.js → singlecell-0754aab0.js} +1 -1
- package/dist/{singlecell-87b4b9a9.js → singlecell-7c57cd77.js} +1 -1
- package/dist/{snp-b81ef740.js → snp-6b23e7a6.js} +1 -1
- package/dist/snp-a0cdd2a5.js +1 -0
- package/dist/snplocus-c60eab56.js +1 -0
- package/dist/{spliceevent.a53ss.diagram-5f8352eb.js → spliceevent.a53ss.diagram-8714f740.js} +1 -1
- package/dist/{spliceevent.exonskip.diagram-0d30a735.js → spliceevent.exonskip.diagram-40c1e363.js} +1 -1
- package/dist/spliceevent.exonskip.getdefault-4bb6f19f.js +1 -0
- package/dist/{spliceevent.noeventdiagram-df9ce4bc.js → spliceevent.noeventdiagram-41a56db9.js} +1 -1
- package/dist/{spliceevent.phrase-a8401d53.js → spliceevent.phrase-7f34e3b1.js} +1 -1
- package/dist/{stattable-46cde32c.js → stattable-78dc5c34.js} +1 -1
- package/dist/{style.gdc-72d730f2.js → style.gdc-cd49882c.js} +1 -1
- package/dist/summary-45c56298.js +1 -0
- package/dist/{sunburst-fe95832e.js → sunburst-2140e468.js} +1 -1
- package/dist/{survival-57ff3c03.js → survival-db972025.js} +1 -1
- package/dist/{survival-52714cd3.js → survival-ed4bdad2.js} +1 -1
- package/dist/{svg.download-f4aa48e4.js → svg.download-a5e20a92.js} +1 -1
- package/dist/{svg.legend-749348e0.js → svg.legend-8d21872d.js} +1 -1
- package/dist/{svgraph-b46f1f92.js → svgraph-f6a28b78.js} +1 -1
- package/dist/{svmr-9a76c6d4.js → svmr-8b4b4c59.js} +1 -1
- package/dist/{table-bf40249b.js → table-1cbe3a36.js} +1 -1
- package/dist/{table-0daf2b89.js → table-e2a307e6.js} +1 -1
- package/dist/{termInfo-491b10af.js → termInfo-5477ba96.js} +1 -1
- package/dist/termdb.bins-7ecc48db.js +1 -0
- package/dist/{termsetting-492eefa7.js → termsetting-2e75e729.js} +1 -1
- package/dist/tk-a8a4481a.js +1 -0
- package/dist/{toggleButtons-c4d6f260.js → toggleButtons-7ce58d97.js} +1 -1
- package/dist/{tp.ui-0a476325.js → tp.ui-be14f635.js} +1 -1
- package/dist/{tvs.density-034b506d.js → tvs.density-8b953cef.js} +1 -1
- package/dist/{tvs.geneVariant-c59c8b54.js → tvs.geneVariant-ecad287d.js} +1 -1
- package/dist/{tvs.numeric-aa1f892f.js → tvs.numeric-b56a5aba.js} +1 -1
- package/dist/{tvs.samplelst-515f27b9.js → tvs.samplelst-3150e0b7.js} +1 -1
- package/dist/{uiUtils-ea7dfea2.js → uiUtils-71cc22de.js} +1 -1
- package/dist/{variantBrowser-14d5c3f6.js → variantBrowser-df2f9c22.js} +1 -1
- package/dist/{vcf-d357ce08.js → vcf-3e370c9b.js} +1 -1
- package/dist/{violin-74d26b75.js → violin-4595cef4.js} +1 -1
- package/dist/{violin.interactivity-bf40ddde.js → violin.interactivity-8b63e000.js} +1 -1
- package/dist/{violin.renderer-469fa0ff.js → violin.renderer-0b7431a2.js} +1 -1
- package/dist/{violinRenderer-14fa200d.js → violinRenderer-7b0a4e98.js} +1 -1
- package/dist/{viridis-cc59f478.js → viridis-725f66e0.js} +1 -1
- package/dist/{y-59cbff5e.js → y-300bac24.js} +1 -1
- package/dist/{zoom-f445cfef.js → zoom-d3d38b3b.js} +1 -1
- package/package.json +2 -4
- package/dist/FilterRxComp-02e68f1b.js +0 -1
- package/dist/FilterStateless-16a33070.js +0 -1
- package/dist/app-42f69951.js +0 -1
- package/dist/app-6fb77603.js +0 -1
- package/dist/block.lazyload-d2951c91.js +0 -1
- package/dist/controls.btns-5bf9e7d7.js +0 -1
- package/dist/databrowser.ui-2197fc73.js +0 -1
- package/dist/downloadTextfile-5723af95.js +0 -1
- package/dist/geneExpression-c61e8f1c.js +0 -1
- package/dist/geneVariant-f17cda85.js +0 -1
- package/dist/genomeBrowser-608b924e.js +0 -1
- package/dist/hierCluster.config-f4daaf92.js +0 -1
- package/dist/launch.adhoc-e124c993.js +0 -1
- package/dist/leftlabel.sample-59f99ef5.js +0 -1
- package/dist/matrix.controls-42ad4912.js +0 -1
- package/dist/numeric.continuous-6feb34a7.js +0 -1
- package/dist/numeric.discrete-ed10bbc1.js +0 -1
- package/dist/oncomatrix-c0b2d635.js +0 -1
- package/dist/plot.app-2a805759.js +0 -1
- package/dist/profilePlot-4db8ca78.js +0 -1
- package/dist/profileSummary-04b8b15b.js +0 -1
- package/dist/sampleScatter-55d9eb74.js +0 -1
- package/dist/singleCellCellType-fd1606b8.js +0 -1
- package/dist/singleCellPlot-eff5760b.js +0 -1
- package/dist/snp-f6123244.js +0 -1
- package/dist/snplocus-acafb1ba.js +0 -1
- package/dist/spliceevent.exonskip.getdefault-237c481c.js +0 -1
- package/dist/summary-a6c15c9e.js +0 -1
- package/dist/termdb.bins-39d11f24.js +0 -1
- package/dist/tk-ac524564.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-
|
|
1
|
+
import{n as e,a as t,d as n,b as r,c as u,y as a}from"./nodrag-0fa60f70.js";import{_ as i,d as o}from"./app-0de0ae35.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-
|
|
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-0de0ae35.js";import{d as p}from"./tp.ui-be14f635.js";import{p as c}from"./viridis-725f66e0.js";import{a as d,b as u}from"./axis-747c801e.js";import"./block.lazyload-19a55cac.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+" ");_.append("span").html("min: "+o+" ");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(" 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-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 "+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+" ");if(s.full){a.append("span").html(s.full+" ").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(" <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-0de0ae35.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-d560d2a5.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 "+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+" ");if(s.full){a.append("span").html(s.full+" ").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(" <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-
|
|
1
|
+
import{h as t,P as e,M as s}from"./app-0de0ae35.js";import{f as o,i as a}from"./termsetting-2e75e729.js";import{controlsInit as i}from"./controls-1f3ac9d0.js";import{s as r}from"./select2Terms-d9320d21.js";import{b as l,a as n,d as c}from"./recover-6f2f3379.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./controls.btns-5b44e5d0.js";import"./controls.config-b0339f96.js";import"./FilterRxComp-fb608459.js";import"./table-e2a307e6.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-7ecc48db.js";import"./FilterStateless-fc4e4e1b.js";import"./app-7f695ce7.js";import"./termInfo-5477ba96.js";import"./toggleButtons-7ce58d97.js";import"./genesearch-5fa13afa.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) 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
|
-
function e(e,i){n(i);const r=new Set;for(const n of e){if(r.has(n.sample))continue;const e=n.s||n.data;if(e&&t(e,i)){r.add(n.sample)}}return r}function t(e,r,s=null,
|
|
1
|
+
function e(e,i){n(i);const r=new Set;for(const n of e){if(r.has(n.sample))continue;const e=n.s||n.data;if(e&&t(e,i)){r.add(n.sample)}}return r}function t(e,r,s=null,l=null){const o=r.type=="tvslst"?r.lst:[r];let a=0;for(const f of o){if(f.type=="tvslst"){if(t(e,f,s,l)){a++}}else{const t=JSON.parse(JSON.stringify(f));const r=t.tvs;if(s&&r.term){if(!(s.name==r.term.name&&s.type==r.term.type)){a++;continue}}let o;if(s&&!r.term){if(r.term$type&&r.term$type!==s.type){a++;continue}r.term=s;o=typeof e==="object"&&r.term.id in e?e[r.term.id]:e}else if(l&&r.term.$id){o=l[r.term.$id].value}else{o=r.term.id in e?e[r.term.id]:e}n(t);let u;if(r.term.type=="categorical"){if(o===undefined)continue;u=r.valueset.has(o)}else if(r.term.type=="integer"||r.term.type=="float"){if(o===undefined)continue;for(const e of r.ranges){if("value"in e){u=o===e.value;if(u)break}else if(o==e.name){u=true;break}else{if(r.term.values){const e=r.term.values[o.toString()];if(e&&e.uncomputable){continue}}let t,n;if(e.startunbounded){t=true}else if("start"in e){if(e.startinclusive){t=o>=e.start}else{t=o>e.start}}if(e.stopunbounded){n=true}else if("stop"in e){if(e.stopinclusive){n=o<=e.stop}else{n=o<e.stop}}u=t&&n}if(u)break}}else if(r.term.type=="condition"){const e=i(r);const t=o&&o[e];if(t){u=Array.isArray(t)?r.values.find((e=>t.includes(e.key))):r.values.find((e=>e.key==t))}}else if(r.term.type=="geneVariant"){const e=o.values||[o];for(const t of e){u=r.values.find((e=>e.dt==t.dt&&(!e.origin||t.origin==e.origin)&&(!e.mclasslst||e.mclasslst.includes(t.class))))&&true}}else{throw"unknown term type"}if(r.isnot){u=!u}if(u)a++}if(r.join=="or"){if(a&&r.in)return true;if(!a&&!r.in)return true}}if(!("in"in r))r.in=true;return r.in==(a==o.length)}function n(e,t=null){if(e.type=="tvslst"){for(const i of e.lst){n(i,t)}}else{if(t&&typeof t.setAnnoByTermId=="function"){t.setAnnoByTermId(e.tvs.term.id)}if(e.tvs.term.type=="categorical"){e.tvs.valueset=new Set(e.tvs.values.map((e=>e.key)))}}}function i(e){const t=e.bar_by_children&&e.value_by_max_grade?"childrenAtMaxGrade":e.bar_by_children&&e.value_by_most_recent?"childrenAtMostRecent":e.bar_by_children&&e.value_by_computable_grade?"children":e.bar_by_grade&&e.value_by_max_grade?"maxGrade":e.bar_by_grade&&e.value_by_most_recent?"mostRecentGrades":e.bar_by_grade&&e.value_by_computable_grade?"computableGrades":"";if(!t)throw`unknown condition term bar_by_* and/or value_by_*`;return t}function r(e){if(!e||e.length==0)return;let t=JSON.parse(JSON.stringify(e[0]));if(e.length==1)return t;if(t.lst.length<2){if(t.join!=="")throw'filter.join must be an empty string "" when filter.lst.length < 2';t.join="and"}else if(t.join=="or"){t={type:"tvslst",join:"and",in:true,lst:[t]}}else if(t.join!="and"){throw'filter.join must be either "and" or "or" when .lst length > 1'}for(let n=1;n<e.length;n++){const i=JSON.parse(JSON.stringify(e[n]));if(i.join=="or")t.lst.push(i);else t.lst.push(...i.lst)}if(t.lst.length==1&&t.lst[0].type=="tvs"){t.join=""}return t}export{r as f,e as g,t as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as i}from"./app-
|
|
1
|
+
import{x as i}from"./app-0de0ae35.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 +1 @@
|
|
|
1
|
-
import{appInit as e}from"./plot.app-
|
|
1
|
+
import{appInit as e}from"./plot.app-0b02df66.js";import{d as t,P as r}from"./app-0de0ae35.js";import{T as s,f as i}from"./termsetting-2e75e729.js";import{v as o}from"./FilterRxComp-fb608459.js";import"./recover-6f2f3379.js";import"./FilterStateless-fc4e4e1b.js";import"./app-7f695ce7.js";import"./termInfo-5477ba96.js";import"./tslib.es6-c3c2d88f.js";import"./toggleButtons-7ce58d97.js";import"path";import"./table-e2a307e6.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-7ecc48db.js";import"./genesearch-5fa13afa.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 c=a.settings||{};if(typeof c!="object")throw"arg.settings{} not object";if(!c.hierCluster)c.hierCluster={};if(typeof c.hierCluster!="object")throw"arg.settings.hierCluster{} not object";if(!Number.isInteger(c.hierCluster.maxGenes))c.hierCluster.maxGenes=1e3;if(a.filter0&&typeof a.filter0!="object")throw"arg.filter0 not object";const d=await o({state:{vocab:{genome:n,dslabel:p}}});d.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:c.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:c,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}},d))))}]}})}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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-c3c2d88f.js";import{M as a}from"./app-0de0ae35.js";import{a as t}from"./genesearch-5fa13afa.js";import{T as s}from"./termsetting-2e75e729.js";import"path";class o{init(e){this.callback=e.callback;this.app=e.app;const s=t({tip:new a({padding:"0px"}),genome:e.genomeObj,row:e.holder,searchOnly:"gene",callback:()=>this.selectGene(s.geneSymbol)})}selectGene(a){return e(this,void 0,void 0,(function*(){if(!a)throw new Error("No gene selected");this.callback({gene:a,type:s.GENE_EXPRESSION,name:a})}))}}export{o as SearchHandler};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./tslib.es6-c3c2d88f.js";import{P as t}from"./app-
|
|
1
|
+
import{_ as e}from"./tslib.es6-c3c2d88f.js";import{P as t}from"./app-0de0ae35.js";function n(e){switch(e){case"./numeric.binary.ts":return import("./numeric.binary-07e15211.js");case"./numeric.continuous.ts":return import("./numeric.continuous-76dd29ba.js");case"./numeric.discrete.ts":return import("./numeric.discrete-6d697c68.js");case"./numeric.spline.ts":return import("./numeric.spline-cf331bad.js");case"./numeric.toggle.ts":return import("./numeric.toggle-332c2578.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-
|
|
1
|
+
import{P as t,h as e,b as o,bL as n}from"./app-0de0ae35.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 +1 @@
|
|
|
1
|
-
import{r as e}from"./table-
|
|
1
|
+
import{r as e}from"./table-e2a307e6.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-0de0ae35.js";import{controlsInit as r}from"./controls-1f3ac9d0.js";import"./tslib.es6-c3c2d88f.js";import"./controls.btns-5b44e5d0.js";import"./controls.config-b0339f96.js";import"./termsetting-2e75e729.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./tslib.es6-c3c2d88f.js";import{M as t}from"./app-0de0ae35.js";import{a}from"./genesearch-5fa13afa.js";class n{init(e){this.callback=e.callback;const n=a({tip:new t({padding:"0px"}),genome:e.genomeObj,row:e.holder,callback:()=>this.selectGene(n)})}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:a,stop:n}=t;const o=`${e}:${a+1}-${n}`;this.callback({kind:"coord",id:o,chr:e,start:a,stop:n,name:o,type:"geneVariant"})}else{throw"no gene or position specified"}}))}}export{n as SearchHandler};
|
|
@@ -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-
|
|
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-0de0ae35.js";import{o as l,s as a}from"./termsetting-2e75e729.js";import{m as u}from"./radiobutton-09bff425.js";import{GroupSettingMethods as c}from"./groupsetting-a3de9ec7.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{a as e,e as t,b as n,c as s}from"./uiUtils-
|
|
1
|
+
import{a as e,e as t,b as n,c as s}from"./uiUtils-71cc22de.js";import{j as o,d as a,aT as p}from"./app-0de0ae35.js";import{T as i}from"./toggleButtons-7ce58d97.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};
|