@sjcrh/proteinpaint-client 2.76.1 → 2.76.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2dmaf-593951c7.js → 2dmaf-f240211f.js} +1 -1
- package/dist/{AppHeader-29b88e14.js → AppHeader-c9432a24.js} +1 -1
- package/dist/{ColorScale-3d3c42dc.js → ColorScale-b991fc9e.js} +1 -1
- package/dist/{DEanalysis-f81e0f19.js → DEanalysis-bbfad00d.js} +1 -1
- package/dist/{Disco-db386f7a.js → Disco-b7c9bf72.js} +1 -1
- package/dist/{Disco.UI-8ed9cb39.js → Disco.UI-a5296c36.js} +1 -1
- package/dist/{DragControls-d6250d18.js → DragControls-ca3fa0cf.js} +1 -1
- package/dist/{DziViewer-9352e224.js → DziViewer-28915c11.js} +1 -1
- package/dist/{FilterRxComp-0f35b322.js → FilterRxComp-02e68f1b.js} +1 -1
- package/dist/{FilterStateless-b1c6ee04.js → FilterStateless-16a33070.js} +1 -1
- package/dist/{HicApp-14b94b20.js → HicApp-e713aa40.js} +1 -1
- package/dist/{OrbitControls-45f56ed4.js → OrbitControls-2466d420.js} +1 -1
- package/dist/{WSIViewer-80f60272.js → WSIViewer-957695a8.js} +1 -1
- package/dist/{adSandbox-94424b88.js → adSandbox-27d93bc0.js} +1 -1
- package/dist/app-42f69951.js +1 -0
- package/dist/{app-2cd97738.js → app-6fb77603.js} +1 -1
- package/dist/{app-686b9547.js → app-d215327f.js} +1 -1
- package/dist/app.js +1 -1
- package/dist/{bam-6631640f.js → bam-d67e5315.js} +1 -1
- package/dist/{barchart-3c5d734c.js → barchart-2898d229.js} +1 -1
- package/dist/{barchart.events-df44e666.js → barchart.events-426d737a.js} +1 -1
- package/dist/{bars.renderer-b232d882.js → bars.renderer-71935d34.js} +1 -1
- package/dist/{block-4134e823.js → block-75d4ff92.js} +1 -1
- package/dist/block.lazyload-d2951c91.js +1 -0
- package/dist/{block.legend-d2b7f1cb.js → block.legend-93d85a6e.js} +1 -1
- package/dist/{block.mds-ebe7b58d.js → block.mds-84b9d1c1.js} +1 -1
- package/dist/{block.mds.cnv-99f0a414.js → block.mds.cnv-a991ed79.js} +1 -1
- package/dist/{block.mds.expressionrank-96bf864b.js → block.mds.expressionrank-33b858de.js} +1 -1
- package/dist/{block.mds.expressionstat-dcab3fd1.js → block.mds.expressionstat-3093599f.js} +1 -1
- package/dist/{block.mds.geneboxplot-e5b2a4ce.js → block.mds.geneboxplot-b8391d18.js} +1 -1
- package/dist/{block.mds.junction-534eef9b.js → block.mds.junction-69708c7f.js} +1 -1
- package/dist/{block.mds.svcnv-de6a3c7d.js → block.mds.svcnv-322baea6.js} +1 -1
- package/dist/{block.mds.svcnv.share-2c2c16db.js → block.mds.svcnv.share-c5c38237.js} +1 -1
- package/dist/{block.mds2-373fcb4d.js → block.mds2-de4811dd.js} +1 -1
- package/dist/{block.svg-be5d741d.js → block.svg-ac9fec2d.js} +1 -1
- package/dist/{block.tk.aicheck-f2da5e81.js → block.tk.aicheck-ac4b8d4d.js} +1 -1
- package/dist/{block.tk.ase-ef848944.js → block.tk.ase-6dc0f9f1.js} +1 -1
- package/dist/{block.tk.bam-11fcba17.js → block.tk.bam-8f68b41d.js} +1 -1
- package/dist/{block.tk.bedgraphdot-a81b0709.js → block.tk.bedgraphdot-d8878860.js} +1 -1
- package/dist/{block.tk.bigwig.ui-f8e5ba71.js → block.tk.bigwig.ui-f6ed051c.js} +1 -1
- package/dist/{block.tk.hicstraw-e7072b25.js → block.tk.hicstraw-725bdc8a.js} +1 -1
- package/dist/{block.tk.junction-1c9a7854.js → block.tk.junction-f8b0b51d.js} +1 -1
- package/dist/{block.tk.junction.textmatrixui-ffecbb16.js → block.tk.junction.textmatrixui-252e7d7e.js} +1 -1
- package/dist/{block.tk.ld-274c3a82.js → block.tk.ld-11acf730.js} +1 -1
- package/dist/{block.tk.menu-e970cd4a.js → block.tk.menu-5e04436d.js} +1 -1
- package/dist/{block.tk.pgv-f4d4dbf7.js → block.tk.pgv-fef17dc4.js} +1 -1
- package/dist/{boxplot-44d3b48f.js → boxplot-4c9a5479.js} +1 -1
- package/dist/{brainImaging-2eaa419d.js → brainImaging-7716bc66.js} +1 -1
- package/dist/{brush-bb4ae2fb.js → brush-9faa7ae7.js} +1 -1
- package/dist/{categorical-db9b0175.js → categorical-1dea48ba.js} +1 -1
- package/dist/{condition-4e788f7d.js → condition-ebac4f75.js} +1 -1
- package/dist/{controls-3c1691d7.js → controls-268e40e6.js} +1 -1
- package/dist/{controls.btns-5b1240c8.js → controls.btns-5bf9e7d7.js} +1 -1
- package/dist/controls.config-2f0fa061.js +1 -0
- package/dist/{cuminc-c4db28f0.js → cuminc-8dffb765.js} +1 -1
- package/dist/{customdata.inputui-f9234d1f.js → customdata.inputui-b229d3a0.js} +1 -1
- package/dist/{dataDownload-a4dfa2d0.js → dataDownload-452ae3cd.js} +1 -1
- package/dist/{databrowser.ui-a64bab0c.js → databrowser.ui-2197fc73.js} +1 -1
- package/dist/{density-69a732f6.js → density-09feb0c9.js} +1 -1
- package/dist/{dictionary-e2232e84.js → dictionary-a132a3cc.js} +1 -1
- package/dist/{drag-d8daa62f.js → drag-2e9c80bb.js} +1 -1
- package/dist/{e2pca-f9324654.js → e2pca-4f1648e3.js} +1 -1
- package/dist/{ep-a5c1ee3a.js → ep-1d4c58b4.js} +1 -1
- package/dist/{facet-98971c68.js → facet-fa4fe49c.js} +1 -1
- package/dist/{fusion.parse-466ded6d.js → fusion.parse-7dfd6988.js} +1 -1
- package/dist/{geneExpClustering-66c05fb1.js → geneExpClustering-ed9121b8.js} +1 -1
- package/dist/{geneExpression-ff46a389.js → geneExpression-394672ff.js} +1 -1
- package/dist/{geneExpression-b5d0261f.js → geneExpression-66208299.js} +1 -1
- package/dist/geneExpression-c61e8f1c.js +1 -0
- package/dist/{geneORA-f1a90d02.js → geneORA-9456872c.js} +1 -1
- package/dist/{geneVariant-1cf17b3b.js → geneVariant-beaf9adb.js} +1 -1
- package/dist/{geneVariant-d0b9e1cb.js → geneVariant-f17cda85.js} +1 -1
- package/dist/{genefusion.ui-89a727ea.js → genefusion.ui-9238ec7f.js} +1 -1
- package/dist/{genesearch-41cb55ce.js → genesearch-ffd88bf2.js} +1 -1
- package/dist/{geneset-b63496eb.js → geneset-0315daf8.js} +1 -1
- package/dist/{genomeBrowser-ec8fbddc.js → genomeBrowser-608b924e.js} +1 -1
- package/dist/{genomeBrowser.controls-2dcaf4f5.js → genomeBrowser.controls-2601cab5.js} +1 -1
- package/dist/{groupsetting-3fef59f9.js → groupsetting-e3a4ecd5.js} +1 -1
- package/dist/{gsea-3075c82c.js → gsea-0c0cf8de.js} +1 -1
- package/dist/{hierCluster-33a828a1.js → hierCluster-7ab62ca5.js} +1 -1
- package/dist/hierCluster.config-f4daaf92.js +1 -0
- package/dist/{hierCluster.interactivity-6d453881.js → hierCluster.interactivity-7f475259.js} +1 -1
- package/dist/{hierCluster.renderers-6279d7fb.js → hierCluster.renderers-19b79639.js} +1 -1
- package/dist/{html.legend-fac5cb07.js → html.legend-80b2b3ec.js} +1 -1
- package/dist/{imagePlot-38254245.js → imagePlot-1ef24562.js} +1 -1
- package/dist/{lasso-e8b9500e.js → lasso-1a02a545.js} +1 -1
- package/dist/launch.adhoc-e124c993.js +1 -0
- package/dist/{leftlabel.sample-afcdcefd.js → leftlabel.sample-59f99ef5.js} +1 -1
- package/dist/{legacyDataset-3b08c91a.js → legacyDataset-fbaa5ebb.js} +1 -1
- package/dist/{log-4d84c357.js → log-c26b6cfd.js} +1 -1
- package/dist/{lollipop-64c5cdfc.js → lollipop-3aebe5d3.js} +1 -1
- package/dist/{maf-fd4ffbd0.js → maf-c439c851.js} +1 -1
- package/dist/{maftimeline-3e892da7.js → maftimeline-0da64e54.js} +1 -1
- package/dist/{matrix-e371888a.js → matrix-38cd47c3.js} +1 -1
- package/dist/{matrix.cells-eb4110a7.js → matrix.cells-a018d731.js} +1 -1
- package/dist/{matrix.cluster-0df274ed.js → matrix.cluster-a6e713e8.js} +1 -1
- package/dist/{matrix.config-3ef822b9.js → matrix.config-2c550b5d.js} +1 -1
- package/dist/matrix.controls-42ad4912.js +1 -0
- package/dist/{matrix.data-27b8e3a9.js → matrix.data-2b814c9f.js} +1 -1
- package/dist/{matrix.dom-1bbe1f39.js → matrix.dom-1e0da5b3.js} +1 -1
- package/dist/{matrix.groups-67606700.js → matrix.groups-824a7244.js} +1 -1
- package/dist/{matrix.interactivity-cdcc56c9.js → matrix.interactivity-1cb56534.js} +1 -1
- package/dist/{matrix.layout-857cd336.js → matrix.layout-47e44357.js} +1 -1
- package/dist/{matrix.legend-09f6dc57.js → matrix.legend-9af0c757.js} +1 -1
- package/dist/{matrix.renderers-d392fb69.js → matrix.renderers-337ce240.js} +1 -1
- package/dist/{matrix.serieses-b03b62aa.js → matrix.serieses-7b7184c9.js} +1 -1
- package/dist/{matrix.sort-9440c86a.js → matrix.sort-1ac05842.js} +1 -1
- package/dist/{matrix.sorterUi-2c5eb35f.js → matrix.sorterUi-1c60c145.js} +1 -1
- package/dist/{mavb-9d86df89.js → mavb-da8d1a0a.js} +1 -1
- package/dist/{mds.fimo-bffccb9f.js → mds.fimo-8604c3f8.js} +1 -1
- package/dist/{mds.samplescatterplot-b3908cc7.js → mds.samplescatterplot-3f09ae0e.js} +1 -1
- package/dist/{mds.survivalplot-9ad7dabc.js → mds.survivalplot-1d8f2b7e.js} +1 -1
- package/dist/{metaboliteIntensity-ec3176f4.js → metaboliteIntensity-bbb23c76.js} +1 -1
- package/dist/niceNumLabels-29a7c6ca.js +1 -0
- package/dist/{nodrag-ab7d5a9f.js → nodrag-b2737073.js} +1 -1
- package/dist/{notify-59f61230.js → notify-0cb8904f.js} +1 -1
- package/dist/{numeric-4853b665.js → numeric-24dacbee.js} +1 -1
- package/dist/{numeric.binary-1dd9a2b4.js → numeric.binary-f382cc98.js} +1 -1
- package/dist/{numeric.continuous-ed132eea.js → numeric.continuous-6feb34a7.js} +1 -1
- package/dist/{numeric.discrete-d780d076.js → numeric.discrete-ed10bbc1.js} +1 -1
- package/dist/{numeric.spline-abe07708.js → numeric.spline-a35cfbf0.js} +1 -1
- package/dist/{numeric.toggle-647423dd.js → numeric.toggle-2f98d6e5.js} +1 -1
- package/dist/oncomatrix-c0b2d635.js +1 -0
- package/dist/{parseData-567f3d70.js → parseData-292648dd.js} +1 -1
- package/dist/{plot.2dvaf-4016e75e.js → plot.2dvaf-6ae22dc1.js} +1 -1
- package/dist/plot.app-2a805759.js +1 -0
- package/dist/plot.barplot-34841e70.js +1 -0
- package/dist/{plot.boxplot-76229491.js → plot.boxplot-87ac2ce9.js} +1 -1
- package/dist/{plot.brainImaging-39b80a1c.js → plot.brainImaging-32a484b6.js} +1 -1
- package/dist/{plot.disco-9a544f9a.js → plot.disco-1fdfee3c.js} +1 -1
- package/dist/{plot.dzi-f1658ebf.js → plot.dzi-e3d0f610.js} +1 -1
- package/dist/{plot.ssgq-aeb2dabc.js → plot.ssgq-d33113d5.js} +1 -1
- package/dist/{plot.vaf2cov-ba8332ed.js → plot.vaf2cov-9f4f1776.js} +1 -1
- package/dist/{plot.wsi-2d802557.js → plot.wsi-dea124a7.js} +1 -1
- package/dist/{profileBarchart-72adc533.js → profileBarchart-58f0a8c0.js} +1 -1
- package/dist/{profileHome-37fd52e5.js → profileHome-7f404152.js} +1 -1
- package/dist/{profilePlot-0b897a05.js → profilePlot-4db8ca78.js} +1 -1
- package/dist/{profilePolar-a7248d48.js → profilePolar-50b8e40e.js} +1 -1
- package/dist/{profileRadar-1ba5d8fd.js → profileRadar-fff0b004.js} +1 -1
- package/dist/{profileRadarFacility-452e76ef.js → profileRadarFacility-d6d34c15.js} +1 -1
- package/dist/{profileSummary-7f0eacf0.js → profileSummary-04b8b15b.js} +1 -1
- package/dist/{recover-74f2e965.js → recover-299ffdb3.js} +1 -1
- package/dist/{regression.inputs-ff00f74e.js → regression.inputs-14df7c31.js} +1 -1
- package/dist/{regression.inputs.values.table-1753d56b.js → regression.inputs.values.table-d79efa9e.js} +1 -1
- package/dist/{regression.results-6f85a5dc.js → regression.results-4767144e.js} +1 -1
- package/dist/{renderPvalueTable-17558d6a.js → renderPvalueTable-002cc8ff.js} +1 -1
- package/dist/{sampleScatter-97917406.js → sampleScatter-55d9eb74.js} +1 -1
- package/dist/{sampleScatter.rendererThree-4649d1ec.js → sampleScatter.rendererThree-ef289434.js} +2 -2
- package/dist/{sampleView-f86dc5ea.js → sampleView-1dff3fca.js} +1 -1
- package/dist/{samplelst-4a5512df.js → samplelst-d2db0f24.js} +1 -1
- package/dist/{samplematrix-1192e5e2.js → samplematrix-0841387f.js} +1 -1
- package/dist/{scatter-cc1b0d07.js → scatter-f8285107.js} +1 -1
- package/dist/{select2Terms-d4f6ed9e.js → select2Terms-d48d037e.js} +1 -1
- package/dist/{selectGenomeWithTklst-b5cfd153.js → selectGenomeWithTklst-9af86d31.js} +1 -1
- package/dist/{singleCellCellType-d8c58253.js → singleCellCellType-fd1606b8.js} +1 -1
- package/dist/{singleCellGeneExpression-b7209531.js → singleCellGeneExpression-537f1157.js} +1 -1
- package/dist/{singleCellPlot-e6f83b2a.js → singleCellPlot-eff5760b.js} +1 -1
- package/dist/{singlecell-321dd973.js → singlecell-38336cbc.js} +1 -1
- package/dist/{singlecell-879235b3.js → singlecell-87b4b9a9.js} +1 -1
- package/dist/{snp-b046b7e6.js → snp-b81ef740.js} +1 -1
- package/dist/snp-f6123244.js +1 -0
- package/dist/{snplocus-61ff1c10.js → snplocus-acafb1ba.js} +1 -1
- package/dist/{spliceevent.a53ss.diagram-1a84db58.js → spliceevent.a53ss.diagram-5f8352eb.js} +1 -1
- package/dist/{spliceevent.exonskip.diagram-da10648b.js → spliceevent.exonskip.diagram-0d30a735.js} +1 -1
- package/dist/spliceevent.exonskip.getdefault-237c481c.js +1 -0
- package/dist/{spliceevent.noeventdiagram-1d6d790d.js → spliceevent.noeventdiagram-df9ce4bc.js} +1 -1
- package/dist/{spliceevent.phrase-2ca0ce59.js → spliceevent.phrase-a8401d53.js} +1 -1
- package/dist/{stattable-c5f12d9c.js → stattable-46cde32c.js} +1 -1
- package/dist/{style.gdc-5b7d90c6.js → style.gdc-72d730f2.js} +1 -1
- package/dist/{summary-0624f5e6.js → summary-a6c15c9e.js} +1 -1
- package/dist/{sunburst-30295714.js → sunburst-fe95832e.js} +1 -1
- package/dist/{survival-fcc7719f.js → survival-52714cd3.js} +1 -1
- package/dist/survival-57ff3c03.js +1 -0
- package/dist/{svg.download-e89a7369.js → svg.download-f4aa48e4.js} +1 -1
- package/dist/{svg.legend-c93f2980.js → svg.legend-749348e0.js} +1 -1
- package/dist/{svgraph-6ab3011b.js → svgraph-b46f1f92.js} +1 -1
- package/dist/{svmr-3ad3d600.js → svmr-9a76c6d4.js} +1 -1
- package/dist/{table-f50a9344.js → table-0daf2b89.js} +1 -1
- package/dist/{table-4d3a771e.js → table-bf40249b.js} +1 -1
- package/dist/{termInfo-d0a9e65f.js → termInfo-491b10af.js} +1 -1
- package/dist/{termdb.bins-01e8cce6.js → termdb.bins-39d11f24.js} +1 -1
- package/dist/termsetting-492eefa7.js +1 -0
- package/dist/{tk-e74c9beb.js → tk-ac524564.js} +1 -1
- package/dist/{toggleButtons-04c5ad7c.js → toggleButtons-c4d6f260.js} +1 -1
- package/dist/{tp.ui-7b24f0ef.js → tp.ui-0a476325.js} +1 -1
- package/dist/tvs.density-034b506d.js +1 -0
- package/dist/{tvs.geneVariant-418ed4ff.js → tvs.geneVariant-c59c8b54.js} +1 -1
- package/dist/{tvs.numeric-de14101f.js → tvs.numeric-aa1f892f.js} +1 -1
- package/dist/{tvs.samplelst-15bb62f1.js → tvs.samplelst-515f27b9.js} +1 -1
- package/dist/{uiUtils-ff2d4a6a.js → uiUtils-ea7dfea2.js} +1 -1
- package/dist/{variantBrowser-261373bf.js → variantBrowser-14d5c3f6.js} +1 -1
- package/dist/{vcf-145bf5dd.js → vcf-d357ce08.js} +1 -1
- package/dist/{violin-e647aac9.js → violin-74d26b75.js} +1 -1
- package/dist/{violin.interactivity-30a239fe.js → violin.interactivity-bf40ddde.js} +1 -1
- package/dist/{violin.renderer-e29d2700.js → violin.renderer-469fa0ff.js} +1 -1
- package/dist/{violinRenderer-08b3b58c.js → violinRenderer-14fa200d.js} +1 -1
- package/dist/{viridis-d86ad99b.js → viridis-cc59f478.js} +1 -1
- package/dist/{y-06b0d47c.js → y-59cbff5e.js} +1 -1
- package/dist/{zoom-d6ef6f3f.js → zoom-f445cfef.js} +1 -1
- package/package.json +1 -1
- package/dist/app-f031940d.js +0 -1
- package/dist/block.lazyload-eda77d9b.js +0 -1
- package/dist/controls.config-81cd5749.js +0 -1
- package/dist/geneExpression-5685eae2.js +0 -1
- package/dist/hierCluster.config-fa799d06.js +0 -1
- package/dist/launch.adhoc-2799109b.js +0 -1
- package/dist/matrix.controls-42bb2063.js +0 -1
- package/dist/niceNumLabels-5f45218a.js +0 -1
- package/dist/oncomatrix-7ac995a2.js +0 -1
- package/dist/plot.app-d6fe76e2.js +0 -1
- package/dist/plot.barplot-d2fc5020.js +0 -1
- package/dist/snp-541ec14d.js +0 -1
- package/dist/spliceevent.exonskip.getdefault-8028e522.js +0 -1
- package/dist/survival-816e055a.js +0 -1
- package/dist/termsetting-ad8c4f3a.js +0 -1
- package/dist/tvs.density-b2790080.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bp as t,bq as e,a3 as n,br as r,a2 as a,bn as o,bo as i,M as u,bm as c,ac as s,Z as l,a8 as f,af as p,d,I as g,a9 as h,ag as m,W as v,U as y}from"./app-2cd97738.js";import{n as x,l as b}from"./log-4d84c357.js";import{a as M,b as T}from"./axis-747c801e.js";var w=new Date,C=new Date;function U(t,e,n,r){function a(e){return t(e=arguments.length===0?new Date:new Date(+e)),e}a.floor=function(e){return t(e=new Date(+e)),e};a.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n};a.round=function(t){var e=a(t),n=a.ceil(t);return t-e<n-t?e:n};a.offset=function(t,n){return e(t=new Date(+t),n==null?1:Math.floor(n)),t};a.range=function(n,r,o){var i=[],u;n=a.ceil(n);o=o==null?1:Math.floor(o);if(!(n<r)||!(o>0))return i;do{i.push(u=new Date(+n)),e(n,o),t(n)}while(u<n&&n<r);return i};a.filter=function(n){return U((function(e){if(e>=e)while(t(e),!n(e))e.setTime(e-1)}),(function(t,r){if(t>=t){if(r<0)while(++r<=0){while(e(t,-1),!n(t)){}}else while(--r>=0){while(e(t,+1),!n(t)){}}}}))};if(n){a.count=function(e,r){w.setTime(+e),C.setTime(+r);t(w),t(C);return Math.floor(n(w,C))};a.every=function(t){t=Math.floor(t);return!isFinite(t)||!(t>0)?null:!(t>1)?a:a.filter(r?function(e){return r(e)%t===0}:function(e){return a.count(0,e)%t===0})}}return a}var k=U((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));k.every=function(t){t=Math.floor(t);if(!isFinite(t)||!(t>0))return null;if(!(t>1))return k;return U((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t}))};var D=k;k.range;const F=1e3;const Y=F*60;const A=Y*60;const H=A*24;const S=H*7;const L=H*30;const z=H*365;var _=U((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*F)}),(function(t,e){return(e-t)/F}),(function(t){return t.getUTCSeconds()}));var I=_;_.range;var j=U((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getMinutes()}));var N=j;j.range;var W=U((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F-t.getMinutes()*Y)}),(function(t,e){t.setTime(+t+e*A)}),(function(t,e){return(e-t)/A}),(function(t){return t.getHours()}));var Z=W;W.range;var V=U((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/H),(t=>t.getDate()-1));var X=V;V.range;function q(t){return U((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7);e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e*7)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/S}))}var O=q(0);var J=q(1);var R=q(2);var E=q(3);var G=q(4);var Q=q(5);var P=q(6);O.range;J.range;R.range;E.range;G.range;Q.range;P.range;var B=U((function(t){t.setDate(1);t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12}),(function(t){return t.getMonth()}));var $=B;B.range;var K=U((function(t){t.setMonth(0,1);t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));K.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:U((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t);e.setMonth(0,1);e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)}))};var tt=K;K.range;var et=U((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getUTCMinutes()}));var nt=et;et.range;var rt=U((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*A)}),(function(t,e){return(e-t)/A}),(function(t){return t.getUTCHours()}));var at=rt;rt.range;var ot=U((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/H}),(function(t){return t.getUTCDate()-1}));var it=ot;ot.range;function ut(t){return U((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7);e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e*7)}),(function(t,e){return(e-t)/S}))}var ct=ut(0);var st=ut(1);var lt=ut(2);var ft=ut(3);var pt=ut(4);var dt=ut(5);var gt=ut(6);ct.range;st.range;lt.range;ft.range;pt.range;dt.range;gt.range;var ht=U((function(t){t.setUTCDate(1);t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12}),(function(t){return t.getUTCMonth()}));var mt=ht;ht.range;var vt=U((function(t){t.setUTCMonth(0,1);t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));vt.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:U((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t);e.setUTCMonth(0,1);e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}))};var yt=vt;vt.range;function xt(n,r,a,o,i,u){const c=[[I,1,F],[I,5,5*F],[I,15,15*F],[I,30,30*F],[u,1,Y],[u,5,5*Y],[u,15,15*Y],[u,30,30*Y],[i,1,A],[i,3,3*A],[i,6,6*A],[i,12,12*A],[o,1,H],[o,2,2*H],[a,1,S],[r,1,L],[r,3,3*L],[n,1,z]];function s(t,e,n){const r=e<t;if(r)[t,e]=[e,t];const a=n&&typeof n.range==="function"?n:l(t,e,n);const o=a?a.range(t,+e+1):[];return r?o.reverse():o}function l(r,a,o){const i=Math.abs(a-r)/o;const u=t((([,,t])=>t)).right(c,i);if(u===c.length)return n.every(e(r/z,a/z,o));if(u===0)return D.every(Math.max(e(r,a,o),1));const[s,l]=c[i/c[u-1][2]<c[u][2]/i?u-1:u];return s.every(l)}return[s,l]}xt(yt,mt,ct,it,at,nt);const[bt,Mt]=xt(tt,$,O,X,Z,N);function Tt(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);e.setFullYear(t.y);return e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function wt(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));e.setUTCFullYear(t.y);return e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ct(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Ut(t){var e=t.dateTime,n=t.date,r=t.time,a=t.periods,o=t.days,i=t.shortDays,u=t.months,c=t.shortMonths;var s=St(a),l=Lt(a),f=St(o),p=Lt(o),d=St(i),g=Lt(i),h=St(u),m=Lt(u),v=St(c),y=Lt(c);var x={a:L,A:z,b:_,B:I,c:null,d:te,e:te,f:oe,g:me,G:ye,H:ee,I:ne,j:re,L:ae,m:ie,M:ue,p:j,q:N,Q:Ve,s:Xe,S:ce,u:se,U:le,V:pe,w:de,W:ge,x:null,X:null,y:he,Y:ve,Z:xe,"%":Ze};var b={a:W,A:Z,b:V,B:q,c:null,d:be,e:be,f:Ue,g:Ie,G:Ne,H:Me,I:Te,j:we,L:Ce,m:ke,M:De,p:O,q:R,Q:Ve,s:Xe,S:Fe,u:Ye,U:Ae,V:Se,w:Le,W:ze,x:null,X:null,y:_e,Y:je,Z:We,"%":Ze};var M={a:k,A:D,b:F,B:Y,c:A,d:Ot,e:Ot,f:Pt,g:Zt,G:Wt,H:Rt,I:Rt,j:Jt,L:Qt,m:qt,M:Et,p:U,q:Xt,Q:$t,s:Kt,S:Gt,u:_t,U:It,V:jt,w:zt,W:Nt,x:H,X:S,y:Zt,Y:Wt,Z:Vt,"%":Bt};x.x=T(n,x);x.X=T(r,x);x.c=T(e,x);b.x=T(n,b);b.X=T(r,b);b.c=T(e,b);function T(t,e){return function(n){var r=[],a=-1,o=0,i=t.length,u,c,s;if(!(n instanceof Date))n=new Date(+n);while(++a<i){if(t.charCodeAt(a)===37){r.push(t.slice(o,a));if((c=kt[u=t.charAt(++a)])!=null)u=t.charAt(++a);else c=u==="e"?" ":"0";if(s=e[u])u=s(n,c);r.push(u);o=a+1}}r.push(t.slice(o,a));return r.join("")}}function w(t,e){return function(n){var r=Ct(1900,undefined,1),a=C(r,t,n+="",0),o,i;if(a!=n.length)return null;if("Q"in r)return new Date(r.Q);if("s"in r)return new Date(r.s*1e3+("L"in r?r.L:0));if(e&&!("Z"in r))r.Z=0;if("p"in r)r.H=r.H%12+r.p*12;if(r.m===undefined)r.m="q"in r?r.q:0;if("V"in r){if(r.V<1||r.V>53)return null;if(!("w"in r))r.w=1;if("Z"in r){o=wt(Ct(r.y,0,1)),i=o.getUTCDay();o=i>4||i===0?st.ceil(o):st(o);o=it.offset(o,(r.V-1)*7);r.y=o.getUTCFullYear();r.m=o.getUTCMonth();r.d=o.getUTCDate()+(r.w+6)%7}else{o=Tt(Ct(r.y,0,1)),i=o.getDay();o=i>4||i===0?J.ceil(o):J(o);o=X.offset(o,(r.V-1)*7);r.y=o.getFullYear();r.m=o.getMonth();r.d=o.getDate()+(r.w+6)%7}}else if("W"in r||"U"in r){if(!("w"in r))r.w="u"in r?r.u%7:"W"in r?1:0;i="Z"in r?wt(Ct(r.y,0,1)).getUTCDay():Tt(Ct(r.y,0,1)).getDay();r.m=0;r.d="W"in r?(r.w+6)%7+r.W*7-(i+5)%7:r.w+r.U*7-(i+6)%7}if("Z"in r){r.H+=r.Z/100|0;r.M+=r.Z%100;return wt(r)}return Tt(r)}}function C(t,e,n,r){var a=0,o=e.length,i=n.length,u,c;while(a<o){if(r>=i)return-1;u=e.charCodeAt(a++);if(u===37){u=e.charAt(a++);c=M[u in kt?e.charAt(a++):u];if(!c||(r=c(t,n,r))<0)return-1}else if(u!=n.charCodeAt(r++)){return-1}}return r}function U(t,e,n){var r=s.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1}function k(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1}function D(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1}function F(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1}function Y(t,e,n){var r=h.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1}function A(t,n,r){return C(t,e,n,r)}function H(t,e,r){return C(t,n,e,r)}function S(t,e,n){return C(t,r,e,n)}function L(t){return i[t.getDay()]}function z(t){return o[t.getDay()]}function _(t){return c[t.getMonth()]}function I(t){return u[t.getMonth()]}function j(t){return a[+(t.getHours()>=12)]}function N(t){return 1+~~(t.getMonth()/3)}function W(t){return i[t.getUTCDay()]}function Z(t){return o[t.getUTCDay()]}function V(t){return c[t.getUTCMonth()]}function q(t){return u[t.getUTCMonth()]}function O(t){return a[+(t.getUTCHours()>=12)]}function R(t){return 1+~~(t.getUTCMonth()/3)}return{format:function(t){var e=T(t+="",x);e.toString=function(){return t};return e},parse:function(t){var e=w(t+="",false);e.toString=function(){return t};return e},utcFormat:function(t){var e=T(t+="",b);e.toString=function(){return t};return e},utcParse:function(t){var e=w(t+="",true);e.toString=function(){return t};return e}}}var kt={"-":"",_:" ",0:"0"},Dt=/^\s*\d+/,Ft=/^%/,Yt=/[\\^$*+?|[\]().{}]/g;function At(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o<n?new Array(n-o+1).join(e)+a:a)}function Ht(t){return t.replace(Yt,"\\$&")}function St(t){return new RegExp("^(?:"+t.map(Ht).join("|")+")","i")}function Lt(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function zt(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function _t(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function It(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function jt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Nt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Wt(t,e,n){var r=Dt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Zt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Xt(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function qt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ot(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Jt(t,e,n){var r=Dt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Rt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Et(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Gt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Qt(t,e,n){var r=Dt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Pt(t,e,n){var r=Dt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Bt(t,e,n){var r=Ft.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $t(t,e,n){var r=Dt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Kt(t,e,n){var r=Dt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function te(t,e){return At(t.getDate(),e,2)}function ee(t,e){return At(t.getHours(),e,2)}function ne(t,e){return At(t.getHours()%12||12,e,2)}function re(t,e){return At(1+X.count(tt(t),t),e,3)}function ae(t,e){return At(t.getMilliseconds(),e,3)}function oe(t,e){return ae(t,e)+"000"}function ie(t,e){return At(t.getMonth()+1,e,2)}function ue(t,e){return At(t.getMinutes(),e,2)}function ce(t,e){return At(t.getSeconds(),e,2)}function se(t){var e=t.getDay();return e===0?7:e}function le(t,e){return At(O.count(tt(t)-1,t),e,2)}function fe(t){var e=t.getDay();return e>=4||e===0?G(t):G.ceil(t)}function pe(t,e){t=fe(t);return At(G.count(tt(t),t)+(tt(t).getDay()===4),e,2)}function de(t){return t.getDay()}function ge(t,e){return At(J.count(tt(t)-1,t),e,2)}function he(t,e){return At(t.getFullYear()%100,e,2)}function me(t,e){t=fe(t);return At(t.getFullYear()%100,e,2)}function ve(t,e){return At(t.getFullYear()%1e4,e,4)}function ye(t,e){var n=t.getDay();t=n>=4||n===0?G(t):G.ceil(t);return At(t.getFullYear()%1e4,e,4)}function xe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+At(e/60|0,"0",2)+At(e%60,"0",2)}function be(t,e){return At(t.getUTCDate(),e,2)}function Me(t,e){return At(t.getUTCHours(),e,2)}function Te(t,e){return At(t.getUTCHours()%12||12,e,2)}function we(t,e){return At(1+it.count(yt(t),t),e,3)}function Ce(t,e){return At(t.getUTCMilliseconds(),e,3)}function Ue(t,e){return Ce(t,e)+"000"}function ke(t,e){return At(t.getUTCMonth()+1,e,2)}function De(t,e){return At(t.getUTCMinutes(),e,2)}function Fe(t,e){return At(t.getUTCSeconds(),e,2)}function Ye(t){var e=t.getUTCDay();return e===0?7:e}function Ae(t,e){return At(ct.count(yt(t)-1,t),e,2)}function He(t){var e=t.getUTCDay();return e>=4||e===0?pt(t):pt.ceil(t)}function Se(t,e){t=He(t);return At(pt.count(yt(t),t)+(yt(t).getUTCDay()===4),e,2)}function Le(t){return t.getUTCDay()}function ze(t,e){return At(st.count(yt(t)-1,t),e,2)}function _e(t,e){return At(t.getUTCFullYear()%100,e,2)}function Ie(t,e){t=He(t);return At(t.getUTCFullYear()%100,e,2)}function je(t,e){return At(t.getUTCFullYear()%1e4,e,4)}function Ne(t,e){var n=t.getUTCDay();t=n>=4||n===0?pt(t):pt.ceil(t);return At(t.getUTCFullYear()%1e4,e,4)}function We(){return"+0000"}function Ze(){return"%"}function Ve(t){return+t}function Xe(t){return Math.floor(+t/1e3)}var qe;var Oe;var Je;Re({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Re(t){qe=Ut(t);Oe=qe.format;Je=qe.parse;qe.utcFormat;qe.utcParse;return qe}function Ee(t){return new Date(t)}function Ge(t){return t instanceof Date?+t:+new Date(+t)}function Qe(t,e,n,o,i,u,c,s,l,f){var p=r(),d=p.invert,g=p.domain;var h=f(".%L"),m=f(":%S"),v=f("%I:%M"),y=f("%I %p"),b=f("%a %d"),M=f("%b %d"),T=f("%B"),w=f("%Y");function C(t){return(l(t)<t?h:s(t)<t?m:c(t)<t?v:u(t)<t?y:o(t)<t?i(t)<t?b:M:n(t)<t?T:w)(t)}p.invert=function(t){return new Date(d(t))};p.domain=function(t){return arguments.length?g(Array.from(t,Ge)):g().map(Ee)};p.ticks=function(e){var n=g();return t(n[0],n[n.length-1],e==null?10:e)};p.tickFormat=function(t,e){return e==null?C:f(e)};p.nice=function(t){var n=g();if(!t||typeof t.range!=="function")t=e(n[0],n[n.length-1],t==null?10:t);return t?g(x(n,t)):p};p.copy=function(){return a(p,Qe(t,e,n,o,i,u,c,s,l,f))};return p}function Pe(){return n.apply(Qe(bt,Mt,tt,$,O,X,Z,N,I,Oe).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Be=1e-5;let $e=true;let Ke=true;const tn=new u;function en(t,e,n){let r,a,u,f,p,d;if(e!==undefined)[a,u,f,p,d]=o(e,t);else{[r,a,u,f,p,d]=i(100,100,t);r.header.text("MAF timeline plot")}a.append("p").html("<a href=https://docs.google.com/document/d/1WXlCVHLq_P2jGiRGJ55uzXCC6p-6Jqn7h406RUID_xo/edit?usp=sharing target=_blank>File format</a>");a.append("p").html("<a href=https://www.dropbox.com/s/940wfo6rd1ttlim/example.maftimeline?dl=0 target=_blank>Example file</a>");{const t=Math.random().toString();const e=a.append("p");e.append("input").attr("type","checkbox").attr("id",t).property("checked",true).style("margin-right","5px").on("change",(()=>{Ke=!Ke}));e.append("label").attr("for",t).text("Y axis (MAF) log10 scale")}const g=()=>{f.selectAll("*").remove();const t=f.append("input").attr("type","file").on("change",(t=>{p.text("");const n=t.target.files[0];if(!n){g();return}if(n.size==0){p.text("Wrong file: "+n.name);g();return}const o=new FileReader;o.onload=t=>{const o=t.target.result.trim().split(/\r?\n/);const[i,u]=nn(o[0].trim());if(i){p.text("File header error: "+i);g();return}const f=[];const h={};let m=0;for(let t=1;t<o.length;t++){if(o[t]=="")continue;if(o[t][0]=="#")continue;const e=rn(t,o[t],u,f,h);if(e){m++}}if(f.length){c(u,f)}if(m==0){g();return}let v;if(r){s(r.pane);const t=l({x:100,y:100,toshrink:true});t.header.html('<span style="opacity:.5;font-size:.7em">MAF TIMELINE</span> '+n.name);v=t.body}if(e!==undefined){v=d.html('<span style="opacity:.5;font-size:.7em">MAF TIMELINE</span> '+n.name);a.selectAll("*").remove();p.text("")}an(h,u,v)};o.onerror=function(){p.text("Error reading file "+n.name);g();return};p.text("Parsing file "+n.name+" ...");o.readAsText(n,"utf8")}));setTimeout((()=>t.node().focus()),1100)};g()}function nn(t){const e=t.toLowerCase().split("\t");if(e.length<=1)return["columns must be separated by tab"];const n=(...t)=>{for(const n of t){const t=e.indexOf(n);if(t!=-1)return t}return-1};let r=n("person","patient","caseid");if(r==-1)return["person missing"];e[r]="patient";r=n("sample","sampleid");if(r==-1)return["sample missing"];e[r]="sample";r=n("snv4");if(r==-1)return["snv4 missing"];e[r]="snv4";r=n("date","dateofsample");if(r==-1)return["date missing"];e[r]="date";r=n("mutant_readcount","mutantcount");if(r!=-1)e[r]="mutant_readcount";r=n("ref_readcount","refcount");if(r!=-1)e[r]="ref_readcount";r=n("total_readcount","coveragecount");if(r==-1)return["total_readcount missing"];e[r]="coverage";r=n("maf");if(r==-1)return["maf missing"];e[r]="maf";r=n("call_manual");if(r!=-1)e[r]="call_manual";return[null,e]}function rn(t,e,n,r,a){const o=e.split("\t");const i={};for(let t=0;t<n.length;t++){i[n[t]]=o[t]}if(!i.patient){r.push([t,"missing patient",o]);return}if(!a[i.patient]){a[i.patient]={snv4:{},show:false}}if(!i.snv4){r.push([t,"missing snv4",o]);return}if(!a[i.patient].snv4[i.snv4]){a[i.patient].snv4[i.snv4]={mutationname:i.snv4,samples:[],subidx:undefined}}if(i.gene){a[i.patient].snv4[i.snv4].gene=i.gene}if(!i.maf){r.push([t,"missing maf",o]);return}let u=Number.parseFloat(i.maf);if(Number.isNaN(u)){r.push([t,"invalid maf",o]);return}if(u<Be){u=Be}i.maf=u;if(!i.coverage){r.push([t,"missing total_readcount",o]);return}if(i.call_manual&&i.call_manual=="wildtype"){i.maf=Be}u=Number.parseInt(i.coverage);if(Number.isNaN(u)){r.push([t,"invalid total_readcount",o]);return}i.coverage=u;let c;if(i.date){const t=Je("%m/%d/%Y");c=t(i.date);i.Date=i.date}else{r.push([t,"missing date",o]);return}if(c==null){r.push([t,"cannot parse date",o]);return}i.date=c;if(!i.sample){r.push([t,"missing sample",o]);return}a[i.patient].snv4[i.snv4].samples.push(i);return true}function an(t,e,n){const r=n.append("table").style("margin","20px");const a=r.append("tr");let o=a.append("td").style("vertical-align","top").attr("rowspan",2);o.append("button").text("Toggle circle visibility").on("click",(()=>{$e=!$e;for(const e in t){if(t[e].show){t[e].handle.node().click();break}}}));const i=o.append("div").style("margin-top","10px");const u=a.append("td").style("vertical-align","top");const c=u.append("div").style("display","inline-block");const s=u.append("div").style("display","inline-block").style("vertical-align","top");const l=r.append("tr");const d=l.append("td").append("table").style("border-spacing","20px").style("border-collapse","separate");const g=d.append("tr");o=g.append("td").style("vertical-align","top");o.append("div").text("Shared").style("font-size","2em");const h=o.append("div").style("border","solid 1px black");o=g.append("td").style("vertical-align","top");o.append("div").text("Rising").style("font-size","2em");const m=o.append("div").style("border","solid 1px black");const v=d.append("tr");o=v.append("td").style("vertical-align","top");o.append("div").text("Falling").style("font-size","2em");const y=o.append("div").style("border","solid 1px black");o=v.append("td").style("vertical-align","top");o.append("div").text("R-only").style("font-size","2em");const x=o.append("div").style("border","solid 1px black");for(const n in t){const r=[];const a=f(p);for(const e in t[n].snv4){const o=t[n].snv4[e];o.show=true;o.color=a(o.mutationname);o.samples.sort(((t,e)=>t.date-e.date));for(const t of o.samples){t.color=o.color}r.push(o)}const o=i.append("div").classed("sja_menuoption",true).style("color","black").text(n).on("click",(()=>{for(const e in t){t[e].handle.style("color","black");t[e].show=false}t[n].handle.style("color","red");t[n].show=true;un(r,e,c);on(r,h,m,y,x);cn(r,e,s,c,h,m,y,x)}));t[n].handle=o}for(const e in t){t[e].handle.node().click();break}}function on(t,e,n,r,a){e.selectAll("*").remove();n.selectAll("*").remove();r.selectAll("*").remove();a.selectAll("*").remove();const o=[];const i=[];const u=[];const c=[];for(const e of t){switch(e.subidx){case 1:o.push(e);break;case 2:i.push(e);break;case 3:u.push(e);break;case 4:c.push(e);break}}if(o.length){un(o,null,e,true)}else{e.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(i.length){un(i,null,n,true)}else{n.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(u.length){un(u,null,r,true)}else{r.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(c.length){un(c,null,a,true)}else{a.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}}function un(t,e,n,r){n.selectAll("*").remove();const a=[];const o=[];for(const e of t){if(!r&&!e.show)continue;o.push(e);for(const t of e.samples){a.push(t)}}if(o.length==0)return;let i=o[0].samples[0].date;let u=o[0].samples[0].date;let c=o[0].samples[0].maf;let s=o[0].samples[0].coverage;for(const t of o){for(const e of t.samples){i=Math.min(i,e.date);u=Math.max(u,e.date);c=Math.max(c,e.maf);s=Math.max(s,e.coverage)}}const l=n.append("svg");const f=30,p=200,x=100,w=50;let C=600;let U=400;let k,D,F;const Y=l.append("g");const A=l.append("g");const H=l.append("text").text("drag to resize").attr("class","sja_clb").attr("text-anchor","end").on("mousedown",(t=>{t.preventDefault();const e=t.clientX;const n=t.clientY;const r=C;const a=U;const o=d(document.body);o.on("mousemove",(t=>{W(r+t.clientX-e,a+t.clientY-n)})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null)}))}));const S=Pe().domain([i,u]);const L=(Ke?b():g()).domain([Be,1]);const z=g().domain([1,s]);const _=l.append("g");const I=_.selectAll().data(o).enter().append("path").attr("stroke",(t=>t.color)).attr("fill","none");let j;if($e){j=_.selectAll().data(a).enter().append("circle").attr("fill",(t=>t.color)).attr("fill-opacity",.1).on("mouseover",((t,e)=>{t.target.setAttribute("fill-opacity",.4);tn.clear();tn.show(t.clientX,t.clientY);const n=[];for(const t in e){if(t=="color")continue;if(t=="gene"){n.push({k:"gene",v:'<span style="color:'+e.color+'">'+e.gene+"</span>"});continue}if(t=="date")continue;if(t=="url"){n.push({k:"URL",v:"<a href="+e.url+" target=_blank>LINK</a>"});continue}n.push({k:t,v:e[t]})}h(tn.d,n)})).on("mouseout",(t=>{t.target.setAttribute("fill-opacity",.1)}))}const N=l.append("g");const W=(t,e)=>{C=t;U=e;F=2;const n=Math.max(C,U)/30;k=n;D=n;z.range([Math.pow(F,2),Math.pow(n,2)]);S.range([0,C]);L.range([U,0]);l.attr("width",x+k+C+p).attr("height",f+U+D+w);Y.attr("transform","translate("+(x+k)+","+(f+U+D)+")");A.attr("transform","translate("+x+","+f+")");H.attr("x",x+k+C).attr("y",f+U+D+w-4);m({axis:Y.call(M().scale(S)),showline:true,color:"black",fontsize:Math.max(12,Math.min(20,C/100))});m({axis:A.call(T().scale(L).tickValues([1,.1,.01,.001,1e-4,Be]).tickFormat(v(" "))),showline:true,color:"black",fontsize:Math.max(12,Math.min(20,U/100))});_.attr("transform","translate("+(x+k)+","+f+")");I.attr("d",(t=>{const e=[];for(let n=0;n<t.samples.length;n++){const r=t.samples[n];e.push((n==0?"M":"L")+" "+S(r.date)+" "+L(r.maf))}return e.join(" ")}));if($e){j.attr("cx",(t=>S(t.date))).attr("cy",(t=>L(t.maf))).attr("r",(t=>Math.sqrt(z(t.coverage))))}N.attr("transform","translate("+(x+k+C+n+5)+","+f+")");N.selectAll("*").remove();let r=F;if($e){N.append("circle").attr("r",F).attr("cx",F).attr("cy",r).attr("fill","#ccc");N.append("text").text(1).attr("x",F*2+10).attr("y",r).attr("font-size",10).attr("dominant-baseline","central");r+=5+F+n;N.append("circle").attr("r",n).attr("cx",n).attr("cy",r).attr("fill","#ccc");N.append("text").text(s).attr("x",n*2+10).attr("y",r).attr("font-size",15).attr("dominant-baseline","central");r+=15+n}const a=12;for(const t of o){N.append("line").attr("x2",30).attr("y1",r).attr("y2",r).attr("stroke",t.color);if($e){N.append("circle").attr("cx",15).attr("cy",r).attr("r",8).attr("fill",t.color).attr("fill-opacity",.1)}N.append("text").text(t.gene).attr("dominant-baseline","central").attr("font-size",a).attr("x",30+10).attr("y",r).attr("fill",t.color).style("cursor","default").on("mouseover",(e=>{e.target.setAttribute("font-weight","bold");I.filter((e=>e.mutationname==t.mutationname)).attr("stroke-width",3)})).on("mouseout",(e=>{e.target.setAttribute("font-weight","normal");I.filter((e=>e.mutationname==t.mutationname)).attr("stroke-width",1)}));r+=a+10}};W(C,U);n.append("div").style("text-align","right").append("button").text("SVG").on("click",(()=>{y(l.node(),"maf-timeline")}))}function cn(t,e,n,r,a,o,i,u){n.selectAll("*").remove();const c=n.append("table");for(const n of t){const s=c.append("tr");const l=s.append("td");l.text(n.gene).style("color",n.color);const f=s.append("td");const p=f.append("input").attr("type","checkbox").style("zoom","150%").property("checked",n.show);n.checkbox=p;p.on("change",(a=>{n.show=a.target.checked;un(t,e,r)}));f.append("button").style("margin-left","5px").text("Only").on("click",(()=>{for(const e of t){e.show=false;e.checkbox.property("checked",false)}n.show=true;n.checkbox.property("checked",true);un(t,e,r)}));let d=Math.random();const g=s.append("td");const h=g.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(1,t.target)));g.append("label").html(" shared").attr("for",d);d=Math.random();const m=s.append("td");const v=m.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(2,t.target)));m.append("label").html(" rising").attr("for",d);d=Math.random();const y=s.append("td");const x=y.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(3,t.target)));y.append("label").html(" falling").attr("for",d);d=Math.random();const b=s.append("td");const M=b.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(4,t.target)));b.append("label").html(" R-only").attr("for",d);if(n.subidx==1)h.property("checked",true);if(n.subidx==2)v.property("checked",true);if(n.subidx==3)x.property("checked",true);if(n.subidx==4)M.property("checked",true);const T=(e,r)=>{if(!r.checked){n.subidx=-1}else{n.subidx=e;if(e==1){v.property("checked",false);x.property("checked",false);M.property("checked",false)}else if(e==2){h.property("checked",false);x.property("checked",false);M.property("checked",false)}else if(e==3){h.property("checked",false);v.property("checked",false);M.property("checked",false)}else{h.property("checked",false);v.property("checked",false);x.property("checked",false)}}on(t,a,o,i,u)}}}export{en as default};
|
|
1
|
+
import{bp as t,bq as e,a3 as n,br as r,a2 as a,bn as o,bo as i,M as u,bm as c,ac as s,Z as l,a8 as f,af as p,d,I as g,a9 as h,ag as m,W as v,U as y}from"./app-6fb77603.js";import{n as x,l as b}from"./log-c26b6cfd.js";import{a as M,b as T}from"./axis-747c801e.js";var w=new Date,C=new Date;function U(t,e,n,r){function a(e){return t(e=arguments.length===0?new Date:new Date(+e)),e}a.floor=function(e){return t(e=new Date(+e)),e};a.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n};a.round=function(t){var e=a(t),n=a.ceil(t);return t-e<n-t?e:n};a.offset=function(t,n){return e(t=new Date(+t),n==null?1:Math.floor(n)),t};a.range=function(n,r,o){var i=[],u;n=a.ceil(n);o=o==null?1:Math.floor(o);if(!(n<r)||!(o>0))return i;do{i.push(u=new Date(+n)),e(n,o),t(n)}while(u<n&&n<r);return i};a.filter=function(n){return U((function(e){if(e>=e)while(t(e),!n(e))e.setTime(e-1)}),(function(t,r){if(t>=t){if(r<0)while(++r<=0){while(e(t,-1),!n(t)){}}else while(--r>=0){while(e(t,+1),!n(t)){}}}}))};if(n){a.count=function(e,r){w.setTime(+e),C.setTime(+r);t(w),t(C);return Math.floor(n(w,C))};a.every=function(t){t=Math.floor(t);return!isFinite(t)||!(t>0)?null:!(t>1)?a:a.filter(r?function(e){return r(e)%t===0}:function(e){return a.count(0,e)%t===0})}}return a}var k=U((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));k.every=function(t){t=Math.floor(t);if(!isFinite(t)||!(t>0))return null;if(!(t>1))return k;return U((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t}))};var D=k;k.range;const F=1e3;const Y=F*60;const A=Y*60;const H=A*24;const S=H*7;const L=H*30;const z=H*365;var _=U((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*F)}),(function(t,e){return(e-t)/F}),(function(t){return t.getUTCSeconds()}));var I=_;_.range;var j=U((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getMinutes()}));var N=j;j.range;var W=U((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*F-t.getMinutes()*Y)}),(function(t,e){t.setTime(+t+e*A)}),(function(t,e){return(e-t)/A}),(function(t){return t.getHours()}));var Z=W;W.range;var V=U((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/H),(t=>t.getDate()-1));var X=V;V.range;function q(t){return U((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7);e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e*7)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Y)/S}))}var O=q(0);var J=q(1);var R=q(2);var E=q(3);var G=q(4);var Q=q(5);var P=q(6);O.range;J.range;R.range;E.range;G.range;Q.range;P.range;var B=U((function(t){t.setDate(1);t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12}),(function(t){return t.getMonth()}));var $=B;B.range;var K=U((function(t){t.setMonth(0,1);t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));K.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:U((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t);e.setMonth(0,1);e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)}))};var tt=K;K.range;var et=U((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Y)}),(function(t,e){return(e-t)/Y}),(function(t){return t.getUTCMinutes()}));var nt=et;et.range;var rt=U((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*A)}),(function(t,e){return(e-t)/A}),(function(t){return t.getUTCHours()}));var at=rt;rt.range;var ot=U((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/H}),(function(t){return t.getUTCDate()-1}));var it=ot;ot.range;function ut(t){return U((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7);e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e*7)}),(function(t,e){return(e-t)/S}))}var ct=ut(0);var st=ut(1);var lt=ut(2);var ft=ut(3);var pt=ut(4);var dt=ut(5);var gt=ut(6);ct.range;st.range;lt.range;ft.range;pt.range;dt.range;gt.range;var ht=U((function(t){t.setUTCDate(1);t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12}),(function(t){return t.getUTCMonth()}));var mt=ht;ht.range;var vt=U((function(t){t.setUTCMonth(0,1);t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));vt.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:U((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t);e.setUTCMonth(0,1);e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}))};var yt=vt;vt.range;function xt(n,r,a,o,i,u){const c=[[I,1,F],[I,5,5*F],[I,15,15*F],[I,30,30*F],[u,1,Y],[u,5,5*Y],[u,15,15*Y],[u,30,30*Y],[i,1,A],[i,3,3*A],[i,6,6*A],[i,12,12*A],[o,1,H],[o,2,2*H],[a,1,S],[r,1,L],[r,3,3*L],[n,1,z]];function s(t,e,n){const r=e<t;if(r)[t,e]=[e,t];const a=n&&typeof n.range==="function"?n:l(t,e,n);const o=a?a.range(t,+e+1):[];return r?o.reverse():o}function l(r,a,o){const i=Math.abs(a-r)/o;const u=t((([,,t])=>t)).right(c,i);if(u===c.length)return n.every(e(r/z,a/z,o));if(u===0)return D.every(Math.max(e(r,a,o),1));const[s,l]=c[i/c[u-1][2]<c[u][2]/i?u-1:u];return s.every(l)}return[s,l]}xt(yt,mt,ct,it,at,nt);const[bt,Mt]=xt(tt,$,O,X,Z,N);function Tt(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);e.setFullYear(t.y);return e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function wt(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));e.setUTCFullYear(t.y);return e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ct(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Ut(t){var e=t.dateTime,n=t.date,r=t.time,a=t.periods,o=t.days,i=t.shortDays,u=t.months,c=t.shortMonths;var s=St(a),l=Lt(a),f=St(o),p=Lt(o),d=St(i),g=Lt(i),h=St(u),m=Lt(u),v=St(c),y=Lt(c);var x={a:L,A:z,b:_,B:I,c:null,d:te,e:te,f:oe,g:me,G:ye,H:ee,I:ne,j:re,L:ae,m:ie,M:ue,p:j,q:N,Q:Ve,s:Xe,S:ce,u:se,U:le,V:pe,w:de,W:ge,x:null,X:null,y:he,Y:ve,Z:xe,"%":Ze};var b={a:W,A:Z,b:V,B:q,c:null,d:be,e:be,f:Ue,g:Ie,G:Ne,H:Me,I:Te,j:we,L:Ce,m:ke,M:De,p:O,q:R,Q:Ve,s:Xe,S:Fe,u:Ye,U:Ae,V:Se,w:Le,W:ze,x:null,X:null,y:_e,Y:je,Z:We,"%":Ze};var M={a:k,A:D,b:F,B:Y,c:A,d:Ot,e:Ot,f:Pt,g:Zt,G:Wt,H:Rt,I:Rt,j:Jt,L:Qt,m:qt,M:Et,p:U,q:Xt,Q:$t,s:Kt,S:Gt,u:_t,U:It,V:jt,w:zt,W:Nt,x:H,X:S,y:Zt,Y:Wt,Z:Vt,"%":Bt};x.x=T(n,x);x.X=T(r,x);x.c=T(e,x);b.x=T(n,b);b.X=T(r,b);b.c=T(e,b);function T(t,e){return function(n){var r=[],a=-1,o=0,i=t.length,u,c,s;if(!(n instanceof Date))n=new Date(+n);while(++a<i){if(t.charCodeAt(a)===37){r.push(t.slice(o,a));if((c=kt[u=t.charAt(++a)])!=null)u=t.charAt(++a);else c=u==="e"?" ":"0";if(s=e[u])u=s(n,c);r.push(u);o=a+1}}r.push(t.slice(o,a));return r.join("")}}function w(t,e){return function(n){var r=Ct(1900,undefined,1),a=C(r,t,n+="",0),o,i;if(a!=n.length)return null;if("Q"in r)return new Date(r.Q);if("s"in r)return new Date(r.s*1e3+("L"in r?r.L:0));if(e&&!("Z"in r))r.Z=0;if("p"in r)r.H=r.H%12+r.p*12;if(r.m===undefined)r.m="q"in r?r.q:0;if("V"in r){if(r.V<1||r.V>53)return null;if(!("w"in r))r.w=1;if("Z"in r){o=wt(Ct(r.y,0,1)),i=o.getUTCDay();o=i>4||i===0?st.ceil(o):st(o);o=it.offset(o,(r.V-1)*7);r.y=o.getUTCFullYear();r.m=o.getUTCMonth();r.d=o.getUTCDate()+(r.w+6)%7}else{o=Tt(Ct(r.y,0,1)),i=o.getDay();o=i>4||i===0?J.ceil(o):J(o);o=X.offset(o,(r.V-1)*7);r.y=o.getFullYear();r.m=o.getMonth();r.d=o.getDate()+(r.w+6)%7}}else if("W"in r||"U"in r){if(!("w"in r))r.w="u"in r?r.u%7:"W"in r?1:0;i="Z"in r?wt(Ct(r.y,0,1)).getUTCDay():Tt(Ct(r.y,0,1)).getDay();r.m=0;r.d="W"in r?(r.w+6)%7+r.W*7-(i+5)%7:r.w+r.U*7-(i+6)%7}if("Z"in r){r.H+=r.Z/100|0;r.M+=r.Z%100;return wt(r)}return Tt(r)}}function C(t,e,n,r){var a=0,o=e.length,i=n.length,u,c;while(a<o){if(r>=i)return-1;u=e.charCodeAt(a++);if(u===37){u=e.charAt(a++);c=M[u in kt?e.charAt(a++):u];if(!c||(r=c(t,n,r))<0)return-1}else if(u!=n.charCodeAt(r++)){return-1}}return r}function U(t,e,n){var r=s.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1}function k(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1}function D(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1}function F(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1}function Y(t,e,n){var r=h.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1}function A(t,n,r){return C(t,e,n,r)}function H(t,e,r){return C(t,n,e,r)}function S(t,e,n){return C(t,r,e,n)}function L(t){return i[t.getDay()]}function z(t){return o[t.getDay()]}function _(t){return c[t.getMonth()]}function I(t){return u[t.getMonth()]}function j(t){return a[+(t.getHours()>=12)]}function N(t){return 1+~~(t.getMonth()/3)}function W(t){return i[t.getUTCDay()]}function Z(t){return o[t.getUTCDay()]}function V(t){return c[t.getUTCMonth()]}function q(t){return u[t.getUTCMonth()]}function O(t){return a[+(t.getUTCHours()>=12)]}function R(t){return 1+~~(t.getUTCMonth()/3)}return{format:function(t){var e=T(t+="",x);e.toString=function(){return t};return e},parse:function(t){var e=w(t+="",false);e.toString=function(){return t};return e},utcFormat:function(t){var e=T(t+="",b);e.toString=function(){return t};return e},utcParse:function(t){var e=w(t+="",true);e.toString=function(){return t};return e}}}var kt={"-":"",_:" ",0:"0"},Dt=/^\s*\d+/,Ft=/^%/,Yt=/[\\^$*+?|[\]().{}]/g;function At(t,e,n){var r=t<0?"-":"",a=(r?-t:t)+"",o=a.length;return r+(o<n?new Array(n-o+1).join(e)+a:a)}function Ht(t){return t.replace(Yt,"\\$&")}function St(t){return new RegExp("^(?:"+t.map(Ht).join("|")+")","i")}function Lt(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function zt(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function _t(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function It(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function jt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Nt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Wt(t,e,n){var r=Dt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Zt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Xt(t,e,n){var r=Dt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function qt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ot(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Jt(t,e,n){var r=Dt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Rt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Et(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Gt(t,e,n){var r=Dt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Qt(t,e,n){var r=Dt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Pt(t,e,n){var r=Dt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Bt(t,e,n){var r=Ft.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function $t(t,e,n){var r=Dt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Kt(t,e,n){var r=Dt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function te(t,e){return At(t.getDate(),e,2)}function ee(t,e){return At(t.getHours(),e,2)}function ne(t,e){return At(t.getHours()%12||12,e,2)}function re(t,e){return At(1+X.count(tt(t),t),e,3)}function ae(t,e){return At(t.getMilliseconds(),e,3)}function oe(t,e){return ae(t,e)+"000"}function ie(t,e){return At(t.getMonth()+1,e,2)}function ue(t,e){return At(t.getMinutes(),e,2)}function ce(t,e){return At(t.getSeconds(),e,2)}function se(t){var e=t.getDay();return e===0?7:e}function le(t,e){return At(O.count(tt(t)-1,t),e,2)}function fe(t){var e=t.getDay();return e>=4||e===0?G(t):G.ceil(t)}function pe(t,e){t=fe(t);return At(G.count(tt(t),t)+(tt(t).getDay()===4),e,2)}function de(t){return t.getDay()}function ge(t,e){return At(J.count(tt(t)-1,t),e,2)}function he(t,e){return At(t.getFullYear()%100,e,2)}function me(t,e){t=fe(t);return At(t.getFullYear()%100,e,2)}function ve(t,e){return At(t.getFullYear()%1e4,e,4)}function ye(t,e){var n=t.getDay();t=n>=4||n===0?G(t):G.ceil(t);return At(t.getFullYear()%1e4,e,4)}function xe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+At(e/60|0,"0",2)+At(e%60,"0",2)}function be(t,e){return At(t.getUTCDate(),e,2)}function Me(t,e){return At(t.getUTCHours(),e,2)}function Te(t,e){return At(t.getUTCHours()%12||12,e,2)}function we(t,e){return At(1+it.count(yt(t),t),e,3)}function Ce(t,e){return At(t.getUTCMilliseconds(),e,3)}function Ue(t,e){return Ce(t,e)+"000"}function ke(t,e){return At(t.getUTCMonth()+1,e,2)}function De(t,e){return At(t.getUTCMinutes(),e,2)}function Fe(t,e){return At(t.getUTCSeconds(),e,2)}function Ye(t){var e=t.getUTCDay();return e===0?7:e}function Ae(t,e){return At(ct.count(yt(t)-1,t),e,2)}function He(t){var e=t.getUTCDay();return e>=4||e===0?pt(t):pt.ceil(t)}function Se(t,e){t=He(t);return At(pt.count(yt(t),t)+(yt(t).getUTCDay()===4),e,2)}function Le(t){return t.getUTCDay()}function ze(t,e){return At(st.count(yt(t)-1,t),e,2)}function _e(t,e){return At(t.getUTCFullYear()%100,e,2)}function Ie(t,e){t=He(t);return At(t.getUTCFullYear()%100,e,2)}function je(t,e){return At(t.getUTCFullYear()%1e4,e,4)}function Ne(t,e){var n=t.getUTCDay();t=n>=4||n===0?pt(t):pt.ceil(t);return At(t.getUTCFullYear()%1e4,e,4)}function We(){return"+0000"}function Ze(){return"%"}function Ve(t){return+t}function Xe(t){return Math.floor(+t/1e3)}var qe;var Oe;var Je;Re({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Re(t){qe=Ut(t);Oe=qe.format;Je=qe.parse;qe.utcFormat;qe.utcParse;return qe}function Ee(t){return new Date(t)}function Ge(t){return t instanceof Date?+t:+new Date(+t)}function Qe(t,e,n,o,i,u,c,s,l,f){var p=r(),d=p.invert,g=p.domain;var h=f(".%L"),m=f(":%S"),v=f("%I:%M"),y=f("%I %p"),b=f("%a %d"),M=f("%b %d"),T=f("%B"),w=f("%Y");function C(t){return(l(t)<t?h:s(t)<t?m:c(t)<t?v:u(t)<t?y:o(t)<t?i(t)<t?b:M:n(t)<t?T:w)(t)}p.invert=function(t){return new Date(d(t))};p.domain=function(t){return arguments.length?g(Array.from(t,Ge)):g().map(Ee)};p.ticks=function(e){var n=g();return t(n[0],n[n.length-1],e==null?10:e)};p.tickFormat=function(t,e){return e==null?C:f(e)};p.nice=function(t){var n=g();if(!t||typeof t.range!=="function")t=e(n[0],n[n.length-1],t==null?10:t);return t?g(x(n,t)):p};p.copy=function(){return a(p,Qe(t,e,n,o,i,u,c,s,l,f))};return p}function Pe(){return n.apply(Qe(bt,Mt,tt,$,O,X,Z,N,I,Oe).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Be=1e-5;let $e=true;let Ke=true;const tn=new u;function en(t,e,n){let r,a,u,f,p,d;if(e!==undefined)[a,u,f,p,d]=o(e,t);else{[r,a,u,f,p,d]=i(100,100,t);r.header.text("MAF timeline plot")}a.append("p").html("<a href=https://docs.google.com/document/d/1WXlCVHLq_P2jGiRGJ55uzXCC6p-6Jqn7h406RUID_xo/edit?usp=sharing target=_blank>File format</a>");a.append("p").html("<a href=https://www.dropbox.com/s/940wfo6rd1ttlim/example.maftimeline?dl=0 target=_blank>Example file</a>");{const t=Math.random().toString();const e=a.append("p");e.append("input").attr("type","checkbox").attr("id",t).property("checked",true).style("margin-right","5px").on("change",(()=>{Ke=!Ke}));e.append("label").attr("for",t).text("Y axis (MAF) log10 scale")}const g=()=>{f.selectAll("*").remove();const t=f.append("input").attr("type","file").on("change",(t=>{p.text("");const n=t.target.files[0];if(!n){g();return}if(n.size==0){p.text("Wrong file: "+n.name);g();return}const o=new FileReader;o.onload=t=>{const o=t.target.result.trim().split(/\r?\n/);const[i,u]=nn(o[0].trim());if(i){p.text("File header error: "+i);g();return}const f=[];const h={};let m=0;for(let t=1;t<o.length;t++){if(o[t]=="")continue;if(o[t][0]=="#")continue;const e=rn(t,o[t],u,f,h);if(e){m++}}if(f.length){c(u,f)}if(m==0){g();return}let v;if(r){s(r.pane);const t=l({x:100,y:100,toshrink:true});t.header.html('<span style="opacity:.5;font-size:.7em">MAF TIMELINE</span> '+n.name);v=t.body}if(e!==undefined){v=d.html('<span style="opacity:.5;font-size:.7em">MAF TIMELINE</span> '+n.name);a.selectAll("*").remove();p.text("")}an(h,u,v)};o.onerror=function(){p.text("Error reading file "+n.name);g();return};p.text("Parsing file "+n.name+" ...");o.readAsText(n,"utf8")}));setTimeout((()=>t.node().focus()),1100)};g()}function nn(t){const e=t.toLowerCase().split("\t");if(e.length<=1)return["columns must be separated by tab"];const n=(...t)=>{for(const n of t){const t=e.indexOf(n);if(t!=-1)return t}return-1};let r=n("person","patient","caseid");if(r==-1)return["person missing"];e[r]="patient";r=n("sample","sampleid");if(r==-1)return["sample missing"];e[r]="sample";r=n("snv4");if(r==-1)return["snv4 missing"];e[r]="snv4";r=n("date","dateofsample");if(r==-1)return["date missing"];e[r]="date";r=n("mutant_readcount","mutantcount");if(r!=-1)e[r]="mutant_readcount";r=n("ref_readcount","refcount");if(r!=-1)e[r]="ref_readcount";r=n("total_readcount","coveragecount");if(r==-1)return["total_readcount missing"];e[r]="coverage";r=n("maf");if(r==-1)return["maf missing"];e[r]="maf";r=n("call_manual");if(r!=-1)e[r]="call_manual";return[null,e]}function rn(t,e,n,r,a){const o=e.split("\t");const i={};for(let t=0;t<n.length;t++){i[n[t]]=o[t]}if(!i.patient){r.push([t,"missing patient",o]);return}if(!a[i.patient]){a[i.patient]={snv4:{},show:false}}if(!i.snv4){r.push([t,"missing snv4",o]);return}if(!a[i.patient].snv4[i.snv4]){a[i.patient].snv4[i.snv4]={mutationname:i.snv4,samples:[],subidx:undefined}}if(i.gene){a[i.patient].snv4[i.snv4].gene=i.gene}if(!i.maf){r.push([t,"missing maf",o]);return}let u=Number.parseFloat(i.maf);if(Number.isNaN(u)){r.push([t,"invalid maf",o]);return}if(u<Be){u=Be}i.maf=u;if(!i.coverage){r.push([t,"missing total_readcount",o]);return}if(i.call_manual&&i.call_manual=="wildtype"){i.maf=Be}u=Number.parseInt(i.coverage);if(Number.isNaN(u)){r.push([t,"invalid total_readcount",o]);return}i.coverage=u;let c;if(i.date){const t=Je("%m/%d/%Y");c=t(i.date);i.Date=i.date}else{r.push([t,"missing date",o]);return}if(c==null){r.push([t,"cannot parse date",o]);return}i.date=c;if(!i.sample){r.push([t,"missing sample",o]);return}a[i.patient].snv4[i.snv4].samples.push(i);return true}function an(t,e,n){const r=n.append("table").style("margin","20px");const a=r.append("tr");let o=a.append("td").style("vertical-align","top").attr("rowspan",2);o.append("button").text("Toggle circle visibility").on("click",(()=>{$e=!$e;for(const e in t){if(t[e].show){t[e].handle.node().click();break}}}));const i=o.append("div").style("margin-top","10px");const u=a.append("td").style("vertical-align","top");const c=u.append("div").style("display","inline-block");const s=u.append("div").style("display","inline-block").style("vertical-align","top");const l=r.append("tr");const d=l.append("td").append("table").style("border-spacing","20px").style("border-collapse","separate");const g=d.append("tr");o=g.append("td").style("vertical-align","top");o.append("div").text("Shared").style("font-size","2em");const h=o.append("div").style("border","solid 1px black");o=g.append("td").style("vertical-align","top");o.append("div").text("Rising").style("font-size","2em");const m=o.append("div").style("border","solid 1px black");const v=d.append("tr");o=v.append("td").style("vertical-align","top");o.append("div").text("Falling").style("font-size","2em");const y=o.append("div").style("border","solid 1px black");o=v.append("td").style("vertical-align","top");o.append("div").text("R-only").style("font-size","2em");const x=o.append("div").style("border","solid 1px black");for(const n in t){const r=[];const a=f(p);for(const e in t[n].snv4){const o=t[n].snv4[e];o.show=true;o.color=a(o.mutationname);o.samples.sort(((t,e)=>t.date-e.date));for(const t of o.samples){t.color=o.color}r.push(o)}const o=i.append("div").classed("sja_menuoption",true).style("color","black").text(n).on("click",(()=>{for(const e in t){t[e].handle.style("color","black");t[e].show=false}t[n].handle.style("color","red");t[n].show=true;un(r,e,c);on(r,h,m,y,x);cn(r,e,s,c,h,m,y,x)}));t[n].handle=o}for(const e in t){t[e].handle.node().click();break}}function on(t,e,n,r,a){e.selectAll("*").remove();n.selectAll("*").remove();r.selectAll("*").remove();a.selectAll("*").remove();const o=[];const i=[];const u=[];const c=[];for(const e of t){switch(e.subidx){case 1:o.push(e);break;case 2:i.push(e);break;case 3:u.push(e);break;case 4:c.push(e);break}}if(o.length){un(o,null,e,true)}else{e.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(i.length){un(i,null,n,true)}else{n.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(u.length){un(u,null,r,true)}else{r.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}if(c.length){un(c,null,a,true)}else{a.append("div").style("padding","60px").style("background-color","#ededed").text("no data")}}function un(t,e,n,r){n.selectAll("*").remove();const a=[];const o=[];for(const e of t){if(!r&&!e.show)continue;o.push(e);for(const t of e.samples){a.push(t)}}if(o.length==0)return;let i=o[0].samples[0].date;let u=o[0].samples[0].date;let c=o[0].samples[0].maf;let s=o[0].samples[0].coverage;for(const t of o){for(const e of t.samples){i=Math.min(i,e.date);u=Math.max(u,e.date);c=Math.max(c,e.maf);s=Math.max(s,e.coverage)}}const l=n.append("svg");const f=30,p=200,x=100,w=50;let C=600;let U=400;let k,D,F;const Y=l.append("g");const A=l.append("g");const H=l.append("text").text("drag to resize").attr("class","sja_clb").attr("text-anchor","end").on("mousedown",(t=>{t.preventDefault();const e=t.clientX;const n=t.clientY;const r=C;const a=U;const o=d(document.body);o.on("mousemove",(t=>{W(r+t.clientX-e,a+t.clientY-n)})).on("mouseup",(()=>{o.on("mousemove",null).on("mouseup",null)}))}));const S=Pe().domain([i,u]);const L=(Ke?b():g()).domain([Be,1]);const z=g().domain([1,s]);const _=l.append("g");const I=_.selectAll().data(o).enter().append("path").attr("stroke",(t=>t.color)).attr("fill","none");let j;if($e){j=_.selectAll().data(a).enter().append("circle").attr("fill",(t=>t.color)).attr("fill-opacity",.1).on("mouseover",((t,e)=>{t.target.setAttribute("fill-opacity",.4);tn.clear();tn.show(t.clientX,t.clientY);const n=[];for(const t in e){if(t=="color")continue;if(t=="gene"){n.push({k:"gene",v:'<span style="color:'+e.color+'">'+e.gene+"</span>"});continue}if(t=="date")continue;if(t=="url"){n.push({k:"URL",v:"<a href="+e.url+" target=_blank>LINK</a>"});continue}n.push({k:t,v:e[t]})}h(tn.d,n)})).on("mouseout",(t=>{t.target.setAttribute("fill-opacity",.1)}))}const N=l.append("g");const W=(t,e)=>{C=t;U=e;F=2;const n=Math.max(C,U)/30;k=n;D=n;z.range([Math.pow(F,2),Math.pow(n,2)]);S.range([0,C]);L.range([U,0]);l.attr("width",x+k+C+p).attr("height",f+U+D+w);Y.attr("transform","translate("+(x+k)+","+(f+U+D)+")");A.attr("transform","translate("+x+","+f+")");H.attr("x",x+k+C).attr("y",f+U+D+w-4);m({axis:Y.call(M().scale(S)),showline:true,color:"black",fontsize:Math.max(12,Math.min(20,C/100))});m({axis:A.call(T().scale(L).tickValues([1,.1,.01,.001,1e-4,Be]).tickFormat(v(" "))),showline:true,color:"black",fontsize:Math.max(12,Math.min(20,U/100))});_.attr("transform","translate("+(x+k)+","+f+")");I.attr("d",(t=>{const e=[];for(let n=0;n<t.samples.length;n++){const r=t.samples[n];e.push((n==0?"M":"L")+" "+S(r.date)+" "+L(r.maf))}return e.join(" ")}));if($e){j.attr("cx",(t=>S(t.date))).attr("cy",(t=>L(t.maf))).attr("r",(t=>Math.sqrt(z(t.coverage))))}N.attr("transform","translate("+(x+k+C+n+5)+","+f+")");N.selectAll("*").remove();let r=F;if($e){N.append("circle").attr("r",F).attr("cx",F).attr("cy",r).attr("fill","#ccc");N.append("text").text(1).attr("x",F*2+10).attr("y",r).attr("font-size",10).attr("dominant-baseline","central");r+=5+F+n;N.append("circle").attr("r",n).attr("cx",n).attr("cy",r).attr("fill","#ccc");N.append("text").text(s).attr("x",n*2+10).attr("y",r).attr("font-size",15).attr("dominant-baseline","central");r+=15+n}const a=12;for(const t of o){N.append("line").attr("x2",30).attr("y1",r).attr("y2",r).attr("stroke",t.color);if($e){N.append("circle").attr("cx",15).attr("cy",r).attr("r",8).attr("fill",t.color).attr("fill-opacity",.1)}N.append("text").text(t.gene).attr("dominant-baseline","central").attr("font-size",a).attr("x",30+10).attr("y",r).attr("fill",t.color).style("cursor","default").on("mouseover",(e=>{e.target.setAttribute("font-weight","bold");I.filter((e=>e.mutationname==t.mutationname)).attr("stroke-width",3)})).on("mouseout",(e=>{e.target.setAttribute("font-weight","normal");I.filter((e=>e.mutationname==t.mutationname)).attr("stroke-width",1)}));r+=a+10}};W(C,U);n.append("div").style("text-align","right").append("button").text("SVG").on("click",(()=>{y(l.node(),"maf-timeline")}))}function cn(t,e,n,r,a,o,i,u){n.selectAll("*").remove();const c=n.append("table");for(const n of t){const s=c.append("tr");const l=s.append("td");l.text(n.gene).style("color",n.color);const f=s.append("td");const p=f.append("input").attr("type","checkbox").style("zoom","150%").property("checked",n.show);n.checkbox=p;p.on("change",(a=>{n.show=a.target.checked;un(t,e,r)}));f.append("button").style("margin-left","5px").text("Only").on("click",(()=>{for(const e of t){e.show=false;e.checkbox.property("checked",false)}n.show=true;n.checkbox.property("checked",true);un(t,e,r)}));let d=Math.random();const g=s.append("td");const h=g.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(1,t.target)));g.append("label").html(" shared").attr("for",d);d=Math.random();const m=s.append("td");const v=m.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(2,t.target)));m.append("label").html(" rising").attr("for",d);d=Math.random();const y=s.append("td");const x=y.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(3,t.target)));y.append("label").html(" falling").attr("for",d);d=Math.random();const b=s.append("td");const M=b.append("input").attr("type","checkbox").attr("id",d).on("change",(t=>T(4,t.target)));b.append("label").html(" R-only").attr("for",d);if(n.subidx==1)h.property("checked",true);if(n.subidx==2)v.property("checked",true);if(n.subidx==3)x.property("checked",true);if(n.subidx==4)M.property("checked",true);const T=(e,r)=>{if(!r.checked){n.subidx=-1}else{n.subidx=e;if(e==1){v.property("checked",false);x.property("checked",false);M.property("checked",false)}else if(e==2){h.property("checked",false);x.property("checked",false);M.property("checked",false)}else if(e==3){h.property("checked",false);v.property("checked",false);M.property("checked",false)}else{h.property("checked",false);v.property("checked",false);x.property("checked",false)}}on(t,a,o,i,u)}}}export{en as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as t,P as e,F as s,h as i,z as o,B as n,O as r}from"./app-2cd97738.js";import{setMatrixDom as l}from"./matrix.dom-1bbe1f39.js";import{setInteractivity as a}from"./matrix.interactivity-cdcc56c9.js";import{setRenderers as p}from"./matrix.renderers-d392fb69.js";import{MatrixCluster as d}from"./matrix.cluster-0df274ed.js";import{MatrixControls as c}from"./matrix.controls-42bb2063.js";import{s as m}from"./svg.legend-c93f2980.js";import{m as h}from"./matrix.data-27b8e3a9.js";import{m as g}from"./matrix.layout-857cd336.js";import{m as u}from"./matrix.serieses-b03b62aa.js";import{m as f}from"./matrix.legend-09f6dc57.js";import{m as b}from"./matrix.groups-67606700.js";import{setComputedConfig as y}from"./matrix.config-3ef822b9.js";export{getPlotConfig}from"./matrix.config-3ef822b9.js";import{l as v}from"./termsetting-ad8c4f3a.js";import"./table-f50a9344.js";import"./tslib.es6-c3c2d88f.js";import"./pointer-c7475677.js";import"./controls.config-81cd5749.js";import"path";import"./matrix.sorterUi-2c5eb35f.js";import"./radiobutton-09bff425.js";import"./checkbox-96437f4d.js";import"./recover-74f2e965.js";import"./FilterRxComp-0f35b322.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-01e8cce6.js";import"./FilterStateless-b1c6ee04.js";import"./app-686b9547.js";import"./termInfo-d0a9e65f.js";import"./toggleButtons-04c5ad7c.js";import"./genesearch-41cb55ce.js";import"./rehydrateFilter-12d118cb.js";import"./axis-747c801e.js";import"./matrix.cells-eb4110a7.js";import"./legacy-d3-polyfill-bdb2d792.js";import"./filter-b3d3964e.js";import"./matrix.sort-9440c86a.js";let x;function j(t,e){const s=structuredClone(t);if(!x)x={CatTWValues:k,CatTWPredefinedGS:k,CatTWCustomGS:k,NumTWRegularBin:k,NumTWCustomBin:k,NumTWCont:C};const i={vocabApi:e.vocabApi,addons:x};for(const t of s){const e=[];for(const s of t.lst){e.push(s.type in i.addons?v.init(s,i):s)}t.lst=e}return s}const k={setCellProps:{value:function(t,e,s,i,o,n,r,l,a,p,d){var c,m,h;const g=this.getTw();const u=e.key;const f=g.term.values||{};t.label="label"in e?e.label:((c=f[u])===null||c===void 0?void 0:c.label)?f[u].label:u;t.fill=e.color||((m=f[e.key])===null||m===void 0?void 0:m.color);t.order=o.ref.bins?o.ref.bins.findIndex((t=>t.name==u)):0;t.x=t.totalIndex*a+t.grpIndex*i.colgspace;t.y=l*d;const b=((h=g.legend)===null||h===void 0?void 0:h.group)||g.$id;return{ref:o.ref,group:b,value:u,entry:{key:u,label:t.label,fill:t.fill}}}}};const C={setCellProps:{value:function(e,s,i,o,n,r,l,a,p,d,c){var m,h,g,u,f;const b=this.getTw();const y=s.key;const v=b.term.values||{};e.label="label"in s?s.label:((m=v[y])===null||m===void 0?void 0:m.label)?v[y].label:y;e.fill=s.color||((h=v[s.key])===null||h===void 0?void 0:h.color);if(!b.settings)b.settings={};if(!b.settings.barh)b.settings.barh=o.barh;if(!("gap"in b.settings))b.settings.gap=4;const x=(g=b.term.values)===null||g===void 0?void 0:g[e.key];if(x===null||x===void 0?void 0:x.uncomputable){e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=a*c;e.height=b.settings.barh;e.fill="transparent";e.label=x.label;const t=((u=b.legend)===null||u===void 0?void 0:u.group)||b.$id;return{ref:n.ref,group:t,value:x.label||x.key,entry:{key:y,label:e.label,fill:e.fill}}}e.fill="#555";if(o.transpose){e.height=n.scale(e.key);e.x=b.settings.gap}else{const i=e.term.valueConversion;let r=i?e.key*i.scaleFactor:e.key;if(this.q.convert2ZScore){r=(r-n.mean)/n.std;e.fill=r>0?"#FF6666":"#6666FF";e.zscoreLabel=` (z-score: ${r.toFixed(2)})`}e.label="label"in s?s.label:((f=v[y])===null||f===void 0?void 0:f.label)?v[y].label:this.term.unit?`${e.key.toFixed(2)} ${this.term.unit}`:e.key.toFixed(2);e.height=r>=0?n.scales.pos(r):n.scales.neg(r);e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=r>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!i?"":t(e.key,i.fromUnit,i.toUnit,i.scaleFactor)}}}};class T{constructor(t){this.type="matrix";this.holderTitle="Sample Matrix";this.optionalFeatures=JSON.parse(sessionStorage.getItem("optionalFeatures")||`{}`)?.matrix||[];a(this);p(this)}async init(t){const s=this.opts;if(s.reactsTo)this.reactsTo=s.reactsTo;this.setDom=l;this.setDom(s);this.config=t.plots.find((t=>t.id===this.id));this.settings=Object.assign({},this.config.settings.matrix);this.computed={};if(this.dom.header)this.dom.header.html(this.holderTitle);this.setControls(t);this.clusterRenderer=new d({holder:this.dom.cluster,app:this.app,parent:this});this.legendRenderer=m({holder:this.dom.legendG,rectFillFxn:t=>t.color,iconStroke:"#aaa",handlers:{legend:{click:this.legendClick}},settings:{isExcludedAttr:"isExcluded"},note:"CLICK A ROW LABEL OR ITEM TO APPLY FILTERING"});this.customTipApi=this.dom.tip.getCustomApi({d:this.dom.menubody,clear:t=>{if(t?.target)this.dom.menutop.style("display","none");this.dom.menubody.selectAll("*").remove();return this.customTipApi},show:()=>{this.dom.menubody.style("display","block")},hide:()=>{}});this.setPill(t);const i={mclass:o,dt2label:n,morigin:r};for(const s in i){const o=i[s];this[s]=e({},o,t.termdbConfig[s]||{},t.termdbConfig.matrix?.[s]||{})}}setControls(t){this.controlsRenderer=new c({app:this.app,id:this.id,parent:this,holder:this.dom.controls,getSvg:()=>this.dom.svg.node()},t)}getState(t){const e=t.plots.find((t=>t.id===this.id));const s=t.termfilter.filter0;this.prevFilter0=this.state?.filter0;return{isVisible:true,config:e,filter:t.termfilter.filter,filter0:s,hasVerifiedToken:this.app.vocabApi.hasVerifiedToken(),tokenVerificationMessage:this.app.vocabApi.tokenVerificationMessage,vocab:t.vocab,termdbConfig:t.termdbConfig,clusterMethod:e.settings.hierCluster?.clusterMethod,distanceMethod:e.settings.hierCluster?.distanceMethod,clusterSamples:e.settings.hierCluster?.clusterSamples,nav:t.nav}}async main(){try{this.config=structuredClone(this.state.config);if(this.mayRequireToken())return;this.termGroups=j(this.config.termgroups,this.app);const t=this.settings.transpose;Object.assign(this.settings,structuredClone(this.config.settings),this.controlsRenderer.getSettings());this.dom.loadingDiv.selectAll("*").remove();this.dom.loadingDiv.html("").style("display","").style("position","relative").style("left","45%");this.dom.svg.style("opacity",.1).style("pointer-events","none");delete this.clickedChildren;try{y(this.config);const t=[];if(this.setHierClusterData)t.push(this.setHierClusterData());t.push(this.setData());this.dom.loadingDiv.html("Processing data ...");await Promise.all(t);this.applyLegendValueFilter();if(this.combineData)this.combineData();this.app.save({type:"plot_edit",id:this.id,config:this.config})}catch(t){if(t=="no data"){this.showNoMatchingDataMessage();return}else if(t=="stale sequenceId"||t.name=="AbortError"){return}else{this.dom.svg.style("display","none");throw t}}this.dom.loadingDiv.html("Updating ...").style("display","");this.termOrder=this.getTermOrder(this.data);this.sampleGroups=this.getSampleGroups(this.hierClusterSamples||this.data);this.sampleOrder=this.getSampleOrder(this.data);if(!this.sampleOrder?.length&&!this.config.legendGrpFilter?.lst.length&&!this.config.legendValueFilter?.lst.length){this.showNoMatchingDataMessage();this.controlsRenderer.main();return}this.setLayout();if(this.setHierColorScale)this.setHierColorScale(this.hierClusterData.clustering);this.serieses=this.getSerieses(this.data);this.dom.loadingDiv.html("Rendering ...");if(this.plotDendrogramHclust)this.plotDendrogramHclust();this.render();this.mayDisplayCohortMessage();this.dom.svg.style("display","").style("opacity",1).style("pointer-events","");const[e,s]=!this.settings.matrix.transpose?["sampleGrps","termGrps"]:["termGrps","sampleGrps"];const i=this.dimensions;this.clusterRenderer.main({settings:this.settings.matrix,xGrps:this[e],yGrps:this[s],dimensions:i});this.legendRenderer(this.legendData,{settings:Object.assign({},this.settings.legend,{svgw:Math.max(400,i.mainw+i.xOffset-this.settings.matrix.margin.right),svgh:i.mainh+i.yOffset,dimensions:i,padleft:this.settings.legend.padleft})});await this.adjustSvgDimensions(t);this.controlsRenderer.main()}catch(t){const e=this.app.vocabApi.tokenVerificationMessage;this.mayRequireToken(e);if(!e){this.app.tip.hide();this.dom.loadingDiv.style("display","none");throw t}}this.resetInteractions()}showNoMatchingDataMessage(){this.forcedSampleCount=0;this.dom.svg.style("opacity",.001).style("display","none");if(this.termOrder&&this.dimensions)this.controlsRenderer.main({sampleCount:0});this.dom.loadingDiv.html("");const t=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");t.append("div").style("margin","5px 10px").html("No matching cohort sample data for the current gene list.");if(this.settings.matrix.showHints?.includes("genesetEdit")){const e=t.append("div").style("margin","5px 10px");e.append("span").html("You may change the selected cohort,");if(this.config.legendGrpFilter?.lst.length||this.config.legendValueFilter?.lst.length){e.append("br");e.append("span").html("show hidden ");e.append("span").html("CNV").style("cursor","pointer").style("text-decoration","underline").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="CNV"))?.node().click()}));e.append("span").html(" or ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Mutation").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Mutation"))?.node().click()}));e.append("span").html(" data,")}e.append("br");e.append("span").html("or edit the gene list from the ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}this.dom.svg.style("display","none")}mayDisplayCohortMessage(){const t=!this.prevFilter0||s(this.state.filter0,this.prevFilter0)?"":"The gene list is persisted across cohorts.";if(t){this.dom.loadingDiv.html("");const e=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");e.append("div").html(t);if(this.settings.matrix.showHints?.includes("genesetEdit")){const t=e.append("div");t.append("span").html(" You may edit the gene list from the ");t.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}}this.dom.loadingDiv.style("display",t?"":"none")}sampleKey(t){return t.row.sample}sampleLabel(t){return t.label||t.row._ref_.label||""}sampleGrpKey(t){return t.grp.name}sampleGrpLabel(t){return t.grp.label||t.grp.name||""}termKey(t){return t.tw.$id}termLabel(t){return t.label}termGrpKey(t){return t.grp.name}termGrpLabel(t){return t.grp.label||t.grp.name||[{text:"⋮",dx:3,cls:"sjpp-exclude-svg-download"}]}}for(const t of[h,b,g,u,f]){for(const e in t){T.prototype[e]=t[e]}}const w=i(T);const D=w;function G(t,e){e.dom.tip.clear();const s=t.append("div");if(e.state.termdbConfig.matrixplots){for(const t of e.state.termdbConfig.matrixplots){s.append("div").attr("class","sja_menuoption sja_sharp_border").text(t.name).on("click",(async()=>{e.dom.tip.hide();const s=await e.app.vocabApi.getMatrixByName(t.name);e.app.dispatch({type:"plot_create",config:s})}))}}s.append("div").datum({label:"Term tree & search",clickTo:e.showTree_selectlst,chartType:"matrix",usecase:{target:"matrix",detail:"termgroups"},processSelection:t=>[{name:"",lst:t.map((t=>({term:t})))}]}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>e.showTree_selectlst(s)));s.append("div").datum({label:"Text input",chartType:"matrix",clickTo:S,usecase:{target:"matrix",detail:"termgroups"},placeholder:"term\tgroup",processInput:async t=>{const s=t.split("\n").map((t=>t.split("\t")));const i=s.map((t=>t[0])).filter((t=>!!t));const o=await e.app.vocabApi.getTermTypes(i);const n={};for(const[t,e]of s){if(!(t in o))continue;if(!(e in n))n[e]={name:e,lst:[]};n[e].lst.push({term:o[t]})}return Object.values(n)}}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>S(s,e)))}function S(t,e){e.dom.tip.clear();e.dom.submenu=e.dom.tip.d.append("div").style("text-align","center");e.dom.submenu.append("span").html(t.label);e.dom.submenu.append("button").style("margin","0 5px").html("Submit").on("click",(async()=>{const i=await t.processInput(s.property("value"));e.dom.tip.hide();const o={type:"plot_create",id:I(),config:{chartType:t.usecase.target,[t.usecase.detail]:i}};e.app.dispatch(o)}));const s=e.dom.submenu.append("div").style("text-align","left").append("textarea").attr("placeholder",t.placeholder).style("width","300px").style("height","300px").style("margin","5px").style("padding","5px").on("keydown",(t=>{const e=t.keyCode||t.which;if(e==9){t.preventDefault();const e=t.target;const s=e.selectionStart;e.value=e.value.substring(0,e.selectionStart)+"\t"+e.value.substring(e.selectionEnd);e.selectionEnd=s+1}}))}const F="_CHART_AUTOID_";let M=Date.now();function I(){return F+M++}export{T as Matrix,D as componentInit,G as makeChartBtnMenu,w as matrixInit};
|
|
1
|
+
import{V as t,P as e,F as s,h as i,z as o,B as n,O as r}from"./app-6fb77603.js";import{setMatrixDom as l}from"./matrix.dom-1e0da5b3.js";import{setInteractivity as a}from"./matrix.interactivity-1cb56534.js";import{setRenderers as p}from"./matrix.renderers-337ce240.js";import{MatrixCluster as d}from"./matrix.cluster-a6e713e8.js";import{MatrixControls as c}from"./matrix.controls-42ad4912.js";import{s as m}from"./svg.legend-749348e0.js";import{m as h}from"./matrix.data-2b814c9f.js";import{m as g}from"./matrix.layout-47e44357.js";import{m as u}from"./matrix.serieses-7b7184c9.js";import{m as f}from"./matrix.legend-9af0c757.js";import{m as b}from"./matrix.groups-824a7244.js";import{setComputedConfig as y}from"./matrix.config-2c550b5d.js";export{getPlotConfig}from"./matrix.config-2c550b5d.js";import{l as v}from"./termsetting-492eefa7.js";import"./table-0daf2b89.js";import"./tslib.es6-c3c2d88f.js";import"./pointer-c7475677.js";import"./controls.config-2f0fa061.js";import"path";import"./matrix.sorterUi-1c60c145.js";import"./radiobutton-09bff425.js";import"./checkbox-96437f4d.js";import"./recover-299ffdb3.js";import"./FilterRxComp-02e68f1b.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-39d11f24.js";import"./FilterStateless-16a33070.js";import"./app-d215327f.js";import"./termInfo-491b10af.js";import"./toggleButtons-c4d6f260.js";import"./genesearch-ffd88bf2.js";import"./rehydrateFilter-12d118cb.js";import"./axis-747c801e.js";import"./matrix.cells-a018d731.js";import"./legacy-d3-polyfill-bdb2d792.js";import"./filter-b3d3964e.js";import"./matrix.sort-1ac05842.js";let x;function j(t,e){const s=structuredClone(t);if(!x)x={CatTWValues:k,CatTWPredefinedGS:k,CatTWCustomGS:k,NumTWRegularBin:k,NumTWCustomBin:k,NumTWCont:C};const i={vocabApi:e.vocabApi,addons:x};for(const t of s){const e=[];for(const s of t.lst){e.push(s.type in i.addons?v.init(s,i):s)}t.lst=e}return s}const k={setCellProps:{value:function(t,e,s,i,o,n,r,l,a,p,d){var c,m,h;const g=this.getTw();const u=e.key;const f=g.term.values||{};t.label="label"in e?e.label:((c=f[u])===null||c===void 0?void 0:c.label)?f[u].label:u;t.fill=e.color||((m=f[e.key])===null||m===void 0?void 0:m.color);t.order=o.ref.bins?o.ref.bins.findIndex((t=>t.name==u)):0;t.x=t.totalIndex*a+t.grpIndex*i.colgspace;t.y=l*d;const b=((h=g.legend)===null||h===void 0?void 0:h.group)||g.$id;return{ref:o.ref,group:b,value:u,entry:{key:u,label:t.label,fill:t.fill}}}}};const C={setCellProps:{value:function(e,s,i,o,n,r,l,a,p,d,c){var m,h,g,u,f;const b=this.getTw();const y=s.key;const v=b.term.values||{};e.label="label"in s?s.label:((m=v[y])===null||m===void 0?void 0:m.label)?v[y].label:y;e.fill=s.color||((h=v[s.key])===null||h===void 0?void 0:h.color);if(!b.settings)b.settings={};if(!b.settings.barh)b.settings.barh=o.barh;if(!("gap"in b.settings))b.settings.gap=4;const x=(g=b.term.values)===null||g===void 0?void 0:g[e.key];if(x===null||x===void 0?void 0:x.uncomputable){e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=a*c;e.height=b.settings.barh;e.fill="transparent";e.label=x.label;const t=((u=b.legend)===null||u===void 0?void 0:u.group)||b.$id;return{ref:n.ref,group:t,value:x.label||x.key,entry:{key:y,label:e.label,fill:e.fill}}}e.fill="#555";if(o.transpose){e.height=n.scale(e.key);e.x=b.settings.gap}else{const i=e.term.valueConversion;let r=i?e.key*i.scaleFactor:e.key;if(this.q.convert2ZScore){r=(r-n.mean)/n.std;e.fill=r>0?"#FF6666":"#6666FF";e.zscoreLabel=` (z-score: ${r.toFixed(2)})`}e.label="label"in s?s.label:((f=v[y])===null||f===void 0?void 0:f.label)?v[y].label:this.term.unit?`${e.key.toFixed(2)} ${this.term.unit}`:e.key.toFixed(2);e.height=r>=0?n.scales.pos(r):n.scales.neg(r);e.x=e.totalIndex*p+e.grpIndex*o.colgspace;e.y=r>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!i?"":t(e.key,i.fromUnit,i.toUnit,i.scaleFactor)}}}};class T{constructor(t){this.type="matrix";this.holderTitle="Sample Matrix";this.optionalFeatures=JSON.parse(sessionStorage.getItem("optionalFeatures")||`{}`)?.matrix||[];a(this);p(this)}async init(t){const s=this.opts;if(s.reactsTo)this.reactsTo=s.reactsTo;this.setDom=l;this.setDom(s);this.config=t.plots.find((t=>t.id===this.id));this.settings=Object.assign({},this.config.settings.matrix);this.computed={};if(this.dom.header)this.dom.header.html(this.holderTitle);this.setControls(t);this.clusterRenderer=new d({holder:this.dom.cluster,app:this.app,parent:this});this.legendRenderer=m({holder:this.dom.legendG,rectFillFxn:t=>t.color,iconStroke:"#aaa",handlers:{legend:{click:this.legendClick}},settings:{isExcludedAttr:"isExcluded"},note:"CLICK A ROW LABEL OR ITEM TO APPLY FILTERING"});this.customTipApi=this.dom.tip.getCustomApi({d:this.dom.menubody,clear:t=>{if(t?.target)this.dom.menutop.style("display","none");this.dom.menubody.selectAll("*").remove();return this.customTipApi},show:()=>{this.dom.menubody.style("display","block")},hide:()=>{}});this.setPill(t);const i={mclass:o,dt2label:n,morigin:r};for(const s in i){const o=i[s];this[s]=e({},o,t.termdbConfig[s]||{},t.termdbConfig.matrix?.[s]||{})}}setControls(t){this.controlsRenderer=new c({app:this.app,id:this.id,parent:this,holder:this.dom.controls,getSvg:()=>this.dom.svg.node()},t)}getState(t){const e=t.plots.find((t=>t.id===this.id));const s=t.termfilter.filter0;this.prevFilter0=this.state?.filter0;return{isVisible:true,config:e,filter:t.termfilter.filter,filter0:s,hasVerifiedToken:this.app.vocabApi.hasVerifiedToken(),tokenVerificationMessage:this.app.vocabApi.tokenVerificationMessage,vocab:t.vocab,termdbConfig:t.termdbConfig,clusterMethod:e.settings.hierCluster?.clusterMethod,distanceMethod:e.settings.hierCluster?.distanceMethod,clusterSamples:e.settings.hierCluster?.clusterSamples,nav:t.nav}}async main(){try{this.config=structuredClone(this.state.config);if(this.mayRequireToken())return;this.termGroups=j(this.config.termgroups,this.app);const t=this.settings.transpose;Object.assign(this.settings,structuredClone(this.config.settings),this.controlsRenderer.getSettings());this.dom.loadingDiv.selectAll("*").remove();this.dom.loadingDiv.html("").style("display","").style("position","relative").style("left","45%");this.dom.svg.style("opacity",.1).style("pointer-events","none");delete this.clickedChildren;try{y(this.config);const t=[];if(this.setHierClusterData)t.push(this.setHierClusterData());t.push(this.setData());this.dom.loadingDiv.html("Processing data ...");await Promise.all(t);this.applyLegendValueFilter();if(this.combineData)this.combineData();this.app.save({type:"plot_edit",id:this.id,config:this.config})}catch(t){if(t=="no data"){this.showNoMatchingDataMessage();return}else if(t=="stale sequenceId"||t.name=="AbortError"){return}else{this.dom.svg.style("display","none");throw t}}this.dom.loadingDiv.html("Updating ...").style("display","");this.termOrder=this.getTermOrder(this.data);this.sampleGroups=this.getSampleGroups(this.hierClusterSamples||this.data);this.sampleOrder=this.getSampleOrder(this.data);if(!this.sampleOrder?.length&&!this.config.legendGrpFilter?.lst.length&&!this.config.legendValueFilter?.lst.length){this.showNoMatchingDataMessage();this.controlsRenderer.main();return}this.setLayout();if(this.setHierColorScale)this.setHierColorScale(this.hierClusterData.clustering);this.serieses=this.getSerieses(this.data);this.dom.loadingDiv.html("Rendering ...");if(this.plotDendrogramHclust)this.plotDendrogramHclust();this.render();this.mayDisplayCohortMessage();this.dom.svg.style("display","").style("opacity",1).style("pointer-events","");const[e,s]=!this.settings.matrix.transpose?["sampleGrps","termGrps"]:["termGrps","sampleGrps"];const i=this.dimensions;this.clusterRenderer.main({settings:this.settings.matrix,xGrps:this[e],yGrps:this[s],dimensions:i});this.legendRenderer(this.legendData,{settings:Object.assign({},this.settings.legend,{svgw:Math.max(400,i.mainw+i.xOffset-this.settings.matrix.margin.right),svgh:i.mainh+i.yOffset,dimensions:i,padleft:this.settings.legend.padleft})});await this.adjustSvgDimensions(t);this.controlsRenderer.main()}catch(t){const e=this.app.vocabApi.tokenVerificationMessage;this.mayRequireToken(e);if(!e){this.app.tip.hide();this.dom.loadingDiv.style("display","none");throw t}}this.resetInteractions()}showNoMatchingDataMessage(){this.forcedSampleCount=0;this.dom.svg.style("opacity",.001).style("display","none");if(this.termOrder&&this.dimensions)this.controlsRenderer.main({sampleCount:0});this.dom.loadingDiv.html("");const t=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");t.append("div").style("margin","5px 10px").html("No matching cohort sample data for the current gene list.");if(this.settings.matrix.showHints?.includes("genesetEdit")){const e=t.append("div").style("margin","5px 10px");e.append("span").html("You may change the selected cohort,");if(this.config.legendGrpFilter?.lst.length||this.config.legendValueFilter?.lst.length){e.append("br");e.append("span").html("show hidden ");e.append("span").html("CNV").style("cursor","pointer").style("text-decoration","underline").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="CNV"))?.node().click()}));e.append("span").html(" or ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Mutation").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Mutation"))?.node().click()}));e.append("span").html(" data,")}e.append("br");e.append("span").html("or edit the gene list from the ");e.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}this.dom.svg.style("display","none")}mayDisplayCohortMessage(){const t=!this.prevFilter0||s(this.state.filter0,this.prevFilter0)?"":"The gene list is persisted across cohorts.";if(t){this.dom.loadingDiv.html("");const e=this.dom.loadingDiv.append("div").style("display","inline-block").style("text-align","center").style("position","relative").style("left","-150px");e.append("div").html(t);if(this.settings.matrix.showHints?.includes("genesetEdit")){const t=e.append("div");t.append("span").html(" You may edit the gene list from the ");t.append("span").style("cursor","pointer").style("text-decoration","underline").html("Gene Set Edit Group menu.").on("click",(()=>{this.controlsRenderer.btns.filter((t=>t.label=="Genes"))?.node().click();const t=setInterval((()=>{const e=this.app.tip.d.selectAll("button").filter((function(){return this.innerHTML=="Edit Group"})).node();if(e){e.click();clearInterval(t)}}),100)}))}}this.dom.loadingDiv.style("display",t?"":"none")}sampleKey(t){return t.row.sample}sampleLabel(t){return t.label||t.row._ref_.label||""}sampleGrpKey(t){return t.grp.name}sampleGrpLabel(t){return t.grp.label||t.grp.name||""}termKey(t){return t.tw.$id}termLabel(t){return t.label}termGrpKey(t){return t.grp.name}termGrpLabel(t){return t.grp.label||t.grp.name||[{text:"⋮",dx:3,cls:"sjpp-exclude-svg-download"}]}}for(const t of[h,b,g,u,f]){for(const e in t){T.prototype[e]=t[e]}}const w=i(T);const D=w;function G(t,e){e.dom.tip.clear();const s=t.append("div");if(e.state.termdbConfig.matrixplots){for(const t of e.state.termdbConfig.matrixplots){s.append("div").attr("class","sja_menuoption sja_sharp_border").text(t.name).on("click",(async()=>{e.dom.tip.hide();const s=await e.app.vocabApi.getMatrixByName(t.name);e.app.dispatch({type:"plot_create",config:s})}))}}s.append("div").datum({label:"Term tree & search",clickTo:e.showTree_selectlst,chartType:"matrix",usecase:{target:"matrix",detail:"termgroups"},processSelection:t=>[{name:"",lst:t.map((t=>({term:t})))}]}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>e.showTree_selectlst(s)));s.append("div").datum({label:"Text input",chartType:"matrix",clickTo:S,usecase:{target:"matrix",detail:"termgroups"},placeholder:"term\tgroup",processInput:async t=>{const s=t.split("\n").map((t=>t.split("\t")));const i=s.map((t=>t[0])).filter((t=>!!t));const o=await e.app.vocabApi.getTermTypes(i);const n={};for(const[t,e]of s){if(!(t in o))continue;if(!(e in n))n[e]={name:e,lst:[]};n[e].lst.push({term:o[t]})}return Object.values(n)}}).attr("class","sja_menuoption sja_sharp_border").text((t=>t.label)).on("click",((t,s)=>S(s,e)))}function S(t,e){e.dom.tip.clear();e.dom.submenu=e.dom.tip.d.append("div").style("text-align","center");e.dom.submenu.append("span").html(t.label);e.dom.submenu.append("button").style("margin","0 5px").html("Submit").on("click",(async()=>{const i=await t.processInput(s.property("value"));e.dom.tip.hide();const o={type:"plot_create",id:I(),config:{chartType:t.usecase.target,[t.usecase.detail]:i}};e.app.dispatch(o)}));const s=e.dom.submenu.append("div").style("text-align","left").append("textarea").attr("placeholder",t.placeholder).style("width","300px").style("height","300px").style("margin","5px").style("padding","5px").on("keydown",(t=>{const e=t.keyCode||t.which;if(e==9){t.preventDefault();const e=t.target;const s=e.selectionStart;e.value=e.value.substring(0,e.selectionStart)+"\t"+e.value.substring(e.selectionEnd);e.selectionEnd=s+1}}))}const F="_CHART_AUTOID_";let M=Date.now();function I(){return F+M++}export{T as Matrix,D as componentInit,G as makeChartBtnMenu,w as matrixInit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ak as e,at as l,ap as t,R as s,as as a,bR as n,V as r}from"./app-
|
|
1
|
+
import{ak as e,at as l,ap as t,R as s,as as a,bR as n,V as r}from"./app-6fb77603.js";import{T as o}from"./termsetting-492eefa7.js";import"./tslib.es6-c3c2d88f.js";import"path";function i(e,l,t,s,a,n,o,i,c,g,d,u){const f=t.key;const p=l.term.values||{};e.label="label"in t?t.label:p[f]?.label?p[f].label:f;e.fill=t.color||p[t.key]?.color;e.order=n.ref.bins?n.ref.bins.findIndex((e=>e.name==f)):0;if(l.q?.mode=="continuous"){if(!l.settings)l.settings={};if(!l.settings.barh)l.settings.barh=a.barh;if(!("gap"in l.settings))l.settings.gap=4;const s=l.term.values?.[e.key];if(s?.uncomputable){e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;e.height=l.settings.barh;e.fill="transparent";l.legend?.group||l.$id;return}e.fill="#555";if(a.transpose){e.height=n.scale(e.key);e.x=l.settings.gap}else{const s=e.term.valueConversion;let o=s?e.key*s.scaleFactor:e.key;if(l.q.convert2ZScore){o=(o-n.mean)/n.std;e.fill=o>0?"#FF6666":"#6666FF";e.zscoreLabel=` (z-score: ${o.toFixed(2)})`}e.label="label"in t?t.label:p[f]?.label?p[f].label:l.term.unit?`${e.key.toFixed(2)} ${l.term.unit}`:e.key.toFixed(2);e.height=o>=0?n.scales.pos(o):n.scales.neg(o);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=o>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!s?"":r(e.key,s.fromUnit,s.toUnit,s.scaleFactor)}}else{e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const t=l.legend?.group||l.$id;return{ref:n.ref,group:t,value:f,entry:{key:f,label:e.label,fill:e.fill}}}}function c(e,l,t,s,a,n,o,i,c,g,d,u){const f=l.q?.mode=="continuous"?t.value:t.key;e.key=f;e.label=l.q?.mode=="continuous"?l.term.unit?`${f} ${l.term.unit}`:f:l.term.values?.[f].label?l.term.values?.[f].label:"Exit code: "+f;e.fill=f==1?"#a1a3a6":"#a3c88b";e.order=0;if(l.q?.mode=="continuous"){if(!l.settings)l.settings={};if(!l.settings.barh)l.settings.barh=a.barh;if(!("gap"in l.settings))l.settings.gap=4;e.exitCodeKey=l.term.values?.[t.key].label||"Exit code: "+t.key;e.fill=t.key==1?"#a1a3a6":"#a3c88b";if(a.transpose){e.height=n.scale(e.key);e.x=l.settings.gap}else{const t=e.term.valueConversion;let s=t?e.key*t.scaleFactor:e.key;if(l.q.convert2ZScore){s=(s-n.mean)/n.std;e.zscoreLabel=` (z-score: ${s.toFixed(2)})`}e.label=l.term.unit?`${e.key.toFixed(2)} ${l.term.unit}`:e.key.toFixed(2);e.height=s>=0?n.scales.pos(s):n.scales.neg(s);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=s>=0?n.counts.posMaxHt+n.tw.settings.gap-e.height:n.counts.posMaxHt+n.tw.settings.gap;e.convertedValueLabel=!t?"":r(e.key,t.fromUnit,t.toUnit,t.scaleFactor)}}else{const s=e.term.valueConversion;e.timeToEventKey=s?r(t.value,s.fromUnit,s.toUnit,s.scaleFactor):t.value.toFixed(2);e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const o=l.legend?.group||l.$id;return{ref:n.ref,group:o,value:f,entry:{key:f,label:e.label,fill:e.fill}}}}function g(e,l,t,s,a,n,r,o,i,c,g,d){const u=l.term.values||{};const f=t.key;e.label="label"in t?t.label:u[f]?.label?u[f].label:f;e.fill=t.color||u[f]?.color;e.x=e.totalIndex*c+e.grpIndex*a.colgspace;e.y=i*d;const p=l.legend?.group||l.$id;return{ref:n.ref,group:p,value:t.key,entry:{key:f,label:e.label,fill:e.fill}}}function d(n,r,o,i,c,g,d,u,f,p,b,x){const h=o.renderedValues||o.filteredValues||o.values||[o.value];const y=r.q?.values&&r.q?.values[i.class]?.color;if(r.q?.type=="predefined-groupset"||r.q?.type=="custom-groupset"){n.label=i;n.fill=["Mutated","Protein-changing","Truncating"].includes(i)?"#FF0000":["Wildtype","Rest"].includes(o.key)?"#0000FF":o.key=="Not tested"?"#00FF00":"#000000";n.value={value:i,dt:r.q.dt,origin:r.q.origin};n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*x;const e=r.legend?.group||r.q.origin?`${r.q.origin[0].toUpperCase()+r.q.origin.slice(1)} ${d.dt2label[r.q.dt]}`:d.dt2label[r.q.dt];return{ref:g.ref,group:e,value:o.key,order:-2,entry:{key:o.key,label:n.label,fill:n.fill,dt:r.q.dt,origin:r.q.origin}}}else{n.label=i.label||d.mclass[i.class].label;n.fill=d.getValueColor?.(i.value)||y||i.color||d.mclass[i.class]?.color;n.class=i.class;n.value=i;const o=d.dimensions.colw;if(c.cellEncoding==""){n.height=c.rowh/h.length;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*x}else if(i.dt==e||i.dt==l){if(c.cellEncoding=="single"){n.height=c.rowh;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=0}else{const e=3;n.height=c.rowh/e;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=f*.33333}}else if(i.dt==t||i.dt==s){n.height=c.rowh;n.width=o;n.x=n.totalIndex*p+n.grpIndex*c.colgspace;n.y=0}else{throw`cannot set cell props for dt='${i.dt}'`}if(i.class=="Blank"||i.class=="WT"){n.label=`${d.dt2label[i.dt]} ${n.label}`}const u=d.state.termdbConfig.assayAvailability?.byDt;const b=i.class=="CNV_loss"?-2:i.class.startsWith("CNV_")?-1:0;if(i.dt==t){if(g.scales&&i.class.startsWith("CNV_")){g.scales.max;const{maxLoss:e,maxGain:l,minLoss:t,minGain:s}=g.scales;i.scaledValue=i.value<0?i.value/t:i.value/l;n.fill=i.value<0?g.scales.loss(i.scaledValue):g.scales.gain(i.scaledValue);return{ref:g.ref,group:"CNV",value:i.class,order:-1,entry:{key:i.class,label:n.label,scale:i.class=="CNV_loss"?g.scales.loss:g.scales.gain,domain:i.class=="CNV_loss"?[0,-t]:[0,l],minLabel:0,maxLabel:i.class=="CNV_loss"?t:l,order:b,dt:i.dt,origin:i.origin}}}else{const e="CNV";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}}else if(i.dt==l&&u?.[l]){const e="Fusion RNA";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}else if(i.dt==a&&u?.[a]){const e="Structural Variation";return{ref:g.ref,group:e,value:i.class,order:-1,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}else if(i.dt==s){return{ref:g.ref,group:d.config.settings.hierCluster?.termGroupName||"Gene Expression",value:i.class,order:-1,entry:{key:i.class,label:"",scale:d.geneExpValues.scale,domain:[0,.5,1],minLabel:d.geneExpValues.min,maxLabel:d.geneExpValues.max,order:b,dt:i.dt,origin:i.origin}}}else{const e=d.settings.matrix.controlLabels;const l=r.legend?.group||(i.origin?`${i.origin[0].toUpperCase()+i.origin.slice(1)} ${e.Mutations}`:e.Mutations);return{ref:g.ref,group:l,value:i.class,order:-2,entry:{key:i.class,label:n.label,fill:n.fill,order:b,dt:i.dt,origin:i.origin}}}}}function u(e,l,t,s,a,r,o,i,c,g,d,u){t.renderedValues||t.filteredValues||t.values||[t.value];e.label=s.value;e.fill=o.getValueColor?.(s.value);e.value=s;const f=o.dimensions.colw;e.height=a.clusterRowh;e.width=f;e.x=e.totalIndex*g+e.grpIndex*a.colgspace;e.y=c*u;const p=o.config.settings.hierCluster?.termGroupName?o.config.settings.hierCluster?.termGroupName:l.term.type=="geneExpression"?"Expression":l.term.type=="metaboliteIntensity"?"Intensity":"Heatmap color scale";return{ref:r.ref,group:p,order:-1,entry:{label:"",scale:o.hierClusterValues.scale,domain:n[o.settings.hierCluster.colorScale].domain,minLabel:o.hierClusterValues.min,maxLabel:o.hierClusterValues.max,order:0,dt:s.dt}}}function f(e,l,t){const s=Object.assign({},e);s.fill=l.cellbg;s.height=l.rowh;s.width=t.colw;s.x=s.totalIndex*t.dx+s.grpIndex*l.colgspace;s.y=0;return s}const p={categorical:g,condition:g,integer:i,float:i,survival:c,geneVariant:d,hierCluster:u,[o.GENE_EXPRESSION]:i,[o.METABOLITE_INTENSITY]:i};const b={geneVariant:x,integer:h,float:h,categorical:y,condition:y,survival:h,[o.GENE_EXPRESSION]:h,[o.METABOLITE_INTENSITY]:h};function x(e,l,s,a){if(e.find((e=>e.value.dt==t)))return;const n=Object.assign({},l);n.fill=s.cellbg;n.height=s.rowh;n.width=a.colw;n.x=n.totalIndex*a.dx+n.grpIndex*s.colgspace;n.y=0;return n}function h(e,l,t,s){const a=l.tw.q;if(a.mode!="continuous"){if(e.length)return;y(e,l,t,s)}else{if(a?.mode!="continuous")return;const e=l.tw.settings;const n=e?e.barh+2*e.gap:t.rowh;if(l.height>=n)return;const r=Object.assign({},l);r.fill=t.cellbg;r.height=n||t.rowh;r.width=s.colw;r.x=r.totalIndex*s.dx+r.grpIndex*t.colgspace;r.y=0;return r}}function y(e,l,t,s){if(e.length)return;const a=Object.assign({},l);a.fill=t.cellbg;a.height=t.rowh;a.width=s.colw;a.x=a.totalIndex*s.dx+a.grpIndex*t.colgspace;a.y=0;return a}export{f as getEmptyCell,b as maySetEmptyCell,p as setCellProps,d as setGeneVariantCellProps,u as setHierClusterCellProps};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as t}from"./app-
|
|
1
|
+
import{d as t}from"./app-6fb77603.js";class s{constructor(t){this.parent=t.parent;t.svg;this.patternId=`sjpp-matrix-grid-pattern-${this.parent.id}`;this.patternIdSuffix=0;this.dom={holder:t.holder,clusterbg:t.holder.insert("g","g").attr("class","sjpp-matrix-clusterbg").on("mouseover",this.mouseout),outlines:t.holder.append("g").attr("class","sjpp-matrix-clusteroutlines")};e(this)}main(t){this.currData=t;this.settings=t.settings;this.xGrps=t.xGrps;this.xGrpKey=!this.settings.transpose?"samplegrp":"termgrp";this.yGrps=t.yGrps;this.yGrpKey=!this.settings.transpose?"termgrp":"samplegrp";this.clusters=this.processData();this.render(this.clusters)}processData(){const t=this.settings;const s=this.currData.dimensions;const e=[];this.totalWidth=t.zoomLevel==1?-4:0;for(const r of this.xGrps){const n=s.dx;const o=r.prevGrpTotalIndex*n+t.colgspace*r.grpIndex+r.totalHtAdjustments;const a=n*(r.processedLst||r.grp.lst).length+r.grpTotals.htAdjustment-t.colspace;this.totalWidth+=a+2*Math.max(1,t.colspace);for(const n of this.yGrps){const i=n.prevGrpTotalIndex*s.dy+n.grpIndex*t.rowgspace+n.totalHtAdjustments;const c=s.dy*(n.processedLst||n.grp.lst).length+n.grpTotals.htAdjustment-t.rowspace;const p=1;const l=1;e.push({xg:r,yg:n,x:o-p,y:i-l,width:a+2*p,height:c+2*l})}}return e}}function e(s){s.render=function(t){const r=s.settings;const a=s.currData.dimensions;const i=s.dom.outlines.attr("transform")?r.duration:0;s.translateElems(0,r,a,i);if(r.prevShowGrid!=r.showGrid){s.dom.outlines.selectAll("*").remove()}if(r.showGrid!="pattern"){e(t)}else{const e=s.dom.outlines.selectAll("g").data(t,(t=>t.xg.grp.name+";;"+t.yg.grp.name));e.exit().remove();e.each(o);e.enter().append("g").each(n)}r.prevShowGrid=r.showGrid;s.parent.delayedMouseoutHandler()};s.translateElems=function(t,e,r,n=0){const o=!n?s.dom.outlines:s.dom.outlines.transition().duration(n);o.attr("transform",`translate(${r.xOffset+r.seriesXoffset+t},${r.yOffset})`)};function e(t,e,n){const o=s.dom.outlines.selectAll("rect").data(t,(t=>t.xg.grp.name+";;"+t.yg.grp.name));o.exit().remove();o.each(r);o.enter().append("rect").each(r)}function r(e){const r=s.settings;t(this).transition().duration("x"in this?r.duration:0).attr("x",e.x).attr("y",e.y).attr("width",e.width).attr("height",e.height).attr("shape-rendering","crispEdges").attr("fill",!r.showGrid?r.cellbg:r.gridStroke).attr("stroke",r.outlineStroke).attr("stroke-width",1)}function n(e){const r=t(this);const n=r.append("pattern").attr("id",`${s.patternId}-${s.patternIdSuffix++}`).attr("patternUnits","userSpaceOnUse").attr("patternUnits","userSpaceOnUse");n.append("line");n.append("line");r.append("rect");r.append("rect");o.call(this,e)}function o(e){const r=s.settings;const n=s.parent.dimensions;const o=t(this);const c=a(o,r,n);const p=o.node().querySelectorAll("rect");i.call(p[0],e,Object.assign({},r,{fill:r.cellbg}));const l=r.showGrid?`url(#${c})`:"none";i.call(p[1],e,Object.assign({},r,{fill:l,stroke:r.gridStroke}))}function a(s,e,r,n){const o=s.select("pattern").attr("x",0).attr("y",0).attr("width",r.colw+e.colspace).attr("height",e.rowh+e.rowspace);const a=.5*e.rowspace;const i=e.rowh+a;const[c,p]=o.node().querySelectorAll("line");t(c).attr("x1",0).attr("y1",i).attr("x2",r.colw+e.colspace).attr("y2",i).attr("stroke",e.gridStroke).attr("stroke-width",e.rowspace);const l=.5*e.colspace;const d=r.colw+l;t(p).attr("x1",d).attr("y1",0).attr("x2",d).attr("y2",e.rowh).attr("stroke",e.gridStroke).attr("stroke-width",e.colspace);return o.attr("id")}function i(s,e){const r=t(this);r.transition().duration(r.attr("x")?e.duration:0).attr("x",s.x).attr("y",s.y).attr("width",s.width).attr("height",s.height).attr("shape-rendering","crispEdges").attr("fill",e.fill||"none").attr("stroke",e.stroke||"none")}}export{s as MatrixCluster};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bM as e,bN as t,bO as s,bP as a,bQ as i,P as l,z as o,ap as r}from"./app-
|
|
1
|
+
import{bM as e,bN as t,bO as s,bP as a,bQ as i,P as l,z as o,ap as r}from"./app-6fb77603.js";import{getSortOptions as n}from"./matrix.sort-1ac05842.js";import{b as m,f as p}from"./termsetting-492eefa7.js";import"./tslib.es6-c3c2d88f.js";import"path";async function c(o={},r){const c={Samples:"Samples",samples:"samples",Sample:"Sample",sample:"sample",Terms:"Variables",terms:"variables",Term:"Variable",term:"Variable",Mutations:"Mutations"};const d={termgroups:[],samplegroups:[],divideBy:null,legendValueFilter:{isAtomic:true,type:"tvslst",in:true,join:"and",lst:[]},legendGrpFilter:{isAtomic:true,type:"tvslst",in:true,join:"and",lst:[]},settings:{matrix:{svgCanvasSwitch:1e3,useMinPixelWidth:true,cellEncoding:"",margin:{top:10,right:5,bottom:20,left:50},maxGenes:o.settings?.maxGenes||50,maxSample:o.settings?.maxSample||1e3,sampleNameFilter:"",sortSamplesBy:"a",sortPriority:undefined,sortSampleGrpsBy:"name",sortSamplesTieBreakers:[{$id:"sample",sortSamples:{}}],sortTermsBy:"sampleCount",samplecount4gene:o.chartType=="hierCluster"?"":"abs",geneVariantCountSamplesSkipMclass:[],cellbg:"#ececec",showGrid:"",addMutationCNVButtons:false,truncatingMutations:e,proteinChangingMutations:t,synonymousMutations:s,mutationClasses:a,CNVClasses:i,gridStroke:"#fff",outlineStroke:"#ccc",beamStroke:"#f00",colw:0,colwMin:.1/window.devicePixelRatio,colwMax:16,colspace:1,colgspace:8,colglabelpos:true,collabelpos:"bottom",collabelvisible:true,collabelgap:5,collabelpad:1,collabelmaxchars:32,rowh:18,rowhMin:1,rowhMax:20,rowspace:1,rowgspace:8,rowlabelpos:"left",rowlabelgap:5,rowlabelvisible:true,rowlabelpad:1,rowlabelmaxchars:32,legendGrpLabelMaxChars:26,grpLabelFontSize:12,minLabelFontSize:6,maxLabelFontSize:14,transpose:false,sampleLabelOffset:120,sampleGrpLabelOffset:120,sampleGrpLabelMaxChars:32,termLabelOffset:80,termGrpLabelOffset:80,termGrpLabelMaxChars:32,duration:0,zoomLevel:1,zoomCenterPct:0,zoomIndex:0,zoomGrpIndex:0,zoomMin:.5,zoomIncrement:.1,zoomStep:1,imgWMax:6e4/window.devicePixelRatio,scrollHeight:12,controlLabels:c,cnvUnit:"log2ratio",ignoreCnvValues:false,barh:32,showHints:[]}}};const f=d.settings;const u=Math.max(f.matrix.rowh+f.matrix.rowspace-3*f.matrix.rowlabelpad,12);f.legend={ontop:false,lineh:25,padx:5,padleft:0,padright:20,padbtm:30,fontsize:u,iconh:u-2,iconw:u-2,hangleft:1,linesep:false};const g=r.vocabApi.termdbConfig.matrix||{};l(d.settings.matrix,g.settings);if(g.legendGrpFilter)d.legendGrpFilter=g.legendGrpFilter;if(g.legendValueFilter)d.legendValueFilter=g.legendValueFilter;if(o.name){const e=await r.vocabApi.getMatrixByName(o.name);if(!e)throw"error from getMatrixByName()";if(e.error)throw e.error;l(d,e)}const h=o?.settings?.matrix;if(h){if((h.sortSamplesBy=="custom"||h.sortSamplesBy=="asListed")&&h.sortOptions?.custom.label=="against alteration type"){h.sortSamplesBy="a"}if(h.sortOptions){delete h.sortOptions.custom;delete h.sortOptions.asListed}}l(d,o);const b=d.settings.matrix;b.sortOptions=n(r.vocabApi.termdbConfig,c,b);b.duration=0;b.colw=0;if(b.sortSamplesBy!="asListed"&&!b.sortOptions?.[b.sortSamplesBy])b.sortSamplesBy="a";else if(["selectedTerms","class","dt","hits"].includes(b.sortSamplesBy))b.sortSamplesBy="a";if(b.samplecount4gene===true||b.samplecount4gene===1)b.samplecount4gene="abs";if(window.location.hostname=="localhost"){if(window.location.hash=="#canvas")b.svgCanvasSwitch=0}const y=[];for(const e of d.termgroups){e.lst=JSON.parse(JSON.stringify(e.lst));for(const t of e.lst){if(!t.term?.type||m(t.term.type)){if(!t.id){if(!t.term.id)throw`missing tw.id and tw.term.id`;t.id=t.term.id}delete t.term}y.push(p(t,r.vocabApi))}}if(d.divideBy)y.push(p(d.divideBy,r.vocabApi));await Promise.all(y);return d}function d(e){const t=e.settings.matrix;const s=[...t.mutationClasses,...t.CNVClasses];t.filterByClass={isAtomic:true};for(const a of e.legendGrpFilter.lst){if(!a.dt)continue;s.filter((e=>a.dt.includes(o[e].dt))).forEach((e=>{t.filterByClass[e]="value"}))}for(const s of e.legendValueFilter.lst){if(!s.legendGrpName||s.tvs?.term?.type!=="geneVariant")continue;if(s.tvs.values?.[0].mclasslst)s.tvs.values[0].mclasslst.forEach((e=>{t.filterByClass[e]=s.legendFilterType?.endsWith("_hard")?"case":"value"}));else if(s.tvs.values)s.tvs.values.forEach((e=>{t.filterByClass[key]="value"}));else throw`unhandled tvs from legendValueFilter`}t.hiddenVariants=Object.keys(t.filterByClass).filter((e=>e!=="isAtomic"));const a=new Set(t.hiddenVariants.filter((e=>o[e]?.dt===r)));t.hiddenCNVs=[...a];t.showMatrixCNV=!a.size?"all":a.size==t.CNVClasses.length?"none":"bySelection";t.allMatrixCNVHidden=a.size==t.CNVClasses.length;const i=new Set(t.hiddenVariants.filter((e=>t.mutationClasses.find((t=>t===e)))));t.hiddenMutations=[...i];const l=new Set(t.proteinChangingMutations);const n=new Set(t.truncatingMutations);t.showMatrixMutation=!i.size?"all":i.size==t.mutationClasses.length?"none":i.size===t.mutationClasses.length-l.size&&[...i].every((e=>!l.has(e)))?"onlyPC":i.size===t.mutationClasses.length-n.size&&[...i].every((e=>!n.has(e)))?"onlyTruncating":"bySelection";t.allMatrixMutationHidden=i.size==t.mutationClasses.length;const m=t.sortOptions.a?.sortPriority.find((e=>e.types.length==1&&e.types[0]=="geneVariant"))?.tiebreakers||[];t.sortByMutation=m.find((e=>e.filter?.values[0]?.dt===1))?.isOrdered?"consequence":"presence";t.sortByCNV=m.find((e=>e.filter?.values[0]?.dt===4))?.disabled!==true}export{c as getPlotConfig,d as setComputedConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{initByInput as t}from"./controls.config-2f0fa061.js";import{d as e,M as a,U as s,ak as n,B as i,z as o,ap as l,at as r,as as p,L as c}from"./app-6fb77603.js";import{getSorterUi as d}from"./matrix.sorterUi-1c60c145.js";import{i as m,f as h,T as u,g}from"./termsetting-492eefa7.js";import{m as y}from"./radiobutton-09bff425.js";import{m as b}from"./checkbox-96437f4d.js";import{G as f}from"./recover-299ffdb3.js";import"./tslib.es6-c3c2d88f.js";import"path";import"./FilterRxComp-02e68f1b.js";import"./table-0daf2b89.js";import"./partjson.esm-b3f1fc21.js";import"./termdb.bins-39d11f24.js";import"./FilterStateless-16a33070.js";import"./app-d215327f.js";import"./termInfo-491b10af.js";import"./toggleButtons-c4d6f260.js";import"./genesearch-ffd88bf2.js";import"./rehydrateFilter-12d118cb.js";function x(t){if(!t.holder)throw`zoom requires an opts.holder`;if(typeof t.callback!="function")throw`zoom requires an opts.callback function`;const e={min:1,max:100,value:25,step:10,increment:1,numberInputWidth:"35px",showJumpBtns:false};const a=Object.assign({},e,t.settings||{});t.holder.attr("title",t.title||null).style("vertical-align","top").style("text-align","center").on("mouseenter",(()=>{o.style("display","inline-block").style("overflow","visible")})).on("mouseleave",(()=>{o.style("display","none").style("overflow","hidden")}));const s=t.holder.append("label");s.append("span").text("Zoom");const n=s.append("input").attr("title","Enter a desired zoom level").attr("type","number").attr("min",a.min).attr("max",a.max).attr("step",a.increment).style("min-width",a.numberInputWidth).style("width",t.width||"fit-content").style("margin","3px 5px").property("value",a.value).on("change",(e=>{const a=Number(e.target.value);c.update({value:a});t.callback(a)}));s.append("span").text("unit"in t?t.unit:"%");const i=t.holder.node().getBoundingClientRect();t.holder.style("max-height",i.height+"px").style("max-width",i.width+"px");t.holder.append("br");const o=t.holder.append("div").style("display","none");const l=!t.showJumpBtns?null:t.holder.append("button").attr("title","Zoom in").style("width","25px").html("-").on("click",(()=>{const e=Math.max(a.step*Math.ceil((a.value-a.step)/a.step),a.min);c.update({value:e});t.callback(e)}));const r=o.append("input").attr("title","Slide to desired zoom level").attr("type","range").attr("min",a.min).attr("max",a.max).attr("step",a.increment).style("margin","2px 5px").style("padding",0).style("vertical-align","middle").property("value",a.value).html("-").on("input",(t=>{n.property("value",t.target.value)})).on("change",(e=>{const a=Number(e.target.value);c.update({value:a});t.callback(a)}));const p=!t.showJumpBtns?null:t.holder.append("button").attr("title","Zoom out").style("width","25px").html("+").on("click",(()=>{const e=Math.min(a.step*Math.floor((a.value+a.step)/a.step),a.max);c.update({value:e});t.callback(e)}));o.append("span").style("text-decoration","underline").style("cursor","pointer").style("title","use the default zoom value").text("Reset").on("click",t.reset);const c={update(e={}){const s=t.holder.node().getBoundingClientRect();if(!s.height||!s.width){t.holder.style("max-height","").style("max-width","");const e=t.holder.node().getBoundingClientRect();t.holder.style("max-height",e.height+"px").style("max-width",e.width+"px")}Object.assign(a,e);r.property("value",a.value).attr("min",a.min).attr("max",a.max).attr("step",a.increment);n.property("value",a.value).attr("min",a.min).attr("max",a.max).attr("step",a.increment);l?.property("disabled",a.value<=a.min);p?.property("disabled",a.value>=a.max)}};if(t.debug)c.Inner={settings:a,number:n,slider:r,minusBtn:l,plusBtn:p};return c}function v(t){if(!t.holder)throw`missing svgScroll.opts.holder argument`;const a={height:12,zoomLevel:1,opacity:.3};const s=Object.assign({},a,t);function n(t){g.x=t.clientX;e("body").on("mousemove.sjppSvgScroll",i).on("mouseup.sjppSvgScroll",o)}function i(t){if(!("x"in g))return;const e=t.clientX-g.x;if(g.sliderX+g.sliderWidth+e>s.visibleWidth-1){return}if(g.sliderX+e<0){return}h.attr("x",g.sliderX+e);s.callback(g.dxFactor*e,"move")}function o(t){if(!("x"in g))return;const a=t.clientX-g.x;s.callback(g.dxFactor*Math.min(g.maxDx,Math.max(a,g.minDx)),"up");delete g.x;e("body").on("mousemove.sjppSvgScroll",null).on("mouseup.sjppSvgScroll",null)}function l(t){g.x=t.clientX;const e=t.clientX<u.getBoundingClientRect().x?-1:1;o({clientX:Math.floor(g.x+e*g.arrowDx)})}s.holder.attr("display","none").attr("opacity",s.opacity).on("mouseover",(()=>s.holder.attr("opacity",1))).on("mouseout",(()=>s.holder.attr("opacity",s.opacity)));const r=s.holder.append("rect").style("height",s.height).style("stroke","none").style("fill","#fff").on("click",l);const p=s.holder.append("line").style("stroke","#ccc").style("stroke-width",1).on("click",l);const c=s.holder.append("path").attr("y",-s.height).attr("d",`M0,${s.height/2}L${s.height},0L${s.height},${s.height}Z`).style("stroke","#ccc").style("stroke-width",1).style("fill","#ccc").on("click",(t=>{g.x=t.clientX;o({clientX:Math.round(g.x-g.arrowDx)})}));const d=s.holder.append("path").attr("y",-s.height).style("stroke","#ccc").style("stroke-width",1).style("fill","#ccc").attr("d",`M0,0L${s.height},${s.height/2}L0,${s.height}Z`).on("click",(t=>{g.x=t.clientX;o({clientX:Math.round(g.x+g.arrowDx)})}));const m=s.height-4;const h=s.holder.append("rect").attr("y",2).attr("height",m).attr("stroke","#aaa").attr("stroke-width",1).attr("fill","#ccc").attr("rx",m/2).on("mousedown",n).on("mousemove",i).on("mouseup",o);const u=h.node();const g={};const y={update(t){const e={v:s.visibleWidth,t:s.totalWidth,z:s.zoomCenter};Object.assign(s,t);const a=s.totalWidth;const n=s.visibleWidth;if(a<=n){s.holder.attr("display","none");return}s.holder.attr("transform",`translate(${s.x},${s.y})`).attr("display","");r.attr("width",n);p.attr("x1",0).attr("x2",n).attr("y1",s.height/2).attr("y2",s.height/2);c.attr("transform",`translate(0,0)`);d.attr("transform",`translate(${n-s.height},0)`);if(n!=e.v||a!=e.t){g.sliderWidth=n*n/a;g.dxFactor=(a-n)/(n-g.sliderWidth)}const i=n*(s.zoomCenter/a);g.sliderX=Math.max(0,Math.min(i-g.sliderWidth/2,n-g.sliderWidth-1));h.attr("width",g.sliderWidth).attr("x",g.sliderX);g.maxDx=s.visibleWidth-g.sliderX-g.sliderWidth;g.minDx=-g.sliderX;g.arrowDx=Math.round(.1*s.visibleWidth);delete g.x}};return y}const w=new a({padding:""});class C{constructor(t,e){this.type="matrixControls";this.opts=t;this.parent=t.parent;this.overrides={};this.opts.holder.style("margin","10px 10px 20px 10px").style("white-space","nowrap");const a=this.parent.getState(e);const s=a.config.settings.matrix;if(this.parent.setClusteringBtn)this.parent.setClusteringBtn(this.opts.holder,((t,e)=>this.callback(t,e)));this.setSamplesBtn(s);this.setGenesBtn(s);if(s.addMutationCNVButtons&&this.parent.chartType!=="hierCluster"){this.setMutationBtn();this.setCNVBtn()}this.setVariablesBtn(s);this.setDimensionsBtn(s);this.setLegendBtn(s);this.setDownloadBtn(s);this.setZoomInput();this.setDragToggle({holder:this.opts.holder.append("div").style("display","inline-block"),target:this.parent.dom.seriesesG});this.setSvgScroll(a);this.keyboardNavHandler=async t=>{if(t.target.tagName=="BUTTON")this.keyEventTarget=t.target;if(t.key=="Escape"){this.parent.app.tip.hide()}else if(t.key=="Enter"||t.key=="ArrowDown"){const e=t.target.tagName=="BUTTON"?this.parent.app.tip.d.node().querySelectorAll("input, select"):t.target.querySelectorAll("input, select");for(const t of e){if(t.checkVisibility?.()||!t.checkVisibility&&t.getBoundingClientRect().height){t.focus();return false}}}else if(t.key=="Tab"&&t.shiftKey||t.key=="Backspace"||t.key=="ArrowUp"){this.keyEventTarget.focus();return false}};this.btns=this.opts.holder.selectAll(":scope>button").filter((t=>t&&t.label)).on(`keyup.matrix-${this.parent.id}`,this.keyboardNavHandler)}setSamplesBtn(t){const e=t.controlLabels;const a=this;const s=this.parent;const n=[{label:`Maximum # ${e.Samples}`,title:`Limit the number of displayed ${e.samples}`,type:"number",chartType:"matrix",settingsKey:"maxSample",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:`Sort ${e.Sample} Groups`,title:`Set how to sort ${e.sample} groups`,type:"radio",chartType:"matrix",settingsKey:"sortSampleGrpsBy",options:[{label:"Predefined or Group Name",value:"name",title:`Sort by group name`},{label:`${e.Sample} Count`,value:"sampleCount",title:`Sort by the number of samples in the group`},{label:`Hits`,value:"hits",title:`Sort by the total number of variants for every ${e.sample} in the group`}],getDisplayStyle(t){return t.divideBy&&!t.hierCluster?"table-row":"none"}},{label:`${e.Sample} Group Label Character Limit`,title:`Truncate the ${e.sample} group label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"sampleGrpLabelMaxChars",getDisplayStyle(t){return t.divideBy&&!t.hierCluster?"table-row":"none"}},{label:`${e.Sample} Label Character Limit`,title:`Truncate the ${e.sample} label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"collabelmaxchars"},{label:`Group ${e.Samples} By`,title:`Select a variable with discrete values to group ${e.samples}`,type:"term",chartType:"matrix",configKey:"divideBy",vocabApi:this.opts.app.vocabApi,state:{vocab:this.opts.vocab},processInput:async t=>{if(t?.term&&m(t.term)){t.q={...t.q,mode:"discrete"}}if(t)await h(t,this.opts.app.vocabApi);return t},processConfig:t=>{if(this.parent.chartType=="hierCluster"&&t["divideBy"]){t.settings={hierCluster:{yDendrogramHeight:0,clusterSamples:false}}}if(this.parent.config.divideBy)t.legendValueFilter=this.parent.mayRemoveTvsEntry(this.parent.config.divideBy)},getBodyParams:()=>{const t=this.parent.termOrder.filter((t=>t.tw.term.type==="geneVariant")).map((t=>t.tw.term.chr?`${t.tw.term.chr}:${t.tw.term.start}-${t.tw.term.stop}`:t.tw.term.gene||t.tw.term.name));return{currentGeneNames:t}}}];n.push({label:`Sort ${e.Sample} Priority`,title:`Set how to sort ${e.samples}`,type:"custom",init(t){const e=s.config.settings.matrix;if(!a.activeTab)a.activeTab="basic";t.dom.inputTd.style("padding","5px");const n=t.dom.inputTd.append("div").style("margin-bottom","5px");const i=n.append("div").style("display","inline-block").style("padding-right","5px").style("border-right","2px solid black").style("text-decoration",a.activeTab=="basic"?"underline":"").style("cursor","pointer").html("Basic").on("click",(()=>{a.activeTab="basic";i.style("text-decoration","underline");o.style("text-decoration","");l.style("display","");h.style("display","none")}));const o=n.append("div").style("display","inline-block").style("margin-left","5px").style("text-decoration",a.activeTab=="advanced"?"underline":"").style("cursor","pointer").html("Advanced").on("click",(()=>{a.activeTab="advanced";i.style("text-decoration","");o.style("text-decoration","underline");l.style("display","none");h.style("display","")}));const l=t.dom.inputTd.append("div").style("display",a.activeTab=="basic"?"":"none");const r=l.append("div");r.append("span").html("SSM");const{inputs:p}=y({holder:r.append("span"),options:[{label:"by consequence",value:"consequence",checked:e.sortByMutation==="consequence"},{label:"by presence",value:"presence",checked:e.sortByMutation==="presence"}],styles:{display:"inline-block"},callback:t=>{const e=s.config.settings.matrix.sortOptions;const a=e.a;const n=a.sortPriority[0].tiebreakers[1];n.disabled=!t;n.isOrdered=t==="consequence";s.app.dispatch({type:"plot_edit",id:s.id,config:{settings:{matrix:{sortByMutation:t,sortOptions:e}}}})}});p.style("margin","2px 0 0 2px").style("vertical-align","top");const c=l.append("div").style("display",e.showMatrixCNV!="none"&&!e.allMatrixCNVHidden?"block":"none");c.append("span").html("CNV");const m=b({holder:c.append("span"),divstyle:{display:"inline-block"},checked:e.sortByCNV,labeltext:"sort by CNV",callback:()=>{const t=m.property("checked");const e=s.config.settings.matrix.sortOptions;const a=e.a;const n=a.sortPriority[0].tiebreakers[2];n.disabled=!t;n.isOrdered=t;s.app.dispatch({type:"plot_edit",id:s.id,config:{settings:{matrix:{sortByCNV:t,sortOptions:e}}}})}});const h=t.dom.inputTd.append("div").style("display",a.activeTab=="advanced"?"":"none");t.dom.row.on("mouseover",(function(){this.style.backgroundColor="#fff";this.style.textShadow="none"}));if(!a.sorterUi){a.sorterUi=d({controls:this,holder:h,tip:this.parent.app.tip})}else{a.sorterUi.main(this.parent.config.settings.matrix,{holder:h})}return{main:t=>{const e=t.settings.matrix;p.property("checked",(t=>t.value==e.sortByMutation));m.property("checked",e.sortByCNV);c.style("display",e.showMatrixCNV!="none"&&!e.allMatrixCNVHidden?"block":"none")}}}});this.opts.holder.append("button").datum({label:e.Samples||`Samples`,getCount:()=>"sampleCount"in this.overrides?this.overrides.sampleCount:this.parent.sampleOrder?.length||0,rows:n,customInputs:this.updateSamplesControls}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setGenesBtn(t){const e=t.controlLabels;const a=[{label:` Stacked <span style="font-size:.7em;color:#555;">Show stacked rectangles in the same matrix cell to render variants for the same ${e.sample} and gene</span>`,value:"",title:`Show stacked rectangles in the same matrix cell to render variants for the same ${e.sample} and gene`},{label:` OncoPrint <span style="font-size:.7em;color:#555;">Show overlapping rectangles in the same matrix cell to render variants for the same ${e.sample} and gene</span>`,value:"oncoprint",title:`Show overlapping rectangles in the same matrix cell to render variants for the same ${e.sample} and gene`}];if(t.addMutationCNVButtons&&this.parent.chartType!=="hierCluster")a.unshift({label:` Single <span style="font-size:.7em;color:#555;">Show a single rectangle in a matrix cell to render the most severe variant (truncating > indels > missense > synonymous) for the same ${e.sample} and gene</span>`,value:"single",title:`Show a single rectangle in a matrix cell to render the most severe variant (truncating > indels > missense > synonymous) for the same ${e.sample} and gene`});this.opts.holder.append("button").datum({label:"Genes",getCount:()=>this.parent.termOrder?.filter((t=>t.tw.term.type=="geneVariant"||t.tw.term.type==u.GENE_EXPRESSION)).length||0,customInputs:this.appendGeneInputs,rows:[{label:`Display ${e.Sample} Counts for Gene`,title:`Include the ${e.sample} count in the gene label`,type:"radio",chartType:"matrix",settingsKey:"samplecount4gene",options:[{label:"Absolute",value:"abs"},{label:`Percent`,value:"pct"},{label:`None`,value:""}]},{label:"Genomic Alterations Rendering",title:`Set how to indicate a ${e.sample}'s applicable variant types in the same matrix cell`,type:"radio",chartType:"matrix",settingsKey:"cellEncoding",options:a,styles:{padding:"5px 0px",margin:0},labelDisplay:"block",callback:this.parent.geneStyleControlCallback},{label:"Sort Genes",title:"Set how to order the genes as rows",type:"radio",chartType:"matrix",settingsKey:"sortTermsBy",options:[{label:"By Input Data Order",value:"asListed"},{label:`By ${e.sample} Count`,value:"sampleCount"}],styles:{padding:0,"padding-right":"10px",margin:0}}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setVariablesBtn(t){t.controlLabels;this.opts.holder.append("button").datum({label:t.controlLabels.Terms||`Variables`,rows:[{label:`Row Group Label Max Length`,title:`Truncate the row group label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"termGrpLabelMaxChars"},{label:`Row Label Max Length`,title:`Truncate the row label if it exceeds this maximum number of characters`,type:"number",chartType:"matrix",settingsKey:"rowlabelmaxchars"}],customInputs:this.appendDictInputs}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setDimensionsBtn(t){const e=t.controlLabels;this.opts.holder.append("button").datum({label:"Cell Layout",tables:[{rows:[{label:"Grid",title:"Show grid lines, which creates borders around each matrix cells. "+" Note that grid lines are hidden when the auto-computed width <= 2, or when either the column and row spacing is set to 0.",type:"checkbox",boxLabel:"show",processInput:t=>t===true?"rect":t==="rect",chartType:"matrix",settingsKey:"showGrid",colspan:2,align:"center"},{label:"Outline Color",title:"Set a border color for the whole matrix",type:"color",chartType:"matrix",settingsKey:"outlineStroke",colspan:2,align:"center"},{label:"Beam Color",title:"Set a color for the beam highlighter",type:"color",chartType:"matrix",settingsKey:"beamStroke",colspan:2,align:"center"},{label:"Grid Line Color",title:"Set the grid color, equivalent to applying the same border color for each matrix cell",type:"color",chartType:"matrix",settingsKey:"gridStroke",colspan:2,align:"center"},{label:"Background Color",title:`Set the background color when there are no alterations or annotation data for a ${e.sample}`,type:"color",chartType:"matrix",settingsKey:"cellbg",colspan:2,align:"center"},{label:`Use Canvas If # ${e.sample} Exceeds`,title:`Switch from SVG to canvas rendering when the number of ${e.samples} exceeds this number`,type:"number",chartType:"matrix",settingsKey:"svgCanvasSwitch",colspan:2,align:"center",width:60,min:0,max:1e4,step:1},{label:"Canvas Min. Pixel Width",title:"Set a minimum pixel width for a matrix cell when using canvas, may affect the perceived sharpness of the canvas image",type:"checkbox",boxLabel:"apply",chartType:"matrix",settingsKey:"useMinPixelWidth",colspan:2,align:"center",getDisplayStyle:()=>this.parent.settings.matrix.useCanvas?"":"none"}]},{header:["Cells","Columns","Rows"],rows:[{label:"Row Height",title:"Set the height of a matrix row",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{label:"N/A"},{settingsKey:"rowh",min:8,max:30,step:1}],getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:"Min Col. Width",title:"Set the minimum width of the auto-computed matrix column width",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colwMin",min:.1,max:16,step:.2},{label:"N/A"}]},{label:"Max Col. Width",title:"Set the maximum width of the auto-computed matrix column width",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colwMax",min:1,max:24,step:.2},{label:"N/A"}]},{label:"Spacing",title:"Set the column spacing. Note that this will be set to 0 when the auto-computed width < 2.",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"colspace",min:0,max:20,step:1},{settingsKey:"rowspace",min:0,max:20,step:1}],getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"}},{label:"Group spacing",title:"Set the spacing between column and row groups.",type:"number",width:50,align:"center",chartType:"matrix",inputs:[this.parent.chartType=="hierCluster"?{label:"N/A"}:{settingsKey:"colgspace",min:0,max:20,step:1},{settingsKey:"rowgspace",min:0,max:20,step:1}]}]},{header:["Labels","Columns","Rows"],rows:[{label:"Offset",title:"Set the gap between the label text and matrix edge",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"collabelgap",min:0,max:20,step:1},{settingsKey:"rowlabelgap",min:0,max:20,step:1}]},{label:"Spacing",title:"Set the gap between labels",type:"number",width:50,align:"center",chartType:"matrix",inputs:[{settingsKey:"collabelpad",min:0,max:20,step:1},{settingsKey:"rowlabelpad",min:0,max:20,step:1}]},{label:"Min font size",title:"Set the minimum auto-computed font size for labels. Note that labels will be hidden if the auto-computed values falls below this minimum.",type:"number",width:50,align:"center",colspan:2,chartType:"matrix",settingsKey:"minLabelFontSize",min:0,max:24,step:.1},{label:"Max font size",title:"Set the maximum auto-computed font size for labels",type:"number",width:50,align:"center",colspan:2,chartType:"matrix",settingsKey:"maxLabelFontSize",min:0,max:24,step:.1},{label:"Group label<br/>position",title:"Set which side of the matrix to display group labels",type:"radio",width:50,chartType:"matrix",labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},inputs:[{settingsKey:"collabelpos",options:[{label:"Top",value:"bottom",title:`Display ${e.sample} group labels at the bottom`},{label:"Bottom",value:"top",title:`Display ${e.sample} group labels on top`}]},{settingsKey:"rowlabelpos",options:[{label:"Left",value:"right",title:`Display gene or variable group labels on the left side`},{label:"Right",value:"left",title:`Display gene or variable group labels on the right side`}]}]}]}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setLegendBtn(t){this.opts.holder.append("button").style("margin","2px 0").datum({label:"Legend Layout",rows:[{label:"Font Size",title:"Set the font size for the legend text",type:"number",chartType:"legend",settingsKey:"fontsize"},{label:"Line Height",title:"Set the line height for a legend group",type:"number",chartType:"legend",settingsKey:"lineh"},{label:"Icon Height",title:"Set the icon height for a legend item",type:"number",chartType:"legend",settingsKey:"iconh"},{label:"Icon Width",title:"Set the icon width for a legend item",type:"number",chartType:"legend",settingsKey:"iconw"},{label:"Item Left Pad",title:"Set a left margin for each legend item",type:"number",chartType:"legend",settingsKey:"padx"},{label:"Left Margin",title:"Set a left margin for the whole legend",type:"number",chartType:"legend",settingsKey:"padleft"},{label:"Left Indent",title:`Set a left margin for the first legend item in each group, and should be set to the length of the longest group label.`+` The left indent will align the legend group label text to the right.`,type:"number",chartType:"legend",settingsKey:"hangleft"},{label:"Item Layout",title:"Option to separate each legend item into a new line, instead of a horizontal layout in the same line.",type:"checkbox",chartType:"legend",settingsKey:"linesep",boxLabel:"Line separated"}]}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setMutationBtn(){this.opts.holder.append("button").style("margin","2px 0").datum({label:"Mutation",updateBtn:t=>{const e=this.parent.config.settings.matrix;t.style("text-decoration",e.allMatrixMutationHidden?"line-through":"").style("text-decoration-thickness",e.allMatrixMutationHidden?"2px":"")},rows:[{title:`Show mutation options`,type:"radio",chartType:"matrix",settingsKey:"showMatrixMutation",options:[{label:"Show all mutations",value:"all"},{label:`Show only truncating mutations`,value:"onlyTruncating"},{label:`Show only protein-changing mutations`,value:"onlyPC"},{label:`Do not show mutations`,value:"none"},{label:`Show selected mutation`,value:"bySelection"}],labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},callback:this.parent.mutationControlCallback}],customInputs:this.generateMutationItems}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setCNVBtn(){this.opts.holder.append("button").style("margin","2px 0").datum({label:"CNV",updateBtn:t=>{const e=this.parent.config.settings.matrix;const a=e.allMatrixCNVHidden;t.style("text-decoration",a?"line-through":"").style("text-decoration-thickness",a?"2px":"")},rows:[{title:`Show CNV options`,type:"radio",chartType:"matrix",settingsKey:"showMatrixCNV",options:[{label:"Show all CNV",value:"all"},{label:`Do not show CNV`,value:"none"},{label:`Show selected CNV`,value:"bySelection"}],labelDisplay:"block",getDisplayStyle(t){return t.chartType=="hierCluster"?"none":"table-row"},callback:this.parent.CNVControlCallback}],customInputs:this.generateCNVItems}).html((t=>t.label)).style("margin","2px 0").on("click",((t,e)=>this.callback(t,e)))}setDownloadBtn(t){this.opts.holder.append("button").style("margin","2px 0").text("Download").on("focus",(()=>this.parent.app.tip.hide())).on("click.sjpp-matrix-download",(t=>{const e=this.parent;if(!e.dom.downloadMenu)e.dom.downloadMenu=new a({padding:""});const c=e.dom.downloadMenu.clear();const d=c.d.append("div");d.append("div").attr("class","sja_menuoption sja_sharp_border").text(`SVG image`).on("click.sjpp-matrix-download",(()=>{s(this.opts.getSvg(),"matrix",{apply_dom_styles:true});e.dom.downloadMenu.destroy()}));d.append("div").attr("class","sja_menuoption sja_sharp_border").text(`TSV data`).on("click.sjpp-matrix-download",(()=>{const t=e.data.lst;const a=e.termOrder.map((t=>t.tw));const s=e.state.termdbConfig.assayAvailability;const c=e.settings.matrix.controlLabels;if(e.config.divideBy?.id&&!a.find((t=>t.id==e.config.divideBy.id))){a.push(e.config.divideBy)}const d=[];for(const e of t){for(const t of a){if(t.$id in e){d.push(e);break}}}const m=[c.Sample];for(const t of a)m.push(t.term.name);const h=[m];for(const t of d){const e=[t._ref_.label];for(const c of a){if(!t[c.$id]){e.push("")}else{if(c.term.type=="geneVariant"){const a=[];for(const e of t[c.$id].renderedValues){const t=s?.byDt?.[parseInt(e.dt)];if(e.dt==n){a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+`${o[e.class]?.label}`+(e.mname?`,${e.mname}`:""))}else if(e.dt==l){const s=e.value?`${t?"":"CNV:"}${e.value}`:e.class=="CNV_amp"?"CNV gain":e.class=="CNV_loss"?"CNV loss":o[e.class]?.label;a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+s)}else if(e.dt==r||e.dt==p){a.push((e.origin?`${e.origin} `:"")+(t?`${i[e.dt]}:`:"")+`${o[e.class]?.label}`+(e.gene&&e.mname?`(${e.gene}::${e.mname})`:""))}else{a.push(`DO NOT SUPPORT dt='${e.dt}'`)}}e.push(a.join("|"))}else if(c.term.type==u.GENE_EXPRESSION||c.term.type==u.METABOLITE_INTENSITY){e.push(t[c.$id]?.renderedValues?.[0]?.value||"")}else{e.push(t[c.$id]?.renderedValues?.[0]||t[c.$id]?.value||"")}}}h.push(e)}const g=h.map((t=>t.join("\t"))).join("\n");const y=document.createElement("a");document.body.appendChild(y);y.addEventListener("click",(function(){const t=(new Date).toISOString().split("T")[0];y.download=e.config.settings?.hierCluster?.termGroupName?.startsWith("Gene Expression")?`GeneExpression.${t}.tsv`:e.chartType=="hierCluster"?`HierCluster.${t}.tsv`:`${e.app.vocabApi.termdbConfig.matrix?.appName||"Matrix"}.${t}.tsv`;y.href=URL.createObjectURL(new Blob([g],{type:"text/tab-separated-values"}));document.body.removeChild(y)}),false);y.click();e.dom.downloadMenu.destroy()}));c.showunder(t.target)}))}main(t={}){this.overrides=t;this.parent.app.tip.hide();this.btns.text((t=>(t.getCount?`${t.getCount()} `:"")+t.label)).each((function(t){if(t.updateBtn)t.updateBtn(e(this))}));const a=this.parent.config.settings.matrix;const s=this.parent.dimensions;if(this.zoomApi)this.zoomApi.update({value:a.zoomLevel.toFixed(1),min:a.colwMin/a.colw,max:a.colwMax/a.colw,increment:a.zoomIncrement,step:a.zoomStep||1});if(this.svgScrollApi&&s){this.svgScrollApi.update({x:s.xOffset,y:s.yOffset-a.scrollHeight,totalWidth:s.zoomedMainW,visibleWidth:s.mainw,zoomCenter:a.zoomCenterPct*s.mainw-s.seriesXoffset})}if(this.dragToggleApi){this.dragToggleApi.update(a.mouseMode?{mouseMode:a.mouseMode}:{})}}getSettings(){return{mouseMode:this.dragToggleApi.getSettings().mouseMode}}async callback(e,a){const s=this.opts.app;const n=this.opts.parent;const i=a.tables||[a];e.target.focus();s.tip.clear();const o=s.tip.d.append("table").attr("class","sjpp-controls-table");for(const e of i){if(e.header){o.append("tr").selectAll("th").data(e.header).enter().append("th").html((t=>t))}for(const a of e.rows){const e=o.append("tr");const i=await t[a.type](Object.assign({},{holder:e,dispatch:s.dispatch,id:n.id,debug:this.opts.debug,parent:n},a));i.main(n.config)}if(e.customInputs)e.customInputs(this,s,n,o);o.selectAll("select, input, button").attr("tabindex",0).on("keydown",self.keyboardNavHandler)}s.tip.showunder(e.target)}prependInfo(t,e,a){const s=t.append("tr");s.append("td").text(e).attr("class","sja-termdb-config-row-label");s.append("td").text(a)}async appendGeneInputs(e,a,s,n){w.clear();if(!s.selectedGroup)s.selectedGroup=0;if(s.opts.customInputs?.genes){for(const a of s.opts.customInputs.genes){a.chartType="matrix";const i=n.append("tr");if(a.title)i.attr("aria-label",a.title);const o=await t[a.type](Object.assign({},{holder:i,id:s.id,debug:e.opts.debug,parent:s},a));o.main(s.config)}}e.addGenesetInput(event,a,s,n.append("tr"))}addGenesetInput(t,e,a,s){const n=this.btns.filter((t=>t.label=="Genes"))?.node();const i=e.tip;const o=a.config.termgroups;let l;const r=t=>{t.selectAll("*").remove();const a=l.lst.map((t=>({gene:t.name})));new f({holder:t,genome:e.opts.genome,geneList:a,customInputs:this.parent.opts.customInputs?.geneset,mode:l.mode,minNumGenes:l.mode=="geneExpression"?3:1,vocabApi:this.opts.app.vocabApi,callback:async({geneList:t,groupName:a})=>{if(!l)throw`missing selectedGroup`;i.hide();const s=l.status=="new"?{name:a,lst:[]}:o[l.index];if(l.status=="new")o.push(s);const n=l.mode=="geneExpression"?"geneExpression":"geneVariant";const r=s.lst.filter((t=>t.term.type!=n));const p=await Promise.all(t.map((async t=>{const e={gene:t.symbol||t.gene,name:t.symbol||t.gene,type:n};let a=s.lst.find((e=>e.term.name==t.symbol||e.term.name==t.gene));if(!a){a={term:e,q:{}};a.$id=await g(this.opts.app.vocabApi.getTwMinCopy(a))}else if(!a.$id){a.$id=await g(this.opts.app.vocabApi.getTwMinCopy({term:e}))}return a})));s.lst=[...r,...p];if(!s.lst.length)o.splice(l.index,1);e.dispatch({type:"plot_edit",id:this.parent.id,config:{termgroups:o}})},backBtn:{target:"Genes Menu",callback:()=>{n.click()}}})};const p=o.filter((t=>t.type!="hierCluster"||t.lst.find((t=>t.term.type=="geneExpression")))).length;s.append("td").attr("class","sja-termdb-config-row-label").html("Gene Set");if(p>0){const t=s.append("td").style("display","block").style("padding","5px 0px");const e=t.append("div").append("label");e.append("button").html(p>1?"Edit Selected Group":"Edit Current Group").on("click",(()=>{i.clear();this.setMenuBackBtn(i.d.append("div").style("padding","5px"),(()=>n.click()));const t=i.d.append("div");r(t)}));if(p>1){const{groups:t,groupSelect:a}=this.setTermGroupSelector(e,o);l=t.find((t=>t.selected));a.on("change",(()=>{l=t[a.property("value")]}))}else{const t=a.config.settings.hierCluster;const e=o.find((t=>t.type!="hierCluster"||t.lst.find((t=>t.term.type=="geneExpression"))));l={index:0,name:e.name,type:e.type,lst:e.lst.filter((t=>t.term.type.startsWith("gene"))).map((t=>({name:t.term.name}))),mode:this.parent.chartType=="hierCluster"&&(e.type=="hierCluster"||e.name==t?.termGroupName)?t.dataType:this.parent.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:"",selected:true}}}const c=s.append("td").style("display","block").style("padding","5px 0px");const d=c.append("div").append("label");const m=d.append("button").html("Create New Group").property("disabled",true).on("click",(()=>{i.clear();this.setMenuBackBtn(i.d.append("div"),(()=>n.click()));const t=h.property("value");a.config.settings.hierCluster;l={index:o.length,name:t,label:t,lst:[],status:"new",mode:a.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:""};r(i.d.append("div"))}));const h=d.append("input").style("margin","2px 5px").style("width","210px").attr("placeholder","Group Name").on("input",(()=>{m.property("disabled",!h.property("value"))})).on("keyup",(t=>{if(t.key=="Enter"&&!m.property("disabled")){m.node().click()}}))}setMenuBackBtn(t,e){t.attr("tabindex",0).style("padding","5px").style("text-decoration","underline").style("cursor","pointer").style("margin-bottom","12px").html(`« Back to Genes`).on("click",e).on("keyup",(t=>{if(t.key=="Enter")t.target.click()}))}setTermGroupSelector(t,e){const a=e.find((t=>t.lst.find((t=>t.term.type.startsWith("gene")))));const s=this.parent.config.settings.hierCluster;const n=e.map(((t,e)=>({index:e,name:t.name,type:t.type,lst:t.lst.filter((t=>t.term.type.startsWith("gene"))).map((t=>({name:t.term.name}))),mode:this.parent.chartType=="hierCluster"&&(t.type=="hierCluster"||t.name==s?.termGroupName)?s.dataType:this.parent.state.termdbConfig.queries?.snvindel?u.GENE_VARIANT:"",selected:this.parent.chartType=="hierCluster"&&(t.type=="hierCluster"||t.name&&t.name==s?.termGroupName)||t===a})));const i=t.append("select").style("width","218px").style("margin","2px 5px");for(const[t,e]of n.entries()){if(e.label)continue;if(e.name)e.label=e.name;else e.label=`Unlabeled group #${t+1}`}i.selectAll("option").data(n).enter().append("option").property("selected",(t=>t.selected)).attr("value",((t,e)=>e)).html((t=>t.label));return{groups:n,groupSelect:i}}appendDictInputs(t,e,a,s){w.clear();if(!a.selectedGroup)a.selectedGroup=t.chartType=="hierCluster"?1:0;e.tip.d.append("hr");t.addDictMenu(e,a,e.tip.d.append("div"))}generateCNVItems(t,e,a,s){s.attr("class",null);const i=a.config.settings.matrix;const o=a.legendData.find((t=>t.dt?.includes(n)));if(i.showMatrixCNV!=="none"&&(i.allMatrixMutationHidden||!o||o.crossedOut||!o.items.find((t=>!t.greyedOut&&!t.crossedOut)))){s.select("input[type='radio'][value='none']").property("disabled",true);s.select("input[type='radio'][value='none'] + span").style("opacity","0.5").on("mouseup",null)}if(i.addMutationCNVButtons&&a.chartType!=="hierCluster"&&i.showMatrixCNV=="bySelection")a.CNVControlCallback("bySelection")}generateMutationItems(t,e,a,s){s.attr("class",null);const n=a.config.settings.matrix;const i=a.legendData.find((t=>t.dt?.includes(l)));if(n.showMatrixMutation!=="none"&&(n.allMatrixCNVHidden||!i||i.crossedOut||!i.items.find((t=>!t.greyedOut&&!t.crossedOut)))){s.select("input[type='radio'][value='none']").property("disabled",true);s.select("input[type='radio'][value='none'] + span").style("opacity","0.5").on("mouseup",null)}if(n.addMutationCNVButtons&&a.chartType!=="hierCluster"&&n.showMatrixMutation=="bySelection")a.mutationControlCallback("bySelection")}updateSamplesControls(t,e,a,s){if(a.chartType=="hierCluster"&&a.config.settings.hierCluster.clusterSamples){const t=a.config.settings.matrix.controlLabels;const e=s.select(`tr[title='Set how to sort ${t.samples}']`);e.style("display","none")}}async addDictMenu(t,e,a,s=undefined){const n=await import("./app-d215327f.js");n.appInit({holder:s||t.tip.d,vocabApi:this.parent.app.vocabApi,focus:"off",state:{vocab:this.parent.state.vocab,activeCohort:this.parent.activeCohort,nav:{header_mode:"search_only"},tree:{usecase:{target:"matrix",detail:"termgroups"}}},tree:{submit_lst:e=>{this.submit_lst(e);t.tip.hide()}},search:{focus:"off"}})}async submit_lst(t){const e=await Promise.all(t.map((async t=>{const e=structuredClone(t);const a="id"in e?{id:e.id,term:e}:{term:e};await h(a,this.opts.app.vocabApi);return a})));this.parent.settings.matrix;const a=structuredClone(this.parent.config.termgroups);const s=a.findIndex((t=>t.name=="Variables"));if(s!==-1){const t=a[s];t.lst.push(...e);this.parent.app.dispatch({type:"plot_nestedEdits",id:this.parent.id,edits:[{nestedKeys:["termgroups",s,"lst"],value:t.lst}]})}else{const t={name:"Variables",lst:e};a.push(t);this.parent.app.dispatch({type:"plot_edit",id:this.parent.id,config:{termgroups:a}})}}setZoomInput(){const t=this.opts.holder.append("div").style("display","inline-block").style("margin-left","50px");const e=this.parent.config.settings.matrix;this.zoomApi=x({holder:t,title:"Zoom factor relative to the ideal column width, as computed for the number of columns versus available screen width",unit:"",width:"80px",settings:{value:1,min:.1,max:10,increment:e.zoomIncrement,step:e.zoomStep||5},callback:t=>{const e=this.parent;e.dimensions;e.settings.matrix;const a=e.getVisibleCenterCell(0);e.app.dispatch({type:"plot_edit",id:e.id,config:{settings:{matrix:{zoomLevel:t,zoomCenterPct:.5,zoomIndex:a.totalIndex,zoomGrpIndex:a.grpIndex}}}})},reset:()=>{this.parent.settings.matrix;this.parent.dimensions;this.parent.app.dispatch({type:"plot_edit",id:this.parent.id,config:{settings:{matrix:{zoomLevel:1,zoomCenterPct:0}}}})}})}setDragToggle(t={}){const e={mouseMode:"select",activeBgColor:"rgb(255, 255, 255)"};t.target.style("cursor","default");const a={opts:Object.assign({},e,t),dom:{selectBtn:t.holder.append("button").attr("aria-label","Click the matrix to select data").style("display","inline-block").style("width","25px").style("height","24.5px").style("background-color",e.activeBgColor).on("click",(()=>n("select"))),grabBtn:t.holder.append("button").attr("aria-label","Click the matrix to drag and move").style("display","inline-block").style("width","25px").style("height","24.5px").on("click",(()=>n("pan")))}};c.arrowPointer(a.dom.selectBtn,{width:14,height:14,transform:"translate(50,50)"});c.grab(a.dom.grabBtn,{width:14,height:14,transform:"translate(30,50)"});const s=this;function n(e){a.opts.mouseMode=e;s.parent.settings.matrix.mouseMode=e;t.target.style("cursor",e=="select"?"default":"grab");a.dom.selectBtn.style("background-color",e=="select"?a.opts.activeBgColor:"");a.dom.grabBtn.style("background-color",e=="pan"?a.opts.activeBgColor:"")}this.dragToggleApi={update(t={}){Object.assign(a.opts,t);n(a.opts.mouseMode)},getSettings(){return{mouseMode:a.opts.mouseMode}}}}setSvgScroll(t){this.svgScrollApi=v({holder:this.parent.dom.scroll,height:t.config.settings.matrix.scrollHeight,callback:(t,e)=>{const a=this.parent;const s=a.settings.matrix;const n=a.dimensions;if(e=="move"){a.dom.seriesesG.attr("transform",`translate(${n.xOffset+n.seriesXoffset-t},${n.yOffset})`);a.clusterRenderer.translateElems(-t,s,n);a.layout.top.attr.adjustBoxTransform(-t);a.layout.btm.attr.adjustBoxTransform(-t);if(a.dom.topDendrogram){a.dom.topDendrogram.attr("transform",`translate(${a.topDendroX-t},0)`)}}else if(e=="up"){const e=a.getVisibleCenterCell(-t);a.app.dispatch({type:"plot_edit",id:a.id,config:{settings:{matrix:{zoomCenterPct:.5,zoomIndex:e.totalIndex,zoomGrpIndex:e.grpIndex}}}})}}})}}export{C as MatrixControls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as t}from"./FilterRxComp-
|
|
1
|
+
import{h as t}from"./FilterRxComp-02e68f1b.js";function e(t=""){const e=t||this.state.tokenVerificationMessage;if(!e&&this.state.hasVerifiedToken){this.dom.errdiv.style("display","none").html();this.dom.controls.style("display",this.opts.controls?"inline-block":"");this.dom.svg.style("display","");return false}else{this.dom.errdiv.style("display","").html(e||"Requires login");this.dom.controls.style("display","none");this.dom.svg.style("display","none");return true}}function s(t){const e=[];const s=this.chartType=="hierCluster"?t.config.termgroups.filter((t=>t.type!="hierCluster")):t.config.termgroups;for(const t of s){e.push(...i(t.lst))}if(t.config.divideBy)e.push(r(structuredClone(t.config.divideBy)));const o={terms:e,filter:t.filter,filter0:t.filter0,maxGenes:t.config.settings.matrix.maxGenes};if(this.chartType=="hierCluster"){o.isHierCluster=1}return o}function i(t){const e=structuredClone(t);e.forEach(r);e.sort(o);return e}function r(t){if(!t?.term)return;delete t.term.category2samplecount;delete t.term.values;return t}function o(t,e){const s=t?.$id||t.term?.id||t?.term?.name;const i=e?.$id||e.term?.id||e?.term?.name;return s<i?-1:1}async function l(t){const e=this.currRequestOpts?.matrix||this.getMatrixRequestOpts(this.state);this.numTerms=e.terms.length;const s=new AbortController;e.signal=s.signal;e.loadingDiv=this.chartType!="hierCluster"&&this.dom.loadingDiv;const[i,r]=await this.api.detectStale((()=>this.app.vocabApi.getAnnotatedSampleData(e,t)),{abortCtrl:s});if(r)throw`stale sequenceId`;this.data=i;this.origData=structuredClone(this.data);this.sampleIdMap={};for(const t of this.data.lst){this.sampleIdMap[t.sample]=t._ref_.label}}function n(){const e=this;if(!e.config.legendValueFilter.lst.length&&!e.config.legendGrpFilter.lst.length)return;for(const t of e.config.legendGrpFilter.lst){if(t.dt){const s=new Set;for(const i of e.origData.lst){for(const e of Object.values(i)){if(e.values){const i=[];for(const r of e.values){if(!(t.dt.includes(r.dt)&&(!t.origin||r.origin==t.origin))){i.push(r)}else{s.add(r.class)}}e.values=i}}}t.filteredOutCats=[...s];for(const s of Object.values(e.origData.samples)){for(const e of Object.values(s)){if(e.values)e.values=e.values.filter((e=>!(t.dt.includes(e.dt)&&(!t.origin||e.origin==t.origin))))}}}}const s=Object.values(e.data.refs.byTermId).filter((t=>t.term?.type=="geneVariant")).map((t=>t.$id));const i={samples:{},lst:[],refs:e.data.refs};const r=structuredClone(e.config.legendValueFilter);r.lst=r.lst.filter((t=>!t.tvs.legendFilterType||t.tvs.legendFilterType!=="geneVariant_soft"));for(const o of e.origData.lst){const l=t(o,r,s);if(l||e.chartType=="hierCluster"){i.samples[o.sample]=o;i.lst.push(o)}}for(const t of e.config.legendValueFilter.lst){if(t.tvs.legendFilterType!=="geneVariant_soft")continue;const e=t.tvs.values[0];const s=new Set;for(const t of i.lst){for(const i of Object.values(t)){if(i.values){const t=[];for(const r of i.values){if(!(r.dt==e.dt&&(!e.origin||r.origin==e.origin)&&e.mclasslst.includes(r.class))){t.push(r)}else{s.add(r.class)}}i.values=t}}}t.filteredOutCats=[...s];for(const t of Object.values(i.samples)){for(const s of Object.values(t)){if(s.values)s.values=s.values.filter((t=>!(t.dt==e.dt&&(!e.origin||t.origin==e.origin)&&e.mclasslst.includes(t.class))))}}}if(e.chartType!=="hierCluster"&&s.length&&e.app.vocabApi.vocab?.dslabel=="GDC")a(i);e.data=i}function a(t){for(const e of t.lst){let s=true;for(const[i,r]of Object.entries(e)){if(!r.values)continue;const e=t.refs.byTermId[i].term.type;if(e!="geneVariant")continue;if(r.values.length)s=false}if(s){t.lst=t.lst.filter((t=>t.sample!==e.sample));delete t.samples[parseInt(e.sample)]}}return t}var c=Object.freeze({__proto__:null,mayRequireToken:e,getMatrixRequestOpts:s,setData:l,applyLegendValueFilter:n});export{c as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as e,d as s}from"./app-
|
|
1
|
+
import{M as e,d as s}from"./app-6fb77603.js";function t(t){const o=t.controls?t.holder:t.holder.append("div");o.style("position","relative");const i=this.opts.controls||o.append("div");const p=o.append("div").style("position","relative").style("top",this.opts.controls?0:"50px").style("left","50px");const a=o.append("div").attr("class","sja_errorbar").style("display","none");const n=o.append("svg").style("margin","20px 10px").style("overflow","visible").on("mousemove.label",this.svgMousemove).on("mouseup.label",this.svgMouseup);this.seriesClipId=`sjpp_clip_${this.id}`;const l=n.append("g").attr("class","sjpp-matrix-maing").on("mouseover",this.showCellInfo).on("mousemove",this.showCellInfo).on("mouseout",this.mouseout);const r=l.append("g").attr("clip-path",`url(#${this.seriesClipId})`);const d=l.append("g");const m=l.append("g");const u=new e({padding:"5px"});this.dom={header:t.header,holder:o,contentNode:t.holder.node().closest(".sjpp-output-sandbox-content")||t.holder.node().parentNode,errdiv:a,controls:i,loadingDiv:p,svg:n,clipRect:n.append("defs").append("clipPath").attr("id",this.seriesClipId).attr("clipPathUnits","userSpaceOnUse").append("rect").attr("display","block"),mainG:l,cluster:r.append("g").attr("class","sjpp-matrix-cluster-g").on("mousedown",this.seriesesGMousedown).on("mousemove",this.seriesesGMousemove),seriesesG:r.append("g").attr("class","sjpp-matrix-serieses-g").attr("data-testid","sjpp_matrix_mainG_serieses").on("mousedown",this.seriesesGMousedown),highlightBeamG:r.append("g").attr("class","sjpp-matrix-highlight-beam"),sampleLabelsPG:d,sampleGrpLabelG:d.append("g").attr("class","sjpp-matrix-series-group-label-g").on("click",this.showSampleGroupMenu).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),sampleLabelG:d.append("g").attr("class","sjpp-matrix-series-label-g").on("click",(e=>this.mouseclick(e))),termLabelsPG:m,termGrpLabelG:m.append("g").attr("class","sjpp-matrix-term-group-label-g").on("mouseover",this.termGrpLabelMouseover).on("mouseout",this.termGrpLabelMouseout).on("mousedown",this.termGrpLabelMousedown).on("mousemove",this.termGrpLabelMousemove).on("mouseup",this.termGrpLabelMouseup).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),termLabelG:m.append("g").attr("class","sjpp-matrix-term-label-g").on("mouseover",this.termLabelMouseover).on("mouseout",this.termLabelMouseout).on("mousedown",this.termLabelMousedown).on("mousemove",this.termLabelMousemove).on("mouseup",this.termLabelMouseup).on("mousedown.sjppMatrixLabelText",this.enableTextHighlight).on("mouseup.sjppMatrixLabelText",this.disableTextHighlight),scroll:l.append("g"),legendG:l.append("g").attr("class","sjpp-matrix-legend-g").on("mouseover",this.legendLabelMouseover).on("mouseout",this.legendLabelMouseout).on("mouseup",this.legendLabelMouseup),tip:u,menutop:u.d.append("div"),menubody:u.d.append("div"),clickMenu:new e({padding:"0px"}),brushMenu:new e({padding:"0px"}),dendroClickMenu:new e({padding:"0px"}),legendMenu:new e({padding:"0px"}),matrixCellHoverOver:new e({padding:"0px"})};this.dom.colBeam=this.dom.highlightBeamG.append("rect").style("display","none").style("stroke-width","0.5px").style("fill","transparent").style("pointer-events","none");this.dom.rowBeam=this.dom.highlightBeamG.append("rect").style("display","none").style("stroke-width","0.5px").style("fill","transparent").style("pointer-events","none");this.dom.tip.onHide=()=>{this.lastActiveLabel=this.activeLabel;delete this.activeLabel};s("body").on(`mousedown.matrixZoom-${this.id}`,this.resetInteractions);window.onscroll=this.delayedMouseoutHandler;const h=this.dom.holder.node().closest(".sjpp-output-sandbox-content");if(h)h.onscroll=this.delayedMouseoutHandler}export{t as setMatrixDom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as e}from"./filter-b3d3964e.js";import{getTermSorter as t,getMclassSorter as s,getSampleSorter as n,getSampleGroupSorter as i}from"./matrix.sort-
|
|
1
|
+
import{s as e}from"./filter-b3d3964e.js";import{getTermSorter as t,getMclassSorter as s,getSampleSorter as n,getSampleGroupSorter as i}from"./matrix.sort-1ac05842.js";import{ap as l,ak as r,at as o,R as a}from"./app-6fb77603.js";function u(e){const n=this.settings.matrix;this.termSorter=t(this,n);const i=[];let l=0,r=0,o=0;this.mclassSorter=s(this);for(const[s,a]of this.termGroups.entries()){const u=[];for(const[t,s]of a.lst.entries()){const i={samples:0,hits:0};const l=new Set;for(const t of e.lst){if(l.has(t.sample))continue;l.add(t.sample);const e=t[s.$id];if(e){const{filteredValues:l,countedValues:r,renderedValues:o}=this.classifyValues(e,s,a,n,t);e.filteredValues=l;e.countedValues=r;e.renderedValues=o;if(e.countedValues?.length){const t=s.term.values?.[e.value];if(t?.uncountable)continue;i.samples+=1;i.hits+=e.countedValues.length;if(s.q?.mode=="continuous"){const t=e.value;if(!("minval"in i)||i.minval>t)i.minval=t;if(!("maxval"in i)||i.maxval<t)i.maxval=t}}}}if(a.type!="hierCluster"||i.samples)u.push({tw:s,counts:i,index:t});if(a.type=="hierCluster")o++}const c=a.sortTermsBy||a.type=="hierCluster"?t(this,n,a):this.termSorter;const d=u.filter((e=>{if("minNumSamples"in e.tw)return e.tw.minNumSamples<=e.counts.samples;if(!a.settings)return true;return!("minNumSamples"in a.settings)||e.counts.samples>=a.settings.minNumSamples})).sort(c);if(!d.length)continue;for(const[t,n]of d.entries()){const{tw:o,counts:u}=n;const c=e.refs.byTermId[n.tw.$id]||{};i.push({grp:a,grpIndex:s,visibleGrpIndex:r,tw:o,index:t,lstIndex:n.index,processedLst:d,prevGrpTotalIndex:l,totalIndex:l+t,ref:c,allCounts:u})}l+=d.length;r+=1}this.numTerms=i.length;this.numClusterTerms=o;return i}function c(e){const t=this.settings.matrix;const s={id:this.config.divideBy?.$id,name:this.config.divideBy?"Not annotated":"",lst:[]};const l=new Map;const r=this.config.divideBy?.term||{};const o=this.config.divideBy?.$id||"-";const a=this.config.divideBy?.exclude||[];const u=r.values||{};const c=e.refs.byTermId[o]||{};for(const n of e.lst){if(o in n){const e=n[o].key;const s=e in u&&u[e].label?u[e].label:e;if(!l.has(e)){const n={name:`${s}`,id:e,lst:[],tw:this.config.divideBy,legendGroups:{},isExcluded:a.includes(e)};if(c.bins&&t.sortSampleGrpsBy=="name")n.order=c.bins.findIndex((t=>t.name==e));else delete n.order;l.set(e,n)}l.get(e).lst.push(n)}else{s.lst.push(n)}}const d=[...l.values()];const p=l.size;if(p>100&&d.filter((e=>e.lst.length<3)).length>.8*p){const e=t.controlLabels;throw`Did not group ${e.samples} by "${r.name}": too many ${e.sample} groups (${p}), with the majority of groups having <= 2 ${e.samples} per group.`}if(s.lst.length&&!l.size){l.set(undefined,s);d.push(...l.values())}this.asListedSampleOrder=[];for(const e of d){this.asListedSampleOrder.push(...e.lst.map((e=>e.sample)))}const f=this.termOrder.filter((e=>e.tw.sortSamples&&e.tw.term.type!="geneVariant"));const m=n(this,t,e.lst,{skipSorter:(e,t)=>!e.types?.includes("geneVariant")&&f.find((e=>e.tw.$id===t.$id))});const h=e.lst.sort(m);const g=h.slice(0,t.maxSample);const v=e=>g.includes(e);const y=(e,t)=>e+(typeof t=="object"&&t.countedValues?.length?1:0);const x=(e,t)=>e+(Object.values(t).reduce(y,0)?1:0);const S=n(this,t,e.lst);for(const e of d){e.lst=e.lst.filter(v);e.totalCountedValues=e.lst.reduce(x,0);e.lst.sort(S)}const V=i(this);return d.sort(V)}function d(e){this.settings.matrix;this.visibleSampleGrps=new Set;const t=[];let s=0,n=0;for(const[e,i]of this.sampleGroups.entries()){if(!i.lst.length)continue;if(i.isExcluded)n++;let l=i.lst;for(const[r,o]of l.entries()){t.push({grp:i,grpIndex:e-n,row:o,index:r,prevGrpTotalIndex:s,totalIndex:s+r,totalHtAdjustments:0,grpTotals:{htAdjustment:0},processedLst:l})}if(!i.isExcluded)s+=l.length;this.visibleSampleGrps.add(i)}this.unfilteredSampleOrder=t;return t.filter((e=>!e.grp.isExcluded))}function p(t,s,n,i,u){const c="value"in t?[t.value]:t.values;if(!c)return{filteredValues:null,countedValues:null,renderedValues:null};const d=[s.valueFilter||n.valueFilter].filter((e=>e&&true));if(d.length&&d[0].type!=="tvs"&&d[0].type!=="tvslst")throw`unknown matrix value filter type='${d.type}'`;let p=!d.length?c:c.filter((t=>e(t,d[0],s.term,u)));const f=[];if(s.term.type=="geneVariant"&&s.q?.type=="values"){p.sort(this.mclassSorter);if(i.cellEncoding=="")f.push(...p);else{const e=[];for(const t of[l,r,o,a]){const s=t==a?p.find((e=>e.dt===t)):p.find((e=>e.dt===t&&e.class!=="WT"&&e.class!=="Blank"));if(s)f.push(s);const n=p.filter((e=>e.dt===t));e.push(...n)}p=e}}else{f.push(...p)}return{filteredValues:p,countedValues:p.filter((e=>{if(s.term.type=="geneVariant"){if(s.q?.type=="predefined-groupset"||s.q?.type=="custom-groupset"){const t=s.q.type=="predefined-groupset"?s.term.groupsetting.lst[s.q.predefined_groupset_idx]:s.q.customset;if(!t)throw"groupset not found";const n=t.groups[0];if(e!=n.name)return false}else{if(e.class=="WT"||e.class=="Blank"||i.geneVariantCountSamplesSkipMclass.includes(e.class))return false}}return true})),renderedValues:f}}function f(e,t){return e.class===t.class?0:e.class==="Blank"?1:t.class=="Blank"?-1:e.class<t.class?-1:1}var m=Object.freeze({__proto__:null,getTermOrder:u,getSampleGroups:c,getSampleOrder:d,classifyValues:p,stackSiblingCellsByClass:f});export{m};
|