annotate static/js/main.303f671d.chunk.js.map @ 3:7cc457aa78b1 draft default tip

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/vitessce commit af71ccb3b89c9735c6f985a3e8ffe22cd14c0e04
author goeckslab
date Thu, 30 May 2024 17:24:44 +0000
parents 9f60ef2d586e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9f60ef2d586e planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/vitessce commit 9b2dc921e692af8045773013d9f87d4d790e2ea1
goeckslab
parents:
diff changeset
1 {"version":3,"sources":["utils.js","app/constants.js","api/VitessceConfig.js","demo/utils.js","demo/view-configs/codeluppi.js","demo/view-configs/eng.js","demo/view-configs/wang.js","demo/view-configs/spraggins.js","demo/view-configs/satija.js","demo/view-configs/blin.js","demo/view-configs/ome-ngff-legacy.js","demo/view-configs/hubmap.js","demo/view-configs/coordination-types/embeddingZoom.js","demo/view-configs/coordination-types/embeddingTargetX.js","demo/view-configs/coordination-types/embeddingTargetY.js","demo/view-configs/coordination-types/embeddingCellSetPolygonsVisible.js","demo/configs.js","demo/view-configs/rao.js","demo/view-configs/tenx.js","components/classNames.js","app/Warning.js","components/shared-mui/styles.js","app/state/hooks.js","app/vitessce-grid-layout/layout-utils.js","app/vitessce-grid-layout/VitessceGridLayout.js","loaders/AbstractTwoStepLoader.js","loaders/AbstractLoader.js","loaders/errors/AbstractLoaderError.js","loaders/errors/LoaderValidationError.js","loaders/errors/LoaderNotFoundError.js","loaders/LoaderResult.js","loaders/JsonLoader.js","loaders/MatrixZarrLoader.js","loaders/GenesJsonAsMatrixZarrLoader.js","loaders/ClustersJsonAsMatrixZarrLoader.js","components/sets/constants.js","components/utils.js","components/spatial/constants.js","layers/constants.js","layers/BitmaskLayer.js","layers/bitmask-layer-shaders.js","components/layer-controller/utils.js","components/spatial/utils.js","loaders/RasterJsonLoader.js","loaders/OmeZarrLoader.js","components/sets/utils.js","components/sets/cell-set-utils.js","components/sets/io.js","loaders/CellSetsJsonLoader.js","loaders/anndata-loaders/CellSetsZarrLoader.js","loaders/anndata-loaders/MatrixZarrLoader.js","loaders/anndata-loaders/index.js","loaders/anndata-loaders/CellsZarrLoader.js","loaders/GenomicProfilesZarrLoader.js","loaders/data-sources/ZarrDataSource.js","loaders/data-sources/AnnDataSource.js","loaders/errors/DataSourceFetchError.js","loaders/data-sources/JsonSource.js","loaders/types.js","app/vitessce-grid-utils.js","components/hooks.js","app/VitessceGrid.js","app/state/coordination.js","app/view-config-upgraders.js","app/view-config-versions.js","app/CallbackPublisher.js","components/data-hooks.js","components/LoadingIndicator.js","components/shared-mui/components.js","components/TitleInfo.js","components/description/Description.js","components/description/DescriptionSubscriber.js","components/status/Status.js","components/selectable-table/SelectableTable.js","components/genes/Genes.js","components/genes/GenesSubscriber.js","components/sets/Tree.js","components/sets/HelpTooltip.js","components/sets/Popover.js","components/sets/PopoverMenu.js","assets/menu.svg","components/sets/TreeNode.js","assets/sets/union.svg","assets/sets/intersection.svg","assets/sets/complement.svg","components/sets/SetsManagerButtons.js","components/sets/SetsManager.js","components/sets/CellSetsManagerSubscriber.js","components/interpolate-colors.js","layers/SelectionLayer.js","layers/selection-utils.js","layers/heatmap-constants.js","layers/heatmap-bitmap-layer-shaders.js","layers/HeatmapBitmapLayer.js","layers/PixelatedBitmapLayer.js","layers/HeatmapCompositeTextLayer.js","components/shared-spatial-scatterplot/quadtree.js","assets/tools/near_me.svg","assets/tools/selection_rectangle.svg","assets/tools/selection_lasso.svg","components/shared-spatial-scatterplot/ToolMenu.js","components/shared-spatial-scatterplot/cursor.js","components/shared-spatial-scatterplot/AbstractSpatialOrScatterplot.js","components/shared-spatial-scatterplot/force-collide-rects.js","layer-extensions/ScaledExpressionExtension/shader-module.js","layer-extensions/ScaledExpressionExtension/ScaledExpressionExtension.js","layer-extensions/ScaledExpressionExtension/index.js","layer-extensions/SelectionExtension/shader-module.js","layer-extensions/SelectionExtension/SelectionExtension.js","layer-extensions/SelectionExtension/index.js","components/scatterplot/Scatterplot.js","components/tooltip/styles.js","components/tooltip/Tooltip.js","components/tooltip/Tooltip2D.js","components/tooltip/TooltipContent.js","components/scatterplot/ScatterplotTooltipSubscriber.js","components/shared-plot-options/styles.js","components/shared-plot-options/OptionsContainer.js","components/shared-plot-options/OptionSelect.js","components/shared-plot-options/CellColorEncodingOption.js","components/scatterplot/ScatterplotOptions.js","components/scatterplot/ScatterplotSubscriber.js","components/spatial/Spatial.js","components/spatial/SpatialOptions.js","components/spatial/SpatialTooltipSubscriber.js","components/spatial/SpatialSubscriber.js","components/heatmap/utils.js","Pool.js","components/heatmap/HeatmapWorkerPool.js","components/heatmap/Heatmap.js","components/heatmap/HeatmapTooltipSubscriber.js","components/heatmap/HeatmapOptions.js","components/heatmap/HeatmapSubscriber.js","components/layer-controller/ColorPalette.js","components/layer-controller/ChannelOptions.js","components/layer-controller/constants.js","components/layer-controller/styles.js","components/layer-controller/shared-channel-controls.js","components/layer-controller/RasterChannelController.js","components/layer-controller/BitmaskChannelController.js","components/layer-controller/VectorLayerController.js","components/layer-controller/LayerOptions.js","components/layer-controller/VolumeOptions.js","components/layer-controller/LayerController.js","components/layer-controller/ImageAddButton.js","components/layer-controller/LayerControllerSubscriber.js","components/higlass/HiGlassLazy.js","components/higlass/HiGlassSubscriber.js","components/vega/VegaPlot.js","components/vega/utils.js","components/sets/CellSetSizesPlot.js","components/sets/CellSetSizesPlotSubscriber.js","components/higlass/GenomicProfilesSubscriber.js","components/genes/ExpressionHistogram.js","components/genes/ExpressionHistogramSubscriber.js","components/sets/hooks.js","components/sets/CellSetExpressionPlotOptions.js","components/sets/CellSetExpressionPlot.js","components/sets/CellSetExpressionPlotSubscriber.js","app/component-registry.js","components/status/StatusSubscriber.js","components/shared-spatial-scatterplot/dynamic-opacity.js","app/view-config-utils.js","app/Vitessce.js","app/app.js","demo/index.js","app/api.js","components/heatmap/heatmap.worker.js"],"names":["fromEntries","iterable","reduce","obj","key","val","Object","assign","pluralize","singular","plural","count","capitalize","word","charAt","toUpperCase","slice","getNextScope","prevScopes","nextScope","chars","nextCharIndices","next","r","forEach","charIndex","unshift","increment","i","length","push","join","includes","getSourceFromLoader","loader","level","data","Array","isArray","isRgb","source","shape","dtype","labels","indexOf","Component","DESCRIPTION","STATUS","GENES","CELL_SETS","SCATTERPLOT","SPATIAL","HEATMAP","LAYER_CONTROLLER","CELL_SET_SIZES","GENOMIC_PROFILES","CELL_SET_EXPRESSION","EXPRESSION_HISTOGRAM","FileType","CELLS_JSON","CELL_SETS_JSON","EXPRESSION_MATRIX_ZARR","GENOMIC_PROFILES_ZARR","MOLECULES_JSON","NEIGHBORHOODS_JSON","RASTER_JSON","RASTER_OME_ZARR","CLUSTERS_JSON","GENES_JSON","ANNDATA_CELL_SETS_ZARR","ANNDATA_CELLS_ZARR","ANNDATA_EXPRESSION_MATRIX_ZARR","CoordinationType","DATASET","EMBEDDING_TYPE","EMBEDDING_ZOOM","EMBEDDING_ROTATION","EMBEDDING_TARGET_X","EMBEDDING_TARGET_Y","EMBEDDING_TARGET_Z","EMBEDDING_CELL_SET_POLYGONS_VISIBLE","EMBEDDING_CELL_SET_LABELS_VISIBLE","EMBEDDING_CELL_SET_LABEL_SIZE","EMBEDDING_CELL_RADIUS","EMBEDDING_CELL_RADIUS_MODE","EMBEDDING_CELL_OPACITY","EMBEDDING_CELL_OPACITY_MODE","SPATIAL_ZOOM","SPATIAL_ROTATION","SPATIAL_TARGET_X","SPATIAL_TARGET_Y","SPATIAL_TARGET_Z","SPATIAL_ROTATION_X","SPATIAL_ROTATION_Y","SPATIAL_ROTATION_Z","SPATIAL_ROTATION_ORBIT","SPATIAL_ORBIT_AXIS","SPATIAL_AXIS_FIXED","HEATMAP_ZOOM_X","HEATMAP_ZOOM_Y","HEATMAP_TARGET_X","HEATMAP_TARGET_Y","CELL_FILTER","CELL_HIGHLIGHT","CELL_SET_SELECTION","CELL_SET_HIGHLIGHT","CELL_SET_COLOR","GENE_FILTER","GENE_HIGHLIGHT","GENE_SELECTION","GENE_EXPRESSION_COLORMAP","GENE_EXPRESSION_TRANSFORM","GENE_EXPRESSION_COLORMAP_RANGE","CELL_COLOR_ENCODING","SPATIAL_RASTER_LAYERS","SPATIAL_CELLS_LAYER","SPATIAL_MOLECULES_LAYER","SPATIAL_NEIGHBORHOODS_LAYER","GENOMIC_ZOOM_X","GENOMIC_ZOOM_Y","GENOMIC_TARGET_X","GENOMIC_TARGET_Y","ADDITIONAL_CELL_SETS","MOLECULE_HIGHLIGHT","VitessceConfigDatasetFile","url","dataType","fileType","options","this","file","type","VitessceConfigDataset","uid","name","description","dataset","files","map","f","toJSON","VitessceConfigView","component","coordinationScopes","x","y","w","h","view","args","cScopes","cScope","cType","props","VitessceConfigViewHConcat","views","VitessceConfigViewVConcat","VitessceConfigCoordinationScope","cValue","urlPrefix","makeDatasetNameToJsonFiles","datasetPrefix","getS3Url","notPublic","config","public","undefined","vapi","VitessceConfig","version","datasets","coordinationSpace","layout","initStrategy","prevDatasetUids","d","nextUid","newDataset","addCoordination","newScope","setValue","datasetScope","mapping","datasetMatches","entries","filter","Error","newView","etScope","useCoordination","cTypes","result","keys","scope","cValues","viewConcat","layoutAux","xMin","xMax","yMin","yMax","setXYWH","numViews","c","vc","addDataset","addFile","cObj","cScopeName","cScopeValue","hconcat","vcvhc","vconcat","vcvvc","cm","dt","CELLS","EXPRESSION_MATRIX","MOLECULES","NEIGHBORHOODS","RASTER","ft","ct","linnarssonDataTypes","linnarssonName","linnarssonDescription","linnarssonBase","linnarssonBaseNoMolecules","justScatter","requestInit","method","headers","mode","credentials","cache","redirect","referrer","integrity","embeddingType","A","embeddingZoom","justScatterExpression","justSpatial","spatialZoom","spatialTargetX","spatialTargetY","codeluppi2018","PCA","TSNE","transpose","geneSelection","geneExpressionColormapRange","getCodeluppiViewConfig","driesName","driesDescription","eng2019","UMAP","embeddingCellSetPolygonsVisible","embeddingCellSetLabelsVisible","embeddingCellSetLabelSize","embeddingCellRadius","cellRadius","wang2018","spatialLayers","radius","opacity","visible","stroked","vanderbiltBase","layers","spraggins2020","staticLayout","zoom","target","satijaDescription","satija2020","embeddingTargetX","embeddingTargetY","blin2019","omeNgffLegacy","hubmapIntestineSnAtacSeq","baseUrl","umap","addView","cellSetsManager","genomicProfiles","getConfig","embeddingZoomConfig","v1","v2","linkViews","embeddingTargetXConfig","embeddingTargetYConfig","embeddingCellSetPolygonsVisibleConfig","getEngViewConfig","v4","coordinationTypeConfigs","configs","genomicZoomX","genomicZoomY","genomicTargetX","genomicTargetY","hgViewConfig","autocompleteSource","genomePositionSearchBox","autocompleteServer","autocompleteId","chromInfoServer","chromInfoId","chromInfoPath","tracks","top","height","tilesetUid","server","fontSize","labelPosition","labelLeftMargin","labelRightMargin","labelTopMargin","labelBottomMargin","minHeight","geneAnnotationHeight","geneLabelPosition","geneStrandSpacing","showMousePosition","mousePositionColor","plusStrandColor","minusStrandColor","labelColor","trackBorderWidth","trackBorderColor","color","stroke","fontIsLeftAligned","left","width","minWidth","center","contents","maxZoom","backgroundColor","labelShowResolution","labelShowAssembly","labelTextOpacity","labelBackgroundColor","labelBackgroundOpacity","colorRange","colorbarBackgroundColor","colorbarBackgroundOpacity","colorbarPosition","heatmapValueScaling","showTooltip","extent","zeroValueColor","scaleStartPercent","scaleEndPercent","transforms","value","right","bottom","whole","gallery","moved","static","schemaVersion","images","usePhysicalSizeScaling","renderLayers","profileTrackUidKey","vanderbilt","CARD","PRIMARY_CARD","SECONDARY_CARD","BLACK_CARD","SCROLL_CARD","Warning","title","preformatted","unformatted","theme","className","styles","makeStyles","paper","maxHeight","overflow","container","position","span","textAlign","paddingLeft","paddingRight","muiTheme","dark","createTheme","palette","primary","grey","secondary","primaryBackground","primaryBackgroundHighlight","primaryBackgroundInput","primaryBackgroundDim","primaryBackgroundLight","primaryForeground","primaryForegroundDim","primaryForegroundActive","secondaryBackground","secondaryBackgroundDim","secondaryForeground","MuiButtonBase","disableRipple","light","createContext","ViewConfigProviderLocal","Provider","useViewConfigStoreLocal","useStore","useViewConfigStoreApiLocal","useStoreApi","ViewConfigProvider","useViewConfigStore","useViewConfigStoreApi","AuxiliaryProviderLocal","useAuxiliaryStoreLocal","AuxiliaryProvider","useAuxiliaryStore","createViewConfigStore","create","set","viewConfig","loaders","setViewConfig","setLoaders","setCoordinationValue","parameter","state","removeComponent","newLayout","splice","changeLayout","newComponentProps","newProps","createAuxiliaryStore","auxiliaryStore","useHoverStore","componentHover","setComponentHover","useWarnStore","warning","setWarning","useViewInfoStore","viewInfo","setComponentViewInfo","uuid","useGridSizeStore","resizeCount","incrementResizeCount","parameters","shallow","useMemo","AUXILIARY_COORDINATION_TYPES_MAP","spatialRasterLayers","useAuxiliaryCoordination","mappedCoordinationScopes","newCoordinationScopes","coordinationType","mapCoordinationScopes","mappedParameters","Boolean","flat","mapParameters","useLoaders","useComponentHover","useSetComponentHover","useWarning","useSetWarning","useComponentViewInfo","useCallback","useSetComponentViewInfo","setViewInfoRef","useRef","getState","current","useGridResize","useEmitGridResize","makeGridLayout","colXs","colLayout","colWs","a","id","spec","ResponsiveHeightGridLayout","prevProps","onWindowResize","WidthProvider","Responsive","VitessceGridLayout","layouts","getComponent","padding","margin","draggableHandle","reactGridLayoutProps","rowHeight","onRemoveComponent","onLayoutChangeProp","onLayoutChange","cols","breakpoints","components","positions","def","columns","columnXs","range","columnCount","resolveLayout","gridCols","gridLayouts","gridBreakpoints","gridComponents","maxRows","Math","max","values","xywh","style","layoutChildren","k","v","removeGridComponent","window","innerHeight","containerPadding","nextC","prevC","parseInt","substring","nextProps","isEqual","defaultProps","AbstractTwoStepLoader","dataSource","params","subscriptions","subscriber","token","uuidv4","AbstractLoaderError","message","LoaderValidationError","datasetType","datasetFileType","datasetUrl","reason","console","warn","JSON","stringify","LoaderNotFoundError","LoaderResult","coordinationValues","typeToSchema","cells","cellsSchema","molecules","moleculesSchema","neighborhoods","neighborhoodsSchema","raster","rasterSchema","cellSetsSchema","JsonLoader","schema","then","Promise","reject","validate","valid","resolve","failureReason","Ajv","compile","errors","MatrixZarrLoader","attrs","getJson","store","arr","openArray","path","z","getRaw","all","loadAttrs","loadArr","GenesJsonAsMatrixZarrLoader","genesSchema","catch","payload","rows","normalizedFlatMatrix","flatMap","cellId","geneId","Uint8Array","from","ClustersJsonAsMatrixZarrLoader","clustersSchema","matrix","normalizedMatrix","col","min","floor","tNormalizedMatrix","j","HIERARCHICAL_SCHEMAS","cell","latestVersion","TABULAR_SCHEMAS","cellSetsTabularSchema","cellLayerDefaultProps","updateStatus","setCellHighlight","coordinateSystem","COORDINATE_SYSTEM","CARTESIAN","pickable","autoHighlight","filled","getElevation","onHover","info","object","factors","cellInfoFactors","factor","DEFAULT_DARK_COLOR","DEFAULT_LIGHT_COLOR","getDefaultColor","PALETTE","VIEWER_PALETTE","COLORMAP_OPTIONS","DEFAULT_GL_OPTIONS","webgl2","getNextNumberedNodeName","nodes","prefix","find","n","setCellSelection","cellSelection","additionalCellSets","cellSetColor","setCellSetSelection","setAdditionalCellSets","setCellSetColor","setCellColorEncoding","CELL_SELECTIONS_LEVEL_ZERO_NAME","selectionsLevelZeroNode","tree","nextAdditionalCellSets","datatype","nextName","children","colorIndex","nextPath","mergeCellSets","cellSets","asEsModule","__esModule","default","getStatsForResolution","resolution","depth","depthDownsampled","totalBytes","canLoadResolution","performance","memory","jsHeapSizeLimit","GLOBAL_LABELS","DEFAULT_RASTER_LAYER_PROPS","colormap","domainType","transparentColor","renderingMode","RENDERING_MODES","ADDITIVE","use3d","DEFAULT_MOLECULES_LAYER","DEFAULT_CELLS_LAYER","DEFAULT_NEIGHBORHOODS_LAYER","GLSL_COLORMAPS","padWithDefault","defaultValue","padWidth","newArr","hoveredCell","compare","cellColorData","expressionData","BitmaskLayer","fs","vs","modules","project32","picking","defines","oldProps","changeFlags","setColorTexture","cellTexHeight","cellTexWidth","expressionTex","dataToTexture","setState","gl","context","model","delete","_getModel","getAttributeManager","invalidateAll","colorTex","Texture2D","mipmaps","GL","TEXTURE_MIN_FILTER","NEAREST","TEXTURE_MAG_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","format","RGB","dataFormat","UNSIGNED_BYTE","opts","uniforms","channelsVisible","colorScaleLo","colorScaleHi","isExpressionMode","textures","setUniforms","hovered","colorTexHeight","colorTexWidth","uColorScaleRange","uIsExpressionMode","draw","isWebGL2On","isWebGL2","Float32Array","R32F","LUMINANCE","RED","FLOAT","XRLayer","getSingleSelectionStats2D","selection","getRaster","selectionStats","getChannelStats","domain","slider","contrastLimits","getSingleSelectionStats3D","lowResSource","sizeZ","raster0","rasterMid","rasterTop","stats0","statsMid","statsTop","layerName","getSingleSelectionStats","getStats","getMultiSelectionStats","selections","stats","domains","stat","sliders","getBoundingCube","physicalSizeScalingMatrix","meta","physicalSizes","size","ratio","Matrix4","scale","identity","getPhysicalSizeScalingMatrix","buildDefaultSelection","globalSelection","globalIndices","dim","getDefaultGlobalSelection","firstNonGlobalDimension","isInterleaved","lastDimSize","initializeLayerChannels","defaultSelection","colors","channel","getMetaWithTransformMatrices","imageMeta","imageLoaders","sources","metadata","transform","translate","some","every","minPhysicalSize","acc","hasZPhyscialSize","sizes","unit","replace","divide","newMeta","toArray","initializeRasterLayersAndChannels","rasterLayers","rasterRenderLayers","nextImageLoaders","nextImageMetaAndLayers","autoImageLayerDefPromises","layer","loaderCreator","globalIndicesOfRenderLayers","imageName","findIndex","image","layerIndex","autoImageLayerDefPromise","channels","isBitmask","index","modelMatrix","autoImageLayerDefs","renderSubBitmaskLayers","tile","bbox","base","bounds","tileSize","channelData","tileId","initLoader","imageData","dimensions","isPyramid","field","metadataUrl","fetch","response","json","zarrMetadata","paths","metaKey","arrMetaKeys","chunks","yChunk","xChunk","log2","ZarrPixelSource","omeTiffOffsetsUrl","res","ok","offsets","loadOmeTiff","Channels","Pixels","Name","RasterLoader","URL","createObjectURL","Blob","urls","imagesWithLoaderCreators","autoImageCache","autoImages","autoImageLayers","imageLayerLoaders","imageLayerMeta","hexToRgb","hex","exec","toLowerCase","OmeZarrLoader","loadOmeZarr","fetchOptions","omero","error","rdefs","t","defaultT","defaultZ","filterSelection","sel","nextSel","start","end","label","callbackOnKeyPress","event","callback","preventDefault","colorArrayToString","rgbArray","tinycolor","g","b","toHexString","colorStringToArray","colorString","colorObj","toRgb","getLevelTooltipText","repeat","isEqualOrPrefix","targetPath","testPath","tryRenamePath","nextTargetPath","pathToKey","nodeToSet","currNode","nodeToHeight","newLevel","childrenHeights","getNodeLength","curr","treeFindNodeByNamePath","currTree","targetNamePath","foundNodes","levelZeroNode","nodeFindNodeByNamePath","node","currLevelIndex","currNodeName","child","nodeTransform","predicate","transformedPaths","currPath","newPath","concat","nodeAppendChild","newChild","treeToUnion","checkedPaths","nodeSets","hEl","nodeToLevelDescendantNamePaths","prevPath","stopEarly","treeExport","treeExportLevelZeroNode","nodePath","cellSetColors","nodeWithColors","nodeTransformAll","newNode","nPath","nodeColor","treeToExport","nodeName","treeInitialize","colorMixWithUncertainty","originalColor","p","mixingColor","treeToSetSizesBySetNames","selectedNamePaths","setColor","setNamePath","nodeSet","filterNode","filterPath","treesConflict","testCellSets","testPaths","hasConflict","getPaths","lzn","initializeCellSetColor","nextCellSetColor","nodeCountPerTreePerLevel","fill","treeIndex","processNode","hierarchyLevel","nodeColorArray","getCellSetPolygons","cellSetSelection","cellSetPolygons","cellPositions","mappings","points","turfFeatureCollection","turfPoint","hullCoords","concaveman","Infinity","centroidCoords","centroid","geometry","coordinates","hull","treeToCellPolygonsBySetNames","tryUpgradeTreeToLatestSchema","itemId","handleImportJSON","importData","parse","handleImportTabular","dsvFormat","row","groupName","setName","obsId","predictionScore","isNil","treeToImport","Set","groupRows","setRows","levelOneNode","handleExportJSON","jsonString","encodeURIComponent","downloadForUser","dataString","fileName","downloadAnchorNode","document","createElement","setAttribute","body","appendChild","click","remove","CellSetsJsonLoader","rawData","upgradedData","newAutoSetSelectionParentName","newAutoSetSelections","newAutoSetColors","dataToCellSetsTree","cellNames","cellSetScores","cellSetsTree","cellSetIds","levelSets","InternMap","classes","has","get","levels","getNextLevelNames","levelSuffixes","l","sort","localeCompare","levelOneNodes","levelOneName","getNode","parentLevelPrefixes","currLevelName","childLevelSuffixes","isLeaf","resultNode","nextLevelNames","nextLevelName","uniqueCellSetIds","clusters","cluster","normalize","concatenateColumnVectors","numCols","numRows","BYTES_PER_ELEMENT","DataView","ArrayBuffer","TypedArray","constructor","buffer","CellSetsZarrLoader","cellSetZarrLocation","loadObsVariables","cellSetScoreZarrLocation","option","scoreName","loadObsIndex","loadCellSetIds","loadCellSetScores","CellsZarrLoader","xy","loadNumeric","poly","coordinationName","loadMappings","loadXy","loadPoly","loadFactors","dims","factorsObj","split","filteredGeneNames","geneFilterZarr","geneFilter","getFilterFn","getFlatArrDecompressed","_","loadVarIndex","filterZarr","loadFilteredGeneNames","geneNames","genes","gene","sparseArrays","_getGeneIndices","indices","_openSparseArrays","indptrArr","indexArr","cellXGeneArr","_getNumCells","numCells","startRowIndex","endRowIndex","isColumnAllZeros","geneData","rowIndices","cellXGeneData","rowIndex","_getNumGenes","numGenes","_loadCSRSparseCellXGene","cellXGene","_sparseMatrix","cellXGeneMatrix","rowStart","rowEnd","colStart","colEnd","matrixGeneFilter","_matrixZattrs","encodingType","_loadCSCSparseCellXGene","_getFilteredGenes","filteredGenes","numGenesFiltered","cellXGeneMatrixFiltered","loadGeneSelection","shouldNormalize","_loadCSCGeneSelection","_loadCSRGeneSelection","loadCellXGene","matrixGeneFilterZarr","GenomicProfilesZarrLoader","ZarrDataSource","HTTPStore","supportedMethods","getItem","buf","text","TextDecoder","decode","KeyError","readFloat32FromUint8","bytes","Int32Array","parseVlenUtf8","decoder","dataEnd","output","AnnDataSource","obsPromises","Map","obsPaths","obsPath","getObsCol","obsCol","obsPromise","_loadObsVariable","err","obs","categories","categoriesValues","obsArr","obsValues","mappedObsValues","String","parseAndMergeTextBytes","dbytes","mergeBytes","tmp","byteLength","numRequests","ceil","requests","item","keyPrefix","compressor","filters","obsIndex","_index","varIndex","DataSourceFetchError","JsonSource","_data","fileTypeToLoaderAndSource","RasterJsonLoader","AnnDataLoaders","createLoaders","configDescription","dataSources","datasetLoaders","DataSourceClass","LoaderClass","fileId","getWindowDimensions","innerWidth","useVitessceContainer","ref","closest","useGridItemSize","containerRef","useState","setHeight","setWidth","useEffect","onResizeDebounced","debounce","trailing","addEventListener","removeEventListener","containerRect","getBoundingClientRect","useDeckCanvasSize","deckRef","canvasRect","deck","canvas","useReady","supportedItems","items","waiting","setWaiting","setItemIsReady","readyItem","waitingItems","nextWaitingItems","log","setItemIsNotReady","notReadyItem","resetReadyItems","useUrls","setUrls","prev","useClosestVitessceContainerSize","componentHeight","clientHeight","componentWidth","clientWidth","useExpressionValueGetter","cellIdMap","entry","cellIndex","VitessceGrid","initialRowHeight","containerHeight","setContainerHeight","setRowHeight","bottomY","len","getNumRows","newRowHeight","getRowHeight","useRowHeight","onResize","viewConfigStoreApi","useSetViewConfig","changeLayoutPostMount","onResizeStop","DEFAULT_COORDINATION_VALUES","AUTO_INDEPENDENT_COORDINATION_TYPES","COMPONENT_COORDINATION_TYPES","upgradeReplaceViewProp","prevZScopes","prevTXScopes","prevTYScopes","nextZScope","nextTXScope","nextTYScope","targetX","targetY","SCHEMA_HANDLERS","configSchema0_1_0","datasetUid","componentDef","newComponentDef","newScopeValues","newDatasetUid","addSchema","configSchema1_0_0","replaceLayerType","layerType","isRaster","typedLayers","newLayer","newComponent","replaceCoordinationScope","configSchema1_0_1","globalDisable3d","newConfig","cloneDeep","configSchema1_0_2","disableChannelsIfRgbDetected","configSchema1_0_3","configSchema1_0_4","configSchema1_0_5","configSchema1_0_6","CallbackPublisher","onWarn","onConfigChange","onLoaderChange","validateOnConfigChange","subscribe","e","validateViewConfig","warnInConsole","initCoordinationSpace","setters","initialValues","setterName","setterFunc","initialValue","equal","useCellsData","addUrl","isRequired","coordinationSetters","initialCoordinationValues","setCells","cellsCount","setCellsCount","load","spatialCellsLayer","useCellSetsData","setCellSets","useExpressionMatrixData","expressionMatrix","setExpressionMatrix","useGeneSelection","setGeneData","expressionDataForSelection","geneIndex","useExpressionAttrs","setAttrs","useMoleculesData","setMolecules","moleculesCount","setMoleculesCount","locationsCount","setLocationsCount","spatialMoleculesLayer","useRasterData","setRaster","setImageLayerLoaders","setImageLayerMeta","nextImageMeta","LoadingIndicator","CircularProgress","MuiSpan","PopperMenu","buttonIcon","open","setOpen","buttonClassName","placement","anchorRef","handleClose","getTooltipContainer","IconButton","aria-describedby","onClick","Popper","anchorEl","onClose","transition","TransitionProps","ClickAwayListener","onClickAway","Fade","timeout","Paper","elevation","MenuList","useStyles","iconButton","border","marginLeft","background","borderRadius","marginRight","verticalAlign","downloadLink","SettingsIconWithArrow","PlotOptions","CloudDownloadIconWithArrow","DownloadOptions","MenuItem","dense","Link","underline","href","rel","ClosePaneButton","TitleInfo","isScroll","isSpatial","isReady","childClassName","Description","metadataRecord","DESCRIPTION_DATA_TYPES","Status","messages","SelectableTable","hasColorEncoding","onChange","idKey","valueKey","allowMultiple","allowUncheck","showTableHead","showTableInputs","testHeight","testWidth","selectedRows","setSelectedRows","onSelectRow","checked","union","difference","handleInputChange","getDataFromIds","ids","isSelected","initialSelectedRows","selectedRowData","inputUuid","hiddenInputsClass","rowRenderer","role","htmlFor","column","headerRowRenderer","gridStyle","outline","rowCount","headerHeight","rowGetter","Genes","geneList","setGeneSelection","searchTerm","setSearchTerm","searchResults","setSearchResults","results","placeholder","GENES_DATA_TYPES","Tree","React","forwardRef","prefixCls","showIcon","blockNode","checkable","itemHeight","classNames","virtual","HelpTooltip","content","overlayClassName","spanRef","overlay","Popover","PopoverMenuListButton","subtitle","handler","handlerKey","confirm","isConfirming","setIsConfirming","handleOrRequireConfirm","titleWithConfirm","onKeyPress","PopoverMenuList","menuConfig","defaultPalette","disableAlpha","triangle","onChangeComplete","rgb","PopoverMenu","setVisible","onVisibleChange","_extends","arguments","prototype","hasOwnProperty","call","apply","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","trigger","mouseEnterDelay","mouseLeaveDelay","SvgMenu","_ref","svgRef","titleId","viewBox","ForwardRef","makeNodeViewMenuConfig","onCheckNode","onNodeRemove","onNodeSetIsEditing","onExportLevelZeroNodeJSON","onExportLevelZeroNodeTabular","onExportSetJSON","editable","exportable","NamedSetNodeStatic","tooltipText","nodeKey","checkbox","isChecking","onNodeSetColor","onNodeView","expanded","onCheckLevel","checkedLevelPath","checkedLevelIndex","disableTooltip","shouldCheckNextLevel","nextLevelToCheck","niceSize","Intl","NumberFormat","tooltipProps","popoverMenuConfig","NamedSetNodeEditing","onNodeSetName","onNodeCheckNewName","currentTitle","setCurrentTitle","hasConflicts","trySetName","autoFocus","onFocus","select","NamedSetNode","isEditing","isCurrentSet","LevelsButtons","onCheck","isChecked","clsx","SwitcherIcon","isOpen","hexColor","focusable","data-icon","aria-hidden","TreeNode","renderSelector","onDragStartProp","onDragStart","rcTree","prefixClass","draggable","wrapClass","isDraggable","setSelectHandle","getNodeState","aria-grabbed","renderCheckbox","renderLevels","renderSwitcher","onNodeExpand","onNodeExpandWrapper","switcherClass","tabIndex","loading","dragOver","dragOverGapTop","dragOverGapBottom","selected","halfChecked","onDragEndProp","onDragEnd","expandable","otherProps","filterTreeNode","disabled","isDisabled","dataAndAriaAttributeProps","getDataAndAria","onDragEnter","onDragOver","onDragLeave","onDrop","bind","renderChildren","RcTreeNode","SvgUnion","strokeWidth","strokeMiterlimit","strokeDasharray","strokeOpacity","SvgIntersection","mask","SvgComplement","PlusButton","onError","onImportTree","onCreateLevelZeroNode","importable","onImport","importHandler","mimeType","uploadInputNode","File","FileReader","FileList","reader","readAsText","SetOperationButtons","onUnion","onIntersection","onComplement","operatable","hasCheckedSetsToUnion","hasCheckedSetsToIntersect","hasCheckedSetsToComplement","processSets","sets","SetsManager","additionalSets","checkedLevel","levelSelection","setSelection","setExpansion","onExpandNode","onDropNode","isDragging","setIsDragging","isEditingNodeName","setIsEditingNodeName","processedSets","processedAdditionalSets","additionalSetKeys","getAllKeys","allSetSelectionKeys","allSetExpansionKeys","setSelectionKeys","setExpansionKeys","additionalSetSelectionKeys","additionalSetExpansionKeys","renderTreeNodes","readOnly","nodeToRenderProps","levelZeroPath","levelIndex","checkedKeys","expandedKeys","autoExpandParent","onExpand","dropKey","eventKey","dragKey","dragNode","dropToGap","dropPosition","CELL_SETS_DATA_TYPES","spline","v0","v3","t1","t2","t3","innerBasis","interpolatePlasma","interpolateSequentialMulti","getCellColors","cellColorEncoding","expressionDataAttrs","geneExpColormap","cellColor","cellColorsArray","prob","treeToCellColorsBySetNames","ClickableDrawRectangleMode","onEdit","editType","DrawRectangleMode","ClickableDrawPolygonByDraggingMode","DrawPolygonByDraggingMode","MODE_MAP","SELECTION_TYPE","RECTANGLE","POLYGON","selectionType","layerIds","onSelect","EMPTY_DATA","features","PASS_THROUGH_PROPS","SelectionLayer","getCellCoords","cellsQuadTree","flippedCoordinates","flipY","selectedPolygon","turfPolygon","pickingInfos","visit","x0","y0","x1","y1","nodePoints","nodePolygon","nodePolygonContainsSelectedPolygon","booleanContains","nodePolygonWithinSelectedPolygon","booleanWithin","nodePolygonOverlapsSelectedPolgyon","booleanOverlap","booleanPointInPolygon","ViewMode","inheritedProps","EditableGeoJsonLayer","getSubLayerProps","modeConfig","dragToDraw","selectedFeatureIndexes","updatedData","_selectPolygonObjects","_subLayerProps","guides","pointType","ScatterplotLayer","radiusScale","getLineWidth","radiusMinPixels","radiusMaxPixels","getRadius","CompositeLayer","getBaseLayerId","layerId","getSelectionLayers","tool","updateCellsSelection","cellBaseLayerId","editHandlePointRadius","cellIds","cellObj","getTentativeFillColor","getTentativeLineColor","getTentativeLineDashArray","lineWidthMinPixels","lineWidthMaxPixels","getEditHandlePointColor","getEditHandlePointRadius","editHandlePointRadiusScale","editHandlePointRadiusMinPixels","editHandlePointRadiusMaxPixels","THEME_TO_TEXT_COLOR","AXIS_FONT_FAMILY","PIXELATED_TEXTURE_PARAMETERS","fragmentShader","async","aggSizeX","aggSizeY","HeatmapBitmapLayer","shaders","extensions","extension","_mergeShaders","getShaders","fragmentShaderWithColormap","_getShaders","loadTexture","bitmapTexture","uBitmapTexture","uTextureSize","uAggSize","BitmapLayer","desaturate","tintColor","PixelatedBitmapLayer","textureParameters","HeatmapCompositeTextLayer","axisTopLabelData","matrixLeft","matrixWidth","viewWidth","axisTopTitle","showAxisTopLabels","cellWidth","axisLabelTop","axisOffsetTop","scaleFactor","TextLayer","getText","getPosition","getTextAnchor","getColor","getSize","getAngle","fontFamily","updateTriggers","axisLeftLabelData","matrixTop","matrixHeight","viewHeight","axisLeftTitle","showAxisLeftLabels","cellHeight","axisLabelLeft","axisOffsetLeft","_renderAxisTopLayers","_renderAxisLeftLayers","createCellsQuadTree","cellsEntries","quadtree","addAll","SvgNearMe","SvgSelectionRectangle","SvgSelectionLasso","alt","isActive","inactive","active","ToolMenu","setActiveTool","activeTool","visibleTools","pan","selectRectangle","selectLasso","getCursorWithTool","getCursor","interactionState","AbstractSpatialOrScatterplot","viewport","onViewStateChange","onInitializeViewInfo","onWebGLInitialized","onToolChange","nextViewState","viewState","setViewState","spatialAxisFixed","onToolChangeProp","coordinate","sourceLayer","cellHighlight","hasBitmask","layerZoomScale","round","dataCoords","coords","Number","updateViewInfo","project","positionX","positionY","layerProps","getLayers","showCellSelectionTools","cellsLayer","showPanTool","useDevicePixels","OrbitView","controller","orbitAxis","OrthographicView","glOptions","dragPan","PureComponent","constant","jiggle","random","inject","getExpressionValue","getSelectionState","ScaledExpressionExtension","module","models","topModel","sideModel","_getModels","getCurrentLayer","isComposite","attributeManager","add","expressionValue","accessor","divisor","attributes","settings","m","LayerExtension","extensionName","SelectionExtension","instanced","makeDefaultGetCellPosition","cellEntry","available","s","mappedCell","makeDefaultGetCellCoords","Scatterplot","cellSetsForceSimulation","masses","strength","iterations","xCenter","vx","yCenter","vy","prepare","quad","force","nodeSize","nodeMass","xi","yi","visitAfter","xSize","ySize","xd","abs","yd","sqrt","iterate","initialize","forceCollideRects","cellSetsLabelPrevZoom","cellSetsLayers","onUpdateCellsData","onUpdateCellsLayer","onUpdateCellSetsLayers","getCellPosition","cellOpacity","cellFilter","getCellIsSelected","cellColors","getCellColor","makeDefaultGetCellColors","onCellClick","geneExpressionColormap","filteredCellsEntries","radiusUnits","lineWidthUnits","getFillColor","getLineColor","cellSetPolygonsVisible","cellSetLabelsVisible","cellSetLabelSize","PolygonLayer","wireframe","getPolygon","collisionForce","forceSimulation","tick","getAlignmentBaseline","fontWeight","createSelectionLayers","createCellsLayer","onlyViewStateChange","createCellSetsLayers","viewInfoDidUpdate","shallowDiff","propName","forceUpdate","ScatterplotWrapper","tooltipAnchor","pointerEvents","userSelect","tooltipContent","borderCollapse","Tooltip","parentWidth","parentHeight","placementX","setPlacementX","placementY","setPlacementY","flipX","Tooltip2D","parentUuid","sourceUuid","isTooltipVisible","crosshairWidth","TooltipContent","ScatterplotTooltipSubscriber","getCellInfo","cellInfo","box","boxSizing","sliderValueLabel","tableContainer","overflowX","labelCell","inputCell","selectRoot","OptionsContainer","Box","TableContainer","Table","table","TableBody","OptionSelect","classesProp","Select","native","disableUnderline","root","CellColorEncodingOption","observationsLabel","observationsLabelNice","TableRow","TableCell","inputProps","ScatterplotOptions","setCellRadius","cellRadiusMode","setCellRadiusMode","setCellOpacity","cellOpacityMode","setCellOpacityMode","setCellSetLabelsVisible","setCellSetLabelSize","setCellSetPolygonsVisible","setGeneExpressionColormap","setGeneExpressionColormapRange","handleColormapRangeChange","handleColormapRangeChangeDebounced","Checkbox","Slider","valueLabel","aria-labelledby","valueLabelDisplay","step","cmap","SCATTERPLOT_DATA_TYPES","defaultGetCellCoords","Spatial","moleculesEntries","moleculesLayer","neighborhoodsLayer","imageLayers","layerLoaderSelections","randomColorData","expression","onUpdateMoleculesData","onUpdateMoleculesLayer","onUpdateNeighborhoodsData","onUpdateNeighborhoodsLayer","onUpdateImages","layerDef","cellSelectionSet","makeDefaultGetCellIsSelected","getCellPolygon","makeDefaultGetCellPolygon","lineWidthScale","setMoleculeHighlight","getMoleculeColor","getMoleculePosition","getNeighborhoodPolygon","neighborhoodsEntry","neighborhoodsEntries","ScaleBarLayer","rawLayerDef","nextLoaderSelection","prevLoaderSelection","useTransparentColor","xSlice","ySlice","zSlice","visibilities","MultiscaleImageLayer","renderSubLayers","excludeBackground","onViewportLoad","VolumeLayer","ImageLayer","getLayerLoaderTuple","Layer","layerLoader","AdditiveColormapExtension","ColorPaletteExtension","rasterLayersCallbacks","use3dIndex","createImageLayer","createScaleBarLayer","molecule","createMoleculesLayer","createNeighborhoodsLayer","createImageLayers","onUpdateCellColors","onUpdateExpressionData","SpatialWrapper","useToggleStyles","createStyles","cameraLabel","button","ToggleFixedAxisButton","setSpatialAxisFixed","SpatialOptions","canShowExpressionOptions","canShowColorEncodingOption","canShow3DOptions","SpatialTooltipSubscriber","SPATIAL_DATA_TYPES","layerFilter","startsWith","defaultPoolSize","navigator","hardwareConcurrency","HeatmapPool","Worker","waitForWorker","currentWorker","onmessage","finishTask","onerror","postMessage","workers","idleWorkers","waitQueue","idleWorker","pop","waiter","promise","terminate","Heatmap","componentName","rawViewState","colormapRange","clearPleaseWait","hoverInfo","setGeneHighlight","createDefaultUpdateGenesHover","createDefaultUpdateViewInfo","setIsRendering","variablesTitle","observationsTitle","minZoom","workerPool","HeatmapWorkerPool","tilesRef","dataRef","axisLeftLabels","setAxisLeftLabels","axisTopLabels","setAxisTopLabels","useReducer","tileIteration","incTileIteration","backlog","setBacklog","newBuffer","copyUint8Array","newCellOrdering","oldCellOrdering","cellLabelMaxLength","geneLabelMaxLength","clamp","getAxisSizes","offsetTop","offsetLeft","matrixRight","matrixBottom","xTiles","yTiles","tileWidth","tileHeight","colI","rowI","zoomedMouseY","zoomedMouseX","minY","minInViewY","maxInViewY","globalRowY","minX","minInViewX","maxInViewX","globalRowX","heatmapToMousePosition","nextZoom","nextScaleFactor","minTargetX","maxTargetX","minTargetY","maxTargetY","nextTarget","promises","process","tileI","tileJ","cellOrdering","tiles","currWork","currIndex","heatmapLayers","getLayer","textLayers","cellColorsTiles","offset","colorBarTileWidthPx","colorBarTileHeightPx","tileData","Uint8ClampedArray","TILE_SIZE","tileY","rValue","gValue","bValue","ImageData","cellColorsLayers","COLOR_BAR_SIZE","offsetCenter","mouseX","mouseY","viewMouseX","viewMouseY","mouseToHeatmapPosition","obsI","varI","varId","HeatmapTooltipSubscriber","getGeneInfo","geneHighlight","cellCoord","geneInfo","geneCoord","HeatmapOptions","HEATMAP_DATA_TYPES","display","justifyContent","alignItems","flexWrap","icon","action","ColorPalette","handleChange","aria-label","menuButton","ChannelOptions","handlePropertyChange","handleChannelRemove","handleIQRUpdate","disableGutters","DOMAINS","needMin","DTYPE_VALUES","getDomains","useSelectStyles","sharedControllerStyles","withStyles","popper","zIndex","flexDirection","useControllerSectionStyles","StyledAccordionDetails","AccordionDetails","StyledAccordionSummary","marginBottom","spacing","expandIcon","AccordionSummary","StyledInputLabel","InputLabel","OverflowEllipsisGrid","whiteSpace","textOverflow","Grid","StyledSelectionSlider","marginTop","markActive","ChannelSelectionDropdown","channelOptions","selectionIndex","opt","ChannelVisibilityCheckbox","toggle","abbreviateNumber","maxNaiveDigits","isInteger","naive","maximumSignificantDigits","useGrouping","toExponential","ChannelSlider","handleChangeDebounced","valueLabelFormat","getAriaLabel","orientation","RasterChannelController","visibility","channelId","newDomainType","dimName","colormapOn","isLoading","newUse3d","setDomain","setDomainType","setUse3d","rgbColor","on","toRgbUIString","mounted","hasDomainChanged","has3dChanged","hasSelectionChanged","newDomain","direction","xs","BitmaskChannelController","disableOptions","justify","VectorLayerController","handleLayerChange","isOn","Typography","handleCheckBoxChange","handleSliderChange","DOMAIN_OPTIONS","VolumeDropdown","loaderWithMeta","handleMultiPropertyChange","currResolution","disable3d","setRasterLayerCallback","setAreAllChannelsLoading","spatialHeight","spatialWidth","shouldUse3D","propertiesChanged","ch","defaultViewState","getDefaultInitialViewState","rotationX","rotationOrbit","newChannels","hasZStack","decimals","dm","parseFloat","pow","toFixed","formatBytes","ColormapSelect","inputId","TransparentColorCheckbox","float","OpacitySlider","SliderDomainSelector","GlobalSelectionSlider","possibleValues","newValue","onChangeCommitted","marks","LayerOption","LayerOptions","handleColormapChange","handleOpacityChange","handleTransparentColorChange","globalControlLabels","globalLabelValues","handleGlobalChannelsSelectionChange","handleDomainChange","shouldShowTransparentColor","shouldShowDomain","shouldShowColormap","hasDimensionsAndChannels","hasViewableResolutions","useSlicerStyles","enabled","Slicer","handleSlicerSetting","sliceValuesAndSetSliceFunctions","xSliceNew","ySliceNew","zSliceNew","Slicers","setVal","renderingOptions","RenderingModeSelect","handleRenderingModeChange","FormControl","fullWidth","ReCenterButton","Button","VolumeOptions","TabPanel","other","hidden","getDomainsAndSliders","buttonStyles","borderStyle","LayerController","handleLayerRemove","ChannelController","setAreLayerChannelsLoading","areLayerChannelsLoading","shouldShowRemoveLayerButton","channelRef","firstSelection","tab","setTab","isExpanded","setIsExpanded","o","setGlobalLabelValues","setOpacity","setChannels","setChannelsAndDomainType","setChannel","addChannel","newAreLayerChannelsLoading","handleChannelAdd","newChannelId","areLayerChannelsLoadingCallback","newChannelsWithSelection","channelControllers","channelLabel","setIsLoading","loaderData","q1","q3","property","update","removeChannel","controllerSectionClasses","Visibility","VisibilityIcon","VisibilityOffIcon","useVolumeTabs","FullController","MAX_CHANNELS","variant","startIcon","Accordion","enter","aria-controls","stopPropagation","Tabs","newTab","Tab","addButton","ImageAddIcon","ImageAddButton","imageOptions","handleImageAdd","imgData","handleAdd","LAYER_CONTROLLER_DATA_TYPES","LayerControllerMemoized","memo","setMoleculesLayer","canShowCellVecmask","setCellsLayer","setRasterLayersCallbacks","areLoadingRasterChannnels","setAreLoadingRasterChannnels","handleRasterLayerChange","handleRasterLayerRemove","layerIs3DIndex","setZoom","setTargetX","setTargetY","setTargetZ","setRotationX","setRotationOrbit","spatialLayout","enableLayerButtonsWithOneLayer","shouldShowImageLayerButton","layerMeta","cb","newRasterLayersCallbacks","newZoom","newRotationX","newRotationOrbit","newAreLoadingRasterChannnels","LayerControllerSubscriber","layerController","setRasterLayers","setSpatialRasterLayers","setSpatialCellsLayer","setSpatialMoleculesLayer","setSpatialTargetX","setSpatialTargetY","setSpatialTargetZ","setSpatialRotationX","setSpatialRotationOrbit","setSpatialZoom","scopes","useComponentLayout","layerControllerRef","windowDimensions","setWindowDimensions","useWindowDimensions","windowHeight","windowWidth","newLayers","PIXI_BUNDLE_VERSION","packageJson","dependencies","HIGLASS_BUNDLE_VERSION","higlass","PIXI_BUNDLE_URL","HIGLASS_BUNDLE_URL","dynamicImportPolyfill","register","dataFetcher","ZarrMultivecDataFetcher","pluginType","HiGlassComponent","lazy","ReactDOM","handleImportError","__import__","hglib","HiGlassLazy","hgViewConfigProp","hgOptionsProp","hgOptions","genomeSize","setGenomicZoomX","setGenomicZoomY","setGenomicTargetX","setGenomicTargetY","hgInstance","setHgInstance","isActiveRef","centerX","genomesPerUnitX","unitX","initialXDomain","centerY","genomesPerUnitY","unitY","initialYDomain","zoomFixed","trackSourceServers","exportViewUrl","zoomLocks","locksByViewUid","locksDict","locationLocks","valueScaleLocks","handleMouseEnter","handleMouseLeave","api","viewConfigString","xDomain","yDomain","nextGenomicZoomX","nextGenomicZoomY","nextGenomicTargetX","nextGenomicTargetY","off","fallback","bounded","pixelPreciseMarginPadding","containerPaddingX","containerPaddingY","sizeMode","HIGLASS_DATA_TYPES","DATASET_NAME","isVega","$schema","VegaPlot","partialSpec","signalListeners","vegaComponent","tooltip","Handler","renderer","VEGA_THEMES","axis","domainColor","gridColor","tickColor","CellSetSizesPlot","keyLength","keyName","mark","encoding","labelExpr","legend","CELL_SET_SIZES_DATA_TYPES","GENOMIC_PROFILES_DATA_TYPES","REFERENCE_TILESETS","hg38","chromosomes","hg19","mm9","mm10","ExpressionHistogram","bin","maxbins","aggregate","EXPRESSION_HISTOGRAM_DATA_TYPES","useExpressionByCellSet","useGeneExpressionTransform","mergedCellSets","cellObjects","cellsArray","treeToObjectsBySetNames","firstGeneSelected","exprMax","cellIndices","normValue","transformedValue","expressionArr","expressionMax","CellSetExpressionPlotOptions","toggleGeneExpressionTransform","CellSetExpressionPlot","domainMax","maxCharactersForLabel","autoMarginBottom","colorScale","plotWidth","plotHeight","bandWidth","rectColor","axisBand","bandPosition","tickExtra","tickOffset","signals","groupby","bandwidth","fields","ops","as","scales","signal","reverse","axes","orient","zindex","tickCount","labelAngle","labelAlign","facet","encode","xc","band","expr","parent","y2","CELL_SET_EXPRESSION_DATA_TYPES","registry","descriptionOverride","setDescription","useDescription","status","moleculeHighlight","variablesLabelOverride","variablesLabel","variablesPluralLabelOverride","variablesPluralLabel","setGeneFilter","resetUrls","newSelection","cellSetExpansion","setCellSetExpansion","upgradedCellSets","allCellIds","setCellSetColorEncoding","levelNodePaths","treeToExpectedCheckedLevel","targetKey","dropPath","dropNode","dropNodeIsLevelZero","dragPath","dropParentNode","dropParentPath","dropNodeCurrIndex","dragNodeName","newDragPath","insertIndex","newLevelZero","addChildFunction","checkPathFunction","newChildren","nodeInsertChild","newColors","newCellSetColor","levelZeroName","newCellSetSelection","prevNodeColor","nextNamePath","renameNode","nextCellSetSelection","nextCellSetExpansion","setsToView","viewNode","expandedPath","importAutoSetColors","exportData","csvString","json2csv","delimiter","handleExportTabular","setToExport","treeExportSet","treeToIntersection","primaryUnion","el","treeToComplement","observationsLabelOverride","observationsPluralLabelOverride","observationsPluralLabel","titleOverride","averageFillDensity","scatterplot","targetZ","embeddingTargetZ","cellRadiusFixed","embeddingCellRadiusMode","cellOpacityFixed","embeddingCellOpacity","embeddingCellOpacityMode","setEmbeddingZoom","setEmbeddingTargetX","setEmbeddingTargetY","setEmbeddingTargetZ","setCellFilter","setEmbeddingCellSetPolygonsVisible","setEmbeddingCellSetLabelsVisible","setEmbeddingCellSetLabelSize","setCellRadiusFixed","setEmbeddingCellRadius","setEmbeddingCellRadiusMode","setCellOpacityFixed","setEmbeddingCellOpacity","setEmbeddingCellOpacityMode","dynamicCellRadius","setDynamicCellRadius","dynamicCellOpacity","setDynamicCellOpacity","setCellSelectionProp","cellSetPolygonCache","setCellSetPolygonCache","newCellSetPolygons","cacheGet","cellValues","cellCoordinates","xE","yE","xRange","yRange","xExtent","yExtent","pointSizeDevicePixels","devicePixelRatio","pointScreenSizeMin","xAxisRange","yAxisRange","diagonalScreenSize","deviceSize","getPointSizeDevicePixels","nextCellOpacityScale","avgFillDensity","N","makeViewport","getBounds","maxX","X","Y","X0","Y0","W","H","rho","log10","alpha","getPointOpacity","newTargetX","newTargetY","subobservationsLabelOverride","subobservationsLabel","subobservationsPluralLabelOverride","subobservationsPluralLabel","spatial","spatialTargetZ","spatialRotationX","rotationY","spatialRotationY","rotationZ","spatialRotationZ","spatialRotationOrbit","spatialOrbitAxis","spatialNeighborhoodsLayer","setOrbitAxis","setSpatialOrbitAxis","setNeighborhoodsLayer","setSpatialNeighborhoodsLayer","setNeighborhoods","useNeighborhoodsData","canPassInCellsLayer","useRaster","initialTargetX","initialTargetY","initialTargetZ","initialZoom","zoomBackoff","viewSize","newViewStateZoom","getViewExtentFromPolygonExtents","extents","getInitialSpatialTargets","shiftedExpressionDataForBitmask","maxId","observationsCount","subobservationsCount","parts","part","shortNumber","makeSpatialSubtitle","hasExpressionData","hasCellsData","newOrbitAxis","heatmap","zoomX","heatmapZoomX","heatmapTargetX","heatmapTargetY","setZoomX","setHeatmapZoomX","setZoomY","setHeatmapZoomY","setHeatmapTargetX","setHeatmapTargetY","isRendering","genesCount","selectedCount","setColormapRange","cellSetSizes","profileTrackNameKey","higlassServer","assembly","genomicProfilesAttrs","setGenomicProfilesAttrs","useGenomicProfilesData","foregroundColor","dimColor","referenceTracks","referenceTracksHeightSum","sum","profileTrackHeight","row_infos","profileTracks","rowInfo","trackUid","isPath","trackName","setInSelection","trackUidString","track","barFillColor","expressionHistogram","subarray","cellSetExpression","geneExpressionTransform","setGeneExpressionTransform","setArr","getExistingScopesForCoordinationType","spaceScopes","componentScopes","initializeAuto","scopeValue","newScopes","scopeName","coordinateComponentsIndependent","coordinateComponentsTogether","generateClassName","createGenerateClassName","disableGlobal","Vitessce","oldConfig","fromVersion","upgradeFunction","validateFunction","nextConfig","groupCollapsed","groupEnd","upgradeAndValidate","upgradedConfig","configOrWarning","success","StylesProvider","ThemeProvider","createStore","AwaitResponse","responseRef","preformattedDetails","statusText","redirected","react","render","getElementById","renderComponent","datasetId","URLSearchParams","location","search","responsePromise","replaceAll","checkResponse","createApp","exports","require"],"mappings":"iPAGO,SAASA,EAAYC,GAC1B,OAAO,YAAIA,GACRC,QAAO,SAACC,EAAD,OAAWC,EAAX,EAAQ,GAAWC,EAAnB,EAAgB,GAAhB,OAA6BC,OAAOC,OAAOJ,EAAdG,OAAA,IAAAA,CAAA,GAAsBF,EAAMC,MAAQ,IAWtE,SAASG,EAAUC,EAAUC,EAAQC,GAC1C,OAAkB,IAAVA,EAAcF,EAAWC,EAQ5B,SAASE,EAAWC,GACzB,OAAOA,EAAKC,OAAO,GAAGC,cAAgBF,EAAKG,MAAM,GAa5C,SAASC,EAAaC,GAE3B,IA8BIC,EA9BEC,EAAQ,6BAIRC,EAAkB,CAAC,GAKzB,SAASC,IACP,IAAMC,EAAI,GACVF,EAAgBG,SAAQ,SAACC,GACvBF,EAAEG,QAAQN,EAAMK,OAGlB,IADA,IAAIE,GAAY,EACPC,EAAI,EAAGA,EAAIP,EAAgBQ,OAAQD,IAAK,CAE/C,OADcP,EAAgBO,IACnBR,EAAMS,QAEV,CACLF,GAAY,EACZ,MAHAN,EAAgBO,GAAK,EASzB,OAHID,GACFN,EAAgBS,KAAK,GAEhBP,EAAEQ,KAAK,IAIhB,GACEZ,EAAYG,UACLJ,EAAWc,SAASb,IAC7B,OAAOA,EAUF,SAASc,EAAoBC,EAAQC,GAAQ,IAC1CC,EAASF,EAATE,KAER,OADeC,MAAMC,QAAQF,GAAQA,EAAMD,GAASC,EAAKP,OAAS,GAAMO,EAQnE,SA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js","sourcesContent":["/* eslint-disable no-plusplus */\n\n// Adapted from https://github.com/feross/fromentries/blob/29b52a850bb3a47c390937631c2638edf3443942/index.js\nexport function fromEntries(iterable) {\n return [...iterable]\n .reduce((obj, { 0: key, 1: val }) => Object.assign(obj, { [key]: val }), {});\n}\n\n/**\n * Select between a singular and plural version of a word,\n * based on an item count.\n * @param {string} singular The singular version of the word.\n * @param {string} plural The plural version of the word.\n * @param {number} count The number of items.\n * @returns {string} Singular if count is one, else plural.\n */\nexport function pluralize(singular, plural, count) {\n return (count === 1 ? singular : plural);\n}\n\n/**\n * Capitalize a the first letter of a string.\n * @param {string} word A string to capitalize.\n * @returns {string} The word parameter with the first letter capitalized.\n */\nexport function capitalize(word) {\n return word.charAt(0).toUpperCase() + word.slice(1);\n}\n\n/**\n * Generate a new scope name which does not\n * conflict / overlap with a previous scope name.\n * Really these just need to be unique within the coordination object.\n * So in theory they could be String(Math.random()) or uuidv4() or something.\n * However it may be good to make them more human-readable and memorable\n * since eventually we will want to expose a UI to update the coordination.\n * @param {string[]} prevScopes Previous scope names.\n * @returns {string} The new scope name.\n */\nexport function getNextScope(prevScopes) {\n // Keep an ordered list of valid characters.\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n // Store the value of the next character for each position\n // in the new string.\n // For example, [0] -> \"A\", [1] -> \"B\", [0, 1] -> \"AB\"\n const nextCharIndices = [0];\n\n // Generate a new scope name,\n // potentially conflicting with an existing name.\n // Reference: https://stackoverflow.com/a/12504061\n function next() {\n const r = [];\n nextCharIndices.forEach((charIndex) => {\n r.unshift(chars[charIndex]);\n });\n let increment = true;\n for (let i = 0; i < nextCharIndices.length; i++) {\n const val = ++nextCharIndices[i];\n if (val >= chars.length) {\n nextCharIndices[i] = 0;\n } else {\n increment = false;\n break;\n }\n }\n if (increment) {\n nextCharIndices.push(0);\n }\n return r.join('');\n }\n\n let nextScope;\n do {\n nextScope = next();\n } while (prevScopes.includes(nextScope));\n return nextScope;\n}\n\n/**\n * Get a representative PixelSource from a loader object returned from\n * the Vitessce imaging loaders\n * @param {object} loader { data: (PixelSource[]|PixelSource), metadata, channels } object\n * @param {number=} level Level of the multiscale loader from which to get a PixelSource\n * @returns {object} PixelSource object\n */\nexport function getSourceFromLoader(loader, level) {\n const { data } = loader;\n const source = Array.isArray(data) ? data[(level || data.length - 1)] : data;\n return source;\n}\n\n/*\n * Helper method to determine whether pixel data is interleaved and rgb or not.\n * @param {object} loader\n */\nexport function isRgb(loader) {\n const source = getSourceFromLoader(loader);\n const { shape, dtype, labels } = source;\n const channelSize = shape[labels.indexOf('c')];\n return (channelSize === 3) && dtype === 'Uint8';\n}\n","export const Component = {\n DESCRIPTION: 'description',\n STATUS: 'status',\n GENES: 'genes',\n CELL_SETS: 'cellSets',\n SCATTERPLOT: 'scatterplot',\n SPATIAL: 'spatial',\n HEATMAP: 'heatmap',\n LAYER_CONTROLLER: 'layerController',\n CELL_SET_SIZES: 'cellSetSizes',\n GENOMIC_PROFILES: 'genomicProfiles',\n CELL_SET_EXPRESSION: 'cellSetExpression',\n EXPRESSION_HISTOGRAM: 'expressionHistogram',\n};\n\nexport const DataType = {\n CELLS: 'cells',\n CELL_SETS: 'cell-sets',\n EXPRESSION_MATRIX: 'expression-matrix',\n GENOMIC_PROFILES: 'genomic-profiles',\n MOLECULES: 'molecules',\n NEIGHBORHOODS: 'neighborhoods',\n RASTER: 'raster',\n};\n\nexport const FileType = {\n CELLS_JSON: 'cells.json',\n CELL_SETS_JSON: 'cell-sets.json',\n EXPRESSION_MATRIX_ZARR: 'expression-matrix.zarr',\n GENOMIC_PROFILES_ZARR: 'genomic-profiles.zarr',\n MOLECULES_JSON: 'molecules.json',\n NEIGHBORHOODS_JSON: 'neighborhoods.json',\n RASTER_JSON: 'raster.json',\n RASTER_OME_ZARR: 'raster.ome-zarr',\n CLUSTERS_JSON: 'clusters.json',\n GENES_JSON: 'genes.json',\n ANNDATA_CELL_SETS_ZARR: 'anndata-cell-sets.zarr',\n ANNDATA_CELLS_ZARR: 'anndata-cells.zarr',\n ANNDATA_EXPRESSION_MATRIX_ZARR: 'anndata-expression-matrix.zarr',\n};\n\n/**\n * Constants representing names of coordination types,\n * to help prevent typos.\n */\nexport const CoordinationType = {\n DATASET: 'dataset',\n EMBEDDING_TYPE: 'embeddingType',\n EMBEDDING_ZOOM: 'embeddingZoom',\n EMBEDDING_ROTATION: 'embeddingRotation',\n EMBEDDING_TARGET_X: 'embeddingTargetX',\n EMBEDDING_TARGET_Y: 'embeddingTargetY',\n EMBEDDING_TARGET_Z: 'embeddingTargetZ',\n EMBEDDING_CELL_SET_POLYGONS_VISIBLE: 'embeddingCellSetPolygonsVisible',\n EMBEDDING_CELL_SET_LABELS_VISIBLE: 'embeddingCellSetLabelsVisible',\n EMBEDDING_CELL_SET_LABEL_SIZE: 'embeddingCellSetLabelSize',\n EMBEDDING_CELL_RADIUS: 'embeddingCellRadius',\n EMBEDDING_CELL_RADIUS_MODE: 'embeddingCellRadiusMode',\n EMBEDDING_CELL_OPACITY: 'embeddingCellOpacity',\n EMBEDDING_CELL_OPACITY_MODE: 'embeddingCellOpacityMode',\n SPATIAL_ZOOM: 'spatialZoom',\n SPATIAL_ROTATION: 'spatialRotation',\n SPATIAL_TARGET_X: 'spatialTargetX',\n SPATIAL_TARGET_Y: 'spatialTargetY',\n SPATIAL_TARGET_Z: 'spatialTargetZ',\n SPATIAL_ROTATION_X: 'spatialRotationX',\n SPATIAL_ROTATION_Y: 'spatialRotationY',\n SPATIAL_ROTATION_Z: 'spatialRotationZ',\n SPATIAL_ROTATION_ORBIT: 'spatialRotationOrbit',\n SPATIAL_ORBIT_AXIS: 'spatialOrbitAxis',\n SPATIAL_AXIS_FIXED: 'spatialAxisFixed',\n HEATMAP_ZOOM_X: 'heatmapZoomX',\n HEATMAP_ZOOM_Y: 'heatmapZoomY',\n HEATMAP_TARGET_X: 'heatmapTargetX',\n HEATMAP_TARGET_Y: 'heatmapTargetY',\n CELL_FILTER: 'cellFilter',\n CELL_HIGHLIGHT: 'cellHighlight',\n CELL_SET_SELECTION: 'cellSetSelection',\n CELL_SET_HIGHLIGHT: 'cellSetHighlight',\n CELL_SET_COLOR: 'cellSetColor',\n GENE_FILTER: 'geneFilter',\n GENE_HIGHLIGHT: 'geneHighlight',\n GENE_SELECTION: 'geneSelection',\n GENE_EXPRESSION_COLORMAP: 'geneExpressionColormap',\n GENE_EXPRESSION_TRANSFORM: 'geneExpressionTransform',\n GENE_EXPRESSION_COLORMAP_RANGE: 'geneExpressionColormapRange',\n CELL_COLOR_ENCODING: 'cellColorEncoding',\n SPATIAL_RASTER_LAYERS: 'spatialRasterLayers',\n SPATIAL_CELLS_LAYER: 'spatialCellsLayer',\n SPATIAL_MOLECULES_LAYER: 'spatialMoleculesLayer',\n SPATIAL_NEIGHBORHOODS_LAYER: 'spatialNeighborhoodsLayer',\n GENOMIC_ZOOM_X: 'genomicZoomX',\n GENOMIC_ZOOM_Y: 'genomicZoomY',\n GENOMIC_TARGET_X: 'genomicTargetX',\n GENOMIC_TARGET_Y: 'genomicTargetY',\n ADDITIONAL_CELL_SETS: 'additionalCellSets',\n MOLECULE_HIGHLIGHT: 'moleculeHighlight',\n};\n","import { getNextScope, fromEntries } from '../utils';\nimport { CoordinationType } from '../app/constants';\n\n\n/**\n * Class representing a file within a Vitessce config dataset.\n */\nexport class VitessceConfigDatasetFile {\n /**\n * Construct a new file definition instance.\n * @param {string} url The URL to the file.\n * @param {string} dataType The type of data contained in the file.\n * @param {string} fileType The file type.\n * @param {object|array|null} options An optional object or array\n * which may provide additional parameters to the loader class\n * corresponding to the specified fileType.\n */\n constructor(url, dataType, fileType, options) {\n this.file = {\n url,\n type: dataType,\n fileType,\n ...(options !== null ? { options } : {}),\n };\n }\n\n /**\n * @returns {object} This dataset file as a JSON object.\n */\n toJSON() {\n return this.file;\n }\n}\n\n/**\n * Class representing a dataset within a Vitessce config.\n */\nexport class VitessceConfigDataset {\n /**\n * Construct a new dataset definition instance.\n * @param {string} uid The unique ID for the dataset.\n * @param {string} name The name of the dataset.\n * @param {string} description A description for the dataset.\n */\n constructor(uid, name, description) {\n this.dataset = {\n uid,\n name,\n description,\n files: [],\n };\n }\n\n /**\n * Add a file definition to the dataset.\n * @param {string|undefined} url The URL to the file.\n * @param {string} dataType The type of data contained in the file.\n * @param {string} fileType The file type.\n * @param {object|array} options An optional object or array\n * which may provide additional parameters to the loader class\n * corresponding to the specified fileType.\n * @returns {VitessceConfigDataset} This, to allow chaining.\n */\n addFile(url, dataType, fileType, options = null) {\n this.dataset.files.push(\n new VitessceConfigDatasetFile(url, dataType, fileType, options),\n );\n return this;\n }\n\n /**\n * @returns {object} This dataset as a JSON object.\n */\n toJSON() {\n return {\n ...this.dataset,\n files: this.dataset.files.map(f => f.toJSON()),\n };\n }\n}\n\n/**\n * Class representing a view within a Vitessce layout.\n */\nexport class VitessceConfigView {\n /**\n * Construct a new view instance.\n * @param {string} component The name of the Vitessce component type.\n * @param {object} coordinationScopes A mapping from coordination type\n * names to coordination scope names.\n * @param {number} x The x-coordinate of the view in the layout.\n * @param {number} y The y-coordinate of the view in the layout.\n * @param {number} w The width of the view in the layout.\n * @param {number} h The height of the view in the layout.\n */\n constructor(component, coordinationScopes, x, y, w, h) {\n this.view = {\n component,\n coordinationScopes,\n x,\n y,\n w,\n h,\n };\n }\n\n /**\n * Attach coordination scopes to this view.\n * @param {...VitessceConfigCoordinationScope} args A variable number of\n * coordination scope instances.\n * @returns {VitessceConfigView} This, to allow chaining.\n */\n useCoordination(...args) {\n const cScopes = args;\n cScopes.forEach((cScope) => {\n this.view.coordinationScopes[cScope.cType] = cScope.cScope;\n });\n return this;\n }\n\n /**\n * Set the x, y, w, h values for this view.\n * @param {number} x The x-coordinate of the view in the layout.\n * @param {number} y The y-coordinate of the view in the layout.\n * @param {number} w The width of the view in the layout.\n * @param {number} h The height of the view in the layout.\n * @returns {VitessceConfigView} This, to allow chaining.\n */\n setXYWH(x, y, w, h) {\n this.view.x = x;\n this.view.y = y;\n this.view.w = w;\n this.view.h = h;\n\n return this;\n }\n\n /**\n * Set props for this view.\n * @returns {VitessceConfigView} This, to allow chaining.\n */\n setProps(props) {\n this.view.props = {\n ...(this.view.props || {}),\n ...props,\n };\n return this;\n }\n\n /**\n * @returns {object} This view as a JSON object.\n */\n toJSON() {\n return this.view;\n }\n}\n\n/**\n * Class representing a horizontal concatenation of views.\n */\nexport class VitessceConfigViewHConcat {\n constructor(views) {\n this.views = views;\n }\n}\n\n/**\n * Class representing a vertical concatenation of views.\n */\nexport class VitessceConfigViewVConcat {\n constructor(views) {\n this.views = views;\n }\n}\n\n/**\n * A helper function to create a horizontal concatenation of views.\n * @param {...(VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat)} views A\n * variable number of views or view concatenations.\n * @returns {VitessceConfigViewHConcat} A new horizontal view concatenation instance.\n */\nexport function hconcat(...views) {\n const vcvhc = new VitessceConfigViewHConcat(views);\n return vcvhc;\n}\n\n/**\n * A helper function to create a vertical concatenation of views.\n * @param {...(VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat)} views A\n * variable number of views or view concatenations.\n * @returns {VitessceConfigViewVConcat} A new vertical view concatenation instance.\n */\nexport function vconcat(...views) {\n const vcvvc = new VitessceConfigViewVConcat(views);\n return vcvvc;\n}\n\n/**\n * Class representing a coordination scope in the coordination space.\n */\nexport class VitessceConfigCoordinationScope {\n /**\n * Construct a new coordination scope instance.\n * @param {string} cType The coordination type for this coordination scope.\n * @param {string} cScope The name of the coordination scope.\n */\n constructor(cType, cScope) {\n this.cType = cType;\n this.cScope = cScope;\n this.cValue = null;\n }\n\n /**\n * Set the coordination value of the coordination scope.\n * @param {any} cValue The value to set.\n * @returns {VitessceConfigCoordinationScope} This, to allow chaining.\n */\n setValue(cValue) {\n this.cValue = cValue;\n return this;\n }\n}\n\n/**\n * Class representing a Vitessce view config.\n */\nexport class VitessceConfig {\n /**\n * Construct a new view config instance.\n * @param {string} name A name for the config. Optional.\n * @param {string} description A description for the config. Optional.\n */\n constructor(name = undefined, description = undefined) {\n this.config = {\n version: '1.0.4',\n name,\n description,\n datasets: [],\n coordinationSpace: {},\n layout: [],\n initStrategy: 'auto',\n };\n }\n\n /**\n * Add a new dataset to the config.\n * @param {string} name A name for the dataset. Optional.\n * @param {string} description A description for the dataset. Optional.\n * @param {object} options Extra parameters to be used internally. Optional.\n * @param {string} options.uid Override the automatically-generated dataset ID.\n * Intended for internal usage by the VitessceConfig.fromJSON code.\n * @returns {VitessceConfigDataset} A new dataset instance.\n */\n addDataset(name = undefined, description = undefined, options = undefined) {\n const { uid } = options || {};\n const prevDatasetUids = this.config.datasets.map(d => d.dataset.uid);\n const nextUid = (uid || getNextScope(prevDatasetUids));\n const newDataset = new VitessceConfigDataset(nextUid, name, description);\n this.config.datasets.push(newDataset);\n const [newScope] = this.addCoordination(CoordinationType.DATASET);\n newScope.setValue(nextUid);\n return newDataset;\n }\n\n /**\n * Add a new view to the config.\n * @param {VitessceConfigDataset} dataset The dataset instance which defines the data\n * that will be displayed in the view.\n * @param {string} component A component name, such as \"scatterplot\" or \"spatial\".\n * @param {object} options Extra options for the component.\n * @param {number} options.x The x-coordinate for the view in the grid layout.\n * @param {number} options.y The y-coordinate for the view in the grid layout.\n * @param {number} options.w The width for the view in the grid layout.\n * @param {number} options.h The height for the view in the grid layout.\n * @param {number} options.mapping A convenience parameter for setting the EMBEDDING_TYPE\n * coordination value. Only applicable if the component is \"scatterplot\".\n * @returns {VitessceConfigView} A new view instance.\n */\n addView(dataset, component, options) {\n const {\n x = 0,\n y = 0,\n w = 1,\n h = 1,\n mapping = null,\n } = options || {};\n const datasetMatches = (\n this.config.coordinationSpace[CoordinationType.DATASET]\n ? Object.entries(this.config.coordinationSpace[CoordinationType.DATASET])\n // eslint-disable-next-line no-unused-vars\n .filter(([scopeName, datasetScope]) => datasetScope.cValue === dataset.dataset.uid)\n .map(([scopeName]) => scopeName)\n : []\n );\n let datasetScope;\n if (datasetMatches.length === 1) {\n [datasetScope] = datasetMatches;\n } else {\n throw new Error('No coordination scope matching the dataset parameter could be found in the coordination space.');\n }\n const coordinationScopes = {\n [CoordinationType.DATASET]: datasetScope,\n };\n const newView = new VitessceConfigView(component, coordinationScopes, x, y, w, h);\n if (mapping) {\n const [etScope] = this.addCoordination(CoordinationType.EMBEDDING_TYPE);\n etScope.setValue(mapping);\n newView.useCoordination(etScope);\n }\n this.config.layout.push(newView);\n return newView;\n }\n\n /**\n * Get an array of new coordination scope instances corresponding to coordination types\n * of interest.\n * @param {...string} args A variable number of coordination type names.\n * @returns {VitessceConfigCoordinationScope[]} An array of coordination scope instances.\n */\n addCoordination(...args) {\n const cTypes = args;\n const result = [];\n cTypes.forEach((cType) => {\n const prevScopes = (\n this.config.coordinationSpace[cType]\n ? Object.keys(this.config.coordinationSpace[cType])\n : []\n );\n const scope = new VitessceConfigCoordinationScope(cType, getNextScope(prevScopes));\n if (!this.config.coordinationSpace[scope.cType]) {\n this.config.coordinationSpace[scope.cType] = {};\n }\n this.config.coordinationSpace[scope.cType][scope.cScope] = scope;\n result.push(scope);\n });\n return result;\n }\n\n /**\n * A convenience function for setting up new coordination scopes across a set of views.\n * @param {VitessceConfigView[]} views An array of view objects to link together.\n * @param {string[]} cTypes The coordination types on which to coordinate the views.\n * @param {any[]} cValues Initial values corresponding to each coordination type.\n * Should have the same length as the cTypes array. Optional.\n * @returns {VitessceConfig} This, to allow chaining.\n */\n linkViews(views, cTypes, cValues = null) {\n const cScopes = this.addCoordination(...cTypes);\n views.forEach((view) => {\n cScopes.forEach((cScope) => {\n view.useCoordination(cScope);\n });\n });\n if (Array.isArray(cValues) && cValues.length === cTypes.length) {\n cScopes.forEach((cScope, i) => {\n cScope.setValue(cValues[i]);\n });\n }\n return this;\n }\n\n /**\n * Set the layout of views.\n * @param {VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat} viewConcat A\n * view or a concatenation of views.\n * @returns {VitessceConfig} This, to allow chaining.\n */\n layout(viewConcat) {\n function layoutAux(obj, xMin, xMax, yMin, yMax) {\n const w = xMax - xMin;\n const h = yMax - yMin;\n if (obj instanceof VitessceConfigView) {\n obj.setXYWH(xMin, yMin, w, h);\n } else if (obj instanceof VitessceConfigViewHConcat) {\n const { views } = obj;\n const numViews = views.length;\n views.forEach((view, i) => {\n layoutAux(view, xMin + (w / numViews) * i, xMin + (w / numViews) * (i + 1), yMin, yMax);\n });\n } else if (obj instanceof VitessceConfigViewVConcat) {\n const { views } = obj;\n const numViews = views.length;\n views.forEach((view, i) => {\n layoutAux(view, xMin, xMax, yMin + (h / numViews) * i, yMin + (h / numViews) * (i + 1));\n });\n }\n }\n\n layoutAux(viewConcat, 0, 12, 0, 12);\n\n return this;\n }\n\n /**\n * Convert this instance to a JSON object that can be passed to the Vitessce component.\n * @returns {object} The view config as a JSON object.\n */\n toJSON() {\n return {\n ...this.config,\n datasets: this.config.datasets.map(d => d.toJSON()),\n coordinationSpace: fromEntries(\n Object.entries(this.config.coordinationSpace).map(([cType, cScopes]) => ([\n cType,\n fromEntries(\n Object.entries(cScopes).map(([cScopeName, cScope]) => ([\n cScopeName,\n cScope.cValue,\n ])),\n ),\n ])),\n ),\n layout: this.config.layout.map(c => c.toJSON()),\n };\n }\n\n /**\n * Create a VitessceConfig instance from an existing view config, to enable\n * manipulation with the JavaScript API.\n * @param {object} config An existing Vitessce view config as a JSON object.\n * @returns {VitessceConfig} A new config instance, with values set to match\n * the config parameter.\n */\n static fromJSON(config) {\n const { name, description } = config;\n const vc = new VitessceConfig(name, description);\n config.datasets.forEach((d) => {\n const newDataset = vc.addDataset(d.name, d.description, { uid: d.uid });\n d.files.forEach((f) => {\n newDataset.addFile(\n f.url,\n f.type,\n f.fileType,\n );\n });\n });\n Object.keys(config.coordinationSpace).forEach((cType) => {\n if (cType !== CoordinationType.DATASET) {\n const cObj = config.coordinationSpace[cType];\n vc.config.coordinationSpace[cType] = {};\n Object.entries(cObj).forEach(([cScopeName, cScopeValue]) => {\n const scope = new VitessceConfigCoordinationScope(cType, cScopeName);\n scope.setValue(cScopeValue);\n vc.config.coordinationSpace[cType][cScopeName] = scope;\n });\n }\n });\n config.layout.forEach((c) => {\n const newView = new VitessceConfigView(c.component, c.coordinationScopes, c.x, c.y, c.w, c.h);\n vc.config.layout.push(newView);\n });\n return vc;\n }\n}\n","import {\n VitessceConfig, hconcat, vconcat,\n} from '../api/index';\nimport {\n Component as cm,\n DataType as dt,\n FileType as ft,\n CoordinationType as ct,\n} from '../app/constants';\n\n// Exported because used by the cypress tests: They route API requests to the fixtures instead.\nexport const urlPrefix = 'https://s3.amazonaws.com/vitessce-data/0.0.31/master_release';\n\nexport function makeDatasetNameToJsonFiles(datasetPrefix) {\n return name => ({\n type: name,\n fileType: `${name}.json`,\n url: `${urlPrefix}/${datasetPrefix}/${datasetPrefix}.${name}.json`,\n });\n}\n\nexport function getS3Url(datasetPrefix, name) {\n return `${urlPrefix}/${datasetPrefix}/${datasetPrefix}.${name}.json`;\n}\n\nexport function notPublic(config) {\n return {\n ...config,\n public: undefined,\n };\n}\n\nexport const vapi = {\n VitessceConfig,\n hconcat,\n vconcat,\n cm,\n dt,\n ft,\n ct,\n};\n","import {\n makeDatasetNameToJsonFiles,\n getS3Url, vapi,\n} from '../utils';\n\n\nconst linnarssonDataTypes = [\n 'cells',\n 'cell-sets',\n 'raster',\n 'molecules',\n 'neighborhoods',\n];\nconst linnarssonName = 'Codeluppi et al., Nature Methods 2018';\nconst linnarssonDescription = 'Spatial organization of the somatosensory cortex revealed by osmFISH';\nconst linnarssonBase = {\n name: linnarssonName,\n description: linnarssonDescription,\n version: '1.0.0',\n initStrategy: 'auto',\n datasets: [\n {\n uid: 'codeluppi',\n name: 'Codeluppi',\n files: [\n ...linnarssonDataTypes.map(makeDatasetNameToJsonFiles('linnarsson')),\n {\n ...makeDatasetNameToJsonFiles('linnarsson')('clusters'),\n type: 'expression-matrix',\n },\n ],\n },\n ],\n};\n\nconst linnarssonBaseNoMolecules = {\n name: linnarssonName,\n description: linnarssonDescription,\n version: '1.0.0',\n initStrategy: 'auto',\n datasets: [\n {\n uid: 'codeluppi',\n name: 'Codeluppi',\n files: [\n ...linnarssonDataTypes.filter(dtype => dtype !== 'molecules').map(makeDatasetNameToJsonFiles('linnarsson')),\n {\n ...makeDatasetNameToJsonFiles('linnarsson')('clusters'),\n type: 'expression-matrix',\n },\n ],\n },\n ],\n};\n\nexport const justScatter = {\n version: '1.0.0',\n name: 'Codeluppi, just scatterplot',\n public: false,\n initStrategy: 'auto',\n datasets: [\n {\n uid: 'codeluppi',\n name: 'Codeluppi',\n files: [\n {\n ...makeDatasetNameToJsonFiles('linnarsson')('cells'),\n requestInit: {\n // Where the client checks that the value is from an enumeration,\n // I've chosen one of the allowed values,\n // but nothing on our S3 actually needs any of these.\n method: 'GET',\n headers: { 'x-foo': 'FAKE' },\n mode: 'cors',\n credentials: 'omit',\n cache: 'no-store',\n redirect: 'error',\n referrer: 'FAKE',\n integrity: 'FAKE',\n },\n },\n ],\n },\n ],\n coordinationSpace: {\n embeddingType: {\n A: 't-SNE',\n },\n embeddingZoom: {\n A: 0.75,\n },\n },\n layout: [\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'A',\n embeddingZoom: 'A',\n },\n x: 0,\n y: 0,\n w: 12,\n h: 2,\n },\n ],\n};\n\nexport const justScatterExpression = {\n version: '1.0.0',\n name: 'Codeluppi, just scatterplot and expression',\n public: false,\n initStrategy: 'auto',\n datasets: [\n {\n uid: 'codeluppi',\n name: 'Codeluppi',\n files: [\n makeDatasetNameToJsonFiles('linnarsson')('cells'),\n makeDatasetNameToJsonFiles('linnarsson')('genes'),\n ],\n },\n ],\n coordinationSpace: {\n embeddingType: {\n A: 't-SNE',\n },\n embeddingZoom: {\n A: 0.75,\n },\n },\n layout: [\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'A',\n embeddingZoom: 'A',\n },\n x: 0,\n y: 0,\n w: 12,\n h: 2,\n },\n {\n component: 'genes',\n x: 8,\n y: 2,\n w: 4,\n h: 2,\n },\n ],\n};\n\nexport const justSpatial = {\n ...linnarssonBase,\n coordinationSpace: {\n spatialZoom: {\n A: -6.5,\n },\n spatialTargetX: {\n A: 18000,\n },\n spatialTargetY: {\n A: 18000,\n },\n },\n layout: [\n {\n component: 'spatial',\n coordinationScopes: {\n spatialZoom: 'A',\n spatialTargetX: 'A',\n spatialTargetY: 'A',\n },\n x: 0,\n y: 0,\n w: 10,\n h: 2,\n },\n {\n component: 'genes',\n x: 10,\n y: 1,\n w: 2,\n h: 1,\n },\n ],\n};\n\nexport const codeluppi2018 = {\n ...linnarssonBase,\n public: true,\n coordinationSpace: {\n embeddingZoom: {\n PCA: 0,\n TSNE: 0.75,\n },\n embeddingType: {\n PCA: 'PCA',\n TSNE: 't-SNE',\n },\n spatialZoom: {\n A: -5.5,\n },\n spatialTargetX: {\n A: 16000,\n },\n spatialTargetY: {\n A: 20000,\n },\n },\n layout: [\n {\n component: 'description',\n props: {\n description: `${linnarssonName}: ${linnarssonDescription}`,\n },\n x: 0,\n y: 0,\n w: 2,\n h: 1,\n },\n {\n component: 'layerController',\n x: 0,\n y: 1,\n w: 2,\n h: 4,\n },\n {\n component: 'status',\n x: 0,\n y: 5,\n w: 2,\n h: 1,\n },\n {\n component: 'spatial',\n coordinationScopes: {\n spatialZoom: 'A',\n spatialTargetX: 'A',\n spatialTargetY: 'A',\n },\n x: 2,\n y: 0,\n w: 4,\n h: 4,\n },\n {\n component: 'genes',\n x: 9,\n y: 0,\n w: 3,\n h: 2,\n },\n {\n component: 'cellSets',\n x: 9,\n y: 3,\n w: 3,\n h: 2,\n },\n {\n component: 'heatmap',\n props: {\n transpose: true,\n },\n x: 2,\n y: 4,\n w: 5,\n h: 2,\n },\n {\n component: 'cellSetExpression',\n x: 7,\n y: 4,\n w: 5,\n h: 2,\n },\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'PCA',\n embeddingZoom: 'PCA',\n },\n x: 6,\n y: 0,\n w: 3,\n h: 2,\n },\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'TSNE',\n embeddingZoom: 'TSNE',\n },\n x: 6,\n y: 2,\n w: 3,\n h: 2,\n },\n ],\n};\n\nexport const linnarssonWithRorb = {\n ...linnarssonBaseNoMolecules,\n coordinationSpace: {\n embeddingZoom: {\n PCA: 0,\n TSNE: 0.75,\n },\n embeddingType: {\n PCA: 'PCA',\n TSNE: 't-SNE',\n },\n spatialZoom: {\n A: -5.5,\n },\n spatialTargetX: {\n A: 16000,\n },\n spatialTargetY: {\n A: 20000,\n },\n geneSelection: {\n A: ['Rorb'],\n },\n geneExpressionColormapRange: {\n A: [0, 0.75],\n },\n },\n layout: [\n {\n component: 'description',\n props: {\n description: `${linnarssonName}: ${linnarssonDescription}`,\n },\n x: 0,\n y: 0,\n w: 2,\n h: 2,\n },\n {\n component: 'layerController',\n x: 0,\n y: 2,\n w: 2,\n h: 4,\n },\n {\n component: 'spatial',\n coordinationScopes: {\n spatialZoom: 'A',\n spatialTargetX: 'A',\n spatialTargetY: 'A',\n geneSelection: 'A',\n },\n x: 2,\n y: 0,\n w: 4,\n h: 4,\n },\n {\n component: 'genes',\n coordinationScopes: {\n geneSelection: 'A',\n },\n x: 9,\n y: 0,\n w: 3,\n h: 2,\n },\n {\n component: 'cellSets',\n x: 9,\n y: 3,\n w: 3,\n h: 2,\n },\n {\n component: 'heatmap',\n coordinationScopes: {\n geneSelection: 'A',\n geneExpressionColormapRange: 'A',\n },\n props: {\n transpose: true,\n },\n x: 2,\n y: 4,\n w: 10,\n h: 2,\n },\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'TSNE',\n embeddingZoom: 'TSNE',\n geneSelection: 'A',\n },\n x: 6,\n y: 0,\n w: 3,\n h: 4,\n },\n ],\n};\n\nexport function getCodeluppiViewConfig(name, description) {\n const vc = new vapi.VitessceConfig(name, description);\n const dataset = vc.addDataset(linnarssonName, linnarssonDescription)\n .addFile(getS3Url('linnarsson', 'cells'), vapi.dt.CELLS, vapi.ft.CELLS_JSON)\n .addFile(getS3Url('linnarsson', 'cell-sets'), vapi.dt.CELL_SETS, vapi.ft.CELL_SETS_JSON)\n .addFile(getS3Url('linnarsson', 'raster'), vapi.dt.RASTER, vapi.ft.RASTER_JSON)\n .addFile(getS3Url('linnarsson', 'molecules'), vapi.dt.MOLECULES, vapi.ft.MOLECULES_JSON);\n return [vc, dataset];\n}\n","import {\n makeDatasetNameToJsonFiles,\n getS3Url, vapi,\n} from '../utils';\n\nconst driesName = 'Eng et al., Nature 2019';\nconst driesDescription = 'Transcriptome-scale super-resolved imaging in tissues by RNA seqFISH';\n\nexport const eng2019 = {\n name: driesName,\n version: '1.0.0',\n description: driesDescription,\n public: true,\n datasets: [\n {\n uid: 'dries-2019',\n name: 'Dries 2019',\n files: [\n 'cells',\n 'cell-sets',\n ].map(makeDatasetNameToJsonFiles('dries')),\n },\n ],\n initStrategy: 'auto',\n coordinationSpace: {\n embeddingType: {\n TSNE: 't-SNE',\n UMAP: 'UMAP',\n },\n embeddingCellSetPolygonsVisible: {\n A: false,\n },\n embeddingCellSetLabelsVisible: {\n A: true,\n },\n embeddingCellSetLabelSize: {\n A: 16,\n },\n embeddingCellRadius: {\n A: 1,\n },\n embeddingZoom: {\n TSNE: 3,\n UMAP: 3,\n },\n spatialZoom: {\n A: -4.4,\n },\n spatialTargetX: {\n A: 3800,\n },\n spatialTargetY: {\n A: -900,\n },\n },\n layout: [\n {\n component: 'description',\n props: {\n description: `${driesName}: ${driesDescription}`,\n },\n x: 9,\n y: 0,\n w: 3,\n h: 2,\n },\n {\n component: 'status',\n x: 9,\n y: 2,\n w: 3,\n h: 2,\n },\n {\n component: 'cellSets',\n x: 9,\n y: 4,\n w: 3,\n h: 4,\n },\n {\n component: 'cellSetSizes',\n x: 5,\n y: 4,\n w: 4,\n h: 4,\n },\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'TSNE',\n embeddingZoom: 'TSNE',\n embeddingCellSetLabelsVisible: 'A',\n embeddingCellSetLabelSize: 'A',\n embeddingCellSetPolygonsVisible: 'A',\n embeddingCellRadius: 'A',\n },\n x: 0,\n y: 2,\n w: 5,\n h: 4,\n },\n {\n component: 'spatial',\n props: {\n cellRadius: 50,\n },\n coordinationScopes: {\n spatialZoom: 'A',\n spatialTargetX: 'A',\n spatialTargetY: 'A',\n },\n x: 5,\n y: 0,\n w: 4,\n h: 4,\n },\n {\n component: 'scatterplot',\n coordinationScopes: {\n embeddingType: 'UMAP',\n embeddingZoom: 'UMAP',\n embeddingCellSetLabelsVisible: 'A',\n embeddingCellSetLabelSize: 'A',\n embeddingCellSetPolygonsVisible: 'A',\n embeddingCellRadius: 'A',\n },\n x: 0,\n y: 0,\n w: 5,\n h: 4,\n },\n ],\n};\n\nexport function getEngViewConfig(name, description) {\n const vc = new vapi.VitessceConfig(name, description);\n const dataset = vc.addDataset(driesName, driesDescription)\n .addFile(getS3Url('dries', 'cells'), vapi.dt.CELLS, vapi.ft.CELLS_JSON)\n .addFile(getS3Url('dries', 'cell-sets'), vapi.dt.CELL_SETS, vapi.ft.CELL_SETS_JSON);\n return [vc, dataset];\n}\n","import { makeDatasetNameToJsonFiles } from '../utils';\n\nconst wangName = 'Wang et al., Scientific Reports 2018';\nconst wangDescription = 'Multiplexed imaging of high-density libraries of RNAs with MERFISH and expansion microscopy';\n\nexport const wang2018 = {\n name: wangName,\n version: '1.0.0',\n description: wangDescription,\n public: true,\n datasets: [\n {\n uid: 'wang-2018',\n name: 'Wang 2018',\n files: [\n ...[\n 'cells', 'molecules',\n ].map(makeDatasetNameToJsonFiles('wang')),\n {\n ...makeDatasetNameToJsonFiles('wang')('genes'),\n type: 'expression-matrix',\n },\n ],\n },\n ],\n initStrategy: 'auto',\n coordinationSpace: {\n spatialZoom: {\n A: -1,\n },\n spatialLayers: {\n A: [\n {\n type: 'molecules', radius: 2, opacity: 1, visible: true,\n },\n {\n type: 'cells', opacity: 1, radius: 50, visible: true, stroked: false,\n },\n ],\n },\n },\n layout: [\n {\n component: 'spatial',\n coordinationScopes: {\n spatialZoom: 'A',\n spatialLayers: 'A',\n },\n x: 0,\n y: 0,\n w: 10,\n h: 2,\n },\n {\n component: 'genes',\n x: 10,\n y: 0,\n w: 2,\n h: 2,\n },\n ],\n};\n","import { urlPrefix } from '../utils';\n\nconst vanderbiltDescription = 'High bit depth (uint16) multiplex immunofluorescence images of the kidney by the BIOmolecular Multimodal Imaging Center (BIOMIC) at Vanderbilt University';\nconst vanderbiltBase = {\n description: vanderbiltDescription,\n layers: [\n {\n name: 'raster',\n type: 'RASTER',\n fileType: 'raster.json',\n url: `${urlPrefix}/spraggins/spraggins.raster.json`,\n },\n ],\n};\n\nexport const spraggins2020 = {\n ...vanderbiltBase,\n version: '0.1.0',\n name: 'Spraggins',\n public: true,\n staticLayout: [\n {\n component: 'spatial',\n props: {\n view: {\n zoom: -6.5,\n target: [20000, 20000, 0],\n },\n },\n x: 0,\n y: 0,\n w: 9,\n h: 2,\n },\n {\n component: 'layerController',\n x: 9,\n y: 0,\n w: 3,\n h: 2,\n },\n ],\n};\n\nexport const neumann2020 = {\n version: '1.0.1',\n name: 'Neumann et al., 2020',\n description: 'Four registered imaging modalities (PAS, IMS, AF) from HuBMAP collection HBM876.XNRH.336',\n datasets: [\n {\n uid: 'A',\n name: 'Spraggins',\n files: [\n {\n type: 'raster',\n fileType: 'raster.json',\n options: {\n schemaVersion: '0.0.2',\n images: [\n {\n name: 'PAS',\n type: 'ome-tiff',\n url: 'https://assets.hubmapconsortium.org/f4188a148e4c759092d19369d310883b/ometiff-pyramids/processedMicroscopy/VAN0006-LK-2-85-PAS_images/VAN0006-LK-2-85-PAS_registered.ome.tif?token=',\n },\n {\n name: 'AF',\n type: 'ome-tiff',\n url: 'https://assets.hubmapconsortium.org/2130d5f91ce61d7157a42c0497b06de8/ometiff-pyramids/processedMicroscopy/VAN0006-LK-2-85-AF_preIMS_images/VAN0006-LK-2-85-AF_preIMS_registered.ome.tif?token=',\n },\n {\n name: 'IMS PosMode',\n type: 'ome-tiff',\n url: 'https://assets.hubmapconsortium.org/be503a021ed910c0918842e318e6efa2/ometiff-pyramids/ometiffs/VAN0006-LK-2-85-IMS_PosMode_multilayer.ome.tif?token=',\n },\n {\n name: 'IMS NegMode',\n type: 'ome-tiff',\n url: 'https://assets.hubmapconsortium.org/ca886a630b2038997a4cfbbf4abfd283/ometiff-pyramids/ometiffs/VAN0006-LK-2-85-IMS_NegMode_multilayer.ome.tif?token=',\n },\n ],\n usePhysicalSizeScaling: true,\n renderLayers: [\n 'PAS',\n 'AF',\n 'IMS PosMode',\n 'IMS NegMode',\n ],\n },\n },\n ],\n },\n ],\n coordinationSpace: {},\n layout: [\n {\n component: 'spatial',\n coordinationScopes: {},\n x: 0,\n y: 0,\n w: 9,\n h: 12,\n },\n {\n component: 'layerController',\n coordinationScopes: {},\n x: 9,\n y: 0,\n w: 3,\n h: 12,\n },\n ],\n initStrategy: 'auto',\n};\n","\n\nconst satijaName = 'HBM336.FWTN.636';\nconst satijaDescription = 'Spleen scRNA-seq HuBMAP dataset with cell type annotations generated by the Satija lab and the Seurat v3.1 Label Transfer workflow';\nexport const satija2020 = {\n version: '1.0.0',\n name: satijaName,\n description: satijaDescription,\n public: true,\n datasets: [\n {\n uid: '339952f4-a47f-46dc-9228-18ba2ca256f2',\n name: '339952f4-a47f-46dc-9228-18ba2ca256f2',\n files: [\n {\n type: 'cells',\n fileType: 'cells.json',\n url: 'https://s3.amazonaws.com/vitessce-data/0.0.31/master_release/satija/2dca1bf5832a4102ba780e9e54f6c350.cells.json',\n },\n {\n type: 'cell-sets',\n fileType: 'cell-sets.json',\n url: 'https://s3.amazonaws.com/vitessce-data/0.0.31/master_release/satija/2dca1bf5832a4102ba780e9e54f6c350.cell-sets.json',\n },\n {\n type: 'expression-matrix',\n fileType: 'expression-matrix.zarr',\n url: 'https://vitessce-data.storage.googleapis.com/0.0.31/master_release/satija/2dca1bf5832a4102ba780e9e54f6c350.expression-matrix.zarr',\n },\n ],\n },\n ],\n initStrategy: 'auto',\n coordinationSpace: {\n embeddingType: {\n UMAP: 'UMAP',\n },\n embeddingZoom: {\n A: 3,\n },\n embeddingTargetX: {\n A: 0,\n },\n embeddingTargetY: {\n A: 0,\n },\n spatialZoom: {},\n spatialTargetX: {},\n spatialTargetY: {},\n geneExpressionColormapRange: {\n A: [0, 0.25],\n },\n },\n layout: [\n {\n component: 'cellSets',\n h: 4,\n w: 4,\n x: 4,\n y: 0,\n coordinationScopes: {},\n },\n {\n component: 'cellSetSizes',\n h: 4,\n w: 4,\n x: 8,\n y: 0,\n coordinationScopes: {},\n },\n {\n component: 'scatterplot',\n h: 4,\n props: {\n mapping: 'UMAP',\n view: {\n target: [\n 0,\n 0,\n 0,\n ],\n zoom: 3,\n },\n },\n w: 4,\n x: 0,\n y: 0,\n coordinationScopes: {\n embeddingType: 'UMAP',\n embeddingZoom: 'A',\n embeddingTargetX: 'A',\n embeddingTargetY: 'A',\n },\n },\n {\n component: 'heatmap',\n h: 4,\n w: 10,\n x: 0,\n y: 4,\n coordinationScopes: {\n geneExpressionColormapRange: 'A',\n },\n },\n {\n component: 'description',\n h: 4,\n w: 2,\n x: 10,\n y: 4,\n props: {\n description: `${satijaName}: ${satijaDescription}`,\n },\n },\n ],\n};\n","\n\nconst blinName = 'Blin et al., PLoS Biol 2019';\nconst blinDescription = 'Mouse blastocysts imaged by confocal microscopy';\nexport const blin2019 = {\n version: '1.0.6',\n name: blinName,\n description: blinDescription,\n public: true,\n datasets: [\n {\n uid: 'idr0062-blin-nuclearsegmentation/6001240',\n name: 'idr0062-blin-nuclearsegmentation/6001240',\n files: [\n {\n type: 'raster',\n fileType: 'raster.ome-zarr',\n url: 'https://minio-dev.openmicroscopy.org/idr/v0.3/idr0062-blin-nuclearsegmentation/6001240.zarr',\n },\n ],\n },\n ],\n initStrategy: 'auto',\n layout: [\n {\n component: 'spatial',\n x: 0,\n y: 0,\n w: 8,\n h: 12,\n },\n {\n component: 'layerController',\n x: 8,\n y: 0,\n w: 4,\n h: 6,\n },\n {\n component: 'description',\n x: 8,\n y: 6,\n w: 4,\n h: 3,\n },\n {\n component: 'status',\n x: 8,\n y: 9,\n w: 4,\n h: 3,\n },\n ],\n};\n","\n\nconst blinName = '179706';\nconst blinDescription = 'Example of OME-NGFF v0.1';\nexport const omeNgffLegacy = {\n version: '1.0.6',\n name: blinName,\n description: blinDescription,\n public: false,\n datasets: [\n {\n uid: '179706',\n name: '179706',\n files: [\n {\n type: 'raster',\n fileType: 'raster.ome-zarr',\n url: 'https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/179706.zarr',\n },\n ],\n },\n ],\n coordinationSpace: {\n spatialZoom: {\n A: -0.38015,\n },\n spatialTargetX: {\n A: 807.843,\n },\n spatialTargetY: {\n A: 537.031,\n },\n },\n initStrategy: 'auto',\n layout: [\n {\n component: 'spatial',\n coordinationScopes: {\n spatialZoom: 'A',\n spatialTargetX: 'A',\n spatialTargetY: 'A',\n },\n x: 0,\n y: 0,\n w: 8,\n h: 12,\n },\n {\n component: 'layerController',\n x: 8,\n y: 0,\n w: 4,\n h: 6,\n },\n {\n component: 'description',\n x: 8,\n y: 6,\n w: 4,\n h: 3,\n },\n {\n component: 'status',\n x: 8,\n y: 9,\n w: 4,\n h: 3,\n },\n ],\n};\n","import { vapi } from '../utils';\n\nfunction getConfig() {\n // Instantiate a view config object.\n const vc = new vapi.VitessceConfig('HBM485.TBWH.322', 'Large intestine snATAC-seq HuBMAP dataset with genomic data visualization powered by HiGlass');\n // Add a dataset and its files.\n const baseUrl = 'https://vitessce-data.s3.amazonaws.com/0.0.32/master_release/human_intestine_2020_hubmap';\n const dataset = vc\n .addDataset('HBM485.TBWH.322', 'Human large intestine, snATAC-seq')\n .addFile(`${baseUrl}/human_intestine_2020_hubmap.cells.json`, vapi.dt.CELLS, vapi.ft.CELLS_JSON)\n .addFile(`${baseUrl}/human_intestine_2020_hubmap.cell-sets.json`, vapi.dt.CELL_SETS, vapi.ft.CELL_SETS_JSON)\n .addFile(`${baseUrl}/human_intestine_2020_hubmap.genomic-profiles.zarr`, vapi.dt.GENOMIC_PROFILES, vapi.ft.GENOMIC_PROFILES_ZARR);\n // Add components.\n // Use mapping: \"UMAP\" so that cells are mapped to the UMAP positions from the JSON file.\n const umap = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 'UMAP' });\n const cellSetsManager = vc.addView(dataset, vapi.cm.CELL_SETS);\n const genomicProfiles = vc.addView(dataset, vapi.cm.GENOMIC_PROFILES);\n\n // Try un-commenting the line below to link center points of the two scatterplots!\n // vc.linkViews([umap, tsne], [ct.EMBEDDING_TARGET_X, ct.EMBEDDING_TARGET_Y], [0, 0]);\n vc.layout(\n vapi.vconcat(\n genomicProfiles,\n vapi.hconcat(umap, cellSetsManager),\n ),\n );\n\n // Return the view config as JSON.\n return vc.toJSON();\n}\n\nexport const hubmapIntestineSnAtacSeq = getConfig();\n","import { vapi } from '../../utils';\nimport { getCodeluppiViewConfig } from '../codeluppi';\n\nfunction getConfig() {\n const [vc, dataset] = getCodeluppiViewConfig(`Coordination Type: ${vapi.ct.EMBEDDING_ZOOM}`, 'Zoom levels in the scatterplots are coordinated.');\n const v1 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n const v2 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n vc.linkViews([v1, v2], [vapi.ct.EMBEDDING_ZOOM], [-1]);\n\n vc.layout(vapi.hconcat(v1, v2));\n return vc.toJSON();\n}\n\nexport const embeddingZoomConfig = getConfig();\n","import { vapi } from '../../utils';\nimport { getCodeluppiViewConfig } from '../codeluppi';\n\nfunction getConfig() {\n const [vc, dataset] = getCodeluppiViewConfig(`Coordination Type: ${vapi.ct.EMBEDDING_TARGET_X}`, 'Panning along the x-axis of the scatterplots is coordinated.');\n const v1 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n const v2 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n vc.linkViews([v1, v2], [vapi.ct.EMBEDDING_TARGET_X], [0]);\n\n vc.layout(vapi.hconcat(v1, v2));\n return vc.toJSON();\n}\n\nexport const embeddingTargetXConfig = getConfig();\n","import { vapi } from '../../utils';\nimport { getCodeluppiViewConfig } from '../codeluppi';\n\nfunction getConfig() {\n const [vc, dataset] = getCodeluppiViewConfig(`Coordination Type: ${vapi.ct.EMBEDDING_TARGET_Y}`, 'Panning along the y-axis of the scatterplots is coordinated.');\n const v1 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n const v2 = vc.addView(dataset, vapi.cm.SCATTERPLOT, { mapping: 't-SNE' });\n vc.linkViews([v1, v2], [vapi.ct.EMBEDDING_TARGET_Y], [0]);\n\n vc.layout(vapi.hconcat(v1, v2));\n return vc.toJSON();\n}\n\nexport const embeddingTargetYConfig = getConfig();\n","import { vapi } from '../../utils';\nimport { getEngViewConfig } from '../eng';\n\nfunction getConfig() {\n const [vc, dataset] = getEngViewConfig(`Coordination Type: ${vapi.ct.EMBEDDING_CELL_SET_POLYGONS_VISIBLE}`, 'Visibility of polygon overlays is coordinated in the top two scatterplots, and independent in the bottom two. Try clicking the gear above each plot and toggling the \"Cell Set Polygons Visible\" checkboxes.');\n const v1 = vc.addView(dataset, vapi.cm.SCATTERPLOT, {\n mapping: 't-SNE', x: 0, y: 0, w: 5, h: 6,\n });\n const v2 = vc.addView(dataset, vapi.cm.SCATTERPLOT, {\n mapping: 't-SNE', x: 5, y: 0, w: 5, h: 6,\n });\n vc.addView(dataset, vapi.cm.SCATTERPLOT, {\n mapping: 't-SNE', x: 0, y: 6, w: 5, h: 6,\n });\n const v4 = vc.addView(dataset, vapi.cm.SCATTERPLOT, {\n mapping: 't-SNE', x: 5, y: 6, w: 5, h: 6,\n });\n vc.addView(dataset, vapi.cm.CELL_SETS, {\n x: 10, y: 0, w: 2, h: 12,\n });\n vc.linkViews([v1, v2], [vapi.ct.EMBEDDING_CELL_SET_POLYGONS_VISIBLE], [true]);\n vc.linkViews([v4], [vapi.ct.EMBEDDING_CELL_SET_POLYGONS_VISIBLE], [true]);\n\n return vc.toJSON();\n}\n\nexport const embeddingCellSetPolygonsVisibleConfig = getConfig();\n","import { notPublic, vapi } from './utils';\nimport {\n justScatter, justScatterExpression, justSpatial, codeluppi2018,\n} from './view-configs/codeluppi';\nimport { eng2019 } from './view-configs/eng';\nimport { wang2018 } from './view-configs/wang';\nimport { spraggins2020, neumann2020 } from './view-configs/spraggins';\nimport { satija2020 } from './view-configs/satija';\nimport { justHiglass } from './view-configs/rao';\nimport { scAtacSeq10xPbmc } from './view-configs/tenx';\nimport { blin2019 } from './view-configs/blin';\nimport { omeNgffLegacy } from './view-configs/ome-ngff-legacy';\nimport { hubmapIntestineSnAtacSeq } from './view-configs/hubmap';\nimport {\n embeddingZoomConfig,\n embeddingTargetXConfig,\n embeddingTargetYConfig,\n embeddingCellSetPolygonsVisibleConfig,\n} from './view-configs/coordination-types/index';\n\n\nexport const coordinationTypeConfigs = {\n [vapi.ct.EMBEDDING_ZOOM]: embeddingZoomConfig,\n [vapi.ct.EMBEDDING_TARGET_X]: embeddingTargetXConfig,\n [vapi.ct.EMBEDDING_TARGET_Y]: embeddingTargetYConfig,\n [vapi.ct.EMBEDDING_CELL_SET_POLYGONS_VISIBLE]: embeddingCellSetPolygonsVisibleConfig,\n};\n\n// Note that the ordering of the components in the layout\n// can affect the z-index of plot tooltips due to the\n// resulting ordering of elements in the DOM.\n\nexport const configs = {\n 'just-scatter': justScatter,\n 'just-scatter-expression': justScatterExpression,\n 'just-spatial': justSpatial,\n 'just-higlass': justHiglass,\n 'codeluppi-2018': codeluppi2018,\n 'eng-2019': eng2019,\n 'wang-2018': wang2018,\n 'spraggins-2020': spraggins2020,\n 'neumann-2020': neumann2020,\n 'satija-2020': satija2020,\n 'sn-atac-seq-hubmap-2020': hubmapIntestineSnAtacSeq,\n 'sc-atac-seq-10x-genomics-pbmc': scAtacSeq10xPbmc,\n 'blin-2019': blin2019,\n 'ome-ngff-v0.1': omeNgffLegacy,\n // Keys which enable backwards compatibility with old links.\n 'linnarsson-2018': notPublic(codeluppi2018),\n vanderbilt: notPublic(spraggins2020),\n 'dries-2019': notPublic(eng2019),\n ...coordinationTypeConfigs,\n};\n","\nexport const justHiglass = {\n public: false,\n initStrategy: 'auto',\n version: '1.0.0',\n datasets: [\n {\n uid: 'higlass-dataset',\n name: 'HiGlass Dataset',\n files: [],\n },\n ],\n name: 'HiGlass demo',\n coordinationSpace: {\n genomicZoomX: {\n A: 0,\n },\n genomicZoomY: {\n A: 0,\n },\n genomicTargetX: {\n A: 1549999999.5,\n },\n genomicTargetY: {\n A: 1549999999.5,\n },\n },\n layout: [\n {\n component: 'higlass',\n coordinationScopes: {\n genomicZoomX: 'A',\n genomicZoomY: 'A',\n genomicTargetX: 'A',\n genomicTargetY: 'A',\n },\n props: {\n hgViewConfig: {\n uid: 'aa',\n autocompleteSource: '/api/v1/suggest/?d=OHJakQICQD6gTD7skx4EWA&',\n genomePositionSearchBox: {\n autocompleteServer: '//higlass.io/api/v1',\n autocompleteId: 'OHJakQICQD6gTD7skx4EWA',\n chromInfoServer: '//higlass.io/api/v1',\n chromInfoId: 'hg19',\n visible: true,\n },\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n tracks: {\n top: [\n {\n type: 'horizontal-gene-annotations',\n height: 60,\n tilesetUid: 'OHJakQICQD6gTD7skx4EWA',\n server: '//higlass.io/api/v1',\n uid: 'OHJakQICQD6gTD7skx4EWA',\n options: {\n name: 'Gene Annotations (hg19)',\n fontSize: 10,\n labelPosition: 'hidden',\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n minHeight: 24,\n geneAnnotationHeight: 16,\n geneLabelPosition: 'outside',\n geneStrandSpacing: 4,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n plusStrandColor: '#fdff54',\n minusStrandColor: '#68bf30',\n labelColor: 'black',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n },\n },\n {\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n type: 'horizontal-chromosome-labels',\n height: 30,\n uid: 'X4e_1DKiQHmyghDa6lLMVA',\n options: {\n color: '#808080',\n stroke: 'black',\n fontSize: 12,\n fontIsLeftAligned: false,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n },\n },\n ],\n left: [\n {\n type: 'vertical-gene-annotations',\n width: 60,\n tilesetUid: 'OHJakQICQD6gTD7skx4EWA',\n server: '//higlass.io/api/v1',\n options: {\n labelPosition: 'bottomRight',\n name: 'Gene Annotations (hg19)',\n fontSize: 10,\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n minWidth: 24,\n geneAnnotationHeight: 16,\n geneLabelPosition: 'outside',\n geneStrandSpacing: 4,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n plusStrandColor: '#fdff54',\n minusStrandColor: '#68bf30',\n labelColor: 'black',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n },\n uid: 'dqBTMH78Rn6DeSyDBoAEXw',\n },\n {\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n type: 'vertical-chromosome-labels',\n width: 30,\n uid: 'RHdQK4IRQ7yJeDmKWb7Pcg',\n options: {\n color: '#777777',\n stroke: 'black',\n fontSize: 12,\n fontIsLeftAligned: false,\n minWidth: 35,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n },\n },\n ],\n center: [\n {\n uid: 'c1',\n type: 'combined',\n height: 600,\n contents: [\n {\n server: '//higlass.io/api/v1',\n tilesetUid: 'CQMd6V_cRw6iCI_-Unl3PQ',\n type: 'heatmap',\n options: {\n maxZoom: null,\n labelPosition: 'bottomRight',\n name: 'Rao et al. (2014) GM12878 MboI (allreps) 1kb',\n backgroundColor: 'black',\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n labelShowResolution: true,\n labelShowAssembly: true,\n labelColor: '#ffffff',\n labelTextOpacity: 0.5,\n labelBackgroundColor: 'black',\n labelBackgroundOpacity: 0.01,\n colorRange: [\n '#000000',\n '#222e54',\n '#448db2',\n '#68bf30',\n '#fdff54',\n '#FFFFFF',\n ],\n colorbarBackgroundColor: 'black',\n colorbarBackgroundOpacity: 0.01,\n colorbarPosition: 'topRight',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n heatmapValueScaling: 'log',\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n showTooltip: false,\n extent: 'full',\n zeroValueColor: null,\n scaleStartPercent: '0.00000',\n scaleEndPercent: '1.00000',\n },\n height: 500,\n uid: 'GjuZed1ySGW1IzZZqFB9BA',\n transforms: [\n {\n name: 'ICE',\n value: 'weight',\n },\n ],\n },\n ],\n options: {},\n },\n ],\n right: [],\n bottom: [],\n whole: [],\n gallery: [],\n },\n layout: {\n w: 12,\n h: 12,\n x: 0,\n y: 0,\n moved: false,\n static: false,\n },\n },\n },\n x: 0,\n y: 0,\n w: 8,\n h: 2,\n },\n {\n component: 'higlass',\n coordinationScopes: {\n genomicZoomX: 'A',\n genomicZoomY: 'A',\n genomicTargetX: 'A',\n genomicTargetY: 'A',\n },\n props: {\n hgViewConfig: {\n uid: 'aa',\n autocompleteSource: '/api/v1/suggest/?d=OHJakQICQD6gTD7skx4EWA&',\n genomePositionSearchBox: {\n autocompleteServer: '//higlass.io/api/v1',\n autocompleteId: 'OHJakQICQD6gTD7skx4EWA',\n chromInfoServer: '//higlass.io/api/v1',\n chromInfoId: 'hg19',\n visible: true,\n },\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n tracks: {\n top: [\n {\n type: 'horizontal-gene-annotations',\n height: 60,\n tilesetUid: 'OHJakQICQD6gTD7skx4EWA',\n server: '//higlass.io/api/v1',\n uid: 'OHJakQICQD6gTD7skx4EWA',\n options: {\n name: 'Gene Annotations (hg19)',\n fontSize: 10,\n labelPosition: 'hidden',\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n minHeight: 24,\n geneAnnotationHeight: 16,\n geneLabelPosition: 'outside',\n geneStrandSpacing: 4,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n plusStrandColor: '#fdff54',\n minusStrandColor: '#68bf30',\n labelColor: 'black',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n },\n },\n {\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n type: 'horizontal-chromosome-labels',\n height: 30,\n uid: 'X4e_1DKiQHmyghDa6lLMVA',\n options: {\n color: '#808080',\n stroke: 'black',\n fontSize: 12,\n fontIsLeftAligned: false,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n },\n },\n ],\n left: [\n {\n type: 'vertical-gene-annotations',\n width: 60,\n tilesetUid: 'OHJakQICQD6gTD7skx4EWA',\n server: '//higlass.io/api/v1',\n options: {\n labelPosition: 'bottomRight',\n name: 'Gene Annotations (hg19)',\n fontSize: 10,\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n minWidth: 24,\n geneAnnotationHeight: 16,\n geneLabelPosition: 'outside',\n geneStrandSpacing: 4,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n plusStrandColor: '#fdff54',\n minusStrandColor: '#68bf30',\n labelColor: 'black',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n },\n uid: 'dqBTMH78Rn6DeSyDBoAEXw',\n },\n {\n chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',\n type: 'vertical-chromosome-labels',\n width: 30,\n uid: 'RHdQK4IRQ7yJeDmKWb7Pcg',\n options: {\n color: '#777777',\n stroke: 'black',\n fontSize: 12,\n fontIsLeftAligned: false,\n minWidth: 35,\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n },\n },\n ],\n center: [\n {\n uid: 'c1',\n type: 'combined',\n height: 600,\n contents: [\n {\n server: '//higlass.io/api/v1',\n tilesetUid: 'CQMd6V_cRw6iCI_-Unl3PQ',\n type: 'heatmap',\n options: {\n maxZoom: null,\n labelPosition: 'bottomRight',\n name: 'Rao et al. (2014) GM12878 MboI (allreps) 1kb',\n backgroundColor: 'black',\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n labelShowResolution: true,\n labelShowAssembly: true,\n labelColor: '#ffffff',\n labelTextOpacity: 0.5,\n labelBackgroundColor: 'black',\n labelBackgroundOpacity: 0.01,\n colorRange: [\n '#000000',\n '#222e54',\n '#448db2',\n '#68bf30',\n '#fdff54',\n '#FFFFFF',\n ],\n colorbarBackgroundColor: 'black',\n colorbarBackgroundOpacity: 0.01,\n colorbarPosition: 'topRight',\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n heatmapValueScaling: 'log',\n showMousePosition: true,\n mousePositionColor: '#ff00ff',\n showTooltip: false,\n extent: 'full',\n zeroValueColor: null,\n scaleStartPercent: '0.00000',\n scaleEndPercent: '1.00000',\n },\n height: 500,\n uid: 'GjuZed1ySGW1IzZZqFB9BA',\n transforms: [\n {\n name: 'ICE',\n value: 'weight',\n },\n ],\n },\n ],\n options: {},\n },\n ],\n right: [],\n bottom: [],\n whole: [],\n gallery: [],\n },\n layout: {\n w: 12,\n h: 12,\n x: 0,\n y: 0,\n moved: false,\n static: false,\n },\n },\n },\n x: 8,\n y: 0,\n w: 4,\n h: 2,\n },\n ],\n};\n","\n\nexport const scAtacSeq10xPbmc = {\n version: '1.0.0',\n name: 'HiGlass serverless demo with 10x Genomics scATAC-seq 5k PBMC dataset',\n datasets: [\n {\n uid: '10x-genomics-pbmc',\n name: '10x Genomics PBMC',\n files: [\n {\n type: 'genomic-profiles',\n fileType: 'genomic-profiles.zarr',\n url: 'http://higlass-serverless.s3.amazonaws.com/multivec/pbmc_10x_peaks_by_cluster.zarr',\n },\n ],\n },\n ],\n layout: [\n {\n component: 'genomicProfiles',\n props: {\n profileTrackUidKey: 'file',\n },\n x: 0,\n y: 0,\n w: 8,\n h: 2,\n },\n {\n component: 'description',\n props: {\n description: '10x Genomics scATAC-seq of 5k PBMCs. Note: the Zarr HiGlass Plugin Datafetcher is not yet optimized. Please be patient while the HiGlass tracks load.',\n },\n x: 8,\n y: 0,\n w: 4,\n h: 2,\n },\n ],\n initStrategy: 'auto',\n};\n","export const TOOLTIP_ANCESTOR = 'tooltip-ancestor';\nconst CARD = `card card-body my-2 ${TOOLTIP_ANCESTOR}`;\nexport const PRIMARY_CARD = `${CARD} bg-primary`;\nexport const SECONDARY_CARD = `${CARD} bg-secondary`;\nexport const BLACK_CARD = `${CARD} bg-black`;\nexport const TITLE_CARD = 'title';\nexport const SCROLL_CARD = `${PRIMARY_CARD} scroll`;\nexport const VITESSCE_CONTAINER = 'vitessce-container';\n","import React from 'react';\nimport { PRIMARY_CARD } from '../components/classNames';\n\nexport default function Warning(props) {\n const {\n title,\n preformatted,\n unformatted,\n theme,\n } = props;\n return (\n <div className={`vitessce-container vitessce-theme-${theme}`}>\n <div className=\"warning-layout container-fluid\">\n <div className=\"row\">\n <div className=\"col-12\">\n <div className={PRIMARY_CARD}>\n <h1>{title}</h1>\n <pre>{preformatted}</pre>\n <div>{unformatted}</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n}\n","import { makeStyles, createTheme } from '@material-ui/core/styles';\nimport { grey } from '@material-ui/core/colors';\n\nexport const styles = makeStyles(() => ({\n paper: {\n maxHeight: 200,\n overflow: 'auto',\n },\n container: {\n position: 'relative',\n left: 0,\n top: 0,\n },\n span: {\n width: '70px',\n textAlign: 'center',\n paddingLeft: '2px',\n paddingRight: '2px',\n },\n}));\n\nexport const muiTheme = {\n dark: createTheme({\n palette: {\n type: 'dark',\n primary: grey,\n secondary: grey,\n primaryBackground: '#222222',\n primaryBackgroundHighlight: '#000000',\n primaryBackgroundInput: '#D3D3D3',\n primaryBackgroundDim: '#333333',\n primaryBackgroundLight: '#757575',\n primaryForeground: '#D3D3D3',\n primaryForegroundDim: '#000000',\n primaryForegroundActive: '#9bb7d6',\n secondaryBackground: '#000000',\n secondaryBackgroundDim: '#444444',\n secondaryForeground: '#D3D3D3',\n },\n props: {\n MuiButtonBase: {\n disableRipple: true,\n },\n },\n }),\n light: createTheme({\n palette: {\n type: 'light',\n primary: grey,\n secondary: grey,\n primaryBackground: '#F1F1F1',\n primaryBackgroundHighlight: '#FFFFFF',\n primaryBackgroundInput: '#FFFFFF',\n primaryBackgroundDim: '#8A8A8A',\n primaryBackgroundLight: '#e0e0e0',\n primaryForeground: '#333333',\n primaryForegroundDim: '#808080',\n primaryForegroundActive: '#0074D9',\n secondaryBackground: '#F1F1F1',\n secondaryBackgroundDim: '#C0C0C0',\n secondaryForeground: '#222222',\n },\n props: {\n MuiButtonBase: {\n disableRipple: true,\n },\n },\n }),\n};\n","import { useRef, useCallback, useMemo } from 'react';\nimport create from 'zustand';\nimport createContext from 'zustand/context';\nimport shallow from 'zustand/shallow';\nimport { fromEntries, capitalize } from '../../utils';\n\n// Reference: https://github.com/pmndrs/zustand#react-context\n// Reference: https://github.com/pmndrs/zustand/blob/e47ea03/tests/context.test.tsx#L60\nconst {\n Provider: ViewConfigProviderLocal,\n useStore: useViewConfigStoreLocal,\n useStoreApi: useViewConfigStoreApiLocal,\n} = createContext();\n\nexport const ViewConfigProvider = ViewConfigProviderLocal;\nexport const useViewConfigStore = useViewConfigStoreLocal;\nexport const useViewConfigStoreApi = useViewConfigStoreApiLocal;\n\nconst {\n Provider: AuxiliaryProviderLocal,\n useStore: useAuxiliaryStoreLocal,\n} = createContext();\n\nexport const AuxiliaryProvider = AuxiliaryProviderLocal;\nexport const useAuxiliaryStore = useAuxiliaryStoreLocal;\n\n\n/**\n * The useViewConfigStore hook is initialized via the zustand\n * create() function, which sets up both the state variables\n * and the reducer-type functions.\n * Reference: https://github.com/react-spring/zustand\n * @returns {function} The useStore hook.\n */\nexport const createViewConfigStore = () => create(set => ({\n // State:\n // The viewConfig is an object which must conform to the schema\n // found in src/schemas/config.schema.json.\n viewConfig: null,\n // The loaders object is a mapping from dataset ID to\n // data type to loader object instance.\n loaders: null,\n // Reducer functions which update the state\n // (although technically also part of state):\n setViewConfig: viewConfig => set({ viewConfig }),\n setLoaders: loaders => set({ loaders }),\n setCoordinationValue: ({ parameter, scope, value }) => set(state => ({\n viewConfig: {\n ...state.viewConfig,\n coordinationSpace: {\n ...state.viewConfig.coordinationSpace,\n [parameter]: {\n ...state.viewConfig.coordinationSpace[parameter],\n [scope]: value,\n },\n },\n },\n })),\n removeComponent: i => set((state) => {\n const newLayout = state.viewConfig.layout.slice();\n newLayout.splice(i, 1);\n return {\n viewConfig: {\n ...state.viewConfig,\n layout: newLayout,\n },\n };\n }),\n changeLayout: newComponentProps => set((state) => {\n const newLayout = state.viewConfig.layout.slice();\n newComponentProps.forEach(([i, newProps]) => {\n newLayout[i] = {\n ...newLayout[i],\n ...newProps,\n };\n });\n return {\n viewConfig: {\n ...state.viewConfig,\n layout: newLayout,\n },\n };\n }),\n}));\n\n/**\n * Hook for getting components' layout from the view config based on\n * matching all coordination scopes.\n * @returns {Object} The components' layout.\n */\nexport const useComponentLayout = (component, scopes, coordinationScopes) => useViewConfigStore(\n state => state.viewConfig.layout.filter(l => l.component === component).filter(\n l => scopes.every(scope => l.coordinationScopes[scope]\n === coordinationScopes[scope]),\n ),\n);\n\n/**\n * The useAuxiliaryStore hook is initialized via the zustand\n * create() function, which sets up both the state variables\n * and the reducer-type functions.\n * Reference: https://github.com/react-spring/zustand\n * It is meant to be used for non-viewconfig-based coordination between components.\n * For example, as currently happens, the layer controller can coordinate\n * on-load callbacks with spatial view based on whether or not they are\n * coordinated via `spatialRasterLayers` - the callbacks are not part of the view config\n * though so they live here.\n * @returns {function} The useStore hook.\n */\nexport const createAuxiliaryStore = () => create(set => ({\n auxiliaryStore: null,\n setCoordinationValue: ({ parameter, scope, value }) => set(state => ({\n auxiliaryStore: {\n ...state.auxiliaryStore,\n [parameter]: {\n [scope]: value,\n },\n },\n })),\n}));\n\n/**\n * The hover store can be used to store global state\n * related to which component is currently hovered,\n * which is required for tooltip / crossover elements.\n * @returns {function} The useStore hook.\n */\nconst useHoverStore = create(set => ({\n // Components may need to know if they are the \"hover source\"\n // for tooltip interactions. This value should be a unique\n // component ID, such as its index in the view config layout.\n componentHover: null,\n setComponentHover: componentHover => set({ componentHover }),\n}));\n\n/**\n * The warning store can be used to store global state\n * related to app warning messages.\n * @returns {function} The useStore hook.\n */\nconst useWarnStore = create(set => ({\n // Want a global state to collect warning messages\n // that occur anywhere in the app.\n warning: null,\n setWarning: warning => set({ warning }),\n}));\n\n/**\n * The view info store can be used to store component-level\n * viewInfo objects,\n * which are required for tooltip / crossover elements.\n * @returns {function} The useStore hook.\n */\nconst useViewInfoStore = create(set => ({\n // The viewInfo object is a mapping from\n // component IDs to component view info objects.\n // Each view info object must have a project() function.\n viewInfo: {},\n setComponentViewInfo: (uuid, viewInfo) => set(state => ({\n viewInfo: {\n ...state.viewInfo,\n [uuid]: viewInfo,\n },\n })),\n}));\n\n/**\n * The grid size store can be used to store a\n * counter which updates on each window or react-grid-layout\n * resize event.\n * @returns {function} The useStore hook.\n */\nconst useGridSizeStore = create(set => ({\n resizeCount: {},\n incrementResizeCount: () => set(state => ({\n resizeCount: state.resizeCount + 1,\n })),\n}));\n\n/**\n * The useCoordination hook returns both the\n * values and setter functions for the coordination objects\n * in a particular coordination scope mapping.\n * This hook is intended to be used within the ___Subscriber\n * components to allow them to \"hook into\" only those coordination\n * objects and setter functions of relevance.\n * @param {string[]} parameters Array of coordination types.\n * @param {object} coordinationScopes Mapping of coordination types\n * to scope names.\n * @returns {array} Returns a tuple [values, setters]\n * where values is an object containing all coordination values,\n * and setters is an object containing all coordination setter\n * functions for the values in `values`, named with a \"set\"\n * prefix.\n */\nexport function useCoordination(parameters, coordinationScopes) {\n const setCoordinationValue = useViewConfigStore(state => state.setCoordinationValue);\n\n const values = useViewConfigStore((state) => {\n const { coordinationSpace } = state.viewConfig;\n return fromEntries(parameters.map((parameter) => {\n if (coordinationSpace && coordinationSpace[parameter]) {\n const value = coordinationSpace[parameter][coordinationScopes[parameter]];\n return [parameter, value];\n }\n return [parameter, undefined];\n }));\n }, shallow);\n\n const setters = useMemo(() => fromEntries(parameters.map((parameter) => {\n const setterName = `set${capitalize(parameter)}`;\n const setterFunc = value => setCoordinationValue({\n parameter,\n scope: coordinationScopes[parameter],\n value,\n });\n return [setterName, setterFunc];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n })), [parameters, coordinationScopes]);\n\n return [values, setters];\n}\n\nconst AUXILIARY_COORDINATION_TYPES_MAP = {\n spatialRasterLayers: ['rasterLayersCallbacks', 'areLoadingRasterChannnels'],\n};\n\n/**\n * The maps the coordination types of incoming scopes to new types\n * for the auxiliary store.\n * @param {object} coordinationScopes Mapping of coordination types\n * to scope names.\n * @returns {object} Mapping of coordination types\n * to new scope names for the auxiliary store.\n */\nconst mapCoordinationScopes = (coordinationScopes) => {\n const newCoordinationScopes = {};\n Object.keys(coordinationScopes).forEach((key) => {\n const newCoordinationTypes = AUXILIARY_COORDINATION_TYPES_MAP[key] || [];\n newCoordinationTypes.forEach((coordinationType) => {\n newCoordinationScopes[coordinationType || key] = coordinationScopes[key];\n });\n });\n return newCoordinationScopes;\n};\n\nconst mapParameters = parameters => parameters\n .map(parameter => AUXILIARY_COORDINATION_TYPES_MAP[parameter]).filter(Boolean).flat();\n\n/**\n * The useAuxiliaryCoordination hook returns both the\n * values and setter functions for the auxiliary coordination objects\n * in a particular coordination scope mapping.\n * This hook is intended to be used within the ___Subscriber\n * components to allow them to \"hook into\" only those auxiliary coordination\n * objects and setter functions of relevance, for example \"on load\" callbacks.\n * @param {string[]} parameters Array of coordination types.\n * @param {object} coordinationScopes Mapping of coordination types\n * to scope names.\n * @returns {array} Returns a tuple [values, setters]\n * where values is an object containing all coordination values,\n * and setters is an object containing all coordination setter\n * functions for the values in `values`, named with a \"set\"\n * prefix.\n */\nexport function useAuxiliaryCoordination(parameters, coordinationScopes) {\n const setCoordinationValue = useAuxiliaryStore(state => state.setCoordinationValue);\n const mappedCoordinationScopes = mapCoordinationScopes(coordinationScopes);\n const mappedParameters = mapParameters(parameters);\n const values = useAuxiliaryStore((state) => {\n const { auxiliaryStore } = state;\n return fromEntries(mappedParameters.map((parameter) => {\n if (auxiliaryStore && auxiliaryStore[parameter]) {\n const value = auxiliaryStore[parameter][mappedCoordinationScopes[parameter]];\n return [parameter, value];\n }\n return [parameter, undefined];\n }));\n }, shallow);\n const setters = useMemo(() => fromEntries(mappedParameters.map((parameter) => {\n const setterName = `set${capitalize(parameter)}`;\n const setterFunc = value => setCoordinationValue({\n parameter,\n scope: mappedCoordinationScopes[parameter],\n value,\n });\n return [setterName, setterFunc];\n // eslint-disable-next-line react-hooks/exhaustive-deps\n })), [parameters, coordinationScopes]);\n\n return [values, setters];\n}\n\n/**\n * Obtain the loaders object from\n * the global app state.\n * @returns {object} The loaders object\n * in the `useViewConfigStore` store.\n */\nexport function useLoaders() {\n return useViewConfigStore(state => state.loaders);\n}\n\n/**\n * Obtain the view config layout array from\n * the global app state.\n * @returns {object[]} The layout array\n * in the `useViewConfigStore` store.\n */\nexport function useLayout() {\n return useViewConfigStore(state => state.viewConfig?.layout);\n}\n\n/**\n * Obtain the component removal function from\n * the global app state.\n * @returns {function} The remove component function\n * in the `useViewInfoStore` store.\n */\nexport function useRemoveComponent() {\n return useViewConfigStore(state => state.removeComponent);\n}\n\n/**\n * Obtain the component prop setter function from\n * the global app state.\n * @returns {function} The set component props function\n * in the `useViewInfoStore` store.\n */\nexport function useChangeLayout() {\n return useViewConfigStore(state => state.changeLayout);\n}\n\n/**\n * Obtain the loaders setter function from\n * the global app state.\n * @returns {function} The loaders setter function\n * in the `useViewConfigStore` store.\n */\nexport function useSetLoaders() {\n return useViewConfigStore(state => state.setLoaders);\n}\n\n/**\n * Obtain the view config setter function from\n * the global app state.\n * @returns {function} The view config setter function\n * in the `useViewConfigStore` store.\n */\nexport function useSetViewConfig(viewConfigStoreApi) {\n const setViewConfigRef = useRef(viewConfigStoreApi.getState().setViewConfig);\n const setViewConfig = setViewConfigRef.current;\n return setViewConfig;\n}\n\n/**\n * Obtain the component hover value from\n * the global app state.\n * @returns {number} The hovered component ID\n * in the `useHoverStore` store.\n */\nexport function useComponentHover() {\n return useHoverStore(state => state.componentHover);\n}\n\n/**\n * Obtain the component hover setter function from\n * the global app state.\n * @returns {function} The component hover setter function\n * in the `useHoverStore` store.\n */\nexport function useSetComponentHover() {\n return useHoverStore(state => state.setComponentHover);\n}\n\n/**\n * Obtain the warning message from\n * the global app state.\n * @returns {string} The warning message\n * in the `useWarnStore` store.\n */\nexport function useWarning() {\n return useWarnStore(state => state.warning);\n}\n\n/**\n * Obtain the warning setter function from\n * the global app state.\n * @returns {function} The warning setter function\n * in the `useWarnStore` store.\n */\nexport function useSetWarning() {\n return useWarnStore(state => state.setWarning);\n}\n\n/**\n * Obtain the component view info value from\n * the global app state.\n * @returns {object} The view info object for the component\n * in the `useViewInfoStore` store.\n */\nexport function useComponentViewInfo(uuid) {\n return useViewInfoStore(useCallback(state => state.viewInfo[uuid], [uuid]));\n}\n\n/**\n * Obtain the component view info setter function from\n * the global app state.\n * @returns {function} The component view info setter function\n * in the `useViewInfoStore` store.\n */\nexport function useSetComponentViewInfo(uuid) {\n const setViewInfoRef = useRef(useViewInfoStore.getState().setComponentViewInfo);\n const setComponentViewInfo = viewInfo => setViewInfoRef.current(uuid, viewInfo);\n return setComponentViewInfo;\n}\n\n/**\n * Obtain the grid resize count value\n * from the global app state.\n * @returns {number} The grid resize increment value.\n */\nexport function useGridResize() {\n return useGridSizeStore(state => state.resizeCount);\n}\n\n/**\n * Obtain the grid resize count increment function\n * from the global app state.\n * @returns {function} The grid resize count increment\n * function.\n */\nexport function useEmitGridResize() {\n return useGridSizeStore(state => state.incrementResizeCount);\n}\n","import range from 'lodash/range';\n\nexport const COMPONENT_ID_PREFIX = 'i';\n\nfunction sum(a) {\n return a.reduce((x, y) => x + y, 0);\n}\n\nexport function makeGridLayout(colXs, colLayout) {\n const colWs = [];\n for (let i = 0; i < colXs.length; i++) { // eslint-disable-line no-plusplus\n colWs.push(colXs[i + 1] - colXs[i]);\n }\n return Object.entries(colLayout).map(([id, spec]) => ({\n i: id,\n y: spec.y,\n h: spec.h || 1,\n x: colXs[spec.x],\n w: sum(colWs.slice(spec.x, spec.x + (spec.w || 1))),\n }));\n}\n\nexport function getMaxRows(layouts) {\n return Math.max(\n ...Object.values(layouts).map(\n layout => Math.max(\n ...layout.map(xywh => xywh.y + xywh.h),\n ),\n ),\n );\n}\n\nexport function resolveLayout(layout) {\n const cols = {};\n const layouts = {};\n const breakpoints = {};\n const components = {};\n const positions = {};\n\n (('components' in layout) ? layout.components : layout).forEach(\n (def, i) => {\n const id = `${COMPONENT_ID_PREFIX}${i}`;\n components[id] = {\n component: def.component,\n props: def.props || {},\n coordinationScopes: def.coordinationScopes || {},\n };\n positions[id] = {\n id, x: def.x, y: def.y, w: def.w, h: def.h,\n };\n },\n );\n\n if ('components' in layout) {\n Object.entries(layout.columns).forEach(\n ([width, columnXs]) => {\n cols[width] = columnXs[columnXs.length - 1];\n layouts[width] = makeGridLayout(columnXs, positions);\n breakpoints[width] = width;\n },\n );\n } else {\n // static layout\n const id = 'ID';\n const columnCount = 12;\n cols[id] = columnCount;\n layouts[id] = makeGridLayout(range(columnCount + 1), positions);\n breakpoints[id] = 1000;\n // Default has different numbers of columns at different widths,\n // so we do need to override that to ensure the same number of columns,\n // regardless of window width.\n }\n return {\n cols, layouts, breakpoints, components,\n };\n}\n","import React from 'react';\nimport { Responsive, WidthProvider } from 'react-grid-layout';\nimport isEqual from 'lodash/isEqual';\nimport { getMaxRows, resolveLayout, COMPONENT_ID_PREFIX } from './layout-utils';\n\nconst ResponsiveGridLayout = WidthProvider(Responsive);\n\nclass ResponsiveHeightGridLayout extends ResponsiveGridLayout {\n componentDidUpdate(prevProps) {\n if (this.props.height !== prevProps.height) {\n this.onWindowResize();\n }\n }\n}\n\nexport default function VitessceGridLayout(props) {\n const {\n layout,\n getComponent, padding, margin, draggableHandle,\n reactGridLayoutProps, rowHeight, theme, height,\n onRemoveComponent, onLayoutChange: onLayoutChangeProp,\n } = props;\n\n // If layout changes, update grid components.\n const {\n cols: gridCols, layouts: gridLayouts, breakpoints: gridBreakpoints, components: gridComponents,\n } = resolveLayout(layout);\n\n const maxRows = getMaxRows(gridLayouts);\n\n // Inline CSS is generally avoided, but this saves the end-user a little work,\n // and prevents class names from getting out of sync.\n const style = (\n <style>\n {`\n ${draggableHandle} {\n cursor: grab;\n }\n ${draggableHandle}:active {\n cursor: grabbing;\n }\n `}\n </style>\n );\n\n const onLayoutChange = (newLayout) => {\n if (newLayout.length === Object.entries(gridComponents).length) {\n const newComponentProps = [];\n newLayout.forEach((nextC) => {\n const id = nextC.i;\n const prevC = gridComponents[id];\n if (prevC) {\n const i = parseInt(id.substring(id.indexOf(COMPONENT_ID_PREFIX) + 1), 10);\n const nextProps = {\n x: nextC.x, y: nextC.y, w: nextC.w, h: nextC.h,\n };\n const prevProps = {\n x: prevC.x, y: prevC.y, w: prevC.w, h: prevC.h,\n };\n if (!isEqual(nextProps, prevProps)) {\n newComponentProps.push([i, nextProps]);\n }\n }\n });\n if (newComponentProps.length > 0) {\n onLayoutChangeProp(newComponentProps);\n }\n }\n };\n\n const layoutChildren = Object.entries(gridComponents).map(([k, v], i) => {\n const Component = getComponent(v.component);\n\n const removeGridComponent = () => {\n onRemoveComponent(i);\n };\n\n return (\n <div key={k}>\n <Component\n {... v.props}\n uuid={i}\n coordinationScopes={v.coordinationScopes}\n theme={theme}\n removeGridComponent={removeGridComponent}\n />\n </div>\n );\n });\n return (gridLayouts && gridComponents && gridBreakpoints && gridCols) && (\n <>\n {style}\n <ResponsiveHeightGridLayout\n className=\"layout\"\n cols={gridCols}\n layouts={gridLayouts}\n breakpoints={gridBreakpoints}\n height={height}\n rowHeight={\n rowHeight\n || (\n (window.innerHeight - 2 * padding - (maxRows - 1) * margin)\n / maxRows\n )}\n containerPadding={[padding, padding]}\n margin={[margin, margin]}\n draggableHandle={draggableHandle}\n onLayoutChange={onLayoutChange}\n {... reactGridLayoutProps}\n >\n {layoutChildren}\n </ResponsiveHeightGridLayout>\n </>\n );\n}\n\nVitessceGridLayout.defaultProps = {\n padding: 10,\n margin: 10,\n};\n","import AbstractLoader from './AbstractLoader';\n\nexport default class AbstractTwoStepLoader extends AbstractLoader {\n constructor(dataSource, params) {\n super(params);\n this.dataSource = dataSource;\n }\n}\n","import uuidv4 from 'uuid/v4';\n\n/**\n * A loader ancestor class containing a default constructor\n * and a stub for the required load() method.\n */\nexport default class AbstractLoader {\n constructor({\n type, url, requestInit, options,\n }) {\n this.type = type;\n this.url = url;\n this.requestInit = requestInit;\n this.options = options;\n\n this.subscriptions = {};\n }\n\n // eslint-disable-next-line class-methods-use-this\n load() {\n throw new Error('The load() method has not been implemented.');\n }\n\n subscribe(subscriber) {\n const token = uuidv4();\n this.subscriptions[token] = subscriber;\n return token;\n }\n\n unsubscribe(token) {\n delete this.subscriptions[token];\n }\n\n publish(data) {\n Object.values(this.subscriptions).forEach((subscriber) => {\n subscriber(data);\n });\n }\n}\n","/**\n * A loader error ancestor class containing a default constructor\n * and a stub for the required warnInConsole() method.\n */\nexport default class AbstractLoaderError {\n constructor(message) {\n this.message = message;\n }\n\n // eslint-disable-next-line class-methods-use-this\n warnInConsole() {\n throw new Error('The warnInConsole() method has not been implemented.');\n }\n}\n","import AbstractLoaderError from './AbstractLoaderError';\n\nexport default class LoaderValidationError extends AbstractLoaderError {\n constructor(datasetType, datasetFileType, datasetUrl, reason) {\n super(`Error while validating ${datasetType}.`);\n this.name = 'LoaderValidationError';\n\n this.datasetType = datasetType;\n this.datasetFileType = datasetFileType;\n this.datasetUrl = datasetUrl;\n this.reason = reason;\n }\n\n warnInConsole() {\n const {\n datasetType, datasetUrl, reason,\n } = this;\n console.warn(\n `${datasetType} from ${datasetUrl}: validation failed`,\n JSON.stringify(reason, null, 2),\n );\n }\n}\n","import AbstractLoaderError from './AbstractLoaderError';\n\nexport default class LoaderNotFoundError extends AbstractLoaderError {\n constructor(datasetType, datasetFileType, datasetUrl) {\n super(`Error finding loader for ${datasetType}.`);\n this.name = 'LoaderNotFoundError';\n\n this.datasetType = datasetType;\n this.datasetFileType = datasetFileType;\n this.datasetUrl = datasetUrl;\n }\n\n warnInConsole() {\n const {\n datasetType, datasetFileType, datasetUrl,\n } = this;\n if (datasetFileType && datasetUrl) {\n console.warn(\n `${datasetType} from ${datasetUrl}: unable to find loader for fileType ${datasetFileType}`,\n );\n } else {\n console.warn(\n `${datasetType}: unable to find loader`,\n );\n }\n }\n}\n","\n\nexport default class LoaderResult {\n constructor(data, url, coordinationValues = null) {\n this.data = data;\n this.url = url;\n this.coordinationValues = coordinationValues;\n }\n}\n","import Ajv from 'ajv';\nimport AbstractTwoStepLoader from './AbstractTwoStepLoader';\nimport { LoaderValidationError, AbstractLoaderError } from './errors/index';\nimport LoaderResult from './LoaderResult';\n\nimport cellsSchema from '../schemas/cells.schema.json';\nimport moleculesSchema from '../schemas/molecules.schema.json';\nimport neighborhoodsSchema from '../schemas/neighborhoods.schema.json';\nimport rasterSchema from '../schemas/raster.schema.json';\nimport cellSetsSchema from '../schemas/cell-sets.schema.json';\n\nconst typeToSchema = {\n cells: cellsSchema,\n molecules: moleculesSchema,\n neighborhoods: neighborhoodsSchema,\n raster: rasterSchema,\n 'cell-sets': cellSetsSchema,\n};\n\nexport default class JsonLoader extends AbstractTwoStepLoader {\n constructor(dataSource, params) {\n super(dataSource, params);\n\n const { type } = params;\n this.schema = typeToSchema[type];\n }\n\n load() {\n const {\n url, type, fileType,\n } = this;\n if (this.data) {\n return this.data;\n }\n this.data = this.dataSource.data\n .then((data) => {\n if (data instanceof AbstractLoaderError) {\n return Promise.reject(data);\n }\n const [valid, reason] = this.validate(data);\n if (valid) {\n return Promise.resolve(new LoaderResult(data, url));\n }\n return Promise.reject(new LoaderValidationError(type, fileType, url, reason));\n });\n return this.data;\n }\n\n validate(data) {\n const { schema, type } = this;\n if (!schema) {\n throw Error(`No schema for ${type}`);\n }\n const validate = new Ajv().compile(schema);\n const valid = validate(data);\n let failureReason;\n if (!valid) {\n failureReason = validate.errors;\n }\n return [valid, failureReason];\n }\n}\n","import { openArray } from 'zarr';\nimport AbstractTwoStepLoader from './AbstractTwoStepLoader';\nimport LoaderResult from './LoaderResult';\n\nexport default class MatrixZarrLoader extends AbstractTwoStepLoader {\n loadAttrs() {\n if (this.attrs) {\n return this.attrs;\n }\n this.attrs = this.dataSource.getJson('.zattrs');\n return this.attrs;\n }\n\n loadArr() {\n const { store } = this.dataSource;\n if (this.arr) {\n return this.arr;\n }\n this.arr = openArray({ store, path: '/', mode: 'r' }).then(z => new Promise((resolve) => {\n z.getRaw([null, null])\n .then(resolve);\n }));\n return this.arr;\n }\n\n load() {\n return Promise\n .all([this.loadAttrs(), this.loadArr()])\n .then(data => Promise.resolve(new LoaderResult(data, null)));\n }\n}\n","import genesSchema from '../schemas/genes.schema.json';\nimport JsonLoader from './JsonLoader';\nimport { AbstractLoaderError } from './errors';\nimport LoaderResult from './LoaderResult';\n\nexport default class GenesJsonAsMatrixZarrLoader extends JsonLoader {\n constructor(dataSource, params) {\n super(dataSource, params);\n\n this.schema = genesSchema;\n }\n\n async load() {\n const payload = await super.load().catch(reason => Promise.resolve(reason));\n if (payload instanceof AbstractLoaderError) {\n return Promise.reject(payload);\n }\n const { data, url } = payload;\n const cols = Object.keys(data);\n const rows = (cols.length > 0 ? Object.keys(data[cols[0]].cells) : []);\n const attrs = { rows, cols };\n\n const normalizedFlatMatrix = rows\n .flatMap(cellId => cols.map(\n geneId => (data[geneId].cells[cellId] / data[geneId].max) * 255,\n ));\n // Need to wrap the NestedArray to mock the HTTPStore-based array\n // which returns promises.\n const arr = { data: Uint8Array.from(normalizedFlatMatrix) };\n return Promise.resolve(new LoaderResult([attrs, arr], url));\n }\n}\n","import { extent } from 'd3-array';\nimport range from 'lodash/range';\nimport clustersSchema from '../schemas/clusters.schema.json';\nimport JsonLoader from './JsonLoader';\nimport { AbstractLoaderError } from './errors';\nimport LoaderResult from './LoaderResult';\n\nexport default class ClustersJsonAsMatrixZarrLoader extends JsonLoader {\n constructor(dataSource, params) {\n super(dataSource, params);\n\n this.schema = clustersSchema;\n }\n\n async load() {\n const payload = await super.load().catch(reason => Promise.resolve(reason));\n if (payload instanceof AbstractLoaderError) {\n return Promise.reject(payload);\n }\n const { data, url } = payload;\n const { rows, cols, matrix } = data;\n const attrs = {\n rows: cols,\n cols: rows,\n };\n const shape = [attrs.rows.length, attrs.cols.length];\n // Normalize values by converting to one-byte integers.\n // Normalize for each gene (column) independently.\n const normalizedMatrix = matrix.map((col) => {\n const [min, max] = extent(col);\n const normalize = d => Math.floor(((d - min) / (max - min)) * 255);\n return col.map(normalize);\n });\n // Transpose the normalized matrix.\n const tNormalizedMatrix = range(shape[0])\n .map(i => range(shape[1]).map(j => normalizedMatrix[j][i]));\n // Flatten the transposed matrix.\n const normalizedFlatMatrix = tNormalizedMatrix.flat();\n // Need to wrap the NestedArray to mock the HTTPStore-based array\n // which returns promises.\n const arr = { data: Uint8Array.from(normalizedFlatMatrix) };\n return Promise.resolve(new LoaderResult([attrs, arr], url));\n }\n}\n","import cellSetsSchema from '../../schemas/cell-sets.schema.json';\nimport cellSetsTabularSchema from '../../schemas/cell-sets-tabular.schema.json';\n\nexport const FILE_EXTENSION_JSON = 'json';\nexport const MIME_TYPE_JSON = 'application/json';\n\nexport const FILE_EXTENSION_TABULAR = 'csv';\nexport const MIME_TYPE_TABULAR = 'text/csv';\nexport const SEPARATOR_TABULAR = ',';\n// The NA value below corresponds to the allowed string enum\n// value \"NA\" in the cell-sets-tabular JSON schema.\nexport const NA_VALUE_TABULAR = 'NA';\n\nexport const SETS_DATATYPE_CELL = 'cell';\nexport const HIERARCHICAL_SCHEMAS = {\n cell: {\n latestVersion: '0.1.3',\n schema: cellSetsSchema,\n },\n};\n\nexport const TABULAR_SCHEMAS = {\n cell: {\n schema: cellSetsTabularSchema,\n },\n};\n","import React from 'react';\nimport { COORDINATE_SYSTEM } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport {\n SETS_DATATYPE_CELL,\n HIERARCHICAL_SCHEMAS,\n} from './sets/constants';\nimport { PRIMARY_CARD } from './classNames';\n\nexport function makeCellStatusMessage(cellInfoFactors) {\n return Object.entries(cellInfoFactors).map(\n ([factor, value]) => `${factor}: ${value}`,\n ).join('; ');\n}\n\nexport function cellLayerDefaultProps(cells, updateStatus, setCellHighlight, setComponentHover) {\n return {\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: cells,\n pickable: true,\n autoHighlight: true,\n stroked: true,\n filled: true,\n getElevation: 0,\n onHover: (info) => {\n // Notify the parent component that its child component is\n // the \"hover source\".\n if (setComponentHover) {\n setComponentHover();\n }\n if (info.object) {\n const [cellId, cellInfo] = info.object;\n const { factors = {} } = cellInfo;\n if (updateStatus) {\n updateStatus(makeCellStatusMessage(factors));\n }\n if (setCellHighlight) {\n setCellHighlight(cellId);\n }\n } else if (setCellHighlight) {\n // Clear the currently-hovered cell info by passing null.\n setCellHighlight('');\n }\n },\n };\n}\n\nexport const DEFAULT_DARK_COLOR = [50, 50, 50];\nexport const DEFAULT_LIGHT_COLOR = [200, 200, 200];\n\nexport function getDefaultColor(theme) {\n return theme === 'dark' ? DEFAULT_DARK_COLOR : DEFAULT_LIGHT_COLOR;\n}\n\n// From https://personal.sron.nl/~pault/#sec:qualitative\nexport const PALETTE = [\n [68, 119, 170],\n [136, 204, 238],\n [68, 170, 153],\n [17, 119, 51],\n [153, 153, 51],\n [221, 204, 119],\n [204, 102, 119],\n [136, 34, 85],\n [170, 68, 153],\n];\n\nexport const VIEWER_PALETTE = [\n [0, 0, 255],\n [0, 255, 0],\n [255, 0, 255],\n [255, 255, 0],\n [0, 255, 255],\n [255, 255, 255],\n [255, 128, 0],\n [255, 0, 0],\n];\n\nexport const COLORMAP_OPTIONS = [\n 'viridis',\n 'greys',\n 'magma',\n 'jet',\n 'hot',\n 'bone',\n 'copper',\n 'summer',\n 'density',\n 'inferno',\n];\n\nexport const DEFAULT_GL_OPTIONS = { webgl2: true };\n\nexport function createDefaultUpdateStatus(componentName) {\n return message => console.warn(`${componentName} updateStatus: ${message}`);\n}\n\nexport function createDefaultUpdateCellsSelection(componentName) {\n return cellsSelection => console.warn(`${componentName} updateCellsSelection: ${cellsSelection}`);\n}\n\nexport function createDefaultUpdateCellsHover(componentName) {\n return hoverInfo => console.warn(`${componentName} updateCellsHover: ${hoverInfo.cellId}`);\n}\n\nexport function createDefaultUpdateGenesHover(componentName) {\n return hoverInfo => console.warn(`${componentName} updateGenesHover: ${hoverInfo.geneId}`);\n}\n\nexport function createDefaultUpdateViewInfo(componentName) {\n return viewInfo => console.warn(`${componentName} updateViewInfo: ${viewInfo}`);\n}\n\nexport function createDefaultClearPleaseWait() {\n return () => {};\n}\n\n\n/**\n * Copy a typed array into a new array buffer.\n * @param {Uint8Array} arr The typed array to be copied.\n * @returns {Uint8Array} The copied array.\n */\nexport function copyUint8Array(arr) {\n const newBuffer = new ArrayBuffer(arr.buffer.byteLength);\n const newArr = new Uint8Array(newBuffer);\n newArr.set(arr);\n return newArr;\n}\n\nexport function getNextNumberedNodeName(nodes, prefix) {\n let i = 1;\n if (nodes) {\n // eslint-disable-next-line no-loop-func\n while (nodes.find(n => n.name === `${prefix}${i}`)) {\n // eslint-disable-next-line no-plusplus\n i++;\n }\n }\n return `${prefix}${i}`;\n}\n\n/**\n * Create a new selected cell set based on a cell selection.\n * @param {string[]} cellSelection An array of cell IDs.\n * @param {object[]} additionalCellSets The previous array of user-defined cell sets.\n * @param {function} setCellSetSelection The setter function for cell set selections.\n * @param {function} setAdditionalCellSets The setter function for user-defined cell sets.\n */\nexport function setCellSelection(cellSelection, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding, prefix = 'Selection ') {\n const CELL_SELECTIONS_LEVEL_ZERO_NAME = 'My Selections';\n\n const selectionsLevelZeroNode = additionalCellSets?.tree.find(\n n => n.name === CELL_SELECTIONS_LEVEL_ZERO_NAME,\n );\n const nextAdditionalCellSets = {\n version: HIERARCHICAL_SCHEMAS[SETS_DATATYPE_CELL].latestVersion,\n datatype: SETS_DATATYPE_CELL,\n tree: [...(additionalCellSets ? additionalCellSets.tree : [])],\n };\n\n const nextName = getNextNumberedNodeName(selectionsLevelZeroNode?.children, prefix);\n let colorIndex = 0;\n if (selectionsLevelZeroNode) {\n colorIndex = selectionsLevelZeroNode.children.length;\n selectionsLevelZeroNode.children.push({\n name: nextName,\n set: cellSelection.map(d => [d, null]),\n });\n } else {\n nextAdditionalCellSets.tree.push({\n name: CELL_SELECTIONS_LEVEL_ZERO_NAME,\n children: [\n {\n name: nextName,\n set: cellSelection.map(d => [d, null]),\n },\n ],\n });\n }\n setAdditionalCellSets(nextAdditionalCellSets);\n const nextPath = ['My Selections', nextName];\n setCellSetColor([\n ...(cellSetColor || []),\n {\n path: nextPath,\n color: PALETTE[colorIndex % PALETTE.length],\n },\n ]);\n setCellSetSelection([nextPath]);\n setCellColorEncoding('cellSetSelection');\n}\n\nexport function mergeCellSets(cellSets, additionalCellSets) {\n return {\n version: HIERARCHICAL_SCHEMAS[SETS_DATATYPE_CELL].latestVersion,\n datatype: SETS_DATATYPE_CELL,\n tree: [\n ...(cellSets ? cellSets.tree : []),\n ...(additionalCellSets ? additionalCellSets.tree : []),\n ],\n };\n}\n\nexport function createWarningComponent(props) {\n return () => {\n const {\n title,\n message,\n } = props;\n return (\n <div className={PRIMARY_CARD}>\n <h1>{title}</h1>\n <div>{message}</div>\n </div>\n );\n };\n}\n\nexport function asEsModule(component) {\n return {\n __esModule: true,\n default: component,\n };\n}\n\n\nexport function formatBytes(bytes, decimals = 2) {\n if (bytes === 0) return '0 Bytes';\n\n const k = 1024;\n const dm = decimals < 0 ? 0 : decimals;\n const sizes = ['Bytes', 'KB', 'MB', 'GB'];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n // eslint-disable-next-line no-restricted-properties\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;\n}\n\nexport const getStatsForResolution = (loader, resolution) => {\n const { shape, labels } = loader[resolution];\n const height = shape[labels.indexOf('y')];\n const width = shape[labels.indexOf('x')];\n const depth = shape[labels.indexOf('z')];\n // eslint-disable-next-line no-bitwise\n const depthDownsampled = Math.max(1, depth >> resolution);\n // Check memory allocation limits for Float32Array (used in XR3DLayer for rendering)\n const totalBytes = 4 * height * width * depthDownsampled;\n return {\n height, width, depthDownsampled, totalBytes,\n };\n};\n\nexport const canLoadResolution = (loader, resolution) => {\n const {\n totalBytes, height, width, depthDownsampled,\n } = getStatsForResolution(\n loader,\n resolution,\n );\n const maxHeapSize = window.performance?.memory\n && window.performance?.memory?.jsHeapSizeLimit / 2;\n const maxSize = maxHeapSize || (2 ** 31) - 1;\n // 2048 is a normal texture size limit although some browsers go larger.\n return (\n totalBytes < maxSize\n && height <= 2048\n && depthDownsampled <= 2048\n && width <= 2048\n && depthDownsampled > 1\n );\n};\n","import { RENDERING_MODES } from '@hms-dbmi/viv';\n\nexport const GLOBAL_LABELS = ['z', 't'];\n\nexport const DEFAULT_RASTER_DOMAIN_TYPE = 'Min/Max';\n\nexport const DEFAULT_RASTER_LAYER_PROPS = {\n visible: true,\n colormap: null,\n opacity: 1,\n domainType: DEFAULT_RASTER_DOMAIN_TYPE,\n transparentColor: [0, 0, 0],\n renderingMode: RENDERING_MODES.ADDITIVE,\n use3d: false,\n};\n\nexport const DEFAULT_MOLECULES_LAYER = {\n opacity: 1, radius: 20, visible: true,\n};\nexport const DEFAULT_CELLS_LAYER = {\n opacity: 1, radius: 50, visible: true, stroked: false,\n};\nexport const DEFAULT_NEIGHBORHOODS_LAYER = {\n visible: false,\n};\n\nexport const DEFAULT_LAYER_TYPE_ORDERING = [\n 'molecules',\n 'cells',\n 'neighborhoods',\n 'raster',\n];\n","// List of the GLSL colormaps available,\n// to validate against before string replacing.\nexport const GLSL_COLORMAPS = [\n 'plasma',\n 'viridis',\n 'jet',\n];\nexport const GLSL_COLORMAP_DEFAULT = 'plasma';\nexport const COLORMAP_SHADER_PLACEHOLDER = 'COLORMAP_FUNC';\n","import GL from '@luma.gl/constants'; // eslint-disable-line import/no-extraneous-dependencies\nimport { project32, picking } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { Texture2D, isWebGL2 } from '@luma.gl/core';\nimport { XRLayer } from '@hms-dbmi/viv';\nimport { fs, vs } from './bitmask-layer-shaders';\nimport {\n GLSL_COLORMAPS,\n GLSL_COLORMAP_DEFAULT,\n COLORMAP_SHADER_PLACEHOLDER,\n} from './constants';\n\nfunction padWithDefault(arr, defaultValue, padWidth) {\n const newArr = [...arr];\n for (let i = 0; i < padWidth; i += 1) {\n newArr.push(defaultValue);\n }\n return newArr;\n}\n\nconst defaultProps = {\n hoveredCell: { type: 'number', value: null, compare: true },\n cellColorData: { type: 'object', value: null, compare: true },\n colormap: { type: 'string', value: GLSL_COLORMAP_DEFAULT, compare: true },\n expressionData: { type: 'object', value: null, compare: true },\n};\n\n/**\n * A BitmapLayer that performs aggregation in the fragment shader,\n * and renders its texture from a Uint8Array rather than an ImageData.\n */\nexport default class BitmaskLayer extends XRLayer {\n // eslint-disable-next-line class-methods-use-this\n getShaders() {\n const { colormap } = this.props;\n return {\n fs,\n vs,\n modules: [project32, picking],\n defines: {\n [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap)\n ? colormap\n : GLSL_COLORMAP_DEFAULT,\n },\n };\n }\n\n updateState({ props, oldProps, changeFlags }) {\n super.updateState({ props, oldProps, changeFlags });\n if (props.cellColorData !== oldProps.cellColorData) {\n this.setColorTexture();\n }\n if (props.expressionData !== oldProps.expressionData) {\n const { expressionData, cellTexHeight, cellTexWidth } = this.props;\n const expressionTex = this.dataToTexture(\n expressionData,\n cellTexWidth,\n cellTexHeight,\n );\n this.setState({ expressionTex });\n }\n if (props.colormap !== oldProps.colormap) {\n const { gl } = this.context;\n if (this.state.model) {\n this.state.model.delete();\n }\n // eslint-disable-next-line no-underscore-dangle\n this.setState({ model: this._getModel(gl) });\n\n this.getAttributeManager().invalidateAll();\n }\n }\n\n setColorTexture() {\n const {\n cellColorData: data,\n cellTexHeight: height,\n cellTexWidth: width,\n } = this.props;\n const colorTex = new Texture2D(this.context.gl, {\n width,\n height,\n // Only use Float32 so we don't have to write two shaders\n data,\n // we don't want or need mimaps\n mipmaps: false,\n parameters: {\n // NEAREST for integer data\n [GL.TEXTURE_MIN_FILTER]: GL.NEAREST,\n [GL.TEXTURE_MAG_FILTER]: GL.NEAREST,\n // CLAMP_TO_EDGE to remove tile artifacts\n [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,\n },\n format: GL.RGB,\n dataFormat: GL.RGB,\n type: GL.UNSIGNED_BYTE,\n });\n this.setState({ colorTex });\n }\n\n draw(opts) {\n const { uniforms } = opts;\n const {\n channelsVisible,\n hoveredCell,\n colorScaleLo,\n colorScaleHi,\n isExpressionMode,\n } = this.props;\n const {\n textures, model, colorTex, expressionTex,\n } = this.state;\n // Render the image\n if (textures && model && colorTex) {\n model\n .setUniforms(\n Object.assign({}, uniforms, {\n hovered: hoveredCell || 0,\n colorTex,\n expressionTex,\n colorTexHeight: colorTex.height,\n colorTexWidth: colorTex.width,\n channelsVisible: padWithDefault(\n channelsVisible,\n false,\n // There are six texture entries on the shaders\n 6 - channelsVisible.length,\n ),\n uColorScaleRange: [colorScaleLo, colorScaleHi],\n uIsExpressionMode: isExpressionMode,\n ...textures,\n }),\n )\n .draw();\n }\n }\n\n /**\n * This function creates textures from the data\n */\n dataToTexture(data, width, height) {\n const isWebGL2On = isWebGL2(this.context.gl);\n return new Texture2D(this.context.gl, {\n width,\n height,\n // Only use Float32 so we don't have to write two shaders\n data: new Float32Array(data),\n // we don't want or need mimaps\n mipmaps: false,\n parameters: {\n // NEAREST for integer data\n [GL.TEXTURE_MIN_FILTER]: GL.NEAREST,\n [GL.TEXTURE_MAG_FILTER]: GL.NEAREST,\n // CLAMP_TO_EDGE to remove tile artifacts\n [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,\n },\n format: isWebGL2On ? GL.R32F : GL.LUMINANCE,\n dataFormat: isWebGL2On ? GL.RED : GL.LUMINANCE,\n type: GL.FLOAT,\n });\n }\n}\nBitmaskLayer.layerName = 'BitmaskLayer';\nBitmaskLayer.defaultProps = defaultProps;\n","import glsl from 'glslify';\n\nexport const vs = glsl`\n#define SHADER_NAME bitmask-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute vec3 instancePickingColors;\n\nvarying vec2 vTexCoord;\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = instancePickingColors;\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vTexCoord = texCoords;\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;\n\nexport const fs = glsl`\n#define SHADER_NAME bitmask-layer-fragment-shader\nprecision highp float;\n\n#pragma glslify: plasma = require(\"glsl-colormap/plasma\")\n#pragma glslify: viridis = require(\"glsl-colormap/viridis\")\n#pragma glslify: greys = require(\"glsl-colormap/greys\")\n#pragma glslify: magma = require(\"glsl-colormap/magma\")\n#pragma glslify: jet = require(\"glsl-colormap/jet\")\n#pragma glslify: bone = require(\"glsl-colormap/bone\")\n#pragma glslify: copper = require(\"glsl-colormap/copper\")\n#pragma glslify: density = require(\"glsl-colormap/density\")\n#pragma glslify: inferno = require(\"glsl-colormap/inferno\")\n#pragma glslify: cool = require(\"glsl-colormap/cool\")\n#pragma glslify: hot = require(\"glsl-colormap/hot\")\n#pragma glslify: spring = require(\"glsl-colormap/spring\")\n#pragma glslify: summer = require(\"glsl-colormap/summer\")\n#pragma glslify: autumn = require(\"glsl-colormap/autumn\")\n#pragma glslify: winter = require(\"glsl-colormap/winter\")\n\n// Data (mask) texture\nuniform sampler2D channel0;\nuniform sampler2D channel1;\nuniform sampler2D channel2;\nuniform sampler2D channel3;\nuniform sampler2D channel4;\nuniform sampler2D channel5;\n\n// Color texture\nuniform sampler2D colorTex;\nuniform float colorTexHeight;\nuniform float colorTexWidth;\nuniform float hovered;\n// range\nuniform bool channelsVisible[6];\n\n// Expression mapping\nuniform vec2 uColorScaleRange;\nuniform bool uIsExpressionMode;\nuniform sampler2D expressionTex;\n\n// opacity\nuniform float opacity;\n\nvarying vec2 vTexCoord;\n\nvec4 sampleAndGetColor(sampler2D dataTex, vec2 coord, bool isOn){\n float sampledData = texture(dataTex, coord).r;\n vec4 hoveredColor = float(sampledData == hovered && sampledData > 0. && hovered > 0.) * vec4(0., 0., 1., 1.);\n // Colors are laid out corresponding to ids in row-major order in the texture. So if width of the texture is 10, and you want ID 25,\n // you need coordinate (1, 4) (i.e 2 rows down, and 5 columns over indexed from 0 for a total of 25 units covered in row major order).\n vec2 colorTexCoord = vec2(mod(sampledData, colorTexWidth) / colorTexWidth, floor(sampledData / colorTexWidth) / (colorTexHeight - 1.));\n float expressionValue = texture(expressionTex, colorTexCoord).r / 255.;\n float scaledExpressionValue = (expressionValue - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));\n vec4 sampledColor = float(uIsExpressionMode) * COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)) + (1. - float(uIsExpressionMode)) * vec4(texture(colorTex, colorTexCoord).rgb, 1.);\n // Only return a color if the data is non-zero.\n return max(0., min(sampledData, 1.)) * float(isOn) * (sampledColor + hoveredColor);\n}\n\nvoid main() {\n\n gl_FragColor = sampleAndGetColor(channel0, vTexCoord, channelsVisible[0]);\n\n // If the sampled color and the currently stored color (gl_FragColor) are identical, don't blend and use the sampled color,\n // otherwise just use the currently stored color. Repeat this for all channels.\n vec4 sampledColor = sampleAndGetColor(channel1, vTexCoord, channelsVisible[1]);\n gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;\n sampledColor = sampleAndGetColor(channel2, vTexCoord, channelsVisible[2]);\n gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;\n sampledColor = sampleAndGetColor(channel3, vTexCoord, channelsVisible[3]);\n gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;\n sampledColor = sampleAndGetColor(channel4, vTexCoord, channelsVisible[4]);\n gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;\n sampledColor = sampleAndGetColor(channel5, vTexCoord, channelsVisible[5]);\n gl_FragColor = (sampledColor == gl_FragColor || sampledColor == vec4(0.)) ? gl_FragColor : sampledColor;\n // Apply the opacity if there is pixel data, and if the pixel data is empty i.e no segmentation, use 0 opacity.\n gl_FragColor = vec4(gl_FragColor.rgb, (gl_FragColor.rgb == vec3(0., 0., 0.)) ? 0.0 : opacity);\n\n geometry.uv = vTexCoord;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;\n","import { getChannelStats } from '@hms-dbmi/viv';\nimport { Matrix4 } from 'math.gl';\n\nasync function getSingleSelectionStats2D({ loader, selection }) {\n const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;\n const raster = await data.getRaster({ selection });\n const selectionStats = getChannelStats(raster.data);\n const { domain, contrastLimits: slider } = selectionStats;\n return { domain, slider };\n}\n\nasync function getSingleSelectionStats3D({ loader, selection }) {\n const lowResSource = loader[loader.length - 1];\n const { shape, labels } = lowResSource;\n // eslint-disable-next-line no-bitwise\n const sizeZ = shape[labels.indexOf('z')] >> (loader.length - 1);\n const raster0 = await lowResSource.getRaster({\n selection: { ...selection, z: 0 },\n });\n const rasterMid = await lowResSource.getRaster({\n selection: { ...selection, z: Math.floor(sizeZ / 2) },\n });\n const rasterTop = await lowResSource.getRaster({\n selection: { ...selection, z: Math.max(0, sizeZ - 1) },\n });\n const stats0 = getChannelStats(raster0.data);\n const statsMid = getChannelStats(rasterMid.data);\n const statsTop = getChannelStats(rasterTop.data);\n return {\n domain: [\n Math.min(stats0.domain[0], statsMid.domain[0], statsTop.domain[0]),\n Math.max(stats0.domain[1], statsMid.domain[1], statsTop.domain[1]),\n ],\n slider: [\n Math.min(\n stats0.contrastLimits[0],\n statsMid.contrastLimits[0],\n statsTop.contrastLimits[0],\n ),\n Math.max(\n stats0.contrastLimits[1],\n statsMid.contrastLimits[1],\n statsTop.contrastLimits[1],\n ),\n ],\n };\n}\n\n/**\n * Get bounding cube for a given loader i.e [[0, width], [0, height], [0, depth]]\n * @param {Object} loader PixelSource|PixelSource[]\n * @param {[]} selection Selection for stats.\n * @param {boolean} use3d Whether or not to get 3d stats.\n * @returns {Object} { domains, sliders }\n */\nexport const getSingleSelectionStats = async ({ loader, selection, use3d }) => {\n const getStats = use3d\n ? getSingleSelectionStats3D\n : getSingleSelectionStats2D;\n return getStats({ loader, selection });\n};\n\nexport const getMultiSelectionStats = async ({ loader, selections, use3d }) => {\n const stats = await Promise.all(\n selections.map(selection => getSingleSelectionStats({ loader, selection, use3d })),\n );\n const domains = stats.map(stat => stat.domain);\n const sliders = stats.map(stat => stat.slider);\n return { domains, sliders };\n};\n\n/**\n * Get physical size scaling Matrix4\n * @param {Object} loader PixelSource\n * @returns {Object} matrix\n */\nexport function getPhysicalSizeScalingMatrix(loader) {\n const { x, y, z } = loader?.meta?.physicalSizes ?? {};\n if (x?.size && y?.size && z?.size) {\n const min = Math.min(z.size, x.size, y.size);\n const ratio = [x.size / min, y.size / min, z.size / min];\n return new Matrix4().scale(ratio);\n }\n return new Matrix4().identity();\n}\n\n/**\n * Get bounding cube for a given loader\n * @param {Object} loader PixelSource|PixelSource[]\n * @returns {Array} [0, width], [0, height], [0, depth]]\n */\nexport function getBoundingCube(loader) {\n const source = Array.isArray(loader) ? loader[0] : loader;\n const { shape, labels } = source;\n const physicalSizeScalingMatrix = getPhysicalSizeScalingMatrix(source);\n const xSlice = [0, physicalSizeScalingMatrix[0] * shape[labels.indexOf('x')]];\n const ySlice = [0, physicalSizeScalingMatrix[5] * shape[labels.indexOf('y')]];\n const zSlice = [\n 0,\n physicalSizeScalingMatrix[10] * shape[labels.indexOf('z')],\n ];\n return [xSlice, ySlice, zSlice];\n}\n\nexport function abbreviateNumber(value) {\n // Return an abbreviated representation of value, in 5 characters or less.\n\n const maxLength = 5;\n let maxNaiveDigits = maxLength;\n\n /* eslint-disable no-plusplus */\n if (!Number.isInteger(value)) {\n --maxNaiveDigits;\n } // Wasted on \".\"\n if (value < 1) {\n --maxNaiveDigits;\n } // Wasted on \"0.\"\n /* eslint-disable no-plusplus */\n\n const naive = Intl.NumberFormat('en-US', {\n maximumSignificantDigits: maxNaiveDigits,\n useGrouping: false,\n }).format(value);\n if (naive.length <= maxLength) return naive;\n\n // \"e+9\" consumes 3 characters, so if we even had two significant digits,\n // it would take take us to six characters, including the decimal point.\n return value.toExponential(0);\n}\n","/* eslint-disable no-plusplus */\nimport shortNumber from 'short-number';\nimport isEqual from 'lodash/isEqual';\nimport {\n getDefaultInitialViewState,\n MultiscaleImageLayer,\n ImageLayer,\n VolumeLayer,\n} from '@hms-dbmi/viv';\nimport { extent } from 'd3-array';\nimport { Matrix4 } from 'math.gl';\nimport { divide, compare, unit } from 'mathjs';\nimport { pluralize, getSourceFromLoader, isRgb } from '../../utils';\nimport { VIEWER_PALETTE } from '../utils';\nimport {\n GLOBAL_LABELS,\n DEFAULT_RASTER_LAYER_PROPS,\n DEFAULT_LAYER_TYPE_ORDERING,\n} from './constants';\nimport BitmaskLayer from '../../layers/BitmaskLayer';\nimport { getMultiSelectionStats } from '../layer-controller/utils';\n\nexport function square(x, y, r) {\n return [[x, y + r], [x + r, y], [x, y - r], [x - r, y]];\n}\n\n/**\n * Sort spatial layer definition array,\n * to keep the ordering in the layer controller\n * consistent.\n * Intended to be used with auto-initialized layer\n * definition arrays only, as a pre-defined layer array\n * should not be re-ordered.\n * @param {object[]} layers Array of layer definition objects.\n * Object must have a .type property.\n */\nexport function sortLayers(layers) {\n return layers.sort((a, b) => (\n DEFAULT_LAYER_TYPE_ORDERING.indexOf(a.type) - DEFAULT_LAYER_TYPE_ORDERING.indexOf(b.type)\n ));\n}\n\n/**\n * Return the midpoint of the global dimensions.\n * @param {object} source PixelSource object from Viv\n * @returns {object} The selection.\n */\nfunction getDefaultGlobalSelection(source) {\n const globalIndices = source.labels\n .filter(dim => GLOBAL_LABELS.includes(dim));\n const selection = {};\n globalIndices.forEach((dim) => {\n selection[dim] = Math.floor(\n (source.shape[source.labels.indexOf(dim)] || 0) / 2,\n );\n });\n return selection;\n}\n\n/**\n * Create a default selection using the midpoint of the available global dimensions,\n * and then the first four available selections from the first selectable channel.\n * @param {object} source PixelSource object from Viv\n * @returns {object} The selection.\n */\nfunction buildDefaultSelection(source) {\n const selection = [];\n const globalSelection = getDefaultGlobalSelection(source);\n // First non-global dimension with some sort of selectable values\n const firstNonGlobalDimension = source.labels.filter(\n dim => !GLOBAL_LABELS.includes(dim)\n && source.shape[source.labels.indexOf(dim)],\n )[0];\n for (let i = 0; i < Math.min(4, source.shape[\n source.labels.indexOf(firstNonGlobalDimension)\n ]); i += 1) {\n selection.push(\n {\n [firstNonGlobalDimension]: i,\n ...globalSelection,\n },\n );\n }\n return selection;\n}\n\n/**\n * @param {Array.<number>} shape loader shape\n */\nexport function isInterleaved(shape) {\n const lastDimSize = shape[shape.length - 1];\n return lastDimSize === 3 || lastDimSize === 4;\n}\n\n/**\n * Initialize the channel selections for an individual layer.\n * @param {object} loader A viv loader instance with channel names appended by Vitessce loaders\n * of the form { data: (PixelSource[]|PixelSource), metadata: Object, channels }\n * @returns {object[]} An array of selected channels with default\n * domain/slider settings.\n */\nexport async function initializeLayerChannels(loader, use3d) {\n const result = [];\n const source = getSourceFromLoader(loader);\n // Add channel automatically as the first avaialable value for each dimension.\n let defaultSelection = buildDefaultSelection(source);\n defaultSelection = isInterleaved(source.shape)\n ? [{ ...defaultSelection[0], c: 0 }] : defaultSelection;\n const stats = await getMultiSelectionStats({\n loader: loader.data, selections: defaultSelection, use3d,\n });\n\n const domains = isRgb(loader)\n ? [[0, 255], [0, 255], [0, 255]]\n : stats.domains;\n const colors = isRgb(loader)\n ? [[255, 0, 0], [0, 255, 0], [0, 0, 255]]\n : null;\n const sliders = isRgb(loader)\n ? [[0, 255], [0, 255], [0, 255]]\n : stats.sliders;\n\n defaultSelection.forEach((selection, i) => {\n const domain = domains[i];\n const slider = sliders[i];\n const channel = {\n selection,\n // eslint-disable-next-line no-nested-ternary\n color: colors ? colors[i]\n : defaultSelection.length !== 1\n ? VIEWER_PALETTE[i] : [255, 255, 255],\n visible: true,\n slider: slider || domain,\n };\n result.push(channel);\n });\n return result;\n}\n\nfunction getMetaWithTransformMatrices(imageMeta, imageLoaders) {\n // Do not fill in transformation matrices if any of the layers specify one.\n const sources = imageLoaders.map(loader => getSourceFromLoader(loader));\n if (\n imageMeta.map(meta => meta?.metadata?.transform?.matrix\n || meta?.metadata?.transform?.scale\n || meta?.metadata?.transform?.translate).some(Boolean)\n || sources.every(\n source => !source.meta?.physicalSizes?.x || !source.meta?.physicalSizes?.y,\n )\n ) {\n return imageMeta;\n }\n // Get the minimum physical among all the current images.\n const minPhysicalSize = sources.reduce((acc, source) => {\n const hasZPhyscialSize = source.meta?.physicalSizes?.z?.size;\n const sizes = [\n unit(`${source.meta?.physicalSizes.x.size} ${source.meta?.physicalSizes.x.unit}`.replace('µ', 'u')),\n unit(`${source.meta?.physicalSizes.y.size} ${source.meta?.physicalSizes.y.unit}`.replace('µ', 'u')),\n ];\n if (hasZPhyscialSize) {\n sizes.push(unit(`${source.meta?.physicalSizes.z.size} ${source.meta?.physicalSizes.z.unit}`.replace('µ', 'u')));\n }\n acc[0] = (acc[0] === undefined || compare(sizes[0], acc[0]) === -1) ? sizes[0] : acc[0];\n acc[1] = (acc[1] === undefined || compare(sizes[1], acc[1]) === -1) ? sizes[1] : acc[1];\n acc[2] = (acc[2] === undefined || compare(sizes[2], acc[2]) === -1) ? sizes[2] : acc[2];\n return acc;\n }, []);\n const imageMetaWithTransform = imageMeta.map((meta, j) => {\n const source = sources[j];\n const hasZPhyscialSize = source.meta?.physicalSizes?.z?.size;\n const sizes = [\n unit(`${source.meta?.physicalSizes.x.size} ${source.meta?.physicalSizes.x.unit}`.replace('µ', 'u')),\n unit(`${source.meta?.physicalSizes.y.size} ${source.meta?.physicalSizes.y.unit}`.replace('µ', 'u')),\n ];\n if (hasZPhyscialSize) {\n sizes.push(unit(`${source.meta?.physicalSizes.z.size} ${source.meta?.physicalSizes.z.unit}`.replace('µ', 'u')));\n }\n // Find the ratio of the sizes to get the scaling factor.\n const scale = sizes.map((i, k) => divide(i, minPhysicalSize[k]));\n // Add in z dimension needed for Matrix4 scale API.\n if (!scale[2]) {\n scale[2] = 1;\n }\n // no need to store/use identity scaling\n if (isEqual(scale, [1, 1, 1])) {\n return meta;\n }\n // Make sure to scale the z direction by one.\n const matrix = new Matrix4().scale([...scale]);\n const newMeta = { ...meta };\n newMeta.metadata = {\n ...newMeta.metadata,\n // We don't want to store matrix objects in the view config.\n transform: { matrix: matrix.toArray() },\n };\n return newMeta;\n });\n return imageMetaWithTransform;\n}\n\n/**\n * Given a set of image layer loader creator functions,\n * create loader objects for an initial layer or set of layers,\n * which will be selected based on default values predefined in\n * the image data file or otherwise by a heuristic\n * (the midpoint of the layers array).\n * @param {object[]} rasterLayers A list of layer metadata objects with\n * shape { name, type, url, createLoader }.\n * @param {(string[]|null)} rasterRenderLayers A list of default raster layers. Optional.\n */\nexport async function initializeRasterLayersAndChannels(\n rasterLayers,\n rasterRenderLayers,\n usePhysicalSizeScaling,\n) {\n const nextImageLoaders = [];\n let nextImageMetaAndLayers = [];\n const autoImageLayerDefPromises = [];\n\n // Start all loader creators immediately.\n // Reference: https://eslint.org/docs/rules/no-await-in-loop\n const loaders = await Promise.all(rasterLayers.map(layer => layer.loaderCreator()));\n\n for (let i = 0; i < rasterLayers.length; i++) {\n const layer = rasterLayers[i];\n const loader = loaders[i];\n nextImageLoaders[i] = loader;\n nextImageMetaAndLayers[i] = layer;\n }\n if (usePhysicalSizeScaling) {\n nextImageMetaAndLayers = getMetaWithTransformMatrices(nextImageMetaAndLayers, nextImageLoaders);\n }\n // No layers were pre-defined so set up the default image layers.\n if (!rasterRenderLayers) {\n // Midpoint of images list as default image to show.\n const layerIndex = Math.floor(rasterLayers.length / 2);\n const loader = nextImageLoaders[layerIndex];\n const autoImageLayerDefPromise = initializeLayerChannels(loader)\n .then(channels => Promise.resolve({\n type: nextImageMetaAndLayers[layerIndex]?.metadata?.isBitmask ? 'bitmask' : 'raster',\n index: layerIndex,\n ...DEFAULT_RASTER_LAYER_PROPS,\n channels: channels.map((channel, j) => ({\n ...channel,\n ...(nextImageMetaAndLayers[layerIndex].channels\n ? nextImageMetaAndLayers[layerIndex].channels[j] : []),\n })),\n modelMatrix: nextImageMetaAndLayers[layerIndex]?.metadata?.transform?.matrix,\n transparentColor: layerIndex > 0 ? [0, 0, 0] : null,\n }));\n autoImageLayerDefPromises.push(autoImageLayerDefPromise);\n } else {\n // The renderLayers parameter is a list of layer names to show by default.\n const globalIndicesOfRenderLayers = rasterRenderLayers\n .map(imageName => rasterLayers.findIndex(image => image.name === imageName));\n for (let i = 0; i < globalIndicesOfRenderLayers.length; i++) {\n const layerIndex = globalIndicesOfRenderLayers[i];\n const loader = nextImageLoaders[layerIndex];\n const autoImageLayerDefPromise = initializeLayerChannels(loader)\n // eslint-disable-next-line no-loop-func\n .then(channels => Promise.resolve({\n type: nextImageMetaAndLayers[layerIndex]?.metadata?.isBitmask ? 'bitmask' : 'raster',\n index: layerIndex,\n ...DEFAULT_RASTER_LAYER_PROPS,\n channels: channels.map((channel, j) => ({\n ...channel,\n ...(nextImageMetaAndLayers[layerIndex].channels\n ? nextImageMetaAndLayers[layerIndex].channels[j] : []),\n })),\n domainType: 'Min/Max',\n modelMatrix: nextImageMetaAndLayers[layerIndex]?.metadata?.transform?.matrix,\n transparentColor: i > 0 ? [0, 0, 0] : null,\n }));\n autoImageLayerDefPromises.push(autoImageLayerDefPromise);\n }\n }\n\n const autoImageLayerDefs = await Promise.all(autoImageLayerDefPromises);\n return [autoImageLayerDefs, nextImageLoaders, nextImageMetaAndLayers];\n}\n\n/**\n * Make a subtitle for the spatial component.\n * @param {object} params\n * @param {number} params.observationsCount\n * @param {string} params.observationsLabel\n * @param {string} params.observationsPluralLabel\n * @param {number} params.subobservationsCount\n * @param {string} params.subobservationsLabel\n * @param {string} params.subobservationsPluralLabel\n * @param {number} params.locationsCount\n * @returns {string} The subtitle string,\n * with info about items with zero counts omitted.\n */\nexport function makeSpatialSubtitle({\n observationsCount, observationsLabel, observationsPluralLabel,\n subobservationsCount, subobservationsLabel, subobservationsPluralLabel,\n locationsCount,\n}) {\n const parts = [];\n if (subobservationsCount > 0) {\n let part = `${subobservationsCount} ${pluralize(subobservationsLabel, subobservationsPluralLabel, subobservationsCount)}`;\n if (locationsCount > 0) {\n part += ` at ${shortNumber(locationsCount)} locations`;\n }\n parts.push(part);\n }\n if (observationsCount > 0) {\n parts.push(`${observationsCount} ${pluralize(observationsLabel, observationsPluralLabel, observationsCount)}`);\n }\n return parts.join(', ');\n}\n\nexport function getInitialSpatialTargets({\n width,\n height,\n cells,\n imageLayerLoaders,\n useRaster,\n use3d,\n}) {\n let initialTargetX = -Infinity;\n let initialTargetY = -Infinity;\n let initialTargetZ = -Infinity;\n let initialZoom = -Infinity;\n // Some backoff from completely filling the screen.\n const zoomBackoff = use3d ? 1.5 : 0.1;\n const cellValues = Object.values(cells);\n if (imageLayerLoaders.length > 0 && useRaster) {\n for (let i = 0; i < imageLayerLoaders.length; i += 1) {\n const viewSize = { height, width };\n const { target, zoom: newViewStateZoom } = getDefaultInitialViewState(\n imageLayerLoaders[i].data,\n viewSize,\n zoomBackoff,\n use3d,\n );\n if (target[0] > initialTargetX) {\n // eslint-disable-next-line prefer-destructuring\n initialTargetX = target[0];\n initialZoom = newViewStateZoom;\n }\n if (target[1] > initialTargetY) {\n // eslint-disable-next-line prefer-destructuring\n initialTargetY = target[1];\n initialZoom = newViewStateZoom;\n }\n if (target[2] > initialTargetZ) {\n // eslint-disable-next-line prefer-destructuring\n initialTargetZ = target[2];\n initialZoom = newViewStateZoom;\n } else {\n initialTargetZ = null;\n }\n }\n } else if (cellValues.length > 0\n // Only use cellValues in quadtree calculation if there is\n // centroid data in the cells (i.e not just ids).\n && cellValues[0].xy\n && !useRaster) {\n const cellCoordinates = cellValues.map(c => c.xy);\n let xExtent = extent(cellCoordinates, c => c[0]);\n let yExtent = extent(cellCoordinates, c => c[1]);\n let xRange = xExtent[1] - xExtent[0];\n let yRange = yExtent[1] - yExtent[0];\n const getViewExtentFromPolygonExtents = extents => [\n Math.min(...extents.map(i => i[0])),\n Math.max(...extents.map(i => i[1])),\n ];\n if (xRange === 0) {\n // The fall back is the cells' polygon coordinates, if the original range\n // is 0 i.e the centroids are all on the same axis.\n const polygonExtentsX = cellValues.map(cell => extent(cell.poly, i => i[0]));\n xExtent = getViewExtentFromPolygonExtents(polygonExtentsX);\n xRange = xExtent[1] - xExtent[0];\n }\n if (yRange === 0) {\n // The fall back is the first cells' polygon coordinates, if the original range\n // is 0 i.e the centroids are all on the same axis.\n const polygonExtentsY = cellValues.map(cell => extent(cell.poly, i => i[1]));\n yExtent = getViewExtentFromPolygonExtents(polygonExtentsY);\n yRange = yExtent[1] - yExtent[0];\n }\n initialTargetX = xExtent[0] + xRange / 2;\n initialTargetY = yExtent[0] + yRange / 2;\n initialTargetZ = null;\n initialZoom = Math.log2(Math.min(width / xRange, height / yRange)) - zoomBackoff;\n } else {\n return {\n initialTargetX: null, initialTargetY: null, initialTargetZ: null, initialZoom: null,\n };\n }\n return {\n initialTargetX, initialTargetY, initialZoom, initialTargetZ,\n };\n}\n\n/**\n * Make a subtitle for the spatial component.\n * @param {object} data PixelSource | PixelSource[]\n * @returns {Array} [Layer, PixelSource | PixelSource[]] tuple.\n */\nexport function getLayerLoaderTuple(data, use3d) {\n const loader = ((Array.isArray(data) && data.length > 1) || !Array.isArray(data))\n ? data : data[0];\n if (use3d) {\n return [VolumeLayer, Array.isArray(loader) ? loader : [loader]];\n }\n const Layer = (Array.isArray(data) && data.length > 1) ? MultiscaleImageLayer : ImageLayer;\n return [Layer, loader];\n}\n\n\nexport function renderSubBitmaskLayers(props) {\n const {\n bbox: {\n left, top, right, bottom,\n },\n x,\n y,\n z,\n } = props.tile;\n const {\n data, id, loader,\n } = props;\n // Only render in positive coorinate system\n if ([left, bottom, right, top].some(v => v < 0) || !data) {\n return null;\n }\n const base = loader[0];\n const [height, width] = loader[0].shape.slice(-2);\n // Tiles are exactly fitted to have height and width such that their bounds\n // match that of the actual image (not some padded version).\n // Thus the right/bottom given by deck.gl are incorrect since\n // they assume tiles are of uniform sizes, which is not the case for us.\n const bounds = [\n left,\n data.height < base.tileSize ? height : bottom,\n data.width < base.tileSize ? width : right,\n top,\n ];\n return new BitmaskLayer(props, {\n channelData: data,\n // Uncomment to help debugging - shades the tile being hovered over.\n // autoHighlight: true,\n // highlightColor: [80, 80, 80, 50],\n // Shared props with BitmapLayer:\n bounds,\n id: `sub-layer-${bounds}-${id}`,\n tileId: { x, y, z },\n });\n}\n","import { ZarrPixelSource, loadOmeTiff } from '@hms-dbmi/viv';\nimport { openArray } from 'zarr';\nimport rasterSchema from '../schemas/raster.schema.json';\nimport JsonLoader from './JsonLoader';\nimport { AbstractLoaderError } from './errors';\nimport LoaderResult from './LoaderResult';\n\nimport { initializeRasterLayersAndChannels } from '../components/spatial/utils';\n\nasync function initLoader(imageData) {\n const {\n type, url, metadata, requestInit,\n } = imageData;\n switch (type) {\n case ('zarr'): {\n const {\n dimensions, isPyramid, transform,\n } = metadata || {};\n const labels = dimensions.map(d => d.field);\n let source;\n if (isPyramid) {\n const metadataUrl = `${url}${\n url.slice(-1) === '/' ? '' : '/'\n }.zmetadata`;\n const response = await fetch(metadataUrl);\n const { metadata: zarrMetadata } = await response.json();\n const paths = Object.keys(zarrMetadata)\n .filter(metaKey => metaKey.includes('.zarray'))\n .map(arrMetaKeys => arrMetaKeys.slice(0, -7));\n const data = await Promise.all(\n paths.map(path => openArray({ store: url, path })),\n );\n const [yChunk, xChunk] = data[0].chunks.slice(-2);\n const size = Math.min(yChunk, xChunk);\n // deck.gl requirement for power-of-two tile size.\n const tileSize = 2 ** Math.floor(Math.log2(size));\n source = data.map(d => new ZarrPixelSource(d, labels, tileSize));\n } else {\n const data = await openArray({ store: url });\n source = new ZarrPixelSource(data, labels);\n }\n return { data: source, metadata: { dimensions, transform }, channels: (dimensions.find(d => d.field === 'channel') || dimensions[0]).values };\n }\n case ('ome-tiff'): {\n let loader;\n // Fetch offsets for ome-tiff if needed.\n if (metadata && 'omeTiffOffsetsUrl' in metadata) {\n const { omeTiffOffsetsUrl } = metadata;\n const res = await fetch(omeTiffOffsetsUrl, (requestInit || {}));\n if (res.ok) {\n const offsets = await res.json();\n loader = await loadOmeTiff(\n url,\n {\n offsets,\n headers: requestInit?.headers,\n },\n );\n } else {\n throw new Error('Offsets not found but provided.');\n }\n } else {\n loader = await loadOmeTiff(url, { headers: requestInit?.headers });\n }\n const { Pixels: { Channels } } = loader.metadata;\n const channels = Array.isArray(Channels)\n ? Channels.map((channel, i) => channel.Name || `Channel ${i}`)\n : [Channels.Name || `Channel ${0}`];\n return { ...loader, channels };\n }\n default: {\n throw Error(`Image type (${type}) is not supported`);\n }\n }\n}\n\nexport default class RasterLoader extends JsonLoader {\n constructor(dataSource, params) {\n const { url, options } = params;\n if (!url && options) {\n // eslint-disable-next-line no-param-reassign\n dataSource.url = URL.createObjectURL(new Blob([JSON.stringify(options)]));\n }\n super(dataSource, params);\n this.schema = rasterSchema;\n }\n\n async load() {\n const payload = await super.load().catch(reason => Promise.resolve(reason));\n if (payload instanceof AbstractLoaderError) {\n return Promise.reject(payload);\n }\n const { data: raster } = payload;\n const { images, renderLayers, usePhysicalSizeScaling = false } = raster;\n\n // Get image name and URL tuples.\n const urls = images\n .filter(image => !image.url.includes('zarr'))\n .map(image => ([image.url, image.name]));\n\n // Add a loaderCreator function for each image layer.\n const imagesWithLoaderCreators = images.map(image => ({\n ...image,\n loaderCreator: async () => initLoader(image),\n }));\n\n // TODO: use options for initial selection of channels\n // which omit domain/slider ranges.\n if (!this.autoImageCache) {\n this.autoImageCache = initializeRasterLayersAndChannels(\n imagesWithLoaderCreators,\n renderLayers,\n usePhysicalSizeScaling,\n );\n }\n\n return this.autoImageCache.then((autoImages) => {\n const [autoImageLayers, imageLayerLoaders, imageLayerMeta] = autoImages;\n\n const coordinationValues = {\n spatialRasterLayers: autoImageLayers,\n };\n return new LoaderResult(\n { loaders: imageLayerLoaders, meta: imageLayerMeta },\n urls,\n coordinationValues,\n );\n });\n }\n}\n","import { loadOmeZarr } from '@hms-dbmi/viv';\nimport { AbstractLoaderError } from './errors';\nimport LoaderResult from './LoaderResult';\n\nimport { initializeRasterLayersAndChannels } from '../components/spatial/utils';\nimport AbstractTwoStepLoader from './AbstractTwoStepLoader';\n\nfunction hexToRgb(hex) {\n const result = /^#?([A-F\\d]{2})([A-F\\d]{2})([A-F\\d]{2})$/i.exec(hex);\n return [\n parseInt(result[1].toLowerCase(), 16),\n parseInt(result[2].toLowerCase(), 16),\n parseInt(result[3].toLowerCase(), 16),\n ];\n}\n\nexport default class OmeZarrLoader extends AbstractTwoStepLoader {\n async load() {\n const payload = await this.dataSource.getJson('.zattrs').catch(reason => Promise.resolve(reason));\n if (payload instanceof AbstractLoaderError) {\n return Promise.reject(payload);\n }\n\n const loader = await loadOmeZarr(this.url, { fetchOptions: this.requestInit, type: 'multiscales' });\n const { metadata, data } = loader;\n\n const { omero } = metadata;\n\n if (!omero) {\n console.error('Path for image not valid');\n return Promise.reject(payload);\n }\n\n const { rdefs, channels } = omero;\n\n const t = rdefs.defaultT ?? 0;\n const z = rdefs.defaultZ ?? 0;\n\n const filterSelection = (sel) => {\n // Remove selection keys for which there is no dimension.\n if (data.length > 0) {\n const nextSel = {};\n // eslint-disable-next-line prefer-destructuring\n const labels = data[0].labels;\n Object.keys(sel).forEach((key) => {\n if (labels.includes(key)) {\n nextSel[key] = sel[key];\n }\n });\n return nextSel;\n }\n return sel;\n };\n\n const imagesWithLoaderCreators = [\n {\n name: omero.name || 'Image',\n channels: channels.map((channel, i) => ({\n selection: filterSelection({ z, t, c: i }),\n slider: [channel.window.start, channel.window.end],\n color: hexToRgb(channel.color),\n })),\n loaderCreator: async () => ({ ...loader, channels: channels.map(c => c.label) }),\n },\n ];\n\n // TODO: use options for initial selection of channels\n // which omit domain/slider ranges.\n const [\n autoImageLayers, imageLayerLoaders, imageLayerMeta,\n ] = await initializeRasterLayersAndChannels(\n imagesWithLoaderCreators, undefined,\n );\n\n const coordinationValues = {\n spatialRasterLayers: autoImageLayers,\n };\n return Promise.resolve(new LoaderResult(\n { loaders: imageLayerLoaders, meta: imageLayerMeta },\n [],\n coordinationValues,\n ));\n }\n}\n","import tinycolor from 'tinycolor2';\nimport isEqual from 'lodash/isEqual';\n\n/**\n * Execute a callback function based on a keypress event.\n * @param {object} event The event from onKeyPress\n * @param {string} key The key identifier to match.\n * @param {Function} callback The function to execute.\n */\nexport function callbackOnKeyPress(event, key, callback) {\n if (event.key === key) {\n event.preventDefault();\n callback();\n }\n}\n\n/**\n * Convert an array of [r, g, b] numbers to a hex color.\n * @param {number[]} rgbArray The color [r, g, b] array.\n * @returns {string} The hex color as a string.\n */\nexport function colorArrayToString(rgbArray) {\n return tinycolor({ r: rgbArray[0], g: rgbArray[1], b: rgbArray[2] }).toHexString();\n}\n\n/**\n * Convert a string color representation to an array of [r,g,b].\n * @param {string} colorString The color as a string.\n * @returns {number[]} The color as an array.\n */\nexport function colorStringToArray(colorString) {\n const colorObj = tinycolor(colorString).toRgb();\n return [colorObj.r, colorObj.g, colorObj.b];\n}\n\n/**\n * Get a string of help text for coloring a particular hierarchy level.\n * @param {integer} i The level. 1 for cluster, 2 for subcluster, etc.\n * @returns {string} The tooltip text for coloring the level.\n */\nexport function getLevelTooltipText(i) {\n if (i === 0) return 'Color by hierarchy';\n if (i <= 2) {\n const subs = j => ('sub'.repeat(j));\n return `Color by ${subs(i - 1)}cluster`;\n }\n return `Color by cluster level ${i}`;\n}\n\nexport function isEqualOrPrefix(targetPath, testPath) {\n if (targetPath.length <= testPath.length) {\n return isEqual(targetPath, testPath.slice(0, targetPath.length));\n }\n return false;\n}\n\nexport function tryRenamePath(targetPath, testPath, nextTargetPath) {\n if (isEqualOrPrefix(targetPath, testPath)) {\n return [...nextTargetPath, ...testPath.slice(nextTargetPath.length)];\n }\n return testPath;\n}\n\nexport const PATH_SEP = '___';\n\nexport function pathToKey(path) {\n return path.join(PATH_SEP);\n}\n","/* eslint-disable no-underscore-dangle */\nimport uuidv4 from 'uuid/v4';\nimport isNil from 'lodash/isNil';\nimport isEqual from 'lodash/isEqual';\nimport range from 'lodash/range';\nimport { featureCollection as turfFeatureCollection, point as turfPoint } from '@turf/helpers';\nimport centroid from '@turf/centroid';\nimport concaveman from 'concaveman';\nimport {\n HIERARCHICAL_SCHEMAS,\n} from './constants';\nimport { getDefaultColor, PALETTE } from '../utils';\nimport { pathToKey } from './utils';\n\n/**\n * Alias for the uuidv4 function to make code more readable.\n * @returns {string} UUID.\n */\nfunction generateKey() {\n return uuidv4();\n}\n\n/**\n * Get the set associated with a particular node.\n * Recursive.\n * @param {object} currNode A node object.\n * @returns {array} The array representing the set associated with the node.\n */\nexport function nodeToSet(currNode) {\n if (!currNode) {\n return [];\n }\n if (!currNode.children) {\n return (currNode.set || []);\n }\n return currNode.children.flatMap(c => nodeToSet(c));\n}\n\n/**\n * Get the height of a node (the number of levels to reach a leaf).\n * @param {object} currNode A node object.\n * @param {number} level The level that the height will be computed relative to. By default, 0.\n * @returns {number} The height. If the node has a .children property,\n * then the minimum value returned is 1.\n */\nexport function nodeToHeight(currNode, level = 0) {\n if (!currNode.children) {\n return level;\n }\n const newLevel = level + 1;\n const childrenHeights = currNode.children.map(c => nodeToHeight(c, newLevel));\n return Math.max(...childrenHeights, newLevel);\n}\n\n/**\n * Get the size associated with a particular node.\n * Recursive.\n * @param {object} currNode A node object.\n * @returns {number} The length of all the node's children\n */\nexport function getNodeLength(currNode) {\n if (!currNode) {\n return 0;\n }\n if (!currNode.children) {\n return (currNode.set?.length || 0);\n }\n return currNode.children.reduce((acc, curr) => acc + getNodeLength(curr), 0);\n}\n\n/**\n * Find a node with a matching name path, relative to a particular node.\n * @param {object} node A node object.\n * @param {string[]} path The name path for the node of interest.\n * @param {number} currLevelIndex The index of the current hierarchy level.\n * @returns {object|null} A matching node object, or null if none is found.\n */\nfunction nodeFindNodeByNamePath(node, path, currLevelIndex) {\n const currNodeName = path[currLevelIndex];\n if (node.name === currNodeName) {\n if (currLevelIndex === path.length - 1) {\n return node;\n }\n if (node.children) {\n const foundNodes = node.children\n .map(child => nodeFindNodeByNamePath(child, path, currLevelIndex + 1))\n .filter(Boolean);\n if (foundNodes.length === 1) {\n return foundNodes[0];\n }\n }\n }\n return null;\n}\n\n/**\n * Find a node with a matching name path, relative to the whole tree.\n * @param {object} currTree A tree object.\n * @param {string[]} targetNamePath The name path for the node of interest.\n * @returns {object|null} A matching node object, or null if none is found.\n */\nexport function treeFindNodeByNamePath(currTree, targetNamePath) {\n const foundNodes = currTree.tree\n .map(levelZeroNode => nodeFindNodeByNamePath(levelZeroNode, targetNamePath, 0))\n .filter(Boolean);\n if (foundNodes.length === 1) {\n return foundNodes[0];\n }\n return null;\n}\n\n/**\n * Transform a node object using a transform function.\n * @param {object} node A node object.\n * @param {function} predicate Returns true if a node matches a condition of interest.\n * @param {function} transform Takes the node matching the predicate as input, returns\n * a transformed version of the node.\n * @param {array} transformedPaths This array parameter is mutated. The path of\n * each transformed node is appended to this array.\n * @param {string[]} The current path of the node being updated, used internally\n * during recursion.\n * @returns {object} The updated node.\n */\nexport function nodeTransform(node, predicate, transform, transformedPaths, currPath) {\n let newPath;\n if (!currPath) {\n newPath = [node.name];\n } else {\n newPath = [...currPath];\n }\n if (predicate(node, newPath)) {\n transformedPaths.push(newPath);\n return transform(node, newPath);\n }\n if (node.children) {\n return {\n ...node,\n children: node.children.map(\n child => nodeTransform(\n child, predicate, transform, transformedPaths, newPath.concat([child.name]),\n ),\n ),\n };\n }\n return node;\n}\n\n/**\n * Transform many node objects using a transform function.\n * @param {object} node A node object.\n * @param {function} predicate Returns true if a node matches a condition of interest.\n * @param {function} transform Takes the node matching the predicate as input, returns\n * a transformed version of the node.\n * @param {array} transformedPaths This array parameter is mutated. The path of\n * each transformed node is appended to this array.\n * @param {string[]} The current path of the node being updated, used internally\n * during recursion.\n * @returns {object} The updated node.\n */\nexport function nodeTransformAll(node, predicate, transform, transformedPaths, currPath) {\n let newPath;\n if (!currPath) {\n newPath = [node.name];\n } else {\n newPath = [...currPath];\n }\n let newNode = node;\n if (predicate(node, newPath)) {\n transformedPaths.push(newPath);\n newNode = transform(node, newPath);\n }\n if (node.children) {\n return {\n ...newNode,\n children: newNode.children.map(\n child => nodeTransformAll(\n child, predicate, transform, transformedPaths, newPath.concat([child.name]),\n ),\n ),\n };\n }\n return newNode;\n}\n\n/**\n * Append a child to a parent node.\n * @param {object} currNode A node object.\n * @param {object} newChild The child node object.\n * @returns {object} The updated node.\n */\nexport function nodeAppendChild(currNode, newChild) {\n return {\n ...currNode,\n children: [...currNode.children, newChild],\n };\n}\n\n/**\n * Prepend a child to a parent node.\n * @param {object} currNode A node object.\n * @param {object} newChild The child node object.\n * @returns {object} The updated node.\n */\nexport function nodePrependChild(currNode, newChild) {\n return {\n ...currNode,\n children: [newChild, ...currNode.children],\n };\n}\n\n/**\n * Insert a child to a parent node.\n * @param {object} currNode A node object.\n * @param {*} newChild The child node object.\n * @param {*} insertIndex The index at which to insert the child.\n * @returns {object} The updated node.\n */\nexport function nodeInsertChild(currNode, newChild, insertIndex) {\n const newChildren = Array.from(currNode.children);\n newChildren.splice(insertIndex, 0, newChild);\n return {\n ...currNode,\n children: newChildren,\n };\n}\n\n/**\n * Get an array representing the union of the sets of checked nodes.\n * @param {object} currTree A tree object.\n * @returns {array} An array representing the union of the sets of checked nodes.\n */\nexport function treeToUnion(currTree, checkedPaths) {\n const nodes = checkedPaths.map(path => treeFindNodeByNamePath(currTree, path));\n const nodeSets = nodes.map(node => nodeToSet(node).map(([cellId]) => cellId));\n return nodeSets\n .reduce((a, h) => a.concat(h.filter(hEl => !a.includes(hEl))), nodeSets[0] || []);\n}\n\n/**\n * Get an array representing the intersection of the sets of checked nodes.\n * @param {object} currTree A tree object.\n * @returns {array} An array representing the intersection of the sets of checked nodes.\n */\nexport function treeToIntersection(currTree, checkedPaths) {\n const nodes = checkedPaths.map(path => treeFindNodeByNamePath(currTree, path));\n const nodeSets = nodes.map(node => nodeToSet(node).map(([cellId]) => cellId));\n return nodeSets\n .reduce((a, h) => h.filter(hEl => a.includes(hEl)), nodeSets[0] || []);\n}\n\n/**\n * Get an array representing the complement of the union of the sets of checked nodes.\n * @param {object} currTree\n * @returns {array} An array representing the complement of the\n * union of the sets of checked nodes.\n */\nexport function treeToComplement(currTree, checkedPaths, items) {\n const primaryUnion = treeToUnion(currTree, checkedPaths);\n return items.filter(el => !primaryUnion.includes(el));\n}\n\n/**\n * Get an flattened array of descendants at a particular relative\n * level of interest.\n * @param {object} node A node object.\n * @param {number} level The relative level of interest.\n * 0 for this node's children, 1 for grandchildren, etc.\n * @param {boolean} stopEarly Should a node be returned early if no children exist?\n * @returns {object[]} An array of descendants at the specified level,\n * where the level is relative to the node.\n */\nexport function nodeToLevelDescendantNamePaths(node, level, prevPath, stopEarly = false) {\n if (!node.children) {\n if (!stopEarly) {\n return null;\n }\n return [[...prevPath, node.name]];\n }\n if (level === 0) {\n return [[...prevPath, node.name]];\n }\n return node.children\n .flatMap(c => nodeToLevelDescendantNamePaths(c, level - 1, [...prevPath, node.name], stopEarly))\n .filter(Boolean);\n}\n\n/**\n * Export the tree by clearing tree state and all node states.\n * @param {object} currTree A tree object.\n * @returns {object} Tree object with tree and node state removed.\n */\nexport function treeExport(currTree, datatype) {\n return {\n version: HIERARCHICAL_SCHEMAS[datatype].latestVersion,\n datatype,\n tree: currTree.tree,\n };\n}\n\n/**\n * Export the tree by clearing tree state and all node states,\n * and filter so that only the level zero node of interest is included.\n * @param {object} currTree A tree object.\n * @param {string} nodePath The path of the node of interest.\n * @param {string} dataType Datatype (i.e cell sets)\n * @param {Array} cellSetColors Array of objects of cell set colors and paths\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * @returns {object} { treeToExport, nodeName }\n * Tree with one level zero node, and with state removed.\n */\nexport function treeExportLevelZeroNode(currTree, nodePath, datatype, cellSetColors, theme) {\n const node = treeFindNodeByNamePath(currTree, nodePath);\n const nodeWithColors = nodeTransformAll(node, () => true, (n, nPath) => {\n const nodeColor = cellSetColors?.find(c => isEqual(c.path, nPath))?.color\n ?? getDefaultColor(theme);\n return {\n ...n,\n color: nodeColor.slice(0, 3),\n };\n }, []);\n const treeWithOneLevelZeroNode = {\n ...currTree,\n tree: [nodeWithColors],\n };\n return {\n treeToExport: treeExport(treeWithOneLevelZeroNode, datatype),\n nodeName: node.name,\n };\n}\n\n/**\n * Prepare the set of a node of interest for export.\n * @param {object} currTree A tree object.\n * @param {string} nodeKey The key of the node of interest.\n * @returns {object} { setToExport, nodeName } The set as an array.\n */\nexport function treeExportSet(currTree, nodePath) {\n const node = treeFindNodeByNamePath(currTree, nodePath);\n return { setToExport: nodeToSet(node), nodeName: node.name };\n}\n\n/**\n * Get an empty tree, with a default tree state.\n * @param {string} datatype The type of sets that this tree contains.\n * @returns {object} Empty tree.\n */\nexport function treeInitialize(datatype) {\n return {\n version: HIERARCHICAL_SCHEMAS[datatype].latestVersion,\n datatype,\n tree: [],\n };\n}\n\n/**\n * For convenience, get an object with information required\n * to render a node as a component.\n * @param {object} node A node to be rendered.\n * @returns {object} An object containing properties required\n * by the TreeNode render functions.\n */\nexport function nodeToRenderProps(node, path, cellSetColor) {\n const level = path.length - 1;\n return {\n title: node.name,\n nodeKey: pathToKey(path),\n path,\n size: getNodeLength(node),\n color: cellSetColor?.find(d => isEqual(d.path, path))?.color,\n level,\n isLeaf: (!node.children || node.children.length === 0) && Boolean(node.set),\n height: nodeToHeight(node),\n };\n}\n\n/**\n * Using a color and a probability, mix the color with an \"uncertainty\" color,\n * for example, gray.\n * Reference: https://github.com/bgrins/TinyColor/blob/80f7225029c428c0de0757f7d98ac15f497bee57/tinycolor.js#L701\n * @param {number[]} originalColor The color assignment for the class.\n * @param {number} p The mixing amount, or level certainty in the originalColor classification,\n * between 0 and 1.\n * @param {number[]} mixingColor The color with which to mix. By default, [128, 128, 128] gray.\n * @returns {number[]} Returns the color after mixing.\n */\nfunction colorMixWithUncertainty(originalColor, p, mixingColor = [128, 128, 128]) {\n return [\n ((originalColor[0] - mixingColor[0]) * p) + mixingColor[0],\n ((originalColor[1] - mixingColor[1]) * p) + mixingColor[1],\n ((originalColor[2] - mixingColor[2]) * p) + mixingColor[2],\n ];\n}\n\n/**\n * Given a tree with state, get the cellIds and cellColors,\n * based on the nodes currently marked as \"visible\".\n * @param {object} currTree A tree object.\n * @param {array} selectedNamePaths Array of arrays of strings,\n * representing set \"paths\".\n * @param {object[]} cellSetColor Array of objects with the\n * properties `path` and `color`.\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * @returns {array} Tuple of [cellIds, cellColors]\n * where cellIds is an array of strings,\n * and cellColors is an object mapping cellIds to color [r,g,b] arrays.\n */\nexport function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetColor, theme) {\n let cellColorsArray = [];\n selectedNamePaths.forEach((setNamePath) => {\n const node = treeFindNodeByNamePath(currTree, setNamePath);\n if (node) {\n const nodeSet = nodeToSet(node);\n const nodeColor = (\n cellSetColor?.find(d => isEqual(d.path, setNamePath))?.color\n || getDefaultColor(theme)\n );\n cellColorsArray = [\n ...cellColorsArray,\n ...nodeSet.map(([cellId, prob]) => [\n cellId,\n (isNil(prob) ? nodeColor : colorMixWithUncertainty(nodeColor, prob)),\n ]),\n ];\n }\n });\n return new Map(cellColorsArray);\n}\n\n/**\n * Given a tree with state, get an array of\n * objects with cellIds and cellColors,\n * based on the nodes currently marked as \"visible\".\n * @param {object} currTree A tree object.\n * @param {array} selectedNamePaths Array of arrays of strings,\n * representing set \"paths\".\n * @param {object[]} setColor Array of objects with the\n * properties `path` and `color`\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme.\n * @returns {object[]} Array of objects with properties\n * `obsId`, `name`, and `color`.\n */\nexport function treeToObjectsBySetNames(currTree, selectedNamePaths, setColor, theme) {\n let cellsArray = [];\n for (let i = 0; i < selectedNamePaths.length; i += 1) {\n const setNamePath = selectedNamePaths[i];\n const node = treeFindNodeByNamePath(currTree, setNamePath);\n if (node) {\n const nodeSet = nodeToSet(node);\n const nodeColor = (\n setColor?.find(d => isEqual(d.path, setNamePath))?.color\n || getDefaultColor(theme)\n );\n cellsArray = cellsArray.concat(nodeSet.map(([cellId]) => ({\n obsId: cellId,\n name: node.name,\n color: nodeColor,\n })));\n }\n }\n return cellsArray;\n}\n\nexport function treeToCellPolygonsBySetNames(\n currTree, cells, mapping, selectedNamePaths, cellSetColor, theme,\n) {\n const cellSetPolygons = [];\n selectedNamePaths.forEach((setNamePath) => {\n const node = treeFindNodeByNamePath(currTree, setNamePath);\n if (node) {\n const nodeSet = nodeToSet(node);\n const nodeColor = (\n cellSetColor?.find(d => isEqual(d.path, setNamePath))?.color\n || getDefaultColor(theme)\n );\n const cellPositions = nodeSet\n .map(([cellId]) => ([\n cells[cellId]?.mappings[mapping][0],\n -cells[cellId]?.mappings[mapping][1],\n ]))\n .filter(cell => cell.every(i => typeof i === 'number'));\n\n if (cellPositions.length > 2) {\n const points = turfFeatureCollection(\n cellPositions.map(turfPoint),\n );\n const concavity = Infinity;\n const hullCoords = concaveman(cellPositions, concavity);\n if (hullCoords) {\n const centroidCoords = centroid(points).geometry.coordinates;\n cellSetPolygons.push({\n path: setNamePath,\n name: setNamePath[setNamePath.length - 1],\n hull: hullCoords,\n color: nodeColor,\n centroid: centroidCoords,\n });\n }\n }\n }\n });\n return cellSetPolygons;\n}\n\n/**\n * Given a tree with state, get the sizes of the\n * sets currently marked as \"visible\".\n * @param {object} currTree A tree object.\n * @param {array} selectedNamePaths Array of arrays of strings,\n * representing set \"paths\".\n * @param {object[]} setColor Array of objects with the\n * properties `path` and `color`.\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * @returns {object[]} Array of objects\n * with the properties `name`, `size`, `key`,\n * and `color`.\n */\nexport function treeToSetSizesBySetNames(currTree, selectedNamePaths, setColor, theme) {\n const sizes = [];\n selectedNamePaths.forEach((setNamePath) => {\n const node = treeFindNodeByNamePath(currTree, setNamePath);\n if (node) {\n const nodeSet = nodeToSet(node);\n const nodeColor = setColor?.find(d => isEqual(d.path, setNamePath))?.color\n || getDefaultColor(theme);\n sizes.push({\n key: generateKey(),\n name: node.name,\n size: nodeSet.length,\n color: nodeColor,\n });\n }\n });\n return sizes;\n}\n\n/**\n * Find and remove a node from the descendants of the current node.\n * @param {object} node A node to search on.\n * @param {array} prevPath Path of the current node to be searched.\n * @param {array} filterPath The path sought.\n * @returns {object} A new node without a node at filterPath.\n */\nexport function filterNode(node, prevPath, filterPath) {\n if (isEqual([...prevPath, node.name], filterPath)) {\n return null;\n }\n if (!node.children) {\n return node;\n }\n return {\n ...node,\n children: node.children.map(\n c => filterNode(c, [...prevPath, node.name], filterPath),\n ).filter(Boolean),\n };\n}\n\nexport function treeToExpectedCheckedLevel(currTree, checkedPaths) {\n let result = null;\n if (currTree) {\n currTree.tree.forEach((lzn) => {\n const levelZeroPath = [lzn.name];\n const height = nodeToHeight(lzn);\n range(height).forEach((i) => {\n const levelIndex = i + 1;\n const levelNodePaths = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);\n if (isEqual(levelNodePaths, checkedPaths)) {\n result = { levelZeroPath, levelIndex };\n }\n });\n });\n }\n return result;\n}\n\nexport function treesConflict(cellSets, testCellSets) {\n const paths = [];\n const testPaths = [];\n let hasConflict = false;\n\n function getPaths(node, prevPath) {\n paths.push([...prevPath, node.name]);\n if (node.children) {\n node.children.forEach(c => getPaths(c, [...prevPath, node.name]));\n }\n }\n cellSets.tree.forEach(lzn => getPaths(lzn, []));\n\n function getTestPaths(node, prevPath) {\n testPaths.push([...prevPath, node.name]);\n if (node.children) {\n node.children.forEach(c => getPaths(c, [...prevPath, node.name]));\n }\n }\n testCellSets.tree.forEach(lzn => getTestPaths(lzn, []));\n\n testPaths.forEach((testPath) => {\n if (paths.find(p => isEqual(p, testPath))) {\n hasConflict = true;\n }\n });\n return hasConflict;\n}\n\nexport function initializeCellSetColor(cellSets, cellSetColor) {\n const nextCellSetColor = [...(cellSetColor || [])];\n const nodeCountPerTreePerLevel = cellSets.tree.map(tree => Array\n .from({\n length: nodeToHeight(tree) + 1, // Need to add one because its an array.\n }).fill(0));\n\n function processNode(node, prevPath, hierarchyLevel, treeIndex) {\n const index = nodeCountPerTreePerLevel[treeIndex][hierarchyLevel];\n const nodePath = [...prevPath, node.name];\n\n const nodeColor = nextCellSetColor.find(d => isEqual(d.path, nodePath));\n if (!nodeColor) {\n // If there is a color for the node specified via the cell set tree,\n // then use it. Otherwise, use a color from the default color palette.\n const nodeColorArray = (node.color ? node.color : PALETTE[index % PALETTE.length]);\n nextCellSetColor.push({\n path: nodePath,\n color: nodeColorArray,\n });\n }\n nodeCountPerTreePerLevel[treeIndex][hierarchyLevel] += 1;\n if (node.children) {\n node.children.forEach(c => processNode(c, nodePath, hierarchyLevel + 1, treeIndex));\n }\n }\n\n cellSets.tree.forEach((lzn, treeIndex) => processNode(lzn, [], 0, treeIndex));\n return nextCellSetColor;\n}\n\nexport function getCellSetPolygons(params) {\n const {\n cells,\n mapping,\n cellSets,\n cellSetSelection,\n cellSetColor,\n theme,\n } = params;\n if (cellSetSelection && cellSetSelection.length > 0 && cellSets && cells) {\n return treeToCellPolygonsBySetNames(\n cellSets, cells, mapping, cellSetSelection, cellSetColor, theme,\n );\n }\n return [];\n}\n","import Ajv from 'ajv';\nimport isNil from 'lodash/isNil';\nimport { dsvFormat } from 'd3-dsv';\nimport { parse as json2csv } from 'json2csv';\nimport { colorArrayToString, colorStringToArray } from './utils';\nimport { nodeTransform } from './cell-set-utils';\nimport { getDefaultColor } from '../utils';\nimport {\n HIERARCHICAL_SCHEMAS, TABULAR_SCHEMAS,\n MIME_TYPE_JSON, MIME_TYPE_TABULAR,\n SEPARATOR_TABULAR, NA_VALUE_TABULAR,\n} from './constants';\n\n/**\n * Check if an imported tree has an old schema version that we know how to\n * \"upgrade\" to the latest schema version. Validate against the schema.\n * @param {object} currTree A hierarchical tree object with a .version property,\n * which has already passed schema validation, but may not have the latest schema version.\n * @param {string} datatype The data type of the items in the schema.\n */\nexport function tryUpgradeTreeToLatestSchema(currTree, datatype) {\n const validate = new Ajv().compile(HIERARCHICAL_SCHEMAS[datatype].schema);\n const valid = validate(currTree);\n if (!valid) {\n const failureReason = JSON.stringify(validate.errors, null, 2);\n throw new Error(`Tree validation failed: ${failureReason}`);\n } else if (currTree.datatype !== datatype) {\n throw new Error(\n `The data type does not match the expected data type of '${datatype}'.`,\n );\n }\n if (currTree.version === '0.1.2') {\n // To upgrade from cell-sets schema 0.1.2 to 0.1.3,\n // add a confidence value of null for each cell ID.\n return {\n ...currTree,\n version: HIERARCHICAL_SCHEMAS[datatype].latestVersion,\n tree: currTree.tree.map(levelZeroNode => nodeTransform(\n levelZeroNode,\n n => !n.children && Array.isArray(n.set),\n n => ({ ...n, set: n.set.map(itemId => ([itemId, null])) }), [],\n )),\n };\n }\n return currTree;\n}\n\n/**\n * Handler for JSON imports. Validates and upgrades against the hierarchical sets schema.\n * @param {string} result The data passed from the FileReader as a string.\n * @param {string} datatype The data type to validate against.\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * @returns {object} The imported tree object.\n * @throws {Error} Throws error if validation fails or if the datatype does not match.\n */\n// eslint-disable-next-line no-unused-vars\nexport function handleImportJSON(result, datatype, theme) {\n let importData = JSON.parse(result);\n // Validate the imported file.\n importData = tryUpgradeTreeToLatestSchema(importData, datatype);\n return importData;\n}\n\n/**\n * Handler for tabular imports. Validates against the tabular sets schema.\n * @param {string} result The data passed from the FileReader as a string.\n * @param {string} datatype The data type to validate against.\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * @returns {object} The imported tree object.\n * @throws {Error} Throws error if validation fails or if the datatype does not match.\n */\nexport function handleImportTabular(result, datatype, theme) {\n const dsvParser = dsvFormat(SEPARATOR_TABULAR);\n const importData = dsvParser.parse(result, row => ({\n groupName: row.groupName,\n setName: row.setName,\n setColor: (row.setColor ? colorStringToArray(row.setColor) : getDefaultColor(theme)),\n obsId: row.obsId,\n predictionScore: (\n (\n isNil(row.predictionScore)\n || row.predictionScore === NA_VALUE_TABULAR\n )\n ? null\n : +row.predictionScore\n ),\n }));\n // Validate the imported file.\n const validate = new Ajv().compile(TABULAR_SCHEMAS[datatype].schema);\n const valid = validate(importData);\n if (!valid) {\n const failureReason = JSON.stringify(validate.errors, null, 2);\n throw new Error(`Import validation failed: ${failureReason}`);\n } else {\n // Convert the validated array to a tree representation.\n const treeToImport = {\n version: HIERARCHICAL_SCHEMAS[datatype].latestVersion,\n datatype,\n tree: [],\n };\n const uniqueGroupNames = Array.from(new Set(importData.map(d => d.groupName)));\n uniqueGroupNames.forEach((groupName) => {\n const levelZeroNode = {\n name: groupName,\n children: [],\n };\n const groupRows = importData.filter(d => d.groupName === groupName);\n const uniqueSetNames = Array.from(new Set(groupRows.map(d => d.setName)));\n uniqueSetNames.forEach((setName) => {\n const setRows = groupRows.filter(d => d.setName === setName);\n const { setColor } = setRows[0];\n const levelOneNode = {\n name: setName,\n color: setColor,\n set: setRows.map(d => ([d.obsId, d.predictionScore])),\n };\n levelZeroNode.children.push(levelOneNode);\n });\n treeToImport.tree.push(levelZeroNode);\n });\n return treeToImport;\n }\n}\n\n/**\n * Convert a tree object to a JSON representation.\n * @param {object} result The object to export.\n * @returns {string} The data in a string representation.\n */\nexport function handleExportJSON(result) {\n const jsonString = JSON.stringify(result);\n const dataString = `data:${MIME_TYPE_JSON};charset=utf-8,${encodeURIComponent(jsonString)}`;\n return dataString;\n}\n\n/**\n * Convert a tree object with one level (height === 1) to a tabular representation.\n * @param {object} result The object to export.\n * @returns {string} The data in a string representation.\n */\nexport function handleExportTabular(result) {\n // Convert a tree object to an array of JSON objects.\n const exportData = [];\n result.tree.forEach((levelZeroNode) => {\n levelZeroNode.children.forEach((levelOneNode) => {\n if (levelOneNode.set) {\n levelOneNode.set.forEach(([obsId, prob]) => {\n exportData.push({\n groupName: levelZeroNode.name,\n setName: levelOneNode.name,\n setColor: colorArrayToString(levelOneNode.color),\n obsId,\n predictionScore: isNil(prob) ? NA_VALUE_TABULAR : prob,\n });\n });\n }\n });\n });\n const csvString = json2csv(exportData, {\n fields: ['groupName', 'setName', 'setColor', 'obsId', 'predictionScore'],\n delimiter: SEPARATOR_TABULAR,\n });\n const dataString = `data:${MIME_TYPE_TABULAR};charset=utf-8,${encodeURIComponent(csvString)}`;\n return dataString;\n}\n\n/**\n * Download a file. Appends and removes an anchor node in the DOM.\n * @param {string} dataString The function that converts the data to a string.\n * @param {string} fileName The name of the file to be downloaded.\n */\nexport function downloadForUser(dataString, fileName) {\n const downloadAnchorNode = document.createElement('a');\n downloadAnchorNode.setAttribute('href', dataString);\n downloadAnchorNode.setAttribute('download', fileName);\n document.body.appendChild(downloadAnchorNode); // required for firefox\n downloadAnchorNode.click();\n downloadAnchorNode.remove();\n}\n","import cellSetsSchema from '../schemas/cell-sets.schema.json';\nimport JsonLoader from './JsonLoader';\nimport { tryUpgradeTreeToLatestSchema } from '../components/sets/io';\nimport { AbstractLoaderError } from './errors';\nimport LoaderResult from './LoaderResult';\n\nimport { initializeCellSetColor } from '../components/sets/cell-set-utils';\n\nexport default class CellSetsJsonLoader extends JsonLoader {\n constructor(dataSource, params) {\n super(dataSource, params);\n\n this.schema = cellSetsSchema;\n }\n\n async load() {\n const payload = await super.load().catch(reason => Promise.resolve(reason));\n if (payload instanceof AbstractLoaderError) {\n return Promise.reject(payload);\n }\n const { data: rawData, url } = payload;\n const upgradedData = tryUpgradeTreeToLatestSchema(rawData, 'cell');\n\n const coordinationValues = {\n cellSetSelection: [],\n cellSetColor: [],\n };\n\n // Set up the initial coordination values.\n if (upgradedData && upgradedData.tree.length >= 1) {\n const { tree } = upgradedData;\n const newAutoSetSelectionParentName = tree[0].name;\n // Create a list of set paths to initally select.\n const newAutoSetSelections = tree[0].children\n .map(node => ([newAutoSetSelectionParentName, node.name]));\n // Create a list of cell set objects with color mappings.\n const newAutoSetColors = initializeCellSetColor(upgradedData, []);\n coordinationValues.cellSetSelection = newAutoSetSelections;\n coordinationValues.cellSetColor = newAutoSetColors;\n }\n return Promise.resolve(new LoaderResult(upgradedData, url, coordinationValues));\n }\n}\n","/* eslint-disable no-control-regex */\nimport { InternMap } from 'internmap';\nimport {\n treeInitialize,\n nodeAppendChild,\n initializeCellSetColor,\n} from '../../components/sets/cell-set-utils';\nimport {\n SETS_DATATYPE_CELL,\n} from '../../components/sets/constants';\nimport AbstractTwoStepLoader from '../AbstractTwoStepLoader';\nimport LoaderResult from '../LoaderResult';\n\nexport function dataToCellSetsTree(data, options) {\n const [cellNames, cellSets, cellSetScores] = data;\n const cellSetsTree = treeInitialize(SETS_DATATYPE_CELL);\n cellSets.forEach((cellSetIds, j) => {\n const name = options[j].groupName;\n let levelZeroNode = {\n name,\n children: [],\n };\n if (cellSetIds.length > 0 && Array.isArray(cellSetIds[0])) {\n // Multi-level case.\n const levelSets = new InternMap([], JSON.stringify);\n\n cellNames.forEach((id, i) => {\n const classes = cellSetIds.map(col => col[i]);\n if (levelSets.has(classes)) {\n levelSets.get(classes).push([id, null]);\n } else {\n levelSets.set(classes, [[id, null]]);\n }\n });\n\n const levels = Array.from(levelSets.keys());\n\n const getNextLevelNames = (levelSuffixes) => {\n const nextLevelNames = Array.from(new Set(levelSuffixes.map(l => l[0])));\n return nextLevelNames.sort((a, b) => a.localeCompare(b));\n };\n\n // Recursive function to create nodes.\n const getNode = (parentLevelPrefixes, currLevelName, childLevelSuffixes) => {\n const isLeaf = childLevelSuffixes.length === 0;\n const resultNode = {\n name: currLevelName,\n };\n if (isLeaf) {\n // Base case: this is a leaf node.\n resultNode.set = levelSets.get([...parentLevelPrefixes, currLevelName]);\n } else {\n // Are the remaining suffices redundant?\n // Consider [\"Parent\", \"Child\", \"Child\"]\n // where parentLevelPrefixes is [\"Parent\"] and currLevelName is \"Child\".\n const shouldBeLeaf = (\n childLevelSuffixes.length === 1\n && currLevelName === childLevelSuffixes[0][childLevelSuffixes[0].length - 1]\n );\n if (shouldBeLeaf) {\n resultNode.set = levelSets.get(\n [...parentLevelPrefixes, currLevelName, ...childLevelSuffixes[0]],\n );\n } else {\n // Recursion, run getNode() on each of the unique names at the next level.\n const nextLevelNames = getNextLevelNames(childLevelSuffixes);\n\n resultNode.children = nextLevelNames\n .map(nextLevelName => getNode(\n [...parentLevelPrefixes, currLevelName],\n nextLevelName,\n childLevelSuffixes\n .filter(l => l[0] === nextLevelName)\n .map(l => l.slice(1))\n .filter(v => v.length > 0),\n ));\n }\n }\n return resultNode;\n };\n // Start the recursion.\n const levelOneNodes = getNextLevelNames(levels)\n .map(levelOneName => getNode(\n [],\n levelOneName,\n levels.filter(l => l[0] === levelOneName).map(l => l.slice(1)),\n ));\n\n levelZeroNode.children = levelOneNodes;\n } else {\n // Single-level case.\n // Check for the optional corresponding confidence score column name.\n const uniqueCellSetIds = Array.from(new Set(cellSetIds)).sort();\n const clusters = {};\n // eslint-disable-next-line no-return-assign\n uniqueCellSetIds.forEach(id => (clusters[id] = { name: id, set: [] }));\n if (cellSetScores[j]) {\n cellSetIds.forEach((id, i) => clusters[id].set.push([cellNames[i], cellSetScores[j][i]]));\n } else {\n cellSetIds.forEach((id, i) => clusters[id].set.push([cellNames[i], null]));\n }\n Object.values(clusters).forEach(\n // eslint-disable-next-line no-return-assign\n cluster => (levelZeroNode = nodeAppendChild(levelZeroNode, cluster)),\n );\n }\n cellSetsTree.tree.push(levelZeroNode);\n });\n return cellSetsTree;\n}\n\n/**\n * Loader for converting zarr into the cell sets json schema.\n */\nexport default class CellSetsZarrLoader extends AbstractTwoStepLoader {\n loadCellSetIds() {\n const { options } = this;\n const cellSetZarrLocation = options.map(({ setName }) => setName);\n return this.dataSource.loadObsVariables(cellSetZarrLocation);\n }\n\n loadCellSetScores() {\n const { options } = this;\n const cellSetScoreZarrLocation = options.map(option => option.scoreName || undefined);\n return this.dataSource.loadObsVariables(cellSetScoreZarrLocation);\n }\n\n async load() {\n if (!this.cellSetsTree) {\n const { options } = this;\n this.cellSetsTree = Promise.all([\n this.dataSource.loadObsIndex(),\n this.loadCellSetIds(),\n this.loadCellSetScores(),\n ]).then(data => dataToCellSetsTree(data, options));\n }\n const cellSetsTree = await this.cellSetsTree;\n const coordinationValues = {};\n const { tree } = cellSetsTree;\n const newAutoSetSelectionParentName = tree[0].name;\n // Create a list of set paths to initally select.\n const newAutoSetSelections = tree[0].children.map(node => [\n newAutoSetSelectionParentName,\n node.name,\n ]);\n // Create a list of cell set objects with color mappings.\n const newAutoSetColors = initializeCellSetColor(cellSetsTree, []);\n coordinationValues.cellSetSelection = newAutoSetSelections;\n coordinationValues.cellSetColor = newAutoSetColors;\n return Promise.resolve(\n new LoaderResult(cellSetsTree, null, coordinationValues),\n );\n }\n}\n","/* eslint-disable no-underscore-dangle */\nimport { openArray, slice } from 'zarr';\nimport { extent } from 'd3-array';\nimport LoaderResult from '../LoaderResult';\nimport AbstractTwoStepLoader from '../AbstractTwoStepLoader';\n\nconst normalize = (arr) => {\n const [min, max] = extent(arr);\n const ratio = 255 / (max - min);\n const data = new Uint8Array(\n arr.map(i => Math.floor((i - min) * ratio)),\n );\n return { data };\n};\n\nconst concatenateColumnVectors = (arr) => {\n const numCols = arr.length;\n const numRows = arr[0].length;\n const { BYTES_PER_ELEMENT } = arr[0];\n const view = new DataView(new ArrayBuffer(numCols * numRows * BYTES_PER_ELEMENT));\n const TypedArray = arr[0].constructor;\n const dtype = TypedArray.name.replace('Array', '');\n for (let i = 0; i < numCols; i += 1) {\n for (let j = 0; j < numRows; j += 1) {\n view[`set${dtype}`](BYTES_PER_ELEMENT * (j * numCols + i), arr[i][j], true);\n }\n }\n return new TypedArray(view.buffer);\n};\n\n/**\n * Loader for converting zarr into the a cell x gene matrix for use in Genes/Heatmap components.\n */\nexport default class MatrixZarrLoader extends AbstractTwoStepLoader {\n /**\n * Class method for loading the genes list from AnnData.var,\n * filtered if a there is a `geneFilterZarr` present in the view config.\n * @returns {Promise} A promise for the zarr array contianing the gene names.\n */\n async loadFilteredGeneNames() {\n if (this.filteredGeneNames) {\n return this.filteredGeneNames;\n }\n const { geneFilter: geneFilterZarr } = this.options;\n const getFilterFn = async () => {\n if (!geneFilterZarr) return data => data;\n const geneFilter = await this.dataSource.getFlatArrDecompressed(geneFilterZarr);\n return data => data.filter((_, j) => geneFilter[j]);\n };\n\n this.filteredGeneNames = Promise\n .all([this.dataSource.loadVarIndex(), getFilterFn()])\n .then(([data, filter]) => filter(data));\n return this.filteredGeneNames;\n }\n\n /**\n * Class method for loading a filtered subset of the genes list\n * @param {String} filterZarr A location in the zarr store to fetch a boolean array from.\n * @returns {Array} A list of filtered genes.\n */\n async _getFilteredGenes(filterZarr) {\n const filter = await this.dataSource.getFlatArrDecompressed(filterZarr);\n const geneNames = await this.loadFilteredGeneNames();\n const genes = geneNames.filter((_, i) => filter[i]);\n return genes;\n }\n\n /**\n * Class method for getting the integer indices of a selection of genes within a list.\n * @param {Array} selection A list of gene names.\n * @returns {Array} A list of integer indices.\n */\n async _getGeneIndices(selection) {\n const geneNames = await this.loadFilteredGeneNames();\n return selection.map(gene => geneNames.indexOf(gene));\n }\n\n /**\n * Class method for getting the number of cells i.e entries in `obs`.\n * @returns {Number} The number of cells.\n */\n async _getNumCells() {\n const cells = await this.dataSource.loadObsIndex();\n return cells.length;\n }\n\n /**\n * Class method for getting the number of genes i.e entries in `var`,\n * potentially filtered by `genesFilter`.\n * @returns {Number} The number of genes.\n */\n async _getNumGenes() {\n const genes = await this.loadFilteredGeneNames();\n return genes.length;\n }\n\n /**\n * Class method for opening the sparse matrix arrays in zarr.\n * @returns {Array} A list of promises pointing to the indptr, indices, and data of the matrix.\n */\n async _openSparseArrays() {\n const { options: { matrix } } = this;\n const { store } = this.dataSource;\n if (this.sparseArrays) {\n return this.sparseArrays;\n }\n this.sparseArrays = Promise.all(\n ['indptr', 'indices', 'data'].map(name => openArray({ store, path: `${matrix}/${name}`, mode: 'r' })),\n );\n return this.sparseArrays;\n }\n\n /**\n * Class method for loading a gene selection from a CSC matrix.\n * @param {Array} selection A list of gene names whose data should be fetched.\n * @returns {Promise} A Promise.all array of promises containing Uint8Arrays, one per selection.\n */\n async _loadCSCGeneSelection(selection) {\n const indices = await this._getGeneIndices(selection);\n const [indptrArr, indexArr, cellXGeneArr] = await this._openSparseArrays();\n const numCells = await this._getNumCells();\n const { data: cols } = await indptrArr.getRaw(null);\n // If there is not change in the column indexer, then the data is all zeros\n return Promise.all(\n indices.map(async (index) => {\n const startRowIndex = cols[index];\n const endRowIndex = cols[index + 1];\n const isColumnAllZeros = startRowIndex === endRowIndex;\n const geneData = new Float32Array(numCells).fill(0);\n if (isColumnAllZeros) {\n return geneData;\n }\n const { data: rowIndices } = await indexArr.get([\n slice(startRowIndex, endRowIndex),\n ]);\n const { data: cellXGeneData } = await cellXGeneArr.get([\n slice(startRowIndex, endRowIndex),\n ]);\n for (let rowIndex = 0; rowIndex < rowIndices.length; rowIndex += 1) {\n geneData[rowIndices[rowIndex]] = cellXGeneData[rowIndex];\n }\n return geneData;\n }),\n );\n }\n\n /**\n * Class method for loading a gene selection from a CSR matrix.\n * @param {Array} selection A list of gene names whose data should be fetched.\n * @returns {Promise} A Promise.all array of promises containing Uint8Arrays, one per selection.\n */\n async _loadCSRGeneSelection(selection) {\n const indices = await this._getGeneIndices(selection);\n const numGenes = await this._getNumGenes();\n const numCells = await this._getNumCells();\n const cellXGene = await this._loadCSRSparseCellXGene();\n return indices.map((index) => {\n const geneData = new Float32Array(numCells).fill(0);\n for (let i = 0; i < numCells; i += 1) {\n geneData[i] = cellXGene[i * numGenes + index];\n }\n return geneData;\n });\n }\n\n /**\n * Class method for loading row oriented (CSR) sparse data from zarr.\n *\n * @returns {Object} A { data: Float32Array } contianing the CellXGene matrix.\n */\n async _loadCSRSparseCellXGene() {\n if (this._sparseMatrix) {\n return this._sparseMatrix;\n }\n this._sparseMatrix = this._openSparseArrays().then(async (sparseArrays) => {\n const { options: { matrix } } = this;\n const { shape } = await this.dataSource.getJson(`${matrix}/.zattrs`);\n const [rows, cols, cellXGene] = await Promise.all(\n sparseArrays.map(async (arr) => {\n const { data } = await arr.getRaw(null);\n return data;\n }),\n );\n const cellXGeneMatrix = new Float32Array(shape[0] * shape[1]).fill(0);\n let row = 0;\n rows.forEach((_, index) => {\n const rowStart = rows[index];\n const rowEnd = rows[index + 1];\n for (let i = rowStart; i < rowEnd; i += 1) {\n const val = cellXGene[i];\n const col = cols[i];\n cellXGeneMatrix[row * shape[1] + col] = val;\n }\n row += 1;\n });\n return cellXGeneMatrix;\n });\n return this._sparseMatrix;\n }\n\n /**\n * Class method for loading column oriented (CSC) sparse data from zarr.\n * @returns {Object} A { data: Float32Array } contianing the CellXGene matrix.\n */\n async _loadCSCSparseCellXGene() {\n if (this._sparseMatrix) {\n return this._sparseMatrix;\n }\n this._sparseMatrix = this._openSparseArrays().then(async (sparseArrays) => {\n const { options: { matrix } } = this;\n const { shape } = await this.dataSource.getJson(`${matrix}/.zattrs`);\n const [cols, rows, cellXGene] = await Promise.all(\n sparseArrays.map(async (arr) => {\n const { data } = await arr.getRaw(null);\n return data;\n }),\n );\n const cellXGeneMatrix = new Float32Array(shape[0] * shape[1]).fill(0);\n let col = 0;\n cols.forEach((_, index) => {\n const colStart = cols[index];\n const colEnd = cols[index + 1];\n for (let i = colStart; i < colEnd; i += 1) {\n const val = cellXGene[i];\n const row = rows[i];\n cellXGeneMatrix[row * shape[1] + col] = val;\n }\n col += 1;\n });\n return cellXGeneMatrix;\n });\n return this._sparseMatrix;\n }\n\n /**\n * Class method for loading the cell x gene matrix.\n * @returns {Promise} A promise for the zarr array contianing the cell x gene data.\n */\n async loadCellXGene() {\n const { store } = this.dataSource;\n if (this.cellXGene) {\n return this.cellXGene;\n }\n const { options: { matrix, matrixGeneFilter } } = this;\n if (!this._matrixZattrs) {\n this._matrixZattrs = await this.dataSource.getJson(`${matrix}/.zattrs`);\n }\n const encodingType = this._matrixZattrs['encoding-type'];\n if (!matrixGeneFilter) {\n if (encodingType === 'csr_matrix') {\n this.cellXGene = this._loadCSRSparseCellXGene().then(data => normalize(data));\n } else if (encodingType === 'csc_matrix') {\n this.cellXGene = this._loadCSCSparseCellXGene().then(data => normalize(data));\n } else {\n if (!this.arr) {\n this.arr = openArray({ store, path: matrix, mode: 'r' });\n }\n this.cellXGene = this.arr.then(z => z.getRaw(null).then(({ data }) => normalize(data)));\n }\n } else if (encodingType === 'csr_matrix') {\n this.cellXGene = this._loadCSRSparseCellXGene().then(\n async (cellXGene) => {\n const filteredGenes = await this._getFilteredGenes(matrixGeneFilter);\n const numGenesFiltered = filteredGenes.length;\n const geneNames = await this.loadFilteredGeneNames();\n const numGenes = geneNames.length;\n const numCells = await this._getNumCells();\n const cellXGeneMatrixFiltered = new Float32Array(\n numCells * numGenesFiltered,\n ).fill(0);\n for (let i = 0; i < numGenesFiltered; i += 1) {\n const index = geneNames.indexOf(filteredGenes[i]);\n for (let j = 0; j < numCells; j += 1) {\n cellXGeneMatrixFiltered[j * numGenesFiltered + i] = cellXGene[j * numGenes + index];\n }\n }\n return normalize(cellXGeneMatrixFiltered);\n },\n );\n } else {\n const genes = await this._getFilteredGenes(matrixGeneFilter);\n this.cellXGene = this.loadGeneSelection({ selection: genes, shouldNormalize: false })\n .then(({ data }) => (normalize(concatenateColumnVectors(data))));\n }\n return this.cellXGene;\n }\n\n /**\n * Class method for loading a gene selection.\n * @param {Object} args\n * @param {Array} args.selection A list of gene names whose data should be fetched.\n * @param {Boolean} args.shouldNormalize A list of gene names whose data should be fetched.\n * @returns {Object} { data } containing an array of gene expression data.\n */\n async loadGeneSelection({ selection, shouldNormalize = true }) {\n const { options: { matrix } } = this;\n const { store } = this.dataSource;\n if (!this._matrixZattrs) {\n this._matrixZattrs = await this.dataSource.getJson(`${matrix}/.zattrs`);\n }\n const encodingType = this._matrixZattrs['encoding-type'];\n let genes;\n if (encodingType === 'csc_matrix') {\n genes = await this._loadCSCGeneSelection(selection);\n } else if (encodingType === 'csr_matrix') {\n genes = await this._loadCSRGeneSelection(selection);\n } else {\n if (!this.arr) {\n this.arr = openArray({ store, path: matrix, mode: 'r' });\n }\n const indices = await this._getGeneIndices(selection);\n // We can index directly into a normal dense array zarr store via `get`.\n genes = await Promise.all(\n indices.map(index => this.arr.then(z => z.get([null, index])).then(({ data }) => data)),\n );\n }\n return { data: genes.map(i => (shouldNormalize ? normalize(i).data : i)), url: null };\n }\n\n /**\n * Class method for loading only attributes i.e rows and columns\n * @param {Array} selection A list of gene names whose data should be fetched.\n * @returns {Object} { data: { rows, cols }, url } containing row and col labels for the matrix.\n */\n loadAttrs() {\n return Promise.all([this.dataSource.loadObsIndex(), this.loadFilteredGeneNames()])\n .then((d) => {\n const [cellNames, geneNames] = d;\n const attrs = { rows: cellNames, cols: geneNames };\n return {\n data: attrs,\n url: null,\n };\n });\n }\n\n load() {\n return Promise.all([this.loadAttrs(), this.loadCellXGene()]).then(\n async (d) => {\n const [{ data: attrs }, cellXGene] = d;\n const {\n options: { matrixGeneFilter: matrixGeneFilterZarr },\n } = this;\n // In order to return the correct gene list with the heatmap data,\n // we need to filter the columns of attrs so it matches the cellXGene data.\n if (matrixGeneFilterZarr) {\n const matrixGeneFilter = await this.dataSource.getFlatArrDecompressed(\n matrixGeneFilterZarr,\n );\n attrs.cols = attrs.cols.filter((_, i) => matrixGeneFilter[i]);\n }\n return Promise.resolve(new LoaderResult([attrs, cellXGene], null));\n },\n );\n }\n}\n","import CellSetsZarrLoader from './CellSetsZarrLoader';\nimport CellsZarrLoader from './CellsZarrLoader';\nimport MatrixZarrLoader from './MatrixZarrLoader';\n\nexport default { CellSetsZarrLoader, CellsZarrLoader, MatrixZarrLoader };\n","import LoaderResult from '../LoaderResult';\nimport AbstractTwoStepLoader from '../AbstractTwoStepLoader';\n\n/**\n * Loader for converting zarr into the cell json schema.\n */\nexport default class CellsZarrLoader extends AbstractTwoStepLoader {\n /**\n * Class method for loading spatial cell centroids.\n * @returns {Promise} A promise for an array of tuples/triples for cell centroids.\n */\n loadXy() {\n const { xy } = (this.options || {});\n if (this.xy) {\n return this.xy;\n }\n if (!this.xy && xy) {\n this.xy = this.dataSource.loadNumeric(xy);\n return this.xy;\n }\n this.xy = Promise.resolve(null);\n return this.xy;\n }\n\n /**\n * Class method for loading spatial cell polygons.\n * @returns {Promise} A promise for an array of arrays for cell polygons.\n */\n loadPoly() {\n const { poly } = (this.options || {});\n if (this.poly) {\n return this.poly;\n }\n if (!this.poly && poly) {\n this.poly = this.dataSource.loadNumeric(poly);\n return this.poly;\n }\n this.poly = Promise.resolve(null);\n return this.poly;\n }\n\n /**\n * Class method for loading various mappings, like UMAP or tSNE cooridnates.\n * @returns {Promise} A promise for an array of tuples of coordinates.\n */\n loadMappings() {\n const { mappings } = (this.options || {});\n if (this.mappings) {\n return this.mappings;\n }\n if (!this.mappings && mappings) {\n this.mappings = Promise.all(\n Object.keys(mappings).map(async (coordinationName) => {\n const { key } = mappings[coordinationName];\n return { coordinationName, arr: await this.dataSource.loadNumeric(key) };\n }),\n );\n return this.mappings;\n }\n this.mappings = Promise.resolve(null);\n return this.mappings;\n }\n\n /**\n * Class method for loading factors, which are cell set ids.\n * @returns {Promise} A promise for an array of an array of strings of ids,\n * where subarray is a clustering/factor.\n */\n loadFactors() {\n const { factors } = (this.options || {});\n if (factors) {\n return this.dataSource.loadObsVariables(factors);\n }\n return Promise.resolve(null);\n }\n\n async load() {\n if (!this.cells) {\n this.cells = Promise.all([\n this.loadMappings(),\n this.loadXy(),\n this.loadPoly(),\n this.dataSource.loadObsIndex(),\n this.loadFactors(),\n ]).then(([mappings, xy, poly, cellNames, factors]) => {\n const cells = {};\n cellNames.forEach((name, i) => {\n cells[name] = {};\n if (mappings) {\n mappings.forEach(({ coordinationName, arr }) => {\n if (!cells[name].mappings) {\n cells[name].mappings = {};\n }\n const { dims } = this.options.mappings[coordinationName];\n cells[name].mappings[coordinationName] = dims.map(\n dim => arr.data[i][dim],\n );\n });\n }\n if (xy) {\n cells[name].xy = xy.data[i];\n }\n if (poly) {\n cells[name].poly = poly.data[i];\n }\n if (factors) {\n const factorsObj = {};\n factors.forEach(\n // eslint-disable-next-line no-return-assign\n (factor, j) => (factorsObj[this.options.factors[j].split('/').slice(-1)] = factor[i]),\n );\n cells[name].factors = factorsObj;\n }\n });\n return cells;\n });\n }\n return Promise.resolve(new LoaderResult(await this.cells, null));\n }\n}\n","import AbstractTwoStepLoader from './AbstractTwoStepLoader';\nimport LoaderResult from './LoaderResult';\n\nexport default class GenomicProfilesZarrLoader extends AbstractTwoStepLoader {\n loadAttrs() {\n if (this.attrs) {\n return this.attrs;\n }\n this.attrs = this.dataSource.getJson('.zattrs');\n return this.attrs;\n }\n\n load() {\n const { url } = this;\n return this.loadAttrs()\n .then(attrs => Promise.resolve(new LoaderResult(attrs, url)));\n }\n}\n","import { HTTPStore, KeyError } from 'zarr';\n\n/**\n * A loader ancestor class containing a default constructor\n * and a stub for the required load() method.\n */\nexport default class ZarrDataSource {\n constructor({ url, requestInit }) {\n // TODO: We should probably add a way of allowing HEAD requests as well:\n // https://github.com/gzuidhof/zarr.js/blob/375ce0c299469a970da6bb5653513564e25806bb/docs/getting-started/remote-data.md#stores\n const supportedMethods = ['GET'];\n this.store = new HTTPStore(url, {\n supportedMethods, fetchOptions: requestInit,\n });\n }\n\n /**\n * Class method for decoding json from the store.\n * @param {string} key A path to the item.\n * @returns {Promise} This async function returns a promise\n * that resolves to the parsed JSON if successful.\n * @throws This may throw an error.\n */\n async getJson(key) {\n try {\n const buf = await this.store.getItem(key);\n const text = new TextDecoder('utf-8').decode(buf);\n return JSON.parse(text);\n } catch (err) {\n if (err instanceof KeyError) {\n return {};\n }\n throw err;\n }\n }\n}\n","/* eslint-disable no-underscore-dangle */\nimport { openArray } from 'zarr';\nimport range from 'lodash/range';\nimport ZarrDataSource from './ZarrDataSource';\n\nconst readFloat32FromUint8 = (bytes) => {\n if (bytes.length !== 4) {\n throw new Error('readFloat32 only takes in length 4 byte buffers');\n }\n return new Int32Array(bytes.buffer)[0];\n};\n\nconst HEADER_LENGTH = 4;\n\n/**\n * Method for decoding text arrays from zarr.\n * Largerly a port of https://github.com/zarr-developers/numcodecs/blob/2c1aff98e965c3c4747d9881d8b8d4aad91adb3a/numcodecs/vlen.pyx#L135-L178\n * @returns {string[]} An array of strings.\n */\nfunction parseVlenUtf8(buffer) {\n const decoder = new TextDecoder();\n let data = 0;\n const dataEnd = data + buffer.length;\n const length = readFloat32FromUint8(buffer.slice(data, HEADER_LENGTH));\n if (buffer.length < HEADER_LENGTH) {\n throw new Error('corrupt buffer, missing or truncated header');\n }\n data += HEADER_LENGTH;\n const output = new Array(length);\n for (let i = 0; i < length; i += 1) {\n if (data + 4 > dataEnd) {\n throw new Error('corrupt buffer, data seem truncated');\n }\n const l = readFloat32FromUint8(buffer.slice(data, data + 4));\n data += 4;\n if (data + l > dataEnd) {\n throw new Error('corrupt buffer, data seem truncated');\n }\n output[i] = decoder.decode(buffer.slice(data, data + l));\n data += l;\n }\n return output;\n}\n\n/**\n * A base AnnData loader which has all shared methods for more comlpex laoders,\n * like loading cell names and ids. It inherits from AbstractLoader.\n */\nexport default class AnnDataSource extends ZarrDataSource {\n constructor(...args) {\n super(...args);\n /** @type {Map<string, Promise<string[]>} */\n this.obsPromises = new Map();\n }\n\n /**\n * Class method for loading obs variables.\n * Takes the location as an argument because this is shared across objects,\n * which have different ways of specifying location.\n * @param {string[]} obsPaths An array of strings like \"obs/leiden\" or \"obs/bulk_labels.\"\n * @returns {Promise} A promise for an array of ids with one per cell.\n */\n loadObsVariables(obsPaths) {\n const obsPromises = obsPaths.map((obsPath) => {\n const getObsCol = (obsCol) => {\n if (!this.obsPromises.has(obsCol)) {\n const obsPromise = this._loadObsVariable(obsCol).catch((err) => {\n // clear from cache if promise rejects\n this.obsPromises.delete(obsCol);\n // propagate error\n throw err;\n });\n this.obsPromises.set(obsCol, obsPromise);\n }\n return this.obsPromises.get(obsCol);\n };\n if (!obsPath) {\n return Promise.resolve(undefined);\n }\n if (Array.isArray(obsPath)) {\n return Promise.resolve(Promise.all(obsPath.map(getObsCol)));\n }\n return getObsCol(obsPath);\n });\n return Promise.all(obsPromises);\n }\n\n async _loadObsVariable(obs) {\n const { store } = this;\n const { categories } = await this.getJson(`${obs}/.zattrs`);\n let categoriesValues;\n if (categories) {\n const { dtype } = await this.getJson(`/obs/${categories}/.zarray`);\n if (dtype === '|O') {\n categoriesValues = await this.getFlatArrDecompressed(`/obs/${categories}`);\n }\n }\n const obsArr = await openArray({ store, path: obs, mode: 'r' });\n const obsValues = await obsArr.get();\n const { data } = obsValues;\n const mappedObsValues = Array.from(data).map(\n i => (!categoriesValues ? String(i) : categoriesValues[i]),\n );\n return mappedObsValues;\n }\n\n /**\n * Class method for loading general numeric arrays.\n * @param {string} path A string like obsm.X_pca.\n * @returns {Promise} A promise for a zarr array containing the data.\n */\n loadNumeric(path) {\n const { store } = this;\n return openArray({\n store,\n path,\n mode: 'r',\n }).then(arr => arr.get());\n }\n\n /**\n * A common method for loading flattened data\n * i.e that which has shape [n] where n is a natural number.\n * @param {string} path A path to a flat array location, like obs/_index\n * @returns {Array} The data from the zarr array.\n */\n getFlatArrDecompressed(path) {\n const { store } = this;\n return openArray({\n store,\n path,\n mode: 'r',\n }).then(async (z) => {\n let data;\n const parseAndMergeTextBytes = (dbytes) => {\n const text = parseVlenUtf8(dbytes);\n if (!data) {\n data = text;\n } else {\n data = data.concat(text);\n }\n };\n const mergeBytes = (dbytes) => {\n if (!data) {\n data = dbytes;\n } else {\n const tmp = new Uint8Array(dbytes.buffer.byteLength + data.buffer.byteLength);\n tmp.set(new Uint8Array(data.buffer), 0);\n tmp.set(dbytes, data.buffer.byteLength);\n data = tmp;\n }\n };\n const numRequests = Math.ceil(z.meta.shape[0] / z.meta.chunks[0]);\n const requests = range(numRequests).map(async item => store.getItem(`${z.keyPrefix}${String(item)}`)\n .then(buf => z.compressor.then(compressor => compressor.decode(buf))));\n const dbytesArr = await Promise.all(requests);\n dbytesArr.forEach((dbytes) => {\n // Use vlenutf-8 decoding if necessary and merge `data` as a normal array.\n if (Array.isArray(z.meta.filters) && z.meta.filters[0].id === 'vlen-utf8') {\n parseAndMergeTextBytes(dbytes);\n // Otherwise just merge the bytes as a typed array.\n } else {\n mergeBytes(dbytes);\n }\n });\n const {\n meta: {\n shape: [length],\n },\n } = z;\n // truncate the filled in values\n return data.slice(0, length);\n });\n }\n\n /**\n * Class method for loading the obs index.\n * @returns {Promise} An promise for a zarr array containing the indices.\n */\n loadObsIndex() {\n if (this.obsIndex) {\n return this.obsIndex;\n }\n this.obsIndex = this.getJson('obs/.zattrs')\n .then(({ _index }) => this.getFlatArrDecompressed(`/obs/${_index}`));\n return this.obsIndex;\n }\n\n /**\n * Class method for loading the var index.\n * @returns {Promise} An promise for a zarr array containing the indices.\n */\n loadVarIndex() {\n if (this.varIndex) {\n return this.varIndex;\n }\n this.varIndex = this.getJson('var/.zattrs')\n .then(({ _index }) => this.getFlatArrDecompressed(`/var/${_index}`));\n return this.varIndex;\n }\n}\n","import AbstractLoaderError from './AbstractLoaderError';\n\nexport default class DataSourceFetchError extends AbstractLoaderError {\n constructor(source, url, headers) {\n super(`${source} Error HTTP Status fetching from ${url}`);\n this.source = source;\n this.url = url;\n this.headers = headers;\n }\n\n warnInConsole() {\n const { source, url, headers } = this;\n console.warn(`${source} failed to fetch from ${url} with headers ${headers}`);\n }\n}\n","/* eslint-disable no-underscore-dangle */\nimport DataSourceFetchError from '../errors/DataSourceFetchError';\n\nexport default class JsonSource {\n constructor({ url, requestInit }) {\n this.url = url;\n this.requestInit = requestInit;\n }\n\n get data() {\n if (this._data) return this._data;\n this._data = fetch(this.url, this.requestInit).then((response) => {\n if (!response.ok) {\n return Promise.reject(new DataSourceFetchError('JsonSource', this.url, response.headers));\n }\n return response.json();\n // eslint-disable-next-line no-console\n }).catch(() => Promise.reject(new DataSourceFetchError('JsonSource', this.url, {})));\n return this._data;\n }\n}\n","import { FileType } from '../app/constants';\n\nimport JsonLoader from './JsonLoader';\nimport MatrixZarrLoader from './MatrixZarrLoader';\nimport GenesJsonAsMatrixZarrLoader from './GenesJsonAsMatrixZarrLoader';\nimport ClustersJsonAsMatrixZarrLoader from './ClustersJsonAsMatrixZarrLoader';\nimport RasterJsonLoader from './RasterJsonLoader';\nimport OmeZarrLoader from './OmeZarrLoader';\nimport CellSetsJsonLoader from './CellSetsJsonLoader';\nimport AnnDataLoaders from './anndata-loaders';\nimport GenomicProfilesZarrLoader from './GenomicProfilesZarrLoader';\nimport { AnnDataSource, ZarrDataSource, JsonSource } from './data-sources';\n\nexport const fileTypeToLoaderAndSource = {\n [FileType.EXPRESSION_MATRIX_ZARR]: [ZarrDataSource, MatrixZarrLoader],\n [FileType.CLUSTERS_JSON]: [JsonSource, ClustersJsonAsMatrixZarrLoader],\n [FileType.GENES_JSON]: [JsonSource, GenesJsonAsMatrixZarrLoader],\n [FileType.CELLS_JSON]: [JsonSource, JsonLoader],\n [FileType.MOLECULES_JSON]: [JsonSource, JsonLoader],\n [FileType.NEIGHBORHOODS_JSON]: [JsonSource, JsonLoader],\n [FileType.RASTER_JSON]: [JsonSource, RasterJsonLoader],\n [FileType.RASTER_OME_ZARR]: [ZarrDataSource, OmeZarrLoader],\n [FileType.CELL_SETS_JSON]: [JsonSource, CellSetsJsonLoader],\n [FileType.ANNDATA_CELL_SETS_ZARR]: [AnnDataSource, AnnDataLoaders.CellSetsZarrLoader],\n [FileType.ANNDATA_CELLS_ZARR]: [AnnDataSource, AnnDataLoaders.CellsZarrLoader],\n [FileType.ANNDATA_EXPRESSION_MATRIX_ZARR]: [AnnDataSource, AnnDataLoaders.MatrixZarrLoader],\n [FileType.GENOMIC_PROFILES_ZARR]: [ZarrDataSource, GenomicProfilesZarrLoader],\n};\n\nexport function getSourceAndLoaderFromFileType(type) {\n return fileTypeToLoaderAndSource[type] || [JsonSource, JsonLoader];\n}\n","import {\n useState, useEffect, useRef,\n} from 'react';\nimport { getSourceAndLoaderFromFileType } from '../loaders/types';\n\n/**\n * Return the bottom coordinate of the layout.\n * https://github.com/STRML/react-grid-layout/blob/20dac73f91274526034c00968b5bedb9c2ed36b9/lib/utils.js#L82\n * @param {array} layout react-grid-layout layout array.\n * @returns {number} Bottom coordinate.\n */\nfunction getNumRows(layout) {\n let max = 0;\n let bottomY;\n // eslint-disable-next-line no-plusplus\n for (let i = 0, len = layout.length; i < len; i++) {\n bottomY = layout[i].y + layout[i].h;\n if (bottomY > max) max = bottomY;\n }\n return max;\n}\n\n/**\n * Compute the row height based on the container height, number of rows,\n * and margin/padding. Basically the reverse of the react-grid-layout's\n * `.containerHeight()` function.\n * https://github.com/STRML/react-grid-layout/blob/83251e5e682abfa3252ff89d4bacf47fdc1f4270/lib/ReactGridLayout.jsx#L223\n * @param {number} containerHeight The height of the .vitessce-container element.\n * @param {number} numRows The number of rows in the layout.\n * @param {number} margin The margin value that will be passed to VitessceGrid.\n * @param {number} padding The padding value that will be passed to VitessceGrid.\n * @returns {number} The new row height value.\n */\nfunction getRowHeight(containerHeight, numRows, margin, padding) {\n const effectiveContainerHeight = containerHeight - 2 * padding - (numRows - 1) * margin;\n return effectiveContainerHeight / numRows;\n}\n\nexport function useRowHeight(config, initialRowHeight, height, margin, padding) {\n const [containerHeight, setContainerHeight] = useState(height);\n const [rowHeight, setRowHeight] = useState(initialRowHeight);\n const containerRef = useRef();\n\n // Detect when the `config` or `containerHeight` variables\n // have changed, and update `rowHeight` in response.\n useEffect(() => {\n const numRows = getNumRows(config.layout);\n const newRowHeight = getRowHeight(containerHeight, numRows, margin, padding);\n setRowHeight(newRowHeight);\n }, [containerHeight, config, margin, padding]);\n\n // Update the `containerHeight` state when the `height` prop has changed.\n useEffect(() => {\n if (height !== null && height !== undefined) {\n setContainerHeight(height);\n }\n }, [height]);\n\n // If no height prop has been provided, set the `containerHeight`\n // using height of the `.vitessce-container` element.\n // Check the container element height whenever the window has been\n // resized, as it may change if `.vitessce-container` should be\n // sized relative to its parent (and by extension, potentially the window).\n useEffect(() => {\n if (height !== null && height !== undefined) {\n // eslint will complain if the return value is inconsistent,\n // so return a no-op function.\n return () => {};\n }\n function onWindowResize() {\n if (!containerRef.current) return;\n const containerRect = containerRef.current.getBoundingClientRect();\n setContainerHeight(containerRect.height);\n }\n window.addEventListener('resize', onWindowResize);\n onWindowResize();\n return () => {\n window.removeEventListener('resize', onWindowResize);\n };\n }, [containerRef, height]);\n\n\n return [rowHeight, containerRef];\n}\n\n/**\n * Create a mapping from dataset ID to loader objects by data type.\n * @param {object[]} datasets The datasets array from the view config.\n * @param {string} configDescription The top-level description in the\n * view config.\n * @returns {object} Mapping from dataset ID to data type to loader\n * instance.\n */\nexport function createLoaders(datasets, configDescription) {\n const result = {};\n const dataSources = {};\n datasets.forEach((dataset) => {\n const datasetLoaders = {\n name: dataset.name,\n description: dataset.description || configDescription,\n loaders: {},\n };\n dataset.files.forEach((file) => {\n const [DataSourceClass, LoaderClass] = getSourceAndLoaderFromFileType(file.fileType);\n // Create _one_ DataSourceClass instance per URL. Derived loaders share this object.\n const { url, options, requestInit } = file;\n const fileId = url || JSON.stringify(options);\n if (!(fileId in dataSources)) {\n dataSources[fileId] = new DataSourceClass({ url, requestInit });\n }\n const loader = new LoaderClass(dataSources[fileId], file);\n datasetLoaders.loaders[file.type] = loader;\n });\n result[dataset.uid] = datasetLoaders;\n });\n return result;\n}\n","import {\n useRef, useState, useEffect, useCallback, useMemo,\n} from 'react';\nimport debounce from 'lodash/debounce';\nimport { useGridResize, useEmitGridResize } from '../app/state/hooks';\nimport { VITESSCE_CONTAINER } from './classNames';\n\nfunction getWindowDimensions() {\n const { innerWidth: width, innerHeight: height } = window;\n return {\n width,\n height,\n };\n}\n\nexport function useVitessceContainer(ref) {\n return useCallback(() => {\n if (ref.current) {\n return ref.current.closest(`.${VITESSCE_CONTAINER}`);\n }\n return null;\n }, [ref]);\n}\n\n/**\n * Custom hook, gets the full window dimensions.\n * @returns {array} `[width, height]` where width and height\n * are numbers.\n */\nexport function useWindowDimensions() {\n const [windowDimensions, setWindowDimensions] = useState(\n getWindowDimensions(),\n );\n\n useEffect(() => {\n function handleResize() {\n setWindowDimensions(getWindowDimensions());\n }\n const onResizeDebounced = debounce(handleResize, 100, { trailing: true });\n\n window.addEventListener('resize', onResizeDebounced);\n return () => window.removeEventListener('resize', onResizeDebounced);\n }, []);\n\n return windowDimensions;\n}\n\n/**\n * Custom hook, subscribes to GRID_RESIZE and window resize events.\n * @returns {array} `[width, height, containerRef]` where width and height\n * are numbers and containerRef is a React ref.\n */\nexport function useGridItemSize() {\n const containerRef = useRef();\n\n const [height, setHeight] = useState();\n const [width, setWidth] = useState();\n\n const resizeCount = useGridResize();\n const incrementResizeCount = useEmitGridResize();\n\n // On window resize events, increment the grid resize count.\n useEffect(() => {\n function onWindowResize() {\n incrementResizeCount();\n }\n const onResizeDebounced = debounce(onWindowResize, 100, { trailing: true });\n window.addEventListener('resize', onResizeDebounced);\n onWindowResize();\n return () => {\n window.removeEventListener('resize', onResizeDebounced);\n };\n }, [incrementResizeCount]);\n\n // On new grid resize counts, re-compute the component\n // width/height.\n useEffect(() => {\n if (!containerRef.current) return;\n const container = containerRef.current;\n const containerRect = container.getBoundingClientRect();\n setHeight(containerRect.height);\n setWidth(containerRect.width);\n }, [resizeCount]);\n\n return [width, height, containerRef];\n}\n\n/**\n * Custom hook, subscribes to GRID_RESIZE and window resize events.\n * @returns {array} `[width, height, deckRef]` where width and height\n * are numbers and deckRef is a React ref to be used with\n * a <DeckGL/> element (or a forwardRef to one).\n */\nexport function useDeckCanvasSize() {\n const deckRef = useRef();\n\n const [height, setHeight] = useState();\n const [width, setWidth] = useState();\n\n const resizeCount = useGridResize();\n const incrementResizeCount = useEmitGridResize();\n\n // On window resize events, increment the grid resize count.\n useEffect(() => {\n function onWindowResize() {\n incrementResizeCount();\n }\n const onResizeDebounced = debounce(onWindowResize, 100, { trailing: true });\n window.addEventListener('resize', onResizeDebounced);\n onWindowResize();\n return () => {\n window.removeEventListener('resize', onResizeDebounced);\n };\n }, [incrementResizeCount]);\n\n // On new grid resize counts, re-compute the DeckGL canvas\n // width/height.\n useEffect(() => {\n if (!deckRef.current) return;\n const { canvas } = deckRef.current.deck;\n const canvasRect = canvas.getBoundingClientRect();\n setHeight(canvasRect.height);\n setWidth(canvasRect.width);\n }, [resizeCount]);\n\n return [width, height, deckRef];\n}\n\n/**\n * This hook handles a boolean isReady value,\n * which only returns true once every item in the\n * input list has been marked as \"ready\".\n * @param {string[]} items The items to wait on.\n * Should be defined as a constant\n * (outside a function component / render function),\n * otherwise strange bugs may occur.\n * @returns {array} An array\n * [isReady, setItemIsReady, setItemIsNotReady, resetReadyItems]\n * where isReady is the boolean value,\n * setItemIsReady marks one item as ready,\n * setItemIsNotReady marks one item as not ready,\n * and resetReadyItem marks all items as waiting.\n */\nexport function useReady(supportedItems) {\n const items = supportedItems;\n const [waiting, setWaiting] = useState(items);\n\n const setItemIsReady = useCallback((readyItem) => {\n setWaiting((waitingItems) => {\n const nextWaitingItems = waitingItems.filter(item => item !== readyItem);\n // eslint-disable-next-line no-console\n console.log(`cleared ${readyItem}; waiting on ${nextWaitingItems.length}: ${JSON.stringify(nextWaitingItems)}`);\n return nextWaitingItems;\n });\n }, [setWaiting]);\n\n const setItemIsNotReady = useCallback((notReadyItem) => {\n setWaiting((waitingItems) => {\n const nextWaitingItems = [...waitingItems, notReadyItem];\n // eslint-disable-next-line no-console\n console.log(`waiting on ${nextWaitingItems.length}: ${JSON.stringify(nextWaitingItems)}`);\n return nextWaitingItems;\n });\n }, [setWaiting]);\n\n const resetReadyItems = useCallback(() => {\n setWaiting(items);\n // eslint-disable-next-line no-console\n console.log(`waiting on ${items.length}: ${JSON.stringify(items)}`);\n }, [setWaiting, items]);\n\n const isReady = waiting.length === 0;\n\n return [isReady, setItemIsReady, setItemIsNotReady, resetReadyItems];\n}\n\n/**\n * This hook manages a list of URLs,\n * with adding and resetting helpers.\n * @returns {array} An array\n * [urls, addUrl, resetUrls]\n * where urls is the array of URL objects,\n * addUrl is a function for adding a URL to the array,\n * resetUrls is a function that clears the array.\n */\nexport function useUrls() {\n const [urls, setUrls] = useState([]);\n\n const addUrl = useCallback((url, name) => {\n if (url) {\n setUrls(prev => ([...prev, { url, name }]));\n }\n }, [setUrls]);\n\n const resetUrls = useCallback(() => {\n setUrls([]);\n }, [setUrls]);\n\n return [urls, addUrl, resetUrls];\n}\n\n/**\n * Custom hook, subscribes to the width and height of the closest .vitessce-container\n * element and updates upon window resize events.\n * @param {Ref} ref A React ref object within the `.vitessce-container`.\n * @returns {array} `[width, height]` where width and height\n * are numbers.\n */\nexport function useClosestVitessceContainerSize(ref) {\n const [height, setHeight] = useState();\n const [width, setWidth] = useState();\n\n useEffect(() => {\n function onWindowResize() {\n if (ref.current) {\n const {\n clientHeight: componentHeight, clientWidth: componentWidth,\n } = ref.current.closest('.vitessce-container');\n setWidth(componentWidth);\n setHeight(componentHeight);\n }\n }\n const onResizeDebounced = debounce(onWindowResize, 100, { trailing: true });\n window.addEventListener('resize', onResizeDebounced);\n onWindowResize();\n return () => {\n window.removeEventListener('resize', onResizeDebounced);\n };\n }, [ref]);\n\n return [width, height];\n}\n\nexport function useExpressionValueGetter({ attrs, expressionData }) {\n // Get a mapping from cell ID to row index in the gene expression matrix.\n const cellIdMap = useMemo(() => {\n const result = {};\n if (attrs && attrs.rows) {\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < attrs.rows.length; i++) {\n result[attrs.rows[i]] = i;\n }\n }\n return result;\n }, [attrs]);\n\n // Set up a getter function for gene expression values, to be used\n // by the DeckGL layer to obtain values for instanced attributes.\n const getExpressionValue = useCallback((entry) => {\n const cellId = entry[0];\n if (cellIdMap && expressionData && expressionData[0]) {\n const cellIndex = cellIdMap[cellId];\n const val = expressionData[0][cellIndex];\n return val;\n }\n return 0;\n }, [cellIdMap, expressionData]);\n return getExpressionValue;\n}\n","import React, {\n useEffect,\n useCallback,\n} from 'react';\nimport { VitessceGridLayout } from './vitessce-grid-layout';\nimport { useRowHeight, createLoaders } from './vitessce-grid-utils';\nimport {\n useViewConfigStoreApi,\n useSetViewConfig,\n useSetLoaders,\n useEmitGridResize,\n useRemoveComponent,\n useChangeLayout,\n useLayout,\n} from './state/hooks';\nimport {\n useClosestVitessceContainerSize,\n} from '../components/hooks';\n\nconst padding = 10;\nconst margin = 5;\n\n/**\n * The wrapper for the VitessceGrid and LoadingIndicator components.\n * @param {object} props\n * @param {number} props.rowHeight The height of each grid row. Optional.\n * @param {object} props.config The view config.\n * @param {function} props.getComponent A function that maps component names to their\n * React counterparts.\n * @param {string} props.theme The theme name.\n * @param {number} props.height Total height for grid. Optional.\n * @param {function} props.onWarn A callback for warning messages. Optional.\n */\nexport default function VitessceGrid(props) {\n const {\n rowHeight: initialRowHeight,\n config,\n getComponent,\n theme,\n height,\n } = props;\n\n const [rowHeight, containerRef] = useRowHeight(config, initialRowHeight, height, margin, padding);\n const onResize = useEmitGridResize();\n\n const [componentWidth] = useClosestVitessceContainerSize(containerRef);\n\n // When the row height has changed, publish a GRID_RESIZE event.\n useEffect(() => {\n onResize();\n }, [rowHeight, onResize]);\n\n const viewConfigStoreApi = useViewConfigStoreApi();\n const setViewConfig = useSetViewConfig(viewConfigStoreApi);\n const setLoaders = useSetLoaders();\n const removeComponent = useRemoveComponent();\n const changeLayout = useChangeLayout();\n const layout = useLayout();\n\n const changeLayoutPostMount = useCallback(() => (\n componentWidth > 0 ? changeLayout : () => {}\n ), [changeLayout, componentWidth]);\n\n // Update the view config and loaders in the global state.\n useEffect(() => {\n if (config) {\n setViewConfig(config);\n const loaders = createLoaders(config.datasets, config.description);\n setLoaders(loaders);\n } else {\n // No config found, so clear the loaders.\n setLoaders({});\n }\n }, [config, setViewConfig, setLoaders]);\n\n return (\n <div\n ref={containerRef}\n className={`vitessce-container vitessce-theme-${theme}`}\n >\n {layout && (\n <VitessceGridLayout\n layout={layout}\n height={height}\n rowHeight={rowHeight}\n theme={theme}\n getComponent={getComponent}\n draggableHandle=\".title\"\n margin={margin}\n padding={padding}\n onRemoveComponent={removeComponent}\n onLayoutChange={changeLayoutPostMount}\n reactGridLayoutProps={{\n onResize,\n onResizeStop: onResize,\n }}\n />\n )}\n </div>\n );\n}\n","import { CoordinationType, Component } from '../constants';\n\n/**\n * Coordination types may have default values,\n * which can be defined here, and used by the\n * auto initialization strategy.\n */\nexport const DEFAULT_COORDINATION_VALUES = {\n [CoordinationType.EMBEDDING_ZOOM]: null,\n [CoordinationType.EMBEDDING_ROTATION]: 0,\n [CoordinationType.EMBEDDING_TARGET_X]: null,\n [CoordinationType.EMBEDDING_TARGET_Y]: null,\n [CoordinationType.EMBEDDING_TARGET_Z]: 0,\n [CoordinationType.EMBEDDING_CELL_SET_POLYGONS_VISIBLE]: false,\n [CoordinationType.EMBEDDING_CELL_SET_LABELS_VISIBLE]: false,\n [CoordinationType.EMBEDDING_CELL_SET_LABEL_SIZE]: 14,\n [CoordinationType.EMBEDDING_CELL_RADIUS]: 1,\n [CoordinationType.EMBEDDING_CELL_RADIUS_MODE]: 'auto',\n [CoordinationType.EMBEDDING_CELL_OPACITY]: 1,\n [CoordinationType.EMBEDDING_CELL_OPACITY_MODE]: 'auto',\n [CoordinationType.SPATIAL_ZOOM]: null,\n [CoordinationType.SPATIAL_ROTATION]: 0,\n [CoordinationType.SPATIAL_TARGET_X]: null,\n [CoordinationType.SPATIAL_TARGET_Y]: null,\n [CoordinationType.SPATIAL_TARGET_Z]: null,\n [CoordinationType.SPATIAL_ROTATION_X]: null,\n [CoordinationType.SPATIAL_ROTATION_Y]: null,\n [CoordinationType.SPATIAL_ROTATION_Z]: null,\n [CoordinationType.SPATIAL_AXIS_FIXED]: false,\n [CoordinationType.SPATIAL_ROTATION_ORBIT]: 0,\n [CoordinationType.SPATIAL_ORBIT_AXIS]: 'Y',\n [CoordinationType.SPATIAL_RASTER_LAYERS]: null,\n [CoordinationType.SPATIAL_CELLS_LAYER]: null,\n [CoordinationType.SPATIAL_MOLECULES_LAYER]: null,\n [CoordinationType.SPATIAL_NEIGHBORHOODS_LAYER]: null,\n [CoordinationType.HEATMAP_ZOOM_X]: 0,\n [CoordinationType.HEATMAP_ZOOM_Y]: 0,\n [CoordinationType.HEATMAP_TARGET_X]: 0,\n [CoordinationType.HEATMAP_TARGET_Y]: 0,\n [CoordinationType.GENE_EXPRESSION_COLORMAP]: 'plasma',\n [CoordinationType.GENE_EXPRESSION_COLORMAP_RANGE]: [0.0, 1.0],\n [CoordinationType.GENE_EXPRESSION_TRANSFORM]: null,\n [CoordinationType.GENE_FILTER]: null,\n [CoordinationType.GENE_HIGHLIGHT]: null,\n [CoordinationType.GENE_SELECTION]: null,\n [CoordinationType.CELL_FILTER]: null,\n [CoordinationType.CELL_HIGHLIGHT]: null,\n [CoordinationType.CELL_SET_SELECTION]: null,\n [CoordinationType.CELL_SET_HIGHLIGHT]: null,\n [CoordinationType.CELL_SET_COLOR]: null,\n [CoordinationType.CELL_COLOR_ENCODING]: 'cellSetSelection',\n [CoordinationType.GENOMIC_ZOOM_X]: 0,\n [CoordinationType.GENOMIC_ZOOM_Y]: 0,\n [CoordinationType.GENOMIC_TARGET_X]: 1549999999.5,\n [CoordinationType.GENOMIC_TARGET_Y]: 1549999999.5,\n [CoordinationType.ADDITIONAL_CELL_SETS]: null,\n [CoordinationType.MOLECULE_HIGHLIGHT]: null,\n};\n\n// The following coordination types should be\n// initialized to independent scopes when\n// initialized automatically.\n// These make the resulting view config\n// (after auto-initialization) behave\n// like \"legacy\" Vitessce (pre-coordination model).\nexport const AUTO_INDEPENDENT_COORDINATION_TYPES = [\n CoordinationType.HEATMAP_ZOOM_X,\n CoordinationType.HEATMAP_ZOOM_Y,\n CoordinationType.HEATMAP_TARGET_X,\n CoordinationType.HEATMAP_TARGET_Y,\n CoordinationType.EMBEDDING_ZOOM,\n CoordinationType.EMBEDDING_TARGET_X,\n CoordinationType.EMBEDDING_TARGET_Y,\n CoordinationType.EMBEDDING_TARGET_Z,\n CoordinationType.EMBEDDING_CELL_SET_POLYGONS_VISIBLE,\n CoordinationType.EMBEDDING_CELL_SET_LABELS_VISIBLE,\n CoordinationType.EMBEDDING_CELL_SET_LABEL_SIZE,\n CoordinationType.EMBEDDING_CELL_RADIUS,\n CoordinationType.EMBEDDING_CELL_OPACITY,\n];\n\n/**\n * Mapping from component type to\n * supported coordination object types.\n * This mapping can be used to determine\n * which pieces of state that a component will\n * need to get/set.\n * Keys here are the component registry keys.\n */\nexport const COMPONENT_COORDINATION_TYPES = {\n [Component.SCATTERPLOT]: [\n CoordinationType.DATASET,\n CoordinationType.EMBEDDING_TYPE,\n CoordinationType.EMBEDDING_ZOOM,\n CoordinationType.EMBEDDING_ROTATION,\n CoordinationType.EMBEDDING_TARGET_X,\n CoordinationType.EMBEDDING_TARGET_Y,\n CoordinationType.EMBEDDING_TARGET_Z,\n CoordinationType.EMBEDDING_CELL_SET_POLYGONS_VISIBLE,\n CoordinationType.EMBEDDING_CELL_SET_LABELS_VISIBLE,\n CoordinationType.EMBEDDING_CELL_SET_LABEL_SIZE,\n CoordinationType.EMBEDDING_CELL_RADIUS,\n CoordinationType.EMBEDDING_CELL_RADIUS_MODE,\n CoordinationType.EMBEDDING_CELL_OPACITY,\n CoordinationType.EMBEDDING_CELL_OPACITY_MODE,\n CoordinationType.CELL_FILTER,\n CoordinationType.CELL_HIGHLIGHT,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n CoordinationType.GENE_EXPRESSION_COLORMAP,\n CoordinationType.GENE_EXPRESSION_COLORMAP_RANGE,\n CoordinationType.CELL_COLOR_ENCODING,\n CoordinationType.ADDITIONAL_CELL_SETS,\n ],\n [Component.SPATIAL]: [\n CoordinationType.DATASET,\n CoordinationType.SPATIAL_ZOOM,\n CoordinationType.SPATIAL_ROTATION,\n CoordinationType.SPATIAL_RASTER_LAYERS,\n CoordinationType.SPATIAL_CELLS_LAYER,\n CoordinationType.SPATIAL_MOLECULES_LAYER,\n CoordinationType.SPATIAL_NEIGHBORHOODS_LAYER,\n CoordinationType.SPATIAL_TARGET_X,\n CoordinationType.SPATIAL_TARGET_Y,\n CoordinationType.SPATIAL_TARGET_Z,\n CoordinationType.SPATIAL_ROTATION_X,\n CoordinationType.SPATIAL_ROTATION_Y,\n CoordinationType.SPATIAL_ROTATION_Z,\n CoordinationType.SPATIAL_ROTATION_ORBIT,\n CoordinationType.SPATIAL_ORBIT_AXIS,\n CoordinationType.SPATIAL_AXIS_FIXED,\n CoordinationType.CELL_FILTER,\n CoordinationType.CELL_HIGHLIGHT,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n CoordinationType.GENE_EXPRESSION_COLORMAP,\n CoordinationType.GENE_EXPRESSION_COLORMAP_RANGE,\n CoordinationType.CELL_COLOR_ENCODING,\n CoordinationType.ADDITIONAL_CELL_SETS,\n CoordinationType.MOLECULE_HIGHLIGHT,\n ],\n [Component.HEATMAP]: [\n CoordinationType.DATASET,\n CoordinationType.HEATMAP_ZOOM_X,\n CoordinationType.HEATMAP_ZOOM_Y,\n CoordinationType.HEATMAP_TARGET_X,\n CoordinationType.HEATMAP_TARGET_Y,\n CoordinationType.CELL_FILTER,\n CoordinationType.CELL_HIGHLIGHT,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.GENE_FILTER,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n CoordinationType.GENE_EXPRESSION_COLORMAP,\n CoordinationType.GENE_EXPRESSION_COLORMAP_RANGE,\n CoordinationType.CELL_COLOR_ENCODING,\n CoordinationType.ADDITIONAL_CELL_SETS,\n ],\n [Component.CELL_SETS]: [\n CoordinationType.DATASET,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.CELL_COLOR_ENCODING,\n CoordinationType.ADDITIONAL_CELL_SETS,\n CoordinationType.GENE_SELECTION,\n ],\n [Component.CELL_SET_SIZES]: [\n CoordinationType.DATASET,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.ADDITIONAL_CELL_SETS,\n ],\n [Component.STATUS]: [\n CoordinationType.DATASET,\n CoordinationType.CELL_HIGHLIGHT,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.MOLECULE_HIGHLIGHT,\n ],\n [Component.GENES]: [\n CoordinationType.DATASET,\n CoordinationType.GENE_FILTER,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n CoordinationType.CELL_COLOR_ENCODING,\n CoordinationType.CELL_SET_SELECTION,\n ],\n [Component.CELL_SET_EXPRESSION]: [\n CoordinationType.DATASET,\n CoordinationType.GENE_SELECTION,\n CoordinationType.GENE_EXPRESSION_TRANSFORM,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.ADDITIONAL_CELL_SETS,\n ],\n [Component.EXPRESSION_HISTOGRAM]: [\n CoordinationType.DATASET,\n CoordinationType.GENE_SELECTION,\n ],\n [Component.LAYER_CONTROLLER]: [\n CoordinationType.DATASET,\n CoordinationType.SPATIAL_RASTER_LAYERS,\n CoordinationType.SPATIAL_CELLS_LAYER,\n CoordinationType.SPATIAL_MOLECULES_LAYER,\n CoordinationType.SPATIAL_NEIGHBORHOODS_LAYER,\n CoordinationType.SPATIAL_ZOOM,\n CoordinationType.SPATIAL_TARGET_X,\n CoordinationType.SPATIAL_TARGET_Y,\n CoordinationType.SPATIAL_TARGET_Z,\n CoordinationType.SPATIAL_ROTATION_X,\n CoordinationType.SPATIAL_ROTATION_Y,\n CoordinationType.SPATIAL_ROTATION_Z,\n CoordinationType.SPATIAL_ROTATION_ORBIT,\n CoordinationType.SPATIAL_ORBIT_AXIS,\n ],\n [Component.GENOMIC_PROFILES]: [\n CoordinationType.DATASET,\n CoordinationType.GENOMIC_ZOOM_X,\n CoordinationType.GENOMIC_ZOOM_Y,\n CoordinationType.GENOMIC_TARGET_X,\n CoordinationType.GENOMIC_TARGET_Y,\n CoordinationType.GENE_FILTER,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n CoordinationType.CELL_SET_SELECTION,\n CoordinationType.CELL_SET_HIGHLIGHT,\n CoordinationType.CELL_SET_COLOR,\n CoordinationType.ADDITIONAL_CELL_SETS,\n ],\n [Component.DESCRIPTION]: [\n CoordinationType.DATASET,\n CoordinationType.SPATIAL_RASTER_LAYERS,\n ],\n higlass: [\n CoordinationType.DATASET,\n CoordinationType.GENOMIC_ZOOM_X,\n CoordinationType.GENOMIC_ZOOM_Y,\n CoordinationType.GENOMIC_TARGET_X,\n CoordinationType.GENOMIC_TARGET_Y,\n CoordinationType.GENE_FILTER,\n CoordinationType.GENE_HIGHLIGHT,\n CoordinationType.GENE_SELECTION,\n ],\n};\n","/* eslint-disable camelcase */\nimport uuidv4 from 'uuid/v4';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { getNextScope, capitalize } from '../utils';\nimport {\n COMPONENT_COORDINATION_TYPES,\n} from './state/coordination';\n\n/**\n * A helper function for the `upgrade()` function,\n * which helps convert `props.view` (for scatterplot and spatial),\n * into new coordination scopes, setting their values\n * in the coordination space and returning the new scope mappings.\n * This function does mutate the `coordinationSpace` parameter.\n * @param {string} prefix The coordination type prefix,\n * either 'embedding' or 'spatial'.\n * @param {object} view The view prop object containing\n * the properties `.target` and `.zoom`.\n * @param {object} coordinationSpace The coordination space.\n * @returns {object} The new coordination scope names.\n */\nfunction upgradeReplaceViewProp(prefix, view, coordinationSpace) {\n const prevZScopes = Object.keys(coordinationSpace[`${prefix}Zoom`]);\n const prevTXScopes = Object.keys(coordinationSpace[`${prefix}TargetX`]);\n const prevTYScopes = Object.keys(coordinationSpace[`${prefix}TargetY`]);\n\n const nextZScope = getNextScope(prevZScopes);\n const nextTXScope = getNextScope(prevTXScopes);\n const nextTYScope = getNextScope(prevTYScopes);\n\n const { zoom, target: [targetX, targetY] } = view;\n // eslint-disable-next-line no-param-reassign\n coordinationSpace[`${prefix}Zoom`][nextZScope] = zoom;\n // eslint-disable-next-line no-param-reassign\n coordinationSpace[`${prefix}TargetX`][nextTXScope] = targetX;\n // eslint-disable-next-line no-param-reassign\n coordinationSpace[`${prefix}TargetY`][nextTYScope] = targetY;\n return {\n [`${prefix}Zoom`]: nextZScope,\n [`${prefix}TargetX`]: nextTXScope,\n [`${prefix}TargetY`]: nextTYScope,\n };\n}\n\n/**\n * Convert an older view config to a newer view config.\n * @param {object} config A v0.1.0 \"legacy\" view config.\n * @returns {object} A v1.0.0 \"upgraded\" view config.\n */\nexport function upgradeFrom0_1_0(config, datasetUid = null) {\n const coordinationSpace = {\n embeddingType: {},\n embeddingZoom: {},\n embeddingTargetX: {},\n embeddingTargetY: {},\n spatialZoom: {},\n spatialTargetX: {},\n spatialTargetY: {},\n };\n\n const layout = [];\n config.staticLayout.forEach((componentDef) => {\n let newComponentDef = {\n ...componentDef,\n coordinationScopes: {},\n };\n if (componentDef.component === 'scatterplot') {\n // Need to set up the coordinationSpace\n // with embeddingType to replace scatterplot\n // component prop \"mapping\".\n if (componentDef.props.mapping) {\n coordinationSpace.embeddingType[componentDef.props.mapping] = componentDef.props.mapping;\n newComponentDef = {\n ...newComponentDef,\n coordinationScopes: {\n ...newComponentDef.coordinationScopes,\n embeddingType: componentDef.props.mapping,\n },\n };\n }\n // Need to set up the coordinationSpace\n // with embeddingZoom / embeddingTargetX/Y to replace scatterplot\n // component prop \"view\" ({ zoom, target }).\n if (componentDef.props.view) {\n // Note that the below function does mutate the coordinationSpace param.\n const newScopeValues = upgradeReplaceViewProp(\n 'embedding', componentDef.props.view, coordinationSpace,\n );\n newComponentDef = {\n ...newComponentDef,\n coordinationScopes: {\n ...newComponentDef.coordinationScopes,\n ...newScopeValues,\n },\n };\n }\n }\n if (componentDef.component === 'spatial') {\n // Need to set up the coordinationSpace\n // with spatialZoom / spatialTargetX/Y to replace spatial\n // component prop \"view\" ({ zoom, target }).\n if (componentDef?.props?.view) {\n // Note that the below function does mutate the coordinationSpace param.\n const newScopeValues = upgradeReplaceViewProp(\n 'spatial', componentDef.props.view, coordinationSpace,\n );\n newComponentDef = {\n ...newComponentDef,\n coordinationScopes: {\n ...newComponentDef.coordinationScopes,\n ...newScopeValues,\n },\n };\n }\n }\n layout.push(newComponentDef);\n });\n\n // Use a random dataset ID when initializing automatically,\n // so that it changes with each new v0.1.0 view config.\n // However, check if the `datasetUid` parameter was passed,\n // which allows for unit testing.\n const newDatasetUid = datasetUid || uuidv4();\n\n return {\n version: '1.0.1',\n name: config.name,\n description: config.description,\n public: config.public,\n datasets: [\n {\n uid: newDatasetUid,\n name: newDatasetUid,\n files: config.layers.map(layer => ({\n type: layer.type.toLowerCase(),\n fileType: layer.fileType,\n url: layer.url,\n })),\n },\n ],\n initStrategy: 'auto',\n coordinationSpace,\n layout,\n };\n}\n\nexport function upgradeFrom1_0_0(config) {\n const coordinationSpace = { ...config.coordinationSpace };\n\n function replaceLayerType(layerType) {\n // Layer type could be one of a few things, bitmask or raster at the moment.\n const isRaster = layerType === 'raster';\n coordinationSpace[`spatial${capitalize(layerType)}Layer${isRaster ? 's' : ''}`] = {};\n Object.entries(coordinationSpace.spatialLayers).forEach(([scope, layers]) => {\n if (Array.isArray(layers) && layers.find(layer => layer.type === layerType)) {\n const typedLayers = layers\n .filter(layer => layer.type === layerType)\n .map((layer) => {\n const newLayer = { ...layer };\n delete newLayer.type;\n return newLayer;\n });\n coordinationSpace[`spatial${capitalize(layerType)}Layer${isRaster ? 's' : ''}`][scope] = isRaster ? typedLayers : typedLayers[0];\n } else {\n coordinationSpace[`spatial${capitalize(layerType)}Layer${isRaster ? 's' : ''}`][scope] = null;\n }\n });\n }\n\n if (coordinationSpace.spatialLayers) {\n replaceLayerType('raster');\n replaceLayerType('cells');\n replaceLayerType('molecules');\n replaceLayerType('neighborhoods');\n delete coordinationSpace.spatialLayers;\n }\n\n const layout = config.layout.map((component) => {\n const newComponent = { ...component };\n\n function replaceCoordinationScope(layerType) {\n const isRaster = layerType === 'raster';\n if (COMPONENT_COORDINATION_TYPES[newComponent.component].includes(`spatial${capitalize(layerType)}Layer${isRaster ? 's' : ''}`)) {\n newComponent.coordinationScopes[`spatial${capitalize(layerType)}Layer${isRaster ? 's' : ''}`] = newComponent.coordinationScopes.spatialLayers;\n }\n }\n\n if (newComponent.coordinationScopes && newComponent.coordinationScopes.spatialLayers) {\n replaceCoordinationScope('raster');\n replaceCoordinationScope('cells');\n replaceCoordinationScope('molecules');\n replaceCoordinationScope('neighborhoods');\n delete newComponent.coordinationScopes.spatialLayers;\n }\n return newComponent;\n });\n\n return {\n ...config,\n coordinationSpace,\n layout,\n version: '1.0.1',\n };\n}\n\n\nexport function upgradeFrom1_0_1(config) {\n // Need to add the globalDisable3d prop to any layer controller views,\n // to match the previous lack of 3D auto-detection behavior.\n\n const layout = config.layout.map((component) => {\n const newComponent = { ...component };\n if (newComponent.component === 'layerController') {\n newComponent.props = {\n ...newComponent.props,\n globalDisable3d: true,\n };\n }\n return newComponent;\n });\n\n // Enforce bitmask or raster as spatial raster layer type, defaulting\n // to raster layer if it is not one of bitmask or raster from the old config.\n\n const newConfig = cloneDeep(config);\n Object.keys((newConfig?.coordinationSpace?.spatialRasterLayers || {})).forEach((key) => {\n if (newConfig.coordinationSpace.spatialRasterLayers[key]) {\n newConfig.coordinationSpace.spatialRasterLayers[key].forEach((layer, index) => {\n newConfig.coordinationSpace.spatialRasterLayers[key][index].type = ['bitmask', 'raster'].includes(layer.type) ? layer.type : 'raster';\n });\n }\n });\n\n return {\n ...newConfig,\n layout,\n version: '1.0.2',\n };\n}\n\nexport function upgradeFrom1_0_2(config) {\n // Need to add the globalDisable3d prop to any layer controller views,\n // to match the previous lack of 3D auto-detection behavior.\n\n const layout = config.layout.map((component) => {\n const newComponent = { ...component };\n if (newComponent.component === 'layerController') {\n newComponent.props = {\n ...newComponent.props,\n disableChannelsIfRgbDetected: true,\n };\n }\n return newComponent;\n });\n\n // Enforce bitmask or raster as spatial raster layer type, defaulting\n // to raster layer if it is not one of bitmask or raster from the old config.\n\n const newConfig = cloneDeep(config);\n\n return {\n ...newConfig,\n layout,\n version: '1.0.3',\n };\n}\n\nexport function upgradeFrom1_0_3(config) {\n const newConfig = cloneDeep(config);\n\n return {\n ...newConfig,\n version: '1.0.4',\n };\n}\n\n// Added in version 1.0.5:\n// - Support for an array of strings in the setName property within options array items\n// for the anndata-cell-sets.zarr file type.\nexport function upgradeFrom1_0_4(config) {\n const newConfig = cloneDeep(config);\n\n return {\n ...newConfig,\n version: '1.0.5',\n };\n}\n\n\n// Added in version 1.0.6:\n// - Support for the scoreName property within options array items\n// for the anndata-cell-sets.zarr file type.\nexport function upgradeFrom1_0_5(config) {\n const newConfig = cloneDeep(config);\n\n return {\n ...newConfig,\n version: '1.0.6',\n };\n}\n","/* eslint-disable camelcase */\nimport Ajv from 'ajv';\nimport configSchema0_1_0 from '../schemas/config-0.1.0.schema.json';\nimport configSchema1_0_0 from '../schemas/config-1.0.0.schema.json';\nimport configSchema1_0_1 from '../schemas/config-1.0.1.schema.json';\nimport configSchema1_0_2 from '../schemas/config-1.0.2.schema.json';\nimport configSchema1_0_3 from '../schemas/config-1.0.3.schema.json';\nimport configSchema1_0_4 from '../schemas/config-1.0.4.schema.json';\nimport configSchema1_0_5 from '../schemas/config-1.0.5.schema.json';\nimport configSchema1_0_6 from '../schemas/config-1.0.6.schema.json';\nimport cellSetsSchema from '../schemas/cell-sets.schema.json';\nimport rasterSchema from '../schemas/raster.schema.json';\nimport {\n upgradeFrom0_1_0,\n upgradeFrom1_0_0,\n upgradeFrom1_0_1,\n upgradeFrom1_0_2,\n upgradeFrom1_0_3,\n upgradeFrom1_0_4,\n upgradeFrom1_0_5,\n} from './view-config-upgraders';\n\n/**\n * Mapping from view config versions to view config schemas and upgrade functions.\n * Add a new schema and upgrade function here when bumping the view config version.\n * The latest view config version should always have a null value instead of an upgrade function.\n */\nexport const LATEST_VERSION = '1.0.6';\nexport const SCHEMA_HANDLERS = {\n '0.1.0': [new Ajv().compile(configSchema0_1_0), upgradeFrom0_1_0],\n '1.0.0': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_0), upgradeFrom1_0_0],\n '1.0.1': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_1), upgradeFrom1_0_1],\n '1.0.2': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_2), upgradeFrom1_0_2],\n '1.0.3': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_3), upgradeFrom1_0_3],\n '1.0.4': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_4), upgradeFrom1_0_4],\n '1.0.5': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_5), upgradeFrom1_0_5],\n '1.0.6': [new Ajv().addSchema(cellSetsSchema).addSchema(rasterSchema).compile(configSchema1_0_6), null],\n};\n","import { useEffect } from 'react';\nimport { SCHEMA_HANDLERS, LATEST_VERSION } from './view-config-versions';\nimport { useViewConfigStoreApi, useLoaders, useWarning } from './state/hooks';\n\nfunction validateViewConfig(viewConfig) {\n // Need the try-catch here since Zustand will actually\n // just catch and ignore errors in its subscription callbacks.\n try {\n const validate = SCHEMA_HANDLERS[LATEST_VERSION][0];\n const valid = validate(viewConfig);\n if (!valid) {\n const failureReason = JSON.stringify(validate.errors, null, 2);\n throw new Error(`Config validation failed: ${failureReason}`);\n }\n } catch (e) {\n console.error(e);\n }\n // Do nothing if successful.\n}\n\n/**\n * This is a dummy component which handles\n * publishing new view configs and loaders to\n * the provided callbacks on changes.\n * @param {object} props\n * @param {function} props.onConfigChange A callback function\n * to execute on each change of the Vitessce view config.\n * @param {function} props.onLoaderChange A callback function\n * to execute on each change of the loaders object.\n * @param {boolean} props.validateOnConfigChange Whether to validate\n * against the view config schema when publishing changes.\n */\nexport default function CallbackPublisher(props) {\n const {\n onWarn,\n onConfigChange,\n onLoaderChange,\n validateOnConfigChange,\n } = props;\n\n const warning = useWarning();\n const loaders = useLoaders();\n\n const viewConfigStoreApi = useViewConfigStoreApi();\n\n // View config updates are often-occurring, so\n // we want to use the \"transient update\" approach\n // to subscribe to view config changes.\n // Reference: https://github.com/react-spring/zustand#transient-updates-for-often-occuring-state-changes\n useEffect(() => viewConfigStoreApi.subscribe(\n // The function to run on each publish.\n (viewConfig) => {\n if (validateOnConfigChange && viewConfig) {\n validateViewConfig(viewConfig);\n }\n if (onConfigChange && viewConfig) {\n onConfigChange(viewConfig);\n }\n },\n // The function to specify which part of the store\n // we want to subscribe to.\n state => state.viewConfig,\n ), [onConfigChange, validateOnConfigChange, viewConfigStoreApi]);\n\n // Emit updates to the warning message.\n useEffect(() => {\n if (onWarn && warning) {\n onWarn(warning);\n }\n }, [warning, onWarn]);\n\n // Emit updates to the loaders.\n useEffect(() => {\n if (onLoaderChange && loaders) {\n onLoaderChange(loaders);\n }\n }, [loaders, onLoaderChange]);\n\n // Render nothing.\n return null;\n}\n","import { useState, useEffect } from 'react';\nimport equal from 'fast-deep-equal';\nimport { capitalize } from '../utils';\nimport { useSetWarning } from '../app/state/hooks';\nimport {\n AbstractLoaderError,\n LoaderNotFoundError,\n} from '../loaders/errors/index';\nimport {\n DEFAULT_MOLECULES_LAYER,\n DEFAULT_CELLS_LAYER,\n DEFAULT_NEIGHBORHOODS_LAYER,\n} from './spatial/constants';\nimport { DEFAULT_COORDINATION_VALUES } from '../app/state/coordination';\n\n/**\n * Warn via publishing to the console\n * and to the global warning store.\n * @param {AbstractLoaderError} error An error instance.\n */\nfunction warn(error, setWarning) {\n setWarning(error.message);\n console.warn(error.message);\n if (error instanceof AbstractLoaderError) {\n error.warnInConsole();\n }\n}\n\n/**\n * Initialize values in the coordination space.\n * @param {object} values Object where\n * keys are coordination type names,\n * values are initial coordination values.\n * @param {object} setters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialValues Object where\n * keys are coordination type names and keys are values.\n */\nfunction initCoordinationSpace(values, setters, initialValues) {\n if (!values || !setters) {\n return;\n }\n Object.entries(values).forEach(([coordinationType, value]) => {\n const setterName = `set${capitalize(coordinationType)}`;\n const setterFunc = setters[setterName];\n const initialValue = initialValues && initialValues[coordinationType];\n const shouldInit = equal(initialValue, DEFAULT_COORDINATION_VALUES[coordinationType]);\n if (shouldInit && setterFunc) {\n setterFunc(value);\n }\n });\n}\n\n/**\n * Get the dataset description string.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @returns {array} [description] where\n * description is a string.\n */\nexport function useDescription(loaders, dataset) {\n const [description, setDescription] = useState();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].description) {\n setDescription(loaders[dataset].description);\n } else {\n setDescription(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [description];\n}\n\n/**\n * Get data from a cells data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [cells, cellsCount] where\n * cells is an object and cellsCount is the\n * number of items in the cells object.\n */\nexport function useCellsData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [cells, setCells] = useState({});\n const [cellsCount, setCellsCount] = useState(0);\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders.cells) {\n loaders[dataset].loaders.cells.load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n setCells(data);\n setCellsCount(Object.keys(data).length);\n addUrl(url, 'Cells');\n // This dataset has cells, so set up the\n // spatial cells layer coordination value\n // using the cell layer singleton.\n const coordinationValuesOrDefault = {\n spatialCellsLayer: DEFAULT_CELLS_LAYER,\n ...coordinationValues,\n };\n initCoordinationSpace(\n coordinationValuesOrDefault,\n coordinationSetters, initialCoordinationValues,\n );\n setItemIsReady('cells');\n });\n } else {\n setCells({});\n setCellsCount(0);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'cells', null, null), setWarning);\n } else {\n setItemIsReady('cells');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [cells, cellsCount];\n}\n\n/**\n * Get data from a cell sets data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names and values are the current values.\n * @returns {array} [cellSets] where\n * cellSets is a sets tree object.\n */\nexport function useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [cellSets, setCellSets] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders['cell-sets']) {\n // Load the data initially.\n loaders[dataset].loaders['cell-sets'].load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n setCellSets(data);\n addUrl(url, 'Cell Sets');\n initCoordinationSpace(\n coordinationValues,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('cell-sets');\n });\n } else {\n setCellSets(null);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'cell-sets', null, null), setWarning);\n } else {\n setItemIsReady('cell-sets');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [cellSets];\n}\n\n/**\n * Get (potentially filtered) data from an expression matrix data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates. Should not be used in conjunction (called in the same component)\n * with useExpressionAttrs as this returns a potentially filtered set of attributes\n * specifically for the returned expression data.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [expressionMatrix] where\n * expressionMatrix is an object with\n * shape { cols, rows, matrix }.\n */\nexport function useExpressionMatrixData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [expressionMatrix, setExpressionMatrix] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders['expression-matrix']) {\n loaders[dataset].loaders['expression-matrix'].load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n const [attrs, arr] = data;\n setExpressionMatrix({\n cols: attrs.cols,\n rows: attrs.rows,\n matrix: arr.data,\n });\n addUrl(url, 'Expression Matrix');\n initCoordinationSpace(\n coordinationValues,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('expression-matrix');\n });\n } else {\n setExpressionMatrix(null);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'expression-matrix', null, null), setWarning);\n } else {\n setItemIsReady('expression-matrix');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [expressionMatrix];\n}\n\n/**\n * Get data from the expression matrix data type loader for a given gene selection.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {boolean} selection A list of gene names to get expression data for.\n * @returns {array} [geneData] where geneData is an array [Uint8Array, ..., Uint8Array]\n * for however many genes are in the selection.\n */\nexport function useGeneSelection(\n loaders,\n dataset,\n setItemIsReady,\n isRequired,\n selection,\n setItemIsNotReady,\n) {\n const [geneData, setGeneData] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n if (!selection) {\n setItemIsReady('expression-matrix');\n return;\n }\n const loader = loaders[dataset].loaders['expression-matrix'];\n if (loader) {\n setItemIsNotReady('expression-matrix');\n const implementsGeneSelection = typeof loader.loadGeneSelection === 'function';\n if (implementsGeneSelection) {\n loaders[dataset].loaders['expression-matrix']\n .loadGeneSelection({ selection })\n .catch(e => warn(e, setWarning))\n .then((payload) => {\n if (!payload) return;\n const { data } = payload;\n setGeneData(data);\n setItemIsReady('expression-matrix');\n });\n } else {\n loader.load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data } = payload;\n const [attrs, { data: matrix }] = data;\n const expressionDataForSelection = selection.map((sel) => {\n const geneIndex = attrs.cols.indexOf(sel);\n const numGenes = attrs.cols.length;\n const numCells = attrs.rows.length;\n const expressionData = new Uint8Array(numCells);\n for (let cellIndex = 0; cellIndex < numCells; cellIndex += 1) {\n expressionData[cellIndex] = matrix[cellIndex * numGenes + geneIndex];\n }\n return expressionData;\n });\n setGeneData(expressionDataForSelection);\n setItemIsReady('expression-matrix');\n });\n }\n } else {\n setGeneData(null);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'expression-matrix', null, null), setWarning);\n } else {\n setItemIsReady('expression-matrix');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset, selection]);\n\n return [geneData];\n}\n\n/**\n * Get the attributes for the expression matrix data type loader,\n * i.e names of cells and genes.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates. Should not be used in conjunction (called in the same component)\n * with useExpressionMatrixData.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @returns {object} [attrs] { rows, cols } object containing cell and gene names.\n */\nexport function useExpressionAttrs(loaders, dataset, setItemIsReady, addUrl, isRequired) {\n const [attrs, setAttrs] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n const loader = loaders[dataset].loaders['expression-matrix'];\n if (loader) {\n const implementsLoadAttrs = typeof loader.loadAttrs === 'function';\n if (implementsLoadAttrs) {\n loader.loadAttrs().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url } = payload;\n setAttrs(data);\n addUrl(url, 'Expression Matrix');\n setItemIsReady('expression-matrix');\n });\n } else {\n loader.load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url } = payload;\n setAttrs(data[0]);\n addUrl(url, 'Expression Matrix');\n setItemIsReady('expression-matrix');\n });\n }\n } else {\n setAttrs(null);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'expression-matrix', null, null), setWarning);\n } else {\n setItemIsReady('expression-matrix');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [attrs];\n}\n\n/**\n * Get data from a molecules data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [molecules, moleculesCount, locationsCount] where\n * molecules is an object,\n * moleculesCount is the number of unique molecule types, and\n * locationsCount is the number of molecules.\n */\nexport function useMoleculesData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [molecules, setMolecules] = useState();\n const [moleculesCount, setMoleculesCount] = useState(0);\n const [locationsCount, setLocationsCount] = useState(0);\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders.molecules) {\n loaders[dataset].loaders.molecules.load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n setMolecules(data);\n setMoleculesCount(Object.keys(data).length);\n setLocationsCount(Object.values(data)\n .map(l => l.length)\n .reduce((a, b) => a + b, 0));\n addUrl(url, 'Molecules');\n const coordinationValuesOrDefault = {\n spatialMoleculesLayer: DEFAULT_MOLECULES_LAYER,\n ...coordinationValues,\n };\n initCoordinationSpace(\n coordinationValuesOrDefault,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('molecules');\n });\n } else {\n setMolecules({});\n setMoleculesCount(0);\n setLocationsCount(0);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'molecules', null, null), setWarning);\n } else {\n setItemIsReady('molecules');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [molecules, moleculesCount, locationsCount];\n}\n\n/**\n * Get data from a neighborhoods data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [neighborhoods] where\n * neighborhoods is an object.\n */\nexport function useNeighborhoodsData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [neighborhoods, setNeighborhoods] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders.neighborhoods) {\n loaders[dataset].loaders.neighborhoods.load().catch(e => warn(e, setWarning))\n .then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n setNeighborhoods(data);\n addUrl(url, 'Neighborhoods');\n const coordinationValuesOrDefault = {\n spatialNeighborhoodsLayer: DEFAULT_NEIGHBORHOODS_LAYER,\n ...coordinationValues,\n };\n initCoordinationSpace(\n coordinationValuesOrDefault,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('neighborhoods');\n });\n } else {\n setNeighborhoods({});\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'neighborhoods', null, null), setWarning);\n } else {\n setItemIsReady('neighborhoods');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [neighborhoods];\n}\n\n/**\n * Get data from a raster data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [raster, imageLayerLoaders, imageLayerMeta] where\n * raster is an object,\n * imageLayerLoaders is an object, and\n * imageLayerMeta is an object.\n */\nexport function useRasterData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [raster, setRaster] = useState();\n // Since we want the image layer / channel definitions to come from the\n // coordination space stored as JSON in the view config,\n // we need to set up a separate state variable here to store the\n // non-JSON objects, such as layer loader instances.\n const [imageLayerLoaders, setImageLayerLoaders] = useState([]);\n const [imageLayerMeta, setImageLayerMeta] = useState([]);\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders.raster) {\n loaders[dataset].loaders.raster.load().catch(e => warn(e, setWarning)).then((payload) => {\n if (!payload) return;\n const { data, url: urls, coordinationValues } = payload;\n setRaster(data);\n urls.forEach(([url, name]) => {\n addUrl(url, name);\n });\n const { loaders: nextImageLoaders, meta: nextImageMeta } = data;\n setImageLayerLoaders(nextImageLoaders);\n setImageLayerMeta(nextImageMeta);\n initCoordinationSpace(\n coordinationValues,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('raster');\n });\n } else {\n // There was no raster loader for this dataset,\n // and raster should be optional.\n setImageLayerLoaders([]);\n setImageLayerMeta([]);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'raster', null, null), setWarning);\n } else {\n setItemIsReady('raster');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n return [raster, imageLayerLoaders, imageLayerMeta];\n}\n\n/**\n * Get data from a genomic-profiles data type loader,\n * updating \"ready\" and URL state appropriately.\n * Throw warnings if the data is marked as required.\n * Subscribe to loader updates.\n * @param {object} loaders The object mapping\n * datasets and data types to loader instances.\n * @param {string} dataset The key for a dataset,\n * used to identify which loader to use.\n * @param {function} setItemIsReady A function to call\n * when done loading.\n * @param {function} addUrl A function to call to update\n * the URL list.\n * @param {boolean} isRequired Should a warning be thrown if\n * loading is unsuccessful?\n * @param {object} coordinationSetters Object where\n * keys are coordination type names with the prefix 'set',\n * values are coordination setter functions.\n * @param {object} initialCoordinationValues Object where\n * keys are coordination type names with the prefix 'initialize',\n * values are initialization preferences as boolean values.\n * @returns {array} [neighborhoods] where\n * neighborhoods is an object.\n */\nexport function useGenomicProfilesData(\n loaders, dataset, setItemIsReady, addUrl, isRequired,\n coordinationSetters, initialCoordinationValues,\n) {\n const [genomicProfilesAttrs, setGenomicProfilesAttrs] = useState();\n\n const setWarning = useSetWarning();\n\n useEffect(() => {\n if (!loaders[dataset]) {\n return;\n }\n\n if (loaders[dataset].loaders['genomic-profiles']) {\n loaders[dataset].loaders['genomic-profiles'].load().catch(e => warn(e, setWarning))\n .then((payload) => {\n if (!payload) return;\n const { data, url, coordinationValues } = payload;\n setGenomicProfilesAttrs(data);\n addUrl(url);\n initCoordinationSpace(\n coordinationValues,\n coordinationSetters,\n initialCoordinationValues,\n );\n setItemIsReady('genomic-profiles');\n });\n } else {\n setGenomicProfilesAttrs(null);\n if (isRequired) {\n warn(new LoaderNotFoundError(dataset, 'genomic-profiles', null, null), setWarning);\n } else {\n setItemIsReady('genomic-profiles');\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return [genomicProfilesAttrs];\n}\n","import React from 'react';\nimport CircularProgress from '@material-ui/core/CircularProgress';\n\nexport default function LoadingIndicator() {\n return (\n <div className=\"loading-indicator-backdrop\">\n <div className=\"loading-indicator-container\">\n <CircularProgress />\n </div>\n </div>\n );\n}\n","import React, { useRef } from 'react';\nimport Paper from '@material-ui/core/Paper';\nimport Popper from '@material-ui/core/Popper';\nimport IconButton from '@material-ui/core/IconButton';\nimport MenuList from '@material-ui/core/MenuList';\nimport ClickAwayListener from '@material-ui/core/ClickAwayListener';\nimport Fade from '@material-ui/core/Fade';\nimport { useVitessceContainer } from '../hooks';\nimport { styles } from './styles';\n\nexport function MuiSpan(props) {\n const { children } = props;\n const classes = styles();\n return <span className={classes.span}>{children}</span>;\n}\n\nexport function PopperMenu(props) {\n const {\n buttonIcon,\n open,\n setOpen,\n children,\n buttonClassName,\n placement = 'bottom-end',\n } = props;\n const classes = styles();\n\n const anchorRef = useRef();\n\n const handleClick = () => {\n setOpen(prev => !prev);\n };\n\n const handleClose = () => {\n setOpen(false);\n };\n\n const id = open ? 'v-popover-menu' : undefined;\n\n const getTooltipContainer = useVitessceContainer(anchorRef);\n\n return (\n <div ref={anchorRef} className={classes.container}>\n <IconButton\n aria-describedby={id}\n onClick={handleClick}\n size=\"small\"\n className={buttonClassName}\n >\n {buttonIcon}\n </IconButton>\n <Popper\n id={id}\n open={open}\n anchorEl={anchorRef && anchorRef.current}\n container={getTooltipContainer}\n onClose={handleClose}\n placement={placement}\n transition\n >\n {({ TransitionProps }) => (\n <ClickAwayListener onClickAway={handleClose}>\n <Fade {...TransitionProps} timeout={100}>\n <Paper elevation={4} className={classes.paper}>\n <MenuList>{children}</MenuList>\n </Paper>\n </Fade>\n </ClickAwayListener>\n )}\n </Popper>\n </div>\n );\n}\n","import React, { useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloudDownloadIcon from '@material-ui/icons/CloudDownload';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport IconButton from '@material-ui/core/IconButton';\nimport Link from '@material-ui/core/Link';\nimport ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';\nimport ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport CloseIcon from '@material-ui/icons/Close';\n\nimport { SCROLL_CARD, BLACK_CARD, SECONDARY_CARD } from './classNames';\nimport LoadingIndicator from './LoadingIndicator';\nimport { PopperMenu } from './shared-mui/components';\n\nconst useStyles = makeStyles(theme => ({\n iconButton: {\n border: 'none',\n marginLeft: 0,\n background: 'none',\n color: theme.palette.primaryForeground,\n paddingLeft: '0.25em',\n paddingRight: '0.25em',\n borderRadius: '2px',\n '&:hover': {\n backgroundColor: theme.palette.primaryBackgroundLight,\n },\n '&:first-child': {\n marginLeft: '0.25em',\n },\n '&:last-child': {\n marginRight: '0.25em',\n },\n '& svg': {\n width: '0.7em',\n height: '0.7em',\n verticalAlign: 'middle',\n overflow: 'visible',\n },\n },\n downloadLink: {\n color: theme.palette.primaryForeground,\n },\n}));\n\nfunction SettingsIconWithArrow({ open }) {\n return (\n <>\n <SettingsIcon />\n {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}\n </>\n );\n}\n\nfunction PlotOptions(props) {\n const { options } = props;\n const [open, setOpen] = useState(false);\n const classes = useStyles();\n return (\n <PopperMenu\n open={open}\n setOpen={setOpen}\n buttonIcon={<SettingsIconWithArrow open={open} />}\n buttonClassName={classes.iconButton}\n placement=\"bottom-end\"\n >\n {options}\n </PopperMenu>\n );\n}\n\nfunction CloudDownloadIconWithArrow({ open }) {\n return (\n <>\n <CloudDownloadIcon />\n {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}\n </>\n );\n}\n\nfunction DownloadOptions(props) {\n const { urls } = props;\n const [open, setOpen] = useState(false);\n const classes = useStyles();\n return (\n <PopperMenu\n open={open}\n setOpen={setOpen}\n buttonIcon={<CloudDownloadIconWithArrow open={open} />}\n buttonClassName={classes.iconButton}\n placement=\"bottom-end\"\n >\n {urls.map(({ url, name }) => (\n <MenuItem dense key={url}>\n <Link underline=\"none\" href={url} target=\"_blank\" rel=\"noopener\" className={classes.downloadLink}>\n Download {name}\n </Link>\n </MenuItem>\n ))}\n </PopperMenu>\n );\n}\n\nfunction ClosePaneButton(props) {\n const { removeGridComponent } = props;\n const classes = useStyles();\n return (\n <IconButton\n onClick={removeGridComponent}\n size=\"small\"\n className={classes.iconButton}\n title=\"close\"\n >\n <CloseIcon />\n </IconButton>\n );\n}\n\nexport default function TitleInfo(props) {\n const {\n title, info, children, isScroll, isSpatial, removeGridComponent, urls,\n isReady, options,\n } = props;\n // eslint-disable-next-line no-nested-ternary\n const childClassName = isScroll ? SCROLL_CARD : (isSpatial ? BLACK_CARD : SECONDARY_CARD);\n return (\n // d-flex without wrapping div is not always full height; I don't understand the root cause.\n <>\n <div className=\"title\">\n <div className=\"title-left\">\n {title}\n </div>\n <div className=\"title-info\" title={info}>\n {info}\n </div>\n <div className=\"title-buttons\">\n { options && (\n <PlotOptions\n options={options}\n />\n ) }\n {urls && urls.length > 0 && (\n <DownloadOptions\n urls={urls}\n />\n )}\n <ClosePaneButton\n removeGridComponent={removeGridComponent}\n />\n </div>\n </div>\n <div className={childClassName}>\n { !isReady && <LoadingIndicator /> }\n {children}\n </div>\n </>\n // \"pl-2\" only matters when the window is very narrow.\n );\n}\n","import React from 'react';\n\nexport default function Description(props) {\n const { description, metadata } = props;\n\n return (\n <div className=\"description\">\n <p>{description}</p>\n\n {metadata && Array.from(metadata.entries())\n .map(([layerIndex, { name: layerName, metadata: metadataRecord }]) => (\n metadataRecord && Object.entries(metadataRecord).length > 0 ? (\n <details key={layerIndex}>\n <summary>{layerName}</summary>\n <div className=\"metadata-container\">\n <table>\n <tbody>\n {Object.entries(metadataRecord)\n .map(([key, value]) => (\n <tr key={key}>\n <th title={key}>{key}</th>\n <td title={value}>{value}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </details>\n ) : null))}\n </div>\n );\n}\n","import React, { useEffect, useMemo } from 'react';\nimport { useReady } from '../hooks';\nimport { useDescription, useRasterData } from '../data-hooks';\nimport { useCoordination, useLoaders } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport TitleInfo from '../TitleInfo';\nimport Description from './Description';\n\nconst DESCRIPTION_DATA_TYPES = ['raster'];\n\n/**\n * A subscriber component for a text description component.\n * Also renders a table containing image metadata.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n */\nexport default function DescriptionSubscriber(props) {\n const {\n coordinationScopes,\n description: descriptionOverride,\n removeGridComponent,\n theme,\n title = 'Data Set',\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n spatialRasterLayers: rasterLayers,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.description, coordinationScopes);\n\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n DESCRIPTION_DATA_TYPES,\n );\n\n // Reset loader progress when the dataset has changed.\n useEffect(() => {\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [description] = useDescription(loaders, dataset);\n const [raster, imageLayerLoaders, imageLayerMeta] = useRasterData(\n loaders, dataset, setItemIsReady, () => {}, false,\n );\n\n const metadata = useMemo(() => {\n const result = new Map();\n if (rasterLayers && rasterLayers.length > 0 && raster && imageLayerMeta && imageLayerLoaders) {\n rasterLayers.forEach((layer) => {\n if (imageLayerMeta[layer.index]) {\n // Want to ensure that layer index is a string.\n const { format } = imageLayerLoaders[layer.index].metadata;\n result.set(`${layer.index}`, {\n name: raster.meta[layer.index].name,\n metadata: format && format(),\n });\n }\n });\n }\n return result;\n }, [raster, rasterLayers, imageLayerMeta, imageLayerLoaders]);\n\n return (\n <TitleInfo\n title={title}\n removeGridComponent={removeGridComponent}\n isScroll\n theme={theme}\n isReady={isReady}\n >\n <Description\n description={descriptionOverride || description}\n metadata={metadata}\n />\n </TitleInfo>\n );\n}\n","import React from 'react';\n\nexport default function Status(props) {\n const warnClass = 'alert alert-warning my-0 details';\n const { info, warn } = props;\n const messages = [];\n if (info) {\n messages.push(<p className=\"details\" key=\"info\">{info}</p>);\n }\n if (warn) {\n messages.push(<p className={warnClass} key=\"warn\">{warn}</p>);\n }\n return (\n messages\n );\n}\n","/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport React, { useEffect, useCallback, useState } from 'react';\nimport { Table, AutoSizer } from 'react-virtualized';\nimport uuidv4 from 'uuid/v4';\nimport union from 'lodash/union';\nimport difference from 'lodash/difference';\nimport isEqual from 'lodash/isEqual';\n\n/**\n * A table with \"selectable\" rows.\n * @prop {string[]} columns An array of column names, corresponding to data object properties.\n * @prop {object[]} data An array of data objects used to populate table rows.\n * @prop {function} onChange Callback function,\n * passed a selection object when `allowMultiple` is false (and `null` if `allowUncheck` is true),\n * or passed an array of selection objects when `allowMultiple` is true.\n * @prop {string} idKey The key for a unique identifier property of `data` objects.\n * @prop {string} valueKey If initially-selected rows are required,\n * this key specifies a boolean property of the `data` objects\n * indicating those rows that should be initially selected.\n * @prop {boolean} allowMultiple Whether to allow multiple rows to be selected. By default, false.\n * @prop {boolean} allowUncheck Whether to allow selected rows to be un-checked. By default, false.\n * @prop {boolean} showTableHead Whether to show the table header element. By default, true.\n * @prop {boolean} showTableInputs Whether to show the table input elements for each row.\n * By default, false.\n */\nexport default function SelectableTable(props) {\n const {\n hasColorEncoding,\n columns,\n data,\n onChange,\n idKey = 'id',\n valueKey = 'value',\n allowMultiple = false,\n allowUncheck = false,\n showTableHead = true,\n showTableInputs = false,\n testHeight = undefined,\n testWidth = undefined,\n } = props;\n\n const [selectedRows, setSelectedRows] = useState(null);\n\n // Callback function to update the `selectedRows` state.\n const onSelectRow = useCallback((value, checked) => {\n if (checked || allowUncheck) {\n if (!allowMultiple) {\n setSelectedRows(checked ? [value] : []);\n } else {\n setSelectedRows(\n checked\n ? union(selectedRows || [], [value])\n : difference(selectedRows || [], [value]),\n );\n }\n }\n }, [allowMultiple, allowUncheck, selectedRows]);\n\n // Handler for checkbox input elements.\n const handleInputChange = useCallback((event) => {\n const { target } = event;\n const { checked } = target;\n const { value } = target;\n onSelectRow(value, checked);\n }, [onSelectRow]);\n\n // Function to map row IDs to corresponding objects\n // to pass to the `onChange` callback.\n const getDataFromIds = useCallback(ids => ids.map(id => ({\n [idKey]: id,\n data: data.find(item => item[idKey] === id),\n })), [data, idKey]);\n\n // Function to check if a row ID has been selected.\n const isSelected = useCallback(id => (\n Array.isArray(selectedRows) && selectedRows.includes(id)\n ), [selectedRows]);\n\n /* eslint-disable react-hooks/exhaustive-deps */\n useEffect(() => {\n // Check whether an initial set of rows should be selected.\n const initialSelectedRows = data\n .map((d) => {\n if (d[valueKey]) {\n return d[idKey];\n }\n return null;\n })\n .filter(Boolean);\n if (!isEqual(initialSelectedRows, selectedRows)) {\n if (initialSelectedRows.length > 0) {\n setSelectedRows(initialSelectedRows);\n } else {\n setSelectedRows(null);\n }\n }\n }, [data, idKey, valueKey]);\n\n /* eslint-disable react-hooks/exhaustive-deps */\n useEffect(() => {\n // Call the `onChange` prop function with an updated row or set of rows.\n if (!onChange || !selectedRows) {\n return;\n }\n const selectedRowData = getDataFromIds(selectedRows);\n if (allowMultiple) {\n onChange(selectedRowData);\n } else if (selectedRows.length === 1) {\n onChange(selectedRowData[0]);\n } else if (selectedRows.length === 0) {\n onChange(null);\n }\n }, [selectedRows]);\n\n // Generate a unique ID to use in (for, id) label-input pairs.\n const inputUuid = uuidv4();\n\n // Class for first column of inputs, to hide them if desired.\n const hiddenInputsClass = (showTableInputs ? '' : 'hidden-input-column');\n\n const rowRenderer = ({ index, style }) => (\n // eslint-disable-next-line jsx-a11y/interactive-supports-focus\n <div\n key={data[index][idKey]}\n className={`table-item table-row ${isSelected(data[index][idKey]) ? 'row-checked ' : ''}`}\n style={style}\n role=\"button\"\n onClick={() => onSelectRow(\n data[index][idKey],\n !isSelected(data[index][idKey]) || !hasColorEncoding,\n )}\n >\n <div className={`input-container ${hiddenInputsClass} table-cell`}>\n <label htmlFor={`${inputUuid}_${data[index][idKey]}`}>\n <input\n id={`${inputUuid}_${data[index][idKey]}`}\n type=\"checkbox\"\n className={(allowMultiple ? 'checkbox' : 'radio')}\n name={inputUuid}\n value={data[index][idKey]}\n onChange={handleInputChange}\n checked={isSelected(data[index][idKey])}\n />\n </label>\n </div>\n {columns.map(column => (\n <div\n className=\"table-cell\"\n key={column}\n >\n {data[index][column]}\n </div>\n ))}\n </div>\n );\n\n const headerRowRenderer = ({ style }) => (\n <div className={`${hiddenInputsClass} table-row`} style={style}>\n {columns.map(column => (\n <div key={column}>{column}</div>\n ))}\n </div>\n );\n\n return (\n <div className=\"selectable-table\">\n <AutoSizer>\n {({ width, height }) => (\n <Table\n height={testHeight || height}\n gridStyle={{ outline: 'none' }}\n rowCount={data.length}\n // 24 is 1 em + padding in either direction (see _selectable_table.scss).\n rowHeight={24}\n headerHeight={showTableHead ? 24 : undefined}\n rowRenderer={rowRenderer}\n width={testWidth || width}\n headerRowRenderer={showTableHead ? headerRowRenderer : undefined}\n rowGetter={({ index }) => data[index]}\n />\n )}\n </AutoSizer>\n </div>\n );\n}\n","import React, { useEffect, useState } from 'react';\nimport { SelectableTable } from '../selectable-table/index';\n\nexport default function Genes(props) {\n const {\n hasColorEncoding,\n geneList = [],\n geneSelection = [],\n geneFilter = null,\n setGeneSelection,\n } = props;\n\n const [searchTerm, setSearchTerm] = useState('');\n const [searchResults, setSearchResults] = useState(geneList);\n\n useEffect(() => {\n const results = geneList\n .filter(gene => gene.toLowerCase().includes(searchTerm.toLowerCase()));\n setSearchResults(results);\n }, [searchTerm, geneList]);\n\n function onChange(selection) {\n if (setGeneSelection && selection && selection.name) {\n setGeneSelection([selection.name]);\n }\n }\n\n const data = searchResults\n .filter(gene => (geneFilter ? geneFilter.includes(gene) : true))\n .sort((a, b) => a.localeCompare(b))\n .map(\n gene => ({ name: gene, value: (geneSelection ? geneSelection.includes(gene) : false) }),\n );\n\n const handleChange = (event) => {\n setSearchTerm(event.target.value);\n };\n\n return (\n <>\n <input\n className=\"search-bar\"\n type=\"text\"\n placeholder=\"Search\"\n value={searchTerm}\n onChange={handleChange}\n />\n <SelectableTable\n columns={['name']}\n data={data}\n hasColorEncoding={hasColorEncoding}\n idKey=\"name\"\n valueKey=\"value\"\n onChange={onChange}\n allowUncheck={false}\n showTableHead={false}\n />\n </>\n );\n}\n","import React, { useEffect } from 'react';\nimport { pluralize } from '../../utils';\nimport { useReady, useUrls } from '../hooks';\nimport { useExpressionAttrs } from '../data-hooks';\nimport { useCoordination, useLoaders } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\n\nimport TitleInfo from '../TitleInfo';\nimport Genes from './Genes';\n\nconst GENES_DATA_TYPES = ['expression-matrix'];\n\n/**\n * A subscriber component for a gene listing component.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n * @param {string} props.variablesLabelOverride The singular form\n * of the name of the variable.\n * @param {string} props.variablesPluralLabelOverride The plural\n * form of the name of the variable.\n */\nexport default function GenesSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n variablesLabelOverride: variablesLabel = 'gene',\n variablesPluralLabelOverride: variablesPluralLabel = `${variablesLabel}s`,\n theme,\n title = 'Expression Levels',\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n geneSelection,\n geneFilter,\n cellColorEncoding,\n }, {\n setGeneSelection,\n setGeneFilter,\n setGeneHighlight,\n setCellColorEncoding,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.genes, coordinationScopes);\n\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n GENES_DATA_TYPES,\n );\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [attrs] = useExpressionAttrs(\n loaders, dataset, setItemIsReady, addUrl, true,\n );\n const geneList = attrs ? attrs.cols : [];\n const numGenes = geneList.length;\n\n function setGeneSelectionAndColorEncoding(newSelection) {\n setGeneSelection(newSelection);\n setCellColorEncoding('geneSelection');\n }\n\n return (\n <TitleInfo\n title={title}\n info={`${numGenes} ${pluralize(variablesLabel, variablesPluralLabel, numGenes)}`}\n theme={theme}\n // Virtual scroll is used but this allows for the same styling as a scroll component\n // even though this no longer uses the TitleInfo component's\n // scroll css (SelectableTable is virtual scroll).\n isScroll\n removeGridComponent={removeGridComponent}\n isReady={isReady}\n urls={urls}\n >\n <Genes\n hasColorEncoding={cellColorEncoding === 'geneSelection'}\n geneList={geneList}\n geneSelection={geneSelection}\n geneFilter={geneFilter}\n setGeneSelection={setGeneSelectionAndColorEncoding}\n setGeneFilter={setGeneFilter}\n setGeneHighlight={setGeneHighlight}\n />\n </TitleInfo>\n );\n}\n","import React from 'react';\nimport RcTree from 'rc-tree';\nimport classNames from 'classnames';\n\n/**\n * A helper component around the rc-tree\n * library's tree component, to set\n * default props.\n */\nconst Tree = React.forwardRef((props, ref) => {\n const {\n prefixCls,\n className,\n showIcon,\n blockNode,\n children,\n checkable,\n } = props;\n return (\n <RcTree\n itemHeight={32}\n ref={ref}\n {...props}\n className={classNames(className, {\n [`${prefixCls}-icon-hide`]: !showIcon,\n [`${prefixCls}-block-node`]: blockNode,\n })}\n checkable={checkable ? <span className={`${prefixCls}-checkbox-inner`} /> : checkable}\n >\n {children}\n </RcTree>\n );\n});\n\nTree.defaultProps = {\n virtual: false,\n checkable: false,\n showIcon: false,\n blockNode: true,\n prefixCls: 'rc-tree',\n};\n\nexport default Tree;\n","import React, { useRef } from 'react';\nimport RcTooltip from 'rc-tooltip';\nimport { useVitessceContainer } from '../hooks';\n\n/**\n * This is a small wrapper around the Tooltip component from the rc-tooltip library,\n * which is required to be able to apply theme styles to the tooltip.\n * The default `getTooltipContainer` function used by rc-tooltip\n * just returns `document.body` (see https://github.com/react-component/tooltip#props),\n * We want theme styles to be applied relative to the closest `.vitessce-container`\n * ancestor element.\n * https://github.com/vitessce/vitessce/pull/494#discussion_r395957914\n * @param {object} props Props are passed through to the <RcTooltip/> from the library.\n */\nexport default function HelpTooltip(props) {\n const { title, content, overlayClassName } = props;\n const spanRef = useRef();\n const getTooltipContainer = useVitessceContainer(spanRef);\n\n const overlay = title || content;\n\n return (\n <>\n <span ref={spanRef} />\n <RcTooltip\n getTooltipContainer={getTooltipContainer}\n overlayClassName={overlayClassName}\n overlay={overlay}\n {...props}\n />\n </>\n );\n}\n\nHelpTooltip.defaultProps = {\n overlayClassName: 'help-tooltip',\n placement: 'top',\n trigger: 'hover',\n mouseEnterDelay: 0.2,\n mouseLeaveDelay: 0,\n};\n","import React from 'react';\nimport HelpTooltip from './HelpTooltip';\n\n/**\n * This is a wrapper around the HelpTooltip component, to style it as a popover,\n * and change the trigger to \"click\" rather than \"hover\".\n * @param {*} props Props are passed through to the HelpTooltip component.\n */\nexport default function Popover(props) {\n return (\n <HelpTooltip {...props} />\n );\n}\n\nPopover.defaultProps = {\n overlayClassName: 'popover',\n placement: 'top',\n trigger: 'click',\n mouseEnterDelay: 0,\n mouseLeaveDelay: 0,\n};\n","import React, { useState, useEffect } from 'react';\nimport { TwitterPicker } from 'react-color';\nimport { colorArrayToString, callbackOnKeyPress } from './utils';\nimport { PALETTE } from '../utils';\nimport Popover from './Popover';\n\n/**\n * Wrapper around a button element that supports asking for confirmation.\n * @param {object} props\n * @param {string} props.title The main button text.\n * @param {string} props.subtitle Smaller text on a line beneath the main text. Optional.\n * @param {function} props.onClick A \"clean up\" handler passed from the parent,\n * to alert the parent Popover component that it should close the popover after the button has\n * fired its handler.\n * @param {function} props.handler A function to call on button click (or after confirmation).\n * @param {string} props.handlerKey A key associated with the button, to support accessibility.\n * @param {boolean} props.confirm Does the user need to press the button again to confirm?\n * By default, false.\n * @param {boolean} props.visible The visibility state from the parent popover,\n * so that on visibility change, the button can clear its confirmation state.\n */\nfunction PopoverMenuListButton(props) {\n const {\n title, subtitle, onClick, handler, handlerKey, confirm,\n visible,\n } = props;\n\n const [isConfirming, setIsConfirming] = useState(false);\n\n useEffect(() => {\n // Want to clear the \"confirming\",\n // state if the user hides the popover.\n setIsConfirming(false);\n }, [visible]);\n\n function handleOrRequireConfirm() {\n if (!confirm || isConfirming) {\n onClick();\n handler();\n } else {\n setIsConfirming(true);\n }\n }\n\n const titleWithConfirm = `${isConfirming ? 'Confirm ' : ''}${title}`;\n\n return (\n <button\n title={titleWithConfirm}\n type=\"button\"\n onClick={handleOrRequireConfirm}\n onKeyPress={e => callbackOnKeyPress(e, handlerKey, handleOrRequireConfirm)}\n >{titleWithConfirm}\n {subtitle && (<><br /><span className=\"small\">{subtitle}</span></>)}\n </button>\n );\n}\n\n/**\n * Helper component to create a list of buttons for the body of a popover.\n * If the color, setColor, and palette props are provided then a color picker\n * will be rendered at the top of the button list.\n * @param {object} props\n * @param {object[]} props.menuConfig The list of button definition objects.\n * `{ title, subtitle, confirm, handler, handlerKey }`\n * @param {function} props.onClick A \"clean up\" handler passed from the parent,\n * to alert the parent Popover component that it should close the popover after the button has\n * fired its handler.\n * @param {number[]} props.color The current color. Optional.\n * @param {string} props.palette The color palette for the color picker. Optional.\n * @param {boolean} props.setColor The handler to call when a color has been selected. Optional.\n * @param {boolean} props.visible The visibility state from the parent popover,\n * so that on visibility change, buttons can clear confirmation states.\n */\nfunction PopoverMenuList(props) {\n const {\n menuConfig,\n onClick,\n color = null,\n palette = null,\n setColor = null,\n visible,\n } = props;\n\n function handleColorChange({ rgb }) {\n if (rgb && setColor) {\n setColor([rgb.r, rgb.g, rgb.b]);\n }\n }\n\n const defaultPalette = palette\n ? palette.map(colorArrayToString)\n : PALETTE.concat([[255, 255, 255], [128, 128, 128], [0, 0, 0]]).map(colorArrayToString);\n\n return (\n <div>\n {color && setColor && defaultPalette && (\n <TwitterPicker\n className=\"popover-menu-color\"\n disableAlpha\n width={108}\n triangle=\"hide\"\n colors={defaultPalette}\n color={colorArrayToString(color)}\n onChangeComplete={handleColorChange}\n />\n )}\n <ul className=\"popover-menu-list\">\n {menuConfig.map(item => (\n <li key={item.title + item.subtitle}>\n <PopoverMenuListButton\n {...item}\n onClick={onClick}\n visible={visible}\n />\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/**\n * Helper component to create a popover component with a list of buttons.\n * If the color, setColor, and palette props are provided then a color picker\n * will be rendered at the top of the button list.\n * @param {object} props\n * @param {object[]} props.menuConfig The list of button definition objects.\n * `{ title, subtitle, confirm, handler, handlerKey }`\n * @param {string} placement Where to place the popover (top, bottom, left, right).\n * @param {number[]} props.color The current color. Optional.\n * @param {string} props.palette The color palette for the color picker. Optional.\n * @param {boolean} props.setColor The handler to call when a color has been selected. Optional.\n * @param {Element|React.Component} props.children Children to render,\n * which will trigger the popover on click.\n */\nexport default function PopoverMenu(props) {\n const {\n menuConfig, placement, children,\n color = null, setColor = null, palette = null,\n } = props;\n\n const [visible, setVisible] = useState(false);\n\n return (\n <Popover\n content={(\n <PopoverMenuList\n menuConfig={menuConfig}\n onClick={() => setVisible(false)}\n color={color}\n setColor={setColor}\n palette={palette}\n visible={visible}\n />\n)}\n placement={placement}\n visible={visible}\n onVisibleChange={setVisible}\n >\n {children}\n </Popover>\n );\n}\n","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nvar _ref2 = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M12 18c1.657 0 3 1.343 3 3s-1.343 3-3 3-3-1.343-3-3 1.343-3 3-3zm0-9c1.657 0 3 1.343 3 3s-1.343 3-3 3-3-1.343-3-3 1.343-3 3-3zm0-9c1.657 0 3 1.343 3 3s-1.343 3-3 3-3-1.343-3-3 1.343-3 3-3z\"\n});\n\nfunction SvgMenu(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _ref2);\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgMenu, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/menu.bc56e94a.svg\";\nexport { ForwardRef as ReactComponent };","import React, { useState } from 'react';\nimport clsx from 'clsx';\nimport { TreeNode as RcTreeNode } from 'rc-tree';\nimport { getDataAndAria } from 'rc-tree/es/util';\nimport classNames from 'classnames';\nimport range from 'lodash/range';\nimport isEqual from 'lodash/isEqual';\nimport PopoverMenu from './PopoverMenu';\nimport HelpTooltip from './HelpTooltip';\nimport { callbackOnKeyPress, colorArrayToString, getLevelTooltipText } from './utils';\nimport { ReactComponent as MenuSVG } from '../../assets/menu.svg';\nimport { getDefaultColor } from '../utils';\n\n\n/**\n * Construct a `menuConfig` array for the PopoverMenu component.\n * @param {object} props The props for the TreeNode component.\n * @returns {object[]} An array of menu items to pass to PopoverMenu.\n */\nfunction makeNodeViewMenuConfig(props) {\n const {\n path,\n level,\n height,\n onCheckNode,\n onNodeRemove,\n onNodeSetIsEditing,\n onExportLevelZeroNodeJSON,\n onExportLevelZeroNodeTabular,\n onExportSetJSON,\n checkable,\n editable,\n exportable,\n checked,\n } = props;\n\n return [\n ...(editable ? [\n {\n title: 'Rename',\n handler: () => { onNodeSetIsEditing(path, true); },\n handlerKey: 'r',\n },\n {\n title: 'Delete',\n confirm: true,\n handler: () => { onNodeRemove(path); },\n handlerKey: 'd',\n },\n ] : []),\n ...(level === 0 && exportable ? [\n {\n title: 'Export hierarchy',\n subtitle: '(to JSON file)',\n handler: () => { onExportLevelZeroNodeJSON(path); },\n handlerKey: 'j',\n },\n ...(height <= 1 ? [\n {\n title: 'Export hierarchy',\n subtitle: '(to CSV file)',\n handler: () => { onExportLevelZeroNodeTabular(path); },\n handlerKey: 't',\n },\n ] : []),\n ] : []),\n ...(level > 0 ? [\n ...(checkable ? [\n {\n title: (checked ? 'Uncheck' : 'Check'),\n handler: () => { onCheckNode(path, !checked); },\n handlerKey: 's',\n },\n ] : []),\n ...(exportable ? [\n {\n title: 'Export set',\n subtitle: '(to JSON file)',\n handler: () => { onExportSetJSON(path); },\n handlerKey: 'e',\n },\n ] : []),\n ] : []),\n ];\n}\n\n/**\n * The \"static\" node component to render when the user is not renaming.\n * @param {object} props The props for the TreeNode component.\n */\nfunction NamedSetNodeStatic(props) {\n const {\n title,\n path,\n nodeKey,\n level,\n height,\n color,\n checkbox,\n isChecking,\n isLeaf,\n onNodeSetColor,\n onNodeView,\n expanded,\n onCheckLevel,\n checkedLevelPath,\n checkedLevelIndex,\n disableTooltip,\n size,\n datatype,\n editable,\n theme,\n } = props;\n const shouldCheckNextLevel = (level === 0 && !expanded);\n const nextLevelToCheck = (\n (checkedLevelIndex && isEqual(path, checkedLevelPath) && checkedLevelIndex < height)\n ? checkedLevelIndex + 1\n : 1\n );\n const numberFormatter = new Intl.NumberFormat('en-US');\n const niceSize = numberFormatter.format(size);\n let tooltipText;\n if (shouldCheckNextLevel) {\n tooltipText = getLevelTooltipText(nextLevelToCheck);\n } else if (isLeaf || !expanded) {\n tooltipText = `Color individual set (${niceSize} ${datatype}${(size === 1 ? '' : 's')})`;\n } else {\n tooltipText = 'Color by expanded descendants';\n }\n // If this is a level zero node and is _not_ expanded, then upon click,\n // the behavior should be to color by the first or next cluster level.\n // If this is a level zero node and _is_ expanded, or if any other node,\n // click should trigger onNodeView.\n const onClick = (level === 0 && !expanded\n ? () => onCheckLevel(nodeKey, nextLevelToCheck)\n : () => onNodeView(path)\n );\n const tooltipProps = (disableTooltip ? { visible: false } : {});\n const popoverMenuConfig = makeNodeViewMenuConfig(props);\n return (\n <span>\n <HelpTooltip title={tooltipText} {...tooltipProps}>\n <button\n type=\"button\"\n onClick={onClick}\n onKeyPress={e => callbackOnKeyPress(e, 'v', () => onNodeView(path))}\n className=\"title-button\"\n >\n {title}\n </button>\n </HelpTooltip>\n {popoverMenuConfig.length > 0 ? (\n <PopoverMenu\n menuConfig={makeNodeViewMenuConfig(props)}\n color={level > 0 && editable ? (color || getDefaultColor(theme)) : null}\n setColor={c => onNodeSetColor(path, c)}\n >\n <MenuSVG className=\"node-menu-icon\" />\n </PopoverMenu>\n ) : null}\n {level > 0 && isChecking ? checkbox : null}\n {level > 0 && (<span className=\"node-size-label\">{niceSize}</span>)}\n </span>\n );\n}\n\n/**\n * The \"editing\" node component to render when the user is renaming,\n * containing a text input field and a save button.\n * @param {object} props The props for the TreeNode component.\n */\nfunction NamedSetNodeEditing(props) {\n const {\n title,\n path,\n onNodeSetName,\n onNodeCheckNewName,\n } = props;\n const [currentTitle, setCurrentTitle] = useState(title);\n\n // Do not allow the user to save a potential name if it conflicts with\n // another name in the hierarchy.\n const hasConflicts = onNodeCheckNewName(path, currentTitle);\n function trySetName() {\n if (!hasConflicts) {\n onNodeSetName(path, currentTitle, true);\n }\n }\n return (\n <span className=\"title-button-with-input\">\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n className=\"title-input\"\n type=\"text\"\n value={currentTitle}\n onChange={(e) => { setCurrentTitle(e.target.value); }}\n onKeyPress={e => callbackOnKeyPress(\n e,\n 'Enter',\n trySetName,\n )}\n onFocus={e => e.target.select()}\n />\n {!hasConflicts && (\n <button\n type=\"button\"\n className=\"title-save-button\"\n onClick={trySetName}\n >\n Save\n </button>\n )}\n </span>\n );\n}\n\n/**\n * A \"delegation\" component, to decide whether to render\n * an \"editing\" vs. \"static\" node component.\n * @param {object} props The props for the TreeNode component.\n */\nfunction NamedSetNode(props) {\n const {\n isEditing,\n isCurrentSet,\n } = props;\n return (\n (isEditing || isCurrentSet)\n ? (<NamedSetNodeEditing {...props} />)\n : (<NamedSetNodeStatic {...props} />)\n );\n}\n\n/**\n * Buttons for viewing each hierarchy level,\n * rendered below collapsed level zero nodes.\n * @param {object} props The props for the (level zero) TreeNode component.\n */\nfunction LevelsButtons(props) {\n const {\n nodeKey,\n path,\n height,\n onCheckLevel,\n checkedLevelPath,\n checkedLevelIndex,\n hasColorEncoding,\n } = props;\n function onCheck(event) {\n if (event.target.checked) {\n const newLevel = parseInt(event.target.value, 10);\n onCheckLevel(nodeKey, newLevel);\n }\n }\n return (\n <div className=\"level-buttons-container\">\n {range(1, height + 1).map((i) => {\n const isChecked = isEqual(path, checkedLevelPath) && i === checkedLevelIndex;\n return (\n <div className=\"level-buttons\" key={i}>\n <HelpTooltip title={getLevelTooltipText(i)}>\n <input\n className={clsx('level-radio-button', { checked: isChecked && !hasColorEncoding })}\n type=\"checkbox\"\n value={i}\n checked={isChecked && hasColorEncoding}\n onChange={onCheck}\n />\n </HelpTooltip>\n </div>\n );\n })}\n </div>\n );\n}\n\n/**\n * Render the \"switcher\" icon.\n * Arrow for collapsed/expanded non-leaf nodes,\n * or square for leaf nodes.\n * @param {object} props The props for the TreeNode component.\n */\nfunction SwitcherIcon(props) {\n const {\n isLeaf, isOpen, color,\n } = props;\n const hexColor = (color ? colorArrayToString(color) : undefined);\n if (isLeaf) {\n return (\n <i\n className=\"anticon anticon-circle rc-tree-switcher-icon\"\n >\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"caret-down\"\n width=\"1em\"\n height=\"1em\"\n aria-hidden=\"true\"\n >\n <rect fill={hexColor} x={600 / 2} y={600 / 2} width={1024 - 600} height={1024 - 600} />\n </svg>\n </i>\n );\n }\n return (\n <i\n className=\"anticon anticon-caret-down rc-tree-switcher-icon\"\n >\n <svg\n viewBox=\"0 0 1024 1024\"\n focusable=\"false\"\n data-icon=\"caret-down\"\n width=\"1em\"\n height=\"1em\"\n aria-hidden=\"true\"\n >\n <path\n fill={(isOpen ? '#444' : hexColor)}\n d=\"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z\"\n />\n </svg>\n </i>\n );\n}\n\n/**\n * A custom TreeNode component.\n * @extends {RcTreeNode} TreeNode from the rc-tree library.\n */\nexport default class TreeNode extends RcTreeNode {\n /**\n * Override the main node text elements.\n */\n renderSelector = () => {\n const {\n title,\n isCurrentSet,\n isSelected,\n isEditing,\n onDragStart: onDragStartProp,\n } = this.props;\n const {\n rcTree: {\n prefixCls: prefixClass,\n draggable,\n },\n } = this.context;\n\n const onDragStart = (e) => {\n onDragStartProp();\n this.onDragStart(e);\n };\n\n const wrapClass = `${prefixClass}-node-content-wrapper`;\n const isDraggable = (!isCurrentSet && !isEditing && draggable);\n return (\n <span\n ref={this.setSelectHandle}\n title={title}\n className={classNames(\n wrapClass,\n `${wrapClass}-${this.getNodeState() || 'normal'}`,\n isSelected && `${prefixClass}-node-selected`,\n isDraggable && 'draggable',\n )}\n draggable={isDraggable}\n aria-grabbed={isDraggable}\n onDragStart={isDraggable ? onDragStart : undefined}\n >\n <NamedSetNode\n {...this.props}\n prefixClass={prefixClass}\n checkbox={this.renderCheckbox()}\n />\n {this.renderLevels()}\n </span>\n );\n };\n\n /**\n * Render the LevelsButtons component if this node\n * is a collapsed level zero node.\n */\n renderLevels = () => {\n const { level, expanded } = this.props;\n if (level !== 0 || expanded) {\n return null;\n }\n return (\n <LevelsButtons\n {...this.props}\n />\n );\n }\n\n /**\n * Override the switcher element.\n */\n renderSwitcher = () => {\n const { expanded, isLeaf, color } = this.props;\n const {\n rcTree: {\n prefixCls: prefixClass,\n onNodeExpand,\n },\n } = this.context;\n\n const onNodeExpandWrapper = (e) => {\n // Do not call onNodeExpand if the node is a leaf node.\n if (!isLeaf) {\n onNodeExpand(e, this);\n }\n };\n\n const switcherClass = classNames(\n `${prefixClass}-switcher`,\n { [`${prefixClass}-switcher_${(expanded ? 'open' : 'close')}`]: !isLeaf },\n );\n return (\n <span\n className={switcherClass}\n onClick={onNodeExpandWrapper}\n onKeyPress={e => callbackOnKeyPress(e, 'd', onNodeExpandWrapper)}\n role=\"button\"\n tabIndex=\"0\"\n >\n <SwitcherIcon\n isLeaf={isLeaf}\n isOpen={expanded}\n color={color}\n />\n </span>\n );\n };\n\n /**\n * Override main render function,\n * to enable overriding the sub-render functions\n * for switcher, selector, etc.\n */\n render() {\n const {\n style, loading, level,\n dragOver, dragOverGapTop, dragOverGapBottom,\n isLeaf,\n expanded, selected, checked, halfChecked,\n onDragEnd: onDragEndProp,\n expandable,\n ...otherProps\n } = this.props;\n const {\n rcTree: {\n prefixCls: prefixClass,\n filterTreeNode,\n draggable,\n },\n } = this.context;\n const disabled = this.isDisabled();\n const dataAndAriaAttributeProps = getDataAndAria(otherProps);\n\n const onDragEnd = (e) => {\n onDragEndProp();\n this.onDragEnd(e);\n };\n\n return (\n <li\n className={classNames('rc-tree-treenode', `level-${level}-treenode`, {\n [`${prefixClass}-treenode-disabled`]: disabled,\n [`${prefixClass}-treenode-switcher-${expanded ? 'open' : 'close'}`]: !isLeaf,\n [`${prefixClass}-treenode-checkbox-checked`]: checked,\n [`${prefixClass}-treenode-checkbox-indeterminate`]: halfChecked,\n [`${prefixClass}-treenode-selected`]: selected,\n [`${prefixClass}-treenode-loading`]: loading,\n\n 'drag-over': !disabled && dragOver,\n 'drag-over-gap-top': !disabled && dragOverGapTop,\n 'drag-over-gap-bottom': !disabled && dragOverGapBottom,\n 'filter-node': filterTreeNode && filterTreeNode(this),\n })}\n style={style}\n role=\"treeitem\"\n onDragEnter={draggable ? this.onDragEnter : undefined}\n onDragOver={draggable ? this.onDragOver : undefined}\n onDragLeave={draggable ? this.onDragLeave : undefined}\n onDrop={draggable ? this.onDrop.bind(this) : undefined}\n onDragEnd={draggable ? onDragEnd : undefined}\n {...dataAndAriaAttributeProps}\n >\n {expandable ? this.renderSwitcher() : null}\n {this.renderSelector()}\n {this.renderChildren()}\n </li>\n );\n }\n}\n","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgUnion(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n viewBox: \"0 0 16.433999 10.234\",\n height: 12,\n width: 18,\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"translate(0.117,-2.883)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"m 11.467471,11.811278 c 0.198237,-0.322177 0.508,-1.011333 0.653661,-1.454255 0.659343,-2.0049141 0.44323,-4.2620847 -0.577734,-6.0340822 l -0.168844,-0.2930481 0.105744,0.017887 c 0.759902,0.1285441 1.368762,0.3699553 1.856675,0.7361658 1.988296,1.4923476 2.192477,4.3353549 0.434717,6.0529895 -0.641216,0.626581 -1.299647,0.94683 -2.294136,1.115833 l -0.108488,0.01844 z M 4.3162122,11.919169 C 1.9278944,11.487872 0.46692382,9.0323123 1.234873,6.7401372 1.5621727,5.763213 2.2610593,4.9489746 3.1840041,4.4693005 3.5978035,4.2542401 3.9427842,4.145371 4.5197023,4.0477802 L 4.6254464,4.0298927 4.4571836,4.3223069 C 3.4332707,6.1017061 3.2180432,8.3476022 3.878868,10.357023 c 0.1458466,0.443487 0.4554716,1.132155 0.6542959,1.455285 0.054471,0.08853 0.087814,0.159599 0.074096,0.157937 -0.013718,-0.0017 -0.1446898,-0.02465 -0.2910477,-0.05108 z M 5.0000001,3 C 2.2,3 0,5.2 0,8 c 0,2.8 2.2,5 5.0000001,5 0.6,0 1.1,-0.1 1.6,-0.3 C 5.3000001,11.6 4.5,9.7999998 4.5,8 4.5,6.2 5.3000001,4.5 6.6000001,3.3 c -0.5,-0.2 -1,-0.3 -1.6,-0.3 z M 4.65,4.02 C 3.92,5.17 3.51,6.54 3.51,8 c 0,1.4599998 0.42,2.83 1.14,3.98 C 2.61,11.8 1.01,10.08 1.01,8 1.01,5.92 2.61,4.2 4.65,4.02 Z M 8,4 C 6.8,4.9 6,6.4 6,8 6,9.6 6.8,11.1 8,12 9.2,11.1 10,9.7 10,8 10,6.3 9.2,4.9 8,4 Z m 3,-1 c 2.8,0 5,2.2 5,5 0,2.8 -2.2,5 -5,5 C 10.4,13 9.9,12.9 9.4,12.7 10.7,11.6 11.5,9.8 11.5,8 11.5,6.2 10.7,4.5 9.4,3.3 9.9,3.1 10.4,3 11,3 Z m 0.35,1.02 c 0.73,1.15 1.14,2.52 1.14,3.98 0,1.46 -0.42,2.83 -1.14,3.98 2.04,-0.18 3.64,-1.9 3.64,-3.98 0,-2.08 -1.6,-3.8 -3.64,-3.98 z\",\n style: {\n strokeWidth: 0.234,\n strokeMiterlimit: 4,\n strokeDasharray: \"none\",\n strokeOpacity: 1\n }\n })));\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgUnion, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/union.de5168c6.svg\";\nexport { ForwardRef as ReactComponent };","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgIntersection(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 18,\n height: 12,\n viewBox: \"0 0 16 10\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"translate(0,-3)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"M 5.0000001,3 C 2.2,3 0,5.2 0,8 c 0,2.8 2.2,5 5.0000001,5 0.6,0 1.1,-0.1 1.6,-0.3 C 5.3000001,11.6 4.5,9.7999998 4.5,8 4.5,6.2 5.3000001,4.5 6.6000001,3.3 c -0.5,-0.2 -1,-0.3 -1.6,-0.3 z M 4.65,4.02 C 3.92,5.17 3.51,6.54 3.51,8 c 0,1.4599998 0.42,2.83 1.14,3.98 C 2.61,11.8 1.01,10.08 1.01,8 1.01,5.92 2.61,4.2 4.65,4.02 Z M 8,4 C 6.8,4.9 6,6.4 6,8 6,9.6 6.8,11.1 8,12 9.2,11.1 10,9.7 10,8 10,6.3 9.2,4.9 8,4 Z m 3,-1 c 2.8,0 5,2.2 5,5 0,2.8 -2.2,5 -5,5 C 10.4,13 9.9,12.9 9.4,12.7 10.7,11.6 11.5,9.8 11.5,8 11.5,6.2 10.7,4.5 9.4,3.3 9.9,3.1 10.4,3 11,3 Z m 0.35,1.02 c 0.73,1.15 1.14,2.52 1.14,3.98 0,1.46 -0.42,2.83 -1.14,3.98 2.04,-0.18 3.64,-1.9 3.64,-3.98 0,-2.08 -1.6,-3.8 -3.64,-3.98 z\",\n style: {\n strokeWidth: 0.234,\n strokeMiterlimit: 4,\n strokeDasharray: \"none\",\n strokeOpacity: 1\n }\n })));\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgIntersection, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/intersection.b0003109.svg\";\nexport { ForwardRef as ReactComponent };","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nvar _ref2 = /*#__PURE__*/React.createElement(\"rect\", {\n x: \"5%\",\n width: \"90%\",\n height: \"100%\",\n fill: \"white\"\n});\n\nvar _ref3 = /*#__PURE__*/React.createElement(\"g\", null, /*#__PURE__*/React.createElement(\"rect\", {\n x: 0,\n y: 0,\n width: 25.3804963846,\n height: 16,\n mask: \"url(#union-mask)\"\n}));\n\nfunction SvgComplement(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n id: \"svg14\",\n viewBox: \"0 0 25.3804963846 16\",\n height: 16,\n width: 25.3804963846,\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"mask\", {\n id: \"union-mask\",\n x: 0,\n y: 0,\n width: 25.3804963846,\n height: 16\n }, _ref2, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"translate(4.69,0)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n d: \"m 11.467471,11.811278 c 0.198237,-0.322177 0.508,-1.011333 0.653661,-1.454255 0.659343,-2.0049141 0.44323,-4.2620847 -0.577734,-6.0340822 l -0.168844,-0.2930481 0.105744,0.017887 c 0.759902,0.1285441 1.368762,0.3699553 1.856675,0.7361658 1.988296,1.4923476 2.192477,4.3353549 0.434717,6.0529895 -0.641216,0.626581 -1.299647,0.94683 -2.294136,1.115833 l -0.108488,0.01844 z M 4.3162122,11.919169 C 1.9278944,11.487872 0.46692382,9.0323123 1.234873,6.7401372 1.5621727,5.763213 2.2610593,4.9489746 3.1840041,4.4693005 3.5978035,4.2542401 3.9427842,4.145371 4.5197023,4.0477802 L 4.6254464,4.0298927 4.4571836,4.3223069 C 3.4332707,6.1017061 3.2180432,8.3476022 3.878868,10.357023 c 0.1458466,0.443487 0.4554716,1.132155 0.6542959,1.455285 0.054471,0.08853 0.087814,0.159599 0.074096,0.157937 -0.013718,-0.0017 -0.1446898,-0.02465 -0.2910477,-0.05108 z M 5.0000001,3 C 2.2,3 0,5.2 0,8 c 0,2.8 2.2,5 5.0000001,5 0.6,0 1.1,-0.1 1.6,-0.3 C 5.3000001,11.6 4.5,9.7999998 4.5,8 4.5,6.2 5.3000001,4.5 6.6000001,3.3 c -0.5,-0.2 -1,-0.3 -1.6,-0.3 z M 4.65,4.02 C 3.92,5.17 3.51,6.54 3.51,8 c 0,1.4599998 0.42,2.83 1.14,3.98 C 2.61,11.8 1.01,10.08 1.01,8 1.01,5.92 2.61,4.2 4.65,4.02 Z M 8,4 C 6.8,4.9 6,6.4 6,8 6,9.6 6.8,11.1 8,12 9.2,11.1 10,9.7 10,8 10,6.3 9.2,4.9 8,4 Z m 3,-1 c 2.8,0 5,2.2 5,5 0,2.8 -2.2,5 -5,5 C 10.4,13 9.9,12.9 9.4,12.7 10.7,11.6 11.5,9.8 11.5,8 11.5,6.2 10.7,4.5 9.4,3.3 9.9,3.1 10.4,3 11,3 Z m 0.35,1.02 c 0.73,1.15 1.14,2.52 1.14,3.98 0,1.46 -0.42,2.83 -1.14,3.98 2.04,-0.18 3.64,-1.9 3.64,-3.98 0,-2.08 -1.6,-3.8 -3.64,-3.98 z\",\n style: {\n strokeWidth: 0.234,\n strokeMiterlimit: 4,\n strokeDasharray: \"none\",\n strokeOpacity: 1\n },\n fill: \"black\"\n })))), _ref3);\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgComplement, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/complement.c220ca8c.svg\";\nexport { ForwardRef as ReactComponent };","import React, { useCallback } from 'react';\nimport PopoverMenu from './PopoverMenu';\nimport {\n handleImportJSON,\n handleImportTabular,\n} from './io';\nimport {\n MIME_TYPE_JSON,\n MIME_TYPE_TABULAR,\n} from './constants';\n\nimport { ReactComponent as SetUnionSVG } from '../../assets/sets/union.svg';\nimport { ReactComponent as SetIntersectionSVG } from '../../assets/sets/intersection.svg';\nimport { ReactComponent as SetComplementSVG } from '../../assets/sets/complement.svg';\n\n/**\n * A plus button for creating or importing set hierarchies.\n * @param {object} props\n * @param {string} props.datatype The data type to validate imported hierarchies against.\n * @param {function} props.onError A callback to pass error message strings.\n * @param {function} props.onImportTree A callback to pass successfully-validated tree objects.\n * @param {function} props.onCreateLevelZeroNode A callback to create a new empty\n * level zero node.\n * @param {boolean} props.importable Is importing allowed?\n * If not, the import button will not be rendered.\n * @param {boolean} props.editable Is editing allowed?\n * If not, the create button will not be rendered.\n */\nexport function PlusButton(props) {\n const {\n datatype, onError, onImportTree, onCreateLevelZeroNode,\n importable, editable,\n } = props;\n\n /**\n * Import a file, then process the imported data via the supplied handler function.\n * @param {Function} importHandler The function to process the imported data.\n * @param {string} mimeType The accepted mime type for the file upload input.\n * @returns {Function} An import function corresponding to the supplied parameters.\n */\n const onImport = useCallback((importHandler, mimeType) => () => {\n const uploadInputNode = document.createElement('input');\n uploadInputNode.setAttribute('type', 'file');\n uploadInputNode.setAttribute('accept', mimeType);\n document.body.appendChild(uploadInputNode); // required for firefox\n uploadInputNode.click();\n uploadInputNode.addEventListener('change', (event) => {\n if (!(window.File && window.FileReader && window.FileList && window.Blob)) {\n onError('Local file reading APIs are not fully supported in this browser.');\n return;\n }\n const { files } = event.target;\n if (!files || files.length !== 1) {\n onError('Incorrect number of files selected.');\n return;\n }\n const reader = new FileReader();\n reader.addEventListener('load', () => {\n const { result } = reader;\n try {\n const treeToImport = importHandler(result, datatype);\n onError(false); // Clear any previous import error.\n onImportTree(treeToImport);\n } catch (e) {\n onError(e.message);\n }\n }, false);\n reader.readAsText(files[0]);\n });\n uploadInputNode.remove();\n }, [datatype, onError, onImportTree]);\n\n const menuConfig = [\n ...(editable ? [\n {\n title: 'Create hierarchy',\n handler: onCreateLevelZeroNode,\n handlerKey: 'n',\n },\n ] : []),\n ...(importable ? [\n {\n title: 'Import hierarchy',\n subtitle: '(from CSV file)',\n handler: onImport(handleImportTabular, MIME_TYPE_TABULAR),\n handlerKey: 'c',\n },\n {\n title: 'Import hierarchy',\n subtitle: '(from JSON file)',\n handler: onImport(handleImportJSON, MIME_TYPE_JSON),\n handlerKey: 'j',\n },\n ] : []),\n ];\n\n return (menuConfig.length > 0 ? (\n <PopoverMenu\n menuConfig={menuConfig}\n >\n <button className=\"plus-button\" type=\"submit\">+</button>\n </PopoverMenu>\n ) : null);\n}\n\n/**\n * Set operations buttons (union, intersection, complement)\n * and a view checked sets button.\n * @param {object} props\n * @param {function} props.onUnion A callback for the union button.\n * @param {function} props.onIntersection A callback for the intersection button.\n * @param {function} props.onComplement A callback for the complement button.\n * @param {boolean} props.operatable Are set operations allowed?\n * If not, the union, intersection, and complement buttons will not be rendered.\n */\nexport function SetOperationButtons(props) {\n const {\n onUnion,\n onIntersection,\n onComplement,\n operatable,\n hasCheckedSetsToUnion,\n hasCheckedSetsToIntersect,\n hasCheckedSetsToComplement,\n } = props;\n\n return (\n <>\n {operatable && (\n <>\n <button\n onClick={onUnion}\n title=\"New set from union of checked sets\"\n type=\"submit\"\n disabled={!hasCheckedSetsToUnion}\n >\n <SetUnionSVG />\n </button>\n <button\n onClick={onIntersection}\n title=\"New set from intersection of checked sets\"\n type=\"submit\"\n disabled={!hasCheckedSetsToIntersect}\n >\n <SetIntersectionSVG />\n </button>\n <button\n onClick={onComplement}\n title=\"New set from complement of checked sets\"\n type=\"submit\"\n disabled={!hasCheckedSetsToComplement}\n >\n <SetComplementSVG />\n </button>\n </>\n )}\n </>\n );\n}\n","/* eslint-disable no-underscore-dangle */\nimport React, { useState, useMemo } from 'react';\nimport isEqual from 'lodash/isEqual';\nimport Tree from './Tree';\nimport TreeNode from './TreeNode';\nimport { PlusButton, SetOperationButtons } from './SetsManagerButtons';\nimport { nodeToRenderProps } from './cell-set-utils';\nimport { getDefaultColor } from '../utils';\nimport { pathToKey } from './utils';\n\nfunction processNode(node, prevPath, setColor, theme) {\n const nodePath = [...prevPath, node.name];\n return {\n ...node,\n ...(node.children ? ({\n children: node.children\n .map(c => processNode(c, nodePath, setColor)),\n }) : {}),\n color: setColor?.find(d => isEqual(d.path, nodePath))?.color || getDefaultColor(theme),\n };\n}\n\nfunction processSets(sets, setColor, theme) {\n return {\n ...sets,\n tree: sets ? sets.tree.map(lzn => processNode(lzn, [], setColor, theme)) : [],\n };\n}\n\nfunction getAllKeys(node, path = []) {\n if (!node) {\n return null;\n }\n const newPath = [...path, node.name];\n if (node.children) {\n return [pathToKey(newPath), ...node.children.flatMap(v => getAllKeys(v, newPath))];\n }\n return pathToKey(newPath);\n}\n\n/**\n * A generic hierarchical set manager component.\n * @prop {object} tree An object representing set hierarchies.\n * @prop {string} datatype The data type for sets (e.g. \"cell\")\n * @prop {function} clearPleaseWait A callback to signal that loading is complete.\n * @prop {boolean} draggable Whether tree nodes can be rearranged via drag-and-drop.\n * By default, true.\n * @prop {boolean} checkable Whether to show the \"Check\" menu button\n * and checkboxes for selecting multiple sets. By default, true.\n * @prop {boolean} editable Whether to show rename, delete, color, or create options.\n * By default, true.\n * @prop {boolean} expandable Whether to allow hierarchies to be expanded\n * to show the list or tree of sets contained. By default, true.\n * @prop {boolean} operatable Whether to enable union, intersection,\n * and complement operations on checked sets. By default, true.\n * @prop {boolean} exportable Whether to enable exporting hierarchies and sets to files.\n * By default, true.\n * @prop {boolean} importable Whether to enable importing hierarchies from files.\n * By default, true.\n * @prop {function} onError Function to call with error messages (failed import validation, etc).\n * @prop {function} onCheckNode Function to call when a single node has been checked or un-checked.\n * @prop {function} onExpandNode Function to call when a node has been expanded.\n * @prop {function} onDropNode Function to call when a node has been dragged-and-dropped.\n * @prop {function} onCheckLevel Function to call when an entire hierarchy level has been selected,\n * via the \"Color by cluster\" and \"Color by subcluster\" buttons below collapsed level zero nodes.\n * @prop {function} onNodeSetColor Function to call when a new node color has been selected.\n * @prop {function} onNodeSetName Function to call when a node has been renamed.\n * @prop {function} onNodeRemove Function to call when the user clicks the \"Delete\" menu button\n * to remove a node.\n * @prop {function} onNodeView Function to call when the user wants to view the set associated\n * with a particular node.\n * @prop {function} onImportTree Function to call when a tree has been imported\n * using the \"plus\" button.\n * @prop {function} onCreateLevelZeroNode Function to call when a user clicks the \"Create hierarchy\"\n * menu option using the \"plus\" button.\n * @prop {function} onExportLevelZeroNode Function to call when a user wants to\n * export an entire hierarchy via the \"Export hierarchy\" menu button for a\n * particular level zero node.\n * @prop {function} onExportSet Function to call when a user wants to export a set associated with\n * a particular node via the \"Export set\" menu button.\n * @prop {function} onUnion Function to call when a user wants to create a new set from the union\n * of the sets associated with the currently-checked nodes.\n * @prop {function} onIntersection Function to call when a user wants to create a new set from the\n * intersection of the sets associated with the currently-checked nodes.\n * @prop {function} onComplement Function to call when a user wants to create a new set from the\n * complement of the (union of the) sets associated with the currently-checked nodes.\n * @prop {function} onView Function to call when a user wants to view the sets\n * associated with the currently-checked nodes.\n * @prop {string} theme \"light\" or \"dark\" for the vitessce theme\n */\nexport default function SetsManager(props) {\n const {\n theme,\n sets,\n additionalSets,\n setColor, // TODO: use this\n levelSelection: checkedLevel,\n setSelection,\n setExpansion,\n hasColorEncoding,\n datatype,\n draggable = true,\n checkable = true,\n editable = true,\n expandable = true,\n operatable = true,\n exportable = true,\n importable = true,\n onError,\n onCheckNode,\n onExpandNode,\n onDropNode,\n onCheckLevel,\n onNodeSetColor,\n onNodeSetName,\n onNodeCheckNewName,\n onNodeRemove,\n onNodeView,\n onImportTree,\n onCreateLevelZeroNode,\n onExportLevelZeroNodeJSON,\n onExportLevelZeroNodeTabular,\n onExportSetJSON,\n onUnion,\n onIntersection,\n onComplement,\n hasCheckedSetsToUnion,\n hasCheckedSetsToIntersect,\n hasCheckedSetsToComplement,\n } = props;\n\n const isChecking = true;\n const autoExpandParent = true;\n const [isDragging, setIsDragging] = useState(false);\n const [isEditingNodeName, setIsEditingNodeName] = useState(null);\n\n const processedSets = useMemo(() => processSets(\n sets, setColor, theme,\n ), [sets, setColor, theme]);\n const processedAdditionalSets = useMemo(() => processSets(\n additionalSets, setColor, theme,\n ), [additionalSets, setColor, theme]);\n\n const additionalSetKeys = (processedAdditionalSets\n ? processedAdditionalSets.tree.flatMap(v => getAllKeys(v, []))\n : []\n );\n\n const allSetSelectionKeys = (setSelection || []).map(pathToKey);\n const allSetExpansionKeys = (setExpansion || []).map(pathToKey);\n\n const setSelectionKeys = allSetSelectionKeys.filter(k => !additionalSetKeys.includes(k));\n const setExpansionKeys = allSetExpansionKeys.filter(k => !additionalSetKeys.includes(k));\n\n const additionalSetSelectionKeys = allSetSelectionKeys.filter(k => additionalSetKeys.includes(k));\n const additionalSetExpansionKeys = allSetExpansionKeys.filter(k => additionalSetKeys.includes(k));\n\n /**\n * Recursively render TreeNode components.\n * @param {object[]} nodes An array of node objects.\n * @returns {TreeNode[]|null} Array of TreeNode components or null.\n */\n function renderTreeNodes(nodes, readOnly, currPath) {\n if (!nodes) {\n return null;\n }\n return nodes.map((node) => {\n const newPath = [...currPath, node.name];\n return (\n <TreeNode\n theme={theme}\n key={pathToKey(newPath)}\n {...nodeToRenderProps(node, newPath, setColor)}\n\n isEditing={isEqual(isEditingNodeName, newPath)}\n\n datatype={datatype}\n draggable={draggable && !readOnly}\n editable={editable && !readOnly}\n checkable={checkable}\n expandable={expandable}\n exportable={exportable}\n\n hasColorEncoding={hasColorEncoding}\n isChecking={isChecking}\n checkedLevelPath={checkedLevel ? checkedLevel.levelZeroPath : null}\n checkedLevelIndex={checkedLevel ? checkedLevel.levelIndex : null}\n\n onCheckNode={onCheckNode}\n onCheckLevel={onCheckLevel}\n onNodeView={onNodeView}\n onNodeSetColor={onNodeSetColor}\n onNodeSetName={(targetPath, name) => {\n onNodeSetName(targetPath, name);\n setIsEditingNodeName(null);\n }}\n onNodeCheckNewName={onNodeCheckNewName}\n onNodeSetIsEditing={setIsEditingNodeName}\n onNodeRemove={onNodeRemove}\n onExportLevelZeroNodeJSON={onExportLevelZeroNodeJSON}\n onExportLevelZeroNodeTabular={onExportLevelZeroNodeTabular}\n onExportSetJSON={onExportSetJSON}\n\n disableTooltip={isDragging}\n onDragStart={() => setIsDragging(true)}\n onDragEnd={() => setIsDragging(false)}\n >\n {renderTreeNodes(node.children, readOnly, newPath, theme)}\n </TreeNode>\n );\n });\n }\n\n return (\n <div className=\"sets-manager\">\n <div className=\"sets-manager-tree\">\n <Tree\n draggable={false}\n checkable={checkable}\n\n checkedKeys={setSelectionKeys}\n expandedKeys={setExpansionKeys}\n autoExpandParent={autoExpandParent}\n\n onCheck={(checkedKeys, info) => onCheckNode(\n info.node.props.nodeKey,\n info.checked,\n )}\n onExpand={(expandedKeys, info) => onExpandNode(\n expandedKeys,\n info.node.props.nodeKey,\n info.expanded,\n )}\n >\n {renderTreeNodes(processedSets.tree, true, [], theme)}\n </Tree>\n <Tree\n draggable /* TODO */\n checkable={checkable}\n\n checkedKeys={additionalSetSelectionKeys}\n expandedKeys={additionalSetExpansionKeys}\n autoExpandParent={autoExpandParent}\n\n onCheck={(checkedKeys, info) => onCheckNode(\n info.node.props.nodeKey,\n info.checked,\n )}\n onExpand={(expandedKeys, info) => onExpandNode(\n expandedKeys,\n info.node.props.nodeKey,\n info.expanded,\n )}\n onDrop={(info) => {\n const { eventKey: dropKey } = info.node.props;\n const { eventKey: dragKey } = info.dragNode.props;\n const { dropToGap, dropPosition } = info;\n onDropNode(dropKey, dragKey, dropPosition, dropToGap);\n }}\n >\n {renderTreeNodes(processedAdditionalSets.tree, false, [], theme)}\n </Tree>\n\n <PlusButton\n datatype={datatype}\n onError={onError}\n onImportTree={onImportTree}\n onCreateLevelZeroNode={onCreateLevelZeroNode}\n importable={importable}\n editable={editable}\n />\n </div>\n {isChecking ? (\n <div className=\"set-operation-buttons\">\n <SetOperationButtons\n onUnion={onUnion}\n onIntersection={onIntersection}\n onComplement={onComplement}\n operatable={operatable}\n\n hasCheckedSetsToUnion={hasCheckedSetsToUnion}\n hasCheckedSetsToIntersect={hasCheckedSetsToIntersect}\n hasCheckedSetsToComplement={hasCheckedSetsToComplement}\n />\n </div>\n ) : null}\n </div>\n );\n}\n","import React, {\n useEffect,\n useState,\n useMemo,\n} from 'react';\nimport isEqual from 'lodash/isEqual';\nimport packageJson from '../../../package.json';\nimport {\n useCoordination,\n useLoaders,\n useSetWarning,\n} from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport SetsManager from './SetsManager';\nimport TitleInfo from '../TitleInfo';\nimport {\n treeExportLevelZeroNode,\n treeExportSet,\n treeToExpectedCheckedLevel,\n nodeToLevelDescendantNamePaths,\n treeToIntersection,\n treeToUnion,\n treeToComplement,\n treeFindNodeByNamePath,\n treesConflict,\n nodeTransform,\n nodeAppendChild,\n nodePrependChild,\n nodeInsertChild,\n filterNode,\n treeInitialize,\n initializeCellSetColor,\n} from './cell-set-utils';\nimport {\n isEqualOrPrefix,\n tryRenamePath,\n PATH_SEP,\n} from './utils';\nimport {\n downloadForUser,\n handleExportJSON,\n handleExportTabular,\n tryUpgradeTreeToLatestSchema,\n} from './io';\nimport {\n FILE_EXTENSION_JSON,\n FILE_EXTENSION_TABULAR,\n SETS_DATATYPE_CELL,\n} from './constants';\nimport { useUrls, useReady } from '../hooks';\nimport {\n setCellSelection,\n mergeCellSets,\n getNextNumberedNodeName,\n} from '../utils';\nimport { useCellsData, useCellSetsData } from '../data-hooks';\n\nconst CELL_SETS_DATA_TYPES = ['cells', 'cell-sets'];\n\n/**\n * A subscriber wrapper around the SetsManager component\n * for the 'cell' datatype.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n */\nexport default function CellSetsManagerSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n title = 'Cell Sets',\n } = props;\n\n const loaders = useLoaders();\n const setWarning = useSetWarning();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n cellSetSelection,\n cellSetColor,\n additionalCellSets,\n cellColorEncoding,\n }, {\n setCellSetSelection,\n setCellColorEncoding,\n setCellSetColor,\n setAdditionalCellSets,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.cellSets, coordinationScopes);\n\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n CELL_SETS_DATA_TYPES,\n );\n\n const [cellSetExpansion, setCellSetExpansion] = useState([]);\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n setCellSetExpansion([]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [cells] = useCellsData(loaders, dataset, setItemIsReady, addUrl, true);\n const [cellSets] = useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, true,\n { setCellSetSelection, setCellSetColor },\n { cellSetSelection, cellSetColor },\n );\n\n // Validate and upgrade the additionalCellSets.\n useEffect(() => {\n if (additionalCellSets) {\n let upgradedCellSets;\n try {\n upgradedCellSets = tryUpgradeTreeToLatestSchema(additionalCellSets, SETS_DATATYPE_CELL);\n } catch (e) {\n setWarning(e.message);\n return;\n }\n setAdditionalCellSets(upgradedCellSets);\n }\n }, [additionalCellSets, setAdditionalCellSets, setWarning]);\n\n // Get an array of all cell IDs to use for set complement operations.\n const allCellIds = useMemo(() => (cells ? Object.keys(cells) : []), [cells]);\n\n // A helper function for updating the encoding for cell colors,\n // which may have previously been set to 'geneSelection'.\n function setCellSetColorEncoding() {\n setCellColorEncoding('cellSetSelection');\n }\n\n // Merged cell sets are only to be used for convenience when reading\n // (if writing: update either `cellSets` _or_ `additionalCellSets`).\n const mergedCellSets = useMemo(\n () => mergeCellSets(cellSets, additionalCellSets),\n [cellSets, additionalCellSets],\n );\n\n // Infer the state of the \"checked level\" radio button based on the selected cell sets.\n const checkedLevel = useMemo(() => {\n if (cellSetSelection && cellSetSelection.length > 0\n && mergedCellSets && mergedCellSets.tree.length > 0) {\n return treeToExpectedCheckedLevel(mergedCellSets, cellSetSelection);\n }\n return null;\n }, [cellSetSelection, mergedCellSets]);\n\n // Callback functions\n\n // The user wants to select all nodes at a particular hierarchy level.\n function onCheckLevel(levelZeroName, levelIndex) {\n const lzn = mergedCellSets.tree.find(n => n.name === levelZeroName);\n if (lzn) {\n const newCellSetSelection = nodeToLevelDescendantNamePaths(lzn, levelIndex, [], true);\n setCellSetSelection(newCellSetSelection);\n setCellSetColorEncoding();\n }\n }\n\n // The user wants to check or uncheck a cell set node.\n function onCheckNode(targetKey, checked) {\n const targetPath = (Array.isArray(targetKey) ? targetKey : targetKey.split(PATH_SEP));\n if (!targetKey) {\n return;\n }\n if (checked) {\n setCellSetSelection([...cellSetSelection, targetPath]);\n } else {\n setCellSetSelection(cellSetSelection.filter(d => !isEqual(d, targetPath)));\n }\n setCellSetColorEncoding();\n }\n\n // The user wants to expand or collapse a node in the tree.\n function onExpandNode(expandedKeys, targetKey, expanded) {\n if (expanded) {\n setCellSetExpansion(prev => ([...prev, targetKey.split(PATH_SEP)]));\n } else {\n setCellSetExpansion(prev => prev.filter(d => !isEqual(d, targetKey.split(PATH_SEP))));\n }\n }\n\n // The user dragged a tree node and dropped it somewhere else in the tree\n // to re-arrange or re-order the nodes.\n // We need to verify that their drop target is valid, and if so, complete\n // the tree re-arrangement.\n function onDropNode(dropKey, dragKey, dropPosition, dropToGap) {\n const dropPath = dropKey.split(PATH_SEP);\n const dropNode = treeFindNodeByNamePath(additionalCellSets, dropPath);\n if (!dropNode.children && !dropToGap) {\n // Do not allow a node with a set (i.e. leaf) to become a child of another node with a set,\n // as this will result in an internal node having a set, which we do not allow.\n return;\n }\n const dropNodeLevel = dropPath.length - 1;\n const dropNodeIsLevelZero = dropNodeLevel === 0;\n\n // Get drag node.\n const dragPath = dragKey.split(PATH_SEP);\n const dragNode = treeFindNodeByNamePath(additionalCellSets, dragPath);\n\n if (dropNodeIsLevelZero && dropToGap && !dragNode.children) {\n // Do not allow a leaf node to become a level zero node.\n return;\n }\n\n let dropParentNode;\n let dropParentPath;\n let dropNodeCurrIndex;\n if (!dropNodeIsLevelZero) {\n dropParentPath = dropPath.slice(0, -1);\n dropParentNode = treeFindNodeByNamePath(additionalCellSets, dropParentPath);\n dropNodeCurrIndex = dropParentNode.children.findIndex(c => c.name === dropNode.name);\n } else {\n dropNodeCurrIndex = additionalCellSets.tree.findIndex(\n lzn => lzn.name === dropNode.name,\n );\n }\n // Further, only allow dragging if the dragged node will have a unique\n // name among its new siblings.\n let hasSiblingNameConflict;\n const dragNodeName = dragNode.name;\n if (!dropNodeIsLevelZero && dropToGap) {\n hasSiblingNameConflict = dropParentNode.children\n .find(c => c !== dragNode && c.name === dragNodeName);\n } else if (!dropToGap) {\n hasSiblingNameConflict = dropNode.children\n .find(c => c !== dragNode && c.name === dragNodeName);\n } else {\n hasSiblingNameConflict = additionalCellSets.tree\n .find(lzn => lzn !== dragNode && lzn.name === dragNodeName);\n }\n\n if (hasSiblingNameConflict) {\n return;\n }\n\n // Remove the dragged object from its current position.\n // Recursively check whether each node path\n // matches the path of the node to delete.\n // If so, return null, and then always use\n // .filter(Boolean) to eliminate any null array elements.\n const nextAdditionalCellSets = {\n ...additionalCellSets,\n tree: additionalCellSets.tree.map(lzn => filterNode(lzn, [], dragPath)).filter(Boolean),\n };\n\n // Update index values after temporarily removing the dragged node.\n // Names are unique as children of their parents.\n if (!dropNodeIsLevelZero) {\n dropNodeCurrIndex = dropParentNode.children.findIndex(c => c.name === dropNode.name);\n } else {\n dropNodeCurrIndex = nextAdditionalCellSets.tree.findIndex(\n lzn => lzn.name === dropNode.name,\n );\n }\n let newDragPath = [];\n if (!dropToGap || !dropNodeIsLevelZero) {\n let addChildFunction;\n let checkPathFunction;\n const newPath = [];\n if (!dropToGap) {\n // Append the dragNode to dropNode's children if dropping _onto_ the dropNode.\n // Set dragNode as the last child of dropNode.\n addChildFunction = n => nodeAppendChild(n, dragNode);\n checkPathFunction = path => isEqual(path, dropPath);\n } else if (!dropNodeIsLevelZero) {\n // Prepend or insert the dragNode if dropping _between_ (above or below dropNode).\n // The dropNode is at a level greater than zero,\n // so it has a parent.\n checkPathFunction = path => isEqual(path, dropParentPath);\n if (dropPosition === -1) {\n // Set dragNode as first child of dropParentNode.\n addChildFunction = n => nodePrependChild(n, dragNode);\n } else {\n // Set dragNode before or after dropNode.\n const insertIndex = dropNodeCurrIndex + (dropPosition > dropNodeCurrIndex ? 1 : 0);\n addChildFunction = n => nodeInsertChild(n, dragNode, insertIndex);\n }\n }\n nextAdditionalCellSets.tree = nextAdditionalCellSets.tree.map(\n node => nodeTransform(\n node,\n (n, path) => checkPathFunction(path),\n (n) => {\n const newNode = addChildFunction(n);\n return newNode;\n },\n newPath,\n ),\n );\n // Done\n setAdditionalCellSets(nextAdditionalCellSets);\n newDragPath = [...newPath[0], dragNode.name];\n setCellSetSelection([newDragPath]);\n } else if (dropPosition === -1) {\n // We need to drop the dragNode to level zero,\n // and level zero nodes do not have parents.\n // Set dragNode as first level zero node of the tree.\n nextAdditionalCellSets.tree.unshift(dragNode);\n setAdditionalCellSets(nextAdditionalCellSets);\n newDragPath = [dragNode.name];\n setCellSetSelection([newDragPath]);\n } else {\n // Set dragNode before or after dropNode in level zero.\n const insertIndex = dropNodeCurrIndex + (dropPosition > dropNodeCurrIndex ? 1 : 0);\n const newLevelZero = Array.from(nextAdditionalCellSets.tree);\n newLevelZero.splice(insertIndex, 0, dragNode);\n nextAdditionalCellSets.tree = newLevelZero;\n setAdditionalCellSets(nextAdditionalCellSets);\n newDragPath = [dragNode.name];\n setCellSetSelection([newDragPath]);\n }\n const oldColors = cellSetColor.filter(\n i => isEqualOrPrefix(dragPath, i.path),\n );\n const newColors = oldColors.map(\n i => (\n {\n ...i,\n path: !isEqual(i.path, dragPath)\n ? newDragPath.concat(i.path.slice(dragPath.length))\n : newDragPath,\n }\n ),\n );\n const newCellSetColor = cellSetColor.filter(\n i => !isEqualOrPrefix(dragPath, i.path),\n );\n newCellSetColor.push(...newColors);\n setCellSetColor(newCellSetColor);\n }\n\n // The user wants to change the color of a cell set node.\n function onNodeSetColor(targetPath, color) {\n // Replace the color if an array element for this path already exists.\n const prevNodeColor = cellSetColor?.find(d => isEqual(d.path, targetPath));\n if (!prevNodeColor) {\n setCellSetColor([\n ...(cellSetColor || []),\n {\n path: targetPath,\n color,\n },\n ]);\n } else {\n setCellSetColor([\n ...cellSetColor.filter(d => !isEqual(d.path, targetPath)),\n {\n path: targetPath,\n color,\n },\n ]);\n }\n }\n\n // The user wants to change the name of a cell set node.\n function onNodeSetName(targetPath, name) {\n const nextNamePath = [...targetPath];\n nextNamePath.pop();\n nextNamePath.push(name);\n\n // Recursively check whether each node path\n // matches the path or a prefix of the path of the node to rename.\n // If so, rename the node using the new path.\n function renameNode(node, prevPath) {\n if (isEqual([...prevPath, node.name], targetPath)) {\n return {\n ...node,\n name,\n };\n }\n if (!node.children) {\n return node;\n }\n return {\n ...node,\n children: node.children.map(c => renameNode(c, [...prevPath, node.name])),\n };\n }\n const nextAdditionalCellSets = {\n ...additionalCellSets,\n tree: additionalCellSets.tree.map(lzn => renameNode(lzn, [])),\n };\n // Change all paths that have this node as a prefix (i.e. descendants).\n const nextCellSetColor = cellSetColor.map(d => ({\n path: tryRenamePath(targetPath, d.path, nextNamePath),\n color: d.color,\n }));\n const nextCellSetSelection = cellSetSelection.map(d => (\n tryRenamePath(targetPath, d, nextNamePath)\n ));\n const nextCellSetExpansion = cellSetExpansion.map(d => (\n tryRenamePath(targetPath, d, nextNamePath)\n ));\n // Need to update the node path everywhere it may be present.\n setAdditionalCellSets(nextAdditionalCellSets);\n setCellSetColor(nextCellSetColor);\n setCellSetSelection(nextCellSetSelection);\n setCellSetExpansion(nextCellSetExpansion);\n }\n\n // Each time the user types while renaming a cell set node,\n // we need to check whether the potential new name conflicts\n // with any existing cell set node names.\n // If there are conflicts, we want to disable the \"Save\" button.\n function onNodeCheckNewName(targetPath, name) {\n const nextNamePath = [...targetPath];\n nextNamePath.pop();\n nextNamePath.push(name);\n const hasConflicts = (\n !isEqual(targetPath, nextNamePath)\n && treeFindNodeByNamePath(additionalCellSets, nextNamePath)\n );\n return hasConflicts;\n }\n\n // The user wants to delete a cell set node, and has confirmed their choice.\n function onNodeRemove(targetPath) {\n // Recursively check whether each node path\n // matches the path of the node to delete.\n // If so, return null, and then always use\n // .filter(Boolean) to eliminate any null array elements.\n const nextAdditionalCellSets = {\n ...additionalCellSets,\n tree: additionalCellSets.tree.map(lzn => filterNode(lzn, [], targetPath)).filter(Boolean),\n };\n // Delete state for all paths that have this node\n // path as a prefix (i.e. delete all descendents).\n const nextCellSetColor = cellSetColor.filter(d => !isEqualOrPrefix(targetPath, d.path));\n const nextCellSetSelection = cellSetSelection.filter(d => !isEqualOrPrefix(targetPath, d));\n const nextCellSetExpansion = cellSetExpansion.filter(d => !isEqualOrPrefix(targetPath, d));\n setAdditionalCellSets(nextAdditionalCellSets);\n setCellSetColor(nextCellSetColor);\n setCellSetSelection(nextCellSetSelection);\n setCellSetExpansion(nextCellSetExpansion);\n }\n\n // The user wants to view (i.e. select) a particular node,\n // or its expanded descendents.\n function onNodeView(targetPath) {\n // If parent node is clicked, and if it is expanded,\n // then select the expanded descendent nodes.\n const setsToView = [];\n // Recursively determine which descendent nodes are currently expanded.\n function viewNode(node, nodePath) {\n if (cellSetExpansion.find(expandedPath => isEqual(nodePath, expandedPath))) {\n if (node.children) {\n node.children.forEach((c) => {\n viewNode(c, [...nodePath, c.name]);\n });\n } else {\n setsToView.push(nodePath);\n }\n } else {\n setsToView.push(nodePath);\n }\n }\n const targetNode = treeFindNodeByNamePath(mergedCellSets, targetPath);\n viewNode(targetNode, targetPath);\n setCellSetSelection(setsToView);\n setCellSetColorEncoding();\n }\n\n // The user wants to create a new level zero node.\n function onCreateLevelZeroNode() {\n const nextName = getNextNumberedNodeName(additionalCellSets?.tree, 'My hierarchy ');\n setAdditionalCellSets({\n ...(additionalCellSets || treeInitialize(SETS_DATATYPE_CELL)),\n tree: [\n ...(additionalCellSets ? additionalCellSets.tree : []),\n {\n name: nextName,\n children: [],\n },\n ],\n });\n }\n\n // The user wants to create a new node corresponding to\n // the union of the selected sets.\n function onUnion() {\n const newSet = treeToUnion(mergedCellSets, cellSetSelection);\n setCellSelection(\n newSet, additionalCellSets, cellSetColor,\n setCellSetSelection, setAdditionalCellSets, setCellSetColor,\n setCellColorEncoding,\n 'Union ',\n );\n }\n\n // The user wants to create a new node corresponding to\n // the intersection of the selected sets.\n function onIntersection() {\n const newSet = treeToIntersection(mergedCellSets, cellSetSelection);\n setCellSelection(\n newSet, additionalCellSets, cellSetColor,\n setCellSetSelection, setAdditionalCellSets, setCellSetColor,\n setCellColorEncoding,\n 'Intersection ',\n );\n }\n\n // The user wants to create a new node corresponding to\n // the complement of the selected sets.\n function onComplement() {\n const newSet = treeToComplement(mergedCellSets, cellSetSelection, allCellIds);\n setCellSelection(\n newSet, additionalCellSets, cellSetColor,\n setCellSetSelection, setAdditionalCellSets, setCellSetColor,\n setCellColorEncoding,\n 'Complement ',\n );\n }\n\n // The user wants to import a cell set hierarchy,\n // probably from a CSV or JSON file.\n function onImportTree(treeToImport) {\n // Check for any naming conflicts with the current sets\n // (both user-defined and dataset-defined) before importing.\n const hasConflict = treesConflict(mergedCellSets, treeToImport);\n if (!hasConflict) {\n setAdditionalCellSets({\n ...(additionalCellSets || treeInitialize(SETS_DATATYPE_CELL)),\n tree: [\n ...(additionalCellSets ? additionalCellSets.tree : []),\n ...treeToImport.tree,\n ],\n });\n // Automatically initialize set colors for the imported sets.\n const importAutoSetColors = initializeCellSetColor(treeToImport, cellSetColor);\n setCellSetColor([\n ...cellSetColor,\n ...importAutoSetColors,\n ]);\n }\n }\n\n // The user wants to download a particular hierarchy to a JSON file.\n function onExportLevelZeroNodeJSON(nodePath) {\n const {\n treeToExport, nodeName,\n } = treeExportLevelZeroNode(mergedCellSets, nodePath, SETS_DATATYPE_CELL, cellSetColor, theme);\n downloadForUser(\n handleExportJSON(treeToExport),\n `${nodeName}_${packageJson.name}-${SETS_DATATYPE_CELL}-hierarchy.${FILE_EXTENSION_JSON}`,\n );\n }\n\n // The user wants to download a particular hierarchy to a CSV file.\n function onExportLevelZeroNodeTabular(nodePath) {\n const {\n treeToExport, nodeName,\n } = treeExportLevelZeroNode(mergedCellSets, nodePath, SETS_DATATYPE_CELL, cellSetColor, theme);\n downloadForUser(\n handleExportTabular(treeToExport),\n `${nodeName}_${packageJson.name}-${SETS_DATATYPE_CELL}-hierarchy.${FILE_EXTENSION_TABULAR}`,\n );\n }\n\n // The user wants to download a particular set to a JSON file.\n function onExportSetJSON(nodePath) {\n const { setToExport, nodeName } = treeExportSet(mergedCellSets, nodePath);\n downloadForUser(\n handleExportJSON(setToExport),\n `${nodeName}_${packageJson.name}-${SETS_DATATYPE_CELL}-set.${FILE_EXTENSION_JSON}`,\n FILE_EXTENSION_JSON,\n );\n }\n return (\n <TitleInfo\n title={title}\n isScroll\n removeGridComponent={removeGridComponent}\n urls={urls}\n theme={theme}\n isReady={isReady}\n >\n <SetsManager\n setColor={cellSetColor}\n sets={cellSets}\n additionalSets={additionalCellSets}\n levelSelection={checkedLevel}\n setSelection={cellSetSelection}\n setExpansion={cellSetExpansion}\n hasColorEncoding={cellColorEncoding === 'cellSetSelection'}\n draggable\n datatype={SETS_DATATYPE_CELL}\n onError={setWarning}\n onCheckNode={onCheckNode}\n onExpandNode={onExpandNode}\n onDropNode={onDropNode}\n onCheckLevel={onCheckLevel}\n onNodeSetColor={onNodeSetColor}\n onNodeSetName={onNodeSetName}\n onNodeCheckNewName={onNodeCheckNewName}\n onNodeRemove={onNodeRemove}\n onNodeView={onNodeView}\n onImportTree={onImportTree}\n onCreateLevelZeroNode={onCreateLevelZeroNode}\n onExportLevelZeroNodeJSON={onExportLevelZeroNodeJSON}\n onExportLevelZeroNodeTabular={onExportLevelZeroNodeTabular}\n onExportSetJSON={onExportSetJSON}\n onUnion={onUnion}\n onIntersection={onIntersection}\n onComplement={onComplement}\n hasCheckedSetsToUnion={cellSetSelection?.length > 1}\n hasCheckedSetsToIntersect={cellSetSelection?.length > 1}\n hasCheckedSetsToComplement={cellSetSelection?.length > 0}\n theme={theme}\n />\n </TitleInfo>\n );\n}\n","/* eslint-disable no-nested-ternary */\n/* eslint-disable no-param-reassign */\nimport { treeToCellColorsBySetNames } from './sets/cell-set-utils';\n\n// The functions defined here have been adapted from d3-interpolate,\n// d3-color, and d3-scale-chromatic.\n// Color string \"rgb(r,g,b)\" representations are replaced by color array [r, g, b]\n// representations, to allow them to work nicely with deck.gl,\n// without the need to converting back and forth between string and array formats.\n\n// Reference: https://github.com/d3/d3-scale-chromatic/blob/431d21da776f97c632f53a855bd822edfbbcd56e/src/diverging/RdBu.js\n// eslint-disable-next-line max-len\nconst schemeRdBu = [[103, 0, 31], [178, 24, 43], [214, 96, 77], [244, 165, 130], [253, 219, 199], [247, 247, 247], [209, 229, 240], [146, 197, 222], [67, 147, 195], [33, 102, 172], [5, 48, 97]];\n// eslint-disable-next-line max-len\nconst schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [25, 6, 140], [27, 6, 141], [29, 6, 142], [32, 6, 143], [34, 6, 144], [36, 6, 145], [38, 5, 145], [40, 5, 146], [42, 5, 147], [44, 5, 148], [46, 5, 149], [47, 5, 150], [49, 5, 151], [51, 5, 151], [53, 4, 152], [55, 4, 153], [56, 4, 154], [58, 4, 154], [60, 4, 155], [62, 4, 156], [63, 4, 156], [65, 4, 157], [67, 3, 158], [68, 3, 158], [70, 3, 159], [72, 3, 159], [73, 3, 160], [75, 3, 161], [76, 2, 161], [78, 2, 162], [80, 2, 162], [81, 2, 163], [83, 2, 163], [85, 2, 164], [86, 1, 164], [88, 1, 164], [89, 1, 165], [91, 1, 165], [92, 1, 166], [94, 1, 166], [96, 1, 166], [97, 0, 167], [99, 0, 167], [100, 0, 167], [102, 0, 167], [103, 0, 168], [105, 0, 168], [106, 0, 168], [108, 0, 168], [110, 0, 168], [111, 0, 168], [113, 0, 168], [114, 1, 168], [116, 1, 168], [117, 1, 168], [119, 1, 168], [120, 1, 168], [122, 2, 168], [123, 2, 168], [125, 3, 168], [126, 3, 168], [128, 4, 168], [129, 4, 167], [131, 5, 167], [132, 5, 167], [134, 6, 166], [135, 7, 166], [136, 8, 166], [138, 9, 165], [139, 10, 165], [141, 11, 165], [142, 12, 164], [143, 13, 164], [145, 14, 163], [146, 15, 163], [148, 16, 162], [149, 17, 161], [150, 19, 161], [152, 20, 160], [153, 21, 159], [154, 22, 159], [156, 23, 158], [157, 24, 157], [158, 25, 157], [160, 26, 156], [161, 27, 155], [162, 29, 154], [163, 30, 154], [165, 31, 153], [166, 32, 152], [167, 33, 151], [168, 34, 150], [170, 35, 149], [171, 36, 148], [172, 38, 148], [173, 39, 147], [174, 40, 146], [176, 41, 145], [177, 42, 144], [178, 43, 143], [179, 44, 142], [180, 46, 141], [181, 47, 140], [182, 48, 139], [183, 49, 138], [184, 50, 137], [186, 51, 136], [187, 52, 136], [188, 53, 135], [189, 55, 134], [190, 56, 133], [191, 57, 132], [192, 58, 131], [193, 59, 130], [194, 60, 129], [195, 61, 128], [196, 62, 127], [197, 64, 126], [198, 65, 125], [199, 66, 124], [200, 67, 123], [201, 68, 122], [202, 69, 122], [203, 70, 121], [204, 71, 120], [204, 73, 119], [205, 74, 118], [206, 75, 117], [207, 76, 116], [208, 77, 115], [209, 78, 114], [210, 79, 113], [211, 81, 113], [212, 82, 112], [213, 83, 111], [213, 84, 110], [214, 85, 109], [215, 86, 108], [216, 87, 107], [217, 88, 106], [218, 90, 106], [218, 91, 105], [219, 92, 104], [220, 93, 103], [221, 94, 102], [222, 95, 101], [222, 97, 100], [223, 98, 99], [224, 99, 99], [225, 100, 98], [226, 101, 97], [226, 102, 96], [227, 104, 95], [228, 105, 94], [229, 106, 93], [229, 107, 93], [230, 108, 92], [231, 110, 91], [231, 111, 90], [232, 112, 89], [233, 113, 88], [233, 114, 87], [234, 116, 87], [235, 117, 86], [235, 118, 85], [236, 119, 84], [237, 121, 83], [237, 122, 82], [238, 123, 81], [239, 124, 81], [239, 126, 80], [240, 127, 79], [240, 128, 78], [241, 129, 77], [241, 131, 76], [242, 132, 75], [243, 133, 75], [243, 135, 74], [244, 136, 73], [244, 137, 72], [245, 139, 71], [245, 140, 70], [246, 141, 69], [246, 143, 68], [247, 144, 68], [247, 145, 67], [247, 147, 66], [248, 148, 65], [248, 149, 64], [249, 151, 63], [249, 152, 62], [249, 154, 62], [250, 155, 61], [250, 156, 60], [250, 158, 59], [251, 159, 58], [251, 161, 57], [251, 162, 56], [252, 163, 56], [252, 165, 55], [252, 166, 54], [252, 168, 53], [252, 169, 52], [253, 171, 51], [253, 172, 51], [253, 174, 50], [253, 175, 49], [253, 177, 48], [253, 178, 47], [253, 180, 47], [253, 181, 46], [254, 183, 45], [254, 184, 44], [254, 186, 44], [254, 187, 43], [254, 189, 42], [254, 190, 42], [254, 192, 41], [253, 194, 41], [253, 195, 40], [253, 197, 39], [253, 198, 39], [253, 200, 39], [253, 202, 38], [253, 203, 38], [252, 205, 37], [252, 206, 37], [252, 208, 37], [252, 210, 37], [251, 211, 36], [251, 213, 36], [251, 215, 36], [250, 216, 36], [250, 218, 36], [249, 220, 36], [249, 221, 37], [248, 223, 37], [248, 225, 37], [247, 226, 37], [247, 228, 37], [246, 230, 38], [246, 232, 38], [245, 233, 38], [245, 235, 39], [244, 237, 39], [243, 238, 39], [243, 240, 39], [242, 242, 39], [241, 244, 38], [241, 245, 37], [240, 247, 36], [240, 249, 33]];\n\n// Reference: https://github.com/d3/d3-interpolate/blob/96d54051d1c2fec55f240edd0ec5401715b10390/src/rgb.js\nfunction rgbSpline(spline) {\n return (colors) => {\n const n = colors.length;\n let r = new Array(n);\n let g = new Array(n);\n let b = new Array(n);\n let i; let\n color;\n // eslint-disable-next-line no-plusplus\n for (i = 0; i < n; ++i) {\n color = [colors[i][0], colors[i][1], colors[i][2]];\n r[i] = color[0] || 0;\n g[i] = color[1] || 0;\n b[i] = color[2] || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n return t => [r(t), g(t), b(t)];\n };\n}\n\n// Reference: https://github.com/d3/d3-interpolate/blob/594a32af1fe1118812b439012c2cb742e907c0c0/src/basis.js\nfunction basis(values) {\n function innerBasis(t1, v0, v1, v2, v3) {\n const t2 = t1 * t1; const\n t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n }\n\n const n = values.length - 1;\n return (t) => {\n const i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n);\n const v1 = values[i];\n const v2 = values[i + 1];\n const v0 = i > 0 ? values[i - 1] : 2 * v1 - v2;\n const v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return innerBasis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n\n\n// Reference: https://github.com/d3/d3-scale-chromatic/blob/ade54c13e8dfdb9807801a794eaec1a37f926b8a/src/ramp.js\nconst interpolateRgbBasis = rgbSpline(basis);\n\nfunction interpolateSequentialMulti(range) {\n const n = range.length;\n return t => range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n}\n\nexport const interpolateRdBu = interpolateRgbBasis(schemeRdBu);\nexport const interpolatePlasma = interpolateSequentialMulti(schemePlasma);\n\n\n/**\n * Get a mapping of cell IDs to cell colors based on\n * gene / cell set selection coordination state.\n * @param {object} params\n * @param {object} params.expressionMatrix { rows, cols, matrix }\n * @param {array} params.geneSelection Array of selected gene IDs.\n * @param {object} params.cellSets The cell sets tree.\n * @param {object} params.cellSetSelection Selected cell sets.\n * @param {string} params.cellColorEncoding Which to use for\n * coloring: gene expression or cell sets?\n * @returns {Map} Mapping from cell IDs to [r, g, b] color arrays.\n */\nexport function getCellColors(params) {\n const {\n cellColorEncoding,\n expressionData,\n cellSets, cellSetSelection,\n cellSetColor,\n expressionDataAttrs,\n theme,\n } = params;\n if (cellColorEncoding === 'geneSelection' && expressionData && expressionDataAttrs) {\n // TODO: allow other color maps.\n const geneExpColormap = interpolatePlasma;\n const colors = new Map();\n for (let i = 0; i < expressionData.length; i += 1) {\n const value = expressionData[i];\n const cellColor = geneExpColormap(value / 255);\n colors.set(expressionDataAttrs.rows[i], cellColor);\n }\n return colors;\n } if (cellColorEncoding === 'cellSetSelection' && cellSetSelection && cellSets) {\n // Cell sets can potentially lack set colors since the color property\n // is not a required part of the schema.\n // The `initializeSets` function fills in any empty colors\n // with defaults and returns the processed tree object.\n return treeToCellColorsBySetNames(cellSets, cellSetSelection, cellSetColor, theme);\n }\n return new Map();\n}\n","/* eslint-disable import/no-extraneous-dependencies */\n/* eslint-disable no-underscore-dangle */\n// File adopted from nebula.gl's SelectionLayer\n// https://github.com/uber/nebula.gl/blob/8e9c2ec8d7cf4ca7050909ed826eb847d5e2cd9c/modules/layers/src/layers/selection-layer.js\nimport { CompositeLayer } from 'deck.gl';\nimport { polygon as turfPolygon, point as turfPoint } from '@turf/helpers';\nimport booleanWithin from '@turf/boolean-within';\nimport booleanContains from '@turf/boolean-contains';\nimport booleanOverlap from '@turf/boolean-overlap';\nimport booleanPointInPolygon from '@turf/boolean-point-in-polygon';\nimport { ScatterplotLayer } from '@deck.gl/layers';\nimport { SELECTION_TYPE } from 'nebula.gl';\nimport { EditableGeoJsonLayer } from '@nebula.gl/layers';\nimport { DrawRectangleMode, DrawPolygonByDraggingMode, ViewMode } from '@nebula.gl/edit-modes';\n\nconst EDIT_TYPE_ADD = 'addFeature';\nconst EDIT_TYPE_CLEAR = 'clearFeatures';\n\n// Customize the click handlers for the rectangle and polygon tools,\n// so that clicking triggers the `onEdit` callback.\nclass ClickableDrawRectangleMode extends DrawRectangleMode {\n // eslint-disable-next-line class-methods-use-this\n handleClick(event, props) {\n props.onEdit({ editType: EDIT_TYPE_CLEAR });\n }\n}\n\nclass ClickableDrawPolygonByDraggingMode extends DrawPolygonByDraggingMode {\n // eslint-disable-next-line class-methods-use-this\n handleClick(event, props) {\n props.onEdit({ editType: EDIT_TYPE_CLEAR });\n }\n}\n\nconst MODE_MAP = {\n [SELECTION_TYPE.RECTANGLE]: ClickableDrawRectangleMode,\n [SELECTION_TYPE.POLYGON]: ClickableDrawPolygonByDraggingMode,\n};\n\nconst defaultProps = {\n selectionType: SELECTION_TYPE.RECTANGLE,\n layerIds: [],\n onSelect: () => {},\n};\n\nconst EMPTY_DATA = {\n type: 'FeatureCollection',\n features: [],\n};\n\nconst LAYER_ID_GEOJSON = 'selection-geojson';\n\nconst PASS_THROUGH_PROPS = [\n 'lineWidthScale',\n 'lineWidthMinPixels',\n 'lineWidthMaxPixels',\n 'lineWidthUnits',\n 'lineJointRounded',\n 'lineMiterLimit',\n 'pointRadiusScale',\n 'pointRadiusMinPixels',\n 'pointRadiusMaxPixels',\n 'lineDashJustified',\n 'getLineColor',\n 'getFillColor',\n 'getRadius',\n 'getLineWidth',\n 'getLineDashArray',\n 'getTentativeLineDashArray',\n 'getTentativeLineColor',\n 'getTentativeFillColor',\n 'getTentativeLineWidth',\n 'editHandlePointRadiusScale',\n 'editHandlePointRadiusMinPixels',\n 'editHandlePointRadiusMaxPixels',\n 'getEditHandlePointColor',\n 'getEditHandlePointRadius',\n 'modeHandlers',\n];\n\nexport default class SelectionLayer extends CompositeLayer {\n _selectPolygonObjects(coordinates) {\n const {\n onSelect,\n getCellCoords,\n cellsQuadTree,\n flipY,\n } = this.props;\n\n const flippedCoordinates = (flipY\n ? coordinates.map(poly => poly.map(p => ([p[0], -p[1]])))\n : coordinates);\n\n // Convert the selection to a turf polygon object.\n const selectedPolygon = turfPolygon(flippedCoordinates);\n\n // Create an array to store the results.\n const pickingInfos = [];\n\n // quadtree.visit() takes a callback that returns a boolean:\n // If true returned, then the children of the node are _not_ visited.\n // If false returned, then the children of the node are visited.\n // Reference: https://github.com/d3/d3-quadtree#quadtree_visit\n cellsQuadTree.visit((node, x0, y0, x1, y1) => {\n const nodePoints = [[[x0, y0], [x1, y0], [x1, y1], [x0, y1], [x0, y0]]];\n const nodePolygon = turfPolygon(nodePoints);\n\n const nodePolygonContainsSelectedPolygon = booleanContains(nodePolygon, selectedPolygon);\n const nodePolygonWithinSelectedPolygon = booleanWithin(nodePolygon, selectedPolygon);\n const nodePolygonOverlapsSelectedPolgyon = booleanOverlap(nodePolygon, selectedPolygon);\n\n if (!nodePolygonContainsSelectedPolygon\n && !nodePolygonWithinSelectedPolygon\n && !nodePolygonOverlapsSelectedPolgyon) {\n // We are not interested in anything below this node,\n // so return true because we are done with this node.\n return true;\n }\n\n // This node made it past the above return statement, so it must either\n // contain, be within, or overlap with the selected polygon.\n\n // Check if this is a leaf node.\n if (node.data\n && booleanPointInPolygon(\n turfPoint([].slice.call(getCellCoords(node.data[1]))), selectedPolygon,\n )\n ) {\n // This node has data, so it is a leaf node representing one data point,\n // and we have verified that the point is in the selected polygon.\n pickingInfos.push(node.data);\n }\n\n // Return false because we are not done.\n // We want to visit the children of this node.\n return false;\n });\n\n onSelect({ pickingInfos });\n }\n\n renderLayers() {\n const { onSelect } = this.props;\n const mode = MODE_MAP[this.props.selectionType] || ViewMode;\n\n const inheritedProps = {};\n PASS_THROUGH_PROPS.forEach((p) => {\n if (this.props[p] !== undefined) inheritedProps[p] = this.props[p];\n });\n const layers = [\n new EditableGeoJsonLayer(\n this.getSubLayerProps({\n id: LAYER_ID_GEOJSON,\n pickable: true,\n mode,\n modeConfig: {\n dragToDraw: true,\n },\n selectedFeatureIndexes: [],\n data: EMPTY_DATA,\n onEdit: ({ updatedData, editType }) => {\n if (editType === EDIT_TYPE_ADD) {\n const { coordinates } = updatedData.features[0].geometry;\n this._selectPolygonObjects(coordinates);\n } else if (editType === EDIT_TYPE_CLEAR) {\n // We want to select an empty array to clear any previous selection.\n onSelect({ pickingInfos: [] });\n }\n },\n _subLayerProps: {\n guides: {\n pointType: 'circle',\n _subLayerProps: {\n 'points-circle': {\n // Styling for editHandles goes here.\n // Reference: https://github.com/uber/nebula.gl/issues/618#issuecomment-898466319\n type: ScatterplotLayer,\n radiusScale: 1,\n stroked: true,\n getLineWidth: 1,\n radiusMinPixels: 1,\n radiusMaxPixels: 3,\n getRadius: 2,\n },\n },\n },\n },\n ...inheritedProps,\n }),\n ),\n ];\n\n return layers;\n }\n}\n\nSelectionLayer.layerName = 'SelectionLayer';\nSelectionLayer.defaultProps = defaultProps;\n","import { COORDINATE_SYSTEM } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { DataFilterExtension } from '@deck.gl/extensions'; // eslint-disable-line import/no-extraneous-dependencies\nimport SelectionLayer from './SelectionLayer';\n\n/**\n * Convert a DeckGL layer ID to a \"base\" layer ID for selection.\n * @param {string} layerId The layer ID to convert.\n * @returns {string} The base layer ID.\n */\nfunction getBaseLayerId(layerId) {\n return `base-${layerId}`;\n}\n\n/**\n * Convert a DeckGL layer ID to a \"selected\" layer ID for selection.\n * @param {string} layerId The layer ID to convert.\n * @returns {string} The base layer ID.\n */\nfunction getSelectedLayerId(layerId) {\n return `selected-${layerId}`;\n}\n\n/**\n * Construct DeckGL selection layers.\n * @param {string} tool\n * @param {number} zoom\n * @param {string} cellBaseLayerId\n * @param {function} getCellCoords\n * @param {function} updateCellsSelection\n * @returns {object[]} The array of DeckGL selection layers.\n */\nexport function getSelectionLayers(\n tool,\n zoom,\n layerId,\n getCellCoords,\n updateCellsSelection,\n cellsQuadTree,\n flipY = false,\n) {\n if (!tool) {\n return [];\n }\n\n const cellBaseLayerId = getBaseLayerId(layerId);\n const editHandlePointRadius = 5 / (zoom + 16);\n\n return [new SelectionLayer({\n id: 'selection',\n flipY,\n cellsQuadTree,\n getCellCoords,\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n selectionType: tool,\n onSelect: ({ pickingInfos }) => {\n const cellIds = pickingInfos.map(cellObj => cellObj[0]);\n if (updateCellsSelection) {\n updateCellsSelection(cellIds);\n }\n },\n layerIds: [cellBaseLayerId],\n getTentativeFillColor: () => [255, 255, 255, 95],\n getTentativeLineColor: () => [143, 143, 143, 255],\n getTentativeLineDashArray: () => [7, 4],\n lineWidthMinPixels: 2,\n lineWidthMaxPixels: 2,\n getEditHandlePointColor: () => [0xff, 0xff, 0xff, 0xff],\n getEditHandlePointRadius: () => editHandlePointRadius,\n editHandlePointRadiusScale: 1,\n editHandlePointRadiusMinPixels: editHandlePointRadius,\n editHandlePointRadiusMaxPixels: 2 * editHandlePointRadius,\n })];\n}\n\n/**\n * Get deck.gl layer props for selection overlays.\n * @param {object} props\n * @returns {object} Object with two properties,\n * overlay: overlayProps, base: baseProps,\n * where the values are deck.gl layer props.\n */\nexport function overlayBaseProps(props) {\n const {\n id, getColor, data, isSelected, ...rest\n } = props;\n return {\n overlay: {\n id: getSelectedLayerId(id),\n getFillColor: getColor,\n getLineColor: getColor,\n data,\n getFilterValue: isSelected,\n extensions: [new DataFilterExtension({ filterSize: 1 })],\n filterRange: [1, 1],\n ...rest,\n },\n base: {\n id: getBaseLayerId(id),\n getLineColor: getColor,\n getFillColor: getColor,\n // Alternatively: contrast outlines with solids:\n // getLineColor: getColor,\n // getFillColor: [255, 255, 255],\n data: data.slice(),\n ...rest,\n },\n };\n}\n","import GL from '@luma.gl/constants'; // eslint-disable-line import/no-extraneous-dependencies\n\nexport const TILE_SIZE = 2048;\nexport const MIN_ROW_AGG = 1;\nexport const MAX_ROW_AGG = 16;\n\nexport const COLOR_BAR_SIZE = 20;\nexport const AXIS_LABEL_TEXT_SIZE = 9;\nexport const AXIS_TITLE_TEXT_SIZE = 15;\nexport const AXIS_MIN_SIZE = 10;\nexport const AXIS_MAX_SIZE = 90;\nexport const AXIS_MARGIN = 3;\nexport const THEME_TO_TEXT_COLOR = {\n dark: [224, 224, 224],\n light: [64, 64, 64],\n};\nexport const AXIS_FONT_FAMILY = \"-apple-system, 'Helvetica Neue', Arial, sans-serif\";\n\nexport const PIXELATED_TEXTURE_PARAMETERS = {\n // NEAREST for integer data to prevent interpolation.\n [GL.TEXTURE_MIN_FILTER]: GL.NEAREST,\n [GL.TEXTURE_MAG_FILTER]: GL.NEAREST,\n // CLAMP_TO_EDGE to remove tile artifacts.\n [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,\n};\n","import glsl from 'glslify';\n\n/**\n * No change to the vertex shader from the base BitmapLayer.\n * Reference: https://github.com/visgl/deck.gl/blob/8.2-release/modules/layers/src/bitmap-layer/bitmap-layer-vertex.js\n */\nexport const vertexShader = glsl`\n#define SHADER_NAME heatmap-bitmap-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\n\nvarying vec2 vTexCoord;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = pickingColor;\n\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vTexCoord = texCoords;\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n`;\n\n/**\n * Fragment shader adapted to perform aggregation and\n * take color scale functions + sliders into account.\n * Reference: https://github.com/visgl/deck.gl/blob/8.2-release/modules/layers/src/bitmap-layer/bitmap-layer-fragment.js\n * Reference: https://github.com/hms-dbmi/viv/blob/06231ae02cac1ff57ba458c71e9bc59ed2fc4f8b/src/layers/XRLayer/xr-layer-fragment-colormap.webgl1.glsl\n */\nexport const fragmentShader = glsl`\n#define SHADER_NAME heatmap-bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision mediump float;\n#endif\n\n#pragma glslify: rdbu = require(\"glsl-colormap/rdbu\")\n#pragma glslify: plasma = require(\"glsl-colormap/plasma\")\n#pragma glslify: viridis = require(\"glsl-colormap/viridis\")\n#pragma glslify: greys = require(\"glsl-colormap/greys\")\n#pragma glslify: magma = require(\"glsl-colormap/magma\")\n#pragma glslify: jet = require(\"glsl-colormap/jet\")\n#pragma glslify: bone = require(\"glsl-colormap/bone\")\n#pragma glslify: copper = require(\"glsl-colormap/copper\")\n#pragma glslify: density = require(\"glsl-colormap/density\")\n#pragma glslify: inferno = require(\"glsl-colormap/inferno\")\n#pragma glslify: cool = require(\"glsl-colormap/cool\")\n#pragma glslify: hot = require(\"glsl-colormap/hot\")\n#pragma glslify: spring = require(\"glsl-colormap/spring\")\n#pragma glslify: summer = require(\"glsl-colormap/summer\")\n#pragma glslify: autumn = require(\"glsl-colormap/autumn\")\n#pragma glslify: winter = require(\"glsl-colormap/winter\")\n\n// The texture (GL.LUMINANCE & Uint8Array).\nuniform sampler2D uBitmapTexture;\n\n// What are the dimensions of the texture (width, height)?\nuniform vec2 uTextureSize;\n\n// How many consecutive pixels should be aggregated together along each axis?\nuniform vec2 uAggSize;\n\n// What are the values of the color scale sliders?\nuniform vec2 uColorScaleRange;\n\n// The texture coordinate, varying (interpolated between values set by the vertex shader).\nvarying vec2 vTexCoord;\n\nvoid main(void) {\n // Compute 1 pixel in texture coordinates\n vec2 onePixel = vec2(1.0, 1.0) / uTextureSize;\n \n vec2 viewCoord = vec2(floor(vTexCoord.x * uTextureSize.x), floor(vTexCoord.y * uTextureSize.y));\n\n // Compute (x % aggSizeX, y % aggSizeY).\n // These values will be the number of values to the left / above the current position to consider.\n vec2 modAggSize = vec2(-1.0 * mod(viewCoord.x, uAggSize.x), -1.0 * mod(viewCoord.y, uAggSize.y));\n\n // Take the sum of values along each axis.\n float intensitySum = 0.0;\n vec2 offsetPixels = vec2(0.0, 0.0);\n\n for(int i = 0; i < 16; i++) {\n // Check to break outer loop early.\n // Uniforms cannot be used as conditions in GLSL for loops.\n if(float(i) >= uAggSize.y) {\n // Done in the y direction.\n break;\n }\n\n offsetPixels = vec2(offsetPixels.x, (modAggSize.y + float(i)) * onePixel.y);\n\n for(int j = 0; j < 16; j++) {\n // Check to break inner loop early.\n // Uniforms cannot be used as conditions in GLSL for loops.\n if(float(j) >= uAggSize.x) {\n // Done in the x direction.\n break;\n }\n\n offsetPixels = vec2((modAggSize.x + float(j)) * onePixel.x, offsetPixels.y);\n intensitySum += texture2D(uBitmapTexture, vTexCoord + offsetPixels).r;\n }\n }\n \n // Compute the mean value.\n float intensityMean = intensitySum / (uAggSize.x * uAggSize.y);\n \n // Re-scale using the color scale slider values.\n float scaledIntensityMean = (intensityMean - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));\n\n gl_FragColor = COLORMAP_FUNC(clamp(scaledIntensityMean, 0.0, 1.0));\n\n geometry.uv = vTexCoord;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n`;\n","/* eslint-disable no-underscore-dangle */\nimport GL from '@luma.gl/constants'; // eslint-disable-line import/no-extraneous-dependencies\nimport { _mergeShaders, project32, picking } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { BitmapLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies\nimport { Texture2D } from '@luma.gl/core';\nimport { PIXELATED_TEXTURE_PARAMETERS, TILE_SIZE } from './heatmap-constants';\nimport { GLSL_COLORMAPS, GLSL_COLORMAP_DEFAULT, COLORMAP_SHADER_PLACEHOLDER } from './constants';\nimport { vertexShader, fragmentShader } from './heatmap-bitmap-layer-shaders';\n\nconst defaultProps = {\n image: { type: 'object', value: null, async: true },\n colormap: { type: 'string', value: GLSL_COLORMAP_DEFAULT, compare: true },\n bounds: { type: 'array', value: [1, 0, 0, 1], compare: true },\n aggSizeX: { type: 'number', value: 8.0, compare: true },\n aggSizeY: { type: 'number', value: 8.0, compare: true },\n colorScaleLo: { type: 'number', value: 0.0, compare: true },\n colorScaleHi: { type: 'number', value: 1.0, compare: true },\n};\n\n/**\n * A BitmapLayer that performs aggregation in the fragment shader,\n * and renders its texture from a Uint8Array rather than an ImageData.\n */\nexport default class HeatmapBitmapLayer extends BitmapLayer {\n /**\n * Copy of getShaders from Layer (grandparent, parent of BitmapLayer).\n * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/core/src/lib/layer.js#L302\n * @param {object} shaders\n * @returns {object} Merged shaders.\n */\n _getShaders(shaders) {\n this.props.extensions.forEach((extension) => {\n // eslint-disable-next-line no-param-reassign\n shaders = _mergeShaders(shaders, extension.getShaders.call(this, extension));\n });\n return shaders;\n }\n\n /**\n * Need to override to provide custom shaders.\n */\n getShaders() {\n const { colormap } = this.props;\n const fragmentShaderWithColormap = (GLSL_COLORMAPS.includes(colormap)\n ? fragmentShader.replace(COLORMAP_SHADER_PLACEHOLDER, colormap)\n : fragmentShader.replace(COLORMAP_SHADER_PLACEHOLDER, GLSL_COLORMAP_DEFAULT)\n );\n return this._getShaders({\n vs: vertexShader,\n fs: fragmentShaderWithColormap,\n modules: [project32, picking],\n });\n }\n\n updateState(args) {\n super.updateState(args);\n this.loadTexture(this.props.image);\n const { props, oldProps } = args;\n if (props.colormap !== oldProps.colormap) {\n const { gl } = this.context;\n // eslint-disable-next-line no-unused-expressions\n this.state.model?.delete();\n this.state.model = this._getModel(gl);\n this.getAttributeManager().invalidateAll();\n }\n }\n\n /**\n * Need to override to provide additional uniform values.\n * Simplified by removing video-related code.\n * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/layers/src/bitmap-layer/bitmap-layer.js#L173\n * @param {*} opts\n */\n draw(opts) {\n const { uniforms } = opts;\n const { bitmapTexture, model } = this.state;\n const {\n aggSizeX,\n aggSizeY,\n colorScaleLo,\n colorScaleHi,\n } = this.props;\n\n // Render the image\n if (bitmapTexture && model) {\n model\n .setUniforms(\n Object.assign({}, uniforms, {\n uBitmapTexture: bitmapTexture,\n uTextureSize: [TILE_SIZE, TILE_SIZE],\n uAggSize: [aggSizeX, aggSizeY],\n uColorScaleRange: [colorScaleLo, colorScaleHi],\n }),\n )\n .draw();\n }\n }\n\n /**\n * Need to override to provide the custom DEFAULT_TEXTURE_PARAMETERS\n * object.\n * Simplified by removing video-related code.\n * Reference: https://github.com/visgl/deck.gl/blob/0afd4e99a6199aeec979989e0c361c97e6c17a16/modules/layers/src/bitmap-layer/bitmap-layer.js#L218\n * @param {Uint8Array} image\n */\n loadTexture(image) {\n const { gl } = this.context;\n\n if (this.state.bitmapTexture) {\n this.state.bitmapTexture.delete();\n }\n\n if (image instanceof Texture2D) {\n this.setState({\n bitmapTexture: image,\n });\n } else if (image) {\n this.setState({\n bitmapTexture: new Texture2D(gl, {\n data: image,\n mipmaps: false,\n parameters: PIXELATED_TEXTURE_PARAMETERS,\n // Each color contains a single luminance value.\n // When sampled, rgb are all set to this luminance, alpha is 1.0.\n // Reference: https://luma.gl/docs/api-reference/webgl/texture#texture-formats\n format: GL.LUMINANCE,\n dataFormat: GL.LUMINANCE,\n type: GL.UNSIGNED_BYTE,\n width: TILE_SIZE,\n height: TILE_SIZE,\n }),\n });\n }\n }\n}\nHeatmapBitmapLayer.layerName = 'HeatmapBitmapLayer';\nHeatmapBitmapLayer.defaultProps = defaultProps;\n","import { BitmapLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies\nimport { CompositeLayer } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { PIXELATED_TEXTURE_PARAMETERS } from './heatmap-constants';\n\n\n// These are the same defaultProps as for BitmapLayer.\nconst defaultProps = {\n ...BitmapLayer.defaultProps,\n image: { type: 'object', value: null, async: true },\n bounds: { type: 'array', value: [1, 0, 0, 1], compare: true },\n desaturate: {\n type: 'number', min: 0, max: 1, value: 0,\n },\n transparentColor: { type: 'color', value: [0, 0, 0, 0] },\n tintColor: { type: 'color', value: [255, 255, 255] },\n};\n\nexport default class PixelatedBitmapLayer extends CompositeLayer {\n renderLayers() {\n const { image } = this.props;\n return new BitmapLayer(this.props, {\n id: `${this.props.id}-wrapped`,\n image,\n textureParameters: PIXELATED_TEXTURE_PARAMETERS,\n });\n }\n}\n\nPixelatedBitmapLayer.layerName = 'PixelatedBitmapLayer';\nPixelatedBitmapLayer.defaultProps = defaultProps;\n","/* eslint-disable no-underscore-dangle */\nimport { COORDINATE_SYSTEM, CompositeLayer } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { TextLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies\nimport {\n AXIS_LABEL_TEXT_SIZE,\n AXIS_TITLE_TEXT_SIZE,\n AXIS_MARGIN,\n THEME_TO_TEXT_COLOR,\n AXIS_FONT_FAMILY,\n} from './heatmap-constants';\n\nexport default class HeatmapCompositeTextLayer extends CompositeLayer {\n _renderAxisTopLayers() {\n const {\n axisTopLabelData, matrixLeft, width, matrixWidth, viewWidth, theme,\n targetX, targetY, axisTopTitle, cellWidth, axisOffsetTop, scaleFactor,\n } = this.props;\n const showAxisTopLabels = cellWidth >= AXIS_LABEL_TEXT_SIZE;\n const axisLabelTop = targetY + (axisOffsetTop - AXIS_MARGIN) / 2 / scaleFactor;\n return [\n new TextLayer({\n id: 'axisTopLabels',\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: axisTopLabelData,\n getText: d => d[1],\n getPosition: d => [matrixLeft + ((d[0] + 0.5) / width) * matrixWidth, axisLabelTop],\n getTextAnchor: 'start',\n getColor: () => THEME_TO_TEXT_COLOR[theme],\n getSize: (showAxisTopLabels ? AXIS_LABEL_TEXT_SIZE : 0),\n getAngle: 75,\n fontFamily: AXIS_FONT_FAMILY,\n updateTriggers: {\n getPosition: [axisLabelTop, matrixLeft, matrixWidth, viewWidth],\n getSize: [showAxisTopLabels],\n getColor: [theme],\n },\n }),\n new TextLayer({\n id: 'axisTopTitle',\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: [{ title: axisTopTitle }],\n getText: d => d.title,\n getPosition: [targetX, targetY],\n getTextAnchor: 'middle',\n getColor: () => THEME_TO_TEXT_COLOR[theme],\n getSize: (!showAxisTopLabels ? AXIS_TITLE_TEXT_SIZE : 0),\n getAngle: 0,\n fontFamily: AXIS_FONT_FAMILY,\n updateTriggers: {\n getSize: [showAxisTopLabels],\n getColor: [theme],\n },\n }),\n ];\n }\n\n _renderAxisLeftLayers() {\n const {\n axisLeftLabelData, matrixTop, height, matrixHeight,\n viewHeight, theme, axisLeftTitle, targetX, targetY, cellHeight, axisOffsetLeft,\n scaleFactor,\n } = this.props;\n const showAxisLeftLabels = cellHeight >= AXIS_LABEL_TEXT_SIZE;\n const axisLabelLeft = targetX + (axisOffsetLeft - AXIS_MARGIN) / 2 / scaleFactor;\n return [\n new TextLayer({\n id: 'axisLeftLabels',\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: axisLeftLabelData,\n getText: d => d[1],\n getPosition: d => [axisLabelLeft, matrixTop + ((d[0] + 0.5) / height) * matrixHeight],\n getTextAnchor: 'end',\n getColor: () => THEME_TO_TEXT_COLOR[theme],\n getSize: (showAxisLeftLabels ? AXIS_LABEL_TEXT_SIZE : 0),\n getAngle: 0,\n fontFamily: AXIS_FONT_FAMILY,\n updateTriggers: {\n getPosition: [axisLabelLeft, matrixTop, matrixHeight, viewHeight],\n getSize: [showAxisLeftLabels],\n getColor: [theme],\n },\n }),\n new TextLayer({\n id: 'axisLeftTitle',\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: [{ title: axisLeftTitle }],\n getText: d => d.title,\n getPosition: [targetX, targetY],\n getTextAnchor: 'middle',\n getColor: () => THEME_TO_TEXT_COLOR[theme],\n getSize: (!showAxisLeftLabels ? AXIS_TITLE_TEXT_SIZE : 0),\n getAngle: 90,\n fontFamily: AXIS_FONT_FAMILY,\n updateTriggers: {\n getSize: [showAxisLeftLabels],\n getColor: [theme],\n },\n }),\n ];\n }\n\n renderLayers() {\n return [\n this._renderAxisTopLayers(),\n this._renderAxisLeftLayers(),\n ];\n }\n}\n\nHeatmapCompositeTextLayer.layerName = 'HeatmapCompositeTextLayer';\n","import { quadtree } from 'd3-quadtree';\n\n/**\n * Create a d3-quadtree object for cells data points.\n * @param {array} cellsEntries Array of [cellId, cell] tuples,\n * resulting from running Object.entries on the cells object.\n * @param {function} getCellCoords Given a cell object, return the\n * spatial/scatterplot coordinates [x, y].\n * @returns {object} Quadtree instance.\n */\nexport function createCellsQuadTree(cellsEntries, getCellCoords) {\n // Use the cellsEntries variable since it is already\n // an array, converted by Object.entries().\n // Only use cellsEntries in quadtree calculation if there is\n // centroid data in the cells (i.e not just ids).\n // eslint-disable-next-line no-unused-vars\n if (!cellsEntries || !cellsEntries.length || !getCellCoords(cellsEntries[0][1])) {\n // Abort if the cells data is not yet available.\n return null;\n }\n const tree = quadtree()\n .x(d => getCellCoords(d[1])[0])\n .y(d => getCellCoords(d[1])[1])\n .addAll(cellsEntries);\n return tree;\n}\n","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nvar _ref2 = /*#__PURE__*/React.createElement(\"path\", {\n fill: \"none\",\n d: \"M0 0h24v24H0V0z\"\n});\n\nvar _ref3 = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M21 3L3 10.53v.98l6.84 2.65L12.48 21h.98L21 3z\"\n});\n\nfunction SvgNearMe(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _ref2, _ref3);\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgNearMe, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/near_me.2a308adc.svg\";\nexport { ForwardRef as ReactComponent };","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nvar _ref2 = /*#__PURE__*/React.createElement(\"path\", {\n d: \" M19 19h2v2h-2v-2zm0-2h2v-2h-2v2z M3 13h2v-2H3v2zm0 4h2v-2H3v2z m0-8h2V7H3v2zm0-4h2V3H3v2z m4 0h2V3H7v2zm8 16h2v-2h-2v2z m-4 0h2v-2h-2v2z m4 0h2v-2h-2v2z m-8 0h2v-2H7v2z m-4 0h2v-2H3v2z M11 5h2v-2h-2v2z M15 5h2v-2h-2v2z M19 5h2v-2h-2v2z M19 9h2v-2h-2v2z M19 13h2v-2h-2v2z \"\n});\n\nfunction SvgSelectionRectangle(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, _ref2);\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgSelectionRectangle, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/selection_rectangle.aa477261.svg\";\nexport { ForwardRef as ReactComponent };","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport * as React from \"react\";\n\nfunction SvgSelectionLasso(_ref) {\n var svgRef = _ref.svgRef,\n title = _ref.title,\n titleId = _ref.titleId,\n props = _objectWithoutProperties(_ref, [\"svgRef\", \"title\", \"titleId\"]);\n\n return /*#__PURE__*/React.createElement(\"svg\", _extends({\n width: 24,\n height: 24,\n viewBox: \"0 0 24 24\",\n ref: svgRef,\n \"aria-labelledby\": titleId\n }, props), title ? /*#__PURE__*/React.createElement(\"title\", {\n id: titleId\n }, title) : null, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"translate(0,3)\"\n }, /*#__PURE__*/React.createElement(\"path\", {\n style: {\n strokeWidth: 0.343565\n },\n d: \"M 23.942314,4.6958443 C 23.446206,1.8868581 19.727461,0 14.687364,0 13.437819,0 12.150138,0.11543779 10.859708,0.34287772 4.1629423,1.5250844 -0.58168816,5.2884937 0.05768601,8.911385 c 0.25355086,1.439193 1.35605049,2.63583 3.04638949,3.461072 -0.2569865,0.387198 -0.4074679,0.826617 -0.4074679,1.29524 0,1.337498 1.1863293,2.457176 2.7639791,2.728248 l -1.3615475,2.333149 c -0.1576963,0.271073 -0.066308,0.61876 0.2047647,0.776457 0.090014,0.05291 0.1886171,0.07799 0.2858459,0.07799 0.1951448,0 0.3851362,-0.100665 0.4912977,-0.281723 l 1.6803757,-2.88148 C 8.41868,16.20561 9.6895264,15.063601 9.6998333,13.683844 c 6.872e-4,-0.0055 0.00137,-0.01065 0.00137,-0.01615 0,-0.02336 -0.00344,-0.04569 -0.00481,-0.06837 1.1292977,-0.0213 2.2847067,-0.130211 3.4435507,-0.334975 6.69711,-1.181863 11.44174,-4.9456164 10.802366,-8.5685077 z M 3.83312,13.667353 c 0,-0.30749 0.1281497,-0.59849 0.3470005,-0.848261 0.1219655,0.04295 0.2456489,0.08383 0.3717372,0.123339 l 1.2234344,2.352045 C 4.6865351,15.149835 3.83312,14.46408 3.83312,13.667353 Z M 7.0141869,15.216144 6.0223152,13.309702 5.4008064,12.114097 c 0.121622,-0.03161 0.2477103,-0.05634 0.3772342,-0.07387 0.1367388,-0.0189 0.2772568,-0.02886 0.420867,-0.02886 0.5067581,0 0.980534,0.11956 1.3701366,0.317454 0.5696305,0.289968 0.9554538,0.750345 0.9904974,1.262944 0.00137,0.02542 0.0055,0.05016 0.0055,0.07593 0,0.698124 -0.6562089,1.310356 -1.5508518,1.548447 z m 5.9185921,-3.126441 c -1.217251,0.214728 -2.429691,0.323982 -3.6060571,0.324669 -0.5765018,-0.911821 -1.7614569,-1.53917 -3.1278143,-1.53917 -0.4717146,0 -0.921441,0.07593 -1.332001,0.211292 -0.3061162,0.100665 -0.5878394,0.237403 -0.8427645,0.39991 C 2.4598914,10.828133 1.4360682,9.8579062 1.2319907,8.7035283 0.72660678,5.8381974 5.2307418,2.5475333 11.067221,1.5175259 c 1.222061,-0.2161023 2.439998,-0.3246688 3.620143,-0.3246688 4.371863,0 7.694479,1.5250844 8.080645,3.7101568 0.505041,2.8653309 -3.998751,6.1566821 -9.83523,7.1866891 z\",\n id: \"path10\"\n })));\n}\n\nvar ForwardRef = React.forwardRef(function (props, ref) {\n return /*#__PURE__*/React.createElement(SvgSelectionLasso, _extends({\n svgRef: ref\n }, props));\n});\nexport default __webpack_public_path__ + \"static/media/selection_lasso.00e80a33.svg\";\nexport { ForwardRef as ReactComponent };","import React from 'react';\nimport { SELECTION_TYPE } from 'nebula.gl';\nimport { ReactComponent as PointerIconSVG } from '../../assets/tools/near_me.svg';\nimport { ReactComponent as SelectRectangleIconSVG } from '../../assets/tools/selection_rectangle.svg';\nimport { ReactComponent as SelectLassoIconSVG } from '../../assets/tools/selection_lasso.svg';\n\nexport function IconButton(props) {\n const {\n alt, onClick, isActive, children,\n } = props;\n const inactive = 'btn btn-outline-secondary mr-2 icon';\n const active = `${inactive} active`;\n return (\n <button\n className={isActive ? active : inactive}\n onClick={onClick}\n type=\"button\"\n title={alt}\n >\n {children}\n </button>\n );\n}\n\nexport default function ToolMenu(props) {\n const {\n setActiveTool,\n activeTool,\n visibleTools = { pan: true, selectRectangle: true, selectLasso: true },\n } = props;\n return (\n <div className=\"tool\">\n {visibleTools.pan && (\n <IconButton\n alt=\"pointer tool\"\n onClick={() => setActiveTool(null)}\n isActive={activeTool === null}\n ><PointerIconSVG />\n </IconButton>\n )}\n {visibleTools.selectRectangle ? (\n <IconButton\n alt=\"select rectangle\"\n onClick={() => setActiveTool(SELECTION_TYPE.RECTANGLE)}\n isActive={activeTool === SELECTION_TYPE.RECTANGLE}\n ><SelectRectangleIconSVG />\n </IconButton>\n ) : null}\n {visibleTools.selectLasso ? (\n <IconButton\n alt=\"select lasso\"\n onClick={() => setActiveTool(SELECTION_TYPE.POLYGON)}\n isActive={activeTool === SELECTION_TYPE.POLYGON}\n ><SelectLassoIconSVG />\n </IconButton>\n ) : null}\n </div>\n );\n}\n","export const getCursorWithTool = () => 'crosshair';\nexport const getCursor = interactionState => (interactionState.isDragging\n ? 'grabbing' : 'default'\n);\n","import React, { PureComponent } from 'react';\nimport DeckGL, { OrthographicView, OrbitView } from 'deck.gl';\nimport ToolMenu from './ToolMenu';\nimport { DEFAULT_GL_OPTIONS } from '../utils';\nimport { getCursor, getCursorWithTool } from './cursor';\n\n/**\n * Abstract class component intended to be inherited by\n * the Spatial and Scatterplot class components.\n * Contains a common constructor, common DeckGL callbacks,\n * and common render function.\n */\nexport default class AbstractSpatialOrScatterplot extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n gl: null,\n tool: null,\n };\n\n this.viewport = null;\n\n this.onViewStateChange = this.onViewStateChange.bind(this);\n this.onInitializeViewInfo = this.onInitializeViewInfo.bind(this);\n this.onWebGLInitialized = this.onWebGLInitialized.bind(this);\n this.onToolChange = this.onToolChange.bind(this);\n this.onHover = this.onHover.bind(this);\n }\n\n /**\n * Called by DeckGL upon a viewState change,\n * for example zoom or pan interaction.\n * Emit the new viewState to the `setViewState`\n * handler prop.\n * @param {object} params\n * @param {object} params.viewState The next deck.gl viewState.\n */\n onViewStateChange({ viewState: nextViewState }) {\n const {\n setViewState, viewState, layers, spatialAxisFixed,\n } = this.props;\n const use3d = layers?.some(l => l.use3d);\n setViewState({\n ...nextViewState,\n // If the axis is fixed, just use the current target in state i.e don't change target.\n target: spatialAxisFixed && use3d ? viewState.target : nextViewState.target,\n });\n }\n\n /**\n * Called by DeckGL upon viewport\n * initialization.\n * @param {object} viewState\n * @param {object} viewState.viewport\n */\n onInitializeViewInfo({ viewport }) {\n this.viewport = viewport;\n }\n\n /**\n * Called by DeckGL upon initialization,\n * helps to understand when to pass layers\n * to the DeckGL component.\n * @param {object} gl The WebGL context object.\n */\n onWebGLInitialized(gl) {\n this.setState({ gl });\n }\n\n /**\n * Called by the ToolMenu buttons.\n * Emits the new tool value to the\n * `onToolChange` prop.\n * @param {string} tool Name of tool.\n */\n onToolChange(tool) {\n const { onToolChange: onToolChangeProp } = this.props;\n this.setState({ tool });\n if (onToolChangeProp) {\n onToolChangeProp(tool);\n }\n }\n\n /**\n * Create the DeckGL layers.\n * @returns {object[]} Array of\n * DeckGL layer objects.\n * Intended to be overriden by descendants.\n */\n // eslint-disable-next-line class-methods-use-this\n getLayers() {\n return [];\n }\n\n // eslint-disable-next-line consistent-return\n onHover(info) {\n const {\n coordinate, sourceLayer: layer, tile,\n } = info;\n const {\n setCellHighlight, cellHighlight, setComponentHover, layers,\n } = this.props;\n const hasBitmask = (layers || []).some(l => l.type === 'bitmask');\n if (!setCellHighlight || !tile) {\n return null;\n }\n if (!layer || !coordinate) {\n if (cellHighlight && hasBitmask) {\n setCellHighlight(null);\n }\n return null;\n }\n const { content, bbox, z } = tile;\n if (!content) {\n if (cellHighlight && hasBitmask) {\n setCellHighlight(null);\n }\n return null;\n }\n const { data, width, height } = content;\n const {\n left, right, top, bottom,\n } = bbox;\n const bounds = [\n left,\n data.height < layer.tileSize ? height : bottom,\n data.width < layer.tileSize ? width : right,\n top,\n ];\n if (!data) {\n if (cellHighlight && hasBitmask) {\n setCellHighlight(null);\n }\n return null;\n }\n // Tiled layer needs a custom layerZoomScale.\n if (layer.id.includes('bitmask')) {\n // The zoomed out layer needs to use the fixed zoom at which it is rendered.\n const layerZoomScale = Math.max(\n 1,\n 2 ** Math.round(-z),\n );\n const dataCoords = [\n Math.floor((coordinate[0] - bounds[0]) / layerZoomScale),\n Math.floor((coordinate[1] - bounds[3]) / layerZoomScale),\n ];\n const coords = dataCoords[1] * width + dataCoords[0];\n const hoverData = data.map(d => d[coords]);\n const cellId = hoverData.find(i => i > 0);\n if (cellId !== Number(cellHighlight)) {\n if (setComponentHover) {\n setComponentHover();\n }\n // eslint-disable-next-line no-unused-expressions\n setCellHighlight(cellId ? String(cellId) : null);\n }\n }\n }\n\n /**\n * Emits a function to project from the\n * cell ID space to the scatterplot or\n * spatial coordinate space, via the\n * `updateViewInfo` prop.\n */\n viewInfoDidUpdate(getCellCoords) {\n const { updateViewInfo, cells, uuid } = this.props;\n const { viewport } = this;\n if (updateViewInfo && viewport) {\n updateViewInfo({\n uuid,\n project: (cellId) => {\n const cell = cells[cellId];\n try {\n const [positionX, positionY] = getCellCoords(cell);\n return viewport.project([positionX, positionY]);\n } catch (e) {\n return [null, null];\n }\n },\n });\n }\n }\n\n /**\n * Intended to be overriden by descendants.\n */\n componentDidUpdate() {\n\n }\n\n /**\n * A common render function for both Spatial\n * and Scatterplot components.\n */\n render() {\n const {\n deckRef, viewState, uuid, layers: layerProps,\n } = this.props;\n const { gl, tool } = this.state;\n const layers = this.getLayers();\n const use3d = (layerProps || []).some(l => l.use3d);\n\n const showCellSelectionTools = this.cellsLayer !== null\n || (this.cellsEntries.length && this.cellsEntries[0][1].xy);\n const showPanTool = this.cellsLayer !== null || layerProps.findIndex(l => l.type === 'bitmask' || l.type === 'raster') >= 0;\n // For large datasets or ray casting, the visual quality takes only a small\n // hit in exchange for much better performance by setting this to false:\n // https://deck.gl/docs/api-reference/core/deck#usedevicepixels\n const useDevicePixels = this.cellsEntries.length < 100000 && !use3d;\n\n return (\n <>\n <ToolMenu\n activeTool={tool}\n setActiveTool={this.onToolChange}\n visibleTools={{\n pan: showPanTool,\n selectRectangle: showCellSelectionTools,\n selectLasso: showCellSelectionTools,\n }}\n />\n <DeckGL\n id={`deckgl-overlay-${uuid}`}\n ref={deckRef}\n views={[\n use3d\n ? new OrbitView({ id: 'orbit', controller: true, orbitAxis: 'Y' })\n : new OrthographicView({\n id: 'ortho',\n }),\n ]} // id is a fix for https://github.com/uber/deck.gl/issues/3259\n layers={\n gl && viewState.target.slice(0, 2).every(i => typeof i === 'number')\n ? layers\n : []\n }\n glOptions={DEFAULT_GL_OPTIONS}\n onWebGLInitialized={this.onWebGLInitialized}\n onViewStateChange={this.onViewStateChange}\n viewState={viewState}\n useDevicePixels={useDevicePixels}\n controller={tool ? { dragPan: false } : true}\n getCursor={tool ? getCursorWithTool : getCursor}\n onHover={this.onHover}\n >\n {this.onInitializeViewInfo}\n </DeckGL>\n </>\n );\n }\n}\n","/* eslint-disable no-plusplus */\n/* eslint-disable no-param-reassign */\nimport { quadtree } from 'd3-quadtree';\n\n/**\n * Returns a closure that returns a constant value.\n */\nfunction constant(v) {\n return (() => v);\n}\n\n/**\n * Adds a tiny bit of randomness to a number.\n */\nfunction jiggle(v) {\n return v + (Math.random() - 0.5) * 1e-6;\n}\n\n/**\n * A force function to be used with d3.forceSimulation.\n * This has been adapted for use here, with comments explaining each part.\n * Reference: https://bl.ocks.org/cmgiven/547658968d365bcc324f3e62e175709b\n */\nexport function forceCollideRects() {\n // D3 implements things with function prototypes rather than classes.\n // Pretend these variables are the \"instance members\" of a class.\n // Note that this function actually returns the internal force() function,\n // but that the force() function is a closure with access to these instance members.\n\n let nodes;\n let masses;\n let strength = 1;\n let iterations = 1;\n\n let sizes;\n let size = constant([0, 0]);\n\n // Given a node, return the center point along the x-axis.\n function xCenter(d) {\n return d.x + d.vx + sizes[d.index][0] / 2;\n }\n\n // Given a node, return the center point along the y-axis.\n function yCenter(d) {\n return d.y + d.vy + sizes[d.index][1] / 2;\n }\n\n // Given a quadtree node, initialize its .size property.\n function prepare(quad) {\n if (quad.data) {\n // This is a leaf node, so we set quad.size to the node's size.\n // (No need to compute the max of internal nodes,\n // since leaf nodes do not have any internal nodes).\n quad.size = sizes[quad.data.index];\n } else {\n quad.size = [0, 0];\n // Internal nodes of the quadtree are represented\n // as four-element arrays in left-to-right, top-to-bottom order.\n // Here, we are setting quad.size to [maxWidth, maxHeight]\n // among the internal nodes of this current `quad` node.\n for (let i = 0; i < 4; i++) {\n if (quad[i] && quad[i].size) {\n quad.size[0] = Math.max(quad.size[0], quad[i].size[0]);\n quad.size[1] = Math.max(quad.size[1], quad[i].size[1]);\n }\n }\n }\n }\n\n function force() {\n let node;\n let nodeSize;\n let nodeMass;\n let xi;\n let yi;\n\n // Create a quadtree based on node center points.\n // Initialize each quadtree node's .size property by calling\n // the prepare() function on each quadtree node.\n const tree = quadtree(nodes, xCenter, yCenter).visitAfter(prepare);\n\n // Update the .vx and .vy properties of both `node` and `data`\n // (the current node pair).\n function apply(quad, x0, y0, x1, y1) {\n // `quad` is a quadtree node.\n const { data } = quad;\n const xSize = (nodeSize[0] + quad.size[0]) / 2;\n const ySize = (nodeSize[1] + quad.size[1]) / 2;\n\n if (data && data.index > node.index) {\n // This is a leaf node because `data` is defined.\n // `x` is the difference in x centers between `node` and `data`.\n // `y` is the difference in y centers between `node` and `data`.\n let x = jiggle(xi - xCenter(data));\n let y = jiggle(yi - yCenter(data));\n const xd = Math.abs(x) - xSize;\n const yd = Math.abs(y) - ySize;\n\n // If `xd` and `yd` is less than zero,\n // then there is an overlap between the two nodes.\n if (xd < 0 && yd < 0) {\n const l = Math.sqrt(x * x + y * y);\n const m = masses[data.index] / (nodeMass + masses[data.index]);\n\n // We move the nodes either in the x or y direction.\n // Nodes are moved proportionally to:\n // their distance apart (`l`), their amount of overlap (`xd` or `yd`), their masses (`m`),\n // and the strength parameter (`strength`).\n if (Math.abs(xd) < Math.abs(yd)) {\n node.vx -= (x *= xd / l * strength) * m;\n data.vx += x * (1 - m);\n } else {\n node.vy -= (y *= yd / l * strength) * m;\n data.vy += y * (1 - m);\n }\n }\n // When the quadtree.visit callback returns _true_ for a node,\n // then the node's children will _not_ be visited.\n return x0 > xi + xSize || x1 < xi - xSize || y0 > yi + ySize || y1 < yi - ySize;\n }\n return false;\n }\n\n function iterate() {\n // On every iteration, use the `apply` function to visit every node\n // which has an index greater than the current node's index,\n // (visiting every node pair).\n for (let j = 0; j < nodes.length; j++) {\n node = nodes[j];\n nodeSize = sizes[j];\n nodeMass = masses[j];\n xi = xCenter(node);\n yi = yCenter(node);\n\n tree.visit(apply);\n }\n }\n\n // Do the specified number of iterations.\n for (let i = 0; i < iterations; i++) {\n iterate();\n }\n }\n\n // The \"constructor\".\n // Takes a list of nodes as input.\n force.initialize = (v) => {\n nodes = v;\n // Get the size [w, h] of each node using the size getter function.\n sizes = nodes.map(size);\n // Get the mass of each node,\n // which is the sum of its horizontal and vertical edge lengths.\n masses = sizes.map(d => d[0] + d[1]);\n };\n\n // Set the number of iterations.\n // If no value is provided as a parameter, this acts as a getter function.\n force.iterations = (...v) => {\n if (v.length) {\n iterations = +v[0];\n return force;\n }\n return iterations;\n };\n\n // Set the strength value.\n // If no value is provided as a parameter, this acts as a getter function.\n force.strength = (...v) => {\n if (v.length) {\n strength = +v[0];\n return force;\n }\n return strength;\n };\n\n // Set the size function.\n // The size function takes a node as a parameter and returns its size.\n // If no size function is provided as a parameter, this acts as a getter function.\n force.size = (...v) => {\n if (v.length) {\n size = (typeof v[0] === 'function' ? v[0] : constant(v[0]));\n return force;\n }\n return size;\n };\n\n // Returns the force closure.\n return force;\n}\n","import glsl from 'glslify';\n\n/**\n *\n * Reference: https://github.com/visgl/deck.gl/blob/8.4-release/modules/layers/src/scatterplot-layer/scatterplot-layer-vertex.glsl.js\n * Reference: https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds\n * Reference: https://github.com/flekschas/regl-scatterplot/blob/5e3b03e/src/point.vs\n */\nconst vs = glsl`\n#pragma glslify: plasma = require(\"glsl-colormap/plasma\")\n#pragma glslify: viridis = require(\"glsl-colormap/viridis\")\n#pragma glslify: greys = require(\"glsl-colormap/greys\")\n#pragma glslify: magma = require(\"glsl-colormap/magma\")\n#pragma glslify: jet = require(\"glsl-colormap/jet\")\n#pragma glslify: bone = require(\"glsl-colormap/bone\")\n#pragma glslify: copper = require(\"glsl-colormap/copper\")\n#pragma glslify: density = require(\"glsl-colormap/density\")\n#pragma glslify: inferno = require(\"glsl-colormap/inferno\")\n#pragma glslify: cool = require(\"glsl-colormap/cool\")\n#pragma glslify: hot = require(\"glsl-colormap/hot\")\n#pragma glslify: spring = require(\"glsl-colormap/spring\")\n#pragma glslify: summer = require(\"glsl-colormap/summer\")\n#pragma glslify: autumn = require(\"glsl-colormap/autumn\")\n#pragma glslify: winter = require(\"glsl-colormap/winter\")\n\n// Custom attributes for Vitessce:\nattribute float expressionValue;\n\n// Custom uniforms for Vitessce:\nuniform vec2 uColorScaleRange;\nuniform bool uIsExpressionMode;\n\n`;\n\nconst inject = {\n 'vs:DECKGL_FILTER_COLOR': `\n if(uIsExpressionMode) {\n float normalizedExpressionValue = expressionValue / 255.0;\n float scaledExpressionValue = (normalizedExpressionValue - uColorScaleRange[0]) / max(0.005, (uColorScaleRange[1] - uColorScaleRange[0]));\n color.rgb = COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb;\n }\n `,\n};\n\nexport default {\n name: 'scaled-expression',\n vs,\n inject,\n};\n","/* eslint-disable no-underscore-dangle */\n/* eslint-disable import/no-extraneous-dependencies */\nimport GL from '@luma.gl/constants';\nimport { LayerExtension } from '@deck.gl/core';\nimport { GLSL_COLORMAPS, GLSL_COLORMAP_DEFAULT, COLORMAP_SHADER_PLACEHOLDER } from '../../layers/constants';\nimport module from './shader-module';\n\nconst defaultProps = {\n colormap: { type: 'string', value: GLSL_COLORMAP_DEFAULT, compare: true },\n colorScaleLo: { type: 'number', value: 0.0, compare: true },\n colorScaleHi: { type: 'number', value: 1.0, compare: true },\n isExpressionMode: false,\n getExpressionValue: { type: 'accessor', value: 0 },\n getSelectionState: { type: 'accessor', value: 0.0 },\n};\n\nexport default class ScaledExpressionExtension extends LayerExtension {\n getShaders() {\n const { colormap } = this.props;\n return {\n modules: [module],\n defines: {\n [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap)\n ? colormap\n : GLSL_COLORMAP_DEFAULT,\n },\n };\n }\n\n updateState({ props, oldProps }) {\n if (props.colormap !== oldProps.colormap) {\n const { gl } = this.context;\n // Normal single model layers, like ScatterplotLayer\n if (this.state.model) {\n // eslint-disable-next-line no-unused-expressions\n this.state.model?.delete();\n this.state.model = this._getModel(gl);\n } else {\n // Special handling for PolygonLayer sublayer models.\n if (this.state.models) {\n // eslint-disable-next-line no-unused-expressions\n this.state.models?.forEach(model => model?.delete());\n }\n if (this.state.topModel) {\n // eslint-disable-next-line no-unused-expressions\n this.state.topModel?.delete();\n }\n if (this.state.sideModel) {\n // eslint-disable-next-line no-unused-expressions\n this.state.sideModel?.delete();\n }\n if (this._getModels) {\n this.setState(this._getModels(this.context.gl));\n }\n }\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n this.getAttributeManager().invalidateAll();\n }\n }\n }\n\n initializeState() {\n const layer = this.getCurrentLayer();\n // No need to run this on layers that don't have a `draw` call.\n if (layer.isComposite) {\n return;\n }\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n // This attributes is the array of expression data needed for\n // coloring cells against the colormap.\n attributeManager.add({\n expressionValue: {\n type: GL.FLOAT,\n size: 1,\n transition: true,\n accessor: 'getExpressionValue',\n defaultValue: 1,\n // PolygonLayer fill needs not-intsanced attribute but\n // ScatterplotLayer and the PolygonLayer stroke needs instanced.\n // So use another attribute's divisor property as a proxy for this divisor.\n divisor: Object.values(attributeManager.attributes)[0].settings.divisor,\n },\n });\n }\n }\n\n draw() {\n const {\n colorScaleLo,\n colorScaleHi,\n isExpressionMode,\n } = this.props;\n const {\n topModel, sideModel, models, model,\n } = this.state;\n const uniforms = {\n uColorScaleRange: [colorScaleLo, colorScaleHi],\n uIsExpressionMode: isExpressionMode,\n };\n // ScatterplotLayer model\n // eslint-disable-next-line no-unused-expressions\n model?.setUniforms(uniforms);\n\n // PolygonLayer models from sublayers\n // eslint-disable-next-line no-unused-expressions\n models?.forEach(m => m.setUniforms(uniforms));\n // eslint-disable-next-line no-unused-expressions\n topModel?.setUniforms(uniforms);\n // eslint-disable-next-line no-unused-expressions\n sideModel?.setUniforms(uniforms);\n }\n}\n\nScaledExpressionExtension.extensionName = 'ScaledExpressionExtension';\nScaledExpressionExtension.defaultProps = defaultProps;\n","import ScaledExpressionExtension from './ScaledExpressionExtension';\n\nexport default ScaledExpressionExtension;\n","import glsl from 'glslify';\n\nconst vs = glsl`\nattribute float isSelected;\n`;\n\nconst inject = {\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position.z += (1. - isSelected) * .00005; // Add a small z offset for unselected points in the positive direction i.e into the screen.\n `,\n 'fs:#main-start': ` // Gets rid of bad border effects (active after deck.gl 8.5): https://github.com/visgl/deck.gl/pull/6081\n float distToCenterNew = length(unitPosition) * outerRadiusPixels;\n float inCircleNew = step(distToCenterNew, outerRadiusPixels);\n if (inCircleNew == 0.0) {\n discard;\n }\n `,\n};\n\nexport default {\n name: 'selection',\n vs,\n inject,\n};\n","/* eslint-disable no-underscore-dangle */\n/* eslint-disable import/no-extraneous-dependencies */\nimport GL from '@luma.gl/constants';\nimport { LayerExtension } from '@deck.gl/core';\nimport module from './shader-module';\n\nexport default class SelectionExtension extends LayerExtension {\n // eslint-disable-next-line class-methods-use-this\n getShaders() {\n return {\n modules: [module],\n };\n }\n\n initializeState(context, extension) {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.add({\n isSelected: {\n type: GL.FLOAT,\n size: 1,\n transition: true,\n accessor: 'getCellIsSelected',\n defaultValue: 1,\n // PolygonLayer needs not-intsanced attribute but\n // ScatterplotLayer needs instanced.\n divisor: Number(extension.opts.instanced),\n },\n });\n }\n }\n}\n\nSelectionExtension.extensionName = 'SelectionExtension';\n","import SelectionExtension from './SelectionExtension';\n\nexport default SelectionExtension;\n","import React, { forwardRef } from 'react';\nimport { PolygonLayer, TextLayer, ScatterplotLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies\nimport { forceSimulation } from 'd3-force';\nimport { getSelectionLayers } from '../../layers';\nimport { cellLayerDefaultProps, getDefaultColor } from '../utils';\nimport {\n createCellsQuadTree,\n} from '../shared-spatial-scatterplot/quadtree';\nimport AbstractSpatialOrScatterplot from '../shared-spatial-scatterplot/AbstractSpatialOrScatterplot';\nimport { forceCollideRects } from '../shared-spatial-scatterplot/force-collide-rects';\nimport { ScaledExpressionExtension, SelectionExtension } from '../../layer-extensions';\n\nconst CELLS_LAYER_ID = 'scatterplot';\nconst LABEL_FONT_FAMILY = \"-apple-system, 'Helvetica Neue', Arial, sans-serif\";\nconst NUM_FORCE_SIMULATION_TICKS = 100;\nconst LABEL_UPDATE_ZOOM_DELTA = 0.25;\n\n// Default getter function props.\nconst makeDefaultGetCellPosition = mapping => (cellEntry) => {\n const { mappings } = cellEntry[1];\n if (!(mapping in mappings)) {\n const available = Object.keys(mappings).map(s => `\"${s}\"`).join(', ');\n throw new Error(`Expected to find \"${mapping}\", but available mappings are: ${available}`);\n }\n const mappedCell = mappings[mapping];\n // The negative applied to the y-axis is because\n // graphics rendering has the y-axis positive going south.\n return [mappedCell[0], -mappedCell[1], 0];\n};\nconst makeDefaultGetCellCoords = mapping => cell => cell.mappings[mapping];\nconst makeDefaultGetCellColors = (cellColors, theme) => (cellEntry) => {\n const [r, g, b, a] = (cellColors && cellColors.get(cellEntry[0])) || getDefaultColor(theme);\n return [r, g, b, 255 * (a || 1)];\n};\n\n/**\n * React component which renders a scatterplot from cell data, typically tSNE or PCA.\n * @param {object} props\n * @param {string} props.uuid A unique identifier for this component.\n * @param {string} props.theme The current vitessce theme.\n * @param {object} props.viewState The deck.gl view state.\n * @param {function} props.setViewState Function to call to update the deck.gl view state.\n * @param {object} props.cells\n * @param {string} props.mapping The name of the coordinate mapping field,\n * for each cell, for example \"PCA\" or \"t-SNE\".\n * @param {Map} props.cellColors Mapping of cell IDs to colors.\n * @param {array} props.cellSelection Array of selected cell IDs.\n * @param {array} props.cellFilter Array of filtered cell IDs. By default, null.\n * @param {number} props.cellRadius The value for `radiusScale` to pass\n * to the deck.gl cells ScatterplotLayer.\n * @param {number} props.cellOpacity The value for `opacity` to pass\n * to the deck.gl cells ScatterplotLayer.\n * @param {function} props.getCellCoords Getter function for cell coordinates\n * (used by the selection layer).\n * @param {function} props.getCellPosition Getter function for cell [x, y, z] position.\n * @param {function} props.getCellColor Getter function for cell color as [r, g, b] array.\n * @param {function} props.getCellIsSelected Getter function for cell layer isSelected.\n * @param {function} props.setCellSelection\n * @param {function} props.setCellHighlight\n * @param {function} props.updateViewInfo\n * @param {function} props.onToolChange Callback for tool changes\n * (lasso/pan/rectangle selection tools).\n * @param {function} props.onCellClick Getter function for cell layer onClick.\n */\nclass Scatterplot extends AbstractSpatialOrScatterplot {\n constructor(props) {\n super(props);\n\n // To avoid storing large arrays/objects\n // in React state, this component\n // uses instance variables.\n // All instance variables used in this class:\n this.cellsEntries = [];\n this.cellsQuadTree = null;\n this.cellsLayer = null;\n this.cellSetsForceSimulation = forceCollideRects();\n this.cellSetsLabelPrevZoom = null;\n this.cellSetsLayers = [];\n\n // Initialize data and layers.\n this.onUpdateCellsData();\n this.onUpdateCellsLayer();\n this.onUpdateCellSetsLayers();\n }\n\n createCellsLayer() {\n const { cellsEntries } = this;\n const {\n theme,\n mapping,\n getCellPosition = makeDefaultGetCellPosition(mapping),\n cellRadius = 1.0,\n cellOpacity = 1.0,\n cellFilter,\n cellSelection,\n setCellHighlight,\n setComponentHover,\n getCellIsSelected,\n cellColors,\n getCellColor = makeDefaultGetCellColors(cellColors, theme),\n getExpressionValue,\n onCellClick,\n geneExpressionColormap,\n geneExpressionColormapRange = [0.0, 1.0],\n cellColorEncoding,\n } = this.props;\n const filteredCellsEntries = (cellFilter\n ? cellsEntries.filter(cellEntry => cellFilter.includes(cellEntry[0]))\n : cellsEntries);\n return new ScatterplotLayer({\n id: CELLS_LAYER_ID,\n backgroundColor: (theme === 'dark' ? [0, 0, 0] : [241, 241, 241]),\n getCellIsSelected,\n opacity: cellOpacity,\n radiusScale: cellRadius,\n radiusMinPixels: 1,\n radiusMaxPixels: 30,\n // Our radius pixel setters measure in pixels.\n radiusUnits: 'pixels',\n lineWidthUnits: 'pixels',\n getPosition: getCellPosition,\n getFillColor: getCellColor,\n getLineColor: getCellColor,\n getRadius: 1,\n getExpressionValue,\n getLineWidth: 0,\n extensions: [\n new ScaledExpressionExtension(),\n new SelectionExtension({ instanced: true }),\n ],\n colorScaleLo: geneExpressionColormapRange[0],\n colorScaleHi: geneExpressionColormapRange[1],\n isExpressionMode: (cellColorEncoding === 'geneSelection'),\n colormap: geneExpressionColormap,\n onClick: (info) => {\n if (onCellClick) {\n onCellClick(info);\n }\n },\n updateTriggers: {\n getExpressionValue,\n getFillColor: [cellColorEncoding, cellSelection, cellColors],\n getLineColor: [cellColorEncoding, cellSelection, cellColors],\n getCellIsSelected,\n },\n ...cellLayerDefaultProps(\n filteredCellsEntries, undefined, setCellHighlight, setComponentHover,\n ),\n stroked: 0,\n });\n }\n\n createCellSetsLayers() {\n const {\n theme,\n cellSetPolygons,\n viewState,\n cellSetPolygonsVisible,\n cellSetLabelsVisible,\n cellSetLabelSize,\n } = this.props;\n\n const result = [];\n\n if (cellSetPolygonsVisible) {\n result.push(new PolygonLayer({\n id: 'cell-sets-polygon-layer',\n data: cellSetPolygons,\n stroked: true,\n filled: false,\n wireframe: true,\n lineWidthMaxPixels: 1,\n getPolygon: d => d.hull,\n getLineColor: d => d.color,\n getLineWidth: 1,\n }));\n }\n\n if (cellSetLabelsVisible) {\n const { zoom } = viewState;\n const nodes = cellSetPolygons.map(p => ({\n x: p.centroid[0],\n y: p.centroid[1],\n label: p.name,\n }));\n\n const collisionForce = this.cellSetsForceSimulation\n .size(d => ([\n cellSetLabelSize * 1 / (2 ** zoom) * 4 * d.label.length,\n cellSetLabelSize * 1 / (2 ** zoom) * 1.5,\n ]));\n\n forceSimulation()\n .nodes(nodes)\n .force('collision', collisionForce)\n .tick(NUM_FORCE_SIMULATION_TICKS);\n\n result.push(new TextLayer({\n id: 'cell-sets-text-layer',\n data: nodes,\n getPosition: d => ([d.x, d.y]),\n getText: d => d.label,\n getColor: (theme === 'dark' ? [255, 255, 255] : [0, 0, 0]),\n getSize: cellSetLabelSize,\n getAngle: 0,\n getTextAnchor: 'middle',\n getAlignmentBaseline: 'center',\n fontFamily: LABEL_FONT_FAMILY,\n fontWeight: 'normal',\n }));\n }\n\n return result;\n }\n\n createSelectionLayers() {\n const {\n viewState,\n mapping,\n getCellCoords = makeDefaultGetCellCoords(mapping),\n setCellSelection,\n } = this.props;\n const { tool } = this.state;\n const { cellsQuadTree } = this;\n const flipYTooltip = true;\n return getSelectionLayers(\n tool,\n viewState.zoom,\n CELLS_LAYER_ID,\n getCellCoords,\n setCellSelection,\n cellsQuadTree,\n flipYTooltip,\n );\n }\n\n getLayers() {\n const {\n cellsLayer,\n cellSetsLayers,\n } = this;\n return [\n cellsLayer,\n ...cellSetsLayers,\n ...this.createSelectionLayers(),\n ];\n }\n\n onUpdateCellsData() {\n const {\n cells = {},\n mapping,\n getCellCoords = makeDefaultGetCellCoords(mapping),\n } = this.props;\n const cellsEntries = Object.entries(cells);\n this.cellsEntries = cellsEntries;\n this.cellsQuadTree = createCellsQuadTree(cellsEntries, getCellCoords);\n }\n\n onUpdateCellsLayer() {\n this.cellsLayer = this.createCellsLayer();\n }\n\n onUpdateCellSetsLayers(onlyViewStateChange) {\n // Because the label sizes for the force simulation depend on the zoom level,\n // we _could_ run the simulation every time the zoom level changes.\n // However, this has a performance impact in firefox.\n if (onlyViewStateChange) {\n const { viewState, cellSetLabelsVisible } = this.props;\n const { zoom } = viewState;\n const { cellSetsLabelPrevZoom } = this;\n // Instead, we can just check if the zoom level has changed\n // by some relatively large delta, to be more conservative\n // about re-running the force simulation.\n if (cellSetLabelsVisible\n && (\n cellSetsLabelPrevZoom === null\n || Math.abs(cellSetsLabelPrevZoom - zoom) > LABEL_UPDATE_ZOOM_DELTA\n )\n ) {\n this.cellSetsLayers = this.createCellSetsLayers();\n this.cellSetsLabelPrevZoom = zoom;\n }\n } else {\n // Otherwise, something more substantial than just\n // the viewState has changed, such as the label array\n // itself, so we always want to update the layer\n // in this case.\n this.cellSetsLayers = this.createCellSetsLayers();\n }\n }\n\n viewInfoDidUpdate() {\n const {\n mapping,\n getCellPosition = makeDefaultGetCellPosition(mapping),\n } = this.props;\n super.viewInfoDidUpdate(cell => getCellPosition([null, cell]));\n }\n\n /**\n * Here, asynchronously check whether props have\n * updated which require re-computing memoized variables,\n * followed by a re-render.\n * This function does not follow React conventions or paradigms,\n * it is only implemented this way to try to squeeze out\n * performance.\n * @param {object} prevProps The previous props to diff against.\n */\n componentDidUpdate(prevProps) {\n this.viewInfoDidUpdate();\n\n const shallowDiff = propName => (prevProps[propName] !== this.props[propName]);\n if (['cells'].some(shallowDiff)) {\n // Cells data changed.\n this.onUpdateCellsData();\n this.forceUpdate();\n }\n\n if ([\n 'cells', 'cellFilter', 'cellSelection', 'cellColors',\n 'cellRadius', 'cellOpacity', 'cellRadiusMode', 'geneExpressionColormap',\n 'geneExpressionColormapRange', 'geneSelection', 'cellColorEncoding',\n ].some(shallowDiff)) {\n // Cells layer props changed.\n this.onUpdateCellsLayer();\n this.forceUpdate();\n }\n if ([\n 'cellSetPolygons', 'cellSetPolygonsVisible',\n 'cellSetLabelsVisible', 'cellSetLabelSize',\n ].some(shallowDiff)) {\n // Cell sets layer props changed.\n this.onUpdateCellSetsLayers(false);\n this.forceUpdate();\n }\n if (shallowDiff('viewState')) {\n // The viewState prop has changed (due to zoom or pan).\n this.onUpdateCellSetsLayers(true);\n this.forceUpdate();\n }\n }\n\n // render() is implemented in the abstract parent class.\n}\n\n/**\n * Need this wrapper function here,\n * since we want to pass a forwardRef\n * so that outer components can\n * access the grandchild DeckGL ref,\n * but we are using a class component.\n */\nconst ScatterplotWrapper = forwardRef((props, deckRef) => (\n <Scatterplot\n {...props}\n deckRef={deckRef}\n />\n));\nexport default ScatterplotWrapper;\n","import { makeStyles } from '@material-ui/core/styles';\n\nexport const styles = makeStyles(() => ({\n tooltipAnchor: {\n position: 'relative',\n width: '0px',\n height: '0px',\n pointerEvents: 'none',\n userSelect: 'none',\n },\n tooltipContent: {\n opacity: 0.9,\n padding: '5px',\n pointerEvents: 'none',\n '& table > tbody > tr > th, & table > tbody > tr > td': {\n fontSize: '80%',\n opacity: 0.8,\n outline: 0,\n padding: '0 2px',\n },\n '& table': {\n borderCollapse: 'collapse',\n },\n },\n}));\n","import React, { useEffect, useRef, useState } from 'react';\nimport Paper from '@material-ui/core/Paper';\nimport Popper from '@material-ui/core/Popper';\nimport { useVitessceContainer } from '../hooks';\nimport { styles } from './styles';\n\nexport default function Tooltip(props) {\n const {\n x,\n y,\n parentWidth,\n parentHeight,\n children,\n } = props;\n const ref = useRef();\n const classes = styles();\n const [placementX, setPlacementX] = useState('start');\n const [placementY, setPlacementY] = useState('bottom');\n\n const getTooltipContainer = useVitessceContainer(ref);\n\n // Do collision detection based on the bounds of the tooltip ancestor element.\n useEffect(() => {\n if (ref && ref.current) {\n const flipX = (x > parentWidth / 2);\n const flipY = (y > parentHeight / 2);\n setPlacementX(flipX ? 'end' : 'start');\n setPlacementY(flipY ? 'top' : 'bottom');\n ref.current.style.left = `${x + (flipX ? -20 : 5)}px`;\n ref.current.style.top = `${y + (flipY ? -20 : 5)}px`;\n }\n }, [x, y, parentWidth, parentHeight]);\n\n return (\n <div\n ref={ref}\n className={classes.tooltipAnchor}\n >\n {ref && ref.current ? (\n <Popper\n open\n anchorEl={ref.current}\n container={getTooltipContainer}\n transition\n placement={`${placementY}-${placementX}`}\n >\n <Paper elevation={4} className={classes.tooltipContent}>\n {children}\n </Paper>\n </Popper>\n ) : null}\n </div>\n );\n}\n","import React from 'react';\nimport Tooltip from './Tooltip';\n\n/**\n * A tooltip component that also incorporates a crosshair element.\n * @param {object} props\n * @param {string} props.parentUuid A unique identifier corresponding to the plot\n * with which this scatterplot is associated.\n * @param {string} props.sourceUuid A unique identifier corresponding to the plot\n * from which this tooltip originated.\n * @param {number} props.x The x coordinate for the tooltip.\n * @param {number} props.y The y coordinate for the tooltip.\n * @param {number} props.parentWidth The width of the parent plot container element.\n * @param {number} props.parentHeight The height of the parent plot container element.\n * @param {React.Component} props.children The tooltip contents as a react component.\n */\nexport default function Tooltip2D(props) {\n const {\n parentUuid,\n sourceUuid,\n x,\n y,\n parentWidth,\n parentHeight,\n children,\n } = props;\n // Check if out of bounds.\n if (x < 0 || x > parentWidth || y < 0 || y > parentHeight) {\n return null;\n }\n // Show tooltip or crosshair?\n const isTooltipVisible = (parentUuid === sourceUuid);\n const crosshairWidth = 1;\n return (\n <>\n {isTooltipVisible ? (\n <Tooltip\n x={x}\n y={y}\n parentWidth={parentWidth}\n parentHeight={parentHeight}\n >\n {children}\n </Tooltip>\n ) : (\n <>\n {x !== null ? (\n <div\n className=\"cell-emphasis-crosshair\"\n style={{\n left: `${x - crosshairWidth / 2}px`,\n top: 0,\n width: `${crosshairWidth}px`,\n height: `${parentHeight}px`,\n }}\n />\n ) : null}\n {y !== null ? (\n <div\n className=\"cell-emphasis-crosshair\"\n style={{\n left: 0,\n top: `${y - crosshairWidth / 2}px`,\n width: `${parentWidth}px`,\n height: `${crosshairWidth}px`,\n }}\n />\n ) : null}\n </>\n )}\n </>\n );\n}\n","import React from 'react';\n\nexport default function TooltipContent(props) {\n const {\n info,\n } = props;\n\n return (\n <table>\n <tbody>\n {Object.entries(info).map(([key, value]) => (\n <tr key={key}>\n <th>{key}</th>\n <td>{value}</td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","import React from 'react';\nimport Tooltip2D from '../tooltip/Tooltip2D';\nimport TooltipContent from '../tooltip/TooltipContent';\nimport { useComponentHover, useComponentViewInfo } from '../../app/state/hooks';\n\nexport default function ScatterplotTooltipSubscriber(props) {\n const {\n parentUuid,\n cellHighlight,\n width,\n height,\n getCellInfo,\n } = props;\n\n const sourceUuid = useComponentHover();\n const viewInfo = useComponentViewInfo(parentUuid);\n\n const [cellInfo, x, y] = (cellHighlight && getCellInfo ? (\n [\n getCellInfo(cellHighlight),\n ...(viewInfo && viewInfo.project ? viewInfo.project(cellHighlight) : [null, null]),\n ]\n ) : ([null, null, null]));\n\n return (\n (cellInfo ? (\n <Tooltip2D\n x={x}\n y={y}\n parentUuid={parentUuid}\n sourceUuid={sourceUuid}\n parentWidth={width}\n parentHeight={height}\n >\n <TooltipContent info={cellInfo} />\n </Tooltip2D>\n ) : null)\n );\n}\n","import { makeStyles } from '@material-ui/core/styles';\n\nexport const useStyles = makeStyles(theme => ({\n box: {\n boxSizing: 'border-box',\n },\n checkbox: {\n padding: '3px',\n color: theme.palette.primaryForeground,\n '&:checked': {\n color: theme.palette.primaryForeground,\n },\n '& input': {\n height: '100%',\n },\n },\n slider: {\n color: theme.palette.primaryForeground,\n minWidth: '60px',\n padding: '10px 0 10px 0',\n },\n sliderValueLabel: {\n '& span': {\n '& span': {\n color: theme.palette.primaryBackground,\n },\n },\n },\n tableContainer: {\n overflow: 'hidden',\n overflowX: 'hidden !important',\n },\n labelCell: {\n padding: '2px 8px 2px 16px',\n },\n inputCell: {\n padding: '2px 16px 2px 8px',\n overflow: 'visible',\n },\n select: {\n '& select': {\n fontSize: '.875rem',\n },\n },\n selectRoot: {\n padding: 0,\n height: 'auto',\n },\n}));\n","import React from 'react';\nimport Box from '@material-ui/core/Box';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableContainer from '@material-ui/core/TableContainer';\nimport { useStyles } from './styles';\n\nexport default function OptionsContainer(props) {\n const {\n children,\n } = props;\n\n const classes = useStyles();\n\n return (\n <Box className={classes.box}>\n <TableContainer className={classes.tableContainer}>\n <Table className={classes.table} size=\"small\">\n <TableBody>\n {children}\n </TableBody>\n </Table>\n </TableContainer>\n </Box>\n );\n}\n","import React from 'react';\nimport Select from '@material-ui/core/Select';\nimport { useStyles } from './styles';\n\nexport default function OptionSelect(props) {\n const { classes: classesProp = {} } = props;\n const classes = useStyles();\n return (\n <Select\n native\n disableUnderline\n {...props}\n classes={{\n root: classes.selectRoot,\n ...classesProp,\n }}\n />\n );\n}\n","import React from 'react';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport { capitalize } from '../../utils';\nimport OptionSelect from './OptionSelect';\nimport { useStyles } from './styles';\n\nexport default function CellColorEncodingOption(props) {\n const {\n observationsLabel,\n cellColorEncoding,\n setCellColorEncoding,\n } = props;\n\n const classes = useStyles();\n\n const observationsLabelNice = capitalize(observationsLabel);\n\n function handleColorEncodingChange(event) {\n setCellColorEncoding(event.target.value);\n }\n\n return (\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"cell-color-encoding-select\">\n {observationsLabelNice} Color Encoding\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={cellColorEncoding}\n onChange={handleColorEncodingChange}\n inputProps={{\n id: 'cell-color-encoding-select',\n }}\n >\n <option value=\"cellSetSelection\">Cell Sets</option>\n <option value=\"geneSelection\">Gene Expression</option>\n </OptionSelect>\n </TableCell>\n </TableRow>\n );\n}\n","import React, { useCallback } from 'react';\nimport debounce from 'lodash/debounce';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Slider from '@material-ui/core/Slider';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport { capitalize } from '../../utils';\nimport { useStyles } from '../shared-plot-options/styles';\nimport OptionsContainer from '../shared-plot-options/OptionsContainer';\nimport OptionSelect from '../shared-plot-options/OptionSelect';\nimport CellColorEncodingOption from '../shared-plot-options/CellColorEncodingOption';\nimport { GLSL_COLORMAPS } from '../../layers/constants';\n\nexport default function ScatterplotOptions(props) {\n const {\n observationsLabel,\n cellRadius,\n setCellRadius,\n cellRadiusMode,\n setCellRadiusMode,\n cellOpacity,\n setCellOpacity,\n cellOpacityMode,\n setCellOpacityMode,\n cellSetLabelsVisible,\n setCellSetLabelsVisible,\n cellSetLabelSize,\n setCellSetLabelSize,\n cellSetPolygonsVisible,\n setCellSetPolygonsVisible,\n cellColorEncoding,\n setCellColorEncoding,\n geneExpressionColormap,\n setGeneExpressionColormap,\n geneExpressionColormapRange,\n setGeneExpressionColormapRange,\n } = props;\n\n const observationsLabelNice = capitalize(observationsLabel);\n\n const classes = useStyles();\n\n function handleCellRadiusModeChange(event) {\n setCellRadiusMode(event.target.value);\n }\n\n function handleCellOpacityModeChange(event) {\n setCellOpacityMode(event.target.value);\n }\n\n function handleRadiusChange(event, value) {\n setCellRadius(value);\n }\n\n function handleOpacityChange(event, value) {\n setCellOpacity(value);\n }\n\n function handleLabelVisibilityChange(event) {\n setCellSetLabelsVisible(event.target.checked);\n }\n\n function handleLabelSizeChange(event, value) {\n setCellSetLabelSize(value);\n }\n\n function handlePolygonVisibilityChange(event) {\n setCellSetPolygonsVisible(event.target.checked);\n }\n\n function handleGeneExpressionColormapChange(event) {\n setGeneExpressionColormap(event.target.value);\n }\n\n function handleColormapRangeChange(event, value) {\n setGeneExpressionColormapRange(value);\n }\n const handleColormapRangeChangeDebounced = useCallback(\n debounce(handleColormapRangeChange, 5, { trailing: true }),\n [handleColormapRangeChange],\n );\n\n return (\n <OptionsContainer>\n <CellColorEncodingOption\n observationsLabel={observationsLabel}\n cellColorEncoding={cellColorEncoding}\n setCellColorEncoding={setCellColorEncoding}\n />\n <TableRow>\n <TableCell className={classes.labelCell}>\n {observationsLabelNice} Set Labels Visible\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Checkbox\n className={classes.checkbox}\n checked={cellSetLabelsVisible}\n onChange={handleLabelVisibilityChange}\n name=\"scatterplot-option-cell-set-labels\"\n color=\"default\"\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n {observationsLabelNice} Set Label Size\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n disabled={!cellSetLabelsVisible}\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={cellSetLabelSize}\n onChange={handleLabelSizeChange}\n aria-labelledby=\"cell-set-label-size-slider\"\n valueLabelDisplay=\"auto\"\n step={1}\n min={8}\n max={36}\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n {observationsLabelNice} Set Polygons Visible\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Checkbox\n className={classes.checkbox}\n checked={cellSetPolygonsVisible}\n onChange={handlePolygonVisibilityChange}\n name=\"scatterplot-option-cell-set-polygons\"\n color=\"default\"\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"cell-radius-mode-select\">\n {observationsLabelNice} Radius Mode\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={cellRadiusMode}\n onChange={handleCellRadiusModeChange}\n inputProps={{\n id: 'cell-radius-mode-select',\n }}\n >\n <option value=\"auto\">Auto</option>\n <option value=\"manual\">Manual</option>\n </OptionSelect>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n {observationsLabelNice} Radius\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n disabled={cellRadiusMode !== 'manual'}\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={cellRadius}\n onChange={handleRadiusChange}\n aria-labelledby=\"cell-radius-slider\"\n valueLabelDisplay=\"auto\"\n step={0.01}\n min={0.01}\n max={10}\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"cell-opacity-mode-select\">\n {observationsLabelNice} Opacity Mode\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={cellOpacityMode}\n onChange={handleCellOpacityModeChange}\n inputProps={{\n id: 'cell-opacity-mode-select',\n }}\n >\n <option value=\"auto\">Auto</option>\n <option value=\"manual\">Manual</option>\n </OptionSelect>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n {observationsLabelNice} Opacity\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n disabled={cellOpacityMode !== 'manual'}\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={cellOpacity}\n onChange={handleOpacityChange}\n aria-labelledby=\"cell-opacity-slider\"\n valueLabelDisplay=\"auto\"\n step={0.05}\n min={0.0}\n max={1.0}\n />\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"gene-expression-colormap-select\">\n Gene Expression Colormap\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={geneExpressionColormap}\n onChange={handleGeneExpressionColormapChange}\n inputProps={{\n id: 'gene-expression-colormap-select',\n }}\n >\n {GLSL_COLORMAPS.map(cmap => (\n <option key={cmap} value={cmap}>{cmap}</option>\n ))}\n </OptionSelect>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n Gene Expression Colormap Range\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={geneExpressionColormapRange}\n onChange={handleColormapRangeChangeDebounced}\n aria-labelledby=\"gene-expression-colormap-range-slider\"\n valueLabelDisplay=\"auto\"\n step={0.005}\n min={0.0}\n max={1.0}\n />\n </TableCell>\n </TableRow>\n </OptionsContainer>\n );\n}\n","import React, {\n useState, useEffect, useCallback, useMemo,\n} from 'react';\nimport { extent } from 'd3-array';\nimport isEqual from 'lodash/isEqual';\nimport TitleInfo from '../TitleInfo';\nimport { pluralize, capitalize } from '../../utils';\nimport {\n useDeckCanvasSize, useReady, useUrls, useExpressionValueGetter,\n} from '../hooks';\nimport { setCellSelection, mergeCellSets } from '../utils';\nimport { getCellSetPolygons } from '../sets/cell-set-utils';\nimport {\n useCellsData,\n useCellSetsData,\n useGeneSelection,\n useExpressionAttrs,\n} from '../data-hooks';\nimport { getCellColors } from '../interpolate-colors';\nimport Scatterplot from './Scatterplot';\nimport ScatterplotTooltipSubscriber from './ScatterplotTooltipSubscriber';\nimport ScatterplotOptions from './ScatterplotOptions';\nimport {\n useCoordination,\n useLoaders,\n useSetComponentHover,\n useSetComponentViewInfo,\n} from '../../app/state/hooks';\nimport {\n getPointSizeDevicePixels,\n getPointOpacity,\n} from '../shared-spatial-scatterplot/dynamic-opacity';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\n\nconst SCATTERPLOT_DATA_TYPES = ['cells', 'expression-matrix', 'cell-sets'];\n\n/**\n * A subscriber component for the scatterplot.\n * @param {object} props\n * @param {number} props.uuid The unique identifier for this component.\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {boolean} props.disableTooltip Should the tooltip be disabled?\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title An override value for the component title.\n * @param {number} props.averageFillDensity Override the average fill density calculation\n * when using dynamic opacity mode.\n */\nexport default function ScatterplotSubscriber(props) {\n const {\n uuid,\n coordinationScopes,\n removeGridComponent,\n theme,\n disableTooltip = false,\n observationsLabelOverride: observationsLabel = 'cell',\n observationsPluralLabelOverride: observationsPluralLabel = `${observationsLabel}s`,\n title: titleOverride,\n // Average fill density for dynamic opacity calculation.\n averageFillDensity,\n } = props;\n\n const loaders = useLoaders();\n const setComponentHover = useSetComponentHover();\n const setComponentViewInfo = useSetComponentViewInfo(uuid);\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n embeddingZoom: zoom,\n embeddingTargetX: targetX,\n embeddingTargetY: targetY,\n embeddingTargetZ: targetZ,\n embeddingType: mapping,\n cellFilter,\n cellHighlight,\n geneSelection,\n cellSetSelection,\n cellSetColor,\n cellColorEncoding,\n additionalCellSets,\n embeddingCellSetPolygonsVisible: cellSetPolygonsVisible,\n embeddingCellSetLabelsVisible: cellSetLabelsVisible,\n embeddingCellSetLabelSize: cellSetLabelSize,\n embeddingCellRadius: cellRadiusFixed,\n embeddingCellRadiusMode: cellRadiusMode,\n embeddingCellOpacity: cellOpacityFixed,\n embeddingCellOpacityMode: cellOpacityMode,\n geneExpressionColormap,\n geneExpressionColormapRange,\n }, {\n setEmbeddingZoom: setZoom,\n setEmbeddingTargetX: setTargetX,\n setEmbeddingTargetY: setTargetY,\n setEmbeddingTargetZ: setTargetZ,\n setCellFilter,\n setCellSetSelection,\n setCellHighlight,\n setCellSetColor,\n setCellColorEncoding,\n setAdditionalCellSets,\n setEmbeddingCellSetPolygonsVisible: setCellSetPolygonsVisible,\n setEmbeddingCellSetLabelsVisible: setCellSetLabelsVisible,\n setEmbeddingCellSetLabelSize: setCellSetLabelSize,\n setEmbeddingCellRadius: setCellRadiusFixed,\n setEmbeddingCellRadiusMode: setCellRadiusMode,\n setEmbeddingCellOpacity: setCellOpacityFixed,\n setEmbeddingCellOpacityMode: setCellOpacityMode,\n setGeneExpressionColormap,\n setGeneExpressionColormapRange,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.scatterplot, coordinationScopes);\n\n const [urls, addUrl, resetUrls] = useUrls();\n const [width, height, deckRef] = useDeckCanvasSize();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n SCATTERPLOT_DATA_TYPES,\n );\n\n const title = titleOverride || `Scatterplot (${mapping})`;\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [cells, cellsCount] = useCellsData(loaders, dataset, setItemIsReady, addUrl, true);\n const [cellSets] = useCellSetsData(\n loaders,\n dataset,\n setItemIsReady,\n addUrl,\n false,\n { setCellSetSelection, setCellSetColor },\n { cellSetSelection, cellSetColor },\n );\n const [expressionData] = useGeneSelection(\n loaders, dataset, setItemIsReady, false, geneSelection, setItemIsNotReady,\n );\n const [attrs] = useExpressionAttrs(\n loaders, dataset, setItemIsReady, addUrl, false,\n );\n\n const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);\n const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);\n\n const mergedCellSets = useMemo(() => mergeCellSets(\n cellSets, additionalCellSets,\n ), [cellSets, additionalCellSets]);\n\n const setCellSelectionProp = useCallback((v) => {\n setCellSelection(\n v, additionalCellSets, cellSetColor,\n setCellSetSelection, setAdditionalCellSets, setCellSetColor,\n setCellColorEncoding,\n );\n }, [additionalCellSets, cellSetColor, setCellColorEncoding,\n setAdditionalCellSets, setCellSetColor, setCellSetSelection]);\n\n const cellColors = useMemo(() => getCellColors({\n cellColorEncoding,\n expressionData: expressionData && expressionData[0],\n geneSelection,\n cellSets: mergedCellSets,\n cellSetSelection,\n cellSetColor,\n expressionDataAttrs: attrs,\n theme,\n }), [cellColorEncoding, geneSelection, mergedCellSets, theme,\n cellSetSelection, cellSetColor, expressionData, attrs]);\n\n // cellSetPolygonCache is an array of tuples like [(key0, val0), (key1, val1), ...],\n // where the keys are cellSetSelection arrays.\n const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);\n const cacheHas = (cache, key) => cache.findIndex(el => isEqual(el[0], key)) !== -1;\n const cacheGet = (cache, key) => cache.find(el => isEqual(el[0], key))?.[1];\n const cellSetPolygons = useMemo(() => {\n if ((cellSetLabelsVisible || cellSetPolygonsVisible)\n && !cacheHas(cellSetPolygonCache, cellSetSelection)\n && mergedCellSets?.tree?.length\n && Object.values(cells).length\n && cellSetColor?.length) {\n const newCellSetPolygons = getCellSetPolygons({\n cells,\n mapping,\n cellSets: mergedCellSets,\n cellSetSelection,\n cellSetColor,\n theme,\n });\n setCellSetPolygonCache(cache => [...cache, [cellSetSelection, newCellSetPolygons]]);\n return newCellSetPolygons;\n }\n return cacheGet(cellSetPolygonCache, cellSetSelection) || [];\n }, [cellSetPolygonsVisible, cellSetPolygonCache, cellSetLabelsVisible, theme,\n cells, mapping, mergedCellSets, cellSetSelection, cellSetColor]);\n\n\n const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);\n\n const [xRange, yRange, xExtent, yExtent, numCells] = useMemo(() => {\n const cellValues = cells && Object.values(cells);\n if (cellValues?.length) {\n const cellCoordinates = Object.values(cells)\n .map(c => c.mappings[mapping]);\n const xE = extent(cellCoordinates, c => c[0]);\n const yE = extent(cellCoordinates, c => c[1]);\n const xR = xE[1] - xE[0];\n const yR = yE[1] - yE[0];\n return [xR, yR, xE, yE, cellValues.length];\n }\n return [null, null, null, null, null];\n }, [cells, mapping]);\n\n // After cells have loaded or changed,\n // compute the cell radius scale based on the\n // extents of the cell coordinates on the x/y axes.\n useEffect(() => {\n if (xRange && yRange) {\n const pointSizeDevicePixels = getPointSizeDevicePixels(\n window.devicePixelRatio, zoom, xRange, yRange, width, height,\n );\n setDynamicCellRadius(pointSizeDevicePixels);\n\n const nextCellOpacityScale = getPointOpacity(\n zoom, xRange, yRange, width, height, numCells, averageFillDensity,\n );\n setDynamicCellOpacity(nextCellOpacityScale);\n\n if (typeof targetX !== 'number' || typeof targetY !== 'number') {\n const newTargetX = xExtent[0] + xRange / 2;\n const newTargetY = yExtent[0] + yRange / 2;\n const newZoom = Math.log2(Math.min(width / xRange, height / yRange));\n setTargetX(newTargetX);\n // Graphics rendering has the y-axis going south so we need to multiply by negative one.\n setTargetY(-newTargetY);\n setZoom(newZoom);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [xRange, yRange, xExtent, yExtent, numCells, cells, mapping,\n width, height, zoom, averageFillDensity]);\n\n const getCellInfo = useCallback((cellId) => {\n const cellInfo = cells[cellId];\n return {\n [`${capitalize(observationsLabel)} ID`]: cellId,\n ...(cellInfo ? cellInfo.factors : {}),\n };\n }, [cells, observationsLabel]);\n\n const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);\n const getCellIsSelected = useCallback(cellEntry => (\n (cellSelectionSet || new Set([])).has(cellEntry[0]) ? 1.0 : 0.0), [cellSelectionSet]);\n\n const cellRadius = (cellRadiusMode === 'manual' ? cellRadiusFixed : dynamicCellRadius);\n const cellOpacity = (cellOpacityMode === 'manual' ? cellOpacityFixed : dynamicCellOpacity);\n\n // Set up a getter function for gene expression values, to be used\n // by the DeckGL layer to obtain values for instanced attributes.\n const getExpressionValue = useExpressionValueGetter({ attrs, expressionData });\n\n return (\n <TitleInfo\n title={title}\n info={`${cellsCount} ${pluralize(observationsLabel, observationsPluralLabel, cellsCount)}`}\n removeGridComponent={removeGridComponent}\n urls={urls}\n theme={theme}\n isReady={isReady}\n options={(\n <ScatterplotOptions\n observationsLabel={observationsLabel}\n cellRadius={cellRadiusFixed}\n setCellRadius={setCellRadiusFixed}\n cellRadiusMode={cellRadiusMode}\n setCellRadiusMode={setCellRadiusMode}\n cellOpacity={cellOpacityFixed}\n setCellOpacity={setCellOpacityFixed}\n cellOpacityMode={cellOpacityMode}\n setCellOpacityMode={setCellOpacityMode}\n cellSetLabelsVisible={cellSetLabelsVisible}\n setCellSetLabelsVisible={setCellSetLabelsVisible}\n cellSetLabelSize={cellSetLabelSize}\n setCellSetLabelSize={setCellSetLabelSize}\n cellSetPolygonsVisible={cellSetPolygonsVisible}\n setCellSetPolygonsVisible={setCellSetPolygonsVisible}\n cellColorEncoding={cellColorEncoding}\n setCellColorEncoding={setCellColorEncoding}\n geneExpressionColormap={geneExpressionColormap}\n setGeneExpressionColormap={setGeneExpressionColormap}\n geneExpressionColormapRange={geneExpressionColormapRange}\n setGeneExpressionColormapRange={setGeneExpressionColormapRange}\n />\n )}\n >\n <Scatterplot\n ref={deckRef}\n uuid={uuid}\n theme={theme}\n viewState={{ zoom, target: [targetX, targetY, targetZ] }}\n setViewState={({ zoom: newZoom, target }) => {\n setZoom(newZoom);\n setTargetX(target[0]);\n setTargetY(target[1]);\n setTargetZ(target[2] || 0);\n }}\n cells={cells}\n mapping={mapping}\n cellFilter={cellFilter}\n cellSelection={cellSelection}\n cellHighlight={cellHighlight}\n cellColors={cellColors}\n cellSetPolygons={cellSetPolygons}\n cellSetLabelSize={cellSetLabelSize}\n cellSetLabelsVisible={cellSetLabelsVisible}\n cellSetPolygonsVisible={cellSetPolygonsVisible}\n setCellFilter={setCellFilter}\n setCellSelection={setCellSelectionProp}\n setCellHighlight={setCellHighlight}\n cellRadius={cellRadius}\n cellOpacity={cellOpacity}\n cellColorEncoding={cellColorEncoding}\n geneExpressionColormap={geneExpressionColormap}\n geneExpressionColormapRange={geneExpressionColormapRange}\n setComponentHover={() => {\n setComponentHover(uuid);\n }}\n updateViewInfo={setComponentViewInfo}\n getExpressionValue={getExpressionValue}\n getCellIsSelected={getCellIsSelected}\n\n />\n {!disableTooltip && (\n <ScatterplotTooltipSubscriber\n parentUuid={uuid}\n cellHighlight={cellHighlight}\n width={width}\n height={height}\n getCellInfo={getCellInfo}\n />\n )}\n </TitleInfo>\n );\n}\n","import React, { forwardRef } from 'react';\nimport isEqual from 'lodash/isEqual';\nimport { COORDINATE_SYSTEM } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport { PolygonLayer, ScatterplotLayer } from '@deck.gl/layers'; // eslint-disable-line import/no-extraneous-dependencies\nimport { Matrix4 } from 'math.gl';\nimport {\n ScaleBarLayer,\n MultiscaleImageLayer,\n AdditiveColormapExtension,\n ColorPaletteExtension,\n} from '@hms-dbmi/viv';\nimport { getSelectionLayers } from '../../layers';\nimport { cellLayerDefaultProps, PALETTE, getDefaultColor } from '../utils';\nimport { getSourceFromLoader } from '../../utils';\nimport { square, getLayerLoaderTuple, renderSubBitmaskLayers } from './utils';\nimport AbstractSpatialOrScatterplot from '../shared-spatial-scatterplot/AbstractSpatialOrScatterplot';\nimport { createCellsQuadTree } from '../shared-spatial-scatterplot/quadtree';\nimport { ScaledExpressionExtension } from '../../layer-extensions';\n\nconst CELLS_LAYER_ID = 'cells-layer';\nconst MOLECULES_LAYER_ID = 'molecules-layer';\nconst NEIGHBORHOODS_LAYER_ID = 'neighborhoods-layer';\n\n// Default getter function props.\nconst defaultGetCellCoords = cell => cell.xy;\nconst makeDefaultGetCellPolygon = radius => (cellEntry) => {\n const cell = cellEntry[1];\n return cell.poly?.length ? cell.poly : square(cell.xy[0], cell.xy[1], radius);\n};\nconst makeDefaultGetCellColors = (cellColors, theme) => (cellEntry) => {\n const [r, g, b, a] = (cellColors && cellColors.get(cellEntry[0])) || getDefaultColor(theme);\n return [r, g, b, 255 * (a || 1)];\n};\nconst makeDefaultGetCellIsSelected = (cellSelection) => {\n if (cellSelection) {\n // For performance, convert the Array to a Set instance.\n // Set.has() is faster than Array.includes().\n const cellSelectionSet = new Set(cellSelection);\n return cellEntry => (cellSelectionSet.has(cellEntry[0]) ? 1.0 : 0.0);\n }\n return () => 0.0;\n};\n\n/**\n * React component which expresses the spatial relationships between cells and molecules.\n * @param {object} props\n * @param {string} props.uuid A unique identifier for this component,\n * used to determine when to show tooltips vs. crosshairs.\n * @param {number} props.height Height of the DeckGL canvas, used when\n * rendering the scale bar layer.\n * @param {number} props.width Width of the DeckGL canvas, used when\n * rendering the scale bar layer.\n * @param {object} props.viewState The DeckGL viewState object.\n * @param {function} props.setViewState A handler for updating the DeckGL\n * viewState object.\n * @param {object} props.molecules Molecules data.\n * @param {object} props.cells Cells data.\n * @param {object} props.neighborhoods Neighborhoods data.\n * @param {number} props.lineWidthScale Width of cell border in view space (deck.gl).\n * @param {number} props.lineWidthMaxPixels Max width of the cell border in pixels (deck.gl).\n * @param {object} props.imageLayerLoaders An object mapping raster layer index to Viv loader\n * instances.\n * @param {object} props.cellColors Map from cell IDs to colors [r, g, b].\n * @param {function} props.getCellCoords Getter function for cell coordinates\n * (used by the selection layer).\n * @param {function} props.getCellColor Getter function for cell color as [r, g, b] array.\n * @param {function} props.getCellPolygon Getter function for cell polygons.\n * @param {function} props.getCellIsSelected Getter function for cell layer isSelected.\n * @param {function} props.getMoleculeColor\n * @param {function} props.getMoleculePosition\n * @param {function} props.getNeighborhoodPolygon\n * @param {function} props.updateViewInfo Handler for DeckGL viewport updates,\n * used when rendering tooltips and crosshairs.\n * @param {function} props.onCellClick Getter function for cell layer onClick.\n * @param {string} props.theme \"light\" or \"dark\" for the vitessce theme\n */\nclass Spatial extends AbstractSpatialOrScatterplot {\n constructor(props) {\n super(props);\n\n // To avoid storing large arrays/objects\n // in React state, this component\n // uses instance variables.\n // All instance variables used in this class:\n this.cellsEntries = [];\n this.moleculesEntries = [];\n this.cellsQuadTree = null;\n this.cellsLayer = null;\n this.moleculesLayer = null;\n this.neighborhoodsLayer = null;\n this.imageLayers = [];\n this.layerLoaderSelections = {};\n // Better for the bitmask layer when there is no color data to use this.\n // 2048 is best for performance and for stability (4096 texture size is not always supported).\n this.randomColorData = {\n data: new Uint8Array(2048 * 2048 * 3)\n .map((_, j) => (j < 4 ? 0 : Math.round(255 * Math.random()))),\n // This buffer should be able to hold colors for 2048 x 2048 ~ 4 million cells.\n height: 2048,\n width: 2048,\n };\n this.color = { ...this.randomColorData };\n this.expression = {\n data: new Uint8Array(2048 * 2048),\n // This buffer should be able to hold colors for 2048 x 2048 ~ 4 million cells.\n height: 2048,\n width: 2048,\n };\n\n // Initialize data and layers.\n this.onUpdateCellsData();\n this.onUpdateCellsLayer();\n this.onUpdateMoleculesData();\n this.onUpdateMoleculesLayer();\n this.onUpdateNeighborhoodsData();\n this.onUpdateNeighborhoodsLayer();\n this.onUpdateImages();\n }\n\n createCellsLayer(layerDef) {\n const {\n radius, stroked, visible, opacity,\n } = layerDef;\n const { cellsEntries } = this;\n const {\n theme,\n cellFilter,\n cellSelection,\n setCellHighlight,\n setComponentHover,\n getCellIsSelected = makeDefaultGetCellIsSelected(\n cellsEntries.length === cellSelection.length ? null : cellSelection,\n ),\n cellColors,\n getCellColor = makeDefaultGetCellColors(cellColors, theme),\n getCellPolygon = makeDefaultGetCellPolygon(radius),\n onCellClick,\n lineWidthScale = 10,\n lineWidthMaxPixels = 2,\n geneExpressionColormapRange,\n cellColorEncoding,\n getExpressionValue,\n geneExpressionColormap,\n } = this.props;\n const filteredCellsEntries = cellFilter\n ? cellsEntries.filter(cellEntry => cellFilter.includes(cellEntry[0]))\n : cellsEntries;\n\n // Graphics rendering has the y-axis positive going south,\n // so we need to flip it for rendering tooltips.\n const flipYTooltip = true;\n\n return new PolygonLayer({\n id: CELLS_LAYER_ID,\n backgroundColor: [0, 0, 0],\n isSelected: getCellIsSelected,\n getPolygon: getCellPolygon,\n updateTriggers: {\n getLineWidth: [stroked],\n isSelected: cellSelection,\n getExpressionValue,\n getFillColor: [opacity, cellColorEncoding, cellSelection, cellColors],\n getLineColor: [cellColorEncoding, cellSelection, cellColors],\n },\n getFillColor: (cellEntry) => {\n const color = getCellColor(cellEntry);\n color[3] = opacity * 255;\n return color;\n },\n getLineColor: (cellEntry) => {\n const color = getCellColor(cellEntry);\n color[3] = 255;\n return color;\n },\n onClick: (info) => {\n if (onCellClick) {\n onCellClick(info);\n }\n },\n visible,\n getLineWidth: stroked ? 1 : 0,\n lineWidthScale,\n lineWidthMaxPixels,\n getExpressionValue,\n extensions: [new ScaledExpressionExtension()],\n colorScaleLo: geneExpressionColormapRange[0],\n colorScaleHi: geneExpressionColormapRange[1],\n isExpressionMode: cellColorEncoding === 'geneSelection',\n colormap: geneExpressionColormap,\n ...cellLayerDefaultProps(\n filteredCellsEntries,\n undefined,\n setCellHighlight,\n setComponentHover,\n flipYTooltip,\n ),\n });\n }\n\n createMoleculesLayer(layerDef) {\n const {\n setMoleculeHighlight,\n getMoleculeColor = d => PALETTE[d[2] % PALETTE.length],\n getMoleculePosition = d => [d[0], d[1], 0],\n } = this.props;\n const { moleculesEntries } = this;\n\n return new ScatterplotLayer({\n id: MOLECULES_LAYER_ID,\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: moleculesEntries,\n pickable: true,\n autoHighlight: true,\n radiusMaxPixels: 3,\n opacity: layerDef.opacity,\n visible: layerDef.visible,\n getRadius: layerDef.radius,\n getPosition: getMoleculePosition,\n getLineColor: getMoleculeColor,\n getFillColor: getMoleculeColor,\n onHover: (info) => {\n if (setMoleculeHighlight) {\n if (info.object) {\n setMoleculeHighlight(info.object[3]);\n } else {\n setMoleculeHighlight(null);\n }\n }\n },\n });\n }\n\n createNeighborhoodsLayer(layerDef) {\n const {\n getNeighborhoodPolygon = (neighborhoodsEntry) => {\n const neighborhood = neighborhoodsEntry[1];\n return neighborhood.poly;\n },\n } = this.props;\n const { neighborhoodsEntries } = this;\n\n return new PolygonLayer({\n id: NEIGHBORHOODS_LAYER_ID,\n getPolygon: getNeighborhoodPolygon,\n coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,\n data: neighborhoodsEntries,\n pickable: true,\n autoHighlight: true,\n stroked: true,\n filled: false,\n getElevation: 0,\n getLineWidth: 10,\n visible: layerDef.visible,\n });\n }\n\n createSelectionLayers() {\n const {\n viewState,\n getCellCoords = defaultGetCellCoords,\n setCellSelection,\n } = this.props;\n const { tool } = this.state;\n const { cellsQuadTree } = this;\n return getSelectionLayers(\n tool,\n viewState.zoom,\n CELLS_LAYER_ID,\n getCellCoords,\n setCellSelection,\n cellsQuadTree,\n );\n }\n\n createScaleBarLayer() {\n const {\n viewState,\n width,\n height,\n imageLayerLoaders = {},\n layers,\n } = this.props;\n const use3d = (layers || []).some(i => i.use3d);\n // Just get the first layer/loader since they should all be spatially\n // resolved and therefore have the same unit size scale.\n const loaders = Object.values(imageLayerLoaders);\n if (!viewState || !width || !height || loaders.length < 1) return null;\n const loader = loaders[0];\n if (!loader) return null;\n const source = getSourceFromLoader(loader);\n if (!source.meta) return null;\n const { physicalSizes } = source.meta;\n if (physicalSizes && !use3d) {\n const { x } = physicalSizes;\n const { unit, size } = x;\n if (unit && size) {\n return new ScaleBarLayer({\n id: 'scalebar-layer',\n unit,\n size,\n viewState: { ...viewState, width, height },\n });\n }\n return null;\n }\n return null;\n }\n\n createImageLayer(rawLayerDef, loader, i) {\n const layerDef = {\n ...rawLayerDef,\n channels: rawLayerDef.channels.filter(\n channel => channel.selection && channel.color && channel.slider,\n ),\n };\n\n // We need to keep the same selections array reference,\n // otherwise the Viv layer will not be re-used as we want it to,\n // since selections is one of its `updateTriggers`.\n // Reference: https://github.com/hms-dbmi/viv/blob/ad86d0f/src/layers/MultiscaleImageLayer/MultiscaleImageLayer.js#L127\n let selections;\n const nextLoaderSelection = layerDef.channels.map(c => c.selection);\n const prevLoaderSelection = this.layerLoaderSelections[layerDef.index];\n if (isEqual(prevLoaderSelection, nextLoaderSelection)) {\n selections = prevLoaderSelection;\n } else {\n selections = nextLoaderSelection;\n this.layerLoaderSelections[layerDef.index] = nextLoaderSelection;\n }\n const useTransparentColor = (!layerDef.visible\n && typeof layerDef.visible === 'boolean')\n || Boolean(layerDef.transparentColor);\n const transparentColor = useTransparentColor ? [0, 0, 0] : null;\n const layerProps = {\n colormap: layerDef.colormap,\n opacity: layerDef.opacity,\n useTransparentColor,\n transparentColor,\n colors: layerDef.channels.map(c => c.color),\n sliders: layerDef.channels.map(c => c.slider),\n resolution: layerDef.resolution,\n renderingMode: layerDef.renderingMode,\n xSlice: layerDef.xSlice,\n ySlice: layerDef.ySlice,\n zSlice: layerDef.zSlice,\n callback: layerDef.callback,\n visibilities: layerDef.channels.map(c => (!layerDef.visible && typeof layerDef.visible === 'boolean'\n ? false\n : c.visible)),\n };\n\n if (!loader || !layerProps) return null;\n const {\n metadata: { transform },\n data,\n } = loader;\n let modelMatrix;\n if (transform) {\n const { scale, translate } = transform;\n modelMatrix = new Matrix4()\n .translate([translate.x, translate.y, 0])\n .scale(scale);\n } else if (layerDef.modelMatrix) {\n // eslint-disable-next-line prefer-destructuring\n modelMatrix = new Matrix4(layerDef.modelMatrix);\n }\n if (rawLayerDef.type === 'bitmask') {\n const {\n geneExpressionColormap,\n geneExpressionColormapRange = [0.0, 1.0],\n cellColorEncoding,\n } = this.props;\n return new MultiscaleImageLayer({\n // `bitmask` is used by the AbstractSpatialOrScatterplot\n // https://github.com/vitessce/vitessce/pull/927/files#diff-9cab35a2ca0c5b6d9754b177810d25079a30ca91efa062d5795181360bc3ff2cR111\n id: `bitmask-layer-${layerDef.index}-${i}`,\n channelsVisible: layerProps.visibilities,\n opacity: layerProps.opacity,\n modelMatrix,\n hoveredCell: Number(this.props.cellHighlight),\n renderSubLayers: renderSubBitmaskLayers,\n loader: data,\n selections,\n // For some reason, deck.gl doesn't recognize the prop diffing\n // unless these are separated out. I don't think it's a bug, just\n // has to do with the fact that we don't have it in the `defaultProps`,\n // could be wrong though.\n cellColorData: this.color.data,\n cellTexHeight: this.color.height,\n cellTexWidth: this.color.width,\n excludeBackground: true,\n onViewportLoad: layerProps.callback,\n colorScaleLo: geneExpressionColormapRange[0],\n colorScaleHi: geneExpressionColormapRange[1],\n isExpressionMode: cellColorEncoding === 'geneSelection',\n colormap: geneExpressionColormap,\n expressionData: this.expression.data,\n });\n }\n const [Layer, layerLoader] = getLayerLoaderTuple(data, layerDef.use3d);\n\n const extensions = (layerDef.use3d ? [] : [\n ...(layerProps.colormap ? [\n new AdditiveColormapExtension(),\n ] : [\n new ColorPaletteExtension(),\n ]),\n ]);\n\n return new Layer({\n loader: layerLoader,\n id: `${layerDef.use3d ? 'volume' : 'image'}-layer-${layerDef.index}-${i}`,\n colors: layerProps.colors,\n contrastLimits: layerProps.sliders,\n selections,\n channelsVisible: layerProps.visibilities,\n opacity: layerProps.opacity,\n colormap: layerProps.colormap,\n modelMatrix,\n transparentColor: layerProps.transparentColor,\n useTransparentColor: layerProps.useTransparentColor,\n resolution: layerProps.resolution,\n renderingMode: layerProps.renderingMode,\n pickable: false,\n xSlice: layerProps.xSlice,\n ySlice: layerProps.ySlice,\n zSlice: layerProps.zSlice,\n onViewportLoad: layerProps.callback,\n extensions,\n });\n }\n\n createImageLayers() {\n const {\n layers,\n imageLayerLoaders = {},\n rasterLayersCallbacks = [],\n } = this.props;\n const use3d = (layers || []).some(i => i.use3d);\n const use3dIndex = (layers || []).findIndex(i => i.use3d);\n return (layers || [])\n .filter(layer => layer.type === 'raster' || layer.type === 'bitmask')\n .filter(layer => (use3d ? layer.use3d === use3d : true))\n .map((layer, i) => this.createImageLayer(\n { ...layer, callback: rasterLayersCallbacks[use3d ? use3dIndex : i] },\n imageLayerLoaders[layer.index],\n i,\n ));\n }\n\n getLayers() {\n const {\n imageLayers, cellsLayer, neighborhoodsLayer, moleculesLayer,\n } = this;\n return [\n ...imageLayers,\n cellsLayer,\n neighborhoodsLayer,\n moleculesLayer,\n this.createScaleBarLayer(),\n ...this.createSelectionLayers(),\n ];\n }\n\n onUpdateCellsData() {\n const { cells = {}, getCellCoords = defaultGetCellCoords } = this.props;\n const cellsEntries = Object.entries(cells);\n this.cellsEntries = cellsEntries;\n this.cellsQuadTree = createCellsQuadTree(cellsEntries, getCellCoords);\n }\n\n onUpdateCellsLayer() {\n const { layers } = this.props;\n const layerDef = (layers || []).find(layer => layer.type === 'cells');\n if (layerDef) {\n this.cellsLayer = this.createCellsLayer(layerDef);\n } else {\n this.cellsLayer = null;\n }\n }\n\n onUpdateCellColors() {\n const color = this.randomColorData;\n const { size } = this.props.cellColors;\n if (typeof size === 'number') {\n const cellIds = this.props.cellColors.keys();\n color.data = new Uint8Array(color.height * color.width * 3).fill(\n getDefaultColor(this.props.theme)[0],\n );\n // 0th cell id is the empty space of the image i.e black color.\n color.data[0] = 0;\n color.data[1] = 0;\n color.data[2] = 0;\n // eslint-disable-next-line no-restricted-syntax\n for (const id of cellIds) {\n if (id > 0) {\n const cellColor = this.props.cellColors.get(id);\n if (cellColor) {\n color.data.set(cellColor.slice(0, 3), Number(id) * 3);\n }\n }\n }\n }\n this.color = color;\n }\n\n onUpdateExpressionData() {\n const { expressionData } = this.props;\n if (expressionData[0]?.length) {\n this.expression.data = new Uint8Array(\n this.expression.height * this.expression.width,\n );\n this.expression.data.set(expressionData[0]);\n }\n }\n\n onUpdateMoleculesData() {\n const { molecules = {} } = this.props;\n const moleculesEntries = Object.entries(molecules).flatMap(\n ([molecule, coords], index) => coords.map(([x, y]) => [x, y, index, molecule]),\n );\n this.moleculesEntries = moleculesEntries;\n }\n\n onUpdateMoleculesLayer() {\n const { layers } = this.props;\n const layerDef = (layers || []).find(layer => layer.type === 'molecules');\n if (layerDef) {\n this.moleculesLayer = this.createMoleculesLayer(layerDef);\n } else {\n this.moleculesLayer = null;\n }\n }\n\n onUpdateNeighborhoodsData() {\n const { neighborhoods = {} } = this.props;\n const neighborhoodsEntries = Object.entries(neighborhoods);\n this.neighborhoodsEntries = neighborhoodsEntries;\n }\n\n onUpdateNeighborhoodsLayer() {\n const { layers } = this.props;\n const layerDef = (layers || []).find(\n layer => layer.type === 'neighborhoods',\n );\n if (layerDef) {\n this.neighborhoodsLayer = this.createNeighborhoodsLayer(layerDef);\n } else {\n this.neighborhoodsLayer = null;\n }\n }\n\n onUpdateImages() {\n this.imageLayers = this.createImageLayers();\n }\n\n viewInfoDidUpdate() {\n const { getCellCoords = defaultGetCellCoords } = this.props;\n super.viewInfoDidUpdate(getCellCoords);\n }\n\n /**\n * Here, asynchronously check whether props have\n * updated which require re-computing memoized variables,\n * followed by a re-render.\n * This function does not follow React conventions or paradigms,\n * it is only implemented this way to try to squeeze out\n * performance.\n * @param {object} prevProps The previous props to diff against.\n */\n componentDidUpdate(prevProps) {\n this.viewInfoDidUpdate();\n\n const shallowDiff = propName => prevProps[propName] !== this.props[propName];\n if (['cells'].some(shallowDiff)) {\n // Cells data changed.\n this.onUpdateCellsData();\n this.forceUpdate();\n }\n\n if (\n [\n 'layers',\n 'cells',\n 'cellFilter',\n 'cellSelection',\n 'cellColors',\n 'geneExpressionColormapRange',\n 'cellColorEncoding',\n 'geneExpressionColormap',\n ].some(shallowDiff)\n ) {\n // Cells layer props changed.\n this.onUpdateCellsLayer();\n this.forceUpdate();\n }\n\n if (['cellColors'].some(shallowDiff)) {\n // Cells Color layer props changed.\n this.onUpdateCellColors();\n this.forceUpdate();\n }\n\n if (['expressionData'].some(shallowDiff)) {\n // Expression data prop changed.\n this.onUpdateExpressionData();\n this.forceUpdate();\n }\n\n if (['molecules'].some(shallowDiff)) {\n // Molecules data changed.\n this.onUpdateMoleculesData();\n this.forceUpdate();\n }\n\n if (['layers', 'molecules'].some(shallowDiff)) {\n // Molecules layer props changed.\n this.onUpdateMoleculesLayer();\n this.forceUpdate();\n }\n\n if (['neighborhoods'].some(shallowDiff)) {\n // Neighborhoods data changed.\n this.onUpdateNeighborhoodsData();\n this.forceUpdate();\n }\n\n if (['layers', 'neighborhoods'].some(shallowDiff)) {\n // Neighborhoods layer props changed.\n this.onUpdateNeighborhoodsLayer();\n this.forceUpdate();\n }\n\n if (\n [\n 'layers',\n 'imageLayerLoaders',\n 'cellColors',\n 'cellHighlight',\n 'geneExpressionColormapRange',\n 'expressionData',\n 'rasterLayersCallbacks',\n 'geneExpressionColormap',\n ].some(shallowDiff)\n ) {\n // Image layers changed.\n this.onUpdateImages();\n this.forceUpdate();\n }\n }\n\n // render() is implemented in the abstract parent class.\n}\n\n/**\n * Need this wrapper function here,\n * since we want to pass a forwardRef\n * so that outer components can\n * access the grandchild DeckGL ref,\n * but we are using a class component.\n */\nconst SpatialWrapper = forwardRef((props, deckRef) => (\n <Spatial {...props} deckRef={deckRef} />\n));\nexport default SpatialWrapper;\n","import React, { useCallback } from 'react';\nimport debounce from 'lodash/debounce';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Slider from '@material-ui/core/Slider';\nimport { makeStyles, createStyles } from '@material-ui/core/styles';\nimport { useStyles } from '../shared-plot-options/styles';\nimport OptionsContainer from '../shared-plot-options/OptionsContainer';\nimport CellColorEncodingOption from '../shared-plot-options/CellColorEncodingOption';\nimport OptionSelect from '../shared-plot-options/OptionSelect';\nimport { GLSL_COLORMAPS } from '../../layers/constants';\n\nconst useToggleStyles = makeStyles(() => createStyles({\n cameraLabel: {\n padding: '0px 0px 0px 16px',\n },\n box: {\n padding: '0px',\n },\n button: {\n padding: '0px 0px 0px 8px',\n },\n}));\n\nconst ToggleFixedAxisButton = ({\n setSpatialAxisFixed,\n spatialAxisFixed,\n use3d,\n}) => {\n const classes = useToggleStyles();\n return (\n <TableRow>\n <TableCell className={classes.cameraLabel}>\n Fix Camera Axis\n </TableCell>\n <TableCell className={classes.box}>\n <Checkbox\n onClick={() => setSpatialAxisFixed(!spatialAxisFixed)}\n disabled={!use3d}\n checked={Boolean(spatialAxisFixed)}\n />\n </TableCell>\n </TableRow>\n );\n};\n\nexport default function SpatialOptions(props) {\n const {\n observationsLabel,\n cellColorEncoding,\n setCellColorEncoding,\n setSpatialAxisFixed,\n spatialAxisFixed,\n use3d,\n geneExpressionColormap,\n setGeneExpressionColormap,\n geneExpressionColormapRange,\n setGeneExpressionColormapRange,\n canShowExpressionOptions,\n canShowColorEncodingOption,\n canShow3DOptions,\n } = props;\n\n function handleGeneExpressionColormapChange(event) {\n setGeneExpressionColormap(event.target.value);\n }\n\n function handleColormapRangeChange(event, value) {\n setGeneExpressionColormapRange(value);\n }\n const handleColormapRangeChangeDebounced = useCallback(\n debounce(handleColormapRangeChange, 5, { trailing: true }),\n [handleColormapRangeChange],\n );\n\n const classes = useStyles();\n\n return (\n <OptionsContainer>\n {canShowColorEncodingOption ? (\n <CellColorEncodingOption\n observationsLabel={observationsLabel}\n cellColorEncoding={cellColorEncoding}\n setCellColorEncoding={setCellColorEncoding}\n />\n ) : null}\n {canShow3DOptions ? (\n <ToggleFixedAxisButton\n setSpatialAxisFixed={setSpatialAxisFixed}\n spatialAxisFixed={spatialAxisFixed}\n use3d={use3d}\n />\n ) : null}\n {canShowExpressionOptions ? (\n <>\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"gene-expression-colormap-select\">\n Gene Expression Colormap\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={geneExpressionColormap}\n onChange={handleGeneExpressionColormapChange}\n inputProps={{\n id: 'gene-expression-colormap-select',\n }}\n >\n {GLSL_COLORMAPS.map(cmap => (\n <option key={cmap} value={cmap}>{cmap}</option>\n ))}\n </OptionSelect>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n Gene Expression Colormap Range\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={geneExpressionColormapRange}\n onChange={handleColormapRangeChangeDebounced}\n aria-labelledby=\"gene-expression-colormap-range-slider\"\n valueLabelDisplay=\"auto\"\n step={0.005}\n min={0.0}\n max={1.0}\n />\n </TableCell>\n </TableRow>\n </>\n ) : null}\n </OptionsContainer>\n );\n}\n","import React from 'react';\nimport Tooltip2D from '../tooltip/Tooltip2D';\nimport TooltipContent from '../tooltip/TooltipContent';\nimport { useComponentHover, useComponentViewInfo } from '../../app/state/hooks';\n\nexport default function SpatialTooltipSubscriber(props) {\n const {\n parentUuid,\n cellHighlight,\n width,\n height,\n getCellInfo,\n } = props;\n\n const sourceUuid = useComponentHover();\n const viewInfo = useComponentViewInfo(parentUuid);\n\n const [cellInfo, x, y] = (cellHighlight && getCellInfo ? (\n [\n getCellInfo(cellHighlight),\n ...(viewInfo && viewInfo.project ? viewInfo.project(cellHighlight) : [null, null]),\n ]\n ) : ([null, null, null]));\n\n return (\n (cellInfo ? (\n <Tooltip2D\n x={x}\n y={y}\n parentUuid={parentUuid}\n sourceUuid={sourceUuid}\n parentWidth={width}\n parentHeight={height}\n >\n <TooltipContent info={cellInfo} />\n </Tooltip2D>\n ) : null)\n );\n}\n","import React, { useEffect, useMemo, useCallback } from 'react';\nimport TitleInfo from '../TitleInfo';\nimport { capitalize } from '../../utils';\nimport {\n useDeckCanvasSize, useReady, useUrls, useExpressionValueGetter,\n} from '../hooks';\nimport { setCellSelection, mergeCellSets, canLoadResolution } from '../utils';\nimport {\n useCellsData,\n useCellSetsData,\n useGeneSelection,\n useMoleculesData,\n useNeighborhoodsData,\n useRasterData,\n useExpressionAttrs,\n} from '../data-hooks';\nimport { getCellColors } from '../interpolate-colors';\nimport Spatial from './Spatial';\nimport SpatialOptions from './SpatialOptions';\nimport SpatialTooltipSubscriber from './SpatialTooltipSubscriber';\nimport { makeSpatialSubtitle, getInitialSpatialTargets } from './utils';\nimport {\n useCoordination,\n useLoaders,\n useSetComponentHover,\n useSetComponentViewInfo,\n useAuxiliaryCoordination,\n} from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\n\nconst SPATIAL_DATA_TYPES = [\n 'cells', 'molecules', 'raster', 'cell-sets', 'expression-matrix',\n];\n\n/**\n * A subscriber component for the spatial plot.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n */\nexport default function SpatialSubscriber(props) {\n const {\n uuid,\n coordinationScopes,\n removeGridComponent,\n observationsLabelOverride: observationsLabel = 'cell',\n observationsPluralLabelOverride: observationsPluralLabel = `${observationsLabel}s`,\n subobservationsLabelOverride: subobservationsLabel = 'molecule',\n subobservationsPluralLabelOverride: subobservationsPluralLabel = `${subobservationsLabel}s`,\n theme,\n disableTooltip = false,\n title = 'Spatial',\n disable3d,\n globalDisable3d,\n } = props;\n\n const loaders = useLoaders();\n const setComponentHover = useSetComponentHover();\n const setComponentViewInfo = useSetComponentViewInfo(uuid);\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n spatialZoom: zoom,\n spatialTargetX: targetX,\n spatialTargetY: targetY,\n spatialTargetZ: targetZ,\n spatialRotationX: rotationX,\n spatialRotationY: rotationY,\n spatialRotationZ: rotationZ,\n spatialRotationOrbit: rotationOrbit,\n spatialOrbitAxis: orbitAxis,\n spatialRasterLayers: rasterLayers,\n spatialCellsLayer: cellsLayer,\n spatialMoleculesLayer: moleculesLayer,\n spatialNeighborhoodsLayer: neighborhoodsLayer,\n cellFilter,\n cellHighlight,\n geneSelection,\n cellSetSelection,\n cellSetColor,\n cellColorEncoding,\n additionalCellSets,\n spatialAxisFixed,\n geneExpressionColormap,\n geneExpressionColormapRange,\n }, {\n setSpatialZoom: setZoom,\n setSpatialTargetX: setTargetX,\n setSpatialTargetY: setTargetY,\n setSpatialTargetZ: setTargetZ,\n setSpatialRotationX: setRotationX,\n setSpatialRotationOrbit: setRotationOrbit,\n setSpatialOrbitAxis: setOrbitAxis,\n setSpatialRasterLayers: setRasterLayers,\n setSpatialCellsLayer: setCellsLayer,\n setSpatialMoleculesLayer: setMoleculesLayer,\n setSpatialNeighborhoodsLayer: setNeighborhoodsLayer,\n setCellFilter,\n setCellSetSelection,\n setCellHighlight,\n setCellSetColor,\n setCellColorEncoding,\n setAdditionalCellSets,\n setMoleculeHighlight,\n setSpatialAxisFixed,\n setGeneExpressionColormap,\n setGeneExpressionColormapRange,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.spatial, coordinationScopes);\n\n const [\n {\n rasterLayersCallbacks,\n },\n ] = useAuxiliaryCoordination(\n COMPONENT_COORDINATION_TYPES.layerController,\n coordinationScopes,\n );\n\n const use3d = rasterLayers?.some(l => l.use3d);\n\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady,\n resetReadyItems,\n ] = useReady(\n SPATIAL_DATA_TYPES,\n );\n const [width, height, deckRef] = useDeckCanvasSize();\n\n // Reset file URLs and loader progress when the dataset has changed.\n // Also clear the array of automatically-initialized layers.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [cells, cellsCount] = useCellsData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setSpatialCellsLayer: setCellsLayer },\n { spatialCellsLayer: cellsLayer },\n );\n const [molecules, moleculesCount, locationsCount] = useMoleculesData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setSpatialMoleculesLayer: setMoleculesLayer },\n { spatialMoleculesLayer: moleculesLayer },\n );\n const [neighborhoods] = useNeighborhoodsData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setSpatialNeighborhoodsLayer: setNeighborhoodsLayer },\n { spatialNeighborhoodsLayer: neighborhoodsLayer },\n );\n const [cellSets] = useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setCellSetSelection, setCellSetColor },\n { cellSetSelection, cellSetColor },\n );\n const [expressionData] = useGeneSelection(\n loaders, dataset, setItemIsReady, false, geneSelection, setItemIsNotReady,\n );\n const [attrs] = useExpressionAttrs(\n loaders, dataset, setItemIsReady, addUrl, false,\n );\n // eslint-disable-next-line no-unused-vars\n const [raster, imageLayerLoaders, imageLayerMeta] = useRasterData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setSpatialRasterLayers: setRasterLayers },\n { spatialRasterLayers: rasterLayers },\n );\n\n const layers = useMemo(() => {\n // Only want to pass in cells layer once if there is not `bitmask`.\n // We pass in the cells data regardless because it is needed for selection,\n // but the rendering layer itself is not needed.\n const canPassInCellsLayer = !imageLayerMeta.some(l => l?.metadata?.isBitmask);\n return [\n ...(moleculesLayer ? [{ ...moleculesLayer, type: 'molecules' }] : []),\n ...((cellsLayer && canPassInCellsLayer) ? [{ ...cellsLayer, type: 'cells' }] : []),\n ...(neighborhoodsLayer ? [{ ...neighborhoodsLayer, type: 'neighborhoods' }] : []),\n ...(rasterLayers ? rasterLayers.map(l => ({ ...l, type: (l.type && ['raster', 'bitmask'].includes(l.type) ? l.type : 'raster') })) : []),\n ];\n }, [cellsLayer, moleculesLayer, neighborhoodsLayer, rasterLayers, imageLayerMeta]);\n\n useEffect(() => {\n if ((typeof targetX !== 'number' || typeof targetY !== 'number')) {\n const {\n initialTargetX, initialTargetY, initialTargetZ, initialZoom,\n } = getInitialSpatialTargets({\n width,\n height,\n cells,\n imageLayerLoaders,\n useRaster: Boolean(loaders[dataset].loaders.raster),\n use3d,\n });\n setTargetX(initialTargetX);\n setTargetY(initialTargetY);\n setTargetZ(initialTargetZ);\n setZoom(initialZoom);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [imageLayerLoaders, cells, targetX, targetY, setTargetX, setTargetY, setZoom, use3d]);\n\n const mergedCellSets = useMemo(() => mergeCellSets(\n cellSets, additionalCellSets,\n ), [cellSets, additionalCellSets]);\n\n const setCellSelectionProp = useCallback((v) => {\n setCellSelection(\n v, additionalCellSets, cellSetColor,\n setCellSetSelection, setAdditionalCellSets, setCellSetColor,\n setCellColorEncoding,\n );\n }, [additionalCellSets, cellSetColor, setCellColorEncoding,\n setAdditionalCellSets, setCellSetColor, setCellSetSelection]);\n\n const cellColors = useMemo(() => getCellColors({\n cellColorEncoding,\n expressionData: expressionData && expressionData[0],\n geneSelection,\n cellSets: mergedCellSets,\n cellSetSelection,\n cellSetColor,\n expressionDataAttrs: attrs,\n theme,\n }), [cellColorEncoding, geneSelection, mergedCellSets, theme,\n cellSetColor, cellSetSelection, expressionData, attrs]);\n\n // The bitmask layer needs access to a array (i.e a texture) lookup of cell -> expression value\n // where each cell id indexes into the array.\n // Cell ids in `attrs.rows` do not necessaryily correspond to indices in that array, though,\n // so we create a \"shifted\" array where this is the case.\n const shiftedExpressionDataForBitmask = useMemo(() => {\n const hasBitmask = imageLayerMeta.some(l => l?.metadata?.isBitmask);\n if (attrs?.rows && expressionData && hasBitmask) {\n const maxId = attrs.rows.reduce((max, curr) => Math.max(max, Number(curr)));\n const result = new Uint8Array(maxId + 1);\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < attrs.rows.length; i++) {\n const id = attrs.rows[i];\n result.set(expressionData[0].slice(i, i + 1), Number(id));\n }\n return [result];\n } return [new Uint8Array()];\n }, [attrs, expressionData, imageLayerMeta]);\n\n const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);\n\n const getCellInfo = (cellId) => {\n const cell = cells[cellId];\n if (cell) {\n return {\n [`${capitalize(observationsLabel)} ID`]: cellId,\n ...cell.factors,\n };\n }\n return null;\n };\n\n const setViewState = ({\n zoom: newZoom,\n target,\n rotationX: newRotationX,\n rotationOrbit: newRotationOrbit,\n orbitAxis: newOrbitAxis,\n }) => {\n setZoom(newZoom);\n setTargetX(target[0]);\n setTargetY(target[1]);\n setTargetZ(target[2] || null);\n setRotationX(newRotationX);\n setRotationOrbit(newRotationOrbit);\n setOrbitAxis(newOrbitAxis || null);\n };\n\n const subtitle = makeSpatialSubtitle({\n observationsCount: cellsCount,\n observationsLabel,\n observationsPluralLabel,\n subobservationsCount: moleculesCount,\n subobservationsLabel,\n subobservationsPluralLabel,\n locationsCount,\n });\n\n // Set up a getter function for gene expression values, to be used\n // by the DeckGL layer to obtain values for instanced attributes.\n const getExpressionValue = useExpressionValueGetter({ attrs, expressionData });\n const hasExpressionData = loaders[dataset].loaders['expression-matrix'];\n const hasCellsData = loaders[dataset].loaders.cells\n || imageLayerMeta.some(l => l?.metadata?.isBitmask);\n const canLoad3DLayers = imageLayerLoaders.some(loader => Boolean(\n Array.from({\n length: loader.data.length,\n }).filter((_, res) => canLoadResolution(loader.data, res)).length,\n ));\n // Only show 3D options if we can theoretically load the data and it is allowed to be loaded.\n const canShow3DOptions = canLoad3DLayers\n && !(disable3d?.length === imageLayerLoaders.length) && !globalDisable3d;\n\n return (\n <TitleInfo\n title={title}\n info={subtitle}\n isSpatial\n urls={urls}\n theme={theme}\n removeGridComponent={removeGridComponent}\n isReady={isReady}\n options={\n // Only show button if there is expression or 3D data because only cells data\n // does not have any options (i.e for color encoding, you need to switch to expression data)\n canShow3DOptions || hasExpressionData ? (\n <SpatialOptions\n observationsLabel={observationsLabel}\n cellColorEncoding={cellColorEncoding}\n setCellColorEncoding={setCellColorEncoding}\n setSpatialAxisFixed={setSpatialAxisFixed}\n spatialAxisFixed={spatialAxisFixed}\n use3d={use3d}\n geneExpressionColormap={geneExpressionColormap}\n setGeneExpressionColormap={setGeneExpressionColormap}\n geneExpressionColormapRange={geneExpressionColormapRange}\n setGeneExpressionColormapRange={setGeneExpressionColormapRange}\n canShowExpressionOptions={hasExpressionData}\n canShowColorEncodingOption={hasCellsData && hasExpressionData}\n canShow3DOptions={canShow3DOptions}\n />\n ) : null\n }\n >\n <Spatial\n ref={deckRef}\n uuid={uuid}\n width={width}\n height={height}\n viewState={{\n zoom,\n target: [targetX, targetY, targetZ],\n rotationX,\n rotationY,\n rotationZ,\n rotationOrbit,\n orbitAxis,\n }}\n setViewState={setViewState}\n layers={layers}\n cells={cells}\n cellFilter={cellFilter}\n cellSelection={cellSelection}\n cellHighlight={cellHighlight}\n cellColors={cellColors}\n molecules={molecules}\n neighborhoods={neighborhoods}\n imageLayerLoaders={imageLayerLoaders}\n setCellFilter={setCellFilter}\n setCellSelection={setCellSelectionProp}\n setCellHighlight={setCellHighlight}\n setMoleculeHighlight={setMoleculeHighlight}\n setComponentHover={() => {\n setComponentHover(uuid);\n }}\n updateViewInfo={setComponentViewInfo}\n rasterLayersCallbacks={rasterLayersCallbacks}\n spatialAxisFixed={spatialAxisFixed}\n geneExpressionColormap={geneExpressionColormap}\n geneExpressionColormapRange={geneExpressionColormapRange}\n expressionData={shiftedExpressionDataForBitmask}\n cellColorEncoding={cellColorEncoding}\n getExpressionValue={getExpressionValue}\n theme={theme}\n />\n {!disableTooltip && (\n <SpatialTooltipSubscriber\n parentUuid={uuid}\n cellHighlight={cellHighlight}\n width={width}\n height={height}\n getCellInfo={getCellInfo}\n />\n )}\n </TitleInfo>\n );\n}\n","import clamp from 'lodash/clamp';\nimport range from 'lodash/range';\n\nimport {\n AXIS_LABEL_TEXT_SIZE,\n AXIS_MIN_SIZE,\n AXIS_MAX_SIZE,\n} from '../../layers/heatmap-constants';\n\nexport function getGeneByCellTile(view, {\n tileSize, tileI, tileJ, numCells, numGenes, cellOrdering, cells,\n}) {\n const tileData = new Uint8Array(tileSize * tileSize);\n let offset;\n let value;\n let cellI;\n let geneI;\n let sortedCellI;\n\n const tileSizeRange = range(tileSize);\n\n tileSizeRange.forEach((j) => {\n // Need to iterate over cells in the outer loop.\n cellI = (tileJ * tileSize) + j;\n if (cellI < numCells) {\n sortedCellI = cells.indexOf(cellOrdering[cellI]);\n if (sortedCellI >= -1) {\n tileSizeRange.forEach((i) => {\n geneI = (tileI * tileSize) + i;\n value = view[sortedCellI * numGenes + geneI];\n offset = ((tileSize - i - 1) * tileSize + j);\n tileData[offset] = value;\n });\n }\n }\n });\n return tileData;\n}\n\nexport function getCellByGeneTile(view, {\n tileSize, tileI, tileJ, numCells, numGenes, cellOrdering, cells,\n}) {\n const tileData = new Uint8Array(tileSize * tileSize);\n let offset;\n let value;\n let cellI;\n let geneI;\n let sortedCellI;\n\n const tileSizeRange = range(tileSize);\n\n tileSizeRange.forEach((i) => {\n // Need to iterate over cells in the outer loop.\n cellI = (tileI * tileSize) + i;\n if (cellI < numCells) {\n sortedCellI = cells.indexOf(cellOrdering[cellI]);\n if (sortedCellI >= -1) {\n tileSizeRange.forEach((j) => {\n geneI = (tileJ * tileSize) + j;\n if (geneI < numGenes) {\n value = view[sortedCellI * numGenes + geneI];\n } else {\n value = 0;\n }\n offset = ((tileSize - i - 1) * tileSize + j);\n tileData[offset] = value;\n });\n }\n }\n });\n\n return tileData;\n}\n\n/**\n * Called before a layer is drawn to determine whether it should be rendered.\n * Reference: https://deck.gl/docs/api-reference/core/deck#layerfilter\n * @param {object} params A viewport, layer pair.\n * @param {object} params.layer The layer to check.\n * @param {object} params.viewport The viewport to check.\n * @returns {boolean} Should this layer be rendered in this viewport?\n */\nexport function layerFilter({ layer, viewport }) {\n if (viewport.id === 'axisLeft') {\n return layer.id.startsWith('axisLeft');\n } if (viewport.id === 'axisTop') {\n return layer.id.startsWith('axisTop');\n } if (viewport.id === 'heatmap') {\n return layer.id.startsWith('heatmap');\n } if (viewport.id === 'colorsLeft') {\n return layer.id.startsWith('colorsLeft');\n } if (viewport.id === 'colorsTop') {\n return layer.id.startsWith('colorsTop');\n }\n return false;\n}\n\n/**\n * Get the size of the left and top heatmap axes,\n * taking into account the maximum label string lengths.\n * @param {boolean} transpose Is the heatmap transposed?\n * @param {number} geneLabelMaxLength What is the maximum length gene label?\n * @param {number} cellLabelMaxLength What is the maximum length cell label?\n * @returns {number[]} [axisOffsetLeft, axisOffsetTop]\n */\nexport function getAxisSizes(transpose, geneLabelMaxLength, cellLabelMaxLength) {\n const axisOffsetLeft = clamp(\n (transpose ? geneLabelMaxLength : cellLabelMaxLength) * AXIS_LABEL_TEXT_SIZE,\n AXIS_MIN_SIZE,\n AXIS_MAX_SIZE,\n );\n const axisOffsetTop = clamp(\n (transpose ? cellLabelMaxLength : geneLabelMaxLength) * AXIS_LABEL_TEXT_SIZE,\n AXIS_MIN_SIZE,\n AXIS_MAX_SIZE,\n );\n return [axisOffsetLeft, axisOffsetTop];\n}\n\n/**\n * Convert a mouse coordinate (x, y) to a heatmap coordinate (col index, row index).\n * @param {number} mouseX The mouse X of interest.\n * @param {number} mouseY The mouse Y of interest.\n * @param {object} param2 An object containing current sizes and scale factors.\n * @returns {number[]} [colI, rowI]\n */\nexport function mouseToHeatmapPosition(mouseX, mouseY, {\n offsetLeft, offsetTop, targetX, targetY, scaleFactor, matrixWidth, matrixHeight, numRows, numCols,\n}) {\n // TODO: use linear algebra\n const viewMouseX = mouseX - offsetLeft;\n const viewMouseY = mouseY - offsetTop;\n\n if (viewMouseX < 0 || viewMouseY < 0) {\n // The mouse is outside the heatmap.\n return [null, null];\n }\n\n // Determine the rowI and colI values based on the current viewState.\n const bboxTargetX = targetX * scaleFactor + matrixWidth * scaleFactor / 2;\n const bboxTargetY = targetY * scaleFactor + matrixHeight * scaleFactor / 2;\n\n const bboxLeft = bboxTargetX - matrixWidth / 2;\n const bboxTop = bboxTargetY - matrixHeight / 2;\n\n const zoomedOffsetLeft = bboxLeft / (matrixWidth * scaleFactor);\n const zoomedOffsetTop = bboxTop / (matrixHeight * scaleFactor);\n\n const zoomedViewMouseX = viewMouseX / (matrixWidth * scaleFactor);\n const zoomedViewMouseY = viewMouseY / (matrixHeight * scaleFactor);\n\n const zoomedMouseX = zoomedOffsetLeft + zoomedViewMouseX;\n const zoomedMouseY = zoomedOffsetTop + zoomedViewMouseY;\n\n const rowI = Math.floor(zoomedMouseY * numRows);\n const colI = Math.floor(zoomedMouseX * numCols);\n return [colI, rowI];\n}\n\n/**\n * Convert a heatmap coordinate (col index, row index) to a mouse coordinate (x, y).\n * @param {number} colI The column index of interest.\n * @param {number} rowI The row index of interest.\n * @param {object} param2 An object containing current sizes and scale factors.\n * @returns {number[]} [x, y]\n */\nexport function heatmapToMousePosition(colI, rowI, {\n offsetLeft, offsetTop, targetX, targetY, scaleFactor, matrixWidth, matrixHeight, numRows, numCols,\n}) {\n // TODO: use linear algebra\n let zoomedMouseY = null;\n let zoomedMouseX = null;\n\n if (rowI !== null) {\n const minY = -matrixHeight * scaleFactor / 2;\n const maxY = matrixHeight * scaleFactor / 2;\n const totalHeight = maxY - minY;\n\n const minInViewY = (targetY * scaleFactor) - (matrixHeight / 2);\n const maxInViewY = (targetY * scaleFactor) + (matrixHeight / 2);\n const inViewHeight = maxInViewY - minInViewY;\n\n const normalizedRowY = (rowI + 0.5) / numRows;\n const globalRowY = minY + (normalizedRowY * totalHeight);\n\n if (minInViewY <= globalRowY && globalRowY <= maxInViewY) {\n zoomedMouseY = offsetTop + ((globalRowY - minInViewY) / inViewHeight) * matrixHeight;\n }\n }\n if (colI !== null) {\n const minX = -matrixWidth * scaleFactor / 2;\n const maxX = matrixWidth * scaleFactor / 2;\n const totalWidth = maxX - minX;\n\n const minInViewX = (targetX * scaleFactor) - (matrixWidth / 2);\n const maxInViewX = (targetX * scaleFactor) + (matrixWidth / 2);\n const inViewWidth = maxInViewX - minInViewX;\n\n const normalizedRowX = (colI + 0.5) / numCols;\n const globalRowX = minX + (normalizedRowX * totalWidth);\n\n if (minInViewX <= globalRowX && globalRowX <= maxInViewX) {\n zoomedMouseX = offsetLeft + ((globalRowX - minInViewX) / inViewWidth) * matrixWidth;\n }\n }\n return [zoomedMouseX, zoomedMouseY];\n}\n","// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorConcurrentHardware/hardwareConcurrency\n// We need to give a different way of getting this for safari, so 4 is probably a safe bet\n// for parallel processing in the meantime. More can't really hurt since they'll just block\n// each other and not the UI thread, which is the real benefit.\nconst defaultPoolSize = typeof navigator !== 'undefined' ? navigator.hardwareConcurrency || 4 : null;\n\n/**\n * Pool for workers to decode chunks of the images.\n * This is a line-for-line copy of GeoTIFFs old implementation: https://github.com/geotiffjs/geotiff.js/blob/v1.0.0-beta.6/src/pool.js\n */\nexport default class Pool {\n /**\n * @constructor\n * @param {object} Worker The worker class to be used for processing.\n */\n constructor(Worker) {\n this.workers = [];\n this.idleWorkers = [];\n this.waitQueue = [];\n this.decoder = null;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < defaultPoolSize; ++i) {\n const w = new Worker();\n this.workers.push(w);\n this.idleWorkers.push(w);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n async process() {\n throw new Error('Pool needs to implement \"process\" method');\n }\n\n async waitForWorker() {\n const idleWorker = this.idleWorkers.pop();\n if (idleWorker) {\n return idleWorker;\n }\n const waiter = {};\n const promise = new Promise((resolve) => {\n waiter.resolve = resolve;\n });\n\n this.waitQueue.push(waiter);\n return promise;\n }\n\n async finishTask(currentWorker) {\n const waiter = this.waitQueue.pop();\n if (waiter) {\n waiter.resolve(currentWorker);\n } else {\n this.idleWorkers.push(currentWorker);\n }\n }\n\n destroy() {\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < this.workers.length; ++i) {\n this.workers[i].terminate();\n }\n }\n}\n","import Worker from './heatmap.worker'; // eslint-disable-line import/no-unresolved\nimport Pool from '../../Pool';\n\n/**\n * Pool for workers to decode chunks of the images.\n * This is a line-for-line copy of GeoTIFFs old implementation: https://github.com/geotiffjs/geotiff.js/blob/v1.0.0-beta.6/src/pool.js\n */\nexport default class HeatmapPool extends Pool {\n constructor() {\n super(Worker);\n }\n\n /**\n * Process each heatmap tile\n * @param {object} params The arguments passed to the heatmap worker.\n * @param {string} params.curr The current task uuid.\n * @param {number} params.xTiles How many tiles required in the x direction?\n * @param {number} params.yTiles How many tiles required in the y direction?\n * @param {number} params.tileSize How many entries along each tile axis?\n * @param {string[]} params.cellOrdering The current ordering of cells.\n * @param {string[]} params.rows The name of each row (cell ID).\n * Does not take transpose into account (always cells).\n * @param {string[]} params.cols The name of each column (gene ID).\n * Does not take transpose into account (always genes).\n * @param {ArrayBuffer} params.data The array buffer.\n * Need to transfer back to main thread when done.\n * @param {boolean} params.transpose Is the heatmap transposed?\n * @returns {array} [message, transfers]\n * @returns {Promise.<ArrayBuffer>} the decoded result as a `Promise`\n */\n async process(args) {\n const currentWorker = await this.waitForWorker();\n return new Promise((resolve, reject) => {\n currentWorker.onmessage = (event) => {\n // this.workers.push(currentWorker);\n this.finishTask(currentWorker);\n resolve(event.data);\n };\n currentWorker.onerror = (error) => {\n // this.workers.push(currentWorker);\n this.finishTask(currentWorker);\n reject(error);\n };\n currentWorker.postMessage(['getTile', args], [args.data]);\n });\n }\n}\n","import React, {\n useRef, useState, useCallback, useMemo, useEffect, useReducer, forwardRef,\n} from 'react';\nimport uuidv4 from 'uuid/v4';\nimport DeckGL from 'deck.gl';\nimport { OrthographicView } from '@deck.gl/core'; // eslint-disable-line import/no-extraneous-dependencies\nimport range from 'lodash/range';\nimport clamp from 'lodash/clamp';\nimport isEqual from 'lodash/isEqual';\nimport { max } from 'd3-array';\nimport HeatmapCompositeTextLayer from '../../layers/HeatmapCompositeTextLayer';\nimport PixelatedBitmapLayer from '../../layers/PixelatedBitmapLayer';\nimport HeatmapBitmapLayer from '../../layers/HeatmapBitmapLayer';\nimport {\n DEFAULT_GL_OPTIONS,\n createDefaultUpdateCellsHover,\n createDefaultUpdateGenesHover,\n createDefaultUpdateViewInfo,\n copyUint8Array,\n} from '../utils';\nimport {\n layerFilter,\n getAxisSizes,\n mouseToHeatmapPosition,\n heatmapToMousePosition,\n} from './utils';\nimport {\n TILE_SIZE, MAX_ROW_AGG, MIN_ROW_AGG,\n COLOR_BAR_SIZE,\n AXIS_MARGIN,\n} from '../../layers/heatmap-constants';\nimport HeatmapWorkerPool from './HeatmapWorkerPool';\n/**\n * A heatmap component for cell x gene matrices.\n * @param {object} props\n * @param {string} props.uuid The uuid of this component,\n * used by tooltips to determine whether to render a tooltip or\n * a crosshair.\n * @param {string} props.theme The current theme name.\n * @param {object} props.initialViewState The initial viewState for\n * DeckGL.\n * @param {number} props.width The width of the canvas.\n * @param {number} props.height The height of the canvas.\n * @param {object} props.expressionMatrix An object { rows, cols, matrix },\n * where matrix is a flat Uint8Array, rows is a list of cell ID strings,\n * and cols is a list of gene ID strings.\n * @param {Map} props.cellColors Map of cell ID to color. Optional.\n * If defined, the key ordering is used to order the cell axis of the heatmap.\n * @param {function} props.clearPleaseWait The clear please wait callback,\n * called when the expression matrix has loaded (is not null).\n * @param {function} props.setCellHighlight Callback function called on\n * hover with the cell ID. Optional.\n * @param {function} props.setGeneHighlight Callback function called on\n * hover with the gene ID. Optional.\n * @param {function} props.updateViewInfo Callback function that gets called with an\n * object { uuid, project() } where project is a function that maps (cellId, geneId)\n * to canvas (x,y) coordinates. Used to show tooltips. Optional.\n * @param {boolean} props.transpose By default, false.\n * @param {string} props.variablesTitle By default, 'Genes'.\n * @param {string} props.observationsTitle By default, 'Cells'.\n * @param {string} props.colormap The name of the colormap function to use.\n * @param {array} props.colormapRange A tuple [lower, upper] to adjust the color scale.\n * @param {function} props.setColormapRange The setter function for colormapRange.\n */\nconst Heatmap = forwardRef((props, deckRef) => {\n const {\n uuid,\n theme,\n viewState: rawViewState,\n setViewState,\n width: viewWidth,\n height: viewHeight,\n expressionMatrix: expression,\n cellColors,\n colormap,\n colormapRange,\n clearPleaseWait,\n setComponentHover,\n setCellHighlight = createDefaultUpdateCellsHover('Heatmap'),\n setGeneHighlight = createDefaultUpdateGenesHover('Heatmap'),\n updateViewInfo = createDefaultUpdateViewInfo('Heatmap'),\n setIsRendering = () => {},\n transpose = false,\n variablesTitle = 'Genes',\n observationsTitle = 'Cells',\n } = props;\n\n const viewState = {\n ...rawViewState,\n target: (transpose ? [rawViewState.target[1], rawViewState.target[0]] : rawViewState.target),\n minZoom: 0,\n };\n\n const axisLeftTitle = (transpose ? variablesTitle : observationsTitle);\n const axisTopTitle = (transpose ? observationsTitle : variablesTitle);\n\n const workerPool = useMemo(() => new HeatmapWorkerPool(), []);\n\n useEffect(() => {\n if (clearPleaseWait && expression) {\n clearPleaseWait('expression-matrix');\n }\n }, [clearPleaseWait, expression]);\n\n const tilesRef = useRef();\n const dataRef = useRef();\n const [axisLeftLabels, setAxisLeftLabels] = useState([]);\n const [axisTopLabels, setAxisTopLabels] = useState([]);\n\n\n // Since we are storing the tile data in a ref,\n // and updating it asynchronously when the worker finishes,\n // we need to tie it to a piece of state through this iteration value.\n const [tileIteration, incTileIteration] = useReducer(i => i + 1, 0);\n\n // We need to keep a backlog of the tasks for the worker thread,\n // since the array buffer can only be held by one thread at a time.\n const [backlog, setBacklog] = useState([]);\n\n // Store a reference to the matrix Uint8Array in the dataRef,\n // since we need to access its array buffer to transfer\n // it back and forth from the worker thread.\n useEffect(() => {\n // Store the expression matrix Uint8Array in the dataRef.\n if (expression && expression.matrix) {\n dataRef.current = copyUint8Array(expression.matrix);\n }\n }, [dataRef, expression]);\n\n // Check if the ordering of axis labels needs to be changed,\n // for example if the cells \"selected\" (technically just colored)\n // have changed.\n useEffect(() => {\n if (!expression) {\n return;\n }\n const newCellOrdering = (!cellColors || cellColors.size === 0\n ? expression.rows\n : Array.from(cellColors.keys())\n );\n const oldCellOrdering = (transpose ? axisTopLabels : axisLeftLabels);\n\n if (!isEqual(oldCellOrdering, newCellOrdering)) {\n if (transpose) {\n setAxisTopLabels(newCellOrdering);\n } else {\n setAxisLeftLabels(newCellOrdering);\n }\n }\n }, [expression, cellColors, axisTopLabels, axisLeftLabels, transpose]);\n\n // Set the genes ordering.\n useEffect(() => {\n if (!expression) {\n return;\n }\n if (transpose) {\n setAxisLeftLabels(expression.cols);\n } else {\n setAxisTopLabels(expression.cols);\n }\n }, [expression, transpose]);\n\n const [cellLabelMaxLength, geneLabelMaxLength] = useMemo(() => {\n if (!expression) {\n return [0, 0];\n }\n return [\n max(expression.rows.map(cellId => cellId.length)),\n max(expression.cols.map(geneId => geneId.length)),\n ];\n }, [expression]);\n\n const width = axisTopLabels.length;\n const height = axisLeftLabels.length;\n\n const [axisOffsetLeft, axisOffsetTop] = getAxisSizes(\n transpose, geneLabelMaxLength, cellLabelMaxLength,\n );\n\n const offsetTop = axisOffsetTop + COLOR_BAR_SIZE;\n const offsetLeft = axisOffsetLeft + COLOR_BAR_SIZE;\n\n const matrixWidth = viewWidth - offsetLeft;\n const matrixHeight = viewHeight - offsetTop;\n\n const matrixLeft = -matrixWidth / 2;\n const matrixRight = matrixWidth / 2;\n const matrixTop = -matrixHeight / 2;\n const matrixBottom = matrixHeight / 2;\n\n const xTiles = Math.ceil(width / TILE_SIZE);\n const yTiles = Math.ceil(height / TILE_SIZE);\n\n const widthRatio = 1 - (TILE_SIZE - (width % TILE_SIZE)) / (xTiles * TILE_SIZE);\n const heightRatio = 1 - (TILE_SIZE - (height % TILE_SIZE)) / (yTiles * TILE_SIZE);\n\n const tileWidth = (matrixWidth / widthRatio) / (xTiles);\n const tileHeight = (matrixHeight / heightRatio) / (yTiles);\n\n const scaleFactor = 2 ** viewState.zoom;\n const cellHeight = (matrixHeight * scaleFactor) / height;\n const cellWidth = (matrixWidth * scaleFactor) / width;\n\n // Get power of 2 between 1 and 16,\n // for number of cells to aggregate together in each direction.\n const aggSizeX = clamp(2 ** Math.ceil(Math.log2(1 / cellWidth)), MIN_ROW_AGG, MAX_ROW_AGG);\n const aggSizeY = clamp(2 ** Math.ceil(Math.log2(1 / cellHeight)), MIN_ROW_AGG, MAX_ROW_AGG);\n\n const [targetX, targetY] = viewState.target;\n\n // Emit the viewInfo object on viewState updates\n // (used by tooltips / crosshair elements).\n useEffect(() => {\n updateViewInfo({\n uuid,\n project: (cellId, geneId) => {\n const colI = transpose ? axisTopLabels.indexOf(cellId) : axisTopLabels.indexOf(geneId);\n const rowI = transpose ? axisLeftLabels.indexOf(geneId) : axisLeftLabels.indexOf(cellId);\n return heatmapToMousePosition(\n colI, rowI, {\n offsetLeft,\n offsetTop,\n targetX: viewState.target[0],\n targetY: viewState.target[1],\n scaleFactor,\n matrixWidth,\n matrixHeight,\n numRows: height,\n numCols: width,\n },\n );\n },\n });\n }, [uuid, updateViewInfo, transpose, axisTopLabels, axisLeftLabels, offsetLeft,\n offsetTop, viewState, scaleFactor, matrixWidth, matrixHeight, height, width]);\n\n\n // Listen for viewState changes.\n // Do not allow the user to zoom and pan outside of the initial window.\n const onViewStateChange = useCallback(({ viewState: nextViewState }) => {\n const { zoom: nextZoom } = nextViewState;\n const nextScaleFactor = 2 ** nextZoom;\n\n const minTargetX = nextZoom === 0 ? 0 : -(matrixRight - (matrixRight / nextScaleFactor));\n const maxTargetX = -1 * minTargetX;\n\n const minTargetY = nextZoom === 0 ? 0 : -(matrixBottom - (matrixBottom / nextScaleFactor));\n const maxTargetY = -1 * minTargetY;\n\n // Manipulate view state if necessary to keep the user in the window.\n const nextTarget = [\n clamp(nextViewState.target[0], minTargetX, maxTargetX),\n clamp(nextViewState.target[1], minTargetY, maxTargetY),\n ];\n\n setViewState({\n zoom: nextZoom,\n target: (transpose ? [nextTarget[1], nextTarget[0]] : nextTarget),\n });\n }, [matrixRight, matrixBottom, transpose, setViewState]);\n\n // If `expression` or `cellOrdering` have changed,\n // then new tiles need to be generated,\n // so add a new task to the backlog.\n useEffect(() => {\n if (!expression) {\n return;\n }\n // Use a uuid to give the task a unique ID,\n // to help identify where in the list it is located\n // after the worker thread asynchronously sends the data back\n // to this thread.\n if (\n axisTopLabels && axisLeftLabels && xTiles && yTiles\n ) {\n setBacklog(prev => [...prev, uuidv4()]);\n }\n }, [dataRef, expression, axisTopLabels, axisLeftLabels, xTiles, yTiles]);\n\n // When the backlog has updated, a new worker job can be submitted if:\n // - the backlog has length >= 1 (at least one job is waiting), and\n // - buffer.byteLength is not zero, so the worker does not currently \"own\" the buffer.\n useEffect(() => {\n if (backlog.length < 1) {\n return;\n }\n const curr = backlog[backlog.length - 1];\n if (dataRef.current && dataRef.current.buffer.byteLength) {\n const { rows, cols, matrix } = expression;\n const promises = range(yTiles).map(i => range(xTiles).map(async j => workerPool.process({\n curr,\n tileI: i,\n tileJ: j,\n tileSize: TILE_SIZE,\n cellOrdering: transpose ? axisTopLabels : axisLeftLabels,\n rows,\n cols,\n transpose,\n data: matrix.buffer.slice(),\n })));\n const process = async () => {\n const tiles = await Promise.all(promises.flat());\n tilesRef.current = tiles.map(i => i.tile);\n incTileIteration();\n dataRef.current = new Uint8Array(tiles[0].buffer);\n const { curr: currWork } = tiles[0];\n setBacklog((prev) => {\n const currIndex = prev.indexOf(currWork);\n return prev.slice(currIndex + 1, prev.length);\n });\n };\n process();\n }\n }, [axisLeftLabels, axisTopLabels, backlog, expression, transpose, xTiles, yTiles, workerPool]);\n\n useEffect(() => {\n setIsRendering(backlog.length > 0);\n }, [backlog, setIsRendering]);\n\n // Update the heatmap tiles if:\n // - new tiles are available (`tileIteration` has changed), or\n // - the matrix bounds have changed, or\n // - the `aggSizeX` or `aggSizeY` have changed, or\n // - the cell ordering has changed.\n const heatmapLayers = useMemo(() => {\n if (!tilesRef.current || backlog.length) {\n return [];\n }\n function getLayer(i, j, tile) {\n return new HeatmapBitmapLayer({\n id: `heatmapLayer-${tileIteration}-${i}-${j}`,\n image: tile,\n bounds: [\n matrixLeft + j * tileWidth,\n matrixTop + i * tileHeight,\n matrixLeft + (j + 1) * tileWidth,\n matrixTop + (i + 1) * tileHeight,\n ],\n aggSizeX,\n aggSizeY,\n colormap,\n colorScaleLo: colormapRange[0],\n colorScaleHi: colormapRange[1],\n updateTriggers: {\n image: [axisLeftLabels, axisTopLabels],\n bounds: [tileHeight, tileWidth],\n },\n });\n }\n const layers = tilesRef\n .current.map((tile, index) => getLayer(Math.floor(index / xTiles), index % xTiles, tile));\n return layers;\n }, [backlog, tileIteration, matrixLeft, tileWidth, matrixTop, tileHeight,\n aggSizeX, aggSizeY, colormap, colormapRange,\n axisLeftLabels, axisTopLabels, xTiles]);\n\n\n // Map cell and gene names to arrays with indices,\n // to prepare to render the names in TextLayers.\n const axisTopLabelData = useMemo(() => axisTopLabels.map((d, i) => [i, d]), [axisTopLabels]);\n const axisLeftLabelData = useMemo(() => axisLeftLabels.map((d, i) => [i, d]), [axisLeftLabels]);\n\n // Generate the axis label, axis title, and loading indicator text layers.\n const textLayers = [\n new HeatmapCompositeTextLayer({\n targetX,\n targetY,\n scaleFactor,\n axisLeftLabelData,\n matrixTop,\n height,\n matrixHeight,\n cellHeight,\n cellWidth,\n axisTopLabelData,\n matrixLeft,\n width,\n matrixWidth,\n viewHeight,\n viewWidth,\n theme,\n axisLeftTitle,\n axisTopTitle,\n axisOffsetLeft,\n axisOffsetTop,\n }),\n ];\n\n // Create the left color bar with a BitmapLayer.\n // TODO: find a way to do aggregation for this as well.\n const cellColorsTiles = useMemo(() => {\n if (!cellColors) {\n return null;\n }\n\n let cellId;\n let offset;\n let color;\n let rowI;\n\n const cellOrdering = (transpose ? axisTopLabels : axisLeftLabels);\n const colorBarTileWidthPx = (transpose ? TILE_SIZE : 1);\n const colorBarTileHeightPx = (transpose ? 1 : TILE_SIZE);\n\n const result = range((transpose ? xTiles : yTiles)).map((i) => {\n const tileData = new Uint8ClampedArray(TILE_SIZE * 1 * 4);\n\n range(TILE_SIZE).forEach((tileY) => {\n rowI = (i * TILE_SIZE) + tileY; // the row / cell index\n if (rowI < cellOrdering.length) {\n cellId = cellOrdering[rowI];\n color = cellColors.get(cellId);\n offset = (transpose ? tileY : (TILE_SIZE - tileY - 1)) * 4;\n if (color) {\n const [rValue, gValue, bValue] = color;\n tileData[offset + 0] = rValue;\n tileData[offset + 1] = gValue;\n tileData[offset + 2] = bValue;\n tileData[offset + 3] = 255;\n }\n }\n });\n\n return new ImageData(tileData, colorBarTileWidthPx, colorBarTileHeightPx);\n });\n\n return result;\n }, [cellColors, transpose, axisTopLabels, axisLeftLabels, xTiles, yTiles]);\n\n const cellColorsLayers = useMemo(() => (cellColorsTiles\n ? cellColorsTiles\n .map((tile, i) => new PixelatedBitmapLayer({\n id: `${(transpose ? 'colorsTopLayer' : 'colorsLeftLayer')}-${i}-${uuidv4()}`,\n image: tile,\n bounds: (transpose ? [\n matrixLeft + i * tileWidth,\n -matrixHeight / 2,\n matrixLeft + (i + 1) * tileWidth,\n matrixHeight / 2,\n ] : [\n -matrixWidth / 2,\n matrixTop + i * tileHeight,\n matrixWidth / 2,\n matrixTop + (i + 1) * tileHeight,\n ]),\n }))\n : []), [cellColorsTiles, matrixTop, matrixLeft, matrixHeight,\n matrixWidth, tileWidth, tileHeight, transpose]);\n\n const layers = heatmapLayers\n .concat(textLayers)\n .concat(cellColorsLayers);\n\n // Set up the onHover function.\n function onHover(info, event) {\n if (!expression) {\n return;\n }\n const { x: mouseX, y: mouseY } = event.offsetCenter;\n const [colI, rowI] = mouseToHeatmapPosition(mouseX, mouseY, {\n offsetLeft,\n offsetTop,\n targetX,\n targetY,\n scaleFactor,\n matrixWidth,\n matrixHeight,\n numRows: height,\n numCols: width,\n });\n\n if (colI === null) {\n if (transpose) {\n setCellHighlight(null);\n } else {\n setGeneHighlight(null);\n }\n }\n\n if (rowI === null) {\n if (transpose) {\n setGeneHighlight(null);\n } else {\n setCellHighlight(null);\n }\n }\n\n const obsI = expression.rows.indexOf(transpose\n ? axisTopLabels[colI]\n : axisLeftLabels[rowI]);\n const varI = expression.cols.indexOf(transpose\n ? axisLeftLabels[rowI]\n : axisTopLabels[colI]);\n\n const obsId = expression.rows[obsI];\n const varId = expression.cols[varI];\n if (setComponentHover) {\n setComponentHover();\n }\n setCellHighlight(obsId || null);\n setGeneHighlight(varId || null);\n }\n\n return (\n <DeckGL\n id={`deckgl-overlay-${uuid}`}\n ref={deckRef}\n views={[\n // Note that there are multiple views here,\n // but only one viewState.\n new OrthographicView({\n id: 'heatmap',\n controller: true,\n x: offsetLeft,\n y: offsetTop,\n width: matrixWidth,\n height: matrixHeight,\n }),\n new OrthographicView({\n id: 'axisLeft',\n controller: false,\n x: (transpose ? COLOR_BAR_SIZE : 0),\n y: offsetTop,\n width: axisOffsetLeft,\n height: matrixHeight,\n }),\n new OrthographicView({\n id: 'axisTop',\n controller: false,\n x: offsetLeft,\n y: (transpose ? 0 : COLOR_BAR_SIZE),\n width: matrixWidth,\n height: axisOffsetTop,\n }),\n new OrthographicView({\n id: 'colorsLeft',\n controller: false,\n x: axisOffsetLeft,\n y: offsetTop,\n width: COLOR_BAR_SIZE - AXIS_MARGIN,\n height: matrixHeight,\n }),\n new OrthographicView({\n id: 'colorsTop',\n controller: false,\n x: offsetLeft,\n y: axisOffsetTop,\n width: matrixWidth,\n height: COLOR_BAR_SIZE - AXIS_MARGIN,\n }),\n ]}\n layers={layers}\n layerFilter={layerFilter}\n getCursor={interactionState => (interactionState.isDragging ? 'grabbing' : 'default')}\n glOptions={DEFAULT_GL_OPTIONS}\n onViewStateChange={onViewStateChange}\n viewState={viewState}\n onHover={onHover}\n />\n );\n});\n\nexport default Heatmap;\n","import React from 'react';\nimport Tooltip2D from '../tooltip/Tooltip2D';\nimport TooltipContent from '../tooltip/TooltipContent';\nimport { useComponentHover, useComponentViewInfo } from '../../app/state/hooks';\n\nexport default function HeatmapTooltipSubscriber(props) {\n const {\n parentUuid,\n width, height, transpose,\n getCellInfo, getGeneInfo,\n cellHighlight, geneHighlight,\n } = props;\n\n const sourceUuid = useComponentHover();\n const viewInfo = useComponentViewInfo(parentUuid);\n\n const [cellInfo, cellCoord] = (cellHighlight && getCellInfo ? (\n [\n getCellInfo(cellHighlight),\n (viewInfo && viewInfo.project\n ? viewInfo.project(cellHighlight, null)[(transpose ? 0 : 1)]\n : null),\n ]\n ) : ([null, null]));\n\n const [geneInfo, geneCoord] = (geneHighlight && getGeneInfo ? (\n [\n getGeneInfo(geneHighlight),\n (viewInfo && viewInfo.project\n ? viewInfo.project(null, geneHighlight)[(transpose ? 1 : 0)]\n : null),\n ]\n ) : ([null, null]));\n\n const x = (transpose ? cellCoord : geneCoord);\n const y = (transpose ? geneCoord : cellCoord);\n\n return (\n (cellInfo || geneInfo ? (\n <Tooltip2D\n x={x}\n y={y}\n parentUuid={parentUuid}\n parentWidth={width}\n parentHeight={height}\n sourceUuid={sourceUuid}\n >\n <TooltipContent info={{ ...geneInfo, ...cellInfo }} />\n </Tooltip2D>\n ) : null)\n );\n}\n","import React, { useCallback } from 'react';\nimport debounce from 'lodash/debounce';\nimport Slider from '@material-ui/core/Slider';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport { useStyles } from '../shared-plot-options/styles';\nimport OptionsContainer from '../shared-plot-options/OptionsContainer';\nimport OptionSelect from '../shared-plot-options/OptionSelect';\nimport { GLSL_COLORMAPS } from '../../layers/constants';\n\nexport default function HeatmapOptions(props) {\n const {\n geneExpressionColormap,\n setGeneExpressionColormap,\n geneExpressionColormapRange,\n setGeneExpressionColormapRange,\n } = props;\n\n const classes = useStyles();\n\n function handleGeneExpressionColormapChange(event) {\n setGeneExpressionColormap(event.target.value);\n }\n\n function handleColormapRangeChange(event, value) {\n setGeneExpressionColormapRange(value);\n }\n const handleColormapRangeChangeDebounced = useCallback(\n debounce(handleColormapRangeChange, 5, { trailing: true }),\n [handleColormapRangeChange],\n );\n\n return (\n <OptionsContainer>\n <TableRow>\n <TableCell className={classes.labelCell} htmlFor=\"gene-expression-colormap-select\">\n Gene Expression Colormap\n </TableCell>\n <TableCell className={classes.inputCell}>\n <OptionSelect\n className={classes.select}\n value={geneExpressionColormap}\n onChange={handleGeneExpressionColormapChange}\n inputProps={{\n id: 'gene-expression-colormap-select',\n }}\n >\n {GLSL_COLORMAPS.map(cmap => (\n <option key={cmap} value={cmap}>{cmap}</option>\n ))}\n </OptionSelect>\n </TableCell>\n </TableRow>\n <TableRow>\n <TableCell className={classes.labelCell}>\n Gene Expression Colormap Range\n </TableCell>\n <TableCell className={classes.inputCell}>\n <Slider\n classes={{ root: classes.slider, valueLabel: classes.sliderValueLabel }}\n value={geneExpressionColormapRange}\n onChange={handleColormapRangeChangeDebounced}\n aria-labelledby=\"gene-expression-colormap-range-slider\"\n valueLabelDisplay=\"auto\"\n step={0.005}\n min={0.0}\n max={1.0}\n />\n </TableCell>\n </TableRow>\n </OptionsContainer>\n );\n}\n","import React, {\n useEffect, useState, useCallback, useMemo,\n} from 'react';\nimport TitleInfo from '../TitleInfo';\nimport { pluralize, capitalize } from '../../utils';\nimport { useDeckCanvasSize, useReady, useUrls } from '../hooks';\nimport { mergeCellSets } from '../utils';\nimport {\n useCellsData,\n useCellSetsData,\n useExpressionMatrixData,\n} from '../data-hooks';\nimport { getCellColors } from '../interpolate-colors';\nimport {\n useCoordination, useLoaders,\n useSetComponentHover, useSetComponentViewInfo,\n} from '../../app/state/hooks';\nimport {\n COMPONENT_COORDINATION_TYPES,\n} from '../../app/state/coordination';\nimport Heatmap from './Heatmap';\nimport HeatmapTooltipSubscriber from './HeatmapTooltipSubscriber';\nimport HeatmapOptions from './HeatmapOptions';\n\nconst HEATMAP_DATA_TYPES = ['cells', 'cell-sets', 'expression-matrix'];\n\n/**\n * @param {object} props\n * @param {number} props.uuid The unique identifier for this component.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n * @param {boolean} props.transpose Whether to\n * render as cell-by-gene or gene-by-cell.\n * @param {string} props.observationsLabelOverride The singular\n * form of the name of the observation.\n * @param {string} props.observationsPluralLabelOverride The\n * plural form of the name of the observation.\n * @param {string} props.variablesLabelOverride The singular\n * form of the name of the variable.\n * @param {string} props.variablesPluralLabelOverride The plural\n * form of the name of the variable.\n * @param {boolean} props.disableTooltip Whether to disable the\n * tooltip on mouse hover.\n */\nexport default function HeatmapSubscriber(props) {\n const {\n uuid,\n coordinationScopes,\n removeGridComponent, theme, transpose,\n observationsLabelOverride: observationsLabel = 'cell',\n observationsPluralLabelOverride: observationsPluralLabel = `${observationsLabel}s`,\n variablesLabelOverride: variablesLabel = 'gene',\n variablesPluralLabelOverride: variablesPluralLabel = `${variablesLabel}s`,\n disableTooltip = false,\n title = 'Heatmap',\n } = props;\n\n const loaders = useLoaders();\n const setComponentHover = useSetComponentHover();\n const setComponentViewInfo = useSetComponentViewInfo(uuid);\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n heatmapZoomX: zoomX,\n heatmapTargetX: targetX,\n heatmapTargetY: targetY,\n geneSelection,\n cellHighlight,\n geneHighlight,\n cellSetSelection,\n cellSetColor,\n additionalCellSets,\n geneExpressionColormap,\n geneExpressionColormapRange,\n }, {\n setHeatmapZoomX: setZoomX,\n setHeatmapZoomY: setZoomY,\n setHeatmapTargetX: setTargetX,\n setHeatmapTargetY: setTargetY,\n setCellHighlight,\n setGeneHighlight,\n setCellSetSelection,\n setCellSetColor,\n setGeneExpressionColormapRange,\n setGeneExpressionColormap,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.heatmap, coordinationScopes);\n\n const observationsTitle = capitalize(observationsPluralLabel);\n const variablesTitle = capitalize(variablesPluralLabel);\n\n const [isRendering, setIsRendering] = useState(false);\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n HEATMAP_DATA_TYPES,\n );\n const [urls, addUrl, resetUrls] = useUrls();\n const [width, height, deckRef] = useDeckCanvasSize();\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [cells] = useCellsData(loaders, dataset, setItemIsReady, addUrl, true);\n const [expressionMatrix] = useExpressionMatrixData(\n loaders, dataset, setItemIsReady, addUrl, true,\n );\n const [cellSets] = useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, false,\n { setCellSetSelection, setCellSetColor },\n { cellSetSelection, cellSetColor },\n );\n\n const mergedCellSets = useMemo(() => mergeCellSets(\n cellSets, additionalCellSets,\n ), [cellSets, additionalCellSets]);\n\n const cellColors = useMemo(() => getCellColors({\n // Only show cell set selection on heatmap labels.\n cellColorEncoding: 'cellSetSelection',\n geneSelection,\n cellSets: mergedCellSets,\n cellSetSelection,\n cellSetColor,\n expressionDataAttrs: expressionMatrix,\n theme,\n }), [mergedCellSets, geneSelection, theme,\n cellSetColor, cellSetSelection, expressionMatrix]);\n\n const getCellInfo = useCallback((cellId) => {\n if (cellId) {\n const cellInfo = cells[cellId];\n return {\n [`${capitalize(observationsLabel)} ID`]: cellId,\n ...(cellInfo ? cellInfo.factors : {}),\n };\n }\n return null;\n }, [cells, observationsLabel]);\n\n const getGeneInfo = useCallback((geneId) => {\n if (geneId) {\n return { [`${capitalize(variablesLabel)} ID`]: geneId };\n }\n return null;\n }, [variablesLabel]);\n\n const cellsCount = expressionMatrix && expressionMatrix.rows\n ? expressionMatrix.rows.length : 0;\n const genesCount = expressionMatrix && expressionMatrix.cols\n ? expressionMatrix.cols.length : 0;\n const selectedCount = cellColors.size;\n return (\n <TitleInfo\n title={title}\n info={`${cellsCount} ${pluralize(observationsLabel, observationsPluralLabel, cellsCount)} × ${genesCount} ${pluralize(variablesLabel, variablesPluralLabel, genesCount)},\n with ${selectedCount} ${pluralize(observationsLabel, observationsPluralLabel, selectedCount)} selected`}\n urls={urls}\n theme={theme}\n removeGridComponent={removeGridComponent}\n isReady={isReady && !isRendering}\n options={(\n <HeatmapOptions\n geneExpressionColormap={geneExpressionColormap}\n setGeneExpressionColormap={setGeneExpressionColormap}\n geneExpressionColormapRange={geneExpressionColormapRange}\n setGeneExpressionColormapRange={setGeneExpressionColormapRange}\n />\n )}\n >\n <Heatmap\n ref={deckRef}\n transpose={transpose}\n viewState={{ zoom: zoomX, target: [targetX, targetY] }}\n setViewState={({ zoom, target }) => {\n setZoomX(zoom);\n setZoomY(zoom);\n setTargetX(target[0]);\n setTargetY(target[1]);\n }}\n colormapRange={geneExpressionColormapRange}\n setColormapRange={setGeneExpressionColormapRange}\n height={height}\n width={width}\n theme={theme}\n uuid={uuid}\n expressionMatrix={expressionMatrix}\n cellColors={cellColors}\n colormap={geneExpressionColormap}\n setIsRendering={setIsRendering}\n setCellHighlight={setCellHighlight}\n setGeneHighlight={setGeneHighlight}\n setComponentHover={() => {\n setComponentHover(uuid);\n }}\n updateViewInfo={setComponentViewInfo}\n observationsTitle={observationsTitle}\n variablesTitle={variablesTitle}\n />\n {!disableTooltip && (\n <HeatmapTooltipSubscriber\n parentUuid={uuid}\n width={width}\n height={height}\n transpose={transpose}\n getCellInfo={getCellInfo}\n getGeneInfo={getGeneInfo}\n cellHighlight={cellHighlight}\n geneHighlight={geneHighlight}\n />\n )}\n </TitleInfo>\n );\n}\n","import React from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport LensIcon from '@material-ui/icons/Lens';\nimport { makeStyles } from '@material-ui/core/styles';\n\n\nimport { VIEWER_PALETTE } from '../utils';\n\nconst useStyles = makeStyles(theme => ({\n container: {\n width: '70px',\n height: '40px',\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n flexWrap: 'wrap',\n },\n button: {\n padding: '3px',\n width: '16px',\n },\n icon: {\n width: '17px',\n height: '17px',\n stroke: theme.palette.action.selected,\n 'stroke-width': '1px',\n },\n}));\n\nconst ColorPalette = ({ handleChange }) => {\n const classes = useStyles();\n return (\n <div className={classes.container} aria-label=\"color-swatch\">\n {VIEWER_PALETTE.map(color => (\n <IconButton\n className={classes.button}\n key={color}\n onClick={() => handleChange(color)}\n >\n <LensIcon\n fontSize=\"small\"\n style={{ color: `rgb(${color})` }}\n className={classes.icon}\n />\n </IconButton>\n ))}\n </div>\n );\n};\n\nexport default ColorPalette;\n","import React, { useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { PopperMenu, MuiSpan } from '../shared-mui/components';\n\nimport ColorPalette from './ColorPalette';\n\nconst useStyles = makeStyles(() => ({\n menuButton: {\n backgroundColor: 'transparent',\n },\n colors: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n paddingLeft: '2px',\n paddingRight: '2px',\n },\n}));\n\n/**\n * Dropdown for options for a channel on the three dots button.\n * @prop {function} handlePropertyChange Callback for changing property (color, IQR of sliders).\n * @prop {function} handleChannelRemove Callback for channel removal.\n * @prop {function} handleIQRUpdate Callback for IQR slider update.\n */\nfunction ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUpdate }) {\n const [open, setOpen] = useState(false);\n\n const classes = useStyles();\n\n const handleColorSelect = (color) => {\n handlePropertyChange('color', color);\n };\n\n const handleRemove = () => {\n setOpen(false);\n handleChannelRemove();\n };\n\n return (\n <PopperMenu\n open={open}\n setOpen={setOpen}\n buttonIcon={<MoreVertIcon fontSize=\"small\" />}\n buttonClassName={classes.menuButton}\n >\n <MenuItem dense disableGutters onClick={handleRemove}>\n <MuiSpan>Remove</MuiSpan>\n </MenuItem>\n <MenuItem dense disableGutters onClick={handleIQRUpdate}>\n <MuiSpan>Use IQR</MuiSpan>\n </MenuItem>\n <MenuItem dense disableGutters className={classes.colors}>\n <ColorPalette handleChange={handleColorSelect} />\n </MenuItem>\n </PopperMenu>\n );\n}\n\nexport default ChannelOptions;\n","import { DTYPE_VALUES } from '@hms-dbmi/viv';\n\nfunction getDomains() {\n const domains = {};\n const needMin = ['Int8', 'Int16', 'Int32'];\n Object.keys(DTYPE_VALUES).forEach((dtype) => {\n const { max } = DTYPE_VALUES[dtype];\n const min = needMin.includes(dtype) ? -(max + 1) : 0;\n domains[dtype] = [min, max];\n });\n return domains;\n}\n\nexport const DOMAINS = getDomains();\n","import { makeStyles, withStyles } from '@material-ui/core/styles';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Slider from '@material-ui/core/Slider';\nimport Grid from '@material-ui/core/Grid';\n\nexport const useSelectStyles = makeStyles(() => ({\n selectRoot: {\n padding: 0,\n height: 'auto',\n margin: '4px 0',\n },\n}));\n\nexport const useOptionStyles = withStyles(theme => ({\n paper: {\n backgroundColor: theme.palette.background.paper,\n },\n span: {\n width: '70px',\n textAlign: 'center',\n paddingLeft: '2px',\n paddingRight: '2px',\n },\n colors: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n paddingLeft: '2px',\n paddingRight: '2px',\n },\n popper: {\n zIndex: 4,\n },\n}));\n\nconst sharedControllerStyles = {\n width: '100%',\n flexDirection: 'column',\n};\n\nexport const useControllerSectionStyles = makeStyles(() => ({\n root: {\n ...sharedControllerStyles,\n padding: '0px 8px',\n },\n}));\n\nexport const StyledAccordionDetails = withStyles(() => ({\n root: {\n ...sharedControllerStyles,\n padding: '8px 8px 24px 8px',\n },\n}))(AccordionDetails);\n\nexport const StyledAccordionSummary = withStyles(theme => ({\n root: {\n padding: '0px 8px',\n },\n content: {\n margin: '4px 0px',\n minWidth: '0px',\n },\n expanded: {\n marginBottom: theme.spacing(-3),\n top: theme.spacing(-1),\n },\n expandIcon: {\n '&$expanded': {\n top: theme.spacing(-1.3),\n },\n },\n}))(AccordionSummary);\n\nexport const StyledInputLabel = withStyles(() => ({\n root: {\n fontSize: '14px',\n },\n}))(InputLabel);\n\nexport const OverflowEllipsisGrid = withStyles(() => ({\n item: {\n width: '100%',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n },\n}))(Grid);\n\nexport const StyledSelectionSlider = withStyles(() => ({\n root: {\n marginTop: '7px',\n },\n markActive: {\n backgroundColor: 'rgba(128, 128, 128, 0.7)',\n },\n}))(Slider);\n","import React from 'react';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Select from '@material-ui/core/Select';\nimport { useSelectStyles } from './styles';\n\n/**\n * Dropdown for selecting a channel.\n * @prop {function} handleChange Callback for each new selection.\n * @prop {array} channelOptions List of available selections, like ['DAPI', 'FITC', ...].\n * @prop {boolean} disabled Whether or not the component is disabled.\n * @prop {number} selectionIndex Current numeric index of a selection.\n */\nexport function ChannelSelectionDropdown({\n handleChange,\n disabled,\n channelOptions,\n selectionIndex,\n}) {\n const classes = useSelectStyles();\n return (\n <Select\n classes={{ root: classes.selectRoot }}\n native\n value={selectionIndex}\n onChange={e => handleChange(Number(e.target.value))}\n >\n {channelOptions.map((opt, i) => (\n <option disabled={disabled} key={opt} value={i}>\n {opt}\n </option>\n ))}\n </Select>\n );\n}\n\n/**\n * Checkbox for toggling on/off of a channel.\n * @prop {string} color Current color for this channel.\n * @prop {boolean} checked Whether or not this channel is \"on\".\n * @prop {boolean} disabled Whether or not the component is disabled.\n * @prop {function} toggle Callback for toggling on/off.\n */\nexport function ChannelVisibilityCheckbox({\n color, checked, toggle, disabled,\n}) {\n return (\n <Checkbox\n onChange={toggle}\n checked={checked}\n disabled={disabled}\n style={{ color, '&$checked': { color } }}\n />\n );\n}\n","import React, { useCallback, useState, useEffect } from 'react';\n\nimport Grid from '@material-ui/core/Grid';\nimport Slider from '@material-ui/core/Slider';\nimport debounce from 'lodash/debounce';\nimport isEqual from 'lodash/isEqual';\n\nimport ChannelOptions from './ChannelOptions';\nimport { DOMAINS } from './constants';\nimport { getSourceFromLoader } from '../../utils';\nimport { getMultiSelectionStats } from './utils';\nimport {\n ChannelSelectionDropdown,\n ChannelVisibilityCheckbox,\n} from './shared-channel-controls';\n\n// Returns an rgb string for display, and changes the color (arr)\n// to use a grey for light theme + white color or if the colormap is on.\nexport const toRgbUIString = (on, arr, theme) => {\n const color = on || (theme === 'light' && arr.every(i => i === 255))\n ? [220, 220, 220]\n : arr;\n return `rgb(${color})`;\n};\n\nfunction abbreviateNumber(value) {\n // Return an abbreviated representation of value, in 5 characters or less.\n\n const maxLength = 5;\n let maxNaiveDigits = maxLength;\n\n /* eslint-disable no-plusplus */\n if (!Number.isInteger(value)) {\n --maxNaiveDigits;\n } // Wasted on \".\"\n if (value < 1) {\n --maxNaiveDigits;\n } // Wasted on \"0.\"\n /* eslint-disable no-plusplus */\n\n const naive = Intl.NumberFormat('en-US', {\n maximumSignificantDigits: maxNaiveDigits,\n useGrouping: false,\n }).format(value);\n if (naive.length <= maxLength) return naive;\n\n // \"e+9\" consumes 3 characters, so if we even had two significant digits,\n // it would take take us to six characters, including the decimal point.\n return value.toExponential(0);\n}\n\n/**\n * Slider for controlling current colormap.\n * @prop {string} color Current color for this channel.\n * @prop {arry} slider Current value of the slider.\n * @prop {function} handleChange Callback for each slider change.\n * @prop {array} domain Current max/min allowable slider values.\n */\nfunction ChannelSlider({\n color,\n slider = [0, 0],\n handleChange,\n domain = [0, 0],\n dtype,\n disabled,\n}) {\n const [min, max] = domain;\n const handleChangeDebounced = useCallback(\n debounce(handleChange, 3, { trailing: true }),\n [handleChange],\n );\n const step = max - min < 500 && dtype === 'Float32' ? (max - min) / 500 : 1;\n return (\n <Slider\n value={slider}\n valueLabelFormat={abbreviateNumber}\n onChange={(e, v) => handleChangeDebounced(v)}\n valueLabelDisplay=\"auto\"\n getAriaLabel={() => `${color}-${slider}`}\n min={min}\n max={max}\n step={step}\n orientation=\"horizontal\"\n style={{ color, marginTop: '7px' }}\n disabled={disabled}\n />\n );\n}\n\n/**\n * Controller for the handling the colormapping sliders.\n * @prop {boolean} visibility Whether or not this channel is \"on\"\n * @prop {array} slider Current slider range.\n * @prop {array} color Current color for this channel.\n * @prop {array} domain Current max/min for this channel.\n * @prop {string} dimName Name of the dimensions this slider controls (usually \"channel\").\n * @prop {boolean} colormapOn Whether or not the colormap (viridis, magma etc.) is on.\n * @prop {object} channelOptions All available options for this dimension (i.e channel names).\n * @prop {function} handlePropertyChange Callback for when a property (color, slider etc.) changes.\n * @prop {function} handleChannelRemove When a channel is removed, this is called.\n * @prop {function} handleIQRUpdate When the IQR button is clicked, this is called.\n * @prop {number} selectionIndex The current numeric index of the selection.\n */\nfunction RasterChannelController({\n visibility = false,\n slider,\n color,\n channels,\n channelId,\n domainType: newDomainType,\n dimName,\n theme,\n loader,\n colormapOn,\n channelOptions,\n handlePropertyChange,\n handleChannelRemove,\n handleIQRUpdate,\n selectionIndex,\n isLoading,\n use3d: newUse3d,\n}) {\n const { dtype } = getSourceFromLoader(loader);\n const [domain, setDomain] = useState(null);\n const [domainType, setDomainType] = useState(null);\n const [use3d, setUse3d] = useState(null);\n const [selection, setSelection] = useState([\n { ...channels[channelId].selection },\n ]);\n const rgbColor = toRgbUIString(colormapOn, color, theme);\n\n useEffect(() => {\n // Use mounted to prevent state updates/re-renders after the component has been unmounted.\n // All state updates should happen within the mounted check.\n let mounted = true;\n if (dtype && loader && channels) {\n const selections = [{ ...channels[channelId].selection }];\n let domains;\n const hasDomainChanged = newDomainType !== domainType;\n const has3dChanged = use3d !== newUse3d;\n const hasSelectionChanged = !isEqual(selections, selection);\n if (hasDomainChanged || hasSelectionChanged || has3dChanged) {\n if (newDomainType === 'Full') {\n domains = [DOMAINS[dtype]];\n const [newDomain] = domains;\n if (mounted) {\n setDomain(newDomain);\n setDomainType(newDomainType);\n if (hasSelectionChanged) {\n setSelection(selections);\n }\n if (has3dChanged) {\n setUse3d(newUse3d);\n }\n }\n } else {\n getMultiSelectionStats({\n loader: loader.data,\n selections,\n use3d: newUse3d,\n }).then((stats) => {\n // eslint-disable-next-line prefer-destructuring\n domains = stats.domains;\n const [newDomain] = domains;\n if (mounted) {\n setDomain(newDomain);\n setDomainType(newDomainType);\n if (hasSelectionChanged) {\n setSelection(selections);\n }\n if (has3dChanged) {\n setUse3d(newUse3d);\n }\n }\n });\n }\n }\n }\n return () => {\n mounted = false;\n };\n }, [\n domainType,\n channels,\n channelId,\n loader,\n dtype,\n newDomainType,\n selection,\n newUse3d,\n use3d,\n ]);\n /* A valid selection is defined by an object where the keys are\n * the name of a dimension of the data, and the values are the\n * index of the image along that particular dimension.\n *\n * Since we currently only support making a selection along one\n * addtional dimension (i.e. the dropdown just has channels or mz)\n * we have a helper function to create the selection.\n *\n * e.g { channel: 2 } // channel dimension, third channel\n */\n const createSelection = index => ({ [dimName]: index });\n return (\n <Grid container direction=\"column\" m={1} justifyContent=\"center\">\n <Grid container direction=\"row\" justifyContent=\"space-between\">\n <Grid item xs={10}>\n <ChannelSelectionDropdown\n handleChange={v => handlePropertyChange('selection', createSelection(v))\n }\n selectionIndex={selectionIndex}\n channelOptions={channelOptions}\n disabled={isLoading}\n />\n </Grid>\n <Grid item xs={1} style={{ marginTop: '4px' }}>\n <ChannelOptions\n handlePropertyChange={handlePropertyChange}\n handleChannelRemove={handleChannelRemove}\n handleIQRUpdate={handleIQRUpdate}\n disabled={isLoading}\n />\n </Grid>\n </Grid>\n <Grid container direction=\"row\" justifyContent=\"space-between\">\n <Grid item xs={2}>\n <ChannelVisibilityCheckbox\n color={rgbColor}\n checked={visibility}\n toggle={() => handlePropertyChange('visible', !visibility)}\n disabled={isLoading}\n />\n </Grid>\n <Grid item xs={9}>\n <ChannelSlider\n color={rgbColor}\n slider={slider}\n domain={domain || DOMAINS[dtype]}\n dtype={dtype}\n handleChange={v => handlePropertyChange('slider', v)}\n disabled={isLoading}\n />\n </Grid>\n </Grid>\n </Grid>\n );\n}\n\nexport default RasterChannelController;\n","import React from 'react';\n\nimport RemoveCircleIcon from '@material-ui/icons/RemoveCircle';\nimport IconButton from '@material-ui/core/IconButton';\n\nimport Grid from '@material-ui/core/Grid';\n\nimport { ChannelSelectionDropdown, ChannelVisibilityCheckbox } from './shared-channel-controls';\n\n/**\n * Controller for the handling the bitmask channels.\n * @prop {boolean} visibility Whether or not this channel is \"on\"\n * @prop {string} dimName Name of the dimensions this slider controls (usually \"channel\").\n * @prop {object} channelOptions All available options for this dimension (i.e channel names).\n * @prop {function} handlePropertyChange Callback for when a property (color, slider etc.) changes.\n * @prop {function} handleChannelRemove When a channel is removed, this is called.\n * @prop {number} selectionIndex The current numeric index of the selection.\n * @prop {boolean} disableOptions Whether or not channel options are be disabled (default: false).\n */\nfunction BitmaskChannelController({\n visibility = false,\n dimName,\n channelOptions,\n handlePropertyChange,\n handleChannelRemove,\n selectionIndex,\n disableOptions = false,\n}) {\n /* A valid selection is defined by an object where the keys are\n * the name of a dimension of the data, and the values are the\n * index of the image along that particular dimension.\n *\n * Since we currently only support making a selection along one\n * addtional dimension (i.e. the dropdown just has channels or mz)\n * we have a helper function to create the selection.\n *\n * e.g { channel: 2 } // channel dimension, third channel\n */\n const createSelection = index => ({ [dimName]: index });\n return (\n <Grid container direction=\"row\" justify=\"space-between\">\n <Grid item xs={2}>\n <ChannelVisibilityCheckbox\n color={[220, 220, 220]}\n checked={visibility}\n toggle={() => handlePropertyChange('visible', !visibility)}\n />\n </Grid>\n <Grid item xs={9}>\n <ChannelSelectionDropdown\n handleChange={v => handlePropertyChange('selection', createSelection(v))}\n selectionIndex={selectionIndex}\n disableOptions={disableOptions}\n channelOptions={channelOptions}\n />\n </Grid>\n <Grid item xs={1}>\n <IconButton onClick={handleChannelRemove} style={{ padding: '6px 6px 6px 0px' }}>\n <RemoveCircleIcon />\n </IconButton>\n </Grid>\n </Grid>\n );\n}\n\nexport default BitmaskChannelController;\n","import React from 'react';\n\nimport Grid from '@material-ui/core/Grid';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\nimport Slider from '@material-ui/core/Slider';\nimport { useControllerSectionStyles } from './styles';\n\nexport default function VectorLayerController(props) {\n const {\n label,\n layer,\n layerType,\n handleLayerChange,\n } = props;\n\n const slider = layer.opacity;\n const isOn = layer.visible;\n\n function handleSliderChange(v) {\n if (layerType === 'cells') {\n const stroked = v < 0.7;\n handleLayerChange({ ...layer, opacity: v, stroked });\n } else {\n handleLayerChange({ ...layer, opacity: v });\n }\n }\n\n function handleCheckBoxChange(v) {\n handleLayerChange({ ...layer, visible: v });\n }\n\n const classes = useControllerSectionStyles();\n return (\n <Grid item style={{ marginTop: '10px' }}>\n <Paper className={classes.root}>\n <Typography\n style={{\n padding: '15px 8px 0px 8px',\n marginBottom: '-5px',\n }}\n >\n {label}\n </Typography>\n <Grid container direction=\"row\" justifyContent=\"space-between\">\n <Grid item xs={2}>\n <Checkbox color=\"primary\" checked={isOn} onChange={(e, v) => handleCheckBoxChange(v)} />\n </Grid>\n <Grid item xs={9} style={{ paddingRight: '8px' }}>\n <Slider\n value={slider}\n min={0}\n max={1}\n step={0.001}\n onChange={(e, v) => handleSliderChange(v)}\n style={{ marginTop: '7px' }}\n orientation=\"horizontal\"\n />\n </Grid>\n </Grid>\n </Paper>\n </Grid>\n );\n}\n","import React from 'react';\nimport range from 'lodash/range';\nimport { Matrix4 } from 'math.gl';\nimport Grid from '@material-ui/core/Grid';\nimport Slider from '@material-ui/core/Slider';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport { getDefaultInitialViewState } from '@hms-dbmi/viv';\n\nimport {\n getBoundingCube, getMultiSelectionStats,\n} from './utils';\nimport {\n COLORMAP_OPTIONS,\n canLoadResolution,\n formatBytes,\n getStatsForResolution,\n} from '../utils';\nimport { DEFAULT_RASTER_DOMAIN_TYPE } from '../spatial/constants';\nimport { StyledSelectionSlider, useSelectStyles } from './styles';\n\nconst DOMAIN_OPTIONS = ['Full', 'Min/Max'];\n\n/**\n * Wrapper for the dropdown that selects a colormap (None, viridis, magma, etc.).\n * @prop {Object} loader Loader object with metadata.\n * @prop {function} handleMultiPropertyChange Function to propgate multiple layer changes at once.\n * This prevents updates from overridding each other.\n * @prop {number} resolution Current 3D resolution.\n * @prop {boolean} disable3d Whether or not to enable 3D selection\n * @prop {function} setRasterLayerCallback Setter for callbacks that fire after raster/volume loads.\n * @prop {function} setAreAllChannelsLoading Setter for whether or not a given channel is loading.\n * @prop {Object} setViewState Setter for the current view state.\n * @prop {number} spatialHeight Height of the spatial component.\n * @prop {number} spatialWidth Width of the spatial component.\n * @prop {object} channels Channels object.\n * @prop {boolean} use3d Whether or not 3D is enabled for this layer.\n */\nfunction VolumeDropdown({\n loader: loaderWithMeta,\n handleMultiPropertyChange,\n resolution: currResolution,\n disable3d,\n setRasterLayerCallback,\n setAreAllChannelsLoading,\n setViewState,\n spatialHeight,\n spatialWidth,\n channels,\n use3d,\n modelMatrix,\n}) {\n const classes = useSelectStyles();\n const selections = channels.map(i => i.selection);\n const { data: loader } = loaderWithMeta;\n const handleChange = async (val) => {\n // val is the resolution - null indicates 2D\n const shouldUse3D = typeof val === 'number';\n setAreAllChannelsLoading(true);\n setRasterLayerCallback(() => {\n setAreAllChannelsLoading(false);\n setRasterLayerCallback(null);\n });\n if (shouldUse3D) {\n const [xSlice, ySlice, zSlice] = getBoundingCube(loader);\n const propertiesChanged = {\n resolution: val,\n xSlice,\n ySlice,\n zSlice,\n use3d: shouldUse3D,\n };\n // Only make the fetch if needed i.e if the 3d was just being turned on.\n if (!use3d) {\n const { sliders } = await getMultiSelectionStats({\n loader,\n selections,\n use3d: shouldUse3D,\n });\n propertiesChanged.channels = [...channels];\n propertiesChanged.channels.forEach((ch, i) => {\n // eslint-disable-next-line no-param-reassign\n ch.slider = sliders[i];\n });\n }\n // Update all properties at once to avoid overriding calls.\n handleMultiPropertyChange(propertiesChanged);\n const defaultViewState = getDefaultInitialViewState(loader,\n { height: spatialHeight, width: spatialWidth }, 1.5, true, new Matrix4(modelMatrix));\n setViewState({\n ...defaultViewState,\n rotationX: 0,\n rotationOrbit: 0,\n });\n } else {\n const { sliders } = await getMultiSelectionStats({\n loader, selections, use3d: shouldUse3D,\n });\n const newChannels = [...channels];\n newChannels.forEach((ch, i) => {\n // eslint-disable-next-line no-param-reassign\n ch.slider = sliders[i];\n });\n // Update all properties at once to avoid overriding calls.\n handleMultiPropertyChange({\n resolution: val,\n use3d: shouldUse3D,\n spatialAxisFixed: false,\n channels: newChannels,\n });\n const defaultViewState = getDefaultInitialViewState(loader,\n { height: spatialHeight, width: spatialWidth }, 0.5, false, new Matrix4(modelMatrix));\n setViewState({\n ...defaultViewState,\n rotationX: null,\n rotationOrbit: null,\n orbitAxis: null,\n });\n }\n };\n const { labels, shape } = Array.isArray(loader) ? loader[0] : loader;\n const hasZStack = shape[labels.indexOf('z')] > 1;\n return (\n <>\n <Select\n native\n value={currResolution}\n onChange={e => handleChange(\n e.target.value === '2D' ? e.target.value : Number(e.target.value),\n )\n }\n classes={{ root: classes.selectRoot }}\n >\n {\n <option key=\"2D\" value=\"2D\">\n 2D Visualization\n </option>\n }\n {Array.from({ length: loader.length })\n .fill(0)\n // eslint-disable-next-line no-unused-vars\n .map((_, resolution) => {\n if (loader) {\n if (canLoadResolution(loader, resolution)) {\n const {\n height,\n width,\n depthDownsampled,\n totalBytes,\n } = getStatsForResolution(loader, resolution);\n return (\n <option\n key={`(${height}, ${width}, ${depthDownsampled})`}\n value={resolution}\n disabled={\n disable3d\n || !hasZStack\n }\n >\n {`3D: ${resolution}x Downsampled, ~${formatBytes(\n totalBytes,\n )} per channel, (${height}, ${width}, ${depthDownsampled})`}\n </option>\n );\n }\n }\n return null;\n })}\n </Select>\n </>\n );\n}\n\n\n/**\n * Wrapper for the dropdown that selects a colormap (None, viridis, magma, etc.).\n * @prop {string} value Currently selected value for the colormap.\n * @prop {string} inputId Css id.\n * @prop {function} handleChange Callback for every change in colormap.\n */\nfunction ColormapSelect({ value, inputId, handleChange }) {\n const classes = useSelectStyles();\n return (\n <Select\n native\n onChange={e => handleChange(e.target.value === '' ? null : e.target.value)}\n value={value}\n inputProps={{ name: 'colormap', id: inputId }}\n style={{ width: '100%' }}\n classes={{ root: classes.selectRoot }}\n >\n <option aria-label=\"None\" value=\"\">None</option>\n {COLORMAP_OPTIONS.map(name => (\n <option key={name} value={name}>\n {name}\n </option>\n ))}\n </Select>\n );\n}\n\nfunction TransparentColorCheckbox({ value, handleChange }) {\n return (\n <Checkbox\n style={{ float: 'left', padding: 0 }}\n color=\"default\"\n onChange={() => {\n if (value) {\n handleChange(null);\n } else {\n handleChange([0, 0, 0]);\n }\n }}\n checked={Boolean(value)}\n />\n );\n}\n\n/**\n * Wrapper for the slider that updates opacity.\n * @prop {string} value Currently selected value between 0 and 1.\n * @prop {function} handleChange Callback for every change in opacity.\n */\nfunction OpacitySlider({ value, handleChange }) {\n return (\n <Slider\n value={value}\n onChange={(e, v) => handleChange(v)}\n valueLabelDisplay=\"auto\"\n getAriaLabel={() => 'opacity slider'}\n min={0}\n max={1}\n step={0.01}\n orientation=\"horizontal\"\n style={{ marginTop: '7px' }}\n />\n );\n}\n\n/**\n * Wrapper for the dropdown that chooses the domain type.\n * @prop {string} value Currently selected value (i.e 'Max/Min').\n * @prop {string} inputId Css id.\n * @prop {function} handleChange Callback for every change in domain.\n */\nfunction SliderDomainSelector({ value, inputId, handleChange }) {\n const classes = useSelectStyles();\n return (\n <Select\n native\n onChange={e => handleChange(e.target.value)}\n value={value}\n inputProps={{ name: 'domain-selector', id: inputId }}\n style={{ width: '100%' }}\n classes={{ root: classes.selectRoot }}\n >\n {DOMAIN_OPTIONS.map(name => (\n <option key={name} value={name}>\n {name}\n </option>\n ))}\n </Select>\n );\n}\n\n/**\n * Wrapper for the slider that chooses global selections (z, t etc.).\n * @prop {string} field The dimension this selects for (z, t etc.).\n * @prop {number} value Currently selected index (1, 4, etc.).\n * @prop {function} handleChange Callback for every change in selection.\n * @prop {function} possibleValues All available values for the field.\n */\nfunction GlobalSelectionSlider({\n field,\n value,\n handleChange,\n possibleValues,\n}) {\n return (\n <StyledSelectionSlider\n value={value}\n // See https://github.com/hms-dbmi/viv/issues/176 for why\n // we have the two handlers.\n onChange={\n (event, newValue) => {\n handleChange({ selection: { [field]: newValue }, event });\n }\n }\n onChangeCommitted={\n (event, newValue) => {\n handleChange({ selection: { [field]: newValue }, event });\n }\n }\n valueLabelDisplay=\"auto\"\n getAriaLabel={() => `${field} slider`}\n marks={possibleValues.map(val => ({ value: val }))}\n min={Number(possibleValues[0])}\n max={Number(possibleValues.slice(-1))}\n orientation=\"horizontal\"\n step={null}\n />\n );\n}\n\n/**\n * Wrapper for each of the options to show its name and then its UI component.\n * @prop {string} name Display name for option.\n * @prop {number} opacity Current opacity value.\n * @prop {string} inputId An id for css.\n * @prop {object} children Components to be rendered next to the name (slider, dropdown etc.).\n */\nfunction LayerOption({ name, inputId, children }) {\n return (\n <Grid container direction=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <Grid item xs={6}>\n <InputLabel htmlFor={inputId}>{name}:</InputLabel>\n </Grid>\n <Grid item xs={6}>\n {children}\n </Grid>\n </Grid>\n );\n}\n\n/**\n * Gloabl options for all channels (opacity, colormap, etc.).\n * @prop {string} colormap What colormap is currently selected (None, viridis etc.).\n * @prop {number} opacity Current opacity value.\n * @prop {function} handleColormapChange Callback for when colormap changes.\n * @prop {function} handleOpacityChange Callback for when opacity changes.\n * @prop {object} globalControlLabels All available options for global control (z and t).\n * @prop {function} handleGlobalChannelsSelectionChange Callback for global selection changes.\n * @prop {function} handleDomainChange Callback for domain type changes (full or min/max).\n * @prop {array} channels Current channel object for inferring the current global selection.\n * @prop {array} dimensions Currently available dimensions (channel, z, t etc.).\n * @prop {string} domainType One of Max/Min or Full (soon presets as well).\n * @prop {boolean} disableChannelsIfRgbDetected Whether or not we need colormap controllers if RGB.\n */\nfunction LayerOptions({\n colormap,\n opacity,\n handleColormapChange,\n handleOpacityChange,\n handleTransparentColorChange,\n globalControlLabels,\n globalLabelValues,\n handleGlobalChannelsSelectionChange,\n handleSliderChange,\n handleDomainChange,\n transparentColor,\n channels,\n domainType,\n disableChannelsIfRgbDetected,\n shouldShowTransparentColor,\n shouldShowDomain,\n shouldShowColormap,\n use3d,\n loader,\n handleMultiPropertyChange,\n resolution,\n disable3d,\n setRasterLayerCallback,\n setAreAllChannelsLoading,\n setViewState,\n spatialHeight,\n spatialWidth,\n modelMatrix,\n}) {\n const { labels, shape } = Array.isArray(loader.data) ? loader.data[0] : loader.data;\n const hasDimensionsAndChannels = labels.length > 0 && channels.length > 0;\n const hasZStack = shape[labels.indexOf('z')] > 1;\n // Only show volume button if we can actually view resolutions.\n const hasViewableResolutions = Boolean(Array.from({\n length: loader.data.length,\n }).filter((_, res) => canLoadResolution(loader.data, res)).length);\n return (\n <Grid container direction=\"column\" style={{ width: '100%' }}>\n {hasZStack\n && !disable3d\n && hasViewableResolutions\n && (\n <VolumeDropdown\n loader={loader}\n handleSliderChange={handleSliderChange}\n handleDomainChange={handleDomainChange}\n channels={channels}\n handleMultiPropertyChange={handleMultiPropertyChange}\n resolution={resolution}\n disable3d={disable3d}\n setRasterLayerCallback={setRasterLayerCallback}\n setAreAllChannelsLoading={setAreAllChannelsLoading}\n setViewState={setViewState}\n spatialHeight={spatialHeight}\n spatialWidth={spatialWidth}\n use3d={use3d}\n modelMatrix={modelMatrix}\n />\n )\n }\n {hasDimensionsAndChannels\n && !use3d\n && globalControlLabels.map(\n field => shape[labels.indexOf(field)] > 1 && (\n <LayerOption name={field} inputId={`${field}-slider`} key={field}>\n <GlobalSelectionSlider\n field={field}\n value={globalLabelValues[field]}\n handleChange={handleGlobalChannelsSelectionChange}\n possibleValues={range(shape[labels.indexOf(field)])}\n />\n </LayerOption>\n ),\n )}\n {!disableChannelsIfRgbDetected ? (\n <>\n {shouldShowColormap && (\n <Grid item>\n <LayerOption name=\"Colormap\" inputId=\"colormap-select\">\n <ColormapSelect\n value={colormap || ''}\n inputId=\"colormap-select\"\n handleChange={handleColormapChange}\n />\n </LayerOption>\n </Grid>\n )}\n {shouldShowDomain && (\n <Grid item>\n <LayerOption name=\"Domain\" inputId=\"domain-selector\">\n <SliderDomainSelector\n value={domainType || DEFAULT_RASTER_DOMAIN_TYPE}\n handleChange={(value) => {\n handleDomainChange(value);\n }}\n />\n </LayerOption>\n </Grid>\n )}\n </>\n ) : null}\n {!use3d && (\n <Grid item>\n <LayerOption name=\"Opacity\" inputId=\"opacity-slider\">\n <OpacitySlider value={opacity} handleChange={handleOpacityChange} />\n </LayerOption>\n </Grid>\n )}\n {shouldShowTransparentColor && !use3d && (\n <Grid item>\n <LayerOption\n name=\"Zero Transparent\"\n inputId=\"transparent-color-selector\"\n >\n <TransparentColorCheckbox\n value={transparentColor}\n handleChange={handleTransparentColorChange}\n />\n </LayerOption>\n </Grid>\n )}\n </Grid>\n );\n}\n\nexport default LayerOptions;\n","import React from 'react';\nimport { Matrix4 } from 'math.gl';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport { makeStyles, createStyles } from '@material-ui/core/styles';\nimport FormControl from '@material-ui/core/FormControl';\nimport Select from '@material-ui/core/Select';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Slider from '@material-ui/core/Slider';\nimport { RENDERING_MODES, getDefaultInitialViewState } from '@hms-dbmi/viv';\nimport { abbreviateNumber, getBoundingCube } from './utils';\nimport { useSelectStyles } from './styles';\n\nconst useSlicerStyles = makeStyles(theme => createStyles({\n enabled: {},\n disabled: {\n color: theme.palette.text.disabled,\n // Because of the .5 opacity of the disabled color in the theme, and the fact\n // that there are multiple overlaid parts to the slider,\n // this needs to be set manually for the desired effect.\n '& .MuiSlider-thumb': {\n color: 'rgb(100, 100, 100, 1.0)',\n },\n '& .MuiSlider-track': {\n color: 'rgb(100, 100, 100, 1.0)',\n },\n },\n}));\n\nconst Slicer = ({\n xSlice,\n ySlice,\n zSlice,\n handleSlicerSetting,\n loader,\n use3d,\n}) => {\n const [xSliceInit, ySliceInit, zSliceInit] = getBoundingCube(loader.data);\n const sliceValuesAndSetSliceFunctions = [\n [\n xSlice,\n xSliceNew => handleSlicerSetting('x', xSliceNew),\n 'x',\n xSliceInit,\n ],\n [\n ySlice,\n ySliceNew => handleSlicerSetting('y', ySliceNew),\n 'y',\n ySliceInit,\n ],\n [\n zSlice,\n zSliceNew => handleSlicerSetting('z', zSliceNew),\n 'z',\n zSliceInit,\n ],\n ];\n const classes = useSlicerStyles();\n const Slicers = sliceValuesAndSetSliceFunctions.map(\n ([val, setVal, label, [min, max]]) => (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n key={label}\n >\n <Grid item xs={1}>\n <Typography\n className={!use3d ? classes.disabled : classes.enabled}\n style={{ marginBottom: 0 }}\n >\n {label}:\n </Typography>\n </Grid>\n <Grid item xs={11}>\n <Slider\n disabled={!use3d}\n className={!use3d ? classes.disabled : classes.enabled}\n value={val}\n onChange={(e, v) => setVal(v)}\n valueLabelDisplay=\"auto\"\n valueLabelFormat={v => abbreviateNumber(v)}\n getAriaLabel={() => `${label} slider`}\n min={min}\n max={max}\n step={0.005}\n orientation=\"horizontal\"\n />\n </Grid>\n </Grid>\n ),\n );\n return (\n <>\n <Typography\n className={!use3d ? classes.disabled : classes.enabled}\n style={{ marginTop: 16, marginBottom: 0 }}\n >\n Clipping Planes:{' '}\n </Typography>{' '}\n {Slicers}\n </>\n );\n};\n\nconst renderingOptions = Object.values(RENDERING_MODES);\n\nfunction RenderingModeSelect({\n handleRenderingModeChange,\n renderingMode,\n use3d,\n}) {\n const classes = useSelectStyles();\n // Empty option allows for displaying the title of the dropdown fully in the UI.\n const options = !use3d ? [...renderingOptions, ''] : renderingOptions;\n return (\n <FormControl fullWidth>\n <InputLabel htmlFor=\"rendering-mode-select\">Rendering Mode</InputLabel>\n <Select\n native\n onChange={e => handleRenderingModeChange(e.target.value)}\n value={use3d ? renderingMode : ''}\n inputProps={{\n name: 'rendering-mode',\n id: 'rendering-mode-select',\n }}\n disabled={!use3d}\n classes={{ root: classes.selectRoot }}\n >\n {options.map(name => (\n <option key={name} value={name}>\n {name}\n </option>\n ))}\n </Select>\n </FormControl>\n );\n}\n\nconst ReCenterButton = ({\n setViewState,\n use3d,\n spatialHeight,\n spatialWidth,\n loader,\n modelMatrix,\n}) => (\n <Grid item xs=\"auto\" key=\"recenter\">\n <Button\n onClick={() => {\n const defaultViewState = getDefaultInitialViewState(\n loader.data,\n { height: spatialHeight, width: spatialWidth },\n 1.5,\n use3d,\n new Matrix4(modelMatrix),\n );\n setViewState({\n ...defaultViewState,\n rotationX: 0,\n rotationOrbit: 0,\n });\n }\n }\n disabled={!use3d}\n style={{\n padding: 0,\n marginBottom: 6,\n }}\n >\n Re-Center\n </Button>\n </Grid>\n);\n\nconst VolumeOptions = ({\n handleSlicerSetting,\n handleRenderingModeChange,\n renderingMode,\n xSlice,\n ySlice,\n zSlice,\n use3d,\n loader,\n setViewState,\n spatialHeight,\n spatialWidth,\n modelMatrix,\n}) => (\n <>\n <RenderingModeSelect\n handleRenderingModeChange={handleRenderingModeChange}\n renderingMode={renderingMode}\n use3d={use3d}\n />\n <Slicer\n xSlice={xSlice}\n ySlice={ySlice}\n zSlice={zSlice}\n handleSlicerSetting={handleSlicerSetting}\n use3d={use3d}\n loader={loader}\n />\n <ReCenterButton\n setViewState={setViewState}\n use3d={use3d}\n spatialHeight={spatialHeight}\n spatialWidth={spatialWidth}\n loader={loader}\n modelMatrix={modelMatrix}\n />\n </>\n);\n\nexport default VolumeOptions;\n","import React, { useState, useRef, useEffect } from 'react';\nimport { MAX_CHANNELS, getChannelStats } from '@hms-dbmi/viv';\n\nimport Grid from '@material-ui/core/Grid';\nimport Button from '@material-ui/core/Button';\nimport AddIcon from '@material-ui/icons/Add';\nimport Slider from '@material-ui/core/Slider';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\n\nimport Accordion from '@material-ui/core/Accordion';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport VisibilityIcon from '@material-ui/icons/Visibility';\nimport VisibilityOffIcon from '@material-ui/icons/VisibilityOff';\n\nimport LayerOptions from './LayerOptions';\nimport VolumeOptions from './VolumeOptions';\nimport {\n useControllerSectionStyles,\n StyledAccordionDetails,\n StyledAccordionSummary,\n StyledInputLabel,\n OverflowEllipsisGrid,\n} from './styles';\nimport { getMultiSelectionStats } from './utils';\n\nimport { GLOBAL_LABELS } from '../spatial/constants';\nimport { getSourceFromLoader, isRgb } from '../../utils';\nimport { canLoadResolution } from '../utils';\nimport { DOMAINS } from './constants';\n\nfunction TabPanel(props) {\n const {\n children, value, index, ...other\n } = props;\n\n return (\n <div\n role=\"tabpanel\"\n hidden={value !== index}\n id={`simple-tabpanel-${index}`}\n aria-labelledby={`simple-tab-${index}`}\n {...other}\n >\n {value === index && children}\n </div>\n );\n}\n\n// Set the domain of the sliders based on either a full range or min/max.\nasync function getDomainsAndSliders(loader, selections, domainType, use3d) {\n let domains;\n const stats = await getMultiSelectionStats({\n loader: loader.data,\n selections,\n use3d,\n });\n const { sliders } = stats;\n if (domainType === 'Min/Max') {\n // eslint-disable-next-line prefer-destructuring\n domains = stats.domains;\n }\n if (domainType === 'Full') {\n const source = getSourceFromLoader(loader);\n domains = selections.map(() => DOMAINS[source.dtype]);\n }\n return { domains, sliders };\n}\n\nconst buttonStyles = {\n borderStyle: 'dashed',\n marginTop: '10px',\n fontWeight: 400,\n};\n\n/**\n * Controller for the various imaging options (color, opactiy, sliders etc.)\n * @prop {object} imageData Image config object, one of the `images` in the raster schema.\n * @prop {object} layerId Randomly generated id for the image layer that this controller handles.\n * @prop {function} handleLayerRemove Callback for handling the removal of a layer.\n * @prop {object} loader Loader object for the current imaging layer.\n * @prop {function} handleLayerChange Callback for handling the changing of layer properties.\n */\nexport default function LayerController(props) {\n const {\n layer,\n name,\n loader,\n theme,\n handleLayerRemove,\n handleLayerChange,\n shouldShowTransparentColor,\n shouldShowDomain,\n shouldShowColormap,\n ChannelController,\n setViewState,\n disable3d,\n setRasterLayerCallback,\n setAreLayerChannelsLoading,\n areLayerChannelsLoading,\n disabled,\n spatialHeight,\n spatialWidth,\n disableChannelsIfRgbDetected,\n shouldShowRemoveLayerButton,\n } = props;\n\n const {\n colormap,\n opacity,\n channels,\n transparentColor,\n renderingMode,\n xSlice,\n ySlice,\n zSlice,\n resolution,\n use3d,\n modelMatrix,\n } = layer;\n // Channels are used in a lot of callbacks and change handlers\n // so ensuring they have an up to date copy of the data ensures consistency.\n // See: https://github.com/vitessce/vitessce/issues/1036\n const channelRef = useRef(channels);\n useEffect(() => {\n channelRef.current = channels;\n return undefined;\n }, [channels]);\n\n const firstSelection = channels[0]?.selection || {};\n\n const { data, channels: channelOptions } = loader;\n const [tab, setTab] = useState(0);\n\n const handleTabChange = (event, newTab) => {\n setTab(newTab);\n };\n const { labels, shape } = Array.isArray(data) ? data[data.length - 1] : data;\n const [domainType, setDomainType] = useState(layer.domainType);\n const [isExpanded, setIsExpanded] = useState(true);\n const [globalLabelValues, setGlobalLabelValues] = useState(\n GLOBAL_LABELS.filter(\n field => typeof firstSelection[field] === 'number',\n ).reduce((o, key) => ({ ...o, [key]: firstSelection[key] }), {}),\n );\n\n function setVisible(v) {\n handleLayerChange({ ...layer, visible: v });\n }\n\n function setColormap(v) {\n handleLayerChange({ ...layer, colormap: v });\n }\n\n function setOpacity(v) {\n handleLayerChange({ ...layer, opacity: v });\n }\n\n function setChannels(v) {\n handleLayerChange({ ...layer, channels: v });\n }\n function setTransparentColor(v) {\n handleLayerChange({ ...layer, transparentColor: v });\n }\n function setRenderingMode(v) {\n handleLayerChange({ ...layer, renderingMode: v });\n }\n\n function handleMultiPropertyChange(obj) {\n handleLayerChange({ ...layer, ...obj });\n }\n\n function handleSlicerSetting(slice, val) {\n handleLayerChange({ ...layer, [`${slice}Slice`]: val });\n }\n\n function setChannelsAndDomainType(newChannels, newDomainType) {\n handleLayerChange({\n ...layer,\n channels: newChannels,\n domainType: newDomainType,\n });\n }\n\n function setChannel(v, i) {\n const newChannels = [...channelRef.current];\n newChannels[i] = v;\n handleLayerChange({ ...layer, channels: newChannels });\n }\n\n function addChannel(v) {\n const newChannels = [...channelRef.current, v];\n handleLayerChange({ ...layer, channels: newChannels });\n }\n\n function removeChannel(i) {\n const newChannels = [...channelRef.current];\n newChannels.splice(i, 1);\n handleLayerChange({ ...layer, channels: newChannels });\n }\n\n const setAreAllChannelsLoading = (val) => {\n const newAreLayerChannelsLoading = channelRef.current.map(() => val);\n setAreLayerChannelsLoading(newAreLayerChannelsLoading);\n };\n\n // Handles adding a channel, creating a default selection\n // for the current global settings and domain type.\n const handleChannelAdd = async () => {\n const selection = {};\n labels.forEach((label) => {\n // Set new image to default selection for non-global selections (0)\n // and use current global selection otherwise.\n selection[label] = GLOBAL_LABELS.includes(label)\n ? globalLabelValues[label] || 0\n : 0;\n });\n const { domains, sliders } = await getDomainsAndSliders(\n loader,\n [selection],\n domainType,\n use3d,\n );\n const domain = domains[0];\n const slider = domain;\n const color = [255, 255, 255];\n const visible = true;\n const newChannelId = channels.length;\n const newAreLayerChannelsLoading = [...areLayerChannelsLoading];\n newAreLayerChannelsLoading[newChannelId] = true;\n setAreLayerChannelsLoading(newAreLayerChannelsLoading);\n const channel = {\n selection,\n slider,\n visible,\n color,\n };\n setRasterLayerCallback(() => {\n setChannel({ ...channel, slider: sliders[0] }, newChannelId);\n const areLayerChannelsLoadingCallback = [...newAreLayerChannelsLoading];\n areLayerChannelsLoadingCallback[newChannelId] = false;\n setAreLayerChannelsLoading(areLayerChannelsLoadingCallback);\n setRasterLayerCallback(null);\n });\n addChannel(channel);\n };\n\n const handleDomainChange = async (value) => {\n setDomainType(value);\n const selections = channels.map(channel => channel.selection);\n let sliders = channels.map(channel => channel.slider);\n const { domains } = await getDomainsAndSliders(\n loader,\n selections,\n value,\n use3d,\n );\n\n // If it's the right-most slider, we take the minimum of that and the new value.\n // Otherwise, we use the maximum of the left-hand side and the new value.\n sliders = sliders.map((slider, i) => {\n const [left, right] = slider;\n return [Math.max(left, domains[i][0]), Math.min(right, domains[i][1])];\n });\n\n const newChannels = channels.map((c, i) => ({ ...c, slider: sliders[i] }));\n setChannelsAndDomainType(newChannels, value);\n };\n\n // This call updates all channel selections with new global selection from the UI.\n const handleGlobalChannelsSelectionChange = async ({ selection, event }) => {\n const selections = channels.map(channel => ({\n ...channel.selection,\n ...selection,\n }));\n const canUpdateChannels = event.type === 'mouseup' || event.type === 'keydown';\n // Only update domains on a mouseup event for the same reason as above.\n if (canUpdateChannels) {\n setAreAllChannelsLoading(true);\n getDomainsAndSliders(loader, selections, domainType, use3d).then(\n ({ sliders }) => {\n const newChannelsWithSelection = channels.map(c => ({\n ...c,\n selection: { ...c.selection, ...selection },\n }));\n // Set the callback before changing the selection\n // so the callback is used when the layer (re)loads its data.\n setRasterLayerCallback(() => {\n setRasterLayerCallback(null);\n setAreAllChannelsLoading(false);\n const newChannelsWithSliders = [...newChannelsWithSelection].map(\n (c, i) => ({\n ...c,\n slider: sliders[i],\n }),\n );\n setChannels(newChannelsWithSliders);\n });\n setChannels(newChannelsWithSelection);\n },\n );\n }\n setGlobalLabelValues(prev => ({ ...prev, ...selection }));\n };\n\n let channelControllers = [];\n if (labels.length > 0) {\n const channelLabel = labels.find(c => c === 'channel' || c === 'c') || labels[0];\n // Create the channel controllers for each channel.\n channelControllers = channels.map(\n // c is an object like { color, selection, slider, visible }.\n (c, channelId) => {\n // Update the auxiliary store with the current loading state of a channel.\n const setIsLoading = (val) => {\n const newAreLayerChannelsLoading = [...areLayerChannelsLoading];\n newAreLayerChannelsLoading[channelId] = val;\n setAreLayerChannelsLoading(newAreLayerChannelsLoading);\n };\n // Change one property of a channel (for now - soon\n // nested structures allowing for multiple z/t selecitons at once, for example).\n const handleChannelPropertyChange = (property, value) => {\n // property is something like \"selection\" or \"slider.\"\n // value is the actual change, like { channel: \"DAPI\" }.\n const update = { [property]: value };\n if (property === 'selection') {\n // Channel is loading until the layer callback is called\n // by the layer, which fetches the raster data.\n setIsLoading(true);\n update.selection = {\n ...globalLabelValues,\n ...update.selection,\n };\n setChannel({ ...c, ...update }, channelId);\n // Call back for raster layer handles update of UI\n // like sliders and the loading state of the channel.\n setRasterLayerCallback(async () => {\n const selections = [\n { ...channels[channelId][property], ...value },\n ];\n const { sliders } = await getDomainsAndSliders(\n loader,\n selections,\n domainType,\n use3d,\n );\n [update.slider] = sliders;\n setChannel({ ...c, ...update }, channelId);\n setRasterLayerCallback(null);\n setIsLoading(false);\n });\n } else {\n setChannel({ ...c, ...update }, channelId);\n }\n };\n const handleChannelRemove = () => {\n removeChannel(channelId);\n };\n const handleIQRUpdate = async () => {\n const { data: loaderData } = loader;\n const source = Array.isArray(loaderData)\n ? loaderData[loaderData.length - 1]\n : loaderData;\n const raster = await source.getRaster({\n selection: channels[channelId].selection,\n });\n const stats = getChannelStats(raster.data);\n const { q1, q3 } = stats;\n setChannel({ ...c, slider: [q1, q3] }, channelId);\n };\n return (\n <ChannelController\n // eslint-disable-next-line react/no-array-index-key\n key={`channel-controller-${channelId}`}\n dimName={channelLabel}\n visibility={c.visible}\n selectionIndex={c.selection[channelLabel]}\n slider={c.slider}\n color={c.color}\n channels={channels}\n channelId={channelId}\n domainType={domainType}\n loader={loader}\n globalLabelValues={globalLabelValues}\n theme={theme}\n channelOptions={channelOptions}\n colormapOn={Boolean(colormap)}\n handlePropertyChange={handleChannelPropertyChange}\n handleChannelRemove={handleChannelRemove}\n handleIQRUpdate={handleIQRUpdate}\n setRasterLayerCallback={setRasterLayerCallback}\n isLoading={areLayerChannelsLoading[channelId]}\n use3d={use3d}\n />\n );\n },\n );\n }\n\n const controllerSectionClasses = useControllerSectionStyles();\n\n const { visible } = layer;\n const visibleSetting = typeof visible === 'boolean' ? visible : true;\n const Visibility = visibleSetting ? VisibilityIcon : VisibilityOffIcon;\n // Only show Volume tabs if 3D is available.\n const hasViewableResolutions = Boolean(\n Array.from({\n length: loader.data.length,\n }).filter((_, res) => canLoadResolution(loader.data, res)).length,\n );\n const useVolumeTabs = !disable3d && shape[labels.indexOf('z')] > 1 && hasViewableResolutions;\n const FullController = (\n <>\n <LayerOptions\n channels={channels}\n opacity={opacity}\n colormap={colormap}\n transparentColor={transparentColor}\n domainType={domainType}\n // Only allow for global dimension controllers that\n // exist in the `dimensions` part of the loader.\n globalControlLabels={labels.filter(label => GLOBAL_LABELS.includes(label))}\n globalLabelValues={globalLabelValues}\n handleOpacityChange={setOpacity}\n handleColormapChange={setColormap}\n handleGlobalChannelsSelectionChange={\n handleGlobalChannelsSelectionChange\n }\n handleTransparentColorChange={setTransparentColor}\n disableChannelsIfRgbDetected={\n isRgb(loader) && disableChannelsIfRgbDetected\n }\n handleDomainChange={handleDomainChange}\n shouldShowTransparentColor={shouldShowTransparentColor}\n shouldShowDomain={shouldShowDomain}\n shouldShowColormap={shouldShowColormap}\n use3d={use3d}\n loader={loader}\n handleMultiPropertyChange={handleMultiPropertyChange}\n resolution={resolution}\n disable3d={disable3d}\n setRasterLayerCallback={setRasterLayerCallback}\n setAreAllChannelsLoading={setAreAllChannelsLoading}\n setViewState={setViewState}\n spatialHeight={spatialHeight}\n spatialWidth={spatialWidth}\n modelMatrix={modelMatrix}\n />\n {isRgb(loader) && disableChannelsIfRgbDetected\n ? null\n : channelControllers}\n {isRgb(loader) && disableChannelsIfRgbDetected ? null : (\n <Button\n disabled={channels.length === MAX_CHANNELS}\n onClick={handleChannelAdd}\n fullWidth\n variant=\"outlined\"\n style={buttonStyles}\n startIcon={<AddIcon />}\n size=\"small\"\n >\n Add Channel\n </Button>\n )}\n </>\n );\n return (\n <Accordion\n className={controllerSectionClasses.root}\n onChange={(e, expanded) => !disabled\n && setIsExpanded(\n expanded && e?.target?.attributes?.role?.value === 'presentation',\n )\n }\n TransitionProps={{ enter: false }}\n expanded={!disabled && isExpanded}\n >\n <StyledAccordionSummary\n expandIcon={<ExpandMoreIcon role=\"presentation\" />}\n aria-controls={`layer-${name}-controls`}\n >\n <Grid container direction=\"column\" m={1} justifyContent=\"center\">\n <OverflowEllipsisGrid item>\n <Button\n onClick={(e) => {\n if (!disabled) {\n // Needed to prevent affecting the expansion panel from changing\n e.stopPropagation();\n const nextVisible = typeof visible === 'boolean' ? !visible : false;\n setVisible(nextVisible);\n }\n }}\n style={{\n marginRight: 8,\n marginBottom: 2,\n padding: 0,\n minWidth: 0,\n }}\n >\n <Visibility />\n </Button>\n {name}\n </OverflowEllipsisGrid>\n {!disabled && !isExpanded && !use3d && (\n <Grid\n container\n direction=\"row\"\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <Grid item xs={6}>\n <StyledInputLabel htmlFor={`layer-${name}-opacity-closed`}>\n Opacity:\n </StyledInputLabel>\n </Grid>\n <Grid item xs={6}>\n <Slider\n id={`layer-${name}-opacity-closed`}\n value={opacity}\n onChange={(e, v) => setOpacity(v)}\n valueLabelDisplay=\"auto\"\n getAriaLabel={() => 'opacity slider'}\n min={0}\n max={1}\n step={0.01}\n orientation=\"horizontal\"\n />\n </Grid>\n </Grid>\n )}\n </Grid>\n </StyledAccordionSummary>\n <StyledAccordionDetails>\n {useVolumeTabs ? (\n <>\n <Tabs\n value={tab}\n onChange={handleTabChange}\n aria-label=\"simple tabs example\"\n style={{ height: '24px', minHeight: '24px' }}\n >\n <Tab\n label=\"Channels\"\n style={{\n fontSize: '.75rem',\n bottom: 12,\n width: '50%',\n minWidth: '50%',\n }}\n disableRipple\n />\n <Tab\n label=\"Volume\"\n style={{\n fontSize: '.75rem',\n bottom: 12,\n width: '50%',\n minWidth: '50%',\n }}\n />\n </Tabs>\n <TabPanel value={tab} index={0}>\n {FullController}\n </TabPanel>\n <TabPanel value={tab} index={1} style={{ marginTop: 4 }}>\n <VolumeOptions\n loader={loader}\n handleSlicerSetting={handleSlicerSetting}\n handleRenderingModeChange={setRenderingMode}\n renderingMode={renderingMode}\n xSlice={xSlice}\n ySlice={ySlice}\n zSlice={zSlice}\n use3d={use3d}\n setViewState={setViewState}\n spatialHeight={spatialHeight}\n spatialWidth={spatialWidth}\n modelMatrix={modelMatrix}\n />\n </TabPanel>\n </>\n ) : (\n FullController\n )}\n {shouldShowRemoveLayerButton ? (\n <Button\n onClick={handleLayerRemove}\n fullWidth\n variant=\"outlined\"\n style={buttonStyles}\n size=\"small\"\n >\n Remove Image Layer\n </Button>\n ) : null}\n </StyledAccordionDetails>\n </Accordion>\n );\n}\n","import React, { useState } from 'react';\nimport { makeStyles } from '@material-ui/core/styles';\nimport AddIcon from '@material-ui/icons/Add';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport { PopperMenu } from '../shared-mui/components';\n\nconst useStyles = makeStyles(() => ({\n addButton: {\n marginTop: '10px',\n marginBottom: '10px',\n fontWeight: 400,\n },\n}));\n\nfunction ImageAddIcon() {\n return (\n <>\n <AddIcon />\n Add Image Layer\n </>\n );\n}\n\nfunction ImageAddButton({ imageOptions, handleImageAdd }) {\n const [open, setOpen] = useState(false);\n const classes = useStyles();\n\n const handleAdd = (imgData) => {\n setOpen(prev => !prev);\n handleImageAdd(imgData);\n };\n\n if (!imageOptions) return null;\n return (\n <PopperMenu\n open={open}\n setOpen={setOpen}\n buttonIcon={<ImageAddIcon />}\n buttonClassName={classes.addButton}\n placement=\"bottom-start\"\n >\n {imageOptions.map((imgData, i) => (\n <MenuItem dense key={imgData.name} onClick={() => handleAdd(i)}>\n <span>{imgData.name}</span>\n </MenuItem>\n ))}\n </PopperMenu>\n );\n}\n\nexport default ImageAddButton;\n","/* eslint-disable dot-notation */\nimport React, {\n useEffect, useCallback, useRef, forwardRef,\n} from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport TitleInfo from '../TitleInfo';\nimport RasterChannelController from './RasterChannelController';\nimport BitmaskChannelController from './BitmaskChannelController';\nimport VectorLayerController from './VectorLayerController';\nimport LayerController from './LayerController';\nimport ImageAddButton from './ImageAddButton';\nimport { useReady, useClosestVitessceContainerSize, useWindowDimensions } from '../hooks';\nimport { useCellsData, useMoleculesData, useRasterData } from '../data-hooks';\nimport {\n useCoordination,\n useLoaders,\n useAuxiliaryCoordination,\n useComponentLayout,\n} from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport { initializeLayerChannels } from '../spatial/utils';\nimport { DEFAULT_RASTER_LAYER_PROPS } from '../spatial/constants';\n\nconst LAYER_CONTROLLER_DATA_TYPES = ['raster'];\n\n// LayerController is memoized to prevent updates from prop changes that\n// are caused by view state updates i.e zooming and panning within\n// the actual Spatial component. Re-rendering this component is very\n// expensive so we have to be careful with props in this file in general.\nconst LayerControllerMemoized = React.memo(\n forwardRef((props, ref) => {\n const {\n title,\n removeGridComponent,\n theme,\n isReady,\n moleculesLayer,\n dataset,\n setMoleculesLayer,\n cellsLayer,\n canShowCellVecmask,\n setCellsLayer,\n rasterLayers,\n imageLayerLoaders,\n imageLayerMeta,\n rasterLayersCallbacks,\n setRasterLayersCallbacks,\n areLoadingRasterChannnels,\n setAreLoadingRasterChannnels,\n handleRasterLayerChange,\n handleRasterLayerRemove,\n disable3d,\n globalDisable3d,\n disableChannelsIfRgbDetected,\n layerIs3DIndex,\n setZoom,\n setTargetX,\n setTargetY,\n setTargetZ,\n setRotationX,\n setRotationOrbit,\n componentHeight,\n componentWidth,\n spatialLayout,\n handleImageAdd,\n enableLayerButtonsWithOneLayer,\n } = props;\n const shouldShowImageLayerButton = Boolean(\n enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1,\n );\n return (\n <TitleInfo\n title={title}\n isScroll\n removeGridComponent={removeGridComponent}\n theme={theme}\n isReady={isReady}\n >\n <div className=\"layer-controller-container\" ref={ref}>\n {moleculesLayer && (\n <VectorLayerController\n key={`${dataset}-molecules`}\n label=\"Molecules\"\n layerType=\"molecules\"\n layer={moleculesLayer}\n handleLayerChange={setMoleculesLayer}\n />\n )}\n {cellsLayer && canShowCellVecmask && (\n <VectorLayerController\n key={`${dataset}-cells`}\n label=\"Cell Segmentations\"\n layerType=\"cells\"\n layer={cellsLayer}\n handleLayerChange={setCellsLayer}\n />\n )}\n {rasterLayers\n && rasterLayers.map((layer, i) => {\n const { index } = layer;\n const loader = imageLayerLoaders[index];\n const layerMeta = imageLayerMeta[index];\n // Could also be bitmask at the moment.\n const isRaster = !layerMeta?.metadata?.isBitmask;\n const ChannelController = isRaster\n ? RasterChannelController\n : BitmaskChannelController;\n // Set up the call back mechanism so that each layer manages\n // callbacks/loading state for itself and its channels.\n const setRasterLayerCallback = (cb) => {\n const newRasterLayersCallbacks = [\n ...(rasterLayersCallbacks || []),\n ];\n newRasterLayersCallbacks[i] = cb;\n setRasterLayersCallbacks(newRasterLayersCallbacks);\n };\n const areLayerChannelsLoading = (areLoadingRasterChannnels || [])[i] || [];\n const setAreLayerChannelsLoading = (v) => {\n const newAreLoadingRasterChannnels = [\n ...(areLoadingRasterChannnels || []),\n ];\n newAreLoadingRasterChannnels[i] = v;\n setAreLoadingRasterChannnels(newAreLoadingRasterChannnels);\n };\n return loader && layerMeta ? (\n <Grid\n // eslint-disable-next-line react/no-array-index-key\n key={`${dataset}-raster-${index}-${i}`}\n item\n style={{ marginTop: '10px' }}\n >\n <LayerController\n name={layerMeta.name}\n layer={layer}\n loader={loader}\n theme={theme}\n handleLayerChange={v => handleRasterLayerChange(v, i)}\n handleLayerRemove={() => handleRasterLayerRemove(i)}\n ChannelController={ChannelController}\n shouldShowTransparentColor={isRaster}\n shouldShowDomain={isRaster}\n shouldShowColormap={isRaster}\n // Disable 3D if given explicit instructions to do so\n // or if another layer is using 3D mode.\n disable3d={\n globalDisable3d\n || (disable3d || []).indexOf(layerMeta.name) >= 0\n || (typeof layerIs3DIndex === 'number'\n && layerIs3DIndex !== -1\n && layerIs3DIndex !== i)\n }\n disabled={\n typeof layerIs3DIndex === 'number'\n && layerIs3DIndex !== -1\n && layerIs3DIndex !== i\n }\n disableChannelsIfRgbDetected={disableChannelsIfRgbDetected}\n rasterLayersCallbacks={rasterLayersCallbacks}\n setRasterLayerCallback={setRasterLayerCallback}\n setViewState={({\n zoom: newZoom,\n target,\n rotationX: newRotationX,\n rotationOrbit: newRotationOrbit,\n }) => {\n setZoom(newZoom);\n setTargetX(target[0]);\n setTargetY(target[1]);\n setTargetZ(target[2]);\n setRotationX(newRotationX);\n setRotationOrbit(newRotationOrbit);\n }}\n setAreLayerChannelsLoading={setAreLayerChannelsLoading}\n areLayerChannelsLoading={areLayerChannelsLoading}\n spatialHeight={(componentHeight * (spatialLayout ? spatialLayout.h : 1)) / 12}\n spatialWidth={(componentWidth * (spatialLayout ? spatialLayout.w : 1)) / 12}\n shouldShowRemoveLayerButton={shouldShowImageLayerButton}\n />\n </Grid>\n ) : null;\n })}\n {shouldShowImageLayerButton\n ? (\n <Grid item>\n <ImageAddButton\n imageOptions={imageLayerMeta}\n handleImageAdd={handleImageAdd}\n />\n </Grid>\n ) : null}\n </div>\n </TitleInfo>\n );\n }),\n);\n\n/**\n * A subscriber component for the spatial layer controller.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n * @param {Object} props.disable3d Which layers should have 3D disabled (from `raster.json` names).\n * @param {boolean} props.globalDisable3d Disable 3D for all layers. Overrides the `disable3d` prop.\n * @param {boolean} props.disableChannelsIfRgbDetected Disable channel controls if an\n * RGB image is detected i.e 3 channel 8 bit.\n * @param {boolean} props.enableLayerButtonsWithOneLayer If there is only one layer,\n * show the the layer add/remove buttons.\n */\nfunction LayerControllerSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n title = 'Spatial Layers',\n disable3d,\n globalDisable3d,\n disableChannelsIfRgbDetected,\n enableLayerButtonsWithOneLayer,\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [\n {\n dataset,\n spatialRasterLayers: rasterLayers,\n spatialCellsLayer: cellsLayer,\n spatialMoleculesLayer: moleculesLayer,\n },\n {\n setSpatialRasterLayers: setRasterLayers,\n setSpatialCellsLayer: setCellsLayer,\n setSpatialMoleculesLayer: setMoleculesLayer,\n setSpatialTargetX: setTargetX,\n setSpatialTargetY: setTargetY,\n setSpatialTargetZ: setTargetZ,\n setSpatialRotationX: setRotationX,\n setSpatialRotationOrbit: setRotationOrbit,\n setSpatialZoom: setZoom,\n },\n ] = useCoordination(\n COMPONENT_COORDINATION_TYPES.layerController,\n coordinationScopes,\n );\n\n const [\n {\n rasterLayersCallbacks,\n areLoadingRasterChannnels,\n },\n {\n setRasterLayersCallbacks,\n setAreLoadingRasterChannnels,\n },\n ] = useAuxiliaryCoordination(\n COMPONENT_COORDINATION_TYPES.layerController,\n coordinationScopes,\n );\n // Spatial layout + window size is needed for the \"re-center\" button to work properly.\n // Dimensions of the Spatial component can be inferred and used for resetting view state to\n // a nice, centered view.\n const [spatialLayout] = useComponentLayout('spatial', ['spatialRasterLayers'], coordinationScopes);\n const layerControllerRef = useRef();\n const [componentWidth, componentHeight] = useClosestVitessceContainerSize(layerControllerRef);\n const { height: windowHeight, width: windowWidth } = useWindowDimensions();\n\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n LAYER_CONTROLLER_DATA_TYPES,\n );\n\n // Reset loader progress when the dataset has changed.\n useEffect(() => {\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n // eslint-disable-next-line no-unused-vars\n const [raster, imageLayerLoaders, imageLayerMeta] = useRasterData(\n loaders, dataset, setItemIsReady, () => { }, false,\n { setSpatialRasterLayers: setRasterLayers },\n { spatialRasterLayers: rasterLayers },\n );\n\n useCellsData(\n loaders, dataset, setItemIsReady, () => {}, false,\n { setSpatialCellsLayer: setCellsLayer },\n { spatialCellsLayer: cellsLayer },\n );\n useMoleculesData(\n loaders, dataset, setItemIsReady, () => {}, false,\n { setSpatialMoleculesLayer: setMoleculesLayer },\n { spatialMoleculesLayer: moleculesLayer },\n );\n\n // useCallback prevents new functions from propogating\n // changes to the underlying component.\n const handleImageAdd = useCallback(async (index) => {\n const loader = imageLayerLoaders[index];\n const newChannels = await initializeLayerChannels(\n loader,\n (rasterLayers[index] || {}).use3d,\n );\n const newLayer = {\n index,\n modelMatrix: imageLayerMeta[index]?.metadata?.transform?.matrix,\n ...DEFAULT_RASTER_LAYER_PROPS,\n channels: newChannels,\n type: imageLayerMeta[index]?.metadata?.isBitmask ? 'bitmask' : 'raster',\n };\n const newLayers = [...rasterLayers, newLayer];\n setRasterLayers(newLayers);\n }, [imageLayerLoaders, imageLayerMeta, rasterLayers, setRasterLayers]);\n\n const handleRasterLayerChange = useCallback((newLayer, i) => {\n const newLayers = [...rasterLayers];\n newLayers[i] = newLayer;\n setRasterLayers(newLayers);\n }, [rasterLayers, setRasterLayers]);\n\n const handleRasterLayerRemove = useCallback((i) => {\n const newLayers = [...rasterLayers];\n newLayers.splice(i, 1);\n setRasterLayers(newLayers);\n }, [rasterLayers, setRasterLayers]);\n\n const hasNoBitmask = (\n imageLayerMeta.length ? imageLayerMeta : [{ metadata: { isBitmask: true } }]\n ).every(l => !l?.metadata?.isBitmask);\n // Only want to show vector cells controller if there is no bitmask\n const canShowCellVecmask = hasNoBitmask;\n const layerIs3DIndex = rasterLayers?.findIndex && rasterLayers.findIndex(layer => layer.use3d);\n return (\n <LayerControllerMemoized\n ref={layerControllerRef}\n title={title}\n removeGridComponent={removeGridComponent}\n theme={theme}\n isReady={isReady}\n moleculesLayer={moleculesLayer}\n dataset={dataset}\n setMoleculesLayer={setMoleculesLayer}\n cellsLayer={cellsLayer}\n canShowCellVecmask={canShowCellVecmask}\n setCellsLayer={setCellsLayer}\n rasterLayers={rasterLayers}\n imageLayerLoaders={imageLayerLoaders}\n imageLayerMeta={imageLayerMeta}\n rasterLayersCallbacks={rasterLayersCallbacks}\n setRasterLayersCallbacks={setRasterLayersCallbacks}\n areLoadingRasterChannnels={areLoadingRasterChannnels}\n setAreLoadingRasterChannnels={setAreLoadingRasterChannnels}\n handleRasterLayerChange={handleRasterLayerChange}\n handleRasterLayerRemove={handleRasterLayerRemove}\n disable3d={disable3d}\n globalDisable3d={globalDisable3d}\n layerIs3DIndex={layerIs3DIndex}\n disableChannelsIfRgbDetected={disableChannelsIfRgbDetected}\n enableLayerButtonsWithOneLayer={enableLayerButtonsWithOneLayer}\n setZoom={setZoom}\n setTargetX={setTargetX}\n setTargetY={setTargetY}\n setTargetZ={setTargetZ}\n setRotationX={setRotationX}\n setRotationOrbit={setRotationOrbit}\n // Fall back to window for height and width.\n componentHeight={componentHeight || windowHeight}\n componentWidth={componentWidth || windowWidth}\n spatialLayout={spatialLayout}\n handleImageAdd={handleImageAdd}\n />\n );\n}\n\nexport default LayerControllerSubscriber;\n","import React, {\n useMemo, useEffect, useRef, Suspense, useState,\n} from 'react';\nimport ReactDOM from 'react-dom';\nimport dynamicImportPolyfill from 'dynamic-import-polyfill';\nimport register from 'higlass-register';\nimport { ZarrMultivecDataFetcher } from 'higlass-zarr-datafetchers';\nimport packageJson from '../../../package.json';\nimport { createWarningComponent, asEsModule } from '../utils';\nimport { useGridItemSize } from '../hooks';\nimport {\n useCoordination,\n} from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\n\nconst PIXI_BUNDLE_VERSION = packageJson.dependencies['window-pixi'];\nconst HIGLASS_BUNDLE_VERSION = packageJson.dependencies.higlass;\nconst BUNDLE_FILE_EXT = process.env.NODE_ENV === 'development' ? 'js' : 'min.js';\nconst PIXI_BUNDLE_URL = `https://unpkg.com/window-pixi@${PIXI_BUNDLE_VERSION}/dist/pixi.${BUNDLE_FILE_EXT}`;\nconst HIGLASS_BUNDLE_URL = `https://unpkg.com/higlass@${HIGLASS_BUNDLE_VERSION}/dist/hglib.${BUNDLE_FILE_EXT}`;\n\n\n// Initialize the dynamic __import__() function.\nif (dynamicImportPolyfill) {\n dynamicImportPolyfill.initialize();\n}\n\n// Register the zarr-multivec plugin data fetcher.\n// References:\n// https://github.com/higlass/higlass-register\n// https://github.com/higlass/higlass-zarr-datafetchers\nregister(\n { dataFetcher: ZarrMultivecDataFetcher, config: ZarrMultivecDataFetcher.config },\n { pluginType: 'dataFetcher' },\n);\n\n// Lazy load the HiGlass React component,\n// using dynamic imports with absolute URLs.\nconst HiGlassComponent = React.lazy(() => {\n if (!window.React) {\n window.React = React;\n }\n if (!window.ReactDOM) {\n window.ReactDOM = ReactDOM;\n }\n return new Promise((resolve) => {\n const handleImportError = (e) => {\n console.warn(e);\n resolve(asEsModule(createWarningComponent({\n title: 'Could not load HiGlass',\n message: 'The HiGlass scripts could not be dynamically imported.',\n })));\n };\n // eslint-disable-next-line no-undef\n __import__(PIXI_BUNDLE_URL).then(() => {\n // eslint-disable-next-line no-undef\n __import__(HIGLASS_BUNDLE_URL).then(() => {\n // React.lazy promise must return an ES module with the\n // component as the default export.\n resolve(asEsModule(window.hglib.HiGlassComponent));\n }).catch(handleImportError);\n }).catch(handleImportError);\n });\n});\n\n// Use an arbitrary size for normalization of the zoom level.\n// (800 means 800 px width for the full genome)\nconst HG_SIZE = 800;\n\n/**\n * A wrapper around HiGlass (http://higlass.io/).\n * The HiGlassComponent react component is loaded lazily.\n * @prop {object} hgViewConfig A HiGlass viewconfig object to pass\n * to the HiGlassComponent viewConfig prop.\n * @prop {object} hgOptions An optional HiGlass object to pass\n * to the HiGlassComponent hgOptions prop.\n * @prop {function} removeGridComponent A grid component removal handler\n * to pass to the TitleInfo component.\n * @prop {function} onReady A callback function to signal that the component is ready.\n */\nexport default function HiGlassLazy(props) {\n const {\n coordinationScopes,\n theme,\n hgViewConfig: hgViewConfigProp,\n hgOptions: hgOptionsProp,\n genomeSize,\n height,\n } = props;\n\n // Get \"props\" from the coordination space.\n const [{\n genomicZoomX,\n genomicZoomY,\n genomicTargetX,\n genomicTargetY,\n }, {\n setGenomicZoomX,\n setGenomicZoomY,\n setGenomicTargetX,\n setGenomicTargetY,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.higlass, coordinationScopes);\n\n // eslint-disable-next-line no-unused-vars\n const [width, computedHeight, containerRef] = useGridItemSize();\n const [hgInstance, setHgInstance] = useState();\n const isActiveRef = useRef();\n\n const hgOptions = useMemo(() => ({\n ...hgOptionsProp,\n theme,\n }), [hgOptionsProp, theme]);\n\n const hgViewConfig = useMemo(() => {\n // HiGlass needs the start and end absolute genome coordinates\n const centerX = genomicTargetX;\n const genomesPerUnitX = genomeSize / (2 ** genomicZoomX);\n const unitX = width / HG_SIZE;\n const initialXDomain = [\n centerX - genomesPerUnitX * unitX / 2,\n centerX + genomesPerUnitX * unitX / 2,\n ];\n const centerY = genomicTargetY;\n const genomesPerUnitY = genomeSize / (2 ** genomicZoomY);\n const unitY = height / HG_SIZE;\n const initialYDomain = [\n centerY - genomesPerUnitY * unitY / 2,\n centerY + genomesPerUnitY * unitY / 2,\n ];\n return {\n editable: false,\n zoomFixed: false,\n trackSourceServers: [\n '//higlass.io/api/v1',\n ],\n exportViewUrl: '//higlass.io/api/v1/viewconfs',\n views: [\n {\n uid: 'main',\n ...hgViewConfigProp,\n initialXDomain,\n initialYDomain,\n },\n ],\n zoomLocks: {\n locksByViewUid: {},\n locksDict: {},\n },\n locationLocks: {\n locksByViewUid: {},\n locksDict: {},\n },\n valueScaleLocks: {\n locksByViewUid: {},\n locksDict: {},\n },\n };\n }, [genomicTargetX, genomeSize, genomicZoomX, width, genomicTargetY,\n genomicZoomY, height, hgViewConfigProp]);\n\n useEffect(() => {\n const handleMouseEnter = () => {\n isActiveRef.current = true;\n };\n const handleMouseLeave = () => {\n isActiveRef.current = false;\n };\n const container = containerRef.current;\n container.addEventListener('mouseenter', handleMouseEnter);\n container.addEventListener('mouseleave', handleMouseLeave);\n return () => {\n container.removeEventListener('mouseenter', handleMouseEnter);\n container.removeEventListener('mouseenter', handleMouseLeave);\n };\n }, [containerRef]);\n\n\n useEffect(() => {\n if (!hgInstance) {\n return () => {};\n }\n hgInstance.api.on('viewConfig', (viewConfigString) => {\n // Only set if the user mouse is over this component (\"is active\").\n // Otherwise, this could be an initial on viewConfig change callback from a sibling,\n // which will cause an infinite loop.\n if (!isActiveRef.current) {\n return;\n }\n const viewConfig = JSON.parse(viewConfigString);\n const xDomain = viewConfig.views[0].initialXDomain;\n const yDomain = viewConfig.views[0].initialYDomain;\n\n const nextGenomicZoomX = Math.log2(\n genomeSize / ((xDomain[1] - xDomain[0]) * (HG_SIZE / width)),\n );\n const nextGenomicZoomY = Math.log2(\n genomeSize / ((yDomain[1] - yDomain[0]) * (HG_SIZE / height)),\n );\n const nextGenomicTargetX = xDomain[0] + (xDomain[1] - xDomain[0]) / 2;\n const nextGenomicTargetY = yDomain[0] + (yDomain[1] - yDomain[0]) / 2;\n setGenomicZoomX(nextGenomicZoomX);\n setGenomicZoomY(nextGenomicZoomY);\n setGenomicTargetX(nextGenomicTargetX);\n setGenomicTargetY(nextGenomicTargetY);\n });\n return () => hgInstance.api.off('viewConfig');\n }, [hgInstance, genomeSize, width, height, setGenomicZoomX, setGenomicZoomY,\n setGenomicTargetX, setGenomicTargetY]);\n\n return (\n <div className=\"higlass-wrapper-parent\">\n <div className=\"higlass-wrapper\" ref={containerRef} style={{ height: `${height}px` }}>\n <Suspense fallback={<div>Loading...</div>}>\n <HiGlassComponent\n ref={setHgInstance}\n zoomFixed={false}\n viewConfig={hgViewConfig}\n options={hgOptions}\n />\n </Suspense>\n </div>\n </div>\n );\n}\n\nHiGlassLazy.defaultProps = {\n hgOptions: {\n bounded: true,\n pixelPreciseMarginPadding: true,\n containerPaddingX: 0,\n containerPaddingY: 0,\n sizeMode: 'default',\n },\n genomeSize: 3100000000,\n};\n","import React from 'react';\nimport TitleInfo from '../TitleInfo';\nimport { useReady, useUrls, useGridItemSize } from '../hooks';\nimport HiGlassLazy from './HiGlassLazy';\n\nconst HIGLASS_DATA_TYPES = [];\n\n/**\n * A wrapper around HiGlass (http://higlass.io/).\n * The HiGlassComponent react component is loaded lazily.\n * @prop {object} hgViewConfig A HiGlass viewconfig object to pass\n * to the HiGlassComponent viewConfig prop.\n * @prop {object} hgOptions An optional HiGlass object to pass\n * to the HiGlassComponent hgOptions prop.\n * @prop {function} removeGridComponent A grid component removal handler\n * to pass to the TitleInfo component.\n * @prop {function} onReady A callback function to signal that the component is ready.\n */\nexport default function HiGlassSubscriber(props) {\n const {\n coordinationScopes,\n theme,\n hgViewConfig,\n removeGridComponent,\n } = props;\n\n // eslint-disable-next-line no-unused-vars\n const [width, height, containerRef] = useGridItemSize();\n\n const [\n isReady,\n setItemIsReady, // eslint-disable-line no-unused-vars\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems, // eslint-disable-line no-unused-vars\n ] = useReady(\n HIGLASS_DATA_TYPES,\n );\n // eslint-disable-next-line no-unused-vars\n const [urls, addUrl, resetUrls] = useUrls();\n\n return (\n <div className=\"higlass-title-wrapper\">\n <TitleInfo\n title=\"HiGlass\"\n removeGridComponent={removeGridComponent}\n theme={theme}\n isReady={isReady}\n urls={urls}\n >\n <div className=\"higlass-lazy-wrapper\" ref={containerRef}>\n <HiGlassLazy\n coordinationScopes={coordinationScopes}\n theme={theme}\n hgViewConfig={hgViewConfig}\n height={height}\n />\n </div>\n </TitleInfo>\n </div>\n );\n}\n","import React, { Suspense, useMemo } from 'react';\nimport { Handler } from 'vega-tooltip';\nimport ReactVega from './ReactVega';\n\n// TODO: React.lazy is not working with Vitessce in the portal-ui.\n// For now, we can work around this by not using React.lazy,\n// but for performance benefits that come with lazy-loading\n// we should eventually try to resolve this issue.\n// const ReactVega = React.lazy(() => import('./ReactVega'));\n\nexport const DATASET_NAME = 'table';\n\nfunction isVega(spec) {\n return spec.$schema === 'https://vega.github.io/schema/vega/v5.json';\n}\n\n/**\n * A wrapper around the react-vega Vega component.\n * @param {object} props\n * @param {object} spec A vega or vega-lite spec.\n * @param {object[]} data The plot data as an array of objects.\n * @param {object} signalListeners Vega signal listeners. Optional.\n */\nexport default function VegaPlot(props) {\n const {\n spec: partialSpec,\n data,\n signalListeners,\n } = props;\n\n const spec = {\n ...partialSpec,\n data: (isVega(partialSpec)\n ? [\n { name: DATASET_NAME },\n ...partialSpec.data,\n ]\n : { name: DATASET_NAME }\n ),\n };\n\n const vegaComponent = useMemo(() => (\n <ReactVega\n spec={spec}\n data={{\n [DATASET_NAME]: data,\n }}\n signalListeners={signalListeners}\n tooltip={new Handler().call}\n renderer=\"canvas\"\n scaleFactor={3}\n />\n ), [spec, data, signalListeners]);\n\n return (\n spec && data && data.length > 0 ? (\n <Suspense fallback={<div>Loading...</div>}>\n {vegaComponent}\n </Suspense>\n ) : null\n );\n}\n","/**\n * Vega-Lite themes that can be passed to the `config` property\n * of the vega-lite spec.\n */\nexport const VEGA_THEMES = {\n dark: {\n // The vega-themes dark theme.\n // Reference: https://github.com/vega/vega-themes/blob/master/src/theme-dark.ts\n background: null,\n title: { color: '#fff' },\n style: {\n 'guide-label': {\n fill: '#fff',\n },\n 'guide-title': {\n fill: '#fff',\n },\n },\n axis: {\n domainColor: '#fff',\n gridColor: '#888',\n tickColor: '#fff',\n },\n },\n light: {\n // The default vega theme.\n background: null,\n },\n};\n","import React from 'react';\nimport clamp from 'lodash/clamp';\nimport { VegaPlot, VEGA_THEMES } from '../vega';\nimport { colorArrayToString } from './utils';\n\n/**\n * Cell set sizes displayed as a bar chart,\n * implemented with the VegaPlot component.\n * @param {object} props\n * @param {object[]} props.data The set size data, an array\n * of objects with properties `name`, `key`, `color`, and `size`.\n * @param {string} props.theme The name of the current Vitessce theme.\n * @param {number} props.width The container width.\n * @param {number} props.height The container height.\n * @param {number} props.marginRight The size of the margin\n * on the right side of the plot, to account for the vega menu button.\n * By default, 90.\n * @param {number} props.marginBottom The size of the margin\n * on the bottom of the plot, to account for long x-axis labels.\n * By default, 120.\n * @param {number} props.keyLength The length of the `key` property of\n * each data point. Assumes all key strings have the same length.\n * By default, 36.\n */\nexport default function CellSetSizesPlot(props) {\n const {\n data: rawData,\n theme,\n width,\n height,\n marginRight = 90,\n marginBottom = 120,\n keyLength = 36,\n } = props;\n\n // Add a property `keyName` which concatenates the key and the name,\n // which is both unique and can easily be converted\n // back to the name by taking a substring.\n // Add a property `colorString` which contains the `[r, g, b]` color\n // after converting to a color hex string.\n const data = rawData.map(d => ({\n ...d,\n keyName: d.key + d.name,\n colorString: colorArrayToString(d.color),\n }));\n\n // Manually set the color scale so that Vega-Lite does\n // not choose the colors automatically.\n const colors = {\n domain: data.map(d => d.key),\n range: data.map(d => d.colorString),\n };\n\n // Get an array of keys for sorting purposes.\n const keys = data.map(d => d.keyName);\n\n const spec = {\n mark: { type: 'bar' },\n encoding: {\n x: {\n field: 'keyName',\n type: 'nominal',\n axis: { labelExpr: `substring(datum.label, ${keyLength})` },\n title: 'Cell Set',\n sort: keys,\n },\n y: {\n field: 'size',\n type: 'quantitative',\n title: 'Cell Set Size',\n },\n color: {\n field: 'key',\n type: 'nominal',\n scale: colors,\n legend: null,\n },\n tooltip: {\n field: 'size',\n type: 'quantitative',\n },\n },\n width: clamp(width - marginRight, 10, Infinity),\n height: clamp(height - marginBottom, 10, Infinity),\n config: VEGA_THEMES[theme],\n };\n\n return (\n <VegaPlot\n data={data}\n spec={spec}\n />\n );\n}\n","import React, { useMemo, useEffect } from 'react';\nimport TitleInfo from '../TitleInfo';\nimport { useCoordination, useLoaders } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport { useUrls, useReady, useGridItemSize } from '../hooks';\nimport { mergeCellSets } from '../utils';\nimport { useCellSetsData } from '../data-hooks';\nimport { treeToSetSizesBySetNames } from './cell-set-utils';\nimport CellSetSizesPlot from './CellSetSizesPlot';\n\nconst CELL_SET_SIZES_DATA_TYPES = ['cell-sets'];\n\n/**\n * A subscriber component for `CellSetSizePlot`,\n * which listens for cell sets data updates and\n * `GRID_RESIZE` events.\n * @param {object} props\n * @param {function} props.removeGridComponent The grid component removal function.\n * @param {function} props.onReady The function to call when the subscriptions\n * have been made.\n * @param {string} props.theme The name of the current Vitessce theme.\n * @param {string} props.title The component title.\n */\nexport default function CellSetSizesPlotSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n title = 'Cell Set Sizes',\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n cellSetSelection,\n cellSetColor,\n additionalCellSets,\n }, {\n setCellSetSelection,\n setCellSetColor,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.cellSetSizes, coordinationScopes);\n\n const [width, height, containerRef] = useGridItemSize();\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n CELL_SET_SIZES_DATA_TYPES,\n );\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [cellSets] = useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, true,\n { setCellSetSelection, setCellSetColor },\n { cellSetSelection, cellSetColor },\n );\n\n const mergedCellSets = useMemo(\n () => mergeCellSets(cellSets, additionalCellSets),\n [cellSets, additionalCellSets],\n );\n\n // From the cell sets hierarchy and the list of selected cell sets,\n // generate the array of set sizes data points for the bar plot.\n const data = useMemo(() => (mergedCellSets && cellSetSelection && cellSetColor\n ? treeToSetSizesBySetNames(mergedCellSets, cellSetSelection, cellSetColor, theme)\n : []\n ), [mergedCellSets, cellSetSelection, cellSetColor, theme]);\n\n return (\n <TitleInfo\n title={title}\n removeGridComponent={removeGridComponent}\n urls={urls}\n theme={theme}\n isReady={isReady}\n >\n <div ref={containerRef} className=\"vega-container\">\n <CellSetSizesPlot\n data={data}\n theme={theme}\n width={width}\n height={height}\n />\n </div>\n </TitleInfo>\n );\n}\n","import React, {\n useMemo, useEffect,\n} from 'react';\nimport isEqual from 'lodash/isEqual';\nimport { sum } from 'd3-array';\nimport TitleInfo from '../TitleInfo';\nimport { useReady, useUrls, useGridItemSize } from '../hooks';\nimport {\n useCoordination, useLoaders,\n} from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport { useGenomicProfilesData } from '../data-hooks';\nimport HiGlassLazy from './HiGlassLazy';\n\nconst GENOMIC_PROFILES_DATA_TYPES = ['genomic-profiles'];\n\nconst REFERENCE_TILESETS = {\n hg38: {\n chromosomes: 'NyITQvZsS_mOFNlz5C2LJg',\n genes: 'P0PLbQMwTYGy-5uPIQid7A',\n },\n hg19: {\n chromosomes: 'N12wVGG9SPiTkk03yUayUw',\n genes: 'OHJakQICQD6gTD7skx4EWA',\n },\n mm9: {\n chromosomes: 'WAVhNHYxQVueq6KulwgWiQ',\n genes: 'GUm5aBiLRCyz2PsBea7Yzg',\n },\n mm10: {\n chromosomes: 'EtrWT0VtScixmsmwFSd7zg',\n genes: 'QDutvmyiSrec5nX4pA5WGQ',\n },\n};\n\n/**\n * A component for visualization of genomic profiles\n * with genome-wide bar plots.\n * @param {object} props The component props.\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.profileTrackUidKey The key in the genomic profiles row_info that identifies\n * each track. By default, 'path'.\n * @param {string} props.profileTrackNameKey The key in the genomic profiles row_info that\n * gives a name for each track. By default, null. When null is provided, uses the\n * profileTrackUidKey for both UID and name. If UID values are path arrays,\n * they will be converted to name strings.\n * @param {string} props.higlassServer The URL for the higlass server used to retreive\n * reference tilesets for the chromosome and gene annotations.\n * @param {string} props.assembly The genome assembly to use for the reference\n * tilesets for the chromosome and gene annotations.\n * @param {string} props.title The title of the component.\n */\nexport default function GenomicProfilesSubscriber(props) {\n const {\n coordinationScopes,\n theme,\n removeGridComponent,\n profileTrackUidKey = 'path',\n profileTrackNameKey = null,\n higlassServer = 'https://higlass.io/api/v1',\n assembly = 'hg38',\n title = 'Genomic Profiles',\n } = props;\n\n // eslint-disable-next-line no-unused-vars\n const [width, height, containerRef] = useGridItemSize();\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n cellSetColor,\n cellSetSelection,\n }] = useCoordination(\n COMPONENT_COORDINATION_TYPES.genomicProfiles,\n coordinationScopes,\n );\n\n // eslint-disable-next-line no-unused-vars\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n GENOMIC_PROFILES_DATA_TYPES,\n );\n // eslint-disable-next-line no-unused-vars\n const [urls, addUrl, resetUrls] = useUrls();\n\n const [genomicProfilesAttrs] = useGenomicProfilesData(\n loaders, dataset, setItemIsReady, addUrl, true,\n );\n\n const hgViewConfig = useMemo(() => {\n if (!genomicProfilesAttrs || urls.length !== 1) {\n return null;\n }\n // Get the URL to the data file from the downloadable URLs array.\n const { url } = urls[0];\n\n // Set up the colors to use in the HiGlass view config based on the current theme.\n const foregroundColor = (theme === 'dark' ? '#C0C0C0' : '#000000');\n const backgroundColor = (theme === 'dark' ? '#000000' : '#f1f1f1');\n const dimColor = (theme === 'dark' ? 'dimgray' : 'silver');\n\n // Define the \"reference tracks\" for chromosome labels and gene annotations.\n const referenceTracks = [\n {\n type: 'horizontal-chromosome-labels',\n server: higlassServer,\n tilesetUid: REFERENCE_TILESETS[assembly].chromosomes,\n uid: 'chromosome-labels',\n options: {\n color: foregroundColor,\n fontSize: 12,\n fontIsLeftAligned: false,\n showMousePosition: true,\n mousePositionColor: foregroundColor,\n },\n height: 30,\n },\n {\n type: 'horizontal-gene-annotations',\n server: higlassServer,\n tilesetUid: REFERENCE_TILESETS[assembly].genes,\n uid: 'gene-annotations',\n options: {\n name: 'Gene Annotations (hg38)',\n fontSize: 10,\n labelPosition: 'hidden',\n labelLeftMargin: 0,\n labelRightMargin: 0,\n labelTopMargin: 0,\n labelBottomMargin: 0,\n minHeight: 24,\n geneAnnotationHeight: 16,\n geneLabelPosition: 'outside',\n geneStrandSpacing: 4,\n showMousePosition: true,\n mousePositionColor: foregroundColor,\n plusStrandColor: foregroundColor,\n minusStrandColor: foregroundColor,\n labelColor: 'black',\n labelBackgroundColor: backgroundColor,\n trackBorderWidth: 0,\n trackBorderColor: 'black',\n },\n height: 70,\n },\n ];\n // Determine the heights of each profile track by subtracting the\n // reference track heights from the component height, then\n // dividing by the number of profiles.\n const referenceTracksHeightSum = sum(referenceTracks.map(t => t.height));\n const profileTracksHeightSum = height - referenceTracksHeightSum - 10;\n const profileTrackHeight = profileTracksHeightSum / genomicProfilesAttrs.row_infos.length;\n const profileTracks = genomicProfilesAttrs.row_infos.map((rowInfo, i) => {\n // Get the uid for the HiGlass track.\n const trackUid = rowInfo[profileTrackUidKey];\n // When profiles correspond to cell sets, the profile UID will be the cell set path array.\n const isPath = Array.isArray(trackUid);\n // Get the name for the HiGlass track: try the name key first,\n // then try the tail of the path, and otherwise the track UID.\n // eslint-disable-next-line no-nested-ternary\n const trackName = profileTrackNameKey\n ? rowInfo[profileTrackNameKey]\n : (isPath ? trackUid[trackUid.length - 1] : trackUid);\n // If the uid is a path, then try to get the corresponding cell set's color,\n // if it is currently selected.\n const setInSelection = isPath ? cellSetSelection?.find(s => isEqual(s, trackUid)) : false;\n const setColor = isPath ? cellSetColor?.find(s => isEqual(s.path, trackUid))?.color : null;\n // Get the track UID as a string before passing to HiGlass.\n const trackUidString = isPath ? trackUid.join('__') : trackUid;\n // Create the HiGlass track definition for this profile.\n const track = {\n type: 'horizontal-bar',\n uid: `bar-track-${trackUidString}`,\n data: {\n type: 'zarr-multivec',\n url,\n row: i,\n },\n options: {\n name: trackName,\n showMousePosition: true,\n mousePositionColor: foregroundColor,\n labelColor: (theme === 'dark' ? 'white' : 'black'),\n labelBackgroundColor: (theme === 'dark' ? 'black' : 'white'),\n labelShowAssembly: false,\n },\n height: profileTrackHeight,\n };\n // Set the track color if it is available.\n if (setColor && setInSelection) {\n const c = setColor;\n track.options.barFillColor = `rgb(${c[0]},${c[1]},${c[2]})`;\n } else {\n track.options.barFillColor = dimColor;\n }\n return track;\n });\n\n // Create the higlass view.\n // The HiGlassLazy component will fill in the fields 'uid',\n // 'initialXDomain', and 'initialYDomain'.\n const hgView = {\n tracks: {\n top: [\n ...referenceTracks,\n ...profileTracks,\n ],\n left: [],\n center: [],\n right: [],\n bottom: [],\n whole: [],\n gallery: [],\n },\n layout: {\n w: 12,\n h: 12,\n x: 0,\n y: 0,\n static: false,\n },\n };\n return hgView;\n }, [genomicProfilesAttrs, urls, theme, height, profileTrackUidKey,\n profileTrackNameKey, cellSetSelection, cellSetColor,\n higlassServer, assembly]);\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n return (\n <div className=\"higlass-title-wrapper\">\n <TitleInfo\n title={title}\n removeGridComponent={removeGridComponent}\n theme={theme}\n isReady={isReady}\n urls={urls}\n >\n <div className=\"higlass-lazy-wrapper\" ref={containerRef}>\n {hgViewConfig ? (\n <HiGlassLazy\n coordinationScopes={coordinationScopes}\n theme={theme}\n hgViewConfig={hgViewConfig}\n height={height}\n />\n ) : null}\n </div>\n </TitleInfo>\n </div>\n );\n}\n","import React from 'react';\nimport clamp from 'lodash/clamp';\nimport { VegaPlot, VEGA_THEMES } from '../vega';\n\n/**\n * Gene expression histogram displayed as a bar chart,\n * implemented with the VegaPlot component.\n * @param {object} props\n * @param {string[]} props.geneSelection The list of genes\n * currently selected.\n * @param {object[]} props.data The expression data, an array\n * of objects with properties `value` and `gene`.\n * @param {string} props.theme The name of the current Vitessce theme.\n * @param {number} props.width The container width.\n * @param {number} props.height The container height.\n * @param {number} props.marginRight The size of the margin\n * on the right side of the plot, to account for the vega menu button.\n * By default, 90.\n * @param {number} props.marginBottom The size of the margin\n * on the bottom of the plot, to account for long x-axis labels.\n * By default, 50.\n */\nexport default function ExpressionHistogram(props) {\n const {\n geneSelection,\n data,\n theme,\n width,\n height,\n marginRight = 90,\n marginBottom = 50,\n } = props;\n\n const xTitle = geneSelection && geneSelection.length >= 1\n ? 'Normalized Expression Value'\n : 'Total Normalized Transcript Count';\n\n const spec = {\n mark: { type: 'bar' },\n encoding: {\n x: {\n field: 'value',\n type: 'quantitative',\n bin: { maxbins: 50 },\n title: xTitle,\n },\n y: {\n type: 'quantitative',\n aggregate: 'count',\n title: 'Number of Cells',\n },\n color: { value: 'gray' },\n },\n width: clamp(width - marginRight, 10, Infinity),\n height: clamp(height - marginBottom, 10, Infinity),\n config: VEGA_THEMES[theme],\n };\n\n return (\n <VegaPlot\n data={data}\n spec={spec}\n />\n );\n}\n","import React, { useMemo, useEffect } from 'react';\nimport { sum } from 'd3-array';\n\nimport TitleInfo from '../TitleInfo';\nimport { useCoordination, useLoaders } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport { useUrls, useReady, useGridItemSize } from '../hooks';\nimport { useExpressionMatrixData, useGeneSelection } from '../data-hooks';\nimport ExpressionHistogram from './ExpressionHistogram';\n\nconst EXPRESSION_HISTOGRAM_DATA_TYPES = ['expression-matrix'];\n\n/**\n * A subscriber component for `ExpressionHistogram`,\n * which listens for gene selection updates and\n * `GRID_RESIZE` events.\n * @param {object} props\n * @param {function} props.removeGridComponent The grid component removal function.\n * @param {object} props.coordinationScopes An object mapping coordination\n * types to coordination scopes.\n * @param {string} props.theme The name of the current Vitessce theme.\n */\nexport default function ExpressionHistogramSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n geneSelection,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.expressionHistogram, coordinationScopes);\n\n const [width, height, containerRef] = useGridItemSize();\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n EXPRESSION_HISTOGRAM_DATA_TYPES,\n );\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [expressionMatrix] = useExpressionMatrixData(\n loaders, dataset, setItemIsReady, addUrl, true,\n );\n // Get data from loaders using the data hooks.\n const [expressionData] = useGeneSelection(\n loaders, dataset, setItemIsReady, false, geneSelection, setItemIsNotReady,\n );\n\n const firstGeneSelected = geneSelection && geneSelection.length >= 1\n ? geneSelection[0]\n : null;\n\n // From the expression matrix and the list of selected genes,\n // generate the array of data points for the histogram.\n const data = useMemo(() => {\n if (firstGeneSelected && expressionMatrix && expressionData) {\n // Create new cellColors map based on the selected gene.\n return Array.from(expressionData[0]).map((_, index) => {\n const value = expressionData[0][index];\n const normValue = value * 100 / 255;\n return { value: normValue, gene: firstGeneSelected };\n });\n }\n if (expressionMatrix) {\n const numGenes = expressionMatrix.cols.length;\n return expressionMatrix.rows.map((cellId, cellIndex) => {\n const values = expressionMatrix.matrix\n .subarray(cellIndex * numGenes, (cellIndex + 1) * numGenes);\n const sumValue = sum(values) * 100 / 255;\n return { value: sumValue, gene: null };\n });\n }\n return null;\n }, [expressionMatrix, firstGeneSelected, expressionData]);\n\n return (\n <TitleInfo\n title={`Expression Histogram${(firstGeneSelected ? ` (${firstGeneSelected})` : '')}`}\n removeGridComponent={removeGridComponent}\n urls={urls}\n theme={theme}\n isReady={isReady}\n >\n <div ref={containerRef} className=\"vega-container\">\n <ExpressionHistogram\n geneSelection={geneSelection}\n data={data}\n theme={theme}\n width={width}\n height={height}\n />\n </div>\n </TitleInfo>\n );\n}\n","import { useMemo } from 'react';\nimport { mergeCellSets } from '../utils';\nimport { treeToObjectsBySetNames, treeToSetSizesBySetNames } from './cell-set-utils';\n\n/**\n * Get expression data for the cells\n * in the selected cell sets.\n * @param {object} expressionMatrix\n * @param {string[]} expressionMatrix.rows Cell IDs.\n * @param {string[]} expressionMatrix.cols Gene names.\n * @param {Uint8Array} expressionMatrix.matrix The\n * flattened expression matrix as a typed array.\n * @param {object} cellSets The cell sets from the dataset.\n * @param {object} additionalCellSets The user-defined cell sets\n * from the coordination space.\n * @param {array} geneSelection Array of selected genes.\n * @param {array} cellSetSelection Array of selected cell set paths.\n * @param {object[]} cellSetColor Array of objects with properties\n * @param {string} theme \"light\" or \"dark\" for the vitessce theme\n * `path` and `color`.\n */\nexport function useExpressionByCellSet(\n expressionData, expressionDataAttrs, cellSets, additionalCellSets,\n geneSelection, cellSetSelection, cellSetColor, useGeneExpressionTransform,\n theme,\n) {\n const mergedCellSets = useMemo(\n () => mergeCellSets(cellSets, additionalCellSets),\n [cellSets, additionalCellSets],\n );\n\n // From the expression matrix and the list of selected genes / cell sets,\n // generate the array of data points for the plot.\n const [expressionArr, expressionMax] = useMemo(() => {\n if (mergedCellSets && cellSetSelection\n && geneSelection && geneSelection.length >= 1\n && expressionData\n ) {\n const cellObjects = treeToObjectsBySetNames(\n mergedCellSets, cellSetSelection, cellSetColor, theme,\n );\n\n const firstGeneSelected = geneSelection[0];\n // Create new cellColors map based on the selected gene.\n let exprMax = -Infinity;\n const cellIndices = {};\n for (let i = 0; i < expressionDataAttrs.rows.length; i += 1) {\n cellIndices[expressionDataAttrs.rows[i]] = i;\n }\n const exprValues = cellObjects.map((cell) => {\n const cellIndex = cellIndices[cell.obsId];\n const value = expressionData[0][cellIndex];\n const normValue = value * 100 / 255;\n const transformedValue = useGeneExpressionTransform ? Math.log(1 + normValue) : normValue;\n exprMax = Math.max(transformedValue, exprMax);\n return { value: transformedValue, gene: firstGeneSelected, set: cell.name };\n });\n return [exprValues, exprMax];\n }\n return [null, null];\n }, [expressionData, expressionDataAttrs, geneSelection, theme,\n mergedCellSets, cellSetSelection, cellSetColor, useGeneExpressionTransform]);\n\n // From the cell sets hierarchy and the list of selected cell sets,\n // generate the array of set sizes data points for the bar plot.\n const setArr = useMemo(() => (mergedCellSets && cellSetSelection && cellSetColor\n ? treeToSetSizesBySetNames(mergedCellSets, cellSetSelection, cellSetColor, theme)\n : []\n ), [mergedCellSets, cellSetSelection, cellSetColor, theme]);\n\n return [expressionArr, setArr, expressionMax];\n}\n","import React from 'react';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport { useStyles } from '../shared-plot-options/styles';\nimport OptionsContainer from '../shared-plot-options/OptionsContainer';\n\nexport default function CellSetExpressionPlotOptions(props) {\n const { toggleGeneExpressionTransform, useGeneExpressionTransform } = props;\n const classes = useStyles();\n\n function handleGeneExpressionTransformChange() {\n toggleGeneExpressionTransform();\n }\n\n return (\n <OptionsContainer>\n <TableRow>\n <TableCell className={classes.labelCell}>Log Transform</TableCell>\n <TableCell className={classes.inputCell}>\n <Checkbox\n className={classes.checkbox}\n checked={Boolean(useGeneExpressionTransform)}\n onChange={handleGeneExpressionTransformChange}\n name=\"scatterplot-option-cell-set-labels\"\n color=\"default\"\n />\n </TableCell>\n </TableRow>\n </OptionsContainer>\n );\n}\n","import React from 'react';\nimport clamp from 'lodash/clamp';\nimport { VegaPlot, VEGA_THEMES, DATASET_NAME } from '../vega';\nimport { colorArrayToString } from './utils';\n\n/**\n * Gene expression histogram displayed as a bar chart,\n * implemented with the VegaPlot component.\n * @param {object} props\n * @param {object[]} props.data The expression data, an array\n * of objects with properties `value`, `gene`, and `set`.\n * @param {number} props.domainMax The maximum gene expression value.\n * @param {object[]} props.colors An object for each\n * cell set, with properties `name` and `color`.\n * @param {string} props.theme The name of the current Vitessce theme.\n * @param {number} props.width The container width.\n * @param {number} props.height The container height.\n * @param {number} props.marginRight The size of the margin\n * on the right side of the plot, to account for the vega menu button.\n * By default, 90.\n * @param {number} props.marginBottom The size of the margin\n * on the bottom of the plot, to account for long x-axis labels.\n * Default is allowing the component to automatically determine the margin.\n * @param {boolean} props.useGeneExpressionTransform Boolean representing\n * whether or not the expression values are log-transformed.\n */\nexport default function CellSetExpressionPlot(props) {\n const {\n domainMax = 100,\n colors,\n data,\n theme,\n width,\n height,\n marginRight = 90,\n marginBottom,\n useGeneExpressionTransform,\n } = props;\n // Get the max characters in an axis label for autsizing the bottom margin.\n const maxCharactersForLabel = data.reduce((acc, val) => {\n // eslint-disable-next-line no-param-reassign\n acc = acc === undefined || val.set.length > acc ? val.set.length : acc;\n return acc;\n }, 0);\n // Use a square-root term because the angle of the labels is 45 degrees (see below)\n // so the perpendicular distance to the bottom of the labels is proportional to the\n // square root of the length of the labels along the imaginary hypotenuse.\n // 30 is an estimate of the pixel size of a given character and seems to work well.\n const autoMarginBottom = marginBottom\n || 30 + Math.sqrt(maxCharactersForLabel / 2) * 30;\n // Manually set the color scale so that Vega-Lite does\n // not choose the colors automatically.\n const colorScale = {\n domain: colors.map(d => d.name),\n range: colors.map(d => colorArrayToString(d.color)),\n };\n\n const plotWidth = clamp(width - marginRight, 10, Infinity);\n const plotHeight = clamp(height - autoMarginBottom, 10, Infinity);\n\n const numBands = colors.length;\n const bandWidth = plotWidth / numBands;\n\n const rectColor = (theme === 'dark' ? 'white' : 'black');\n\n const spec = {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n description: 'A violin plot showing distributions of expression levels for selected cell sets.',\n width: plotWidth,\n height: plotHeight,\n config: {\n ...VEGA_THEMES[theme],\n axisBand: {\n bandPosition: 1,\n tickExtra: true,\n tickOffset: 0,\n },\n },\n\n signals: [\n { name: 'bandWidth', value: bandWidth },\n { name: 'width', value: plotWidth },\n { name: 'height', value: plotHeight },\n { name: 'trim', value: true },\n ],\n\n data: [\n {\n name: 'density',\n source: DATASET_NAME,\n transform: [\n {\n type: 'kde',\n field: 'value',\n groupby: ['set'],\n bandwidth: 0,\n extent: [0, domainMax],\n },\n ],\n },\n {\n name: 'stats',\n source: DATASET_NAME,\n transform: [\n {\n type: 'aggregate',\n groupby: ['set'],\n fields: ['value', 'value', 'value'],\n ops: ['q1', 'median', 'q3'],\n as: ['q1', 'median', 'q3'],\n },\n ],\n },\n ],\n\n scales: [\n {\n name: 'layout',\n type: 'band',\n range: 'width',\n domain: { data: DATASET_NAME, field: 'set' },\n },\n {\n name: 'yscale',\n type: 'linear',\n range: 'height',\n domain: [0, domainMax],\n },\n {\n name: 'wscale',\n type: 'linear',\n range: [0, { signal: 'bandWidth' }],\n domain: { data: 'density', field: 'density' },\n },\n {\n name: 'wscaleReversed',\n type: 'linear',\n reverse: true,\n range: [0, { signal: 'bandWidth' }],\n domain: { data: 'density', field: 'density' },\n },\n {\n name: 'color',\n type: 'ordinal',\n ...colorScale,\n },\n ],\n\n axes: [\n {\n orient: 'left',\n scale: 'yscale',\n zindex: 1,\n // title: useGeneExpressionTransform\n // ? 'Log-Normalized Expression Values' : 'Normalized Expression Values',\n title: useGeneExpressionTransform\n ? ['Log-Transformed', 'Normalized Expression Values']\n : 'Normalized Expression Values',\n },\n {\n orient: 'bottom',\n scale: 'layout',\n tickCount: 5,\n zindex: 1,\n title: 'Cell Set',\n labelAngle: -45,\n labelAlign: 'right',\n },\n ],\n\n marks: [\n {\n type: 'group',\n from: {\n facet: {\n data: 'density',\n name: 'violin',\n groupby: 'set',\n },\n },\n\n encode: {\n enter: {\n xc: { scale: 'layout', field: 'set', band: 0.5 },\n width: { signal: 'bandWidth' },\n height: { signal: 'height' },\n },\n },\n\n data: [\n {\n name: 'summary',\n source: 'stats',\n transform: [\n {\n type: 'filter',\n expr: 'datum.set === parent.set',\n },\n ],\n },\n ],\n\n marks: [\n {\n type: 'area',\n orient: 'vertical',\n from: { data: 'violin' },\n encode: {\n enter: {\n fill: { scale: 'color', field: { parent: 'set' } },\n },\n update: {\n width: { scale: 'wscale', field: 'density' },\n xc: { signal: 'bandWidth / 2' },\n y2: { scale: 'yscale', field: 'value' },\n y: { scale: 'yscale', value: 0 },\n },\n },\n },\n {\n type: 'area',\n orient: 'vertical',\n from: { data: 'violin' },\n encode: {\n enter: {\n fill: { scale: 'color', field: { parent: 'set' } },\n },\n update: {\n width: { scale: 'wscaleReversed', field: 'density' },\n xc: { signal: 'bandWidth' },\n y2: { scale: 'yscale', field: 'value' },\n y: { scale: 'yscale', value: 0 },\n },\n },\n },\n {\n type: 'rect',\n from: { data: 'summary' },\n encode: {\n enter: {\n fill: { value: rectColor },\n width: { value: 2 },\n },\n update: {\n y: { scale: 'yscale', field: 'q1' },\n y2: { scale: 'yscale', field: 'q3' },\n xc: { signal: 'bandWidth / 2' },\n },\n },\n },\n {\n type: 'rect',\n from: { data: 'summary' },\n encode: {\n enter: {\n fill: { value: rectColor },\n height: { value: 2 },\n width: { value: 8 },\n },\n update: {\n y: { scale: 'yscale', field: 'median' },\n xc: { signal: 'bandWidth / 2' },\n },\n },\n },\n ],\n },\n ],\n };\n\n return (\n <VegaPlot\n data={data}\n spec={spec}\n />\n );\n}\n","import React, { useEffect, useReducer } from 'react';\nimport TitleInfo from '../TitleInfo';\nimport { useCoordination, useLoaders } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport { useUrls, useReady, useGridItemSize } from '../hooks';\nimport { useGeneSelection, useExpressionAttrs, useCellSetsData } from '../data-hooks';\nimport { useExpressionByCellSet } from './hooks';\nimport CellSetExpressionPlotOptions from './CellSetExpressionPlotOptions';\n\nimport CellSetExpressionPlot from './CellSetExpressionPlot';\n\nconst CELL_SET_EXPRESSION_DATA_TYPES = ['cell-sets', 'expression-matrix'];\n\n/**\n * A subscriber component for `CellSetExpressionPlot`,\n * which listens for gene selection updates and\n * `GRID_RESIZE` events.\n * @param {object} props\n * @param {function} props.removeGridComponent The grid component removal function.\n * @param {object} props.coordinationScopes An object mapping coordination\n * types to coordination scopes.\n * @param {string} props.theme The name of the current Vitessce theme.\n */\nexport default function CellSetExpressionPlotSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n } = props;\n\n const loaders = useLoaders();\n\n // Get \"props\" from the coordination space.\n const [{\n dataset,\n geneSelection,\n geneExpressionTransform,\n cellSetSelection,\n cellSetColor,\n additionalCellSets,\n }, {\n setGeneExpressionTransform,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.cellSetExpression, coordinationScopes);\n\n const [width, height, containerRef] = useGridItemSize();\n const [urls, addUrl, resetUrls] = useUrls();\n const [\n isReady,\n setItemIsReady,\n setItemIsNotReady, // eslint-disable-line no-unused-vars\n resetReadyItems,\n ] = useReady(\n CELL_SET_EXPRESSION_DATA_TYPES,\n );\n\n const [useGeneExpressionTransform, toggleGeneExpressionTransform] = useReducer((v) => {\n const newValue = !v;\n setGeneExpressionTransform(newValue ? 'log1p' : null);\n return newValue;\n }, geneExpressionTransform);\n\n // Reset file URLs and loader progress when the dataset has changed.\n useEffect(() => {\n resetUrls();\n resetReadyItems();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loaders, dataset]);\n\n // Get data from loaders using the data hooks.\n const [expressionData] = useGeneSelection(\n loaders, dataset, setItemIsReady, false, geneSelection, setItemIsNotReady,\n );\n const [attrs] = useExpressionAttrs(\n loaders, dataset, setItemIsReady, addUrl, false,\n );\n const [cellSets] = useCellSetsData(\n loaders, dataset, setItemIsReady, addUrl, true,\n );\n\n const [expressionArr, setArr, expressionMax] = useExpressionByCellSet(\n expressionData, attrs, cellSets, additionalCellSets,\n geneSelection, cellSetSelection, cellSetColor, useGeneExpressionTransform,\n theme,\n );\n\n const firstGeneSelected = geneSelection && geneSelection.length >= 1\n ? geneSelection[0]\n : null;\n return (\n <TitleInfo\n title={`Expression by Cell Set${(firstGeneSelected ? ` (${firstGeneSelected})` : '')}`}\n removeGridComponent={removeGridComponent}\n urls={urls}\n theme={theme}\n isReady={isReady}\n options={(\n <CellSetExpressionPlotOptions\n useGeneExpressionTransform={useGeneExpressionTransform}\n toggleGeneExpressionTransform={toggleGeneExpressionTransform}\n />\n )}\n >\n <div ref={containerRef} className=\"vega-container\">\n {expressionArr ? (\n <CellSetExpressionPlot\n domainMax={expressionMax}\n colors={setArr}\n data={expressionArr}\n theme={theme}\n width={width}\n height={height}\n useGeneExpressionTransform={useGeneExpressionTransform}\n />\n ) : (\n <span>Select a gene.</span>\n )}\n </div>\n </TitleInfo>\n );\n}\n","import { Component } from './constants';\n\nimport DescriptionSubscriber from '../components/description/DescriptionSubscriber';\nimport StatusSubscriber from '../components/status/StatusSubscriber';\nimport GenesSubscriber from '../components/genes/GenesSubscriber';\nimport CellSetsManagerSubscriber from '../components/sets/CellSetsManagerSubscriber';\nimport ScatterplotSubscriber from '../components/scatterplot/ScatterplotSubscriber';\nimport SpatialSubscriber from '../components/spatial/SpatialSubscriber';\nimport HeatmapSubscriber from '../components/heatmap/HeatmapSubscriber';\nimport LayerControllerSubscriber from '../components/layer-controller/LayerControllerSubscriber';\nimport HiGlassSubscriber from '../components/higlass/HiGlassSubscriber';\nimport CellSetSizesPlotSubscriber from '../components/sets/CellSetSizesPlotSubscriber';\nimport GenomicProfilesSubscriber from '../components/higlass/GenomicProfilesSubscriber';\nimport ExpressionHistogramSubscriber from '../components/genes/ExpressionHistogramSubscriber';\nimport CellSetExpressionPlotSubscriber from '../components/sets/CellSetExpressionPlotSubscriber';\n\n\nconst registry = {\n [Component.DESCRIPTION]: DescriptionSubscriber,\n [Component.STATUS]: StatusSubscriber,\n [Component.GENES]: GenesSubscriber,\n [Component.CELL_SETS]: CellSetsManagerSubscriber,\n [Component.SCATTERPLOT]: ScatterplotSubscriber,\n [Component.SPATIAL]: SpatialSubscriber,\n [Component.HEATMAP]: HeatmapSubscriber,\n [Component.LAYER_CONTROLLER]: LayerControllerSubscriber,\n [Component.CELL_SET_SIZES]: CellSetSizesPlotSubscriber,\n [Component.GENOMIC_PROFILES]: GenomicProfilesSubscriber,\n [Component.EXPRESSION_HISTOGRAM]: ExpressionHistogramSubscriber,\n [Component.CELL_SET_EXPRESSION]: CellSetExpressionPlotSubscriber,\n // The plain higlass component does not abstract away the HiGlass view config,\n // so we probably want to avoid documenting it, only use it for development purposes.\n higlass: HiGlassSubscriber,\n};\n\nexport function getComponent(name) {\n const component = registry[name];\n if (component === undefined) {\n throw new Error(`Could not find definition for \"${name}\" in registry.`);\n }\n return registry[name];\n}\n","import React from 'react';\nimport { useCoordination, useWarning } from '../../app/state/hooks';\nimport { COMPONENT_COORDINATION_TYPES } from '../../app/state/coordination';\nimport TitleInfo from '../TitleInfo';\nimport Status from './Status';\n\n/**\n * A subscriber component for the status component,\n * which renders hovered cell/gene/molecule information\n * as well as schema validation and data loading errors.\n * @param {object} props\n * @param {string} props.theme The current theme name.\n * @param {object} props.coordinationScopes The mapping from coordination types to coordination\n * scopes.\n * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,\n * to call when the component has been removed from the grid.\n * @param {string} props.title The component title.\n */\nexport default function StatusSubscriber(props) {\n const {\n coordinationScopes,\n removeGridComponent,\n theme,\n title = 'Status',\n } = props;\n\n // Get \"props\" from the coordination space.\n const [{\n cellHighlight,\n geneHighlight,\n moleculeHighlight,\n }] = useCoordination(COMPONENT_COORDINATION_TYPES.status, coordinationScopes);\n\n const warn = useWarning();\n\n const infos = [\n ...(cellHighlight\n ? [`Hovered cell ${cellHighlight}`]\n : []\n ),\n ...(geneHighlight\n ? [`Hovered gene ${geneHighlight}`]\n : []\n ),\n ...(moleculeHighlight\n ? [`Hovered gene ${moleculeHighlight}`]\n : []\n ),\n ];\n const info = infos.join('; ');\n\n return (\n <TitleInfo\n title={title}\n theme={theme}\n removeGridComponent={removeGridComponent}\n isScroll\n isReady\n >\n <Status warn={warn} info={info} />\n </TitleInfo>\n );\n}\n","import { OrthographicView } from 'deck.gl';\nimport clamp from 'lodash/clamp';\n\n// Reference: https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds\n// Reference: https://observablehq.com/@bmschmidt/dot-density-election-maps-with-webgl\nexport function getPointSizeDevicePixels(devicePixelRatio, zoom, xRange, yRange, width, height) {\n // Size of a point, in units of the diagonal axis.\n const pointSize = 0.001;\n // Point size maximum, in screen pixels.\n const pointScreenSizeMax = 10;\n\n // Point size minimum, in screen pixels.\n const pointScreenSizeMin = 1 / devicePixelRatio;\n\n const scaleFactor = 2 ** zoom;\n const xAxisRange = 2.0 / ((xRange * scaleFactor) / width);\n const yAxisRange = 2.0 / ((yRange * scaleFactor) / height);\n\n // The diagonal screen size as a fraction of the current diagonal axis range,\n // then converted to device pixels.\n const diagonalScreenSize = Math.sqrt((width ** 2) + (height ** 2));\n const diagonalAxisRange = Math.sqrt((xAxisRange ** 2) + (yAxisRange ** 2));\n const diagonalFraction = pointSize / diagonalAxisRange;\n const deviceSize = diagonalFraction * diagonalScreenSize;\n\n const pointSizeDevicePixels = clamp(\n deviceSize,\n pointScreenSizeMin,\n pointScreenSizeMax,\n );\n return pointSizeDevicePixels;\n}\n\n// Reference: https://observablehq.com/@rreusser/selecting-the-right-opacity-for-2d-point-clouds\nexport function getPointOpacity(zoom, xRange, yRange, width, height, numCells, avgFillDensity) {\n const N = numCells;\n const [minX, minY, maxX, maxY] = new OrthographicView({ zoom }).makeViewport({\n height,\n width,\n viewState: { zoom, target: [0, 0, 0] },\n }).getBounds();\n const X = maxY - minY;\n const Y = maxX - minX;\n const X0 = xRange;\n const Y0 = yRange;\n const W = width;\n const H = height;\n\n let rho = avgFillDensity;\n if (!rho) {\n rho = Math.min(1, 1 / (10 ** (Math.log10(N) - 3)));\n }\n // p in the calculation is the pixel length/width of a given point, which for us is 1\n // so it does not factor into our calculation here.\n const alpha = ((rho * W * H) / N) * (Y0 / Y) * (X0 / X);\n const pointOpacity = clamp(alpha, 1.01 / 255, 1.0);\n return pointOpacity;\n}\n","/* eslint-disable no-plusplus */\n/* eslint-disable camelcase */\nimport packageJson from '../../package.json';\nimport { getNextScope } from '../utils';\nimport {\n DEFAULT_COORDINATION_VALUES,\n COMPONENT_COORDINATION_TYPES,\n AUTO_INDEPENDENT_COORDINATION_TYPES,\n} from './state/coordination';\nimport { CoordinationType } from './constants';\nimport { SCHEMA_HANDLERS } from './view-config-versions';\n\n/**\n * Get a list of all unique scope names for a\n * particular coordination type, which exist in\n * a particular view config.\n * @param {object} config A view config object.\n * @param {string} coordinationType A coordination type,\n * for example 'spatialZoom' or 'dataset'.\n * @returns {string[]} Array of existing coordination scope names.\n */\nexport function getExistingScopesForCoordinationType(config, coordinationType) {\n const spaceScopes = Object.keys(config?.coordinationSpace?.[coordinationType] || {});\n const componentScopes = config.layout.map(c => c.coordinationScopes?.[coordinationType]);\n return Array.from(new Set([...spaceScopes, ...componentScopes]));\n}\n\n/**\n * Give each component the same scope name for this coordination type.\n * @param {object} config A view config object.\n * @param {string} coordinationType A coordination type,\n * for example 'spatialZoom' or 'dataset'.\n * @param {*} scopeValue The initial value for the coordination scope,\n * to set in the coordination space.\n * @returns {object} The new view config.\n */\nfunction coordinateComponentsTogether(config, coordinationType, scopeValue) {\n const scopeName = getNextScope(getExistingScopesForCoordinationType(config, coordinationType));\n const newConfig = {\n ...config,\n coordinationSpace: {\n ...config.coordinationSpace,\n [coordinationType]: {\n ...config?.coordinationSpace?.[coordinationType],\n // Add the new scope name and value to the coordination space.\n [scopeName]: scopeValue,\n },\n },\n layout: config.layout.map(component => ({\n ...component,\n coordinationScopes: {\n ...component.coordinationScopes,\n // Only set the coordination scope if this component uses this coordination type,\n // and the component is missing a coordination scope for this coordination type.\n ...((\n COMPONENT_COORDINATION_TYPES[component.component].includes(coordinationType)\n && !component.coordinationScopes?.[coordinationType]\n ) ? {\n // Only set the new scope name if the scope name\n // for this component and coordination type is currently undefined.\n [coordinationType]: scopeName,\n } : {}),\n },\n })),\n };\n return newConfig;\n}\n\n/**\n * Give each component a different scope name for this coordination type.\n * @param {object} config A view config object.\n * @param {string} coordinationType A coordination type,\n * for example 'spatialZoom' or 'dataset'.\n * @param {*} scopeValue The initial value for the coordination scope,\n * to set in the coordination space.\n * @returns {object} The new view config.\n */\nfunction coordinateComponentsIndependent(config, coordinationType, scopeValue) {\n const newConfig = {\n ...config,\n layout: [...config.layout],\n };\n const newScopes = {};\n newConfig.layout.forEach((component, i) => {\n // Only set the coordination scope if this component uses this coordination type,\n // and the component is missing a coordination scope for this coordination type.\n if (COMPONENT_COORDINATION_TYPES[component.component].includes(coordinationType)\n && !component.coordinationScopes?.[coordinationType]\n ) {\n const scopeName = getNextScope([\n ...getExistingScopesForCoordinationType(config, coordinationType),\n ...Object.keys(newScopes),\n ]);\n newScopes[scopeName] = scopeValue;\n newConfig.layout[i] = {\n ...component,\n coordinationScopes: {\n ...component.coordinationScopes,\n [coordinationType]: scopeName,\n },\n };\n }\n });\n newConfig.coordinationSpace = {\n ...newConfig.coordinationSpace,\n [coordinationType]: {\n ...newConfig.coordinationSpace[coordinationType],\n // Add the new scope name and value to the coordination space.\n ...newScopes,\n },\n };\n return newConfig;\n}\n\nfunction initializeAuto(config) {\n let newConfig = config;\n const { layout, datasets } = newConfig;\n\n // For each coordination type, check whether it requires initialization.\n Object.values(CoordinationType).forEach((coordinationType) => {\n // A coordination type requires coordination if at least one component is missing\n // a (coordination type, coordination scope) tuple.\n // Components may only use a subset of all coordination types.\n const requiresCoordination = !layout\n .every(c => (\n !COMPONENT_COORDINATION_TYPES[c.component].includes(coordinationType)\n || c.coordinationScopes?.[coordinationType]\n ));\n if (requiresCoordination) {\n // Note that the default value may be undefined.\n let defaultValue = DEFAULT_COORDINATION_VALUES[coordinationType];\n // Check whether this is the special 'dataset' coordination type.\n if (coordinationType === 'dataset' && datasets.length >= 1) {\n // Use the first dataset ID as the default\n // if there is at least one dataset.\n defaultValue = datasets[0].uid;\n }\n // Use the list of \"independent\" coordination types\n // to determine whether a particular coordination type\n // should be initialized to\n // a unique scope for every component (\"independent\")\n // vs. the same scope for every component (\"together\").\n if (AUTO_INDEPENDENT_COORDINATION_TYPES.includes(coordinationType)) {\n newConfig = coordinateComponentsIndependent(newConfig, coordinationType, defaultValue);\n } else {\n newConfig = coordinateComponentsTogether(newConfig, coordinationType, defaultValue);\n }\n }\n });\n\n return newConfig;\n}\n\n\n/**\n * Initialize the view config:\n * - Fill in missing coordination objects with default values.\n * - Fill in missing component coordination scope mappings.\n * based on the `initStrategy` specified in the view config.\n * Should be \"stable\": if run on the same view config twice, the return value the second\n * time should be identical to the return value the first time.\n * @param {object} config The view config prop.\n */\nexport function initialize(config) {\n if (config.initStrategy === 'auto') {\n return initializeAuto(config);\n }\n return config;\n}\n\nexport function upgradeAndValidate(oldConfig) {\n // oldConfig object must have a `version` property.\n let nextConfig = oldConfig;\n let fromVersion;\n let upgradeFunction; let\n validateFunction;\n\n do {\n fromVersion = nextConfig.version;\n\n if (!Object.keys(SCHEMA_HANDLERS).includes(fromVersion)) {\n return [{\n title: 'Config validation failed',\n preformatted: 'Unknown config version.',\n }, false];\n }\n\n [validateFunction, upgradeFunction] = SCHEMA_HANDLERS[fromVersion];\n\n // Validate under the legacy schema before upgrading.\n const validLegacy = validateFunction(nextConfig);\n if (!validLegacy) {\n const failureReason = JSON.stringify(validateFunction.errors, null, 2);\n return [{\n title: 'Config validation failed',\n preformatted: failureReason,\n }, false];\n }\n\n if (upgradeFunction) {\n nextConfig = upgradeFunction(nextConfig);\n }\n } while (upgradeFunction);\n\n // NOTE: Remove when a view config viewer/editor is available in UI.\n console.groupCollapsed(`🚄 Vitessce (${packageJson.version}) view configuration`);\n console.info(`data:,${JSON.stringify(nextConfig)}`);\n console.info(JSON.stringify(nextConfig, null, 2));\n console.groupEnd();\n\n return [nextConfig, true];\n}\n","/* eslint-disable camelcase */\nimport React, { useEffect, useMemo } from 'react';\nimport {\n ThemeProvider, StylesProvider,\n createGenerateClassName,\n} from '@material-ui/core/styles';\nimport isEqual from 'lodash/isEqual';\nimport { muiTheme } from '../components/shared-mui/styles';\nimport {\n ViewConfigProvider, createViewConfigStore,\n AuxiliaryProvider, createAuxiliaryStore,\n} from './state/hooks';\n\nimport VitessceGrid from './VitessceGrid';\nimport Warning from './Warning';\nimport CallbackPublisher from './CallbackPublisher';\nimport { getComponent } from './component-registry';\nimport { initialize, upgradeAndValidate } from './view-config-utils';\n\nconst generateClassName = createGenerateClassName({\n disableGlobal: true,\n});\n\n/**\n * The Vitessce component.\n * @param {object} props\n * @param {object} props.config A Vitessce view config.\n * If the config is valid, the VitessceGrid will be rendered as a child.\n * If the config is invalid, a Warning will be rendered instead.\n * @param {number} props.rowHeight Row height for grid layout. Optional.\n * @param {number} props.height Total height for grid layout. Optional.\n * @param {string} props.theme The theme, used for styling as\n * light or dark. Optional. By default, \"dark\"\n * @param {function} props.onWarn A callback for warning messages. Optional.\n * @param {function} props.onConfigChange A callback for view config\n * updates. Optional.\n * @param {function} props.onLoaderChange A callback for loader\n * updates. Optional.\n * @param {boolean} props.validateOnConfigChange Whether to validate\n * against the view config schema when publishing changes. Use for debugging\n * purposes, as this may have a performance impact. By default, false.\n */\nexport default function Vitessce(props) {\n const {\n config,\n rowHeight,\n height,\n theme,\n onWarn,\n onConfigChange,\n onLoaderChange,\n validateOnConfigChange = false,\n } = props;\n\n // Process the view config and memoize the result:\n // - Validate.\n // - Upgrade, if legacy schema.\n // - Validate after upgrade, if legacy schema.\n // - Initialize (based on initStrategy).\n const [configOrWarning, success] = useMemo(() => {\n // If the config value is undefined, show a warning message.\n if (!config) {\n return [{\n title: 'No such dataset',\n unformatted: 'The dataset configuration could not be found.',\n }, false];\n }\n // If the view config is missing a version, show a warning message.\n if (!config.version) {\n return [{\n title: 'Missing version',\n unformatted: 'The dataset configuration is missing a version, preventing validation.',\n }, false];\n }\n // Check if this is a \"legacy\" view config.\n const [upgradedConfig, upgradeSuccess] = upgradeAndValidate(config);\n if (upgradeSuccess) {\n // Initialize the view config according to the initStrategy.\n const initializedConfig = initialize(upgradedConfig);\n return [initializedConfig, true];\n }\n return [upgradedConfig, false];\n }, [config]);\n\n // Emit the upgraded/initialized view config\n // to onConfigChange if necessary.\n useEffect(() => {\n if (success && !isEqual(configOrWarning, config) && onConfigChange) {\n onConfigChange(configOrWarning);\n }\n }, [success, config, configOrWarning, onConfigChange]);\n\n return success ? (\n <StylesProvider generateClassName={generateClassName}>\n <ThemeProvider theme={muiTheme[theme]}>\n <ViewConfigProvider createStore={createViewConfigStore}>\n <AuxiliaryProvider createStore={createAuxiliaryStore}>\n <VitessceGrid\n config={configOrWarning}\n getComponent={getComponent}\n rowHeight={rowHeight}\n height={height}\n theme={theme}\n />\n <CallbackPublisher\n onWarn={onWarn}\n onConfigChange={onConfigChange}\n onLoaderChange={onLoaderChange}\n validateOnConfigChange={validateOnConfigChange}\n />\n </AuxiliaryProvider>\n </ViewConfigProvider>\n </ThemeProvider>\n </StylesProvider>\n ) : (\n <Warning\n theme={theme}\n {...configOrWarning}\n />\n );\n}\n","import React, { useEffect, useRef, useState } from 'react';\nimport { getConfig } from './api';\nimport Warning from './Warning';\nimport Vitessce from './Vitessce';\n\nimport '../css/index.scss';\nimport '../../node_modules/react-grid-layout/css/styles.css';\nimport '../../node_modules/react-resizable/css/styles.css';\n\nfunction AwaitResponse(props) {\n const {\n response,\n theme,\n } = props;\n const [isLoading, setIsLoading] = useState(true);\n const responseRef = useRef();\n useEffect(() => {\n response.then((c) => {\n responseRef.current = c;\n setIsLoading(false);\n });\n }, [response]);\n return (!isLoading ? React.createElement(responseRef.current)\n : <Warning title=\"Loading...\" theme={theme} />);\n}\n\nfunction preformattedDetails(response) {\n return `\n ok: ${response.ok}\n status: ${response.status}\n statusText: ${response.statusText}\n redirected: ${response.redirected}\n type: ${response.type}\n url: ${response.url}`; // TODO: headers\n}\n\n\nfunction checkResponse(response, theme) {\n if (!response.ok) {\n return Promise.resolve(\n () => (\n <Warning\n title=\"Fetch response not OK\"\n preformatted={preformattedDetails(response)}\n theme={theme}\n />\n ),\n );\n }\n return response.text().then((text) => {\n try {\n const url = window.location.href;\n const base = url.split('?')[0];\n const json = text.replaceAll('http://localhost/', base);\n const config = JSON.parse(json);\n return Promise.resolve(() => (\n <Vitessce\n config={config}\n rowHeight={600}\n theme={theme}\n />\n ));\n } catch (e) {\n return Promise.resolve(() => (\n <Warning\n title=\"Error parsing JSON\"\n preformatted={preformattedDetails(response)}\n unformatted={`${e.message}: ${text}`}\n theme={theme}\n />\n ));\n }\n });\n}\n\n/**\n * Use the theme provided if it is valid, otherwise fall back to the 'dark' theme.\n * @param {string} theme A potentially invalid theme name.\n * @returns {string} A valid theme name.\n */\n// function validateTheme(theme) {\n// return (['light', 'dark'].includes(theme) ? theme : 'dark');\n// }\n\n/**\n * Convenience function for creating the minimal Vitessce demo and demo listing\n * components based on the current URL parameters.\n * @param {object} params\n * @param {number|null} params.rowHeight The row height to pass to the Vitessce grid.\n * Optional. By default, null.\n * @returns A component, either <Welcome/> or <Vitessce/> depending on the URL params.\n */\nexport function createApp() {\n // const { rowHeight = null } = params || {};\n const urlParams = new URLSearchParams(window.location.search);\n const datasetId = urlParams.get('dataset');\n // const debug = urlParams.get('debug') === 'true';\n // const datasetUrl = urlParams.get('url');\n // const showAll = urlParams.get('show') === 'all';\n // const theme = validateTheme(urlParams.get('theme'));\n const theme = 'dark';\n\n if (datasetId) {\n const config = getConfig(datasetId);\n return (\n <Vitessce\n config={config}\n rowHeight={600}\n theme={theme}\n // eslint-disable-next-line no-console\n // onConfigChange={(debug ? console.log : undefined)}\n // validateOnConfigChange={debug}\n />\n );\n }\n const responsePromise = fetch('config.json')\n .then(response => checkResponse(response, theme))\n .catch(error => Promise.resolve(() => (\n <Warning\n title=\"Error fetching\"\n unformatted={error.message}\n theme={theme}\n />\n )));\n return (\n <AwaitResponse response={responsePromise} theme={theme} />\n );\n}\n","import 'whatwg-fetch';\nimport ReactDOM from 'react-dom';\nimport { createApp } from '../app';\n\nfunction renderComponent(react, id) {\n ReactDOM.render(react, document.getElementById(id));\n}\n\n// const urlParams = new URLSearchParams(window.location.search);\n// if (urlParams.has('small')) {\n// renderComponent(createApp({ rowHeight: 100 }), 'small-app');\n// } else {\nrenderComponent(createApp(), 'full-app');\n","import { configs } from '../demo/configs';\n\nexport function listConfigs(showAll) {\n return Object.entries(configs).filter(\n entry => showAll || entry[1].public,\n ).map(\n ([id, config]) => ({\n id,\n name: config.name,\n description: config.description,\n }),\n );\n}\n\nexport function getConfig(id) {\n return configs[id];\n}\n","module.exports = function() {\n return require(\"!!/Users/guq/projects/vitessce/node_modules/worker-loader/dist/workers/InlineWorker.js\")(\"!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){\\\"undefined\\\"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\\\"Module\\\"}),Object.defineProperty(t,\\\"__esModule\\\",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&\\\"object\\\"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,\\\"default\\\",{enumerable:!0,value:t}),2&n&&\\\"string\\\"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\\\"a\\\",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p=\\\"./\\\",e(e.s=23)}([function(t,n){t.exports=function(t){var n=typeof t;return null!=t&&(\\\"object\\\"==n||\\\"function\\\"==n)}},function(t,n,e){var r=e(6),o=e(3);t.exports=function(t,n,e){return void 0===e&&(e=n,n=void 0),void 0!==e&&(e=(e=o(e))===e?e:0),void 0!==n&&(n=(n=o(n))===n?n:0),r(o(t),n,e)}},function(t,n,e){var r=e(14)();t.exports=r},function(t,n,e){var r=e(0),o=e(7),i=/^\\\\s+|\\\\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if(\\\"number\\\"==typeof t)return t;if(o(t))return NaN;if(r(t)){var n=\\\"function\\\"==typeof t.valueOf?t.valueOf():t;t=r(n)?n+\\\"\\\":n}if(\\\"string\\\"!=typeof t)return 0===t?t:+t;t=t.replace(i,\\\"\\\");var e=c.test(t);return e||f.test(t)?l(t.slice(2),e?2:8):u.test(t)?NaN:+t}},function(t,n,e){var r=e(5),o=e(11),i=e(12),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?\\\"[object Undefined]\\\":\\\"[object Null]\\\":u&&u in Object(t)?o(t):i(t)}},function(t,n,e){var r=e(8).Symbol;t.exports=r},function(t,n){t.exports=function(t,n,e){return t===t&&(void 0!==e&&(t=t<=e?t:e),void 0!==n&&(t=t>=n?t:n)),t}},function(t,n,e){var r=e(4),o=e(13);t.exports=function(t){return\\\"symbol\\\"==typeof t||o(t)&&\\\"[object Symbol]\\\"==r(t)}},function(t,n,e){var r=e(9),o=\\\"object\\\"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function(\\\"return this\\\")();t.exports=i},function(t,n,e){(function(n){var e=\\\"object\\\"==typeof n&&n&&n.Object===Object&&n;t.exports=e}).call(this,e(10))},function(t,n){var e;e=function(){return this}();try{e=e||new Function(\\\"return this\\\")()}catch(r){\\\"object\\\"===typeof window&&(e=window)}t.exports=e},function(t,n,e){var r=e(5),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,c=r?r.toStringTag:void 0;t.exports=function(t){var n=i.call(t,c),e=t[c];try{t[c]=void 0;var r=!0}catch(f){}var o=u.call(t);return r&&(n?t[c]=e:delete t[c]),o}},function(t,n){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},function(t,n){t.exports=function(t){return null!=t&&\\\"object\\\"==typeof t}},function(t,n,e){var r=e(15),o=e(16),i=e(22);t.exports=function(t){return function(n,e,u){return u&&\\\"number\\\"!=typeof u&&o(n,e,u)&&(e=u=void 0),n=i(n),void 0===e?(e=n,n=0):e=i(e),u=void 0===u?n<e?1:-1:i(u),r(n,e,u,t)}}},function(t,n){var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var u=-1,c=r(e((n-t)/(o||1)),0),f=Array(c);c--;)f[i?c:++u]=t,t+=o;return f}},function(t,n,e){var r=e(17),o=e(18),i=e(21),u=e(0);t.exports=function(t,n,e){if(!u(e))return!1;var c=typeof n;return!!(\\\"number\\\"==c?o(e)&&i(n,e.length):\\\"string\\\"==c&&n in e)&&r(e[n],t)}},function(t,n){t.exports=function(t,n){return t===n||t!==t&&n!==n}},function(t,n,e){var r=e(19),o=e(20);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,n,e){var r=e(4),o=e(0);t.exports=function(t){if(!o(t))return!1;var n=r(t);return\\\"[object Function]\\\"==n||\\\"[object GeneratorFunction]\\\"==n||\\\"[object AsyncFunction]\\\"==n||\\\"[object Proxy]\\\"==n}},function(t,n){t.exports=function(t){return\\\"number\\\"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,n){var e=/^(?:0|[1-9]\\\\d*)$/;t.exports=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&(\\\"number\\\"==r||\\\"symbol\\\"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}},function(t,n,e){var r=e(3);t.exports=function(t){return t?(t=r(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t===t?t:0:0===t?t:0}},function(t,n,e){\\\"use strict\\\";e.r(n);e(1);var r=e(2),o=e.n(r);function i(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var u,c=9728,f=10240,l=10241,a=10242,s=10243,p=33071;i(u={},l,c),i(u,f,c),i(u,a,p),i(u,s,p);function v(t,n){var e,r,i,u=n.tileSize,c=n.tileI,f=n.tileJ,l=n.numCells,a=n.numGenes,s=n.cellOrdering,p=n.cells,v=new Uint8Array(u*u),d=o()(u);return d.forEach((function(n){(r=f*u+n)<l&&(i=p.indexOf(s[r]))>=-1&&d.forEach((function(r){e=t[i*a+(c*u+r)],v[(u-r-1)*u+n]=e}))})),v}function d(t,n){var e,r,i,u,c=n.tileSize,f=n.tileI,l=n.tileJ,a=n.numCells,s=n.numGenes,p=n.cellOrdering,v=n.cells,d=new Uint8Array(c*c),b=o()(c);return b.forEach((function(n){(r=f*c+n)<a&&(u=v.indexOf(p[r]))>=-1&&b.forEach((function(r){e=(i=l*c+r)<s?t[u*s+i]:0,d[(c-n-1)*c+r]=e}))})),d}if(\\\"undefined\\\"!==typeof self){const t={getTile:function({curr:t,tileI:n,tileJ:e,tileSize:r,cellOrdering:o,rows:i,cols:u,data:c,transpose:f}){const l=new Uint8Array(c),a=u.length;return[{tile:(f?v:d)(l,{tileSize:r,tileI:n,tileJ:e,numCells:o.length,numGenes:a,cellOrdering:o,cells:i}),buffer:c,curr:t},[c]]}};self.addEventListener(\\\"message\\\",n=>{try{const[e,r]=n.data,[o,i]=t[e](r);self.postMessage(o,i)}catch(e){console.warn(e)}})}}]);\\n//# sourceMappingURL=6f6f723a7874f4178a42.worker.js.map\", null);\n};"],"sourceRoot":""}