comparison x/static/js/6837.a706c464.chunk.js.map @ 125:49f3d3878413 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 5ea1f9c1eef1de76232e69aa6d34cda77d90d566
author fubar
date Sat, 05 Oct 2024 23:58:05 +0000
parents
children
comparison
equal deleted inserted replaced
124:137e08517410 125:49f3d3878413
1 {"version":3,"file":"static/js/6837.a706c464.chunk.js","mappings":"gKAEA,MAAMA,GAAeC,EAAAA,EAAAA,qBAAoB,oBAAqB,CAAC,G,mECQ/D,SAASC,EAAsBC,EAAaC,GAC1C,SAASC,EAAAA,EAAAA,qBAAoBF,IAAQC,EACvC,CCGA,SAASE,EACPC,EACAC,EACAC,EACAC,EAAe,EACfC,EAAY,CAAC,GAETH,GAASE,GAGbH,EAAIK,aAAaC,KAAIC,IACnBR,EAAkBQ,EAAKN,EAAOC,EAAOC,EAAe,EAAGC,GACvDF,EAAMK,EAAI,GAEd,CASO,SAASC,EAAkBC,GAChC,OAAOC,EAAAA,MACJC,MAAM,oBAAqB,CAI1BC,GAAIC,EAAAA,UAIJC,KAAMJ,EAAAA,MAAMK,QAAQ,qBAIpBC,YAAaN,EAAAA,MAAMO,SAInBC,gBAAiBR,EAAAA,MAAMO,SAIvBE,uBAAwBT,EAAAA,MAAMO,SAI9BG,KAAMV,EAAAA,MAAMW,cACVZ,EAAca,iBAAiB,OAAQ,eAKzCC,MAAOb,EAAAA,MAAMW,cACXZ,EAAca,iBAAiB,QAAS,eAK1CE,QAASd,EAAAA,MAAMe,MAAMf,EAAAA,MAAMgB,QAI3BC,UAAWjB,EAAAA,MAAMe,MAAMf,EAAAA,MAAMgB,QAI7BE,SAAUlB,EAAAA,MAAMe,MAAMf,EAAAA,MAAMmB,QAK5BC,uBAAwBpB,EAAAA,MAAMqB,SD1E3BrB,EAAAA,MACJC,MAAM,0BACNqB,UAAS,KAAM,CACdC,wBACEnC,EAAAA,EAAAA,qBAAoB,kDACpB,OACFoC,SAAUvC,EAAsB,kC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AAMtH,KAAYsH,EACrB,IACEG,QAAoBzH,EAASyH,EAAaD,EAC5C,CAAE,MAAO3P,GACPiB,QAAQjB,MAAMA,EAChB,CAGJ,OAAO4P,CACT,E,ifCznBF,SACE,OACA,kBACA,QACA,oBACA,YACA,aACA,mBACA,sBACA,0BACA,gBACA,oBACA,gBAEA,uBACA,2BACA,8BACA,qCACA,qCACA,0BACA,+BACA,iCACA,2BACA,gCACA,6BACA,0BACA,wBACA,gCACA,2BACA,gCACA,yBACA,gCACA,mCACA,gCACA,+BACA,8BACA,qCACA,6BACA,sCACA,yBACA,6BACA,8BACA,2BACA,kCACA,gCACA,kCACA,sCACA,4BACA,2BACA,wBACA,yBACA,gCACA,8BACA,gCACA,qCACA,mCACA,8BACA,yBACA,yBACA,yBACA,+BACA,0BACA,8BACA,+BACA,mCACA,yBACA,mCACA,yBACA,6BACA,mCACA,4CACA,iCACA,kCACA,iCACA,yBACA,6BACA,6BACA,0BACA,iCACA,kCACA,+BACA,mCACA,0BACA,4BACA,2BACA,2BACA,0BACA,+BACA,2BACA,sCACA,2BACA,6BACA,2BACA,6BACA,oCACA,8BACA,oCACA,kCACA,0BACA,yBACA,+BACA,kCACA,8BACA,6BACA,4BACA,4BACA,2BACA,wBACA,0BACA,8BACA,8BACA,mCACA,gCACA,8BACA,oCACA,6BACA,mCACA,yBACA,8BACA,qCACA,iCACA,sCACA,4BACA,4BACA,+BACA,0BACA,iCACA,iCACA,sBACA,2BACA,6BACA,uBACA,4BACA,yBACA,sBACA,oBACA,4BACA,uBACA,4BACA,qBACA,4BACA,+BACA,4BACA,2BACA,0BACA,iCACA,yBACA,kCACA,qBACA,yBACA,0BACA,uBACA,8BACA,4BACA,8BACA,kCACA,wBACA,uBACA,oBACA,qBACA,4BACA,0BACA,4BACA,iCACA,+BACA,0BACA,qBACA,qBACA,qBACA,2BACA,sBACA,0BACA,2BACA,+BACA,qBACA,+BACA,qBACA,yBACA,+BACA,wCACA,6BACA,8BACA,6BACA,qBACA,yB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ssB,GACArrB,GACAsrB,GACAC,GACAC,GACAC,GACAC,GACA3e,GACA4e,GAAAA,EACAC,GAAAA,GACAC,GACArJ,GACAsJ,GACA30B,GACA6vB,GACAQ,GACAgB,GACAuD,GACAzkB,G","sources":["../../../packages/core/BaseFeatureWidget/configSchema.ts","../../../packages/core/BaseFeatureWidget/SequenceFeatureDetails/model.ts","../../../packages/core/BaseFeatureWidget/stateModelFactory.ts","../../../packages/core/Plugin.ts","../../../packages/core/rpc/methods/CoreGetRefNames.ts","../../../packages/core/rpc/methods/CoreGetFeatureDetails.ts","../../../packages/core/rpc/methods/CoreGetMetadata.ts","../../../packages/core/rpc/methods/CoreGetFileInfo.ts","../../../packages/core/rpc/methods/CoreGetFeatures.ts","../../../packages/core/rpc/methods/util.ts","../../../packages/core/rpc/methods/CoreRender.ts","../../../packages/core/rpc/methods/CoreFreeResources.ts","../../../packages/core/rpc/methods/CoreGetFeatureDensityStats.ts","../../../packages/core/data_adapters/CytobandAdapter/configSchema.ts","../../../packages/core/CorePlugin.ts","../../../packages/core/data_adapters/CytobandAdapter/index.ts","../../../packages/core/PluginManager.ts","../../../packages/core/ReExports/list.ts","../../../packages/core/ReExports/modules.tsx","../../../packages/core/TextSearch/BaseResults.ts","../../../packages/core/TextSearch/TextSearchManager.ts","../../../packages/core/configuration/configurationSlot.ts","../../../packages/core/configuration/configurationSchema.ts","../../../packages/core/configuration/util.ts","../../../packages/core/data_adapters/BaseAdapter/util.ts","../../../packages/core/data_adapters/BaseAdapter/BaseAdapter.ts","../../../packages/core/data_adapters/BaseAdapter/BaseFeatureDataAdapter.ts","../../../packages/core/data_adapters/BaseAdapter/BaseSequenceAdapter.ts","../../../packages/core/pluggableElementTypes/AdapterType.ts","../../../packages/core/pluggableElementTypes/AddTrackWorkflowType.ts","../../../packages/core/pluggableElementTypes/ConnectionType.ts","../../../packages/core/pluggableElementTypes/DisplayType.ts","../../../packages/core/pluggableElementTypes/InternetAccountType.ts","../../../packages/core/pluggableElementTypes/PluggableElementBase.ts","../../../packages/core/util/map-obj.ts","../../../packages/core/pluggableElementTypes/RpcMethodType.ts","../../../packages/core/pluggableElementTypes/TextSearchAdapterType.ts","../../../packages/core/pluggableElementTypes/TrackType.ts","../../../packages/core/pluggableElementTypes/ViewType.ts","../../../packages/core/pluggableElementTypes/WidgetType.ts","../../../packages/core/pluggableElementTypes/models/BaseViewModel.ts","../../../packages/core/pluggableElementTypes/models/baseConnectionConfig.ts","../../../packages/core/pluggableElementTypes/models/BaseConnectionModelFactory.ts","../../../packages/core/pluggableElementTypes/models/BaseDisplayModel.tsx","../../../packages/core/pluggableElementTypes/models/baseInternetAccountConfig.ts","../../../packages/core/pluggableElementTypes/models/InternetAccountModel.ts","../../../packages/core/pluggableElementTypes/models/BaseTrackModel.ts","../../../packages/core/pluggableElementTypes/models/baseTrackConfig.ts","../../../packages/core/pluggableElementTypes/renderers/BoxRendererType.ts","../../../packages/core/pluggableElementTypes/renderers/RpcRenderedSvgGroup.tsx","../../../packages/core/pluggableElementTypes/renderers/CircularChordRendererType.tsx","../../../packages/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType.ts","../../../packages/core/pluggableElementTypes/renderers/FeatureRendererType.ts","../../../packages/core/pluggableElementTypes/renderers/RendererType.ts","../../../packages/core/pluggableElementTypes/renderers/ServerSideRenderedContent.tsx","../../../packages/core/pluggableElementTypes/renderers/ServerSideRendererType.tsx","../../../packages/core/pluggableElementTypes/renderers/util/serializableFilterChain.ts","../../../packages/core/ui/BaseTooltip.tsx","../../../packages/core/ui/CascadingMenuButton.tsx","../../../packages/core/ui/FatalErrorDialog.tsx","../../../packages/core/ui/FileSelector/LocalFileChooser.tsx","../../../packages/core/ui/FileSelector/UrlChooser.tsx","../../../packages/core/ui/LoadingEllipses.tsx","../../../packages/core/ui/RedErrorMessageBox.tsx","../../../packages/core/ui/colors.ts","../../../packages/core/util/Base1DUtils.ts","../../../packages/core/util/Base1DViewModel.ts","../../../packages/core/util/aborting.ts","../../../packages/core/util/blobToDataURL.ts","../../../packages/core/util/blockTypes.ts","../../../packages/core/util/calculateDynamicBlocks.ts","../../../packages/core/util/calculateStaticBlocks.ts","../../../packages/core/util/color/cssColorsLevel4.ts","../../../packages/core/util/color/index.ts","../../../packages/core/util/colord.ts","../../../packages/core/util/dedupe.ts","../../../packages/core/util/idMaker.ts","../../../packages/core/util/io/RemoteFileWithRangeCache.ts","../../../packages/core/util/io/index.ts","../../../packages/core/util/jexl.ts","../../../packages/core/util/jexlStrings.ts","../../../packages/core/util/layouts/GranularRectLayout.ts","../../../packages/core/util/layouts/MultiLayout.ts","../../../packages/core/util/layouts/PrecomputedLayout.ts","../../../packages/core/util/layouts/PrecomputedMultiLayout.js","../../../packages/core/util/layouts/SceneGraph.ts","../../../packages/core/util/mst-reflection.ts","../../../packages/core/util/nanoid.js","../../../packages/core/util/offscreenCanvasPonyfill.tsx","../../../packages/core/util/offscreenCanvasUtils.tsx","../../../packages/core/util/range.ts","../../../packages/core/util/rxjs.ts","../../../packages/core/util/simpleFeature.ts","../../../packages/core/util/stats.ts","../../../packages/core/util/types/index.ts","../../../packages/core/util/useMeasure.ts","../../../packages/core/util/when.ts","../../../plugins/alignments/src/MismatchParser/index.ts","../../../plugins/alignments/src/CramAdapter/configSchema.ts","../../../plugins/alignments/src/CramAdapter/index.ts","../../../plugins/alignments/src/BamAdapter/configSchema.ts","../../../plugins/alignments/src/BamAdapter/index.ts","../../../plugins/alignments/src/HtsgetBamAdapter/configSchema.ts","../../../plugins/alignments/src/HtsgetBamAdapter/index.ts","../../../plugins/alignments/src/SNPCoverageAdapter/configSchema.ts","../../../plugins/alignments/src/SNPCoverageAdapter/index.ts","../../../plugins/alignments/src/SNPCoverageRenderer/configSchema.ts","../../../plugins/alignments/src/SNPCoverageRenderer/SNPCoverageRenderer.ts","../../../plugins/alignments/src/SNPCoverageRenderer/index.ts","../../../plugins/alignments/src/PileupRenderer/PileupLayoutSession.ts","../../../plugins/alignments/src/PileupRenderer/PileupRenderer.ts","../../../plugins/alignments/src/PileupRenderer/layoutFeatures.ts","../../../plugins/alignments/src/PileupRenderer/sortUtil.ts","../../../plugins/alignments/src/PileupRenderer/layoutFeature.ts","../../../plugins/alignments/src/PileupRenderer/configSchema.ts","../../../plugins/alignments/src/PileupRenderer/components/PileupRendering.tsx","../../../plugins/alignments/src/PileupRenderer/index.ts","../../../plugins/alignments/src/LinearAlignmentsDisplay/models/util.ts","../../../plugins/alignments/src/LinearAlignmentsDisplay/models/model.tsx","../../../plugins/alignments/src/LinearAlignmentsDisplay/models/alignmentsModel.tsx","../../../plugins/alignments/src/LinearAlignmentsDisplay/components/AlignmentsDisplay.tsx","../../../plugins/alignments/src/LinearAlignmentsDisplay/index.ts","../../../plugins/alignments/src/LinearAlignmentsDisplay/models/configSchema.ts","../../../plugins/alignments/src/LinearSNPCoverageDisplay/models/model.ts","../../../plugins/alignments/src/LinearSNPCoverageDisplay/index.ts","../../../plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.ts","../../../plugins/alignments/src/LinearReadArcsDisplay/model.ts","../../../plugins/alignments/src/LinearReadArcsDisplay/index.ts","../../../plugins/alignments/src/LinearReadArcsDisplay/configSchema.ts","../../../plugins/alignments/src/LinearReadCloudDisplay/configSchema.ts","../../../plugins/alignments/src/LinearReadCloudDisplay/model.ts","../../../plugins/alignments/src/LinearReadCloudDisplay/index.ts","../../../plugins/alignments/src/AlignmentsTrack/index.ts","../../../plugins/alignments/src/AlignmentsTrack/configSchemaF.ts","../../../plugins/alignments/src/AlignmentsFeatureDetail/configSchema.ts","../../../plugins/alignments/src/AlignmentsFeatureDetail/stateModelFactory.ts","../../../plugins/alignments/src/AlignmentsFeatureDetail/index.ts","../../../plugins/alignments/src/PileupRPC/base.ts","../../../plugins/alignments/src/PileupRPC/methods/GetReducedFeatures.ts","../../../plugins/alignments/src/PileupRPC/util.ts","../../../plugins/alignments/src/PileupRPC/methods/GetVisibleModifications.ts","../../../plugins/alignments/src/PileupRPC/methods/GetGlobalValueForTag.ts","../../../plugins/alignments/src/PileupRPC/index.ts","../../../plugins/alignments/src/GuessAlignmentsTypes/index.ts","../../../plugins/alignments/src/LinearPileupDisplay/configSchema.ts","../../../plugins/alignments/src/LinearPileupDisplay/components/LinearPileupDisplayBlurb.tsx","../../../plugins/alignments/src/LinearPileupDisplay/SharedLinearPileupDisplayMixin.ts","../../../plugins/alignments/src/LinearPileupDisplay/model.ts","../../../plugins/alignments/src/LinearPileupDisplay/index.ts","../../../plugins/alignments/src/index.ts","../../../plugins/alignments/src/shared/color.ts","../../../plugins/alignments/src/shared/index.ts","../../../plugins/alignments/src/util.ts","../../../plugins/breakpoint-split-view/src/BreakpointSplitView/util.ts","../../../plugins/circular-view/src/CircularView/models/viewportVisibleRegion.ts","../../../plugins/circular-view/src/CircularView/models/slices.ts","../../../plugins/circular-view/src/CircularView/models/model.ts","../../../plugins/circular-view/src/BaseChordDisplay/components/Loading.tsx","../../../plugins/circular-view/src/BaseChordDisplay/components/DisplayError.tsx","../../../plugins/circular-view/src/BaseChordDisplay/components/BaseChordDisplay.tsx","../../../plugins/circular-view/src/BaseChordDisplay/models/renderReaction.ts","../../../plugins/circular-view/src/BaseChordDisplay/models/configSchema.ts","../../../plugins/circular-view/src/BaseChordDisplay/models/model.tsx","../../../plugins/circular-view/src/index.ts","../../../plugins/circular-view/src/CircularView/index.ts","../../../plugins/circular-view/src/LaunchCircularView/index.ts","../../../plugins/config/src/ConfigurationEditorWidget/components/JsonEditor.tsx","../../../plugins/config/src/FromConfigAdapter/configSchema.ts","../../../plugins/config/src/FromConfigRegionsAdapter/configSchema.ts","../../../plugins/config/src/FromConfigSequenceAdapter/configSchema.ts","../../../plugins/config/src/RefNameAliasAdapter/configSchema.ts","../../../plugins/config/src/ConfigurationEditorWidget/model.ts","../../../plugins/config/src/ConfigurationEditorWidget/components/HeadingComponent.tsx","../../../plugins/config/src/ConfigurationEditorWidget/index.ts","../../../plugins/config/src/NcbiSequenceReportAliasAdapter/configSchema.ts","../../../plugins/config/src/index.ts","../../../plugins/config/src/FromConfigAdapter/index.ts","../../../plugins/config/src/FromConfigRegionsAdapter/index.ts","../../../plugins/config/src/FromConfigSequenceAdapter/index.ts","../../../plugins/config/src/RefNameAliasAdapter/index.ts","../../../plugins/config/src/NcbiSequenceReportAliasAdapter/index.ts","../../../plugins/data-management/src/AddConnectionWidget/model.ts","../../../plugins/data-management/src/AddConnectionWidget/index.ts","../../../plugins/data-management/src/AddTrackWidget/model.ts","../../../plugins/data-management/src/AddTrackWidget/index.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/components/faceted/util.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/util.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/filterTracks.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/generateHierarchy.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/facetedUtil.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/facetedModel.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/model.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/configSchema.ts","../../../plugins/data-management/src/HierarchicalTrackSelectorWidget/index.ts","../../../plugins/data-management/src/PluginStoreWidget/model.ts","../../../plugins/data-management/src/PluginStoreWidget/index.ts","../../../plugins/data-management/src/ucsc-trackhub/configSchema.ts","../../../plugins/data-management/src/ucsc-trackhub/model.ts","../../../plugins/data-management/src/ucsc-trackhub/index.ts","../../../plugins/dotplot-view/src/DotplotView/components/util.ts","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/Block.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/BlockMsg.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/Tooltip.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/util.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Cytobands.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TrackLabelDragHandle.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TrackLabel.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TrackLabelContainer.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TrackRenderingContainer.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TrackContainer.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/hooks.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/components/VerticalGuide.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Rubberband.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/ScalebarCoordinateTicks.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/ScalebarCoordinateLabels.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/ScalebarRefNameLabels.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Scalebar.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Gridlines.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/CenterLine.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Highlight.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/TracksContainer.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/LinearGenomeView.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/OverviewScalebarPolygon.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/RefNameAutocomplete/index.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/RefNameAutocomplete/util.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/components/RubberbandSpan.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/util.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/consts.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGBackground.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGRegionSeparators.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGTrackLabel.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGTracks.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGRuler.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGScalebar.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGHeader.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/svgcomponents/util.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/util.ts","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/configSchema.ts","../../../packages/core/util/compositeMap.ts","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/TrackHeightMixin.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/TooLargeMessage.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/FeatureDensityMixin.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/autorunFeatureDensityStats.ts","../../../plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/LinearBlocks.tsx","../../../plugins/linear-genome-view/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx","../../../plugins/linear-genome-view/src/LinearBareDisplay/configSchema.ts","../../../plugins/linear-genome-view/src/LinearBareDisplay/model.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/components/MiniControls.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/OverviewRubberband.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/OverviewHighlight.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/OverviewScalebarTickLabels.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/OverviewScalebar.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/ZoomControls.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/SearchBox.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/components/Header.tsx","../../../plugins/linear-genome-view/src/LinearGenomeView/model.ts","../../../plugins/linear-genome-view/src/LinearBasicDisplay/configSchema.ts","../../../plugins/linear-genome-view/src/LinearBasicDisplay/model.ts","../../../plugins/linear-genome-view/src/index.ts","../../../plugins/linear-genome-view/src/FeatureTrack/index.ts","../../../plugins/linear-genome-view/src/FeatureTrack/configSchema.ts","../../../plugins/linear-genome-view/src/BasicTrack/index.ts","../../../plugins/linear-genome-view/src/BasicTrack/configSchema.ts","../../../plugins/linear-genome-view/src/LinearBasicDisplay/index.ts","../../../plugins/linear-genome-view/src/LinearGenomeView/index.ts","../../../plugins/linear-genome-view/src/LinearBareDisplay/index.ts","../../../plugins/linear-genome-view/src/LaunchLinearGenomeView/index.ts","../../../plugins/linear-genome-view/src/searchUtils.ts","../../../plugins/variants/src/VcfFeature/util.ts","../../../plugins/variants/src/VcfFeature/index.ts","../../../plugins/variants/src/VcfAdapter/configSchema.ts","../../../plugins/variants/src/VcfTabixAdapter/configSchema.ts","../../../plugins/variants/src/LinearVariantDisplay/model.ts","../../../plugins/variants/src/StructuralVariantChordRenderer/configSchema.ts","../../../plugins/variants/src/StructuralVariantChordRenderer/Chord.tsx","../../../plugins/variants/src/StructuralVariantChordRenderer/ReactComponent.tsx","../../../plugins/variants/src/VariantFeatureWidget/stateModelFactory.ts","../../../plugins/variants/src/VariantFeatureWidget/configSchema.ts","../../../plugins/variants/src/index.ts","../../../plugins/variants/src/VariantTrack/index.ts","../../../plugins/variants/src/VcfAdapter/index.ts","../../../plugins/variants/src/VcfTabixAdapter/index.ts","../../../plugins/variants/src/VariantFeatureWidget/index.ts","../../../plugins/variants/src/VariantTrack/configSchema.ts","../../../plugins/variants/src/extensionPoints.ts","../../../plugins/variants/src/LinearVariantDisplay/index.ts","../../../plugins/variants/src/LinearVariantDisplay/configSchema.ts","../../../plugins/variants/src/StructuralVariantChordRenderer/index.ts","../../../plugins/variants/src/ChordVariantDisplay/index.ts","../../../plugins/variants/src/ChordVariantDisplay/models/configSchema.ts","../../../plugins/variants/src/ChordVariantDisplay/models/stateModelFactory.ts","../../../plugins/wiggle/src/LinearWiggleDisplay/components/Tooltip.tsx","../../../plugins/wiggle/src/LinearWiggleDisplay/components/WiggleDisplayComponent.tsx","../../../plugins/wiggle/src/Tooltip.tsx","../../../plugins/wiggle/src/WiggleBaseRenderer.tsx","../../../plugins/wiggle/src/BigWigAdapter/configSchema.ts","../../../plugins/wiggle/src/QuantitativeTrack/configSchema.ts","../../../plugins/wiggle/src/MultiWiggleAdapter/configSchema.ts","../../../plugins/wiggle/src/configSchema.ts","../../../plugins/wiggle/src/DensityRenderer/configSchema.ts","../../../plugins/wiggle/src/drawDensity.ts","../../../plugins/wiggle/src/DensityRenderer/DensityRenderer.ts","../../../plugins/wiggle/src/WiggleRendering.tsx","../../../plugins/wiggle/src/drawXY.ts","../../../plugins/wiggle/src/XYPlotRenderer/XYPlotRenderer.ts","../../../plugins/wiggle/src/XYPlotRenderer/configSchema.ts","../../../plugins/wiggle/src/LinePlotRenderer/configSchema.ts","../../../plugins/wiggle/src/drawLine.ts","../../../plugins/wiggle/src/LinePlotRenderer/LinePlotRenderer.ts","../../../plugins/wiggle/src/shared/configShared.ts","../../../plugins/wiggle/src/shared/modelShared.ts","../../../plugins/wiggle/src/LinearWiggleDisplay/models/model.ts","../../../plugins/wiggle/src/MultiLinearWiggleDisplay/models/model.ts","../../../plugins/wiggle/src/MultiWiggleRendering.tsx","../../../plugins/wiggle/src/MultiXYPlotRenderer/MultiXYPlotRenderer.ts","../../../plugins/wiggle/src/MultiXYPlotRenderer/configSchema.ts","../../../plugins/wiggle/src/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.ts","../../../plugins/wiggle/src/MultiRowXYPlotRenderer/configSchema.ts","../../../plugins/wiggle/src/MultiDensityRenderer/configSchema.ts","../../../plugins/wiggle/src/MultiDensityRenderer/MultiDensityRenderer.ts","../../../plugins/wiggle/src/MultiLineRenderer/MultiLineRenderer.ts","../../../plugins/wiggle/src/MultiLineRenderer/configSchema.ts","../../../plugins/wiggle/src/MultiRowLineRenderer/MultiRowLineRenderer.ts","../../../plugins/wiggle/src/MultiRowLineRenderer/configSchema.ts","../../../plugins/wiggle/src/CreateMultiWiggleExtension/index.ts","../../../plugins/wiggle/src/WiggleRPC/MultiWiggleGetSources.ts","../../../plugins/wiggle/src/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.ts","../../../plugins/wiggle/src/WiggleRPC/WiggleGetGlobalQuantitativeStats.ts","../../../plugins/wiggle/src/index.ts","../../../plugins/wiggle/src/MultiWiggleAdapter/index.ts","../../../plugins/wiggle/src/BigWigAdapter/index.ts","../../../plugins/wiggle/src/QuantitativeTrack/index.ts","../../../plugins/wiggle/src/MultiQuantitativeTrack/index.ts","../../../plugins/wiggle/src/MultiQuantitativeTrack/configSchema.ts","../../../plugins/wiggle/src/LinearWiggleDisplay/index.ts","../../../plugins/wiggle/src/LinearWiggleDisplay/models/configSchema.ts","../../../plugins/wiggle/src/MultiLinearWiggleDisplay/index.ts","../../../plugins/wiggle/src/MultiLinearWiggleDisplay/models/configSchema.ts","../../../plugins/wiggle/src/LinePlotRenderer/index.ts","../../../plugins/wiggle/src/XYPlotRenderer/index.ts","../../../plugins/wiggle/src/DensityRenderer/index.ts","../../../plugins/wiggle/src/MultiXYPlotRenderer/index.ts","../../../plugins/wiggle/src/MultiRowXYPlotRenderer/index.ts","../../../plugins/wiggle/src/MultiDensityRenderer/index.ts","../../../plugins/wiggle/src/MultiLineRenderer/index.ts","../../../plugins/wiggle/src/MultiRowLineRenderer/index.ts","../../../plugins/wiggle/src/MultiWiggleAddTrackWorkflow/index.ts","../../../plugins/wiggle/src/shared/YScaleBar.tsx","../../../plugins/wiggle/src/util.ts","../../../plugins/authentication/src/OAuthModel/configSchema.ts","../../../plugins/authentication/src/OAuthModel/util.ts","../../../plugins/authentication/src/util.ts","../../../plugins/authentication/src/OAuthModel/model.tsx","../../../plugins/authentication/src/ExternalTokenModel/configSchema.ts","../../../plugins/authentication/src/ExternalTokenModel/ExternalTokenEntryForm.tsx","../../../plugins/authentication/src/ExternalTokenModel/model.tsx","../../../plugins/authentication/src/HTTPBasicModel/configSchema.ts","../../../plugins/authentication/src/HTTPBasicModel/HTTPBasicLoginForm.tsx","../../../plugins/authentication/src/HTTPBasicModel/model.tsx","../../../plugins/authentication/src/DropboxOAuthModel/configSchema.ts","../../../plugins/authentication/src/DropboxOAuthModel/util.ts","../../../plugins/authentication/src/DropboxOAuthModel/DropboxIcon.tsx","../../../plugins/authentication/src/DropboxOAuthModel/model.tsx","../../../plugins/authentication/src/GoogleDriveOAuthModel/configSchema.ts","../../../plugins/authentication/src/GoogleDriveOAuthModel/util.ts","../../../plugins/authentication/src/GoogleDriveOAuthModel/GoogleDriveFilehandle.ts","../../../plugins/authentication/src/GoogleDriveOAuthModel/GoogleDriveIcon.tsx","../../../plugins/authentication/src/GoogleDriveOAuthModel/model.tsx","../../../plugins/authentication/src/index.ts","../../../plugins/bed/src/BigBedAdapter/configSchema.ts","../../../plugins/bed/src/BedpeAdapter/configSchema.ts","../../../plugins/bed/src/BedTabixAdapter/configSchema.ts","../../../plugins/bed/src/BedAdapter/configSchema.ts","../../../plugins/bed/src/index.ts","../../../plugins/bed/src/BigBedAdapter/index.ts","../../../plugins/bed/src/BedAdapter/index.ts","../../../plugins/bed/src/BedpeAdapter/index.ts","../../../plugins/bed/src/BedTabixAdapter/index.ts","../../../plugins/breakpoint-split-view/src/BreakpointAlignmentsFeatureDetail/index.ts","../../../plugins/breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView.ts","../../../plugins/breakpoint-split-view/src/BreakpointSplitView/model.ts","../../../plugins/breakpoint-split-view/src/index.ts","../../../plugins/breakpoint-split-view/src/BreakpointSplitView/index.ts","../../../plugins/comparative-adapters/src/PAFAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/PairwiseIndexedPAFAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/MCScanAnchorsAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/MCScanSimpleAnchorsAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/MashMapAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/DeltaAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/ChainAdapter/configSchema.ts","../../../plugins/comparative-adapters/src/index.ts","../../../plugins/comparative-adapters/src/PAFAdapter/index.ts","../../../plugins/comparative-adapters/src/PairwiseIndexedPAFAdapter/index.ts","../../../plugins/comparative-adapters/src/DeltaAdapter/index.ts","../../../plugins/comparative-adapters/src/ChainAdapter/index.ts","../../../plugins/comparative-adapters/src/MCScanAnchorsAdapter/index.ts","../../../plugins/comparative-adapters/src/MCScanSimpleAnchorsAdapter/index.ts","../../../plugins/comparative-adapters/src/MashMapAdapter/index.ts","../../../plugins/dotplot-view/src/DotplotView/1dview.ts","../../../plugins/dotplot-view/src/DotplotView/model.ts","../../../plugins/dotplot-view/src/ServerSideRenderedBlockContent.tsx","../../../plugins/dotplot-view/src/DotplotDisplay/renderDotplotBlock.ts","../../../plugins/dotplot-view/src/DotplotDisplay/stateModelFactory.tsx","../../../plugins/dotplot-view/src/DotplotDisplay/components/DotplotDisplay.tsx","../../../plugins/dotplot-view/src/DotplotRenderer/components/DotplotRendering.tsx","../../../plugins/dotplot-view/src/DotplotRenderer/DotplotRenderer.ts","../../../plugins/dotplot-view/src/DotplotRenderer/configSchema.ts","../../../plugins/dotplot-view/src/ComparativeRenderer/index.ts","../../../plugins/dotplot-view/src/DotplotReadVsRef/DotplotReadVsRef.ts","../../../plugins/dotplot-view/src/index.ts","../../../plugins/dotplot-view/src/DotplotDisplay/index.ts","../../../plugins/dotplot-view/src/DotplotView/index.ts","../../../plugins/dotplot-view/src/DotplotRenderer/index.ts","../../../plugins/dotplot-view/src/LaunchDotplotView.ts","../../../plugins/dotplot-view/src/DotplotReadVsRef/index.ts","../../../plugins/gtf/src/GtfAdapter/configSchema.ts","../../../plugins/gtf/src/index.ts","../../../plugins/gff3/src/Gff3TabixAdapter/configSchema.ts","../../../plugins/gff3/src/Gff3Adapter/configSchema.ts","../../../plugins/gff3/src/index.ts","../../../plugins/gff3/src/Gff3TabixAdapter/index.ts","../../../plugins/gff3/src/Gff3Adapter/index.ts","../../../plugins/gff3/src/GuessGff3/index.ts","../../../plugins/jobs-management/src/JobsListWidget/jobModel.ts","../../../plugins/jobs-management/src/JobsListWidget/index.ts","../../../plugins/jobs-management/src/index.ts","../../../plugins/jobs-management/src/JobsListWidget/model.ts","../../../plugins/legacy-jbrowse/src/NCListAdapter/configSchema.ts","../../../plugins/legacy-jbrowse/src/JBrowse1TextSearchAdapter/configSchema.ts","../../../plugins/legacy-jbrowse/src/JBrowse1Connection/configSchema.ts","../../../plugins/legacy-jbrowse/src/JBrowse1Connection/model.ts","../../../plugins/legacy-jbrowse/src/index.ts","../../../plugins/legacy-jbrowse/src/NCListAdapter/index.ts","../../../plugins/legacy-jbrowse/src/GuessNCList/index.ts","../../../plugins/legacy-jbrowse/src/JBrowse1TextSearchAdapter/index.ts","../../../plugins/legacy-jbrowse/src/JBrowse1Connection/index.ts","../../../plugins/linear-comparative-view/src/LinearComparativeDisplay/configSchemaF.ts","../../../plugins/linear-comparative-view/src/LinearComparativeDisplay/stateModelFactory.ts","../../../plugins/linear-comparative-view/src/LinearComparativeView/model.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/model.ts","../../../plugins/linear-comparative-view/src/LGVSyntenyDisplay/model.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyView/components/Icons.tsx","../../../plugins/linear-comparative-view/src/LinearSyntenyView/model.ts","../../../plugins/linear-comparative-view/src/LaunchLinearSyntenyView.ts","../../../plugins/linear-comparative-view/src/SyntenyTrack/configSchema.ts","../../../plugins/linear-comparative-view/src/LinearReadVsRef/index.ts","../../../plugins/linear-comparative-view/src/index.tsx","../../../plugins/linear-comparative-view/src/LinearComparativeView/index.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyView/index.ts","../../../plugins/linear-comparative-view/src/LinearComparativeDisplay/index.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/index.ts","../../../plugins/linear-comparative-view/src/LinearSyntenyDisplay/configSchemaF.ts","../../../plugins/linear-comparative-view/src/LGVSyntenyDisplay/index.ts","../../../plugins/linear-comparative-view/src/LGVSyntenyDisplay/configSchemaF.ts","../../../plugins/linear-comparative-view/src/SyntenyTrack/index.tsx","../../../plugins/lollipop/src/LinearLollipopDisplay/model.ts","../../../plugins/lollipop/src/LollipopRenderer/Layout.ts","../../../plugins/lollipop/src/LollipopRenderer/LollipopRenderer.js","../../../plugins/lollipop/src/LollipopRenderer/configSchema.ts","../../../plugins/lollipop/src/index.ts","../../../plugins/lollipop/src/LollipopRenderer/index.ts","../../../plugins/lollipop/src/LinearLollipopDisplay/index.ts","../../../plugins/lollipop/src/LinearLollipopDisplay/configSchema.ts","../../../plugins/arc/src/LinearArcDisplay/model.ts","../../../plugins/arc/src/LinearPairedArcDisplay/model.ts","../../../plugins/arc/src/ArcRenderer/ArcRendering.tsx","../../../plugins/arc/src/ArcRenderer/configSchema.ts","../../../plugins/arc/src/ArcRenderer/ArcRenderer.ts","../../../plugins/arc/src/index.ts","../../../plugins/arc/src/ArcRenderer/index.ts","../../../plugins/arc/src/LinearArcDisplay/index.ts","../../../plugins/arc/src/LinearArcDisplay/configSchema.ts","../../../plugins/arc/src/LinearPairedArcDisplay/index.ts","../../../plugins/arc/src/LinearPairedArcDisplay/configSchema.ts","../../../plugins/menus/src/AboutWidget/index.ts","../../../plugins/menus/src/HelpWidget/index.ts","../../../plugins/menus/src/ImportSessionWidget/index.ts","../../../plugins/menus/src/SessionManager/index.ts","../../../plugins/menus/src/index.ts","../../../plugins/rdf/src/SPARQLAdapter/SPARQLAdapter.ts","../../../plugins/rdf/src/SPARQLAdapter/configSchema.ts","../../../plugins/rdf/src/index.ts","../../../plugins/sequence/src/TwoBitAdapter/configSchema.ts","../../../plugins/sequence/src/DivSequenceRenderer/components/DivSequenceRendering.tsx","../../../plugins/sequence/src/DivSequenceRenderer/configSchema.ts","../../../plugins/sequence/src/DivSequenceRenderer/index.ts","../../../plugins/sequence/src/BgzipFastaAdapter/configSchema.ts","../../../plugins/sequence/src/ChromSizesAdapter/configSchema.ts","../../../plugins/sequence/src/IndexedFastaAdapter/configSchema.ts","../../../plugins/sequence/src/UnindexedFastaAdapter/configSchema.ts","../../../plugins/sequence/src/SequenceSearchAdapter/configSchema.ts","../../../plugins/sequence/src/LinearReferenceSequenceDisplay/configSchema.ts","../../../plugins/sequence/src/index.ts","../../../plugins/sequence/src/TwoBitAdapter/index.ts","../../../plugins/sequence/src/BgzipFastaAdapter/index.ts","../../../plugins/sequence/src/ChromSizesAdapter/index.ts","../../../plugins/sequence/src/IndexedFastaAdapter/index.ts","../../../plugins/sequence/src/UnindexedFastaAdapter/index.ts","../../../plugins/sequence/src/SequenceSearchAdapter/index.ts","../../../plugins/sequence/src/ReferenceSequenceTrack/index.ts","../../../plugins/sequence/src/ReferenceSequenceTrack/configSchema.ts","../../../plugins/sequence/src/LinearReferenceSequenceDisplay/index.ts","../../../plugins/sequence/src/LinearReferenceSequenceDisplay/model.ts","../../../plugins/sequence/src/createExtensionPoints.ts","../../../plugins/svg/src/SvgFeatureRenderer/components/FeatureLabel.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/FeatureGlyph.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/SvgOverlay.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/Arrow.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/Box.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/Segments.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/ProcessedTranscript.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/Subfeatures.tsx","../../../plugins/svg/src/SvgFeatureRenderer/components/util.ts","../../../plugins/svg/src/SvgFeatureRenderer/components/SvgFeatureRendering.tsx","../../../plugins/svg/src/SvgFeatureRenderer/configSchema.ts","../../../plugins/svg/src/index.ts","../../../plugins/gccontent/src/GCContentAdapter/configSchema.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/shared.ts","../../../plugins/gccontent/src/index.ts","../../../plugins/gccontent/src/GCContentTrack/index.ts","../../../plugins/gccontent/src/GCContentAdapter/index.ts","../../../plugins/gccontent/src/GCContentTrack/configSchema.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/index.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/config1.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/stateModel1.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/config2.ts","../../../plugins/gccontent/src/LinearGCContentDisplay/stateModel2.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/MakeSpreadsheetColumnType.tsx","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/LocString.tsx","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/Text.tsx","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/LocRef.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/Number.tsx","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/index.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/LocStart.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ColumnDataTypes/LocEnd.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/Row.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/StaticRowSet.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/Spreadsheet.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/ImportWizard.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/FilterControls.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/models/SpreadsheetView.ts","../../../plugins/spreadsheet-view/src/index.ts","../../../plugins/spreadsheet-view/src/SpreadsheetView/index.ts","../../../plugins/spreadsheet-view/src/LaunchSpreadsheetView/index.ts","../../../plugins/sv-inspector/src/SvInspectorView/components/CircularViewOptions.tsx","../../../plugins/sv-inspector/src/SvInspectorView/components/SvInspectorView.tsx","../../../plugins/sv-inspector/src/SvInspectorView/models/adhocFeatureUtils.ts","../../../plugins/sv-inspector/src/SvInspectorView/models/breakpointSplitViewFromTableRow.ts","../../../plugins/sv-inspector/src/SvInspectorView/index.ts","../../../plugins/sv-inspector/src/index.ts","../../../plugins/sv-inspector/src/SvInspectorView/models/SvInspectorView.ts","../../../plugins/sv-inspector/src/LaunchSvInspectorView/index.ts","../../../plugins/hic/src/HicRenderer/components/HicRendering.tsx","../../../plugins/hic/src/HicRenderer/configSchema.ts","../../../plugins/hic/src/HicRenderer/HicRenderer.tsx","../../../plugins/hic/src/LinearHicDisplay/model.ts","../../../plugins/hic/src/HicAdapter/configSchema.ts","../../../plugins/hic/src/index.ts","../../../plugins/hic/src/HicAdapter/index.ts","../../../plugins/hic/src/HicRenderer/index.ts","../../../plugins/hic/src/HicTrack/index.ts","../../../plugins/hic/src/HicTrack/configSchema.ts","../../../plugins/hic/src/LinearHicDisplay/index.ts","../../../plugins/hic/src/LinearHicDisplay/configSchema.ts","../../../plugins/trix/src/TrixTextSearchAdapter/configSchema.ts","../../../plugins/trix/src/index.ts","../../../plugins/grid-bookmark/src/GridBookmarkWidget/model.ts","../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/Highlight/Highlight.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/Highlight/OverviewHighlight.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/index.ts","../../../plugins/grid-bookmark/src/index.ts","../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/Highlight/index.tsx","corePlugins.ts"],"sourcesContent":["import { ConfigurationSchema } from '../configuration'\n\nconst configSchema = ConfigurationSchema('BaseFeatureWidget', {})\nexport { configSchema }\n","import { types, addDisposer, Instance } from 'mobx-state-tree'\nimport { autorun } from 'mobx'\n\n// locals\nimport {\n SimpleFeatureSerialized,\n localStorageGetItem,\n localStorageSetItem,\n} from '../../util'\n\nfunction localStorageGetNumber(key: string, defaultVal: number) {\n return +(localStorageGetItem(key) ?? defaultVal)\n}\n\nexport function SequenceFeatureDetailsF() {\n return types\n .model('SequenceFeatureDetails')\n .volatile(() => ({\n showCoordinatesSetting:\n localStorageGetItem('sequenceFeatureDetails-showCoordinatesSetting') ||\n 'none',\n intronBp: localStorageGetNumber('sequenceFeatureDetails-intronBp', 10),\n upDownBp: localStorageGetNumber('sequenceFeatureDetails-upDownBp', 100),\n upperCaseCDS: Boolean(\n JSON.parse(\n localStorageGetItem('sequenceFeatureDetails-upperCaseCDS') || 'true',\n ),\n ),\n charactersPerRow: 100,\n feature: undefined as SimpleFeatureSerialized | undefined,\n mode: '',\n }))\n .actions(self => ({\n /**\n * #action\n */\n setFeature(f: SimpleFeatureSerialized) {\n self.feature = f\n },\n /**\n * #action\n */\n setUpDownBp(f: number) {\n self.upDownBp = f\n },\n /**\n * #action\n */\n setIntronBp(f: number) {\n self.intronBp = f\n },\n /**\n * #action\n */\n setUpperCaseCDS(f: boolean) {\n self.upperCaseCDS = f\n },\n /**\n * #action\n */\n setShowCoordinates(f: 'none' | 'relative' | 'genomic') {\n self.showCoordinatesSetting = f\n },\n /**\n * #action\n */\n setMode(mode: string) {\n self.mode = mode\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get showCoordinates() {\n return self.showCoordinatesSetting !== 'none'\n },\n /**\n * #getter\n */\n get showGenomicCoordsOption() {\n return (\n self.mode === 'gene' ||\n self.mode === 'gene_updownstream' ||\n self.mode === 'genomic' ||\n self.mode === 'genomic_sequence_updownstream'\n )\n },\n /**\n * #getter\n */\n get hasCDS() {\n return self.feature?.subfeatures?.some(sub => sub.type === 'CDS')\n },\n /**\n * #getter\n */\n get hasExon() {\n return self.feature?.subfeatures?.some(sub => sub.type === 'exon')\n },\n /**\n * #getter\n */\n get hasExonOrCDS() {\n return this.hasExon || this.hasCDS\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n localStorageSetItem(\n 'sequenceFeatureDetails-upDownBp',\n JSON.stringify(self.upDownBp),\n )\n localStorageSetItem(\n 'sequenceFeatureDetails-intronBp',\n JSON.stringify(self.intronBp),\n )\n localStorageSetItem(\n 'sequenceFeatureDetails-upperCaseCDS',\n JSON.stringify(self.upperCaseCDS),\n )\n localStorageSetItem(\n 'sequenceFeatureDetails-showCoordinatesSetting',\n self.showCoordinatesSetting,\n )\n }),\n )\n addDisposer(\n self,\n autorun(() => {\n self.setMode(\n self.hasCDS ? 'cds' : self.hasExon ? 'cdna' : 'genomic',\n )\n }),\n )\n },\n }))\n}\n\nexport type SequenceFeatureDetailsStateModel = ReturnType<\n typeof SequenceFeatureDetailsF\n>\nexport type SequenceFeatureDetailsModel =\n Instance<SequenceFeatureDetailsStateModel>\n","import { types, addDisposer, Instance } from 'mobx-state-tree'\nimport { autorun } from 'mobx'\nimport clone from 'clone'\n\n// locals\nimport PluginManager from '../PluginManager'\nimport { getConf } from '../configuration'\nimport { getSession } from '../util'\nimport { ElementId } from '../util/types/mst'\nimport { SequenceFeatureDetailsF } from './SequenceFeatureDetails/model'\n\ninterface Feat {\n subfeatures?: Record<string, unknown>[]\n}\n\nfunction formatSubfeatures(\n obj: Feat,\n depth: number,\n parse: (obj: Record<string, unknown>) => void,\n currentDepth = 0,\n returnObj = {} as Record<string, unknown>,\n) {\n if (depth <= currentDepth) {\n return\n }\n obj.subfeatures?.map(sub => {\n formatSubfeatures(sub, depth, parse, currentDepth + 1, returnObj)\n parse(sub)\n })\n}\n\n/**\n * #stateModel BaseFeatureWidget\n * displays data about features, allowing configuration callbacks to modify the\n * contents of what is displayed\n *\n * see: formatDetails-\\>feature,formatDetails-\\>subfeatures\n */\nexport function stateModelFactory(pluginManager: PluginManager) {\n return types\n .model('BaseFeatureWidget', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('BaseFeatureWidget'),\n /**\n * #property\n */\n featureData: types.frozen(),\n /**\n * #property\n */\n formattedFields: types.frozen(),\n /**\n * #property\n */\n unformattedFeatureData: types.frozen(),\n /**\n * #property\n */\n view: types.safeReference(\n pluginManager.pluggableMstType('view', 'stateModel'),\n ),\n /**\n * #property\n */\n track: types.safeReference(\n pluginManager.pluggableMstType('track', 'stateModel'),\n ),\n /**\n * #property\n */\n trackId: types.maybe(types.string),\n /**\n * #property\n */\n trackType: types.maybe(types.string),\n /**\n * #property\n */\n maxDepth: types.maybe(types.number),\n\n /**\n * #property\n */\n sequenceFeatureDetails: types.optional(SequenceFeatureDetailsF(), {}),\n })\n .volatile(() => ({\n error: undefined as unknown,\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n setFeatureData(featureData: Record<string, unknown>) {\n self.unformattedFeatureData = featureData\n },\n /**\n * #action\n */\n clearFeatureData() {\n self.featureData = undefined\n },\n /**\n * #action\n */\n setFormattedData(feat: Record<string, unknown>) {\n self.featureData = feat\n },\n /**\n * #action\n */\n setExtra(type?: string, trackId?: string, maxDepth?: number) {\n self.trackId = trackId\n self.trackType = type\n self.maxDepth = maxDepth\n },\n /**\n * #action\n */\n setError(e: unknown) {\n self.error = e\n },\n }))\n .actions(self => ({\n afterCreate() {\n addDisposer(\n self,\n autorun(() => {\n try {\n const { unformattedFeatureData, track } = self\n const session = getSession(self)\n if (track) {\n self.setExtra(\n track.type,\n track.configuration.trackId,\n getConf(track, ['formatDetails', 'maxDepth']),\n )\n }\n if (unformattedFeatureData) {\n const feature = clone(unformattedFeatureData)\n\n const combine = (\n arg2: string,\n feature: Record<string, unknown>,\n ) => ({\n ...getConf(session, ['formatDetails', arg2], { feature }),\n ...getConf(track, ['formatDetails', arg2], { feature }),\n })\n\n if (track) {\n feature.__jbrowsefmt = combine('feature', feature)\n\n formatSubfeatures(\n feature,\n getConf(track, ['formatDetails', 'depth']),\n sub => {\n sub.__jbrowsefmt = combine('subfeatures', sub)\n },\n )\n }\n\n self.setFormattedData(feature)\n }\n } catch (e) {\n console.error(e)\n self.setError(e)\n }\n }),\n )\n },\n }))\n .preProcessSnapshot(snap => {\n // @ts-expect-error\n const { featureData, finalizedFeatureData, ...rest } = snap\n return {\n unformattedFeatureData: featureData,\n featureData: finalizedFeatureData,\n ...rest,\n }\n })\n .postProcessSnapshot(snap => {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n const { unformattedFeatureData, featureData, ...rest } = snap as Omit<\n typeof snap,\n symbol\n >\n // finalizedFeatureData avoids running formatter twice if loading from\n // snapshot\n return {\n // replacing undefined with null helps with allowing fields to be\n // hidden, setting null is not allowed by jexl so we set it to\n // undefined to hide. see config guide. this replacement happens both\n // here and when displaying the featureData in base feature widget\n finalizedFeatureData: JSON.parse(\n JSON.stringify(featureData, (_, v) => (v === undefined ? null : v)),\n ),\n ...rest,\n }\n })\n}\n\nexport type BaseFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>\nexport type BaseFeatureWidgetModel = Instance<BaseFeatureWidgetStateModel>\n","import PluginManager from './PluginManager'\nimport { AnyConfigurationSchemaType } from './configuration'\n\n/**\n * base class for a JBrowse plugin\n */\nexport default abstract class Plugin {\n abstract name: string\n\n url?: string\n\n version?: string\n\n install(_pluginManager: PluginManager): void {}\n\n configure(_pluginManager: PluginManager): void {}\n\n configurationSchema?: AnyConfigurationSchemaType\n}\n\nexport type PluginConstructor = new (...args: unknown[]) => Plugin\n","import { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\n\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\n\nexport default class CoreGetRefNames extends RpcMethodType {\n name = 'CoreGetRefNames'\n\n async execute(\n args: {\n sessionId: string\n signal: RemoteAbortSignal\n adapterConfig: Record<string, unknown>\n },\n rpcDriver: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n const { sessionId, adapterConfig } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n\n if (isFeatureAdapter(dataAdapter)) {\n return dataAdapter.getRefNames(deserializedArgs)\n }\n return []\n }\n}\n","import RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\nimport { RenderArgs } from './util'\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { renameRegionsIfNeeded, getLayoutId } from '../../util'\nimport { RenderArgsSerialized } from './util'\n\n/**\n * fetches features from an adapter and call a renderer with them\n */\nexport default class CoreGetFeatureDetails extends RpcMethodType {\n name = 'CoreGetFeatureDetails'\n\n async serializeArguments(args: RenderArgs, rpcDriver: string) {\n const { rootModel } = this.pluginManager\n const assemblyManager = rootModel!.session!.assemblyManager\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, args)\n const superArgs = (await super.serializeArguments(\n renamedArgs,\n rpcDriver,\n )) as RenderArgs\n if (rpcDriver === 'MainThreadRpcDriver') {\n return superArgs\n }\n const { rendererType } = args\n const RendererType = this.pluginManager.getRendererType(rendererType)!\n // @ts-expect-error\n return RendererType.serializeArgsInClient(superArgs)\n }\n\n async execute(\n args: RenderArgsSerialized & { signal?: RemoteAbortSignal },\n rpcDriver: string,\n ) {\n let deserializedArgs = args\n if (rpcDriver !== 'MainThreadRpcDriver') {\n deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n }\n const { rendererType, featureId } = deserializedArgs\n const RendererType = this.pluginManager.getRendererType(rendererType)!\n\n return {\n // @ts-expect-error\n feature: RendererType.sessions[getLayoutId(args)]?.cachedLayout.layout\n .getDataByID(featureId)\n ?.toJSON(),\n }\n }\n}\n","import { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\n\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\n\nexport default class CoreGetMetadata extends RpcMethodType {\n name = 'CoreGetMetadata'\n\n async execute(\n args: {\n sessionId: string\n signal: RemoteAbortSignal\n adapterConfig: Record<string, unknown>\n },\n rpcDriver: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n const { sessionId, adapterConfig } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n return isFeatureAdapter(dataAdapter)\n ? dataAdapter.getMetadata(deserializedArgs)\n : null\n }\n}\n","import { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\n\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\n\nexport default class CoreGetFileInfo extends RpcMethodType {\n name = 'CoreGetInfo'\n\n async execute(\n args: {\n sessionId: string\n signal: RemoteAbortSignal\n adapterConfig: Record<string, unknown>\n },\n rpcDriver: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n const { sessionId, adapterConfig } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n return isFeatureAdapter(dataAdapter)\n ? dataAdapter.getHeader(deserializedArgs)\n : null\n }\n}\n","import { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\n\n// locals\nimport { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\nimport { RenderArgs } from './util'\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\nimport { renameRegionsIfNeeded, Region } from '../../util'\nimport SimpleFeature, {\n SimpleFeatureSerialized,\n} from '../../util/simpleFeature'\n\nexport default class CoreGetFeatures extends RpcMethodType {\n name = 'CoreGetFeatures'\n\n async deserializeReturn(\n feats: SimpleFeatureSerialized[],\n args: unknown,\n rpcDriver: string,\n ) {\n const superDeserialized = (await super.deserializeReturn(\n feats,\n args,\n rpcDriver,\n )) as SimpleFeatureSerialized[]\n return superDeserialized.map(feat => new SimpleFeature(feat))\n }\n\n async serializeArguments(args: RenderArgs, rpcDriver: string) {\n const { rootModel } = this.pluginManager\n const assemblyManager = rootModel!.session!.assemblyManager\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, args)\n return super.serializeArguments(\n renamedArgs,\n rpcDriver,\n ) as Promise<RenderArgs>\n }\n\n async execute(\n args: {\n sessionId: string\n regions: Region[]\n adapterConfig: Record<string, unknown>\n signal?: RemoteAbortSignal\n\n opts?: any\n },\n rpcDriver: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n const { signal, sessionId, adapterConfig, regions, opts } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n if (!isFeatureAdapter(dataAdapter)) {\n throw new Error('Adapter does not support retrieving features')\n }\n const ret = dataAdapter.getFeaturesInMultipleRegions(regions, {\n ...opts,\n signal,\n })\n const r = await firstValueFrom(ret.pipe(toArray()))\n return r.map(f => f.toJSON())\n }\n}\n","import { ServerSideRendererType } from '../../pluggableElementTypes'\nimport {\n RenderArgs as ServerSideRenderArgs,\n RenderArgsSerialized as ServerSideRenderArgsSerialized,\n} from '../../pluggableElementTypes/renderers/ServerSideRendererType'\nimport { Region } from '../../util'\n\nexport interface RenderArgs extends ServerSideRenderArgs {\n adapterConfig: Record<string, unknown>\n rendererType: string\n}\n\nexport interface RenderArgsSerialized extends ServerSideRenderArgsSerialized {\n assemblyName: string\n regions: Region[]\n adapterConfig: Record<string, unknown>\n rendererType: string\n}\n\nexport function validateRendererType<T>(\n rendererType: string,\n RendererType: T,\n): ServerSideRendererType {\n // @ts-expect-error\n if (!RendererType.ReactComponent) {\n throw new Error(\n `renderer ${rendererType} has no ReactComponent, it may not be completely implemented yet`,\n )\n }\n return RendererType as unknown as ServerSideRendererType\n}\n\nexport {\n type RenderResults,\n type ResultsSerialized,\n} from '../../pluggableElementTypes/renderers/ServerSideRendererType'\n","import RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\nimport {\n RenderResults,\n ResultsSerialized,\n RenderArgs,\n RenderArgsSerialized,\n validateRendererType,\n} from './util'\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { checkAbortSignal, renameRegionsIfNeeded } from '../../util'\n\n/**\n * fetches features from an adapter and call a renderer with them\n */\nexport default class CoreRender extends RpcMethodType {\n name = 'CoreRender'\n\n async serializeArguments(args: RenderArgs, rpcDriver: string) {\n const { rootModel } = this.pluginManager\n const assemblyManager = rootModel!.session!.assemblyManager\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, args)\n\n const superArgs = (await super.serializeArguments(\n renamedArgs,\n rpcDriver,\n )) as RenderArgs\n if (rpcDriver === 'MainThreadRpcDriver') {\n return superArgs\n }\n\n const { rendererType } = args\n\n const RendererType = validateRendererType(\n rendererType,\n this.pluginManager.getRendererType(rendererType),\n )\n\n return RendererType.serializeArgsInClient(superArgs)\n }\n\n async execute(\n args: RenderArgsSerialized & { signal?: RemoteAbortSignal },\n rpcDriver: string,\n ) {\n let deserializedArgs = args\n if (rpcDriver !== 'MainThreadRpcDriver') {\n deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n }\n const { sessionId, rendererType, signal } = deserializedArgs\n if (!sessionId) {\n throw new Error('must pass a unique session id')\n }\n\n checkAbortSignal(signal)\n\n const RendererType = validateRendererType(\n rendererType,\n this.pluginManager.getRendererType(rendererType),\n )\n\n const result =\n rpcDriver === 'MainThreadRpcDriver'\n ? await RendererType.render(deserializedArgs)\n : await RendererType.renderInWorker(deserializedArgs)\n\n checkAbortSignal(signal)\n return result\n }\n\n async deserializeReturn(\n serializedReturn: RenderResults | ResultsSerialized,\n args: RenderArgs,\n rpcDriver: string,\n ): Promise<unknown> {\n const des = await super.deserializeReturn(serializedReturn, args, rpcDriver)\n if (rpcDriver === 'MainThreadRpcDriver') {\n return des\n }\n\n const { rendererType } = args\n const RendererType = validateRendererType(\n rendererType,\n this.pluginManager.getRendererType(rendererType),\n )\n return RendererType.deserializeResultsInClient(\n des as ResultsSerialized,\n args,\n )\n }\n}\n","import RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\nimport { freeAdapterResources } from '../../data_adapters/dataAdapterCache'\n\n/**\n * free up any resources (e.g. cached adapter objects)\n * that are only associated with the given track ID.\n *\n * returns number of objects deleted\n */\nexport default class CoreFreeResources extends RpcMethodType {\n name = 'CoreFreeResources'\n\n async execute(specification: Record<string, unknown>) {\n let deleteCount = 0\n\n deleteCount += freeAdapterResources(specification)\n\n // pass the freeResources hint along to all the renderers as well\n this.pluginManager.getRendererTypes().forEach(renderer => {\n const count = renderer.freeResources(/* specification */)\n if (count) {\n deleteCount += count\n }\n })\n\n return deleteCount\n }\n async serializeArguments(args: Record<string, unknown>, _rpcDriver: string) {\n return args\n }\n}\n","import { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport RpcMethodType from '../../pluggableElementTypes/RpcMethodType'\nimport { RenderArgs } from './util'\nimport { RemoteAbortSignal } from '../remoteAbortSignals'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\nimport { renameRegionsIfNeeded, Region } from '../../util'\n\nexport default class CoreGetFeatureDensityStats extends RpcMethodType {\n name = 'CoreGetFeatureDensityStats'\n\n async serializeArguments(\n args: RenderArgs & {\n signal?: AbortSignal\n statusCallback?: (arg: string) => void\n },\n rpcDriver: string,\n ) {\n const { rootModel } = this.pluginManager\n const assemblyManager = rootModel!.session!.assemblyManager\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, {\n ...args,\n filters: args.filters?.toJSON().filters,\n })\n\n return super.serializeArguments(renamedArgs, rpcDriver)\n }\n\n async execute(\n args: {\n adapterConfig: Record<string, unknown>\n regions: Region[]\n signal?: RemoteAbortSignal\n headers?: Record<string, string>\n sessionId: string\n },\n rpcDriver: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n const { adapterConfig, sessionId, regions } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n\n if (!isFeatureAdapter(dataAdapter)) {\n throw new Error('Adapter does not support retrieving features')\n }\n return dataAdapter.getMultiRegionFeatureDensityStats(\n regions,\n deserializedArgs,\n )\n }\n}\n","import { ConfigurationSchema } from '../../configuration'\n\n/**\n * #config CytobandAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'CytobandAdapter',\n {\n /**\n * #slot\n */\n cytobandLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/cytoband.txt.gz' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default configSchema\n","import { lazy } from 'react'\nimport { configSchema, stateModelFactory } from './BaseFeatureWidget'\nimport Plugin from './Plugin'\nimport PluginManager from './PluginManager'\nimport * as coreRpcMethods from './rpc/coreRpcMethods'\nimport WidgetType from './pluggableElementTypes/WidgetType'\nimport CytobandAdapterF from './data_adapters/CytobandAdapter'\n\n// the core plugin, which registers types that ALL JBrowse applications are\n// expected to need.\nexport default class CorePlugin extends Plugin {\n name = 'CorePlugin'\n\n install(pluginManager: PluginManager) {\n // register all our core rpc methods\n Object.values(coreRpcMethods).forEach(RpcMethod => {\n pluginManager.addRpcMethod(() => new RpcMethod(pluginManager))\n })\n\n CytobandAdapterF(pluginManager)\n\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'BaseFeatureWidget',\n heading: 'Feature details',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(\n () => import('./BaseFeatureWidget/BaseFeatureDetail'),\n ),\n })\n })\n }\n}\n","import { AdapterType } from '../../pluggableElementTypes'\nimport PluginManager from '../../PluginManager'\nimport configSchema from './configSchema'\n\nexport default function CytobandAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'CytobandAdapter',\n configSchema,\n getAdapterClass: () => import('./CytobandAdapter').then(f => f.default),\n }),\n )\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport {\n isModelType,\n isType,\n types,\n IAnyType,\n IAnyModelType,\n} from 'mobx-state-tree'\n\n// Pluggable elements\nimport PluggableElementBase from './pluggableElementTypes/PluggableElementBase'\nimport RendererType from './pluggableElementTypes/renderers/RendererType'\nimport AdapterType from './pluggableElementTypes/AdapterType'\nimport TrackType from './pluggableElementTypes/TrackType'\nimport DisplayType from './pluggableElementTypes/DisplayType'\nimport ViewType from './pluggableElementTypes/ViewType'\nimport WidgetType from './pluggableElementTypes/WidgetType'\nimport ConnectionType from './pluggableElementTypes/ConnectionType'\nimport RpcMethodType from './pluggableElementTypes/RpcMethodType'\nimport InternetAccountType from './pluggableElementTypes/InternetAccountType'\nimport TextSearchAdapterType from './pluggableElementTypes/TextSearchAdapterType'\nimport AddTrackWorkflowType from './pluggableElementTypes/AddTrackWorkflowType'\n\nimport {\n ConfigurationSchema,\n isBareConfigurationSchemaType,\n} from './configuration'\n\nimport Plugin from './Plugin'\nimport ReExports from './ReExports'\n\nimport {\n PluggableElementType,\n PluggableElementMember,\n} from './pluggableElementTypes'\nimport { AbstractRootModel } from './util'\nimport CorePlugin from './CorePlugin'\nimport createJexlInstance from './util/jexl'\nimport { PluginDefinition } from './PluginLoader'\n\n// helper class that keeps groups of callbacks that are then run in a specified\n// order by group\nclass PhasedScheduler<PhaseName extends string> {\n phaseCallbacks = new Map<PhaseName, Function[]>()\n\n phaseOrder: PhaseName[] = []\n\n constructor(...phaseOrder: PhaseName[]) {\n this.phaseOrder = phaseOrder\n }\n\n add(phase: PhaseName, callback: Function) {\n if (!this.phaseOrder.includes(phase)) {\n throw new Error(`unknown phase ${phase}`)\n }\n let phaseCallbacks = this.phaseCallbacks.get(phase)\n if (!phaseCallbacks) {\n phaseCallbacks = []\n this.phaseCallbacks.set(phase, phaseCallbacks)\n }\n phaseCallbacks.push(callback)\n }\n\n run() {\n this.phaseOrder.forEach(phaseName => {\n this.phaseCallbacks.get(phaseName)?.forEach(callback => callback())\n })\n }\n}\n\ntype PluggableElementTypeGroup =\n | 'renderer'\n | 'adapter'\n | 'display'\n | 'track'\n | 'connection'\n | 'view'\n | 'widget'\n | 'rpc method'\n | 'internet account'\n | 'text search adapter'\n | 'add track workflow'\n\n/** internal class that holds the info for a certain element type */\nclass TypeRecord<ElementClass extends PluggableElementBase> {\n registeredTypes: Record<string, ElementClass> = {}\n\n constructor(\n public typeName: string,\n public baseClass:\n | (new (...args: unknown[]) => ElementClass)\n // covers abstract class case\n | (Function & {\n prototype: ElementClass\n }),\n ) {}\n\n add(name: string, t: ElementClass) {\n this.registeredTypes[name] = t\n }\n\n has(name: string) {\n return name in this.registeredTypes\n }\n\n get(name: string) {\n if (!this.has(name)) {\n throw new Error(\n `${this.typeName} '${name}' not found, perhaps its plugin is not loaded or its plugin has not added it.`,\n )\n }\n return this.registeredTypes[name]\n }\n\n all() {\n return Object.values(this.registeredTypes)\n }\n}\n\ntype AnyFunction = (...args: any) => any\n\n/**\n * free-form string-to-unknown mapping of metadata related to the instance of\n * this plugin. `isCore` is typically set to `Boolean(true)` if the plugin was\n * loaded as part of the \"core\" set of plugins for this application. Can also\n * use this metadata to stash other things about why the plugin is loaded, such\n * as where it came from, what plugin depends on it, etc.\n */\nexport type PluginMetadata = Record<string, unknown>\n\nexport interface PluginLoadRecord {\n metadata?: PluginMetadata\n plugin: Plugin\n}\nexport interface RuntimePluginLoadRecord extends PluginLoadRecord {\n definition: PluginDefinition\n}\n\nexport default class PluginManager {\n plugins: Plugin[] = []\n\n jexl = createJexlInstance()\n\n pluginMetadata: Record<string, PluginMetadata> = {}\n\n runtimePluginDefinitions: PluginDefinition[] = []\n\n elementCreationSchedule = new PhasedScheduler<PluggableElementTypeGroup>(\n 'renderer',\n 'adapter',\n 'text search adapter',\n 'display',\n 'track',\n 'connection',\n 'view',\n 'widget',\n 'rpc method',\n 'internet account',\n 'add track workflow',\n ) as PhasedScheduler<PluggableElementTypeGroup> | undefined\n\n rendererTypes = new TypeRecord('RendererType', RendererType)\n\n adapterTypes = new TypeRecord('AdapterType', AdapterType)\n\n textSearchAdapterTypes = new TypeRecord(\n 'TextSearchAdapterType',\n TextSearchAdapterType,\n )\n\n trackTypes = new TypeRecord('TrackType', TrackType)\n\n displayTypes = new TypeRecord('DisplayType', DisplayType)\n\n connectionTypes = new TypeRecord('ConnectionType', ConnectionType)\n\n viewTypes = new TypeRecord('ViewType', ViewType)\n\n widgetTypes = new TypeRecord('WidgetType', WidgetType)\n\n rpcMethods = new TypeRecord('RpcMethodType', RpcMethodType)\n\n addTrackWidgets = new TypeRecord('AddTrackWorkflow', AddTrackWorkflowType)\n\n internetAccountTypes = new TypeRecord(\n 'InternetAccountType',\n InternetAccountType,\n )\n\n configured = false\n\n rootModel?: AbstractRootModel\n\n extensionPoints = new Map<string, Function[]>()\n\n constructor(initialPlugins: (Plugin | PluginLoadRecord)[] = []) {\n // add the core plugin\n this.addPlugin({\n plugin: new CorePlugin(),\n metadata: {\n isCore: true,\n },\n })\n\n // add all the initial plugins\n initialPlugins.forEach(plugin => {\n this.addPlugin(plugin)\n })\n }\n\n pluginConfigurationSchemas() {\n const configurationSchemas: Record<string, unknown> = {}\n this.plugins.forEach(plugin => {\n if (plugin.configurationSchema) {\n configurationSchemas[plugin.name] = plugin.configurationSchema\n }\n })\n return configurationSchemas\n }\n\n addPlugin(load: Plugin | PluginLoadRecord | RuntimePluginLoadRecord) {\n if (this.configured) {\n throw new Error('JBrowse already configured, cannot add plugins')\n }\n\n // check for availability of 'install' and 'configure' as a proxy for being\n // an 'instanceof Plugin'\n const [plugin, metadata = {}] =\n 'install' in load && 'configure' in load\n ? [load, {}]\n : [load.plugin, load.metadata]\n\n if (this.plugins.includes(plugin)) {\n throw new Error('plugin already installed')\n }\n\n this.pluginMetadata[plugin.name] = metadata\n if ('definition' in load) {\n this.runtimePluginDefinitions.push(load.definition)\n }\n plugin.install(this)\n this.plugins.push(plugin)\n return this\n }\n\n getPlugin(name: string) {\n return this.plugins.find(p => p.name === name)\n }\n\n hasPlugin(name: string) {\n return this.getPlugin(name) !== undefined\n }\n\n createPluggableElements() {\n // run the creation callbacks for each element type in order.\n // see elementCreationSchedule above for the creation order\n if (this.elementCreationSchedule) {\n this.elementCreationSchedule.run()\n this.elementCreationSchedule = undefined\n }\n return this\n }\n\n setRootModel(rootModel: AbstractRootModel) {\n this.rootModel = rootModel\n }\n\n configure() {\n if (this.configured) {\n throw new Error('already configured')\n }\n\n this.plugins.forEach(plugin => {\n plugin.configure(this)\n })\n\n this.configured = true\n\n return this\n }\n\n getElementTypeRecord(\n groupName: PluggableElementTypeGroup,\n ): TypeRecord<PluggableElementBase> {\n switch (groupName) {\n case 'adapter':\n return this.adapterTypes\n case 'text search adapter':\n return this.textSearchAdapterTypes\n case 'connection':\n return this.connectionTypes\n case 'widget':\n return this.widgetTypes\n case 'renderer':\n return this.rendererTypes\n case 'display':\n return this.displayTypes\n case 'track':\n return this.trackTypes\n case 'view':\n return this.viewTypes\n case 'rpc method':\n return this.rpcMethods\n case 'internet account':\n return this.internetAccountTypes\n case 'add track workflow':\n return this.addTrackWidgets\n default:\n throw new Error(`invalid element type '${groupName}'`)\n }\n }\n\n addElementType(\n groupName: PluggableElementTypeGroup,\n creationCallback: (pluginManager: PluginManager) => PluggableElementType,\n ) {\n if (typeof creationCallback !== 'function') {\n throw new Error(\n 'must provide a callback function that returns the new type object',\n )\n }\n const typeRecord = this.getElementTypeRecord(groupName)\n\n this.elementCreationSchedule?.add(groupName, () => {\n const newElement = creationCallback(this)\n if (!newElement.name) {\n throw new Error(`cannot add a ${groupName} with no name`)\n }\n\n if (typeRecord.has(newElement.name)) {\n throw new Error(\n `${groupName} ${newElement.name} already registered, cannot register it again`,\n )\n }\n\n typeRecord.add(\n newElement.name,\n this.evaluateExtensionPoint(\n 'Core-extendPluggableElement',\n newElement,\n ) as PluggableElementType,\n )\n })\n\n return this\n }\n\n getElementType(groupName: PluggableElementTypeGroup, typeName: string) {\n return this.getElementTypeRecord(groupName).get(typeName)\n }\n\n getElementTypesInGroup(groupName: PluggableElementTypeGroup) {\n return this.getElementTypeRecord(groupName).all()\n }\n\n getTrackElements() {\n return this.getElementTypesInGroup('track') as TrackType[]\n }\n\n getConnectionElements() {\n return this.getElementTypesInGroup('connection') as ConnectionType[]\n }\n\n getAddTrackWorkflowElements() {\n return this.getElementTypesInGroup(\n 'add track workflow',\n ) as AddTrackWorkflowType[]\n }\n\n getRpcElements() {\n return this.getElementTypesInGroup('rpc method') as RpcMethodType[]\n }\n\n getDisplayElements() {\n return this.getElementTypesInGroup('display') as DisplayType[]\n }\n\n getAdapterElements() {\n return this.getElementTypesInGroup('adapter') as AdapterType[]\n }\n\n /** get a MST type for the union of all specified pluggable MST types */\n pluggableMstType(\n groupName: PluggableElementTypeGroup,\n fieldName: PluggableElementMember,\n fallback: IAnyType = types.maybe(types.null),\n ) {\n const pluggableTypes = this.getElementTypeRecord(groupName)\n .all()\n // @ts-expect-error\n .map(t => t[fieldName])\n .filter(t => isType(t) && isModelType(t)) as IAnyType[]\n\n // try to smooth over the case when no types are registered, mostly\n // encountered in tests\n if (pluggableTypes.length === 0 && typeof jest === 'undefined') {\n console.warn(\n `No pluggable types found matching ('${groupName}','${fieldName}')`,\n )\n return fallback\n }\n return types.union(...pluggableTypes)\n }\n\n /** get a MST type for the union of all specified pluggable config schemas */\n pluggableConfigSchemaType(\n typeGroup: PluggableElementTypeGroup,\n fieldName: PluggableElementMember = 'configSchema',\n ) {\n const pluggableTypes = this.getElementTypeRecord(typeGroup)\n .all()\n // @ts-expect-error\n .map(t => t[fieldName])\n .filter(t => isBareConfigurationSchemaType(t)) as IAnyType[]\n\n if (pluggableTypes.length === 0) {\n pluggableTypes.push(ConfigurationSchema('Null', {}))\n }\n return types.union(...pluggableTypes) as IAnyModelType\n }\n\n jbrequireCache = new Map()\n\n lib = ReExports\n\n load = <FTYPE extends AnyFunction>(lib: FTYPE): ReturnType<FTYPE> => {\n if (!this.jbrequireCache.has(lib)) {\n this.jbrequireCache.set(lib, lib(this))\n }\n return this.jbrequireCache.get(lib)\n }\n\n /**\n * Get the re-exported version of the given package name.\n * Throws an error if the package is not re-exported by the plugin manager.\n *\n * @returns the library's default export\n */\n jbrequire = (\n lib: keyof typeof ReExports | AnyFunction | { default: AnyFunction },\n ): any => {\n if (typeof lib === 'string') {\n const pack = this.lib[lib]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!pack) {\n throw new TypeError(\n `No jbrequire re-export defined for package '${lib}'. If this package must be shared between plugins, add it to ReExports.js. If it does not need to be shared, just import it normally.`,\n )\n }\n return pack\n }\n\n if (typeof lib === 'function') {\n return this.load(lib)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (lib.default) {\n return this.jbrequire(lib.default)\n }\n\n throw new TypeError(\n 'lib passed to jbrequire must be either a string or a function',\n )\n }\n\n getRendererType(typeName: string) {\n return this.rendererTypes.get(typeName)\n }\n\n getRendererTypes(): RendererType[] {\n return this.rendererTypes.all()\n }\n\n getAdapterType(typeName: string) {\n return this.adapterTypes.get(typeName)\n }\n\n getTextSearchAdapterType(typeName: string) {\n return this.textSearchAdapterTypes.get(typeName)\n }\n\n getTrackType(typeName: string) {\n return this.trackTypes.get(typeName)\n }\n\n getDisplayType(typeName: string) {\n return this.displayTypes.get(typeName)\n }\n\n getViewType(typeName: string) {\n return this.viewTypes.get(typeName)\n }\n\n getAddTrackWorkflow(typeName: string) {\n return this.addTrackWidgets.get(typeName)\n }\n\n getWidgetType(typeName: string) {\n return this.widgetTypes.get(typeName)\n }\n\n getConnectionType(typeName: string) {\n return this.connectionTypes.get(typeName)\n }\n\n getRpcMethodType(methodName: string) {\n return this.rpcMethods.get(methodName)\n }\n\n getInternetAccountType(name: string) {\n return this.internetAccountTypes.get(name)\n }\n\n addRendererType(cb: (pm: PluginManager) => RendererType) {\n return this.addElementType('renderer', cb)\n }\n\n addAdapterType(cb: (pm: PluginManager) => AdapterType) {\n return this.addElementType('adapter', cb)\n }\n\n addTextSearchAdapterType(cb: (pm: PluginManager) => TextSearchAdapterType) {\n return this.addElementType('text search adapter', cb)\n }\n\n addTrackType(cb: (pm: PluginManager) => TrackType) {\n // Goes through the already-created displays and registers the ones that\n // specify this track type\n const callback = () => {\n const track = cb(this)\n const displays = this.getElementTypesInGroup('display') as DisplayType[]\n displays.forEach(display => {\n // track may have already added the displayType in its cb\n if (\n display.trackType === track.name &&\n !track.displayTypes.includes(display)\n ) {\n track.addDisplayType(display)\n }\n })\n return track\n }\n return this.addElementType('track', callback)\n }\n\n addDisplayType(cb: (pluginManager: PluginManager) => DisplayType) {\n return this.addElementType('display', cb)\n }\n\n addViewType(cb: (pluginManager: PluginManager) => ViewType) {\n const callback = () => {\n const newView = cb(this)\n const displays = this.getElementTypesInGroup('display') as DisplayType[]\n displays.forEach(display => {\n // view may have already added the displayType in its callback\n // see ViewType for description of extendedName\n if (\n (display.viewType === newView.name ||\n display.viewType === newView.extendedName) &&\n !newView.displayTypes.includes(display)\n ) {\n newView.addDisplayType(display)\n }\n })\n return newView\n }\n return this.addElementType('view', callback)\n }\n\n addWidgetType(cb: (pm: PluginManager) => WidgetType) {\n return this.addElementType('widget', cb)\n }\n\n addConnectionType(cb: (pm: PluginManager) => ConnectionType) {\n return this.addElementType('connection', cb)\n }\n\n addRpcMethod(cb: (pm: PluginManager) => RpcMethodType) {\n return this.addElementType('rpc method', cb)\n }\n\n addInternetAccountType(cb: (pm: PluginManager) => InternetAccountType) {\n return this.addElementType('internet account', cb)\n }\n\n addAddTrackWorkflowType(cb: (pm: PluginManager) => AddTrackWorkflowType) {\n return this.addElementType('add track workflow', cb)\n }\n\n addToExtensionPoint<T>(\n extensionPointName: string,\n callback: (extendee: T, props: Record<string, unknown>) => T,\n ) {\n let callbacks = this.extensionPoints.get(extensionPointName)\n if (!callbacks) {\n callbacks = []\n this.extensionPoints.set(extensionPointName, callbacks)\n }\n callbacks.push(callback)\n }\n\n evaluateExtensionPoint(\n extensionPointName: string,\n extendee: unknown,\n props?: Record<string, unknown>,\n ) {\n const callbacks = this.extensionPoints.get(extensionPointName)\n let accumulator = extendee\n if (callbacks) {\n for (const callback of callbacks) {\n try {\n accumulator = callback(accumulator, props)\n } catch (error) {\n console.error(error)\n }\n }\n }\n return accumulator\n }\n\n async evaluateAsyncExtensionPoint(\n extensionPointName: string,\n extendee: unknown,\n props?: Record<string, unknown>,\n ) {\n const callbacks = this.extensionPoints.get(extensionPointName)\n let accumulator = extendee\n if (callbacks) {\n for (const callback of callbacks) {\n try {\n accumulator = await callback(accumulator, props)\n } catch (error) {\n console.error(error)\n }\n }\n }\n return accumulator\n }\n}\n","/**\n * Used by plugin build systems to determine if a module is provided by JBrowse\n * globally and thus doesn't need to be bundled. A check in ./modules.tsx makes\n * sure this is in sync with the re-exported modules.\n */\nexport default [\n 'mobx',\n 'mobx-state-tree',\n 'react',\n 'react/jsx-runtime',\n 'react-dom',\n 'mobx-react',\n '@mui/x-data-grid',\n '@mui/material/utils',\n '@material-ui/core/utils',\n 'tss-react/mui',\n '@material-ui/core',\n '@mui/material',\n\n '@mui/material/styles',\n '@material-ui/core/styles',\n '@material-ui/core/Accordion',\n '@material-ui/core/AccordionActions',\n '@material-ui/core/AccordionDetails',\n '@material-ui/core/Alert',\n '@material-ui/core/AlertTitle',\n '@material-ui/core/Autocomplete',\n '@material-ui/core/Avatar',\n '@material-ui/core/AvatarGroup',\n '@material-ui/core/Backdrop',\n '@material-ui/core/Badge',\n '@material-ui/core/Box',\n '@material-ui/core/Breadcrumbs',\n '@material-ui/core/Button',\n '@material-ui/core/ButtonGroup',\n '@material-ui/core/Card',\n '@material-ui/core/CardActions',\n '@material-ui/core/CardActionArea',\n '@material-ui/core/CardContent',\n '@material-ui/core/CardHeader',\n '@material-ui/core/CardMedia',\n '@material-ui/core/CircularProgress',\n '@material-ui/core/Collapse',\n '@material-ui/core/ClickAwayListener',\n '@material-ui/core/Chip',\n '@material-ui/core/Checkbox',\n '@material-ui/core/Container',\n '@material-ui/core/Dialog',\n '@material-ui/core/DialogActions',\n '@material-ui/core/DialogTitle',\n '@material-ui/core/DialogContent',\n '@material-ui/core/DialogContentText',\n '@material-ui/core/Divider',\n '@material-ui/core/Drawer',\n '@material-ui/core/Fab',\n '@material-ui/core/Fade',\n '@material-ui/core/FilledInput',\n '@material-ui/core/FormLabel',\n '@material-ui/core/FormControl',\n '@material-ui/core/FormControlLabel',\n '@material-ui/core/FormHelperText',\n '@material-ui/core/FormGroup',\n '@material-ui/core/Grid',\n '@material-ui/core/Grow',\n '@material-ui/core/Icon',\n '@material-ui/core/IconButton',\n '@material-ui/core/Input',\n '@material-ui/core/InputBase',\n '@material-ui/core/InputLabel',\n '@material-ui/core/InputAdornment',\n '@material-ui/core/Link',\n '@material-ui/core/LinearProgress',\n '@material-ui/core/List',\n '@material-ui/core/ListItem',\n '@material-ui/core/ListItemAvatar',\n '@material-ui/core/ListItemSecondaryAction',\n '@material-ui/core/ListItemIcon',\n '@material-ui/core/ListSubheader',\n '@material-ui/core/ListItemText',\n '@material-ui/core/Menu',\n '@material-ui/core/MenuItem',\n '@material-ui/core/MenuList',\n '@material-ui/core/Modal',\n '@material-ui/core/NativeSelect',\n '@material-ui/core/OutlinedInput',\n '@material-ui/core/Pagination',\n '@material-ui/core/PaginationItem',\n '@material-ui/core/Paper',\n '@material-ui/core/Popover',\n '@material-ui/core/Popper',\n '@material-ui/core/Portal',\n '@material-ui/core/Radio',\n '@material-ui/core/RadioGroup',\n '@material-ui/core/Rating',\n '@material-ui/core/ScopedCssBaseline',\n '@material-ui/core/Select',\n '@material-ui/core/Skeleton',\n '@material-ui/core/Slider',\n '@material-ui/core/Snackbar',\n '@material-ui/core/SnackbarContent',\n '@material-ui/core/SpeedDial',\n '@material-ui/core/SpeedDialAction',\n '@material-ui/core/SpeedDialIcon',\n '@material-ui/core/Stack',\n '@material-ui/core/Step',\n '@material-ui/core/StepButton',\n '@material-ui/core/StepConnector',\n '@material-ui/core/StepLabel',\n '@material-ui/core/StepIcon',\n '@material-ui/core/Stepper',\n '@material-ui/core/SvgIcon',\n '@material-ui/core/Switch',\n '@material-ui/core/Tab',\n '@material-ui/core/Table',\n '@material-ui/core/TableBody',\n '@material-ui/core/TableCell',\n '@material-ui/core/TableContainer',\n '@material-ui/core/TableFooter',\n '@material-ui/core/TableHead',\n '@material-ui/core/TablePagination',\n '@material-ui/core/TableRow',\n '@material-ui/core/TableSortLabel',\n '@material-ui/core/Tabs',\n '@material-ui/core/TextField',\n '@material-ui/core/TextareaAutosize',\n '@material-ui/core/ToggleButton',\n '@material-ui/core/ToggleButtonGroup',\n '@material-ui/core/Toolbar',\n '@material-ui/core/Tooltip',\n '@material-ui/core/Typography',\n '@mui/material/Accordion',\n '@mui/material/AccordionActions',\n '@mui/material/AccordionDetails',\n '@mui/material/Alert',\n '@mui/material/AlertTitle',\n '@mui/material/Autocomplete',\n '@mui/material/Avatar',\n '@mui/material/AvatarGroup',\n '@mui/material/Backdrop',\n '@mui/material/Badge',\n '@mui/material/Box',\n '@mui/material/Breadcrumbs',\n '@mui/material/Button',\n '@mui/material/ButtonGroup',\n '@mui/material/Card',\n '@mui/material/CardActions',\n '@mui/material/CardActionArea',\n '@mui/material/CardContent',\n '@mui/material/CardHeader',\n '@mui/material/CardMedia',\n '@mui/material/CircularProgress',\n '@mui/material/Collapse',\n '@mui/material/ClickAwayListener',\n '@mui/material/Chip',\n '@mui/material/Checkbox',\n '@mui/material/Container',\n '@mui/material/Dialog',\n '@mui/material/DialogActions',\n '@mui/material/DialogTitle',\n '@mui/material/DialogContent',\n '@mui/material/DialogContentText',\n '@mui/material/Divider',\n '@mui/material/Drawer',\n '@mui/material/Fab',\n '@mui/material/Fade',\n '@mui/material/FilledInput',\n '@mui/material/FormLabel',\n '@mui/material/FormControl',\n '@mui/material/FormControlLabel',\n '@mui/material/FormHelperText',\n '@mui/material/FormGroup',\n '@mui/material/Grid',\n '@mui/material/Grow',\n '@mui/material/Icon',\n '@mui/material/IconButton',\n '@mui/material/Input',\n '@mui/material/InputBase',\n '@mui/material/InputLabel',\n '@mui/material/InputAdornment',\n '@mui/material/Link',\n '@mui/material/LinearProgress',\n '@mui/material/List',\n '@mui/material/ListItem',\n '@mui/material/ListItemAvatar',\n '@mui/material/ListItemSecondaryAction',\n '@mui/material/ListItemIcon',\n '@mui/material/ListSubheader',\n '@mui/material/ListItemText',\n '@mui/material/Menu',\n '@mui/material/MenuItem',\n '@mui/material/MenuList',\n '@mui/material/Modal',\n '@mui/material/NativeSelect',\n '@mui/material/OutlinedInput',\n '@mui/material/Pagination',\n '@mui/material/PaginationItem',\n '@mui/material/Paper',\n '@mui/material/Popover',\n '@mui/material/Popper',\n '@mui/material/Portal',\n '@mui/material/Radio',\n '@mui/material/RadioGroup',\n '@mui/material/Rating',\n '@mui/material/ScopedCssBaseline',\n '@mui/material/Select',\n '@mui/material/Skeleton',\n '@mui/material/Slider',\n '@mui/material/Snackbar',\n '@mui/material/SnackbarContent',\n '@mui/material/SpeedDial',\n '@mui/material/SpeedDialAction',\n '@mui/material/SpeedDialIcon',\n '@mui/material/Stack',\n '@mui/material/Step',\n '@mui/material/StepButton',\n '@mui/material/StepConnector',\n '@mui/material/StepLabel',\n '@mui/material/StepIcon',\n '@mui/material/Stepper',\n '@mui/material/SvgIcon',\n '@mui/material/Switch',\n '@mui/material/Tab',\n '@mui/material/Table',\n '@mui/material/TableBody',\n '@mui/material/TableCell',\n '@mui/material/TableContainer',\n '@mui/material/TableFooter',\n '@mui/material/TableHead',\n '@mui/material/TablePagination',\n '@mui/material/TableRow',\n '@mui/material/TableSortLabel',\n '@mui/material/Tabs',\n '@mui/material/TextField',\n '@mui/material/TextareaAutosize',\n '@mui/material/ToggleButton',\n '@mui/material/ToggleButtonGroup',\n '@mui/material/Toolbar',\n '@mui/material/Tooltip',\n '@mui/material/Typography',\n '@material-ui/lab/ToggleButton',\n '@material-ui/lab/ToggleButtonGroup',\n '@material-ui/lab/Autocomplete',\n '@material-ui/lab/Alert',\n '@material-ui/lab',\n '@jbrowse/core/Plugin',\n '@jbrowse/core/pluggableElementTypes',\n '@jbrowse/core/pluggableElementTypes/ViewType',\n '@jbrowse/core/pluggableElementTypes/AdapterType',\n '@jbrowse/core/pluggableElementTypes/DisplayType',\n '@jbrowse/core/pluggableElementTypes/TrackType',\n '@jbrowse/core/pluggableElementTypes/WidgetType',\n\n '@jbrowse/core/pluggableElementTypes/models',\n '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType',\n '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType',\n '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType',\n '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType',\n '@jbrowse/core/pluggableElementTypes/renderers/RendererType',\n '@jbrowse/core/configuration',\n '@jbrowse/core/util/types/mst',\n '@jbrowse/core/ui',\n '@jbrowse/core/util',\n '@jbrowse/core/util/color',\n '@jbrowse/core/util/layouts',\n '@jbrowse/core/util/tracks',\n '@jbrowse/core/util/Base1DViewModel',\n '@jbrowse/core/util/io',\n '@jbrowse/core/util/mst-reflection',\n '@jbrowse/core/util/rxjs',\n '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail',\n '@jbrowse/core/data_adapters/BaseAdapter',\n]\n","/* eslint-disable react-refresh/only-export-components */\n// this is all the stuff that the pluginManager re-exports for plugins to use\nimport React, { lazy, LazyExoticComponent, Suspense } from 'react'\nimport * as ReactJSXRuntime from 'react/jsx-runtime'\nimport * as ReactDom from 'react-dom'\nimport * as mobx from 'mobx'\nimport * as mst from 'mobx-state-tree'\nimport * as mxreact from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\n\nimport * as MUIStyles from '@mui/material/styles'\nimport * as MUIUtils from '@mui/material/utils'\nimport { useTheme } from '@mui/material'\nimport {\n useGridApiContext,\n useGridApiRef,\n useGridRootProps,\n} from '@mui/x-data-grid'\n\n// material-ui lab\nimport * as BaseAdapterExports from '../data_adapters/BaseAdapter'\n\nimport Base1DView from '../util/Base1DViewModel'\nimport * as pluggableElementTypes from '../pluggableElementTypes'\nimport ViewType from '../pluggableElementTypes/ViewType'\nimport AdapterType from '../pluggableElementTypes/AdapterType'\nimport DisplayType from '../pluggableElementTypes/DisplayType'\nimport TrackType from '../pluggableElementTypes/TrackType'\nimport WidgetType from '../pluggableElementTypes/WidgetType'\n\nimport * as pluggableElementTypeModels from '../pluggableElementTypes/models'\nimport * as ServerSideRendererType from '../pluggableElementTypes/renderers/ServerSideRendererType'\nimport CircularChordRendererType from '../pluggableElementTypes/renderers/CircularChordRendererType'\nimport * as BoxRendererType from '../pluggableElementTypes/renderers/BoxRendererType'\nimport * as FeatureRendererType from '../pluggableElementTypes/renderers/FeatureRendererType'\nimport * as RendererType from '../pluggableElementTypes/renderers/RendererType'\n\nimport * as Configuration from '../configuration'\nimport Plugin from '../Plugin'\nimport * as coreUi from '../ui'\nimport * as coreUtil from '../util'\nimport * as coreColor from '../util/color'\nimport * as coreLayouts from '../util/layouts'\nimport * as trackUtils from '../util/tracks'\nimport * as coreIo from '../util/io'\nimport * as coreMstReflection from '../util/mst-reflection'\nimport * as rxjs from '../util/rxjs'\nimport * as mstTypes from '../util/types/mst'\n\nimport reExportsList from './list'\n\nconst Entries = {\n Accordion: lazy(() => import('@mui/material/Accordion')),\n AccordionActions: lazy(() => import('@mui/material/AccordionActions')),\n AccordionDetails: lazy(() => import('@mui/material/AccordionDetails')),\n Alert: lazy(() => import('@mui/material/Alert')),\n AlertTitle: lazy(() => import('@mui/material/AlertTitle')),\n Autocomplete: lazy(() => import('@mui/material/Autocomplete')),\n Avatar: lazy(() => import('@mui/material/Avatar')),\n AvatarGroup: lazy(() => import('@mui/material/AvatarGroup')),\n Backdrop: lazy(() => import('@mui/material/Backdrop')),\n Badge: lazy(() => import('@mui/material/Badge')),\n Box: lazy(() => import('@mui/material/Box')),\n Breadcrumbs: lazy(() => import('@mui/material/Breadcrumbs')),\n Button: lazy(() => import('@mui/material/Button')),\n ButtonGroup: lazy(() => import('@mui/material/ButtonGroup')),\n Card: lazy(() => import('@mui/material/Card')),\n CardActions: lazy(() => import('@mui/material/CardActions')),\n CardActionArea: lazy(() => import('@mui/material/CardActionArea')),\n CardContent: lazy(() => import('@mui/material/CardContent')),\n CardHeader: lazy(() => import('@mui/material/CardHeader')),\n CardMedia: lazy(() => import('@mui/material/CardMedia')),\n CircularProgress: lazy(() => import('@mui/material/CircularProgress')),\n Collapse: lazy(() => import('@mui/material/Collapse')),\n ClickAwayListener: lazy(() => import('@mui/material/ClickAwayListener')),\n Chip: lazy(() => import('@mui/material/Chip')),\n Checkbox: lazy(() => import('@mui/material/Checkbox')),\n Container: lazy(() => import('@mui/material/Container')),\n Dialog: lazy(() => import('@mui/material/Dialog')),\n DialogActions: lazy(() => import('@mui/material/DialogActions')),\n DialogTitle: lazy(() => import('@mui/material/DialogTitle')),\n DialogContent: lazy(() => import('@mui/material/DialogContent')),\n DialogContentText: lazy(() => import('@mui/material/DialogContentText')),\n Divider: lazy(() => import('@mui/material/Divider')),\n Drawer: lazy(() => import('@mui/material/Drawer')),\n Fab: lazy(() => import('@mui/material/Fab')),\n Fade: lazy(() => import('@mui/material/Fade')),\n FilledInput: lazy(() => import('@mui/material/FilledInput')),\n FormLabel: lazy(() => import('@mui/material/FormLabel')),\n FormControl: lazy(() => import('@mui/material/FormControl')),\n FormControlLabel: lazy(() => import('@mui/material/FormControlLabel')),\n FormHelperText: lazy(() => import('@mui/material/FormHelperText')),\n FormGroup: lazy(() => import('@mui/material/FormGroup')),\n Grid: lazy(() => import('@mui/material/Grid')),\n Grow: lazy(() => import('@mui/material/Grow')),\n Icon: lazy(() => import('@mui/material/Icon')),\n IconButton: lazy(() => import('@mui/material/IconButton')),\n Input: lazy(() => import('@mui/material/Input')),\n InputBase: lazy(() => import('@mui/material/InputBase')),\n InputLabel: lazy(() => import('@mui/material/InputLabel')),\n InputAdornment: lazy(() => import('@mui/material/InputAdornment')),\n Link: lazy(() => import('@mui/material/Link')),\n LinearProgress: lazy(() => import('@mui/material/LinearProgress')),\n List: lazy(() => import('@mui/material/List')),\n ListItem: lazy(() => import('@mui/material/ListItem')),\n ListItemAvatar: lazy(() => import('@mui/material/ListItemAvatar')),\n ListItemSecondaryAction: lazy(\n () => import('@mui/material/ListItemSecondaryAction'),\n ),\n ListItemIcon: lazy(() => import('@mui/material/ListItemIcon')),\n ListSubheader: lazy(() => import('@mui/material/ListSubheader')),\n ListItemText: lazy(() => import('@mui/material/ListItemText')),\n Menu: lazy(() => import('@mui/material/Menu')),\n MenuItem: lazy(() => import('@mui/material/MenuItem')),\n MenuList: lazy(() => import('@mui/material/MenuList')),\n Modal: lazy(() => import('@mui/material/Modal')),\n NativeSelect: lazy(() => import('@mui/material/NativeSelect')),\n OutlinedInput: lazy(() => import('@mui/material/OutlinedInput')),\n Pagination: lazy(() => import('@mui/material/Pagination')),\n PaginationItem: lazy(() => import('@mui/material/PaginationItem')),\n Paper: lazy(() => import('@mui/material/Paper')),\n Popover: lazy(() => import('@mui/material/Popover')),\n Popper: lazy(() => import('@mui/material/Popper')),\n Portal: lazy(() => import('@mui/material/Portal')),\n Radio: lazy(() => import('@mui/material/Radio')),\n RadioGroup: lazy(() => import('@mui/material/RadioGroup')),\n Rating: lazy(() => import('@mui/material/Rating')),\n ScopedCssBaseline: lazy(() => import('@mui/material/ScopedCssBaseline')),\n Select: lazy(() => import('@mui/material/Select')),\n Skeleton: lazy(() => import('@mui/material/Skeleton')),\n Slider: lazy(() => import('@mui/material/Slider')),\n Snackbar: lazy(() => import('@mui/material/Snackbar')),\n SnackbarContent: lazy(() => import('@mui/material/SnackbarContent')),\n SpeedDial: lazy(() => import('@mui/material/SpeedDial')),\n SpeedDialAction: lazy(() => import('@mui/material/SpeedDialAction')),\n SpeedDialIcon: lazy(() => import('@mui/material/SpeedDialIcon')),\n Stack: lazy(() => import('@mui/material/Stack')),\n Step: lazy(() => import('@mui/material/Step')),\n StepButton: lazy(() => import('@mui/material/StepButton')),\n StepConnector: lazy(() => import('@mui/material/StepConnector')),\n StepLabel: lazy(() => import('@mui/material/StepLabel')),\n StepIcon: lazy(() => import('@mui/material/StepIcon')),\n Stepper: lazy(() => import('@mui/material/Stepper')),\n SvgIcon: lazy(() => import('@mui/material/SvgIcon')),\n Switch: lazy(() => import('@mui/material/Switch')),\n Tab: lazy(() => import('@mui/material/Tab')),\n Table: lazy(() => import('@mui/material/Table')),\n TableBody: lazy(() => import('@mui/material/TableBody')),\n TableCell: lazy(() => import('@mui/material/TableCell')),\n TableContainer: lazy(() => import('@mui/material/TableContainer')),\n TableFooter: lazy(() => import('@mui/material/TableFooter')),\n TableHead: lazy(() => import('@mui/material/TableHead')),\n TablePagination: lazy(() => import('@mui/material/TablePagination')),\n TableRow: lazy(() => import('@mui/material/TableRow')),\n TableSortLabel: lazy(() => import('@mui/material/TableSortLabel')),\n Tabs: lazy(() => import('@mui/material/Tabs')),\n TextField: lazy(() => import('@mui/material/TextField')),\n TextareaAutosize: lazy(() => import('@mui/material/TextareaAutosize')),\n ToggleButton: lazy(() => import('@mui/material/ToggleButton')),\n ToggleButtonGroup: lazy(() => import('@mui/material/ToggleButtonGroup')),\n Toolbar: lazy(() => import('@mui/material/Toolbar')),\n Tooltip: lazy(() => import('@mui/material/Tooltip')),\n Typography: lazy(() => import('@mui/material/Typography')),\n}\n\nconst LazyMUICore = Object.fromEntries(\n Object.entries(Entries).map(([key, ReactComponent]) => {\n const Component = React.forwardRef((props: any, ref) => (\n <Suspense fallback={null}>\n <ReactComponent {...props} ref={ref} />\n </Suspense>\n ))\n Component.displayName = key\n return [key, Component]\n }),\n)\n\nconst MaterialPrefixMUI = Object.fromEntries(\n Object.entries(LazyMUICore).map(([key, value]) => [\n `@material-ui/core/${key}`,\n value,\n ]),\n)\n\nconst MuiPrefixMUI = Object.fromEntries(\n Object.entries(LazyMUICore).map(([key, value]) => [\n `@mui/material/${key}`,\n value,\n ]),\n)\n\nconst Attributes = lazy(() => import('./Attributes'))\nconst FeatureDetails = lazy(() => import('./FeatureDetails'))\nconst BaseCard = lazy(() => import('./BaseCard'))\n\nconst DataGridEntries: Record<string, LazyExoticComponent<any>> = {\n DataGrid: lazy(() =>\n import('@mui/x-data-grid').then(module => ({ default: module.DataGrid })),\n ),\n GridActionsCellItem: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridActionsCellItem,\n })),\n ),\n GridAddIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridAddIcon,\n })),\n ),\n GridArrowDownwardIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridArrowDownwardIcon,\n })),\n ),\n GridArrowUpwardIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridArrowUpwardIcon,\n })),\n ),\n GridCellCheckboxForwardRef: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridCellCheckboxForwardRef,\n })),\n ),\n GridCellCheckboxRenderer: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridCellCheckboxRenderer,\n })),\n ),\n GridCheckCircleIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridCheckCircleIcon,\n })),\n ),\n GridCheckIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridCheckIcon,\n })),\n ),\n GridCloseIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridCloseIcon,\n })),\n ),\n GridColumnHeaderSeparator: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridColumnHeaderSeparator,\n })),\n ),\n GridColumnHeaderSortIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridColumnHeaderSortIcon,\n })),\n ),\n GridColumnIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridColumnIcon,\n })),\n ),\n GridColumnMenu: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridColumnMenu,\n })),\n ),\n GridColumnMenuContainer: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridColumnMenuContainer,\n })),\n ),\n GridDragIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridDragIcon,\n })),\n ),\n GridExpandMoreIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridExpandMoreIcon,\n })),\n ),\n GridFilterAltIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridFilterAltIcon,\n })),\n ),\n GridFilterForm: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridFilterForm,\n })),\n ),\n GridFilterListIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridFilterListIcon,\n })),\n ),\n GridFilterPanel: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridFilterPanel,\n })),\n ),\n GridFooter: lazy(() =>\n import('@mui/x-data-grid').then(module => ({ default: module.GridFooter })),\n ),\n GridFooterContainer: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridFooterContainer,\n })),\n ),\n GridHeader: lazy(() =>\n import('@mui/x-data-grid').then(module => ({ default: module.GridHeader })),\n ),\n GridHeaderCheckbox: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridHeaderCheckbox,\n })),\n ),\n GridKeyboardArrowRight: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridKeyboardArrowRight,\n })),\n ),\n GridLoadIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridLoadIcon,\n })),\n ),\n GridLoadingOverlay: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridLoadingOverlay,\n })),\n ),\n GridMenuIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridMenuIcon,\n })),\n ),\n GridMoreVertIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridMoreVertIcon,\n })),\n ),\n GridNoRowsOverlay: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridNoRowsOverlay,\n })),\n ),\n GridOverlay: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridOverlay,\n })),\n ),\n GridPagination: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridPagination,\n })),\n ),\n GridPanel: lazy(() =>\n import('@mui/x-data-grid').then(module => ({ default: module.GridPanel })),\n ),\n GridPanelWrapper: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridPanelWrapper,\n })),\n ),\n GridRemoveIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridRemoveIcon,\n })),\n ),\n GridRoot: lazy(() =>\n import('@mui/x-data-grid').then(module => ({ default: module.GridRoot })),\n ),\n GridRowCount: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridRowCount,\n })),\n ),\n GridSaveAltIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridSaveAltIcon,\n })),\n ),\n GridSearchIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridSearchIcon,\n })),\n ),\n GridSelectedRowCount: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridSelectedRowCount,\n })),\n ),\n GridSeparatorIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridSeparatorIcon,\n })),\n ),\n GridTableRowsIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridTableRowsIcon,\n })),\n ),\n GridToolbar: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbar,\n })),\n ),\n GridToolbarColumnsButton: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarColumnsButton,\n })),\n ),\n GridToolbarContainer: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarContainer,\n })),\n ),\n GridToolbarDensitySelector: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarDensitySelector,\n })),\n ),\n GridToolbarExport: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarExport,\n })),\n ),\n GridToolbarExportContainer: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarExportContainer,\n })),\n ),\n GridToolbarFilterButton: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridToolbarFilterButton,\n })),\n ),\n GridTripleDotsVerticalIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridTripleDotsVerticalIcon,\n })),\n ),\n GridViewHeadlineIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridViewHeadlineIcon,\n })),\n ),\n GridViewStreamIcon: lazy(() =>\n import('@mui/x-data-grid').then(module => ({\n default: module.GridViewStreamIcon,\n })),\n ),\n}\n\nconst LazyDataGridComponents = Object.fromEntries(\n Object.entries(DataGridEntries).map(([key, ReactComponent]) => {\n const Component = React.forwardRef((props: any, ref) => (\n <Suspense fallback={null}>\n <ReactComponent {...props} ref={ref} />\n </Suspense>\n ))\n Component.displayName = key\n return [key, Component]\n }),\n)\n\nconst LazyAttributes = React.forwardRef((props: any, ref) => (\n <Suspense fallback={null}>\n <Attributes {...props} ref={ref} />\n </Suspense>\n))\nLazyAttributes.displayName = 'Attributes'\n\nconst LazyFeatureDetails = React.forwardRef((props: any, ref) => (\n <Suspense fallback={null}>\n <FeatureDetails {...props} ref={ref} />\n </Suspense>\n))\nLazyFeatureDetails.displayName = 'FeatureDetails'\n\nconst LazyBaseCard = React.forwardRef((props: any, ref) => (\n <Suspense fallback={null}>\n <BaseCard {...props} ref={ref} />\n </Suspense>\n))\nLazyBaseCard.displayName = 'BaseCard'\n\nconst libs = {\n mobx,\n 'mobx-state-tree': mst,\n react: React,\n 'react/jsx-runtime': ReactJSXRuntime,\n 'react-dom': ReactDom,\n 'mobx-react': mxreact,\n '@mui/x-data-grid': {\n useGridApiContext,\n useGridApiRef,\n useGridRootProps,\n ...LazyDataGridComponents,\n },\n\n // special case so plugins can easily use @mui/icons-material; don't remove\n '@mui/material/utils': MUIUtils,\n '@material-ui/core/utils': MUIUtils,\n 'tss-react/mui': { makeStyles },\n\n '@material-ui/core': {\n ...LazyMUICore,\n useTheme,\n alpha: MUIStyles.alpha,\n\n makeStyles: (args: any) => {\n const useStyles = makeStyles()(args)\n return () => useStyles().classes\n },\n },\n '@mui/material': {\n ...LazyMUICore,\n alpha: MUIStyles.alpha,\n useTheme: MUIStyles.useTheme,\n },\n\n // end special case\n // material-ui subcomponents, should get rid of these\n '@mui/material/styles': {\n MUIStyles,\n\n makeStyles: (args: any) => {\n const useStyles = makeStyles()(args)\n return () => useStyles().classes\n },\n },\n '@material-ui/core/styles': {\n MUIStyles,\n\n makeStyles: (args: any) => {\n const useStyles = makeStyles()(args)\n return () => useStyles().classes\n },\n },\n ...MaterialPrefixMUI,\n ...MuiPrefixMUI,\n\n // these are core in @mui/material, but used to be in @material-ui/lab\n '@material-ui/lab/ToggleButton': Entries.ToggleButton,\n '@material-ui/lab/ToggleButtonGroup': Entries.ToggleButtonGroup,\n '@material-ui/lab/Autocomplete': Entries.Autocomplete,\n '@material-ui/lab/Alert': Entries.Alert,\n '@material-ui/lab': {\n Alert: Entries.Alert,\n Autocomplete: Entries.Autocomplete,\n ToggleButton: Entries.ToggleButton,\n ToggleButtonGroup: Entries.ToggleButtonGroup,\n },\n\n '@jbrowse/core/Plugin': Plugin,\n '@jbrowse/core/pluggableElementTypes': pluggableElementTypes,\n '@jbrowse/core/pluggableElementTypes/ViewType': ViewType,\n '@jbrowse/core/pluggableElementTypes/AdapterType': AdapterType,\n '@jbrowse/core/pluggableElementTypes/DisplayType': DisplayType,\n '@jbrowse/core/pluggableElementTypes/TrackType': TrackType,\n '@jbrowse/core/pluggableElementTypes/WidgetType': WidgetType,\n '@jbrowse/core/pluggableElementTypes/models': pluggableElementTypeModels,\n '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType':\n ServerSideRendererType,\n '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType':\n CircularChordRendererType,\n '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType':\n BoxRendererType,\n '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType':\n FeatureRendererType,\n '@jbrowse/core/pluggableElementTypes/renderers/RendererType': RendererType,\n '@jbrowse/core/configuration': Configuration,\n '@jbrowse/core/util/types/mst': mstTypes,\n '@jbrowse/core/ui': coreUi,\n '@jbrowse/core/util': coreUtil,\n '@jbrowse/core/util/color': coreColor,\n '@jbrowse/core/util/layouts': coreLayouts,\n '@jbrowse/core/util/tracks': trackUtils,\n '@jbrowse/core/util/Base1DViewModel': Base1DView,\n '@jbrowse/core/util/io': coreIo,\n '@jbrowse/core/util/mst-reflection': coreMstReflection,\n '@jbrowse/core/util/rxjs': rxjs,\n\n '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail': {\n Attributes: LazyAttributes,\n FeatureDetails: LazyFeatureDetails,\n BaseCard: LazyBaseCard,\n },\n '@jbrowse/core/data_adapters/BaseAdapter': BaseAdapterExports,\n}\n\nconst libsList = Object.keys(libs)\n\n// make sure that all the items in the ReExports/list array (used by build\n// systems and such) are included here, and vice versa\nconst inLibsOnly = libsList.filter(mod => !reExportsList.includes(mod))\nif (inLibsOnly.length > 0) {\n throw new Error(\n `The following modules are in the modules libs, but not the re-exports list: ${inLibsOnly.join(\n ', ',\n )}`,\n )\n}\nconst inReExportsOnly = reExportsList.filter(mod => !libsList.includes(mod))\nif (inReExportsOnly.length) {\n throw new Error(\n `The following modules are in the re-exports list, but not the modules libs: ${inReExportsOnly.join(\n ', ',\n )}`,\n )\n}\n\nexport default libs\n","import React from 'react'\nimport TextSearchAdapterType from '../pluggableElementTypes/TextSearchAdapterType'\nimport { SearchType } from '../data_adapters/BaseAdapter'\n\nexport interface BaseResultArgs {\n label: string\n\n displayString?: string\n\n renderingComponent?: React.ReactElement\n\n matchedAttribute?: string\n\n matchedObject?: object\n\n textSearchAdapter?: TextSearchAdapterType\n\n relevance?: SearchType\n\n locString?: string\n\n refName?: string\n\n trackId?: string\n\n score?: number\n\n results?: BaseResult[]\n}\n\nexport default class BaseResult {\n label: string\n\n renderingComponent?: React.ReactElement\n\n displayString?: string\n\n matchedAttribute?: string\n\n matchedObject?: object\n\n textSearchAdapter?: TextSearchAdapterType\n\n relevance?: SearchType\n\n trackId?: string\n\n score: number\n\n locString?: string\n\n results?: BaseResult[]\n constructor(args: BaseResultArgs) {\n this.label = args.label\n this.locString = args.locString\n this.renderingComponent = args.renderingComponent\n this.displayString = args.displayString\n this.matchedAttribute = args.matchedAttribute\n this.matchedObject = args.matchedObject\n this.textSearchAdapter = args.textSearchAdapter\n this.relevance = args.relevance\n this.trackId = args.trackId\n this.score = args.score || 1\n this.results = args.results || []\n }\n\n getLabel() {\n return this.label\n }\n\n getDisplayString() {\n return this.displayString || this.label\n }\n\n getRenderingComponent() {\n return this.renderingComponent\n }\n\n getTrackId() {\n return this.trackId\n }\n\n getScore() {\n return this.score\n }\n\n updateScore(newScore: number) {\n this.score = newScore\n return this.score\n }\n\n getId() {\n return `${this.getLabel()}-${this.getLocation()}-${this.getTrackId()}`\n }\n\n hasLocation() {\n return !!this.locString\n }\n\n getLocation() {\n return this.locString\n }\n\n getComboResults() {\n return this.results\n }\n}\n\nexport class RefSequenceResult extends BaseResult {\n refName: string\n\n constructor(args: BaseResultArgs) {\n super(args)\n this.refName = args.refName ?? ''\n }\n\n getLocation() {\n return this.refName\n }\n}\n","import BaseResult from './BaseResults'\nimport PluginManager from '../PluginManager'\nimport QuickLRU from '../util/QuickLRU'\nimport {\n BaseTextSearchAdapter,\n BaseTextSearchArgs,\n} from '../data_adapters/BaseAdapter'\nimport { readConfObject, AnyConfigurationModel } from '../configuration'\n\nexport interface SearchScope {\n includeAggregateIndexes: boolean\n assemblyName: string\n tracks?: string[]\n}\n\nexport default class TextSearchManager {\n adapterCache = new QuickLRU<string, BaseTextSearchAdapter>({\n maxSize: 15,\n })\n\n constructor(public pluginManager: PluginManager) {}\n\n loadTextSearchAdapters(searchScope: SearchScope) {\n return Promise.all(\n this.relevantAdapters(searchScope).map(async conf => {\n const adapterId = readConfObject(conf, 'textSearchAdapterId')\n const r = this.adapterCache.get(adapterId)\n if (r) {\n return r\n } else {\n const adapterType = this.pluginManager.getTextSearchAdapterType(\n conf.type,\n )!\n const AdapterClass = await adapterType.getAdapterClass()\n const adapterInstance = new AdapterClass(\n conf,\n undefined,\n this.pluginManager,\n ) as BaseTextSearchAdapter\n this.adapterCache.set(adapterId, adapterInstance)\n return adapterInstance\n }\n }),\n )\n }\n\n relevantAdapters(searchScope: SearchScope) {\n const rootModel = this.pluginManager.rootModel\n const { aggregateTextSearchAdapters } = rootModel?.jbrowse as {\n aggregateTextSearchAdapters: AnyConfigurationModel[]\n }\n const { tracks } = rootModel?.session as {\n tracks: AnyConfigurationModel[]\n }\n\n const { assemblyName } = searchScope\n\n return [\n ...this.getAdaptersWithAssembly(\n assemblyName,\n aggregateTextSearchAdapters,\n ),\n ...this.getTrackAdaptersWithAssembly(assemblyName, tracks),\n ]\n }\n\n getAdaptersWithAssembly(\n assemblyName: string,\n confs: AnyConfigurationModel[],\n ): AnyConfigurationModel[] {\n return confs.filter(c =>\n readConfObject(c, 'assemblyNames')?.includes(assemblyName),\n )\n }\n\n getTrackAdaptersWithAssembly(\n assemblyName: string,\n confs: AnyConfigurationModel[],\n ) {\n return confs\n .filter(conf =>\n readConfObject(conf, [\n 'textSearching',\n 'textSearchAdapter',\n 'assemblyNames',\n ])?.includes(assemblyName),\n )\n .map(\n conf => conf.textSearching.textSearchAdapter as AnyConfigurationModel,\n )\n }\n\n /**\n * Returns list of relevant results given a search query and options\n *\n * @param args - search options/arguments include: search query limit of\n * results to return, searchType...prefix | full | exact\", etc.\n */\n async search(\n args: BaseTextSearchArgs,\n searchScope: SearchScope,\n rankFn: (results: BaseResult[]) => BaseResult[],\n ) {\n const adapters = await this.loadTextSearchAdapters(searchScope)\n const results = await Promise.all(adapters.map(a => a.searchIndex(args)))\n return this.sortResults(results.flat(), rankFn)\n }\n\n /**\n * Returns array of revelevant and sorted results\n * @param results - array of results from all text search adapters\n * @param rankFn - function that updates results scores\n * based on more relevance\n */\n sortResults(\n results: BaseResult[],\n rankFn: (results: BaseResult[]) => BaseResult[],\n ) {\n return rankFn(\n results.sort((a, b) => -b.getLabel().localeCompare(a.getLabel())),\n ).sort((r1, r2) => r1.getScore() - r2.getScore())\n }\n}\n","import { types, IAnyModelType, IAnyComplexType } from 'mobx-state-tree'\nimport { stringToJexlExpression } from '../util/jexlStrings'\nimport { FileLocation } from '../util/types/mst'\nimport { getEnv } from '../util'\n\nfunction isValidColorString(/* str */) {\n // TODO: check all the crazy cases for whether it's a valid HTML/CSS color string\n return true\n}\nconst typeModels: Record<string, any> = {\n stringArray: types.array(types.string),\n stringArrayMap: types.map(types.array(types.string)),\n numberMap: types.map(types.number),\n boolean: types.boolean,\n color: types.refinement('Color', types.string, isValidColorString),\n integer: types.integer,\n number: types.number,\n string: types.string,\n text: types.string,\n fileLocation: FileLocation,\n frozen: types.frozen(),\n}\n\n// default values we use if the defaultValue is malformed or does not work\nconst fallbackDefaults: Record<string, any> = {\n stringArray: [],\n stringArrayMap: {},\n numberMap: {},\n boolean: true,\n color: 'black',\n integer: 1,\n number: 1,\n string: '',\n text: '',\n fileLocation: { uri: '/path/to/resource.txt', locationType: 'UriLocation' },\n frozen: {},\n}\n\nconst literalJSON = (self: { value: any }) => ({\n views: {\n get valueJSON() {\n return self.value\n },\n },\n})\n\nconst objectJSON = (self: { value: any }) => ({\n views: {\n get valueJSON() {\n return JSON.stringify(self.value)\n },\n },\n})\n\n// custom actions for modifying the value models\nconst typeModelExtensions: Record<string, (self: any) => any> = {\n fileLocation: objectJSON,\n number: literalJSON,\n integer: literalJSON,\n boolean: literalJSON,\n frozen: objectJSON,\n // special actions for working with stringArray slots\n stringArray: (self: { value: string[] }) => ({\n views: {\n get valueJSON() {\n return JSON.stringify(self.value)\n },\n },\n actions: {\n add(val: string) {\n self.value.push(val)\n },\n removeAtIndex(idx: number) {\n self.value.splice(idx, 1)\n },\n setAtIndex(idx: number, val: string) {\n self.value[idx] = val\n },\n },\n }),\n stringArrayMap: (self: { value: Map<string, string[]> }) => ({\n views: {\n get valueJSON() {\n return JSON.stringify(self.value)\n },\n },\n actions: {\n add(key: string, val: any) {\n self.value.set(key, val)\n },\n remove(key: string) {\n self.value.delete(key)\n },\n addToKey(key: string, val: string) {\n const ar = self.value.get(key)\n if (!ar) {\n throw new Error(`${key} not found`)\n }\n ar.push(val)\n },\n removeAtKeyIndex(key: string, idx: number) {\n const ar = self.value.get(key)\n if (!ar) {\n throw new Error(`${key} not found`)\n }\n ar.splice(idx, 1)\n },\n setAtKeyIndex(key: string, idx: number, val: string) {\n const ar = self.value.get(key)\n if (!ar) {\n throw new Error(`${key} not found`)\n }\n ar[idx] = val\n },\n },\n }),\n numberMap: (self: { value: Map<string, number> }) => ({\n views: {\n get valueJSON() {\n return JSON.stringify(self.value)\n },\n },\n actions: {\n add(key: string, val: number) {\n self.value.set(key, val)\n },\n remove(key: string) {\n self.value.delete(key)\n },\n },\n }),\n}\n\n// const FunctionStringType = types.refinement(\n// 'FunctionString',\n// types.string,\n// str => functionRegexp.test(str),\n// )\n\nconst JexlStringType = types.refinement('JexlString', types.string, str =>\n str.startsWith('jexl:'),\n)\nfunction json(value: any) {\n return value?.toJSON ? value.toJSON() : `\"${value}\"`\n}\nexport interface ConfigSlotDefinition {\n /** human-readable description of the slot's meaning */\n description?: string\n /** custom base MST model for the slot's value */\n model?: IAnyModelType | IAnyComplexType\n /** name of the type of slot, e.g. \"string\", \"number\", \"stringArray\" */\n type: string\n /** default value of the slot */\n defaultValue: any\n /** parameter names of the function callback */\n contextVariable?: string[]\n}\n\n/**\n * builds a MST model for a configuration slot\n *\n * @param slotName -\n * @param definition -\n */\nexport default function ConfigSlot(\n slotName: string,\n {\n description = '',\n model,\n type,\n defaultValue,\n contextVariable = [],\n }: ConfigSlotDefinition,\n) {\n if (!type) {\n throw new Error('type name required')\n }\n if (!model) {\n model = typeModels[type]\n }\n if (!model) {\n throw new Error(\n `no builtin config slot type \"${type}\", and no 'model' param provided`,\n )\n }\n\n if (defaultValue === undefined) {\n throw new Error(\"no 'defaultValue' provided\")\n }\n\n // if the `type` is something like `color`, then the model name\n // here will be `ColorConfigSlot`\n const configSlotModelName = `${slotName\n .charAt(0)\n .toUpperCase()}${slotName.slice(1)}ConfigSlot`\n let slot = types\n .model(configSlotModelName, {\n name: types.literal(slotName),\n description: types.literal(description),\n type: types.literal(type),\n value: types.optional(types.union(JexlStringType, model), defaultValue),\n })\n .volatile(() => ({\n contextVariable,\n }))\n .views(self => ({\n get isCallback() {\n return String(self.value).startsWith('jexl:')\n },\n }))\n .views(self => ({\n get expr() {\n if (self.isCallback) {\n // compile as jexl function\n const { pluginManager } = getEnv(self)\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!pluginManager && typeof jest === 'undefined') {\n console.warn(\n 'no pluginManager detected on config env (if you dynamically instantiate a config, for example in renderProps for your display model, check that you add the env argument)',\n )\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return stringToJexlExpression(String(self.value), pluginManager?.jexl)\n }\n return { evalSync: () => self.value }\n },\n\n // JS representation of the value of this slot, suitable\n // for embedding in either JSON or a JS function string.\n // many of the data types override this in typeModelExtensions\n get valueJSON(): any[] | Record<string, any> | string | undefined {\n if (self.isCallback) {\n return undefined\n }\n\n return json(self.value)\n },\n }))\n .preProcessSnapshot(val =>\n typeof val === 'object' && val.name === slotName\n ? val\n : {\n name: slotName,\n description,\n type,\n value: val,\n },\n )\n .postProcessSnapshot(snap => {\n if (typeof snap.value === 'object') {\n return JSON.stringify(snap.value) !== JSON.stringify(defaultValue)\n ? snap.value\n : undefined\n }\n return snap.value !== defaultValue ? snap.value : undefined\n })\n .actions(self => ({\n set(newVal: any) {\n self.value = newVal\n },\n reset() {\n self.value = defaultValue\n },\n convertToCallback() {\n if (self.isCallback) {\n return\n }\n self.value = `jexl:${self.valueJSON || \"''\"}`\n },\n convertToValue() {\n if (!self.isCallback) {\n return\n }\n // try calling it with no arguments\n try {\n const funcResult = self.expr.evalSync()\n if (funcResult !== undefined) {\n self.value = funcResult\n return\n }\n } catch (e) {\n /* ignore */\n }\n self.value = defaultValue\n // if it is still a callback (happens if the defaultValue is a\n // callback), then use the last-resort fallback default\n // if defaultValue has jexl: string, run this part\n if (!(type in fallbackDefaults)) {\n throw new Error(`no fallbackDefault defined for type ${type}`)\n }\n self.value = fallbackDefaults[type]\n },\n }))\n\n // if there are any type-specific extensions (views or actions)\n // to the slot, add those in\n if (typeModelExtensions[type]) {\n slot = slot.extend(typeModelExtensions[type])\n }\n\n const completeModel = types.optional(slot, {\n name: slotName,\n type,\n description,\n value: defaultValue,\n })\n const m = completeModel\n Object.defineProperty(m, 'isJBrowseConfigurationSlot', { value: true })\n return m\n}\n","import {\n types,\n isStateTreeNode,\n isType,\n isLateType,\n getSnapshot,\n IAnyType,\n SnapshotOut,\n} from 'mobx-state-tree'\n\nimport { ElementId } from '../util/types/mst'\n\nimport ConfigSlot, { ConfigSlotDefinition } from './configurationSlot'\nimport { isConfigurationSchemaType } from './util'\nimport { AnyConfigurationSchemaType } from './types'\n\nexport type {\n AnyConfigurationSchemaType,\n AnyConfigurationModel,\n AnyConfigurationSlot,\n AnyConfigurationSlotType,\n} from './types'\n\nfunction isEmptyObject(thing: unknown) {\n return (\n typeof thing === 'object' &&\n !Array.isArray(thing) &&\n thing !== null &&\n Object.keys(thing).length === 0\n )\n}\n\nfunction isEmptyArray(thing: unknown) {\n return Array.isArray(thing) && thing.length === 0\n}\n\nexport interface ConfigurationSchemaDefinition {\n [n: string]:\n | ConfigSlotDefinition\n | ConfigurationSchemaDefinition\n | string\n | number\n | IAnyType\n}\n\nexport interface ConfigurationSchemaOptions<\n BASE_SCHEMA extends AnyConfigurationSchemaType | undefined,\n EXPLICIT_IDENTIFIER extends string | undefined,\n> {\n explicitlyTyped?: boolean\n explicitIdentifier?: EXPLICIT_IDENTIFIER\n implicitIdentifier?: string | boolean\n baseConfiguration?: BASE_SCHEMA\n\n actions?: (self: unknown) => any\n views?: (self: unknown) => any\n extend?: (self: unknown) => any\n preProcessSnapshot?: (\n snapshot: Record<string, unknown>,\n ) => Record<string, unknown>\n}\n\nfunction preprocessConfigurationSchemaArguments(\n modelName: string,\n inputSchemaDefinition: ConfigurationSchemaDefinition,\n inputOptions: ConfigurationSchemaOptions<any, any> = {},\n) {\n if (typeof modelName !== 'string') {\n throw new Error(\n 'first arg must be string name of the model that this config schema goes with',\n )\n }\n\n // if we have a base configuration schema that we are\n // extending, grab the slot definitions from that\n let schemaDefinition = inputSchemaDefinition\n let options = inputOptions\n if (inputOptions.baseConfiguration?.jbrowseSchemaDefinition) {\n schemaDefinition = {\n ...inputOptions.baseConfiguration.jbrowseSchemaDefinition,\n ...schemaDefinition,\n }\n options = {\n ...inputOptions.baseConfiguration.jbrowseSchemaOptions,\n ...inputOptions,\n }\n options.baseConfiguration = undefined\n }\n return { schemaDefinition, options }\n}\n\nfunction makeConfigurationSchemaModel<\n DEFINITION extends ConfigurationSchemaDefinition,\n OPTIONS extends ConfigurationSchemaOptions<any, any>,\n>(modelName: string, schemaDefinition: DEFINITION, options: OPTIONS) {\n // now assemble the MST model of the configuration schema\n const modelDefinition: Record<string, any> = {}\n let identifier: string | undefined\n\n if (options.explicitlyTyped) {\n modelDefinition.type = types.optional(types.literal(modelName), modelName)\n }\n\n if (options.explicitIdentifier && options.implicitIdentifier) {\n throw new Error(\n `Cannot have both explicit and implicit identifiers in ${modelName}`,\n )\n }\n if (options.explicitIdentifier) {\n if (typeof options.explicitIdentifier === 'string') {\n modelDefinition[options.explicitIdentifier] = types.identifier\n identifier = options.explicitIdentifier\n } else {\n modelDefinition.id = types.identifier\n identifier = 'id'\n }\n } else if (options.implicitIdentifier) {\n if (typeof options.implicitIdentifier === 'string') {\n modelDefinition[options.implicitIdentifier] = ElementId\n identifier = options.implicitIdentifier\n } else {\n modelDefinition.id = ElementId\n identifier = 'id'\n }\n }\n\n const volatileConstants: Record<string, any> = {\n isJBrowseConfigurationSchema: true,\n jbrowseSchema: {\n modelName,\n definition: schemaDefinition,\n options,\n },\n }\n Object.entries(schemaDefinition).forEach(([slotName, slotDefinition]) => {\n if (\n (isType(slotDefinition) && isLateType(slotDefinition)) ||\n isConfigurationSchemaType(slotDefinition)\n ) {\n // this is either an MST late() type (which we assume to be a sub-configuration),\n // or an actual sub-configuration\n modelDefinition[slotName] = slotDefinition\n } else if (\n typeof slotDefinition === 'string' ||\n typeof slotDefinition === 'number'\n ) {\n volatileConstants[slotName] = slotDefinition\n } else if (typeof slotDefinition === 'object') {\n // this is a slot definition\n if (!slotDefinition.type) {\n throw new Error(`no type set for config slot ${modelName}.${slotName}`)\n }\n try {\n modelDefinition[slotName] = ConfigSlot(\n slotName,\n slotDefinition as ConfigSlotDefinition,\n )\n } catch (e) {\n throw new Error(\n `invalid config slot definition for ${modelName}.${slotName}: ${e}`,\n )\n }\n } else {\n throw new Error(\n `invalid configuration schema definition, \"${slotName}\" must be either a valid configuration slot definition, a constant, or a nested configuration schema`,\n )\n }\n })\n\n let completeModel = types\n .model(`${modelName}ConfigurationSchema`, modelDefinition)\n .actions(self => ({\n setSubschema(slotName: string, data: Record<string, unknown>) {\n if (!isConfigurationSchemaType(modelDefinition[slotName])) {\n throw new Error(`${slotName} is not a subschema, cannot replace`)\n }\n const newSchema = isStateTreeNode(data)\n ? data\n : modelDefinition[slotName].create(data)\n self[slotName] = newSchema\n return newSchema\n },\n }))\n\n if (Object.keys(volatileConstants).length) {\n completeModel = completeModel.volatile((/* self */) => volatileConstants)\n }\n if (options.actions) {\n completeModel = completeModel.actions(options.actions)\n }\n if (options.views) {\n completeModel = completeModel.views(options.views)\n }\n if (options.extend) {\n completeModel = completeModel.extend(options.extend)\n }\n\n const identifierDefault = identifier ? { [identifier]: 'placeholderId' } : {}\n const modelDefault = options.explicitlyTyped\n ? { type: modelName, ...identifierDefault }\n : identifierDefault\n\n const defaultSnap = getSnapshot(completeModel.create(modelDefault))\n completeModel = completeModel.postProcessSnapshot(snap => {\n const newSnap: SnapshotOut<typeof completeModel> = {}\n let matchesDefault = true\n // let keyCount = 0\n for (const [key, value] of Object.entries(snap)) {\n if (matchesDefault) {\n if (typeof defaultSnap[key] === 'object' && typeof value === 'object') {\n if (JSON.stringify(defaultSnap[key]) !== JSON.stringify(value)) {\n matchesDefault = false\n }\n } else if (defaultSnap[key] !== value) {\n matchesDefault = false\n }\n }\n if (\n value !== undefined &&\n volatileConstants[key] === undefined &&\n !isEmptyObject(value) &&\n !isEmptyArray(value)\n ) {\n // keyCount += 1\n newSnap[key] = value\n }\n }\n if (matchesDefault) {\n return {}\n }\n return newSnap\n })\n\n if (options.preProcessSnapshot) {\n completeModel = completeModel.preProcessSnapshot(options.preProcessSnapshot)\n }\n\n return types.optional(completeModel, modelDefault)\n}\n\nexport interface ConfigurationSchemaType<\n DEFINITION extends ConfigurationSchemaDefinition,\n OPTIONS extends ConfigurationSchemaOptions<any, any>,\n> extends ReturnType<typeof makeConfigurationSchemaModel<DEFINITION, OPTIONS>> {\n isJBrowseConfigurationSchema: boolean\n jbrowseSchemaDefinition: DEFINITION\n jbrowseSchemaOptions: OPTIONS\n type: string\n [key: string]: unknown\n}\n\nexport function ConfigurationSchema<\n DEFINITION extends ConfigurationSchemaDefinition,\n OPTIONS extends ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER>,\n BASE_SCHEMA extends AnyConfigurationSchemaType | undefined = undefined,\n EXPLICIT_IDENTIFIER extends string | undefined = undefined,\n>(\n modelName: string,\n inputSchemaDefinition: DEFINITION,\n inputOptions?: ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER>,\n): ConfigurationSchemaType<DEFINITION, OPTIONS> {\n const { schemaDefinition, options } = preprocessConfigurationSchemaArguments(\n modelName,\n inputSchemaDefinition,\n inputOptions,\n )\n const schemaType = makeConfigurationSchemaModel(\n modelName,\n schemaDefinition,\n options,\n ) as AnyConfigurationSchemaType\n // saving a couple of jbrowse-specific things in the type object. hope nobody gets mad.\n schemaType.isJBrowseConfigurationSchema = true\n schemaType.jbrowseSchemaDefinition = schemaDefinition\n schemaType.jbrowseSchemaOptions = options\n return schemaType\n}\n\nexport function ConfigurationReference<\n SCHEMATYPE extends AnyConfigurationSchemaType,\n>(schemaType: SCHEMATYPE) {\n // we cast this to SCHEMATYPE, because the reference *should* behave just\n // like the object it points to. It won't be undefined (this is a\n // `reference`, not a `safeReference`)\n return types.union(types.reference(schemaType), schemaType) as SCHEMATYPE\n}\n","import {\n isStateTreeNode,\n getSnapshot,\n getType,\n isMapType,\n isType,\n isUnionType,\n isOptionalType,\n isArrayType,\n isModelType,\n isLateType,\n} from 'mobx-state-tree'\n\nimport {\n getUnionSubTypes,\n getDefaultValue,\n getSubType,\n resolveLateType,\n} from '../util/mst-reflection'\n\nimport {\n AnyConfigurationModel,\n AnyConfigurationSchemaType,\n ConfigurationSlotName,\n ConfigurationSchemaForModel,\n} from './types'\n\n/**\n * given a configuration model (an instance of a ConfigurationSchema),\n * read the configuration variable at the given path\n *\n * @param model - instance of ConfigurationSchema\n * @param slotPaths - array of paths to read\n * @param args - extra arguments e.g. for a feature callback,\n * will be sent to each of the slotNames\n */\nexport function readConfObject<CONFMODEL extends AnyConfigurationModel>(\n confObject: CONFMODEL,\n slotPath?:\n | ConfigurationSlotName<ConfigurationSchemaForModel<CONFMODEL>>\n | string[],\n args: Record<string, unknown> = {},\n): any {\n if (!slotPath) {\n return JSON.parse(JSON.stringify(getSnapshot(confObject)))\n }\n if (typeof slotPath === 'string') {\n let slot = confObject[slotPath]\n // check for the subconf being a map if we don't find it immediately\n if (\n !slot &&\n isStateTreeNode(confObject) &&\n isMapType(getType(confObject))\n ) {\n slot = confObject.get(slotPath)\n }\n if (!slot) {\n return undefined\n // if we want to be very strict about config slots, we could uncomment the below\n // instead of returning undefined\n //\n // const modelType = getType(model)\n // const schemaType = model.configuration && getType(model.configuration)\n // throw new Error(\n // `no slot \"${slotName}\" found in ${modelType.name} configuration (${\n // schemaType.name\n // })`,\n // )\n }\n\n const val = slot.expr ? slot.expr.evalSync(args) : slot\n return isStateTreeNode(val)\n ? JSON.parse(JSON.stringify(getSnapshot(val)))\n : val\n }\n\n if (Array.isArray(slotPath)) {\n const slotName = slotPath[0]!\n if (slotPath.length > 1) {\n const newPath = slotPath.slice(1)\n let subConf = confObject[slotName]\n // check for the subconf being a map if we don't find it immediately\n if (\n !subConf &&\n isStateTreeNode(confObject) &&\n isMapType(getType(confObject))\n ) {\n subConf = confObject.get(slotName)\n }\n return subConf ? readConfObject(subConf, newPath, args) : undefined\n }\n return readConfObject(\n confObject,\n slotName as ConfigurationSlotName<ConfigurationSchemaForModel<CONFMODEL>>,\n args,\n )\n }\n throw new TypeError('slotPath must be a string or array')\n}\n\n/**\n * helper method for readConfObject, reads the config from a mst model\n *\n * @param model - object containing a 'configuration' member\n * @param slotPaths - array of paths to read\n * @param args - extra arguments e.g. for a feature callback,\n * will be sent to each of the slotNames\n */\nexport function getConf<CONFMODEL extends AnyConfigurationModel>(\n model: { configuration: CONFMODEL },\n slotPath?: Parameters<typeof readConfObject<CONFMODEL>>[1],\n args?: Parameters<typeof readConfObject<CONFMODEL>>[2],\n) {\n const { configuration } = model\n if (isConfigurationModel(configuration)) {\n return readConfObject<CONFMODEL>(configuration, slotPath, args)\n }\n throw new TypeError('cannot getConf on this model, it has no configuration')\n}\n\n/**\n * given a union of explicitly typed configuration schema types,\n * extract an array of the type names contained in the union\n *\n * @param unionType -\n * @returns Array of type names contained in the union\n */\nexport function getTypeNamesFromExplicitlyTypedUnion(maybeUnionType: unknown) {\n if (isType(maybeUnionType)) {\n maybeUnionType = resolveLateType(maybeUnionType)\n // @ts-expect-error\n if (isUnionType(maybeUnionType)) {\n const typeNames: string[] = []\n getUnionSubTypes(maybeUnionType).forEach(type => {\n type = resolveLateType(type)\n let typeName = getTypeNamesFromExplicitlyTypedUnion(type)\n if (!typeName.length) {\n const def = getDefaultValue(type)\n typeName = [def.type]\n }\n if (!typeName[0]) {\n // debugger\n throw new Error(`invalid config schema type ${type}`)\n }\n typeNames.push(...typeName)\n })\n return typeNames\n }\n }\n return []\n}\n\nexport function isBareConfigurationSchemaType(\n thing: unknown,\n): thing is AnyConfigurationSchemaType {\n if (isType(thing)) {\n if (\n isModelType(thing) &&\n ('isJBrowseConfigurationSchema' in thing ||\n thing.name.includes('ConfigurationSchema'))\n ) {\n return true\n }\n // if it's a late type, assume its a config schema\n if (isLateType(thing)) {\n return true\n }\n }\n return false\n}\n\nexport function isConfigurationSchemaType(\n thing: unknown,\n): thing is AnyConfigurationSchemaType {\n if (!isType(thing)) {\n return false\n }\n\n // written as a series of if-statements instead of a big logical OR\n // because this construction gives much better debugging backtraces.\n\n // also, note that the order of these statements matters, because\n // for example some union types are also optional types\n\n if (isBareConfigurationSchemaType(thing)) {\n return true\n }\n\n if (isUnionType(thing)) {\n return getUnionSubTypes(thing).every(\n t => isConfigurationSchemaType(t) || t.name === 'undefined',\n )\n }\n\n if (isOptionalType(thing) && isConfigurationSchemaType(getSubType(thing))) {\n return true\n }\n\n if (isArrayType(thing) && isConfigurationSchemaType(getSubType(thing))) {\n return true\n }\n\n if (isMapType(thing) && isConfigurationSchemaType(getSubType(thing))) {\n return true\n }\n\n return false\n}\n\nexport function isConfigurationModel(\n thing: unknown,\n): thing is AnyConfigurationModel {\n return isStateTreeNode(thing) && isConfigurationSchemaType(getType(thing))\n}\n\nexport function isConfigurationSlotType(thing: unknown) {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'isJBrowseConfigurationSlot' in thing\n )\n}\n","import { BaseAdapter } from './BaseAdapter'\nimport { BaseFeatureDataAdapter } from './BaseFeatureDataAdapter'\nimport { BaseRefNameAliasAdapter } from './BaseRefNameAliasAdapter'\nimport { BaseSequenceAdapter } from './BaseSequenceAdapter'\nimport { BaseTextSearchAdapter } from './BaseTextSearchAdapter'\nimport { RegionsAdapter } from './RegionsAdapter'\n\nexport type AnyDataAdapter =\n | BaseAdapter\n | BaseFeatureDataAdapter\n | BaseRefNameAliasAdapter\n | BaseTextSearchAdapter\n | RegionsAdapter\n | BaseSequenceAdapter\n\nexport function isSequenceAdapter(t: AnyDataAdapter): t is BaseSequenceAdapter {\n return 'getRegions' in t && 'getFeatures' in t\n}\n\nexport function isRegionsAdapter(t: AnyDataAdapter): t is RegionsAdapter {\n return 'getRegions' in t\n}\n\nexport function isFeatureAdapter(\n t: AnyDataAdapter,\n): t is BaseFeatureDataAdapter {\n return 'getFeatures' in t\n}\n\nexport function isRefNameAliasAdapter(t: object): t is BaseRefNameAliasAdapter {\n return 'getRefNameAliases' in t\n}\n\nexport function isTextSearchAdapter(\n t: AnyDataAdapter,\n): t is BaseTextSearchAdapter {\n return 'searchIndex' in t\n}\n","import { isStateTreeNode, getSnapshot } from 'mobx-state-tree'\n\n// locals\nimport { readConfObject, AnyConfigurationModel } from '../../configuration'\nimport { getSubAdapterType } from '../dataAdapterCache'\nimport { AugmentedRegion as Region } from '../../util/types'\nimport idMaker from '../../util/idMaker'\nimport PluginManager from '../../PluginManager'\nimport { ConfigurationSchema } from '../../configuration'\n\nconst EmptyConfig = ConfigurationSchema('empty', {})\n\nexport abstract class BaseAdapter {\n public id: string\n\n static capabilities = [] as string[]\n\n constructor(\n public config: AnyConfigurationModel = EmptyConfig.create(),\n public getSubAdapter?: getSubAdapterType,\n public pluginManager?: PluginManager,\n ) {\n // note: we use switch on jest here for more simple feature IDs\n // in test environment\n if (typeof jest === 'undefined') {\n const data = isStateTreeNode(config) ? getSnapshot(config) : config\n this.id = `${idMaker(data)}`\n } else {\n this.id = 'test'\n }\n }\n\n /**\n * Same as `readConfObject(this.config, arg)`.\n * Note: Does not offer the same TS type checking as `readConfObject`,\n * consider using that instead.\n */\n getConf(arg: string | string[]) {\n return readConfObject(this.config, arg)\n }\n\n /**\n * Called to provide a hint that data tied to a certain region will not be\n * needed for the foreseeable future and can be purged from caches, etc\n * @param region - Region\n */\n public abstract freeResources(region: Region): void\n}\n","import { Observable, firstValueFrom, merge } from 'rxjs'\nimport { toArray } from 'rxjs/operators'\n\n// locals\nimport { BaseAdapter } from './BaseAdapter'\nimport { BaseOptions } from './BaseOptions'\nimport { FeatureDensityStats } from './types'\nimport { ObservableCreate } from '../../util/rxjs'\nimport { checkAbortSignal, sum, max, min } from '../../util'\nimport { Feature } from '../../util/simpleFeature'\nimport { AugmentedRegion as Region } from '../../util/types'\nimport { blankStats, rectifyStats, scoresToStats } from '../../util/stats'\n\n/**\n * Base class for feature adapters to extend. Defines some methods that\n * subclasses must implement.\n */\nexport abstract class BaseFeatureDataAdapter extends BaseAdapter {\n /**\n * Get all reference sequence names used in the data source\n * Example:\n * public async getRefNames(opts?: BaseOptions): Promise\\<string[]\\> \\}\n * await this.setup()\n * const \\{ refNames \\} = this.metadata\n * return refNames\n * \\}\n *\n *\n * NOTE: If an adapter is unable to determine the reference sequence names,\n * the array will be empty\n * @param opts - Feature adapter options\n */\n public abstract getRefNames(opts?: BaseOptions): Promise<string[]>\n\n /**\n * Get features from the data source that overlap a region\n * Example:\n * public getFeatures(\n * region: Region,\n * opts: BaseOptions,\n * ): Observable<Feature> \\{\n * return ObservableCreate(observer =\\> \\{\n * const records = getRecords(assembly, refName, start, end)\n * records.forEach(record =\\> \\{\n * observer.next(this.recordToFeature(record))\n * \\})\n * observer.complete()\n * \\})\n * \\}\n * @param region - Region\n * @param opts - Feature adapter options\n * @returns Observable of Feature objects in the region\n */\n public abstract getFeatures(\n region: Region,\n opts?: BaseOptions,\n ): Observable<Feature>\n\n /**\n * Return \"header info\" that is fetched from the data file, or other info\n * that would not simply be in the config of the file. The return value can\n * be `{tag:string, data: any}[]` e.g. list of tags with their values which\n * is how VCF,BAM,CRAM return values for getInfo or it can be a nested JSON\n * object\n */\n public async getHeader(_opts?: BaseOptions): Promise<unknown> {\n return null\n }\n\n /**\n * Return info that is primarily used for interpreting the data that is there,\n * primarily in reference to being used for augmenting feature details panels\n */\n public async getMetadata(_opts?: BaseOptions): Promise<unknown> {\n return null\n }\n\n /**\n * Checks if the store has data for the given assembly and reference\n * sequence, and then gets the features in the region if it does.\n */\n public getFeaturesInRegion(region: Region, opts: BaseOptions = {}) {\n return ObservableCreate<Feature>(async observer => {\n const hasData = await this.hasDataForRefName(region.refName, opts)\n checkAbortSignal(opts.signal)\n if (!hasData) {\n observer.complete()\n } else {\n this.getFeatures(region, opts).subscribe(observer)\n }\n })\n }\n\n /**\n * Checks if the store has data for the given assembly and reference\n * sequence, and then gets the features in the region if it does.\n *\n * Currently this just calls getFeatureInRegion for each region. Adapters that\n * are frequently called on multiple regions simultaneously may want to\n * implement a more efficient custom version of this method.\n *\n * Currently this just calls getFeatureInRegion for each region. Adapters that\n * are frequently called on multiple regions simultaneously may want to\n * implement a more efficient custom version of this method.\n *\n * @param regions - Regions\n * @param opts - Feature adapter options\n * @returns Observable of Feature objects in the regions\n */\n public getFeaturesInMultipleRegions(\n regions: Region[],\n opts: BaseOptions = {},\n ) {\n return merge(\n ...regions.map(region => this.getFeaturesInRegion(region, opts)),\n )\n }\n\n /**\n * Check if the store has data for the given reference name.\n * @param refName - Name of the reference sequence\n * @returns Whether data source has data for the given reference name\n */\n public async hasDataForRefName(refName: string, opts: BaseOptions = {}) {\n const refNames = await this.getRefNames(opts)\n return refNames.includes(refName)\n }\n\n /**\n * Calculates the minimum score, maximum score, and other statistics from\n * features over a region, primarily used for quantitative tracks\n */\n public async getRegionQuantitativeStats(region: Region, opts?: BaseOptions) {\n const feats = this.getFeatures(region, opts)\n return scoresToStats(region, feats)\n }\n /**\n * Calculates the minimum score, maximum score, and other statistics from\n * features over multiple regions, primarily used for quantitative tracks\n */\n public async getMultiRegionQuantitativeStats(\n regions: Region[] = [],\n opts?: BaseOptions,\n ) {\n if (!regions.length) {\n return blankStats()\n }\n const feats = await Promise.all(\n regions.map(region => this.getRegionQuantitativeStats(region, opts)),\n )\n\n const scoreMax = max(feats.map(a => a.scoreMax))\n const scoreMin = min(feats.map(a => a.scoreMin))\n const scoreSum = sum(feats.map(a => a.scoreSum))\n const scoreSumSquares = sum(feats.map(a => a.scoreSumSquares))\n const featureCount = sum(feats.map(a => a.featureCount))\n const basesCovered = sum(feats.map(a => a.basesCovered))\n\n return rectifyStats({\n scoreMin,\n scoreMax,\n featureCount,\n basesCovered,\n scoreSumSquares,\n scoreSum,\n })\n }\n\n /**\n * Calculates the \"feature density\" of a region. The primary purpose of this\n * API is to alert the user if they are going to be downloading too much\n * information, and give them a hint to zoom in to see more. The default\n * implementation samples from the regions, downloads feature data with\n * getFeatures, and returns an object with the form \\{featureDensity:number\\}\n *\n * Derived classes can override this to return alternative calculations for\n * featureDensity, or they can also return an object containing a byte size\n * calculation with the format \\{bytes:number, fetchSizeLimit:number\\} where\n * fetchSizeLimit is the adapter-defined limit for what it thinks is 'too\n * much data' (e.g. CRAM and BAM may vary on what they think too much data\n * is)\n */\n getRegionFeatureDensityStats(region: Region, opts?: BaseOptions) {\n let lastTime = +Date.now()\n const statsFromInterval = async (length: number, expansionTime: number) => {\n const { start, end } = region\n const sampleCenter = start * 0.75 + end * 0.25\n\n const features = await firstValueFrom(\n this.getFeatures(\n {\n ...region,\n start: Math.max(0, Math.round(sampleCenter - length / 2)),\n end: Math.min(Math.round(sampleCenter + length / 2), end),\n },\n opts,\n ).pipe(toArray()),\n )\n\n return maybeRecordStats(\n length,\n { featureDensity: features.length / length },\n features.length,\n expansionTime,\n )\n }\n\n const maybeRecordStats = async (\n interval: number,\n stats: FeatureDensityStats,\n statsSampleFeatures: number,\n expansionTime: number,\n ): Promise<FeatureDensityStats> => {\n const refLen = region.end - region.start\n if (statsSampleFeatures >= 70 || interval * 2 > refLen) {\n return stats\n } else if (expansionTime <= 5000) {\n const currTime = +Date.now()\n expansionTime += currTime - lastTime\n lastTime = currTime\n return statsFromInterval(interval * 2, expansionTime)\n } else {\n console.warn(\n \"Stats estimation reached timeout, or didn't get enough features\",\n )\n return { featureDensity: Number.POSITIVE_INFINITY }\n }\n }\n\n return statsFromInterval(1000, 0)\n }\n\n /**\n * Calculates the \"feature density\" of a set of regions. The primary purpose\n * of this API is to alert the user if they are going to be downloading too\n * much information, and give them a hint to zoom in to see more. The default\n * implementation samples from the regions, downloads feature data with\n * getFeatures, and returns an object with the form \\{featureDensity:number\\}\n *\n * Derived classes can override this to return alternative calculations for\n * featureDensity, or they can also return an object containing a byte size\n * calculation with the format \\{bytes:number, fetchSizeLimit:number\\} where\n * fetchSizeLimit is the adapter-defined limit for what it thinks is 'too\n * much data' (e.g. CRAM and BAM may vary on what they think too much data\n * is)\n */\n public async getMultiRegionFeatureDensityStats(\n regions: Region[],\n opts?: BaseOptions,\n ) {\n if (!regions.length) {\n throw new Error('No regions supplied')\n }\n return this.getRegionFeatureDensityStats(regions[0]!, opts)\n }\n}\n","import { NoAssemblyRegion } from '../../util'\nimport { BaseOptions } from './types'\nimport { RegionsAdapter } from '../BaseAdapter'\nimport { BaseFeatureDataAdapter } from './BaseFeatureDataAdapter'\n\nexport abstract class BaseSequenceAdapter\n extends BaseFeatureDataAdapter\n implements RegionsAdapter\n{\n async getMultiRegionFeatureDensityStats() {\n return { featureDensity: 0 }\n }\n\n /**\n * Fetches a list of 'regions' with refName, start, and extends\n */\n abstract getRegions(opts: BaseOptions): Promise<NoAssemblyRegion[]>\n}\n","import PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration'\nimport { AnyAdapter } from '../data_adapters/BaseAdapter'\n\nexport interface AdapterMetadata {\n category?: string\n hiddenFromGUI?: boolean\n description?: string\n}\n\nexport default class AdapterType extends PluggableElementBase {\n getAdapterClass: () => Promise<AnyAdapter>\n\n configSchema: AnyConfigurationSchemaType\n\n adapterCapabilities: string[]\n\n adapterMetadata?: AdapterMetadata\n\n constructor(\n stuff: {\n name: string\n configSchema: AnyConfigurationSchemaType\n displayName?: string\n adapterCapabilities?: string[]\n adapterMetadata?: AdapterMetadata\n } & (\n | {\n AdapterClass: AnyAdapter\n }\n | {\n getAdapterClass: () => Promise<AnyAdapter>\n }\n ),\n ) {\n super(stuff)\n this.getAdapterClass =\n 'AdapterClass' in stuff\n ? async () => stuff.AdapterClass\n : stuff.getAdapterClass\n this.configSchema = stuff.configSchema\n this.adapterCapabilities = stuff.adapterCapabilities || []\n this.adapterMetadata = stuff.adapterMetadata\n }\n}\n","import React from 'react'\nimport { IAnyModelType } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\n\ntype BasicComponent = React.ComponentType<{\n // TODO: can we use AbstractViewModel here?\n\n model: any\n}>\ntype AddTrackWorkflowComponentType =\n | React.LazyExoticComponent<BasicComponent>\n | BasicComponent\n\nexport default class AddTrackWorkflow extends PluggableElementBase {\n ReactComponent: AddTrackWorkflowComponentType\n\n stateModel: IAnyModelType\n\n constructor(stuff: {\n name: string\n ReactComponent: AddTrackWorkflowComponentType\n stateModel: IAnyModelType\n }) {\n super(stuff)\n this.ReactComponent = stuff.ReactComponent\n this.stateModel = stuff.stateModel\n }\n}\n","import { IAnyModelType } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration'\nimport { AnyReactComponentType } from '../util'\n\nexport default class ConnectionType extends PluggableElementBase {\n stateModel: IAnyModelType\n\n configSchema: AnyConfigurationSchemaType\n\n description: string\n\n url: string\n\n configEditorComponent?: AnyReactComponentType\n\n constructor(stuff: {\n name: string\n stateModel: IAnyModelType\n configSchema: AnyConfigurationSchemaType\n displayName: string\n description: string\n configEditorComponent?: AnyReactComponentType\n url: string\n }) {\n super(stuff)\n this.stateModel = stuff.stateModel\n this.configSchema = stuff.configSchema\n this.description = stuff.description\n this.url = stuff.url\n this.configEditorComponent = stuff.configEditorComponent\n }\n}\n","import { IAnyModelType } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport { AnyReactComponentType } from '../util'\nimport { AnyConfigurationSchemaType } from '../configuration'\n\nexport default class DisplayType extends PluggableElementBase {\n stateModel: IAnyModelType\n\n configSchema: AnyConfigurationSchemaType\n\n ReactComponent: AnyReactComponentType\n\n /**\n * The track type the display is associated with\n */\n trackType: string\n\n /*\n * Indicates that this display type can be a \"sub-display\" of another type of\n * display, e.g. in AlignmentsDisplay, has Pileup and SNPCoverage subDisplays\n */\n subDisplay?: {\n type: string\n [key: string]: unknown\n }\n\n /**\n * The view type the display is associated with\n */\n viewType: string\n\n constructor(stuff: {\n name: string\n stateModel: IAnyModelType\n trackType: string\n viewType: string\n displayName?: string\n subDisplay?: { type: string; [key: string]: unknown }\n configSchema: AnyConfigurationSchemaType\n ReactComponent: AnyReactComponentType\n }) {\n super(stuff)\n this.stateModel = stuff.stateModel\n this.subDisplay = stuff.subDisplay\n this.configSchema = stuff.configSchema\n this.ReactComponent = stuff.ReactComponent\n this.trackType = stuff.trackType\n this.viewType = stuff.viewType\n }\n}\n","import { IAnyModelType } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration/types'\n\nexport default class InternetAccountType extends PluggableElementBase {\n stateModel: IAnyModelType\n\n configSchema: AnyConfigurationSchemaType\n\n constructor(stuff: {\n name: string\n stateModel: IAnyModelType\n configSchema: AnyConfigurationSchemaType\n }) {\n super(stuff)\n this.stateModel = stuff.stateModel\n this.configSchema = stuff.configSchema\n }\n}\n","export default abstract class PluggableElementBase {\n name: string\n maybeDisplayName?: string\n\n constructor(args: { name?: string; displayName?: string }) {\n this.name = args.name || 'UNKNOWN'\n this.maybeDisplayName = args.displayName\n }\n\n get displayName() {\n return this.maybeDisplayName || this.name\n }\n}\n","// adapted from map-obj (MIT), with modifications to pass the \"whole object\"\n// from an array of objects into itself\nconst isObject = (value: unknown) => typeof value === 'object' && value !== null\n\n// Customized for this use-case\nconst isObjectCustom = (value: unknown) =>\n isObject(value) &&\n !(value instanceof RegExp) &&\n !(value instanceof Error) &&\n !(value instanceof Date) &&\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n !(globalThis.Blob && value instanceof globalThis.Blob)\n\ntype Obj = Record<string, unknown>\n\nexport default function map(\n object: Obj,\n mapper: (val: unknown) => void,\n isSeen = new WeakSet(),\n) {\n if (isSeen.has(object)) {\n return\n }\n\n isSeen.add(object)\n\n const mapArray = (array: unknown[]) => {\n array.forEach(element => {\n mapper(element)\n if (isObject(element)) {\n map(element as Record<string, unknown>, mapper, isSeen)\n }\n })\n }\n\n if (Array.isArray(object)) {\n mapArray(object)\n }\n\n for (const value of Object.values(object)) {\n mapper(value)\n\n if (isObjectCustom(value)) {\n if (Array.isArray(value)) {\n mapArray(value)\n } else {\n map(value as Obj, mapper, isSeen)\n }\n }\n }\n}\n","import mapObject from '../util/map-obj'\nimport PluginManager from '../PluginManager'\nimport PluggableElementBase from './PluggableElementBase'\nimport { setBlobMap, getBlobMap } from '../util/tracks'\nimport {\n isAppRootModel,\n isUriLocation,\n isAuthNeededException,\n RetryError,\n UriLocation,\n} from '../util/types'\n\nimport {\n deserializeAbortSignal,\n isRemoteAbortSignal,\n RemoteAbortSignal,\n} from '../rpc/remoteAbortSignals'\n\ninterface SerializedArgs {\n signal?: RemoteAbortSignal\n blobMap?: Record<string, File>\n}\nexport type RpcMethodConstructor = new (pm: PluginManager) => RpcMethodType\n\nexport default abstract class RpcMethodType extends PluggableElementBase {\n constructor(public pluginManager: PluginManager) {\n super({})\n }\n\n async serializeArguments(\n args: Record<string, unknown>,\n rpcDriverClassName: string,\n ): Promise<Record<string, unknown>> {\n const blobMap = getBlobMap()\n await this.augmentLocationObjects(args, rpcDriverClassName)\n return { ...args, blobMap }\n }\n\n async serializeNewAuthArguments(\n loc: UriLocation,\n rpcDriverClassName: string,\n ) {\n const rootModel = this.pluginManager.rootModel\n\n // args dont need auth or already have auth\n if (!isAppRootModel(rootModel) || loc.internetAccountPreAuthorization) {\n return loc\n }\n\n const account = rootModel.findAppropriateInternetAccount(loc)\n\n // mutating loc object is not allowed in MainThreadRpcDriver, and is only\n // needed for web worker RPC\n if (account && rpcDriverClassName !== 'MainThreadRpcDriver') {\n loc.internetAccountPreAuthorization =\n await account.getPreAuthorizationInformation(loc)\n }\n return loc\n }\n\n async deserializeArguments<T extends SerializedArgs>(\n serializedArgs: T,\n _rpcDriverClassName: string,\n ) {\n if (serializedArgs.blobMap) {\n setBlobMap(serializedArgs.blobMap)\n }\n const { signal } = serializedArgs\n\n return {\n ...serializedArgs,\n signal: isRemoteAbortSignal(signal)\n ? deserializeAbortSignal(signal)\n : undefined,\n }\n }\n\n abstract execute(\n serializedArgs: unknown,\n rpcDriverClassName: string,\n ): Promise<unknown>\n\n async serializeReturn(\n originalReturn: unknown,\n _args: unknown,\n _rpcDriverClassName: string,\n ) {\n return originalReturn\n }\n\n async deserializeReturn(\n serializedReturn: unknown,\n _args: unknown,\n _rpcDriverClassName: string,\n ) {\n let r: unknown\n try {\n r = await serializedReturn\n } catch (error) {\n if (isAuthNeededException(error)) {\n const retryAccount = // @ts-expect-error\n this.pluginManager.rootModel?.createEphemeralInternetAccount(\n `HTTPBasicInternetAccount-${new URL(error.url).origin}`,\n {},\n error.url,\n )\n throw new RetryError(\n 'Retrying with created internet account',\n retryAccount.internetAccountId,\n )\n }\n throw error\n }\n return r\n }\n\n private async augmentLocationObjects(\n thing: Record<string, unknown>,\n rpcDriverClassName: string,\n ) {\n const uris = [] as UriLocation[]\n\n // using map-obj avoids cycles, seen in circular view svg export\n mapObject(thing, val => {\n if (isUriLocation(val)) {\n uris.push(val)\n }\n })\n for (const uri of uris) {\n await this.serializeNewAuthArguments(uri, rpcDriverClassName)\n }\n return thing\n }\n}\n","import PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration'\nimport { AnyAdapter } from '../data_adapters/BaseAdapter'\n\nexport default class TextSearchAdapterType extends PluggableElementBase {\n getAdapterClass: () => Promise<AnyAdapter>\n\n configSchema: AnyConfigurationSchemaType\n\n description?: string\n\n constructor(\n stuff: {\n name: string\n displayName?: string\n description?: string\n configSchema: AnyConfigurationSchemaType\n } & (\n | {\n AdapterClass: AnyAdapter\n }\n | {\n getAdapterClass: () => Promise<AnyAdapter>\n }\n ),\n ) {\n super(stuff)\n this.description = stuff.description\n this.configSchema = stuff.configSchema\n this.getAdapterClass =\n 'getAdapterClass' in stuff\n ? stuff.getAdapterClass\n : async () => stuff.AdapterClass\n }\n}\n","import { IAnyModelType } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration'\nimport DisplayType from './DisplayType'\n\nexport default class TrackType extends PluggableElementBase {\n stateModel: IAnyModelType\n\n configSchema: AnyConfigurationSchemaType\n\n displayTypes: DisplayType[] = []\n\n constructor(stuff: {\n name: string\n stateModel: IAnyModelType\n displayName?: string\n configSchema: AnyConfigurationSchemaType\n }) {\n super(stuff)\n this.stateModel = stuff.stateModel\n this.configSchema = stuff.configSchema\n }\n\n addDisplayType(display: DisplayType) {\n this.displayTypes.push(display)\n }\n}\n","import React from 'react'\nimport { IAnyModelType, IAnyStateTreeNode } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport DisplayType from './DisplayType'\n\ntype BasicView = React.ComponentType<{\n // TODO: can we use AbstractViewModel here?\n\n model: any\n session?: IAnyStateTreeNode\n}>\ntype ViewComponentType = React.LazyExoticComponent<BasicView> | BasicView\n\nexport default class ViewType extends PluggableElementBase {\n ReactComponent: ViewComponentType\n\n stateModel: IAnyModelType\n\n displayTypes: DisplayType[] = []\n\n // extendedName can be used for when you extend a given view type, and want\n // to register all of that view types displays to yourself\n //\n // e.g. you create a linear-genome-view subtype, and want all the tracks that\n // are compatible display types for the linear-genome-view to be compatible\n // with your type also (without this, display types are only registered to a\n // single view type)\n extendedName?: string\n\n constructor(stuff: {\n name: string\n displayName?: string\n ReactComponent: ViewComponentType\n stateModel: IAnyModelType\n extendedName?: string\n }) {\n super(stuff)\n this.ReactComponent = stuff.ReactComponent\n this.stateModel = stuff.stateModel\n this.extendedName = stuff.extendedName\n }\n\n addDisplayType(display: DisplayType) {\n this.displayTypes.push(display)\n }\n}\n","import React, { ComponentType, LazyExoticComponent } from 'react'\nimport { IAnyModelType, IAnyStateTreeNode } from 'mobx-state-tree'\nimport PluggableElementBase from './PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../configuration'\n\ntype WidgetComponentType = LazyExoticComponent<React.FC<any>> | React.FC<any>\n\ntype HeadingComponentType = ComponentType<{ model: IAnyStateTreeNode }>\n\nexport default class WidgetType extends PluggableElementBase {\n heading?: string\n\n configSchema: AnyConfigurationSchemaType\n\n HeadingComponent?: HeadingComponentType\n\n ReactComponent: WidgetComponentType\n\n stateModel: IAnyModelType\n\n constructor(stuff: {\n name: string\n heading?: string\n HeadingComponent?: HeadingComponentType\n configSchema: AnyConfigurationSchemaType\n stateModel: IAnyModelType\n ReactComponent: WidgetComponentType\n }) {\n super(stuff)\n this.heading = stuff.heading\n this.HeadingComponent = stuff.HeadingComponent\n this.configSchema = stuff.configSchema\n this.stateModel = stuff.stateModel\n this.ReactComponent = stuff.ReactComponent\n }\n}\n","import { types, Instance } from 'mobx-state-tree'\nimport { ElementId } from '../../util/types/mst'\nimport { MenuItem } from '../../ui'\nimport { Region } from '../../util/types/mst'\n\n/**\n * #stateModel BaseViewModel\n * #category view\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BaseViewModel = types\n .model('BaseView', {\n /**\n * #property\n */\n id: ElementId,\n\n /**\n * #property\n * displayName is displayed in the header of the view, or assembly names\n * being used if none is specified\n */\n displayName: types.maybe(types.string),\n\n /**\n * #property\n */\n minimized: false,\n })\n .volatile(() => ({\n width: 800,\n }))\n .views(() => ({\n /**\n * #getter\n */\n menuItems(): MenuItem[] {\n return []\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setDisplayName(name: string) {\n self.displayName = name\n },\n\n /**\n * #action\n * width is an important attribute of the view model, when it becomes set, it\n * often indicates when the app can start drawing to it. certain views like\n * lgv are strict about this because if it tries to draw before it knows the\n * width it should draw to, it may start fetching data for regions it doesn't\n * need to\n *\n * setWidth is updated by a ResizeObserver generally, the views often need\n * to know how wide they are to properly draw genomic regions\n */\n setWidth(newWidth: number) {\n self.width = newWidth\n },\n\n /**\n * #action\n */\n setMinimized(flag: boolean) {\n self.minimized = flag\n },\n }))\n\nexport default BaseViewModel\n\nexport type IBaseViewModel = Instance<typeof BaseViewModel>\n\nexport const BaseViewModelWithDisplayedRegions = BaseViewModel.props({\n displayedRegions: types.array(Region),\n})\nexport type IBaseViewModelWithDisplayedRegions = Instance<\n typeof BaseViewModelWithDisplayedRegions\n>\n","import type { Instance } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '../../configuration'\n\n/**\n * #config BaseConnection\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BaseConnectionConfig = ConfigurationSchema(\n 'BaseConnection',\n {\n /**\n * #slot\n */\n name: {\n type: 'string',\n defaultValue: 'nameOfConnection',\n description: 'a unique name for this connection',\n },\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'optional list of names of assemblies in this connection',\n },\n },\n {\n explicitlyTyped: true,\n /**\n * #identifier\n */\n explicitIdentifier: 'connectionId',\n },\n)\n\nexport default BaseConnectionConfig\nexport type BaseConnectionConfigSchema = typeof BaseConnectionConfig\nexport type BaseConnectionConfigModel = Instance<BaseConnectionConfigSchema>\n","import { cast, types } from 'mobx-state-tree'\nimport {\n AnyConfigurationModel,\n ConfigurationReference,\n} from '../../configuration'\nimport PluginManager from '../../PluginManager'\n\nimport configSchema from './baseConnectionConfig'\n\ntype TrackConf = AnyConfigurationModel | Record<string, unknown>\n\n/**\n * #stateModel BaseConnectionModel\n */\nfunction stateModelFactory(pluginManager: PluginManager) {\n return types\n .model('Connection', {\n /**\n * #property\n */\n name: types.identifier,\n /**\n * #property\n */\n tracks: types.array(pluginManager.pluggableConfigSchemaType('track')),\n\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .actions(() => ({\n /**\n * #action\n */\n connect(_arg: AnyConfigurationModel) {},\n }))\n .actions(self => ({\n afterAttach() {\n if (self.tracks.length === 0) {\n self.connect(self.configuration)\n }\n },\n /**\n * #action\n */\n addTrackConf(trackConf: TrackConf) {\n const length = self.tracks.push(trackConf)\n return self.tracks[length - 1]\n },\n /**\n * #action\n */\n addTrackConfs(trackConfs: TrackConf[]) {\n self.tracks.push(...trackConfs)\n },\n /**\n * #action\n */\n setTrackConfs(trackConfs: AnyConfigurationModel[]) {\n self.tracks = cast(trackConfs)\n },\n /**\n * #action\n */\n clear() {},\n }))\n}\n\nexport type BaseConnectionModel = ReturnType<typeof stateModelFactory>\nexport default stateModelFactory\n","import React from 'react'\nimport { getParent, Instance, types, isRoot } from 'mobx-state-tree'\n\n// locals\nimport { getConf } from '../../configuration'\nimport { MenuItem } from '../../ui'\nimport { getParentRenderProps } from '../../util/tracks'\nimport { getContainingView, getEnv } from '../../util'\nimport { ElementId } from '../../util/types/mst'\n\n/**\n * #stateModel BaseDisplay\n * #category display\n */\nfunction stateModelFactory() {\n return types\n .model('BaseDisplay', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.string,\n /**\n * #property\n */\n rpcDriverName: types.maybe(types.string),\n })\n .volatile(() => ({\n rendererTypeName: '',\n error: undefined as unknown,\n message: undefined as string | undefined,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get RenderingComponent(): React.FC<{\n model: typeof self\n onHorizontalScroll?: () => void\n blockState?: Record<string, any>\n }> {\n const { pluginManager } = getEnv(self)\n return pluginManager.getDisplayType(self.type)!\n .ReactComponent as React.FC<{\n model: typeof self\n onHorizontalScroll?: () => void\n blockState?: Record<string, any>\n }>\n },\n\n /**\n * #getter\n */\n get DisplayBlurb(): React.FC<{ model: typeof self }> | null {\n return null\n },\n\n /**\n * #getter\n */\n get adapterConfig() {\n return getConf(this.parentTrack, 'adapter')\n },\n\n /**\n * #getter\n */\n get parentTrack() {\n let track = getParent<any>(self)\n while (!(track.configuration && getConf(track, 'trackId'))) {\n if (isRoot(track)) {\n throw new Error(`No parent track found for ${self.type} ${self.id}`)\n }\n track = getParent<any>(track)\n }\n return track\n },\n\n /**\n * #method\n * the react props that are passed to the Renderer when data\n * is rendered in this display\n */\n renderProps() {\n return {\n ...getParentRenderProps(self),\n notReady: getContainingView(self).minimized,\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n }\n },\n\n /**\n * #getter\n * the pluggable element type object for this display's renderer\n */\n get rendererType() {\n const { pluginManager } = getEnv(self)\n return pluginManager.getRendererType(self.rendererTypeName)!\n },\n\n /**\n * #getter\n * if a display-level message should be displayed instead, make this\n * return a react component\n */\n get DisplayMessageComponent() {\n return undefined as undefined | React.FC<any>\n },\n /**\n * #method\n */\n trackMenuItems(): MenuItem[] {\n return []\n },\n\n /**\n * #getter\n */\n get viewMenuActions(): MenuItem[] {\n return []\n },\n /**\n * #method\n * @param region -\n * @returns falsy if the region is fine to try rendering. Otherwise,\n * return a react node + string of text. string of text describes why it\n * cannot be rendered react node allows user to force load at current\n * setting\n */\n regionCannotBeRendered(/* region */) {\n return null\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setMessage(arg?: string) {\n self.message = arg\n },\n /**\n * #action\n */\n setError(error?: unknown) {\n self.error = error\n },\n /**\n * #action\n */\n setRpcDriverName(rpcDriverName: string) {\n self.rpcDriverName = rpcDriverName\n },\n /**\n * #action\n * base display reload does nothing, see specialized displays for details\n */\n reload() {},\n }))\n}\n\nexport const BaseDisplay = stateModelFactory()\nexport type BaseDisplayStateModel = typeof BaseDisplay\nexport type BaseDisplayModel = Instance<BaseDisplayStateModel>\n","import { ConfigurationSchema } from '../../configuration'\n\n/**\n * #config BaseInternetAccount\n * the \"base\" internet account type\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport const BaseInternetAccountConfig = ConfigurationSchema(\n 'InternetAccount',\n {\n /**\n * #slot\n */\n name: {\n description: 'descriptive name of the internet account',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n description: {\n description: 'a description of the internet account',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n authHeader: {\n description: 'request header for credentials',\n type: 'string',\n defaultValue: 'Authorization',\n },\n /**\n * #slot\n */\n tokenType: {\n description: 'a custom name for a token to include in the header',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n domains: {\n description:\n 'array of valid domains the url can contain to use this account',\n type: 'stringArray',\n defaultValue: [],\n },\n },\n {\n /**\n * #identifier\n */\n explicitIdentifier: 'internetAccountId',\n explicitlyTyped: true,\n },\n)\n","import React from 'react'\nimport { Instance, types } from 'mobx-state-tree'\nimport { ConfigurationReference, getConf } from '../../configuration'\nimport { RemoteFileWithRangeCache } from '../../util/io'\nimport { ElementId } from '../../util/types/mst'\nimport { UriLocation, AnyReactComponentType } from '../../util/types'\nimport { BaseInternetAccountConfig } from './baseInternetAccountConfig'\n\nconst inWebWorker = typeof sessionStorage === 'undefined'\n\n/**\n * #stateModel BaseInternetAccountModel\n * #category internetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport const InternetAccount = types\n .model('InternetAccount', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.string,\n /**\n * #property\n */\n configuration: ConfigurationReference(BaseInternetAccountConfig),\n })\n .views(self => ({\n /**\n * #getter\n */\n get name(): string {\n return getConf(self, 'name')\n },\n /**\n * #getter\n */\n get description(): string {\n return getConf(self, 'description')\n },\n /**\n * #getter\n */\n get internetAccountId(): string {\n return getConf(self, 'internetAccountId') // NOTE: this is the explicitIdentifier of the config schema\n },\n /**\n * #getter\n */\n get authHeader(): string {\n return getConf(self, 'authHeader')\n },\n /**\n * #getter\n */\n get tokenType(): string {\n return getConf(self, 'tokenType')\n },\n /**\n * #getter\n */\n get domains(): string[] {\n return getConf(self, 'domains')\n },\n /**\n * #getter\n * Can use this to customize what is displayed in fileSelector's toggle box\n */\n get toggleContents(): React.ReactNode {\n return null\n },\n /**\n * #getter\n * Can use this to customize what the fileSelector. It takes a prop called\n * `setLocation` that should be used to set a UriLocation\n */\n get SelectorComponent(): AnyReactComponentType | undefined {\n return undefined\n },\n /**\n * #getter\n * Can use this to add a label to the UrlChooser. Has no effect if a custom\n * SelectorComponent is supplied\n */\n get selectorLabel(): string | undefined {\n return undefined\n },\n }))\n .views(self => ({\n /**\n * #method\n * Determine whether this internetAccount provides credentials for a URL\n * @param location - UriLocation of resource\n * @returns true or false\n */\n handlesLocation(location: UriLocation) {\n return self.domains.some(domain => location.uri.includes(domain))\n },\n /**\n * #getter\n * The key used to store this internetAccount's token in sessionStorage\n */\n get tokenKey() {\n return `${self.internetAccountId}-token`\n },\n }))\n .actions(self => ({\n /**\n * #action\n * Must be implemented by a model extending or composing this one. Pass the\n * user's token to `resolve`.\n * @param resolve - Pass the token to this function\n * @param reject - If there is an error getting the token, call this function\n */\n getTokenFromUser(\n _resolve: (token: string) => void,\n _reject: (error: Error) => void,\n ): void {\n throw new Error('getTokenFromUser must be implemented by extending model')\n },\n /**\n * #action\n */\n storeToken(token: string) {\n sessionStorage.setItem(self.tokenKey, token)\n },\n /**\n * #action\n */\n removeToken() {\n sessionStorage.removeItem(self.tokenKey)\n },\n /**\n * #action\n */\n retrieveToken() {\n return sessionStorage.getItem(self.tokenKey)\n },\n /**\n * #action\n * This can be used by an internetAccount to validate a token works before\n * it is used. This is run when preAuthorizationInformation is requested,\n * so it can be used to check that a token is valid before sending it to a\n * worker thread. It expects the token to be returned so that this action\n * can also be used to generate a new token (e.g. by using a refresh token)\n * if the original one was invalid. Should throw an error if a token is\n * invalid.\n *\n * @param token - Auth token\n * @param loc - UriLocation of the resource\n * @returns - Valid auth token\n */\n async validateToken(token: string, _loc: UriLocation) {\n return token\n },\n }))\n .actions(self => {\n let tokenPromise: Promise<string> | undefined = undefined\n return {\n /**\n * #action\n * Try to get the token from the location pre-auth, from local storage,\n * or from a previously cached promise. If token is not available, uses\n * `getTokenFromUser`.\n *\n * @param location - UriLocation of the resource\n * @returns A promise for the token\n */\n async getToken(location?: UriLocation): Promise<string> {\n if (tokenPromise) {\n return tokenPromise\n }\n let token = location?.internetAccountPreAuthorization?.authInfo?.token\n if (token) {\n tokenPromise = Promise.resolve(token)\n return tokenPromise\n }\n if (inWebWorker) {\n throw new Error(\n 'Did not get internet account pre-authorization info in worker',\n )\n }\n token = self.retrieveToken()\n if (token) {\n tokenPromise = Promise.resolve(token)\n return tokenPromise\n }\n tokenPromise = new Promise((resolve, reject) => {\n self.getTokenFromUser(\n token => {\n self.storeToken(token)\n resolve(token)\n },\n error => {\n self.removeToken()\n reject(error)\n },\n )\n })\n return tokenPromise\n },\n }\n })\n .actions(self => ({\n /**\n * #action\n */\n addAuthHeaderToInit(init?: RequestInit, token?: string) {\n return {\n ...init,\n headers: new Headers({\n ...init?.headers,\n ...(token\n ? {\n [self.authHeader]: self.tokenType\n ? `${self.tokenType} ${token}`\n : token,\n }\n : {}),\n }),\n }\n },\n /**\n * #action\n * Gets the token and returns it along with the information needed to\n * create a new internetAccount.\n *\n * @param location - UriLocation of the resource\n * @returns\n */\n async getPreAuthorizationInformation(location: UriLocation) {\n const authToken = await self.getToken(location)\n let validatedToken: string | undefined\n try {\n validatedToken = await self.validateToken(authToken, location)\n } catch (error) {\n self.removeToken()\n throw error\n }\n return {\n internetAccountType: self.type,\n authInfo: {\n token: validatedToken,\n configuration: getConf(self),\n },\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n * Get a fetch method that will add any needed authentication headers to\n * the request before sending it. If location is provided, it will be\n * checked to see if it includes a token in it pre-auth information.\n *\n * @param loc - UriLocation of the resource\n * @returns A function that can be used to fetch\n */\n getFetcher(loc?: UriLocation) {\n return async (input: RequestInfo, init?: RequestInit) => {\n const authToken = await self.getToken(loc)\n const newInit = self.addAuthHeaderToInit(init, authToken)\n return fetch(input, newInit)\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n * Gets a filehandle that uses a fetch that adds auth headers\n * @param location - UriLocation of the resource\n * @returns A filehandle\n */\n openLocation(location: UriLocation) {\n return new RemoteFileWithRangeCache(location.uri, {\n fetch: self.getFetcher(location),\n })\n },\n }))\n\nexport type BaseInternetAccountStateModel = typeof InternetAccount\nexport type BaseInternetAccountModel = Instance<BaseInternetAccountStateModel>\n","import { transaction } from 'mobx'\nimport {\n getRoot,\n resolveIdentifier,\n types,\n Instance,\n IAnyStateTreeNode,\n} from 'mobx-state-tree'\n\n// locals\nimport {\n getConf,\n AnyConfigurationModel,\n AnyConfigurationSchemaType,\n ConfigurationReference,\n} from '../../configuration'\nimport PluginManager from '../../PluginManager'\nimport { MenuItem } from '../../ui'\nimport { getContainingView, getEnv, getSession } from '../../util'\nimport { isSessionModelWithConfigEditing } from '../../util/types'\nimport { ElementId } from '../../util/types/mst'\n\nexport function getCompatibleDisplays(self: IAnyStateTreeNode) {\n const { pluginManager } = getEnv(self)\n const view = getContainingView(self)\n const viewType = pluginManager.getViewType(view.type)!\n const compatTypes = new Set(viewType.displayTypes.map(d => d.name))\n const displays = self.configuration.displays as AnyConfigurationModel[]\n return displays.filter(d => compatTypes.has(d.type))\n}\n\n/**\n * #stateModel BaseTrackModel\n * #category track\n *\n * these MST models only exist for tracks that are *shown*. they should contain\n * only UI state for the track, and have a reference to a track configuration.\n * note that multiple displayed tracks could use the same configuration.\n */\nexport function createBaseTrackModel(\n pm: PluginManager,\n trackType: string,\n baseTrackConfig: AnyConfigurationSchemaType,\n) {\n return types\n .model(trackType, {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal(trackType),\n /**\n * #property\n */\n configuration: ConfigurationReference(baseTrackConfig),\n /**\n * #property\n */\n minimized: false,\n /**\n * #property\n */\n displays: types.array(pm.pluggableMstType('display', 'stateModel')),\n })\n .views(self => ({\n /**\n * #getter\n * determines which webworker to send the track to, currently based on trackId\n */\n get rpcSessionId() {\n return self.configuration.trackId\n },\n /**\n * #getter\n */\n get name() {\n return getConf(self, 'name')\n },\n /**\n * #getter\n */\n get textSearchAdapter() {\n return getConf(self, 'textSearchAdapter')\n },\n\n /**\n * #getter\n */\n get adapterType() {\n const adapterConfig = getConf(self, 'adapter')\n if (!adapterConfig) {\n throw new Error(`no adapter configuration provided for ${self.type}`)\n }\n const adapterType = pm.getAdapterType(adapterConfig.type)\n if (!adapterType) {\n throw new Error(`unknown adapter type ${adapterConfig.type}`)\n }\n return adapterType\n },\n\n /**\n * #getter\n */\n get viewMenuActions(): MenuItem[] {\n return self.displays.flatMap(d => d.viewMenuActions)\n },\n\n /**\n * #getter\n */\n get canConfigure() {\n const session = getSession(self)\n const { sessionTracks, adminMode } = session\n return (\n isSessionModelWithConfigEditing(session) &&\n (adminMode ||\n sessionTracks?.find(t => t.trackId === self.configuration.trackId))\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setMinimized(flag: boolean) {\n self.minimized = flag\n },\n\n /**\n * #action\n */\n showDisplay(displayId: string, initialSnapshot = {}) {\n const schema = pm.pluggableConfigSchemaType('display')\n const conf = resolveIdentifier(schema, getRoot(self), displayId)\n const displayType = pm.getDisplayType(conf.type)\n if (!displayType) {\n throw new Error(`unknown display type ${conf.type}`)\n }\n const display = displayType.stateModel.create({\n ...initialSnapshot,\n type: conf.type,\n configuration: conf,\n })\n self.displays.push(display)\n },\n\n /**\n * #action\n */\n hideDisplay(displayId: string) {\n const schema = pm.pluggableConfigSchemaType('display')\n const conf = resolveIdentifier(schema, getRoot(self), displayId)\n const t = self.displays.filter(d => d.configuration === conf)\n transaction(() => {\n t.forEach(d => self.displays.remove(d))\n })\n return t.length\n },\n\n /**\n * #action\n */\n replaceDisplay(oldId: string, newId: string, initialSnapshot = {}) {\n const idx = self.displays.findIndex(\n d => d.configuration.displayId === oldId,\n )\n if (idx === -1) {\n throw new Error(`could not find display id ${oldId} to replace`)\n }\n const schema = pm.pluggableConfigSchemaType('display')\n const conf = resolveIdentifier(schema, getRoot(self), newId)\n const displayType = pm.getDisplayType(conf.type)\n if (!displayType) {\n throw new Error(`unknown display type ${conf.type}`)\n }\n self.displays.splice(idx, 1, {\n ...initialSnapshot,\n type: conf.type,\n configuration: conf,\n })\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n trackMenuItems() {\n const menuItems: MenuItem[] = self.displays.flatMap(d =>\n d.trackMenuItems(),\n )\n const shownId = self.displays[0].configuration.displayId\n const compatDisp = getCompatibleDisplays(self)\n\n return [\n ...menuItems,\n ...(compatDisp.length > 1\n ? [\n {\n type: 'subMenu',\n label: 'Display types',\n priority: -1000,\n subMenu: compatDisp.map(d => ({\n type: 'radio',\n label: pm.getDisplayType(d.type)!.displayName,\n checked: d.displayId === shownId,\n onClick: () => {\n self.replaceDisplay(shownId, d.displayId)\n },\n })),\n },\n ]\n : []),\n ]\n },\n }))\n}\n\nexport type BaseTrackStateModel = ReturnType<typeof createBaseTrackModel>\nexport type BaseTrackModel = Instance<BaseTrackStateModel>\n","import { types, Instance } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '../../configuration'\nimport PluginManager from '../../PluginManager'\n\n/**\n * #config BaseTrack\n */\nexport function createBaseTrackConfig(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'BaseTrack',\n {\n /**\n * #slot\n */\n name: {\n description: 'descriptive name of the track',\n type: 'string',\n defaultValue: 'Track',\n },\n /**\n * #slot\n */\n assemblyNames: {\n description: 'name of the assembly (or assemblies) track belongs to',\n type: 'stringArray',\n defaultValue: ['assemblyName'],\n },\n /**\n * #slot\n */\n description: {\n description: 'a description of the track',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n category: {\n description: 'the category and sub-categories of a track',\n type: 'stringArray',\n defaultValue: [],\n },\n /**\n * #slot\n */\n metadata: {\n type: 'frozen',\n description: 'anything to add about this track',\n defaultValue: {},\n },\n /**\n * #slot\n */\n adapter: pluginManager.pluggableConfigSchemaType('adapter'),\n\n textSearching: ConfigurationSchema('textSearching', {\n /**\n * #slot textSearching.indexedAttributes\n */\n indexingAttributes: {\n type: 'stringArray',\n description:\n 'list of which feature attributes to index for text searching',\n defaultValue: ['Name', 'ID'],\n },\n /**\n * #slot textSearching.indexingFeatureTypesToExclude\n */\n indexingFeatureTypesToExclude: {\n type: 'stringArray',\n description: 'list of feature types to exclude in text search index',\n defaultValue: ['CDS', 'exon'],\n },\n\n /**\n * #slot textSearching.textSearchAdapter\n */\n textSearchAdapter: pluginManager.pluggableConfigSchemaType(\n 'text search adapter',\n ),\n }),\n\n /**\n * #slot\n */\n displays: types.array(pluginManager.pluggableConfigSchemaType('display')),\n\n formatDetails: ConfigurationSchema('FormatDetails', {\n /**\n * #slot formatDetails.feature\n */\n feature: {\n type: 'frozen',\n description: 'adds extra fields to the feature details',\n defaultValue: {},\n contextVariable: ['feature'],\n },\n /**\n * #slot formatDetails.subfeatures\n */\n subfeatures: {\n type: 'frozen',\n description: 'adds extra fields to the subfeatures of a feature',\n defaultValue: {},\n contextVariable: ['feature'],\n },\n /**\n * #slot formatDetails.depth\n */\n depth: {\n type: 'number',\n defaultValue: 2,\n description:\n 'depth of subfeatures to iterate the formatter on formatDetails.subfeatures (e.g. you may not want to format the exon/cds subfeatures, so limited to 2',\n },\n /**\n * #slot formatDetails.maxDepth\n */\n maxDepth: {\n type: 'number',\n defaultValue: 99999,\n description: 'Maximum depth to render subfeatures',\n },\n }),\n formatAbout: ConfigurationSchema('FormatAbout', {\n /**\n * #slot formatAbout.config\n */\n config: {\n type: 'frozen',\n description: 'formats configuration object in about dialog',\n defaultValue: {},\n contextVariable: ['config'],\n },\n\n /**\n * #slot formatAbout.hideUris\n */\n hideUris: {\n type: 'boolean',\n defaultValue: false,\n },\n }),\n },\n {\n preProcessSnapshot: s2 => {\n const snap = pluginManager.evaluateExtensionPoint(\n 'Core-preProcessTrackConfig',\n JSON.parse(JSON.stringify(s2)),\n ) as {\n trackId: string\n name: string\n type: string\n displays: { type: string; displayId: string }[]\n }\n const { displays = [] } = snap\n if (snap.trackId !== 'placeholderId') {\n // Gets the displays on the track snapshot and the possible displays\n // from the track type and adds any missing possible displays to the\n // snapshot\n const configDisplayTypes = new Set(displays.map(d => d.type))\n pluginManager.getTrackType(snap.type)!.displayTypes.forEach(d => {\n if (!configDisplayTypes.has(d.name)) {\n displays.push({\n displayId: `${snap.trackId}-${d.name}`,\n type: d.name,\n })\n }\n })\n }\n return { ...snap, displays }\n },\n /**\n * #identifier\n */\n explicitIdentifier: 'trackId',\n explicitlyTyped: true,\n\n actions: (self: any) => ({\n addDisplayConf(conf: { type: string; displayId: string }) {\n const { type } = conf\n if (!type) {\n throw new Error(`unknown display type ${type}`)\n }\n const display = self.displays.find(\n (d: any) => d?.displayId === conf.displayId,\n )\n if (display) {\n return display\n }\n const length = self.displays.push(conf)\n return self.displays[length - 1]\n },\n }),\n },\n )\n}\n\nexport type BaseTrackConfigSchema = ReturnType<typeof createBaseTrackConfig>\nexport type BaseTrackConfig = Instance<BaseTrackConfigSchema>\n","import deepEqual from 'fast-deep-equal'\n\n// layouts\nimport GranularRectLayout from '../../util/layouts/GranularRectLayout'\nimport MultiLayout from '../../util/layouts/MultiLayout'\nimport { SerializedLayout, BaseLayout } from '../../util/layouts/BaseLayout'\nimport PrecomputedLayout from '../../util/layouts/PrecomputedLayout'\n\n// other\nimport FeatureRendererType, {\n RenderArgs as FeatureRenderArgs,\n RenderArgsSerialized as FeatureRenderArgsSerialized,\n RenderArgsDeserialized as FeatureRenderArgsDeserialized,\n RenderResults as FeatureRenderResults,\n ResultsSerialized as FeatureResultsSerialized,\n ResultsDeserialized as FeatureResultsDeserialized,\n} from './FeatureRendererType'\nimport { getLayoutId, Region, Feature } from '../../util'\nimport { readConfObject, AnyConfigurationModel } from '../../configuration'\nimport SerializableFilterChain from './util/serializableFilterChain'\nimport RpcManager from '../../rpc/RpcManager'\n\nexport interface LayoutSessionProps {\n config: AnyConfigurationModel\n bpPerPx: number\n filters?: SerializableFilterChain\n}\n\nexport type MyMultiLayout = MultiLayout<GranularRectLayout<unknown>, unknown>\n\nexport interface CachedLayout {\n layout: MyMultiLayout\n config: AnyConfigurationModel\n filters?: SerializableFilterChain\n}\n\nexport class LayoutSession implements LayoutSessionProps {\n config: AnyConfigurationModel\n\n bpPerPx: number\n\n filters?: SerializableFilterChain\n\n constructor(args: LayoutSessionProps) {\n this.config = args.config\n this.bpPerPx = args.bpPerPx\n this.filters = args.filters\n this.update(args)\n }\n\n update(props: LayoutSessionProps) {\n Object.assign(this, props)\n }\n\n makeLayout() {\n return new MultiLayout(GranularRectLayout, {\n maxHeight: readConfObject(this.config, 'maxHeight'),\n displayMode: readConfObject(this.config, 'displayMode'),\n pitchX: this.bpPerPx,\n pitchY: readConfObject(this.config, 'noSpacing') ? 1 : 3,\n })\n }\n\n /**\n * @param layout -\n * @returns true if the given layout is a valid one to use for this session\n */\n cachedLayoutIsValid(cachedLayout: CachedLayout) {\n return (\n cachedLayout.layout.subLayoutConstructorArgs.pitchX === this.bpPerPx &&\n deepEqual(readConfObject(this.config), cachedLayout.config) &&\n deepEqual(this.filters, cachedLayout.filters)\n )\n }\n\n cachedLayout: CachedLayout | undefined\n\n get layout(): MyMultiLayout {\n if (!this.cachedLayout || !this.cachedLayoutIsValid(this.cachedLayout)) {\n this.cachedLayout = {\n layout: this.makeLayout(),\n config: readConfObject(this.config),\n filters: this.filters,\n }\n }\n return this.cachedLayout.layout\n }\n}\nexport interface RenderArgs extends FeatureRenderArgs {\n bpPerPx: number\n layoutId: string\n}\n\nexport interface RenderArgsSerialized extends FeatureRenderArgsSerialized {\n bpPerPx: number\n}\n\nexport interface RenderArgsDeserialized extends FeatureRenderArgsDeserialized {\n bpPerPx: number\n layoutId: string\n}\n\nexport interface RenderResults extends FeatureRenderResults {\n layout: BaseLayout<Feature>\n}\n\nexport interface ResultsSerialized extends FeatureResultsSerialized {\n maxHeightReached: boolean\n layout: SerializedLayout\n}\n\nexport interface ResultsDeserialized extends FeatureResultsDeserialized {\n maxHeightReached: boolean\n layout: PrecomputedLayout<string>\n}\n\nexport default class BoxRendererType extends FeatureRendererType {\n sessions: Record<string, LayoutSession> = {}\n\n getWorkerSession(\n props: LayoutSessionProps & { sessionId: string; layoutId: string },\n ) {\n const key = getLayoutId(props)\n if (!this.sessions[key]) {\n this.sessions[key] = this.createSession(props)\n }\n const session = this.sessions[key]\n session.update(props)\n return session\n }\n\n getExpandedRegion(region: Region, renderArgs: RenderArgsDeserialized) {\n const { bpPerPx, config } = renderArgs\n const maxFeatureGlyphExpansion =\n readConfObject(config, 'maxFeatureGlyphExpansion') || 0\n const bpExpansion = Math.round(maxFeatureGlyphExpansion * bpPerPx)\n return {\n ...(region as Omit<typeof region, symbol>),\n start: Math.floor(Math.max(region.start - bpExpansion, 0)),\n end: Math.ceil(region.end + bpExpansion),\n }\n }\n\n createSession(props: LayoutSessionProps) {\n return new LayoutSession(props)\n }\n\n async freeResourcesInClient(rpcManager: RpcManager, args: RenderArgs) {\n const { regions } = args\n const key = getLayoutId(args)\n const session = this.sessions[key]\n if (session) {\n const region = regions[0]!\n session.layout.discardRange(region.refName, region.start, region.end)\n }\n return await super.freeResourcesInClient(rpcManager, args)\n }\n\n deserializeLayoutInClient(json: SerializedLayout) {\n return new PrecomputedLayout(json)\n }\n\n deserializeResultsInClient(result: ResultsSerialized, args: RenderArgs) {\n const layout = this.deserializeLayoutInClient(result.layout)\n return super.deserializeResultsInClient(\n { ...result, layout } as FeatureResultsSerialized,\n args,\n ) as ResultsDeserialized\n }\n\n createLayoutInWorker(args: RenderArgsDeserialized) {\n const { regions } = args\n const session = this.getWorkerSession(args)\n return session.layout.getSublayout(regions[0]!.refName)\n }\n\n serializeResultsInWorker(\n results: RenderResults,\n args: RenderArgsDeserialized,\n ): ResultsSerialized {\n const serialized = super.serializeResultsInWorker(\n results,\n args,\n ) as ResultsSerialized\n\n const region = args.regions[0]!\n serialized.layout = results.layout.serializeRegion(\n this.getExpandedRegion(region, args),\n )\n serialized.features = serialized.features.filter(f => {\n return Boolean(serialized.layout.rectangles[f.uniqueId])\n })\n\n serialized.maxHeightReached = serialized.layout.maxHeightReached\n return serialized\n }\n\n /**\n * gets layout and renders\n *\n * @param props - render args\n */\n async render(props: RenderArgsDeserialized): Promise<RenderResults> {\n const layout =\n (props.layout as undefined | BaseLayout<unknown>) ||\n this.createLayoutInWorker(props)\n const result = await super.render({ ...props, layout })\n return { ...result, layout }\n }\n}\n","import React, { useEffect, useRef } from 'react'\nimport { observer } from 'mobx-react'\n\n// locals\nimport { AnyReactComponentType, Feature, rIC } from '../../util'\nimport { ThemeOptions, ThemeProvider } from '@mui/material'\nimport { createJBrowseTheme } from '../../ui'\nimport { getRoot } from 'mobx-state-tree'\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, unmountComponentAtNode } from 'react-dom'\n\ninterface Props {\n html: string\n features: Map<string, Feature>\n theme: ThemeOptions\n\n displayModel?: any\n RenderingComponent: AnyReactComponentType\n}\n\nconst NewHydrate = observer(function RpcRenderedSvgGroup(props: Props) {\n const { html, theme, RenderingComponent, ...rest } = props\n const ref = useRef<SVGGElement>(null)\n\n // this `any` is a react-dom/client::Root\n\n const rootRef = useRef<any>()\n\n const root = getRoot<any>(props.displayModel)\n const hydrateRoot = root.hydrateFn\n\n useEffect(() => {\n const renderTimeout = rIC(() => {\n if (!ref.current) {\n return\n }\n const jbrowseTheme = createJBrowseTheme(theme)\n rootRef.current =\n rootRef.current ??\n hydrateRoot(\n ref.current,\n <ThemeProvider theme={jbrowseTheme}>\n <RenderingComponent {...rest} />\n </ThemeProvider>,\n )\n })\n return () => {\n if (renderTimeout !== undefined) {\n clearTimeout(renderTimeout)\n }\n const root = rootRef.current\n rootRef.current = undefined\n\n setTimeout(() => {\n root?.unmount()\n })\n }\n // biome-ignore lint/correctness/useExhaustiveDependencies:\n }, [RenderingComponent, hydrateRoot, theme, rest])\n\n return <g ref={ref} dangerouslySetInnerHTML={{ __html: html }} />\n})\n\nconst OldHydrate = observer(function OldHydrate(props: Props) {\n const { html, RenderingComponent } = props\n const ref = useRef<SVGGElement>(null)\n useEffect(() => {\n const domNode = ref.current\n function doHydrate() {\n if (domNode && html) {\n if (domNode.innerHTML) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n unmountComponentAtNode(domNode)\n }\n\n // setting outline:none fixes react \"focusable\" element issue. see\n // https://github.com/GMOD/jbrowse-components/issues/2160\n domNode.style.outline = 'none'\n domNode.innerHTML = html\n // use requestIdleCallback to defer main-thread rendering and\n // hydration for when we have some free time. helps keep the\n // framerate up.\n rIC(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n hydrate(<RenderingComponent {...props} />, domNode)\n })\n }\n }\n doHydrate()\n return () => {\n if (domNode) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n unmountComponentAtNode(domNode)\n }\n }\n }, [html, RenderingComponent, props])\n\n return <g ref={ref} />\n})\n\nconst RpcRenderedSvgGroup = observer(function (props: Props) {\n const root = getRoot<any>(props.displayModel)\n return root.hydrateFn ? <NewHydrate {...props} /> : <OldHydrate {...props} />\n})\n\nexport default RpcRenderedSvgGroup\n","import React from 'react'\nimport { SimpleFeature, SimpleFeatureSerialized } from '../../util'\nimport FeatureRenderer from './FeatureRendererType'\nimport RpcRenderedSvgGroup from './RpcRenderedSvgGroup'\nimport { ThemeOptions } from '@mui/material'\n\nexport default class CircularChordRendererType extends FeatureRenderer {\n supportsSVG = true\n\n deserializeResultsInClient(\n res: { features: SimpleFeatureSerialized[]; html: string },\n args: {\n displayModel?: any\n theme: ThemeOptions\n exportSVG?: { rasterizeLayers?: boolean }\n },\n ) {\n const deserializedFeatures = new Map(\n res.features.map(f => SimpleFeature.fromJSON(f)).map(f => [f.id(), f]),\n )\n // if we are rendering svg, we skip hydration\n if (args.exportSVG) {\n // only return the res if the renderer explicitly has\n // this.supportsSVG support to avoid garbage being rendered in SVG\n // document\n return {\n ...res,\n features: deserializedFeatures,\n blockKey: 'circularChord',\n html: this.supportsSVG\n ? res.html\n : '<text y=\"12\" fill=\"black\">SVG export not supported for this track</text>',\n }\n }\n\n // hydrate res using ServerSideRenderedContent\n return {\n ...res,\n features: deserializedFeatures,\n blockKey: 'circularChord',\n reactElement: (\n <RpcRenderedSvgGroup\n {...args}\n {...res}\n features={deserializedFeatures}\n RenderingComponent={this.ReactComponent}\n />\n ),\n }\n }\n}\n","import { filter, toArray } from 'rxjs/operators'\nimport { Feature } from '../../util/simpleFeature'\nimport { Region } from '../../util/types'\nimport ServerSideRenderer, {\n RenderArgs as ServerSideRenderArgs,\n RenderArgsSerialized as ServerSideRenderArgsSerialized,\n RenderArgsDeserialized as ServerSideRenderArgsDeserialized,\n ResultsSerialized as ServerSideResultsSerialized,\n ResultsDeserialized as ServerSideResultsDeserialized,\n} from './ServerSideRendererType'\nimport RpcManager from '../../rpc/RpcManager'\nimport { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport { BaseFeatureDataAdapter } from '../../data_adapters/BaseAdapter'\nimport { dedupe, getSerializedSvg } from '../../util'\nimport { firstValueFrom } from 'rxjs'\nimport { AnyConfigurationModel } from '../../configuration'\n\nexport interface RenderArgs extends ServerSideRenderArgs {\n blockKey: string\n}\n\nexport interface RenderArgsSerialized extends ServerSideRenderArgsSerialized {\n blockKey: string\n}\n\nexport interface RenderArgsDeserialized\n extends ServerSideRenderArgsDeserialized {\n blockKey: string\n}\n\nexport type ResultsSerialized = ServerSideResultsSerialized\n\nexport interface ResultsDeserialized extends ServerSideResultsDeserialized {\n blockKey: string\n}\n\nexport interface ResultsSerializedSvgExport extends ResultsSerialized {\n canvasRecordedData: unknown\n width: number\n height: number\n reactElement: unknown\n}\n\nfunction isSvgExport(e: ResultsSerialized): e is ResultsSerializedSvgExport {\n return 'canvasRecordedData' in e\n}\n\nexport default class ComparativeServerSideRenderer extends ServerSideRenderer {\n /**\n * directly modifies the render arguments to prepare them to be serialized\n * and sent to the worker.\n *\n * @param args - the arguments passed to render\n * @returns the same object\n */\n\n async renameRegionsIfNeeded(args: RenderArgs) {\n return args\n }\n\n serializeArgsInClient(args: RenderArgs) {\n const deserializedArgs = {\n ...args,\n displayModel: undefined,\n }\n\n return super.serializeArgsInClient(deserializedArgs)\n }\n\n // deserialize some of the results that came back from the worker\n deserializeResultsInClient(\n result: ResultsSerialized,\n args: RenderArgs,\n ): ResultsDeserialized {\n const deserialized = super.deserializeResultsInClient(result, args)\n return {\n ...deserialized,\n blockKey: args.blockKey,\n }\n }\n\n /**\n * Render method called on the client. Serializes args, then\n * calls `render` with the RPC manager.\n */\n async renderInClient(rpcManager: RpcManager, args: RenderArgs) {\n const results = (await rpcManager.call(\n args.sessionId,\n 'ComparativeRender',\n args,\n )) as ResultsSerialized\n\n if (isSvgExport(results)) {\n results.html = await getSerializedSvg(results)\n results.reactElement = undefined\n }\n return results\n }\n\n /**\n * @param renderArgs -\n * @param feature -\n * @returns true if this feature passes all configured filters\n */\n featurePassesFilters(renderArgs: RenderArgsDeserialized, feature: Feature) {\n return renderArgs.filters\n ? renderArgs.filters.passes(feature, renderArgs)\n : true\n }\n\n async getFeatures(renderArgs: {\n regions: Region[]\n sessionId: string\n adapterConfig: AnyConfigurationModel\n }) {\n const pm = this.pluginManager\n const { regions, sessionId, adapterConfig } = renderArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n const requestRegions = regions.map(r => {\n // make sure the requested region's start and end are integers, if\n // there is a region specification.\n const requestRegion = { ...r }\n if (requestRegion.start) {\n requestRegion.start = Math.floor(requestRegion.start)\n }\n if (requestRegion.end) {\n requestRegion.end = Math.floor(requestRegion.end)\n }\n return requestRegion\n })\n\n // note that getFeaturesInMultipleRegions does not do glyph expansion\n const res = await firstValueFrom(\n (dataAdapter as BaseFeatureDataAdapter)\n .getFeaturesInMultipleRegions(requestRegions, renderArgs)\n .pipe(\n // @ts-expect-error\n filter(f => this.featurePassesFilters(renderArgs, f)),\n toArray(),\n ),\n )\n\n // dedupe needed xref https://github.com/GMOD/jbrowse-components/pull/3404/\n return dedupe(res, f => f.id())\n }\n}\n\nexport { type RenderResults } from './ServerSideRendererType'\n","import { toArray } from 'rxjs/operators'\nimport clone from 'clone'\nimport { firstValueFrom } from 'rxjs'\n\n// locals\nimport { checkAbortSignal, iterMap } from '../../util'\nimport SimpleFeature, {\n Feature,\n SimpleFeatureSerialized,\n} from '../../util/simpleFeature'\nimport { AugmentedRegion as Region } from '../../util/types'\nimport { getAdapter } from '../../data_adapters/dataAdapterCache'\nimport ServerSideRendererType, {\n RenderArgs as ServerSideRenderArgs,\n RenderArgsSerialized as ServerSideRenderArgsSerialized,\n RenderArgsDeserialized as ServerSideRenderArgsDeserialized,\n RenderResults as ServerSideRenderResults,\n ResultsDeserialized as ServerSideResultsDeserialized,\n ResultsSerialized as ServerSideResultsSerialized,\n} from './ServerSideRendererType'\nimport { isFeatureAdapter } from '../../data_adapters/BaseAdapter'\nimport { AnyConfigurationModel } from '../../configuration'\n\nexport interface RenderArgs extends ServerSideRenderArgs {\n displayModel?: {\n id: string\n selectedFeatureId?: string\n }\n regions: Region[]\n blockKey: string\n}\n\nexport interface RenderArgsSerialized extends ServerSideRenderArgsSerialized {\n displayModel?: {\n id: string\n selectedFeatureId?: string\n }\n regions: Region[]\n blockKey: string\n}\n\nexport interface RenderArgsDeserialized\n extends ServerSideRenderArgsDeserialized {\n displayModel: { id: string; selectedFeatureId?: string }\n regions: Region[]\n blockKey: string\n adapterConfig: AnyConfigurationModel\n}\n\nexport interface RenderResults extends ServerSideRenderResults {\n features: Map<string, Feature>\n}\n\nexport interface ResultsSerialized extends ServerSideResultsSerialized {\n features: SimpleFeatureSerialized[]\n}\n\nexport interface ResultsDeserialized extends ServerSideResultsDeserialized {\n features: Map<string, Feature>\n blockKey: string\n}\n\nexport default class FeatureRendererType extends ServerSideRendererType {\n /**\n * replaces the `displayModel` param (which on the client is a MST model)\n * with a stub that only contains the `selectedFeature`, since this is the\n * only part of the track model that most renderers read. also serializes the\n * config and regions to JSON from MST objects.\n *\n * @param args - the arguments passed to render\n */\n serializeArgsInClient(args: RenderArgs) {\n const { regions } = args\n const serializedArgs = {\n ...args,\n displayModel: undefined,\n regions: clone(regions),\n }\n return super.serializeArgsInClient(serializedArgs)\n }\n\n /**\n * Adds feature deserialization to base server-side result deserialization\n *\n * @param results - the results of the render\n * @param args - the arguments passed to render\n */\n deserializeResultsInClient(\n result: ResultsSerialized,\n args: RenderArgs,\n ): ResultsDeserialized {\n const deserializedFeatures = new Map<string, SimpleFeature>(\n result.features.map(f => SimpleFeature.fromJSON(f)).map(f => [f.id(), f]),\n )\n\n const deserialized = super.deserializeResultsInClient(\n {\n ...result,\n features: deserializedFeatures,\n } as ServerSideResultsSerialized,\n args,\n )\n return {\n ...deserialized,\n blockKey: args.blockKey,\n features: deserializedFeatures,\n }\n }\n\n /**\n * Adds feature serialization to base server-side result serialization\n *\n * @param result - object containing the results of calling the `render`\n * method\n * @param args - deserialized render args\n */\n serializeResultsInWorker(\n result: RenderResults,\n args: RenderArgsDeserialized,\n ): ResultsSerialized {\n const serialized = super.serializeResultsInWorker(result, args)\n const { features } = result\n return {\n ...serialized,\n features: iterMap(features.values(), f => f.toJSON(), features.size),\n }\n }\n\n /**\n * will expand if soft clipping or feature glyphs are shown\n *\n * @param region - rendering region\n * @param _renderArgs - render args, unused, may be used in deriving classes\n */\n getExpandedRegion(region: Region, _renderArgs: RenderArgsDeserialized) {\n return region\n }\n\n /**\n * use the dataAdapter to fetch the features to be rendered\n *\n * @param renderArgs -\n * @returns Map of features as `{ id => feature, ... }`\n */\n async getFeatures(\n renderArgs: RenderArgsDeserialized,\n ): Promise<Map<string, Feature>> {\n const pm = this.pluginManager\n const { signal, regions, sessionId, adapterConfig } = renderArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n if (!isFeatureAdapter(dataAdapter)) {\n throw new Error('Adapter does not support retrieving features')\n }\n\n // make sure the requested region's start and end are integers, if\n // there is a region specification.\n const requestRegions = regions.map(r => {\n const requestRegion = { ...r }\n if (requestRegion.start) {\n requestRegion.start = Math.floor(requestRegion.start)\n }\n if (requestRegion.end) {\n requestRegion.end = Math.ceil(requestRegion.end)\n }\n return requestRegion\n })\n\n const region = requestRegions[0]!\n\n const featureObservable =\n requestRegions.length === 1\n ? dataAdapter.getFeatures(\n this.getExpandedRegion(region, renderArgs),\n renderArgs,\n )\n : dataAdapter.getFeaturesInMultipleRegions(requestRegions, renderArgs)\n\n const feats = await firstValueFrom(featureObservable.pipe(toArray()))\n checkAbortSignal(signal)\n return new Map<string, Feature>(\n feats\n .filter(feat => this.featurePassesFilters(renderArgs, feat))\n .map(feat => [feat.id(), feat] as const),\n )\n }\n\n /**\n * @param renderArgs -\n * @param feature -\n * @returns true if this feature passes all configured filters\n */\n featurePassesFilters(renderArgs: RenderArgsDeserialized, feature: Feature) {\n return renderArgs.filters\n ? renderArgs.filters.passes(feature, renderArgs)\n : true\n }\n\n /**\n * gets features and renders\n *\n * @param props - render args\n */\n async render(\n props: RenderArgsDeserialized & { features?: Map<string, Feature> },\n ): Promise<RenderResults> {\n const features = props.features || (await this.getFeatures(props))\n const result = await super.render({ ...props, features })\n return { ...result, features }\n }\n}\n","import React, { ReactElement } from 'react'\nimport PluggableElementBase from '../PluggableElementBase'\nimport { AnyConfigurationSchemaType } from '../../configuration'\nimport { AnyReactComponentType } from '../../util'\nimport PluginManager from '../../PluginManager'\n\nexport type RenderProps = Record<string, unknown>\n\nexport interface RenderResults {\n reactElement?: ReactElement\n html?: string\n}\n\nexport default class RendererType extends PluggableElementBase {\n ReactComponent: AnyReactComponentType\n\n supportsSVG = true\n\n configSchema: AnyConfigurationSchemaType\n\n pluginManager: PluginManager\n\n constructor(stuff: {\n name: string\n ReactComponent: AnyReactComponentType\n displayName?: string\n configSchema: AnyConfigurationSchemaType\n pluginManager: PluginManager\n }) {\n super(stuff)\n this.ReactComponent = stuff.ReactComponent\n this.configSchema = stuff.configSchema\n this.pluginManager = stuff.pluginManager\n }\n\n async render(props: RenderProps): Promise<RenderResults> {\n return {\n reactElement: React.createElement(this.ReactComponent, props, null),\n }\n }\n\n /**\n * frees resources associated with the given range, session, etc.\n * optionally returns the number of data items deleted\n */\n freeResources(/* specification: {} */): number {\n return 0\n }\n}\n","import React, { useEffect, useRef } from 'react'\nimport { ThemeProvider } from '@mui/material/styles'\n\n// locals\nimport { createJBrowseTheme } from '../../ui'\nimport { ResultsSerialized, RenderArgs } from './ServerSideRendererType'\nimport { observer } from 'mobx-react'\nimport { getRoot } from 'mobx-state-tree'\n// eslint-disable-next-line react/no-deprecated\nimport { hydrate, unmountComponentAtNode } from 'react-dom'\nimport { rIC } from '../../util'\n\ninterface Props extends ResultsSerialized, RenderArgs {\n RenderingComponent: React.ComponentType<any>\n}\n\nconst NewHydrate = observer(function ServerSideRenderedContent({\n theme,\n html,\n RenderingComponent,\n ...rest\n}: Props) {\n const ref = useRef<HTMLDivElement>(null)\n const rootRef = useRef<any>()\n const { hydrateFn } = getRoot<any>(rest.displayModel)\n\n useEffect(() => {\n // requestIdleCallback here helps to avoid hydration mismatch because it\n // provides time for dangerouslySetInnerHTML to set the innerHTML contents\n // of the node, otherwise ref.current.innerHTML can be empty\n const renderTimeout = rIC(() => {\n if (!ref.current) {\n return\n }\n const jbrowseTheme = createJBrowseTheme(theme)\n // if there is a hydration mismatch, investigate value of\n // - value of ref.current.innerHTML\n // - value of `html` variable\n // - renderToString of the below React element\n rootRef.current =\n rootRef.current ??\n hydrateFn(\n ref.current,\n <ThemeProvider theme={jbrowseTheme}>\n <RenderingComponent {...rest} />\n </ThemeProvider>,\n )\n })\n return () => {\n if (renderTimeout !== undefined) {\n clearTimeout(renderTimeout)\n }\n const root = rootRef.current\n rootRef.current = undefined\n\n setTimeout(() => {\n root?.unmount()\n })\n }\n /* biome-ignore lint/correctness/useExhaustiveDependencies: */\n }, [theme, rest, hydrateFn, RenderingComponent])\n\n return (\n <div\n data-testid=\"hydrationContainer\"\n ref={ref}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n )\n})\n\nconst OldHydrate = observer(function ({\n theme,\n html,\n RenderingComponent,\n ...rest\n}: Props) {\n const ref = useRef<HTMLDivElement>(null)\n const jbrowseTheme = createJBrowseTheme(theme)\n\n useEffect(() => {\n const domNode = ref.current\n function doHydrate() {\n if (domNode) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n unmountComponentAtNode(domNode)\n domNode.innerHTML = html\n\n rIC(() => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n hydrate(\n <ThemeProvider theme={jbrowseTheme}>\n <RenderingComponent {...rest} />\n </ThemeProvider>,\n domNode,\n )\n })\n }\n }\n\n doHydrate()\n\n return () => {\n if (domNode) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n unmountComponentAtNode(domNode)\n }\n }\n /* biome-ignore lint/correctness/useExhaustiveDependencies: */\n }, [html, jbrowseTheme, rest, RenderingComponent])\n\n return <div ref={ref} />\n})\n\nconst ServerSideRenderedContent = observer(function (props: Props) {\n const root = getRoot<any>(props.displayModel)\n return root.hydrateFn ? <NewHydrate {...props} /> : <OldHydrate {...props} />\n})\n\nexport default ServerSideRenderedContent\n","import React from 'react'\nimport { ThemeOptions } from '@mui/material'\nimport { ThemeProvider } from '@mui/material/styles'\nimport { renderToString } from 'react-dom/server'\nimport {\n SnapshotOrInstance,\n SnapshotIn,\n getSnapshot,\n isStateTreeNode,\n} from 'mobx-state-tree'\n\n// locals\nimport { checkAbortSignal, getSerializedSvg, updateStatus } from '../../util'\nimport SerializableFilterChain, {\n SerializedFilterChain,\n} from './util/serializableFilterChain'\nimport { AnyConfigurationModel } from '../../configuration'\nimport RpcManager from '../../rpc/RpcManager'\nimport { createJBrowseTheme } from '../../ui'\n\nimport RendererType, { RenderProps, RenderResults } from './RendererType'\nimport ServerSideRenderedContent from './ServerSideRenderedContent'\n\ninterface BaseRenderArgs extends RenderProps {\n sessionId: string\n // Note that signal serialization happens after serializeArgsInClient and\n // deserialization happens before deserializeArgsInWorker\n signal?: AbortSignal\n theme: ThemeOptions\n exportSVG?: {\n rasterizeLayers?: boolean\n }\n}\n\nexport interface RenderArgs extends BaseRenderArgs {\n config: SnapshotOrInstance<AnyConfigurationModel>\n filters?: SerializableFilterChain\n}\n\nexport interface RenderArgsSerialized extends BaseRenderArgs {\n statusCallback?: (arg: string) => void\n config: SnapshotIn<AnyConfigurationModel>\n filters?: SerializedFilterChain\n}\nexport interface RenderArgsDeserialized extends BaseRenderArgs {\n config: AnyConfigurationModel\n filters?: SerializableFilterChain\n}\n\nexport interface ResultsSerialized extends Omit<RenderResults, 'reactElement'> {\n html: string\n}\n\nexport interface ResultsSerializedSvgExport extends ResultsSerialized {\n canvasRecordedData: unknown\n width: number\n height: number\n reactElement: unknown\n}\n\nexport type ResultsDeserialized = RenderResults\n\nfunction isSvgExport(e: ResultsSerialized): e is ResultsSerializedSvgExport {\n return 'canvasRecordedData' in e\n}\n\nexport default class ServerSideRenderer extends RendererType {\n /**\n * directly modifies the render arguments to prepare them to be serialized and\n * sent to the worker.\n *\n * @param args - the arguments passed to render\n * @returns the same object\n */\n serializeArgsInClient(args: RenderArgs): RenderArgsSerialized {\n return {\n ...args,\n config: isStateTreeNode(args.config)\n ? getSnapshot(args.config)\n : args.config,\n filters: args.filters?.toJSON().filters,\n }\n }\n\n /**\n * Deserialize the render results from the worker in the client. Includes\n * hydrating of the React HTML string, and not hydrating the result if SVG is\n * being rendered\n *\n * @param results - the results of the render\n * @param args - the arguments passed to render\n */\n deserializeResultsInClient(\n res: ResultsSerialized,\n args: RenderArgs,\n ): ResultsDeserialized {\n // if we are rendering svg, we skip hydration\n if (args.exportSVG) {\n // only return the res if the renderer explicitly has\n // this.supportsSVG support to avoid garbage being rendered in SVG\n // document\n return {\n ...res,\n html: this.supportsSVG\n ? res.html\n : '<text y=\"12\" fill=\"black\">SVG export not supported for this track</text>',\n }\n }\n\n // get res using ServerSideRenderedContent\n return {\n ...res,\n reactElement: (\n <ServerSideRenderedContent\n {...args}\n {...res}\n RenderingComponent={this.ReactComponent}\n />\n ),\n }\n }\n\n /**\n * modifies the passed arguments object to inflate arguments as necessary.\n * called in the worker process.\n *\n * @param args - the converted arguments to modify\n */\n deserializeArgsInWorker(args: RenderArgsSerialized): RenderArgsDeserialized {\n const deserialized = { ...args } as unknown as RenderArgsDeserialized\n deserialized.config = this.configSchema.create(args.config || {}, {\n pluginManager: this.pluginManager,\n })\n deserialized.filters = args.filters\n ? new SerializableFilterChain({\n filters: args.filters,\n })\n : undefined\n\n return deserialized\n }\n\n /**\n * Serialize results of the render to send them to the client. Includes\n * rendering React to an HTML string.\n *\n * @param results - object containing the results of calling the `render`\n * method\n * @param args - deserialized render args\n */\n serializeResultsInWorker(\n results: RenderResults,\n args: RenderArgsDeserialized,\n ): ResultsSerialized {\n const html = renderToString(\n <ThemeProvider theme={createJBrowseTheme(args.theme)}>\n {results.reactElement}\n </ThemeProvider>,\n )\n results.reactElement = undefined\n return { ...results, html }\n }\n\n /**\n * Render method called on the client. Serializes args, then calls\n * \"CoreRender\" with the RPC manager.\n *\n * @param rpcManager - RPC manager\n * @param args - render args\n */\n async renderInClient(rpcManager: RpcManager, args: RenderArgs) {\n const results = (await rpcManager.call(\n args.sessionId,\n 'CoreRender',\n args,\n )) as ResultsSerialized\n\n if (isSvgExport(results)) {\n results.html = await getSerializedSvg(results)\n results.reactElement = undefined\n }\n return results\n }\n\n /**\n * Render method called on the worker. `render` is called here in server-side\n * rendering\n *\n * @param args - serialized render args\n */\n async renderInWorker(args: RenderArgsSerialized): Promise<ResultsSerialized> {\n const { signal, statusCallback = () => {} } = args\n const deserializedArgs = this.deserializeArgsInWorker(args)\n\n const results = await updateStatus('Rendering plot', statusCallback, () =>\n this.render(deserializedArgs),\n )\n checkAbortSignal(signal)\n\n // serialize the results for passing back to the main thread.\n // these will be transmitted to the main process, and will come out\n // as the result of renderRegionWithWorker.\n return updateStatus('Serializing results', statusCallback, () =>\n this.serializeResultsInWorker(results, deserializedArgs),\n )\n }\n\n async freeResourcesInClient(rpcManager: RpcManager, args: RenderArgs) {\n const serializedArgs = this.serializeArgsInClient(args)\n\n const freed = this.freeResources()\n const freedRpc = (await rpcManager.call(\n args.sessionId,\n 'CoreFreeResources',\n serializedArgs,\n )) as number\n return freed + freedRpc\n }\n}\n\nexport { type RenderResults } from './RendererType'\n","import { stringToJexlExpression } from '../../../util/jexlStrings'\n\ntype FilterExpression = (...args: Record<string, any>[] | any[]) => boolean\n\ninterface Filter {\n string: string\n expr: FilterExpression\n}\n\nexport type SerializedFilterChain = string[]\n\nexport default class SerializableFilterChain {\n filterChain: Filter[]\n\n constructor({ filters = [] }: { filters: SerializedFilterChain }) {\n this.filterChain = filters\n .map(f => f.trim())\n .filter(f => !!f)\n .map(inputFilter => {\n if (typeof inputFilter === 'string') {\n const expr = stringToJexlExpression(inputFilter) as FilterExpression\n return { expr, string: inputFilter }\n }\n throw new Error(`invalid inputFilter string \"${inputFilter}\"`)\n })\n }\n\n passes(...args: any[]) {\n for (const entry of this.filterChain) {\n if (\n // @ts-expect-error\n !entry.expr.evalSync({ feature: args[0] })\n ) {\n return false\n }\n }\n return true\n }\n\n toJSON() {\n return { filters: this.filterChain.map(f => f.string) }\n }\n\n static fromJSON(json: { filters: SerializedFilterChain }) {\n return new SerializableFilterChain(json)\n }\n}\n","import React from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { alpha, Portal, useTheme } from '@mui/material'\n\nimport {\n useClientPoint,\n useFloating,\n useInteractions,\n} from '@floating-ui/react'\n\nfunction round(value: number) {\n return Math.round(value * 1e5) / 1e5\n}\n\nconst useStyles = makeStyles()(theme => ({\n // these styles come from\n // https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js\n tooltip: {\n position: 'absolute',\n pointerEvents: 'none',\n backgroundColor: alpha(theme.palette.grey[700], 0.9),\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.common.white,\n fontFamily: theme.typography.fontFamily,\n padding: '4px 8px',\n fontSize: theme.typography.pxToRem(12),\n lineHeight: `${round(14 / 10)}em`,\n maxWidth: 300,\n wordWrap: 'break-word',\n },\n}))\n\nexport default function BaseTooltip({\n clientPoint: clientPointCoords,\n children,\n placement = 'right',\n}: {\n placement?: 'left' | 'right'\n clientPoint?: { x: number; y: number }\n children: React.ReactNode\n}) {\n const theme = useTheme()\n const popperTheme = theme.components?.MuiPopper\n const { classes } = useStyles()\n const { refs, floatingStyles, context } = useFloating({\n placement,\n strategy: 'fixed',\n })\n\n const clientPoint = useClientPoint(context, clientPointCoords)\n const { getFloatingProps } = useInteractions([clientPoint])\n return (\n <Portal container={popperTheme?.defaultProps?.container}>\n <div\n className={classes.tooltip}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n zIndex: 100000,\n // workaround for tooltips flashing at top left corner of screen\n // when first appearing\n visibility:\n floatingStyles.transform === 'translate(0px, 0px)'\n ? 'hidden'\n : undefined,\n pointerEvents: 'none',\n }}\n {...getFloatingProps()}\n >\n {children}\n </div>\n </Portal>\n )\n}\n","import React, { useEffect } from 'react'\nimport CascadingMenu from '@jbrowse/core/ui/CascadingMenu'\nimport { IconButton } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport {\n bindTrigger,\n bindPopover,\n usePopupState,\n} from 'material-ui-popup-state/hooks'\nimport { MenuItem } from '@jbrowse/core/ui'\n\nconst CascadingMenuButton = observer(function CascadingMenuButton({\n children,\n menuItems,\n closeAfterItemClick = true,\n stopPropagation,\n setOpen,\n onClick: onClickExtra,\n ...rest\n}: {\n children?: React.ReactElement\n menuItems: MenuItem[]\n closeAfterItemClick?: boolean\n stopPropagation?: boolean\n onClick?: () => void\n setOpen?: (arg: boolean) => void\n [key: string]: unknown\n}) {\n const popupState = usePopupState({\n popupId: 'viewMenu',\n variant: 'popover',\n })\n const { onClick, onTouchStart, ...rest2 } = bindTrigger(popupState)\n const { isOpen } = popupState\n useEffect(() => {\n setOpen?.(isOpen)\n }, [isOpen, setOpen])\n\n return (\n <>\n <IconButton\n onClick={event => {\n if (stopPropagation) {\n event.stopPropagation()\n }\n onClick(event)\n onClickExtra?.()\n }}\n onTouchStart={event => {\n if (stopPropagation) {\n event.stopPropagation()\n }\n onTouchStart(event)\n onClickExtra?.()\n }}\n {...rest2}\n {...rest}\n disabled={menuItems.length === 0}\n >\n {children}\n </IconButton>\n <CascadingMenu\n {...bindPopover(popupState)}\n onMenuItemClick={(_: unknown, callback: () => void) => {\n callback()\n }}\n menuItems={menuItems}\n closeAfterItemClick={closeAfterItemClick}\n popupState={popupState}\n />\n </>\n )\n})\n\nexport default CascadingMenuButton\n","import React, { useState } from 'react'\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n} from '@mui/material'\nimport FactoryResetDialog from './FactoryResetDialog'\nimport ErrorMessage from './ErrorMessage'\n\nconst ResetComponent = ({\n onFactoryReset,\n resetButtonText,\n}: {\n onFactoryReset: () => void\n resetButtonText: string\n}) => {\n const [dialogOpen, setDialogOpen] = useState(false)\n\n return (\n <>\n <Button\n data-testid=\"fatal-error\"\n color=\"primary\"\n variant=\"contained\"\n onClick={() => {\n setDialogOpen(true)\n }}\n >\n {resetButtonText}\n </Button>\n <FactoryResetDialog\n onClose={() => {\n setDialogOpen(false)\n }}\n open={dialogOpen}\n onFactoryReset={onFactoryReset}\n />\n </>\n )\n}\n\nexport default function FatalErrorDialog({\n componentStack,\n error = 'No error message provided',\n onFactoryReset,\n resetButtonText = 'Factory Reset',\n}: {\n componentStack?: string\n error?: unknown\n onFactoryReset: () => void\n resetButtonText?: string\n}) {\n return (\n <Dialog maxWidth=\"xl\" open>\n <DialogTitle>Fatal error</DialogTitle>\n <DialogContent>\n <ErrorMessage error={error} />\n <pre>{componentStack}</pre>\n </DialogContent>\n <DialogActions>\n <Button\n color=\"secondary\"\n variant=\"contained\"\n onClick={() => {\n window.location.reload()\n }}\n >\n Refresh\n </Button>\n <ResetComponent\n onFactoryReset={onFactoryReset}\n resetButtonText={resetButtonText}\n />\n </DialogActions>\n </Dialog>\n )\n}\n","import React from 'react'\nimport { Box, Button, Typography, FormControl } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { isElectron } from '../../util'\nimport { LocalPathLocation, FileLocation, BlobLocation } from '../../util/types'\nimport { getBlob, storeBlobLocation } from '../../util/tracks'\n\nfunction isLocalPathLocation(loc: FileLocation): loc is LocalPathLocation {\n return 'localPath' in loc\n}\n\nfunction isBlobLocation(loc: FileLocation): loc is BlobLocation {\n return 'blobId' in loc\n}\n\nconst useStyles = makeStyles()(theme => ({\n filename: {\n marginLeft: theme.spacing(1),\n },\n}))\n\nfunction LocalFileChooser({\n location,\n setLocation,\n}: {\n location?: FileLocation\n setLocation: (arg: FileLocation) => void\n}) {\n const { classes } = useStyles()\n const filename =\n location &&\n ((isBlobLocation(location) && location.name) ||\n (isLocalPathLocation(location) && location.localPath))\n\n const needToReload =\n location && isBlobLocation(location) && !getBlob(location.blobId)\n\n return (\n <Box display=\"flex\" flexDirection=\"row\" alignItems=\"center\">\n <Box>\n <FormControl fullWidth>\n <Button variant=\"outlined\" component=\"label\">\n Choose File\n <input\n type=\"file\"\n hidden\n onChange={({ target }) => {\n const file = target.files?.[0]\n if (file) {\n if (isElectron) {\n const { webUtils } = window.require('electron')\n setLocation({\n localPath: webUtils.getPathForFile(file),\n locationType: 'LocalPathLocation',\n })\n } else {\n // @ts-expect-error\n setLocation(storeBlobLocation({ blob: file }))\n }\n }\n }}\n />\n </Button>\n </FormControl>\n </Box>\n <Box>\n <Typography\n component=\"span\"\n className={classes.filename}\n color={filename ? 'initial' : 'textSecondary'}\n >\n {filename || 'No file chosen'}\n </Typography>\n {needToReload ? (\n <Typography color=\"error\">(need to reload)</Typography>\n ) : null}\n </Box>\n </Box>\n )\n}\n\nexport default LocalFileChooser\n","import React from 'react'\nimport { TextField } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { FileLocation, isUriLocation } from '../../util/types'\n\nconst UrlChooser = observer(function ({\n location,\n setLocation,\n label,\n}: {\n location?: FileLocation\n setLocation: (arg: FileLocation) => void\n label?: string\n}) {\n return (\n <TextField\n fullWidth\n variant=\"outlined\"\n inputProps={{ 'data-testid': 'urlInput' }}\n defaultValue={location && isUriLocation(location) ? location.uri : ''}\n label={label || 'Enter URL'}\n onChange={event => {\n setLocation({\n uri: event.target.value.trim(),\n locationType: 'UriLocation',\n })\n }}\n />\n )\n})\n\nexport default UrlChooser\n","import React from 'react'\nimport { Typography, TypographyProps } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { keyframes } from 'tss-react'\n\nconst useStyles = makeStyles()({\n dots: {\n '&::after': {\n display: 'inline-block',\n content: '\"\"',\n width: '1em',\n textAlign: 'left',\n animation: `${keyframes`\n 0% {\n content: '';\n }\n 25% {\n content: '.';\n }\n 50% {\n content: '..';\n }\n 75% {\n content: '...';\n }\n `} 1.2s infinite ease-in-out`,\n },\n },\n})\n\ninterface Props extends TypographyProps {\n message?: string\n}\n\nexport default function LoadingEllipses({\n message,\n variant = 'body2',\n ...rest\n}: Props) {\n const { classes } = useStyles()\n return (\n <Typography className={classes.dots} {...rest} variant={variant}>\n {message || 'Loading'}\n </Typography>\n )\n}\n","import React from 'react'\nimport { makeStyles } from 'tss-react/mui'\n\nconst useStyles = makeStyles()(theme => ({\n bg: {\n padding: 4,\n margin: 4,\n overflow: 'auto',\n maxHeight: 200,\n background: theme.palette.mode === 'dark' ? '#833' : '#f88',\n border: `1px solid ${theme.palette.divider}`,\n },\n}))\n\nexport default function RedErrorMessageBox({\n children,\n}: {\n children: React.ReactNode\n}) {\n const { classes } = useStyles()\n return <div className={classes.bg}>{children}</div>\n}\n","const category10 = [\n '#1f77b4',\n '#ff7f0e',\n '#2ca02c',\n '#d62728',\n '#9467bd',\n '#8c564b',\n '#e377c2',\n '#7f7f7f',\n '#bcbd22',\n '#17becf',\n]\nconst dark2 = [\n '#1b9e77',\n '#d95f02',\n '#7570b3',\n '#e7298a',\n '#66a61e',\n '#e6ab02',\n '#a6761d',\n '#666666',\n]\nconst set1 = [\n '#e41a1c',\n '#377eb8',\n '#4daf4a',\n '#984ea3',\n '#ff7f00',\n '#ffff33',\n '#a65628',\n '#f781bf',\n '#999999',\n]\nconst set2 = [\n '#66c2a5',\n '#fc8d62',\n '#8da0cb',\n '#e78ac3',\n '#a6d854',\n '#ffd92f',\n '#e5c494',\n '#b3b3b3',\n]\nconst tableau10 = [\n '#4e79a7',\n '#f28e2c',\n '#e15759',\n '#76b7b2',\n '#59a14f',\n '#edc949',\n '#af7aa1',\n '#ff9da7',\n '#9c755f',\n '#bab0ab',\n]\n\nconst ggplot2Colors6 = [\n '#F8766D',\n '#B79F00',\n '#00BA38',\n '#00BFC4',\n '#619CFF',\n '#F564E3',\n]\n\nconst ggplot2Colors5 = ['#F8766D', '#A3A500', '#00BF7D', '#00B0F6', '#E76BF3']\nconst ggplot2Colors4 = ['#F8766D', '#7CAE00', '#00BFC4', '#C77CFF']\nconst ggplot2Colors3 = ['#F8766D', '#00BA38', '#619CFF']\n\nexport {\n set1,\n set2,\n tableau10,\n dark2,\n category10,\n ggplot2Colors6,\n ggplot2Colors5,\n ggplot2Colors4,\n ggplot2Colors3,\n}\n","import { Region, ViewSnap } from './index'\n\nexport interface BpOffset {\n refName?: string\n index: number\n offset: number\n start?: number\n end?: number\n}\n\nfunction lengthBetween(self: ViewSnap, start: BpOffset, end: BpOffset) {\n let bpSoFar = 0\n const { displayedRegions } = self\n if (start.index === end.index) {\n bpSoFar += end.offset - start.offset\n } else {\n const s = displayedRegions[start.index]!\n bpSoFar += s.end - s.start - start.offset\n if (end.index - start.index >= 2) {\n for (let i = start.index + 1; i < end.index; i++) {\n const region = displayedRegions[i]!\n const len = region.end - region.start\n bpSoFar += len\n }\n }\n bpSoFar += end.offset\n }\n return bpSoFar\n}\n\nexport function moveTo(\n self: ViewSnap & {\n zoomTo: (arg: number) => number\n scrollTo: (arg: number) => void\n },\n start?: BpOffset,\n end?: BpOffset,\n) {\n if (!start || !end) {\n return\n }\n const {\n width,\n interRegionPaddingWidth,\n displayedRegions,\n bpPerPx,\n minimumBlockWidth,\n } = self\n\n const len = lengthBetween(self, start, end)\n let numBlocksWideEnough = 0\n for (let i = start.index; i < end.index; i++) {\n const r = displayedRegions[i]!\n if ((r.end - r.start) / bpPerPx > minimumBlockWidth) {\n numBlocksWideEnough++\n }\n }\n\n const targetBpPerPx =\n len / (width - interRegionPaddingWidth * numBlocksWideEnough)\n const newBpPerPx = self.zoomTo(targetBpPerPx)\n\n // If our target bpPerPx was smaller than the allowed minBpPerPx, adjust\n // the scroll so the requested range is in the middle of the screen\n let extraBp = 0\n if (targetBpPerPx < newBpPerPx) {\n extraBp = ((newBpPerPx - targetBpPerPx) * self.width) / 2\n }\n\n let bpToStart = -extraBp\n\n for (let i = 0; i < self.displayedRegions.length; i += 1) {\n const region = self.displayedRegions[i]!\n if (start.index === i) {\n bpToStart += start.offset\n break\n } else {\n bpToStart += region.end - region.start\n }\n }\n\n self.scrollTo(Math.round(bpToStart / self.bpPerPx))\n}\n\nfunction coord(r: Region, bp: number) {\n return Math.floor(r.reversed ? r.end - bp : r.start + bp) + 1\n}\n\n// manual return type since getSnapshot hard to infer here\nexport function pxToBp(\n self: ViewSnap,\n px: number,\n): {\n coord: number\n index: number\n refName: string\n oob: boolean\n assemblyName: string\n offset: number\n start: number\n end: number\n reversed?: boolean\n} {\n let bpSoFar = 0\n const {\n bpPerPx,\n offsetPx,\n displayedRegions,\n interRegionPaddingWidth,\n staticBlocks,\n } = self\n const blocks = staticBlocks.contentBlocks\n const bp = (offsetPx + px) * bpPerPx\n if (bp < 0) {\n const r = displayedRegions[0]!\n const snap = r\n return {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n ...(snap as Omit<typeof snap, symbol>),\n oob: true,\n coord: coord(r, bp),\n offset: bp,\n index: 0,\n }\n }\n\n const interRegionPaddingBp = interRegionPaddingWidth * bpPerPx\n let currBlock = 0\n for (let i = 0; i < displayedRegions.length; i++) {\n const r = displayedRegions[i]!\n const len = r.end - r.start\n const offset = bp - bpSoFar\n if (len + bpSoFar > bp && bpSoFar <= bp) {\n const snap = r\n return {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n ...(snap as Omit<typeof snap, symbol>),\n oob: false,\n offset,\n coord: coord(r, offset),\n index: i,\n }\n }\n\n // add the interRegionPaddingWidth if the boundary is in the screen e.g. in\n // a static block\n if (blocks[currBlock]?.regionNumber === i) {\n bpSoFar += len + interRegionPaddingBp\n currBlock++\n } else {\n bpSoFar += len\n }\n }\n\n if (bp >= bpSoFar && displayedRegions.length > 0) {\n const r = displayedRegions.at(-1)!\n const len = r.end - r.start\n const offset = bp - bpSoFar + len\n\n const snap = r\n return {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n ...(snap as Omit<typeof snap, symbol>),\n oob: true,\n offset,\n coord: coord(r, offset),\n index: displayedRegions.length - 1,\n }\n }\n return {\n coord: 0,\n index: 0,\n refName: '',\n oob: true,\n assemblyName: '',\n offset: 0,\n start: 0,\n end: 0,\n reversed: false,\n }\n}\n\nexport function bpToPx({\n refName,\n coord,\n regionNumber,\n self,\n}: {\n refName: string\n coord: number\n regionNumber?: number\n self: ViewSnap\n}) {\n let bpSoFar = 0\n\n const { interRegionPaddingWidth, bpPerPx, displayedRegions, staticBlocks } =\n self\n const blocks = staticBlocks.contentBlocks\n const interRegionPaddingBp = interRegionPaddingWidth * bpPerPx\n let currBlock = 0\n\n let i = 0\n for (; i < displayedRegions.length; i++) {\n const r = displayedRegions[i]!\n const len = r.end - r.start\n if (\n refName === r.refName &&\n coord >= r.start &&\n coord <= r.end &&\n (regionNumber ? regionNumber === i : true)\n ) {\n bpSoFar += r.reversed ? r.end - coord : coord - r.start\n break\n }\n\n // add the interRegionPaddingWidth if the boundary is in the screen e.g. in\n // a static block\n if (blocks[currBlock]?.regionNumber === i) {\n bpSoFar += len + interRegionPaddingBp\n currBlock++\n } else {\n bpSoFar += len\n }\n }\n const found = displayedRegions[i]\n if (found) {\n return {\n index: i,\n offsetPx: Math.round(bpSoFar / bpPerPx),\n }\n }\n\n return undefined\n}\n\nexport function bpToPxMap({\n refName,\n coord,\n regionNumber,\n self,\n}: {\n refName: string\n coord: number\n regionNumber?: number\n self: ViewSnap\n}) {\n let bpSoFar = 0\n\n const { interRegionPaddingWidth, bpPerPx, displayedRegions, staticBlocks } =\n self\n const blocks = staticBlocks.contentBlocks\n const interRegionPaddingBp = interRegionPaddingWidth * bpPerPx\n const map = {}\n let currBlock = 0\n\n let i = 0\n for (; i < displayedRegions.length; i++) {\n const r = displayedRegions[i]!\n const len = r.end - r.start\n if (\n refName === r.refName &&\n coord >= r.start &&\n coord <= r.end &&\n (regionNumber === undefined ? true : regionNumber === i)\n ) {\n bpSoFar += r.reversed ? r.end - coord : coord - r.start\n break\n }\n\n // add the interRegionPaddingWidth if the boundary is in the screen e.g. in\n // a static block\n if (blocks[currBlock]?.regionNumber === i) {\n bpSoFar += len + interRegionPaddingBp\n currBlock++\n } else {\n bpSoFar += len\n }\n }\n const found = displayedRegions[i]\n if (found) {\n return {\n index: i,\n offsetPx: Math.round(bpSoFar / bpPerPx),\n }\n }\n\n return map\n}\n","import { types, cast, Instance } from 'mobx-state-tree'\nimport { clamp, sum } from './index'\nimport { Feature } from './simpleFeature'\nimport { ElementId } from './types/mst'\nimport { Region as IRegion } from './types'\nimport calculateDynamicBlocks from './calculateDynamicBlocks'\nimport calculateStaticBlocks from './calculateStaticBlocks'\nimport { moveTo, pxToBp, bpToPx, BpOffset } from './Base1DUtils'\n\n/**\n * #stateModel Base1DView\n * used in non-lgv view representations of a 1d view e.g. the two axes of the\n * dotplot use this\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst Base1DView = types\n .model('Base1DView', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n displayedRegions: types.optional(types.frozen<IRegion[]>(), []),\n /**\n * #property\n */\n bpPerPx: 0,\n /**\n * #property\n */\n offsetPx: 0,\n /**\n * #property\n */\n interRegionPaddingWidth: types.optional(types.number, 0),\n /**\n * #property\n */\n minimumBlockWidth: types.optional(types.number, 0),\n })\n .volatile(() => ({\n features: undefined as undefined | Feature[],\n volatileWidth: 0,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setDisplayedRegions(regions: IRegion[]) {\n self.displayedRegions = cast(regions)\n },\n /**\n * #action\n */\n setBpPerPx(val: number) {\n self.bpPerPx = val\n },\n /**\n * #action\n */\n setVolatileWidth(width: number) {\n self.volatileWidth = width\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get width() {\n return self.volatileWidth\n },\n /**\n * #getter\n */\n get assemblyNames() {\n return [...new Set(self.displayedRegions.map(r => r.assemblyName))]\n },\n /**\n * #getter\n */\n get displayedRegionsTotalPx() {\n return this.totalBp / self.bpPerPx\n },\n\n /**\n * #getter\n */\n get maxOffset() {\n // objectively determined to keep the linear genome on the main screen\n const leftPadding = 10\n return this.displayedRegionsTotalPx - leftPadding\n },\n\n /**\n * #getter\n */\n get minOffset() {\n // objectively determined to keep the linear genome on the main screen\n const rightPadding = 30\n return -this.width + rightPadding\n },\n\n /**\n * #getter\n */\n get totalBp() {\n return sum(self.displayedRegions.map(a => a.end - a.start))\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get dynamicBlocks() {\n return calculateDynamicBlocks(self)\n },\n\n /**\n * #getter\n */\n get staticBlocks() {\n return calculateStaticBlocks(self)\n },\n\n /**\n * #getter\n */\n get currBp() {\n return sum(this.dynamicBlocks.map(a => a.end - a.start))\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n pxToBp(px: number) {\n return pxToBp(self, px)\n },\n\n /**\n * #method\n */\n bpToPx({\n refName,\n coord,\n regionNumber,\n }: {\n refName: string\n coord: number\n regionNumber?: number\n }) {\n return bpToPx({ refName, coord, regionNumber, self })?.offsetPx\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setFeatures(features: Feature[]) {\n self.features = features\n },\n\n /**\n * #action\n * this makes a zoomed out view that shows all displayedRegions that makes\n * the overview bar square with the scale bar\n */\n showAllRegions() {\n self.bpPerPx = self.totalBp / self.width\n self.offsetPx = 0\n },\n\n /**\n * #action\n */\n zoomOut() {\n this.zoomTo(self.bpPerPx * 2)\n },\n\n /**\n * #action\n */\n zoomIn() {\n this.zoomTo(self.bpPerPx / 2)\n },\n\n /**\n * #action\n */\n zoomTo(bpPerPx: number, offset = self.width / 2) {\n const newBpPerPx = clamp(\n bpPerPx,\n 'minBpPerPx' in self ? (self.minBpPerPx as number) : 0,\n 'maxBpPerPx' in self\n ? (self.maxBpPerPx as number)\n : Number.POSITIVE_INFINITY,\n )\n\n const oldBpPerPx = self.bpPerPx\n if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {\n return oldBpPerPx\n }\n\n self.bpPerPx = newBpPerPx\n\n // tweak the offset so that the center of the view remains at the same\n // coordinate\n self.offsetPx = clamp(\n Math.round(\n ((self.offsetPx + offset) * oldBpPerPx) / newBpPerPx - offset,\n ),\n self.minOffset,\n self.maxOffset,\n )\n return self.bpPerPx\n },\n\n /**\n * #action\n */\n scrollTo(offsetPx: number) {\n const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset)\n self.offsetPx = newOffsetPx\n return newOffsetPx\n },\n /**\n * #action\n */\n centerAt(coord: number, refName: string | undefined, regionNumber: number) {\n if (!refName) {\n return\n }\n const centerPx = self.bpToPx({\n refName,\n coord,\n regionNumber,\n })\n if (centerPx) {\n this.scrollTo(Math.round(centerPx - self.width / 2))\n }\n },\n\n /**\n * #action\n * note: the scroll is clamped to keep the view on the main screen\n */\n scroll(distance: number) {\n const oldOffsetPx = self.offsetPx\n const newOffsetPx = clamp(\n self.offsetPx + distance,\n self.minOffset,\n self.maxOffset,\n )\n self.offsetPx = newOffsetPx\n return newOffsetPx - oldOffsetPx\n },\n }))\n .actions(self => ({\n /**\n * #action\n * offset is the base-pair-offset in the displayed region, index is the\n * index of the displayed region in the linear genome view\n *\n * @param start - object as `{start, end, offset, index}`\n * @param end - object as `{start, end, offset, index}`\n */\n moveTo(start?: BpOffset, end?: BpOffset) {\n moveTo(self, start, end)\n },\n }))\n\nexport type Base1DViewStateModel = typeof Base1DView\nexport type Base1DViewModel = Instance<Base1DViewStateModel>\n\nexport default Base1DView\n","import { Observable, fromEvent } from 'rxjs'\n\nclass AbortError extends Error {\n public code: string | undefined\n}\n\n/**\n * properly check if the given AbortSignal is aborted.\n * per the standard, if the signal reads as aborted,\n * this function throws either a DOMException AbortError, or a regular error\n * with a `code` attribute set to `ERR_ABORTED`.\n *\n * for convenience, passing `undefined` is a no-op\n *\n * @param signal -\n * @returns nothing\n */\nexport function checkAbortSignal(signal?: AbortSignal): void {\n if (!signal) {\n return\n }\n\n if (!(signal instanceof AbortSignal)) {\n throw new TypeError('must pass an AbortSignal')\n }\n\n if (signal.aborted) {\n throw makeAbortError()\n }\n}\n\nfunction timeout(ms: number) {\n return new Promise(resolve => setTimeout(resolve, ms))\n}\n/**\n * Skips to the next tick, then runs `checkAbortSignal`.\n * Await this to inside an otherwise synchronous loop to\n * provide a place to break when an abort signal is received.\n */\nexport async function abortBreakPoint(signal?: AbortSignal) {\n // it was observed that an actual timeout is needed to get the aborting (wrap\n // hicrenderer in a try catch, console.error the error, and rethrow the error\n // to see). using await Promise.resolve() did not appear to allow aborting to\n // occur\n await timeout(1)\n checkAbortSignal(signal)\n}\n\nexport function makeAbortError() {\n if (typeof DOMException !== 'undefined') {\n return new DOMException('aborted', 'AbortError')\n }\n const e = new AbortError('aborted')\n e.code = 'ERR_ABORTED'\n return e\n}\n\nexport function observeAbortSignal(signal?: AbortSignal): Observable<Event> {\n if (!signal) {\n return new Observable()\n }\n return fromEvent(signal, 'abort')\n}\n\n/**\n * check if the given exception was caused by an operation being intentionally aborted\n * @param exception -\n */\nexport function isAbortException(exception: unknown): boolean {\n return (\n exception instanceof Error &&\n // DOMException\n (exception.name === 'AbortError' ||\n // standard-ish non-DOM abort exception\n (exception as AbortError).code === 'ERR_ABORTED' ||\n // message contains aborted for bubbling through RPC\n // things we have seen that we want to catch here\n // Error: aborted\n // AbortError: aborted\n // AbortError: The user aborted a request.\n !!/\\b(aborted|aborterror)\\b/i.test(exception.message))\n )\n}\n","export function blobToDataURL(blob: Blob): Promise<string> {\n const a = new FileReader()\n return new Promise((resolve, reject) => {\n a.onload = e => {\n if (e.target) {\n resolve(e.target.result as string)\n } else {\n reject(new Error('unknown result reading blob from canvas'))\n }\n }\n a.readAsDataURL(blob)\n })\n}\n","import { sum } from '.'\n\ntype Func<T> = (value: BaseBlock, index: number, array: BaseBlock[]) => T\n\nexport class BlockSet {\n constructor(public blocks: BaseBlock[] = []) {}\n\n push(block: BaseBlock) {\n if (block.type === 'ElidedBlock' && this.blocks.length > 0) {\n const lastBlock = this.blocks.at(-1)\n if (lastBlock?.type === 'ElidedBlock') {\n ;(lastBlock as ElidedBlock).push(block as ElidedBlock)\n return\n }\n }\n\n this.blocks.push(block)\n }\n\n getBlocks() {\n return this.blocks\n }\n\n getRegions() {\n return this.blocks.map(block => block.toRegion())\n }\n\n map<T, U = this>(func: Func<T>, thisarg?: U) {\n // eslint-disable-next-line unicorn/no-array-method-this-argument\n return this.blocks.map(func, thisarg)\n }\n\n forEach<T, U = this>(func: Func<T>, thisarg?: U) {\n // eslint-disable-next-line unicorn/no-array-method-this-argument\n this.blocks.forEach(func, thisarg)\n }\n\n get length() {\n return this.blocks.length\n }\n\n get totalWidthPx() {\n return this.blocks.length > 0\n ? sum(this.blocks.map(blocks => blocks.widthPx))\n : 0\n }\n\n get totalWidthPxWithoutBorders() {\n return this.blocks.length > 0\n ? sum(\n this.blocks\n .filter(block => block.variant !== 'boundary')\n .map(blocks => blocks.widthPx),\n )\n : 0\n }\n\n get offsetPx() {\n return this.blocks.length > 0 ? this.blocks[0]!.offsetPx : 0\n }\n\n get contentBlocks() {\n return this.blocks.filter(block => block.type === 'ContentBlock')\n }\n\n get totalBp() {\n return sum(this.contentBlocks.map(block => block.end - block.start))\n }\n}\n\nexport class BaseBlock {\n type = 'BaseBlock'\n\n public regionNumber?: number\n\n public reversed?: boolean\n\n public refName: string\n\n public start: number\n\n public end: number\n\n public assemblyName: string\n\n public key: string\n\n public offsetPx: number\n\n public widthPx = 0\n\n public variant?: string\n\n public isLeftEndOfDisplayedRegion?: boolean\n\n /**\n * a block that should be shown as filled with data\n */\n\n constructor(data: Record<string, any>) {\n Object.assign(this, data)\n this.assemblyName = data.assemblyName\n this.refName = data.refName\n this.start = data.start\n this.end = data.end\n this.key = data.key\n this.offsetPx = data.offsetPx\n }\n\n toRegion() {\n return {\n refName: this.refName,\n start: this.start,\n end: this.end,\n assemblyName: this.assemblyName,\n reversed: this.reversed,\n }\n }\n}\n\nexport class ContentBlock extends BaseBlock {\n type = 'ContentBlock'\n}\n\n/**\n * marker block representing one or more blocks that are\n * too small to be shown at the current zoom level\n */\nexport class ElidedBlock extends BaseBlock {\n type = 'ElidedBlock'\n\n public widthPx: number\n\n public elidedBlockCount = 0\n\n constructor(data: Record<string, any>) {\n super(data)\n this.widthPx = data.widthPx\n }\n\n push(otherBlock: ElidedBlock) {\n this.elidedBlockCount += 1\n this.refName = ''\n this.start = 0\n this.end = 0\n this.widthPx += otherBlock.widthPx\n }\n}\n\n/**\n * marker block that sits between two different displayed regions\n * and provides a thick border between them\n */\nexport class InterRegionPaddingBlock extends BaseBlock {\n type = 'InterRegionPaddingBlock'\n}\n","import { isStateTreeNode, getSnapshot } from 'mobx-state-tree'\nimport { intersection2 } from './range'\nimport { assembleLocStringFast } from '.'\nimport {\n BlockSet,\n ContentBlock,\n ElidedBlock,\n InterRegionPaddingBlock,\n} from './blockTypes'\nimport { Base1DViewModel } from './calculateStaticBlocks'\n\n/**\n * returns a BlockSet of which the `blocks` attribute is an array of 'dynamic\n * blocks', which are blocks representing only the regions that are visible in\n * the view right now. these are mostly used by tracks for which static blocks\n * are not feasible.\n *\n * each block is a plain JS object like:\n * `{ refName, start, end, offsetPx, reversed? }`\n *\n * start and end are in bp, and start is always less than end, but if reversed\n * is true, startBp will be on the right side of the visible region.\n *\n * offsetPx is the number of pixels from the left edge of the view to the left\n * edge of the region\n *\n * NOTE: start, end, and offsetPx may all be fractional!\n *\n * @returns BlockSet of `{ refName, startBp, end, offset, reversed? }`\n */\nexport default function calculateDynamicBlocks(\n model: Base1DViewModel,\n padding = true,\n elision = true,\n) {\n const {\n offsetPx,\n displayedRegions,\n bpPerPx,\n width,\n minimumBlockWidth,\n interRegionPaddingWidth,\n } = model\n\n if (!width) {\n throw new Error('view has no width, cannot calculate displayed blocks')\n }\n const blocks = new BlockSet()\n let displayedRegionLeftPx = 0\n const windowLeftPx = offsetPx\n const windowRightPx = windowLeftPx + width\n for (\n let regionNumber = 0;\n regionNumber < displayedRegions.length;\n regionNumber++\n ) {\n const region = displayedRegions[regionNumber]\n const {\n assemblyName,\n refName,\n start: regionStart,\n end: regionEnd,\n reversed,\n } = region!\n const displayedRegionRightPx =\n displayedRegionLeftPx + (regionEnd - regionStart) / bpPerPx\n\n const regionWidthPx = (regionEnd - regionStart) / bpPerPx\n const parentRegion = isStateTreeNode(region) ? getSnapshot(region) : region\n\n const [leftPx, rightPx] = intersection2(\n windowLeftPx,\n windowRightPx,\n displayedRegionLeftPx,\n displayedRegionRightPx,\n )\n if (leftPx !== undefined && rightPx !== undefined) {\n // this displayed region overlaps the view, so make a record for it\n let start: number\n let end: number\n let isLeftEndOfDisplayedRegion: boolean\n let isRightEndOfDisplayedRegion: boolean\n let blockOffsetPx: number\n if (reversed) {\n start = Math.max(\n regionStart,\n regionEnd - (rightPx - displayedRegionLeftPx) * bpPerPx,\n )\n end = regionEnd - (leftPx - displayedRegionLeftPx) * bpPerPx\n isLeftEndOfDisplayedRegion = end === regionEnd\n isRightEndOfDisplayedRegion = start === regionStart\n blockOffsetPx = displayedRegionLeftPx + (regionEnd - end) / bpPerPx\n } else {\n start = (leftPx - displayedRegionLeftPx) * bpPerPx + regionStart\n end = Math.min(\n regionEnd,\n (rightPx - displayedRegionLeftPx) * bpPerPx + regionStart,\n )\n isLeftEndOfDisplayedRegion = start === regionStart\n isRightEndOfDisplayedRegion = end === regionEnd\n blockOffsetPx = displayedRegionLeftPx + (start - regionStart) / bpPerPx\n }\n const widthPx = (end - start) / bpPerPx\n const blockData = {\n assemblyName,\n refName,\n start,\n end,\n reversed,\n offsetPx: blockOffsetPx,\n parentRegion,\n regionNumber,\n widthPx,\n isLeftEndOfDisplayedRegion,\n isRightEndOfDisplayedRegion,\n key: '',\n }\n blockData.key = `${assembleLocStringFast(blockData)}-${regionNumber}${\n reversed ? '-reversed' : ''\n }`\n\n if (padding && blocks.length === 0 && isLeftEndOfDisplayedRegion) {\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-beforeFirstRegion`,\n widthPx: -offsetPx,\n offsetPx: blockData.offsetPx + offsetPx,\n variant: 'boundary',\n }),\n )\n }\n\n if (elision && regionWidthPx < minimumBlockWidth) {\n blocks.push(new ElidedBlock(blockData))\n } else {\n blocks.push(new ContentBlock(blockData))\n }\n\n if (padding) {\n // insert a inter-region padding block if we are crossing a displayed region\n if (\n regionWidthPx >= minimumBlockWidth &&\n blockData.isRightEndOfDisplayedRegion &&\n regionNumber < displayedRegions.length - 1\n ) {\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-rightpad`,\n widthPx: interRegionPaddingWidth,\n offsetPx: blockData.offsetPx + blockData.widthPx,\n }),\n )\n displayedRegionLeftPx += interRegionPaddingWidth\n }\n\n if (\n regionNumber === displayedRegions.length - 1 &&\n blockData.isRightEndOfDisplayedRegion\n ) {\n blockOffsetPx = blockData.offsetPx + blockData.widthPx\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-afterLastRegion`,\n widthPx: width - blockOffsetPx + offsetPx,\n offsetPx: blockOffsetPx,\n variant: 'boundary',\n }),\n )\n }\n }\n }\n displayedRegionLeftPx += (regionEnd - regionStart) / bpPerPx\n }\n return blocks\n}\n","import { isStateTreeNode, getSnapshot, Instance } from 'mobx-state-tree'\nimport { assembleLocStringFast } from '.'\nimport {\n BlockSet,\n ContentBlock,\n ElidedBlock,\n InterRegionPaddingBlock,\n} from './blockTypes'\nimport { Region } from './types'\nimport type { Region as RegionModel } from './types/mst'\n\nexport interface Base1DViewModel {\n offsetPx: number\n width: number\n displayedRegions: (Region | Instance<typeof RegionModel>)[]\n bpPerPx: number\n minimumBlockWidth: number\n interRegionPaddingWidth: number\n}\n\nexport default function calculateStaticBlocks(\n model: Base1DViewModel,\n padding = true,\n elision = true,\n extra = 0,\n width = 800,\n) {\n const {\n offsetPx,\n displayedRegions,\n bpPerPx,\n minimumBlockWidth,\n interRegionPaddingWidth,\n width: modelWidth,\n } = model\n\n const windowLeftBp = offsetPx * bpPerPx\n const windowRightBp = (offsetPx + modelWidth) * bpPerPx\n const blockSizePx = width\n const blockSizeBp = Math.ceil(blockSizePx * bpPerPx)\n // for each displayed region\n let regionBpOffset = 0\n const blocks = new BlockSet()\n for (\n let regionNumber = 0;\n regionNumber < displayedRegions.length;\n regionNumber++\n ) {\n const region = displayedRegions[regionNumber]!\n const {\n assemblyName,\n refName,\n start: regionStart,\n end: regionEnd,\n reversed,\n } = region\n\n const regionBlockCount = Math.ceil((regionEnd - regionStart) / blockSizeBp)\n const parentRegion = isStateTreeNode(region) ? getSnapshot(region) : region\n\n let windowRightBlockNum =\n Math.floor((windowRightBp - regionBpOffset) / blockSizeBp) + extra\n if (windowRightBlockNum >= regionBlockCount) {\n windowRightBlockNum = regionBlockCount - 1\n }\n\n let windowLeftBlockNum =\n Math.floor((windowLeftBp - regionBpOffset) / blockSizeBp) - extra\n if (windowLeftBlockNum < 0) {\n windowLeftBlockNum = 0\n }\n\n const regionWidthPx = (regionEnd - regionStart) / bpPerPx\n\n for (\n let blockNum = windowLeftBlockNum;\n blockNum <= windowRightBlockNum;\n blockNum += 1\n ) {\n let start: number\n let end: number\n let isLeftEndOfDisplayedRegion: boolean\n let isRightEndOfDisplayedRegion: boolean\n if (reversed) {\n start = Math.max(regionStart, regionEnd - (blockNum + 1) * blockSizeBp)\n end = regionEnd - blockNum * blockSizeBp\n isLeftEndOfDisplayedRegion = end === regionEnd\n isRightEndOfDisplayedRegion = start === regionStart\n } else {\n start = regionStart + blockNum * blockSizeBp\n end = Math.min(regionEnd, regionStart + (blockNum + 1) * blockSizeBp)\n isLeftEndOfDisplayedRegion = start === regionStart\n isRightEndOfDisplayedRegion = end === regionEnd\n }\n const widthPx = (end - start) / bpPerPx\n const blockData = {\n assemblyName,\n refName,\n start,\n end,\n reversed,\n offsetPx: (regionBpOffset + blockNum * blockSizeBp) / bpPerPx,\n parentRegion,\n regionNumber,\n widthPx,\n isLeftEndOfDisplayedRegion,\n isRightEndOfDisplayedRegion,\n key: '',\n }\n blockData.key = `${assembleLocStringFast(blockData)}-${regionNumber}${\n reversed ? '-reversed' : ''\n }`\n\n if (padding && regionNumber === 0 && blockNum === 0) {\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-beforeFirstRegion`,\n widthPx: width,\n offsetPx: blockData.offsetPx - width,\n variant: 'boundary',\n }),\n )\n }\n\n if (elision && regionWidthPx < minimumBlockWidth) {\n blocks.push(new ElidedBlock(blockData))\n } else {\n blocks.push(new ContentBlock(blockData))\n }\n\n if (padding) {\n // insert a inter-region padding block if we are crossing a displayed region\n if (\n regionWidthPx >= minimumBlockWidth &&\n blockData.isRightEndOfDisplayedRegion &&\n regionNumber < displayedRegions.length - 1\n ) {\n regionBpOffset += interRegionPaddingWidth * bpPerPx\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-rightpad`,\n widthPx: interRegionPaddingWidth,\n offsetPx: blockData.offsetPx + blockData.widthPx,\n }),\n )\n }\n if (\n regionNumber === displayedRegions.length - 1 &&\n blockData.isRightEndOfDisplayedRegion\n ) {\n regionBpOffset += interRegionPaddingWidth * bpPerPx\n blocks.push(\n new InterRegionPaddingBlock({\n key: `${blockData.key}-afterLastRegion`,\n widthPx: width,\n offsetPx: blockData.offsetPx + blockData.widthPx,\n variant: 'boundary',\n }),\n )\n }\n }\n }\n regionBpOffset += regionEnd - regionStart\n }\n return blocks\n}\n","// from https://www.w3.org/TR/css-color-4/#named-colors\n\nconst colors: Record<string, string> = {\n aliceblue: '#F0F8FF',\n antiquewhite: '#FAEBD7',\n aqua: '#00FFFF',\n aquamarine: '#7FFFD4',\n azure: '#F0FFFF',\n beige: '#F5F5DC',\n bisque: '#FFE4C4',\n black: '#000000',\n blanchedalmond: '#FFEBCD',\n blue: '#0000FF',\n blueviolet: '#8A2BE2',\n brown: '#A52A2A',\n burlywood: '#DEB887',\n cadetblue: '#5F9EA0',\n chartreuse: '#7FFF00',\n chocolate: '#D2691E',\n coral: '#FF7F50',\n cornflowerblue: '#6495ED',\n cornsilk: '#FFF8DC',\n crimson: '#DC143C',\n cyan: '#00FFFF',\n darkblue: '#00008B',\n darkcyan: '#008B8B',\n darkgoldenrod: '#B8860B',\n darkgray: '#A9A9A9',\n darkgreen: '#006400',\n darkgrey: '#A9A9A9',\n darkkhaki: '#BDB76B',\n darkmagenta: '#8B008B',\n darkolivegreen: '#556B2F',\n darkorange: '#FF8C00',\n darkorchid: '#9932CC',\n darkred: '#8B0000',\n darksalmon: '#E9967A',\n darkseagreen: '#8FBC8F',\n darkslateblue: '#483D8B',\n darkslategray: '#2F4F4F',\n darkslategrey: '#2F4F4F',\n darkturquoise: '#00CED1',\n darkviolet: '#9400D3',\n deeppink: '#FF1493',\n deepskyblue: '#00BFFF',\n dimgray: '#696969',\n dimgrey: '#696969',\n dodgerblue: '#1E90FF',\n firebrick: '#B22222',\n floralwhite: '#FFFAF0',\n forestgreen: '#228B22',\n fuchsia: '#FF00FF',\n gainsboro: '#DCDCDC',\n ghostwhite: '#F8F8FF',\n gold: '#FFD700',\n goldenrod: '#DAA520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#ADFF2F',\n grey: '#808080',\n honeydew: '#F0FFF0',\n hotpink: '#FF69B4',\n indianred: '#CD5C5C',\n indigo: '#4B0082',\n ivory: '#FFFFF0',\n khaki: '#F0E68C',\n lavender: '#E6E6FA',\n lavenderblush: '#FFF0F5',\n lawngreen: '#7CFC00',\n lemonchiffon: '#FFFACD',\n lightblue: '#ADD8E6',\n lightcoral: '#F08080',\n lightcyan: '#E0FFFF',\n lightgoldenrodyellow: '#FAFAD2',\n lightgray: '#D3D3D3',\n lightgreen: '#90EE90',\n lightgrey: '#D3D3D3',\n lightpink: '#FFB6C1',\n lightsalmon: '#FFA07A',\n lightseagreen: '#20B2AA',\n lightskyblue: '#87CEFA',\n lightslategray: '#778899',\n lightslategrey: '#778899',\n lightsteelblue: '#B0C4DE',\n lightyellow: '#FFFFE0',\n lime: '#00FF00',\n limegreen: '#32CD32',\n linen: '#FAF0E6',\n magenta: '#FF00FF',\n maroon: '#800000',\n mediumaquamarine: '#66CDAA',\n mediumblue: '#0000CD',\n mediumorchid: '#BA55D3',\n mediumpurple: '#9370DB',\n mediumseagreen: '#3CB371',\n mediumslateblue: '#7B68EE',\n mediumspringgreen: '#00FA9A',\n mediumturquoise: '#48D1CC',\n mediumvioletred: '#C71585',\n midnightblue: '#191970',\n mintcream: '#F5FFFA',\n mistyrose: '#FFE4E1',\n moccasin: '#FFE4B5',\n navajowhite: '#FFDEAD',\n navy: '#000080',\n oldlace: '#FDF5E6',\n olive: '#808000',\n olivedrab: '#6B8E23',\n orange: '#FFA500',\n orangered: '#FF4500',\n orchid: '#DA70D6',\n palegoldenrod: '#EEE8AA',\n palegreen: '#98FB98',\n paleturquoise: '#AFEEEE',\n palevioletred: '#DB7093',\n papayawhip: '#FFEFD5',\n peachpuff: '#FFDAB9',\n peru: '#CD853F',\n pink: '#FFC0CB',\n plum: '#DDA0DD',\n powderblue: '#B0E0E6',\n purple: '#800080',\n rebeccapurple: '#663399',\n red: '#FF0000',\n rosybrown: '#BC8F8F',\n royalblue: '#4169E1',\n saddlebrown: '#8B4513',\n salmon: '#FA8072',\n sandybrown: '#F4A460',\n seagreen: '#2E8B57',\n seashell: '#FFF5EE',\n sienna: '#A0522D',\n silver: '#C0C0C0',\n skyblue: '#87CEEB',\n slateblue: '#6A5ACD',\n slategray: '#708090',\n slategrey: '#708090',\n snow: '#FFFAFA',\n springgreen: '#00FF7F',\n steelblue: '#4682B4',\n tan: '#D2B48C',\n teal: '#008080',\n thistle: '#D8BFD8',\n tomato: '#FF6347',\n turquoise: '#40E0D0',\n violet: '#EE82EE',\n wheat: '#F5DEB3',\n white: '#FFFFFF',\n whitesmoke: '#F5F5F5',\n yellow: '#FFFF00',\n yellowgreen: '#9ACD32',\n}\n\nexport function namedColorToHex(name: string): string | undefined {\n return colors[name]\n}\n\nexport function isNamedColor(name: string): boolean {\n return !!colors[name]\n}\n","import {\n darken,\n emphasize as muiEmphasize,\n getContrastRatio,\n getLuminance as muiGetLuminance,\n lighten,\n} from '@mui/material/styles'\nimport { namedColorToHex } from './cssColorsLevel4'\n\n/**\n * Algorithmically pick a contrasting text color that will\n * be visible on top of the given background color. Either\n * black or white.\n *\n * @param color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(),\n * hsl(), hsla(), or named color\n * @returns 'black' or 'white'\n */\nexport function contrastingTextColor(color: string): string {\n const luminance = getLuminance(color)\n return luminance > 0.5 ? 'black' : 'white'\n}\n\n/**\n * The relative brightness of any point in a color space,\n * normalized to 0 for darkest black and 1 for lightest white.\n * Uses MUI's `getLuminance`, but adds support for named colors\n *\n * Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests\n *\n * @param color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(),\n * hsl(), hsla(), or named color\n * @returns The relative brightness of the color in the range 0 - 1\n */\nfunction getLuminance(color: string): number {\n const convertedColor = namedColorToHex(color)\n return muiGetLuminance(convertedColor || color)\n}\n\n/**\n * Darken or lighten a color, depending on its luminance.\n * Light colors are darkened, dark colors are lightened.\n * Uses MUI's `emphasize`, but adds support for named colors\n *\n * @param color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(),\n * hsl(), hsla(), or named color\n * @param coefficient - multiplier in the range 0 - 1, defaults to 0.15\n * @returns A CSS color string. Hex input values are returned as rgb\n */\nexport function emphasize(color: string, coefficient = 0.15): string {\n const convertedColor = namedColorToHex(color)\n return muiEmphasize(convertedColor || color, coefficient)\n}\n\nexport function makeContrasting(\n foreground: string,\n background = 'white',\n minContrastRatio = 3,\n) {\n let convertedForeground = namedColorToHex(foreground) || foreground\n const convertedBackground = namedColorToHex(background) || background\n const backgroundLuminance = getLuminance(convertedBackground)\n let contrastRatio = getContrastRatio(convertedForeground, convertedBackground)\n const originalColor = convertedForeground\n let coefficient = 0.05\n while (contrastRatio < minContrastRatio) {\n convertedForeground =\n backgroundLuminance > 0.5\n ? darken(originalColor, coefficient)\n : lighten(originalColor, coefficient)\n coefficient += 0.05\n contrastRatio = getContrastRatio(convertedForeground, convertedBackground)\n }\n return convertedForeground\n}\n\nexport { isNamedColor, namedColorToHex } from './cssColorsLevel4'\n","import { extend } from 'colord'\nimport mix from 'colord/plugins/mix'\nimport names from 'colord/plugins/names'\nextend([mix, names])\n\nexport { Colord, colord } from 'colord'\n","type Hasher<T> = (input: T) => string\n\n// from https://github.com/seriousManual/dedupe/blob/master/LICENSE\nexport function dedupe<T>(list: T[], hasher: Hasher<T> = JSON.stringify) {\n const clone: T[] = []\n const lookup = new Set<string>()\n\n for (const entry of list) {\n const hashed = hasher(entry)\n\n if (!lookup.has(hashed)) {\n clone.push(entry)\n lookup.add(hashed)\n }\n }\n\n return clone\n}\n","import { hashCode } from './'\n\n// generates a short \"id fingerprint\" from the config passed to the base\n// feature adapter by recursively enumerating props, but if config is too big\n// does not process entire config (FromConfigAdapter for example can be large)\n\nexport default function idMaker(args: any, id = '') {\n const keys = Object.keys(args)\n for (const key of keys) {\n if (id.length > 5000) {\n break\n }\n id +=\n typeof args[key] === 'object' && args[key]\n ? idMaker(args[key], id)\n : `${key}-${args[key]};`\n }\n return hashCode(id)\n}\n","import { HttpRangeFetcher } from '@gmod/http-range-fetcher'\nimport { Buffer } from 'buffer'\nimport { RemoteFile, PolyfilledResponse } from 'generic-filehandle'\n\ntype BinaryRangeFetch = (\n url: string,\n start: number,\n end: number,\n options?: { headers?: HeadersInit; signal?: AbortSignal },\n) => Promise<BinaryRangeResponse>\n\nexport interface BinaryRangeResponse {\n headers: Record<string, string>\n requestDate: Date\n responseDate: Date\n buffer: Buffer\n}\n\nconst fetchers: Record<string, BinaryRangeFetch> = {}\n\nfunction binaryRangeFetch(\n url: string,\n start: number,\n end: number,\n options: { headers?: HeadersInit; signal?: AbortSignal } = {},\n): Promise<BinaryRangeResponse> {\n const fetcher = fetchers[url]\n if (!fetcher) {\n throw new Error(`fetch not registered for ${url}`)\n }\n return fetcher(url, start, end, options)\n}\n\nconst globalRangeCache = new HttpRangeFetcher({\n fetch: binaryRangeFetch,\n size: 500 * 1024 ** 2, // 500MiB\n chunkSize: 128 * 1024, // 128KiB\n maxFetchSize: 100 * 1024 ** 2, // 100MiB\n minimumTTL: 24 * 60 * 60 * 1000, // 1 day\n})\n\nexport function clearCache() {\n globalRangeCache.reset()\n}\n\nexport class RemoteFileWithRangeCache extends RemoteFile {\n public async fetch(\n url: RequestInfo,\n init?: RequestInit,\n ): Promise<PolyfilledResponse> {\n const str = String(url)\n if (!fetchers[str]) {\n fetchers[str] = this.fetchBinaryRange.bind(this)\n }\n // if it is a range request, route it through the range cache\n const range = new Headers(init?.headers).get('range')\n if (range) {\n const rangeParse = /bytes=(\\d+)-(\\d+)/.exec(range)\n if (rangeParse) {\n const [, start, end] = rangeParse\n const s = Number.parseInt(start!, 10)\n const e = Number.parseInt(end!, 10)\n const len = e - s\n const { buffer, headers } = (await globalRangeCache.getRange(\n url,\n s,\n len + 1,\n { signal: init?.signal },\n )) as BinaryRangeResponse\n return new Response(buffer, { status: 206, headers })\n }\n }\n return super.fetch(url, init)\n }\n\n public async fetchBinaryRange(\n url: string,\n start: number,\n end: number,\n options: { headers?: HeadersInit; signal?: AbortSignal } = {},\n ): Promise<BinaryRangeResponse> {\n const requestDate = new Date()\n const res = await super.fetch(url, {\n ...options,\n headers: {\n ...options.headers,\n range: `bytes=${start}-${end}`,\n },\n })\n const responseDate = new Date()\n if (!res.ok) {\n const errorMessage = `HTTP ${res.status} fetching ${url} bytes ${start}-${end}`\n const hint = ' (should be 206 for range requests)'\n throw new Error(`${errorMessage}${res.status === 200 ? hint : ''}`)\n }\n\n // translate the Headers object into a regular key -> value object.\n // will miss duplicate headers of course\n\n const headers: Record<string, any> = {}\n for (const [k, v] of res.headers.entries()) {\n headers[k] = v\n }\n\n // return the response headers, and the data buffer\n const arrayBuffer = await res.arrayBuffer()\n return {\n headers,\n requestDate,\n responseDate,\n buffer: Buffer.from(arrayBuffer),\n }\n }\n}\n","import {\n BlobFile,\n GenericFilehandle,\n LocalFile,\n Fetcher,\n} from 'generic-filehandle'\nimport isNode from 'detect-node'\n\n// locals\nimport { RemoteFileWithRangeCache } from './RemoteFileWithRangeCache'\nimport {\n FileLocation,\n LocalPathLocation,\n BlobLocation,\n isRootModelWithInternetAccounts,\n isUriLocation,\n AuthNeededError,\n UriLocation,\n} from '../types'\nimport { BaseInternetAccountModel } from '../../pluggableElementTypes/models'\nimport { getBlob } from '../tracks'\nimport PluginManager from '../../PluginManager'\nimport { isElectron } from '../'\n\nfunction isLocalPathLocation(\n location: FileLocation,\n): location is LocalPathLocation {\n return 'localPath' in location\n}\n\nfunction isBlobLocation(location: FileLocation): location is BlobLocation {\n return 'blobId' in location\n}\n\n/** if a UriLocation has a baseUri, resolves its uri with respect to that base */\nexport function resolveUriLocation(location: UriLocation) {\n return location.baseUri\n ? { ...location, uri: new URL(location.uri, location.baseUri).href }\n : location\n}\n\nexport function openLocation(\n location: FileLocation,\n pluginManager?: PluginManager,\n): GenericFilehandle {\n if (isLocalPathLocation(location)) {\n if (!location.localPath) {\n throw new Error('No local path provided')\n }\n\n if (isNode || isElectron) {\n return new LocalFile(location.localPath)\n } else {\n throw new Error(\"can't use local files in the browser\")\n }\n }\n if (isBlobLocation(location)) {\n // special case where blob is not directly stored on the model, use a getter\n const blob = getBlob(location.blobId)\n if (!blob) {\n throw new Error(\n `file (\"${location.name}\") was opened locally from a previous session. To restore it, go to track settings and reopen the file`,\n )\n }\n return new BlobFile(blob)\n }\n if (isUriLocation(location)) {\n // Check for empty string\n if (!location.uri) {\n throw new Error('No URI provided')\n }\n\n // Resolve any relative URLs to absolute URLs\n const absoluteLocation = resolveUriLocation(location)\n\n // If there is a plugin manager, we can try internet accounts\n if (pluginManager) {\n const internetAccount = getInternetAccount(location, pluginManager)\n // If an internetAccount was found, use it to open the location\n if (internetAccount) {\n return internetAccount.openLocation(absoluteLocation)\n }\n }\n // Otherwise fall back on usual open\n return new RemoteFileWithRangeCache(absoluteLocation.uri, {\n fetch: checkAuthNeededFetch,\n })\n }\n throw new Error('invalid fileLocation')\n}\n\nexport function getFetcher(\n location: FileLocation,\n pluginManager?: PluginManager,\n): Fetcher {\n if (!isUriLocation(location)) {\n throw new Error(`Not a valid UriLocation: ${JSON.stringify(location)}`)\n }\n if (pluginManager) {\n const internetAccount = getInternetAccount(location, pluginManager)\n if (internetAccount) {\n return internetAccount.getFetcher(location)\n }\n }\n return checkAuthNeededFetch\n}\n\nfunction getInternetAccount(\n location: UriLocation,\n pluginManager: PluginManager,\n): BaseInternetAccountModel | undefined {\n const { rootModel } = pluginManager\n // If there is an appRootModel, use it to find the internetAccount\n if (rootModel && isRootModelWithInternetAccounts(rootModel)) {\n return rootModel.findAppropriateInternetAccount(location)\n }\n // If there is no appRootModel, but there is pre-auth, create a temporary\n // internetAccount. This is typical in a worker.\n if (location.internetAccountPreAuthorization) {\n if (!location.internetAccountPreAuthorization.authInfo.token) {\n throw new Error(\n 'Failed to obtain token from internet account. Try reloading the page',\n )\n }\n return pluginManager\n .getInternetAccountType(\n location.internetAccountPreAuthorization.internetAccountType,\n )!\n .stateModel.create({\n type: location.internetAccountPreAuthorization.internetAccountType,\n configuration:\n location.internetAccountPreAuthorization.authInfo.configuration,\n })\n }\n return undefined\n}\n\n// This fetch throws a special error if the response is \"401\" and includes a\n// \"WWW-Authenticate: Basic\" header. This is so downstream code can retry if\n// needed with HTTP Basic authentication included\nasync function checkAuthNeededFetch(url: RequestInfo, opts?: RequestInit) {\n const response = await fetch(url, opts)\n if (\n response.status === 401 &&\n response.headers.get('WWW-Authenticate')?.includes('Basic')\n ) {\n throw new AuthNeededError(\n 'Accessing HTTPBasic resource without authentication',\n url.toString(),\n )\n }\n return response\n}\n\nexport { RemoteFileWithRangeCache } from './RemoteFileWithRangeCache'\n","import jexl from 'jexl'\nimport { Feature } from './simpleFeature'\n\ntype JexlWithAddFunction = typeof jexl & {\n addFunction(name: string, func: (...args: unknown[]) => unknown): void\n}\ntype JexlNonBuildable = Omit<typeof jexl, 'Jexl'>\n\nexport default function JexlF(/* config?: any*/): JexlNonBuildable {\n const j = new jexl.Jexl() as JexlWithAddFunction\n // someday will make sure all of configs callbacks are added in, including\n // ones passed in\n\n // below are core functions\n j.addFunction('get', (feature: Feature, data: string) => feature.get(data))\n j.addFunction('parent', (feature: Feature) => feature.parent())\n\n j.addFunction('id', (feature: Feature) => feature.id())\n\n // let user cast a jexl type into a javascript type\n j.addFunction('cast', (arg: unknown) => arg)\n\n // logging\n j.addFunction('log', (thing: unknown) => {\n console.log(thing) // eslint-disable-line no-console\n return thing\n })\n\n // math\n // addfunction added in jexl 2.3 but types/jexl still on 2.2\n j.addFunction('max', Math.max)\n j.addFunction('min', Math.min)\n j.addFunction('sqrt', Math.sqrt)\n j.addFunction('ceil', Math.ceil)\n j.addFunction('floor', Math.floor)\n j.addFunction('round', Math.round)\n j.addFunction('abs', Math.abs)\n j.addFunction('log10', Math.log10)\n j.addFunction('parseInt', Number.parseInt)\n j.addFunction('parseFloat', Number.parseFloat)\n\n // string\n j.addFunction('split', (s: string, char: string) => s.split(char))\n j.addFunction('charAt', (s: string, index: number) => s.charAt(index))\n j.addFunction('charCodeAt', (s: string, index: number) => s.charCodeAt(index))\n j.addFunction('codePointAt', (s: string, pos: number) => s.codePointAt(pos))\n j.addFunction('startsWith', (s: string, search: string, len?: number) =>\n s.startsWith(search, len),\n )\n j.addFunction('endsWith', (s: string, search: string, len?: number) =>\n s.endsWith(search, len),\n )\n j.addFunction('padEnd', (s: string, len: number, pad?: string) =>\n s.padEnd(len, pad),\n )\n j.addFunction('padStart', (s: string, len: number, fill?: string) =>\n s.padStart(len, fill),\n )\n j.addFunction('repeat', (s: string, count: number) => s.repeat(count))\n j.addFunction('replace', (s: string, match: string, sub: string) =>\n s.replace(match, sub),\n )\n j.addFunction('replaceAll', (s: string, match: string, sub: string) =>\n s.replaceAll(match, sub),\n )\n j.addFunction('slice', (s: string, start: number, end?: number) =>\n s.slice(start, end),\n )\n j.addFunction('startsWith', (s: string, search: string, pos?: number) =>\n s.startsWith(search, pos),\n )\n j.addFunction('substring', (s: string, start: number, end?: number) =>\n // eslint-disable-next-line unicorn/prefer-string-slice\n s.substring(start, end),\n )\n j.addFunction('toLowerCase', (s: string) => s.toLowerCase())\n j.addFunction('toUpperCase', (s: string) => s.toUpperCase())\n j.addFunction('jsonParse', (s: string) => JSON.parse(s))\n j.addFunction('trim', (s: string) => s.trim())\n j.addFunction('trimEnd', (s: string) => s.trimEnd())\n j.addFunction('trimStart', (s: string) => s.trimStart())\n\n j.addFunction('getTag', (feature: Feature, s: string) => {\n const tags = feature.get('tags')\n return tags ? tags[s] : feature.get(s)\n })\n\n j.addBinaryOp('&', 15, (a: number, b: number) => a & b)\n\n return j\n}\n","import createJexlInstance from './jexl'\n\nconst compilationCache: Record<string, any> = {}\n\n// revert function strings back to main, create a different file for\n// jexlStrings.ts pass the jexl property of the pluginManager as a param\n\n/**\n * compile a jexlExpression to a string\n *\n * @param str - string of code like `jexl:...`\n * @param options -\n */\nexport function stringToJexlExpression(str: string, jexl?: any) {\n const cacheKey = `nosig|${str}`\n if (!compilationCache[cacheKey]) {\n const match = str.startsWith('jexl:')\n if (!match) {\n throw new Error('string does not appear to be in jexl format')\n }\n const code = str.split('jexl:')[1]!\n const compiled = jexl\n ? jexl.compile(code)\n : createJexlInstance().compile(code)\n compilationCache[cacheKey] = compiled\n }\n\n return compilationCache[cacheKey]\n}\n","import {\n RectTuple,\n SerializedLayout,\n Rectangle,\n BaseLayout,\n} from './BaseLayout'\n\n/**\n * Rectangle-layout manager that lays out rectangles using bitmaps at\n * resolution that, for efficiency, may be somewhat lower than that of\n * the coordinate system for the rectangles being laid out. `pitchX`\n * and `pitchY` are the ratios of input scale resolution to internal\n * bitmap resolution.\n */\n\n// minimum excess size of the array at which we garbage collect\nconst minSizeToBotherWith = 10000\nconst maxFeaturePitchWidth = 20000\n\nfunction segmentsIntersect(\n x1: number,\n x2: number,\n y1: number,\n y2: number,\n): boolean {\n return x2 >= y1 && y2 >= x1\n}\n\ntype Bit<T> = Record<string, T> | string | undefined\n\ninterface RowState<T> {\n min: number\n max: number\n offset: number\n bits: Bit<T>[]\n}\n// a single row in the layout\nclass LayoutRow<T> {\n private padding = 1\n\n private allFilled?: Record<string, T> | string\n\n private widthLimit = 1_000_000\n\n private rowState?: RowState<T>\n\n // this.rowState.bits is the array of items in the layout row, indexed by (x - this.offset)\n // this.rowState.min is the leftmost edge of all the rectangles we have in the layout\n // this.rowState.max is the rightmost edge of all the rectangles we have in the layout\n // this.rowState.offset is the offset of the bits array relative to the genomic coordinates\n // (modified by pitchX, but we don't know that in this class)\n\n setAllFilled(data: Record<string, T> | string): void {\n this.allFilled = data\n }\n\n getItemAt(x: number): Record<string, T> | string | undefined {\n if (this.allFilled) {\n return this.allFilled\n }\n if (\n this.rowState?.min === undefined ||\n x < this.rowState.min ||\n x >= this.rowState.max\n ) {\n return undefined\n }\n return this.rowState.bits[x - this.rowState.offset]\n }\n\n isRangeClear(left: number, right: number) {\n if (this.allFilled) {\n return false\n }\n\n if (\n this.rowState === undefined ||\n right <= this.rowState.min ||\n left >= this.rowState.max\n ) {\n return true\n }\n const { min, max, offset, bits } = this.rowState\n\n const maxX = Math.min(max, right) - offset\n let flag = true\n for (let x = Math.max(min, left) - offset; x < maxX && flag; x++) {\n flag = bits[x] === undefined\n }\n\n return flag\n }\n\n // NOTE: this.rowState.min, this.rowState.max, and this.rowState.offset are\n // interbase coordinates\n initialize(left: number, right: number): RowState<T> {\n const rectWidth = right - left\n return {\n offset: left - rectWidth,\n min: left,\n max: right,\n bits: Array.from({ length: 3 * rectWidth }),\n }\n }\n\n addRect(rect: Rectangle<T>, data: Record<string, T> | string): void {\n const left = rect.l\n const right = rect.r + this.padding // only padding on the right\n if (!this.rowState) {\n this.rowState = this.initialize(left, right)\n }\n\n // or check if we need to expand to the left and/or to the right\n let oLeft = left - this.rowState.offset\n let oRight = right - this.rowState.offset\n const currLength = this.rowState.bits.length\n\n // expand rightward if necessary\n if (oRight >= this.rowState.bits.length) {\n const additionalLength = oRight + 1\n if (this.rowState.bits.length + additionalLength > this.widthLimit) {\n console.warn(\n 'Layout width limit exceeded, discarding old layout. Please be more careful about discarding unused blocks.',\n )\n this.rowState = this.initialize(left, right)\n } else if (additionalLength > 0) {\n this.rowState.bits = [\n ...this.rowState.bits,\n ...Array.from<Bit<T>>({ length: additionalLength }),\n ]\n }\n }\n\n // expand leftward if necessary\n if (left < this.rowState.offset) {\n // use math.min to avoid negative lengths\n const additionalLength = Math.min(\n currLength - oLeft,\n this.rowState.offset,\n )\n if (this.rowState.bits.length + additionalLength > this.widthLimit) {\n console.warn(\n 'Layout width limit exceeded, discarding old layout. Please be more careful about discarding unused blocks.',\n )\n\n this.rowState = this.initialize(left, right)\n } else {\n this.rowState.bits = [\n ...Array.from<Bit<T>>({ length: additionalLength }),\n ...this.rowState.bits,\n ]\n this.rowState.offset -= additionalLength\n }\n }\n oRight = right - this.rowState.offset\n oLeft = left - this.rowState.offset\n const w = oRight - oLeft\n\n if (w > maxFeaturePitchWidth) {\n console.warn(\n `Layout X pitch set too low, feature spans ${w} bits in a single row.`,\n rect,\n data,\n )\n }\n\n for (let x = oLeft; x < oRight; x += 1) {\n this.rowState.bits[x] = data\n }\n\n if (left < this.rowState.min) {\n this.rowState.min = left\n }\n if (right > this.rowState.max) {\n this.rowState.max = right\n }\n }\n\n /**\n * Given a range of interbase coordinates, deletes all data dealing with that range\n */\n discardRange(left: number, right: number): void {\n if (this.allFilled) {\n return\n } // allFilled is irrevocable currently\n\n // if we have no data, do nothing\n if (!this.rowState) {\n return\n }\n\n // if doesn't overlap at all, do nothing\n if (right <= this.rowState.min || left >= this.rowState.max) {\n return\n }\n\n // if completely encloses range, discard everything\n if (left <= this.rowState.min && right >= this.rowState.max) {\n this.rowState = undefined\n return\n }\n\n // if overlaps left edge, adjust the min\n if (right > this.rowState.min && left <= this.rowState.min) {\n this.rowState.min = right\n }\n\n // if overlaps right edge, adjust the max\n if (left < this.rowState.max && right >= this.rowState.max) {\n this.rowState.max = left\n }\n\n // now trim the left, right, or both sides of the array\n if (\n this.rowState.offset < this.rowState.min - minSizeToBotherWith &&\n this.rowState.bits.length >\n this.rowState.max + minSizeToBotherWith - this.rowState.offset\n ) {\n // trim both sides\n const leftTrimAmount = this.rowState.min - this.rowState.offset\n const rightTrimAmount =\n this.rowState.bits.length -\n 1 -\n (this.rowState.max - this.rowState.offset)\n // if (rightTrimAmount <= 0) debugger\n // if (leftTrimAmount <= 0) debugger\n // this.log(`trim both sides, ${leftTrimAmount} from left, ${rightTrimAmount} from right`)\n this.rowState.bits = this.rowState.bits.slice(\n leftTrimAmount,\n this.rowState.bits.length - rightTrimAmount,\n )\n this.rowState.offset += leftTrimAmount\n // if (this.rowState.offset > this.rowState.min) debugger\n // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger\n } else if (this.rowState.offset < this.rowState.min - minSizeToBotherWith) {\n // trim left side\n const desiredOffset =\n this.rowState.min - Math.floor(minSizeToBotherWith / 2)\n const trimAmount = desiredOffset - this.rowState.offset\n // this.log(`trim left side by ${trimAmount}`)\n this.rowState.bits.splice(0, trimAmount)\n this.rowState.offset += trimAmount\n // if (this.rowState.offset > this.rowState.min) debugger\n // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger\n } else if (\n this.rowState.bits.length >\n this.rowState.max - this.rowState.offset + minSizeToBotherWith\n ) {\n // trim right side\n const desiredLength =\n this.rowState.max -\n this.rowState.offset +\n 1 +\n Math.floor(minSizeToBotherWith / 2)\n // this.log(`trim right side by ${this.rowState.bits.length-desiredLength}`)\n // if (desiredLength > this.rowState.bits.length) debugger\n this.rowState.bits.length = desiredLength\n // if (this.rowState.offset > this.rowState.min) debugger\n // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger\n }\n\n // if (this.rowState.offset > this.rowState.min) debugger\n // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger\n\n // if range now enclosed in the new bounds, loop through and clear the bits\n const oLeft = Math.max(this.rowState.min, left) - this.rowState.offset\n // if (oLeft < 0) debugger\n // if (oLeft >= this.rowState.bits.length) debugger\n // if (oRight < 0) debugger\n // if (oRight >= this.rowState.bits.length) debugger\n\n const oRight = Math.min(right, this.rowState.max) - this.rowState.offset\n for (let x = oLeft; x >= 0 && x < oRight; x += 1) {\n this.rowState.bits[x] = undefined\n }\n }\n}\n\nexport default class GranularRectLayout<T> implements BaseLayout<T> {\n private pitchX: number\n\n private pitchY: number\n\n private hardRowLimit: number\n\n private bitmap: LayoutRow<T>[]\n\n private rectangles: Map<string, Rectangle<T>>\n\n public maxHeightReached: boolean\n\n private maxHeight: number\n\n private displayMode: string\n\n private pTotalHeight: number\n\n /**\n * pitchX - layout grid pitch in the X direction\n * pitchY - layout grid pitch in the Y direction\n * maxHeight - maximum layout height, default Infinity (no max)\n */\n constructor({\n pitchX = 10,\n pitchY = 10,\n maxHeight = 10000,\n hardRowLimit = 10000,\n displayMode = 'normal',\n }: {\n pitchX?: number\n pitchY?: number\n maxHeight?: number\n displayMode?: string\n hardRowLimit?: number\n } = {}) {\n this.pitchX = pitchX\n this.pitchY = pitchY\n this.hardRowLimit = hardRowLimit\n this.maxHeightReached = false\n this.displayMode = displayMode\n\n // reduce the pitchY to try and pack the features tighter\n if (this.displayMode === 'compact') {\n this.pitchY = Math.round(this.pitchY / 4) || 1\n this.pitchX = Math.round(this.pitchX / 4) || 1\n }\n\n this.bitmap = []\n this.rectangles = new Map()\n this.maxHeight = Math.ceil(maxHeight / this.pitchY)\n this.pTotalHeight = 0 // total height, in units of bitmap squares (px/pitchY)\n }\n\n /**\n * @returns top position for the rect, or Null if laying\n * out the rect would exceed maxHeight\n */\n addRect(\n id: string,\n left: number,\n right: number,\n height: number,\n data?: T,\n ): number | null {\n // if we have already laid it out, return its layout\n const storedRec = this.rectangles.get(id)\n if (storedRec) {\n if (storedRec.top === null) {\n return null\n }\n\n // add it to the bitmap again, since that bitmap range may have been\n // discarded\n this.addRectToBitmap(storedRec)\n return storedRec.top * this.pitchY\n }\n\n const pLeft = Math.floor(left / this.pitchX)\n const pRight = Math.floor(right / this.pitchX)\n const pHeight = Math.ceil(height / this.pitchY)\n\n const rectangle: Rectangle<T> = {\n id,\n l: pLeft,\n r: pRight,\n top: null,\n h: pHeight,\n originalHeight: height,\n data,\n }\n\n const maxTop = this.maxHeight - pHeight\n let top = 0\n if (this.displayMode !== 'collapse') {\n for (; top <= maxTop; top += 1) {\n if (!this.collides(rectangle, top)) {\n break\n }\n }\n\n if (top > maxTop) {\n rectangle.top = null\n this.rectangles.set(id, rectangle)\n this.maxHeightReached = true\n return null\n }\n }\n rectangle.top = top\n this.addRectToBitmap(rectangle)\n this.rectangles.set(id, rectangle)\n this.pTotalHeight = Math.max(this.pTotalHeight || 0, top + pHeight)\n return top * this.pitchY\n }\n\n collides(rect: Rectangle<T>, top: number) {\n const { bitmap } = this\n\n const maxY = top + rect.h\n for (let y = top; y < maxY; y += 1) {\n const row = bitmap[y]\n if (row !== undefined && !row.isRangeClear(rect.l, rect.r)) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * make a subarray if it does not exist\n */\n private autovivifyRow(bitmap: LayoutRow<T>[], y: number) {\n let row = bitmap[y]\n if (!row) {\n if (y > this.hardRowLimit) {\n throw new Error(\n `layout hard limit (${\n this.hardRowLimit * this.pitchY\n }px) exceeded, aborting layout`,\n )\n }\n row = new LayoutRow()\n bitmap[y] = row\n }\n return row\n }\n\n addRectToBitmap(rect: Rectangle<T>) {\n if (rect.top === null) {\n return\n }\n\n const data = rect.id\n const yEnd = rect.top + rect.h\n if (rect.r - rect.l > maxFeaturePitchWidth) {\n // the rect is very big in relation to the view size, just pretend, for\n // the purposes of layout, that it extends infinitely. this will cause\n // weird layout if a user scrolls manually for a very, very long time\n // along the genome at the same zoom level. but most users will not do\n // that. hopefully.\n for (let y = rect.top; y < yEnd; y += 1) {\n this.autovivifyRow(this.bitmap, y).setAllFilled(data)\n }\n } else {\n for (let y = rect.top; y < yEnd; y += 1) {\n this.autovivifyRow(this.bitmap, y).addRect(rect, data)\n }\n }\n }\n\n /**\n * Given a range of X coordinates, deletes all data dealing with\n * the features.\n */\n discardRange(left: number, right: number) {\n const pLeft = Math.floor(left / this.pitchX)\n const pRight = Math.floor(right / this.pitchX)\n const { bitmap } = this\n for (const row of bitmap) {\n row.discardRange(pLeft, pRight)\n }\n }\n\n hasSeen(id: string) {\n return this.rectangles.has(id)\n }\n\n getByCoord(x: number, y: number) {\n const pY = Math.floor(y / this.pitchY)\n const row = this.bitmap[pY]\n if (!row) {\n return undefined\n }\n const pX = Math.floor(x / this.pitchX)\n return row.getItemAt(pX)\n }\n\n getByID(id: string) {\n const r = this.rectangles.get(id)\n if (r) {\n const t = r.top! * this.pitchY\n return [\n r.l * this.pitchX,\n t,\n r.r * this.pitchX,\n t + r.originalHeight,\n ] as RectTuple\n }\n\n return undefined\n }\n\n getDataByID(id: string) {\n return this.rectangles.get(id)?.data\n }\n\n cleanup() {}\n\n getTotalHeight() {\n return this.pTotalHeight * this.pitchY\n }\n\n get totalHeight() {\n return this.getTotalHeight()\n }\n\n getRectangles(): Map<string, RectTuple> {\n return new Map(\n [...this.rectangles.entries()].map(([id, rect]) => {\n const { l, r, originalHeight, top } = rect\n const t = (top || 0) * this.pitchY\n const b = t + originalHeight\n return [id, [l * this.pitchX, t, r * this.pitchX, b]] // left, top, right, bottom\n }),\n )\n }\n\n serializeRegion(region: { start: number; end: number }): SerializedLayout {\n const regionRectangles: Record<string, RectTuple> = {}\n let maxHeightReached = false\n for (const [id, rect] of this.rectangles.entries()) {\n const { l, r, originalHeight, top } = rect\n if (rect.top === null) {\n maxHeightReached = true\n } else {\n const t = (top || 0) * this.pitchY\n const b = t + originalHeight\n const y1 = l * this.pitchX\n const y2 = r * this.pitchX\n const x1 = region.start\n const x2 = region.end\n // add +/- pitchX to avoid resolution causing errors\n if (segmentsIntersect(x1, x2, y1 - this.pitchX, y2 + this.pitchX)) {\n regionRectangles[id] = [y1, t, y2, b]\n }\n }\n }\n return {\n rectangles: regionRectangles,\n containsNoTransferables: true,\n totalHeight: this.getTotalHeight(),\n maxHeightReached,\n }\n }\n\n toJSON(): SerializedLayout {\n const rectangles = Object.fromEntries(this.getRectangles())\n return {\n rectangles,\n containsNoTransferables: true,\n totalHeight: this.getTotalHeight(),\n maxHeightReached: this.maxHeightReached,\n }\n }\n}\n","import { BaseLayout, SerializedLayout } from './BaseLayout'\n\nexport default class MultiLayout<SUB_LAYOUT_CLASS extends BaseLayout<T>, T> {\n subLayouts = new Map<string, SUB_LAYOUT_CLASS>()\n\n /**\n * layout class that just keeps a number of named sub-layouts.\n * basically just a fancier\n * `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`\n */\n constructor(\n public SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS,\n public subLayoutConstructorArgs: Record<string, any> = {},\n ) {}\n\n getDataByID(id: string): unknown {\n for (const layout of this.subLayouts.values()) {\n // @ts-expect-error\n const r = layout.getDataByID(id)\n if (r) {\n return r\n }\n }\n return undefined\n }\n\n getSublayout(layoutName: string): SUB_LAYOUT_CLASS {\n let subLayout = this.subLayouts.get(layoutName)\n if (subLayout === undefined) {\n subLayout = new this.SubLayoutClass(this.subLayoutConstructorArgs)\n this.subLayouts.set(layoutName, subLayout)\n return subLayout\n }\n\n return subLayout\n }\n\n addRect(\n layoutName: string,\n id: string,\n left: number,\n right: number,\n height: number,\n data: Record<string, T> = {},\n ) {\n return this.getSublayout(layoutName).addRect(id, left, right, height, data)\n }\n\n discardRange(layoutName: string, left: number, right: number) {\n return this.subLayouts.get(layoutName)?.discardRange(left, right)\n }\n\n toJSON() {\n const data: Record<string, SerializedLayout> = {}\n for (const [layoutName, sublayout] of this.subLayouts.entries()) {\n data[layoutName] = sublayout.toJSON()\n }\n return data\n }\n}\n","import {\n RectTuple,\n SerializedLayout,\n BaseLayout,\n Rectangle,\n} from './BaseLayout'\nimport RBush from 'rbush'\n\nexport interface Layout {\n minX: number\n minY: number\n maxX: number\n maxY: number\n name: string\n}\n\nexport default class PrecomputedLayout<T> implements BaseLayout<T> {\n private rectangles: Map<string, RectTuple>\n\n private totalHeight: number\n\n public maxHeightReached: boolean\n\n private rbush: RBush<Layout>\n\n constructor({ rectangles, totalHeight, maxHeightReached }: SerializedLayout) {\n this.rectangles = new Map(Object.entries(rectangles))\n // rectangles is of the form \"featureId\": [leftPx, topPx, rightPx, bottomPx]\n this.totalHeight = totalHeight\n this.maxHeightReached = maxHeightReached\n this.rbush = new RBush()\n for (const [key, layout] of Object.entries(rectangles)) {\n this.rbush.insert({\n minX: layout[0],\n minY: layout[1],\n maxX: layout[2],\n maxY: layout[3],\n name: key,\n })\n }\n }\n\n addRect(id: string) {\n const rect = this.rectangles.get(id)\n if (!rect) {\n throw new Error(`id ${id} not found in precomputed feature layout`)\n }\n // left, top, right, bottom\n return rect[1]\n }\n\n /**\n * returns a Map of `feature id -> rectangle`\n */\n getRectangles(): Map<string, RectTuple> {\n return this.rectangles\n }\n\n getTotalHeight(): number {\n return this.totalHeight\n }\n\n collides(_rect: Rectangle<T>, _top: number): boolean {\n throw new Error('Method not implemented.')\n }\n\n getByCoord(x: number, y: number) {\n const rect = { minX: x, minY: y, maxX: x + 1, maxY: y + 1 }\n return this.rbush.collides(rect)\n ? this.rbush.search(rect)[0]!.name\n : undefined\n }\n\n getByID(id: string) {\n return this.rectangles.get(id)\n }\n\n addRectToBitmap(_rect: Rectangle<T>, _data: Record<string, T>): void {\n throw new Error('Method not implemented.')\n }\n\n discardRange(_left: number, _right: number): void {\n throw new Error('Method not implemented.')\n }\n\n serializeRegion(_region: { start: number; end: number }): SerializedLayout {\n throw new Error('Method not implemented.')\n }\n\n toJSON(): SerializedLayout {\n return {\n rectangles: Object.fromEntries(this.rectangles),\n totalHeight: this.totalHeight,\n maxHeightReached: false,\n containsNoTransferables: true,\n }\n }\n}\n","import MultiLayout from './MultiLayout'\nimport PrecomputedLayout from './PrecomputedLayout'\n\nclass ThrowingLayout {\n constructor() {\n throw new Error('invalid layout name')\n }\n}\n\nexport default class PrecomputedMultiLayout extends MultiLayout {\n constructor(json) {\n // use ThrowingLayout because there is not supposed to be any creation\n // of new layouts in a precomputed layout\n super(ThrowingLayout)\n Object.entries(json).forEach(([layoutName, sublayoutJson]) => {\n this.subLayouts.set(layoutName, new PrecomputedLayout(sublayoutJson))\n })\n }\n}\n","interface AbsoluteCache {\n dirty: boolean\n left?: number\n right?: number\n top?: number\n bottom?: number\n width?: number\n height?: number\n}\n\nexport default class SceneGraph {\n private children: Map<string, SceneGraph>\n\n private absoluteCache: AbsoluteCache\n\n public parent?: SceneGraph\n\n /**\n * note: all coordinates are inter-base or inter-pixel coordinates\n */\n constructor(\n public name: string,\n public left: number,\n public top: number,\n public width: number,\n public height: number,\n\n public data?: Record<string, any>,\n ) {\n this.children = new Map()\n this.absoluteCache = { dirty: true }\n }\n\n addChild(\n nameOrSceneGraph: string | SceneGraph,\n left: number,\n top: number,\n width: number,\n height: number,\n\n data?: Record<string, any>,\n ) {\n const child =\n nameOrSceneGraph instanceof SceneGraph\n ? nameOrSceneGraph\n : new SceneGraph(nameOrSceneGraph, left, top, width, height, data)\n\n if (!(child instanceof SceneGraph)) {\n throw new TypeError(\n 'argument to addChild must be an array or a SceneGraph',\n )\n }\n\n if (this.children.has(child.name)) {\n throw new Error(`child named \"${child.name}\" already exists`)\n }\n\n // update the bounds to match the child\n child.parent = this\n const {\n left: childLeft,\n right: childRight,\n top: childTop,\n bottom: childBottom,\n } = child.absolute\n if (\n childLeft !== undefined &&\n childRight !== undefined &&\n childTop !== undefined &&\n childBottom !== undefined\n ) {\n this.expand(childLeft, childRight, childTop, childBottom)\n this.children.set(child.name, child)\n }\n return child\n }\n\n getSubRecord(name: string) {\n return this.children.get(name)\n }\n\n /**\n * if the record does not already cover the given absolute extents, extend it\n * to cover them\n *\n * @param left -\n * @param right -\n * @param top -\n * @param bottom -\n */\n expand(newLeft: number, newRight: number, newTop: number, newBottom: number) {\n const { left, right, top, bottom } = this.absolute\n\n if (left !== undefined && newLeft < left) {\n const diff = left - newLeft\n this.width += diff\n this.left -= diff\n }\n if (right !== undefined && newRight > right) {\n this.width += newRight - right\n }\n if (top !== undefined && newTop < top) {\n const diff = top - newTop\n this.height += diff\n this.top -= diff\n }\n if (bottom !== undefined && newBottom > bottom) {\n this.height += newBottom - bottom\n }\n if (this.parent) {\n this.parent.expand(newLeft, newRight, newTop, newBottom)\n }\n this.absoluteCache.dirty = true\n }\n\n get bottom() {\n return this.top + this.height\n }\n\n get right() {\n return this.left + this.width\n }\n\n walkParents(callback: (arg: SceneGraph) => void) {\n if (this.parent) {\n callback(this.parent)\n this.parent.walkParents(callback)\n }\n }\n\n walkChildren(callback: (c: SceneGraph) => void) {\n for (const sub of this.children.values()) {\n callback(sub)\n sub.walkChildren(callback)\n }\n }\n\n get absolute() {\n if (this.absoluteCache.dirty) {\n let xOffset = 0\n let yOffset = 0\n this.walkParents((node: SceneGraph) => {\n xOffset += node.left\n yOffset += node.top\n })\n this.absoluteCache = {\n dirty: false,\n left: this.left + xOffset,\n right: this.right + xOffset,\n top: this.top + yOffset,\n bottom: this.bottom + yOffset,\n width: this.width,\n height: this.height,\n }\n }\n return this.absoluteCache\n }\n\n move(x: number, y: number) {\n this.left += x\n this.top += y\n\n this.absoluteCache.dirty = true\n this.walkChildren(c => {\n c.absoluteCache.dirty = true\n })\n const { left, right, top, bottom } = this.absolute\n if (\n left !== undefined &&\n right !== undefined &&\n top !== undefined &&\n bottom !== undefined\n ) {\n this.expand(left, right, top, bottom)\n }\n }\n}\n","import {\n isOptionalType,\n isUnionType,\n isArrayType,\n isMapType,\n isLateType,\n IAnyType,\n IModelReflectionPropertiesData,\n IAnyComplexType,\n ISimpleType,\n UnionStringArray,\n} from 'mobx-state-tree'\n\nexport interface ILiteralType<T> extends ISimpleType<T> {\n value: T\n}\n\n/**\n * get the inner type of an MST optional, array, or late type object\n */\nexport function getSubType(type: IAnyType): IAnyType {\n let t: IAnyType\n if (isOptionalType(type)) {\n // @ts-expect-error\n t = type._subtype || type.type\n } else if (isArrayType(type) || isMapType(type)) {\n // @ts-expect-error\n t = type._subtype || type._subType || type.subType\n // @ts-expect-error\n } else if (typeof type.getSubType === 'function') {\n // @ts-expect-error\n return type.getSubType()\n } else {\n throw new TypeError('unsupported mst type')\n }\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!t) {\n throw new Error('failed to get subtype')\n }\n return t\n}\n\n/**\n * get the array of the subtypes in a union\n */\nexport function getUnionSubTypes(unionType: IAnyType): IAnyType[] {\n if (!isUnionType(unionType)) {\n throw new TypeError('not an MST union type')\n }\n const t =\n // @ts-expect-error\n unionType._types ||\n // @ts-expect-error\n unionType.types ||\n // @ts-expect-error\n getSubType(unionType)._types ||\n // @ts-expect-error\n getSubType(unionType).types\n if (!t) {\n // debugger\n throw new Error('failed to extract subtypes from mst union')\n }\n return t\n}\n\n/**\n * get the type of one of the properties of the given MST model type\n */\nexport function getPropertyType(\n type: IModelReflectionPropertiesData,\n propertyName: string,\n) {\n return type.properties[propertyName]!\n}\n\n/**\n * get the base type from inside an MST optional type\n */\nexport function getDefaultValue(type: IAnyType) {\n if (!isOptionalType(type)) {\n throw new TypeError('type must be an optional type')\n }\n // @ts-expect-error\n return type._defaultValue || type.defaultValue\n}\n\nexport type IEnumerationType<T extends string> = ISimpleType<\n UnionStringArray<T[]>\n>\n\n/** get the string values of an MST enumeration type */\nexport function getEnumerationValues(type: IAnyComplexType) {\n const subtypes = getUnionSubTypes(type) as ILiteralType<string>[]\n // the subtypes should all be literals with a value member\n return subtypes.map(t => t.value)\n}\n\nexport function resolveLateType(maybeLate: IAnyType) {\n if (\n !isUnionType(maybeLate) &&\n !isArrayType(maybeLate) &&\n isLateType(maybeLate)\n ) {\n // @ts-expect-error\n return maybeLate.getSubType()\n }\n return maybeLate\n}\n","// This file replaces `index.js` in bundlers like webpack or Rollup,\n// according to `browser` config in `package.json`.\n\n// This alphabet uses `A-Za-z0-9_-` symbols.\n// The order of characters is optimized for better gzip and brotli compression.\n// Same as in non-secure/index.js\nexport const urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n\nexport const random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\n\nexport const customRandom = (alphabet, defaultSize, getRandom) => {\n // First, a bitmask is necessary to generate the ID. The bitmask makes bytes\n // values closer to the alphabet size. The bitmask calculates the closest\n // `2^31 - 1` number, which exceeds the alphabet size.\n // For example, the bitmask for the alphabet size 30 is 31 (00011111).\n // `Math.clz32` is not used, because it is not available in browsers.\n const mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n // Though, the bitmask solution is not perfect since the bytes exceeding\n // the alphabet size are refused. Therefore, to reliably generate the ID,\n // the random bytes redundancy has to be satisfied.\n\n // Note: every hardware random generator call is performance expensive,\n // because the system call for entropy collection takes a lot of time.\n // So, to avoid additional system calls, extra bytes are requested in advance.\n\n // Next, a step determines how many random bytes to generate.\n // The number of random bytes gets decided upon the ID size, mask,\n // alphabet size, and magic number 1.6 (using 1.6 peaks at performance\n // according to benchmarks).\n\n // `-~f => Math.ceil(f)` if f is a float\n // `-~i => i + 1` if i is an integer\n const step = -~((1.6 * mask * defaultSize) / alphabet.length)\n\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n const bytes = getRandom(step)\n // A compact alternative for `for (var i = 0; i < step; i++)`.\n let j = step\n while (j--) {\n // Adding `|| ''` refuses a random byte that exceeds the alphabet size.\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) {\n return id\n }\n }\n }\n }\n}\n\nexport const customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\n\nexport const nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n // It is incorrect to use bytes exceeding the alphabet size.\n // The following mask reduces the random byte in the 0-255 value\n // range to the 0-63 value range. Therefore, adding hacks, such\n // as empty string fallback or magic numbers, is unnecessary because\n // the bitmask trims bytes down to the alphabet size.\n byte &= 63\n if (byte < 36) {\n // `0-9a-z`\n id += byte.toString(36)\n } else if (byte < 62) {\n // `A-Z`\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\n","/* eslint-disable react-refresh/only-export-components */\n// This file is a ponyfill for the HTML5 OffscreenCanvas API.\n\nimport isNode from 'detect-node'\n\nimport { CanvasSequence } from 'canvas-sequencer'\n\ntype AbstractCanvas = any\n\ntype AbstractImageBitmap = any\n\nexport let createCanvas: (width: number, height: number) => AbstractCanvas\nexport let createImageBitmap: (\n canvas: AbstractCanvas,\n) => Promise<AbstractImageBitmap>\n\n/** the JS class (constructor) for offscreen-generated image bitmap data */\nexport let ImageBitmapType: unknown\n\nexport function drawImageOntoCanvasContext(\n imageData: any,\n context: CanvasRenderingContext2D,\n) {\n if (imageData.serializedCommands) {\n const seq = new CanvasSequence(imageData.serializedCommands)\n seq.execute(context)\n } else {\n context.drawImage(imageData as CanvasImageSource, 0, 0)\n }\n}\n\nconst weHave = {\n realOffscreenCanvas: typeof OffscreenCanvas === 'function',\n node: isNode,\n}\n\nif (weHave.realOffscreenCanvas) {\n createCanvas = (width, height) => new OffscreenCanvas(width, height)\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n createImageBitmap = window.createImageBitmap || self.createImageBitmap\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n ImageBitmapType = window.ImageBitmap || self.ImageBitmap\n} else if (weHave.node) {\n // use node-canvas if we are running in node (i.e. automated tests)\n createCanvas = (...args) => {\n // @ts-expect-error\n return nodeCreateCanvas(...args)\n }\n createImageBitmap = async canvas => {\n const dataUri = canvas.toDataURL()\n // @ts-expect-error\n const img = new nodeImage()\n return new Promise((resolve, reject) => {\n // need onload for jest\n img.onload = () => {\n resolve(img)\n }\n img.onerror = reject\n img.src = dataUri\n })\n }\n} else {\n createCanvas = (width: number, height: number) => {\n const context = new CanvasSequence()\n return {\n width,\n height,\n getContext() {\n return context\n },\n }\n }\n createImageBitmap = async canvas => {\n const ctx = canvas.getContext('2d')\n return {\n height: canvas.height,\n width: canvas.width,\n serializedCommands: ctx.toJSON(),\n containsNoTransferables: true,\n }\n }\n ImageBitmapType = String\n}\n","/* eslint-disable react-refresh/only-export-components */\nimport React from 'react'\nimport { CanvasSequence } from 'canvas-sequencer'\n\n// locals\nimport { createCanvas, createImageBitmap } from './offscreenCanvasPonyfill'\nimport { blobToDataURL } from './blobToDataURL'\n\nexport type RenderReturn = Record<string, unknown> | undefined\n\ntype RendererRet = Promise<RenderReturn> | RenderReturn\n\nexport async function renderToAbstractCanvas(\n width: number,\n height: number,\n opts: {\n exportSVG?: { rasterizeLayers?: boolean; scale?: number }\n highResolutionScaling?: number\n },\n cb: (ctx: CanvasRenderingContext2D) => RendererRet,\n) {\n const { exportSVG, highResolutionScaling = 1 } = opts\n\n if (exportSVG) {\n if (!exportSVG.rasterizeLayers) {\n const fakeCtx = new CanvasSequence()\n const result = await cb(fakeCtx)\n return {\n ...result,\n canvasRecordedData: fakeCtx.toJSON(),\n }\n } else {\n const s = exportSVG.scale || highResolutionScaling\n const canvas = createCanvas(Math.ceil(width * s), height * s)\n const ctx = canvas.getContext('2d')\n if (!ctx) {\n throw new Error('2d canvas rendering not supported on this platform')\n }\n ctx.scale(s, s)\n const result = await cb(ctx)\n\n // two methods needed for converting canvas to PNG, one for webworker\n // offscreen canvas, one for main thread\n return {\n ...result,\n reactElement: (\n <image\n width={width}\n height={height}\n xlinkHref={\n 'convertToBlob' in canvas\n ? await blobToDataURL(\n await canvas.convertToBlob({\n type: 'image/png',\n }),\n )\n : canvas.toDataURL('image/png')\n }\n />\n ),\n }\n }\n } else {\n const s = highResolutionScaling\n const canvas = createCanvas(Math.ceil(width * s), height * s)\n const ctx = canvas.getContext('2d')\n if (!ctx) {\n throw new Error('2d canvas rendering not supported on this platform')\n }\n ctx.scale(s, s)\n const result = await cb(ctx)\n return { ...result, imageData: await createImageBitmap(canvas) }\n }\n}\n\nexport async function getSerializedSvg(results: {\n width: number\n height: number\n canvasRecordedData: unknown\n}) {\n const { width, height, canvasRecordedData } = results\n\n // @ts-ignore needs to be ignore not expect error, produces error in build step\n const C2S = await import('canvas2svg')\n const ctx = new C2S.default(width, height)\n const seq = new CanvasSequence(canvasRecordedData)\n seq.execute(ctx)\n\n // innerHTML strips the outer <svg> element from returned data, we add\n // our own <svg> element in the view's SVG export\n return ctx.getSvg().innerHTML as string\n}\n\nexport function ReactRendering({\n rendering,\n}: {\n rendering: {\n reactElement?: React.ReactNode\n html?: string\n }\n}) {\n return React.isValidElement(rendering.reactElement) ? (\n rendering.reactElement\n ) : (\n <g dangerouslySetInnerHTML={{ __html: rendering.html || '' }} />\n )\n}\n","/**\n * fast low-level intersection of 2 coordinate ranges. assumes interbase coordinates.\n *\n * assumes `left <= right` for both ranges\n *\n * @returns array of [left, right], or [] if the ranges do not intersect. the choice of [] is because it allows destructuring array assignment without check for undefined return\n */\nexport function intersection2(\n left1: number,\n right1: number,\n left2: number,\n right2: number,\n): [number, number] | [] {\n // this code is verbose because \"if\" statements are faster than Math.min and Math.max\n if (right1 > left2 && left1 < right2 && right2 - left2 && right1 - left1) {\n if (left1 > left2) {\n if (right1 < right2) {\n // 1 |-------|\n // |------------|\n return [left1, right1]\n }\n // 2 |----|\n // |------|\n return [left1, right2]\n }\n if (right1 < right2) {\n // 3 |-----|\n // |------|\n return [left2, right1]\n }\n // 4 |------------|\n // |-------|\n return [left2, right2]\n }\n return []\n}\n\n/**\n * Return whether 2 interbase coordinate ranges intersect.\n *\n * @param left1 -\n * @param right1 -\n * @param left2 -\n * @param right2 -\n *\n * @returns true if the two ranges intersect\n */\nexport function doesIntersect2(\n left1: number,\n right1: number,\n left2: number,\n right2: number,\n) {\n return right1 > left2 && left1 < right2\n}\n\n/**\n * Return whether the first region is completely contained within the second region\n *\n * @param left1 - candidate inner region left\n * @param right1 - candidate inner region right\n * @param left2 - candidate outer region left\n * @param right2 - candidate outer region right\n */\nexport function isContainedWithin(\n left1: number,\n right1: number,\n left2: number,\n right2: number,\n) {\n return left2 <= left1 && right2 >= right1\n}\n","import { Observable, Observer } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { observeAbortSignal } from '.'\n\n/**\n * Wrapper for rxjs Observable.create with improved error handling and\n * aborting support\n * @param func - observer function, could be async\n */\nexport function ObservableCreate<T>(\n func: (arg: Observer<T>) => void | Promise<void>,\n signal?: AbortSignal,\n): Observable<T> {\n return new Observable((observer: Observer<T>) => {\n try {\n const ret = func(observer)\n if (ret?.catch) {\n ret.catch((error: unknown) => {\n observer.error(error)\n })\n }\n } catch (error) {\n observer.error(error)\n }\n }).pipe(takeUntil(observeAbortSignal(signal)))\n}\n","/**\n * Abstract feature object\n */\nexport interface Feature {\n /**\n * Get a piece of data about the feature. All features must have\n * 'start' and 'end', but everything else is optional.\n */\n get(name: 'refName'): string\n get(name: 'start' | 'end'): number\n get(name: 'subfeatures'): Feature[] | undefined\n\n get(name: string): any\n\n /**\n * Set an item of data.\n */\n\n set(name: string, val: any): void\n\n /**\n * Get an array listing which data keys are present in this feature.\n */\n tags(): string[]\n\n /**\n * Get the unique ID of this feature.\n */\n id(): string\n\n /**\n * Get this feature's parent feature, or undefined if none.\n */\n parent(): Feature | undefined\n\n /**\n * Get an array of child features, or undefined if none.\n */\n children(): Feature[] | undefined\n\n /**\n * Convert to JSON\n */\n toJSON(): SimpleFeatureSerialized\n}\n\nexport function isFeature(thing: unknown): thing is Feature {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n typeof (thing as Feature).get === 'function' &&\n typeof (thing as Feature).id === 'function'\n )\n}\n\nexport interface SimpleFeatureArgs {\n /** key-value data, must include 'start' and 'end' */\n data: Record<string, unknown>\n /** optional parent feature */\n parent?: Feature\n /** unique identifier. can also be in data.uniqueId */\n id: string | number // thing that can be stringified easily\n}\n\n// subfeatures do not have to have uniqueId\nexport interface SimpleFeatureSerializedNoId {\n [key: string]: unknown\n parentId?: string\n start: number\n end: number\n refName: string\n type?: string\n subfeatures?: SimpleFeatureSerializedNoId[]\n}\n\n// base serialized feature has to have a uniqueId\nexport interface SimpleFeatureSerialized extends SimpleFeatureSerializedNoId {\n subfeatures?: SimpleFeatureSerializedNoId[]\n uniqueId: string\n}\n\nfunction isSimpleFeatureSerialized(\n args: SimpleFeatureSerialized | SimpleFeatureArgs,\n): args is SimpleFeatureSerialized {\n return 'uniqueId' in args && typeof args.data !== 'object'\n}\n\n/**\n * Simple implementation of a feature object.\n */\nexport default class SimpleFeature implements Feature {\n private data: Record<string, any>\n\n private subfeatures?: SimpleFeature[]\n\n private parentHandle?: Feature\n\n private uniqueId: string\n\n /**\n * @param args - SimpleFeature args\n *\n * Note: args.data.subfeatures can be an array of these same args,\n * which will be inflated to more instances of this class.\n */\n public constructor(args: SimpleFeatureArgs | SimpleFeatureSerialized) {\n if (isSimpleFeatureSerialized(args)) {\n this.data = args\n } else {\n this.data = args.data\n // load handle from args.parent (not args.data.parent) this reason is\n // because if args is an object, it likely isn't properly loaded with\n // parent as a Feature reference (probably a raw parent ID or something\n // instead)\n this.parentHandle = args.parent\n }\n\n // the feature id comes from args.id, args.data.uniqueId, or args.uniqueId\n // due to this initialization\n const id = isSimpleFeatureSerialized(args) ? args.uniqueId : args.id\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (id === undefined || id === null) {\n throw new Error(\n 'SimpleFeature requires a unique `id` or `data.uniqueId` attribute',\n )\n }\n this.uniqueId = String(id)\n\n if (!(this.data.aliases || this.data.end - this.data.start >= 0)) {\n throw new Error(\n `invalid feature data, end less than start. end: ${this.data.end} start: ${this.data.start}`,\n )\n }\n if (this.data.subfeatures) {\n this.subfeatures = this.data.subfeatures?.map((f: any, i: number) =>\n typeof f.get !== 'function'\n ? new SimpleFeature({\n id: f.uniqueId || `${id}-${i}`,\n data: {\n strand: this.data.strand,\n ...f,\n } as Record<string, any>,\n parent: this,\n })\n : f,\n )\n }\n }\n\n /**\n * Get a piece of data about the feature. All features must have\n * 'start' and 'end', but everything else is optional.\n */\n\n public get(name: string): any {\n return name === 'subfeatures'\n ? this.subfeatures\n : name === 'parent'\n ? this.parent()\n : this.data[name]\n }\n\n /**\n * Set an item of data.\n */\n\n public set(name: string, val: any): void {\n this.data[name] = val\n }\n\n /**\n * Get an array listing which data keys are present in this feature.\n */\n public tags(): string[] {\n return Object.keys(this.data)\n }\n\n /**\n * Get the unique ID of this feature.\n */\n public id(): string {\n return this.uniqueId\n }\n\n /**\n * Get this feature's parent feature, or undefined if none.\n */\n public parent(): Feature | undefined {\n return this.parentHandle\n }\n\n /**\n * Get an array of child features, or undefined if none.\n */\n public children(): Feature[] | undefined {\n return this.get('subfeatures')\n }\n\n public toJSON(): SimpleFeatureSerialized {\n const d = { ...this.data, uniqueId: this.id() } as SimpleFeatureSerialized\n const p = this.parent()\n if (p) {\n d.parentId = p.id()\n }\n const c = this.children()\n if (c) {\n d.subfeatures = c.map(child => child.toJSON())\n }\n return d\n }\n\n public static fromJSON(json: SimpleFeatureSerialized) {\n return new SimpleFeature({ ...json })\n }\n}\n","import { firstValueFrom, Observable } from 'rxjs'\nimport { reduce } from 'rxjs/operators'\n\n// locals\nimport { NoAssemblyRegion } from './types'\nimport { Feature } from './simpleFeature'\n\nexport interface UnrectifiedQuantitativeStats {\n scoreMin: number\n scoreMax: number\n scoreSum: number\n scoreSumSquares: number\n featureCount: number\n basesCovered: number\n}\nexport interface QuantitativeStats extends UnrectifiedQuantitativeStats {\n featureDensity: number\n scoreMean: number\n scoreStdDev: number\n}\n\n/**\n * calculate standard deviation using the 'shortcut method' that accepts\n * the sum and the sum squares of the elements\n *\n * @param sum - sum(i, 1..n)\n * @param sumSquares - sum(i^2, 1..n)\n * @param n - number of elements\n * @param population - boolean: use population instead of sample correction\n * @returns - the estimated std deviation\n */\nexport function calcStdFromSums(\n sum: number,\n sumSquares: number,\n n: number,\n population = false,\n): number {\n if (n === 0) {\n return 0\n }\n let variance: number\n if (population) {\n variance = sumSquares / n - (sum * sum) / (n * n)\n } else {\n // sample correction is n-1\n variance = sumSquares - (sum * sum) / n\n if (n > 1) {\n variance /= n - 1\n }\n }\n\n return variance < 0 ? 0 : Math.sqrt(variance)\n}\n\n/**\n * @param stats - a summary stats object with scoreSum, featureCount,\n * scoreSumSquares, and basesCovered\n * @returns - a summary stats object with\n * scoreMean, scoreStdDev, and featureDensity added\n */\nexport function rectifyStats(s: UnrectifiedQuantitativeStats) {\n return {\n ...s,\n scoreMean: (s.scoreSum || 0) / (s.featureCount || s.basesCovered || 1),\n scoreStdDev: calcStdFromSums(\n s.scoreSum,\n s.scoreSumSquares,\n s.featureCount || s.basesCovered,\n ),\n featureDensity: (s.featureCount || 1) / s.basesCovered,\n } as QuantitativeStats\n}\n\n/**\n * calculates per-base scores for variable width features over a region\n *\n * @param region - object contains start, end\n * @param features - list of features with start, end, score\n * @returns array of numeric scores\n */\nexport function calcPerBaseStats(\n region: NoAssemblyRegion,\n features: Feature[],\n): number[] {\n const { start, end } = region\n const scores = []\n const feats = features.sort((a, b) => a.get('start') - b.get('start'))\n let pos = start\n let currentFeat = 0\n let i = 0\n\n while (pos < end) {\n while (\n currentFeat < feats.length &&\n pos >= feats[currentFeat]!.get('end')\n ) {\n currentFeat += 1\n }\n const f = feats[currentFeat]\n if (!f) {\n scores[i] = 0\n } else if (pos >= f.get('start') && pos < f.get('end')) {\n scores[i] = f.get('score')\n } else {\n scores[i] = 0\n }\n i += 1\n pos += 1\n }\n return scores\n}\n\n/**\n * transform a list of scores to summary statistics\n *\n * @param region - object with start, end\n * @param features - array of features which are possibly summary features\n * @returns - object with scoreMax, scoreMin, scoreSum, scoreSumSquares, etc\n */\nexport async function scoresToStats(\n region: NoAssemblyRegion,\n feats: Observable<Feature>,\n) {\n const { start, end } = region\n const seed = {\n scoreMin: Number.MAX_VALUE,\n scoreMax: Number.MIN_VALUE,\n scoreSum: 0,\n scoreSumSquares: 0,\n featureCount: 0,\n }\n let found = false\n\n const { scoreMin, scoreMax, scoreSum, scoreSumSquares, featureCount } =\n await firstValueFrom(\n feats.pipe(\n reduce((acc, f) => {\n const s = f.get('score')\n const summary = f.get('summary')\n const { scoreMax, scoreMin } = acc\n acc.scoreMax = Math.max(scoreMax, summary ? f.get('maxScore') : s)\n acc.scoreMin = Math.min(scoreMin, summary ? f.get('minScore') : s)\n acc.scoreSum += s\n acc.scoreSumSquares += s * s\n acc.featureCount += 1\n found = true\n\n return acc\n }, seed),\n ),\n )\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return found\n ? rectifyStats({\n scoreMax,\n scoreMin,\n scoreSum,\n scoreSumSquares,\n featureCount,\n basesCovered: end - start + 1,\n })\n : blankStats()\n}\n\nexport function blankStats() {\n return {\n scoreMin: 0,\n scoreMax: 0,\n scoreMean: 0,\n scoreStdDev: 0,\n scoreSum: 0,\n scoreSumSquares: 0,\n featureCount: 0,\n featureDensity: 0,\n basesCovered: 0,\n } as QuantitativeStats\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport React from 'react'\nimport {\n isStateTreeNode,\n Instance,\n SnapshotIn,\n IAnyStateTreeNode,\n IStateTreeNode,\n IType,\n} from 'mobx-state-tree'\nimport { ThemeOptions } from '@mui/material'\nimport { AnyConfigurationModel } from '../../configuration'\nimport TextSearchManager from '../../TextSearch/TextSearchManager'\nimport { MenuItem } from '../../ui'\nimport RpcManager from '../../rpc/RpcManager'\nimport { Feature } from '../simpleFeature'\nimport { BaseInternetAccountModel } from '../../pluggableElementTypes/models'\n// types\nimport type assemblyManager from '../../assemblyManager'\nimport type {\n NoAssemblyRegion as MUNoAssemblyRegion,\n Region as MUIRegion,\n LocalPathLocation as MULocalPathLocation,\n UriLocation as MUUriLocation,\n BlobLocation as MUBlobLocation,\n} from './mst'\n\nexport * from './util'\n\n/** abstract type for a model that contains multiple views */\nexport interface AbstractViewContainer\n extends IStateTreeNode<IType<any, unknown, any>> {\n views: AbstractViewModel[]\n removeView(view: AbstractViewModel): void\n addView(\n typeName: string,\n initialState?: Record<string, unknown>,\n ): AbstractViewModel\n}\nexport function isViewContainer(\n thing: unknown,\n): thing is AbstractViewContainer {\n return (\n isStateTreeNode(thing) &&\n 'removeView' in thing &&\n 'addView' in thing &&\n 'views' in thing\n )\n}\n\nexport type NotificationLevel = 'error' | 'info' | 'warning' | 'success'\nexport interface SnackAction {\n name: React.ReactElement\n onClick: () => void\n}\n\nexport type AssemblyManager = Instance<ReturnType<typeof assemblyManager>>\n\nexport interface BasePlugin {\n version?: string\n name: string\n url?: string\n}\n\nexport interface JBrowsePlugin {\n name: string\n authors: string[]\n description: string\n location: string\n url?: string\n umdUrl?: string\n esmUrl?: string\n cjsUrl?: string\n license: string\n image?: string\n}\n\nexport type DialogComponentType =\n | React.LazyExoticComponent<React.FC<any>>\n | React.FC<any>\n\n/** minimum interface that all session state models must implement */\nexport interface AbstractSessionModel extends AbstractViewContainer {\n jbrowse: IAnyStateTreeNode\n drawerPosition?: string\n configuration: AnyConfigurationModel\n rpcManager: RpcManager\n assemblyNames: string[]\n assemblies: AnyConfigurationModel[]\n selection?: unknown\n focusedViewId?: string\n themeName?: string\n hovered: unknown\n setHovered: (arg: unknown) => void\n setFocusedViewId?: (id: string) => void\n allThemes?: () => Record<string, ThemeOptions>\n setSelection: (feature: Feature) => void\n setSession?: (arg: { name: string; [key: string]: unknown }) => void\n clearSelection: () => void\n duplicateCurrentSession?: () => void\n notify: (\n message: string,\n level?: NotificationLevel,\n action?: SnackAction,\n ) => void\n notifyError: (message: string, error?: unknown, extra?: unknown) => void\n assemblyManager: AssemblyManager\n version: string\n getTrackActionMenuItems?: Function\n addAssembly?: Function\n removeAssembly?: Function\n textSearchManager?: TextSearchManager\n connections: AnyConfigurationModel[]\n deleteConnection?: Function\n temporaryAssemblies?: unknown[]\n addTemporaryAssembly?: (arg: Record<string, unknown>) => void\n removeTemporaryAssembly?: (arg: string) => void\n sessionConnections?: AnyConfigurationModel[]\n sessionTracks?: AnyConfigurationModel[]\n connectionInstances?: {\n name: string\n tracks: AnyConfigurationModel[]\n configuration: AnyConfigurationModel\n }[]\n makeConnection?: Function\n breakConnection?: Function\n\n prepareToBreakConnection?: (arg: AnyConfigurationModel) => any\n adminMode?: boolean\n showWidget?: Function\n addWidget?: Function\n\n DialogComponent?: DialogComponentType\n\n DialogProps: any\n queueDialog<T extends DialogComponentType>(\n callback: (doneCallback: () => void) => [T, React.ComponentProps<T>],\n ): void\n name: string\n id?: string\n tracks: AnyConfigurationModel[]\n}\nexport function isSessionModel(thing: unknown): thing is AbstractSessionModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'rpcManager' in thing &&\n 'configuration' in thing\n )\n}\n\n/** abstract interface for a session allows editing configurations */\nexport interface SessionWithConfigEditing extends AbstractSessionModel {\n editConfiguration(configuration: AnyConfigurationModel): void\n}\nexport function isSessionModelWithConfigEditing(\n thing: unknown,\n): thing is SessionWithConfigEditing {\n return isSessionModel(thing) && 'editConfiguration' in thing\n}\n\n/** abstract interface for a session allows adding tracks */\nexport interface SessionWithConfigEditing extends AbstractSessionModel {\n addTrackConf(\n configuration: AnyConfigurationModel | SnapshotIn<AnyConfigurationModel>,\n ): void\n}\nexport function isSessionWithAddTracks(\n thing: unknown,\n): thing is SessionWithConfigEditing {\n return (\n // @ts-expect-error\n isSessionModel(thing) && 'addTrackConf' in thing && !thing.disableAddTracks\n )\n}\n\n/** abstract interface for a session allows adding tracks */\nexport interface SessionWithShareURL extends AbstractSessionModel {\n shareURL: string\n}\nexport function isSessionWithShareURL(\n thing: unknown,\n): thing is SessionWithShareURL {\n return isSessionModel(thing) && 'shareURL' in thing && !!thing.shareURL\n}\n\nexport interface Widget {\n type: string\n id: string\n}\n\n/** abstract interface for a session that manages widgets */\nexport interface SessionWithWidgets extends AbstractSessionModel {\n minimized: boolean\n visibleWidget?: Widget\n widgets: Map<string | number, Widget>\n activeWidgets: Map<string | number, Widget>\n hideAllWidgets: () => void\n addWidget(\n typeName: string,\n id: string,\n initialState?: Record<string, unknown>,\n configuration?: { type: string },\n ): Widget\n showWidget(widget: unknown): void\n hideWidget(widget: unknown): void\n}\n\n/* only some sessions with widgets use a drawer widget */\nexport interface SessionWithDrawerWidgets extends SessionWithWidgets {\n drawerWidth: number\n resizeDrawer(arg: number): number\n minimizeWidgetDrawer(): void\n showWidgetDrawer: () => void\n drawerPosition: string\n setDrawerPosition(arg: string): void\n}\n\nexport function isSessionModelWithWidgets(\n thing: unknown,\n): thing is SessionWithWidgets {\n return isSessionModel(thing) && 'widgets' in thing\n}\ninterface SessionWithConnections {\n makeConnection: (arg: AnyConfigurationModel) => void\n}\nexport function isSessionModelWithConnections(\n thing: unknown,\n): thing is SessionWithConnections {\n return isSessionModel(thing) && 'makeConnection' in thing\n}\n\ninterface SessionWithConnectionEditing {\n addConnectionConf: (arg: AnyConfigurationModel) => void\n}\n\nexport function isSessionModelWithConnectionEditing(\n thing: unknown,\n): thing is SessionWithConnectionEditing {\n return isSessionModel(thing) && 'addConnectionConf' in thing\n}\n\nexport interface SessionWithSessionPlugins extends AbstractSessionModel {\n sessionPlugins: JBrowsePlugin[]\n addSessionPlugin: Function\n removeSessionPlugin: Function\n}\nexport function isSessionWithSessionPlugins(\n thing: unknown,\n): thing is SessionWithSessionPlugins {\n return isSessionModel(thing) && 'sessionPlugins' in thing\n}\n\n/** abstract interface for a session that manages a global selection */\nexport interface SelectionContainer extends AbstractSessionModel {\n selection?: unknown\n setSelection(thing: unknown): void\n}\nexport function isSelectionContainer(\n thing: unknown,\n): thing is SelectionContainer {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'selection' in thing &&\n 'setSelection' in thing\n )\n}\n\n/** abstract interface for a session allows applying focus to views and widgets */\nexport interface SessionWithFocusedViewAndDrawerWidgets\n extends SessionWithDrawerWidgets {\n focusedViewId: string | undefined\n setFocusedViewId(id: string): void\n}\n\n/** minimum interface that all view state models must implement */\nexport interface AbstractViewModel {\n id: string\n type: string\n width: number\n minimized: boolean\n setWidth(width: number): void\n setMinimized(flag: boolean): void\n displayName: string | undefined\n setDisplayName: (arg: string) => void\n menuItems: () => MenuItem[]\n}\nexport function isViewModel(thing: unknown): thing is AbstractViewModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'width' in thing &&\n 'setWidth' in thing\n )\n}\n\nexport interface AbstractTrackModel {\n displays: AbstractDisplayModel[]\n configuration: AnyConfigurationModel\n}\n\nexport function isTrackModel(thing: unknown): thing is AbstractTrackModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'configuration' in thing &&\n // @ts-expect-error\n thing.configuration.trackId\n )\n}\n\nexport interface AbstractDisplayModel {\n id: string\n parentTrack: AbstractTrackModel\n renderDelay: number\n rendererType: any\n cannotBeRenderedReason?: string\n}\nexport function isDisplayModel(thing: unknown): thing is AbstractDisplayModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'configuration' in thing &&\n // @ts-expect-error\n thing.configuration.displayId\n )\n}\n\nexport interface TrackViewModel extends AbstractViewModel {\n showTrack(trackId: string): void\n hideTrack(trackId: string): void\n}\nexport function isTrackViewModel(thing: unknown): thing is TrackViewModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'showTrack' in thing &&\n 'hideTrack' in thing\n )\n}\n\n/** minimum interface for the root MST model of a JBrowse app */\nexport interface AbstractRootModel {\n jbrowse: IAnyStateTreeNode\n session?: AbstractSessionModel\n setDefaultSession?(): void\n adminMode?: boolean\n error?: unknown\n}\n\n/** root model with more included for the heavier JBrowse web and desktop app */\nexport interface AppRootModel extends AbstractRootModel {\n internetAccounts: BaseInternetAccountModel[]\n findAppropriateInternetAccount(\n location: UriLocation,\n ): BaseInternetAccountModel | undefined\n}\n\nexport function isAppRootModel(thing: unknown): thing is AppRootModel {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'findAppropriateInternetAccount' in thing\n )\n}\n\nexport interface RootModelWithInternetAccounts extends AbstractRootModel {\n internetAccounts: BaseInternetAccountModel[]\n findAppropriateInternetAccount(\n location: UriLocation,\n ): BaseInternetAccountModel | undefined\n}\n\nexport function isRootModelWithInternetAccounts(\n thing: unknown,\n): thing is RootModelWithInternetAccounts {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'internetAccounts' in thing &&\n 'findAppropriateInternetAccount' in thing\n )\n}\n\n/** a root model that manages global menus */\nexport interface AbstractMenuManager {\n appendMenu(menuName: string): void\n insertMenu(menuName: string, position: number): number\n insertInMenu(menuName: string, menuItem: MenuItem, position: number): number\n appendToMenu(menuName: string, menuItem: MenuItem): number\n appendToSubMenu(menuPath: string[], menuItem: MenuItem): number\n insertInSubMenu(\n menuPath: string[],\n menuItem: MenuItem,\n position: number,\n ): number\n}\nexport function isAbstractMenuManager(\n thing: unknown,\n): thing is AbstractMenuManager {\n return (\n typeof thing === 'object' &&\n thing !== null &&\n 'appendMenu' in thing &&\n 'appendToSubMenu' in thing\n )\n}\n\n// Empty interfaces required by mobx-state-tree\n// See https://mobx-state-tree.js.org/tips/typescript#using-a-mst-type-at-design-time\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface NoAssemblyRegion\n extends SnapshotIn<typeof MUNoAssemblyRegion> {}\n\n/**\n * a description of a specific genomic region. assemblyName, refName, start,\n * end, and reversed\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface Region extends SnapshotIn<typeof MUIRegion> {}\n\nexport interface AugmentedRegion extends Region {\n originalRefName?: string\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface LocalPathLocation\n extends SnapshotIn<typeof MULocalPathLocation> {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface UriLocation extends SnapshotIn<typeof MUUriLocation> {}\n\nexport function isUriLocation(location: unknown): location is UriLocation {\n return (\n typeof location === 'object' &&\n location !== null &&\n 'uri' in location &&\n !!location.uri\n )\n}\nexport function isLocalPathLocation(\n location: unknown,\n): location is LocalPathLocation {\n return (\n typeof location === 'object' &&\n location !== null &&\n 'localPath' in location &&\n !!location.localPath\n )\n}\n\nexport function isBlobLocation(location: unknown): location is BlobLocation {\n return (\n typeof location === 'object' &&\n location !== null &&\n 'blobId' in location &&\n !!location.blobId\n )\n}\nexport class AuthNeededError extends Error {\n constructor(\n public message: string,\n public url: string,\n ) {\n super(message)\n this.name = 'AuthNeededError'\n\n Object.setPrototypeOf(this, AuthNeededError.prototype)\n }\n}\n\nexport class RetryError extends Error {\n constructor(\n public message: string,\n public internetAccountId: string,\n ) {\n super(message)\n this.name = 'RetryError'\n }\n}\n\nexport function isAuthNeededException(\n exception: unknown,\n): exception is AuthNeededError {\n return (\n exception instanceof Error &&\n // DOMException\n (exception.name === 'AuthNeededError' ||\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n (exception as AuthNeededError).url !== undefined)\n )\n}\n\nexport function isRetryException(exception: Error): boolean {\n return (\n // DOMException\n exception.name === 'RetryError' ||\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n (exception as RetryError).internetAccountId !== undefined\n )\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface BlobLocation extends SnapshotIn<typeof MUBlobLocation> {}\n\nexport type FileLocation = LocalPathLocation | UriLocation | BlobLocation\n\n// These types are slightly different than the MST models representing a\n// location because a blob cannot be stored in a MST, so this is the\n// pre-processed file location\nexport interface PreUriLocation {\n uri: string\n}\nexport interface PreLocalPathLocation {\n localPath: string\n}\nexport interface PreBlobLocation {\n blob: File\n}\nexport type PreFileLocation =\n | PreUriLocation\n | PreLocalPathLocation\n | PreBlobLocation\n\nexport { default as TextSearchManager } from '../../TextSearch/TextSearchManager'\n","import { useState, useEffect, useRef } from 'react'\n\nexport default function useMeasure() {\n const ref = useRef<HTMLDivElement>(null)\n const [dims, setDims] = useState<{ width?: number; height?: number }>({\n width: undefined,\n height: undefined,\n })\n useEffect(() => {\n if (!ref.current) {\n return\n }\n const RS =\n typeof window !== 'undefined' && 'ResizeObserver' in window\n ? window.ResizeObserver\n : undefined\n\n if (!RS) {\n return\n }\n const observer = new RS(entries => {\n setDims({\n width: entries[0]!.contentRect.width,\n height: entries[0]!.contentRect.height,\n })\n })\n observer.observe(ref.current)\n\n // Callback fired when component is unmounted\n return () => {\n observer.disconnect()\n }\n }, [])\n\n return [ref, dims] as const\n}\n","import { when as mobxWhen, IWhenOptions } from 'mobx'\nimport { makeAbortError } from './aborting'\n\ninterface WhenOpts extends IWhenOptions {\n signal?: AbortSignal\n}\n\n/**\n * Wrapper for mobx `when` that adds timeout and aborting support.\n */\nexport function when(\n getter: () => boolean,\n { timeout, signal, name }: WhenOpts = {},\n) {\n return new Promise((resolve, reject) => {\n let finished = false\n\n const whenPromise = mobxWhen(getter)\n\n // set up timeout\n let timeoutId: ReturnType<typeof setTimeout> | undefined\n let finishTimeout = () => {}\n if (timeout) {\n timeoutId = setTimeout(() => {\n if (!finished) {\n finished = true\n whenPromise.cancel()\n reject(new Error(`timed out waiting for ${name || 'whenPresent'}`))\n }\n }, timeout)\n finishTimeout = () => {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n }\n\n // set up aborting\n if (signal) {\n signal.addEventListener('abort', () => {\n if (!finished) {\n finished = true\n\n // mobx when supports a cancel method\n whenPromise.cancel()\n finishTimeout()\n\n reject(makeAbortError())\n }\n })\n }\n\n whenPromise\n .then(() => {\n if (!finished) {\n finished = true\n finishTimeout()\n\n resolve(true)\n }\n })\n .catch((err: unknown) => {\n if (!finished) {\n finished = true\n finishTimeout()\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(err)\n }\n })\n })\n}\n\n/**\n * Wrapper for mobx `when` that makes a promise for the return value\n * of the given function at the point in time when it becomes not\n * undefined and not null.\n */\nexport async function whenPresent<FUNCTION extends () => unknown>(\n getter: FUNCTION,\n opts: WhenOpts = {},\n): Promise<NonNullable<ReturnType<FUNCTION>>> {\n await when(() => {\n const val = getter()\n return val !== undefined && val !== null\n }, opts)\n\n return getter() as NonNullable<ReturnType<FUNCTION>>\n}\n","import { revcom, Feature } from '@jbrowse/core/util'\nimport type { Buffer } from 'buffer'\nimport { getTagAlt } from '../util'\n\nexport interface Mismatch {\n qual?: number\n start: number\n length: number\n type: string\n base: string\n altbase?: string\n seq?: string\n cliplen?: number\n}\nconst mdRegex = new RegExp(/(\\d+|\\^[a-z]+|[a-z])/gi)\nconst modificationRegex = new RegExp(/([A-Z])([-+])([^,.?]+)([.?])?/)\nconst cigarRegex = new RegExp(/([MIDNSHPX=])/)\nconst startClip = new RegExp(/(\\d+)[SH]$/)\nconst endClip = new RegExp(/^(\\d+)([SH])/)\n\nexport function parseCigar(cigar = '') {\n return cigar.split(cigarRegex).slice(0, -1)\n}\n\nexport function cigarToMismatches(\n ops: string[],\n seq?: string,\n ref?: string,\n qual?: Buffer,\n) {\n let roffset = 0 // reference offset\n let soffset = 0 // seq offset\n const mismatches: Mismatch[] = []\n const hasRefAndSeq = ref && seq\n for (let i = 0; i < ops.length; i += 2) {\n const len = +ops[i]!\n const op = ops[i + 1]!\n\n if (op === 'M' || op === '=' || op === 'E') {\n if (hasRefAndSeq) {\n for (let j = 0; j < len; j++) {\n if (\n // @ts-ignore in the full yarn build of the repo, this says that object is possibly undefined for some reason, ignored\n seq[soffset + j].toUpperCase() !== ref[roffset + j].toUpperCase()\n ) {\n mismatches.push({\n start: roffset + j,\n type: 'mismatch',\n base: seq[soffset + j]!,\n altbase: ref[roffset + j]!,\n length: 1,\n })\n }\n }\n }\n soffset += len\n }\n if (op === 'I') {\n mismatches.push({\n start: roffset,\n type: 'insertion',\n base: `${len}`,\n length: 0,\n })\n soffset += len\n } else if (op === 'D') {\n mismatches.push({\n start: roffset,\n type: 'deletion',\n base: '*',\n length: len,\n })\n } else if (op === 'N') {\n mismatches.push({\n start: roffset,\n type: 'skip',\n base: 'N',\n length: len,\n })\n } else if (op === 'X') {\n const r = seq?.slice(soffset, soffset + len) || []\n const q = qual?.subarray(soffset, soffset + len) || []\n\n for (let j = 0; j < len; j++) {\n mismatches.push({\n start: roffset + j,\n type: 'mismatch',\n base: r[j]!,\n qual: q[j]!,\n length: 1,\n })\n }\n soffset += len\n } else if (op === 'H') {\n mismatches.push({\n start: roffset,\n type: 'hardclip',\n base: `H${len}`,\n cliplen: len,\n length: 1,\n })\n } else if (op === 'S') {\n mismatches.push({\n start: roffset,\n type: 'softclip',\n base: `S${len}`,\n cliplen: len,\n length: 1,\n })\n soffset += len\n }\n\n if (op !== 'I' && op !== 'S' && op !== 'H') {\n roffset += len\n }\n }\n return mismatches\n}\n\n/**\n * parse a SAM MD tag to find mismatching bases of the template versus the\n * reference @returns array of mismatches and their positions\n */\nexport function mdToMismatches(\n mdstring: string,\n ops: string[],\n cigarMismatches: Mismatch[],\n seq: string,\n qual?: Buffer,\n) {\n let curr: Mismatch = { start: 0, base: '', length: 0, type: 'mismatch' }\n let lastCigar = 0\n let lastTemplateOffset = 0\n let lastRefOffset = 0\n let lastSkipPos = 0\n const mismatchRecords: Mismatch[] = []\n const skips = cigarMismatches.filter(cigar => cigar.type === 'skip')\n\n // convert a position on the reference sequence to a position\n // on the template sequence, taking into account hard and soft\n // clipping of reads\n\n function nextRecord(): void {\n mismatchRecords.push(curr)\n\n // get a new mismatch record ready\n curr = {\n start: curr.start + curr.length,\n length: 0,\n base: '',\n type: 'mismatch',\n }\n }\n\n function getTemplateCoordLocal(refCoord: number): number {\n let templateOffset = lastTemplateOffset\n let refOffset = lastRefOffset\n for (\n let i = lastCigar;\n i < ops.length && refOffset <= refCoord;\n i += 2, lastCigar = i\n ) {\n const len = +ops[i]!\n const op = ops[i + 1]!\n\n if (op === 'S' || op === 'I') {\n templateOffset += len\n } else if (op === 'D' || op === 'P' || op === 'N') {\n refOffset += len\n } else if (op !== 'H') {\n templateOffset += len\n refOffset += len\n }\n }\n lastTemplateOffset = templateOffset\n lastRefOffset = refOffset\n\n return templateOffset - (refOffset - refCoord)\n }\n\n // now actually parse the MD string\n const md = mdstring.match(mdRegex) || []\n for (const token of md) {\n const num = +token\n if (!Number.isNaN(num)) {\n curr.start += num\n } else if (token.startsWith('^')) {\n curr.start += token.length - 1\n } else {\n // mismatch\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let j = 0; j < token.length; j += 1) {\n curr.length = 1\n\n while (lastSkipPos < skips.length) {\n const mismatch = skips[lastSkipPos]!\n if (curr.start >= mismatch.start) {\n curr.start += mismatch.length\n lastSkipPos++\n } else {\n break\n }\n }\n const s = getTemplateCoordLocal(curr.start)\n curr.base = seq[s] || 'X'\n curr.qual = qual?.[s]\n curr.altbase = token\n nextRecord()\n }\n }\n }\n return mismatchRecords\n}\n\nexport function getMismatches(\n cigar: string,\n md?: string,\n seq?: string,\n ref?: string,\n qual?: Buffer,\n) {\n let mismatches: Mismatch[] = []\n const ops = parseCigar(cigar)\n\n // parse the CIGAR tag if it has one\n if (cigar) {\n mismatches = mismatches.concat(cigarToMismatches(ops, seq, ref, qual))\n }\n\n // now let's look for CRAM or MD mismatches\n if (md && seq) {\n mismatches = mismatches.concat(\n mdToMismatches(md, ops, mismatches, seq, qual),\n )\n }\n\n return mismatches\n}\n// get relative reference sequence positions for positions given relative to\n// the read sequence\nexport function* getNextRefPos(cigarOps: string[], positions: number[]) {\n let readPos = 0\n let refPos = 0\n let currPos = 0\n\n for (let i = 0; i < cigarOps.length && currPos < positions.length; i += 2) {\n const len = +cigarOps[i]!\n const op = cigarOps[i + 1]!\n if (op === 'S' || op === 'I') {\n for (let i = 0; i < len && currPos < positions.length; i++) {\n if (positions[currPos] === readPos + i) {\n currPos++\n }\n }\n readPos += len\n } else if (op === 'D' || op === 'N') {\n refPos += len\n } else if (op === 'M' || op === 'X' || op === '=') {\n for (let i = 0; i < len && currPos < positions.length; i++) {\n if (positions[currPos] === readPos + i) {\n yield refPos + i\n currPos++\n }\n }\n readPos += len\n refPos += len\n }\n }\n}\n\nexport function getModificationProbabilities(feature: Feature) {\n const m = (getTagAlt(feature, 'ML', 'Ml') as number[] | string) || []\n return m\n ? (typeof m === 'string' ? m.split(',').map(e => +e) : m).map(e => e / 255)\n : (getTagAlt(feature, 'MP', 'Mp') as string | undefined)\n ?.split('')\n .map(s => s.charCodeAt(0) - 33)\n .map(elt => Math.min(1, elt / 50))\n}\n\nexport function getMethBins(feature: Feature) {\n const fstart = feature.get('start')\n const fend = feature.get('end')\n const fstrand = feature.get('strand') as -1 | 0 | 1\n const flen = fend - fstart\n const mm = (getTagAlt(feature, 'MM', 'Mm') as string | undefined) || ''\n const methBins = new Array<number>(flen)\n const methProbs = new Array<number>(flen)\n const seq = feature.get('seq') as string | undefined\n if (seq) {\n const ops = parseCigar(feature.get('CIGAR'))\n const probabilities = getModificationProbabilities(feature)\n const modifications = getModificationPositions(mm, seq, fstrand)\n let probIndex = 0\n for (const { type, positions } of modifications) {\n if (type === 'm') {\n for (const ref of getNextRefPos(ops, positions)) {\n const prob = probabilities?.[probIndex] || 0\n probIndex++\n if (ref >= 0 && ref < flen) {\n methBins[ref] = 1\n methProbs[ref] = prob\n }\n }\n }\n }\n }\n return { methBins, methProbs }\n}\n\nexport function getModificationPositions(\n mm: string,\n fseq: string,\n fstrand: number,\n) {\n const seq = fstrand === -1 ? revcom(fseq) : fseq\n const mods = mm.split(';').filter(mod => !!mod)\n const result = []\n for (const mod of mods) {\n const [basemod, ...skips] = mod.split(',')\n\n // regexes based on parse_mm.pl from hts-specs\n const matches = modificationRegex.exec(basemod!)\n if (!matches) {\n throw new Error('bad format for MM tag')\n }\n const [, base, strand, typestr] = matches\n\n // can be a multi e.g. C+mh for both meth (m) and hydroxymeth (h) so\n // split, and they can also be chemical codes (ChEBI) e.g. C+16061\n const types = typestr!.split(/(\\d+|.)/).filter(f => !!f)\n\n if (strand === '-') {\n console.warn('unsupported negative strand modifications')\n // make sure to return a somewhat matching type even in this case\n result.push({ type: 'unsupported', positions: [] as number[] })\n }\n\n // this logic also based on parse_mm.pl from hts-specs is that in the\n // sequence of the read, if we have a modification type e.g. C+m;2 and a\n // sequence ACGTACGTAC we skip the two instances of C and go to the last\n // C\n for (const type of types) {\n let i = 0\n const positions = []\n for (const d of skips) {\n let delta = +d\n do {\n if (base === 'N' || base === seq[i]) {\n delta--\n }\n i++\n } while (delta >= 0 && i < seq.length)\n\n const temp = i - 1\n positions.push(fstrand === -1 ? seq.length - 1 - temp : temp)\n }\n if (fstrand === -1) {\n positions.sort((a, b) => a - b)\n }\n result.push({\n type,\n positions,\n })\n }\n }\n return result\n}\n\nexport function getModificationTypes(mm: string) {\n return mm\n .split(';')\n .filter(mod => !!mod)\n .flatMap(mod => {\n const basemod = mod.split(',')[0]!\n\n const matches = modificationRegex.exec(basemod)\n if (!matches) {\n throw new Error(`bad format for MM tag: ${mm}`)\n }\n const typestr = matches[3]!\n\n // can be a multi e.g. C+mh for both meth (m) and hydroxymeth (h) so\n // split, and they can also be chemical codes (ChEBI) e.g. C+16061\n return typestr.split(/(\\d+|.)/).filter(f => !!f)\n })\n}\n\nexport function getOrientedCigar(flip: boolean, cigar: string[]) {\n if (flip) {\n const ret = []\n for (let i = 0; i < cigar.length; i += 2) {\n const len = cigar[i]!\n let op = cigar[i + 1]!\n if (op === 'D') {\n op = 'I'\n } else if (op === 'I') {\n op = 'D'\n }\n ret.push(len, op)\n }\n return ret\n }\n return cigar\n}\n\nexport function getOrientedMismatches(flip: boolean, cigar: string) {\n const p = parseCigar(cigar)\n return cigarToMismatches(flip ? getOrientedCigar(flip, p) : p)\n}\n\nexport function getLengthOnRef(cigar: string) {\n const cigarOps = parseCigar(cigar)\n let lengthOnRef = 0\n for (let i = 0; i < cigarOps.length; i += 2) {\n const len = +cigarOps[i]!\n const op = cigarOps[i + 1]\n if (op !== 'H' && op !== 'S' && op !== 'I') {\n lengthOnRef += len\n }\n }\n return lengthOnRef\n}\n\nexport function getLength(cigar: string) {\n const cigarOps = parseCigar(cigar)\n let length = 0\n for (let i = 0; i < cigarOps.length; i += 2) {\n const len = +cigarOps[i]!\n const op = cigarOps[i + 1]\n if (op !== 'D' && op !== 'N') {\n length += len\n }\n }\n return length\n}\n\nexport function getLengthSansClipping(cigar: string) {\n const cigarOps = parseCigar(cigar)\n let length = 0\n for (let i = 0; i < cigarOps.length; i += 2) {\n const len = +cigarOps[i]!\n const op = cigarOps[i + 1]\n if (op !== 'H' && op !== 'S' && op !== 'D' && op !== 'N') {\n length += len\n }\n }\n return length\n}\n\nexport function getClip(cigar: string, strand: number) {\n return strand === -1\n ? +(startClip.exec(cigar) || [])[1]! || 0\n : +(endClip.exec(cigar) || [])[1]! || 0\n}\n\nexport function getTag(f: Feature, tag: string) {\n const tags = f.get('tags')\n return tags ? tags[tag] : f.get(tag)\n}\n\n// produces a list of \"feature-like\" object from parsing supplementary\n// alignments in the SA tag\n//\n// @param normalize - used specifically in the linear-read-vs-ref context, it\n// flips features around relative to the original feature. other contexts of\n// usage can keep this false\nexport function featurizeSA(\n SA: string | undefined,\n id: string,\n strand: number,\n readName: string,\n normalize?: boolean,\n) {\n return (\n SA?.split(';')\n .filter(aln => !!aln)\n .map((aln, index) => {\n const ret = aln.split(',')\n const saRef = ret[0]!\n const saStart = ret[1]!\n const saStrand = ret[2]!\n const saCigar = ret[3]!\n const saLengthOnRef = getLengthOnRef(saCigar)\n const saLength = getLength(saCigar)\n const saLengthSansClipping = getLengthSansClipping(saCigar)\n const saStrandNormalized = saStrand === '-' ? -1 : 1\n const saClipPos = getClip(\n saCigar,\n (normalize ? strand : 1) * saStrandNormalized,\n )\n const saRealStart = +saStart - 1\n return {\n refName: saRef,\n start: saRealStart,\n end: saRealStart + saLengthOnRef,\n seqLength: saLength,\n clipPos: saClipPos,\n CIGAR: saCigar,\n strand: (normalize ? strand : 1) * saStrandNormalized,\n uniqueId: `${id}_SA${index}`,\n mate: {\n start: saClipPos,\n end: saClipPos + saLengthSansClipping,\n refName: readName,\n },\n }\n }) || []\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config CramAdapter\n * used to configure CRAM adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'CramAdapter',\n {\n /**\n * #slot fetchSizeLimit\n */\n fetchSizeLimit: {\n type: 'number',\n description:\n 'size in bytes over which to display a warning to the user that too much data will be fetched',\n defaultValue: 3_000_000,\n },\n\n /**\n * #slot cramLocation\n */\n cramLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.cram',\n locationType: 'UriLocation',\n },\n },\n\n /**\n * #slot craiLocation\n */\n craiLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.cram.crai',\n locationType: 'UriLocation',\n },\n },\n\n /**\n * #slot sequenceAdapter\n * generally refers to the reference genome assembly's sequence adapter\n * currently needs to be manually added\n */\n sequenceAdapter: {\n type: 'frozen',\n description: 'sequence data adapter',\n defaultValue: null,\n },\n },\n { explicitlyTyped: true },\n)\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\n// locals\nimport configSchema from './configSchema'\n\nexport default function CramAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(() => {\n return new AdapterType({\n name: 'CramAdapter',\n displayName: 'CRAM adapter',\n configSchema,\n getAdapterClass: () => import('./CramAdapter').then(r => r.default),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config BamAdapter\n * used to configure BAM adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'BamAdapter',\n {\n /**\n * #slot\n */\n bamLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.bam', locationType: 'UriLocation' },\n },\n\n index: ConfigurationSchema('BamIndex', {\n /**\n * #slot index.indexType\n */\n indexType: {\n model: types.enumeration('IndexType', ['BAI', 'CSI']),\n type: 'stringEnum',\n defaultValue: 'BAI',\n },\n /**\n * #slot index.location\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.bam.bai',\n locationType: 'UriLocation',\n },\n },\n }),\n /**\n * #slot\n */\n fetchSizeLimit: {\n type: 'number',\n description:\n 'size to fetch in bytes over which to display a warning to the user that too much data will be fetched',\n defaultValue: 5_000_000,\n },\n /**\n * #slot\n * generally refers to the reference genome assembly's sequence adapter\n * currently needs to be manually added\n */\n sequenceAdapter: {\n type: 'frozen',\n description:\n 'sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags',\n defaultValue: null,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function BamAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(() => {\n return new AdapterType({\n name: 'BamAdapter',\n displayName: 'BAM adapter',\n configSchema,\n getAdapterClass: () => import('./BamAdapter').then(r => r.default),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n/**\n * #config HtsgetBamAdapter\n * Used to fetch data from Htsget endpoints in BAM format, using the gmod/bam library\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst HtsgetBamAdapter = ConfigurationSchema(\n 'HtsgetBamAdapter',\n {\n /**\n * #slot\n */\n htsgetBase: {\n type: 'string',\n description: 'the base URL to fetch from',\n defaultValue: '',\n },\n /**\n * #slot\n */\n htsgetTrackId: {\n type: 'string',\n description: 'the trackId, which is appended to the base URL',\n defaultValue: '',\n },\n /**\n * #slot\n */\n sequenceAdapter: {\n type: 'frozen',\n description:\n 'sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags',\n defaultValue: null,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default HtsgetBamAdapter\n","import configSchema from './configSchema'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nexport default function HtsgetBamAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(() => {\n return new AdapterType({\n name: 'HtsgetBamAdapter',\n displayName: 'Htsget BAM adapter',\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n configSchema,\n getAdapterClass: () => import('./HtsgetBamAdapter').then(r => r.default),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config SNPCoverageAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'SNPCoverageAdapter',\n {\n /**\n * #slot\n * normally refers to a BAM or CRAM adapter\n */\n subadapter: {\n type: 'frozen',\n defaultValue: null,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function SNPCoverageAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(() => {\n return new AdapterType({\n name: 'SNPCoverageAdapter',\n displayName: 'SNPCoverage adapter',\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./SNPCoverageAdapter').then(r => r.default),\n configSchema,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config SNPCoverageRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst SNPCoverageRenderer = ConfigurationSchema(\n 'SNPCoverageRenderer',\n {\n /**\n * #slot\n */\n clipColor: {\n type: 'color',\n description: 'the color of the clipping marker',\n defaultValue: 'red',\n },\n /**\n * #slot\n */\n indicatorThreshold: {\n type: 'number',\n description:\n 'the proportion of reads containing a insertion/clip indicator',\n defaultValue: 0.4,\n },\n /**\n * #slot\n */\n drawArcs: {\n type: 'boolean',\n description: 'Draw sashimi-style arcs for intron features',\n defaultValue: true,\n },\n /**\n * #slot\n */\n drawInterbaseCounts: {\n type: 'boolean',\n description:\n 'draw count \"upsidedown histogram\" of the interbase events that don\\'t contribute to the coverage count so are not drawn in the normal histogram',\n defaultValue: true,\n },\n /**\n * #slot\n */\n drawIndicators: {\n type: 'boolean',\n description:\n 'draw a triangular indicator where an event has been detected',\n defaultValue: true,\n },\n\n color: {\n type: 'color',\n description: 'Background color for the SNPCoverage renderer',\n defaultValue: '#d3d3d3',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default SNPCoverageRenderer\n","import { createJBrowseTheme } from '@jbrowse/core/ui'\nimport { featureSpanPx, bpSpanPx, Feature } from '@jbrowse/core/util'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { RenderArgsDeserialized as FeatureRenderArgsDeserialized } from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType'\nimport {\n getOrigin,\n getScale,\n ScaleOpts,\n WiggleBaseRenderer,\n YSCALEBAR_LABEL_OFFSET,\n} from '@jbrowse/plugin-wiggle'\n\nexport interface RenderArgsDeserialized extends FeatureRenderArgsDeserialized {\n bpPerPx: number\n height: number\n highResolutionScaling: number\n scaleOpts: ScaleOpts\n}\n\nexport interface RenderArgsDeserializedWithFeatures\n extends RenderArgsDeserialized {\n features: Map<string, Feature>\n ticks: { values: number[] }\n displayCrossHatches: boolean\n modificationTagMap?: Record<string, string>\n}\n\ntype Counts = Record<string, { total: number; strands: Record<string, number> }>\n\ninterface SNPInfo {\n cov: Counts\n noncov: Counts\n total: number\n}\n\nconst fudgeFactor = 0.6\n\nexport default class SNPCoverageRenderer extends WiggleBaseRenderer {\n // note: the snps are drawn on linear scale even if the data is drawn in log\n // scape hence the two different scales being used\n async draw(\n ctx: CanvasRenderingContext2D,\n props: RenderArgsDeserializedWithFeatures,\n ) {\n const {\n features,\n regions,\n bpPerPx,\n displayCrossHatches,\n modificationTagMap = {},\n scaleOpts,\n height: unadjustedHeight,\n theme: configTheme,\n config: cfg,\n ticks,\n } = props\n const theme = createJBrowseTheme(configTheme)\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n\n // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the\n // wiggle display, and makes the height of the actual drawn area add\n // \"padding\" to the top and bottom of the display\n const offset = YSCALEBAR_LABEL_OFFSET\n const height = unadjustedHeight - offset * 2\n\n const opts = { ...scaleOpts, range: [0, height] }\n const viewScale = getScale(opts)\n\n // clipping and insertion indicators, uses a smaller height/2 scale\n const indicatorViewScale = getScale({\n ...opts,\n range: [0, height / 2],\n scaleType: 'linear',\n })\n const originY = getOrigin(scaleOpts.scaleType)\n const originLinear = getOrigin('linear')\n\n const indicatorThreshold = readConfObject(cfg, 'indicatorThreshold')\n const drawInterbaseCounts = readConfObject(cfg, 'drawInterbaseCounts')\n const drawArcs = readConfObject(cfg, 'drawArcs')\n const drawIndicators = readConfObject(cfg, 'drawIndicators')\n\n // get the y coordinate that we are plotting at, this can be log scale\n const toY = (n: number) => height - (viewScale(n) || 0) + offset\n const toHeight = (n: number) => toY(originY) - toY(n)\n // used specifically for indicator\n const toY2 = (n: number) => height - (indicatorViewScale(n) || 0) + offset\n const toHeight2 = (n: number) => toY2(originLinear) - toY2(n)\n\n const { bases } = theme.palette\n const colorForBase: Record<string, string> = {\n A: bases.A.main,\n C: bases.C.main,\n G: bases.G.main,\n T: bases.T.main,\n insertion: 'purple',\n softclip: 'blue',\n hardclip: 'red',\n total: readConfObject(cfg, 'color'),\n meth: 'red',\n unmeth: 'blue',\n }\n\n const feats = [...features.values()]\n const coverage = feats.filter(f => f.get('type') !== 'skip')\n const skips = feats.filter(f => f.get('type') === 'skip')\n\n // Use two pass rendering, which helps in visualizing the SNPs at higher\n // bpPerPx First pass: draw the gray background\n ctx.fillStyle = colorForBase.total!\n for (const feature of coverage) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n const w = rightPx - leftPx + fudgeFactor\n const score = feature.get('score') as number\n ctx.fillRect(leftPx, toY(score), w, toHeight(score))\n }\n\n // Keep track of previous total which we will use it to draw the interbase\n // indicator (if there is a sudden clip, there will be no read coverage but\n // there will be \"clip\" coverage) at that position beyond the read. if the\n // clip is right at a block boundary then prevTotal will not be available,\n // so this is a best attempt to plot interbase indicator at the \"cliffs\"\n let prevTotal = 0\n\n // extraHorizontallyFlippedOffset is used to draw interbase items, which\n // are located to the left when forward and right when reversed\n const extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx : 0\n\n // Second pass: draw the SNP data, and add a minimum feature width of 1px\n // which can be wider than the actual bpPerPx This reduces overdrawing of\n // the grey background over the SNPs\n\n for (const feature of coverage) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n\n const score = feature.get('score') as number\n const snpinfo = feature.get('snpinfo') as SNPInfo\n const w = Math.max(rightPx - leftPx, 1)\n const totalScore = snpinfo.total\n const keys = Object.keys(snpinfo.cov).sort()\n\n let curr = 0\n for (const base of keys) {\n const { total } = snpinfo.cov[base]!\n ctx.fillStyle =\n colorForBase[base] ||\n modificationTagMap[base.replace('mod_', '')] ||\n 'black'\n\n const height = toHeight(score)\n const bottom = toY(score) + height\n ctx.fillRect(\n Math.round(leftPx),\n bottom - ((total + curr) / score) * height,\n w,\n (total / score) * height,\n )\n curr += total\n }\n\n const interbaseEvents = Object.keys(snpinfo.noncov)\n const indicatorHeight = 4.5\n if (drawInterbaseCounts) {\n let curr = 0\n for (const base of interbaseEvents) {\n const { total } = snpinfo.noncov[base]!\n const r = 0.6\n ctx.fillStyle = colorForBase[base]!\n ctx.fillRect(\n leftPx - r + extraHorizontallyFlippedOffset,\n indicatorHeight + toHeight2(curr),\n r * 2,\n toHeight2(total),\n )\n curr += total\n }\n }\n\n if (drawIndicators) {\n let accum = 0\n let max = 0\n let maxBase = ''\n for (const base of interbaseEvents) {\n const { total } = snpinfo.noncov[base]!\n accum += total\n if (total > max) {\n max = total\n maxBase = base\n }\n }\n\n // avoid drawing a bunch of indicators if coverage is very low e.g.\n // less than 7, uses the prev total in the case of the \"cliff\"\n const indicatorComparatorScore = Math.max(totalScore, prevTotal)\n if (\n accum > indicatorComparatorScore * indicatorThreshold &&\n indicatorComparatorScore > 7\n ) {\n ctx.fillStyle = colorForBase[maxBase]!\n ctx.beginPath()\n const l = leftPx + extraHorizontallyFlippedOffset\n ctx.moveTo(l - 3.5, 0)\n ctx.lineTo(l + 3.5, 0)\n ctx.lineTo(l, indicatorHeight)\n ctx.fill()\n }\n }\n prevTotal = totalScore\n }\n\n if (drawArcs) {\n for (const f of skips) {\n const [left, right] = bpSpanPx(\n f.get('start'),\n f.get('end'),\n region,\n bpPerPx,\n )\n\n ctx.beginPath()\n const str = f.get('strand') as number\n const xs = f.get('xs') as string\n const pos = 'rgba(255,200,200,0.7)'\n const neg = 'rgba(200,200,255,0.7)'\n const neutral = 'rgba(200,200,200,0.7)'\n\n if (xs === '+') {\n ctx.strokeStyle = pos\n } else if (xs === '-') {\n ctx.strokeStyle = neg\n } else if (str === 1) {\n ctx.strokeStyle = pos\n } else if (str === -1) {\n ctx.strokeStyle = neg\n } else {\n ctx.strokeStyle = neutral\n }\n\n ctx.lineWidth = Math.log(f.get('score') + 1)\n ctx.moveTo(left, height - offset * 2)\n ctx.bezierCurveTo(left, 0, right, 0, right, height - offset * 2)\n ctx.stroke()\n }\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1\n ctx.strokeStyle = 'rgba(140,140,140,0.8)'\n ticks.values.forEach(tick => {\n ctx.beginPath()\n ctx.moveTo(0, Math.round(toY(tick)))\n ctx.lineTo(width, Math.round(toY(tick)))\n ctx.stroke()\n })\n }\n return undefined\n }\n}\n","import configSchema from './configSchema'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport SNPCoverageRenderer from './SNPCoverageRenderer'\n\nimport { WiggleRendering } from '@jbrowse/plugin-wiggle'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new SNPCoverageRenderer({\n name: 'SNPCoverageRenderer',\n ReactComponent: WiggleRendering,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import deepEqual from 'fast-deep-equal'\nimport { LayoutSession } from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\nimport GranularRectLayout from '@jbrowse/core/util/layouts/GranularRectLayout'\nimport MultiLayout from '@jbrowse/core/util/layouts/MultiLayout'\nimport { readConfObject } from '@jbrowse/core/configuration'\n\nexport interface PileupLayoutSessionProps {\n config: AnyConfigurationModel\n bpPerPx: number\n filters: SerializableFilterChain\n filterBy: unknown\n sortedBy: unknown\n showSoftClip: unknown\n}\n\ntype MyMultiLayout = MultiLayout<GranularRectLayout<unknown>, unknown>\ninterface CachedPileupLayout {\n layout: MyMultiLayout\n config: AnyConfigurationModel\n filters?: SerializableFilterChain\n filterBy: unknown\n sortedBy: unknown\n showSoftClip: boolean\n}\n\n// The pileup layout session adds\n// - sorting and revealing soft clip changes the layout of pileup renderer\n// - extra conditions to see if cached layout is valid\nexport class PileupLayoutSession extends LayoutSession {\n sortedBy: unknown\n filterBy: unknown\n\n showSoftClip = false\n\n constructor(args: PileupLayoutSessionProps) {\n super(args)\n this.config = args.config\n }\n\n cachedLayoutIsValid(cachedLayout: CachedPileupLayout) {\n return (\n super.cachedLayoutIsValid(cachedLayout) &&\n this.showSoftClip === cachedLayout.showSoftClip &&\n deepEqual(this.sortedBy, cachedLayout.sortedBy) &&\n deepEqual(this.filterBy, cachedLayout.filterBy)\n )\n }\n\n cachedLayout: CachedPileupLayout | undefined\n\n get layout(): MyMultiLayout {\n if (!this.cachedLayout || !this.cachedLayoutIsValid(this.cachedLayout)) {\n this.cachedLayout = {\n layout: this.makeLayout(),\n config: readConfObject(this.config),\n filters: this.filters,\n filterBy: this.filterBy,\n sortedBy: this.sortedBy,\n showSoftClip: this.showSoftClip,\n }\n }\n return this.cachedLayout.layout\n }\n}\n","import BoxRendererType, {\n RenderArgsDeserialized as BoxRenderArgsDeserialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'\nimport {\n Feature,\n Region,\n notEmpty,\n renderToAbstractCanvas,\n} from '@jbrowse/core/util'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { BaseLayout } from '@jbrowse/core/util/layouts/BaseLayout'\nimport { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport {\n PileupLayoutSession,\n PileupLayoutSessionProps,\n} from './PileupLayoutSession'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\n\n// locals\nimport { fetchSequence, shouldFetchReferenceSequence } from '../util'\nimport { layoutFeats } from './layoutFeatures'\n\nexport interface RenderArgsDeserialized extends BoxRenderArgsDeserialized {\n colorBy?: { type: string; tag?: string }\n colorTagMap?: Record<string, string>\n modificationTagMap?: Record<string, string>\n sortedBy?: {\n type: string\n pos: number\n refName: string\n assemblyName: string\n tag?: string\n }\n showSoftClip: boolean\n highResolutionScaling: number\n}\n\nexport interface RenderArgsDeserializedWithFeaturesAndLayout\n extends RenderArgsDeserialized {\n features: Map<string, Feature>\n layout: BaseLayout<Feature>\n regionSequence?: string\n}\n\nexport default class PileupRenderer extends BoxRendererType {\n supportsSVG = true\n\n async fetchSequence(renderProps: RenderArgsDeserialized) {\n const { sessionId, regions, adapterConfig } = renderProps\n const { sequenceAdapter } = adapterConfig\n if (!sequenceAdapter) {\n return undefined\n }\n const pm = this.pluginManager\n const { dataAdapter } = await getAdapter(pm, sessionId, sequenceAdapter)\n const region = regions[0]!\n return fetchSequence(region, dataAdapter as BaseFeatureDataAdapter)\n }\n\n getExpandedRegion(region: Region, renderArgs: RenderArgsDeserialized) {\n const { config, showSoftClip } = renderArgs\n const { start, end } = region\n const maxClippingSize = readConfObject(config, 'maxClippingSize')\n const bpExpansion = showSoftClip ? Math.round(maxClippingSize) : 0\n\n return {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n ...(region as Omit<typeof region, symbol>),\n start: Math.floor(Math.max(start - bpExpansion, 0)),\n end: Math.ceil(end + bpExpansion),\n }\n }\n\n async render(renderProps: RenderArgsDeserialized) {\n const features = await this.getFeatures(renderProps)\n const layout = this.createLayoutInWorker(renderProps)\n const { regions, bpPerPx } = renderProps\n const region = regions[0]!\n\n const layoutRecords = layoutFeats({\n ...renderProps,\n features,\n layout,\n })\n\n // only need reference sequence if there are features and only for some\n // cases\n const regionSequence =\n features.size && shouldFetchReferenceSequence(renderProps.colorBy?.type)\n ? await this.fetchSequence(renderProps)\n : undefined\n const width = (region.end - region.start) / bpPerPx\n const height = Math.max(layout.getTotalHeight(), 1)\n\n const { makeImageData } = await import('./makeImageData')\n const res = await renderToAbstractCanvas(\n width,\n height,\n renderProps,\n ctx => {\n makeImageData({\n ctx,\n layoutRecords: layoutRecords.filter(notEmpty),\n canvasWidth: width,\n renderArgs: {\n ...renderProps,\n layout,\n features,\n regionSequence,\n },\n })\n return undefined\n },\n )\n\n const results = await super.render({\n ...renderProps,\n ...res,\n features,\n layout,\n height,\n width,\n })\n\n return {\n ...results,\n ...res,\n features: new Map(),\n layout,\n height,\n width,\n maxHeightReached: layout.maxHeightReached,\n }\n }\n\n createSession(args: PileupLayoutSessionProps) {\n return new PileupLayoutSession(args)\n }\n}\n\nexport {\n type RenderArgs,\n type RenderResults,\n type RenderArgsSerialized,\n type ResultsSerialized,\n type ResultsDeserialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'\n","import { readConfObject } from '@jbrowse/core/configuration'\nimport { iterMap } from '@jbrowse/core/util'\n\n// locals\nimport { layoutFeature } from './layoutFeature'\nimport { RenderArgsDeserializedWithFeaturesAndLayout } from './PileupRenderer'\nimport { sortFeature } from './sortUtil'\n\n// layout determines the height of the canvas that we use to render\nexport function layoutFeats(\n props: RenderArgsDeserializedWithFeaturesAndLayout,\n) {\n const { layout, features, sortedBy, config, bpPerPx, showSoftClip, regions } =\n props\n const region = regions[0]!\n const featureMap =\n sortedBy?.type && region.start === sortedBy.pos\n ? sortFeature(features, sortedBy)\n : features\n\n const heightPx = readConfObject(config, 'height')\n const displayMode = readConfObject(config, 'displayMode')\n return iterMap(\n featureMap.values(),\n feature =>\n layoutFeature({\n feature,\n layout,\n bpPerPx,\n region,\n showSoftClip,\n heightPx,\n displayMode,\n }),\n featureMap.size,\n )\n}\n","import { doesIntersect2, Feature } from '@jbrowse/core/util'\nimport { Mismatch } from '../MismatchParser'\n\ninterface SortObject {\n pos: number\n type: string\n tag?: string\n}\nexport const sortFeature = (\n features: Map<string, Feature>,\n sortedBy: SortObject,\n) => {\n const featureArray = Array.from(features.values())\n const featuresInCenterLine: Feature[] = []\n const featuresOutsideCenter: Feature[] = []\n const { pos, type } = sortedBy\n\n // only sort on features that intersect center line, append those outside post-sort\n featureArray.forEach(innerArray => {\n const feature = innerArray\n const start = feature.get('start')\n const end = feature.get('end')\n if (doesIntersect2(pos - 1, pos, start, end)) {\n featuresInCenterLine.push(innerArray)\n } else {\n featuresOutsideCenter.push(innerArray)\n }\n })\n\n const isCram = featureArray.length ? featureArray[0]!.get('tags') : false\n switch (type) {\n case 'Start location': {\n featuresInCenterLine.sort((a, b) => a.get('start') - b.get('start'))\n break\n }\n\n case 'tag': {\n const tag = sortedBy.tag!\n const getTag = (f: Feature, t: string) => {\n return isCram ? f.get('tags')[t] : f.get(t)\n }\n const isString =\n featuresInCenterLine[0] &&\n typeof getTag(featuresInCenterLine[0], tag) === 'string'\n if (isString) {\n featuresInCenterLine.sort((a, b) =>\n getTag(b, tag).localeCompare(getTag(a, tag)),\n )\n } else {\n featuresInCenterLine.sort(\n (a, b) => (getTag(b, tag) || 0) - (getTag(a, tag) || 0),\n )\n }\n break\n }\n\n // first sort all mismatches, then all reference bases at the end\n case 'Base pair': {\n const baseSortArray: [string, Mismatch][] = []\n featuresInCenterLine.forEach(feature => {\n const mismatches: Mismatch[] = feature.get('mismatches')\n mismatches.forEach(mismatch => {\n const start = feature.get('start')\n const offset = start + mismatch.start + 1\n const consuming =\n mismatch.type === 'insertion' || mismatch.type === 'softclip'\n const len = consuming ? 0 : mismatch.length\n if (pos >= offset && pos < offset + len) {\n baseSortArray.push([feature.id(), mismatch])\n }\n })\n })\n\n const baseMap = new Map(baseSortArray)\n featuresInCenterLine.sort((a, b) => {\n const aMismatch = baseMap.get(a.id())\n const bMismatch = baseMap.get(b.id())\n const acode = bMismatch?.base.toUpperCase()\n const bcode = aMismatch?.base.toUpperCase()\n if (acode === bcode && acode === '*') {\n // @ts-expect-error\n return aMismatch.length - bMismatch.length\n }\n return (\n (acode ? acode.charCodeAt(0) : 0) - (bcode ? bcode.charCodeAt(0) : 0)\n )\n })\n\n break\n }\n\n // sorts positive strands then negative strands\n case 'Read strand': {\n featuresInCenterLine.sort((a, b) =>\n a.get('strand') <= b.get('strand') ? 1 : -1,\n )\n break\n }\n }\n\n return new Map(\n [...featuresInCenterLine, ...featuresOutsideCenter].map(feature => [\n feature.id(),\n feature,\n ]),\n )\n}\n","import { bpSpanPx, Feature, Region } from '@jbrowse/core/util'\nimport { BaseLayout } from '@jbrowse/core/util/layouts'\n// locals\nimport { Mismatch } from '../MismatchParser'\n\nexport interface LayoutRecord {\n feature: Feature\n leftPx: number\n rightPx: number\n topPx: number\n heightPx: number\n}\n\nexport function layoutFeature({\n feature,\n layout,\n bpPerPx,\n region,\n showSoftClip,\n heightPx,\n displayMode,\n}: {\n feature: Feature\n layout: BaseLayout<Feature>\n bpPerPx: number\n region: Region\n showSoftClip?: boolean\n heightPx: number\n displayMode: string\n}): LayoutRecord | null {\n let expansionBefore = 0\n let expansionAfter = 0\n\n // Expand the start and end of feature when softclipping enabled\n if (showSoftClip) {\n const mismatches = feature.get('mismatches') as Mismatch[]\n const seq = feature.get('seq') as string\n if (seq) {\n for (const { type, start, cliplen = 0 } of mismatches) {\n if (type === 'softclip') {\n if (start === 0) {\n expansionBefore = cliplen\n } else {\n expansionAfter = cliplen\n }\n }\n }\n }\n }\n\n const [leftPx, rightPx] = bpSpanPx(\n feature.get('start') - expansionBefore,\n feature.get('end') + expansionAfter,\n region,\n bpPerPx,\n )\n\n if (displayMode === 'compact') {\n heightPx /= 3\n }\n if (feature.get('refName') !== region.refName) {\n throw new Error(\n `feature ${feature.id()} is not on the current region's reference sequence ${\n region.refName\n }`,\n )\n }\n const topPx = layout.addRect(\n feature.id(),\n feature.get('start') - expansionBefore,\n feature.get('end') + expansionAfter,\n heightPx,\n feature,\n )\n if (topPx === null) {\n return null\n }\n\n return {\n feature,\n leftPx,\n rightPx,\n topPx: displayMode === 'collapse' ? 0 : topPx,\n heightPx,\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config PileupRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst PileupRenderer = ConfigurationSchema(\n 'PileupRenderer',\n {\n /**\n * #slot\n * default magenta here is used to detect the user has not customized this\n */\n color: {\n type: 'color',\n description: 'the color of each feature in a pileup alignment',\n defaultValue: '#f0f',\n contextVariable: ['feature'],\n },\n\n /**\n * #slot\n */\n orientationType: {\n type: 'stringEnum',\n model: types.enumeration('orientationType', ['fr', 'rf', 'ff']),\n defaultValue: 'fr',\n description:\n 'read sequencer orientation. fr is normal \"reads pointing at each other ---> <--- while some other sequencers can use other options',\n },\n /**\n * #slot\n */\n displayMode: {\n type: 'stringEnum',\n model: types.enumeration('displayMode', [\n 'normal',\n 'compact',\n 'collapse',\n ]),\n description: 'Alternative display modes',\n defaultValue: 'normal',\n },\n /**\n * #slot\n */\n minSubfeatureWidth: {\n type: 'number',\n description:\n 'the minimum width in px for a pileup mismatch feature. use for increasing/decreasing mismatch marker widths when zoomed out, e.g. 0 or 1',\n defaultValue: 1,\n },\n /**\n * #slot\n */\n maxHeight: {\n type: 'integer',\n description: 'the maximum height to be used in a pileup rendering',\n defaultValue: 1200,\n },\n /**\n * #slot\n */\n maxClippingSize: {\n type: 'integer',\n description: 'the max clip size to be used in a pileup rendering',\n defaultValue: 10000,\n },\n /**\n * #slot\n */\n height: {\n type: 'number',\n description: 'the height of each feature in a pileup alignment',\n defaultValue: 7,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n noSpacing: {\n type: 'boolean',\n description: 'remove spacing between features',\n defaultValue: false,\n },\n /**\n * #slot\n */\n largeInsertionIndicatorScale: {\n type: 'number',\n description:\n 'scale at which to draw the large insertion indicators (bp/pixel)',\n defaultValue: 10,\n },\n /**\n * #slot\n */\n mismatchAlpha: {\n type: 'boolean',\n defaultValue: false,\n description: 'Fade low quality mismatches',\n },\n },\n { explicitlyTyped: true },\n)\nexport default PileupRenderer\n","import React, { useRef, useState, useEffect } from 'react'\nimport { Region } from '@jbrowse/core/util/types'\nimport { PrerenderedCanvas } from '@jbrowse/core/ui'\nimport { bpSpanPx } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\nimport type { BaseLinearDisplayModel } from '@jbrowse/plugin-linear-genome-view'\n\nconst PileupRendering = observer(function (props: {\n blockKey: string\n displayModel?: BaseLinearDisplayModel\n width: number\n height: number\n regions: Region[]\n bpPerPx: number\n sortedBy?: {\n type: string\n pos: number\n refName: string\n }\n colorBy?: {\n type: string\n tag?: string\n }\n filterBy?: {\n tagFilter?: { tag: string }\n }\n onMouseMove?: (event: React.MouseEvent, featureId?: string) => void\n}) {\n const {\n onMouseMove,\n blockKey,\n displayModel,\n width,\n height,\n regions,\n bpPerPx,\n sortedBy,\n colorBy,\n filterBy,\n } = props\n const { selectedFeatureId, featureIdUnderMouse, contextMenuFeature } =\n displayModel || {}\n const [firstRender, setFirstRender] = useState(false)\n useEffect(() => {\n setFirstRender(true)\n }, [])\n\n const region = regions[0]!\n const ref = useRef<HTMLDivElement>(null)\n const [mouseIsDown, setMouseIsDown] = useState(false)\n const [movedDuringLastMouseDown, setMovedDuringLastMouseDown] =\n useState(false)\n const selectedRect = selectedFeatureId\n ? displayModel?.getFeatureByID(blockKey, selectedFeatureId)\n : undefined\n\n const highlightedFeature = featureIdUnderMouse || contextMenuFeature?.id()\n const highlightedRect = highlightedFeature\n ? displayModel?.getFeatureByID(blockKey, highlightedFeature)\n : undefined\n\n function makeRect(r: [number, number, number, number], offset = 2) {\n const [leftBp, topPx, rightBp, bottomPx] = r\n const [leftPx, rightPx] = bpSpanPx(leftBp, rightBp, region, bpPerPx)\n const rectTop = Math.round(topPx)\n const rectHeight = Math.round(bottomPx - topPx)\n return {\n left: leftPx - offset,\n top: rectTop - offset,\n width: rightPx - leftPx,\n height: rectHeight,\n }\n }\n const selected = selectedRect ? makeRect(selectedRect) : undefined\n const highlight = highlightedRect ? makeRect(highlightedRect, 0) : undefined\n\n function onMouseDown(event: React.MouseEvent) {\n setMouseIsDown(true)\n setMovedDuringLastMouseDown(false)\n callMouseHandler('MouseDown', event)\n }\n\n function onMouseEnter(event: React.MouseEvent) {\n callMouseHandler('MouseEnter', event)\n }\n\n function onMouseOut(event: React.MouseEvent) {\n callMouseHandler('MouseOut', event)\n callMouseHandler('MouseLeave', event)\n }\n\n function onMouseOver(event: React.MouseEvent) {\n callMouseHandler('MouseOver', event)\n }\n\n function onMouseUp(event: React.MouseEvent) {\n setMouseIsDown(false)\n callMouseHandler('MouseUp', event)\n }\n\n function onClick(event: React.MouseEvent) {\n if (!movedDuringLastMouseDown) {\n callMouseHandler('Click', event)\n }\n }\n\n function onMouseLeave(event: React.MouseEvent) {\n callMouseHandler('MouseOut', event)\n callMouseHandler('MouseLeave', event)\n }\n\n function onContextMenu(event: React.MouseEvent) {\n callMouseHandler('ContextMenu', event)\n }\n\n function mouseMove(event: React.MouseEvent) {\n if (!ref.current) {\n return\n }\n if (mouseIsDown) {\n setMovedDuringLastMouseDown(true)\n }\n const rect = ref.current.getBoundingClientRect()\n const offsetX = event.clientX - rect.left\n const offsetY = event.clientY - rect.top\n const px = region.reversed ? width - offsetX : offsetX\n const clientBp = region.start + bpPerPx * px\n\n onMouseMove?.(\n event,\n displayModel?.getFeatureOverlapping(blockKey, clientBp, offsetY),\n )\n }\n\n function callMouseHandler(handlerName: string, event: React.MouseEvent) {\n // @ts-expect-error\n const featureHandler = props[`onFeature${handlerName}`]\n // @ts-expect-error\n const canvasHandler = props[`on${handlerName}`]\n if (featureHandler && featureIdUnderMouse) {\n featureHandler(event, featureIdUnderMouse)\n } else if (canvasHandler) {\n canvasHandler(event, featureIdUnderMouse)\n }\n }\n\n const canvasWidth = Math.ceil(width)\n // need to call this in render so we get the right observer behavior\n return (\n <div\n ref={ref}\n data-testid={[\n 'pileup-overlay',\n sortedBy?.type,\n colorBy?.type,\n colorBy?.tag,\n filterBy?.tagFilter?.tag,\n ]\n .filter(f => !!f)\n .join('-')}\n style={{ position: 'relative', width: canvasWidth, height }}\n onMouseDown={event => {\n onMouseDown(event)\n }}\n onMouseEnter={event => {\n onMouseEnter(event)\n }}\n onMouseOut={event => {\n onMouseOut(event)\n }}\n onMouseOver={event => {\n onMouseOver(event)\n }}\n onMouseUp={event => {\n onMouseUp(event)\n }}\n onMouseLeave={event => {\n onMouseLeave(event)\n }}\n onMouseMove={event => {\n mouseMove(event)\n }}\n onClick={event => {\n onClick(event)\n }}\n onContextMenu={event => {\n onContextMenu(event)\n }}\n onFocus={() => {}}\n onBlur={() => {}}\n >\n <PrerenderedCanvas\n {...props}\n style={{ position: 'absolute', left: 0, top: 0 }}\n />\n {firstRender && highlight ? (\n <div\n style={{\n position: 'absolute',\n backgroundColor: '#0003',\n pointerEvents: 'none',\n ...highlight,\n }}\n />\n ) : null}\n {firstRender && selected ? (\n <div\n style={{\n position: 'absolute',\n border: '2px solid #00b8ff',\n boxSizing: 'content-box',\n pointerEvents: 'none',\n ...selected,\n }}\n />\n ) : null}\n </div>\n )\n})\n\nexport default PileupRendering\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport PileupRenderer from './PileupRenderer'\nimport configSchema from './configSchema'\nimport ReactComponent from './components/PileupRendering'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addRendererType(() => {\n return new PileupRenderer({\n name: 'PileupRenderer',\n displayName: 'Pileup renderer',\n ReactComponent,\n configSchema,\n pluginManager,\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nexport function getLowerPanelDisplays(pluginManager: PluginManager) {\n return pluginManager\n .getDisplayElements()\n .filter(f => f.subDisplay?.type === 'LinearAlignmentsDisplay')\n .filter(f => f.subDisplay?.lowerPanel)\n}\n","import React from 'react'\nimport { autorun, when } from 'mobx'\nimport {\n addDisposer,\n getSnapshot,\n isAlive,\n types,\n Instance,\n IStateTreeNode,\n} from 'mobx-state-tree'\nimport deepEqual from 'fast-deep-equal'\n\n// jbrowse\nimport {\n AnyConfigurationModel,\n AnyConfigurationSchemaType,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter'\n\n// locals\nimport { LinearAlignmentsDisplayMixin } from './alignmentsModel'\nimport { getLowerPanelDisplays } from './util'\nimport { IFilter } from '../../shared'\n\nconst minDisplayHeight = 20\n\nfunction deepSnap<T extends IStateTreeNode, U extends IStateTreeNode>(\n x1?: T,\n x2?: U,\n) {\n return deepEqual(\n x1 ? getSnapshot(x1) : undefined,\n x2 ? getSnapshot(x2) : undefined,\n )\n}\n\nfunction preCheck(self: LinearAlignmentsDisplayModel) {\n const { PileupDisplay, SNPCoverageDisplay } = self\n return (\n PileupDisplay ||\n isAlive(PileupDisplay) ||\n SNPCoverageDisplay ||\n isAlive(SNPCoverageDisplay)\n )\n}\n\nfunction propagateColorBy(self: LinearAlignmentsDisplayModel) {\n const { PileupDisplay, SNPCoverageDisplay } = self\n if (!preCheck(self) || !PileupDisplay.colorBy) {\n return\n }\n if (!deepSnap(PileupDisplay.colorBy, SNPCoverageDisplay.colorBy)) {\n SNPCoverageDisplay.setColorBy(getSnapshot(PileupDisplay.colorBy))\n }\n}\n\nfunction propagateFilterBy(self: LinearAlignmentsDisplayModel) {\n const { PileupDisplay, SNPCoverageDisplay } = self\n if (!preCheck(self) || !PileupDisplay.filterBy) {\n return\n }\n if (!deepSnap(PileupDisplay.filterBy, SNPCoverageDisplay.filterBy)) {\n SNPCoverageDisplay.setFilterBy(getSnapshot(PileupDisplay.filterBy))\n }\n}\n\n/**\n * #stateModel LinearAlignmentsDisplay\n * extends\n * - [BaseDisplay](../basedisplay)\n * - [LinearAlignmentsDisplayMixin](../linearalignmentsdisplaymixin)\n */\nfunction stateModelFactory(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'LinearAlignmentsDisplay',\n BaseDisplay,\n LinearAlignmentsDisplayMixin(pluginManager, configSchema),\n )\n .volatile(() => ({\n scrollTop: 0,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setScrollTop(scrollTop: number) {\n self.scrollTop = scrollTop\n },\n\n /**\n * #action\n */\n setSNPCoverageHeight(n: number) {\n self.snpCovHeight = n\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get height() {\n return self.heightPreConfig ?? getConf(self, 'height')\n },\n\n /**\n * #getter\n */\n get featureIdUnderMouse() {\n return (\n self.PileupDisplay.featureIdUnderMouse ||\n self.SNPCoverageDisplay.featureIdUnderMouse\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get pileupConf() {\n const conf = getConf(self, 'pileupDisplay')\n return {\n ...conf,\n type: self.lowerPanelType,\n displayId: `${self.configuration.displayId}_${self.lowerPanelType}_xyz`, // xyz to avoid someone accidentally naming the displayId similar to this\n }\n },\n\n /**\n * #method\n */\n getFeatureByID(blockKey: string, id: string) {\n return self.PileupDisplay.getFeatureByID(blockKey, id)\n },\n /**\n * #method\n */\n searchFeatureByID(id: string) {\n return self.PileupDisplay.searchFeatureByID?.(id)\n },\n\n /**\n * #getter\n */\n get features() {\n return self.PileupDisplay.features\n },\n\n /**\n * #getteralignmentsdisplaymodel\n */\n get DisplayBlurb() {\n return self.PileupDisplay?.DisplayBlurb\n },\n\n /**\n * #getter\n */\n get sortedBy() {\n return self.PileupDisplay.sortedBy\n },\n\n /**\n * #getter\n */\n get coverageConf() {\n const conf = getConf(self, 'snpCoverageDisplay')\n return {\n ...conf,\n displayId: `${self.configuration.displayId}_snpcoverage_xyz`, // xyz to avoid someone accidentally naming the displayId similar to this\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setSNPCoverageDisplay(configuration: AnyConfigurationModel) {\n self.SNPCoverageDisplay = {\n type: 'LinearSNPCoverageDisplay',\n configuration,\n height: self.snpCovHeight,\n }\n },\n /**\n * #action\n */\n setFeatureDensityStatsLimit(stats?: FeatureDensityStats) {\n self.PileupDisplay.setFeatureDensityStatsLimit(stats)\n self.SNPCoverageDisplay.setFeatureDensityStatsLimit(stats)\n },\n\n /**\n * #action\n */\n setPileupDisplay(configuration: AnyConfigurationModel) {\n self.PileupDisplay = {\n type: configuration.type || 'LinearPileupDisplay',\n configuration,\n }\n },\n /**\n * #action\n */\n setHeight(n: number) {\n self.heightPreConfig = Math.max(n, minDisplayHeight)\n return self.heightPreConfig\n },\n /**\n * #action\n */\n setFilterBy(filter: IFilter) {\n self.PileupDisplay.setFilterBy(filter)\n self.SNPCoverageDisplay.setFilterBy(filter)\n },\n /**\n * #action\n */\n setLowerPanelType(type: string) {\n self.lowerPanelType = type\n },\n /**\n * #action\n */\n resizeHeight(distance: number) {\n const oldHeight = self.height\n const newHeight = this.setHeight(self.height + distance)\n return newHeight - oldHeight\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n const {\n SNPCoverageDisplay,\n PileupDisplay,\n coverageConf,\n pileupConf,\n } = self\n\n if (!SNPCoverageDisplay) {\n self.setSNPCoverageDisplay(coverageConf)\n } else if (\n !deepEqual(\n coverageConf,\n getSnapshot(SNPCoverageDisplay.configuration),\n )\n ) {\n SNPCoverageDisplay.setHeight(self.snpCovHeight)\n SNPCoverageDisplay.setConfig(self.coverageConf)\n }\n\n if (!PileupDisplay || self.lowerPanelType !== PileupDisplay.type) {\n self.setPileupDisplay(pileupConf)\n } else if (\n !deepEqual(pileupConf, getSnapshot(PileupDisplay.configuration))\n ) {\n PileupDisplay.setConfig(self.pileupConf)\n }\n\n propagateColorBy(self as LinearAlignmentsDisplayModel)\n propagateFilterBy(self as LinearAlignmentsDisplayModel)\n }),\n )\n\n addDisposer(\n self,\n autorun(() => {\n self.setSNPCoverageHeight(self.SNPCoverageDisplay.height)\n }),\n )\n\n addDisposer(\n self,\n autorun(() => {\n self.PileupDisplay.setHeight(\n self.height - self.SNPCoverageDisplay.height,\n )\n }),\n )\n },\n /**\n * #action\n */\n async renderSvg(opts: { rasterizeLayers?: boolean }) {\n const pileupHeight = self.height - self.SNPCoverageDisplay.height\n await when(\n () =>\n !self.PileupDisplay.renderProps().notReady &&\n !self.SNPCoverageDisplay.renderProps().notReady,\n )\n return (\n <>\n <g>{await self.SNPCoverageDisplay.renderSvg(opts)}</g>\n <g transform={`translate(0 ${self.SNPCoverageDisplay.height})`}>\n {await self.PileupDisplay.renderSvg({\n ...opts,\n overrideHeight: pileupHeight,\n })}\n </g>\n </>\n )\n },\n }))\n .views(self => {\n const { trackMenuItems: superTrackMenuItems } = self\n return {\n /**\n * #method\n */\n trackMenuItems(): MenuItem[] {\n if (!self.PileupDisplay) {\n return []\n }\n const extra = getLowerPanelDisplays(pluginManager).map(d => ({\n type: 'radio',\n label: d.displayName,\n checked: d.name === self.PileupDisplay.type,\n onClick: () => {\n self.setLowerPanelType(d.name)\n },\n }))\n return [\n ...superTrackMenuItems(),\n {\n type: 'subMenu',\n label: 'Pileup settings',\n subMenu: self.PileupDisplay.trackMenuItems(),\n },\n {\n type: 'subMenu',\n label: 'SNPCoverage settings',\n subMenu: self.SNPCoverageDisplay.trackMenuItems(),\n },\n {\n type: 'subMenu',\n label: 'Replace lower panel with...',\n subMenu: extra,\n },\n ]\n },\n }\n })\n .preProcessSnapshot(snap => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!snap) {\n return snap\n }\n // @ts-expect-error\n const { height, ...rest } = snap\n return { heightPreConfig: height, ...rest }\n })\n}\n\nexport default stateModelFactory\n\nexport type LinearAlignmentsDisplayStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearAlignmentsDisplayModel =\n Instance<LinearAlignmentsDisplayStateModel>\n","import { types } from 'mobx-state-tree'\n\n// jbrowse\nimport {\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getLowerPanelDisplays } from './util'\n\n/**\n * #stateModel LinearAlignmentsDisplayMixin\n */\nexport function LinearAlignmentsDisplayMixin(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types.model({\n /**\n * #property\n * refers to LinearPileupDisplay sub-display model\n */\n PileupDisplay: types.maybe(\n types.union(\n ...getLowerPanelDisplays(pluginManager).map(f => f.stateModel),\n ),\n ),\n /**\n * #property\n * refers to LinearSNPCoverageDisplay sub-display model\n */\n SNPCoverageDisplay: types.maybe(\n pluginManager.getDisplayType('LinearSNPCoverageDisplay')!.stateModel,\n ),\n /**\n * #property\n */\n snpCovHeight: 45,\n /**\n * #property\n */\n type: types.literal('LinearAlignmentsDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n heightPreConfig: types.maybe(types.number),\n /**\n * #property\n */\n userFeatureScreenDensity: types.maybe(types.number),\n /**\n * #property\n */\n lowerPanelType: 'LinearPileupDisplay',\n })\n}\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { ResizeHandle } from '@jbrowse/core/ui'\n\n// locals\nimport { LinearAlignmentsDisplayModel } from '../models/model'\n\nconst useStyles = makeStyles()({\n resizeHandle: {\n height: 5,\n position: 'absolute',\n zIndex: 2,\n },\n})\n\nconst AlignmentsDisplay = observer(function AlignmentsDisplay({\n model,\n}: {\n model: LinearAlignmentsDisplayModel\n}) {\n const { PileupDisplay, SNPCoverageDisplay } = model\n const { classes } = useStyles()\n if (!SNPCoverageDisplay) {\n return null\n }\n const top = SNPCoverageDisplay.height ?? 100\n return (\n <div\n data-testid={`display-${getConf(model, 'displayId')}`}\n style={{ position: 'relative' }}\n >\n <div data-testid=\"Blockset-snpcoverage\">\n <SNPCoverageDisplay.RenderingComponent model={SNPCoverageDisplay} />\n </div>\n <ResizeHandle\n onDrag={delta => {\n SNPCoverageDisplay.setHeight(SNPCoverageDisplay.height + delta)\n return delta\n }}\n className={classes.resizeHandle}\n style={{ top: top - 4 }}\n />\n\n <div\n data-testid=\"Blockset-pileup\"\n style={{\n position: 'absolute',\n top,\n }}\n >\n <PileupDisplay.RenderingComponent model={PileupDisplay} />\n </div>\n </div>\n )\n})\n\nexport default AlignmentsDisplay\n","import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n// locals\nimport configSchemaFactory from './models/configSchema'\nimport modelFactory from './models/model'\nimport ReactComponent from './components/AlignmentsDisplay'\n\nexport default function LinearAlignmentsDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearAlignmentsDisplay',\n displayName: 'Alignments display (combination)',\n configSchema,\n stateModel: modelFactory(pluginManager, configSchema),\n trackType: 'AlignmentsTrack',\n viewType: 'LinearGenomeView',\n ReactComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearAlignmentsDisplay\n * has a \"pileup\" sub-display, where you can see individual reads and a\n * quantitative \"snpcoverage\" sub-display track showing SNP frequencies\n */\nexport default function configModelFactory(pm: PluginManager) {\n return ConfigurationSchema(\n 'LinearAlignmentsDisplay',\n {\n /**\n * #slot\n */\n pileupDisplay: pm.getDisplayType('LinearPileupDisplay')!.configSchema,\n\n /**\n * #slot\n */\n snpCoverageDisplay: pm.getDisplayType('LinearSNPCoverageDisplay')!\n .configSchema,\n\n /**\n * #slot\n */\n height: {\n type: 'number',\n defaultValue: 250,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import { lazy } from 'react'\nimport { types, cast, getEnv, getSnapshot, isAlive } from 'mobx-state-tree'\nimport { observable } from 'mobx'\n\n// jbrowse\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport {\n getConf,\n readConfObject,\n AnyConfigurationSchemaType,\n AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle'\nimport { getContainingView } from '@jbrowse/core/util'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\n\n// locals\nimport { FilterModel, IFilter, getUniqueModificationValues } from '../../shared'\nimport { createAutorun, modificationColors } from '../../util'\nimport { randomColor } from '../../util'\n\n// lazies\nconst Tooltip = lazy(() => import('../components/Tooltip'))\n\n// using a map because it preserves order\nconst rendererTypes = new Map([['snpcoverage', 'SNPCoverageRenderer']])\n\ntype LGV = LinearGenomeViewModel\n\n/**\n * #stateModel LinearSNPCoverageDisplay\n * extends\n * - [LinearWiggleDisplay](../linearwiggledisplay)\n */\nfunction stateModelFactory(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'LinearSNPCoverageDisplay',\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearSNPCoverageDisplay'),\n /**\n * #property\n */\n drawInterbaseCounts: types.maybe(types.boolean),\n /**\n * #property\n */\n drawIndicators: types.maybe(types.boolean),\n /**\n * #property\n */\n drawArcs: types.maybe(types.boolean),\n /**\n * #property\n */\n filterBy: types.optional(FilterModel, {}),\n /**\n * #property\n */\n colorBy: types.maybe(\n types.model({\n type: types.string,\n tag: types.maybe(types.string),\n }),\n ),\n /**\n * #property\n */\n jexlFilters: types.optional(types.array(types.string), []),\n }),\n )\n .volatile(() => ({\n modificationTagMap: observable.map<string, string>({}),\n modificationsReady: false,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setConfig(configuration: AnyConfigurationModel) {\n self.configuration = configuration\n },\n /**\n * #action\n */\n setFilterBy(filter: IFilter) {\n self.filterBy = cast(filter)\n },\n /**\n * #action\n */\n setColorBy(colorBy?: { type: string; tag?: string }) {\n self.colorBy = cast(colorBy)\n },\n /**\n * #action\n */\n setJexlFilters(filters: string[]) {\n self.jexlFilters = cast(filters)\n },\n\n /**\n * #action\n */\n updateModificationColorMap(uniqueModifications: string[]) {\n uniqueModifications.forEach(value => {\n if (!self.modificationTagMap.has(value)) {\n self.modificationTagMap.set(\n value,\n modificationColors[value] || randomColor(),\n )\n }\n })\n },\n }))\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #getter\n */\n get rendererConfig() {\n const configBlob =\n getConf(self, ['renderers', self.rendererTypeName]) || {}\n\n return self.rendererType.configSchema.create(\n {\n ...configBlob,\n drawInterbaseCounts:\n self.drawInterbaseCounts ?? configBlob.drawInterbaseCounts,\n drawIndicators: self.drawIndicators ?? configBlob.drawIndicators,\n drawArcs: self.drawArcs ?? configBlob.drawArcs,\n },\n getEnv(self),\n )\n },\n /**\n * #getter\n */\n get drawArcsSetting() {\n return (\n self.drawArcs ?? readConfObject(this.rendererConfig, 'drawArcs')\n )\n },\n /**\n * #getter\n */\n get drawInterbaseCountsSetting() {\n return (\n self.drawInterbaseCounts ??\n readConfObject(this.rendererConfig, 'drawInterbaseCounts')\n )\n },\n /**\n * #getter\n */\n get drawIndicatorsSetting() {\n return (\n self.drawIndicators ??\n readConfObject(this.rendererConfig, 'drawIndicators')\n )\n },\n\n /**\n * #getter\n */\n get autorunReady() {\n const view = getContainingView(self) as LGV\n return (\n view.initialized &&\n self.featureDensityStatsReady &&\n !self.regionTooLarge &&\n !self.error\n )\n },\n\n get renderReady() {\n const superProps = superRenderProps()\n return !superProps.notReady && self.modificationsReady\n },\n\n get ready() {\n return this.renderReady\n },\n\n /**\n * #method\n */\n renderProps() {\n const superProps = superRenderProps()\n const { colorBy, filterBy, modificationTagMap } = self\n return {\n ...superProps,\n notReady: !this.ready,\n filters: self.filters,\n modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),\n\n // must use getSnapshot because otherwise changes to e.g. just the\n // colorBy.type are not read\n colorBy: colorBy ? getSnapshot(colorBy) : undefined,\n filterBy: getSnapshot(filterBy),\n }\n },\n }\n })\n .actions(self => ({\n /**\n * #action\n */\n setModificationsReady(flag: boolean) {\n self.modificationsReady = flag\n },\n /**\n * #action\n */\n toggleDrawIndicators() {\n self.drawIndicators = !self.drawIndicatorsSetting\n },\n /**\n * #action\n */\n toggleDrawInterbaseCounts() {\n self.drawInterbaseCounts = !self.drawInterbaseCountsSetting\n },\n /**\n * #action\n */\n toggleDrawArcs() {\n self.drawArcs = !self.drawArcsSetting\n },\n }))\n .actions(self => ({\n afterAttach() {\n createAutorun(\n self,\n async () => {\n self.setModificationsReady(false)\n if (!self.autorunReady) {\n return\n }\n const view = getContainingView(self) as LGV\n const { staticBlocks } = view\n const { colorBy } = self\n if (colorBy?.type === 'modifications') {\n const adapter = getConf(self.parentTrack, 'adapter')\n const vals = await getUniqueModificationValues({\n self,\n adapterConfig: adapter,\n blocks: staticBlocks,\n })\n if (isAlive(self)) {\n self.updateModificationColorMap(vals)\n self.setModificationsReady(true)\n }\n } else {\n self.setModificationsReady(true)\n }\n },\n { delay: 1000 },\n )\n },\n }))\n\n .views(self => {\n const { trackMenuItems: superTrackMenuItems } = self\n return {\n /**\n * #getter\n */\n get TooltipComponent() {\n return Tooltip\n },\n\n /**\n * #getter\n */\n get adapterConfig() {\n const subadapter = getConf(self.parentTrack, 'adapter')\n return {\n type: 'SNPCoverageAdapter',\n subadapter,\n }\n },\n\n /**\n * #getter\n */\n get rendererTypeName() {\n return rendererTypes.get('snpcoverage')\n },\n\n /**\n * #getter\n */\n get needsScalebar() {\n return true\n },\n\n /**\n * #method\n */\n contextMenuItems() {\n return []\n },\n\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Draw insertion/clipping indicators',\n type: 'checkbox',\n checked: self.drawIndicatorsSetting,\n onClick: () => {\n self.toggleDrawIndicators()\n },\n },\n {\n label: 'Draw insertion/clipping counts',\n type: 'checkbox',\n checked: self.drawInterbaseCountsSetting,\n onClick: () => {\n self.toggleDrawInterbaseCounts()\n },\n },\n {\n label: 'Draw arcs',\n type: 'checkbox',\n checked: self.drawArcsSetting,\n onClick: () => {\n self.toggleDrawArcs()\n },\n },\n ]\n },\n\n /**\n * #getter\n */\n get filters() {\n return new SerializableFilterChain({ filters: self.jexlFilters })\n },\n }\n })\n}\n\nexport type SNPCoverageDisplayModel = ReturnType<typeof stateModelFactory>\n\nexport default stateModelFactory\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaFactory from './models/configSchema'\nimport modelFactory from './models/model'\nimport { LinearWiggleDisplayReactComponent } from '@jbrowse/plugin-wiggle'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearSNPCoverageDisplay',\n displayName: 'SNPCoverage display',\n configSchema,\n stateModel: modelFactory(pluginManager, configSchema),\n trackType: 'AlignmentsTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: LinearWiggleDisplayReactComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearSNPCoverageDisplay\n *\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default function SNPCoverageConfigFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearSNPCoverageDisplay',\n {\n /**\n * #slot\n */\n autoscale: {\n type: 'stringEnum',\n defaultValue: 'local',\n model: types.enumeration('Autoscale type', ['local']),\n description:\n 'performs local autoscaling (no other options for SNP Coverage available)',\n },\n /**\n * #slot\n */\n minScore: {\n type: 'number',\n defaultValue: Number.MIN_VALUE,\n description: 'minimum value for the y-scale',\n },\n /**\n * #slot\n */\n maxScore: {\n type: 'number',\n description: 'maximum value for the y-scale',\n defaultValue: Number.MAX_VALUE,\n },\n /**\n * #slot\n */\n scaleType: {\n type: 'stringEnum',\n model: types.enumeration('Scale type', ['linear', 'log']), // todo zscale\n description: 'The type of scale to use',\n defaultValue: 'linear',\n },\n /**\n * #slot\n */ inverted: {\n type: 'boolean',\n description: 'draw upside down',\n defaultValue: false,\n },\n /**\n * #slot\n */\n multiTicks: {\n type: 'boolean',\n description: 'Display multiple values for the ticks',\n defaultValue: false,\n },\n /**\n * #slot\n */\n renderers: ConfigurationSchema('RenderersConfiguration', {\n SNPCoverageRenderer: pluginManager.getRendererType(\n 'SNPCoverageRenderer',\n )!.configSchema,\n }),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import React, { lazy } from 'react'\nimport { cast, types, Instance } from 'mobx-state-tree'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes'\nimport {\n FeatureDensityMixin,\n TrackHeightMixin,\n} from '@jbrowse/plugin-linear-genome-view'\n\n// icons\nimport PaletteIcon from '@mui/icons-material/Palette'\nimport FilterListIcon from '@mui/icons-material/ClearAll'\n\n// locals\nimport { FilterModel, IFilter } from '../shared'\nimport { ChainData } from '../shared/fetchChains'\n\n// async\nconst FilterByTagDialog = lazy(() => import('../shared/FilterByTagDialog'))\n\n/**\n * #stateModel LinearReadArcsDisplay\n * the arc display is a non-block-based track, so draws to a single canvas and\n * can connect multiple regions\n * extends\n * - [BaseDisplay](../basedisplay)\n * - [TrackHeightMixin](../trackheightmixin)\n * - [FeatureDensityMixin](../featuredensitymixin)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearReadArcsDisplay',\n BaseDisplay,\n TrackHeightMixin(),\n FeatureDensityMixin(),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearReadArcsDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n\n /**\n * #property\n */\n filterBy: types.optional(FilterModel, {}),\n\n /**\n * #property\n */\n lineWidth: types.maybe(types.number),\n\n /**\n * #property\n */\n jitter: types.maybe(types.number),\n\n /**\n * #property\n */\n colorBy: types.maybe(\n types.model({\n type: types.string,\n tag: types.maybe(types.string),\n extra: types.frozen(),\n }),\n ),\n\n /**\n * #property\n */\n drawInter: true,\n\n /**\n * #property\n */\n drawLongRange: true,\n }),\n )\n .volatile(() => ({\n loading: false,\n chainData: undefined as ChainData | undefined,\n lastDrawnOffsetPx: undefined as number | undefined,\n lastDrawnBpPerPx: 0,\n ref: null as HTMLCanvasElement | null,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setLastDrawnOffsetPx(n: number) {\n self.lastDrawnOffsetPx = n\n },\n /**\n * #action\n */\n setLastDrawnBpPerPx(n: number) {\n self.lastDrawnBpPerPx = n\n },\n /**\n * #action\n */\n setLoading(f: boolean) {\n self.loading = f\n },\n\n /**\n * #action\n */\n reload() {\n self.error = undefined\n },\n /**\n * #action\n * internal, a reference to a HTMLCanvas because we use a autorun to draw\n * the canvas\n */\n setRef(ref: HTMLCanvasElement | null) {\n self.ref = ref\n },\n\n /**\n * #action\n */\n setColorScheme(s: { type: string }) {\n self.colorBy = cast(s)\n },\n\n /**\n * #action\n */\n setChainData(args: ChainData) {\n self.chainData = args\n },\n\n /**\n * #action\n */\n setDrawInter(f: boolean) {\n self.drawInter = f\n },\n\n /**\n * #action\n */\n setDrawLongRange(f: boolean) {\n self.drawLongRange = f\n },\n\n /**\n * #action\n */\n setFilterBy(filter: IFilter) {\n self.filterBy = cast(filter)\n },\n\n /**\n * #action\n * thin, bold, extrabold, etc\n */\n setLineWidth(n: number) {\n self.lineWidth = n\n },\n\n /**\n * #action\n * jitter val, helpful to jitter the x direction so you see better\n * evidence when e.g. 100 long reads map to same x position\n */\n setJitter(n: number) {\n self.jitter = n\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get drawn() {\n return self.lastDrawnOffsetPx !== undefined\n },\n /**\n * #getter\n */\n get lineWidthSetting() {\n return self.lineWidth ?? getConf(self, 'lineWidth')\n },\n\n /**\n * #getter\n */\n get jitterVal(): number {\n return self.jitter ?? getConf(self, 'jitter')\n },\n }))\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderProps: superRenderProps,\n } = self\n return {\n /**\n * #method\n * only used to tell system it's ready for export\n */\n renderProps() {\n return {\n ...superRenderProps(),\n notReady: !self.chainData,\n }\n },\n\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Filter by',\n icon: FilterListIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n FilterByTagDialog,\n { model: self, handleClose },\n ])\n },\n },\n {\n label: 'Line width',\n subMenu: [\n {\n label: 'Thin',\n onClick: () => {\n self.setLineWidth(1)\n },\n },\n {\n label: 'Bold',\n onClick: () => {\n self.setLineWidth(2)\n },\n },\n {\n label: 'Extra bold',\n onClick: () => {\n self.setLineWidth(5)\n },\n },\n ],\n },\n {\n label: 'Jitter x-positions',\n subMenu: [\n {\n type: 'checkbox',\n checked: self.jitterVal === 0,\n label: 'None',\n onClick: () => {\n self.setJitter(0)\n },\n },\n {\n type: 'checkbox',\n checked: self.jitterVal === 2,\n label: 'Small',\n onClick: () => {\n self.setJitter(2)\n },\n },\n {\n type: 'checkbox',\n checked: self.jitterVal === 10,\n label: 'Large',\n onClick: () => {\n self.setJitter(10)\n },\n },\n ],\n },\n {\n label: 'Draw inter-region vertical lines',\n type: 'checkbox',\n checked: self.drawInter,\n onClick: () => {\n self.setDrawInter(!self.drawInter)\n },\n },\n {\n label: 'Draw long range connections',\n type: 'checkbox',\n checked: self.drawLongRange,\n onClick: () => {\n self.setDrawLongRange(!self.drawLongRange)\n },\n },\n {\n label: 'Color scheme',\n icon: PaletteIcon,\n subMenu: [\n {\n label: 'Insert size ± 3σ and orientation',\n onClick: () => {\n self.setColorScheme({ type: 'insertSizeAndOrientation' })\n },\n },\n {\n label: 'Insert size ± 3σ',\n onClick: () => {\n self.setColorScheme({ type: 'insertSize' })\n },\n },\n {\n label: 'Orientation',\n onClick: () => {\n self.setColorScheme({ type: 'orientation' })\n },\n },\n {\n label: 'Insert size gradient',\n onClick: () => {\n self.setColorScheme({ type: 'gradient' })\n },\n },\n ],\n },\n ]\n },\n }\n })\n .views(self => ({\n /**\n * #method\n */\n async renderSvg(opts: {\n rasterizeLayers?: boolean\n }): Promise<React.ReactNode> {\n const { renderSvg } = await import('../shared/renderSvg')\n const { drawFeats } = await import('./drawFeats')\n return renderSvg(self as LinearReadArcsDisplayModel, opts, drawFeats)\n },\n }))\n .actions(self => ({\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n const { doAfterAttach } = await import('../shared/afterAttach')\n const { drawFeats } = await import('./drawFeats')\n doAfterAttach(self, drawFeats)\n } catch (e) {\n console.error(e)\n self.setError(e)\n }\n })()\n },\n }))\n}\n\nexport type LinearReadArcsDisplayStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearReadArcsDisplayModel =\n Instance<LinearReadArcsDisplayStateModel>\n\nexport default stateModelFactory\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\n// locals\nimport configSchemaF from './configSchema'\nimport stateModelF from './model'\nimport { lazy } from 'react'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new DisplayType({\n name: 'LinearReadArcsDisplay',\n displayName: 'Arc display',\n configSchema,\n stateModel: stateModelF(configSchema),\n trackType: 'AlignmentsTrack',\n viewType: 'LinearGenomeView',\n subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },\n ReactComponent: lazy(() => import('./components/ReactComponent')),\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config LinearReadArcsDisplay\n */\nfunction configSchemaF(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearReadArcsDisplay',\n {\n /**\n * #slot\n */\n maxFeatureScreenDensity: {\n type: 'number',\n description: 'maximum features per pixel that is displayed in the view',\n defaultValue: 5,\n },\n\n /**\n * #slot\n */\n lineWidth: {\n type: 'number',\n description: 'set arc line width',\n defaultValue: 1,\n },\n\n /**\n * #slot\n */\n jitter: {\n type: 'number',\n description:\n 'jitters the x position so e.g. if many reads map to exact same x position, jittering makes it easy to see that there are many of them',\n defaultValue: 0,\n },\n\n /**\n * #slot\n */\n colorScheme: {\n type: 'stringEnum',\n model: types.enumeration('colorScheme', [\n 'strand',\n 'normal',\n 'insertSize',\n 'insertSizeAndOrientation',\n 'mappingQuality',\n 'tag',\n ]),\n description: 'color scheme to use',\n defaultValue: 'normal',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaF\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config LinearReadCloudDisplay\n */\nfunction configSchemaF(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearReadCloudDisplay',\n {\n /**\n * #slot\n */\n maxFeatureScreenDensity: {\n type: 'number',\n description: 'maximum features per pixel that is displayed in the view',\n defaultValue: 5,\n },\n\n /**\n * #slot\n */\n featureHeight: {\n type: 'number',\n defaultValue: 7,\n },\n\n /**\n * #slot\n */\n colorScheme: {\n type: 'stringEnum',\n model: types.enumeration('colorScheme', [\n 'strand',\n 'normal',\n 'insertSize',\n 'insertSizeAndOrientation',\n 'mappingQuality',\n 'tag',\n ]),\n description: 'color scheme to use',\n defaultValue: 'normal',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaF\n","import React, { lazy } from 'react'\nimport { cast, types, Instance } from 'mobx-state-tree'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport {\n FeatureDensityMixin,\n TrackHeightMixin,\n} from '@jbrowse/plugin-linear-genome-view'\n\n// icons\nimport PaletteIcon from '@mui/icons-material/Palette'\nimport FilterListIcon from '@mui/icons-material/ClearAll'\n\n// locals\nimport { FilterModel, IFilter } from '../shared'\nimport { ChainData } from '../shared/fetchChains'\n\n// async\nconst FilterByTagDialog = lazy(() => import('../shared/FilterByTagDialog'))\n\n/**\n * #stateModel LinearReadCloudDisplay\n * it is not a block based track, hence not BaseLinearDisplay\n * extends\n * - [BaseDisplay](../basedisplay)\n * - [TrackHeightMixin](../trackheightmixin)\n * - [FeatureDensityMixin](../featuredensitymixin)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearReadCloudDisplay',\n BaseDisplay,\n TrackHeightMixin(),\n FeatureDensityMixin(),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearReadCloudDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n\n /**\n * #property\n */\n filterBy: types.optional(FilterModel, {}),\n\n /**\n * #property\n */\n colorBy: types.maybe(\n types.model({\n type: types.string,\n tag: types.maybe(types.string),\n extra: types.frozen(),\n }),\n ),\n\n /**\n * #property\n */\n drawSingletons: true,\n }),\n )\n .volatile(() => ({\n loading: false,\n chainData: undefined as ChainData | undefined,\n lastDrawnOffsetPx: undefined as number | undefined,\n lastDrawnBpPerPx: 0,\n ref: null as HTMLCanvasElement | null,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setDrawSingletons(f: boolean) {\n self.drawSingletons = f\n },\n /**\n * #action\n */\n setLastDrawnOffsetPx(n: number) {\n self.lastDrawnOffsetPx = n\n },\n /**\n * #action\n */\n setLastDrawnBpPerPx(n: number) {\n self.lastDrawnBpPerPx = n\n },\n\n /**\n * #action\n */\n setLoading(f: boolean) {\n self.loading = f\n },\n /**\n * #action\n */\n reload() {\n self.error = undefined\n },\n /**\n * #action\n * internal, a reference to a HTMLCanvas because we use a autorun to draw\n * the canvas\n */\n setRef(ref: HTMLCanvasElement | null) {\n self.ref = ref\n },\n\n setColorScheme(s: { type: string }) {\n self.colorBy = cast(s)\n },\n\n /**\n * #action\n */\n setChainData(args: ChainData) {\n self.chainData = args\n },\n\n /**\n * #action\n */\n setFilterBy(filter: IFilter) {\n self.filterBy = cast(filter)\n },\n }))\n .views(self => ({\n get drawn() {\n return self.lastDrawnOffsetPx !== undefined\n },\n }))\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderProps: superRenderProps,\n } = self\n\n return {\n // we don't use a server side renderer, so this fills in minimal\n // info so as not to crash\n renderProps() {\n return {\n ...superRenderProps(),\n notReady: !self.chainData,\n }\n },\n\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Draw singletons',\n type: 'checkbox',\n checked: self.drawSingletons,\n onClick: () => {\n self.setDrawSingletons(!self.drawSingletons)\n },\n },\n {\n label: 'Filter by',\n icon: FilterListIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n FilterByTagDialog,\n { model: self, handleClose },\n ])\n },\n },\n\n {\n label: 'Color scheme',\n icon: PaletteIcon,\n subMenu: [\n {\n label: 'Insert size ± 3σ and orientation',\n onClick: () => {\n self.setColorScheme({ type: 'insertSizeAndOrientation' })\n },\n },\n {\n label: 'Insert size ± 3σ',\n onClick: () => {\n self.setColorScheme({ type: 'insertSize' })\n },\n },\n {\n label: 'Orientation',\n onClick: () => {\n self.setColorScheme({ type: 'orientation' })\n },\n },\n {\n label: 'Insert size gradient',\n onClick: () => {\n self.setColorScheme({ type: 'gradient' })\n },\n },\n ],\n },\n ]\n },\n\n /**\n * #method\n */\n async renderSvg(opts: {\n rasterizeLayers?: boolean\n }): Promise<React.ReactNode> {\n const { renderSvg } = await import('../shared/renderSvg')\n const { drawFeats } = await import('./drawFeats')\n return renderSvg(self as LinearReadCloudDisplayModel, opts, drawFeats)\n },\n }\n })\n .actions(self => ({\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n const { doAfterAttach } = await import('../shared/afterAttach')\n const { drawFeats } = await import('./drawFeats')\n doAfterAttach(self, drawFeats)\n } catch (e) {\n console.error(e)\n self.setError(e)\n }\n })()\n },\n }))\n}\n\nexport type LinearReadCloudDisplayStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearReadCloudDisplayModel =\n Instance<LinearReadCloudDisplayStateModel>\n\nexport default stateModelFactory\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\n// locals\nimport configSchemaF from './configSchema'\nimport stateModelF from './model'\nimport { lazy } from 'react'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new DisplayType({\n name: 'LinearReadCloudDisplay',\n displayName: 'Read cloud display',\n configSchema,\n stateModel: stateModelF(configSchema),\n trackType: 'AlignmentsTrack',\n viewType: 'LinearGenomeView',\n subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },\n ReactComponent: lazy(() => import('./components/ReactComponent')),\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport configSchemaF from './configSchemaF'\n\nexport default function register(pm: PluginManager) {\n pm.addTrackType(() => {\n const configSchema = configSchemaF(pm)\n const track = new TrackType({\n name: 'AlignmentsTrack',\n displayName: 'Alignments track',\n configSchema,\n stateModel: createBaseTrackModel(pm, 'AlignmentsTrack', configSchema),\n })\n const linearAlignmentsDisplay = pm.getDisplayType(\n 'LinearAlignmentsDisplay',\n )!\n // Add LinearAlignmentsDisplay here so that it has priority over the other\n // linear displays (defaults to order the displays are added, but we have\n // to add the Pileup and SNPCoverage displays first).\n track.addDisplayType(linearAlignmentsDisplay)\n return track\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config AlignmentsTrack\n * has very little config; most config and state logic is on the display\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default function configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'AlignmentsTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport const configSchema = ConfigurationSchema('AlignmentsFeatureWidget', {})\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { Instance, types } from 'mobx-state-tree'\nimport { stateModelFactory as baseModelFactory } from '@jbrowse/core/BaseFeatureWidget'\n\nexport function stateModelFactory(pluginManager: PluginManager) {\n const baseModel = baseModelFactory(pluginManager)\n return types.compose(\n baseModel,\n types.model('AlignmentsFeatureWidget', {\n type: types.literal('AlignmentsFeatureWidget'),\n }),\n )\n}\n\nexport type AlignmentFeatureWidgetStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type AlignmentFeatureWidgetModel =\n Instance<AlignmentFeatureWidgetStateModel>\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType'\nimport { configSchema } from './configSchema'\nimport { stateModelFactory } from './stateModelFactory'\n\nexport default function AlignmentFeatureDetailsF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(\n () =>\n new WidgetType({\n name: 'AlignmentsFeatureWidget',\n heading: 'Feature details',\n configSchema: configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./AlignmentsFeatureDetail')),\n }),\n )\n}\n","import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'\nimport { renameRegionsIfNeeded } from '@jbrowse/core/util'\nimport { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods'\n\n// specialized get features to return limited data about alignments\nexport default abstract class PileupBaseRPC extends RpcMethodType {\n async serializeArguments(\n args: RenderArgs & {\n signal?: AbortSignal\n statusCallback?: (arg: string) => void\n },\n rpcDriver: string,\n ) {\n const { rootModel } = this.pluginManager\n const assemblyManager = rootModel?.session?.assemblyManager\n if (!assemblyManager) {\n throw new Error('no assembly manager available')\n }\n\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, args)\n\n return super.serializeArguments(renamedArgs, rpcDriver)\n }\n}\n","import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { Region, dedupe, groupBy } from '@jbrowse/core/util'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\n// locals\nimport { filterForPairs, getInsertSizeStats } from '../util'\nimport PileupBaseRPC from '../base'\nimport { getTag } from '../../util'\n\n// specialized get features to return limited data about alignments\nexport default class PileupGetReducedFeatures extends PileupBaseRPC {\n name = 'PileupGetReducedFeatures'\n\n async execute(\n args: {\n adapterConfig: Record<string, unknown>\n signal?: RemoteAbortSignal\n headers?: Record<string, string>\n regions: Region[]\n sessionId: string\n tag: string\n },\n rpcDriver: string,\n ) {\n const des = await this.deserializeArguments(args, rpcDriver)\n const { adapterConfig, sessionId, regions } = des\n const dataAdapter = (\n await getAdapter(this.pluginManager, sessionId, adapterConfig)\n ).dataAdapter as BaseFeatureDataAdapter\n\n const featuresArray = await firstValueFrom(\n dataAdapter.getFeaturesInMultipleRegions(regions, des).pipe(toArray()),\n )\n\n const reduced = dedupe(\n featuresArray.map(f => ({\n id: f.id(),\n refName: f.get('refName'),\n name: f.get('name'),\n start: f.get('start'),\n strand: f.get('strand'),\n end: f.get('end'),\n flags: f.get('flags'),\n tlen: f.get('template_length'),\n pair_orientation: f.get('pair_orientation'),\n next_ref: f.get('next_ref'),\n next_pos: f.get('next_pos'),\n clipPos: f.get('clipPos'),\n SA: getTag(f, 'SA'),\n })),\n f => f.id,\n )\n\n const filtered = filterForPairs(reduced)\n const stats = filtered.length ? getInsertSizeStats(filtered) : undefined\n const chains = groupBy(reduced, f => f.name)\n\n return {\n chains: Object.values(chains),\n stats,\n hasPaired: !!stats,\n containsNoTransferables: true,\n }\n }\n}\n","import { ReducedFeature } from '../shared/fetchChains'\n\nexport function getInsertSizeStats(features: ReducedFeature[]) {\n const filtered = features.map(f => Math.abs(f.tlen))\n const sum = filtered.reduce((a, b) => a + b, 0)\n const sum2 = filtered.map(a => a * a).reduce((a, b) => a + b, 0)\n const total = filtered.length\n const avg = sum / total\n const sd = Math.sqrt((total * sum2 - sum * sum) / (total * total))\n const upper = avg + 4 * sd\n const lower = avg - 3 * sd\n return { upper, lower, avg, sd }\n}\n\nexport function filterForPairs(features: ReducedFeature[]) {\n return features.filter(\n f => f.flags & 2 && !(f.flags & 256) && !(f.flags & 2048),\n )\n}\n","import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { Region } from '@jbrowse/core/util'\nimport { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\n\n// locals\nimport { getModificationTypes } from '../../MismatchParser'\nimport PileupBaseRPC from '../base'\nimport { getTagAlt } from '../../util'\n\nexport default class PileupGetVisibleModifications extends PileupBaseRPC {\n name = 'PileupGetVisibleModifications'\n\n async execute(\n args: {\n adapterConfig: Record<string, unknown>\n signal?: RemoteAbortSignal\n headers?: Record<string, string>\n regions: Region[]\n sessionId: string\n tag: string\n },\n rpcDriver: string,\n ) {\n const { adapterConfig, sessionId, regions } =\n await this.deserializeArguments(args, rpcDriver)\n const dataAdapter = (\n await getAdapter(this.pluginManager, sessionId, adapterConfig)\n ).dataAdapter as BaseFeatureDataAdapter\n\n const featuresArray = await firstValueFrom(\n dataAdapter.getFeaturesInMultipleRegions(regions).pipe(toArray()),\n )\n\n const uniqueValues = new Set<string>()\n featuresArray.forEach(f => {\n getModificationTypes(getTagAlt(f, 'MM', 'Mm') || '').forEach(t =>\n uniqueValues.add(t),\n )\n })\n return [...uniqueValues]\n }\n}\n","import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { Region } from '@jbrowse/core/util'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\n\n// locals\nimport PileupBaseRPC from '../base'\nimport { getTag } from '../../util'\n\nexport default class PileupGetGlobalValueForTag extends PileupBaseRPC {\n name = 'PileupGetGlobalValueForTag'\n\n async execute(\n args: {\n adapterConfig: Record<string, unknown>\n signal?: RemoteAbortSignal\n headers?: Record<string, string>\n regions: Region[]\n sessionId: string\n tag: string\n },\n rpcDriver: string,\n ) {\n const { adapterConfig, sessionId, regions, tag } =\n await this.deserializeArguments(args, rpcDriver)\n\n const dataAdapter = (\n await getAdapter(this.pluginManager, sessionId, adapterConfig)\n ).dataAdapter as BaseFeatureDataAdapter\n\n const features = dataAdapter.getFeaturesInMultipleRegions(regions)\n const featuresArray = await firstValueFrom(features.pipe(toArray()))\n return [\n ...new Set(\n featuresArray\n .map(feature => getTag(feature, tag))\n .filter(f => f !== undefined)\n .map(f => `${f}`),\n ),\n ]\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport {\n PileupGetGlobalValueForTag,\n PileupGetVisibleModifications,\n PileupGetReducedFeatures,\n} from './rpcMethods'\n\nexport default function PileupRPCMethodsF(pm: PluginManager) {\n pm.addRpcMethod(() => new PileupGetGlobalValueForTag(pm))\n pm.addRpcMethod(() => new PileupGetVisibleModifications(pm))\n pm.addRpcMethod(() => new PileupGetReducedFeatures(pm))\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n makeIndex,\n makeIndexType,\n getFileName,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default function GuessAlignmentsTypesF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.cram$/i\n const adapterName = 'CramAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n cramLocation: file,\n craiLocation: index || makeIndex(file, '.crai'),\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.bam$/i\n const adapterName = 'BamAdapter'\n const fileName = getFileName(file)\n const indexName = index && getFileName(index)\n\n const obj = {\n type: adapterName,\n bamLocation: file,\n index: {\n location: index || makeIndex(file, '.bai'),\n indexType: makeIndexType(indexName, 'CSI', 'BAI'),\n },\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'BamAdapter' || adapterName === 'CramAdapter') {\n return 'AlignmentsTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearPileupDisplay\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nfunction configSchemaF(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearPileupDisplay',\n {\n /**\n * #slot\n */\n defaultRendering: {\n type: 'stringEnum',\n model: types.enumeration('Rendering', ['pileup']),\n defaultValue: 'pileup',\n },\n /**\n * #slot\n */\n renderers: ConfigurationSchema('RenderersConfiguration', {\n PileupRenderer:\n pluginManager.getRendererType('PileupRenderer')!.configSchema,\n }),\n /**\n * #slot\n */\n maxFeatureScreenDensity: {\n type: 'number',\n description: 'maximum features per pixel that is displayed in the view',\n defaultValue: 5,\n },\n\n /**\n * #slot\n */\n colorScheme: {\n type: 'stringEnum',\n model: types.enumeration('colorScheme', [\n 'strand',\n 'normal',\n 'insertSize',\n 'insertSizeAndOrientation',\n 'mappingQuality',\n 'tag',\n ]),\n description: 'color scheme to use',\n defaultValue: 'normal',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaF\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { Typography } from '@mui/material'\n\nconst LinearPileupDisplayBlurb = observer(function ({\n model,\n}: {\n model: {\n sortedBy?: {\n pos: number\n refName: number\n type: string\n tag?: string\n }\n }\n}) {\n const { sortedBy } = model\n return sortedBy ? (\n <div data-testid={`blurb-${sortedBy}`}>\n <Typography color=\"secondary\" variant=\"caption\">\n {`Sorted by ${sortedBy.tag ?? sortedBy.type} at ${\n sortedBy.refName\n }:${sortedBy.pos}`}\n </Typography>\n </div>\n ) : null\n})\n\nexport default LinearPileupDisplayBlurb\n","import { lazy } from 'react'\nimport { autorun, observable } from 'mobx'\nimport { cast, types, addDisposer, getSnapshot } from 'mobx-state-tree'\nimport copy from 'copy-to-clipboard'\nimport {\n AnyConfigurationModel,\n AnyConfigurationSchemaType,\n ConfigurationReference,\n readConfObject,\n getConf,\n} from '@jbrowse/core/configuration'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport {\n getEnv,\n getSession,\n isSessionModelWithWidgets,\n getContainingView,\n SimpleFeature,\n SimpleFeatureSerialized,\n Feature,\n getContainingTrack,\n} from '@jbrowse/core/util'\n\nimport {\n LinearGenomeViewModel,\n BaseLinearDisplay,\n} from '@jbrowse/plugin-linear-genome-view'\n\n// icons\nimport { ContentCopy as ContentCopyIcon } from '@jbrowse/core/ui/Icons'\nimport MenuOpenIcon from '@mui/icons-material/MenuOpen'\nimport FilterListIcon from '@mui/icons-material/ClearAll'\n\n// locals\nimport LinearPileupDisplayBlurb from './components/LinearPileupDisplayBlurb'\nimport { getUniqueTagValues, FilterModel, IFilter } from '../shared'\nimport { createAutorun } from '../util'\nimport { ColorByModel, ExtraColorBy } from '../shared/color'\n\n// lazies\nconst FilterByTagDialog = lazy(() => import('../shared/FilterByTagDialog'))\nconst ColorByTagDialog = lazy(() => import('./components/ColorByTagDialog'))\nconst SetFeatureHeightDialog = lazy(\n () => import('./components/SetFeatureHeightDialog'),\n)\nconst SetMaxHeightDialog = lazy(() => import('./components/SetMaxHeightDialog'))\n\n// using a map because it preserves order\nconst rendererTypes = new Map([\n ['pileup', 'PileupRenderer'],\n ['svg', 'SvgFeatureRenderer'],\n])\n\ntype LGV = LinearGenomeViewModel\n\n/**\n * #stateModel SharedLinearPileupDisplayMixin\n * #category display\n * extends `BaseLinearDisplay`\n */\nexport function SharedLinearPileupDisplayMixin(\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n featureHeight: types.maybe(types.number),\n /**\n * #property\n */\n noSpacing: types.maybe(types.boolean),\n /**\n * #property\n */\n fadeLikelihood: types.maybe(types.boolean),\n /**\n * #property\n */\n trackMaxHeight: types.maybe(types.number),\n /**\n * #property\n */\n colorBy: ColorByModel,\n /**\n * #property\n */\n filterBy: types.optional(FilterModel, {}),\n /**\n * #property\n */\n jexlFilters: types.optional(types.array(types.string), []),\n }),\n )\n .volatile(() => ({\n colorTagMap: observable.map<string, string>({}),\n featureUnderMouseVolatile: undefined as undefined | Feature,\n tagsReady: false,\n }))\n .views(self => ({\n get autorunReady() {\n const view = getContainingView(self) as LGV\n return (\n view.initialized &&\n self.featureDensityStatsReady &&\n !self.regionTooLarge\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setTagsReady(flag: boolean) {\n self.tagsReady = flag\n },\n\n /**\n * #action\n */\n setMaxHeight(n?: number) {\n self.trackMaxHeight = n\n },\n\n /**\n * #action\n */\n setFeatureHeight(n?: number) {\n self.featureHeight = n\n },\n\n /**\n * #action\n */\n setNoSpacing(flag?: boolean) {\n self.noSpacing = flag\n },\n\n /**\n * #action\n */\n setColorScheme(colorScheme: {\n type: string\n tag?: string\n extra?: ExtraColorBy\n }) {\n self.colorTagMap = observable.map({}) // clear existing mapping\n self.colorBy = cast(colorScheme)\n if (colorScheme.tag) {\n self.tagsReady = false\n }\n },\n\n /**\n * #action\n */\n updateColorTagMap(uniqueTag: string[]) {\n // pale color scheme\n // https://cran.r-project.org/web/packages/khroma/vignettes/tol.html\n // e.g. \"tol_light\"\n const colorPalette = [\n '#BBCCEE',\n 'pink',\n '#CCDDAA',\n '#EEEEBB',\n '#FFCCCC',\n 'lightblue',\n 'lightgreen',\n 'tan',\n '#CCEEFF',\n 'lightsalmon',\n ]\n\n uniqueTag.forEach(value => {\n if (!self.colorTagMap.has(value)) {\n const totalKeys = [...self.colorTagMap.keys()].length\n self.colorTagMap.set(value, colorPalette[totalKeys]!)\n }\n })\n },\n\n /**\n * #action\n */\n setFeatureUnderMouse(feat?: Feature) {\n self.featureUnderMouseVolatile = feat\n },\n\n /**\n * #action\n */\n selectFeature(feature: Feature) {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const featureWidget = session.addWidget(\n 'AlignmentsFeatureWidget',\n 'alignmentFeature',\n {\n featureData: feature.toJSON(),\n view: getContainingView(self),\n track: getContainingTrack(self),\n },\n )\n session.showWidget(featureWidget)\n }\n session.setSelection(feature)\n },\n\n /**\n * #action\n * uses copy-to-clipboard and generates notification\n */\n copyFeatureToClipboard(feature: Feature) {\n const { uniqueId, ...rest } = feature.toJSON()\n const session = getSession(self)\n copy(JSON.stringify(rest, null, 4))\n session.notify('Copied to clipboard', 'success')\n },\n\n /**\n * #action\n */\n setConfig(conf: AnyConfigurationModel) {\n self.configuration = conf\n },\n\n /**\n * #action\n */\n setFilterBy(filter: IFilter) {\n self.filterBy = cast(filter)\n },\n\n /**\n * #action\n */\n setJexlFilters(filters: string[]) {\n self.jexlFilters = cast(filters)\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get rendererConfig() {\n const { featureHeight, noSpacing, trackMaxHeight, rendererTypeName } =\n self\n const configBlob = getConf(self, ['renderers', rendererTypeName]) || {}\n return self.rendererType.configSchema.create(\n {\n ...configBlob,\n ...(featureHeight !== undefined ? { height: featureHeight } : {}),\n ...(noSpacing !== undefined ? { noSpacing } : {}),\n ...(trackMaxHeight !== undefined\n ? { maxHeight: trackMaxHeight }\n : {}),\n },\n getEnv(self),\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get maxHeight() {\n return readConfObject(self.rendererConfig, 'maxHeight')\n },\n\n /**\n * #getter\n */\n get featureHeightSetting() {\n return readConfObject(self.rendererConfig, 'height')\n },\n /**\n * #getter\n */\n get featureUnderMouse() {\n return self.featureUnderMouseVolatile\n },\n /**\n * #getter\n */\n renderReady() {\n return self.tagsReady\n },\n /**\n * #getter\n */\n get filters() {\n return new SerializableFilterChain({ filters: self.jexlFilters })\n },\n }))\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderProps: superRenderProps,\n } = self\n\n return {\n /**\n * #getter\n */\n get rendererTypeName() {\n const viewName = getConf(self, 'defaultRendering')\n const rendererType = rendererTypes.get(viewName)\n if (!rendererType) {\n throw new Error(`unknown alignments view name ${viewName}`)\n }\n return rendererType\n },\n\n /**\n * #method\n */\n contextMenuItems() {\n const feat = self.contextMenuFeature\n return feat\n ? [\n {\n label: 'Open feature details',\n icon: MenuOpenIcon,\n onClick: (): void => {\n self.clearFeatureSelection()\n self.selectFeature(feat)\n },\n },\n {\n label: 'Copy info to clipboard',\n icon: ContentCopyIcon,\n onClick: (): void => {\n self.copyFeatureToClipboard(feat)\n },\n },\n ]\n : []\n },\n\n /**\n * #getter\n */\n get DisplayBlurb() {\n return LinearPileupDisplayBlurb\n },\n /**\n * #method\n */\n renderPropsPre() {\n const { colorTagMap, colorBy, filterBy, rpcDriverName } = self\n\n const superProps = superRenderProps()\n return {\n ...superProps,\n notReady: superProps.notReady || !self.renderReady(),\n rpcDriverName,\n displayModel: self,\n colorBy: colorBy ? getSnapshot(colorBy) : undefined,\n filterBy: JSON.parse(JSON.stringify(filterBy)),\n filters: self.filters,\n colorTagMap: Object.fromEntries(colorTagMap.toJSON()),\n config: self.rendererConfig,\n async onFeatureClick(_: unknown, featureId?: string) {\n const session = getSession(self)\n const { rpcManager } = session\n try {\n const f = featureId || self.featureIdUnderMouse\n if (!f) {\n self.clearFeatureSelection()\n } else {\n const sessionId = getRpcSessionId(self)\n const { feature } = (await rpcManager.call(\n sessionId,\n 'CoreGetFeatureDetails',\n {\n featureId: f,\n sessionId,\n layoutId: getContainingView(self).id,\n rendererType: 'PileupRenderer',\n },\n )) as { feature: SimpleFeatureSerialized | undefined }\n\n if (feature) {\n self.selectFeature(new SimpleFeature(feature))\n }\n }\n } catch (e) {\n console.error(e)\n session.notify(`${e}`)\n }\n },\n\n onClick() {\n self.clearFeatureSelection()\n },\n // similar to click but opens a menu with further options\n async onFeatureContextMenu(_: unknown, featureId?: string) {\n const session = getSession(self)\n const { rpcManager } = session\n try {\n const f = featureId || self.featureIdUnderMouse\n if (!f) {\n self.clearFeatureSelection()\n } else {\n const sessionId = getRpcSessionId(self)\n const { feature } = (await rpcManager.call(\n sessionId,\n 'CoreGetFeatureDetails',\n {\n featureId: f,\n sessionId,\n layoutId: getContainingView(self).id,\n rendererType: 'PileupRenderer',\n },\n )) as { feature: SimpleFeatureSerialized | undefined }\n\n if (feature) {\n self.setContextMenuFeature(new SimpleFeature(feature))\n }\n }\n } catch (e) {\n console.error(e)\n session.notify(`${e}`)\n }\n },\n }\n },\n\n /**\n * #method\n */\n colorSchemeSubMenuItems() {\n return [\n {\n label: 'Normal',\n onClick: () => {\n self.setColorScheme({ type: 'normal' })\n },\n },\n {\n label: 'Mapping quality',\n onClick: () => {\n self.setColorScheme({ type: 'mappingQuality' })\n },\n },\n {\n label: 'Strand',\n onClick: () => {\n self.setColorScheme({ type: 'strand' })\n },\n },\n {\n label: 'Per-base quality',\n onClick: () => {\n self.setColorScheme({ type: 'perBaseQuality' })\n },\n },\n {\n label: 'Per-base lettering',\n onClick: () => {\n self.setColorScheme({ type: 'perBaseLettering' })\n },\n },\n {\n label: 'First-of-pair strand',\n onClick: () => {\n self.setColorScheme({ type: 'stranded' })\n },\n },\n {\n label: 'Color by tag...',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ColorByTagDialog,\n {\n model: self,\n handleClose,\n },\n ])\n },\n },\n ]\n },\n\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n\n {\n label: 'Set feature height...',\n priority: 1,\n subMenu: [\n {\n label: 'Normal',\n onClick: () => {\n self.setFeatureHeight(7)\n self.setNoSpacing(false)\n },\n },\n {\n label: 'Compact',\n onClick: () => {\n self.setFeatureHeight(2)\n self.setNoSpacing(true)\n },\n },\n {\n label: 'Manually set height',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetFeatureHeightDialog,\n {\n model: self,\n handleClose,\n },\n ])\n },\n },\n ],\n },\n {\n label: 'Set max height...',\n priority: -1,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetMaxHeightDialog,\n {\n model: self,\n handleClose,\n },\n ])\n },\n },\n {\n label: 'Filter by...',\n icon: FilterListIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n FilterByTagDialog,\n {\n model: self,\n handleClose,\n },\n ])\n },\n },\n ]\n },\n }\n })\n .views(self => ({\n renderProps() {\n return self.renderPropsPre()\n },\n }))\n .actions(self => ({\n afterAttach() {\n createAutorun(\n self,\n async () => {\n const view = getContainingView(self) as LGV\n if (!self.autorunReady) {\n return\n }\n\n const { colorBy, tagsReady } = self\n const { staticBlocks } = view\n if (colorBy?.tag && !tagsReady) {\n const vals = await getUniqueTagValues({\n self,\n tag: colorBy.tag,\n blocks: staticBlocks,\n })\n self.updateColorTagMap(vals)\n }\n self.setTagsReady(true)\n },\n { delay: 1000 },\n )\n\n // autorun synchronizes featureUnderMouse with featureIdUnderMouse\n // asynchronously. this is needed due to how we do not serialize all\n // features from the BAM/CRAM over the rpc\n addDisposer(\n self,\n autorun(async () => {\n const session = getSession(self)\n try {\n const featureId = self.featureIdUnderMouse\n if (self.featureUnderMouse?.id() !== featureId) {\n if (!featureId) {\n self.setFeatureUnderMouse(undefined)\n } else {\n const sessionId = getRpcSessionId(self)\n const view = getContainingView(self)\n const { feature } = (await session.rpcManager.call(\n sessionId,\n 'CoreGetFeatureDetails',\n {\n featureId,\n sessionId,\n layoutId: view.id,\n rendererType: 'PileupRenderer',\n },\n )) as { feature: SimpleFeatureSerialized | undefined }\n\n // check featureIdUnderMouse is still the same as the\n // feature.id that was returned e.g. that the user hasn't\n // moused over to a new position during the async operation\n // above\n if (\n feature &&\n self.featureIdUnderMouse === feature.uniqueId\n ) {\n self.setFeatureUnderMouse(new SimpleFeature(feature))\n }\n }\n }\n } catch (e) {\n console.error(e)\n session.notifyError(`${e}`, e)\n }\n }),\n )\n },\n }))\n}\n","import { lazy } from 'react'\nimport { types, Instance } from 'mobx-state-tree'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n readConfObject,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { getEnv, getSession, getContainingView } from '@jbrowse/core/util'\nimport { getUniqueModificationValues } from '../shared'\n\nimport { createAutorun, randomColor, modificationColors } from '../util'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\n\n// icons\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport SortIcon from '@mui/icons-material/Sort'\nimport WorkspacesIcon from '@mui/icons-material/Workspaces'\nimport ColorLensIcon from '@mui/icons-material/ColorLens'\n\n// locals\nimport { SharedLinearPileupDisplayMixin } from './SharedLinearPileupDisplayMixin'\nimport { observable } from 'mobx'\n\n// lazies\nconst SortByTagDialog = lazy(() => import('./components/SortByTagDialog'))\nconst GroupByDialog = lazy(() => import('./components/GroupByDialog'))\nconst ModificationsDialog = lazy(\n () => import('./components/ColorByModificationsDialog'),\n)\n\ntype LGV = LinearGenomeViewModel\n\n/**\n * #stateModel LinearPileupDisplay\n * #category display\n * extends\n * - [SharedLinearPileupDisplayMixin](../sharedlinearpileupdisplaymixin)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearPileupDisplay',\n SharedLinearPileupDisplayMixin(configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearPileupDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n showSoftClipping: false,\n /**\n * #property\n */\n mismatchAlpha: types.maybe(types.boolean),\n\n /**\n * #property\n */\n sortedBy: types.maybe(\n types.model({\n type: types.string,\n pos: types.number,\n tag: types.maybe(types.string),\n refName: types.string,\n assemblyName: types.string,\n }),\n ),\n }),\n )\n .volatile(() => ({\n sortReady: false,\n currSortBpPerPx: 0,\n modificationTagMap: observable.map<string, string>({}),\n modificationsReady: false,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setCurrSortBpPerPx(n: number) {\n self.currSortBpPerPx = n\n },\n /**\n * #action\n */\n updateModificationColorMap(uniqueModifications: string[]) {\n uniqueModifications.forEach(value => {\n if (!self.modificationTagMap.has(value)) {\n self.modificationTagMap.set(\n value,\n modificationColors[value] || randomColor(),\n )\n }\n })\n },\n /**\n * #action\n */\n setModificationsReady(flag: boolean) {\n self.modificationsReady = flag\n },\n /**\n * #action\n */\n setSortReady(flag: boolean) {\n self.sortReady = flag\n },\n /**\n * #action\n */\n clearSelected() {\n self.sortedBy = undefined\n },\n /**\n * #action\n */\n toggleSoftClipping() {\n self.showSoftClipping = !self.showSoftClipping\n },\n /**\n * #action\n */\n toggleMismatchAlpha() {\n self.mismatchAlpha = !self.mismatchAlpha\n },\n /**\n * #action\n */\n setSortedBy(type: string, tag?: string) {\n const { centerLineInfo } = getContainingView(self) as LGV\n if (!centerLineInfo) {\n return\n }\n const { refName, assemblyName, offset } = centerLineInfo\n const centerBp = Math.round(offset) + 1\n\n if (centerBp < 0 || !refName) {\n return\n }\n\n self.sortReady = false\n self.sortedBy = {\n type,\n pos: centerBp,\n refName,\n assemblyName,\n tag,\n }\n },\n /**\n * #action\n * overrides base from SharedLinearPileupDisplay to make sortReady false\n * since changing feature height destroys the sort-induced layout\n */\n setFeatureHeight(n?: number) {\n self.sortReady = false\n self.featureHeight = n\n },\n }))\n .actions(self => {\n // resets the sort object and refresh whole display on reload\n const superReload = self.reload\n\n return {\n /**\n * #action\n */\n reload() {\n self.clearSelected()\n superReload()\n },\n }\n })\n\n .views(self => ({\n /**\n * #getter\n */\n get rendererConfig() {\n const {\n featureHeight,\n noSpacing,\n trackMaxHeight,\n mismatchAlpha,\n rendererTypeName,\n } = self\n const configBlob = getConf(self, ['renderers', rendererTypeName]) || {}\n return self.rendererType.configSchema.create(\n {\n ...configBlob,\n ...(featureHeight !== undefined ? { height: featureHeight } : {}),\n ...(noSpacing !== undefined ? { noSpacing } : {}),\n ...(mismatchAlpha !== undefined ? { mismatchAlpha } : {}),\n ...(trackMaxHeight !== undefined\n ? { maxHeight: trackMaxHeight }\n : {}),\n },\n getEnv(self),\n )\n },\n }))\n .views(self => {\n const { renderReady: superRenderReady } = self\n return {\n /**\n * #getter\n */\n get mismatchAlphaSetting() {\n return readConfObject(self.rendererConfig, 'mismatchAlpha')\n },\n /**\n * #method\n */\n renderReady() {\n const view = getContainingView(self) as LGV\n return (\n self.modificationsReady &&\n self.currSortBpPerPx === view.bpPerPx &&\n superRenderReady()\n )\n },\n }\n })\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderPropsPre: superRenderPropsPre,\n renderProps: superRenderProps,\n colorSchemeSubMenuItems: superColorSchemeSubMenuItems,\n } = self\n\n return {\n /**\n * #method\n */\n renderPropsPre() {\n const { sortedBy, showSoftClipping, modificationTagMap } = self\n const superProps = superRenderPropsPre()\n return {\n ...superProps,\n showSoftClip: showSoftClipping,\n sortedBy,\n modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),\n }\n },\n /**\n * #method\n */\n renderProps() {\n const { sortReady } = self\n const result = superRenderProps()\n return {\n ...result,\n notReady: result.notReady || !sortReady,\n }\n },\n\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n\n {\n label: 'Sort by...',\n icon: SortIcon,\n disabled: self.showSoftClipping,\n subMenu: [\n ...['Start location', 'Read strand', 'Base pair'].map(\n option => ({\n label: option,\n onClick: () => {\n self.setSortedBy(option)\n },\n }),\n ),\n {\n label: 'Sort by tag...',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SortByTagDialog,\n {\n model: self,\n handleClose,\n },\n ])\n },\n },\n {\n label: 'Clear sort',\n onClick: () => {\n self.clearSelected()\n },\n },\n ],\n },\n {\n label: 'Color by...',\n icon: ColorLensIcon,\n subMenu: [\n {\n label: 'Pair orientation',\n onClick: () => {\n self.setColorScheme({ type: 'pairOrientation' })\n },\n },\n {\n label: 'Modifications or methylation',\n onClick: () => {\n getSession(self).queueDialog(doneCallback => [\n ModificationsDialog,\n {\n model: self,\n handleClose: doneCallback,\n },\n ])\n },\n },\n {\n label: 'Insert size',\n onClick: () => {\n self.setColorScheme({ type: 'insertSize' })\n },\n },\n ...superColorSchemeSubMenuItems(),\n ],\n },\n {\n label: 'Group by...',\n icon: WorkspacesIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n GroupByDialog,\n { model: self, handleClose },\n ])\n },\n },\n {\n label: 'Show soft clipping',\n icon: VisibilityIcon,\n type: 'checkbox',\n checked: self.showSoftClipping,\n onClick: () => {\n self.toggleSoftClipping()\n // if toggling from off to on, will break sort for this track\n // so clear it\n if (self.showSoftClipping) {\n self.clearSelected()\n }\n },\n },\n {\n label: 'Fade mismatches by quality',\n type: 'checkbox',\n checked: self.mismatchAlphaSetting,\n onClick: () => {\n self.toggleMismatchAlpha()\n },\n },\n ] as const\n },\n }\n })\n .actions(self => ({\n afterAttach() {\n createAutorun(\n self,\n async () => {\n const view = getContainingView(self) as LGV\n if (!self.autorunReady) {\n return\n }\n\n self.setCurrSortBpPerPx(view.bpPerPx)\n },\n { delay: 1000 },\n )\n createAutorun(\n self,\n async () => {\n const { rpcManager } = getSession(self)\n const view = getContainingView(self) as LGV\n if (!self.autorunReady) {\n return\n }\n\n const { sortedBy, adapterConfig, rendererType, sortReady } = self\n const { bpPerPx } = view\n\n if (\n sortedBy &&\n (!sortReady || self.currSortBpPerPx === view.bpPerPx)\n ) {\n const { pos, refName, assemblyName } = sortedBy\n // render just the sorted region first\n // @ts-expect-error\n await self.rendererType.renderInClient(rpcManager, {\n assemblyName,\n regions: [\n {\n start: pos,\n end: pos + 1,\n refName,\n assemblyName,\n },\n ],\n adapterConfig,\n rendererType: rendererType.name,\n sessionId: getRpcSessionId(self),\n layoutId: view.id,\n timeout: 1_000_000,\n ...self.renderPropsPre(),\n })\n }\n self.setCurrSortBpPerPx(bpPerPx)\n self.setSortReady(true)\n },\n { delay: 1000 },\n )\n\n createAutorun(self, async () => {\n if (!self.autorunReady) {\n return\n }\n const { parentTrack, colorBy } = self\n const { staticBlocks } = getContainingView(self) as LGV\n if (colorBy?.type === 'modifications') {\n const adapter = getConf(parentTrack, ['adapter'])\n const vals = await getUniqueModificationValues({\n self,\n adapterConfig: adapter,\n blocks: staticBlocks,\n })\n self.updateModificationColorMap(vals)\n }\n self.setModificationsReady(true)\n })\n },\n }))\n}\n\nexport type LinearPileupDisplayStateModel = ReturnType<typeof stateModelFactory>\nexport type LinearPileupDisplayModel = Instance<LinearPileupDisplayStateModel>\nexport default stateModelFactory\n","import configSchemaFactory from './configSchema'\nimport modelFactory from './model'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nexport default function register(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearPileupDisplay',\n displayName: 'Pileup display',\n configSchema,\n stateModel: modelFactory(configSchema),\n subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },\n trackType: 'AlignmentsTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n\nexport { default as linearPileupDisplayStateModelFactory } from './model'\nexport { default as linearPileupDisplayConfigSchemaFactory } from './configSchema'\nexport { SharedLinearPileupDisplayMixin } from './SharedLinearPileupDisplayMixin'\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport BamAdapterF from './CramAdapter'\nimport CramAdapterF from './BamAdapter'\nimport HtsgetBamAdapterF from './HtsgetBamAdapter'\nimport SNPCoverageAdapterF from './SNPCoverageAdapter'\nimport SNPCoverageRendererF from './SNPCoverageRenderer'\nimport PileupRendererF from './PileupRenderer'\nimport LinearAlignmentsDisplayF from './LinearAlignmentsDisplay'\nimport LinearSNPCoverageDisplayF from './LinearSNPCoverageDisplay'\nimport LinearReadArcsDisplayF from './LinearReadArcsDisplay'\nimport LinearReadCloudDisplayF from './LinearReadCloudDisplay'\nimport AlignmentsTrackF from './AlignmentsTrack'\nimport AlignmentsFeatureWidgetF from './AlignmentsFeatureDetail'\nimport PileupRPCMethodsF from './PileupRPC'\nimport GuessAlignmentsTypesF from './GuessAlignmentsTypes'\nimport LinearPileupDisplayF from './LinearPileupDisplay'\n\nexport default class AlignmentsPlugin extends Plugin {\n name = 'AlignmentsPlugin'\n\n install(pluginManager: PluginManager) {\n ;[\n CramAdapterF,\n BamAdapterF,\n LinearPileupDisplayF,\n LinearSNPCoverageDisplayF,\n AlignmentsTrackF,\n SNPCoverageAdapterF,\n HtsgetBamAdapterF,\n PileupRendererF,\n PileupRPCMethodsF,\n SNPCoverageRendererF,\n LinearReadArcsDisplayF,\n LinearReadCloudDisplayF,\n LinearAlignmentsDisplayF,\n AlignmentsFeatureWidgetF,\n GuessAlignmentsTypesF,\n ].map(f => {\n f(pluginManager)\n })\n }\n}\n\nexport {\n linearPileupDisplayStateModelFactory,\n linearPileupDisplayConfigSchemaFactory,\n SharedLinearPileupDisplayMixin,\n} from './LinearPileupDisplay'\nexport { type LinearPileupDisplayModel } from './LinearPileupDisplay/model'\nexport * as MismatchParser from './MismatchParser'\n","import { types, Instance } from 'mobx-state-tree'\n\nimport { orientationTypes, pairMap } from '../util'\nimport { ChainStats } from './fetchChains'\n\nexport const fillColor = {\n color_fwd_strand_not_proper: '#ECC8C8',\n color_rev_strand_not_proper: '#BEBED8',\n color_fwd_strand: '#EC8B8B',\n color_rev_strand: '#8F8FD8',\n color_fwd_missing_mate: '#D11919',\n color_rev_missing_mate: '#1919D1',\n color_fwd_diff_chr: '#000',\n color_rev_diff_chr: '#969696',\n color_pair_lr: '#c8c8c8',\n color_pair_rr: 'navy',\n color_pair_rl: 'teal',\n color_pair_ll: 'green',\n color_nostrand: '#c8c8c8',\n color_interchrom: 'purple',\n color_longinsert: 'red',\n color_shortinsert: 'pink',\n color_unknown: 'grey',\n}\n\n// manually calculated by running\n// const color = require('color')\n// Object.fromEntries(Object.entries(fillColor).map(([key,val])=>{\n// return [key, color(val).darken('0.3').hex()]\n// }))\n// this avoids (expensive) use of Color module at runtime\nexport const strokeColor = {\n color_fwd_strand_not_proper: '#CA6767',\n color_rev_strand_not_proper: '#7272AA',\n color_fwd_strand: '#DC2A2A',\n color_rev_strand: '#4141BA',\n color_fwd_missing_mate: '#921111',\n color_rev_missing_mate: '#111192',\n color_fwd_diff_chr: '#000000',\n color_rev_diff_chr: '#696969',\n color_pair_lr: '#8C8C8C',\n color_pair_rr: '#00005A',\n color_pair_rl: '#005A5A',\n color_pair_ll: '#005A00',\n color_nostrand: '#8C8C8C',\n color_interchrom: '#5A005A',\n color_longinsert: '#B30000',\n color_shortinsert: '#FF3A5C',\n color_unknown: 'grey',\n}\n\nexport function getPairedInsertSizeColor(\n f1: { refName: string; tlen?: number },\n f2: { refName: string },\n stats?: ChainStats,\n) {\n const sameRef = f1.refName === f2.refName\n const tlen = Math.abs(f1.tlen || 0)\n if (sameRef && tlen > (stats?.upper || 0)) {\n return [fillColor.color_longinsert, strokeColor.color_longinsert] as const\n } else if (sameRef && tlen < (stats?.lower || 0)) {\n return [fillColor.color_shortinsert, strokeColor.color_shortinsert] as const\n } else if (!sameRef) {\n return [fillColor.color_interchrom, strokeColor.color_interchrom] as const\n } else {\n return undefined\n }\n}\n\nconst defaultColor = [fillColor.color_unknown, fillColor.color_unknown] as const\n\n// return color scheme with both insert size and orientation coloring,\n// prioritzing orientation coloring\nexport function getPairedInsertSizeAndOrientationColor(\n f1: { refName: string; pair_orientation?: string; tlen?: number },\n f2: { refName: string },\n stats?: ChainStats,\n) {\n return (\n getPairedOrientationColorOrDefault(f1) ||\n getPairedInsertSizeColor(f1, f2, stats) ||\n defaultColor\n )\n}\n\nexport function getPairedOrientationColorOrDefault(f: {\n pair_orientation?: string\n}) {\n const type = orientationTypes.fr\n const r = type[f.pair_orientation || ''] as keyof typeof pairMap\n const type2 = pairMap[r] as keyof typeof fillColor\n return r === 'LR'\n ? undefined\n : ([fillColor[type2], strokeColor[type2]] as const)\n}\n\nexport function getPairedOrientationColor(f: { pair_orientation?: string }) {\n return getPairedOrientationColorOrDefault(f) || defaultColor\n}\n\nexport interface ExtraColorBy {\n custom?: Record<string, string>\n}\n\nexport const ColorByModel = types.maybe(\n types.model({\n type: types.string,\n tag: types.maybe(types.string),\n extra: types.frozen(),\n }),\n)\n\nexport type IColorByModel = Instance<typeof ColorByModel>\n","import { types, IAnyStateTreeNode } from 'mobx-state-tree'\nimport { BlockSet } from '@jbrowse/core/util/blockTypes'\nimport { getSession } from '@jbrowse/core/util'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\nexport async function getUniqueTagValues({\n self,\n tag,\n blocks,\n opts,\n}: {\n self: IAnyStateTreeNode & { adapterConfig: AnyConfigurationModel }\n tag: string\n blocks: BlockSet\n opts?: {\n headers?: Record<string, string>\n signal?: AbortSignal\n filters: string[]\n }\n}) {\n const { rpcManager } = getSession(self)\n const { adapterConfig } = self\n const sessionId = getRpcSessionId(self)\n const values = await rpcManager.call(\n getRpcSessionId(self),\n 'PileupGetGlobalValueForTag',\n {\n adapterConfig,\n tag,\n sessionId,\n regions: blocks.contentBlocks,\n ...opts,\n },\n )\n return values as string[]\n}\n\ntype Track = IAnyStateTreeNode & { configuration: AnyConfigurationModel }\n\nexport async function getUniqueModificationValues({\n self,\n adapterConfig,\n blocks,\n opts,\n}: {\n self: IAnyStateTreeNode & {\n parentTrack: Track\n }\n adapterConfig: AnyConfigurationModel\n blocks: BlockSet\n opts?: {\n headers?: Record<string, string>\n signal?: AbortSignal\n filters: string[]\n }\n}) {\n const { rpcManager } = getSession(self)\n const sessionId = getRpcSessionId(self)\n const values = await rpcManager.call(\n sessionId,\n 'PileupGetVisibleModifications',\n {\n adapterConfig,\n sessionId,\n regions: blocks.contentBlocks,\n ...opts,\n },\n )\n return values as string[]\n}\n\nexport const FilterModel = types.model({\n flagInclude: types.optional(types.number, 0),\n flagExclude: types.optional(types.number, 1540),\n readName: types.maybe(types.string),\n tagFilter: types.maybe(\n types.model({\n tag: types.string,\n value: types.maybe(types.string),\n }),\n ),\n})\n\nexport interface IFilter {\n flagExclude: number\n flagInclude: number\n readName?: string\n tagFilter?: {\n tag: string\n value?: string\n }\n}\n","import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { Feature, AugmentedRegion } from '@jbrowse/core/util'\nimport { toArray } from 'rxjs/operators'\nimport { firstValueFrom } from 'rxjs'\nimport { IAnyStateTreeNode, addDisposer, isAlive } from 'mobx-state-tree'\nimport { IAutorunOptions, autorun } from 'mobx'\n\n// get tag from BAM or CRAM feature, where CRAM uses feature.get('tags') and\n// BAM does not\nexport function getTag(feature: Feature, tag: string) {\n const tags = feature.get('tags')\n return tags !== undefined ? tags[tag] : feature.get(tag)\n}\n\n// use fallback alt tag, used in situations where upper case/lower case tags\n// exist e.g. Mm/MM for base modifications\nexport function getTagAlt(feature: Feature, tag: string, alt: string) {\n return getTag(feature, tag) ?? getTag(feature, alt)\n}\n\n// orientation definitions from igv.js, see also\n// https://software.broadinstitute.org/software/igv/interpreting_pair_orientations\nexport const orientationTypes = {\n fr: {\n F1R2: 'LR',\n F2R1: 'LR',\n\n F1F2: 'LL',\n F2F1: 'LL',\n\n R1R2: 'RR',\n R2R1: 'RR',\n\n R1F2: 'RL',\n R2F1: 'RL',\n } as Record<string, string>,\n\n rf: {\n R1F2: 'LR',\n R2F1: 'LR',\n\n R1R2: 'LL',\n R2R1: 'LL',\n\n F1F2: 'RR',\n F2F1: 'RR',\n\n F1R2: 'RL',\n F2R1: 'RL',\n } as Record<string, string>,\n\n ff: {\n F2F1: 'LR',\n R1R2: 'LR',\n\n F2R1: 'LL',\n R1F2: 'LL',\n\n R2F1: 'RR',\n F1R2: 'RR',\n\n R2R1: 'RL',\n F1F2: 'RL',\n } as Record<string, string>,\n}\n\nexport const pairMap = {\n LR: 'color_pair_lr',\n LL: 'color_pair_ll',\n RR: 'color_pair_rr',\n RL: 'color_pair_rl',\n} as const\n\nexport function getColorWGBS(strand: number, base: string) {\n if (strand === 1) {\n if (base === 'C') {\n return '#f00'\n }\n if (base === 'T') {\n return '#00f'\n }\n } else if (strand === -1) {\n if (base === 'G') {\n return '#f00'\n }\n if (base === 'A') {\n return '#00f'\n }\n }\n return '#888'\n}\n\n// fetches region sequence augmenting by +/- 1bp for CpG on either side of\n// requested region\nexport async function fetchSequence(\n region: AugmentedRegion,\n adapter: BaseFeatureDataAdapter,\n) {\n const { start, end, originalRefName, refName } = region\n\n const feats = await firstValueFrom(\n adapter\n .getFeatures({\n ...region,\n refName: originalRefName || refName,\n end: end + 1,\n start: Math.max(0, start - 1),\n })\n .pipe(toArray()),\n )\n return feats[0]?.get('seq')\n}\n\n// has to check underlying C-G (aka CpG) on the reference sequence\nexport function shouldFetchReferenceSequence(type?: string) {\n return type === 'methylation'\n}\n\n// adapted from IGV\n// https://github.com/igvteam/igv/blob/e803e3af2d8c9ea049961dfd4628146bdde9a574/src/main/java/org/broad/igv/sam/mods/BaseModificationColors.java#L27\nexport const modificationColors = {\n m: 'rgb(255,0,0)',\n h: 'rgb(11, 132, 165)',\n o: 'rgb(111, 78, 129)',\n f: 'rgb(246, 200, 95)',\n c: 'rgb(157, 216, 102)',\n g: 'rgb(255, 160, 86)',\n e: 'rgb(141, 221, 208)',\n b: 'rgb(202, 71, 47)',\n} as Record<string, string>\n\ntype DisplayModel = IAnyStateTreeNode & { setError: (arg: unknown) => void }\n\nexport function createAutorun(\n self: DisplayModel,\n cb: () => Promise<void>,\n opts?: IAutorunOptions,\n) {\n addDisposer(\n self,\n autorun(async () => {\n try {\n await cb()\n } catch (e) {\n if (isAlive(self)) {\n self.setError(e)\n }\n }\n }, opts),\n )\n}\nexport function randomColor() {\n return `hsl(${Math.random() * 200}, 50%, 50%)`\n}\n","import { useState, useEffect } from 'react'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport { clamp } from '@jbrowse/core/util'\n\n// locals\nimport { LayoutRecord } from './model'\n\ntype LGV = LinearGenomeViewModel\n\ninterface Display {\n height: number\n scrollTop: number\n SNPCoverageDisplay?: { height: number }\n}\n\ninterface Track {\n displays: Display[]\n}\n\nconst [, TOP, , BOTTOM] = [0, 1, 2, 3] as const\n\nfunction cheight(chunk: LayoutRecord) {\n return chunk[BOTTOM] - chunk[TOP]\n}\n\nexport function heightFromSpecificLevel(\n views: LGV[],\n trackId: string,\n level: number,\n getYPosOverride?: (trackId: string, level: number) => number,\n) {\n return getYPosOverride\n ? getYPosOverride(trackId, level)\n : views[level]!.trackRefs[trackId]?.getBoundingClientRect().top || 0\n}\n\nexport function getPxFromCoordinate(view: LGV, refName: string, coord: number) {\n return (view.bpToPx({ refName, coord })?.offsetPx || 0) - view.offsetPx\n}\n\n// get's the yposition of a layout record in a track\nexport function yPos(\n trackId: string,\n level: number,\n views: LGV[],\n tracks: Track[],\n c: LayoutRecord,\n getYPosOverride?: (trackId: string, level: number) => number,\n) {\n const display = tracks[level]!.displays[0]!\n const min = 0\n const max = display.height\n let offset = 0\n const { SNPCoverageDisplay } = display\n if (SNPCoverageDisplay) {\n offset = SNPCoverageDisplay.height\n }\n const yPos = getYPosOverride ? 0 : display.scrollTop\n return (\n clamp(c[TOP] - yPos + cheight(c) / 2 + offset, min, max) +\n heightFromSpecificLevel(views, trackId, level, getYPosOverride) +\n display.scrollTop\n )\n}\n\n// we combo a useEffect and useState combo to force rerender on snap changing.\n// the setup of this being a useEffect+useState makes it re-render once the\n// useEffect is called, which is generally the \"next frame\". If we removed the\n// below use\nexport const useNextFrame = (variable: unknown) => {\n const [, setNextFrameState] = useState<unknown>()\n useEffect(() => {\n setNextFrameState(variable)\n }, [variable])\n}\n\n// https://stackoverflow.com/a/49186706/2129219 the array-intersection package\n// on npm has a large kb size, and we are just intersecting open track ids so\n// simple is better\nexport function intersect<T>(\n cb: (l: T) => string,\n a1: T[] = [],\n a2: T[] = [],\n ...rest: T[][]\n): T[] {\n const ids = new Set(a2.map(elt => cb(elt)))\n const a12 = a1.filter(value => ids.has(cb(value)))\n return rest.length === 0 ? a12 : intersect(cb, a12, ...rest)\n}\n","function findCircleIntersectionX(\n y: number,\n cx: number,\n cy: number,\n r: number,\n resultArray: [number, number][],\n) {\n const d = Math.abs(y - cy)\n if (d > r) {\n return\n }\n if (d === r) {\n resultArray.push([cx, y])\n }\n const solution = Math.sqrt(r * r - d * d)\n resultArray.push([cx - solution, y], [cx + solution, y])\n}\n\nfunction findCircleIntersectionY(\n x: number,\n cx: number,\n cy: number,\n r: number,\n resultArray: [number, number][],\n) {\n const d = Math.abs(x - cx)\n if (d > r) {\n return\n }\n if (d === r) {\n resultArray.push([x, cy])\n }\n const solution = Math.sqrt(r * r - d * d)\n resultArray.push([x, cy - solution], [x, cy + solution])\n}\n\nfunction cartesianToTheta(x: number, y: number) {\n let theta = (Math.atan(y / x) + 2 * Math.PI) % (2 * Math.PI)\n if (x < 0) {\n if (y <= 0) {\n theta += Math.PI\n } else {\n theta -= Math.PI\n }\n }\n return theta\n}\n\nexport function cartesianToPolar(x: number, y: number) {\n const rho = Math.sqrt(x * x + y * y)\n if (rho === 0) {\n return [0, 0] as const\n }\n const theta = cartesianToTheta(x, y)\n return [rho, theta] as const\n}\n\nconst twoPi = 2 * Math.PI\nexport function thetaRangesOverlap(\n r1start: number,\n r1length: number,\n r2start: number,\n r2length: number,\n) {\n if (r1length <= 0 || r2length <= 0) {\n return false\n }\n if (r1length + 0.0001 >= twoPi || r2length + 0.0001 >= twoPi) {\n return true\n }\n\n // put both range starts between 2π and 4π\n r1start = (((r1start % twoPi) + twoPi) % twoPi) + twoPi\n r2start = (((r2start % twoPi) + twoPi) % twoPi) + twoPi\n\n if (r1start < r2start + r2length && r1start + r1length > r2start) {\n return true\n }\n\n // move r2 2π to the left and check\n r2start -= twoPi\n if (r1start < r2start + r2length && r1start + r1length > r2start) {\n return true\n }\n\n // move it 2π to the right and check\n r2start += twoPi + twoPi\n return r1start < r2start + r2length && r1start + r1length > r2start\n}\n\n// return which arc range has any part of the circle visible in the viewport\nexport function viewportVisibleSection(\n viewSides: [number, number, number, number],\n circleCenter: [number, number],\n circleRadius: number,\n) {\n let [viewL, viewR, viewT, viewB] = viewSides\n const [cx, cy] = circleCenter\n\n // transform coordinate system to center of circle\n viewL -= cx\n viewR -= cx\n viewT -= cy\n viewB -= cy\n\n const centerIsInsideViewport =\n viewL < 0 && viewR > 0 && viewT < 0 && viewB > 0\n\n if (centerIsInsideViewport) {\n const vertices = [\n [viewL, viewT],\n [viewR, viewT],\n [viewL, viewB],\n [viewR, viewB],\n ] as const\n let maxRho = Number.NEGATIVE_INFINITY\n for (const [x, y] of vertices) {\n const rho = Math.sqrt(x * x + y * y)\n if (rho > maxRho) {\n maxRho = rho\n }\n }\n return {\n rho: [0, Math.min(circleRadius, maxRho)] as [number, number],\n theta: [0, 2 * Math.PI] as [number, number],\n }\n }\n // const viewportCompletelyContainsCircle =\n // circleCenter[0] - viewL >= circleRadius &&\n // viewR - circleCenter[0] >= circleRadius &&\n // circleCenter[1] - viewT >= circleRadius &&\n // viewB - circleCenter[1] >= circleRadius\n\n // if (viewportCompletelyContainsCircle) {\n // return [0, 2 * Math.PI]\n // }\n\n // const distToCenterSquared = ([x, y]) => {\n // const [cx, cy] = circleCenter\n // const sq = n => n * n\n // return sq(x - cx) + sq(y - cy)\n // }\n // const circleRadiusSquared = circleRadius * circleRadius\n\n // const tlInside = distToCenterSquared([viewL, viewT]) <= circleRadiusSquared\n // const trInside = distToCenterSquared([viewR, viewT]) <= circleRadiusSquared\n // const blInside = distToCenterSquared([viewL, viewB]) <= circleRadiusSquared\n // const brInside = distToCenterSquared([viewR, viewB]) <= circleRadiusSquared\n\n // const noIntersection = !tlInside && !trInside && !blInside && !brInside\n // if (noIntersection) return undefined\n\n // const circleCompletelyContainsViewport =\n // tlInside && trInside && blInside && brInside\n // if (circleCompletelyContainsViewport) {\n // // viewport is in the circle, but the center is not in it, so take max\n // // and min of thetas to the center\n // const thetas = [\n // Math.atan(viewT / viewL),\n // Math.atan(viewT / viewR),\n // Math.atan(viewB / viewL),\n // Math.atan(viewB / viewR),\n // ]\n\n // return [Math.min(...thetas), Math.max(...thetas)]\n // }\n\n // if we get here, the viewport is partly in, partly out of the circle\n\n // const viewLIntersects = Math.abs(viewL - circleCenter[0]) <= circleRadius\n // const viewRIntersects = Math.abs(viewR - circleCenter[0]) <= circleRadius\n // const viewTIntersects = Math.abs(viewT - circleCenter[1]) <= circleRadius\n // const viewBIntersects = Math.abs(viewB - circleCenter[1]) <= circleRadius\n\n // const numIntersectingSides =\n // Number(viewLIntersects) +\n // Number(viewRIntersects) +\n // Number(viewTIntersects) +\n // Number(viewBIntersects)\n\n // if (numIntersectingSides === 4) return [0, 2 * Math.PI]\n // if (numIntersectingSides === 3) {\n // // TODO calculate the thetas of the\n // } else if (numIntersectingSides === 2) {\n // // TODO calculate the thetas of the 2 intersection points\n // } else if (numIntersectingSides === 1) {\n // // TODO calculate the thetas of the 1-2 intersection points of the line, and the angle between\n // }\n\n // make a list of vertices-of-interest that lie inside both shapes to examine\n // to determine the range covered by their intersection\n\n // transform coordinates to have the circle as the origin and find the intersections\n // of the circle and the view rectangle\n const vertices: [number, number][] = [\n [viewL, viewT],\n [viewR, viewT],\n [viewL, viewB],\n [viewR, viewB],\n ]\n findCircleIntersectionY(viewL, 0, 0, circleRadius, vertices)\n findCircleIntersectionY(viewR, 0, 0, circleRadius, vertices)\n findCircleIntersectionX(viewT, 0, 0, circleRadius, vertices)\n findCircleIntersectionX(viewB, 0, 0, circleRadius, vertices)\n\n // for each edge, also look at the closest point to center if it is inside the circle\n if (-viewL < circleRadius) {\n vertices.push([viewL, 0])\n }\n if (viewR < circleRadius) {\n vertices.push([viewR, 0])\n }\n if (-viewT < circleRadius) {\n vertices.push([0, viewT])\n }\n if (viewB < circleRadius) {\n vertices.push([0, viewB])\n }\n\n // const verticesOriginal = vertices.map(([x, y]) => [x + cx, y + cy])\n\n // now convert them all to polar and take the max and min of rho and theta\n\n // const viewportCenterTheta = cartesianToTheta(viewR + viewL, viewT + viewB)\n const reflect = viewL >= 0 ? -1 : 1\n // viewportCenterTheta < Math.PI / 2 || viewportCenterTheta > 1.5 * Math.PI\n // ? -1\n // : 1\n let rhoMin = Number.POSITIVE_INFINITY\n let rhoMax = Number.NEGATIVE_INFINITY\n let thetaMin = Number.POSITIVE_INFINITY\n let thetaMax = Number.NEGATIVE_INFINITY\n for (const [vx, vy] of vertices) {\n // ignore vertex if outside the viewport\n if (vx >= viewL && vx <= viewR && vy >= viewT && vy <= viewB) {\n const [rho, theta] = cartesianToPolar(vx * reflect, vy * reflect)\n // ignore vertex if outside the circle\n if (rho <= circleRadius + 0.001) {\n // ignore theta if rho is 0\n if (theta < thetaMin && rho > 0.0001) {\n thetaMin = theta\n }\n if (theta > thetaMax && rho > 0.0001) {\n thetaMax = theta\n }\n if (rho < rhoMin) {\n rhoMin = rho\n }\n if (rho > rhoMax) {\n rhoMax = rho\n }\n }\n }\n }\n\n if (reflect === -1) {\n thetaMin += Math.PI\n thetaMax += Math.PI\n }\n\n if (thetaMin > 2 * Math.PI && thetaMax > 2 * Math.PI) {\n thetaMin -= 2 * Math.PI\n thetaMax -= 2 * Math.PI\n }\n\n return {\n rho: [rhoMin, Math.min(circleRadius, rhoMax)] as [number, number],\n theta: [thetaMin, thetaMax] as [number, number],\n }\n}\n","import { polarToCartesian, assembleLocString, Region } from '@jbrowse/core/util'\nimport { thetaRangesOverlap } from './viewportVisibleRegion'\n\nexport interface SliceElidedRegion {\n elided: true\n widthBp: number\n regions: Region[]\n}\n\nexport interface SliceNonElidedRegion {\n elided: false\n widthBp: number\n start: number\n end: number\n refName: string\n assemblyName: string\n}\nexport type SliceRegion = SliceNonElidedRegion | SliceElidedRegion\n\nexport class Slice {\n key: string\n\n startRadians: number\n\n endRadians: number\n\n bpPerRadian: number\n\n flipped: boolean\n\n constructor(\n view: { bpPerRadian: number },\n public region: SliceRegion,\n public offsetRadians: number,\n public radianWidth: number,\n ) {\n const { bpPerRadian } = view\n this.key =\n 'regions' in region\n ? JSON.stringify(region.regions)\n : assembleLocString(region)\n this.bpPerRadian = bpPerRadian\n this.flipped = false\n\n this.startRadians = offsetRadians\n this.endRadians = region.widthBp / this.bpPerRadian + offsetRadians\n Object.freeze(this)\n }\n\n bpToXY(bp: number, radiusPx: number) {\n let offsetBp: number | undefined\n if (this.region.elided) {\n offsetBp = this.region.widthBp / 2\n } else if (this.flipped) {\n offsetBp = this.region.end - bp\n } else {\n offsetBp = bp - this.region.start\n }\n const totalRadians = offsetBp / this.bpPerRadian + this.offsetRadians\n return polarToCartesian(radiusPx, totalRadians)\n }\n\n toJSON() {\n return Object.fromEntries(Object.entries(this))\n }\n}\n\nfunction calculateStaticSlices(self: {\n elidedRegions: readonly SliceRegion[]\n bpPerRadian: number\n spacingPx: number\n pxPerRadian: number\n}) {\n const slices = []\n let currentRadianOffset = 0\n const { bpPerRadian, spacingPx, pxPerRadian } = self\n for (const region of self.elidedRegions) {\n const radianWidth = region.widthBp / bpPerRadian + spacingPx / pxPerRadian\n slices.push(new Slice(self, region, currentRadianOffset, radianWidth))\n currentRadianOffset += radianWidth\n }\n return slices\n}\n\nfunction sliceIsVisible(\n self: { offsetRadians: number; visibleSection: { theta: [number, number] } },\n slice: Slice,\n) {\n const {\n theta: [visibleThetaMin, visibleThetaMax],\n } = self.visibleSection\n\n return thetaRangesOverlap(\n slice.offsetRadians + self.offsetRadians,\n slice.radianWidth,\n visibleThetaMin,\n visibleThetaMax - visibleThetaMin,\n )\n}\n\nexport { calculateStaticSlices, sliceIsVisible }\n","import React, { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport {\n cast,\n getRoot,\n resolveIdentifier,\n types,\n SnapshotOrInstance,\n Instance,\n} from 'mobx-state-tree'\nimport { Region } from '@jbrowse/core/util/types/mst'\nimport { transaction } from 'mobx'\nimport { saveAs } from 'file-saver'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport {\n getSession,\n clamp,\n isSessionModelWithWidgets,\n} from '@jbrowse/core/util'\nimport { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'\n\n// icons\nimport { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\nimport PhotoCameraIcon from '@mui/icons-material/PhotoCamera'\n\n// locals\nimport { calculateStaticSlices, sliceIsVisible, SliceRegion } from './slices'\nimport { viewportVisibleSection } from './viewportVisibleRegion'\n\n// lazies\nconst ExportSvgDialog = lazy(() => import('../components/ExportSvgDialog'))\n\nexport interface ExportSvgOptions {\n rasterizeLayers?: boolean\n filename?: string\n Wrapper?: React.FC<{ children: React.ReactNode }>\n themeName?: string\n}\n\n/**\n * #stateModel CircularView\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nfunction stateModelFactory(pluginManager: PluginManager) {\n const minHeight = 40\n const minWidth = 100\n const defaultHeight = 400\n return types\n .compose(\n 'CircularView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n type: types.literal('CircularView'),\n /**\n * #property\n * similar to offsetPx in linear genome view\n */\n offsetRadians: -Math.PI / 2,\n /**\n * #property\n */\n bpPerPx: 200,\n /**\n * #property\n */\n tracks: types.array(\n pluginManager.pluggableMstType('track', 'stateModel'),\n ),\n\n /**\n * #property\n */\n hideVerticalResizeHandle: false,\n /**\n * #property\n */\n hideTrackSelectorButton: false,\n /**\n * #property\n */\n lockedFitToWindow: true,\n /**\n * #property\n */\n disableImportForm: false,\n\n /**\n * #property\n */\n height: types.optional(\n types.refinement('trackHeight', types.number, n => n >= minHeight),\n defaultHeight,\n ),\n /**\n * #property\n */\n displayedRegions: types.array(Region),\n /**\n * #property\n */\n scrollX: 0,\n /**\n * #property\n */\n scrollY: 0,\n\n /**\n * #property\n */\n minimumRadiusPx: 25,\n /**\n * #property\n */\n spacingPx: 10,\n /**\n * #property\n */\n paddingPx: 80,\n /**\n * #property\n */\n lockedPaddingPx: 100,\n /**\n * #property\n */\n minVisibleWidth: 6,\n /**\n * #property\n */\n minimumBlockWidth: 20,\n /**\n * #property\n */\n trackSelectorType: 'hierarchical',\n }),\n )\n .volatile(() => ({\n volatileWidth: undefined as number | undefined,\n error: undefined as unknown,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get width() {\n if (self.volatileWidth === undefined) {\n throw new Error(\n 'wait for view to be initialized first before accessing width',\n )\n }\n return self.volatileWidth\n },\n\n /**\n * #getter\n */\n get visibleSection() {\n const { scrollX, scrollY, width, height } = self\n return viewportVisibleSection(\n [scrollX, scrollX + width, scrollY, scrollY + height],\n this.centerXY,\n this.radiusPx,\n )\n },\n /**\n * #getter\n */\n get circumferencePx() {\n let elidedBp = 0\n\n for (const r of this.elidedRegions) {\n elidedBp += r.widthBp\n }\n return (\n elidedBp / self.bpPerPx + self.spacingPx * this.elidedRegions.length\n )\n },\n /**\n * #getter\n */\n get radiusPx() {\n return this.circumferencePx / (2 * Math.PI)\n },\n /**\n * #getter\n */\n get bpPerRadian() {\n return self.bpPerPx * this.radiusPx\n },\n /**\n * #getter\n */\n get pxPerRadian() {\n return this.radiusPx\n },\n /**\n * #getter\n */\n get centerXY(): [number, number] {\n return [this.radiusPx + self.paddingPx, this.radiusPx + self.paddingPx]\n },\n /**\n * #getter\n */\n get totalBp() {\n let total = 0\n for (const region of self.displayedRegions) {\n total += region.end - region.start\n }\n return total\n },\n /**\n * #getter\n */\n get maximumRadiusPx() {\n return self.lockedFitToWindow\n ? Math.min(self.width, self.height) / 2 - self.lockedPaddingPx\n : 1000000\n },\n /**\n * #getter\n */\n get maxBpPerPx() {\n const minCircumferencePx = 2 * Math.PI * self.minimumRadiusPx\n return this.totalBp / minCircumferencePx\n },\n /**\n * #getter\n */\n get minBpPerPx() {\n // min depends on window dimensions, clamp between old min(0.01) and max\n const maxCircumferencePx = 2 * Math.PI * this.maximumRadiusPx\n return clamp(\n this.totalBp / maxCircumferencePx,\n 0.0000000001,\n this.maxBpPerPx,\n )\n },\n /**\n * #getter\n */\n get atMaxBpPerPx() {\n return self.bpPerPx >= this.maxBpPerPx\n },\n /**\n * #getter\n */\n get atMinBpPerPx() {\n return self.bpPerPx <= this.minBpPerPx\n },\n /**\n * #getter\n */\n get tooSmallToLock() {\n return this.minBpPerPx <= 0.0000000001\n },\n /**\n * #getter\n */\n get figureDimensions(): [number, number] {\n return [\n this.radiusPx * 2 + 2 * self.paddingPx,\n this.radiusPx * 2 + 2 * self.paddingPx,\n ]\n },\n /**\n * #getter\n */\n get figureWidth() {\n return this.figureDimensions[0]\n },\n /**\n * #getter\n */\n get figureHeight() {\n return this.figureDimensions[1]\n },\n /**\n * #getter\n * this is displayedRegions, post-processed to elide regions that are too\n * small to see reasonably\n */\n get elidedRegions() {\n const visible: SliceRegion[] = []\n self.displayedRegions.forEach(region => {\n const widthBp = region.end - region.start\n const widthPx = widthBp / self.bpPerPx\n if (widthPx < self.minVisibleWidth) {\n // too small to see, collapse into a single elision region\n const lastVisible = visible.at(-1)\n if (lastVisible?.elided) {\n lastVisible.regions.push({ ...region })\n lastVisible.widthBp += widthBp\n } else {\n visible.push({\n elided: true,\n widthBp,\n regions: [{ ...region }],\n })\n }\n } else {\n // big enough to see, display it\n visible.push({ ...region, widthBp, elided: false })\n }\n })\n\n // remove any single-region elisions\n for (let i = 0; i < visible.length; i += 1) {\n const v = visible[i]!\n if (v.elided && v.regions.length === 1) {\n visible[i] = { ...v, ...v.regions[0]!, elided: false }\n }\n }\n return visible\n },\n /**\n * #getter\n */\n get assemblyNames() {\n const assemblyNames: string[] = []\n self.displayedRegions.forEach(displayedRegion => {\n if (!assemblyNames.includes(displayedRegion.assemblyName)) {\n assemblyNames.push(displayedRegion.assemblyName)\n }\n })\n return assemblyNames\n },\n /**\n * #getter\n */\n get initialized() {\n const { assemblyManager } = getSession(self)\n return (\n self.volatileWidth !== undefined &&\n this.assemblyNames.every(a => assemblyManager.get(a)?.initialized)\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get staticSlices() {\n return calculateStaticSlices(self)\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get visibleStaticSlices() {\n return self.staticSlices.filter(s => sliceIsVisible(self, s))\n },\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.volatileWidth = Math.max(newWidth, minWidth)\n return self.volatileWidth\n },\n /**\n * #action\n */\n setHeight(newHeight: number) {\n self.height = Math.max(newHeight, minHeight)\n return self.height\n },\n /**\n * #action\n */\n resizeHeight(distance: number) {\n const oldHeight = self.height\n const newHeight = this.setHeight(self.height + distance)\n this.setModelViewWhenAdjust(!self.tooSmallToLock)\n return newHeight - oldHeight\n },\n /**\n * #action\n */\n resizeWidth(distance: number) {\n const oldWidth = self.width\n const newWidth = this.setWidth(self.width + distance)\n this.setModelViewWhenAdjust(!self.tooSmallToLock)\n return newWidth - oldWidth\n },\n /**\n * #action\n */\n rotateClockwiseButton() {\n this.rotateClockwise(Math.PI / 6)\n },\n\n /**\n * #action\n */\n rotateCounterClockwiseButton() {\n this.rotateCounterClockwise(Math.PI / 6)\n },\n\n /**\n * #action\n */\n rotateClockwise(distance = 0.17) {\n self.offsetRadians += distance\n },\n\n /**\n * #action\n */\n rotateCounterClockwise(distance = 0.17) {\n self.offsetRadians -= distance\n },\n\n /**\n * #action\n */\n zoomInButton() {\n this.setBpPerPx(self.bpPerPx / 1.4)\n },\n\n /**\n * #action\n */\n zoomOutButton() {\n this.setBpPerPx(self.bpPerPx * 1.4)\n },\n\n /**\n * #action\n */\n setBpPerPx(newVal: number) {\n self.bpPerPx = clamp(newVal, self.minBpPerPx, self.maxBpPerPx)\n },\n\n /**\n * #action\n */\n setModelViewWhenAdjust(secondCondition: boolean) {\n if (self.lockedFitToWindow && secondCondition) {\n this.setBpPerPx(self.minBpPerPx)\n }\n },\n\n /**\n * #action\n */\n setDisplayedRegions(regions: SnapshotOrInstance<typeof Region>[]) {\n const previouslyEmpty = self.displayedRegions.length === 0\n self.displayedRegions = cast(regions)\n\n if (previouslyEmpty) {\n this.setBpPerPx(self.minBpPerPx)\n } else {\n this.setBpPerPx(self.bpPerPx)\n }\n },\n\n /**\n * #action\n */\n activateTrackSelector() {\n if (self.trackSelectorType === 'hierarchical') {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const selector = session.addWidget(\n 'HierarchicalTrackSelectorWidget',\n 'hierarchicalTrackSelector',\n { view: self },\n )\n session.showWidget(selector)\n return selector\n }\n }\n throw new Error(`invalid track selector type ${self.trackSelectorType}`)\n },\n\n /**\n * #action\n */\n toggleTrack(trackId: string) {\n const hiddenCount = this.hideTrack(trackId)\n if (!hiddenCount) {\n this.showTrack(trackId)\n return true\n }\n return false\n },\n\n /**\n * #action\n */\n setError(error: unknown) {\n self.error = error\n },\n\n /**\n * #action\n */\n showTrack(trackId: string, initialSnapshot = {}) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n const trackType = pluginManager.getTrackType(conf.type)\n if (!trackType) {\n throw new Error(`unknown track type ${conf.type}`)\n }\n const viewType = pluginManager.getViewType(self.type)!\n const supportedDisplays = new Set(\n viewType.displayTypes.map(d => d.name),\n )\n const displayConf = conf.displays.find((d: AnyConfigurationModel) =>\n supportedDisplays.has(d.type),\n )\n const track = trackType.stateModel.create({\n ...initialSnapshot,\n type: conf.type,\n configuration: conf,\n displays: [{ type: displayConf.type, configuration: displayConf }],\n })\n self.tracks.push(track)\n },\n\n /**\n * #action\n */\n addTrackConf(configuration: AnyConfigurationModel, initialSnapshot = {}) {\n const { type } = configuration\n const name = readConfObject(configuration, 'name')\n const trackType = pluginManager.getTrackType(type)\n if (!trackType) {\n throw new Error(`unknown track type ${type}`)\n }\n const viewType = pluginManager.getViewType(self.type)!\n const supportedDisplays = new Set(\n viewType.displayTypes.map(d => d.name),\n )\n const displayConf = configuration.displays.find(\n (d: AnyConfigurationModel) => supportedDisplays.has(d.type),\n )\n self.tracks.push(\n trackType.stateModel.create({\n ...initialSnapshot,\n name,\n type,\n configuration,\n displays: [{ type: displayConf.type, configuration: displayConf }],\n }),\n )\n },\n\n /**\n * #action\n */\n hideTrack(trackId: string) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n const t = self.tracks.filter(t => t.configuration === conf)\n transaction(() => {\n t.forEach(t => self.tracks.remove(t))\n })\n return t.length\n },\n\n /**\n * #action\n */\n toggleFitToWindowLock() {\n // when going unlocked -> locked and circle is cut off, set to the\n // locked minBpPerPx\n self.lockedFitToWindow = !self.lockedFitToWindow\n this.setModelViewWhenAdjust(self.atMinBpPerPx)\n return self.lockedFitToWindow\n },\n /**\n * #action\n * creates an svg export and save using FileSaver\n */\n async exportSvg(opts: ExportSvgOptions = {}) {\n const { renderToSvg } = await import('../svgcomponents/SVGCircularView')\n const html = await renderToSvg(self as CircularViewModel, opts)\n const blob = new Blob([html], { type: 'image/svg+xml' })\n saveAs(blob, opts.filename || 'image.svg')\n },\n }))\n .views(self => ({\n /**\n * #method\n * return the view menu items\n */\n menuItems(): MenuItem[] {\n return [\n {\n label: 'Return to import form',\n onClick: () => {\n self.setDisplayedRegions([])\n },\n icon: FolderOpenIcon,\n },\n {\n label: 'Export SVG',\n icon: PhotoCameraIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n {\n label: 'Open track selector',\n onClick: self.activateTrackSelector,\n icon: TrackSelectorIcon,\n },\n ]\n },\n }))\n}\n\nexport type CircularViewStateModel = ReturnType<typeof stateModelFactory>\nexport type CircularViewModel = Instance<CircularViewStateModel>\n\nexport default stateModelFactory\n","import React, { useState, useEffect } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\nconst useStyles = makeStyles()(theme => {\n const offset = 2\n const duration = 1.4\n\n const { primary, secondary, tertiary, quaternary } = theme.palette\n return {\n path: {\n strokeDasharray: 187,\n strokeDashoffset: 50,\n animation: `$dash ${duration}s ease-in-out infinite, $colors ${\n duration * 4\n }s ease-in-out infinite`,\n },\n '@keyframes colors': {\n '0%': {\n stroke: primary.light,\n },\n '25%': {\n stroke: secondary.light,\n },\n '50%': {\n stroke: tertiary.light,\n },\n '75%': {\n stroke: quaternary.light,\n },\n '100%': {\n stroke: primary.light,\n },\n },\n\n '@keyframes dash': {\n '0%': {\n strokeDashoffset: offset,\n },\n '50%': {\n strokeDashoffset: offset / 4,\n transform: 'rotate(135deg)',\n },\n '100%': {\n strokeDashoffset: offset,\n transform: 'rotate(720deg)',\n },\n },\n }\n})\n\nconst Loading = observer(function ({\n model: {\n renderProps: { radius },\n },\n}: {\n model: { renderProps: { radius: number } }\n}) {\n const { classes } = useStyles()\n\n // only show the loading message after 400ms to prevent excessive flickering\n const [shown, setShown] = useState(false)\n useEffect(() => {\n const timeout = setTimeout(() => {\n setShown(true)\n }, 400)\n return () => {\n clearTimeout(timeout)\n }\n })\n\n return !shown ? null : (\n <g>\n <defs>\n <pattern\n id=\"diagonalHatch\"\n width=\"10\"\n height=\"10\"\n patternTransform=\"rotate(45 0 0)\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"10\"\n style={{ stroke: 'rgba(255,255,255,0.5)', strokeWidth: 10 }}\n />\n </pattern>\n </defs>\n <circle cx=\"0\" cy=\"0\" r={radius} fill=\"#f1f1f1\" />\n <circle cx=\"0\" cy=\"0\" r={radius} fill=\"url(#diagonalHatch)\" />\n <text\n x=\"0\"\n y=\"0\"\n transform=\"rotate(90 0 0)\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n Loading&hellip;\n </text>\n <circle\n className={classes.path}\n fill=\"none\"\n strokeWidth=\"4\"\n strokeLinecap=\"round\"\n cx=\"0\"\n cy=\"0\"\n r=\"60\"\n />\n </g>\n )\n})\n\nexport default Loading\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\nconst DisplayError = observer(function ({\n model,\n}: {\n model: { renderProps: { radius: number }; error: unknown }\n}) {\n const {\n renderProps: { radius },\n error,\n } = model\n return (\n <g>\n <defs>\n <pattern\n id=\"diagonalHatch\"\n width=\"10\"\n height=\"10\"\n patternTransform=\"rotate(45 0 0)\"\n patternUnits=\"userSpaceOnUse\"\n >\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"10\"\n style={{ stroke: 'rgba(255,0,0,0.5)', strokeWidth: 10 }}\n />\n </pattern>\n </defs>\n <circle cx=\"0\" cy=\"0\" r={radius} fill=\"#ffb4b4\" />\n <circle cx=\"0\" cy=\"0\" r={radius} fill=\"url(#diagonalHatch)\" />\n <text\n x=\"0\"\n y=\"0\"\n transform=\"rotate(90 0 0)\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {String(error)}\n </text>\n </g>\n )\n})\n\nexport default DisplayError\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\n// locals\nimport Loading from './Loading'\nimport DisplayError from './DisplayError'\n\nconst BaseChordDisplay = observer(function ({\n display,\n}: {\n display: {\n filled: boolean\n error: unknown\n reactElement: React.ReactElement\n renderProps: { radius: number }\n }\n}) {\n if (display.error) {\n return <DisplayError model={display} />\n }\n if (!display.filled) {\n return <Loading model={display} />\n }\n\n return display.reactElement\n})\n\nexport default BaseChordDisplay\n","import clone from 'clone'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { getSession, getContainingView } from '@jbrowse/core/util'\nimport { CircularViewModel } from '../../CircularView/models/model'\n\nexport function renderReactionData(self: any) {\n const view = getContainingView(self) as CircularViewModel\n const { rendererType } = self\n const { rpcManager } = getSession(view)\n\n return {\n rendererType,\n rpcManager,\n renderProps: self.renderProps(),\n renderArgs: {\n assemblyName: view.displayedRegions[0]!.assemblyName,\n adapterConfig: clone(self.adapterConfig),\n rendererType: rendererType.name,\n regions: clone(view.displayedRegions),\n blockDefinitions: self.blockDefinitions,\n sessionId: getRpcSessionId(self),\n timeout: 1000000,\n },\n }\n}\n\nexport async function renderReactionEffect(\n props: any,\n signal: AbortSignal | undefined,\n self: any,\n) {\n if (!props) {\n throw new Error('cannot render with no props')\n }\n\n const {\n rendererType,\n rpcManager,\n cannotBeRenderedReason,\n renderArgs,\n renderProps,\n exportSVG,\n } = props\n\n if (cannotBeRenderedReason) {\n return { message: cannotBeRenderedReason }\n }\n\n // don't try to render 0 or NaN radius or no regions\n if (!renderProps.radius || !renderArgs.regions?.length) {\n return { message: 'Skipping render' }\n }\n\n // check renderertype compatibility\n if (!self.isCompatibleWithRenderer(rendererType)) {\n throw new Error(\n `renderer ${rendererType.name} is not compatible with this display type`,\n )\n }\n\n const { html, ...data } = await rendererType.renderInClient(rpcManager, {\n ...renderArgs,\n ...renderProps,\n exportSVG,\n })\n\n return {\n html,\n data,\n reactElement: data.reactElement,\n renderingComponent: rendererType.ReactComponent,\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BaseChordDisplay\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst baseChordDisplayConfig = ConfigurationSchema(\n 'BaseChordDisplay',\n {\n /**\n * #slot\n */\n onChordClick: {\n type: 'boolean',\n description:\n 'callback that should be run when a chord in the track is clicked',\n defaultValue: false,\n contextVariable: ['feature', 'track', 'pluginManager'],\n },\n },\n {\n /**\n * #identifier\n */\n explicitIdentifier: 'displayId',\n },\n)\n\nexport { baseChordDisplayConfig }\n","import React from 'react'\nimport clone from 'clone'\nimport { getParent, isAlive, types } from 'mobx-state-tree'\n\n// jbrowse\nimport { ConfigurationReference, getConf } from '@jbrowse/core/configuration'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'\nimport CircularChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType'\nimport RendererType from '@jbrowse/core/pluggableElementTypes/renderers/RendererType'\nimport {\n getContainingView,\n getSession,\n getEnv,\n isFeature,\n makeAbortableReaction,\n AnyReactComponentType,\n Feature,\n ReactRendering,\n} from '@jbrowse/core/util'\nimport {\n getParentRenderProps,\n getRpcSessionId,\n getTrackAssemblyNames,\n} from '@jbrowse/core/util/tracks'\n\n// locals\nimport { renderReactionData, renderReactionEffect } from './renderReaction'\nimport {\n CircularViewModel,\n ExportSvgOptions,\n} from '../../CircularView/models/model'\nimport { ThemeOptions } from '@mui/material'\nimport { baseChordDisplayConfig } from './configSchema'\n\n/**\n * #stateModel BaseChordDisplay\n * extends\n * - [BaseDisplay](../basedisplay)\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport const BaseChordDisplayModel = types\n .compose(\n 'BaseChordDisplay',\n BaseDisplay,\n types.model({\n /**\n * #property\n */\n bezierRadiusRatio: 0.1,\n /**\n * #property\n */\n assemblyName: types.maybe(types.string),\n /**\n * #property\n */\n configuration: ConfigurationReference(baseChordDisplayConfig),\n }),\n )\n .volatile(() => ({\n // NOTE: all this volatile stuff has to be filled in at once\n // so that it stays consistent\n filled: false,\n reactElement: undefined as React.ReactElement | undefined,\n data: undefined,\n html: undefined as string | undefined,\n message: '',\n renderingComponent: undefined as undefined | AnyReactComponentType,\n refNameMap: undefined as Record<string, string> | undefined,\n }))\n .actions(self => {\n const { pluginManager } = getEnv(self)\n const track = self\n return {\n /**\n * #action\n */\n onChordClick(feature: Feature) {\n getConf(self, 'onChordClick', { feature, track, pluginManager })\n },\n }\n })\n .views(self => ({\n /**\n * #getter\n */\n get blockDefinitions() {\n const view = getContainingView(self) as CircularViewModel\n const origSlices = view.staticSlices\n if (!self.refNameMap) {\n return origSlices\n }\n\n const slices = clone(origSlices)\n\n slices.forEach(slice => {\n const regions = slice.region.elided\n ? slice.region.regions\n : [slice.region]\n regions.forEach(region => {\n const renamed = self.refNameMap?.[region.refName]\n if (renamed && region.refName !== renamed) {\n region.refName = renamed\n }\n })\n })\n return slices\n },\n\n /**\n * #method\n */\n renderProps() {\n const view = getContainingView(self) as CircularViewModel\n return {\n ...getParentRenderProps(self),\n rpcDriverName: self.rpcDriverName,\n bezierRadius: view.radiusPx * self.bezierRadiusRatio,\n radius: view.radiusPx,\n blockDefinitions: this.blockDefinitions,\n onChordClick: self.onChordClick,\n }\n },\n\n /**\n * #getter\n * the pluggable element type object for this display's renderer\n */\n get rendererType() {\n return getEnv(self).pluginManager.getRendererType(self.rendererTypeName)\n },\n\n /**\n * #method\n */\n isCompatibleWithRenderer(renderer: RendererType) {\n return !!(renderer instanceof CircularChordRendererType)\n },\n\n /**\n * #getter\n * returns a string feature ID if the globally-selected object\n * is probably a feature\n */\n get selectedFeatureId() {\n if (!isAlive(self)) {\n return undefined\n }\n const session = getSession(self)\n const { selection } = session\n // does it quack like a feature?\n if (isFeature(selection)) {\n return selection.id()\n }\n return undefined\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n renderStarted() {\n self.filled = false\n self.message = ''\n self.reactElement = undefined\n self.data = undefined\n self.html = undefined\n self.error = undefined\n self.renderingComponent = undefined\n },\n /**\n * #action\n */\n renderSuccess({\n message,\n data,\n reactElement,\n html,\n renderingComponent,\n }: {\n message: string\n data: any\n html: string\n reactElement: React.ReactElement\n renderingComponent: AnyReactComponentType\n }) {\n if (message) {\n self.filled = false\n self.message = message\n self.reactElement = undefined\n self.data = undefined\n self.html = undefined\n self.error = undefined\n self.renderingComponent = undefined\n } else {\n self.filled = true\n self.message = ''\n self.reactElement = reactElement\n self.data = data\n self.html = html\n self.error = undefined\n self.renderingComponent = renderingComponent\n }\n },\n /**\n * #action\n */\n renderError(error: unknown) {\n console.error(error)\n // the rendering failed for some reason\n self.filled = false\n self.message = ''\n self.reactElement = undefined\n self.html = undefined\n self.data = undefined\n self.error = error\n self.renderingComponent = undefined\n },\n\n /**\n * #action\n */\n setRefNameMap(refNameMap: Record<string, string>) {\n self.refNameMap = refNameMap\n },\n }))\n .actions(self => ({\n afterAttach() {\n makeAbortableReaction(\n self,\n renderReactionData,\n\n // @ts-expect-error\n renderReactionEffect,\n {\n name: `${self.type} ${self.id} rendering`,\n // delay: self.renderDelay || 300,\n fireImmediately: true,\n },\n self.renderStarted,\n self.renderSuccess,\n self.renderError,\n )\n\n makeAbortableReaction(\n self,\n () => ({\n assemblyNames: getTrackAssemblyNames(self.parentTrack),\n\n adapter: getConf(getParent<any>(self, 2), 'adapter'),\n assemblyManager: getSession(self).assemblyManager,\n }),\n\n async ({ assemblyNames, adapter, assemblyManager }: any, signal) => {\n return assemblyManager.getRefNameMapForAdapter(\n adapter,\n assemblyNames[0],\n { signal, sessionId: getRpcSessionId(self) },\n )\n },\n {\n name: `${self.type} ${self.id} getting refNames`,\n fireImmediately: true,\n },\n () => {},\n refNameMap => {\n self.setRefNameMap(refNameMap)\n },\n error => {\n console.error(error)\n self.setError(error)\n },\n )\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n async renderSvg(\n opts: ExportSvgOptions & {\n theme?: ThemeOptions\n },\n ) {\n const data = renderReactionData(self)\n const rendering = await renderReactionEffect(\n {\n ...data,\n exportSVG: opts,\n theme: opts.theme || data.renderProps.theme,\n },\n undefined,\n self,\n )\n return <ReactRendering rendering={rendering} />\n },\n }))\n","import { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\n\n// locals\n\nimport CircularViewF from './CircularView'\nimport LaunchCircularViewF from './LaunchCircularView'\n\n// icons\nimport DataUsageIcon from '@mui/icons-material/DataUsage'\n\nexport default class CircularViewPlugin extends Plugin {\n name = 'CircularViewPlugin'\n\n install(pluginManager: PluginManager) {\n CircularViewF(pluginManager)\n LaunchCircularViewF(pluginManager)\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToSubMenu(['Add'], {\n label: 'Circular view',\n icon: DataUsageIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('CircularView', {})\n },\n })\n }\n }\n}\n\nexport {\n baseChordDisplayConfig,\n BaseChordDisplayModel,\n BaseChordDisplayComponent,\n} from './BaseChordDisplay'\n\nexport {\n type CircularViewModel,\n type CircularViewStateModel,\n} from './CircularView/models/model'\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\nimport stateModelFactory from './models/model'\n\nexport default function CircularViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(\n () =>\n new ViewType({\n ReactComponent: lazy(() => import('./components/CircularView')),\n stateModel: stateModelFactory(pluginManager),\n name: 'CircularView',\n displayName: 'Circular view',\n }),\n )\n}\n","import { when } from 'mobx'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport { CircularViewModel } from '../CircularView/models/model'\n\ntype CGV = CircularViewModel\n\nexport default function LaunchCircularViewF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-CircularView',\n // @ts-expect-error\n async ({\n session,\n assembly,\n tracks = [],\n }: {\n session: AbstractSessionModel\n assembly?: string\n loc: string\n tracks?: string[]\n }) => {\n const { assemblyManager } = session\n const view = session.addView('CircularView', {}) as CGV\n\n await when(() => view.initialized)\n\n if (!assembly) {\n throw new Error(\n 'No assembly provided when launching circular genome view',\n )\n }\n\n const asm = await assemblyManager.waitForAssembly(assembly)\n if (!asm) {\n throw new Error(\n `Assembly \"${assembly}\" not found when launching circular genome view`,\n )\n }\n\n view.setDisplayedRegions(asm.regions || [])\n\n tracks.forEach(track => {\n view.showTrack(track)\n })\n },\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { InputLabel, TextField } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// fontSize and fontFamily have to match between Editor and SyntaxHighlighter\nconst fontSize = '12px'\n// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/\nconst fontFamily =\n 'Consolas, \"Andale Mono WT\", \"Andale Mono\", \"Lucida Console\", \"Lucida Sans Typewriter\", \"DejaVu Sans Mono\", \"Bitstream Vera Sans Mono\", \"Liberation Mono\", \"Nimbus Mono L\", Monaco, \"Courier New\", Courier, monospace'\n\nconst useStyles = makeStyles()(theme => ({\n error: {\n color: 'red',\n fontSize: '0.8em',\n },\n callbackEditor: {\n fontFamily,\n fontSize,\n background: theme.palette.background.default,\n width: 800,\n marginTop: '16px',\n border: '1px solid rgba(0,0,0,0.42)',\n },\n callbackContainer: {\n width: '100%',\n overflowX: 'auto',\n },\n textAreaFont: {\n fontFamily,\n },\n}))\n\nconst JsonEditor = observer(function JsonEditor({\n slot,\n}: {\n slot: {\n name: string\n description: string\n value: unknown\n set: (arg: unknown) => void\n }\n}) {\n const { classes } = useStyles()\n const [contents, setContents] = useState(JSON.stringify(slot.value, null, 2))\n const [error, setError] = useState<unknown>()\n\n useEffect(() => {\n try {\n setError(undefined)\n slot.set(JSON.parse(contents))\n } catch (e) {\n console.error({ e })\n setError(e)\n }\n }, [contents, slot])\n\n return (\n <>\n {error ? <p className={classes.error}>{`${error}`}</p> : null}\n <div className={classes.callbackContainer}>\n <InputLabel shrink htmlFor=\"json-editor\">\n {slot.name}\n </InputLabel>\n <TextField\n id=\"json-editor\"\n className={classes.callbackEditor}\n value={contents}\n helperText={slot.description}\n multiline\n onChange={event => {\n setContents(event.target.value)\n }}\n style={{ background: error ? '#fdd' : undefined }}\n InputProps={{\n classes: {\n input: classes.textAreaFont,\n },\n }}\n />\n </div>\n </>\n )\n})\n\nexport default JsonEditor\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config FromConfigAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'FromConfigAdapter',\n {\n /**\n * #slot\n */\n features: {\n type: 'frozen',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true, implicitIdentifier: 'adapterId' },\n)\n\nexport default configSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n/**\n * #config FromConfigRegionsAdapter\n * used for specifying refNames+sizes of an assembly\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst regionsConfigSchema = ConfigurationSchema(\n 'FromConfigRegionsAdapter',\n {\n /**\n * #slot\n */\n features: {\n type: 'frozen',\n defaultValue: [],\n },\n },\n {\n explicitlyTyped: true,\n implicitIdentifier: 'adapterId',\n },\n)\nexport default regionsConfigSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n/**\n * #config FromConfigSequenceAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst sequenceConfigSchema = ConfigurationSchema(\n 'FromConfigSequenceAdapter',\n {\n /**\n * #slot\n */\n features: {\n type: 'frozen',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true, implicitIdentifier: 'adapterId' },\n)\n\nexport default sequenceConfigSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config RefNameAliasAdapter\n * can read \"chromAliases\" type files from UCSC or any tab separated file of\n * refName aliases\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst RefNameAliasAdapter = ConfigurationSchema(\n 'RefNameAliasAdapter',\n {\n /**\n * #slot\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my/aliases.txt',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n * by default, the \"ref names that match the fasta\" are assumed to be in the\n * first column (0), change this variable if needed\n */\n refNameColumn: {\n type: 'number',\n defaultValue: 0,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default RefNameAliasAdapter\n","import { types } from 'mobx-state-tree'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nexport default function stateModelFactory(pluginManager: PluginManager) {\n return types\n .model('ConfigurationEditorWidget', {\n id: ElementId,\n type: types.literal('ConfigurationEditorWidget'),\n // If you add different types of targets, don't forget to account for that\n // in the key of ./components/ConfigurationEditor.js\n target: types.safeReference(\n pluginManager.pluggableConfigSchemaType('track'),\n ),\n })\n .actions(self => ({\n setTarget(newTarget: any) {\n self.target = newTarget\n },\n }))\n}\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { isStateTreeNode, getType } from 'mobx-state-tree'\n\nconst HeadingComponent = observer(function ({\n model,\n}: {\n model?: {\n target: {\n type: string\n }\n }\n}) {\n if (model?.target) {\n if (model.target.type) {\n return `${model.target.type} settings`\n }\n if (isStateTreeNode(model.target)) {\n const type = getType(model.target)\n if (type.name) {\n return `${type.name.replace('ConfigurationSchema', '')} settings`\n }\n }\n }\n return <>Settings</>\n})\n\nexport default HeadingComponent\n","import { lazy } from 'react'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport stateModelFactory from './model'\nimport HeadingComponent from './components/HeadingComponent'\n\nconst configSchema = ConfigurationSchema('ConfigurationEditorWidget', {})\n\nconst LazyConfigurationEditorComponent = lazy(\n () => import('./components/ConfigurationEditor'),\n)\n\nexport default function registerConfigurationEditorWidget(\n pluginManager: PluginManager,\n) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'ConfigurationEditorWidget',\n HeadingComponent,\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: LazyConfigurationEditorComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config NcbiSequenceReportAliasAdapter\n * can read \"sequence_report.tsv\" type files from NCBI\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst NcbiSequenceReportAliasAdapterConfigSchema = ConfigurationSchema(\n 'NcbiSequenceReportAliasAdapter',\n {\n /**\n * #slot\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my/sequence_report.tsv',\n locationType: 'UriLocation',\n },\n },\n\n useUcscNameOverride: {\n type: 'boolean',\n defaultValue: true,\n description:\n 'forces usage of the UCSC names over the NCBI style names from a FASTA',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default NcbiSequenceReportAliasAdapterConfigSchema\n","import { lazy } from 'react'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport FromConfigAdapterF from './FromConfigAdapter'\nimport FromConfigRegionsAdapterF from './FromConfigRegionsAdapter'\nimport FromConfigSequenceAdapterF from './FromConfigSequenceAdapter'\nimport RefNameAliasAdapterF from './RefNameAliasAdapter'\nimport ConfigurationEditorWidgetF from './ConfigurationEditorWidget'\nimport NcbiSequenceReportAliasAdapterF from './NcbiSequenceReportAliasAdapter'\n\nconst LazyConfigurationEditorComponent = lazy(\n () => import('./ConfigurationEditorWidget/components/ConfigurationEditor'),\n)\n\nexport default class ConfigurationPlugin extends Plugin {\n name = 'ConfigurationPlugin'\n\n install(pluginManager: PluginManager) {\n FromConfigAdapterF(pluginManager)\n FromConfigRegionsAdapterF(pluginManager)\n FromConfigSequenceAdapterF(pluginManager)\n RefNameAliasAdapterF(pluginManager)\n ConfigurationEditorWidgetF(pluginManager)\n NcbiSequenceReportAliasAdapterF(pluginManager)\n }\n}\n\nexport { default as JsonEditor } from './ConfigurationEditorWidget/components/JsonEditor'\n\nexport { LazyConfigurationEditorComponent as ConfigurationEditor }\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\n\nexport default function FromConfigAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'FromConfigAdapter',\n configSchema,\n getAdapterClass: () =>\n import('./FromConfigAdapter').then(r => r.default),\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n }),\n )\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\n\nexport default function FromConfigRegionsAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'FromConfigRegionsAdapter',\n configSchema,\n getAdapterClass: () =>\n import('./FromConfigRegionsAdapter').then(r => r.default),\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n }),\n )\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport configSchema from './configSchema'\n\nexport default function FromConfigSequenceAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'FromConfigSequenceAdapter',\n configSchema,\n getAdapterClass: () =>\n import('./FromConfigSequenceAdapter').then(r => r.default),\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n }),\n )\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport configSchema from './configSchema'\n\nexport default function RefNameAliasAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'RefNameAliasAdapter',\n configSchema,\n getAdapterClass: () =>\n import('./RefNameAliasAdapter').then(r => r.default),\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n }),\n )\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport configSchema from './configSchema'\n\nexport default function NcbiSequenceReportAliasAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addAdapterType(() => {\n return new AdapterType({\n name: 'NcbiSequenceReportAliasAdapter',\n configSchema,\n getAdapterClass: () =>\n import('./NcbiSequenceReportAliasAdapter').then(r => r.default),\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n })\n })\n}\n","import { types } from 'mobx-state-tree'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\n\nexport default types.model('AddConnectionModel', {\n id: ElementId,\n type: types.literal('AddConnectionWidget'),\n})\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { lazy } from 'react'\n\nimport stateModel from './model'\nconst configSchema = ConfigurationSchema('AddConnectionWidget', {})\n\nexport default function AddConnectionWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'AddConnectionWidget',\n heading: 'Add a connection',\n configSchema,\n stateModel,\n ReactComponent: lazy(() => import('./components/AddConnectionWidget')),\n })\n })\n}\n","import { types, Instance } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n guessAdapter,\n guessTrackType,\n getFileName,\n UNSUPPORTED,\n} from '@jbrowse/core/util/tracks'\n\nfunction isAbsoluteUrl(url = '') {\n try {\n new URL(url)\n return true\n } catch (error) {\n return url.startsWith('/')\n }\n}\ninterface IndexingAttr {\n attributes: string[]\n exclude: string[]\n}\n\n/**\n * #stateModel AddTrackModel\n */\nexport default function f(pluginManager: PluginManager) {\n return types\n .model('AddTrackModel', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('AddTrackWidget'),\n /**\n * #property\n */\n view: types.safeReference(\n pluginManager.pluggableMstType('view', 'stateModel'),\n ),\n })\n .volatile(() => ({\n trackSource: 'fromFile',\n trackData: undefined as FileLocation | undefined,\n indexTrackData: undefined as FileLocation | undefined,\n\n // alts\n altAssemblyName: '',\n altTrackName: '',\n altTrackType: '',\n\n adapterHint: '',\n textIndexTrack: true,\n textIndexingConf: undefined as IndexingAttr | undefined,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setAdapterHint(obj: string) {\n self.adapterHint = obj\n },\n /**\n * #action\n */\n setTrackSource(str: string) {\n self.trackSource = str\n },\n /**\n * #action\n */\n setTextIndexingConf(conf: IndexingAttr) {\n self.textIndexingConf = conf\n },\n /**\n * #action\n */\n setTextIndexTrack(flag: boolean) {\n self.textIndexTrack = flag\n },\n /**\n * #action\n */\n setTrackData(obj: FileLocation) {\n self.trackData = obj\n },\n /**\n * #action\n */\n setIndexTrackData(obj: FileLocation) {\n self.indexTrackData = obj\n },\n /**\n * #action\n */\n setAssembly(str: string) {\n self.altAssemblyName = str\n },\n /**\n * #action\n */\n setTrackName(str: string) {\n self.altTrackName = str\n },\n /**\n * #action\n */\n setTrackType(str: string) {\n self.altTrackType = str\n },\n /**\n * #action\n */\n clearData() {\n self.trackSource = ''\n self.altTrackName = ''\n self.altTrackType = ''\n self.altAssemblyName = ''\n self.adapterHint = ''\n self.indexTrackData = undefined\n self.trackData = undefined\n self.textIndexingConf = undefined\n self.textIndexTrack = true\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get trackAdapter() {\n const { trackData, indexTrackData, adapterHint } = self\n\n return trackData\n ? guessAdapter(trackData, indexTrackData, adapterHint, self)\n : undefined\n },\n\n /**\n * #getter\n */\n get trackName() {\n return (\n self.altTrackName ||\n (self.trackData ? getFileName(self.trackData) : '')\n )\n },\n\n /**\n * #getter\n */\n get isFtp() {\n const { trackData: track, indexTrackData: index } = self\n return !!(\n // @ts-expect-error\n (index?.uri?.startsWith('ftp://') || track?.uri?.startsWith('ftp://'))\n )\n },\n\n /**\n * #getter\n */\n get isRelativeTrackUrl() {\n // @ts-expect-error\n const uri = self.trackData?.uri\n return uri ? !isAbsoluteUrl(uri) : false\n },\n /**\n * #getter\n */\n get isRelativeIndexUrl() {\n // @ts-expect-error\n const uri = self.indexTrackData?.uri\n return uri ? !isAbsoluteUrl(uri) : false\n },\n /**\n * #getter\n */\n get isRelativeUrl() {\n return this.isRelativeIndexUrl || this.isRelativeTrackUrl\n },\n\n /**\n * #getter\n */\n get trackHttp() {\n // @ts-expect-error\n return self.trackData?.uri?.startsWith('http://')\n },\n /**\n * #getter\n */\n get indexHttp() {\n // @ts-expect-error\n return self.indexTrackData?.uri?.startsWith('http://')\n },\n\n /**\n * #getter\n */\n get wrongProtocol() {\n return (\n window.location.protocol === 'https:' &&\n (this.trackHttp || this.indexHttp)\n )\n },\n\n /**\n * #getter\n */\n get unsupported() {\n return this.trackAdapter?.type === UNSUPPORTED\n },\n\n /**\n * #getter\n */\n get assembly() {\n return self.altAssemblyName || self.view.assemblyNames?.[0]\n },\n\n /**\n * #getter\n */\n get trackType() {\n return (\n self.altTrackType ||\n (this.trackAdapter\n ? guessTrackType(this.trackAdapter.type, self)\n : '')\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get warningMessage() {\n if (self.isFtp) {\n return 'Warning: JBrowse cannot access files using the ftp protocol'\n } else if (self.isRelativeUrl) {\n return `Warning: one or more of your files do not provide the protocol e.g.\n https://, please provide an absolute URL unless you are sure a\n relative URL is intended.`\n } else if (self.wrongProtocol) {\n return `Warning: You entered a http:// resources but we cannot access HTTP\n resources from JBrowse when it is running on https. Please use an\n https URL for your track, or access the JBrowse app from the http\n protocol`\n }\n return ''\n },\n }))\n}\n\nexport type AddTrackStateModel = ReturnType<typeof f>\nexport type AddTrackModel = Instance<AddTrackStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { lazy } from 'react'\n\nimport stateModelFactory from './model'\nconst configSchema = ConfigurationSchema('AddTrackWidget', {})\n\nexport default function AddTrackWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'AddTrackWidget',\n heading: 'Add a track',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/AddTrackWidget')),\n })\n })\n}\n","export interface Row {\n id: string\n metadata?: Record<string, unknown>\n [key: string]: unknown\n}\n\nexport function getRowStr(facet: string, row: Row) {\n return `${\n (facet.startsWith('metadata.')\n ? row.metadata?.[facet.replace('metadata.', '')]\n : row[facet]) || ''\n }`\n}\n","import {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\n\nexport function hasAnyOverlap<T>(a1: T[] = [], a2: T[] = []) {\n // shortcut case is that arrays are single entries, and are equal\n // long case is that we use a set\n if (a1[0] === a2[0]) {\n return true\n } else {\n const s1 = new Set(a1)\n return a2.some(a => s1.has(a))\n }\n}\n\nexport function hasAllOverlap<T>(a1: T[] = [], a2: T[] = []) {\n const s1 = new Set(a1)\n return a2.every(a => s1.has(a))\n}\n\nexport function matches(\n query: string,\n conf: AnyConfigurationModel,\n session: AbstractSessionModel,\n) {\n const categories = (readConfObject(conf, 'category') || []) as string[]\n const queryLower = query.toLowerCase()\n return (\n getTrackName(conf, session).toLowerCase().includes(queryLower) ||\n !!categories.filter(c => c.toLowerCase().includes(queryLower)).length\n )\n}\n\ninterface Node {\n children: Node[]\n id: string\n}\n\nexport function findSubCategories(obj: Node[], paths: string[], depth = 0) {\n let hasSubs = false\n for (const elt of obj) {\n if (elt.children.length) {\n const hasSubCategories = findSubCategories(elt.children, paths, depth + 1)\n // avoid pushing the root \"Tracks\" node by checking depth>0\n if (hasSubCategories && depth > 0) {\n paths.push(elt.id)\n }\n } else {\n hasSubs = true\n }\n }\n return hasSubs\n}\n\nexport function findTopLevelCategories(obj: Node[], paths: string[]) {\n for (const elt of obj) {\n if (elt.children.length) {\n paths.push(elt.id)\n }\n }\n}\n","import {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { getEnv, getSession, notEmpty } from '@jbrowse/core/util'\nimport { hasAllOverlap, hasAnyOverlap } from './util'\n\nexport function filterTracks(\n tracks: AnyConfigurationModel[],\n self: {\n view?: {\n type: string\n trackSelectorAnyOverlap?: boolean\n }\n assemblyNames: string[]\n },\n) {\n const { assemblyManager } = getSession(self)\n const { pluginManager } = getEnv(self)\n const { view } = self\n\n if (!view) {\n return []\n }\n const trackListAssemblies = self.assemblyNames\n .map(a => assemblyManager.get(a))\n .filter(notEmpty)\n return tracks\n .filter(c => {\n const trackAssemblyNames = readConfObject(c, 'assemblyNames') as\n | string[]\n | undefined\n const trackAssemblies = trackAssemblyNames\n ?.map(name => assemblyManager.get(name))\n .filter(notEmpty)\n return view.trackSelectorAnyOverlap\n ? hasAnyOverlap(trackAssemblies, trackListAssemblies)\n : hasAllOverlap(trackAssemblies, trackListAssemblies)\n })\n .filter(c => {\n const { displayTypes } = pluginManager.getViewType(view.type)!\n const compatDisplays = displayTypes.map(d => d.name)\n const trackDisplays = c.displays.map((d: { type: string }) => d.type)\n return hasAnyOverlap(compatDisplays, trackDisplays)\n })\n}\n","import {\n readConfObject,\n AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\n\n// locals\nimport { matches } from './util'\nimport { MenuItem } from '@jbrowse/core/ui'\n\nfunction sortConfs(\n confs: AnyConfigurationModel[],\n sortNames: boolean,\n sortCategories: boolean,\n) {\n // uses readConfObject instead of getTrackName so that the undefined\n // reference sequence track is sorted to the top\n const ret = confs.map(c => [\n c,\n readConfObject(c, 'name'),\n readConfObject(c, 'category')?.[0] || '',\n readConfObject(c, 'category')?.[1] || '',\n readConfObject(c, 'category')?.[2] || '',\n ])\n if (sortNames) {\n ret.sort((a, b) => a[1].localeCompare(b[1]))\n }\n if (sortCategories) {\n // sort up to three sub-category levels, harder to code it to go deeper\n // than this and likely rarely used\n ret.sort((a, b) => {\n if (a[2] !== b[2]) {\n return a[2].localeCompare(b[2])\n } else if (a[3] !== b[3]) {\n return a[3].localeCompare(b[3])\n } else if (a[4] !== b[4]) {\n return a[4].localeCompare(b[4])\n }\n return 0\n })\n }\n return ret.map(a => a[0])\n}\n\nexport interface TreeTrackNode {\n name: string\n id: string\n trackId: string\n conf: AnyConfigurationModel\n checked: boolean\n children: TreeNode[] // empty\n type: 'track'\n}\n\nexport interface TreeCategoryNode {\n name: string\n id: string\n isOpenByDefault: boolean\n children: TreeNode[]\n type: 'category'\n}\n\nexport type TreeNode = TreeTrackNode | TreeCategoryNode\n\nexport function generateHierarchy({\n model,\n trackConfs,\n extra,\n noCategories,\n menuItems,\n}: {\n model: {\n filterText: string\n activeSortTrackNames: boolean\n activeSortCategories: boolean\n collapsed: Map<string | number, boolean>\n view?: {\n tracks: { configuration: AnyConfigurationModel }[]\n }\n }\n noCategories?: boolean\n menuItems?: MenuItem[]\n trackConfs: AnyConfigurationModel[]\n extra?: string\n}): TreeNode[] {\n const hierarchy = { children: [] as TreeNode[] } as TreeNode\n const {\n collapsed,\n filterText,\n activeSortTrackNames,\n activeSortCategories,\n view,\n } = model\n if (!view) {\n return []\n }\n const session = getSession(model)\n const viewTracks = view.tracks\n const confs = trackConfs.filter(conf => matches(filterText, conf, session))\n\n // uses getConf\n for (const conf of sortConfs(\n confs,\n activeSortTrackNames,\n activeSortCategories,\n )) {\n // copy the categories since this array can be mutated downstream\n const categories = [...(readConfObject(conf, 'category') || [])]\n\n // hack where if trackId ends with sessionTrack, then push it to a\n // category that starts with a space to force sort to the top\n if (conf.trackId.endsWith('sessionTrack')) {\n categories.unshift(' Session tracks')\n }\n\n let currLevel = hierarchy\n\n if (!noCategories) {\n // find existing category to put track into or create it\n for (let i = 0; i < categories.length; i++) {\n const category = categories[i]\n const ret = currLevel.children.find(c => c.name === category)\n const id = [extra, categories.slice(0, i + 1).join(',')]\n .filter(f => !!f)\n .join('-')\n if (!ret) {\n const n = {\n children: [],\n name: category,\n id,\n isOpenByDefault: !collapsed.get(id),\n menuItems,\n type: 'category' as const,\n }\n currLevel.children.push(n)\n currLevel = n\n } else {\n currLevel = ret\n }\n }\n }\n\n // uses splice to try to put all leaf nodes above \"category nodes\" if you\n // change the splice to a simple push and open\n // test_data/test_order/config.json you will see the weirdness\n const r = currLevel.children.findIndex(elt => elt.children.length)\n const idx = r === -1 ? currLevel.children.length : r\n currLevel.children.splice(idx, 0, {\n id: [extra, conf.trackId].filter(f => !!f).join(','),\n trackId: conf.trackId,\n name: getTrackName(conf, session),\n conf,\n checked: viewTracks.some(f => f.configuration === conf),\n children: [],\n type: 'track' as const,\n })\n }\n\n return hierarchy.children\n}\n","export function findNonSparseKeys(\n keys: readonly string[],\n rows: Record<string, unknown>[],\n cb: (row: Record<string, unknown>, f: string) => unknown,\n) {\n return keys.filter(f => rows.map(r => cb(r, f)).filter(f => !!f).length > 5)\n}\n\nexport function getRootKeys(obj: Record<string, unknown>) {\n return Object.entries(obj)\n .map(([key, val]) => (typeof val === 'string' ? key : ''))\n .filter(f => !!f)\n}\n","import { Instance, addDisposer, getParent, types } from 'mobx-state-tree'\nimport { matches } from './util'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\nimport { getSession, localStorageGetItem } from '@jbrowse/core/util'\nimport { autorun, observable } from 'mobx'\nimport { getRootKeys, findNonSparseKeys } from './facetedUtil'\nimport { getRowStr } from './components/faceted/util'\n\nconst nonMetadataKeys = ['category', 'adapter', 'description'] as const\n\n/**\n * #stateModel FacetedModel\n */\nexport function facetedStateTreeF() {\n return types\n .model('FacetedModel', {\n /**\n * #property\n */\n filterText: types.optional(types.string, ''),\n /**\n * #property\n */\n showSparse: types.optional(types.boolean, () =>\n JSON.parse(localStorageGetItem('facet-showSparse') || 'false'),\n ),\n /**\n * #property\n */\n showFilters: types.optional(types.boolean, () =>\n JSON.parse(localStorageGetItem('facet-showFilters') || 'true'),\n ),\n\n /**\n * #property\n */\n showOptions: types.optional(types.boolean, () =>\n JSON.parse(localStorageGetItem('facet-showTableOptions') || 'false'),\n ),\n\n /**\n * #property\n */\n panelWidth: types.optional(types.number, () =>\n JSON.parse(localStorageGetItem('facet-panelWidth') || '400'),\n ),\n })\n .volatile(() => ({\n visible: {} as Record<string, boolean>,\n useShoppingCart: false,\n filters: observable.map<string, string[]>(),\n }))\n .actions(self => ({\n /**\n * #action\n */\n setFilter(key: string, value: string[]) {\n self.filters.set(key, value)\n },\n /**\n * #action\n */\n setPanelWidth(width: number) {\n self.panelWidth = width\n return self.panelWidth\n },\n /**\n * #action\n */\n setUseShoppingCart(f: boolean) {\n self.useShoppingCart = f\n },\n /**\n * #action\n */\n setFilterText(str: string) {\n self.filterText = str\n },\n /**\n * #action\n */\n setShowSparse(f: boolean) {\n self.showSparse = f\n },\n /**\n * #action\n */\n setShowOptions(f: boolean) {\n self.showOptions = f\n },\n /**\n * #action\n */\n setShowFilters(f: boolean) {\n self.showFilters = f\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get allTrackConfigurations() {\n return getParent<{ allTrackConfigurations: AnyConfigurationModel[] }>(\n self,\n ).allTrackConfigurations\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get rows() {\n const session = getSession(self)\n const { allTrackConfigurations, filterText } = self\n return allTrackConfigurations\n .filter(conf => matches(filterText, conf, session))\n .map(track => {\n return {\n id: track.trackId as string,\n conf: track,\n name: getTrackName(track, session),\n category: readConfObject(track, 'category')?.join(', ') as string,\n adapter: readConfObject(track, 'adapter')?.type as string,\n description: readConfObject(track, 'description') as string,\n metadata: readConfObject(track, 'metadata') as Record<\n string,\n unknown\n >,\n } as const\n })\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get filteredNonMetadataKeys() {\n return self.showSparse\n ? nonMetadataKeys\n : findNonSparseKeys(nonMetadataKeys, self.rows, (r, f) => r[f])\n },\n /**\n * #getter\n */\n get metadataKeys() {\n return [...new Set(self.rows.flatMap(row => getRootKeys(row.metadata)))]\n },\n get filteredMetadataKeys() {\n return self.showSparse\n ? this.metadataKeys\n : findNonSparseKeys(\n this.metadataKeys,\n self.rows,\n // @ts-expect-error\n (r, f) => r.metadata[f],\n )\n },\n /**\n * #getter\n */\n get fields() {\n return [\n 'name',\n ...this.filteredNonMetadataKeys,\n ...this.filteredMetadataKeys.map(m => `metadata.${m}`),\n ]\n },\n /**\n * #getter\n */\n get filteredRows() {\n const arrFilters = [...self.filters.entries()]\n .filter(f => f[1].length > 0)\n .map(([key, val]) => [key, new Set(val)] as const)\n return self.rows.filter(row =>\n arrFilters.every(([key, val]) => val.has(getRowStr(key, row))),\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setVisible(args: Record<string, boolean>) {\n self.visible = args\n },\n\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n this.setVisible(Object.fromEntries(self.fields.map(c => [c, true])))\n }),\n )\n },\n }))\n}\n\nexport type FacetedStateModel = ReturnType<typeof facetedStateTreeF>\nexport type FacetedModel = Instance<FacetedStateModel>\n","import { types, addDisposer, Instance } from 'mobx-state-tree'\nimport { autorun, observable } from 'mobx'\nimport {\n getConf,\n readConfObject,\n AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport {\n dedupe,\n getSession,\n localStorageGetItem,\n localStorageSetItem,\n notEmpty,\n} from '@jbrowse/core/util'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport { filterTracks } from './filterTracks'\nimport { generateHierarchy } from './generateHierarchy'\nimport { findSubCategories, findTopLevelCategories } from './util'\nimport { facetedStateTreeF } from './facetedModel'\n\ntype MaybeAnyConfigurationModel = AnyConfigurationModel | undefined\n\ntype MaybeBoolean = boolean | undefined\n\ntype MaybeCollapsedKeys = [string, boolean][] | undefined\n\n// for settings that are config dependent\nfunction keyConfigPostFix() {\n return typeof window !== 'undefined'\n ? [\n window.location.pathname,\n new URLSearchParams(window.location.search).get('config'),\n ]\n .filter(f => !!f)\n .join('-')\n : 'empty'\n}\n\nfunction recentlyUsedK(assemblyNames: string[]) {\n return ['recentlyUsedTracks', keyConfigPostFix(), assemblyNames.join(',')]\n .filter(f => !!f)\n .join('-')\n}\n\n// this has a extra } at the end because that's how it was initially\n// released\nfunction favoritesK() {\n return `favoriteTracks-${keyConfigPostFix()}}`\n}\n\nfunction collapsedK(assemblyNames: string[], viewType: string) {\n return [\n 'collapsedCategories',\n keyConfigPostFix(),\n assemblyNames.join(','),\n viewType,\n ].join('-')\n}\n\nfunction sortTrackNamesK() {\n return 'sortTrackNames'\n}\n\nfunction sortCategoriesK() {\n return 'sortCategories'\n}\n\nfunction localStorageGetJSON<T>(key: string, defaultValue: T) {\n const val = localStorageGetItem(key)\n return val !== undefined && val !== null && val\n ? (JSON.parse(val) as T)\n : defaultValue\n}\n\nfunction localStorageSetJSON(key: string, val: unknown) {\n if (val !== undefined && val !== null) {\n localStorageSetItem(key, JSON.stringify(val))\n }\n}\n\nconst MAX_RECENTLY_USED = 10\n\n/**\n * #stateModel HierarchicalTrackSelectorWidget\n */\nexport default function stateTreeFactory(pluginManager: PluginManager) {\n return types\n .model('HierarchicalTrackSelectorWidget', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('HierarchicalTrackSelectorWidget'),\n\n /**\n * #property\n */\n view: types.safeReference(\n pluginManager.pluggableMstType('view', 'stateModel'),\n ),\n /**\n * #property\n */\n faceted: types.optional(facetedStateTreeF(), {}),\n })\n .volatile(() => ({\n /**\n * #volatile\n */\n favorites: localStorageGetJSON<string[]>(favoritesK(), []),\n /**\n * #volatile\n */\n recentlyUsed: [] as string[],\n /**\n * #volatile\n */\n selection: [] as AnyConfigurationModel[],\n /**\n * #volatile\n */\n sortTrackNames: localStorageGetJSON<MaybeBoolean>(\n sortTrackNamesK(),\n undefined,\n ),\n /**\n * #volatile\n */\n sortCategories: localStorageGetJSON<MaybeBoolean>(\n sortCategoriesK(),\n undefined,\n ),\n /**\n * #volatile\n */\n collapsed: observable.map<string, boolean>(),\n /**\n * #volatile\n */\n filterText: '',\n /**\n * #volatile\n */\n recentlyUsedCounter: 0,\n /**\n * #volatile\n */\n favoritesCounter: 0,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get shownTrackIds() {\n return new Set<string>(\n self.view?.tracks?.map(\n (t: { configuration: { trackId: string } }) =>\n t.configuration.trackId,\n ),\n )\n },\n /**\n * #getter\n */\n get selectionSet() {\n return new Set(self.selection)\n },\n /**\n * #getter\n */\n get favoritesSet() {\n return new Set(self.favorites)\n },\n /**\n * #getter\n */\n get recentlyUsedSet() {\n return new Set(self.recentlyUsed)\n },\n /**\n * #getter\n */\n get assemblyNames(): string[] {\n return self.view?.assemblyNames || []\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setSortTrackNames(val: boolean) {\n self.sortTrackNames = val\n },\n /**\n * #action\n */\n setSortCategories(val: boolean) {\n self.sortCategories = val\n },\n /**\n * #action\n */\n setSelection(elt: AnyConfigurationModel[]) {\n self.selection = elt\n },\n /**\n * #action\n */\n addToSelection(elt: AnyConfigurationModel[]) {\n self.selection = dedupe([...self.selection, ...elt], e => e.trackId)\n },\n /**\n * #action\n */\n removeFromSelection(elt: AnyConfigurationModel[]) {\n const s = new Set(elt)\n self.selection = self.selection.filter(f => !s.has(f))\n },\n /**\n * #action\n */\n clearSelection() {\n self.selection = []\n },\n\n /**\n * #action\n */\n addToFavorites(trackId: string) {\n self.favoritesCounter += 1\n self.favorites = [...self.favorites, trackId]\n },\n /**\n * #action\n */\n removeFromFavorites(trackId: string) {\n self.favorites = self.favorites.filter(f => f !== trackId)\n },\n /**\n * #action\n */\n clearFavorites() {\n self.favorites = []\n },\n\n /**\n * #action\n */\n setRecentlyUsedCounter(val: number) {\n self.recentlyUsedCounter = val\n },\n /**\n * #action\n */\n setRecentlyUsed(str: string[]) {\n self.recentlyUsed = str\n },\n /**\n * #action\n */\n setFavorites(str: string[]) {\n self.favorites = str\n },\n /**\n * #action\n */\n setFavoritesCounter(val: number) {\n self.favoritesCounter = val\n },\n /**\n * #action\n */\n addToRecentlyUsed(id: string) {\n if (!self.recentlyUsed.includes(id)) {\n self.recentlyUsedCounter = Math.min(\n self.recentlyUsedCounter + 1,\n MAX_RECENTLY_USED,\n )\n self.recentlyUsed =\n self.recentlyUsed.length >= MAX_RECENTLY_USED\n ? [...self.recentlyUsed.slice(1), id]\n : [...self.recentlyUsed, id]\n }\n },\n /**\n * #action\n */\n clearRecentlyUsed() {\n self.recentlyUsed = []\n },\n /**\n * #action\n */\n setView(view: unknown) {\n self.view = view\n },\n /**\n * #action\n */\n toggleCategory(pathName: string) {\n self.collapsed.set(pathName, !self.collapsed.get(pathName))\n },\n /**\n * #action\n */\n setCategoryCollapsed(pathName: string, status: boolean) {\n self.collapsed.set(pathName, status)\n },\n /**\n * #action\n */\n expandAllCategories() {\n self.collapsed.clear()\n },\n /**\n * #action\n */\n setCollapsedCategories(str: [string, boolean][]) {\n self.collapsed.replace(str)\n },\n /**\n * #action\n */\n clearFilterText() {\n self.filterText = ''\n },\n /**\n * #action\n */\n setFilterText(newText: string) {\n self.filterText = newText\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n isSelected(track: AnyConfigurationModel) {\n return self.selectionSet.has(track)\n },\n /**\n * #method\n */\n isFavorite(trackId: string) {\n return self.favoritesSet.has(trackId)\n },\n /**\n * #method\n */\n isRecentlyUsed(trackId: string) {\n return self.recentlyUsedSet.has(trackId)\n },\n /**\n * #method\n */\n getRefSeqTrackConf(assemblyName: string): MaybeAnyConfigurationModel {\n const { assemblyManager } = getSession(self)\n const assembly = assemblyManager.get(assemblyName)\n const trackConf = assembly?.configuration.sequence\n const viewType = pluginManager.getViewType(self.view.type)!\n if (trackConf) {\n for (const display of trackConf.displays) {\n if (viewType.displayTypes.some(d => d.name === display.type)) {\n return trackConf\n }\n }\n }\n return undefined\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get activeSortTrackNames() {\n return (\n self.sortTrackNames ??\n getConf(getSession(self), ['hierarchical', 'sort', 'trackNames'])\n )\n },\n /**\n * #getter\n */\n get activeSortCategories() {\n return (\n self.sortCategories ??\n getConf(getSession(self), ['hierarchical', 'sort', 'categories'])\n )\n },\n\n /**\n * #getter\n * filter out tracks that don't match the current assembly/display types\n */\n get configAndSessionTrackConfigurations() {\n return [\n ...self.assemblyNames.map(a => self.getRefSeqTrackConf(a)),\n ...filterTracks(getSession(self).tracks, self),\n ].filter(notEmpty)\n },\n /**\n * #getter\n */\n get allTrackConfigurations() {\n const { connectionInstances = [] } = getSession(self)\n return [\n ...this.configAndSessionTrackConfigurations,\n ...connectionInstances.flatMap(c => c.tracks),\n ]\n },\n\n /**\n * #getter\n */\n get allTrackConfigurationTrackIdSet() {\n return new Map(this.allTrackConfigurations.map(t => [t.trackId, t]))\n },\n }))\n .views(self => ({\n /**\n * #getter\n * filters out tracks that are not in the favorites group\n */\n get favoriteTracks() {\n return self.favorites\n .filter(t => self.allTrackConfigurationTrackIdSet.has(t))\n .map(t => self.allTrackConfigurationTrackIdSet.get(t)!)\n },\n\n /**\n * #getter\n * filters out tracks that are not in the recently used group\n */\n get recentlyUsedTracks() {\n return self.recentlyUsed\n .filter(t => self.allTrackConfigurationTrackIdSet.has(t))\n .map(t => self.allTrackConfigurationTrackIdSet.get(t)!)\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get allTracks() {\n const { connectionInstances = [] } = getSession(self)\n return [\n {\n group: 'Tracks',\n tracks: self.configAndSessionTrackConfigurations,\n noCategories: false,\n menuItems: [],\n },\n ...connectionInstances.flatMap(c => ({\n group: getConf(c, 'name'),\n tracks: c.tracks,\n noCategories: false,\n menuItems: [],\n })),\n ]\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get hierarchy() {\n return {\n name: 'Root',\n id: 'Root',\n isOpenByDefault: true,\n type: 'category' as const,\n children: self.allTracks.map(s => ({\n name: s.group,\n id: s.group,\n type: 'category' as const,\n isOpenByDefault: !self.collapsed.get(s.group),\n menuItems: s.menuItems,\n children: generateHierarchy({\n // @ts-expect-error conflict between IMSTMap and Map types in typescript 5.6\n model: self,\n trackConfs: s.tracks,\n extra: s.group,\n noCategories: s.noCategories,\n }),\n })),\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n collapseSubCategories() {\n const paths = [] as string[]\n findSubCategories(self.hierarchy.children, paths)\n for (const path of paths) {\n self.setCategoryCollapsed(path, true)\n }\n },\n /**\n * #action\n */\n collapseTopLevelCategories() {\n const paths = [] as string[]\n for (const trackGroups of self.hierarchy.children) {\n if (trackGroups.children.length) {\n findTopLevelCategories(trackGroups.children, paths)\n }\n }\n for (const path of paths) {\n self.setCategoryCollapsed(path, true)\n }\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get hasAnySubcategories() {\n return self.allTracks.some(group =>\n group.tracks.some(t => readConfObject(t, 'category')?.length > 1),\n )\n },\n }))\n .actions(self => ({\n afterAttach() {\n // this should be the first autorun to properly initialize\n addDisposer(\n self,\n autorun(() => {\n const { assemblyNames, view } = self\n self.setRecentlyUsed(\n localStorageGetJSON<string[]>(recentlyUsedK(assemblyNames), []),\n )\n if (view) {\n const lc = localStorageGetJSON<MaybeCollapsedKeys>(\n collapsedK(assemblyNames, view.type),\n undefined,\n )\n const r = ['hierarchical', 'defaultCollapsed']\n const session = getSession(self)\n if (!lc) {\n self.expandAllCategories()\n if (getConf(session, [...r, 'topLevelCategories'])) {\n self.collapseTopLevelCategories()\n }\n if (getConf(session, [...r, 'subCategories'])) {\n self.collapseSubCategories()\n }\n for (const elt of getConf(session, [...r, 'categoryNames'])) {\n self.setCategoryCollapsed(`Tracks-${elt}`, true)\n }\n } else {\n self.setCollapsedCategories(lc)\n }\n }\n }),\n )\n // this should be the second autorun\n addDisposer(\n self,\n autorun(() => {\n const {\n sortTrackNames,\n sortCategories,\n favorites,\n recentlyUsed,\n assemblyNames,\n collapsed,\n view,\n } = self\n localStorageSetJSON(recentlyUsedK(assemblyNames), recentlyUsed)\n localStorageSetJSON(favoritesK(), favorites)\n localStorageSetJSON(sortTrackNamesK(), sortTrackNames)\n localStorageSetJSON(sortCategoriesK(), sortCategories)\n if (view) {\n localStorageSetJSON(\n collapsedK(assemblyNames, view.type),\n collapsed,\n )\n }\n }),\n )\n },\n }))\n}\n\nexport type HierarchicalTrackSelectorStateModel = ReturnType<\n typeof stateTreeFactory\n>\nexport type HierarchicalTrackSelectorModel =\n Instance<HierarchicalTrackSelectorStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nconst configSchema = ConfigurationSchema('HierarchicalTrackSelectorWidget', {})\nexport default configSchema\n","import stateModelFactory from './model'\nimport configSchema from './configSchema'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport { lazy } from 'react'\n\nexport default function HierarchicalTrackSelectorWidgetF(\n pluginManager: PluginManager,\n) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'HierarchicalTrackSelectorWidget',\n heading: 'Available tracks',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(\n () => import('./components/HierarchicalTrackSelector'),\n ),\n })\n })\n}\n\nexport {\n type HierarchicalTrackSelectorModel,\n default as stateModelFactory,\n} from './model'\nexport { default as configSchema } from './configSchema'\n","import { types, Instance } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\n\nexport default function stateModelFactory(pluginManager: PluginManager) {\n return types\n .model('PluginStoreModel', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('PluginStoreWidget'),\n /**\n * #property\n */\n filterText: '',\n /**\n * #property\n */\n view: types.safeReference(\n pluginManager.pluggableMstType('view', 'stateModel'),\n ),\n })\n .actions(self => ({\n /**\n * #action\n */\n clearFilterText() {\n self.filterText = ''\n },\n /**\n * #action\n */\n setFilterText(newText: string) {\n self.filterText = newText\n },\n }))\n}\n\nexport type PluginStoreStateModel = ReturnType<typeof stateModelFactory>\nexport type PluginStoreModel = Instance<PluginStoreStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { lazy } from 'react'\n\nimport stateModelFactory from './model'\nconst configSchema = ConfigurationSchema('PluginStoreWidget', {})\n\nexport default function PluginStoreWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'PluginStoreWidget',\n heading: 'Plugin store',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/PluginStoreWidget')),\n })\n })\n}\n","import { baseConnectionConfig } from '@jbrowse/core/pluggableElementTypes/models'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config UCSCTrackHubConnection\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst UCSCTrackHubConnection = ConfigurationSchema(\n 'UCSCTrackHubConnection',\n {\n /**\n * #slot\n */\n hubTxtLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: 'http://mysite.com/path/to/hub.txt',\n locationType: 'UriLocation',\n },\n description: 'location of the hub file (usually called hub.txt)',\n },\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'optional list of genomes to import from this track hub, if empty all genomes will be imported',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseConnectionConfig,\n },\n)\n\nexport default UCSCTrackHubConnection\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'\nimport { ConfigurationReference } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n// locals\nimport configSchema from './configSchema'\n\n/**\n * #stateModel UCSCTrackHubConnection\n * extends BaseConnectionModel\n */\nexport default function UCSCTrackHubConnection(pluginManager: PluginManager) {\n return types\n .compose(\n 'UCSCTrackHubConnection',\n BaseConnectionModelFactory(pluginManager),\n types.model({\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n type: types.literal('UCSCTrackHubConnection'),\n }),\n )\n .actions(self => ({\n /**\n * #action\n */\n async connect() {\n const { doConnect } = await import('./doConnect')\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n doConnect(self)\n },\n }))\n}\n","import { ConnectionType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport stateModelFactory from './model'\nimport configSchema from './configSchema'\n\nexport default function UCSCTrackHubConnectionF(pluginManager: PluginManager) {\n pluginManager.addConnectionType(\n () =>\n new ConnectionType({\n name: 'UCSCTrackHubConnection',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n displayName: 'UCSC Track Hub',\n description: 'A track or assembly hub in the Track Hub format',\n url: '//genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html#Intro',\n }),\n )\n}\n","import { BaseBlock } from '@jbrowse/core/util/blockTypes'\nimport { Dotplot1DViewModel } from '../model'\n\nexport function locstr(\n px: number,\n view: Dotplot1DViewModel,\n includeAsm = true,\n) {\n const { assemblyName, refName, start, offset, oob } = view.pxToBp(px)\n const coord = Math.floor(start + offset)\n return oob\n ? 'out of bounds'\n : `${\n includeAsm ? `{${assemblyName}}` : ''\n }${refName}:${coord.toLocaleString('en-US')}`\n}\n\nexport function getBlockLabelKeysToHide(\n blocks: BaseBlock[],\n length: number,\n viewOffsetPx: number,\n) {\n const blockLabelKeysToHide = new Set<string>()\n const sortedBlocks = [...blocks].sort((a, b) => {\n const alen = a.end - a.start\n const blen = b.end - b.start\n return blen - alen\n })\n const positions = Array.from({ length: Math.round(length) })\n for (const { key, offsetPx } of sortedBlocks) {\n const y = Math.round(length - offsetPx + viewOffsetPx)\n const labelBounds = [Math.max(y - 12, 0), y]\n if (y === 0 || positions.slice(...labelBounds).some(Boolean)) {\n blockLabelKeysToHide.add(key)\n } else {\n positions.fill(true, ...labelBounds)\n }\n }\n return blockLabelKeysToHide\n}\n/**\n * Given a scale ( bp/px ) and minimum distances (px) between major and minor\n * gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving\n * the gridline pitches to use.\n */\nexport function chooseGridPitch(\n scale: number,\n minMajorPitchPx: number,\n minMinorPitchPx: number,\n) {\n scale = Math.abs(scale)\n const minMajorPitchBp = minMajorPitchPx * scale\n const majorMagnitude = +Number(minMajorPitchBp)\n .toExponential()\n .split(/e/i)[1]!\n\n let majorPitch = 10 ** majorMagnitude\n while (majorPitch < minMajorPitchBp) {\n majorPitch *= 2\n if (majorPitch >= minMajorPitchBp) {\n break\n }\n majorPitch *= 2.5\n }\n\n majorPitch = Math.max(majorPitch, 5)\n\n const majorPitchPx = majorPitch / scale\n\n let minorPitch = 0\n if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {\n minorPitch = majorPitch / 10\n } else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {\n minorPitch = majorPitch / 5\n } else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {\n minorPitch = majorPitch / 2\n }\n\n return { majorPitch, minorPitch }\n}\n\nexport function makeTicks(\n regions: BaseBlock[],\n bpPerPx: number,\n emitMajor = true,\n emitMinor = true,\n) {\n const ticks = []\n const gridPitch = chooseGridPitch(bpPerPx, 60, 15)\n const iterPitch = gridPitch.minorPitch || gridPitch.majorPitch\n for (const { start, end, refName } of regions) {\n let index = 0\n\n const minBase = start\n const maxBase = end\n\n for (\n let base = Math.floor(minBase / iterPitch) * iterPitch;\n base < Math.ceil(maxBase / iterPitch) * iterPitch + 1;\n base += iterPitch\n ) {\n if (emitMinor && base % gridPitch.majorPitch) {\n ticks.push({ type: 'minor', base: base - 1, index, refName })\n index += 1\n } else if (emitMajor && Math.abs(base - start) > gridPitch.minorPitch) {\n ticks.push({ type: 'major', base: base - 1, index, refName })\n index += 1\n }\n }\n }\n return ticks\n}\n","import React from 'react'\nimport { BaseBlock } from '@jbrowse/core/util/blockTypes'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\nconst useStyles = makeStyles()(theme => ({\n contentBlock: {\n position: 'relative',\n minHeight: '100%',\n boxSizing: 'border-box',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n elidedBlock: {\n minHeight: '100%',\n boxSizing: 'border-box',\n backgroundColor: '#999',\n backgroundImage:\n 'repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)',\n },\n interRegionPaddingBlock: {\n minHeight: '100%',\n backgroundColor: theme.palette.text.disabled,\n },\n boundaryPaddingBlock: {\n minHeight: '100%',\n backgroundColor: theme.palette.action.disabledBackground,\n },\n}))\n\nconst ContentBlock = observer(function ({\n block,\n children,\n}: {\n block: BaseBlock\n children: React.ReactNode\n}) {\n const { classes } = useStyles()\n const { widthPx } = block\n return (\n <div style={{ width: widthPx }} className={classes.contentBlock}>\n {children}\n </div>\n )\n})\n\nfunction ElidedBlock({ width }: { width: number }) {\n const { classes } = useStyles()\n return <div className={classes.elidedBlock} style={{ width }} />\n}\n\nfunction InterRegionPaddingBlock({\n boundary,\n width,\n style = {},\n}: {\n boundary: boolean\n width: number\n style?: React.CSSProperties\n}) {\n const { classes } = useStyles()\n return (\n <div\n style={{\n ...style,\n width,\n }}\n className={\n boundary\n ? classes.boundaryPaddingBlock\n : classes.interRegionPaddingBlock\n }\n />\n )\n}\n\nexport { ContentBlock, ElidedBlock, InterRegionPaddingBlock }\n","import React from 'react'\nimport { Tooltip, Alert, AlertColor } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\n\nconst useStyles = makeStyles()({\n ellipses: {\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n },\n})\n\nexport default function BlockMsg({\n message,\n severity,\n action,\n}: {\n message: string\n severity?: AlertColor\n action?: React.ReactNode\n}) {\n const { classes } = useStyles()\n return (\n <Alert\n severity={severity}\n action={action}\n classes={{ message: classes.ellipses }}\n >\n <Tooltip title={message}>\n <div>{message}</div>\n </Tooltip>\n </Alert>\n )\n}\n","import React, { lazy, Suspense } from 'react'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { SanitizedHTML } from '@jbrowse/core/ui'\nimport { observer } from 'mobx-react'\n// locals\nimport { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'\n\nconst BaseTooltip = lazy(() => import('@jbrowse/core/ui/BaseTooltip'))\n\ninterface Props {\n message: React.ReactNode | string\n}\nconst TooltipContents = React.forwardRef<HTMLDivElement, Props>(\n function TooltipContents2({ message }, ref) {\n return (\n <div ref={ref}>\n {React.isValidElement(message) ? (\n message\n ) : message ? (\n <SanitizedHTML html={String(message)} />\n ) : null}\n </div>\n )\n },\n)\n\ntype Coord = [number, number]\nconst Tooltip = observer(function ({\n model,\n clientMouseCoord,\n}: {\n model: BaseLinearDisplayModel\n clientMouseCoord: Coord\n}) {\n const { featureUnderMouse } = model\n const x = clientMouseCoord[0] + 15\n const y = clientMouseCoord[1]\n\n const contents = featureUnderMouse\n ? getConf(model, 'mouseover', { feature: featureUnderMouse })\n : undefined\n\n return featureUnderMouse && contents ? (\n <Suspense fallback={null}>\n <BaseTooltip clientPoint={{ x, y }}>\n <TooltipContents message={contents} />\n </BaseTooltip>\n </Suspense>\n ) : null\n})\n\nexport default Tooltip\n","import React, { lazy } from 'react'\nimport { Tooltip, IconButton } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { getParent } from 'mobx-state-tree'\nimport { LoadingEllipses } from '@jbrowse/core/ui'\nimport { getSession } from '@jbrowse/core/util'\n\n// icons\nimport RefreshIcon from '@mui/icons-material/Refresh'\nimport ReportIcon from '@mui/icons-material/Report'\n\n// locals\nimport BlockMsg from './BlockMsg'\n\nconst ErrorMessageStackTraceDialog = lazy(\n () => import('@jbrowse/core/ui/ErrorMessageStackTraceDialog'),\n)\n\nconst useStyles = makeStyles()(theme => {\n const bg = theme.palette.action.disabledBackground\n return {\n loading: {\n paddingLeft: '0.6em',\n backgroundColor: theme.palette.background.default,\n backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,\n textAlign: 'center',\n },\n }\n})\n\nconst LoadingMessage = observer(({ model }: { model: { status?: string } }) => {\n const { classes } = useStyles()\n const { status: blockStatus } = model\n const { message: displayStatus } = getParent<{ message?: string }>(model, 2)\n const status = displayStatus || blockStatus\n return (\n <div className={classes.loading}>\n <LoadingEllipses message={status} />\n </div>\n )\n})\n\nconst ServerSideRenderedBlockContent = observer(function ({\n model,\n}: {\n model: {\n error?: unknown\n reload: () => void\n message: React.ReactNode\n filled?: boolean\n status?: string\n reactElement?: React.ReactElement\n }\n}) {\n if (model.error) {\n return (\n <BlockMsg\n message={`${model.error}`}\n severity=\"error\"\n action={\n <>\n <Tooltip title=\"Reload track\">\n <IconButton\n data-testid=\"reload_button\"\n onClick={() => {\n model.reload()\n }}\n >\n <RefreshIcon />\n </IconButton>\n </Tooltip>\n <Tooltip title=\"Show stack trace\">\n <IconButton\n onClick={() => {\n getSession(model).queueDialog(onClose => [\n ErrorMessageStackTraceDialog,\n { onClose, error: model.error as Error },\n ])\n }}\n >\n <ReportIcon />\n </IconButton>\n </Tooltip>\n </>\n }\n />\n )\n } else if (model.message) {\n // the message can be a fully rendered react component, e.g. the region too large message\n return React.isValidElement(model.message) ? (\n model.message\n ) : (\n <BlockMsg message={`${model.message}`} severity=\"info\" />\n )\n } else if (!model.filled) {\n return <LoadingMessage model={model} />\n } else {\n return model.reactElement\n }\n})\n\nexport default ServerSideRenderedBlockContent\n","import React from 'react'\nimport {\n types,\n getParent,\n isAlive,\n cast,\n Instance,\n getSnapshot,\n} from 'mobx-state-tree'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport {\n assembleLocString,\n getSession,\n getContainingDisplay,\n getContainingView,\n getViewParams,\n makeAbortableReaction,\n Feature,\n} from '@jbrowse/core/util'\nimport { Region } from '@jbrowse/core/util/types/mst'\nimport {\n AbstractDisplayModel,\n isRetryException,\n} from '@jbrowse/core/util/types'\n\nimport {\n getTrackAssemblyNames,\n getRpcSessionId,\n} from '@jbrowse/core/util/tracks'\n\n// locals\nimport ServerSideRenderedBlockContent from '../components/ServerSideRenderedBlockContent'\n\n// the MST state of a single server-side-rendered block in a display\nconst blockState = types\n .model('BlockState', {\n key: types.string,\n region: Region,\n reloadFlag: 0,\n isLeftEndOfDisplayedRegion: false,\n isRightEndOfDisplayedRegion: false,\n })\n // NOTE: all this volatile stuff has to be filled in at once, so that it stays consistent\n .volatile(() => ({\n renderInProgress: undefined as AbortController | undefined,\n filled: false,\n reactElement: undefined as React.ReactElement | undefined,\n features: undefined as Map<string, Feature> | undefined,\n layout: undefined as any,\n status: '',\n error: undefined as unknown,\n message: undefined as string | undefined,\n maxHeightReached: false,\n ReactComponent: ServerSideRenderedBlockContent,\n renderProps: undefined as any,\n }))\n .actions(self => {\n let renderInProgress: undefined | AbortController\n return {\n doReload() {\n self.reloadFlag = self.reloadFlag + 1\n },\n afterAttach() {\n const display = getContainingDisplay(self)\n setTimeout(() => {\n if (isAlive(self)) {\n makeAbortableReaction(\n self as any,\n renderBlockData,\n renderBlockEffect, // reaction doesn't expect async here\n {\n name: `${display.id}/${assembleLocString(\n self.region,\n )} rendering`,\n delay: display.renderDelay,\n fireImmediately: true,\n },\n this.setLoading,\n this.setRendered,\n this.setError,\n )\n }\n }, display.renderDelay)\n },\n setStatus(message: string) {\n self.status = message\n },\n setLoading(abortController: AbortController) {\n if (\n renderInProgress !== undefined &&\n !renderInProgress.signal.aborted\n ) {\n renderInProgress.abort()\n }\n self.filled = false\n self.message = undefined\n self.reactElement = undefined\n self.features = undefined\n self.layout = undefined\n self.error = undefined\n self.maxHeightReached = false\n self.renderProps = undefined\n renderInProgress = abortController\n },\n setMessage(messageText: string) {\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n self.filled = false\n self.message = messageText\n self.reactElement = undefined\n self.features = undefined\n self.layout = undefined\n self.error = undefined\n self.maxHeightReached = false\n self.renderProps = undefined\n renderInProgress = undefined\n },\n setRendered(\n props:\n | {\n reactElement: React.ReactElement\n features: Map<string, Feature>\n layout: any\n maxHeightReached: boolean\n renderProps: any\n }\n | undefined,\n ) {\n if (!props) {\n return\n }\n const {\n reactElement,\n features,\n layout,\n maxHeightReached,\n renderProps,\n } = props\n self.filled = true\n self.message = undefined\n self.reactElement = reactElement\n self.features = features\n self.layout = layout\n self.error = undefined\n self.maxHeightReached = maxHeightReached\n self.renderProps = renderProps\n renderInProgress = undefined\n },\n setError(error: unknown) {\n console.error(error)\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n // the rendering failed for some reason\n self.filled = false\n self.message = undefined\n self.reactElement = undefined\n self.features = undefined\n self.layout = undefined\n self.maxHeightReached = false\n self.error = error\n self.renderProps = undefined\n renderInProgress = undefined\n if (isRetryException(error as Error)) {\n this.reload()\n }\n },\n reload() {\n self.renderInProgress = undefined\n self.filled = false\n self.reactElement = undefined\n self.features = undefined\n self.layout = undefined\n self.error = undefined\n self.message = undefined\n self.maxHeightReached = false\n self.ReactComponent = ServerSideRenderedBlockContent\n self.renderProps = undefined\n getParent<any>(self, 2).reload()\n },\n beforeDestroy() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n const display = getContainingDisplay(self)\n const { rpcManager } = getSession(self)\n const { rendererType } = display\n const { renderArgs } = renderBlockData(cast(self))\n // renderArgs can be undefined if an error occurred in this block\n if (renderArgs) {\n await rendererType.freeResourcesInClient(\n rpcManager,\n JSON.parse(JSON.stringify(renderArgs)),\n )\n }\n } catch (e) {\n console.error('Error while destroying block', e)\n }\n })()\n },\n }\n })\n\nexport default blockState\nexport type BlockStateModel = typeof blockState\nexport type BlockModel = Instance<BlockStateModel>\n\n// calls the render worker to render the block content not using a flow for\n// this, because the flow doesn't work with autorun\nexport function renderBlockData(\n self: BlockModel,\n optDisplay?: AbstractDisplayModel,\n) {\n try {\n const display = optDisplay || (getContainingDisplay(self) as any)\n const { assemblyManager, rpcManager } = getSession(display)\n const { adapterConfig, rendererType, error, parentTrack } = display\n const assemblyNames = getTrackAssemblyNames(parentTrack)\n const regionAsm = self.region.assemblyName\n if (\n !assemblyNames.includes(regionAsm) &&\n !assemblyNames.some(name => assemblyManager.get(name)?.hasName(regionAsm))\n ) {\n throw new Error(\n `region assembly (${regionAsm}) does not match track assemblies (${assemblyNames})`,\n )\n }\n\n const renderProps = display.renderProps()\n const { config } = renderProps\n\n // This line is to trigger the mobx reaction when the config changes\n // It won't trigger the reaction if it doesn't think we're accessing it\n readConfObject(config)\n\n const sessionId = getRpcSessionId(display)\n const layoutId = getContainingView(display).id\n const cannotBeRenderedReason = display.regionCannotBeRendered(self.region)\n\n return {\n rendererType,\n rpcManager,\n renderProps,\n cannotBeRenderedReason,\n displayError: error,\n renderArgs: {\n statusCallback: (message: string) => {\n if (isAlive(self)) {\n self.setStatus(message)\n }\n },\n assemblyName: self.region.assemblyName,\n regions: [getSnapshot(self.region)],\n adapterConfig,\n rendererType: rendererType.name,\n sessionId,\n layoutId,\n blockKey: self.key,\n reloadFlag: self.reloadFlag,\n timeout: 1000000, // 10000,\n },\n }\n } catch (e) {\n return { displayError: e }\n }\n}\n\nasync function renderBlockEffect(\n props: ReturnType<typeof renderBlockData> | undefined,\n signal: AbortSignal,\n self: BlockModel,\n) {\n if (!props) {\n return\n }\n const {\n rendererType,\n renderProps,\n rpcManager,\n renderArgs,\n cannotBeRenderedReason,\n displayError,\n } = props\n if (!isAlive(self)) {\n return undefined\n }\n\n if (displayError) {\n self.setError(displayError)\n return undefined\n }\n if (cannotBeRenderedReason) {\n self.setMessage(cannotBeRenderedReason)\n return undefined\n }\n\n if (renderProps.notReady) {\n return undefined\n }\n\n const { reactElement, features, layout, maxHeightReached } =\n await rendererType.renderInClient(rpcManager, {\n ...renderArgs,\n ...renderProps,\n viewParams: getViewParams(self),\n signal,\n })\n return {\n reactElement,\n features,\n layout,\n maxHeightReached,\n renderProps,\n }\n}\n","import { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { getContainingView, getSession } from '@jbrowse/core/util'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { IAnyStateTreeNode, isAlive } from 'mobx-state-tree'\nimport { LinearGenomeViewModel } from '../../LinearGenomeView'\n\nexport interface RenderProps {\n rendererType: any\n renderArgs: Record<string, any>\n renderProps: Record<string, any>\n displayError: unknown\n rpcManager: { call: (...args: unknown[]) => void }\n cannotBeRenderedReason: string\n}\n\nexport interface ErrorProps {\n displayError: string\n}\n\nexport function getDisplayStr(totalBytes: number) {\n if (Math.floor(totalBytes / 1000000) > 0) {\n return `${Number.parseFloat((totalBytes / 1000000).toPrecision(3))} Mb`\n } else if (Math.floor(totalBytes / 1000) > 0) {\n return `${Number.parseFloat((totalBytes / 1000).toPrecision(3))} Kb`\n } else {\n return `${Math.floor(totalBytes)} bytes`\n }\n}\n\n// stabilize clipid under test for snapshot\nexport function getId(id: string, index: number) {\n const notJest = typeof jest === 'undefined'\n return ['clip', notJest ? id : 'jest', index, notJest ? Math.random() : '']\n .filter(f => !!f)\n .join('-')\n}\n\nexport async function getFeatureDensityStatsPre(\n self: IAnyStateTreeNode & {\n adapterConfig?: AnyConfigurationModel\n setMessage: (arg: string) => void\n },\n) {\n const view = getContainingView(self) as LinearGenomeViewModel\n const regions = view.staticBlocks.contentBlocks\n\n const { rpcManager } = getSession(self)\n const { adapterConfig } = self\n if (!adapterConfig) {\n // A track extending the base track might not have an adapter config\n // e.g. Apollo tracks don't use adapters\n return {}\n }\n const sessionId = getRpcSessionId(self)\n\n return rpcManager.call(sessionId, 'CoreGetFeatureDensityStats', {\n sessionId,\n regions,\n adapterConfig,\n statusCallback: (message: string) => {\n if (isAlive(self)) {\n self.setMessage(message)\n }\n },\n }) as Promise<FeatureDensityStats>\n}\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\n// core\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport { ContentBlock } from '@jbrowse/core/util/blockTypes'\nimport { Assembly } from '@jbrowse/core/assemblyManager/assembly'\nimport { getFillProps } from '@jbrowse/core/util'\n\n// locals\nimport { getCytobands } from './util'\nimport { HEADER_OVERVIEW_HEIGHT } from '../consts'\n\n// rounded rect from https://stackoverflow.com/a/45889603/2129219\nfunction rightRoundedRect(\n x: number,\n y: number,\n width: number,\n height: number,\n radius: number,\n) {\n return `M${x},${y}h${width - radius}a${radius},${radius} 0 0 1 ${radius},${radius}v${height - 2 * radius}a${radius},${radius} 0 0 1 ${-radius},${radius}h${radius - width}z`\n}\n\nfunction leftRoundedRect(\n x: number,\n y: number,\n width: number,\n height: number,\n radius: number,\n) {\n return `M${x + radius},${y}h${width - radius}v${height}h${radius - width}a${radius},${radius} 0 0 1 ${-radius},${-radius}v${2 * radius - height}a${radius},${radius} 0 0 1 ${radius},${-radius}z`\n}\n\nfunction leftTriangle(x: number, y: number, width: number, height: number) {\n return [\n [x, 0],\n [x + width, height / 2],\n [x, height],\n ].toString()\n}\n\nfunction rightTriangle(x: number, y: number, width: number, height: number) {\n return [\n [x, height / 2],\n [x + width, 0],\n [x + width, height],\n ].toString()\n}\n\nconst colorMap: Record<string, string> = {\n gneg: 'rgb(227,227,227)',\n gpos25: 'rgb(142,142,142)',\n gpos50: 'rgb(85,85,85)',\n gpos100: 'rgb(0,0,0)',\n gpos75: 'rgb(57,57,57)',\n gvar: 'rgb(0,0,0)',\n stalk: 'rgb(127,127,127)',\n acen: '#800',\n}\n\nconst Cytobands = observer(function ({\n overview,\n block,\n assembly,\n}: {\n overview: Base1DViewModel\n assembly?: Assembly\n block: ContentBlock\n}) {\n const { offsetPx, reversed } = block\n const cytobands = getCytobands(assembly, block.refName)\n const lcap = reversed ? cytobands.length - 1 : 0\n const rcap = reversed ? 0 : cytobands.length - 1\n\n const h = HEADER_OVERVIEW_HEIGHT\n let centromereSeen = false\n return (\n <g transform={`translate(-${offsetPx})`}>\n {cytobands.map((args, index) => {\n const k = JSON.stringify(args)\n const { refName, type, start, end } = args\n const s = overview.bpToPx({ refName, coord: start }) || 0\n const e = overview.bpToPx({ refName, coord: end }) || 0\n const l = Math.min(s, e)\n const w = Math.abs(e - s)\n const c = colorMap[type] || 'black'\n if (type === 'acen' && !centromereSeen) {\n centromereSeen = true // the next acen entry is drawn with different right triangle\n return (\n <polygon\n key={k}\n points={\n reversed\n ? rightTriangle(s - w, 0, w, h)\n : leftTriangle(s, 0, w, h)\n }\n {...getFillProps(c)}\n />\n )\n }\n if (type === 'acen' && centromereSeen) {\n return (\n <polygon\n key={k}\n points={\n reversed\n ? leftTriangle(s - w, 0, w, h)\n : rightTriangle(s, 0, w, h)\n }\n {...getFillProps(c)}\n />\n )\n }\n if (lcap === index) {\n return (\n <path\n key={k}\n d={leftRoundedRect(l, 0, w, h, 8)}\n {...getFillProps(c)}\n />\n )\n }\n if (rcap === index) {\n return (\n <path\n key={k}\n d={rightRoundedRect(l, 0, w, h, 8)}\n {...getFillProps(c)}\n />\n )\n }\n return (\n <rect key={k} x={l} y={0} width={w} height={h} {...getFillProps(c)} />\n )\n })}\n </g>\n )\n})\n\nexport default Cytobands\n","import React from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\n\n// icons\nimport DragIcon from '@mui/icons-material/DragIndicator'\n\nimport { LinearGenomeViewModel } from '..'\n\nconst useStyles = makeStyles()({\n dragHandle: {\n cursor: 'grab',\n },\n dragHandleIcon: {\n display: 'inline-block',\n verticalAlign: 'middle',\n pointerEvents: 'none',\n },\n})\n\nfunction TrackLabelDragHandle({\n trackId,\n view,\n track,\n}: {\n trackId: string\n track: BaseTrackModel\n view: LinearGenomeViewModel\n}) {\n const { classes } = useStyles()\n return (\n <span\n draggable\n className={classes.dragHandle}\n onDragStart={event => {\n const target = event.currentTarget\n if (target.parentNode) {\n const parent = target.parentNode as HTMLElement\n event.dataTransfer.setDragImage(parent, 20, 20)\n view.setDraggingTrackId(track.id)\n }\n }}\n onDragEnd={() => {\n view.setDraggingTrackId(undefined)\n }}\n data-testid={`dragHandle-${view.id}-${trackId}`}\n >\n <DragIcon className={classes.dragHandleIcon} fontSize=\"small\" />\n </span>\n )\n}\n\nexport default TrackLabelDragHandle\n","import React from 'react'\nimport { IconButton, Paper, Typography, alpha } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { getSession, getContainingView } from '@jbrowse/core/util'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\nimport { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { SanitizedHTML } from '@jbrowse/core/ui'\nimport CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'\n\n// icons\nimport MoreVertIcon from '@mui/icons-material/MoreVert'\nimport CloseIcon from '@mui/icons-material/Close'\nimport MinimizeIcon from '@mui/icons-material/Minimize'\nimport AddIcon from '@mui/icons-material/Add'\nimport KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown'\nimport KeyboardDoubleArrowUpIcon from '@mui/icons-material/KeyboardDoubleArrowUp'\nimport KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'\nimport KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'\n\nimport { LinearGenomeViewModel } from '..'\nimport TrackLabelDragHandle from './TrackLabelDragHandle'\n\nconst useStyles = makeStyles()(theme => ({\n root: {\n background: alpha(theme.palette.background.paper, 0.8),\n '&:hover': {\n background: theme.palette.background.paper,\n },\n },\n trackName: {\n fontSize: '0.8rem',\n },\n iconButton: {\n padding: theme.spacing(1),\n },\n}))\n\ntype LGV = LinearGenomeViewModel\n\ninterface Props {\n track: BaseTrackModel\n className?: string\n}\n\nconst TrackLabel = observer(\n React.forwardRef<HTMLDivElement, Props>(function TrackLabel2(\n { track, className },\n ref,\n ) {\n const { classes, cx } = useStyles()\n const view = getContainingView(track) as LGV\n const session = getSession(track)\n const trackConf = track.configuration\n const minimized = track.minimized\n const trackId = getConf(track, 'trackId')\n const trackName = getTrackName(trackConf, session)\n const items = [\n {\n label: 'Track order',\n type: 'subMenu',\n priority: 2000,\n subMenu: [\n {\n label: minimized ? 'Restore track' : 'Minimize track',\n icon: minimized ? AddIcon : MinimizeIcon,\n onClick: () => {\n track.setMinimized(!minimized)\n },\n },\n {\n label: 'Move track to top',\n icon: KeyboardDoubleArrowUpIcon,\n onClick: () => {\n view.moveTrackToTop(track.id)\n },\n },\n\n {\n label: 'Move track up',\n icon: KeyboardArrowUpIcon,\n onClick: () => {\n view.moveTrackUp(track.id)\n },\n },\n {\n label: 'Move track down',\n icon: KeyboardArrowDownIcon,\n onClick: () => {\n view.moveTrackDown(track.id)\n },\n },\n {\n label: 'Move track to bottom',\n icon: KeyboardDoubleArrowDownIcon,\n onClick: () => {\n view.moveTrackToBottom(track.id)\n },\n },\n ],\n },\n ...(session.getTrackActionMenuItems?.(trackConf) || []),\n ...track.trackMenuItems(),\n ].sort((a, b) => (b?.priority || 0) - (a?.priority || 0))\n\n return (\n <Paper ref={ref} className={cx(className, classes.root)}>\n <TrackLabelDragHandle track={track} trackId={trackId} view={view} />\n <IconButton\n onClick={() => view.hideTrack(trackId)}\n className={classes.iconButton}\n title=\"close this track\"\n >\n <CloseIcon fontSize=\"small\" />\n </IconButton>\n\n <Typography\n variant=\"body1\"\n component=\"span\"\n className={classes.trackName}\n onMouseDown={event => {\n // avoid becoming a click-and-drag action on the lgv\n event.stopPropagation()\n }}\n >\n <SanitizedHTML\n html={[trackName, minimized ? '(minimized)' : '']\n .filter(f => !!f)\n .join(' ')}\n />\n </Typography>\n\n <CascadingMenuButton menuItems={items} data-testid=\"track_menu_icon\">\n <MoreVertIcon fontSize=\"small\" />\n </CascadingMenuButton>\n </Paper>\n )\n }),\n)\n\nexport default TrackLabel\n","import React from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// jbrowse core\nimport { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport TrackLabel from './TrackLabel'\n\nconst useStyles = makeStyles()({\n trackLabel: {\n zIndex: 3,\n },\n\n trackLabelOffset: {\n position: 'relative',\n display: 'inline-block',\n },\n trackLabelOverlap: {\n position: 'absolute',\n },\n})\n\ntype LGV = LinearGenomeViewModel\n\nconst TrackLabelContainer = observer(function ({\n track,\n view,\n}: {\n track: BaseTrackModel\n view: LGV\n}) {\n const { classes, cx } = useStyles()\n const display = track.displays[0]\n const { trackLabel, trackLabelOverlap, trackLabelOffset } = classes\n const labelStyle =\n view.trackLabelsSetting !== 'overlapping' || display.prefersOffset\n ? trackLabelOffset\n : trackLabelOverlap\n\n return view.trackLabelsSetting !== 'hidden' ? (\n <TrackLabel track={track} className={cx(trackLabel, labelStyle)} />\n ) : null\n})\n\nexport default TrackLabelContainer\n","import React, { Suspense, useEffect, useRef } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// jbrowse core\nimport { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { LoadingEllipses } from '@jbrowse/core/ui'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\n\nconst useStyles = makeStyles()({\n // aligns with block boundaries. check for example the breakpoint split view\n // demo to see if features align if wanting to change things\n renderingComponentContainer: {\n position: 'absolute',\n // -1 offset because of the 1px border of the Paper\n left: -1,\n height: '100%',\n width: '100%',\n },\n\n trackRenderingContainer: {\n overflowY: 'auto',\n overflowX: 'hidden',\n whiteSpace: 'nowrap',\n position: 'relative',\n background: 'none',\n zIndex: 2,\n },\n})\n\ntype LGV = LinearGenomeViewModel\n\nconst TrackRenderingContainer = observer(function ({\n model,\n track,\n onDragEnter,\n}: {\n model: LGV\n track: BaseTrackModel\n onDragEnter: () => void\n}) {\n const { classes } = useStyles()\n const display = track.displays[0]\n const { height, RenderingComponent, DisplayBlurb } = display\n const { trackRefs, id, scaleFactor } = model\n const trackId = getConf(track, 'trackId')\n const ref = useRef<HTMLDivElement>(null)\n const minimized = track.minimized\n\n useEffect(() => {\n if (ref.current) {\n trackRefs[trackId] = ref.current\n }\n return () => {\n delete trackRefs[trackId]\n }\n }, [trackRefs, trackId])\n\n return (\n <div\n className={classes.trackRenderingContainer}\n style={{\n height: minimized ? 20 : height,\n }}\n onScroll={evt => display.setScrollTop(evt.currentTarget.scrollTop)}\n onDragEnter={onDragEnter}\n data-testid={`trackRenderingContainer-${id}-${trackId}`}\n >\n {!minimized ? (\n <>\n <div\n ref={ref}\n className={classes.renderingComponentContainer}\n style={{\n transform:\n scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,\n }}\n >\n <Suspense fallback={<LoadingEllipses />}>\n <RenderingComponent\n model={display}\n onHorizontalScroll={model.horizontalScroll}\n />\n </Suspense>\n </div>\n\n {DisplayBlurb ? (\n <div\n style={{\n position: 'absolute',\n left: 0,\n top: display.height - 20,\n }}\n >\n <DisplayBlurb model={display} />\n </div>\n ) : null}\n </>\n ) : null}\n </div>\n )\n})\n\nexport default TrackRenderingContainer\n","import React, { useRef } from 'react'\nimport { Paper } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { isAlive } from 'mobx-state-tree'\nimport { ErrorBoundary } from 'react-error-boundary'\n\n// jbrowse core\nimport { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { ResizeHandle, ErrorMessage } from '@jbrowse/core/ui'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport TrackLabelContainer from './TrackLabelContainer'\nimport TrackRenderingContainer from './TrackRenderingContainer'\n\nconst useStyles = makeStyles()({\n root: {\n marginTop: 2,\n },\n resizeHandle: {\n height: 3,\n boxSizing: 'border-box',\n position: 'relative',\n zIndex: 2,\n },\n})\n\ntype LGV = LinearGenomeViewModel\n\nconst TrackContainer = observer(function ({\n model,\n track,\n}: {\n model: LGV\n track: BaseTrackModel\n}) {\n const { classes } = useStyles()\n const display = track.displays[0]\n const { draggingTrackId, showTrackOutlines } = model\n const ref = useRef<HTMLDivElement>(null)\n\n return (\n <Paper\n ref={ref}\n className={classes.root}\n variant={showTrackOutlines ? 'outlined' : undefined}\n elevation={showTrackOutlines ? undefined : 0}\n onClick={event => {\n if (event.detail === 2 && !track.displays[0].featureIdUnderMouse) {\n const left = ref.current?.getBoundingClientRect().left || 0\n model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)\n }\n }}\n >\n <TrackLabelContainer track={track} view={model} />\n <ErrorBoundary FallbackComponent={e => <ErrorMessage error={e.error} />}>\n <TrackRenderingContainer\n model={model}\n track={track}\n onDragEnter={() => {\n if (\n isAlive(display) &&\n draggingTrackId !== undefined &&\n draggingTrackId !== display.id\n ) {\n model.moveTrack(draggingTrackId, track.id)\n }\n }}\n />\n </ErrorBoundary>\n <ResizeHandle\n onDrag={display.resizeHeight}\n className={classes.resizeHandle}\n />\n </Paper>\n )\n})\n\nexport default TrackContainer\n","import React, { useRef, useEffect, useState } from 'react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport { getRelativeX } from './util'\n\ntype LGV = LinearGenomeViewModel\ntype Timer = ReturnType<typeof setTimeout>\n\nexport function useSideScroll(model: LGV) {\n const [mouseDragging, setMouseDragging] = useState(false)\n // refs are to store these variables to avoid repeated rerenders associated\n // with useState/setState\n const scheduled = useRef(false)\n\n const prevX = useRef<number>(0)\n\n useEffect(() => {\n let cleanup = () => {}\n\n function globalMouseMove(event: MouseEvent) {\n event.preventDefault()\n const currX = event.clientX\n const distance = currX - prevX.current\n if (distance) {\n // use rAF to make it so multiple event handlers aren't fired per-frame\n // see https://calendar.perfplanet.com/2013/the-runtime-performance-checklist/\n if (!scheduled.current) {\n scheduled.current = true\n window.requestAnimationFrame(() => {\n model.horizontalScroll(-distance)\n scheduled.current = false\n prevX.current = event.clientX\n })\n }\n }\n }\n\n function globalMouseUp() {\n prevX.current = 0\n if (mouseDragging) {\n setMouseDragging(false)\n }\n }\n\n if (mouseDragging) {\n window.addEventListener('mousemove', globalMouseMove, true)\n window.addEventListener('mouseup', globalMouseUp, true)\n cleanup = () => {\n window.removeEventListener('mousemove', globalMouseMove, true)\n window.removeEventListener('mouseup', globalMouseUp, true)\n }\n }\n return cleanup\n }, [model, mouseDragging])\n\n function mouseDown(event: React.MouseEvent) {\n if (event.shiftKey) {\n return\n }\n // check if clicking a draggable element or a resize handle\n const target = event.target as HTMLElement\n if (target.draggable || target.dataset.resizer) {\n return\n }\n\n // otherwise do click and drag scroll\n if (event.button === 0) {\n prevX.current = event.clientX\n setMouseDragging(true)\n }\n }\n\n // this local mouseup is used in addition to the global because sometimes\n // the global add/remove are not called in time, resulting in issue #533\n function mouseUp(event: React.MouseEvent) {\n event.preventDefault()\n setMouseDragging(false)\n }\n return { mouseDown, mouseUp }\n}\n\ninterface AnchorPosition {\n offsetX: number\n clientX: number\n clientY: number\n}\n\nexport function useRangeSelect(\n ref: React.RefObject<HTMLDivElement>,\n model: LGV,\n shiftOnly?: boolean,\n) {\n const [startX, setStartX] = useState<number>()\n const [currentX, setCurrentX] = useState<number>()\n\n // clientX and clientY used for anchorPosition for menu\n // offsetX used for calculations about width of selection\n const [anchorPosition, setAnchorPosition] = useState<AnchorPosition>()\n const [guideX, setGuideX] = useState<number>()\n const mouseDragging = startX !== undefined && anchorPosition === undefined\n\n useEffect(() => {\n function computeOffsets(offsetX: number) {\n if (startX === undefined) {\n return\n }\n const leftPx = Math.min(startX, offsetX)\n const rightPx = Math.max(startX, offsetX)\n return {\n leftOffset: model.pxToBp(leftPx),\n rightOffset: model.pxToBp(rightPx),\n }\n }\n\n function globalMouseMove(event: MouseEvent) {\n if (ref.current && mouseDragging) {\n const relativeX = getRelativeX(event, ref.current)\n setCurrentX(relativeX)\n }\n }\n\n function globalMouseUp(event: MouseEvent) {\n if (startX !== undefined && ref.current) {\n const { clientX, clientY } = event\n const offsetX = getRelativeX(event, ref.current)\n // as stated above, store both clientX/Y and offsetX for different\n // purposes\n setAnchorPosition({\n offsetX,\n clientX,\n clientY,\n })\n const args = computeOffsets(offsetX)\n if (args) {\n model.setOffsets(args.leftOffset, args.rightOffset)\n }\n setGuideX(undefined)\n }\n }\n if (mouseDragging) {\n window.addEventListener('mousemove', globalMouseMove)\n window.addEventListener('mouseup', globalMouseUp)\n return () => {\n window.removeEventListener('mousemove', globalMouseMove)\n window.removeEventListener('mouseup', globalMouseUp)\n }\n }\n return () => {}\n }, [startX, mouseDragging, model, ref])\n\n useEffect(() => {\n if (\n !mouseDragging &&\n currentX !== undefined &&\n startX !== undefined &&\n Math.abs(currentX - startX) <= 3\n ) {\n handleClose()\n }\n }, [mouseDragging, currentX, startX])\n\n function mouseDown(event: React.MouseEvent<HTMLDivElement>) {\n if (shiftOnly && !event.shiftKey) {\n return\n }\n\n event.preventDefault()\n event.stopPropagation()\n const relativeX = getRelativeX(event, ref.current)\n setStartX(relativeX)\n setCurrentX(relativeX)\n }\n\n function mouseMove(event: React.MouseEvent<HTMLDivElement>) {\n if (shiftOnly) {\n if (event.shiftKey) {\n setGuideX(getRelativeX(event, ref.current))\n } else {\n setGuideX(undefined)\n }\n } else {\n setGuideX(getRelativeX(event, ref.current))\n }\n }\n\n function mouseOut() {\n setGuideX(undefined)\n model.setOffsets(undefined, undefined)\n }\n\n function handleClose() {\n setAnchorPosition(undefined)\n setStartX(undefined)\n setCurrentX(undefined)\n }\n\n function handleMenuItemClick(_: unknown, callback: () => void) {\n callback()\n handleClose()\n }\n\n const open = Boolean(anchorPosition)\n if (startX === undefined) {\n return {\n open,\n guideX,\n mouseDown,\n mouseMove,\n mouseOut,\n handleMenuItemClick,\n }\n }\n const right = anchorPosition ? anchorPosition.offsetX : currentX || 0\n const left = right < startX ? right : startX\n const width = Math.abs(right - startX)\n const leftBpOffset = model.pxToBp(left)\n const rightBpOffset = model.pxToBp(left + width)\n const numOfBpSelected = Math.ceil(width * model.bpPerPx)\n\n return {\n open,\n rubberbandOn: true,\n mouseDown,\n mouseMove,\n mouseOut,\n handleClose,\n handleMenuItemClick,\n leftBpOffset,\n rightBpOffset,\n anchorPosition,\n numOfBpSelected,\n width,\n left,\n }\n}\n\nexport function useWheelScroll(\n ref: React.RefObject<HTMLDivElement>,\n model: {\n bpPerPx: number\n zoomTo: (arg: number, arg2?: number) => void\n setScaleFactor: (arg: number) => void\n horizontalScroll: (arg: number) => void\n },\n) {\n const delta = useRef(0)\n const timeout = useRef<Timer>()\n const scheduled = useRef(false)\n useEffect(() => {\n const curr = ref.current\n\n // if ctrl is held down, zoom in with y-scroll\n // else scroll horizontally with x-scroll\n function onWheel(event: WheelEvent) {\n if (event.ctrlKey) {\n event.preventDefault()\n delta.current += event.deltaY / 500\n model.setScaleFactor(\n delta.current < 0 ? 1 - delta.current : 1 / (1 + delta.current),\n )\n if (timeout.current) {\n clearTimeout(timeout.current)\n }\n timeout.current = setTimeout(() => {\n model.setScaleFactor(1)\n model.zoomTo(\n delta.current > 0\n ? model.bpPerPx * (1 + delta.current)\n : model.bpPerPx / (1 - delta.current),\n event.clientX - (curr?.getBoundingClientRect().left || 0),\n )\n delta.current = 0\n }, 300)\n } else {\n // this is needed to stop the event from triggering \"back button\n // action\" on MacOSX etc. but is a heuristic to avoid preventing the\n // inner-track scroll behavior\n if (Math.abs(event.deltaX) > Math.abs(2 * event.deltaY)) {\n event.preventDefault()\n }\n delta.current += event.deltaX\n if (!scheduled.current) {\n // use rAF to make it so multiple event handlers aren't fired per-frame\n // see https://calendar.perfplanet.com/2013/the-runtime-performance-checklist/\n scheduled.current = true\n window.requestAnimationFrame(() => {\n model.horizontalScroll(delta.current)\n delta.current = 0\n scheduled.current = false\n })\n }\n }\n }\n if (curr) {\n curr.addEventListener('wheel', onWheel)\n return () => {\n curr.removeEventListener('wheel', onWheel)\n }\n }\n return () => {}\n }, [model, ref])\n}\n","import React from 'react'\nimport { Tooltip } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { stringify } from '@jbrowse/core/util'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n guide: {\n pointerEvents: 'none',\n height: '100%',\n width: 1,\n position: 'absolute',\n zIndex: 10,\n },\n})\n\nconst VerticalGuide = observer(function VerticalGuide({\n model,\n coordX,\n}: {\n model: LGV\n coordX: number\n}) {\n const { classes } = useStyles()\n return (\n <Tooltip open placement=\"top\" title={stringify(model.pxToBp(coordX))} arrow>\n <div\n className={classes.guide}\n style={{\n left: coordX,\n background: 'red',\n }}\n />\n </Tooltip>\n )\n})\n\nexport default VerticalGuide\n","import React, { useRef } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { Menu } from '@jbrowse/core/ui'\n\n// locals\nimport VerticalGuide from './VerticalGuide'\nimport RubberbandSpan from './RubberbandSpan'\nimport { useRangeSelect } from './hooks'\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n rubberbandControl: {\n cursor: 'crosshair',\n width: '100%',\n minHeight: 8,\n },\n})\n\nconst Rubberband = observer(function ({\n model,\n ControlComponent = <div />,\n}: {\n model: LGV\n ControlComponent?: React.ReactElement\n}) {\n const ref = useRef<HTMLDivElement>(null)\n const { classes } = useStyles()\n\n const {\n guideX,\n rubberbandOn,\n leftBpOffset,\n rightBpOffset,\n numOfBpSelected,\n width,\n left,\n anchorPosition,\n handleMenuItemClick,\n open,\n handleClose,\n mouseMove,\n mouseDown,\n mouseOut,\n } = useRangeSelect(ref, model)\n\n return (\n <>\n {guideX !== undefined ? (\n <VerticalGuide model={model} coordX={guideX} />\n ) : rubberbandOn ? (\n <RubberbandSpan\n leftBpOffset={leftBpOffset}\n rightBpOffset={rightBpOffset}\n numOfBpSelected={numOfBpSelected}\n width={width}\n left={left}\n />\n ) : null}\n {anchorPosition ? (\n <Menu\n anchorReference=\"anchorPosition\"\n anchorPosition={{\n left: anchorPosition.clientX,\n top: anchorPosition.clientY,\n }}\n onMenuItemClick={handleMenuItemClick}\n open={open}\n onClose={handleClose}\n menuItems={model.rubberBandMenuItems()}\n />\n ) : null}\n <div\n data-testid=\"rubberband_controls\"\n className={classes.rubberbandControl}\n ref={ref}\n onMouseDown={mouseDown}\n onMouseMove={mouseMove}\n onMouseOut={mouseOut}\n >\n {ControlComponent}\n </div>\n </>\n )\n})\n\nexport default Rubberband\n","import { Typography } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { ContentBlock } from '@jbrowse/core/util/blockTypes'\nimport React from 'react'\nimport { getTickDisplayStr } from '@jbrowse/core/util'\n\n// locals\nimport { ContentBlock as ContentBlockComponent } from '../../BaseLinearDisplay/components/Block'\nimport { makeTicks } from '../util'\n\nconst useStyles = makeStyles()(theme => ({\n majorTickLabel: {\n fontSize: 11,\n zIndex: 1,\n background: theme.palette.background.paper,\n lineHeight: 'normal',\n pointerEvents: 'none',\n },\n tick: {\n position: 'absolute',\n width: 0,\n display: 'flex',\n justifyContent: 'center',\n pointerEvents: 'none',\n },\n}))\n\nconst ScalebarCoordinateTicks = function ({\n block,\n bpPerPx,\n}: {\n block: ContentBlock\n bpPerPx: number\n}) {\n const { classes } = useStyles()\n const { reversed, start, end } = block\n const ticks = makeTicks(start, end, bpPerPx, true, false)\n\n return (\n <ContentBlockComponent block={block}>\n {ticks.map(({ type, base }) => {\n if (type === 'major') {\n const x = (reversed ? end - base : base - start) / bpPerPx\n const baseNumber = base + 1\n return (\n <div key={base} className={classes.tick} style={{ left: x }}>\n {baseNumber ? (\n <Typography className={classes.majorTickLabel}>\n {getTickDisplayStr(baseNumber, bpPerPx)}\n </Typography>\n ) : null}\n </div>\n )\n }\n return null\n })}\n </ContentBlockComponent>\n )\n}\n\nexport default ScalebarCoordinateTicks\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport {\n ElidedBlock as ElidedBlockComponent,\n InterRegionPaddingBlock as InterRegionPaddingBlockComponent,\n} from '../../BaseLinearDisplay/components/Block'\nimport ScalebarCoordinateTicks from './ScalebarCoordinateTicks'\n\ntype LGV = LinearGenomeViewModel\n\nconst ScalebarCoordinateLabels = observer(function ({ model }: { model: LGV }) {\n const { staticBlocks, bpPerPx } = model\n return (\n <>\n {staticBlocks.map((b, idx) => {\n const { key, widthPx } = b\n const k = `${key}-${idx}`\n if (b.type === 'ContentBlock') {\n return <ScalebarCoordinateTicks key={k} block={b} bpPerPx={bpPerPx} />\n } else if (b.type === 'ElidedBlock') {\n return <ElidedBlockComponent key={k} width={widthPx} />\n } else if (b.type === 'InterRegionPaddingBlock') {\n return (\n <InterRegionPaddingBlockComponent\n key={k}\n width={widthPx}\n style={{ background: 'none' }}\n boundary={b.variant === 'boundary'}\n />\n )\n } else {\n return null\n }\n })}\n </>\n )\n})\n\nexport default ScalebarCoordinateLabels\n","import React from 'react'\nimport { Typography } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()(theme => ({\n refLabel: {\n fontSize: 11,\n position: 'absolute',\n left: 2,\n top: -1,\n fontWeight: 'bold',\n lineHeight: 'normal',\n zIndex: 1,\n background: theme.palette.background.paper,\n },\n b0: {\n left: 0,\n zIndex: 100,\n },\n}))\n\nconst ScalebarRefNameLabels = observer(function ({ model }: { model: LGV }) {\n const { classes, cx } = useStyles()\n const { staticBlocks, offsetPx, scaleBarDisplayPrefix } = model\n\n // find the block that needs pinning to the left side for context\n let lastLeftBlock = 0\n staticBlocks.forEach((block, i) => {\n if (block.offsetPx - offsetPx < 0) {\n lastLeftBlock = i\n }\n })\n const val = scaleBarDisplayPrefix()\n const b0 = staticBlocks.blocks[0]\n return (\n <>\n {b0?.type !== 'ContentBlock' && val ? (\n <Typography className={cx(classes.b0, classes.refLabel)}>\n {val}\n </Typography>\n ) : null}\n {staticBlocks.map((block, index) => {\n const {\n offsetPx: blockOffsetPx,\n isLeftEndOfDisplayedRegion,\n key,\n type,\n refName,\n } = block\n const last = (index = lastLeftBlock)\n return type === 'ContentBlock' &&\n (isLeftEndOfDisplayedRegion || last) ? (\n <Typography\n key={`refLabel-${key}-${index}`}\n style={{\n left: last\n ? Math.max(0, -offsetPx)\n : blockOffsetPx - offsetPx - 1,\n paddingLeft: last ? 0 : 1,\n }}\n className={classes.refLabel}\n data-testid={`refLabel-${refName}`}\n >\n {last && val ? `${val}:` : ''}\n {refName}\n </Typography>\n ) : null\n })}\n </>\n )\n})\n\nexport default ScalebarRefNameLabels\n","import { Paper } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport React from 'react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport ScalebarCoordinateLabels from './ScalebarCoordinateLabels'\nimport ScalebarRefNameLabels from './ScalebarRefNameLabels'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n container: {\n overflow: 'hidden',\n position: 'relative',\n },\n zoomContainer: {\n position: 'relative',\n zIndex: 1,\n },\n scalebar: {\n position: 'absolute',\n display: 'flex',\n pointerEvents: 'none',\n },\n})\n\ninterface ScalebarProps {\n model: LGV\n style?: React.CSSProperties\n className?: string\n}\n\nconst Scalebar = observer(\n React.forwardRef<HTMLDivElement, ScalebarProps>(function Scalebar2(\n { model, style, className, ...other },\n ref,\n ) {\n const { classes, cx } = useStyles()\n const { staticBlocks, offsetPx, scaleFactor } = model\n const offsetLeft = staticBlocks.offsetPx - offsetPx\n return (\n <Paper\n data-resizer=\"true\" // used to avoid click-and-drag scrolls on trackscontainer\n className={cx(classes.container, className)}\n variant=\"outlined\"\n ref={ref}\n style={style}\n {...other}\n >\n <div\n className={classes.zoomContainer}\n style={{\n transform: scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,\n }}\n >\n <div\n className={classes.scalebar}\n style={{\n left: offsetLeft - 1,\n width: staticBlocks.totalWidthPx,\n ...style,\n }}\n >\n <ScalebarCoordinateLabels model={model} />\n </div>\n </div>\n <ScalebarRefNameLabels model={model} />\n </Paper>\n )\n }),\n)\n\nexport default Scalebar\n","import React from 'react'\nimport { ContentBlock } from '@jbrowse/core/util/blockTypes'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { LinearGenomeViewModel } from '..'\nimport {\n ContentBlock as ContentBlockComponent,\n ElidedBlock as ElidedBlockComponent,\n InterRegionPaddingBlock as InterRegionPaddingBlockComponent,\n} from '../../BaseLinearDisplay/components/Block'\n\nimport { makeTicks } from '../util'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()(theme => ({\n verticalGuidesZoomContainer: {\n position: 'absolute',\n height: '100%',\n width: '100%',\n zIndex: 1,\n pointerEvents: 'none',\n },\n verticalGuidesContainer: {\n position: 'absolute',\n height: '100%',\n zIndex: 1,\n pointerEvents: 'none',\n display: 'flex',\n },\n tick: {\n position: 'absolute',\n height: '100%',\n width: 1,\n },\n majorTick: {\n background: theme.palette.action.disabled,\n },\n minorTick: {\n background: theme.palette.divider,\n },\n}))\n\nfunction RenderedBlockLines({\n block,\n bpPerPx,\n}: {\n block: ContentBlock\n bpPerPx: number\n}) {\n const { classes, cx } = useStyles()\n const ticks = makeTicks(block.start, block.end, bpPerPx)\n return (\n <ContentBlockComponent block={block}>\n {ticks.map(({ type, base }) => {\n const x =\n (block.reversed ? block.end - base : base - block.start) / bpPerPx\n return (\n <div\n key={base}\n className={cx(\n classes.tick,\n type === 'major' || type === 'labeledMajor'\n ? classes.majorTick\n : classes.minorTick,\n )}\n style={{ left: x }}\n />\n )\n })}\n </ContentBlockComponent>\n )\n}\nconst RenderedVerticalGuides = observer(({ model }: { model: LGV }) => {\n const { staticBlocks, bpPerPx } = model\n return (\n <>\n {staticBlocks.map((block, index) => {\n const k = `${block.key}-${index}`\n if (block.type === 'ContentBlock') {\n return <RenderedBlockLines key={k} block={block} bpPerPx={bpPerPx} />\n } else if (block.type === 'ElidedBlock') {\n return <ElidedBlockComponent key={k} width={block.widthPx} />\n } else if (block.type === 'InterRegionPaddingBlock') {\n return (\n <InterRegionPaddingBlockComponent\n key={k}\n width={block.widthPx}\n boundary={block.variant === 'boundary'}\n />\n )\n }\n return null\n })}\n </>\n )\n})\nconst Gridlines = observer(function ({ model }: { model: LGV }) {\n const { classes } = useStyles()\n // find the block that needs pinning to the left side for context\n const offsetLeft = model.staticBlocks.offsetPx - model.offsetPx\n return (\n <div\n className={classes.verticalGuidesZoomContainer}\n style={{\n transform:\n model.scaleFactor !== 1 ? `scaleX(${model.scaleFactor})` : undefined,\n }}\n >\n <div\n className={classes.verticalGuidesContainer}\n style={{\n left: offsetLeft,\n width: model.staticBlocks.totalWidthPx,\n }}\n >\n <RenderedVerticalGuides model={model} />\n </div>\n </div>\n )\n})\n\nexport default Gridlines\n","import React, { useRef } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()(theme => ({\n centerLineContainer: {\n background: 'transparent',\n height: '100%',\n zIndex: 5, // above the track but under menu\n position: 'absolute',\n border: `1px ${theme.palette.action.active} dashed`,\n borderTop: 'none',\n borderBottom: 'none',\n pointerEvents: 'none',\n },\n centerLineText: {\n position: 'absolute',\n pointerEvents: 'none',\n whiteSpace: 'nowrap',\n fontWeight: 'bold',\n },\n}))\n\nconst CenterLine = observer(function ({ model }: { model: LGV }) {\n const { bpPerPx, centerLineInfo, trackHeights, tracks, width } = model\n const ref = useRef<HTMLDivElement>(null)\n const { classes } = useStyles()\n const startingPosition = width / 2\n\n return tracks.length ? (\n <div\n data-testid=\"centerline_container\"\n className={classes.centerLineContainer}\n role=\"presentation\"\n ref={ref}\n style={{\n left: `${startingPosition}px`,\n width: Math.max(1 / bpPerPx, 1),\n }}\n >\n {centerLineInfo && (\n <div\n // text that indicates what bp is center, positioned\n // at the bottom right of the center line\n data-testid=\"centerline_text\"\n className={classes.centerLineText}\n role=\"presentation\"\n style={{\n left: Math.max(1 / bpPerPx, 1) + 5,\n top: trackHeights,\n }}\n >\n {/* change bp to refName */}\n {centerLineInfo.refName}:{' '}\n {Math.max(Math.round(centerLineInfo.offset) + 1, 0)}\n </div>\n )}\n </div>\n ) : null\n})\n\nexport default CenterLine\n","import React, { useRef, useState } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { colord } from '@jbrowse/core/util/colord'\nimport { Region, SessionWithWidgets, getSession } from '@jbrowse/core/util'\nimport { Menu } from '@jbrowse/core/ui'\nimport { IconButton, Tooltip } from '@mui/material'\n\n// icons\nimport LinkIcon from '@mui/icons-material/Link'\nimport CloseIcon from '@mui/icons-material/Close'\nimport BookmarkIcon from '@mui/icons-material/Bookmark'\n\n// locals\nimport { LinearGenomeViewModel } from '../model'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()(theme => ({\n highlight: {\n height: '100%',\n position: 'absolute',\n overflow: 'hidden',\n background: colord(theme.palette.highlight.main).alpha(0.35).toRgbString(),\n },\n linkIcon: {\n color: colord(theme.palette.highlight.main).darken(0.2).toRgbString(),\n },\n}))\n\nconst Highlight = observer(function Highlight({\n model,\n highlight,\n}: {\n model: LGV\n highlight: {\n assemblyName: string\n refName: string\n start: number\n end: number\n }\n}) {\n const { classes } = useStyles()\n const [open, setOpen] = useState(false)\n const anchorEl = useRef(null)\n const session = getSession(model) as SessionWithWidgets\n const { assemblyManager } = session\n\n const dismissHighlight = () => {\n model.removeHighlight(highlight)\n }\n\n function handleClose() {\n setOpen(false)\n }\n\n // coords\n const mapCoords = (r: {\n assemblyName: string\n refName: string\n start: number\n end: number\n }) => {\n const s = model.bpToPx({\n refName: r.refName,\n coord: r.start,\n })\n const e = model.bpToPx({\n refName: r.refName,\n coord: r.end,\n })\n return s && e\n ? {\n width: Math.max(Math.abs(e.offsetPx - s.offsetPx), 3),\n left: Math.min(s.offsetPx, e.offsetPx) - model.offsetPx,\n }\n : undefined\n }\n\n const asm = assemblyManager.get(highlight.assemblyName)\n\n const h = mapCoords({\n ...highlight,\n refName: asm?.getCanonicalRefName(highlight.refName) ?? highlight.refName,\n })\n\n return h ? (\n <div\n className={classes.highlight}\n style={{\n left: h.left,\n width: h.width,\n }}\n >\n <Tooltip title=\"Highlighted from URL parameter\" arrow>\n <IconButton\n ref={anchorEl}\n onClick={() => {\n setOpen(true)\n }}\n style={{ zIndex: 3 }}\n >\n <LinkIcon fontSize=\"small\" className={classes.linkIcon} />\n </IconButton>\n </Tooltip>\n <Menu\n anchorEl={anchorEl.current}\n onMenuItemClick={(_event, callback) => {\n callback(session)\n handleClose()\n }}\n open={open}\n onClose={handleClose}\n menuItems={[\n {\n label: 'Dismiss highlight',\n icon: CloseIcon,\n onClick: () => {\n dismissHighlight()\n },\n },\n {\n label: 'Bookmark highlighted region',\n icon: BookmarkIcon,\n onClick: () => {\n let bookmarkWidget = session.widgets.get('GridBookmark')\n if (!bookmarkWidget) {\n bookmarkWidget = session.addWidget(\n 'GridBookmarkWidget',\n 'GridBookmark',\n )\n }\n // @ts-expect-error\n bookmarkWidget.addBookmark(highlight as Region)\n dismissHighlight()\n },\n },\n ]}\n />\n </div>\n ) : null\n})\n\nconst HighlightGroup = observer(function HighlightGroup({\n model,\n}: {\n model: LGV\n}) {\n return model.highlight.map((highlight, idx) => (\n <Highlight\n key={`${JSON.stringify(highlight)}-${idx}`}\n model={model}\n highlight={highlight}\n />\n ))\n})\n\nexport default HighlightGroup\n","import React, { useRef } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { Menu } from '@jbrowse/core/ui'\nimport { getEnv } from '@jbrowse/core/util'\n\n// local utils\nimport { LinearGenomeViewModel } from '..'\nimport { useSideScroll, useRangeSelect, useWheelScroll } from './hooks'\n\n// local components\nimport Rubberband from './Rubberband'\nimport Scalebar from './Scalebar'\nimport Gridlines from './Gridlines'\nimport CenterLine from './CenterLine'\nimport VerticalGuide from './VerticalGuide'\nimport RubberbandSpan from './RubberbandSpan'\nimport HighlightGroup from './Highlight'\nimport { SCALE_BAR_HEIGHT } from '../consts'\n\nconst useStyles = makeStyles()({\n tracksContainer: {\n position: 'relative',\n overflow: 'hidden',\n },\n})\n\ntype LGV = LinearGenomeViewModel\n\nconst TracksContainer = observer(function TracksContainer({\n children,\n model,\n}: {\n children: React.ReactNode\n model: LGV\n}) {\n const { classes } = useStyles()\n const { pluginManager } = getEnv(model)\n const { mouseDown: mouseDown1, mouseUp } = useSideScroll(model)\n const ref = useRef<HTMLDivElement>(null)\n const {\n guideX,\n rubberbandOn,\n leftBpOffset,\n rightBpOffset,\n numOfBpSelected,\n width,\n left,\n anchorPosition,\n open,\n handleMenuItemClick,\n handleClose,\n mouseMove,\n mouseDown: mouseDown2,\n } = useRangeSelect(ref, model, true)\n useWheelScroll(ref, model)\n\n const additional = pluginManager.evaluateExtensionPoint(\n 'LinearGenomeView-TracksContainerComponent',\n undefined,\n { model },\n ) as React.ReactNode\n\n return (\n <div\n ref={ref}\n data-testid=\"trackContainer\"\n className={classes.tracksContainer}\n onMouseDown={event => {\n mouseDown1(event)\n mouseDown2(event)\n }}\n onMouseMove={mouseMove}\n onMouseUp={mouseUp}\n >\n {model.showGridlines ? <Gridlines model={model} /> : null}\n {model.showCenterLine ? <CenterLine model={model} /> : null}\n {guideX !== undefined ? (\n <VerticalGuide model={model} coordX={guideX} />\n ) : rubberbandOn ? (\n <RubberbandSpan\n leftBpOffset={leftBpOffset}\n rightBpOffset={rightBpOffset}\n numOfBpSelected={numOfBpSelected}\n width={width}\n left={left}\n />\n ) : null}\n {anchorPosition ? (\n <Menu\n anchorReference=\"anchorPosition\"\n anchorPosition={{\n left: anchorPosition.clientX,\n top: anchorPosition.clientY,\n }}\n onMenuItemClick={handleMenuItemClick}\n open={open}\n onClose={handleClose}\n menuItems={model.rubberBandMenuItems()}\n />\n ) : null}\n\n <Rubberband\n model={model}\n ControlComponent={\n <Scalebar\n model={model}\n style={{\n height: SCALE_BAR_HEIGHT,\n boxSizing: 'border-box',\n }}\n />\n }\n />\n <HighlightGroup model={model} />\n {additional}\n {children}\n </div>\n )\n})\n\nexport default TracksContainer\n","import React, { lazy, Suspense, useEffect, useRef } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { LoadingEllipses } from '@jbrowse/core/ui'\nimport { getSession } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport TrackContainer from './TrackContainer'\nimport TracksContainer from './TracksContainer'\n\nconst ImportForm = lazy(() => import('./ImportForm'))\nconst NoTracksActiveButton = lazy(() => import('./NoTracksActiveButton'))\n\nconst useStyles = makeStyles()(theme => ({\n note: {\n textAlign: 'center',\n paddingTop: theme.spacing(1),\n paddingBottom: theme.spacing(1),\n },\n rel: {\n position: 'relative',\n },\n top: {\n zIndex: 1000,\n },\n}))\n\nconst LinearGenomeView = observer(function ({\n model,\n}: {\n model: LinearGenomeViewModel\n}) {\n const { tracks, error, initialized, hasDisplayedRegions } = model\n const ref = useRef<HTMLDivElement>(null)\n const session = getSession(model)\n const { classes } = useStyles()\n useEffect(() => {\n // sets the focused view id based on a click within the LGV;\n // necessary for subviews to be focused properly\n function handleSelectView(e: Event) {\n if (e.target instanceof Element && ref.current?.contains(e.target)) {\n session.setFocusedViewId?.(model.id)\n }\n }\n\n document.addEventListener('mousedown', handleSelectView)\n document.addEventListener('keydown', handleSelectView)\n return () => {\n document.removeEventListener('mousedown', handleSelectView)\n document.removeEventListener('keydown', handleSelectView)\n }\n }, [session, model])\n\n if (!initialized && !error) {\n return <LoadingEllipses variant=\"h6\" />\n }\n if (!hasDisplayedRegions || error) {\n return <ImportForm model={model} />\n }\n\n const MiniControlsComponent = model.MiniControlsComponent()\n const HeaderComponent = model.HeaderComponent()\n\n return (\n <div\n className={classes.rel}\n ref={ref}\n onMouseLeave={() => {\n session.setHovered(undefined)\n }}\n onMouseMove={event => {\n const c = ref.current\n if (!c) {\n return\n }\n const { tracks } = model\n const leftPx = event.clientX - c.getBoundingClientRect().left\n const hoverPosition = model.pxToBp(leftPx)\n const hoverFeature = tracks.find(t => t.displays[0].featureUnderMouse)\n session.setHovered({ hoverPosition, hoverFeature })\n }}\n >\n <HeaderComponent model={model} />\n <MiniControlsComponent model={model} />\n <TracksContainer model={model}>\n {!tracks.length ? (\n <Suspense fallback={<React.Fragment />}>\n <NoTracksActiveButton model={model} />\n </Suspense>\n ) : (\n tracks.map(track => (\n <TrackContainer key={track.id} model={model} track={track} />\n ))\n )}\n </TracksContainer>\n </div>\n )\n})\n\nexport default LinearGenomeView\n","import React from 'react'\nimport { useTheme, alpha } from '@mui/material'\nimport { observer } from 'mobx-react'\n\n// core\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport { getFillProps, getStrokeProps } from '@jbrowse/core/util'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport { HEADER_BAR_HEIGHT } from '../consts'\n\nconst OverviewScalebarPolygon = observer(function ({\n model,\n overview,\n useOffset = true,\n}: {\n model: LinearGenomeViewModel\n overview: Base1DViewModel\n useOffset?: boolean\n}) {\n const theme = useTheme()\n const multiplier = Number(useOffset)\n const { interRegionPaddingWidth, offsetPx, dynamicBlocks, cytobandOffset } =\n model\n const { contentBlocks, totalWidthPxWithoutBorders } = dynamicBlocks\n const polygonColor = theme.palette.tertiary.light\n\n // catches possible null from at's below\n if (!contentBlocks.length) {\n return null\n }\n const first = contentBlocks.at(0)!\n const last = contentBlocks.at(-1)!\n const topLeft =\n (overview.bpToPx({\n ...first,\n coord: first.reversed ? first.end : first.start,\n }) || 0) +\n cytobandOffset * multiplier\n const topRight =\n (overview.bpToPx({\n ...last,\n coord: last.reversed ? last.start : last.end,\n }) || 0) +\n cytobandOffset * multiplier\n\n const startPx = Math.max(0, -offsetPx)\n const endPx =\n startPx +\n totalWidthPxWithoutBorders +\n (contentBlocks.length * interRegionPaddingWidth) / 2\n\n const points = [\n [startPx, HEADER_BAR_HEIGHT],\n [endPx, HEADER_BAR_HEIGHT],\n [topRight, 0],\n [topLeft, 0],\n ]\n\n return (\n <polygon\n points={points.toString()}\n {...getFillProps(alpha(polygonColor, 0.3))}\n {...getStrokeProps(alpha(polygonColor, 0.8))}\n />\n )\n})\n\nexport default OverviewScalebarPolygon\n","import React, { Suspense, lazy, useState } from 'react'\n\nimport { IconButton, InputAdornment } from '@mui/material'\n\n// icons\nimport SearchIcon from '@mui/icons-material/Search'\nimport HelpIcon from '@mui/icons-material/Help'\n\n// lazy\nconst HelpDialog = lazy(() => import('./HelpDialog'))\n\nfunction HelpAdornment() {\n const [isHelpDialogDisplayed, setHelpDialogDisplayed] = useState(false)\n return (\n <>\n <IconButton\n onClick={() => {\n setHelpDialogDisplayed(true)\n }}\n size=\"small\"\n >\n <HelpIcon fontSize=\"small\" />\n </IconButton>\n {isHelpDialogDisplayed ? (\n <Suspense fallback={null}>\n <HelpDialog\n handleClose={() => {\n setHelpDialogDisplayed(false)\n }}\n />\n </Suspense>\n ) : null}\n </>\n )\n}\n\nexport default function EndAdornment({\n showHelp,\n endAdornment,\n}: {\n showHelp?: boolean\n endAdornment: React.ReactNode\n}) {\n return (\n <>\n <InputAdornment position=\"end\" style={{ marginRight: 7 }}>\n <SearchIcon fontSize=\"small\" />\n {showHelp ? <HelpAdornment /> : null}\n </InputAdornment>\n {endAdornment}\n </>\n )\n}\n","import React from 'react'\nimport {\n AutocompleteRenderInputParams,\n TextField,\n TextFieldProps as TFP,\n} from '@mui/material'\n\n// locals\nimport EndAdornment from './EndAdornment'\n\nexport default function AutocompleteTextField({\n TextFieldProps,\n inputBoxVal,\n params,\n showHelp,\n setInputValue,\n setCurrentSearch,\n}: {\n TextFieldProps: TFP\n inputBoxVal: string\n showHelp?: boolean\n params: AutocompleteRenderInputParams\n setInputValue: (arg: string) => void\n setCurrentSearch: (arg: string) => void\n}) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const { helperText, InputProps = {} } = TextFieldProps\n return (\n <TextField\n onBlur={() => {\n // this is used to restore a refName or the non-user-typed input\n // to the box on blurring\n setInputValue(inputBoxVal)\n }}\n {...params}\n {...TextFieldProps}\n size=\"small\"\n helperText={helperText}\n slotProps={{\n input: {\n ...params.InputProps,\n ...InputProps,\n\n endAdornment: (\n <EndAdornment\n showHelp={showHelp}\n endAdornment={params.InputProps.endAdornment}\n />\n ),\n },\n }}\n placeholder=\"Search for location\"\n onChange={e => {\n setCurrentSearch(e.target.value)\n }}\n />\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { observer } from 'mobx-react'\nimport { getSession, useDebounce, measureText } from '@jbrowse/core/util'\nimport BaseResult, {\n RefSequenceResult,\n} from '@jbrowse/core/TextSearch/BaseResults'\nimport { Autocomplete, TextFieldProps as TFP } from '@mui/material'\n\n// locals\nimport { LinearGenomeViewModel } from '../../model'\nimport { getDeduplicatedResult, getFiltered, Option } from './util'\nimport AutocompleteTextField from './AutocompleteTextField'\n\nconst RefNameAutocomplete = observer(function ({\n model,\n onSelect,\n assemblyName,\n style,\n fetchResults,\n onChange,\n value,\n showHelp = true,\n minWidth = 200,\n maxWidth = 550,\n TextFieldProps = {},\n}: {\n model: LinearGenomeViewModel\n onSelect?: (region: BaseResult) => void\n onChange?: (val: string) => void\n assemblyName?: string\n value?: string\n fetchResults: (query: string) => Promise<BaseResult[]>\n style?: React.CSSProperties\n minWidth?: number\n maxWidth?: number\n showHelp?: boolean\n TextFieldProps?: TFP\n}) {\n const session = getSession(model)\n const { assemblyManager } = session\n const [open, setOpen] = useState(false)\n const [loaded, setLoaded] = useState(true)\n const [currentSearch, setCurrentSearch] = useState('')\n const [inputValue, setInputValue] = useState('')\n const [searchOptions, setSearchOptions] = useState<Option[]>()\n const debouncedSearch = useDebounce(currentSearch, 300)\n const assembly = assemblyName ? assemblyManager.get(assemblyName) : undefined\n const { coarseVisibleLocStrings, hasDisplayedRegions } = model\n\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n if (debouncedSearch === '' || !assemblyName) {\n return\n }\n\n setLoaded(false)\n const results = await fetchResults(debouncedSearch)\n setLoaded(true)\n setSearchOptions(getDeduplicatedResult(results))\n } catch (e) {\n console.error(e)\n session.notifyError(`${e}`, e)\n }\n })()\n }, [assemblyName, fetchResults, debouncedSearch, session])\n\n const inputBoxVal = coarseVisibleLocStrings || value || ''\n\n // heuristic, text width + 60 accommodates help icon and search icon\n const width = Math.min(\n Math.max(measureText(inputBoxVal, 14) + 100, minWidth),\n maxWidth,\n )\n\n const refNames = assembly?.refNames\n const regionOptions =\n refNames?.map(refName => ({\n result: new RefSequenceResult({\n refName,\n label: refName,\n matchedAttribute: 'refName',\n }),\n })) || []\n\n // notes on implementation:\n // The selectOnFocus setting helps highlight the field when clicked\n return (\n <Autocomplete\n data-testid=\"autocomplete\"\n disableListWrap\n disableClearable\n disabled={!assemblyName}\n freeSolo\n includeInputInList\n selectOnFocus\n style={{ ...style, width }}\n value={inputBoxVal}\n loading={!loaded}\n inputValue={inputValue}\n onInputChange={(_event, newInputValue) => {\n setInputValue(newInputValue)\n onChange?.(newInputValue)\n }}\n loadingText=\"loading results\"\n open={open}\n onOpen={() => {\n setOpen(true)\n }}\n onClose={() => {\n setOpen(false)\n setLoaded(true)\n if (hasDisplayedRegions) {\n setCurrentSearch('')\n setSearchOptions(undefined)\n }\n }}\n onChange={(_event, selectedOption) => {\n if (!selectedOption || !assemblyName) {\n return\n }\n\n if (typeof selectedOption === 'string') {\n // handles string inputs on keyPress enter\n onSelect?.(new BaseResult({ label: selectedOption }))\n } else {\n onSelect?.(selectedOption.result)\n }\n setInputValue(inputBoxVal)\n }}\n options={searchOptions?.length ? searchOptions : regionOptions}\n getOptionDisabled={option => option.group === 'limitOption'}\n filterOptions={(opts, { inputValue }) => getFiltered(opts, inputValue)}\n renderInput={params => (\n <AutocompleteTextField\n showHelp={showHelp}\n params={params}\n inputBoxVal={inputBoxVal}\n TextFieldProps={TextFieldProps}\n setCurrentSearch={setCurrentSearch}\n setInputValue={setInputValue}\n />\n )}\n getOptionLabel={opt =>\n typeof opt === 'string' ? opt : opt.result.getDisplayString()\n }\n />\n )\n})\n\nexport default RefNameAutocomplete\n","import BaseResult from '@jbrowse/core/TextSearch/BaseResults'\n\nexport interface Option {\n group?: string\n result: BaseResult\n}\n\n// filter so don't need re-filtering\nfunction filterOptions(options: Option[], searchQuery: string) {\n return options.filter(\n ({ result }) =>\n result.getLabel().toLowerCase().includes(searchQuery) ||\n result.matchedObject,\n )\n}\n\n// the logic of this method is to only apply a filter to RefSequenceResults\n// because they do not have a matchedObject. the trix search results already\nexport function getFiltered(opts: Option[], inputValue: string) {\n const filtered = filterOptions(opts, inputValue.toLocaleLowerCase())\n return [\n ...filtered.slice(0, 100),\n ...(filtered.length > 100\n ? [\n {\n group: 'limitOption',\n result: new BaseResult({\n label: 'keep typing for more results',\n }),\n },\n ]\n : []),\n ]\n}\n\nexport function aggregateResults(results: BaseResult[]) {\n const m: Record<string, BaseResult[]> = {}\n\n for (const result of results) {\n const displayString = result.getDisplayString()\n if (!m[displayString]) {\n m[displayString] = []\n }\n m[displayString].push(result)\n }\n return m\n}\n\nexport function getDeduplicatedResult(results: BaseResult[]) {\n return Object.entries(aggregateResults(results)).map(\n ([displayString, results]) =>\n results.length === 1\n ? {\n result: results[0]!,\n }\n : {\n // deduplicate a \"multi-result\"\n result: new BaseResult({\n displayString,\n results,\n label: displayString,\n }),\n },\n )\n}\n","import React, { useRef } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { Popover, Typography, alpha } from '@mui/material'\nimport { stringify, toLocale } from '@jbrowse/core/util'\n\nconst useStyles = makeStyles()(theme => {\n const { tertiary } = theme.palette\n const background = alpha(tertiary.light, 0.7)\n return {\n rubberband: {\n height: '100%',\n background,\n position: 'absolute',\n zIndex: 10,\n textAlign: 'center',\n overflow: 'hidden',\n },\n rubberbandControl: {\n cursor: 'crosshair',\n width: '100%',\n minHeight: 8,\n },\n rubberbandText: {\n color: tertiary.contrastText,\n },\n popover: {\n mouseEvents: 'none',\n cursor: 'crosshair',\n },\n paper: {\n paddingLeft: theme.spacing(1),\n paddingRight: theme.spacing(1),\n },\n }\n})\n\ninterface Offset {\n coord: number\n refName?: string\n oob?: boolean\n}\n\nexport default function RubberbandSpan({\n leftBpOffset,\n rightBpOffset,\n numOfBpSelected,\n left,\n width,\n}: {\n leftBpOffset: Offset\n rightBpOffset: Offset\n numOfBpSelected?: number\n left: number\n width: number\n}) {\n const ref = useRef<HTMLDivElement>(null)\n const { classes } = useStyles()\n return (\n <>\n {ref.current ? (\n <>\n <Popover\n className={classes.popover}\n classes={{ paper: classes.paper }}\n open\n anchorEl={ref.current}\n anchorOrigin={{ vertical: 'top', horizontal: 'left' }}\n transformOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n keepMounted\n disableRestoreFocus\n >\n <Typography>{stringify(leftBpOffset)}</Typography>\n </Popover>\n <Popover\n className={classes.popover}\n classes={{ paper: classes.paper }}\n open\n anchorEl={ref.current}\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n transformOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n keepMounted\n disableRestoreFocus\n >\n <Typography>{stringify(rightBpOffset)}</Typography>\n </Popover>\n </>\n ) : null}\n <div ref={ref} className={classes.rubberband} style={{ left, width }}>\n {numOfBpSelected ? (\n <Typography variant=\"h6\" className={classes.rubberbandText}>\n {toLocale(numOfBpSelected)} bp\n </Typography>\n ) : null}\n </div>\n </>\n )\n}\n","import { Assembly } from '@jbrowse/core/assemblyManager/assembly'\nimport { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'\nimport { dedupe, TextSearchManager } from '@jbrowse/core/util'\nimport BaseResult from '@jbrowse/core/TextSearch/BaseResults'\n\nexport async function fetchResults({\n queryString,\n searchType,\n searchScope,\n rankSearchResults,\n textSearchManager,\n assembly,\n}: {\n queryString: string\n searchScope: SearchScope\n rankSearchResults: (results: BaseResult[]) => BaseResult[]\n searchType?: SearchType\n textSearchManager?: TextSearchManager\n assembly?: Assembly\n}) {\n if (!textSearchManager) {\n console.warn('No text search manager')\n }\n\n const textSearchResults = await textSearchManager?.search(\n {\n queryString,\n searchType,\n },\n searchScope,\n rankSearchResults,\n )\n\n const refNameResults = assembly?.allRefNames\n ?.filter(ref => ref.toLowerCase().startsWith(queryString.toLowerCase()))\n .slice(0, 10)\n .map(r => new BaseResult({ label: r }))\n\n return dedupe(\n [...(refNameResults || []), ...(textSearchResults || [])],\n elt => elt.getId(),\n )\n}\n\n// splits on the last instance of a character\nexport function splitLast(str: string, split: string): [string, string] {\n const lastIndex = str.lastIndexOf(split)\n if (lastIndex === -1) {\n return [str, '']\n } else {\n const before = str.slice(0, lastIndex)\n const after = str.slice(lastIndex + 1)\n return [before, after]\n }\n}\n\nexport function getRelativeX(\n event: { clientX: number; target: EventTarget | null },\n element: HTMLElement | null,\n) {\n return event.clientX - (element?.getBoundingClientRect().left || 0)\n}\n\nexport function getCytobands(assembly: Assembly | undefined, refName: string) {\n return (\n assembly?.cytobands\n ?.map(f => ({\n refName:\n assembly.getCanonicalRefName(f.get('refName')) || f.get('refName'),\n start: f.get('start'),\n end: f.get('end'),\n type: f.get('type') as string,\n }))\n .filter(f => f.refName === refName) || []\n )\n}\n","export const HEADER_BAR_HEIGHT = 48\nexport const HEADER_OVERVIEW_HEIGHT = 20\nexport const SCALE_BAR_HEIGHT = 17\nexport const RESIZE_HANDLE_HEIGHT = 3\nexport const INTER_REGION_PADDING_WIDTH = 2\nexport const SPACING = 7\nexport const WIDGET_HEIGHT = 32\n","import React from 'react'\nimport { useTheme } from '@mui/material'\nimport { stripAlpha } from '@jbrowse/core/util'\n\nexport default function SVGBackground({\n width,\n height,\n shift,\n}: {\n width: number\n height: number\n shift: number\n}) {\n const theme = useTheme()\n return (\n <rect\n width={width + shift * 2}\n height={height}\n fill={stripAlpha(theme.palette.background.default)}\n />\n )\n}\n","import React from 'react'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\n// SVG component, region separator\nexport default function SVGRegionSeparators({\n model,\n height,\n}: {\n height: number\n model: LGV\n}) {\n const { dynamicBlocks, offsetPx, interRegionPaddingWidth } = model\n return (\n <>\n {dynamicBlocks.contentBlocks.slice(1).map(block => (\n <rect\n key={block.key}\n x={block.offsetPx - offsetPx - interRegionPaddingWidth}\n width={interRegionPaddingWidth}\n y={0}\n height={height}\n fill=\"grey\"\n />\n ))}\n </>\n )\n}\n","import React from 'react'\nimport { useTheme } from '@mui/material'\nimport { coarseStripHTML, stripAlpha } from '@jbrowse/core/util'\n\nexport default function SVGTrackLabel({\n trackLabels,\n trackName,\n fontSize,\n trackLabelOffset,\n x,\n}: {\n trackName: string\n trackLabels: string\n fontSize: number\n trackLabelOffset: number\n x: number\n}) {\n const theme = useTheme()\n const fill = stripAlpha(theme.palette.text.primary)\n const xoff = trackLabels === 'overlay' ? 5 : 0\n const yoff = trackLabels === 'offset' ? 5 : 0\n const name = coarseStripHTML(trackName)\n return trackLabels !== 'none' ? (\n <g>\n {trackLabels === 'left' ? (\n <text\n x={trackLabelOffset - 40}\n y={20}\n fill={fill}\n fontSize={fontSize}\n dominantBaseline=\"hanging\"\n textAnchor=\"end\"\n >\n {name}\n </text>\n ) : (\n <text\n x={x + xoff}\n y={yoff}\n fill={fill}\n fontSize={fontSize}\n dominantBaseline=\"hanging\"\n >\n {name}\n </text>\n )}\n </g>\n ) : null\n}\n","import React from 'react'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\nimport { getSession } from '@jbrowse/core/util'\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport SVGRegionSeparators from './SVGRegionSeparators'\nimport SVGTrackLabel from './SVGTrackLabel'\n\ntype LGV = LinearGenomeViewModel\n\ninterface DisplayResult {\n track: {\n configuration: AnyConfigurationModel\n displays: { height: number }[]\n }\n result: string\n}\n\n// SVG component, tracks\nexport default function SVGTracks({\n displayResults,\n model,\n offset,\n textHeight,\n fontSize,\n trackLabels = 'offset',\n trackLabelOffset = 0,\n}: {\n displayResults: DisplayResult[]\n model: LGV\n offset: number\n textHeight: number\n fontSize: number\n trackLabels?: string\n trackLabelOffset?: number\n}) {\n const session = getSession(model)\n const textOffset = trackLabels === 'offset' ? textHeight : 0\n return (\n <>\n {displayResults.map(({ track, result }) => {\n const current = offset\n const conf = track.configuration\n const trackName = getTrackName(conf, session)\n const display = track.displays[0]!\n const x = Math.max(-model.offsetPx, 0)\n offset += display.height + textOffset\n return (\n <g key={conf.trackId} transform={`translate(0 ${current})`}>\n <g transform={`translate(${trackLabelOffset} ${textOffset})`}>\n <SVGRegionSeparators model={model} height={display.height} />\n {result}\n </g>\n <SVGTrackLabel\n trackName={trackName}\n fontSize={fontSize}\n trackLabels={trackLabels}\n trackLabelOffset={trackLabelOffset}\n x={x}\n />\n </g>\n )\n })}\n </>\n )\n}\n","import React from 'react'\nimport { getTickDisplayStr, stripAlpha } from '@jbrowse/core/util'\nimport { useTheme } from '@mui/material'\n\n// locals\nimport { makeTicks } from '../util'\n\nimport { LinearGenomeViewModel } from '..'\nimport SVGRegionSeparators from './SVGRegionSeparators'\n\ntype LGV = LinearGenomeViewModel\n\nfunction Ruler({\n start,\n end,\n bpPerPx,\n reversed = false,\n major = true,\n minor = true,\n hideText = false,\n}: {\n start: number\n end: number\n bpPerPx: number\n reversed?: boolean\n major?: boolean\n minor?: boolean\n hideText?: boolean\n}) {\n const ticks = makeTicks(start, end, bpPerPx, major, minor)\n const theme = useTheme()\n const c = stripAlpha(theme.palette.text.secondary)\n return (\n <>\n {ticks.map(tick => {\n const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx\n return (\n <line\n key={`tick-${tick.base}`}\n x1={x}\n x2={x}\n y1={0}\n y2={tick.type === 'major' ? 6 : 4}\n strokeWidth={1}\n stroke={c}\n />\n )\n })}\n {!hideText\n ? ticks\n .filter(tick => tick.type === 'major')\n .map(tick => {\n const x =\n (reversed ? end - tick.base : tick.base - start) / bpPerPx\n return (\n <text\n key={`label-${tick.base}`}\n x={x - 3}\n y={7 + 11}\n fontSize={11}\n fill={c}\n >\n {getTickDisplayStr(tick.base + 1, bpPerPx)}\n </text>\n )\n })\n : null}\n </>\n )\n}\n\nexport default function SVGRuler({\n model,\n fontSize,\n}: {\n model: LGV\n fontSize: number\n}) {\n const {\n dynamicBlocks: { contentBlocks },\n offsetPx: viewOffsetPx,\n bpPerPx,\n } = model\n const renderRuler = contentBlocks.length < 5\n const theme = useTheme()\n const c = stripAlpha(theme.palette.text.primary)\n return (\n <>\n <SVGRegionSeparators model={model} height={30} />\n {contentBlocks.map(block => {\n const { start, end, key, reversed, offsetPx, refName, widthPx } = block\n const offset = offsetPx - viewOffsetPx\n const clipid = `clip-${key}`\n return (\n <g key={key}>\n <defs>\n <clipPath id={clipid}>\n <rect x={0} y={0} width={widthPx} height={100} />\n </clipPath>\n </defs>\n <g transform={`translate(${offset} 0)`}>\n <g clipPath={`url(#${clipid})`}>\n <text x={4} y={fontSize} fontSize={fontSize} fill={c}>\n {refName}\n </text>\n <g transform=\"translate(0 20)\">\n <Ruler\n hideText={!renderRuler}\n start={start}\n end={end}\n bpPerPx={bpPerPx}\n reversed={reversed}\n />\n </g>\n </g>\n </g>\n </g>\n )\n })}\n </>\n )\n}\n","import React from 'react'\nimport { getBpDisplayStr, stripAlpha } from '@jbrowse/core/util'\nimport { useTheme } from '@mui/material'\nimport { LinearGenomeViewModel } from '..'\n\ntype LGV = LinearGenomeViewModel\n\nexport default function SVGScalebar({\n model,\n fontSize,\n}: {\n model: LGV\n fontSize: number\n}) {\n const {\n offsetPx,\n dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp },\n } = model\n const theme = useTheme()\n const displayBp = getBpDisplayStr(totalBp)\n const x0 = Math.max(-offsetPx, 0)\n const x1 = x0 + totalWidthPx\n const c = stripAlpha(theme.palette.text.secondary)\n const x = x0 + (x1 - x0) / 2\n const y = fontSize\n return (\n <>\n <line x1={x0} x2={x1} y1={10} y2={10} stroke={c} />\n <line x1={x0} x2={x0} y1={5} y2={15} stroke={c} />\n <line x1={x1} x2={x1} y1={5} y2={15} stroke={c} />\n <text\n x={x}\n y={y}\n textAnchor=\"middle\"\n dominantBaseline=\"hanging\"\n fontSize={fontSize}\n fill={c}\n >\n {displayBp}\n </text>\n </>\n )\n}\n","import React from 'react'\nimport { getSession, stripAlpha } from '@jbrowse/core/util'\nimport Base1DView from '@jbrowse/core/util/Base1DViewModel'\nimport { useTheme } from '@mui/material'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport Cytobands from '../components/Cytobands'\nimport SVGRuler from './SVGRuler'\nimport SVGScalebar from './SVGScalebar'\nimport OverviewScalebarPolygon from '../components/OverviewScalebarPolygon'\nimport { HEADER_OVERVIEW_HEIGHT } from '../consts'\n\nexport default function SVGHeader({\n model,\n fontSize,\n cytobandHeight,\n rulerHeight,\n}: {\n model: LinearGenomeViewModel\n rulerHeight: number\n fontSize: number\n cytobandHeight: number\n}) {\n const { width, assemblyNames, showCytobands, displayedRegions } = model\n const { assemblyManager } = getSession(model)\n const assemblyName = assemblyNames.length > 1 ? '' : assemblyNames[0]!\n const assembly = assemblyManager.get(assemblyName)\n const theme = useTheme()\n const c = stripAlpha(theme.palette.text.primary)\n const overview = Base1DView.create({\n displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),\n interRegionPaddingWidth: 0,\n minimumBlockWidth: model.minimumBlockWidth,\n })\n const visibleRegions = model.dynamicBlocks.contentBlocks\n if (!visibleRegions.length) {\n return null\n }\n\n overview.setVolatileWidth(width)\n overview.showAllRegions()\n const block = overview.dynamicBlocks.contentBlocks[0]!\n const first = visibleRegions.at(0)!\n const last = visibleRegions.at(-1)!\n const firstOverviewPx =\n overview.bpToPx({\n ...first,\n coord: first.reversed ? first.end : first.start,\n }) || 0\n\n const lastOverviewPx =\n overview.bpToPx({\n ...last,\n coord: last.reversed ? last.start : last.end,\n }) || 0\n const y = +showCytobands * cytobandHeight\n return (\n <g id=\"header\">\n <text x={0} y={0} dominantBaseline=\"hanging\" fontSize={fontSize} fill={c}>\n {assemblyName}\n </text>\n\n {showCytobands ? (\n <g transform={`translate(0 ${rulerHeight})`}>\n <Cytobands overview={overview} assembly={assembly} block={block} />\n <rect\n stroke=\"red\"\n fill=\"rgb(255,0,0)\"\n fillOpacity={0.1}\n width={Math.max(lastOverviewPx - firstOverviewPx, 0.5)}\n height={HEADER_OVERVIEW_HEIGHT - 1}\n x={firstOverviewPx}\n y={0.5}\n />\n <g transform={`translate(0,${HEADER_OVERVIEW_HEIGHT})`}>\n <OverviewScalebarPolygon\n overview={overview}\n model={model}\n useOffset={false}\n />\n </g>\n </g>\n ) : null}\n\n <g transform={`translate(0 ${fontSize + y})`}>\n <SVGScalebar model={model} fontSize={fontSize} />\n </g>\n <g transform={`translate(0 ${rulerHeight + y})`}>\n <SVGRuler model={model} fontSize={fontSize} />\n </g>\n </g>\n )\n}\n","/* eslint-disable react-refresh/only-export-components */\nimport React from 'react'\nimport { when } from 'mobx'\nimport {\n getSession,\n max,\n measureText,\n renderToStaticMarkup,\n} from '@jbrowse/core/util'\nimport { ThemeProvider } from '@mui/material'\nimport { createJBrowseTheme } from '@jbrowse/core/ui'\nimport { getTrackName } from '@jbrowse/core/util/tracks'\nimport { getRoot } from 'mobx-state-tree'\n\n// locals\nimport { LinearGenomeViewModel, ExportSvgOptions } from '..'\nimport SVGBackground from './SVGBackground'\nimport SVGTracks from './SVGTracks'\nimport SVGHeader from './SVGHeader'\nimport { totalHeight } from './util'\n\ntype LGV = LinearGenomeViewModel\n\n// render LGV to SVG\nexport async function renderToSvg(model: LGV, opts: ExportSvgOptions) {\n await when(() => model.initialized)\n const {\n textHeight = 18,\n headerHeight = 40,\n rulerHeight = 50,\n fontSize = 13,\n cytobandHeight = 100,\n trackLabels = 'offset',\n themeName = 'default',\n Wrapper = ({ children }) => children,\n } = opts\n const session = getSession(model)\n const { allThemes } = session\n\n const { createRootFn } = getRoot<any>(model)\n const theme = allThemes?.()[themeName]\n const { width, tracks, showCytobands } = model\n const shift = 50\n const c = +showCytobands * cytobandHeight\n const offset = headerHeight + rulerHeight + c + 10\n const height = totalHeight(tracks, textHeight, trackLabels) + offset + 100\n const displayResults = await Promise.all(\n tracks.map(async track => {\n const display = track.displays[0]\n await when(() => !display.renderProps().notReady)\n return { track, result: await display.renderSvg({ ...opts, theme }) }\n }),\n )\n const trackLabelMaxLen =\n max(\n tracks.map(t =>\n measureText(getTrackName(t.configuration, session), fontSize),\n ),\n 0,\n ) + 40\n const trackLabelOffset = trackLabels === 'left' ? trackLabelMaxLen : 0\n const w = width + trackLabelOffset\n\n // the xlink namespace is used for rendering <image> tag\n return renderToStaticMarkup(\n <ThemeProvider theme={createJBrowseTheme(theme)}>\n <Wrapper>\n <svg\n width={w}\n height={height}\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n viewBox={[0, 0, w + shift * 2, height].toString()}\n >\n <SVGBackground width={w} height={height} shift={shift} />\n <g transform={`translate(${shift} 0)`}>\n <g transform={`translate(${trackLabelOffset})`}>\n <SVGHeader\n model={model}\n fontSize={fontSize}\n rulerHeight={rulerHeight}\n cytobandHeight={cytobandHeight}\n />\n </g>\n <SVGTracks\n textHeight={textHeight}\n fontSize={fontSize}\n model={model}\n displayResults={displayResults}\n offset={offset}\n trackLabels={trackLabels}\n trackLabelOffset={trackLabelOffset}\n />\n </g>\n </svg>\n </Wrapper>\n </ThemeProvider>,\n createRootFn,\n )\n}\n\nexport { default as SVGRuler } from './SVGRuler'\nexport { default as SVGTracks } from './SVGTracks'\n","import { sum } from '@jbrowse/core/util'\n\ninterface Display {\n height: number\n}\ninterface Track {\n displays: Display[]\n}\n\nexport function totalHeight(\n tracks: Track[],\n textHeight: number,\n trackLabels: string,\n) {\n return sum(\n tracks.map(\n t =>\n t.displays[0]!.height +\n (['none', 'left'].includes(trackLabels) ? 0 : textHeight),\n ),\n )\n}\n","import {\n AssemblyManager,\n ParsedLocString,\n parseLocString,\n} from '@jbrowse/core/util'\n\n/**\n * Given a scale ( bp/px ) and minimum distances (px) between major and minor\n * gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving\n * the gridline pitches to use.\n */\nexport function chooseGridPitch(\n scale: number,\n minMajorPitchPx: number,\n minMinorPitchPx: number,\n) {\n scale = Math.abs(scale)\n const minMajorPitchBp = minMajorPitchPx * scale\n const majorMagnitude = Number.parseInt(\n Number(minMajorPitchBp).toExponential().split(/e/i)[1]!,\n 10,\n )\n\n let majorPitch = 10 ** majorMagnitude\n while (majorPitch < minMajorPitchBp) {\n majorPitch *= 2\n if (majorPitch >= minMajorPitchBp) {\n break\n }\n majorPitch *= 2.5\n }\n\n majorPitch = Math.max(majorPitch, 5)\n\n const majorPitchPx = majorPitch / scale\n\n let minorPitch = 0\n if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {\n minorPitch = majorPitch / 10\n } else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {\n minorPitch = majorPitch / 5\n } else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {\n minorPitch = majorPitch / 2\n }\n\n return { majorPitch, minorPitch }\n}\n\nexport function makeTicks(\n start: number,\n end: number,\n bpPerPx: number,\n emitMajor = true,\n emitMinor = true,\n) {\n const gridPitch = chooseGridPitch(bpPerPx, 60, 15)\n\n let minBase = start\n let maxBase = end\n\n if (bpPerPx < 0) {\n ;[minBase, maxBase] = [maxBase, minBase]\n }\n\n // add 20px additional on the right and left to allow us to draw the ends\n // of labels that lie a little outside our region\n minBase -= Math.abs(20 * bpPerPx) - 1\n maxBase += Math.abs(20 * bpPerPx) + 1\n\n const iterPitch = gridPitch.minorPitch || gridPitch.majorPitch\n let index = 0\n const ticks = []\n for (\n let base = Math.floor(minBase / iterPitch) * iterPitch;\n base < Math.ceil(maxBase / iterPitch) * iterPitch + 1;\n base += iterPitch\n ) {\n if (emitMinor && base % (gridPitch.majorPitch * 2)) {\n ticks.push({ type: 'minor', base: base - 1, index })\n index += 1\n } else if (emitMajor && !(base % (gridPitch.majorPitch * 2))) {\n ticks.push({ type: 'major', base: base - 1, index })\n index += 1\n }\n }\n return ticks\n}\n\n/**\n * Generate location objects for a set of parsed locstrings, which includes\n * translating the refNames to assembly-canonical refNames and adding the\n * 'parentRegion'\n *\n * Used by navToLocations and navToLocString\n */\nexport async function generateLocations(\n regions: ParsedLocString[],\n assemblyManager: AssemblyManager,\n assemblyName?: string,\n) {\n return Promise.all(\n regions.map(async region => {\n const asmName = region.assemblyName || assemblyName\n if (!asmName) {\n throw new Error('no assembly provided')\n }\n const asm = await assemblyManager.waitForAssembly(asmName)\n const { refName } = region\n if (!asm) {\n throw new Error(`assembly ${asmName} not found`)\n }\n const { regions } = asm\n if (!regions) {\n throw new Error(`regions not loaded yet for ${asmName}`)\n }\n const canonicalRefName = asm.getCanonicalRefName(region.refName)\n if (!canonicalRefName) {\n throw new Error(`Could not find refName ${refName} in ${asm.name}`)\n }\n const parentRegion = regions.find(r => r.refName === canonicalRefName)\n if (!parentRegion) {\n throw new Error(`Could not find refName ${refName} in ${asmName}`)\n }\n\n return {\n ...(region as Omit<typeof region, symbol>),\n assemblyName: asmName,\n parentRegion,\n }\n }),\n )\n}\n\n/**\n * Parses locString or space separated set of locStrings into location objects\n * Example inputs:\n * \"chr1\"\n * \"chr1:1-100\"\n * \"chr1:1..100\"\n * \"chr1 chr2\"\n * \"chr1:1-100 chr2:1-100\"\n * \"chr1 100 200\" equivalent to \"chr1:1-100\"\n *\n * Used by navToLocString\n */\nexport function parseLocStrings(\n input: string,\n assemblyName: string,\n isValidRefName: (str: string, assemblyName: string) => boolean,\n) {\n const inputs = input\n .split(/(\\s+)/)\n .map(f => f.trim())\n .filter(f => !!f)\n // first try interpreting as a whitespace-separated sequence of\n // multiple locstrings\n try {\n return inputs.map(loc =>\n parseLocString(loc, ref => isValidRefName(ref, assemblyName)),\n )\n } catch (e) {\n // if this fails, try interpreting as a whitespace-separated refname,\n // start, end if start and end are integer inputs\n const [refName, start, end] = inputs\n if (\n /Unknown reference sequence/.exec(`${e}`) &&\n Number.isInteger(+start!) &&\n Number.isInteger(+end!)\n ) {\n return [\n parseLocString(`${refName}:${start}..${end}`, ref =>\n isValidRefName(ref, assemblyName),\n ),\n ]\n }\n throw e\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BaseLinearDisplay\n * #category display\n *\n * `BaseLinearDisplay` is a \"base\" config that is extended by other configs including\n * - `LinearBasicDisplay` (used for feature tracks, etc)\n * - `LinearBareDisplay` (more stripped down than even the basic display, not\n * commonly used)\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst baseLinearDisplayConfigSchema = ConfigurationSchema(\n 'BaseLinearDisplay',\n {\n /**\n * #slot\n */\n maxFeatureScreenDensity: {\n type: 'number',\n description:\n 'maximum features per pixel that is displayed in the view, used if byte size estimates not available',\n defaultValue: 0.3,\n },\n /**\n * #slot\n */\n fetchSizeLimit: {\n type: 'number',\n defaultValue: 1_000_000,\n description:\n \"maximum data to attempt to download for a given track, used if adapter doesn't specify one\",\n },\n /**\n * #slot\n */\n height: {\n type: 'number',\n defaultValue: 100,\n description: 'default height for the track',\n },\n /**\n * #slot\n */\n mouseover: {\n type: 'string',\n description: 'text to display when the cursor hovers over a feature',\n defaultValue: `jexl:get(feature,'name')`,\n\n contextVariable: ['feature'],\n },\n /**\n * #slot\n * config jexlFilters are deferred evaluated so they are prepended with\n * jexl at runtime rather than being stored with jexl in the config\n */\n jexlFilters: {\n type: 'stringArray',\n description:\n 'default set of jexl filters to apply to a track. note: these do not use the jexl prefix because they have a deferred evaluation system',\n defaultValue: [],\n },\n },\n {\n /**\n * #identifier\n */\n explicitIdentifier: 'displayId',\n },\n)\n\nexport default baseLinearDisplayConfigSchema\n","// takes an array or Map or Set (anything iterable with values()) of Maps and\n// lets you query them as one Map\nexport default class CompositeMap<T, U> {\n constructor(private submaps: Map<T, U>[]) {}\n\n has(id: T) {\n for (const submap of this.submaps.values()) {\n if (submap.has(id)) {\n return true\n }\n }\n return false\n }\n\n get(id: T) {\n for (const submap of this.submaps.values()) {\n if (submap.has(id)) {\n return submap.get(id)\n }\n }\n return undefined\n }\n\n *values() {\n for (const key of this.keys()) {\n yield this.get(key) as U\n }\n }\n\n *keys() {\n const keys = new Set<T>()\n for (const submap of this.submaps.values()) {\n for (const key of submap.keys()) {\n keys.add(key)\n }\n }\n for (const key of keys) {\n yield key\n }\n }\n\n find<V>(f: (arg0: U) => V) {\n for (const submap of this.submaps.values()) {\n for (const value of submap.values()) {\n const found = f(value)\n if (found) {\n return value\n }\n }\n }\n return undefined\n }\n\n *[Symbol.iterator]() {\n for (const key of this.keys()) {\n yield [key, this.get(key)]\n }\n }\n\n *entries() {\n for (const k of this.keys()) {\n yield [k, this.get(k)]\n }\n }\n}\n","import { getConf } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\nconst minDisplayHeight = 20\n\n/**\n * #stateModel TrackHeightMixin\n * #category display\n */\nexport default function TrackHeightMixin() {\n return types\n .model({\n /**\n * #property\n */\n heightPreConfig: types.maybe(\n types.refinement(\n 'displayHeight',\n types.number,\n n => n >= minDisplayHeight,\n ),\n ),\n })\n .volatile(() => ({\n /**\n * #property\n */\n scrollTop: 0,\n }))\n .views(self => ({\n get height() {\n // @ts-expect-error\n return self.heightPreConfig ?? (getConf(self, 'height') as number)\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setScrollTop(scrollTop: number) {\n self.scrollTop = scrollTop\n },\n /**\n * #action\n */\n setHeight(displayHeight: number) {\n self.heightPreConfig = Math.max(displayHeight, minDisplayHeight)\n return self.height\n },\n /**\n * #action\n */\n resizeHeight(distance: number) {\n const oldHeight = self.height\n const newHeight = this.setHeight(self.height + distance)\n return newHeight - oldHeight\n },\n }))\n}\n","import React from 'react'\nimport { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter'\n\n// locals\nimport BlockMsg from '../components/BlockMsg'\nimport { Button } from '@mui/material'\n\nfunction TooLargeMessage({\n model,\n}: {\n model: {\n regionTooLargeReason: string\n featureDensityStats?: FeatureDensityStats\n setFeatureDensityStatsLimit: (s?: FeatureDensityStats) => void\n reload: () => void\n }\n}) {\n const { regionTooLargeReason } = model\n return (\n <BlockMsg\n severity=\"warning\"\n action={\n <Button\n onClick={() => {\n model.setFeatureDensityStatsLimit(model.featureDensityStats)\n model.reload()\n }}\n >\n Force load\n </Button>\n }\n message={[\n regionTooLargeReason,\n 'Zoom in to see features or force load (may be slow)',\n ]\n .filter(f => !!f)\n .join('. ')}\n />\n )\n}\n\nexport default TooLargeMessage\n","import React from 'react'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { getContainingView } from '@jbrowse/core/util'\nimport { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { Region } from '@jbrowse/core/util/types'\nimport { autorun } from 'mobx'\nimport { addDisposer, isAlive, types } from 'mobx-state-tree'\n\n// locals\nimport { LinearGenomeViewModel } from '../../LinearGenomeView'\nimport TooLargeMessage from '../components/TooLargeMessage'\nimport { getDisplayStr, getFeatureDensityStatsPre } from './util'\nimport autorunFeatureDensityStats from './autorunFeatureDensityStats'\n\ntype LGV = LinearGenomeViewModel\n\n/**\n * #stateModel FeatureDensityMixin\n * #category display\n */\nexport default function FeatureDensityMixin() {\n return types\n .model({\n /**\n * #property\n */\n userBpPerPxLimit: types.maybe(types.number),\n /**\n * #property\n */\n\n userByteSizeLimit: types.maybe(types.number),\n })\n .volatile(() => ({\n featureDensityStatsP: undefined as\n | undefined\n | Promise<FeatureDensityStats>,\n featureDensityStats: undefined as undefined | FeatureDensityStats,\n currStatsBpPerPx: 0,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get currentBytesRequested() {\n return self.featureDensityStats?.bytes || 0\n },\n\n /**\n * #getter\n */\n get currentFeatureScreenDensity() {\n const view = getContainingView(self) as LGV\n return (self.featureDensityStats?.featureDensity || 0) * view.bpPerPx\n },\n\n /**\n * #getter\n */\n get maxFeatureScreenDensity() {\n // @ts-expect-error\n return getConf(self, 'maxFeatureScreenDensity')\n },\n /**\n * #getter\n */\n get featureDensityStatsReady() {\n const view = getContainingView(self) as LGV\n return (\n self.currStatsBpPerPx === view.bpPerPx &&\n (!!self.featureDensityStats || !!self.userBpPerPxLimit)\n )\n },\n\n /**\n * #getter\n */\n get maxAllowableBytes() {\n return (\n self.userByteSizeLimit ||\n self.featureDensityStats?.fetchSizeLimit ||\n // @ts-expect-error\n (getConf(self, 'fetchSizeLimit') as number)\n )\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(() => autorunFeatureDensityStats(self as any)),\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setCurrStatsBpPerPx(n: number) {\n self.currStatsBpPerPx = n\n },\n /**\n * #action\n */\n setFeatureDensityStatsLimit(stats?: FeatureDensityStats) {\n const view = getContainingView(self) as LGV\n if (stats?.bytes) {\n self.userByteSizeLimit = stats.bytes\n } else {\n self.userBpPerPxLimit = view.bpPerPx\n }\n },\n /**\n * #action\n */\n getFeatureDensityStats() {\n if (!self.featureDensityStatsP) {\n self.featureDensityStatsP = getFeatureDensityStatsPre(\n self as any,\n ).catch((e: unknown) => {\n if (isAlive(self)) {\n this.setFeatureDensityStatsP(undefined)\n }\n throw e\n })\n }\n return self.featureDensityStatsP\n },\n\n /**\n * #action\n */\n setFeatureDensityStatsP(arg: any) {\n self.featureDensityStatsP = arg\n },\n\n /**\n * #action\n */\n setFeatureDensityStats(featureDensityStats?: FeatureDensityStats) {\n self.featureDensityStats = featureDensityStats\n },\n /**\n * #action\n */\n clearFeatureDensityStats() {\n self.featureDensityStatsP = undefined\n self.featureDensityStats = undefined\n },\n }))\n .views(self => ({\n /**\n * #getter\n * region is too large if:\n * - stats are ready\n * - region is greater than 20kb (don't warn when zoomed in less than that)\n * - and bytes is greater than max allowed bytes or density greater than max\n * density\n */\n get regionTooLarge() {\n const view = getContainingView(self) as LGV\n if (\n !self.featureDensityStatsReady ||\n view.dynamicBlocks.totalBp < 20_000\n ) {\n return false\n }\n return (\n self.currentBytesRequested > self.maxAllowableBytes ||\n (self.userBpPerPxLimit\n ? view.bpPerPx > self.userBpPerPxLimit\n : self.currentFeatureScreenDensity > self.maxFeatureScreenDensity)\n )\n },\n\n /**\n * #getter\n * only shows a message of bytes requested is defined, the feature density\n * based stats don't produce any helpful message besides to zoom in\n */\n get regionTooLargeReason() {\n const req = self.currentBytesRequested\n const max = self.maxAllowableBytes\n\n return req && req > max\n ? `Requested too much data (${getDisplayStr(req)})`\n : ''\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n regionCannotBeRenderedText(_region: Region) {\n return self.regionTooLarge ? 'Force load to see features' : ''\n },\n\n /**\n * #method\n * @param region -\n * @returns falsy if the region is fine to try rendering. Otherwise,\n * return a react node + string of text.\n * string of text describes why it cannot be rendered\n * react node allows user to force load at current setting\n */\n regionCannotBeRendered(_region: Region) {\n return self.regionTooLarge ? (\n <TooLargeMessage model={self as any} />\n ) : null\n },\n }))\n}\n","import { getContainingView, isAbortException } from '@jbrowse/core/util'\nimport { LinearGenomeViewModel } from '../../LinearGenomeView'\nimport { isAlive } from 'mobx-state-tree'\nimport { BaseLinearDisplayModel } from './BaseLinearDisplayModel'\n\n// stats estimation autorun calls getFeatureDensityStats against the data\n// adapter which by default uses featureDensity, but can also respond with a\n// byte size estimate and fetch size limit (data adapter can define what is too\n// much data)\nexport default async function autorunFeatureDensityStats(\n self: BaseLinearDisplayModel,\n) {\n try {\n const view = getContainingView(self) as LinearGenomeViewModel\n\n // extra check for contentBlocks.length\n // https://github.com/GMOD/jbrowse-components/issues/2694\n if (\n !view.initialized ||\n !view.staticBlocks.contentBlocks.length ||\n view.bpPerPx === self.currStatsBpPerPx ||\n self.error\n ) {\n return\n }\n\n // don't re-estimate featureDensity even if zoom level changes,\n // jbrowse1-style assume it's sort of representative\n if (self.featureDensityStats?.featureDensity !== undefined) {\n self.setCurrStatsBpPerPx(view.bpPerPx)\n return\n }\n\n self.clearFeatureDensityStats()\n self.setCurrStatsBpPerPx(view.bpPerPx)\n const stats = await self.getFeatureDensityStats()\n if (isAlive(self)) {\n self.setFeatureDensityStats(stats)\n }\n } catch (e) {\n if (!isAbortException(e) && isAlive(self)) {\n console.error(e)\n self.setError(e)\n }\n }\n}\n","import React, { lazy } from 'react'\nimport { ThemeOptions } from '@mui/material'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'\nimport { ConfigurationReference } from '@jbrowse/core/configuration'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport {\n getContainingView,\n getContainingTrack,\n getSession,\n isSelectionContainer,\n isSessionModelWithWidgets,\n isFeature,\n Feature,\n AnyReactComponentType,\n} from '@jbrowse/core/util'\nimport { BaseBlock } from '@jbrowse/core/util/blockTypes'\nimport CompositeMap from '@jbrowse/core/util/compositeMap'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport { autorun } from 'mobx'\nimport { addDisposer, isAlive, types, Instance } from 'mobx-state-tree'\n\n// icons\nimport MenuOpenIcon from '@mui/icons-material/MenuOpen'\nimport CenterFocusStrongIcon from '@mui/icons-material/CenterFocusStrong'\n\n// locals\nimport { LinearGenomeViewModel, ExportSvgOptions } from '../../LinearGenomeView'\nimport BlockState from './serverSideRenderedBlock'\nimport configSchema from './configSchema'\nimport TrackHeightMixin from './TrackHeightMixin'\nimport FeatureDensityMixin from './FeatureDensityMixin'\n\n// lazies\nconst Tooltip = lazy(() => import('../components/Tooltip'))\n\ntype LGV = LinearGenomeViewModel\n\nexport interface Layout {\n minX: number\n minY: number\n maxX: number\n maxY: number\n name: string\n}\n\ntype LayoutRecord = [number, number, number, number]\n\nexport interface ExportSvgDisplayOptions extends ExportSvgOptions {\n overrideHeight: number\n theme: ThemeOptions\n}\n\n/**\n * #stateModel BaseLinearDisplay\n * #category display\n *\n * BaseLinearDisplay is used as the basis for many linear genome view tracks.\n * It is block based, and can use 'static blocks' or 'dynamic blocks'\n *\n * extends\n * - [BaseDisplay](../basedisplay)\n * - [TrackHeightMixin](../trackheightmixin)\n * - [FeatureDensityMixin](../featuredensitymixin)\n */\nfunction stateModelFactory() {\n return types\n .compose(\n 'BaseLinearDisplay',\n BaseDisplay,\n TrackHeightMixin(),\n FeatureDensityMixin(),\n types.model({\n /**\n * #property\n * updated via autorun\n */\n blockState: types.map(BlockState),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n .volatile(() => ({\n featureIdUnderMouse: undefined as undefined | string,\n contextMenuFeature: undefined as undefined | Feature,\n }))\n .views(self => ({\n /**\n * #getter\n * if a display-level message should be displayed instead of the blocks,\n * make this return a react component\n */\n get DisplayMessageComponent(): undefined | React.FC<any> {\n return undefined\n },\n /**\n * #getter\n */\n get blockType(): 'staticBlocks' | 'dynamicBlocks' {\n return 'staticBlocks'\n },\n /**\n * #getter\n */\n get blockDefinitions() {\n const view = getContainingView(self) as LGV\n if (!view.initialized) {\n throw new Error('view not initialized yet')\n }\n return view[this.blockType]\n },\n }))\n .views(self => ({\n /**\n * #getter\n * how many milliseconds to wait for the display to\n * \"settle\" before re-rendering a block\n */\n get renderDelay() {\n return 50\n },\n\n /**\n * #getter\n */\n get TooltipComponent(): AnyReactComponentType {\n return Tooltip as AnyReactComponentType\n },\n\n /**\n * #getter\n * returns a string feature ID if the globally-selected object\n * is probably a feature\n */\n get selectedFeatureId() {\n if (isAlive(self)) {\n const { selection } = getSession(self)\n // does it quack like a feature?\n if (isFeature(selection)) {\n return selection.id()\n }\n }\n return undefined\n },\n }))\n .views(self => ({\n /**\n * #getter\n * a CompositeMap of `featureId -> feature obj` that\n * just looks in all the block data for that feature\n */\n get features() {\n const featureMaps = []\n for (const block of self.blockState.values()) {\n if (block.features) {\n featureMaps.push(block.features)\n }\n }\n return new CompositeMap(featureMaps)\n },\n\n /**\n * #getter\n */\n get featureUnderMouse() {\n const feat = self.featureIdUnderMouse\n return feat ? this.features.get(feat) : undefined\n },\n\n /**\n * #getter\n */\n getFeatureOverlapping(\n blockKey: string,\n x: number,\n y: number,\n ): string | undefined {\n return self.blockState.get(blockKey)?.layout?.getByCoord(x, y)\n },\n\n /**\n * #getter\n */\n getFeatureByID(blockKey: string, id: string): LayoutRecord | undefined {\n return self.blockState.get(blockKey)?.layout?.getByID(id)\n },\n\n /**\n * #getter\n */\n searchFeatureByID(id: string): LayoutRecord | undefined {\n let ret: LayoutRecord | undefined\n self.blockState.forEach(block => {\n const val = block.layout?.getByID(id)\n if (val) {\n ret = val\n }\n })\n return ret\n },\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n addBlock(key: string, block: BaseBlock) {\n self.blockState.set(\n key,\n BlockState.create({\n key,\n region: block.toRegion(),\n }),\n )\n },\n\n /**\n * #action\n */\n deleteBlock(key: string) {\n self.blockState.delete(key)\n },\n /**\n * #action\n */\n selectFeature(feature: Feature) {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const featureWidget = session.addWidget(\n 'BaseFeatureWidget',\n 'baseFeature',\n {\n view: getContainingView(self),\n track: getContainingTrack(self),\n featureData: feature.toJSON(),\n },\n )\n\n session.showWidget(featureWidget)\n }\n if (isSelectionContainer(session)) {\n session.setSelection(feature)\n }\n },\n /**\n * #action\n */\n navToFeature(feature: Feature) {\n const view = getContainingView(self) as LGV\n view.navTo({\n refName: feature.get('refName'),\n start: feature.get('start'),\n end: feature.get('end'),\n })\n },\n /**\n * #action\n */\n clearFeatureSelection() {\n getSession(self).clearSelection()\n },\n /**\n * #action\n */\n setFeatureIdUnderMouse(feature?: string) {\n self.featureIdUnderMouse = feature\n },\n\n /**\n * #action\n */\n setContextMenuFeature(feature?: Feature) {\n self.contextMenuFeature = feature\n },\n }))\n\n .actions(self => {\n const { reload: superReload } = self\n\n return {\n /**\n * #action\n */\n async reload() {\n self.setError()\n self.setCurrStatsBpPerPx(0)\n self.clearFeatureDensityStats()\n ;[...self.blockState.values()].forEach(val => {\n val.doReload()\n })\n superReload()\n },\n }\n })\n\n .views(self => ({\n /**\n * #method\n */\n trackMenuItems(): MenuItem[] {\n return []\n },\n\n /**\n * #method\n */\n contextMenuItems(): MenuItem[] {\n return [\n ...(self.contextMenuFeature\n ? [\n {\n label: 'Open feature details',\n icon: MenuOpenIcon,\n onClick: () => {\n if (self.contextMenuFeature) {\n self.selectFeature(self.contextMenuFeature)\n }\n },\n },\n {\n label: 'Zoom to feature',\n icon: CenterFocusStrongIcon,\n onClick: () => {\n if (self.contextMenuFeature) {\n self.navToFeature(self.contextMenuFeature)\n }\n },\n },\n ]\n : []),\n ]\n },\n /**\n * #method\n */\n renderProps() {\n return {\n ...getParentRenderProps(self),\n notReady: !self.featureDensityStatsReady,\n rpcDriverName: self.rpcDriverName,\n\n displayModel: self,\n onFeatureClick(_: unknown, featureId?: string) {\n const f = featureId || self.featureIdUnderMouse\n if (!f) {\n self.clearFeatureSelection()\n } else {\n const feature = self.features.get(f)\n if (feature) {\n self.selectFeature(feature)\n }\n }\n },\n onClick() {\n self.clearFeatureSelection()\n },\n // similar to click but opens a menu with further options\n onFeatureContextMenu(_: unknown, featureId?: string) {\n const f = featureId || self.featureIdUnderMouse\n if (!f) {\n self.clearFeatureSelection()\n } else {\n // feature id under mouse passed to context menu\n self.setContextMenuFeature(self.features.get(f))\n }\n },\n\n onMouseMove(_: unknown, featureId?: string) {\n self.setFeatureIdUnderMouse(featureId)\n },\n\n onMouseLeave(_: unknown) {\n self.setFeatureIdUnderMouse(undefined)\n },\n\n onContextMenu() {\n self.setContextMenuFeature(undefined)\n self.clearFeatureSelection()\n },\n }\n },\n }))\n .actions(self => ({\n /**\n * #method\n */\n async renderSvg(opts: ExportSvgDisplayOptions) {\n const { renderBaseLinearDisplaySvg } = await import('./renderSvg')\n return renderBaseLinearDisplaySvg(self as BaseLinearDisplayModel, opts)\n },\n afterAttach() {\n // watch the parent's blocks to update our block state when they change,\n // then we recreate the blocks on our own model (creating and deleting to\n // match the parent blocks)\n addDisposer(\n self,\n autorun(() => {\n const blocksPresent: Record<string, boolean> = {}\n const view = getContainingView(self) as LGV\n if (!view.initialized) {\n return\n }\n self.blockDefinitions.contentBlocks.forEach(block => {\n blocksPresent[block.key] = true\n if (!self.blockState.has(block.key)) {\n self.addBlock(block.key, block)\n }\n })\n self.blockState.forEach((_, key) => {\n if (!blocksPresent[key]) {\n self.deleteBlock(key as string)\n }\n })\n }),\n )\n },\n }))\n .preProcessSnapshot(snap => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!snap) {\n return snap\n }\n // rewrite \"height\" from older snapshots to \"heightPreConfig\", this allows\n // us to maintain a height \"getter\" going forward\n // @ts-expect-error\n const { height, ...rest } = snap\n return { heightPreConfig: height, ...rest }\n })\n .postProcessSnapshot(snap => {\n // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit\n const r = snap as Omit<typeof snap, symbol>\n const { blockState, ...rest } = r\n return rest\n })\n}\n\nexport const BaseLinearDisplay = stateModelFactory()\n\nexport type BaseLinearDisplayStateModel = typeof BaseLinearDisplay\nexport type BaseLinearDisplayModel = Instance<BaseLinearDisplayStateModel>\n","import React from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { getContainingView } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\nimport { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'\n\nimport {\n ContentBlock as ContentBlockComponent,\n ElidedBlock as ElidedBlockComponent,\n InterRegionPaddingBlock as InterRegionPaddingBlockComponent,\n} from './Block'\nimport { LinearGenomeViewModel } from '../../LinearGenomeView'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n linearBlocks: {\n whiteSpace: 'nowrap',\n textAlign: 'left',\n position: 'absolute',\n minHeight: '100%',\n display: 'flex',\n },\n heightOverflowed: {\n position: 'absolute',\n color: 'rgb(77,77,77)',\n borderBottom: '2px solid rgb(77,77,77)',\n textShadow: 'white 0px 0px 1px',\n whiteSpace: 'nowrap',\n width: '100%',\n fontWeight: 'bold',\n textAlign: 'center',\n zIndex: 2000,\n boxSizing: 'border-box',\n },\n})\n\nconst RenderedBlocks = observer(function ({\n model,\n}: {\n model: BaseLinearDisplayModel\n}) {\n const { classes } = useStyles()\n const { blockDefinitions, blockState } = model\n return (\n <>\n {blockDefinitions.map(block => {\n const key = `${model.id}-${block.key}`\n if (block.type === 'ContentBlock') {\n const state = blockState.get(block.key)\n return (\n <ContentBlockComponent block={block} key={key}>\n {state?.ReactComponent ? (\n <state.ReactComponent model={state} />\n ) : null}\n {state?.maxHeightReached ? (\n <div\n className={classes.heightOverflowed}\n style={{\n top: state.layout.getTotalHeight() - 16,\n pointerEvents: 'none',\n height: 16,\n }}\n >\n Max height reached\n </div>\n ) : null}\n </ContentBlockComponent>\n )\n }\n if (block.type === 'ElidedBlock') {\n return <ElidedBlockComponent key={key} width={block.widthPx} />\n }\n if (block.type === 'InterRegionPaddingBlock') {\n return (\n <InterRegionPaddingBlockComponent\n key={key}\n width={block.widthPx}\n style={{ background: 'none' }}\n boundary={block.variant === 'boundary'}\n />\n )\n }\n throw new Error(`invalid block type ${JSON.stringify(block)}`)\n })}\n </>\n )\n})\n\nexport { RenderedBlocks }\n\nconst LinearBlocks = observer(function ({\n model,\n}: {\n model: BaseLinearDisplayModel\n}) {\n const { classes } = useStyles()\n const { blockDefinitions } = model\n const viewModel = getContainingView(model) as LGV\n return (\n <div\n className={classes.linearBlocks}\n style={{\n left: blockDefinitions.offsetPx - viewModel.offsetPx,\n }}\n >\n <RenderedBlocks model={model} />\n </div>\n )\n})\n\nexport default LinearBlocks\n","import React, { useState, useRef, Suspense } from 'react'\nimport { observer } from 'mobx-react'\nimport { useTheme } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { getConf } from '@jbrowse/core/configuration'\nimport { Menu } from '@jbrowse/core/ui'\n\n// locals\n\nimport LinearBlocks from './LinearBlocks'\nimport { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'\n\nconst useStyles = makeStyles()({\n display: {\n position: 'relative',\n whiteSpace: 'nowrap',\n textAlign: 'left',\n width: '100%',\n minHeight: '100%',\n },\n})\n\ntype Coord = [number, number]\n\nconst BaseLinearDisplay = observer(function (props: {\n model: BaseLinearDisplayModel\n children?: React.ReactNode\n}) {\n const { classes } = useStyles()\n const theme = useTheme()\n const ref = useRef<HTMLDivElement>(null)\n const [clientRect, setClientRect] = useState<DOMRect>()\n const [offsetMouseCoord, setOffsetMouseCoord] = useState<Coord>([0, 0])\n const [clientMouseCoord, setClientMouseCoord] = useState<Coord>([0, 0])\n const [contextCoord, setContextCoord] = useState<Coord>()\n const { model, children } = props\n const { TooltipComponent, DisplayMessageComponent, height } = model\n const items = model.contextMenuItems()\n return (\n <div\n ref={ref}\n data-testid={`display-${getConf(model, 'displayId')}`}\n className={classes.display}\n onContextMenu={event => {\n event.preventDefault()\n if (contextCoord) {\n // There's already a context menu open, so close it\n setContextCoord(undefined)\n } else if (ref.current) {\n setContextCoord([event.clientX, event.clientY])\n }\n }}\n onMouseMove={event => {\n if (!ref.current) {\n return\n }\n const rect = ref.current.getBoundingClientRect()\n const { left, top } = rect\n setOffsetMouseCoord([event.clientX - left, event.clientY - top])\n setClientMouseCoord([event.clientX, event.clientY])\n setClientRect(rect)\n }}\n >\n {DisplayMessageComponent ? (\n <DisplayMessageComponent model={model} />\n ) : (\n <LinearBlocks {...props} />\n )}\n {children}\n\n <Suspense fallback={null}>\n <TooltipComponent\n model={model}\n height={height}\n offsetMouseCoord={offsetMouseCoord}\n clientMouseCoord={clientMouseCoord}\n clientRect={clientRect}\n mouseCoord={offsetMouseCoord}\n />\n </Suspense>\n\n <Menu\n open={Boolean(contextCoord) && items.length > 0}\n onMenuItemClick={(_, callback) => {\n callback()\n setContextCoord(undefined)\n }}\n onClose={() => {\n setContextCoord(undefined)\n model.setContextMenuFeature(undefined)\n }}\n TransitionProps={{\n onExit: () => {\n setContextCoord(undefined)\n model.setContextMenuFeature(undefined)\n },\n }}\n anchorReference=\"anchorPosition\"\n anchorPosition={\n contextCoord\n ? { top: contextCoord[1], left: contextCoord[0] }\n : undefined\n }\n style={{\n zIndex: theme.zIndex.tooltip,\n }}\n menuItems={items}\n />\n </div>\n )\n})\n\nexport default BaseLinearDisplay\n\nexport { default as Tooltip } from './Tooltip'\nexport { default as BlockMsg } from './BlockMsg'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '../BaseLinearDisplay'\n\n/**\n * #config LinearBareDisplay\n * #category display\n */\nfunction configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearBareDisplay',\n {\n /**\n * #slot\n */\n renderer: pluginManager.pluggableConfigSchemaType('renderer'),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n\nexport { configSchemaFactory }\n","import {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n} from '@jbrowse/core/configuration'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport { types } from 'mobx-state-tree'\nimport { BaseLinearDisplay } from '../BaseLinearDisplay'\n\n/**\n * #stateModel LinearBareDisplay\n * #category display\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nexport function stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearBareDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearBareDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #method\n */\n renderProps() {\n return {\n ...superRenderProps(),\n ...getParentRenderProps(self),\n rpcDriverName: self.rpcDriverName,\n config: self.configuration.renderer,\n }\n },\n\n /**\n * #getter\n */\n get rendererTypeName() {\n return self.configuration.renderer.type\n },\n }\n })\n}\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { IconButton, Paper, alpha } from '@mui/material'\nimport CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'\nimport { makeStyles } from 'tss-react/mui'\nimport { getSession } from '@jbrowse/core/util'\n\n// icons\nimport ZoomIn from '@mui/icons-material/ZoomIn'\nimport ZoomOut from '@mui/icons-material/ZoomOut'\nimport ArrowDown from '@mui/icons-material/KeyboardArrowDown'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\n\nconst useStyles = makeStyles()(theme => ({\n background: {\n position: 'absolute',\n right: 0,\n zIndex: 1001,\n background: theme.palette.background.paper,\n },\n focusedBackground: {\n background: alpha(theme.palette.secondary.light, 0.2),\n },\n}))\n\nconst MiniControls = observer(function ({\n model,\n}: {\n model: LinearGenomeViewModel\n}) {\n const { classes } = useStyles()\n const { id, bpPerPx, maxBpPerPx, minBpPerPx, scaleFactor, hideHeader } = model\n const { focusedViewId } = getSession(model)\n return hideHeader ? (\n <Paper className={classes.background}>\n <Paper\n className={focusedViewId === id ? classes.focusedBackground : undefined}\n >\n <CascadingMenuButton menuItems={model.menuItems()}>\n <ArrowDown fontSize=\"small\" />\n </CascadingMenuButton>\n <IconButton\n data-testid=\"zoom_out\"\n onClick={() => {\n model.zoom(bpPerPx * 2)\n }}\n disabled={bpPerPx >= maxBpPerPx - 0.0001 || scaleFactor !== 1}\n >\n <ZoomOut fontSize=\"small\" />\n </IconButton>\n <IconButton\n data-testid=\"zoom_in\"\n onClick={() => {\n model.zoom(bpPerPx / 2)\n }}\n disabled={bpPerPx <= minBpPerPx + 0.0001 || scaleFactor !== 1}\n >\n <ZoomIn fontSize=\"small\" />\n </IconButton>\n </Paper>\n </Paper>\n ) : null\n})\n\nexport default MiniControls\n","import React, { useRef, useEffect, useState } from 'react'\nimport { Tooltip } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { getSession, stringify } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport RubberbandSpan from './RubberbandSpan'\nimport { getRelativeX } from './util'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n rubberbandControl: {\n cursor: 'crosshair',\n width: '100%',\n minHeight: 8,\n },\n guide: {\n pointerEvents: 'none',\n height: '100%',\n width: 1,\n position: 'absolute',\n zIndex: 10,\n },\n rel: {\n position: 'relative',\n },\n})\n\nconst HoverTooltip = observer(function ({\n model,\n open,\n guideX,\n overview,\n}: {\n model: LGV\n open: boolean\n guideX: number\n overview: Base1DViewModel\n}) {\n const { classes } = useStyles()\n const { cytobandOffset } = model\n const { assemblyManager } = getSession(model)\n\n const px = overview.pxToBp(guideX - cytobandOffset)\n const assembly = assemblyManager.get(px.assemblyName)\n const cytoband = assembly?.cytobands?.find(\n f =>\n px.coord > f.get('start') &&\n px.coord < f.get('end') &&\n px.refName === assembly.getCanonicalRefName(f.get('refName')),\n )\n\n return (\n <Tooltip\n open={open}\n placement=\"top\"\n title={[stringify(px), cytoband?.get('name')].join(' ')}\n arrow\n >\n <div className={classes.guide} style={{ left: guideX }} />\n </Tooltip>\n )\n})\n\nconst OverviewRubberband = observer(function OverviewRubberband({\n model,\n overview,\n ControlComponent = <div />,\n}: {\n model: LGV\n overview: Base1DViewModel\n ControlComponent?: React.ReactElement\n}) {\n const { cytobandOffset } = model\n const [startX, setStartX] = useState<number>()\n const [currentX, setCurrentX] = useState<number>()\n const [guideX, setGuideX] = useState<number>()\n const controlsRef = useRef<HTMLDivElement>(null)\n const { classes } = useStyles()\n const mouseDragging = startX !== undefined\n\n useEffect(() => {\n function globalMouseMove(event: MouseEvent) {\n const ref = controlsRef.current\n if (ref && mouseDragging) {\n setCurrentX(getRelativeX(event, ref))\n }\n }\n\n function globalMouseUp() {\n // click and drag\n if (startX !== undefined && currentX !== undefined) {\n if (Math.abs(currentX - startX) > 3) {\n const left = Math.min(startX, currentX)\n const right = Math.max(startX, currentX)\n model.moveTo(\n overview.pxToBp(left - cytobandOffset),\n overview.pxToBp(right - cytobandOffset),\n )\n }\n }\n\n // just a click\n if (startX !== undefined && currentX === undefined) {\n const click = overview.pxToBp(startX - cytobandOffset)\n if (!click.refName) {\n getSession(model).notify('unknown position clicked')\n console.error('unknown position clicked', click)\n } else {\n model.centerAt(Math.round(click.coord), click.refName, click.index)\n }\n }\n setStartX(undefined)\n setCurrentX(undefined)\n\n if (startX !== undefined) {\n setGuideX(undefined)\n }\n }\n\n function globalKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n setStartX(undefined)\n setCurrentX(undefined)\n }\n }\n\n if (mouseDragging) {\n window.addEventListener('mousemove', globalMouseMove, true)\n window.addEventListener('mouseup', globalMouseUp, true)\n window.addEventListener('keydown', globalKeyDown, true)\n return () => {\n window.removeEventListener('mousemove', globalMouseMove, true)\n window.removeEventListener('mouseup', globalMouseUp, true)\n window.removeEventListener('keydown', globalKeyDown, true)\n }\n }\n return () => {}\n }, [mouseDragging, currentX, startX, model, overview, cytobandOffset])\n\n function mouseDown(event: React.MouseEvent<HTMLDivElement>) {\n event.preventDefault()\n event.stopPropagation()\n setStartX(getRelativeX(event, controlsRef.current))\n }\n\n function mouseMove(event: React.MouseEvent<HTMLDivElement>) {\n setGuideX(getRelativeX(event, controlsRef.current))\n }\n\n function mouseOut() {\n setGuideX(undefined)\n }\n\n if (startX === undefined) {\n return (\n <div className={classes.rel}>\n {guideX !== undefined ? (\n <HoverTooltip\n model={model}\n open={!mouseDragging}\n overview={overview}\n guideX={guideX}\n />\n ) : null}\n <div\n className={classes.rubberbandControl}\n ref={controlsRef}\n onMouseDown={mouseDown}\n onMouseOut={mouseOut}\n onMouseMove={mouseMove}\n >\n {ControlComponent}\n </div>\n </div>\n )\n }\n\n let left = startX || 0\n let width = 0\n if (currentX !== undefined) {\n left = currentX < startX ? currentX : startX\n width = currentX - startX\n }\n // calculate the start and end bp of drag\n let leftBpOffset: ReturnType<typeof overview.pxToBp> | undefined\n let rightBpOffset: ReturnType<typeof overview.pxToBp> | undefined\n if (startX) {\n leftBpOffset = overview.pxToBp(startX - cytobandOffset)\n rightBpOffset = overview.pxToBp(startX + width - cytobandOffset)\n if (currentX !== undefined && currentX < startX) {\n ;[leftBpOffset, rightBpOffset] = [rightBpOffset, leftBpOffset]\n }\n }\n\n return (\n <div className={classes.rel}>\n {leftBpOffset && rightBpOffset ? (\n <RubberbandSpan\n leftBpOffset={leftBpOffset}\n rightBpOffset={rightBpOffset}\n width={Math.abs(width)}\n left={left}\n />\n ) : null}\n <div\n data-testid=\"rubberband_controls\"\n className={classes.rubberbandControl}\n ref={controlsRef}\n onMouseDown={mouseDown}\n onMouseOut={mouseOut}\n onMouseMove={mouseMove}\n >\n {ControlComponent}\n </div>\n </div>\n )\n})\n\nexport default OverviewRubberband\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { colord } from '@jbrowse/core/util/colord'\nimport { SessionWithWidgets, getSession, notEmpty } from '@jbrowse/core/util'\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\n\n// locals\nimport { LinearGenomeViewModel } from '../model'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()(theme => ({\n highlight: {\n height: '100%',\n position: 'absolute',\n background: colord(theme.palette.highlight.main).alpha(0.35).toRgbString(),\n borderLeft: `1px solid ${theme.palette.highlight.main}`,\n borderRight: `1px solid ${theme.palette.highlight.main}`,\n },\n}))\n\nconst OverviewHighlight = observer(function OverviewHighlight({\n model,\n overview,\n}: {\n model: LGV\n overview: Base1DViewModel\n}) {\n const { classes } = useStyles()\n const { highlight, cytobandOffset } = model\n\n const session = getSession(model) as SessionWithWidgets\n const { assemblyManager } = session\n return highlight\n .map(r => {\n const asm = assemblyManager.get(r.assemblyName)\n const refName = asm?.getCanonicalRefName(r.refName) ?? r.refName\n const s = overview.bpToPx({\n ...r,\n refName,\n coord: r.start,\n })\n const e = overview.bpToPx({\n ...r,\n refName,\n coord: r.end,\n })\n return s !== undefined && e !== undefined\n ? {\n width: Math.abs(e - s),\n left: s + cytobandOffset,\n }\n : undefined\n })\n .filter(notEmpty)\n .map(({ left, width }, idx) => (\n <div\n /* biome-ignore lint/suspicious/noArrayIndexKey: */\n key={`${left}_${width}_${idx}`}\n className={classes.highlight}\n style={{\n width: width,\n left: left,\n }}\n />\n ))\n})\n\nexport default OverviewHighlight\n","import React from 'react'\nimport { Typography } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// core\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport { getSession, getTickDisplayStr } from '@jbrowse/core/util'\nimport { ContentBlock } from '@jbrowse/core/util/blockTypes'\n\n// locals\nimport type { LinearGenomeViewModel } from '..'\nimport { chooseGridPitch } from '../util'\nimport { HEADER_OVERVIEW_HEIGHT } from '../consts'\n\nconst useStyles = makeStyles()({\n scalebarLabel: {\n height: HEADER_OVERVIEW_HEIGHT,\n position: 'absolute',\n display: 'flex',\n justifyContent: 'center',\n pointerEvents: 'none',\n },\n})\n\nconst OverviewScalebarTickLabels = observer(function ({\n block,\n scale,\n overview,\n model,\n}: {\n model: LinearGenomeViewModel\n scale: number\n block: ContentBlock\n overview: Base1DViewModel\n}) {\n const { classes } = useStyles()\n const { start, end, reversed, refName, assemblyName } = block\n const { majorPitch } = chooseGridPitch(scale, 120, 15)\n const { assemblyManager } = getSession(model)\n const assembly = assemblyManager.get(assemblyName)\n const refNameColor = assembly?.getRefNameColor(refName)\n\n const tickLabels = []\n for (let i = 0; i < Math.floor((end - start) / majorPitch); i++) {\n const offsetLabel = (i + 1) * majorPitch\n tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel)\n }\n return tickLabels.map((tickLabel, labelIdx) => (\n <Typography\n key={`${JSON.stringify(block)}-${tickLabel}-${labelIdx}`}\n className={classes.scalebarLabel}\n variant=\"body2\"\n style={{\n left: ((labelIdx + 1) * majorPitch) / scale,\n pointerEvents: 'none',\n color: refNameColor,\n }}\n >\n {getTickDisplayStr(tickLabel, overview.bpPerPx)}\n </Typography>\n ))\n})\n\nexport default OverviewScalebarTickLabels\n","import React, { useMemo } from 'react'\nimport { Typography, useTheme, alpha } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\n\n// core\nimport Base1DView, { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport { getEnv, getSession } from '@jbrowse/core/util'\nimport { ContentBlock } from '@jbrowse/core/util/blockTypes'\n\n// locals\nimport type { LinearGenomeViewModel } from '..'\nimport { getCytobands } from './util'\nimport OverviewRubberband from './OverviewRubberband'\nimport Cytobands from './Cytobands'\nimport OverviewScalebarPolygon from './OverviewScalebarPolygon'\nimport OverviewHighlight from './OverviewHighlight'\nimport OverviewScalebarTickLabels from './OverviewScalebarTickLabels'\nimport { HEADER_BAR_HEIGHT, HEADER_OVERVIEW_HEIGHT } from '../consts'\n\nconst wholeSeqSpacer = 2\n\nconst useStyles = makeStyles()(theme => ({\n scalebar: {\n height: HEADER_OVERVIEW_HEIGHT,\n },\n scalebarBorder: {\n border: '1px solid',\n },\n scalebarContig: {\n backgroundColor: theme.palette.background.default,\n position: 'absolute',\n top: 0,\n height: HEADER_OVERVIEW_HEIGHT,\n overflow: 'hidden',\n },\n scalebarContigForward: {\n backgroundImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='${theme.palette.divider}'/%3E%3C/svg%3E\")`,\n backgroundRepeat: 'repeat',\n },\n scalebarContigReverse: {\n backgroundImage: `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='${theme.palette.divider}'/%3E%3C/svg%3E\")`,\n backgroundRepeat: 'repeat',\n },\n\n scalebarRefName: {\n position: 'absolute',\n fontWeight: 'bold',\n pointerEvents: 'none',\n zIndex: 100,\n },\n scalebarVisibleRegion: {\n position: 'absolute',\n height: HEADER_OVERVIEW_HEIGHT,\n pointerEvents: 'none',\n zIndex: 100,\n border: '1px solid',\n },\n overview: {\n height: HEADER_BAR_HEIGHT,\n position: 'relative',\n },\n overviewSvg: {\n pointerEvents: 'none',\n width: '100%',\n position: 'absolute',\n },\n}))\n\ntype LGV = LinearGenomeViewModel\n\nconst OverviewBox = observer(function ({\n scale,\n model,\n block,\n overview,\n}: {\n scale: number\n model: LGV\n block: ContentBlock\n overview: Base1DViewModel\n}) {\n const { classes, cx } = useStyles()\n const theme = useTheme()\n const { cytobandOffset, showCytobands } = model\n const { reversed, refName, assemblyName } = block\n const { assemblyManager } = getSession(model)\n const assembly = assemblyManager.get(assemblyName)\n const refNameColor = assembly?.getRefNameColor(refName)\n\n const canDisplayCytobands =\n showCytobands && getCytobands(assembly, block.refName).length\n\n return (\n <div>\n {/* name of sequence */}\n <Typography\n style={{\n left: block.offsetPx + 3,\n color: canDisplayCytobands\n ? theme.palette.text.primary\n : refNameColor,\n }}\n className={classes.scalebarRefName}\n >\n {refName}\n </Typography>\n <div\n className={cx(\n classes.scalebarContig,\n canDisplayCytobands\n ? undefined\n : reversed\n ? classes.scalebarContigReverse\n : classes.scalebarContigForward,\n !canDisplayCytobands ? classes.scalebarBorder : undefined,\n )}\n style={{\n left: block.offsetPx + cytobandOffset,\n width: block.widthPx,\n borderColor: refNameColor,\n }}\n >\n {canDisplayCytobands ? (\n <svg style={{ width: '100%' }}>\n <Cytobands overview={overview} assembly={assembly} block={block} />\n </svg>\n ) : (\n <OverviewScalebarTickLabels\n model={model}\n overview={overview}\n scale={scale}\n block={block}\n />\n )}\n </div>\n </div>\n )\n})\n\nconst Scalebar = observer(function ({\n model,\n scale,\n overview,\n}: {\n model: LGV\n overview: Base1DViewModel\n scale: number\n}) {\n const { classes } = useStyles()\n const theme = useTheme()\n const { dynamicBlocks, showCytobands, cytobandOffset } = model\n const { pluginManager } = getEnv(model)\n const visibleRegions = dynamicBlocks.contentBlocks\n const overviewVisibleRegions = overview.dynamicBlocks\n const scalebarColor = theme.palette.tertiary.light\n // catches possible null from at's below\n if (!visibleRegions.length) {\n return null\n }\n\n const first = visibleRegions.at(0)!\n const last = visibleRegions.at(-1)!\n\n const firstOverviewPx =\n overview.bpToPx({\n ...first,\n coord: first.reversed ? first.end : first.start,\n }) || 0\n\n const lastOverviewPx =\n overview.bpToPx({\n ...last,\n coord: last.reversed ? last.start : last.end,\n }) || 0\n\n const color = showCytobands ? '#f00' : scalebarColor\n const transparency = showCytobands ? 0.1 : 0.3\n\n const additional = pluginManager.evaluateExtensionPoint(\n 'LinearGenomeView-OverviewScalebarComponent',\n undefined,\n { model, overview },\n ) as React.ReactNode\n\n return (\n <div className={classes.scalebar}>\n <div\n className={classes.scalebarVisibleRegion}\n style={{\n width: lastOverviewPx - firstOverviewPx,\n left: firstOverviewPx + cytobandOffset,\n background: alpha(color, transparency),\n borderColor: color,\n }}\n />\n {/* this is the entire scale bar */}\n {overviewVisibleRegions.map((block, idx) => {\n return !(block.type === 'ContentBlock') ? (\n <div\n key={`${JSON.stringify(block)}-${idx}`}\n className={classes.scalebarContig}\n style={{\n width: block.widthPx,\n left: block.offsetPx,\n backgroundColor: '#999',\n backgroundImage:\n 'repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)',\n }}\n />\n ) : (\n <OverviewBox\n scale={scale}\n block={block}\n model={model}\n overview={overview}\n key={`${JSON.stringify(block)}-${idx}`}\n />\n )\n })}\n <OverviewHighlight model={model} overview={overview} />\n {additional}\n </div>\n )\n})\n\nconst OverviewScalebar = observer(function ({\n model,\n children,\n}: {\n model: LGV\n children: React.ReactNode\n}) {\n const { classes } = useStyles()\n const {\n minimumBlockWidth,\n totalBp,\n width,\n cytobandOffset,\n displayedRegions,\n } = model\n\n const modWidth = width - cytobandOffset\n const str = JSON.stringify(displayedRegions)\n const overview = useMemo(() => {\n const overview = Base1DView.create({\n displayedRegions: JSON.parse(str),\n interRegionPaddingWidth: 0,\n minimumBlockWidth,\n })\n\n overview.setVolatileWidth(modWidth)\n overview.showAllRegions()\n return overview\n }, [str, minimumBlockWidth, modWidth])\n\n const scale =\n totalBp / (modWidth - (displayedRegions.length - 1) * wholeSeqSpacer)\n\n return (\n <div>\n <OverviewRubberband\n model={model}\n overview={overview}\n ControlComponent={\n <Scalebar model={model} overview={overview} scale={scale} />\n }\n />\n <div className={classes.overview}>\n <svg height={HEADER_BAR_HEIGHT} className={classes.overviewSvg}>\n <OverviewScalebarPolygon model={model} overview={overview} />\n </svg>\n {children}\n </div>\n </div>\n )\n})\n\nexport default OverviewScalebar\n","import React, { useState, useEffect } from 'react'\nimport { observer } from 'mobx-react'\nimport { Slider, IconButton } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport ZoomIn from '@mui/icons-material/ZoomIn'\nimport ZoomOut from '@mui/icons-material/ZoomOut'\nimport { LinearGenomeViewModel } from '..'\n\nconst useStyles = makeStyles()(theme => ({\n container: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n },\n slider: {\n width: 70,\n color: theme.palette.text.secondary,\n },\n}))\n\nconst ZoomControls = observer(function ({\n model,\n}: {\n model: LinearGenomeViewModel\n}) {\n const { classes } = useStyles()\n const { maxBpPerPx, minBpPerPx, bpPerPx } = model\n const [value, setValue] = useState(-Math.log2(bpPerPx) * 100)\n useEffect(() => {\n setValue(-Math.log2(bpPerPx) * 100)\n }, [bpPerPx])\n\n return (\n <div className={classes.container}>\n <IconButton\n data-testid=\"zoom_out\"\n onClick={() => {\n model.zoom(bpPerPx * 2)\n }}\n disabled={bpPerPx >= maxBpPerPx - 0.0001}\n size=\"large\"\n >\n <ZoomOut />\n </IconButton>\n\n <Slider\n size=\"small\"\n className={classes.slider}\n value={value}\n min={-Math.log2(maxBpPerPx) * 100}\n max={-Math.log2(minBpPerPx) * 100}\n onChange={(_, val) => {\n setValue(val as number)\n }}\n onChangeCommitted={() => model.zoomTo(2 ** (-value / 100))}\n />\n <IconButton\n data-testid=\"zoom_in\"\n onClick={() => {\n model.zoom(model.bpPerPx / 2)\n }}\n disabled={bpPerPx <= minBpPerPx + 0.0001}\n size=\"large\"\n >\n <ZoomIn />\n </IconButton>\n </div>\n )\n})\n\nexport default ZoomControls\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { useTheme, alpha } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { getSession } from '@jbrowse/core/util'\n\n// locals\nimport RefNameAutocomplete from './RefNameAutocomplete'\nimport { fetchResults } from './util'\nimport { LinearGenomeViewModel } from '..'\nimport { handleSelectedRegion, navToOption } from '../../searchUtils'\nimport { SPACING, WIDGET_HEIGHT } from '../consts'\n\nconst useStyles = makeStyles()(() => ({\n headerRefName: {\n minWidth: 100,\n },\n}))\n\nconst SearchBox = observer(function ({\n model,\n showHelp,\n}: {\n showHelp?: boolean\n model: LinearGenomeViewModel\n}) {\n const { classes } = useStyles()\n const theme = useTheme()\n const session = getSession(model)\n\n const { textSearchManager, assemblyManager } = session\n const { assemblyNames, rankSearchResults } = model\n const assemblyName = assemblyNames[0]!\n const assembly = assemblyManager.get(assemblyName)\n const searchScope = model.searchScope(assemblyName)\n\n return (\n <RefNameAutocomplete\n showHelp={showHelp}\n onSelect={async option => {\n try {\n if (option.hasLocation()) {\n await navToOption({ option, model, assemblyName })\n } else if (option.results?.length) {\n model.setSearchResults(option.results, option.getLabel())\n } else if (assembly) {\n await handleSelectedRegion({\n input: option.getLabel(),\n assembly,\n model,\n })\n }\n } catch (e) {\n console.error(e)\n getSession(model).notify(`${e}`, 'warning')\n }\n }}\n assemblyName={assemblyName}\n fetchResults={queryString =>\n fetchResults({\n queryString,\n searchScope,\n rankSearchResults,\n textSearchManager,\n assembly,\n })\n }\n model={model}\n minWidth={175}\n TextFieldProps={{\n variant: 'outlined',\n className: classes.headerRefName,\n style: {\n margin: SPACING,\n },\n InputProps: {\n style: {\n padding: 0,\n height: WIDGET_HEIGHT,\n background: alpha(theme.palette.background.paper, 0.8),\n },\n },\n }}\n />\n )\n})\n\nexport default SearchBox\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { Button, IconButton, FormGroup, Typography, alpha } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { getBpDisplayStr } from '@jbrowse/core/util'\n\n// icons\nimport { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'\nimport ArrowForwardIcon from '@mui/icons-material/ArrowForward'\nimport ArrowBackIcon from '@mui/icons-material/ArrowBack'\n\n// locals\nimport { LinearGenomeViewModel } from '..'\nimport OverviewScalebar from './OverviewScalebar'\nimport ZoomControls from './ZoomControls'\nimport SearchBox from './SearchBox'\nimport { SPACING } from '../consts'\n\ntype LGV = LinearGenomeViewModel\nconst useStyles = makeStyles()(theme => ({\n headerBar: {\n display: 'flex',\n },\n headerForm: {\n flexWrap: 'nowrap',\n marginRight: 7,\n },\n spacer: {\n flexGrow: 1,\n },\n\n panButton: {\n background: alpha(theme.palette.background.paper, 0.8),\n color: theme.palette.text.primary,\n margin: SPACING,\n },\n bp: {\n display: 'flex',\n alignItems: 'center',\n marginLeft: 5,\n },\n toggleButton: {\n height: 44,\n border: 'none',\n marginLeft: theme.spacing(4),\n },\n buttonSpacer: {\n marginRight: theme.spacing(2),\n },\n}))\n\nconst HeaderButtons = observer(({ model }: { model: LGV }) => {\n const { classes } = useStyles()\n return (\n <IconButton\n onClick={model.activateTrackSelector}\n className={classes.toggleButton}\n title=\"Open track selector\"\n value=\"track_select\"\n >\n <TrackSelectorIcon className={classes.buttonSpacer} />\n </IconButton>\n )\n})\n\nfunction PanControls({ model }: { model: LGV }) {\n const { classes } = useStyles()\n return (\n <>\n <Button\n variant=\"outlined\"\n className={classes.panButton}\n onClick={() => {\n model.slide(-0.9)\n }}\n >\n <ArrowBackIcon />\n </Button>\n <Button\n variant=\"outlined\"\n className={classes.panButton}\n onClick={() => {\n model.slide(0.9)\n }}\n >\n <ArrowForwardIcon />\n </Button>\n </>\n )\n}\n\nconst RegionWidth = observer(function ({ model }: { model: LGV }) {\n const { classes } = useStyles()\n const { coarseTotalBp } = model\n return (\n <Typography variant=\"body2\" color=\"textSecondary\" className={classes.bp}>\n {getBpDisplayStr(coarseTotalBp)}\n </Typography>\n )\n})\n\nconst Controls = ({ model }: { model: LGV }) => {\n const { classes } = useStyles()\n return (\n <div className={classes.headerBar}>\n <HeaderButtons model={model} />\n <div className={classes.spacer} />\n <FormGroup row className={classes.headerForm}>\n <PanControls model={model} />\n <SearchBox model={model} />\n </FormGroup>\n <RegionWidth model={model} />\n <ZoomControls model={model} />\n <div className={classes.spacer} />\n </div>\n )\n}\n\nconst LinearGenomeViewHeader = observer(function ({ model }: { model: LGV }) {\n const { hideHeader, hideHeaderOverview } = model\n return !hideHeader ? (\n hideHeaderOverview ? (\n <Controls model={model} />\n ) : (\n <OverviewScalebar model={model}>\n <Controls model={model} />\n </OverviewScalebar>\n )\n ) : null\n})\n\nexport default LinearGenomeViewHeader\n","import React, { lazy } from 'react'\nimport { getConf, AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { Region } from '@jbrowse/core/util/types'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { Region as IRegion } from '@jbrowse/core/util/types'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport {\n assembleLocString,\n clamp,\n findLast,\n getSession,\n isSessionModelWithWidgets,\n isSessionWithAddTracks,\n localStorageGetItem,\n localStorageSetItem,\n measureText,\n springAnimate,\n sum,\n ParsedLocString,\n} from '@jbrowse/core/util'\nimport BaseResult from '@jbrowse/core/TextSearch/BaseResults'\nimport { BlockSet, BaseBlock } from '@jbrowse/core/util/blockTypes'\nimport calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks'\nimport calculateStaticBlocks from '@jbrowse/core/util/calculateStaticBlocks'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport { when, transaction, autorun } from 'mobx'\nimport {\n addDisposer,\n cast,\n getSnapshot,\n getRoot,\n resolveIdentifier,\n types,\n Instance,\n getParent,\n} from 'mobx-state-tree'\n\nimport Base1DView from '@jbrowse/core/util/Base1DViewModel'\nimport { moveTo, pxToBp, bpToPx } from '@jbrowse/core/util/Base1DUtils'\nimport { saveAs } from 'file-saver'\nimport clone from 'clone'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// icons\nimport { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'\nimport SyncAltIcon from '@mui/icons-material/SyncAlt'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport LabelIcon from '@mui/icons-material/Label'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\nimport PhotoCameraIcon from '@mui/icons-material/PhotoCamera'\nimport ZoomInIcon from '@mui/icons-material/ZoomIn'\nimport MenuOpenIcon from '@mui/icons-material/MenuOpen'\nimport PaletteIcon from '@mui/icons-material/Palette'\nimport SearchIcon from '@mui/icons-material/Search'\n\nimport MiniControls from './components/MiniControls'\nimport Header from './components/Header'\nimport { generateLocations, parseLocStrings } from './util'\nimport { Assembly } from '@jbrowse/core/assemblyManager/assembly'\nimport { handleSelectedRegion } from '../searchUtils'\nimport {\n HEADER_BAR_HEIGHT,\n HEADER_OVERVIEW_HEIGHT,\n INTER_REGION_PADDING_WIDTH,\n RESIZE_HANDLE_HEIGHT,\n SCALE_BAR_HEIGHT,\n} from './consts'\n\n// lazies\nconst ReturnToImportFormDialog = lazy(\n () => import('@jbrowse/core/ui/ReturnToImportFormDialog'),\n)\nconst SequenceSearchDialog = lazy(\n () => import('./components/SequenceSearchDialog'),\n)\nconst ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'))\nconst GetSequenceDialog = lazy(() => import('./components/GetSequenceDialog'))\nconst SearchResultsDialog = lazy(\n () => import('./components/SearchResultsDialog'),\n)\n\nexport interface BpOffset {\n refName?: string\n index: number\n offset: number\n start?: number\n end?: number\n coord?: number\n reversed?: boolean\n assemblyName?: string\n oob?: boolean\n}\nexport interface ExportSvgOptions {\n rasterizeLayers?: boolean\n filename?: string\n Wrapper?: React.FC<{ children: React.ReactNode }>\n fontSize?: number\n rulerHeight?: number\n textHeight?: number\n paddingHeight?: number\n headerHeight?: number\n cytobandHeight?: number\n trackLabels?: string\n themeName?: string\n}\n\nexport interface HighlightType {\n start: number\n end: number\n assemblyName: string\n refName: string\n}\n\nfunction calculateVisibleLocStrings(contentBlocks: BaseBlock[]) {\n if (!contentBlocks.length) {\n return ''\n }\n const isSingleAssemblyName = contentBlocks.every(\n b => b.assemblyName === contentBlocks[0]!.assemblyName,\n )\n const locs = contentBlocks.map(block =>\n assembleLocString({\n ...block,\n start: Math.round(block.start),\n end: Math.round(block.end),\n assemblyName: isSingleAssemblyName ? undefined : block.assemblyName,\n }),\n )\n return locs.join(' ')\n}\n\nexport interface NavLocation {\n refName: string\n start?: number\n end?: number\n assemblyName?: string\n}\n\n/**\n * #stateModel LinearGenomeView\n * #category view\n *\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nexport function stateModelFactory(pluginManager: PluginManager) {\n return types\n .compose(\n 'LinearGenomeView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n id: ElementId,\n\n /**\n * #property\n * this is a string instead of the const literal 'LinearGenomeView' to\n * reduce some typescripting strictness, but you should pass the string\n * 'LinearGenomeView' to the model explicitly\n */\n type: types.literal('LinearGenomeView') as unknown as string,\n\n /**\n * #property\n * corresponds roughly to the horizontal scroll of the LGV\n */\n offsetPx: 0,\n\n /**\n * #property\n * corresponds roughly to the zoom level, base-pairs per pixel\n */\n bpPerPx: 1,\n\n /**\n * #property\n * currently displayed regions, can be a single chromosome, arbitrary\n * subsections, or the entire set of chromosomes in the genome, but it not\n * advised to use the entire set of chromosomes if your assembly is very\n * fragmented\n */\n displayedRegions: types.optional(types.frozen<IRegion[]>(), []),\n\n /**\n * #property\n * array of currently displayed tracks state models instances\n */\n tracks: types.array(\n pluginManager.pluggableMstType('track', 'stateModel'),\n ),\n\n /**\n * #property\n */\n hideHeader: false,\n\n /**\n * #property\n */\n hideHeaderOverview: false,\n\n /**\n * #property\n */\n hideNoTracksActive: false,\n\n /**\n * #property\n */\n trackSelectorType: types.optional(\n types.enumeration(['hierarchical']),\n 'hierarchical',\n ),\n /**\n * #property\n * show the \"center line\"\n */\n showCenterLine: types.optional(types.boolean, () =>\n Boolean(\n JSON.parse(localStorageGetItem('lgv-showCenterLine') || 'false'),\n ),\n ),\n\n /**\n * #property\n * show the \"cytobands\" in the overview scale bar\n */\n showCytobandsSetting: types.optional(types.boolean, () =>\n Boolean(\n JSON.parse(localStorageGetItem('lgv-showCytobands') || 'true'),\n ),\n ),\n\n /**\n * #property\n * how to display the track labels, can be \"overlapping\", \"offset\", or\n * \"hidden\", or empty string \"\" (which results in conf being used). see\n * LinearGenomeViewPlugin\n * https://jbrowse.org/jb2/docs/config/lineargenomeviewplugin/ docs for\n * how conf is used\n */\n trackLabels: types.optional(\n types.string,\n () => localStorageGetItem('lgv-trackLabels') || '',\n ),\n\n /**\n * #property\n * show the \"gridlines\" in the track area\n */\n showGridlines: true,\n\n /**\n * #property\n * highlights on the LGV from the URL parameters\n */\n highlight: types.optional(\n types.array(types.frozen<HighlightType>()),\n [],\n ),\n\n /**\n * #property\n * color by CDS\n */\n colorByCDS: types.optional(types.boolean, () =>\n Boolean(JSON.parse(localStorageGetItem('lgv-colorByCDS') || 'false')),\n ),\n\n /**\n * #property\n * color by CDS\n */\n showTrackOutlines: types.optional(types.boolean, () =>\n Boolean(\n JSON.parse(localStorageGetItem('lgv-showTrackOutlines') || 'true'),\n ),\n ),\n }),\n )\n .volatile(() => ({\n volatileWidth: undefined as number | undefined,\n minimumBlockWidth: 3,\n draggingTrackId: undefined as undefined | string,\n volatileError: undefined as unknown,\n\n // array of callbacks to run after the next set of the displayedRegions,\n // which is basically like an onLoad\n afterDisplayedRegionsSetCallbacks: [] as (() => void)[],\n scaleFactor: 1,\n trackRefs: {} as Record<string, HTMLDivElement>,\n coarseDynamicBlocks: [] as BaseBlock[],\n coarseTotalBp: 0,\n leftOffset: undefined as undefined | BpOffset,\n rightOffset: undefined as undefined | BpOffset,\n }))\n .views(self => ({\n /**\n * #getter\n * this is the effective value of the track labels setting, incorporating\n * both the config and view state. use this instead of view.trackLabels\n */\n get trackLabelsSetting() {\n const sessionSetting = getConf(getSession(self), [\n 'LinearGenomeViewPlugin',\n 'trackLabels',\n ])\n return self.trackLabels || sessionSetting\n },\n /**\n * #getter\n */\n get width(): number {\n if (self.volatileWidth === undefined) {\n throw new Error(\n 'width undefined, make sure to check for model.initialized',\n )\n }\n return self.volatileWidth\n },\n /**\n * #getter\n */\n get interRegionPaddingWidth() {\n return INTER_REGION_PADDING_WIDTH\n },\n\n /**\n * #getter\n */\n get assemblyNames() {\n return [\n ...new Set(self.displayedRegions.map(region => region.assemblyName)),\n ]\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n scaleBarDisplayPrefix() {\n return getParent<any>(self, 2).type === 'LinearSyntenyView'\n ? self.assemblyNames[0]\n : ''\n },\n /**\n * #method\n */\n\n MiniControlsComponent(): React.FC<any> {\n return MiniControls\n },\n\n /**\n * #method\n */\n\n HeaderComponent(): React.FC<any> {\n return Header\n },\n\n /**\n * #getter\n */\n get assemblyErrors() {\n const { assemblyManager } = getSession(self)\n return self.assemblyNames\n .map(a => assemblyManager.get(a)?.error)\n .filter(f => !!f)\n .join(', ')\n },\n\n /**\n * #getter\n */\n get assembliesInitialized() {\n const { assemblyManager } = getSession(self)\n const { assemblyNames } = self\n return assemblyNames.every(a => assemblyManager.get(a)?.initialized)\n },\n\n /**\n * #getter\n */\n get initialized() {\n return self.volatileWidth !== undefined && this.assembliesInitialized\n },\n\n /**\n * #getter\n */\n get hasDisplayedRegions() {\n return self.displayedRegions.length > 0\n },\n\n /**\n * #getter\n */\n get scaleBarHeight() {\n return SCALE_BAR_HEIGHT + RESIZE_HANDLE_HEIGHT\n },\n\n /**\n * #getter\n */\n get headerHeight() {\n if (self.hideHeader) {\n return 0\n }\n if (self.hideHeaderOverview) {\n return HEADER_BAR_HEIGHT\n }\n return HEADER_BAR_HEIGHT + HEADER_OVERVIEW_HEIGHT\n },\n\n /**\n * #getter\n */\n get trackHeights() {\n return sum(self.tracks.map(t => t.displays[0].height))\n },\n\n /**\n * #getter\n */\n get trackHeightsWithResizeHandles() {\n return this.trackHeights + self.tracks.length * RESIZE_HANDLE_HEIGHT\n },\n\n /**\n * #getter\n */\n get height() {\n return (\n this.trackHeightsWithResizeHandles +\n this.headerHeight +\n this.scaleBarHeight\n )\n },\n\n /**\n * #getter\n */\n get totalBp() {\n return sum(self.displayedRegions.map(r => r.end - r.start))\n },\n\n /**\n * #getter\n */\n get maxBpPerPx() {\n return this.totalBp / (self.width * 0.9)\n },\n\n /**\n * #getter\n */\n get minBpPerPx() {\n return 1 / 50\n },\n\n /**\n * #getter\n */\n get error(): unknown {\n return self.volatileError || this.assemblyErrors\n },\n\n /**\n * #getter\n */\n get maxOffset() {\n // objectively determined to keep the linear genome on the main screen\n const leftPadding = 10\n return this.displayedRegionsTotalPx - leftPadding\n },\n\n /**\n * #getter\n */\n get minOffset() {\n // objectively determined to keep the linear genome on the main screen\n const rightPadding = 30\n return -self.width + rightPadding\n },\n\n /**\n * #getter\n */\n get displayedRegionsTotalPx() {\n return this.totalBp / self.bpPerPx\n },\n\n /**\n * #method\n */\n renderProps() {\n return {\n ...getParentRenderProps(self),\n bpPerPx: self.bpPerPx,\n colorByCDS: self.colorByCDS,\n }\n },\n\n /**\n * #method\n */\n searchScope(assemblyName: string) {\n return {\n assemblyName,\n includeAggregateIndexes: true,\n tracks: self.tracks,\n }\n },\n\n /**\n * #method\n */\n getTrack(id: string) {\n return self.tracks.find(t => t.configuration.trackId === id)\n },\n\n /**\n * #method\n */\n rankSearchResults(results: BaseResult[]) {\n // order of rank\n const openTrackIds = new Set(\n self.tracks.map(track => track.configuration.trackId),\n )\n for (const result of results) {\n if (openTrackIds.has(result.trackId)) {\n result.updateScore(result.getScore() + 1)\n }\n }\n return results\n },\n\n /**\n * #method\n * modifies view menu action onClick to apply to all tracks of same type\n */\n rewriteOnClicks(trackType: string, viewMenuActions: MenuItem[]) {\n viewMenuActions.forEach(action => {\n // go to lowest level menu\n if ('subMenu' in action) {\n this.rewriteOnClicks(trackType, action.subMenu)\n }\n if ('onClick' in action) {\n const holdOnClick = action.onClick\n action.onClick = (...args: unknown[]) => {\n self.tracks.forEach(track => {\n if (track.type === trackType) {\n holdOnClick.apply(track, [track, ...args])\n }\n })\n }\n }\n })\n },\n /**\n * #getter\n */\n get trackTypeActions() {\n const allActions = new Map<string, MenuItem[]>()\n self.tracks.forEach(track => {\n const trackInMap = allActions.get(track.type)\n if (!trackInMap) {\n const viewMenuActions = clone(track.viewMenuActions)\n this.rewriteOnClicks(track.type, viewMenuActions)\n allActions.set(track.type, viewMenuActions)\n }\n })\n\n return allActions\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setShowTrackOutlines(arg: boolean) {\n self.showTrackOutlines = arg\n },\n /**\n * #action\n */\n setColorByCDS(flag: boolean) {\n self.colorByCDS = flag\n },\n /**\n * #action\n */\n setShowCytobands(flag: boolean) {\n self.showCytobandsSetting = flag\n },\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.volatileWidth = newWidth\n },\n /**\n * #action\n */\n setError(error: unknown) {\n self.volatileError = error\n },\n /**\n * #action\n */\n setHideHeader(b: boolean) {\n self.hideHeader = b\n },\n /**\n * #action\n */\n setHideHeaderOverview(b: boolean) {\n self.hideHeaderOverview = b\n },\n /**\n * #action\n */\n setHideNoTracksActive(b: boolean) {\n self.hideNoTracksActive = b\n },\n /**\n * #action\n */\n setShowGridlines(b: boolean) {\n self.showGridlines = b\n },\n /**\n * #action\n */\n addToHighlights(highlight: HighlightType) {\n self.highlight.push(highlight)\n },\n /**\n * #action\n */\n setHighlight(highlight?: HighlightType[]) {\n self.highlight = cast(highlight)\n },\n /**\n * #action\n */\n removeHighlight(highlight: HighlightType) {\n self.highlight.remove(highlight)\n },\n /**\n * #action\n */\n scrollTo(offsetPx: number) {\n const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset)\n self.offsetPx = newOffsetPx\n return newOffsetPx\n },\n\n /**\n * #action\n */\n zoomTo(bpPerPx: number, offset = self.width / 2, centerAtOffset = false) {\n const newBpPerPx = clamp(bpPerPx, self.minBpPerPx, self.maxBpPerPx)\n if (newBpPerPx === self.bpPerPx) {\n return newBpPerPx\n }\n const oldBpPerPx = self.bpPerPx\n\n if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {\n console.warn('zoomTo bpPerPx rounding error')\n return oldBpPerPx\n }\n self.bpPerPx = newBpPerPx\n\n // tweak the offset so that the center of the view remains at the same\n // coordinate\n this.scrollTo(\n Math.round(\n ((self.offsetPx + offset) * oldBpPerPx) / newBpPerPx -\n (centerAtOffset ? self.width / 2 : offset),\n ),\n )\n return newBpPerPx\n },\n\n /**\n * #action\n * sets offsets of rubberband, used in the get sequence dialog can call\n * view.getSelectedRegions(view.leftOffset,view.rightOffset) to compute\n * the selected regions from the offsets\n */\n setOffsets(left?: BpOffset, right?: BpOffset) {\n self.leftOffset = left\n self.rightOffset = right\n },\n\n /**\n * #action\n */\n setSearchResults(\n searchResults: BaseResult[],\n searchQuery: string,\n assemblyName?: string,\n ) {\n getSession(self).queueDialog(handleClose => [\n SearchResultsDialog,\n {\n model: self as LinearGenomeViewModel,\n searchResults,\n searchQuery,\n handleClose,\n assemblyName,\n },\n ])\n },\n\n /**\n * #action\n */\n setNewView(bpPerPx: number, offsetPx: number) {\n this.zoomTo(bpPerPx)\n this.scrollTo(offsetPx)\n },\n\n /**\n * #action\n */\n horizontallyFlip() {\n self.displayedRegions = cast(\n [...self.displayedRegions]\n .reverse()\n .map(region => ({ ...region, reversed: !region.reversed })),\n )\n this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width)\n },\n\n /**\n * #action\n */\n showTrack(\n trackId: string,\n initialSnapshot = {},\n displayInitialSnapshot = {},\n ) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n if (!conf) {\n throw new Error(`Could not resolve identifier \"${trackId}\"`)\n }\n const trackType = pluginManager.getTrackType(conf?.type)\n if (!trackType) {\n throw new Error(`Unknown track type ${conf.type}`)\n }\n const viewType = pluginManager.getViewType(self.type)!\n const supportedDisplays = new Set(\n viewType.displayTypes.map(d => d.name),\n )\n const displayConf = conf.displays.find((d: AnyConfigurationModel) =>\n supportedDisplays.has(d.type),\n )\n if (!displayConf) {\n throw new Error(\n `Could not find a compatible display for view type ${self.type}`,\n )\n }\n\n const t = self.tracks.filter(t => t.configuration === conf)\n if (t.length === 0) {\n const track = trackType.stateModel.create({\n ...initialSnapshot,\n type: conf.type,\n configuration: conf,\n displays: [\n {\n type: displayConf.type,\n configuration: displayConf,\n ...displayInitialSnapshot,\n },\n ],\n })\n self.tracks.push(track)\n return track\n }\n return t[0]\n },\n /**\n * #action\n */\n hideTrack(trackId: string) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n const t = self.tracks.filter(t => t.configuration === conf)\n transaction(() => {\n t.forEach(t => self.tracks.remove(t))\n })\n return t.length\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n moveTrackDown(id: string) {\n const idx = self.tracks.findIndex(v => v.id === id)\n if (idx === -1) {\n return\n }\n\n if (idx !== -1 && idx < self.tracks.length - 1) {\n self.tracks.splice(idx, 2, self.tracks[idx + 1], self.tracks[idx])\n }\n },\n /**\n * #action\n */\n moveTrackUp(id: string) {\n const idx = self.tracks.findIndex(track => track.id === id)\n if (idx > 0) {\n self.tracks.splice(idx - 1, 2, self.tracks[idx], self.tracks[idx - 1])\n }\n },\n /**\n * #action\n */\n moveTrackToTop(id: string) {\n const idx = self.tracks.findIndex(track => track.id === id)\n self.tracks = cast([\n self.tracks[idx],\n ...self.tracks.filter(track => track.id !== id),\n ])\n },\n /**\n * #action\n */\n moveTrackToBottom(id: string) {\n const idx = self.tracks.findIndex(track => track.id === id)\n self.tracks = cast([\n ...self.tracks.filter(track => track.id !== id),\n self.tracks[idx],\n ])\n },\n /**\n * #action\n */\n moveTrack(movingId: string, targetId: string) {\n const oldIndex = self.tracks.findIndex(track => track.id === movingId)\n if (oldIndex === -1) {\n throw new Error(`Track ID ${movingId} not found`)\n }\n const newIndex = self.tracks.findIndex(track => track.id === targetId)\n if (newIndex === -1) {\n throw new Error(`Track ID ${targetId} not found`)\n }\n\n const tracks = self.tracks.filter((_, idx) => idx !== oldIndex)\n tracks.splice(newIndex, 0, self.tracks[oldIndex])\n self.tracks = cast(tracks)\n },\n\n /**\n * #action\n */\n toggleTrack(trackId: string) {\n // if we have any tracks with that configuration, turn them off\n const hiddenCount = self.hideTrack(trackId)\n // if none had that configuration, turn one on\n if (!hiddenCount) {\n self.showTrack(trackId)\n return true\n }\n return false\n },\n\n /**\n * #action\n */\n setTrackLabels(setting: 'overlapping' | 'offset' | 'hidden') {\n localStorage.setItem('lgv-trackLabels', setting)\n self.trackLabels = setting\n },\n\n /**\n * #action\n */\n setShowCenterLine(b: boolean) {\n self.showCenterLine = b\n },\n\n /**\n * #action\n */\n setDisplayedRegions(regions: Region[]) {\n self.displayedRegions = cast(regions)\n self.zoomTo(self.bpPerPx)\n },\n\n /**\n * #action\n */\n activateTrackSelector() {\n if (self.trackSelectorType === 'hierarchical') {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const selector = session.addWidget(\n 'HierarchicalTrackSelectorWidget',\n 'hierarchicalTrackSelector',\n { view: self },\n )\n session.showWidget(selector)\n return selector\n }\n }\n throw new Error(`invalid track selector type ${self.trackSelectorType}`)\n },\n\n /**\n * #method\n * Helper method for the fetchSequence.\n * Retrieves the corresponding regions that were selected by the\n * rubberband\n *\n * @param leftOffset - `object as {start, end, index, offset}`, offset = start\n * of user drag\n * @param rightOffset - `object as {start, end, index, offset}`,\n * offset = end of user drag\n * @returns array of Region[]\n */\n getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset) {\n const snap = getSnapshot(self)\n const simView = Base1DView.create({\n ...snap,\n interRegionPaddingWidth: self.interRegionPaddingWidth,\n })\n\n simView.setVolatileWidth(self.width)\n simView.moveTo(leftOffset, rightOffset)\n\n return simView.dynamicBlocks.contentBlocks.map(region => ({\n ...region,\n start: Math.floor(region.start),\n end: Math.ceil(region.end),\n }))\n },\n\n /**\n * #action\n * schedule something to be run after the next time displayedRegions is\n * set\n */\n afterDisplayedRegionsSet(cb: () => void) {\n self.afterDisplayedRegionsSetCallbacks.push(cb)\n },\n\n /**\n * #action\n */\n horizontalScroll(distance: number) {\n const oldOffsetPx = self.offsetPx\n // newOffsetPx is the actual offset after the scroll is clamped\n const newOffsetPx = self.scrollTo(self.offsetPx + distance)\n return newOffsetPx - oldOffsetPx\n },\n\n /**\n * #action\n */\n center() {\n const centerBp = self.totalBp / 2\n const centerPx = centerBp / self.bpPerPx\n self.scrollTo(Math.round(centerPx - self.width / 2))\n },\n\n /**\n * #action\n */\n showAllRegions() {\n self.zoomTo(self.maxBpPerPx)\n this.center()\n },\n\n /**\n * #action\n */\n showAllRegionsInAssembly(assemblyName?: string) {\n const session = getSession(self)\n const { assemblyManager } = session\n if (!assemblyName) {\n const names = new Set(self.displayedRegions.map(r => r.assemblyName))\n if (names.size > 1) {\n session.notify(\n `Can't perform operation with multiple assemblies currently`,\n )\n return\n }\n ;[assemblyName] = [...names]\n }\n const assembly = assemblyManager.get(assemblyName!)\n if (assembly) {\n const { regions } = assembly\n if (regions) {\n this.setDisplayedRegions(regions)\n self.zoomTo(self.maxBpPerPx)\n this.center()\n }\n }\n },\n\n /**\n * #action\n */\n setDraggingTrackId(idx?: string) {\n self.draggingTrackId = idx\n },\n\n /**\n * #action\n */\n setScaleFactor(factor: number) {\n self.scaleFactor = factor\n },\n\n /**\n * #action\n * this \"clears the view\" and makes the view return to the import form\n */\n clearView() {\n this.setDisplayedRegions([])\n self.tracks.clear()\n // it is necessary to run these after setting displayed regions empty\n // or else model.offsetPx gets set to Infinity and breaks\n // mobx-state-tree snapshot\n self.scrollTo(0)\n self.zoomTo(10)\n },\n\n /**\n * #method\n * creates an svg export and save using FileSaver\n */\n async exportSvg(opts: ExportSvgOptions = {}) {\n const { renderToSvg } = await import(\n './svgcomponents/SVGLinearGenomeView'\n )\n const html = await renderToSvg(self as LinearGenomeViewModel, opts)\n const blob = new Blob([html], { type: 'image/svg+xml' })\n saveAs(blob, opts.filename || 'image.svg')\n },\n }))\n .actions(self => {\n let cancelLastAnimation = () => {}\n\n /**\n * #action\n * perform animated slide\n */\n function slide(viewWidths: number) {\n const [animate, cancelAnimation] = springAnimate(\n self.offsetPx,\n self.offsetPx + self.width * viewWidths,\n self.scrollTo,\n undefined,\n undefined,\n 200,\n )\n cancelLastAnimation()\n cancelLastAnimation = cancelAnimation!\n animate!()\n }\n\n return { slide }\n })\n .actions(self => {\n let cancelLastAnimation = () => {}\n\n /**\n * #action\n * perform animated zoom\n */\n function zoom(targetBpPerPx: number) {\n self.zoomTo(self.bpPerPx)\n if (\n // already zoomed all the way in\n (targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx) ||\n // already zoomed all the way out\n (targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx)\n ) {\n return\n }\n const factor = self.bpPerPx / targetBpPerPx\n const [animate, cancelAnimation] = springAnimate(\n 1,\n factor,\n self.setScaleFactor,\n () => {\n self.zoomTo(targetBpPerPx)\n self.setScaleFactor(1)\n },\n )\n cancelLastAnimation()\n cancelLastAnimation = cancelAnimation!\n animate!()\n }\n\n return { zoom }\n })\n .views(self => ({\n /**\n * #getter\n */\n get canShowCytobands() {\n return self.displayedRegions.length === 1 && this.anyCytobandsExist\n },\n /**\n * #getter\n */\n get showCytobands() {\n return this.canShowCytobands && self.showCytobandsSetting\n },\n /**\n * #getter\n */\n get anyCytobandsExist() {\n const { assemblyManager } = getSession(self)\n return self.assemblyNames.some(\n a => assemblyManager.get(a)?.cytobands?.length,\n )\n },\n /**\n * #getter\n * the cytoband is displayed to the right of the chromosome name, and\n * that offset is calculated manually with this method\n */\n get cytobandOffset() {\n return this.showCytobands\n ? measureText(self.displayedRegions[0]?.refName || '', 12) + 15\n : 0\n },\n }))\n .views(self => ({\n /**\n * #method\n * return the view menu items\n */\n menuItems(): MenuItem[] {\n const { canShowCytobands, showCytobands } = self\n const session = getSession(self)\n const menuItems: MenuItem[] = [\n {\n label: 'Return to import form',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ReturnToImportFormDialog,\n { model: self, handleClose },\n ])\n },\n icon: FolderOpenIcon,\n },\n ...(isSessionWithAddTracks(session)\n ? [\n {\n label: 'Sequence search',\n icon: SearchIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SequenceSearchDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n : []),\n {\n label: 'Export SVG',\n icon: PhotoCameraIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n {\n label: 'Open track selector',\n onClick: self.activateTrackSelector,\n icon: TrackSelectorIcon,\n },\n {\n label: 'Horizontally flip',\n icon: SyncAltIcon,\n onClick: self.horizontallyFlip,\n },\n {\n label: 'Color by CDS',\n type: 'checkbox',\n checked: self.colorByCDS,\n icon: PaletteIcon,\n onClick: () => {\n self.setColorByCDS(!self.colorByCDS)\n },\n },\n {\n label: 'Show...',\n icon: VisibilityIcon,\n subMenu: [\n {\n label: 'Show all regions in assembly',\n onClick: self.showAllRegionsInAssembly,\n },\n {\n label: 'Show center line',\n type: 'checkbox',\n checked: self.showCenterLine,\n onClick: () => {\n self.setShowCenterLine(!self.showCenterLine)\n },\n },\n {\n label: 'Show header',\n type: 'checkbox',\n checked: !self.hideHeader,\n onClick: () => {\n self.setHideHeader(!self.hideHeader)\n },\n },\n\n {\n label: 'Show track outlines',\n type: 'checkbox',\n checked: self.showTrackOutlines,\n onClick: () => {\n self.setShowTrackOutlines(!self.showTrackOutlines)\n },\n },\n {\n label: 'Show header overview',\n type: 'checkbox',\n checked: !self.hideHeaderOverview,\n onClick: () => {\n self.setHideHeaderOverview(!self.hideHeaderOverview)\n },\n disabled: self.hideHeader,\n },\n {\n label: 'Show no tracks active button',\n type: 'checkbox',\n checked: !self.hideNoTracksActive,\n onClick: () => {\n self.setHideNoTracksActive(!self.hideNoTracksActive)\n },\n },\n {\n label: 'Show guidelines',\n type: 'checkbox',\n checked: self.showGridlines,\n onClick: () => {\n self.setShowGridlines(!self.showGridlines)\n },\n },\n ...(canShowCytobands\n ? [\n {\n label: 'Show ideogram',\n type: 'checkbox' as const,\n checked: self.showCytobands,\n onClick: () => {\n self.setShowCytobands(!showCytobands)\n },\n },\n ]\n : []),\n ],\n },\n {\n label: 'Track labels',\n icon: LabelIcon,\n subMenu: [\n {\n label: 'Overlapping',\n icon: VisibilityIcon,\n type: 'radio',\n checked: self.trackLabelsSetting === 'overlapping',\n onClick: () => {\n self.setTrackLabels('overlapping')\n },\n },\n {\n label: 'Offset',\n icon: VisibilityIcon,\n type: 'radio',\n checked: self.trackLabelsSetting === 'offset',\n onClick: () => {\n self.setTrackLabels('offset')\n },\n },\n {\n label: 'Hidden',\n icon: VisibilityIcon,\n type: 'radio',\n checked: self.trackLabelsSetting === 'hidden',\n onClick: () => {\n self.setTrackLabels('hidden')\n },\n },\n ],\n },\n ]\n\n // add track's view level menu options\n for (const [key, value] of self.trackTypeActions.entries()) {\n if (value.length) {\n menuItems.push(\n { type: 'divider' },\n { type: 'subHeader', label: key },\n )\n value.forEach(action => menuItems.push(action))\n }\n }\n\n return menuItems\n },\n }))\n .views(self => {\n let currentlyCalculatedStaticBlocks: BlockSet | undefined\n let stringifiedCurrentlyCalculatedStaticBlocks = ''\n return {\n /**\n * #getter\n * static blocks are an important concept jbrowse uses to avoid\n * re-rendering when you scroll to the side. when you horizontally\n * scroll to the right, old blocks to the left may be removed, and new\n * blocks may be instantiated on the right. tracks may use the static\n * blocks to render their data for the region represented by the block\n */\n get staticBlocks() {\n const ret = calculateStaticBlocks(self)\n const sret = JSON.stringify(ret)\n if (stringifiedCurrentlyCalculatedStaticBlocks !== sret) {\n currentlyCalculatedStaticBlocks = ret\n stringifiedCurrentlyCalculatedStaticBlocks = sret\n }\n return currentlyCalculatedStaticBlocks!\n },\n /**\n * #getter\n * dynamic blocks represent the exact coordinates of the currently\n * visible genome regions on the screen. they are similar to static\n * blocks, but static blocks can go offscreen while dynamic blocks\n * represent exactly what is on screen\n */\n get dynamicBlocks() {\n return calculateDynamicBlocks(self)\n },\n /**\n * #getter\n * rounded dynamic blocks are dynamic blocks without fractions of bp\n */\n get roundedDynamicBlocks() {\n return this.dynamicBlocks.contentBlocks.map(\n block =>\n ({\n ...block,\n start: Math.floor(block.start),\n end: Math.ceil(block.end),\n }) as BaseBlock,\n )\n },\n\n /**\n * #getter\n * a single \"combo-locstring\" representing all the regions visible on\n * the screen\n */\n get visibleLocStrings() {\n return calculateVisibleLocStrings(this.dynamicBlocks.contentBlocks)\n },\n\n /**\n * #getter\n * same as visibleLocStrings, but only updated every 300ms\n */\n get coarseVisibleLocStrings() {\n return calculateVisibleLocStrings(self.coarseDynamicBlocks)\n },\n }\n })\n .actions(self => ({\n /**\n * #action\n */\n setCoarseDynamicBlocks(blocks: BlockSet) {\n self.coarseDynamicBlocks = blocks.contentBlocks\n self.coarseTotalBp = blocks.totalBp\n },\n\n afterAttach() {\n addDisposer(\n self,\n autorun(\n () => {\n if (self.initialized) {\n this.setCoarseDynamicBlocks(self.dynamicBlocks)\n }\n },\n { delay: 150 },\n ),\n )\n\n addDisposer(\n self,\n autorun(() => {\n const s = (s: unknown) => JSON.stringify(s)\n const { showCytobandsSetting, showCenterLine, colorByCDS } = self\n localStorageSetItem('lgv-showCytobands', s(showCytobandsSetting))\n localStorageSetItem('lgv-showCenterLine', s(showCenterLine))\n localStorageSetItem('lgv-colorByCDS', s(colorByCDS))\n }),\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n * offset is the base-pair-offset in the displayed region, index is the\n * index of the displayed region in the linear genome view\n *\n * @param start - object as `{start, end, offset, index}`\n * @param end - object as `{start, end, offset, index}`\n */\n moveTo(start?: BpOffset, end?: BpOffset) {\n moveTo(self, start, end)\n },\n\n /**\n * #action\n * Navigate to the given locstring, will change displayed regions if\n * needed, and wait for assemblies to be initialized\n *\n * @param input - e.g. \"chr1:1-100\", \"chr1:1-100 chr2:1-100\", \"chr 1 100\"\n * @param optAssemblyName - (optional) the assembly name to use when\n * navigating to the locstring\n */\n async navToLocString(input: string, optAssemblyName?: string) {\n const { assemblyNames } = self\n const { assemblyManager } = getSession(self)\n const assemblyName = optAssemblyName || assemblyNames[0]!\n if (assemblyName) {\n await assemblyManager.waitForAssembly(assemblyName)\n }\n\n return this.navToLocations(\n parseLocStrings(input, assemblyName, (ref, asm) =>\n assemblyManager.isValidRefName(ref, asm),\n ),\n assemblyName,\n )\n },\n\n /**\n * #action\n * Performs a text index search, and navigates to it immediately if a\n * single result is returned. Will pop up a search dialog if multiple\n * results are returned\n */\n async navToSearchString({\n input,\n assembly,\n }: {\n input: string\n assembly: Assembly\n }) {\n await handleSelectedRegion({\n input,\n assembly,\n model: self as LinearGenomeViewModel,\n })\n },\n\n /**\n * #action\n * Similar to `navToLocString`, but accepts parsed location objects\n * instead of strings. Will try to perform `setDisplayedRegions` if\n * changing regions\n */\n async navToLocations(\n parsedLocStrings: ParsedLocString[],\n assemblyName?: string,\n ) {\n const { assemblyManager } = getSession(self)\n await when(() => self.volatileWidth !== undefined)\n\n const locations = await generateLocations(\n parsedLocStrings,\n assemblyManager,\n assemblyName,\n )\n\n if (locations.length === 1) {\n const loc = locations[0]!\n const { reversed, parentRegion, start, end } = loc\n self.setDisplayedRegions([{ reversed, ...parentRegion }])\n\n this.navTo({\n ...loc,\n start: clamp(start ?? 0, 0, parentRegion.end),\n end: clamp(end ?? parentRegion.end, 0, parentRegion.end),\n })\n } else {\n self.setDisplayedRegions(\n // @ts-expect-error\n locations.map(r => (r.start === undefined ? r.parentRegion : r)),\n )\n self.showAllRegions()\n }\n },\n\n /**\n * #action\n * Navigate to a location based on its refName and optionally start, end,\n * and assemblyName. Will not try to change displayed regions, use\n * `navToLocations` instead. Only navigates to a location if it is\n * entirely within a displayedRegion. Navigates to the first matching\n * location encountered.\n *\n * Throws an error if navigation was unsuccessful\n *\n * @param query - a proposed location to navigate to\n */\n navTo(query: NavLocation) {\n this.navToMultiple([query])\n },\n\n /**\n * #action\n * Navigate to a location based on its refName and optionally start, end,\n * and assemblyName. Will not try to change displayed regions, use\n * navToLocations instead. Only navigates to a location if it is entirely\n * within a displayedRegion. Navigates to the first matching location\n * encountered.\n *\n * Throws an error if navigation was unsuccessful\n *\n * @param locations - proposed location to navigate to\n */\n navToMultiple(locations: NavLocation[]) {\n if (\n locations.some(\n l =>\n l.start !== undefined && l.end !== undefined && l.start > l.end,\n )\n ) {\n throw new Error('found start greater than end')\n }\n const f1 = locations.at(0)\n const f2 = locations.at(-1)\n if (!f1 || !f2) {\n return\n }\n const a = self.assemblyNames[0]!\n const { assemblyManager } = getSession(self)\n const assembly1 = assemblyManager.get(f1.assemblyName || a)\n const assembly2 = assemblyManager.get(f2.assemblyName || a)\n const ref1 = assembly1?.getCanonicalRefName(f1.refName) || f1.refName\n const ref2 = assembly2?.getCanonicalRefName(f2.refName) || f2.refName\n const r1 = self.displayedRegions.find(r => r.refName === ref1)\n const r2 = findLast(self.displayedRegions, r => r.refName === ref2)\n if (!r1) {\n throw new Error(`could not find a region with refName \"${ref1}\"`)\n }\n if (!r2) {\n throw new Error(`could not find a region with refName \"${ref2}\"`)\n }\n\n const s1 = f1.start === undefined ? r1.start : f1.start\n const e1 = f1.end === undefined ? r1.end : f1.end\n const s2 = f2.start === undefined ? r2.start : f2.start\n const e2 = f2.end === undefined ? r2.end : f2.end\n\n const index = self.displayedRegions.findIndex(\n r =>\n ref1 === r.refName &&\n s1 >= r.start &&\n s1 <= r.end &&\n e1 <= r.end &&\n e1 >= r.start,\n )\n\n const index2 = self.displayedRegions.findIndex(\n r =>\n ref2 === r.refName &&\n s2 >= r.start &&\n s2 <= r.end &&\n e2 <= r.end &&\n e2 >= r.start,\n )\n\n if (index === -1 || index2 === -1) {\n throw new Error(\n `could not find a region that contained \"${locations.map(l =>\n assembleLocString(l),\n )}\"`,\n )\n }\n\n const sd = self.displayedRegions[index]!\n const ed = self.displayedRegions[index2]!\n\n this.moveTo(\n {\n index,\n offset: sd.reversed ? sd.end - e1 : s1 - sd.start,\n },\n {\n index: index2,\n offset: ed.reversed ? ed.end - s2 : e2 - ed.start,\n },\n )\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n rubberBandMenuItems(): MenuItem[] {\n return [\n {\n label: 'Zoom to region',\n icon: ZoomInIcon,\n onClick: () => {\n self.moveTo(self.leftOffset, self.rightOffset)\n },\n },\n {\n label: 'Get sequence',\n icon: MenuOpenIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n GetSequenceDialog,\n\n { model: self as any, handleClose },\n ])\n },\n },\n ]\n },\n\n /**\n * #method\n */\n bpToPx({\n refName,\n coord,\n regionNumber,\n }: {\n refName: string\n coord: number\n regionNumber?: number\n }) {\n return bpToPx({ refName, coord, regionNumber, self })\n },\n\n /**\n * #method\n * scrolls the view to center on the given bp. if that is not in any of\n * the displayed regions, does nothing\n *\n * @param coord - basepair at which you want to center the view\n * @param refName - refName of the displayedRegion you are centering at\n * @param regionNumber - index of the displayedRegion\n */\n centerAt(coord: number, refName: string, regionNumber?: number) {\n const centerPx = this.bpToPx({\n refName,\n coord,\n regionNumber,\n })\n if (centerPx !== undefined) {\n self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2))\n }\n },\n\n /**\n * #method\n */\n pxToBp(px: number) {\n return pxToBp(self, px)\n },\n\n /**\n * #getter\n */\n get centerLineInfo() {\n return self.displayedRegions.length > 0\n ? this.pxToBp(self.width / 2)\n : undefined\n },\n }))\n .actions(self => ({\n afterCreate() {\n function handler(e: KeyboardEvent) {\n const session = getSession(self)\n if (session.focusedViewId === self.id && (e.ctrlKey || e.metaKey)) {\n if (e.code === 'ArrowLeft') {\n e.preventDefault()\n self.slide(-0.9)\n } else if (e.code === 'ArrowRight') {\n e.preventDefault()\n self.slide(0.9)\n } else if (e.code === 'ArrowUp' && self.scaleFactor === 1) {\n e.preventDefault()\n self.zoom(self.bpPerPx / 2)\n } else if (e.code === 'ArrowDown' && self.scaleFactor === 1) {\n e.preventDefault()\n self.zoom(self.bpPerPx * 2)\n }\n }\n }\n document.addEventListener('keydown', handler)\n addDisposer(self, () => {\n document.removeEventListener('keydown', handler)\n })\n },\n }))\n .preProcessSnapshot(snap => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!snap) {\n return snap\n }\n const { highlight, ...rest } = snap\n return {\n highlight:\n Array.isArray(highlight) || highlight === undefined\n ? highlight\n : [highlight],\n ...rest,\n }\n })\n}\n\nexport type LinearGenomeViewStateModel = ReturnType<typeof stateModelFactory>\nexport type LinearGenomeViewModel = Instance<LinearGenomeViewStateModel>\n\nexport {\n default as ReactComponent,\n default as LinearGenomeView,\n} from './components/LinearGenomeView'\n\nexport { default as RefNameAutocomplete } from './components/RefNameAutocomplete'\nexport { default as SearchBox } from './components/SearchBox'\nexport { default as ZoomControls } from './components/ZoomControls'\n\nexport { renderToSvg } from './svgcomponents/SVGLinearGenomeView'\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { baseLinearDisplayConfigSchema } from '../BaseLinearDisplay'\n\n/**\n * #config LinearBasicDisplay\n * #category display\n */\nfunction configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearBasicDisplay',\n {\n /**\n * #slot\n */\n renderer: pluginManager.pluggableConfigSchemaType('renderer'),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaFactory\n","import { lazy } from 'react'\nimport {\n getConf,\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport { types, getEnv, Instance, cast } from 'mobx-state-tree'\n\n// icons\nimport VisibilityIcon from '@mui/icons-material/Visibility'\n\n// locals\nimport { BaseLinearDisplay } from '../BaseLinearDisplay'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\n\nconst SetMaxHeightDialog = lazy(() => import('./components/SetMaxHeightDialog'))\nconst AddFiltersDialog = lazy(() => import('./components/AddFiltersDialog'))\n\n/**\n * #stateModel LinearBasicDisplay\n * #category display\n * used by `FeatureTrack`, has simple settings like \"show/hide feature labels\",\n * etc.\n *\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearBasicDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearBasicDisplay'),\n /**\n * #property\n */\n trackShowLabels: types.maybe(types.boolean),\n /**\n * #property\n */\n trackShowDescriptions: types.maybe(types.boolean),\n /**\n * #property\n */\n trackDisplayMode: types.maybe(types.string),\n /**\n * #property\n */\n trackMaxHeight: types.maybe(types.number),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n jexlFilters: types.maybe(types.array(types.string)),\n }),\n )\n .views(self => ({\n /**\n * #getter\n */\n get activeFilters() {\n // config jexlFilters are deferred evaluated so they are prepended with\n // jexl at runtime rather than being stored with jexl in the config\n return (\n self.jexlFilters ??\n getConf(self, 'jexlFilters').map((r: string) => `jexl:${r}`)\n )\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return getConf(self, ['renderer', 'type'])\n },\n\n /**\n * #getter\n */\n get showLabels() {\n return self.trackShowLabels ?? getConf(self, ['renderer', 'showLabels'])\n },\n\n /**\n * #getter\n */\n get showDescriptions() {\n return (\n self.trackShowDescriptions ??\n getConf(self, ['renderer', 'showDescriptions'])\n )\n },\n\n /**\n * #getter\n */\n get maxHeight() {\n return self.trackMaxHeight ?? getConf(self, ['renderer', 'maxHeight'])\n },\n\n /**\n * #getter\n */\n get displayMode() {\n return (\n self.trackDisplayMode ?? getConf(self, ['renderer', 'displayMode'])\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get rendererConfig() {\n const configBlob = getConf(self, ['renderer']) || {}\n const config = configBlob as Omit<typeof configBlob, symbol>\n\n return self.rendererType.configSchema.create(\n {\n ...config,\n showLabels: self.showLabels,\n showDescriptions: self.showDescriptions,\n displayMode: self.displayMode,\n maxHeight: self.maxHeight,\n },\n getEnv(self),\n )\n },\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n setJexlFilters(f?: string[]) {\n self.jexlFilters = cast(f)\n },\n /**\n * #action\n */\n toggleShowLabels() {\n self.trackShowLabels = !self.showLabels\n },\n /**\n * #action\n */\n toggleShowDescriptions() {\n self.trackShowDescriptions = !self.showDescriptions\n },\n /**\n * #action\n */\n setDisplayMode(val: string) {\n self.trackDisplayMode = val\n },\n /**\n * #action\n */\n setMaxHeight(val?: number) {\n self.trackMaxHeight = val\n },\n }))\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderProps: superRenderProps,\n } = self\n return {\n /**\n * #method\n */\n renderProps() {\n const superProps = superRenderProps()\n return {\n ...(superProps as Omit<typeof superProps, symbol>),\n config: self.rendererConfig,\n filters: new SerializableFilterChain({\n filters: self.activeFilters,\n }),\n }\n },\n\n /**\n * #method\n */\n trackMenuItems(): MenuItem[] {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Show labels',\n icon: VisibilityIcon,\n type: 'checkbox',\n checked: self.showLabels,\n onClick: () => {\n self.toggleShowLabels()\n },\n },\n {\n label: 'Show descriptions',\n icon: VisibilityIcon,\n type: 'checkbox',\n checked: self.showDescriptions,\n onClick: () => {\n self.toggleShowDescriptions()\n },\n },\n {\n label: 'Display mode',\n icon: VisibilityIcon,\n subMenu: [\n 'compact',\n 'reducedRepresentation',\n 'normal',\n 'collapse',\n ].map(val => ({\n label: val,\n onClick: () => {\n self.setDisplayMode(val)\n },\n })),\n },\n {\n label: 'Set max height',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetMaxHeightDialog,\n { model: self, handleClose },\n ])\n },\n },\n {\n label: 'Edit filters',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n AddFiltersDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }\n })\n}\n\nexport type FeatureTrackStateModel = ReturnType<typeof stateModelFactory>\nexport type FeatureTrackModel = Instance<FeatureTrackStateModel>\n\nexport default stateModelFactory\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n// icons\nimport LineStyleIcon from '@mui/icons-material/LineStyle'\n\n// locals\nimport {\n BaseLinearDisplay,\n BaseLinearDisplayComponent,\n baseLinearDisplayConfigSchema,\n} from './BaseLinearDisplay'\nimport LinearBareDisplayF from './LinearBareDisplay'\nimport LinearGenomeViewF, {\n SearchBox,\n ZoomControls,\n LinearGenomeView,\n} from './LinearGenomeView'\n\nimport LinearBasicDisplayF from './LinearBasicDisplay'\nimport FeatureTrackF from './FeatureTrack'\nimport BasicTrackF from './BasicTrack'\nimport LaunchLinearGenomeViewF from './LaunchLinearGenomeView'\n\nexport default class LinearGenomeViewPlugin extends Plugin {\n name = 'LinearGenomeViewPlugin'\n\n exports = {\n BaseLinearDisplayComponent,\n BaseLinearDisplay,\n baseLinearDisplayConfigSchema,\n SearchBox,\n ZoomControls,\n LinearGenomeView,\n }\n\n /**\n * #config LinearGenomeViewConfigSchema\n */\n configurationSchema = ConfigurationSchema('LinearGenomeViewConfigSchema', {\n /**\n * #slot configuration.LinearGenomeViewPlugin.trackLabels\n */\n trackLabels: {\n type: 'string',\n defaultValue: 'overlapping',\n model: types.enumeration('trackLabelOptions', [\n 'offset',\n 'overlapping',\n 'hidden',\n ]),\n },\n })\n\n install(pluginManager: PluginManager) {\n FeatureTrackF(pluginManager)\n BasicTrackF(pluginManager)\n LinearBasicDisplayF(pluginManager)\n LinearGenomeViewF(pluginManager)\n LinearBareDisplayF(pluginManager)\n LaunchLinearGenomeViewF(pluginManager)\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToSubMenu(['Add'], {\n label: 'Linear genome view',\n icon: LineStyleIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('LinearGenomeView', {})\n },\n })\n }\n }\n}\n\nexport type {\n ExportSvgDisplayOptions,\n BaseLinearDisplayModel,\n BlockModel,\n} from './BaseLinearDisplay'\n\nexport { configSchemaFactory as linearBareDisplayConfigSchemaFactory } from './LinearBareDisplay'\nexport {\n baseLinearDisplayConfigSchema,\n BaseLinearDisplay,\n BlockMsg,\n BaseLinearDisplayComponent,\n TrackHeightMixin,\n FeatureDensityMixin,\n TooLargeMessage,\n} from './BaseLinearDisplay'\nexport {\n type LinearGenomeViewModel,\n type LinearGenomeViewStateModel,\n RefNameAutocomplete,\n SearchBox,\n} from './LinearGenomeView'\nexport {\n renderToSvg,\n SVGTracks,\n SVGRuler,\n} from './LinearGenomeView/svgcomponents/SVGLinearGenomeView'\nexport { totalHeight } from './LinearGenomeView/svgcomponents/util'\nexport {\n configSchema as linearBasicDisplayConfigSchemaFactory,\n modelFactory as linearBasicDisplayModelFactory,\n} from './LinearBasicDisplay'\n","import {\n createBaseTrackModel,\n TrackType,\n} from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaF from './configSchema'\n\nexport default function FeatureTrackF(pm: PluginManager) {\n pm.addTrackType(() => {\n const configSchema = configSchemaF(pm)\n return new TrackType({\n name: 'FeatureTrack',\n displayName: 'Feature track',\n configSchema,\n stateModel: createBaseTrackModel(pm, 'FeatureTrack', configSchema),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config FeatureTrack\n * #category track\n * used for basic gene and feature tracks, generally used with LinearBasicDisplay\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'FeatureTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n /**\n * #identifier\n */\n explicitIdentifier: 'trackId',\n },\n )\n\nexport default configSchema\n","import {\n createBaseTrackModel,\n TrackType,\n} from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaF from './configSchema'\n\nexport default function BasicTrackF(pm: PluginManager) {\n pm.addTrackType(() => {\n const configSchema = configSchemaF(pm)\n\n return new TrackType({\n name: 'BasicTrack',\n configSchema,\n stateModel: createBaseTrackModel(pm, 'BasicTrack', configSchema),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config BasicTrack\n * #category track\n * synonym for FeatureTrack\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'BasicTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n explicitIdentifier: 'trackId',\n },\n )\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport { BaseLinearDisplayComponent } from '../BaseLinearDisplay'\n\n// locals\nimport configSchema from './configSchema'\nimport modelFactory from './model'\n\nexport default function LinearBasicDisplay(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const config = configSchema(pluginManager)\n return new DisplayType({\n name: 'LinearBasicDisplay',\n displayName: 'Basic feature display',\n configSchema: config,\n stateModel: modelFactory(config),\n trackType: 'FeatureTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n\nexport { default as modelFactory } from './model'\nexport { default as configSchema } from './configSchema'\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ViewType } from '@jbrowse/core/pluggableElementTypes'\nimport { stateModelFactory } from './model'\n\nexport default function LinearGenomeViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new ViewType({\n name: 'LinearGenomeView',\n displayName: 'Linear genome view',\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/LinearGenomeView')),\n })\n })\n}\n\nexport * from './model'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { DisplayType } from '@jbrowse/core/pluggableElementTypes'\n\n// locals\nimport { configSchemaFactory } from './configSchema'\nimport { stateModelFactory } from './model'\nimport { BaseLinearDisplayComponent } from '../BaseLinearDisplay/'\n\nexport default function LinearBareDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearBareDisplay',\n configSchema,\n displayName: 'Bare feature display',\n stateModel: stateModelFactory(configSchema),\n trackType: 'BasicTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n\nexport { configSchemaFactory } from './configSchema'\nexport { stateModelFactory } from './model'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel, when, parseLocString } from '@jbrowse/core/util'\n// locals\nimport { LinearGenomeViewModel } from '../LinearGenomeView'\nimport { handleSelectedRegion } from '../searchUtils'\n\ntype LGV = LinearGenomeViewModel\n\nexport default function LaunchLinearGenomeViewF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-LinearGenomeView',\n // @ts-expect-error\n async ({\n session,\n assembly,\n loc,\n tracks = [],\n tracklist,\n nav,\n highlight,\n }: {\n session: AbstractSessionModel\n assembly?: string\n loc: string\n tracks?: string[]\n tracklist?: boolean\n nav?: boolean\n highlight?: string[]\n }) => {\n try {\n const { assemblyManager } = session\n\n const { isValidRefName } = assemblyManager\n\n const view = session.addView('LinearGenomeView', {}) as LGV\n\n await when(() => !!view.volatileWidth)\n\n if (!assembly) {\n throw new Error(\n 'No assembly provided when launching linear genome view',\n )\n }\n\n const asm = await assemblyManager.waitForAssembly(assembly)\n if (!asm) {\n throw new Error(\n `Assembly \"${assembly}\" not found when launching linear genome view`,\n )\n }\n\n if (tracklist) {\n view.activateTrackSelector()\n }\n if (nav !== undefined) {\n view.setHideHeader(!nav)\n }\n if (highlight !== undefined) {\n highlight.forEach(async h => {\n const p = parseLocString(h, refName =>\n isValidRefName(refName, assembly),\n )\n const { start, end } = p\n if (start !== undefined && end !== undefined) {\n view.addToHighlights({\n ...p,\n start,\n end,\n assemblyName: assembly,\n })\n }\n })\n }\n\n await handleSelectedRegion({ input: loc, model: view, assembly: asm })\n\n const idsNotFound = [] as string[]\n tracks.forEach(track => {\n tryTrack(view, track, idsNotFound)\n })\n if (idsNotFound.length) {\n throw new Error(\n `Could not resolve identifiers: ${idsNotFound.join(',')}`,\n )\n }\n } catch (e) {\n session.notifyError(`${e}`, e)\n throw e\n }\n },\n )\n}\n\nfunction tryTrack(\n model: {\n showTrack: (arg: string) => void\n },\n trackId: string,\n idsNotFound: string[],\n) {\n try {\n model.showTrack(trackId)\n } catch (e) {\n if (/Could not resolve identifier/.exec(`${e}`)) {\n idsNotFound.push(trackId)\n } else {\n throw e\n }\n }\n}\n","import { getSession } from '@jbrowse/core/util'\nimport BaseResult from '@jbrowse/core/TextSearch/BaseResults'\nimport { Assembly } from '@jbrowse/core/assemblyManager/assembly'\nimport { SearchType } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { SearchScope } from '@jbrowse/core/TextSearch/TextSearchManager'\nimport { dedupe, TextSearchManager } from '@jbrowse/core/util'\n\n// locals\nimport { LinearGenomeViewModel } from './LinearGenomeView'\n\nexport async function navToOption({\n option,\n model,\n assemblyName,\n}: {\n model: LinearGenomeViewModel\n option: BaseResult\n assemblyName: string\n}) {\n const location = option.getLocation()\n const trackId = option.getTrackId()\n if (location) {\n await model.navToLocString(location, assemblyName)\n if (trackId) {\n model.showTrack(trackId)\n }\n }\n}\n\n// gets a string as input, or use stored option results from previous query,\n// then re-query and\n// 1) if it has multiple results: pop a dialog\n// 2) if it's a single result navigate to it\n// 3) else assume it's a locstring and navigate to it\nexport async function handleSelectedRegion({\n input,\n model,\n assembly,\n}: {\n input: string\n model: LinearGenomeViewModel\n assembly: Assembly\n}) {\n const allRefs = assembly.allRefNamesWithLowerCase || []\n const assemblyName = assembly.name\n if (input.split(' ').every(entry => checkRef(entry, allRefs))) {\n await model.navToLocString(input, assembly.name)\n } else {\n const searchScope = model.searchScope(assemblyName)\n const { textSearchManager } = getSession(model)\n const results = await fetchResults({\n queryString: input,\n searchType: 'exact',\n searchScope,\n rankSearchResults: model.rankSearchResults,\n textSearchManager,\n assembly,\n })\n\n if (results.length > 1) {\n model.setSearchResults(results, input.toLowerCase(), assemblyName)\n } else if (results.length === 1) {\n await navToOption({\n option: results[0]!,\n model,\n assemblyName,\n })\n } else {\n await model.navToLocString(input, assemblyName)\n }\n }\n}\n\nexport function checkRef(str: string, allRefs: string[]) {\n const [ref, rest] = splitLast(str, ':')\n return (\n allRefs.includes(str) ||\n (allRefs.includes(ref) && !Number.isNaN(Number.parseInt(rest, 10)))\n )\n}\n\nexport async function fetchResults({\n queryString,\n searchType,\n searchScope,\n rankSearchResults,\n textSearchManager,\n assembly,\n}: {\n queryString: string\n searchScope: SearchScope\n rankSearchResults: (results: BaseResult[]) => BaseResult[]\n searchType?: SearchType\n textSearchManager?: TextSearchManager\n assembly?: Assembly\n}) {\n if (!textSearchManager) {\n console.warn('No text search manager')\n }\n\n const textSearchResults = await textSearchManager?.search(\n {\n queryString,\n searchType,\n },\n searchScope,\n rankSearchResults,\n )\n\n const refNameResults = assembly?.allRefNames\n ?.filter(ref => ref.toLowerCase().startsWith(queryString.toLowerCase()))\n .slice(0, 10)\n .map(r => new BaseResult({ label: r }))\n\n return dedupe(\n [...(refNameResults || []), ...(textSearchResults || [])],\n elt => elt.getId(),\n )\n}\n\n// splits on the last instance of a character\nexport function splitLast(str: string, split: string): [string, string] {\n const lastIndex = str.lastIndexOf(split)\n if (lastIndex === -1) {\n return [str, '']\n }\n const before = str.slice(0, lastIndex)\n const after = str.slice(lastIndex + 1)\n return [before, after]\n}\n","import VCF, { parseBreakend } from '@gmod/vcf'\n\nconst altTypeToSO: Record<string, string> = {\n DEL: 'deletion',\n INS: 'insertion',\n DUP: 'duplication',\n INV: 'inversion',\n INVDUP: 'inverted_duplication',\n CNV: 'copy_number_variation',\n TRA: 'translocation',\n 'DUP:TANDEM': 'tandem_duplication',\n NON_REF: 'sequence_variant',\n '*': 'sequence_variant',\n}\n\n/**\n * Get a sequence ontology (SO) term that describes the variant type\n */\nexport function getSOTermAndDescription(\n ref: string,\n alt: string[] | undefined,\n parser: VCF,\n): string[] {\n // it's just a remark if there are no alternate alleles\n if (!alt || alt.length === 0) {\n return ['remark', 'no alternative alleles']\n }\n\n const soTerms = new Set<string>()\n let descriptions = new Set<string>()\n alt.forEach(a => {\n let [soTerm, description] = getSOAndDescFromAltDefs(a, parser)\n if (!soTerm) {\n ;[soTerm, description] = getSOAndDescByExamination(ref, a)\n }\n if (soTerm && description) {\n soTerms.add(soTerm)\n descriptions.add(description)\n }\n })\n\n // Combine descriptions like [\"SNV G -> A\", \"SNV G -> T\"] to [\"SNV G -> A,T\"]\n if (descriptions.size > 1) {\n const descs = [...descriptions]\n const prefixes = new Set(\n descs\n .map(desc => {\n const prefix = desc.split('->')\n return prefix[1] ? prefix[0] : desc\n })\n .filter((f): f is string => !!f),\n )\n\n descriptions = new Set(\n [...prefixes]\n .map(r => r.trim())\n .map(prefix => {\n const suffixes = descs\n .map(desc => desc.split('->').map(r => r.trim()))\n .map(pref => (pref[1] && pref[0] === prefix ? pref[1] : ''))\n .filter(f => !!f)\n\n return suffixes.length ? `${prefix} -> ${suffixes.join(',')}` : prefix\n }),\n )\n }\n if (soTerms.size) {\n return [[...soTerms].join(','), [...descriptions].join(',')]\n }\n return []\n}\n\nexport function getSOAndDescFromAltDefs(alt: string, parser: VCF): string[] {\n if (typeof alt === 'string' && !alt.startsWith('<')) {\n return []\n }\n\n // look for a definition with an SO type for this\n let soTerm = altTypeToSO[alt]\n // if no SO term but ALT is in metadata, assume sequence_variant\n if (!soTerm && parser.getMetadata('ALT', alt)) {\n soTerm = 'sequence_variant'\n }\n if (soTerm) {\n return [soTerm, alt]\n }\n\n // try to look for a definition for a parent term if we can\n const modAlt = alt.split(':')\n if (modAlt.length > 1) {\n return getSOAndDescFromAltDefs(`<${modAlt.slice(0, -1).join(':')}>`, parser)\n }\n\n // no parent\n return []\n}\n\n// note: term SNV is used instead of SNP because SO definition of SNP says\n// abundance must be at least 1% in population, and can't be sure we meet\n// that\nexport function getSOAndDescByExamination(ref: string, alt: string) {\n const bnd = parseBreakend(alt)\n if (bnd) {\n return ['breakend', alt]\n }\n if (ref.length === 1 && alt.length === 1) {\n return ['SNV', makeDescriptionString('SNV', ref, alt)]\n }\n if (alt === '<INS>') {\n return ['insertion', alt]\n }\n if (alt === '<DEL>') {\n return ['deletion', alt]\n }\n if (alt === '<DUP>') {\n return ['duplication', alt]\n }\n if (alt === '<CNV>') {\n return ['cnv', alt]\n }\n if (alt === '<INV>') {\n return ['inversion', alt]\n }\n if (alt === '<TRA>') {\n return ['translocation', alt]\n }\n if (alt.includes('<')) {\n return ['sv', alt]\n }\n if (ref.length === alt.length) {\n return ref.split('').reverse().join('') === alt\n ? ['inversion', makeDescriptionString('inversion', ref, alt)]\n : ['substitution', makeDescriptionString('substitution', ref, alt)]\n }\n if (ref.length <= alt.length) {\n const len = alt.length - ref.length\n const lena = len.toLocaleString('en-US')\n return [\n 'insertion',\n len > 5 ? `${lena}bp INS` : makeDescriptionString('insertion', ref, alt),\n ]\n }\n if (ref.length > alt.length) {\n const len = ref.length - alt.length\n const lena = len.toLocaleString('en-US')\n return [\n 'deletion',\n len > 5 ? `${lena}bp DEL` : makeDescriptionString('deletion', ref, alt),\n ]\n }\n\n return ['indel', makeDescriptionString('indel', ref, alt)]\n}\n\nfunction makeDescriptionString(soTerm: string, ref: string, alt: string) {\n return `${soTerm} ${ref} -> ${alt}`\n}\n","import { Feature } from '@jbrowse/core/util'\nimport VCF from '@gmod/vcf'\n\n// locals\nimport { getSOTermAndDescription } from './util'\n\ntype Samples = Record<\n string,\n Record<string, { values: string[] | number[] | null }>\n>\n\ninterface FeatureData {\n [key: string]: unknown\n refName: string\n start: number\n end: number\n description?: string\n type?: string\n name?: string\n aliases?: string[]\n samples?: Samples\n}\n\nexport default class VCFFeature implements Feature {\n private variant: any\n\n private parser: VCF\n\n private data: FeatureData\n\n private _id: string\n\n constructor(args: { variant: any; parser: VCF; id: string }) {\n this.variant = args.variant\n this.parser = args.parser\n this.data = this.dataFromVariant(this.variant)\n this._id = args.id\n }\n\n get(field: string): any {\n return field === 'samples'\n ? this.variant.SAMPLES\n : (this.data[field] ?? this.variant[field])\n }\n\n set() {}\n\n parent() {\n return undefined\n }\n\n children() {\n return undefined\n }\n\n tags() {\n return [...Object.keys(this.data), ...Object.keys(this.variant), 'samples']\n }\n\n id() {\n return this._id\n }\n\n dataFromVariant(variant: {\n REF: string\n POS: number\n ALT?: string[]\n CHROM: string\n INFO: any\n ID?: string[]\n }): FeatureData {\n const { REF, ALT, POS, CHROM, INFO, ID } = variant\n const start = POS - 1\n const [type, description] = getSOTermAndDescription(REF, ALT, this.parser)\n const isTRA = ALT?.includes('<TRA>')\n const isSymbolic = ALT?.some(f => f.includes('<'))\n\n return {\n refName: CHROM,\n start,\n end: isSymbolic && INFO.END && !isTRA ? +INFO.END[0] : start + REF.length,\n description,\n type,\n name: ID?.join(','),\n aliases: ID && ID.length > 1 ? ID.slice(1) : undefined,\n }\n }\n\n toJSON(): any {\n return {\n uniqueId: this._id,\n ...this.variant,\n ...this.data,\n samples: this.variant.SAMPLES,\n }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config VcfAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst VcfAdapter = ConfigurationSchema(\n 'VcfAdapter',\n {\n /**\n * #slot\n */\n vcfLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.vcf', locationType: 'UriLocation' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default VcfAdapter\n","import { types } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config VcfTabixAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst VcfTabixAdapter = ConfigurationSchema(\n 'VcfTabixAdapter',\n {\n /**\n * #slot\n */\n vcfGzLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.vcf.gz', locationType: 'UriLocation' },\n },\n index: ConfigurationSchema('VcfIndex', {\n /**\n * #slot index.indexType\n */\n indexType: {\n model: types.enumeration('IndexType', ['TBI', 'CSI']),\n type: 'stringEnum',\n defaultValue: 'TBI',\n },\n /**\n * #slot index.location\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.vcf.gz.tbi',\n locationType: 'UriLocation',\n },\n },\n }),\n },\n { explicitlyTyped: true },\n)\n\nexport default VcfTabixAdapter\n","import { getConf, ConfigurationReference } from '@jbrowse/core/configuration'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport {\n getContainingTrack,\n getSession,\n getContainingView,\n isSessionModelWithWidgets,\n Feature,\n} from '@jbrowse/core/util'\n\nimport { linearBasicDisplayModelFactory } from '@jbrowse/plugin-linear-genome-view'\nimport { Instance, types } from 'mobx-state-tree'\nimport { AnyConfigurationSchemaType } from '@jbrowse/core/configuration'\n\n/**\n * #stateModel LinearVariantDisplay\n * similar to basic display, but provides custom widget on feature click\n * extends\n *\n * - [LinearBasicDisplay](../linearbasicdisplay)\n */\nexport default function stateModelFactory(\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'LinearVariantDisplay',\n linearBasicDisplayModelFactory(configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearVariantDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n\n .actions(self => ({\n /**\n * #action\n */\n async selectFeature(feature: Feature) {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const { rpcManager } = session\n const sessionId = getRpcSessionId(self)\n const track = getContainingTrack(self)\n const view = getContainingView(self)\n const adapterConfig = getConf(track, 'adapter')\n const descriptions = await rpcManager.call(\n sessionId,\n 'CoreGetMetadata',\n {\n adapterConfig,\n },\n )\n session.showWidget(\n session.addWidget('VariantFeatureWidget', 'variantFeature', {\n featureData: feature.toJSON(),\n view,\n track,\n descriptions,\n }),\n )\n }\n\n session.setSelection(feature)\n },\n }))\n}\n\nexport type LinearVariantDisplayStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearVariantDisplayModel = Instance<LinearVariantDisplayStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n/**\n * #config StructuralVariantChordRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'StructuralVariantChordRenderer',\n {\n /**\n * #slot\n */\n strokeColor: {\n type: 'color',\n description: 'the line color of each arc',\n defaultValue: 'rgba(255,133,0,0.32)',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n strokeColorSelected: {\n type: 'color',\n description: 'the line color of an arc that has been selected',\n defaultValue: 'black',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n strokeColorHover: {\n type: 'color',\n description:\n 'the line color of an arc that is being hovered over with the mouse',\n defaultValue: '#555',\n contextVariable: ['feature'],\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default configSchema\n","import React, { useState } from 'react'\nimport { observer } from 'mobx-react'\nimport { polarToCartesian, Feature, getStrokeProps } from '@jbrowse/core/util'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { parseBreakend } from '@gmod/vcf'\n\nexport interface Region {\n end: number\n start: number\n refName: string\n elided?: false\n}\n\nexport interface ElidedRegion {\n elided: true\n regions: Region[]\n}\n\nexport type AnyRegion = Region | ElidedRegion\n\nexport interface Block {\n flipped: boolean\n bpPerRadian: number\n startRadians: number\n region: AnyRegion\n}\n\nfunction bpToRadians(block: Block, pos: number) {\n const blockStart = block.region.elided ? 0 : block.region.start\n const blockEnd = block.region.elided ? 0 : block.region.end\n const bpOffset = block.flipped ? blockEnd - pos : pos - blockStart\n return bpOffset / block.bpPerRadian + block.startRadians\n}\n\nconst Chord = observer(function Chord({\n feature,\n blocksForRefs,\n radius,\n config,\n bezierRadius,\n selected,\n onClick,\n}: {\n feature: Feature\n blocksForRefs: Record<string, Block>\n radius: number\n config: AnyConfigurationModel\n bezierRadius: number\n selected: boolean\n onClick: (feat: Feature, reg: AnyRegion, end: AnyRegion, evt: unknown) => void\n}) {\n const [hovered, setHovered] = useState(false)\n // find the blocks that our start and end points belong to\n const startBlock = blocksForRefs[feature.get('refName')]\n if (!startBlock) {\n return null\n }\n let svType: string | undefined\n if (feature.get('INFO')) {\n ;[svType] = feature.get('INFO').SVTYPE || []\n } else if (feature.get('mate')) {\n svType = 'mate'\n }\n let endPosition: number\n let endBlock: Block | undefined\n const alt = feature.get('ALT')?.[0]\n const bnd = alt && parseBreakend(alt)\n const startPos = feature.get('start')\n if (bnd) {\n // VCF BND\n const matePosition = bnd.MatePosition.split(':')\n endPosition = +matePosition[1]\n endBlock = blocksForRefs[matePosition[0]]\n } else if (alt === '<TRA>') {\n // VCF TRA\n const chr2 = feature.get('INFO')?.CHR2?.[0]\n const end = feature.get('INFO')?.END?.[0]\n endPosition = Number.parseInt(end, 10)\n endBlock = blocksForRefs[chr2]\n } else if (svType === 'mate') {\n // generic simplefeatures arcs\n const mate = feature.get('mate')\n const chr2 = mate.refName\n endPosition = mate.start\n endBlock = blocksForRefs[chr2]\n } else {\n console.warn('unknown sv type', svType)\n endPosition = startPos + 1\n }\n\n if (endBlock) {\n const startRadians = bpToRadians(startBlock, startPos)\n const endRadians = bpToRadians(endBlock, endPosition)\n const startXY = polarToCartesian(radius, startRadians)\n const endXY = polarToCartesian(radius, endRadians)\n const controlXY = polarToCartesian(\n bezierRadius,\n (endRadians + startRadians) / 2,\n )\n\n const strokeColor = selected\n ? readConfObject(config, 'strokeColorSelected', { feature })\n : readConfObject(config, 'strokeColor', { feature })\n\n const hoverStrokeColor = readConfObject(config, 'strokeColorHover', {\n feature,\n })\n return (\n <path\n data-testid={`chord-${feature.id()}`}\n cursor=\"crosshair\"\n fill=\"none\"\n d={['M', ...startXY, 'Q', ...controlXY, ...endXY].join(' ')}\n {...getStrokeProps(hovered ? hoverStrokeColor : strokeColor)}\n strokeWidth={hovered ? 3 : 1}\n onClick={evt => {\n onClick(feature, startBlock.region, endBlock.region, evt)\n }}\n onMouseOver={() => {\n if (!selected) {\n setHovered(true)\n }\n }}\n onMouseOut={() => {\n if (!selected) {\n setHovered(false)\n }\n }}\n />\n )\n }\n\n return null\n})\n\nexport default Chord\n","import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react'\nimport { Feature } from '@jbrowse/core/util'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\n// locals\nimport Chord, { Block, AnyRegion } from './Chord'\n\nconst StructuralVariantChordsReactComponent = observer(function ({\n features,\n config,\n blockDefinitions,\n radius,\n bezierRadius,\n displayModel,\n onChordClick,\n}: {\n features: Map<string, Feature>\n radius: number\n config: AnyConfigurationModel\n displayModel?: {\n id: string\n selectedFeatureId: string\n }\n blockDefinitions: Block[]\n bezierRadius: number\n onChordClick: (\n feature: Feature,\n reg: AnyRegion,\n endBlock: AnyRegion,\n evt: unknown,\n ) => void\n}) {\n const { selectedFeatureId } = displayModel || {}\n const blocksForRefsMemo = useMemo(() => {\n const blocksForRefs = {} as Record<string, Block>\n for (const block of blockDefinitions) {\n const regions = block.region.elided\n ? block.region.regions\n : [block.region]\n for (const region of regions) {\n blocksForRefs[region.refName] = block\n }\n }\n return blocksForRefs\n }, [blockDefinitions])\n\n return (\n <g data-testid=\"structuralVariantChordRenderer\">\n {[...features.values()].map(feature => {\n const id = feature.id()\n const selected = String(selectedFeatureId) === String(id)\n return (\n <Chord\n key={id}\n feature={feature}\n config={config}\n radius={radius}\n bezierRadius={bezierRadius}\n blocksForRefs={blocksForRefsMemo}\n selected={selected}\n onClick={onChordClick}\n />\n )\n })}\n </g>\n )\n})\n\nexport default StructuralVariantChordsReactComponent\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { Instance, types } from 'mobx-state-tree'\nimport { stateModelFactory as baseModelFactory } from '@jbrowse/core/BaseFeatureWidget'\n\nexport function stateModelFactory(pluginManager: PluginManager) {\n const baseModel = baseModelFactory(pluginManager)\n return types.compose(\n baseModel,\n types.model('VariantFeatureWidget', {\n type: types.literal('VariantFeatureWidget'),\n descriptions: types.frozen(),\n }),\n )\n}\n\nexport type VariantFeatureWidgetStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type VariantFeatureWidgetModel = Instance<VariantFeatureWidgetStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport const configSchema = ConfigurationSchema('VariantFeatureWidget', {})\n","import VcfAdapterF from './VcfAdapter'\nimport VcfTabixAdapterF from './VcfTabixAdapter'\nimport ExtensionPointsF from './extensionPoints'\nimport VariantTrackF from './VariantTrack'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport ChordVariantDisplayF from './ChordVariantDisplay'\nimport LinearVariantDisplayF from './LinearVariantDisplay'\nimport StructuralVariantChordRendererF from './StructuralVariantChordRenderer'\nimport VariantFeatureWidgetF from './VariantFeatureWidget'\n\nexport default class VariantsPlugin extends Plugin {\n name = 'VariantsPlugin'\n\n install(pluginManager: PluginManager) {\n VcfAdapterF(pluginManager)\n VcfTabixAdapterF(pluginManager)\n VariantFeatureWidgetF(pluginManager)\n VariantTrackF(pluginManager)\n ExtensionPointsF(pluginManager)\n LinearVariantDisplayF(pluginManager)\n StructuralVariantChordRendererF(pluginManager)\n ChordVariantDisplayF(pluginManager)\n }\n}\n\nexport { default as VcfFeature } from './VcfFeature'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport configSchemaF from './configSchema'\n\nexport default function VariantTrackF(pm: PluginManager) {\n pm.addTrackType(() => {\n const configSchema = configSchemaF(pm)\n return new TrackType({\n name: 'VariantTrack',\n displayName: 'Variant track',\n configSchema,\n stateModel: createBaseTrackModel(pm, 'VariantTrack', configSchema),\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function VcfAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'VcfAdapter',\n displayName: 'VCF adapter',\n configSchema,\n getAdapterClass: () => import('./VcfAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport { default as configSchema } from './configSchema'\n\nexport default function VcfTabixAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'VcfTabixAdapter',\n displayName: 'VCF tabix adapter',\n configSchema,\n getAdapterClass: () => import('./VcfTabixAdapter').then(r => r.default),\n }),\n )\n}\n","import { lazy } from 'react'\nimport WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { stateModelFactory } from './stateModelFactory'\nimport { configSchema } from './configSchema'\n\nexport default function VariantFeatureWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(\n () =>\n new WidgetType({\n name: 'VariantFeatureWidget',\n heading: 'Feature details',\n configSchema: configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./VariantFeatureWidget')),\n }),\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config VariantTrack\n * Mostly similar to feature track, but has `ChordDisplayType` registered to it,\n * and custom feature details in `LinearVariantDisplay`\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'VariantTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n makeIndex,\n makeIndexType,\n getFileName,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default function ExtensionPointsF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.vcf\\.b?gz$/i\n const adapterName = 'VcfTabixAdapter'\n const fileName = getFileName(file)\n const indexName = index && getFileName(index)\n const obj = {\n type: adapterName,\n vcfGzLocation: file,\n index: {\n location: index || makeIndex(file, '.tbi'),\n indexType: makeIndexType(indexName, 'CSI', 'TBI'),\n },\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'VcfTabixAdapter' || adapterName === 'VcfAdapter') {\n return 'VariantTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.vcf$/i\n const adapterName = 'VcfAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n vcfLocation: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport stateModelFactory from './model'\nimport configSchemaF from './configSchema'\n\nexport default function LinearVariantDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new DisplayType({\n name: 'LinearVariantDisplay',\n displayName: 'Variant display',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'VariantTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #config LinearVariantDisplay\n * mostly empty, this display type is very much\n * like a `FeatureTrack` with a `LinearBasicDisplay` except it has a custom\n * feature details widget\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default function configSchemaF(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearVariantDisplay',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport type LinearVariantDisplayConfigModel = ReturnType<typeof configSchemaF>\nexport type LinearVariantDisplayConfig =\n Instance<LinearVariantDisplayConfigModel>\n","import ChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\nimport ReactComponent from './ReactComponent'\n\nexport default function StructuralVariantChordRendererF(\n pluginManager: PluginManager,\n) {\n pluginManager.addRendererType(\n () =>\n new ChordRendererType({\n name: 'StructuralVariantChordRenderer',\n displayName: 'SV chord renderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseChordDisplayComponent } from '@jbrowse/plugin-circular-view'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\n// locals\nimport configSchemaF from './models/configSchema'\nimport stateModelF from './models/stateModelFactory'\n\nexport default function ChordVariantDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n const stateModel = stateModelF(configSchema)\n return new DisplayType({\n name: 'ChordVariantDisplay',\n displayName: 'Chord variant display',\n configSchema,\n stateModel,\n trackType: 'VariantTrack',\n viewType: 'CircularView',\n ReactComponent: BaseChordDisplayComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { baseChordDisplayConfig } from '@jbrowse/plugin-circular-view'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config ChordVariantDisplay\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nfunction stateModelFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'ChordVariantDisplay',\n {\n /**\n * #slot\n */\n renderer: types.optional(\n pluginManager.pluggableConfigSchemaType('renderer'),\n { type: 'StructuralVariantChordRenderer' },\n ),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseChordDisplayConfig,\n explicitlyTyped: true,\n },\n )\n}\n\nexport default stateModelFactory\n","import {\n BaseChordDisplayModel,\n CircularViewModel,\n} from '@jbrowse/plugin-circular-view'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n} from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport { Feature, getContainingView } from '@jbrowse/core/util'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\n\n/**\n * #stateModel ChordVariantDisplay\n * extends\n * - [BaseChordDisplay](../basechorddisplay)\n */\nconst stateModelFactory = (configSchema: AnyConfigurationSchemaType) => {\n return types\n .compose(\n 'ChordVariantDisplay',\n BaseChordDisplayModel,\n types.model({\n /**\n * #property\n */\n type: types.literal('ChordVariantDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n .views(self => ({\n /**\n * #getter\n */\n get rendererTypeName() {\n return self.configuration.renderer.type\n },\n\n /**\n * #method\n */\n renderProps(): Record<string, unknown> {\n const view = getContainingView(self) as CircularViewModel\n return {\n ...getParentRenderProps(self),\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n bezierRadius: view.radiusPx * self.bezierRadiusRatio,\n radius: view.radiusPx,\n blockDefinitions: self.blockDefinitions,\n config: self.configuration.renderer,\n onChordClick: (arg: Feature) => {\n self.onChordClick(arg)\n },\n }\n },\n }))\n}\n\n// http://localhost:3000/test_data/hs37d5.HG002-SequelII-CCS.sv.vcf.gz.tbi\n\n// render request is for 1.5x the current viewing window\n\n// tracks all have a height\n//\nexport default stateModelFactory\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { Feature } from '@jbrowse/core/util'\n\n// locals\nimport Tooltip, { TooltipContentsComponent } from '../../Tooltip'\nimport { toP } from '../../util'\n\nconst en = (n: number) => n.toLocaleString('en-US')\n\ninterface Props {\n feature: Feature\n}\n\nconst TooltipContents = React.forwardRef<HTMLDivElement, Props>(\n function TooltipContents2({ feature }, ref) {\n const start = feature.get('start')\n const end = feature.get('end')\n const refName = feature.get('refName')\n const name = feature.get('name')\n const loc = [\n refName,\n name,\n start === end ? en(start) : `${en(start)}..${en(end)}`,\n ]\n .filter(f => !!f)\n .join(':')\n\n return feature.get('summary') !== undefined ? (\n <div ref={ref}>\n {loc}\n <br />\n Max: {toP(feature.get('maxScore'))}\n <br />\n Avg: {toP(feature.get('score'))}\n <br />\n Min: {toP(feature.get('minScore'))}\n </div>\n ) : (\n <div ref={ref}>\n {loc}\n <br />\n {`${toP(feature.get('score'))}`}\n </div>\n )\n },\n)\n\ntype Coord = [number, number]\n\nconst WiggleTooltip = observer(function (props: {\n model: {\n featureUnderMouse?: Feature\n }\n height: number\n offsetMouseCoord: Coord\n clientMouseCoord: Coord\n clientRect?: DOMRect\n TooltipContents?: TooltipContentsComponent\n}) {\n return <Tooltip TooltipContents={TooltipContents} {...props} />\n})\nexport default WiggleTooltip\n\nexport { default as Tooltip } from '../../Tooltip'\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport {\n measureText,\n getContainingView,\n getContainingTrack,\n} from '@jbrowse/core/util'\nimport { getConf } from '@jbrowse/core/configuration'\nimport {\n BaseLinearDisplayComponent,\n LinearGenomeViewModel,\n} from '@jbrowse/plugin-linear-genome-view'\n\n// locals\nimport { WiggleDisplayModel } from '../models/model'\nimport YScaleBar from '../../shared/YScaleBar'\n\ntype LGV = LinearGenomeViewModel\n\nconst LinearWiggleDisplay = observer((props: { model: WiggleDisplayModel }) => {\n const { model } = props\n const { stats, height, needsScalebar } = model\n\n const { trackLabels } = getContainingView(model) as LGV\n const track = getContainingTrack(model)\n const left =\n trackLabels === 'overlapping'\n ? measureText(getConf(track, 'name'), 12.8) + 100\n : 50\n return (\n <div>\n <BaseLinearDisplayComponent {...props} />\n {stats && needsScalebar ? (\n <svg\n style={{\n position: 'absolute',\n top: 0,\n left,\n pointerEvents: 'none',\n height,\n width: 50,\n }}\n >\n <YScaleBar model={model} />\n </svg>\n ) : null}\n </div>\n )\n})\n\nexport default LinearWiggleDisplay\n","import React, { Suspense } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { Feature } from '@jbrowse/core/util'\nimport BaseTooltip from '@jbrowse/core/ui/BaseTooltip'\n// locals\nimport { YSCALEBAR_LABEL_OFFSET } from './util'\n\nconst useStyles = makeStyles()({\n hoverVertical: {\n background: '#333',\n border: 'none',\n width: 1,\n height: '100%',\n top: YSCALEBAR_LABEL_OFFSET,\n cursor: 'default',\n position: 'absolute',\n pointerEvents: 'none',\n },\n})\n\ntype Coord = [number, number]\n\n// React.forwardRef component for the tooltip, the ref is used for measuring\n// the size of the tooltip\nexport type TooltipContentsComponent = React.ForwardRefExoticComponent<\n { feature: Feature; model: any } & React.RefAttributes<HTMLDivElement>\n>\n\nconst Tooltip = observer(function Tooltip({\n model,\n height,\n clientMouseCoord,\n offsetMouseCoord,\n clientRect,\n TooltipContents,\n useClientY,\n}: {\n model: { featureUnderMouse?: Feature }\n useClientY?: boolean\n height: number\n clientMouseCoord: Coord\n offsetMouseCoord: Coord\n clientRect?: DOMRect\n TooltipContents: TooltipContentsComponent\n}) {\n const { featureUnderMouse } = model\n const { classes } = useStyles()\n\n const x = clientMouseCoord[0] + 5\n const y = useClientY ? clientMouseCoord[1] : clientRect?.top || 0\n return featureUnderMouse ? (\n <>\n <Suspense fallback={null}>\n <BaseTooltip clientPoint={{ x, y }}>\n <TooltipContents model={model} feature={featureUnderMouse} />\n </BaseTooltip>\n </Suspense>\n\n <div\n className={classes.hoverVertical}\n style={{\n left: offsetMouseCoord[0],\n height: height - YSCALEBAR_LABEL_OFFSET * 2,\n }}\n />\n </>\n ) : null\n})\n\nexport default Tooltip\n","import FeatureRendererType, {\n RenderArgs as FeatureRenderArgs,\n RenderArgsDeserialized as FeatureRenderArgsDeserialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType'\nimport { renderToAbstractCanvas, Feature } from '@jbrowse/core/util'\nimport { ThemeOptions } from '@mui/material'\n\n// locals\nimport { ScaleOpts, Source } from './util'\n\nexport interface RenderArgs extends FeatureRenderArgs {\n scaleOpts: ScaleOpts\n}\n\nexport interface RenderArgsDeserialized extends FeatureRenderArgsDeserialized {\n bpPerPx: number\n height: number\n highResolutionScaling: number\n scaleOpts: ScaleOpts\n displayCrossHatches: boolean\n ticks: { values: number[] }\n themeOptions: ThemeOptions\n}\n\nexport interface RenderArgsDeserializedWithFeatures\n extends RenderArgsDeserialized {\n features: Map<string, Feature>\n}\n\nexport interface MultiRenderArgsDeserialized\n extends RenderArgsDeserializedWithFeatures {\n sources: Source[]\n}\n\nexport default abstract class WiggleBaseRenderer extends FeatureRendererType {\n supportsSVG = true\n\n async render(renderProps: RenderArgsDeserialized) {\n const features = await this.getFeatures(renderProps)\n const { height, regions, bpPerPx } = renderProps\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n\n // @ts-expect-error\n const { reducedFeatures, ...rest } = await renderToAbstractCanvas(\n width,\n height,\n renderProps,\n ctx =>\n this.draw(ctx, {\n ...renderProps,\n features,\n }),\n )\n\n const results = await super.render({\n ...renderProps,\n ...rest,\n features,\n height,\n width,\n })\n\n return {\n ...results,\n ...rest,\n features: reducedFeatures\n ? new Map<string, Feature>(\n reducedFeatures.map((r: Feature) => [r.id(), r]),\n )\n : results.features,\n height,\n width,\n containsNoTransferables: true,\n }\n }\n\n /**\n * draw features to context given props, to be used by derived renderer\n * classes\n */\n abstract draw<T extends RenderArgsDeserializedWithFeatures>(\n ctx: CanvasRenderingContext2D,\n\n props: T,\n ): Promise<Record<string, unknown> | undefined>\n}\n\nexport {\n type RenderArgsSerialized,\n type RenderResults,\n type ResultsDeserialized,\n type ResultsSerialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType'\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BigWigAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BigWigAdapter = ConfigurationSchema(\n 'BigWigAdapter',\n {\n /**\n * #slot\n */\n bigWigLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.bw',\n locationType: 'UriLocation',\n },\n },\n\n /**\n * #slot\n */\n source: {\n type: 'string',\n defaultValue: '',\n description: 'Used for multiwiggle',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default BigWigAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes/models'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config QuantitativeTrack\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nfunction configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'QuantitativeTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n}\n\nexport default configSchemaFactory\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config MultiWiggleAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst MultiWiggleAdapter = ConfigurationSchema(\n 'MultiWiggleAdapter',\n {\n /**\n * #slot\n */\n subadapters: {\n type: 'frozen',\n defaultValue: [],\n description: 'array of subadapter JSON objects',\n },\n /**\n * #slot\n */\n bigWigs: {\n type: 'frozen',\n description:\n 'array of bigwig filenames, alternative to the subadapters slot',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default MultiWiggleAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config WiggleRenderer\n * this is the \"base wiggle renderer config schema\"\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst WiggleRenderer = ConfigurationSchema(\n 'WiggleRenderer',\n {\n /**\n * #slot\n */\n color: {\n type: 'color',\n description: 'the color of track, overrides posColor and negColor',\n defaultValue: '#f0f',\n },\n /**\n * #slot\n */\n posColor: {\n type: 'color',\n description: 'the color to use when the score is positive',\n defaultValue: 'blue',\n },\n /**\n * #slot\n */\n negColor: {\n type: 'color',\n description: 'the color to use when the score is negative',\n defaultValue: 'red',\n },\n /**\n * #slot\n */\n clipColor: {\n type: 'color',\n description: 'the color of the clipping marker',\n defaultValue: 'red',\n },\n /**\n * #slot\n */\n bicolorPivot: {\n type: 'stringEnum',\n model: types.enumeration('Scale type', [\n 'numeric',\n 'mean',\n 'z_score',\n 'none',\n ]),\n description: 'type of bicolor pivot',\n defaultValue: 'numeric',\n },\n /**\n * #slot\n */\n bicolorPivotValue: {\n type: 'number',\n defaultValue: 0,\n description: 'value to use for bicolor pivot',\n },\n },\n { explicitlyTyped: true },\n)\nexport default WiggleRenderer\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config DensityRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'DensityRenderer',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { featureSpanPx, Feature, Region } from '@jbrowse/core/util'\n\n// locals\nimport { fillRectCtx, getScale, ScaleOpts } from './util'\n\nconst fudgeFactor = 0.3\nconst clipHeight = 2\n\nexport function drawDensity(\n ctx: CanvasRenderingContext2D,\n props: {\n features: Map<string, Feature> | Feature[]\n regions: Region[]\n bpPerPx: number\n scaleOpts: ScaleOpts\n height: number\n ticks: { values: number[] }\n displayCrossHatches: boolean\n config: AnyConfigurationModel\n },\n) {\n const { features, regions, bpPerPx, scaleOpts, height, config } = props\n const region = regions[0]!\n const pivot = readConfObject(config, 'bicolorPivot')\n const pivotValue = readConfObject(config, 'bicolorPivotValue')\n const negColor = readConfObject(config, 'negColor')\n const posColor = readConfObject(config, 'posColor')\n const color = readConfObject(config, 'color')\n const clipColor = readConfObject(config, 'clipColor')\n const crossing = pivot !== 'none' && scaleOpts.scaleType !== 'log'\n const scale = getScale({\n ...scaleOpts,\n pivotValue: crossing ? pivotValue : undefined,\n range: crossing ? [negColor, 'white', posColor] : ['white', posColor],\n })\n\n const scale2 = getScale({ ...scaleOpts, range: [0, height] })\n const cb =\n color === '#f0f'\n ? (_: Feature, score: number) => scale(score)\n : (feature: Feature, score: number) =>\n readConfObject(config, 'color', { feature, score })\n const domain = scale2.domain()\n const niceMin = domain[0]!\n const niceMax = domain[1]!\n\n let prevLeftPx = Number.NEGATIVE_INFINITY\n let hasClipping = false\n const reducedFeatures = []\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n\n // create reduced features, avoiding multiple features per px\n if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {\n reducedFeatures.push(feature)\n prevLeftPx = leftPx\n }\n const score = feature.get('score')\n hasClipping = hasClipping || score > niceMax || score < niceMin\n const w = rightPx - leftPx + fudgeFactor\n ctx.fillStyle = cb(feature, score)\n ctx.fillRect(leftPx, 0, w, height)\n }\n\n // second pass: draw clipping\n // avoid persisting the red fillstyle with save/restore\n ctx.save()\n if (hasClipping) {\n ctx.fillStyle = clipColor\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n const w = rightPx - leftPx + fudgeFactor\n const score = feature.get('score')\n if (score > niceMax) {\n fillRectCtx(leftPx, 0, w, clipHeight, ctx)\n } else if (score < niceMin && scaleOpts.scaleType !== 'log') {\n fillRectCtx(leftPx, 0, w, clipHeight, ctx)\n }\n }\n }\n ctx.restore()\n\n return { reducedFeatures }\n}\n","import { drawDensity } from '../drawDensity'\n\nimport WiggleBaseRenderer, {\n RenderArgsDeserializedWithFeatures,\n} from '../WiggleBaseRenderer'\n\nexport default class DensityRenderer extends WiggleBaseRenderer {\n async draw(\n ctx: CanvasRenderingContext2D,\n props: RenderArgsDeserializedWithFeatures,\n ) {\n return drawDensity(ctx, props)\n }\n}\n","import { observer } from 'mobx-react'\nimport React, { useRef } from 'react'\n\nimport { Region } from '@jbrowse/core/util/types'\nimport { Feature } from '@jbrowse/core/util'\nimport { PrerenderedCanvas } from '@jbrowse/core/ui'\n\nconst WiggleRendering = observer(function (props: {\n regions: Region[]\n features: Map<string, Feature>\n bpPerPx: number\n width: number\n height: number\n blockKey: string\n onMouseLeave?: (event: React.MouseEvent) => void\n onMouseMove?: (event: React.MouseEvent, arg?: string) => void\n onFeatureClick?: (event: React.MouseEvent, arg?: string) => void\n}) {\n const {\n regions,\n features,\n bpPerPx,\n width,\n height,\n onMouseLeave,\n onMouseMove,\n onFeatureClick,\n } = props\n const region = regions[0]!\n const ref = useRef<HTMLDivElement>(null)\n\n function getFeatureUnderMouse(eventClientX: number) {\n // calculates feature under mouse\n let offset = 0\n if (ref.current) {\n offset = ref.current.getBoundingClientRect().left\n }\n const offsetX = eventClientX - offset\n const px = region.reversed ? width - offsetX : offsetX\n const clientBp = region.start + bpPerPx * px\n let featureUnderMouse: Feature | undefined\n for (const feature of features.values()) {\n // bpPerPx added to the end to accommodate \"reduced features\" (one feature per px)\n if (\n clientBp <= feature.get('end') + bpPerPx &&\n clientBp >= feature.get('start')\n ) {\n featureUnderMouse = feature\n break\n }\n }\n return featureUnderMouse\n }\n return (\n <div\n ref={ref}\n data-testid=\"wiggle-rendering-test\"\n onMouseMove={e => onMouseMove?.(e, getFeatureUnderMouse(e.clientX)?.id())}\n onClick={e => onFeatureClick?.(e, getFeatureUnderMouse(e.clientX)?.id())}\n onMouseLeave={e => onMouseLeave?.(e)}\n style={{\n overflow: 'visible',\n position: 'relative',\n height,\n }}\n >\n <PrerenderedCanvas {...props} />\n </div>\n )\n})\n\nexport default WiggleRendering\n","import {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { colord, Colord } from '@jbrowse/core/util/colord'\n// required to import this for typescript purposes\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport mix from 'colord/plugins/mix'\n\nimport { clamp, featureSpanPx, Feature, Region } from '@jbrowse/core/util'\n\n// locals\nimport { fillRectCtx, getOrigin, getScale, ScaleOpts } from './util'\n\nfunction lighten(color: Colord, amount: number) {\n const hslColor = color.toHsl()\n const l = hslColor.l * (1 + amount)\n return colord({ ...hslColor, l: clamp(l, 0, 100) })\n}\n\nfunction darken(color: Colord, amount: number) {\n const hslColor = color.toHsl()\n const l = hslColor.l * (1 - amount)\n return colord({ ...hslColor, l: clamp(l, 0, 100) })\n}\n\nconst fudgeFactor = 0.3\nconst clipHeight = 2\n\nexport function drawXY(\n ctx: CanvasRenderingContext2D,\n props: {\n features: Map<string, Feature> | Feature[]\n bpPerPx: number\n regions: Region[]\n scaleOpts: ScaleOpts\n height: number\n ticks: { values: number[] }\n config: AnyConfigurationModel\n displayCrossHatches: boolean\n offset?: number\n colorCallback: (f: Feature, score: number) => string\n },\n) {\n const {\n features,\n bpPerPx,\n regions,\n scaleOpts,\n height: unadjustedHeight,\n config,\n ticks,\n displayCrossHatches,\n offset = 0,\n colorCallback,\n } = props\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n\n // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the\n // wiggle display, and makes the height of the actual drawn area add\n // \"padding\" to the top and bottom of the display\n const height = unadjustedHeight - offset * 2\n\n const filled = readConfObject(config, 'filled')\n const clipColor = readConfObject(config, 'clipColor')\n const summaryScoreMode = readConfObject(config, 'summaryScoreMode')\n const pivotValue = readConfObject(config, 'bicolorPivotValue')\n const minSize = readConfObject(config, 'minSize')\n\n const scale = getScale({ ...scaleOpts, range: [0, height] })\n const originY = getOrigin(scaleOpts.scaleType)\n const domain = scale.domain()\n const niceMin = domain[0]!\n const niceMax = domain[1]!\n\n const toY = (n: number) => clamp(height - (scale(n) || 0), 0, height) + offset\n const toOrigin = (n: number) => toY(originY) - toY(n)\n const getHeight = (n: number) => (filled ? toOrigin(n) : Math.max(minSize, 1))\n let hasClipping = false\n\n let prevLeftPx = Number.NEGATIVE_INFINITY\n const reducedFeatures = []\n const crossingOrigin = niceMin < pivotValue && niceMax > pivotValue\n\n // we handle whiskers separately to render max row, min row, and avg in three\n // passes. this reduces subpixel rendering issues. note: for stylistic\n // reasons, clipping indicator is only drawn for score, not min/max score\n if (summaryScoreMode === 'whiskers') {\n let lastCol: string | undefined\n let lastMix: string | undefined\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n if (feature.get('summary')) {\n const w = Math.max(rightPx - leftPx + fudgeFactor, minSize)\n const max = feature.get('maxScore')\n const c = colorCallback(feature, max)\n const effectiveC = crossingOrigin\n ? c\n : c === lastCol\n ? lastMix\n : (lastMix = lighten(colord(c), 0.4).toHex())\n fillRectCtx(leftPx, toY(max), w, getHeight(max), ctx, effectiveC)\n lastCol = c\n }\n }\n lastMix = undefined\n lastCol = undefined\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n const score = feature.get('score')\n const max = feature.get('maxScore')\n const min = feature.get('minScore')\n const summary = feature.get('summary')\n const c = colorCallback(feature, score)\n const effectiveC =\n crossingOrigin && summary\n ? c === lastCol\n ? lastMix\n : (lastMix = colord(colorCallback(feature, max))\n .mix(colord(colorCallback(feature, min)))\n .toString())\n : c\n const w = Math.max(rightPx - leftPx + fudgeFactor, minSize)\n // create reduced features, avoiding multiple features per px\n if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {\n reducedFeatures.push(feature)\n prevLeftPx = leftPx\n }\n hasClipping = hasClipping || score < niceMin || score > niceMax\n fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, effectiveC)\n lastCol = c\n }\n lastMix = undefined\n lastCol = undefined\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n\n if (feature.get('summary')) {\n const min = feature.get('minScore')\n const c = colorCallback(feature, min)\n const w = Math.max(rightPx - leftPx + fudgeFactor, minSize)\n const effectiveC = crossingOrigin\n ? c\n : c === lastCol\n ? lastMix\n : (lastMix = darken(colord(c), 0.4).toHex())\n\n fillRectCtx(leftPx, toY(min), w, getHeight(min), ctx, effectiveC)\n lastCol = c\n }\n }\n } else {\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n\n // create reduced features, avoiding multiple features per px\n if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {\n reducedFeatures.push(feature)\n prevLeftPx = leftPx\n }\n\n const score = feature.get('score')\n const c = colorCallback(feature, score)\n\n hasClipping = hasClipping || score < niceMin || score > niceMax\n const w = Math.max(rightPx - leftPx + fudgeFactor, minSize)\n\n if (summaryScoreMode === 'max') {\n const s = feature.get('summary') ? feature.get('maxScore') : score\n fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c)\n } else if (summaryScoreMode === 'min') {\n const s = feature.get('summary') ? feature.get('minScore') : score\n fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c)\n } else {\n fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, c)\n }\n }\n }\n\n // second pass: draw clipping\n // avoid persisting the red fillstyle with save/restore\n ctx.save()\n if (hasClipping) {\n ctx.fillStyle = clipColor\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n const w = rightPx - leftPx + fudgeFactor\n const score = feature.get('score')\n if (score > niceMax) {\n fillRectCtx(leftPx, offset, w, clipHeight, ctx)\n } else if (score < niceMin && scaleOpts.scaleType !== 'log') {\n fillRectCtx(leftPx, unadjustedHeight, w, clipHeight, ctx)\n }\n }\n }\n ctx.restore()\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1\n ctx.strokeStyle = 'rgba(200,200,200,0.5)'\n ticks.values.forEach(tick => {\n ctx.beginPath()\n ctx.moveTo(0, Math.round(toY(tick)))\n ctx.lineTo(width, Math.round(toY(tick)))\n ctx.stroke()\n })\n }\n\n return { reducedFeatures }\n}\n","import { readConfObject } from '@jbrowse/core/configuration'\nimport { Feature } from '@jbrowse/core/util'\nimport { drawXY } from '../drawXY'\nimport WiggleBaseRenderer, {\n RenderArgsDeserializedWithFeatures,\n} from '../WiggleBaseRenderer'\nimport { YSCALEBAR_LABEL_OFFSET } from '../util'\n\nexport default class XYPlotRenderer extends WiggleBaseRenderer {\n async draw(\n ctx: CanvasRenderingContext2D,\n props: RenderArgsDeserializedWithFeatures,\n ) {\n const { features, config } = props\n\n // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the\n // wiggle display, and makes the height of the actual drawn area add\n // \"padding\" to the top and bottom of the display\n const pivotValue = readConfObject(config, 'bicolorPivotValue')\n const negColor = readConfObject(config, 'negColor')\n const posColor = readConfObject(config, 'posColor')\n\n return drawXY(ctx, {\n ...props,\n colorCallback:\n readConfObject(config, 'color') === '#f0f'\n ? (_: Feature, score: number) =>\n score < pivotValue ? negColor : posColor\n : (feature: Feature, _score: number) =>\n readConfObject(config, 'color', { feature }),\n offset: YSCALEBAR_LABEL_OFFSET,\n features: [...features.values()],\n })\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport baseWiggleRendererConfigSchema from '../configSchema'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config XYPlotRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'XYPlotRenderer',\n {\n /**\n * #slot\n */\n filled: {\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n /**\n * #slot\n */\n summaryScoreMode: {\n type: 'stringEnum',\n model: types.enumeration('Score type', ['max', 'min', 'avg', 'whiskers']),\n description:\n 'choose whether to use max/min/average or whiskers which combines all three into the same rendering',\n defaultValue: 'whiskers',\n },\n /**\n * #slot\n */\n minSize: {\n type: 'number',\n defaultValue: 0,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config LinePlotRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'LinePlotRenderer',\n {\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { clamp, featureSpanPx, Feature, Region } from '@jbrowse/core/util'\n\n// locals\nimport { getScale, ScaleOpts } from './util'\n\nconst fudgeFactor = 0.3\nconst clipHeight = 2\n\nexport function drawLine(\n ctx: CanvasRenderingContext2D,\n props: {\n features: Map<string, Feature> | Feature[]\n regions: Region[]\n bpPerPx: number\n scaleOpts: ScaleOpts\n height: number\n ticks: { values: number[] }\n displayCrossHatches: boolean\n colorCallback: (f: Feature, score: number) => string\n config: AnyConfigurationModel\n offset?: number\n },\n) {\n const {\n features,\n regions,\n bpPerPx,\n scaleOpts,\n height: unadjustedHeight,\n ticks: { values },\n displayCrossHatches,\n colorCallback,\n config,\n offset = 0,\n } = props\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n\n // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the\n // wiggle display, and makes the height of the actual drawn area add\n // \"padding\" to the top and bottom of the display\n const height = unadjustedHeight - offset * 2\n const clipColor = readConfObject(config, 'clipColor')\n const scale = getScale({ ...scaleOpts, range: [0, height] })\n const domain = scale.domain()\n const niceMin = domain[0]!\n const niceMax = domain[1]!\n const toY = (n: number) => clamp(height - (scale(n) || 0), 0, height) + offset\n\n let lastVal: number | undefined\n let prevLeftPx = Number.NEGATIVE_INFINITY\n const reducedFeatures = []\n for (const feature of features.values()) {\n const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx)\n\n // create reduced features, avoiding multiple features per px\n if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {\n reducedFeatures.push(feature)\n prevLeftPx = leftPx\n }\n const score = feature.get('score')\n const lowClipping = score < niceMin\n const highClipping = score > niceMax\n const w = rightPx - leftPx + fudgeFactor\n\n const c = colorCallback(feature, score)\n\n ctx.beginPath()\n ctx.strokeStyle = c\n const startPos = lastVal !== undefined ? lastVal : score\n if (!region.reversed) {\n ctx.moveTo(leftPx, toY(startPos))\n ctx.lineTo(leftPx, toY(score))\n ctx.lineTo(rightPx, toY(score))\n } else {\n ctx.moveTo(rightPx, toY(startPos))\n ctx.lineTo(rightPx, toY(score))\n ctx.lineTo(leftPx, toY(score))\n }\n ctx.stroke()\n lastVal = score\n\n if (highClipping) {\n ctx.fillStyle = clipColor\n ctx.fillRect(leftPx, offset, w, clipHeight)\n } else if (lowClipping && scaleOpts.scaleType !== 'log') {\n ctx.fillStyle = clipColor\n ctx.fillRect(leftPx, height - clipHeight, w, height)\n }\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1\n ctx.strokeStyle = 'rgba(200,200,200,0.5)'\n values.forEach(tick => {\n ctx.beginPath()\n ctx.moveTo(0, Math.round(toY(tick)))\n ctx.lineTo(width, Math.round(toY(tick)))\n ctx.stroke()\n })\n }\n return { reducedFeatures }\n}\n","import { readConfObject } from '@jbrowse/core/configuration'\nimport { Feature } from '@jbrowse/core/util'\nimport WiggleBaseRenderer, {\n RenderArgsDeserializedWithFeatures,\n} from '../WiggleBaseRenderer'\n\nimport { YSCALEBAR_LABEL_OFFSET } from '../util'\nimport { drawLine } from '../drawLine'\n\nexport default class LinePlotRenderer extends WiggleBaseRenderer {\n async draw(\n ctx: CanvasRenderingContext2D,\n props: RenderArgsDeserializedWithFeatures,\n ) {\n const { config } = props\n const c = readConfObject(config, 'color')\n return drawLine(ctx, {\n ...props,\n offset: YSCALEBAR_LABEL_OFFSET,\n colorCallback:\n c === '#f0f'\n ? () => 'grey'\n : (feature: Feature) => readConfObject(config, 'color', { feature }),\n })\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config SharedWiggleDisplay\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nexport default function sharedWiggleConfigFactory() {\n return ConfigurationSchema(\n 'SharedWiggleDisplay',\n {\n /**\n * #slot\n */\n autoscale: {\n type: 'stringEnum',\n defaultValue: 'local',\n model: types.enumeration('Autoscale type', [\n 'global',\n 'local',\n 'globalsd',\n 'localsd',\n 'zscore',\n ]),\n description:\n 'global/local using their min/max values or w/ standard deviations (globalsd/localsd)',\n },\n\n /**\n * #slot\n */\n minimalTicks: {\n type: 'boolean',\n defaultValue: false,\n description: 'use the minimal amount of ticks',\n },\n\n /**\n * #slot\n */\n minScore: {\n type: 'number',\n defaultValue: Number.MIN_VALUE,\n description: 'minimum value for the y-scale',\n },\n /**\n * #slot\n */\n maxScore: {\n type: 'number',\n description: 'maximum value for the y-scale',\n defaultValue: Number.MAX_VALUE,\n },\n /**\n * #slot\n */\n numStdDev: {\n type: 'number',\n description:\n 'number of standard deviations to use for autoscale types globalsd or localsd',\n defaultValue: 3,\n },\n /**\n * #slot\n */\n scaleType: {\n type: 'stringEnum',\n model: types.enumeration('Scale type', ['linear', 'log']), // todo zscale\n description: 'The type of scale to use',\n defaultValue: 'linear',\n },\n\n /**\n * #slot\n */\n inverted: {\n type: 'boolean',\n description: 'draw upside down',\n defaultValue: false,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n getConf,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport {\n Feature,\n getEnv,\n getSession,\n isSelectionContainer,\n} from '@jbrowse/core/util'\nimport { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'\nimport { types } from 'mobx-state-tree'\n\n// locals\nimport { getNiceDomain } from '../util'\nimport { lazy } from 'react'\n\n// lazies\nconst SetMinMaxDialog = lazy(() => import('./SetMinMaxDialog'))\n\n/**\n * #stateModel SharedWiggleMixin\n */\nexport default function SharedWiggleMixin(\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n selectedRendering: types.optional(types.string, ''),\n /**\n * #property\n */\n resolution: types.optional(types.number, 1),\n /**\n * #property\n */\n fill: types.maybe(types.boolean),\n /**\n * #property\n */\n minSize: types.maybe(types.number),\n /**\n * #property\n */\n color: types.maybe(types.string),\n /**\n * #property\n */\n posColor: types.maybe(types.string),\n /**\n * #property\n */\n negColor: types.maybe(types.string),\n /**\n * #property\n */\n summaryScoreMode: types.maybe(types.string),\n /**\n * #property\n */\n rendererTypeNameState: types.maybe(types.string),\n /**\n * #property\n */\n scale: types.maybe(types.string),\n /**\n * #property\n */\n autoscale: types.maybe(types.string),\n /**\n * #property\n */\n displayCrossHatches: types.maybe(types.boolean),\n /**\n * #property\n */\n constraints: types.optional(\n types.model({\n max: types.maybe(types.number),\n min: types.maybe(types.number),\n }),\n {},\n ),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n .volatile(() => ({\n message: undefined as undefined | string,\n stats: undefined as { scoreMin: number; scoreMax: number } | undefined,\n statsFetchInProgress: undefined as undefined | AbortController,\n }))\n .actions(self => ({\n /**\n * #action\n */\n updateQuantitativeStats(stats: { scoreMin: number; scoreMax: number }) {\n const { scoreMin, scoreMax } = stats\n const EPSILON = 0.000001\n if (!self.stats) {\n self.stats = { scoreMin, scoreMax }\n } else if (\n Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||\n Math.abs(self.stats.scoreMin - scoreMin) > EPSILON\n ) {\n self.stats = { scoreMin, scoreMax }\n }\n },\n /**\n * #action\n */\n setColor(color?: string) {\n self.color = color\n },\n /**\n * #action\n */\n setPosColor(color?: string) {\n self.posColor = color\n },\n /**\n * #action\n */\n setNegColor(color?: string) {\n self.negColor = color\n },\n\n /**\n * #action\n */\n setLoading(aborter: AbortController) {\n const { statsFetchInProgress: statsFetch } = self\n if (statsFetch !== undefined && !statsFetch.signal.aborted) {\n statsFetch.abort()\n }\n self.statsFetchInProgress = aborter\n },\n\n /**\n * #action\n * this overrides the BaseLinearDisplayModel to avoid popping up a\n * feature detail display, but still sets the feature selection on the\n * model so listeners can detect a click\n */\n selectFeature(feature: Feature) {\n const session = getSession(self)\n if (isSelectionContainer(session)) {\n session.setSelection(feature)\n }\n },\n\n /**\n * #action\n */\n setResolution(res: number) {\n self.resolution = res\n },\n\n /**\n * #action\n */\n setFill(fill: number) {\n if (fill === 0) {\n self.fill = true\n self.minSize = 0\n } else if (fill === 1) {\n self.fill = false\n self.minSize = 1\n } else if (fill === 2) {\n self.fill = false\n self.minSize = 2\n }\n },\n\n /**\n * #action\n */\n toggleLogScale() {\n self.scale = self.scale === 'log' ? 'linear' : 'log'\n },\n\n /**\n * #action\n */\n setScaleType(scale?: string) {\n self.scale = scale\n },\n\n /**\n * #action\n */\n setSummaryScoreMode(val: string) {\n self.summaryScoreMode = val\n },\n\n /**\n * #action\n */\n setAutoscale(val: string) {\n self.autoscale = val\n },\n\n /**\n * #action\n */\n setMaxScore(val?: number) {\n self.constraints.max = val\n },\n\n /**\n * #action\n */\n setRendererType(val: string) {\n self.rendererTypeNameState = val\n },\n\n /**\n * #action\n */\n setMinScore(val?: number) {\n self.constraints.min = val\n },\n\n /**\n * #action\n */\n toggleCrossHatches() {\n self.displayCrossHatches = !self.displayCrossHatches\n },\n\n /**\n * #action\n */\n setCrossHatches(cross: boolean) {\n self.displayCrossHatches = cross\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get adapterTypeName() {\n return self.adapterConfig.type\n },\n\n /**\n * #getter\n */\n get rendererTypeNameSimple() {\n return self.rendererTypeNameState ?? getConf(self, 'defaultRendering')\n },\n\n /**\n * #getter\n * subclasses can define these, as snpcoverage track does\n */\n get filters() {\n return undefined\n },\n\n /**\n * #getter\n */\n get scaleType() {\n return self.scale ?? getConf(self, 'scaleType')\n },\n\n /**\n * #getter\n */\n get maxScore() {\n return self.constraints.max ?? getConf(self, 'maxScore')\n },\n\n /**\n * #getter\n */\n get minScore() {\n return self.constraints.min ?? getConf(self, 'minScore')\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get adapterCapabilities() {\n const type = self.adapterTypeName\n const { pluginManager } = getEnv(self)\n return pluginManager.getAdapterType(type)!.adapterCapabilities\n },\n /**\n * #getter\n */\n get rendererConfig() {\n const {\n color,\n displayCrossHatches,\n fill,\n minSize,\n negColor,\n posColor,\n summaryScoreMode,\n scaleType,\n rendererTypeName,\n } = self\n const configBlob = getConf(self, ['renderers', rendererTypeName]) || {}\n return self.rendererType.configSchema.create(\n {\n ...configBlob,\n ...(scaleType ? { scaleType } : {}),\n ...(fill !== undefined ? { filled: fill } : {}),\n ...(displayCrossHatches !== undefined\n ? { displayCrossHatches }\n : {}),\n ...(summaryScoreMode !== undefined ? { summaryScoreMode } : {}),\n ...(color !== undefined ? { color } : {}),\n ...(negColor !== undefined ? { negColor } : {}),\n ...(posColor !== undefined ? { posColor } : {}),\n ...(minSize !== undefined ? { minSize } : {}),\n },\n getEnv(self),\n )\n },\n\n /**\n * #getter\n */\n get autoscaleType() {\n return self.autoscale ?? getConf(self, 'autoscale')\n },\n }))\n .views(self => {\n let oldDomain: [number, number] = [0, 0]\n return {\n /**\n * #getter\n */\n get domain() {\n const { stats, scaleType, minScore, maxScore } = self\n if (!stats) {\n return undefined\n }\n\n const ret = getNiceDomain({\n domain: [stats.scoreMin, stats.scoreMax],\n bounds: [minScore, maxScore],\n scaleType,\n })\n\n // avoid weird scalebar if log value and empty region displayed\n if (scaleType === 'log' && ret[1] === Number.MIN_VALUE) {\n return [0, Number.MIN_VALUE]\n }\n\n // avoid returning a new object if it matches the old value\n if (JSON.stringify(oldDomain) !== JSON.stringify(ret)) {\n oldDomain = ret\n }\n\n return oldDomain\n },\n }\n })\n .views(self => ({\n /**\n * #getter\n */\n get filled(): boolean {\n const { fill, rendererConfig } = self\n return fill ?? readConfObject(rendererConfig, 'filled')\n },\n /**\n * #getter\n */\n get summaryScoreModeSetting(): string {\n const { summaryScoreMode: mode, rendererConfig } = self\n return mode ?? readConfObject(rendererConfig, 'summaryScoreMode')\n },\n\n /**\n * #getter\n */\n get scaleOpts() {\n return {\n domain: self.domain,\n stats: self.stats,\n autoscaleType: self.autoscaleType,\n scaleType: self.scaleType,\n inverted: getConf(self, 'inverted'),\n }\n },\n\n /**\n * #getter\n */\n get canHaveFill() {\n return self.rendererTypeName === 'XYPlotRenderer'\n },\n\n /**\n * #getter\n */\n get displayCrossHatchesSetting(): boolean {\n const { displayCrossHatches: hatches, rendererConfig } = self\n return hatches ?? readConfObject(rendererConfig, 'displayCrossHatches')\n },\n /**\n * #getter\n */\n get hasResolution() {\n return self.adapterCapabilities.includes('hasResolution')\n },\n\n /**\n * #getter\n */\n get hasGlobalStats() {\n return self.adapterCapabilities.includes('hasGlobalStats')\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n scoreTrackMenuItems() {\n return [\n ...(self.hasResolution\n ? [\n {\n label: 'Resolution',\n subMenu: [\n {\n label: 'Finer resolution',\n onClick: () => {\n self.setResolution(self.resolution * 5)\n },\n },\n {\n label: 'Coarser resolution',\n onClick: () => {\n self.setResolution(self.resolution / 5)\n },\n },\n ],\n },\n {\n label: 'Summary score mode',\n subMenu: ['min', 'max', 'avg', 'whiskers'].map(elt => ({\n label: elt,\n type: 'radio',\n checked: self.summaryScoreModeSetting === elt,\n onClick: () => {\n self.setSummaryScoreMode(elt)\n },\n })),\n },\n ]\n : []),\n {\n label:\n self.scaleType === 'log' ? 'Set linear scale' : 'Set log scale',\n onClick: () => {\n self.toggleLogScale()\n },\n },\n {\n label: 'Autoscale type',\n subMenu: [\n ['local', 'Local'],\n ...(self.hasGlobalStats\n ? ([\n ['global', 'Global'],\n ['globalsd', 'Global ± 3σ'],\n ] as const)\n : []),\n ['localsd', 'Local ± 3σ'],\n ].map(([val, label]) => ({\n label,\n type: 'radio',\n checked: self.autoscaleType === val,\n onClick: () => {\n self.setAutoscale(val)\n },\n })),\n },\n {\n label: 'Set min/max score',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetMinMaxDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }))\n .actions(self => {\n const { reload: superReload } = self\n return {\n /**\n * #action\n */\n async reload() {\n self.setError()\n superReload()\n },\n }\n })\n}\n","import { lazy } from 'react'\nimport {\n AnyConfigurationSchemaType,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { AnyReactComponentType, getSession } from '@jbrowse/core/util'\nimport { types, Instance } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { axisPropsFromTickScale } from 'react-d3-axis-mod'\nimport { ExportSvgDisplayOptions } from '@jbrowse/plugin-linear-genome-view'\n\n// locals\nimport { getScale, YSCALEBAR_LABEL_OFFSET } from '../../util'\nimport SharedWiggleMixin from '../../shared/modelShared'\n\n// lazies\nconst Tooltip = lazy(() => import('../components/Tooltip'))\nconst SetColorDialog = lazy(() => import('../components/SetColorDialog'))\n\n// using a map because it preserves order\nconst rendererTypes = new Map([\n ['xyplot', 'XYPlotRenderer'],\n ['density', 'DensityRenderer'],\n ['line', 'LinePlotRenderer'],\n])\n\n/**\n * #stateModel LinearWiggleDisplay\n * extends\n * - [SharedWiggleMixin](../sharedwigglemixin)\n */\nfunction stateModelFactory(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'LinearWiggleDisplay',\n SharedWiggleMixin(configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearWiggleDisplay'),\n }),\n )\n\n .views(self => ({\n /**\n * #getter\n */\n get TooltipComponent() {\n return Tooltip as AnyReactComponentType\n },\n\n /**\n * #getter\n */\n get rendererTypeName() {\n const name = self.rendererTypeNameSimple\n const rendererType = rendererTypes.get(name)\n if (!rendererType) {\n throw new Error(`unknown renderer ${name}`)\n }\n return rendererType\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get ticks() {\n const { scaleType, domain, height } = self\n const minimalTicks = getConf(self, 'minimalTicks')\n const inverted = getConf(self, 'inverted')\n const range = [height - YSCALEBAR_LABEL_OFFSET, YSCALEBAR_LABEL_OFFSET]\n if (!domain) {\n return undefined\n }\n const scale = getScale({\n scaleType,\n domain,\n range,\n inverted,\n })\n const ticks = axisPropsFromTickScale(scale, 4)\n return height < 100 || minimalTicks\n ? { ...ticks, values: domain }\n : ticks\n },\n }))\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #method\n */\n renderProps() {\n const superProps = superRenderProps()\n const { filters, ticks, height, resolution, scaleOpts } = self\n return {\n ...superProps,\n notReady: superProps.notReady || !self.stats,\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n config: self.rendererConfig,\n displayCrossHatches: self.displayCrossHatchesSetting,\n scaleOpts,\n resolution,\n height,\n ticks,\n filters,\n }\n },\n\n /**\n * #getter\n */\n get needsScalebar() {\n const { rendererTypeName: type } = self\n return type === 'XYPlotRenderer' || type === 'LinePlotRenderer'\n },\n /**\n * #getter\n */\n get fillSetting() {\n if (self.filled) {\n return 0\n } else if (self.minSize === 1) {\n return 1\n } else {\n return 2\n }\n },\n }\n })\n .views(self => {\n const { trackMenuItems: superTrackMenuItems } = self\n const hasRenderings = getConf(self, 'defaultRendering')\n return {\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Score',\n subMenu: self.scoreTrackMenuItems(),\n },\n\n ...(self.canHaveFill\n ? [\n {\n label: 'Fill mode',\n subMenu: ['filled', 'no fill', 'no fill w/ emphasis'].map(\n (elt, idx) => ({\n label: elt,\n type: 'radio',\n checked: self.fillSetting === idx,\n onClick: () => {\n self.setFill(idx)\n },\n }),\n ),\n },\n ]\n : []),\n\n ...(self.needsScalebar\n ? [\n {\n type: 'checkbox',\n label: 'Draw cross hatches',\n checked: self.displayCrossHatchesSetting,\n onClick: () => {\n self.toggleCrossHatches()\n },\n },\n ]\n : []),\n\n ...(hasRenderings\n ? [\n {\n label: 'Renderer type',\n subMenu: ['xyplot', 'density', 'line'].map(key => ({\n label: key,\n type: 'radio',\n checked: self.rendererTypeNameSimple === key,\n onClick: () => {\n self.setRendererType(key)\n },\n })),\n },\n ]\n : []),\n\n {\n label: 'Set color',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetColorDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }\n })\n .actions(self => {\n const { renderSvg: superRenderSvg } = self\n\n return {\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n const { quantitativeStatsAutorun } = await import('../../util')\n quantitativeStatsAutorun(self)\n })()\n },\n /**\n * #action\n */\n async renderSvg(opts: ExportSvgDisplayOptions) {\n const { renderSvg } = await import('./renderSvg')\n return renderSvg(self, opts, superRenderSvg)\n },\n }\n })\n}\n\nexport type WiggleDisplayStateModel = ReturnType<typeof stateModelFactory>\nexport type WiggleDisplayModel = Instance<WiggleDisplayStateModel>\n\nexport default stateModelFactory\n","import { lazy } from 'react'\nimport { addDisposer, isAlive, types, Instance } from 'mobx-state-tree'\nimport { autorun } from 'mobx'\nimport { axisPropsFromTickScale } from 'react-d3-axis-mod'\nimport deepEqual from 'fast-deep-equal'\n\n// jbrowse imports\nimport {\n AnyConfigurationSchemaType,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { getSession, Feature, AnyReactComponentType } from '@jbrowse/core/util'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { set1 as colors } from '@jbrowse/core/ui/colors'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ExportSvgDisplayOptions } from '@jbrowse/plugin-linear-genome-view'\n\n// locals\nimport { getScale, YSCALEBAR_LABEL_OFFSET } from '../../util'\nimport SharedWiggleMixin from '../../shared/modelShared'\n\nconst randomColor = () =>\n '#000000'.replaceAll('0', () => (~~(Math.random() * 16)).toString(16))\n\n// lazies\nconst Tooltip = lazy(() => import('../components/Tooltip'))\nconst SetColorDialog = lazy(() => import('../components/SetColorDialog'))\n\n// using a map because it preserves order\nconst rendererTypes = new Map([\n ['xyplot', 'MultiXYPlotRenderer'],\n ['multirowxy', 'MultiRowXYPlotRenderer'],\n ['multirowdensity', 'MultiDensityRenderer'],\n ['multiline', 'MultiLineRenderer'],\n ['multirowline', 'MultiRowLineRenderer'],\n])\n\ninterface Source {\n name: string\n color?: string\n group?: string\n}\n\n/**\n * #stateModel MultiLinearWiggleDisplay\n * extends\n * - [SharedWiggleMixin](../sharedwigglemixin)\n */\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'MultiLinearWiggleDisplay',\n SharedWiggleMixin(configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('MultiLinearWiggleDisplay'),\n\n /**\n * #property\n */\n layout: types.optional(types.frozen<Source[]>(), []),\n }),\n )\n .volatile(() => ({\n featureUnderMouseVolatile: undefined as Feature | undefined,\n sourcesVolatile: undefined as Source[] | undefined,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setLayout(layout: Source[]) {\n self.layout = layout\n },\n /**\n * #action\n */\n clearLayout() {\n self.layout = []\n },\n\n /**\n * #action\n */\n setSources(sources: Source[]) {\n if (!deepEqual(sources, self.sourcesVolatile)) {\n self.sourcesVolatile = sources\n }\n },\n\n /**\n * #action\n */\n setFeatureUnderMouse(f?: Feature) {\n self.featureUnderMouseVolatile = f\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get featureUnderMouse() {\n return self.featureUnderMouseVolatile\n },\n /**\n * #getter\n */\n get TooltipComponent() {\n return Tooltip as AnyReactComponentType\n },\n\n /**\n * #getter\n */\n get rendererTypeName() {\n const name = self.rendererTypeNameSimple\n const rendererType = rendererTypes.get(name)\n if (!rendererType) {\n throw new Error(`unknown renderer ${name}`)\n }\n return rendererType\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get needsScalebar() {\n return (\n self.rendererTypeName === 'MultiXYPlotRenderer' ||\n self.rendererTypeName === 'MultiRowXYPlotRenderer' ||\n self.rendererTypeName === 'MultiLineRenderer' ||\n self.rendererTypeName === 'MultiRowLineRenderer'\n )\n },\n /**\n * #getter\n */\n get needsFullHeightScalebar() {\n return (\n self.rendererTypeName === 'MultiXYPlotRenderer' ||\n self.rendererTypeName === 'MultiLineRenderer'\n )\n },\n /**\n * #getter\n */\n get isMultiRow() {\n return (\n self.rendererTypeName === 'MultiRowXYPlotRenderer' ||\n self.rendererTypeName === 'MultiRowLineRenderer' ||\n self.rendererTypeName === 'MultiDensityRenderer'\n )\n },\n /**\n * #getter\n * can be used to give it a \"color scale\" like a R heatmap, not\n * implemented like this yet but flag can be used for this\n */\n get needsCustomLegend() {\n return self.rendererTypeName === 'MultiDensityRenderer'\n },\n\n get canHaveFill() {\n return (\n self.rendererTypeName === 'MultiXYPlotRenderer' ||\n self.rendererTypeName === 'MultiRowXYPlotRenderer'\n )\n },\n /**\n * #getter\n * the multirowxy and multiline don't need to use colors on the legend\n * boxes since their track is drawn with the color. sort of a stylistic\n * choice\n */\n get renderColorBoxes() {\n return !(\n self.rendererTypeName === 'MultiRowLineRenderer' ||\n self.rendererTypeName === 'MultiRowXYPlotRenderer'\n )\n },\n /**\n * #getter\n * positions multi-row below the tracklabel even if using overlap\n * tracklabels for everything else\n */\n get prefersOffset() {\n return this.isMultiRow\n },\n /**\n * #getter\n */\n get sources() {\n const sources = Object.fromEntries(\n self.sourcesVolatile?.map(s => [s.name, s]) || [],\n )\n const iter = self.layout.length ? self.layout : self.sourcesVolatile\n return iter\n ?.map(s => ({\n ...sources[s.name],\n ...s,\n }))\n .map((s, i) => ({\n ...s,\n color:\n s.color ||\n (!this.isMultiRow ? colors[i] || randomColor() : 'blue'),\n }))\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get rowHeight() {\n const { sources, height, isMultiRow } = self\n return isMultiRow ? height / (sources?.length || 1) : height\n },\n /**\n * #getter\n */\n get rowHeightTooSmallForScalebar() {\n return this.rowHeight < 70\n },\n\n /**\n * #getter\n */\n get useMinimalTicks() {\n return (\n getConf(self, 'minimalTicks') || this.rowHeightTooSmallForScalebar\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get ticks() {\n const { scaleType, domain, isMultiRow, rowHeight, useMinimalTicks } =\n self\n\n if (!domain) {\n return undefined\n }\n\n const offset = isMultiRow ? 0 : YSCALEBAR_LABEL_OFFSET\n const ticks = axisPropsFromTickScale(\n getScale({\n scaleType,\n domain,\n range: [rowHeight - offset, offset],\n inverted: getConf(self, 'inverted') as boolean,\n }),\n 4,\n )\n return useMinimalTicks ? { ...ticks, values: domain } : ticks\n },\n\n /**\n * #getter\n */\n get colors() {\n return [\n 'red',\n 'blue',\n 'green',\n 'orange',\n 'purple',\n 'cyan',\n 'pink',\n 'darkblue',\n 'darkred',\n 'pink',\n ]\n },\n }))\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #method\n */\n renderProps() {\n const superProps = superRenderProps()\n const {\n displayCrossHatches,\n filters,\n height,\n resolution,\n rpcDriverName,\n scaleOpts,\n stats,\n sources,\n ticks,\n rendererConfig: config,\n } = self\n return {\n ...superProps,\n notReady: superProps.notReady || !sources || !stats,\n displayModel: self,\n config,\n displayCrossHatches,\n filters,\n height,\n resolution,\n rpcDriverName,\n scaleOpts,\n sources,\n ticks,\n onMouseMove: (_: unknown, f: Feature) => {\n self.setFeatureUnderMouse(f)\n },\n onMouseLeave: () => {\n self.setFeatureUnderMouse(undefined)\n },\n }\n },\n\n /**\n * #getter\n */\n get hasResolution() {\n return self.adapterCapabilities.includes('hasResolution')\n },\n\n /**\n * #getter\n */\n get hasGlobalStats() {\n return self.adapterCapabilities.includes('hasGlobalStats')\n },\n\n /**\n * #getter\n */\n get fillSetting() {\n if (self.filled) {\n return 0\n } else if (self.minSize === 1) {\n return 1\n } else {\n return 2\n }\n },\n }\n })\n .views(self => {\n const { trackMenuItems: superTrackMenuItems } = self\n const hasRenderings = getConf(self, 'defaultRendering')\n return {\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Score',\n subMenu: self.scoreTrackMenuItems(),\n },\n\n ...(self.canHaveFill\n ? [\n {\n label: 'Fill mode',\n subMenu: ['filled', 'no fill', 'no fill w/ emphasis'].map(\n (elt, idx) => ({\n label: elt,\n type: 'radio',\n checked: self.fillSetting === idx,\n onClick: () => {\n self.setFill(idx)\n },\n }),\n ),\n },\n ]\n : []),\n\n ...(self.needsScalebar\n ? [\n {\n type: 'checkbox',\n label: 'Draw cross hatches',\n checked: self.displayCrossHatchesSetting,\n onClick: () => {\n self.toggleCrossHatches()\n },\n },\n ]\n : []),\n ...(hasRenderings\n ? [\n {\n label: 'Renderer type',\n subMenu: [\n 'xyplot',\n 'multirowxy',\n 'multirowdensity',\n 'multiline',\n 'multirowline',\n ].map(key => ({\n label: key,\n type: 'radio',\n checked: self.rendererTypeNameSimple === key,\n onClick: () => {\n self.setRendererType(key)\n },\n })),\n },\n ]\n : []),\n\n {\n label: 'Edit colors/arrangement...',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n SetColorDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }\n })\n .actions(self => {\n const { renderSvg: superRenderSvg } = self\n return {\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n const { quantitativeStatsAutorun } = await import('../../util')\n quantitativeStatsAutorun(self)\n addDisposer(\n self,\n autorun(async () => {\n const { rpcManager } = getSession(self)\n const { adapterConfig } = self\n const sessionId = getRpcSessionId(self)\n const sources = (await rpcManager.call(\n sessionId,\n 'MultiWiggleGetSources',\n {\n sessionId,\n adapterConfig,\n },\n )) as Source[]\n if (isAlive(self)) {\n self.setSources(sources)\n }\n }),\n )\n })()\n },\n\n /**\n * #action\n */\n async renderSvg(opts: ExportSvgDisplayOptions) {\n const { renderSvg } = await import('./renderSvg')\n return renderSvg(self, opts, superRenderSvg)\n },\n }\n })\n}\n\nexport type WiggleDisplayStateModel = ReturnType<typeof stateModelFactory>\nexport type WiggleDisplayModel = Instance<WiggleDisplayStateModel>\n\nexport default stateModelFactory\n","import { observer } from 'mobx-react'\nimport React, { useRef } from 'react'\n\nimport { Region } from '@jbrowse/core/util/types'\nimport { SimpleFeature, Feature } from '@jbrowse/core/util'\nimport { PrerenderedCanvas } from '@jbrowse/core/ui'\nimport { Source } from './util'\n\nconst MultiWiggleRendering = observer(function (props: {\n regions: Region[]\n features: Map<string, Feature>\n bpPerPx: number\n width: number\n height: number\n blockKey: string\n sources: Source[]\n displayModel?: { isMultiRow: boolean }\n onMouseLeave?: (event: React.MouseEvent) => void\n onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void\n onFeatureClick?: (event: React.MouseEvent, arg?: Feature) => void\n}) {\n const {\n regions,\n features,\n bpPerPx,\n width,\n height,\n sources,\n onMouseLeave = () => {},\n onMouseMove = () => {},\n onFeatureClick = () => {},\n displayModel,\n } = props\n const region = regions[0]!\n const ref = useRef<HTMLDivElement>(null)\n const { isMultiRow } = displayModel || {}\n\n function getFeatureUnderMouse(eventClientX: number, eventClientY: number) {\n if (!ref.current) {\n return\n }\n const rect = ref.current.getBoundingClientRect()\n const offsetX = eventClientX - rect.left\n const offsetY = eventClientY - rect.top\n const source = sources[Math.floor((offsetY / height) * sources.length)]\n if (!source) {\n return\n }\n const px = region.reversed ? width - offsetX : offsetX\n const mouseoverBp = region.start + bpPerPx * px\n let featureUnderMouse: Feature | undefined\n if (isMultiRow) {\n for (const feature of features.values()) {\n if (feature.get('source') !== source.name) {\n continue\n }\n if (\n mouseoverBp <= feature.get('end') + bpPerPx &&\n mouseoverBp >= feature.get('start')\n ) {\n featureUnderMouse = feature\n break\n }\n }\n } else {\n const featuresUnderMouse = []\n for (const feature of features.values()) {\n if (\n mouseoverBp <= feature.get('end') + bpPerPx &&\n mouseoverBp >= feature.get('start')\n ) {\n featuresUnderMouse.push(feature)\n }\n }\n\n if (featuresUnderMouse.length) {\n const pos = Math.floor(mouseoverBp)\n featureUnderMouse = new SimpleFeature({\n uniqueId: 'mouseoverfeat',\n sources: Object.fromEntries(\n featuresUnderMouse\n .map(f => f.toJSON())\n .map(f => {\n const { refName, start, end, source, ...rest } = f\n return [source, rest]\n }),\n ),\n ...region,\n start: pos,\n end: pos + 1,\n })\n }\n }\n return featureUnderMouse\n }\n\n return (\n <div\n ref={ref}\n onMouseMove={event => {\n const { clientX, clientY } = event\n const featureUnderMouse = getFeatureUnderMouse(clientX, clientY)\n onMouseMove(event, featureUnderMouse)\n }}\n onClick={event => {\n const { clientX, clientY } = event\n const featureUnderMouse = getFeatureUnderMouse(clientX, clientY)\n onFeatureClick(event, featureUnderMouse)\n }}\n onMouseLeave={event => {\n onMouseLeave(event)\n }}\n style={{\n overflow: 'visible',\n position: 'relative',\n height,\n }}\n >\n <PrerenderedCanvas {...props} />\n </div>\n )\n})\n\nexport default MultiWiggleRendering\n","import { groupBy, Feature } from '@jbrowse/core/util'\nimport { drawXY } from '../drawXY'\nimport { YSCALEBAR_LABEL_OFFSET } from '../util'\n\nimport WiggleBaseRenderer, {\n MultiRenderArgsDeserialized as MultiArgs,\n} from '../WiggleBaseRenderer'\n\nexport default class MultiXYPlotRenderer extends WiggleBaseRenderer {\n // @ts-expect-error\n async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {\n const { sources, features } = props\n const groups = groupBy(features.values(), f => f.get('source'))\n let feats = [] as Feature[]\n for (const source of sources) {\n const features = groups[source.name] || []\n const { reducedFeatures } = drawXY(ctx, {\n ...props,\n features,\n offset: YSCALEBAR_LABEL_OFFSET,\n colorCallback: () => source.color || 'blue',\n })\n feats = feats.concat(reducedFeatures)\n }\n return { reducedFeatures: feats }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config MultiXYPlotRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'MultiXYPlotRenderer',\n {\n /**\n * #slot\n */\n filled: {\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n /**\n * #slot\n */\n summaryScoreMode: {\n type: 'stringEnum',\n model: types.enumeration('Score type', ['max', 'min', 'avg', 'whiskers']),\n description:\n 'choose whether to use max/min/average or whiskers which combines all three into the same rendering',\n defaultValue: 'avg',\n },\n /**\n * #slot\n */\n minSize: {\n type: 'number',\n defaultValue: 0,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\nexport default configSchema\n","import { groupBy, Feature } from '@jbrowse/core/util'\nimport { drawXY } from '../drawXY'\n\nimport WiggleBaseRenderer, {\n MultiRenderArgsDeserialized as MultiArgs,\n} from '../WiggleBaseRenderer'\n\nexport default class MultiXYPlotRenderer extends WiggleBaseRenderer {\n // @ts-expect-error\n async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {\n const { bpPerPx, sources, regions, features } = props\n const region = regions[0]!\n const groups = groupBy(features.values(), f => f.get('source'))\n const height = props.height / sources.length\n const width = (region.end - region.start) / bpPerPx\n let feats = [] as Feature[]\n ctx.save()\n sources.forEach(source => {\n const { reducedFeatures } = drawXY(ctx, {\n ...props,\n features: groups[source.name] || [],\n height,\n colorCallback: () => source.color || 'blue',\n })\n ctx.strokeStyle = 'rgba(200,200,200,0.8)'\n ctx.beginPath()\n ctx.moveTo(0, height)\n ctx.lineTo(width, height)\n ctx.stroke()\n ctx.translate(0, height)\n feats = feats.concat(reducedFeatures)\n })\n ctx.restore()\n return { reducedFeatures: feats }\n }\n}\n","import { types } from 'mobx-state-tree'\n\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config MultiRowXYPlotRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'MultiRowXYPlotRenderer',\n {\n /**\n * #slot\n */\n filled: {\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n /**\n * #slot\n */\n summaryScoreMode: {\n type: 'stringEnum',\n model: types.enumeration('Score type', ['max', 'min', 'avg', 'whiskers']),\n description:\n 'choose whether to use max/min/average or whiskers which combines all three into the same rendering',\n defaultValue: 'whiskers',\n },\n /**\n * #slot\n */\n minSize: {\n type: 'number',\n defaultValue: 0,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config MultiDensityRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'MultiDensityRenderer',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import { groupBy, Feature } from '@jbrowse/core/util'\nimport WiggleBaseRenderer, {\n MultiRenderArgsDeserialized as MultiArgs,\n} from '../WiggleBaseRenderer'\nimport { drawDensity } from '../drawDensity'\n\nexport default class MultiXYPlotRenderer extends WiggleBaseRenderer {\n // @ts-expect-error\n async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {\n const { sources, features } = props\n const groups = groupBy(features.values(), f => f.get('source'))\n const height = props.height / sources.length\n let feats = [] as Feature[]\n ctx.save()\n sources.forEach(source => {\n const features = groups[source.name] || []\n const { reducedFeatures } = drawDensity(ctx, {\n ...props,\n features,\n height,\n })\n ctx.translate(0, height)\n feats = feats.concat(reducedFeatures)\n })\n ctx.restore()\n return { reducedFeatures: feats }\n }\n}\n","import { groupBy, Feature } from '@jbrowse/core/util'\nimport { drawLine } from '../drawLine'\n\nimport WiggleBaseRenderer, {\n MultiRenderArgsDeserialized as MultiArgs,\n} from '../WiggleBaseRenderer'\n\nexport default class MultiLineRenderer extends WiggleBaseRenderer {\n // @ts-expect-error\n async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {\n const { sources, features } = props\n const groups = groupBy(features.values(), f => f.get('source'))\n let feats = [] as Feature[]\n sources.forEach(source => {\n const { reducedFeatures } = drawLine(ctx, {\n ...props,\n features: groups[source.name] || [],\n colorCallback: () => source.color || 'blue',\n })\n feats = feats.concat(reducedFeatures)\n })\n return { reducedFeatures: feats }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n/**\n * #config MultiLineRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'MultiLineRenderer',\n {\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n /**\n * #slot\n */\n summaryScoreMode: {\n type: 'stringEnum',\n model: types.enumeration('Score type', ['max', 'min', 'avg', 'whiskers']),\n description:\n 'choose whether to use max/min/average or whiskers which combines all three into the same rendering',\n defaultValue: 'avg',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\nexport default configSchema\n","import { groupBy, Feature } from '@jbrowse/core/util'\nimport { drawLine } from '../drawLine'\n\nimport WiggleBaseRenderer, {\n MultiRenderArgsDeserialized as MultiArgs,\n} from '../WiggleBaseRenderer'\n\nexport default class MultiRowLineRenderer extends WiggleBaseRenderer {\n // @ts-expect-error\n async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {\n const { bpPerPx, sources, regions, features } = props\n const region = regions[0]!\n const groups = groupBy(features.values(), f => f.get('source'))\n const height = props.height / sources.length\n const width = (region.end - region.start) / bpPerPx\n let feats = [] as Feature[]\n ctx.save()\n sources.forEach(source => {\n const { reducedFeatures } = drawLine(ctx, {\n ...props,\n features: groups[source.name] || [],\n height,\n colorCallback: () => source.color || 'blue',\n })\n ctx.strokeStyle = 'rgba(200,200,200,0.8)'\n ctx.beginPath()\n ctx.moveTo(0, height)\n ctx.lineTo(width, height)\n ctx.stroke()\n ctx.translate(0, height)\n feats = feats.concat(reducedFeatures)\n })\n ctx.restore()\n return { reducedFeatures: feats }\n }\n}\n","import { types } from 'mobx-state-tree'\n\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport baseWiggleRendererConfigSchema from '../configSchema'\n\n/**\n * #config MultiRowLineRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'MultiRowLineRenderer',\n {\n /**\n * #slot\n */\n displayCrossHatches: {\n type: 'boolean',\n description: 'choose to draw cross hatches (sideways lines)',\n defaultValue: false,\n },\n /**\n * #slot\n */\n summaryScoreMode: {\n type: 'stringEnum',\n model: types.enumeration('Score type', ['max', 'min', 'avg', 'whiskers']),\n description:\n 'choose whether to use max/min/average or whiskers which combines all three into the same rendering',\n defaultValue: 'avg',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseWiggleRendererConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport default configSchema\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { getSession, isSessionWithAddTracks } from '@jbrowse/core/util'\nimport { HierarchicalTrackSelectorModel } from '@jbrowse/plugin-data-management'\n\nconst ConfirmDialog = lazy(() => import('./ConfirmDialog'))\n\nexport default function CreateMultiWiggleExtensionF(pm: PluginManager) {\n pm.addToExtensionPoint(\n 'TrackSelector-multiTrackMenuItems',\n (items: unknown[], props: Record<string, unknown>) => {\n const { session } = props\n return [\n ...items,\n ...(isSessionWithAddTracks(session)\n ? [\n {\n label: 'Create multi-wiggle track',\n onClick: (model: HierarchicalTrackSelectorModel) => {\n const tracks = model.selection\n const trackIds = tracks.map(c => readConfObject(c, 'name'))\n function makeTrack(arg: { name: string }) {\n const subadapters = tracks\n .map(c => readConfObject(c, 'adapter'))\n .map((c, idx) => ({ ...c, source: trackIds[idx] }))\n const assemblyNames = [\n ...new Set(\n tracks.flatMap(c => readConfObject(c, 'assemblyNames')),\n ),\n ]\n const now = +Date.now()\n const trackId = `multitrack-${now}-sessionTrack`\n\n const session = getSession(model)\n if (isSessionWithAddTracks(session)) {\n session.addTrackConf({\n type: 'MultiQuantitativeTrack',\n trackId,\n name: arg.name,\n assemblyNames,\n adapter: {\n type: 'MultiWiggleAdapter',\n subadapters,\n },\n })\n model.view.showTrack(trackId)\n }\n }\n getSession(model).queueDialog(handleClose => [\n ConfirmDialog,\n {\n tracks,\n onClose: (arg: boolean, arg1?: { name: string }) => {\n if (arg && arg1) {\n makeTrack(arg1)\n }\n handleClose()\n },\n },\n ])\n },\n },\n ]\n : []),\n ]\n },\n )\n}\n","import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\nimport { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods'\nimport { renameRegionsIfNeeded, Region } from '@jbrowse/core/util'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\nexport class MultiWiggleGetSources extends RpcMethodType {\n name = 'MultiWiggleGetSources'\n\n async deserializeArguments(args: any, rpcDriverClassName: string) {\n const l = await super.deserializeArguments(args, rpcDriverClassName)\n return {\n ...l,\n filters: args.filters\n ? new SerializableFilterChain({\n filters: args.filters,\n })\n : undefined,\n }\n }\n\n async serializeArguments(\n args: RenderArgs & {\n signal?: AbortSignal\n statusCallback?: (arg: string) => void\n },\n rpcDriverClassName: string,\n ) {\n const pm = this.pluginManager\n const assemblyManager = pm.rootModel?.session?.assemblyManager\n if (!assemblyManager) {\n return args\n }\n\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, {\n ...args,\n filters: args.filters?.toJSON().filters,\n })\n\n return super.serializeArguments(renamedArgs, rpcDriverClassName)\n }\n\n async execute(\n args: {\n adapterConfig: AnyConfigurationModel\n signal?: RemoteAbortSignal\n sessionId: string\n headers?: Record<string, string>\n regions: Region[]\n bpPerPx: number\n },\n rpcDriverClassName: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(\n args,\n rpcDriverClassName,\n )\n const { regions, adapterConfig, sessionId } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n\n // @ts-expect-error\n return dataAdapter.getSources(regions, deserializedArgs)\n }\n}\n","import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\nimport { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods'\nimport { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { Region, renameRegionsIfNeeded } from '@jbrowse/core/util'\n\nexport class WiggleGetMultiRegionQuantitativeStats extends RpcMethodType {\n name = 'WiggleGetMultiRegionQuantitativeStats'\n\n async deserializeArguments(args: any, rpcDriverClassName: string) {\n const l = await super.deserializeArguments(args, rpcDriverClassName)\n return {\n ...l,\n filters: args.filters\n ? new SerializableFilterChain({\n filters: args.filters,\n })\n : undefined,\n }\n }\n\n async serializeArguments(\n args: RenderArgs & {\n signal?: AbortSignal\n statusCallback?: (arg: string) => void\n },\n rpcDriverClassName: string,\n ) {\n const pm = this.pluginManager\n const assemblyManager = pm.rootModel?.session?.assemblyManager\n if (!assemblyManager) {\n return args\n }\n\n const renamedArgs = await renameRegionsIfNeeded(assemblyManager, {\n ...args,\n filters: args.filters?.toJSON().filters,\n })\n\n return super.serializeArguments(renamedArgs, rpcDriverClassName)\n }\n\n async execute(\n args: {\n adapterConfig: Record<string, unknown>\n signal?: RemoteAbortSignal\n sessionId: string\n headers?: Record<string, string>\n regions: Region[]\n bpPerPx: number\n },\n rpcDriverClassName: string,\n ) {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(\n args,\n rpcDriverClassName,\n )\n const { regions, adapterConfig, sessionId } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n\n // @ts-expect-error\n return dataAdapter.getMultiRegionQuantitativeStats(\n regions,\n deserializedArgs,\n )\n }\n}\n","import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'\nimport SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain'\nimport { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\nimport { QuantitativeStats } from '@jbrowse/core/util/stats'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\nexport class WiggleGetGlobalQuantitativeStats extends RpcMethodType {\n name = 'WiggleGetGlobalQuantitativeStats'\n\n async deserializeArguments(args: any, rpcDriverClassName: string) {\n const l = await super.deserializeArguments(args, rpcDriverClassName)\n return {\n ...l,\n filters: args.filters\n ? new SerializableFilterChain({\n filters: args.filters,\n })\n : undefined,\n }\n }\n\n async execute(\n args: {\n adapterConfig: AnyConfigurationModel\n signal?: RemoteAbortSignal\n headers?: Record<string, string>\n sessionId: string\n },\n rpcDriverClassName: string,\n ): Promise<QuantitativeStats> {\n const pm = this.pluginManager\n const deserializedArgs = await this.deserializeArguments(\n args,\n rpcDriverClassName,\n )\n const { adapterConfig, sessionId } = deserializedArgs\n const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig)\n\n // @ts-expect-error\n return dataAdapter.getGlobalStats(deserializedArgs)\n }\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n AdapterGuesser,\n TrackTypeGuesser,\n getFileName,\n} from '@jbrowse/core/util/tracks'\n\n// locals\nimport WiggleBaseRenderer from './WiggleBaseRenderer'\n\nimport BigWigAdapterF from './BigWigAdapter'\nimport QuantitativeTrackF from './QuantitativeTrack'\nimport MultiQuantitativeTrackF from './MultiQuantitativeTrack'\nimport MultiWiggleAdapterF from './MultiWiggleAdapter'\nimport DensityRendererF from './DensityRenderer'\nimport XYPlotRendererF from './XYPlotRenderer'\nimport LinePlotRendererF from './LinePlotRenderer'\nimport LinearWiggleDisplayF from './LinearWiggleDisplay'\nimport MultiLinearWiggleDisplayF from './MultiLinearWiggleDisplay'\nimport MultiXYPlotRendererF from './MultiXYPlotRenderer'\nimport MultiRowXYPlotRendererF from './MultiRowXYPlotRenderer'\nimport MultiDensityRendererF from './MultiDensityRenderer'\nimport MultiLineRendererF from './MultiLineRenderer'\nimport MultiRowLineRendererF from './MultiRowLineRenderer'\nimport CreateMultiWiggleExtensionF from './CreateMultiWiggleExtension'\nimport MultiWiggleAddTrackWorkflowF from './MultiWiggleAddTrackWorkflow'\n\nimport * as utils from './util'\n\nimport {\n WiggleGetGlobalQuantitativeStats,\n WiggleGetMultiRegionQuantitativeStats,\n MultiWiggleGetSources,\n} from './WiggleRPC/rpcMethods'\n\nimport {\n ReactComponent as LinearWiggleDisplayReactComponent,\n modelFactory as linearWiggleDisplayModelFactory,\n} from './LinearWiggleDisplay'\n\nimport {\n ReactComponent as XYPlotRendererReactComponent,\n configSchema as xyPlotRendererConfigSchema,\n XYPlotRenderer,\n} from './XYPlotRenderer'\n\nexport default class WigglePlugin extends Plugin {\n name = 'WigglePlugin'\n\n install(pm: PluginManager) {\n MultiWiggleAdapterF(pm)\n BigWigAdapterF(pm)\n QuantitativeTrackF(pm)\n MultiQuantitativeTrackF(pm)\n LinearWiggleDisplayF(pm)\n MultiLinearWiggleDisplayF(pm)\n LinePlotRendererF(pm)\n XYPlotRendererF(pm)\n DensityRendererF(pm)\n MultiXYPlotRendererF(pm)\n MultiRowXYPlotRendererF(pm)\n MultiDensityRendererF(pm)\n MultiLineRendererF(pm)\n MultiRowLineRendererF(pm)\n MultiWiggleAddTrackWorkflowF(pm)\n CreateMultiWiggleExtensionF(pm)\n\n pm.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (cb: AdapterGuesser) => {\n return (file: FileLocation, index?: FileLocation, hint?: string) => {\n const regexGuess = /\\.(bw|bigwig)$/i\n const adapterName = 'BigWigAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n bigWigLocation: file,\n }\n\n if (regexGuess.test(fileName) && !hint) {\n return obj\n }\n if (hint === adapterName) {\n return obj\n }\n\n return cb(file, index, hint)\n }\n },\n )\n pm.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'BigWigAdapter') {\n return 'QuantitativeTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n\n pm.addRpcMethod(() => new WiggleGetGlobalQuantitativeStats(pm))\n pm.addRpcMethod(() => new WiggleGetMultiRegionQuantitativeStats(pm))\n pm.addRpcMethod(() => new MultiWiggleGetSources(pm))\n }\n\n exports = {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n XYPlotRenderer,\n WiggleBaseRenderer,\n linearWiggleDisplayModelFactory,\n xyPlotRendererConfigSchema,\n utils,\n }\n}\n\nexport * from './util'\n\nexport { default as WiggleRendering } from './WiggleRendering'\nexport {\n Tooltip,\n ReactComponent as LinearWiggleDisplayReactComponent,\n modelFactory as linearWiggleDisplayModelFactory,\n} from './LinearWiggleDisplay'\nexport { type TooltipContentsComponent } from './Tooltip'\n\nexport { default as WiggleBaseRenderer } from './WiggleBaseRenderer'\n","import configSchema from './configSchema'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nexport default function MultiWiggleAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'MultiWiggleAdapter',\n displayName: 'Multi-wiggle adapter',\n configSchema,\n adapterCapabilities: [\n 'hasResolution',\n 'hasLocalStats',\n 'hasGlobalStats',\n ],\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./MultiWiggleAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function BigWigAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BigWigAdapter',\n displayName: 'BigWig adapter',\n configSchema,\n adapterCapabilities: [\n 'hasResolution',\n 'hasLocalStats',\n 'hasGlobalStats',\n ],\n getAdapterClass: () => import('./BigWigAdapter').then(r => r.default),\n }),\n )\n}\n","import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaF from './configSchema'\n\nexport default function QuantitativeTrackF(pluginManager: PluginManager) {\n pluginManager.addTrackType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new TrackType({\n name: 'QuantitativeTrack',\n displayName: 'Quantitative track',\n configSchema,\n stateModel: createBaseTrackModel(\n pluginManager,\n 'QuantitativeTrack',\n configSchema,\n ),\n })\n })\n}\n","import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaF from './configSchema'\n\nexport default function MultiQuantitativeTrackF(pluginManager: PluginManager) {\n pluginManager.addTrackType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new TrackType({\n name: 'MultiQuantitativeTrack',\n displayName: 'Multi-quantitative track',\n configSchema,\n stateModel: createBaseTrackModel(\n pluginManager,\n 'MultiQuantitativeTrack',\n configSchema,\n ),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes/models'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config MultiQuantitativeTrack\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) => {\n return ConfigurationSchema(\n 'MultiQuantitativeTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n}\n\nexport default configSchema\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\nimport configSchemaFactory from './models/configSchema'\nimport modelFactory from './models/model'\nimport { lazy } from 'react'\n\nexport default function LinearWiggleDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n const stateModel = modelFactory(pluginManager, configSchema)\n return new DisplayType({\n name: 'LinearWiggleDisplay',\n displayName: 'Wiggle display',\n configSchema,\n stateModel,\n trackType: 'QuantitativeTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: lazy(() => import('./components/WiggleDisplayComponent')),\n })\n })\n}\n\nexport { default as Tooltip } from './components/Tooltip'\nexport { default as ReactComponent } from './components/WiggleDisplayComponent'\nexport { default as modelFactory } from './models/model'\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport sharedWiggleConfigFactory from '../../shared/configShared'\n\n/**\n * #config LinearWiggleDisplay\n * extends\n * - [SharedWiggleDisplay](../sharedwiggledisplay)\n */\nexport default function WiggleConfigFactory(pluginManager: PluginManager) {\n const XYPlotRendererConfigSchema =\n pluginManager.getRendererType('XYPlotRenderer')!.configSchema\n const DensityRendererConfigSchema =\n pluginManager.getRendererType('DensityRenderer')!.configSchema\n const LinePlotRendererConfigSchema =\n pluginManager.getRendererType('LinePlotRenderer')!.configSchema\n\n return ConfigurationSchema(\n 'LinearWiggleDisplay',\n {\n /**\n * #slot\n */\n defaultRendering: {\n type: 'stringEnum',\n model: types.enumeration('Rendering', ['density', 'xyplot', 'line']),\n defaultValue: 'xyplot',\n },\n /**\n * #slot\n */\n renderers: ConfigurationSchema('RenderersConfiguration', {\n DensityRenderer: DensityRendererConfigSchema,\n XYPlotRenderer: XYPlotRendererConfigSchema,\n LinePlotRenderer: LinePlotRendererConfigSchema,\n }),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: sharedWiggleConfigFactory(),\n explicitlyTyped: true,\n },\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\n\nimport configSchemaFactory from './models/configSchema'\nimport modelFactory from './models/model'\nimport { lazy } from 'react'\n\nexport default function MultiLinearWiggleDisplayF(\n pluginManager: PluginManager,\n) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'MultiLinearWiggleDisplay',\n displayName: 'Multi-wiggle display',\n configSchema,\n stateModel: modelFactory(pluginManager, configSchema),\n trackType: 'MultiQuantitativeTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: lazy(() => import('./components/WiggleDisplayComponent')),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport sharedWiggleConfigFactory from '../../shared/configShared'\n\n/**\n * #config MultiLinearWiggleDisplay\n * extends\n * - [SharedWiggleDisplay](../sharedwiggledisplay)\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default function WiggleConfigFactory(pluginManager: PluginManager) {\n const MultiXYPlotRendererConfigSchema = pluginManager.getRendererType(\n 'MultiXYPlotRenderer',\n )!.configSchema\n const MultiDensityRendererConfigSchema = pluginManager.getRendererType(\n 'MultiDensityRenderer',\n )!.configSchema\n const MultiRowXYPlotRendererConfigSchema = pluginManager.getRendererType(\n 'MultiRowXYPlotRenderer',\n )!.configSchema\n const MultiLineRendererConfigSchema =\n pluginManager.getRendererType('MultiLineRenderer')!.configSchema\n const MultiRowLineRendererConfigSchema = pluginManager.getRendererType(\n 'MultiRowLineRenderer',\n )!.configSchema\n\n return ConfigurationSchema(\n 'MultiLinearWiggleDisplay',\n {\n /**\n * #slot\n */\n defaultRendering: {\n type: 'stringEnum',\n model: types.enumeration('Rendering', [\n 'multirowxy',\n 'xyplot',\n 'multirowdensity',\n 'multiline',\n 'multirowline',\n ]),\n defaultValue: 'multirowxy',\n },\n\n /**\n * #slot\n */\n renderers: ConfigurationSchema('RenderersConfiguration', {\n MultiXYPlotRenderer: MultiXYPlotRendererConfigSchema,\n MultiDensityRenderer: MultiDensityRendererConfigSchema,\n MultiRowXYPlotRenderer: MultiRowXYPlotRendererConfigSchema,\n MultiLineRenderer: MultiLineRendererConfigSchema,\n MultiRowLineRenderer: MultiRowLineRendererConfigSchema,\n }),\n\n /**\n * #slot\n */\n height: {\n type: 'number',\n defaultValue: 200,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: sharedWiggleConfigFactory(),\n explicitlyTyped: true,\n },\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\nimport ReactComponent from '../WiggleRendering'\nimport LinePlotRenderer from './LinePlotRenderer'\n\nexport default function LinePlotRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new LinePlotRenderer({\n name: 'LinePlotRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import ReactComponent from '../WiggleRendering'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport XYPlotRenderer from './XYPlotRenderer'\nimport configSchema from './configSchema'\n\nexport default function XYPlotRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new XYPlotRenderer({\n name: 'XYPlotRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n\nexport { default as XYPlotRenderer } from './XYPlotRenderer'\nexport { default as ReactComponent } from '../WiggleRendering'\nexport { default as configSchema } from './configSchema'\n","import configSchema from './configSchema'\n\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport DensityRenderer from './DensityRenderer'\nimport ReactComponent from '../WiggleRendering'\n\nexport default function DensityRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new DensityRenderer({\n name: 'DensityRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport ReactComponent from '../MultiWiggleRendering'\nimport MultiXYPlotRenderer from './MultiXYPlotRenderer'\nimport configSchema from './configSchema'\n\nexport default function MultiXYPlotRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new MultiXYPlotRenderer({\n name: 'MultiXYPlotRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport ReactComponent from '../MultiWiggleRendering'\nimport MultiRowXYPlotRenderer from './MultiRowXYPlotRenderer'\nimport configSchema from './configSchema'\n\nexport default function MultiRowXYPlotRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new MultiRowXYPlotRenderer({\n name: 'MultiRowXYPlotRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\nimport ReactComponent from '../MultiWiggleRendering'\nimport MultiDensityRenderer from './MultiDensityRenderer'\n\nexport default function MultiDensityRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new MultiDensityRenderer({\n name: 'MultiDensityRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport ReactComponent from '../MultiWiggleRendering'\nimport MultiLineRenderer from './MultiLineRenderer'\nimport configSchema from './configSchema'\n\nexport default function MultiLineRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new MultiLineRenderer({\n name: 'MultiLineRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport ReactComponent from '../MultiWiggleRendering'\nimport MultiRowLineRenderer from './MultiRowLineRenderer'\nimport configSchema from './configSchema'\n\nexport default function MultiRowLineRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new MultiRowLineRenderer({\n name: 'MultiRowLineRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AddTrackWorkflowType } from '@jbrowse/core/pluggableElementTypes'\nimport { types } from 'mobx-state-tree'\n\n// locals\nimport { lazy } from 'react'\n\nexport default function MultiWiggleAddTrackWorkflowF(pm: PluginManager) {\n pm.addAddTrackWorkflowType(\n () =>\n new AddTrackWorkflowType({\n name: 'Multi-wiggle track',\n ReactComponent: lazy(() => import('./AddTrackWorkflow')),\n stateModel: types.model({}),\n }),\n )\n}\n","import React from 'react'\nimport { useTheme } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { Axis, LEFT, RIGHT } from 'react-d3-axis-mod'\nimport type { axisPropsFromTickScale } from 'react-d3-axis-mod'\n\ntype Ticks = ReturnType<typeof axisPropsFromTickScale>\n\nconst YScaleBar = observer(function ({\n model,\n orientation,\n}: {\n model: { ticks?: Ticks }\n orientation?: string\n}) {\n const { ticks } = model\n const theme = useTheme()\n return ticks ? (\n <Axis\n {...ticks}\n shadow={2}\n format={(n: number) => n}\n style={{ orient: orientation === 'left' ? LEFT : RIGHT }}\n bg={theme.palette.background.default}\n fg={theme.palette.text.primary}\n />\n ) : null\n})\n\nexport default YScaleBar\n","import {\n scaleLinear,\n scaleLog,\n scaleQuantize,\n} from '@mui/x-charts-vendor/d3-scale'\nimport { autorun } from 'mobx'\nimport {\n isAbortException,\n getSession,\n getContainingView,\n} from '@jbrowse/core/util'\nimport { QuantitativeStats } from '@jbrowse/core/util/stats'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { addDisposer, isAlive } from 'mobx-state-tree'\n\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport { AnyConfigurationModel, getConf } from '@jbrowse/core/configuration'\n\ntype LGV = LinearGenomeViewModel\n\nexport const YSCALEBAR_LABEL_OFFSET = 5\n\nexport interface ScaleOpts {\n domain: number[]\n range: number[]\n scaleType: string\n pivotValue?: number\n inverted?: boolean\n}\n\nexport interface Source {\n baseUri?: string\n name: string\n color?: string\n group?: string\n}\n\n/**\n * produces a d3-scale from arguments. applies a \"nice domain\" adjustment\n *\n * @param object - containing attributes\n * - domain [min,max]\n * - range [min,max]\n * - bounds [min,max]\n * - scaleType (linear or log)\n * - pivotValue (number)\n * - inverted (boolean)\n */\nexport function getScale({\n domain = [],\n range = [],\n scaleType,\n pivotValue,\n inverted,\n}: ScaleOpts) {\n let scale:\n | ReturnType<typeof scaleLinear<number>>\n | ReturnType<typeof scaleLog<number>>\n | ReturnType<typeof scaleQuantize<number>>\n const [min, max] = domain\n if (min === undefined || max === undefined) {\n throw new Error('invalid domain')\n }\n if (scaleType === 'linear') {\n scale = scaleLinear()\n } else if (scaleType === 'log') {\n scale = scaleLog().base(2)\n } else if (scaleType === 'quantize') {\n scale = scaleQuantize()\n } else {\n throw new Error('undefined scaleType')\n }\n scale.domain(pivotValue !== undefined ? [min, pivotValue, max] : [min, max])\n scale.nice()\n\n const [rangeMin, rangeMax] = range\n if (rangeMin === undefined || rangeMax === undefined) {\n throw new Error('invalid range')\n }\n scale.range(inverted ? range.slice().reverse() : range)\n return scale\n}\n/**\n * gets the origin for drawing the graph. for linear this is 0, for log this is arbitrarily set to log(1)==0\n *\n * @param scaleType -\n */\nexport function getOrigin(scaleType: string /* , pivot, stats */) {\n // if (pivot) {\n // if (pivot === 'mean') {\n // return stats.scoreMean || 0\n // }\n // if (pivot === 'zero') {\n // return 0\n // }\n // return parseFloat()\n // }\n // if (scaleType === 'z_score') {\n // return stats.scoreMean || 0\n // }\n if (scaleType === 'log') {\n return 1\n }\n return 0\n}\n\n/**\n * produces a \"nice\" domain that actually rounds down to 0 for the min\n * or 0 to the max depending on if all values are positive or negative\n *\n * @param object - containing attributes\n * - domain [min,max]\n * - bounds [min,max]\n * - mean\n * - stddev\n * - scaleType (linear or log)\n */\nexport function getNiceDomain({\n scaleType,\n domain,\n bounds,\n}: {\n scaleType: string\n domain: readonly [number, number]\n bounds: readonly [number | undefined, number | undefined]\n}) {\n const [minScore, maxScore] = bounds\n let [min, max] = domain\n\n if (scaleType === 'linear') {\n if (max < 0) {\n max = 0\n }\n if (min > 0) {\n min = 0\n }\n }\n if (scaleType === 'log') {\n // for min>0 and max>1, set log min to 1, which works for most coverage\n // types tracks. if max is not >1, might be like raw p-values so then it'll\n // display negative values\n if (min >= 0 && max > 1) {\n min = 1\n }\n }\n\n if (minScore !== undefined && minScore !== Number.MIN_VALUE) {\n min = minScore\n }\n if (maxScore !== undefined && maxScore !== Number.MAX_VALUE) {\n max = maxScore\n }\n const getScaleType = (type: string) => {\n if (type === 'linear') {\n return scaleLinear()\n }\n if (type === 'log') {\n const scale = scaleLog()\n scale.base(2)\n return scale\n }\n if (type === 'quantize') {\n return scaleQuantize()\n }\n throw new Error(`undefined scaleType ${type}`)\n }\n const scale = getScaleType(scaleType)\n\n scale.domain([min, max])\n scale.nice()\n return scale.domain() as [number, number]\n}\n\nexport async function getQuantitativeStats(\n self: {\n adapterConfig: AnyConfigurationModel\n configuration: AnyConfigurationModel\n autoscaleType: string\n setMessage: (str: string) => void\n },\n opts: {\n headers?: Record<string, string>\n signal?: AbortSignal\n filters: string[]\n },\n): Promise<QuantitativeStats> {\n const { rpcManager } = getSession(self)\n const numStdDev = getConf(self, 'numStdDev') || 3\n const { adapterConfig, autoscaleType } = self\n const sessionId = getRpcSessionId(self)\n const params = {\n sessionId,\n adapterConfig,\n statusCallback: (message: string) => {\n if (isAlive(self)) {\n self.setMessage(message)\n }\n },\n ...opts,\n }\n\n if (autoscaleType === 'global' || autoscaleType === 'globalsd') {\n const results = (await rpcManager.call(\n sessionId,\n 'WiggleGetGlobalQuantitativeStats',\n params,\n )) as QuantitativeStats\n const { scoreMin, scoreMean, scoreStdDev } = results\n // globalsd uses heuristic to avoid unnecessary scoreMin<0\n // if the scoreMin is never less than 0\n // helps with most coverage bigwigs just being >0\n return autoscaleType === 'globalsd'\n ? {\n ...results,\n scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,\n scoreMax: scoreMean + numStdDev * scoreStdDev,\n }\n : results\n }\n if (autoscaleType === 'local' || autoscaleType === 'localsd') {\n const { dynamicBlocks, bpPerPx } = getContainingView(self) as LGV\n const results = (await rpcManager.call(\n sessionId,\n 'WiggleGetMultiRegionQuantitativeStats',\n {\n ...params,\n regions: dynamicBlocks.contentBlocks.map(region => {\n const { start, end } = region\n return {\n ...JSON.parse(JSON.stringify(region)),\n start: Math.floor(start),\n end: Math.ceil(end),\n }\n }),\n bpPerPx,\n },\n )) as QuantitativeStats\n const { scoreMin, scoreMean, scoreStdDev } = results\n\n // localsd uses heuristic to avoid unnecessary scoreMin<0 if the\n // scoreMin is never less than 0 helps with most coverage bigwigs\n // just being >0\n return autoscaleType === 'localsd'\n ? {\n ...results,\n scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,\n scoreMax: scoreMean + numStdDev * scoreStdDev,\n }\n : results\n }\n if (autoscaleType === 'zscale') {\n return rpcManager.call(\n sessionId,\n 'WiggleGetGlobalQuantitativeStats',\n params,\n ) as Promise<QuantitativeStats>\n }\n throw new Error(`invalid autoscaleType '${autoscaleType}'`)\n}\n\nexport function quantitativeStatsAutorun(self: {\n featureDensityStatsReady: boolean\n regionTooLarge: boolean\n error: unknown\n setLoading: (aborter: AbortController) => void\n setError: (error: unknown) => void\n updateQuantitativeStats: (\n stats: QuantitativeStats,\n statsRegion: string,\n ) => void\n renderProps: () => Record<string, unknown>\n configuration: AnyConfigurationModel\n adapterConfig: AnyConfigurationModel\n autoscaleType: string\n setMessage: (str: string) => void\n}) {\n addDisposer(\n self,\n autorun(\n async () => {\n try {\n const aborter = new AbortController()\n const view = getContainingView(self) as LGV\n self.setLoading(aborter)\n\n if (\n !view.initialized ||\n !self.featureDensityStatsReady ||\n self.regionTooLarge ||\n self.error\n ) {\n return\n }\n const statsRegion = JSON.stringify(view.dynamicBlocks)\n\n const wiggleStats = await getQuantitativeStats(self, {\n signal: aborter.signal,\n filters: [],\n ...self.renderProps(),\n })\n\n if (isAlive(self)) {\n self.updateQuantitativeStats(wiggleStats, statsRegion)\n }\n } catch (e) {\n if (!isAbortException(e) && isAlive(self)) {\n console.error(e)\n self.setError(e)\n }\n }\n },\n { delay: 1000 },\n ),\n )\n}\n\nexport function toP(s = 0) {\n return +(+s).toPrecision(6)\n}\n\nexport function round(value: number) {\n return Math.round(value * 1e5) / 1e5\n}\n\n// avoid drawing negative width features for SVG exports\nexport function fillRectCtx(\n x: number,\n y: number,\n width: number,\n height: number,\n ctx: CanvasRenderingContext2D,\n color?: string,\n) {\n if (width < 0) {\n x += width\n width = -width\n }\n if (height < 0) {\n y += height\n height = -height\n }\n\n if (color) {\n ctx.fillStyle = color\n }\n ctx.fillRect(x, y, width, height)\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models'\n\n/**\n * #config OAuthInternetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst OAuthConfigSchema = ConfigurationSchema(\n 'OAuthInternetAccount',\n {\n /**\n * #slot\n */\n tokenType: {\n description: 'a custom name for a token to include in the header',\n type: 'string',\n defaultValue: 'Bearer',\n },\n /**\n * #slot\n */\n authEndpoint: {\n description: 'the authorization code endpoint of the internet account',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n tokenEndpoint: {\n description: 'the token endpoint of the internet account',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n needsPKCE: {\n description: 'boolean to indicate if the endpoint needs a PKCE code',\n type: 'boolean',\n defaultValue: false,\n },\n /**\n * #slot\n */\n clientId: {\n description: 'id for the OAuth application',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n scopes: {\n description: 'optional scopes for the authorization call',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n state: {\n description: 'optional state for the authorization call',\n type: 'string',\n defaultValue: '',\n },\n /**\n * #slot\n */\n responseType: {\n description:\n \"the type of response from the authorization endpoint. can be 'token' or 'code'\",\n type: 'string',\n defaultValue: 'code',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: BaseInternetAccountConfig,\n explicitlyTyped: true,\n },\n)\n\nexport type OAuthInternetAccountConfigModel = typeof OAuthConfigSchema\nexport type OAuthInternetAccountConfig =\n Instance<OAuthInternetAccountConfigModel>\nexport default OAuthConfigSchema\n","export function fixup(buf: string) {\n return buf.replaceAll('+', '-').replaceAll('/', '_').replaceAll('=', '')\n}\n\nexport async function generateChallenge(val: string) {\n const sha256 = await import('crypto-js/sha256').then(f => f.default)\n const Base64 = await import('crypto-js/enc-base64')\n return fixup(Base64.stringify(sha256(val)))\n}\n\n// if response is JSON, checks if it needs to remove tokens in error, or just plain throw\nexport function processError(text: string, invalidErrorCb: () => void) {\n try {\n const obj = JSON.parse(text)\n if (obj.error === 'invalid_grant') {\n invalidErrorCb()\n }\n return obj?.error_description ?? text\n } catch (e) {\n /* response text is not json, just use original text as error */\n }\n return text\n}\n\nexport function processTokenResponse(\n data: { refresh_token?: string; access_token: string },\n storeRefreshTokenCb: (str: string) => void,\n) {\n if (data.refresh_token) {\n storeRefreshTokenCb(data.refresh_token)\n }\n return data.access_token\n}\n","export async function getResponseError({\n response,\n reason,\n statusText,\n}: {\n response: Response\n reason?: string\n statusText?: string\n}) {\n return [\n `HTTP ${response.status}`,\n reason,\n statusText ?? (await getError(response)),\n ]\n .filter(f => !!f)\n .join(' - ')\n}\n\nexport async function getError(response: Response) {\n try {\n return await response.text()\n } catch (e) {\n return response.statusText\n }\n}\n","import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'\nimport { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models'\nimport { isElectron, UriLocation } from '@jbrowse/core/util'\nimport { Instance, types } from 'mobx-state-tree'\nimport { Buffer } from 'buffer'\n\n// locals\nimport { OAuthInternetAccountConfigModel } from './configSchema'\nimport {\n fixup,\n generateChallenge,\n processError,\n processTokenResponse,\n} from './util'\nimport { getResponseError } from '../util'\n\ninterface OAuthData {\n client_id: string\n redirect_uri: string\n response_type: 'token' | 'code'\n scope?: string\n code_challenge?: string\n code_challenge_method?: string\n token_access_type?: string\n state?: string\n}\n\n/**\n * #stateModel OAuthInternetAccount\n */\nconst stateModelFactory = (configSchema: OAuthInternetAccountConfigModel) => {\n return InternetAccount.named('OAuthInternetAccount')\n .props({\n /**\n * #property\n */\n type: types.literal('OAuthInternetAccount'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .views(() => {\n let codeVerifier: string | undefined = undefined\n return {\n /**\n * #getter\n */\n get codeVerifierPKCE() {\n if (codeVerifier) {\n return codeVerifier\n }\n const array = new Uint8Array(32)\n globalThis.crypto.getRandomValues(array)\n codeVerifier = fixup(Buffer.from(array).toString('base64'))\n return codeVerifier\n },\n }\n })\n .views(self => ({\n /**\n * #getter\n */\n get authEndpoint(): string {\n return getConf(self, 'authEndpoint')\n },\n /**\n * #getter\n */\n get tokenEndpoint(): string {\n return getConf(self, 'tokenEndpoint')\n },\n /**\n * #getter\n */\n get needsPKCE(): boolean {\n return getConf(self, 'needsPKCE')\n },\n /**\n * #getter\n */\n get clientId(): string {\n return getConf(self, 'clientId')\n },\n /**\n * #getter\n */\n get scopes(): string {\n return getConf(self, 'scopes')\n },\n /**\n * #method\n * OAuth state parameter:\n * https://www.rfc-editor.org/rfc/rfc6749#section-4.1.1\n *\n * Can override or extend if dynamic state is needed.\n */\n state(): string | undefined {\n return getConf(self, 'state')\n },\n /**\n * #getter\n */\n get responseType(): 'token' | 'code' {\n return getConf(self, 'responseType')\n },\n /**\n * #getter\n */\n get refreshTokenKey() {\n return `${self.internetAccountId}-refreshToken`\n },\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n storeRefreshToken(refreshToken: string) {\n localStorage.setItem(self.refreshTokenKey, refreshToken)\n },\n /**\n * #action\n */\n removeRefreshToken() {\n localStorage.removeItem(self.refreshTokenKey)\n },\n /**\n * #method\n */\n retrieveRefreshToken() {\n return localStorage.getItem(self.refreshTokenKey)\n },\n /**\n * #action\n */\n async exchangeAuthorizationForAccessToken(\n token: string,\n redirectUri: string,\n ): Promise<string> {\n const params = new URLSearchParams(\n Object.entries({\n code: token,\n grant_type: 'authorization_code',\n client_id: self.clientId,\n redirect_uri: redirectUri,\n ...(self.needsPKCE ? { code_verifier: self.codeVerifierPKCE } : {}),\n }),\n )\n\n const response = await fetch(self.tokenEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: params.toString(),\n })\n\n if (!response.ok) {\n throw new Error(\n await getResponseError({\n response,\n reason: 'Failed to obtain token',\n }),\n )\n }\n\n const data = await response.json()\n return processTokenResponse(data, token => {\n this.storeRefreshToken(token)\n })\n },\n /**\n * #action\n */\n async exchangeRefreshForAccessToken(\n refreshToken: string,\n ): Promise<string> {\n const response = await fetch(self.tokenEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams(\n Object.entries({\n grant_type: 'refresh_token',\n refresh_token: refreshToken,\n client_id: self.clientId,\n }),\n ).toString(),\n })\n\n if (!response.ok) {\n self.removeToken()\n const text = await response.text()\n throw new Error(\n await getResponseError({\n response,\n statusText: processError(text, () => {\n this.removeRefreshToken()\n }),\n }),\n )\n }\n const data = await response.json()\n return processTokenResponse(data, token => {\n this.storeRefreshToken(token)\n })\n },\n }))\n .actions(self => {\n let listener: (event: MessageEvent) => undefined\n let exchangedTokenPromise: Promise<string> | undefined = undefined\n return {\n /**\n * #action\n * used to listen to child window for auth code/token\n */\n addMessageChannel(\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n listener = event => {\n // this should probably get better handling, but ignored for now\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.finishOAuthWindow(event, resolve, reject)\n }\n window.addEventListener('message', listener)\n },\n /**\n * #action\n */\n deleteMessageChannel() {\n window.removeEventListener('message', listener)\n },\n /**\n * #action\n */\n async finishOAuthWindow(\n event: MessageEvent,\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n if (\n event.data.name !== `JBrowseAuthWindow-${self.internetAccountId}`\n ) {\n this.deleteMessageChannel()\n return\n }\n const redirectUriWithInfo = event.data.redirectUri\n const fixedQueryString = redirectUriWithInfo.replace('#', '?')\n const redirectUrl = new URL(fixedQueryString)\n const queryStringSearch = redirectUrl.search\n const urlParams = new URLSearchParams(queryStringSearch)\n if (urlParams.has('access_token')) {\n const token = urlParams.get('access_token')\n if (!token) {\n reject(new Error('Error with token endpoint'))\n return\n }\n self.storeToken(token)\n resolve(token)\n return\n }\n if (urlParams.has('code')) {\n const code = urlParams.get('code')\n if (!code) {\n reject(new Error('Error with authorization endpoint'))\n return\n }\n try {\n const token = await self.exchangeAuthorizationForAccessToken(\n code,\n redirectUrl.origin + redirectUrl.pathname,\n )\n self.storeToken(token)\n resolve(token)\n return\n } catch (e) {\n if (e instanceof Error) {\n reject(e)\n } else {\n reject(new Error(String(e)))\n }\n return\n }\n }\n if (redirectUriWithInfo.includes('access_denied')) {\n reject(new Error('OAuth flow was cancelled'))\n return\n }\n if (redirectUriWithInfo.includes('error')) {\n reject(new Error(`OAuth flow error: ${queryStringSearch}`))\n return\n }\n this.deleteMessageChannel()\n },\n /**\n * #action\n * opens external OAuth flow, popup for web and new browser window for\n * desktop\n */\n async useEndpointForAuthorization(\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n const redirectUri = isElectron\n ? 'http://localhost/auth'\n : window.location.origin + window.location.pathname\n const data: OAuthData = {\n client_id: self.clientId,\n redirect_uri: redirectUri,\n response_type: self.responseType,\n token_access_type: 'offline',\n }\n\n if (self.state()) {\n data.state = self.state()\n }\n\n if (self.scopes) {\n data.scope = self.scopes\n }\n\n if (self.needsPKCE) {\n data.code_challenge = await generateChallenge(self.codeVerifierPKCE)\n data.code_challenge_method = 'S256'\n }\n\n const params = new URLSearchParams(Object.entries(data))\n\n const url = new URL(self.authEndpoint)\n url.search = params.toString()\n\n const eventName = `JBrowseAuthWindow-${self.internetAccountId}`\n if (isElectron) {\n const { ipcRenderer } = window.require('electron')\n const redirectUri = await ipcRenderer.invoke('openAuthWindow', {\n internetAccountId: self.internetAccountId,\n data,\n url: url.toString(),\n })\n\n const eventFromDesktop = new MessageEvent('message', {\n data: { name: eventName, redirectUri: redirectUri },\n })\n // may want to improve handling\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.finishOAuthWindow(eventFromDesktop, resolve, reject)\n } else {\n window.open(url, eventName, 'width=500,height=600,left=0,top=0')\n }\n },\n /**\n * #action\n */\n async getTokenFromUser(\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n const refreshToken = self.retrieveRefreshToken()\n let doUserFlow = true\n\n // if there is a refresh token, then try it out, and only if that\n // refresh token succeeds, set doUserFlow to false\n if (refreshToken) {\n try {\n const token =\n await self.exchangeRefreshForAccessToken(refreshToken)\n resolve(token)\n doUserFlow = false\n } catch (e) {\n console.error(e)\n self.removeRefreshToken()\n }\n }\n if (doUserFlow) {\n this.addMessageChannel(resolve, reject)\n // may want to improve handling\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.useEndpointForAuthorization(resolve, reject)\n }\n },\n /**\n * #action\n */\n async validateToken(token: string, location: UriLocation) {\n const newInit = self.addAuthHeaderToInit({ method: 'HEAD' }, token)\n const response = await fetch(location.uri, newInit)\n if (!response.ok) {\n self.removeToken()\n const refreshToken = self.retrieveRefreshToken()\n if (refreshToken) {\n try {\n if (!exchangedTokenPromise) {\n exchangedTokenPromise =\n self.exchangeRefreshForAccessToken(refreshToken)\n }\n const newToken = await exchangedTokenPromise\n exchangedTokenPromise = undefined\n return newToken\n } catch (err) {\n console.error('Token could not be refreshed', err)\n // let original error be thrown\n }\n }\n\n throw new Error(\n await getResponseError({\n response,\n reason: 'Error validating token',\n }),\n )\n }\n return token\n },\n }\n })\n .actions(self => {\n const superGetFetcher = self.getFetcher\n return {\n /**\n * #action\n * Get a fetch method that will add any needed authentication headers\n * to the request before sending it. If location is provided, it will\n * be checked to see if it includes a token in it's pre-auth\n * information.\n *\n * @param loc - UriLocation of the resource\n * @returns A function that can be used to fetch\n */\n getFetcher(loc?: UriLocation) {\n const fetcher = superGetFetcher(loc)\n return async (input: RequestInfo, init?: RequestInit) => {\n if (loc) {\n await self.validateToken(await self.getToken(loc), loc)\n }\n return fetcher(input, init)\n }\n },\n }\n })\n}\n\nexport default stateModelFactory\nexport type OAuthStateModel = ReturnType<typeof stateModelFactory>\nexport type OAuthModel = Instance<OAuthStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models'\n\n/**\n * #config ExternalTokenInternetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst ExternalTokenConfigSchema = ConfigurationSchema(\n 'ExternalTokenInternetAccount',\n {\n /**\n * #slot\n */\n validateWithHEAD: {\n description: 'validate the token with a HEAD request before using it',\n type: 'boolean',\n defaultValue: true,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: BaseInternetAccountConfig,\n explicitlyTyped: true,\n },\n)\n\nexport type ExternalTokenInternetAccountConfigModel =\n typeof ExternalTokenConfigSchema\n\nexport type ExternalTokenInternetAccountConfig =\n Instance<ExternalTokenInternetAccountConfigModel>\nexport default ExternalTokenConfigSchema\n","import React, { useState } from 'react'\nimport { Button, DialogContent, DialogActions, TextField } from '@mui/material'\nimport { Dialog } from '@jbrowse/core/ui'\n\nexport const ExternalTokenEntryForm = ({\n internetAccountId,\n handleClose,\n}: {\n internetAccountId: string\n handleClose: (token?: string) => void\n}) => {\n const [token, setToken] = useState('')\n\n return (\n <Dialog\n open\n maxWidth=\"xl\"\n data-testid=\"externalToken-form\"\n title={`Enter token for ${internetAccountId}`}\n >\n <DialogContent style={{ display: 'flex', flexDirection: 'column' }}>\n <TextField\n required\n label=\"Enter Token\"\n variant=\"outlined\"\n inputProps={{ 'data-testid': 'entry-externalToken' }}\n onChange={event => {\n setToken(event.target.value)\n }}\n margin=\"dense\"\n />\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!token}\n onClick={() => {\n if (token) {\n handleClose(token)\n }\n }}\n >\n Add\n </Button>\n <Button\n variant=\"contained\"\n color=\"secondary\"\n onClick={() => {\n handleClose()\n }}\n >\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n","import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'\nimport { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models'\nimport { UriLocation } from '@jbrowse/core/util/types'\nimport { ExternalTokenInternetAccountConfigModel } from './configSchema'\nimport { Instance, types, getRoot } from 'mobx-state-tree'\n\nimport { ExternalTokenEntryForm } from './ExternalTokenEntryForm'\n\nconst stateModelFactory = (\n configSchema: ExternalTokenInternetAccountConfigModel,\n) => {\n return InternetAccount.named('ExternalTokenInternetAccount')\n .props({\n type: types.literal('ExternalTokenInternetAccount'),\n configuration: ConfigurationReference(configSchema),\n })\n .views(self => ({\n get validateWithHEAD(): boolean {\n return getConf(self, 'validateWithHEAD')\n },\n }))\n .actions(self => ({\n getTokenFromUser(\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n const { session } = getRoot<any>(self)\n session.queueDialog((doneCallback: () => void) => [\n ExternalTokenEntryForm,\n {\n internetAccountId: self.internetAccountId,\n handleClose: (token: string) => {\n if (token) {\n resolve(token)\n } else {\n reject(new Error('user cancelled entry'))\n }\n doneCallback()\n },\n },\n ])\n },\n async validateToken(token: string, location: UriLocation) {\n if (!self.validateWithHEAD) {\n return token\n }\n const newInit = self.addAuthHeaderToInit({ method: 'HEAD' }, token)\n const response = await fetch(location.uri, newInit)\n if (!response.ok) {\n let errorMessage: string\n try {\n errorMessage = await response.text()\n } catch (error) {\n errorMessage = ''\n }\n throw new Error(\n `Token could not be validated — ${response.status} ${errorMessage ? ` (${errorMessage})` : ''}`,\n )\n }\n return token\n },\n }))\n}\n\nexport default stateModelFactory\nexport type ExternalTokenStateModel = ReturnType<typeof stateModelFactory>\nexport type ExternalTokenModel = Instance<ExternalTokenStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models'\n\n/**\n * #config HTTPBasicInternetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst HTTPBasicConfigSchema = ConfigurationSchema(\n 'HTTPBasicInternetAccount',\n {\n /**\n * #slot\n */\n tokenType: {\n description: 'a custom name for a token to include in the header',\n type: 'string',\n defaultValue: 'Basic',\n },\n /**\n * #slot\n */\n validateWithHEAD: {\n description: 'validate the token with a HEAD request before using it',\n type: 'boolean',\n defaultValue: true,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: BaseInternetAccountConfig,\n explicitlyTyped: true,\n },\n)\n\nexport type HTTPBasicInternetAccountConfigModel = typeof HTTPBasicConfigSchema\n\nexport type HTTPBasicInternetAccountConfig =\n Instance<HTTPBasicInternetAccountConfigModel>\nexport default HTTPBasicConfigSchema\n","import React, { useState } from 'react'\nimport { Button, DialogContent, DialogActions, TextField } from '@mui/material'\nimport { Dialog } from '@jbrowse/core/ui'\n\nexport function HTTPBasicLoginForm({\n internetAccountId,\n handleClose,\n}: {\n internetAccountId: string\n handleClose: (arg?: string) => void\n}) {\n const [username, setUsername] = useState('')\n const [password, setPassword] = useState('')\n\n return (\n <Dialog\n open\n maxWidth=\"xl\"\n data-testid=\"login-httpbasic\"\n title={`Log in for ${internetAccountId}`}\n >\n <form\n onSubmit={event => {\n if (username && password) {\n handleClose(btoa(`${username}:${password}`))\n } else {\n handleClose()\n }\n event.preventDefault()\n }}\n >\n <DialogContent style={{ display: 'flex', flexDirection: 'column' }}>\n <TextField\n required\n label=\"Username\"\n variant=\"outlined\"\n inputProps={{ 'data-testid': 'login-httpbasic-username' }}\n onChange={event => {\n setUsername(event.target.value)\n }}\n margin=\"dense\"\n />\n <TextField\n required\n label=\"Password\"\n type=\"password\"\n autoComplete=\"current-password\"\n variant=\"outlined\"\n inputProps={{ 'data-testid': 'login-httpbasic-password' }}\n onChange={event => {\n setPassword(event.target.value)\n }}\n margin=\"dense\"\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" color=\"primary\" type=\"submit\">\n Submit\n </Button>\n <Button\n variant=\"contained\"\n color=\"secondary\"\n type=\"submit\"\n onClick={() => {\n handleClose()\n }}\n >\n Cancel\n </Button>\n </DialogActions>\n </form>\n </Dialog>\n )\n}\n","import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'\nimport { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models'\nimport { UriLocation } from '@jbrowse/core/util/types'\nimport { Instance, types, getRoot } from 'mobx-state-tree'\n\n// locals\nimport { HTTPBasicInternetAccountConfigModel } from './configSchema'\nimport { HTTPBasicLoginForm } from './HTTPBasicLoginForm'\nimport { getResponseError } from '../util'\n\n/**\n * #stateModel HTTPBasicInternetAccount\n */\nconst stateModelFactory = (\n configSchema: HTTPBasicInternetAccountConfigModel,\n) => {\n return InternetAccount.named('HTTPBasicInternetAccount')\n .props({\n /**\n * #property\n */\n type: types.literal('HTTPBasicInternetAccount'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .views(self => ({\n /**\n * #getter\n */\n get validateWithHEAD(): boolean {\n return getConf(self, 'validateWithHEAD')\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n getTokenFromUser(\n resolve: (token: string) => void,\n reject: (error: Error) => void,\n ) {\n const { session } = getRoot<any>(self)\n session.queueDialog((doneCallback: () => void) => [\n HTTPBasicLoginForm,\n {\n internetAccountId: self.internetAccountId,\n handleClose: (token: string) => {\n if (token) {\n resolve(token)\n } else {\n reject(new Error('User cancelled entry'))\n }\n doneCallback()\n },\n },\n ])\n },\n /**\n * #action\n */\n async validateToken(token: string, location: UriLocation) {\n if (!self.validateWithHEAD) {\n return token\n }\n const newInit = self.addAuthHeaderToInit({ method: 'HEAD' }, token)\n const response = await fetch(location.uri, newInit)\n if (!response.ok) {\n throw new Error(\n await getResponseError({\n response,\n reason: 'Error validating token',\n }),\n )\n }\n return token\n },\n }))\n}\n\nexport default stateModelFactory\nexport type HTTPBasicStateModel = ReturnType<typeof stateModelFactory>\nexport type HTTPBasicModel = Instance<HTTPBasicStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport OAuthConfigSchema from '../OAuthModel/configSchema'\n\n/**\n * #config DropboxOAuthInternetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst DropboxOAuthConfigSchema = ConfigurationSchema(\n 'DropboxOAuthInternetAccount',\n {\n /**\n * #slot\n */\n authEndpoint: {\n description: 'the authorization code endpoint of the internet account',\n type: 'string',\n defaultValue: 'https://www.dropbox.com/oauth2/authorize',\n },\n /**\n * #slot\n */\n tokenEndpoint: {\n description: 'the token endpoint of the internet account',\n type: 'string',\n defaultValue: 'https://api.dropbox.com/oauth2/token',\n },\n /**\n * #slot\n */\n needsPKCE: {\n description: 'boolean to indicate if the endpoint needs a PKCE code',\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n domains: {\n description:\n 'array of valid domains the url can contain to use this account',\n type: 'stringArray',\n defaultValue: [\n 'addtodropbox.com',\n 'db.tt',\n 'dropbox.com',\n 'dropboxapi.com',\n 'dropboxbusiness.com',\n 'dropbox.tech',\n 'getdropbox.com',\n ],\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: OAuthConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport type DropboxOAuthInternetAccountConfigModel =\n typeof DropboxOAuthConfigSchema\n\nexport type DropboxOAuthInternetAccountConfig =\n Instance<DropboxOAuthInternetAccountConfigModel>\nexport default DropboxOAuthConfigSchema\n","import { getResponseError } from '../util'\n\ninterface DropboxError {\n error_summary: string\n error: {\n '.tag': string\n }\n}\n\n/**\n * Error messages from\n * https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file\n * */\nconst dropboxErrorMessages: Record<string, string> = {\n shared_link_not_found: \"The shared link wasn't found.\",\n shared_link_access_denied:\n 'The caller is not allowed to access this shared link.',\n unsupported_link_type:\n 'This type of link is not supported; use files/export instead.',\n shared_link_is_directory: 'Directories cannot be retrieved by this endpoint.',\n}\n\nexport async function getDescriptiveErrorMessage(\n response: Response,\n reason?: string,\n) {\n let errorMessage = ''\n try {\n const err = JSON.parse(await response.text()) as DropboxError\n const tag = err.error['.tag']\n errorMessage = dropboxErrorMessages[tag] || tag\n } catch (error) {\n /* do nothing */\n }\n return getResponseError({ response, reason, statusText: errorMessage })\n}\n","import React from 'react'\nimport { SvgIcon, SvgIconProps } from '@mui/material'\n\nexport default function DropboxIcon(props: SvgIconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z\" />\n </SvgIcon>\n )\n}\n","import React from 'react'\nimport { ConfigurationReference } from '@jbrowse/core/configuration'\nimport { UriLocation } from '@jbrowse/core/util/types'\nimport { Instance, types } from 'mobx-state-tree'\n\n// locals\nimport { DropboxOAuthInternetAccountConfigModel } from './configSchema'\nimport baseModel from '../OAuthModel/model'\nimport { configSchema as OAuthConfigSchema } from '../OAuthModel'\nimport { getDescriptiveErrorMessage } from './util'\nimport DropboxIcon from './DropboxIcon'\n\n/**\n * #stateModel DropboxOAuthInternetAccount\n */\nconst stateModelFactory = (\n configSchema: DropboxOAuthInternetAccountConfigModel,\n) => {\n return baseModel(OAuthConfigSchema)\n .named('DropboxOAuthInternetAccount')\n .props({\n /**\n * #property\n */\n type: types.literal('DropboxOAuthInternetAccount'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .views(() => ({\n /**\n * #getter\n * The FileSelector icon for Dropbox\n */\n get toggleContents() {\n return <DropboxIcon />\n },\n /**\n * #getter\n */\n get selectorLabel() {\n return 'Enter Dropbox share link'\n },\n }))\n .actions(self => ({\n /**\n * #method\n */\n getFetcher(location?: UriLocation) {\n return async (input: RequestInfo, init?: RequestInit) => {\n const authToken = await self.getToken(location)\n const newInit = self.addAuthHeaderToInit(\n { ...init, method: 'POST' },\n authToken,\n )\n newInit.headers.append(\n 'Dropbox-API-Arg',\n JSON.stringify({ url: input }),\n )\n const response = await fetch(\n 'https://content.dropboxapi.com/2/sharing/get_shared_link_file',\n newInit,\n )\n if (!response.ok) {\n throw new Error(await getDescriptiveErrorMessage(response))\n }\n return response\n }\n },\n /**\n * #action\n */\n async validateToken(\n token: string,\n location: UriLocation,\n ): Promise<string> {\n const response = await fetch(\n 'https://api.dropboxapi.com/2/sharing/get_shared_link_metadata',\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n url: location.uri,\n }),\n },\n )\n if (!response.ok) {\n const refreshToken = self.retrieveRefreshToken()\n if (refreshToken) {\n self.removeRefreshToken()\n const newToken =\n await self.exchangeRefreshForAccessToken(refreshToken)\n return this.validateToken(newToken, location)\n }\n throw new Error(\n await getDescriptiveErrorMessage(\n response,\n 'Token could not be validated',\n ),\n )\n }\n return token\n },\n }))\n}\n\nexport default stateModelFactory\nexport type DropboxOAuthStateModel = ReturnType<typeof stateModelFactory>\nexport type DropboxOAuthModel = Instance<DropboxOAuthStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { Instance } from 'mobx-state-tree'\nimport OAuthConfigSchema from '../OAuthModel/configSchema'\n\n/**\n * #config GoogleDriveOAuthInternetAccount\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst GoogleDriveOAuthConfigSchema = ConfigurationSchema(\n 'GoogleDriveOAuthInternetAccount',\n {\n /**\n * #slot\n */\n authEndpoint: {\n description: 'the authorization code endpoint of the internet account',\n type: 'string',\n defaultValue: 'https://accounts.google.com/o/oauth2/v2/auth',\n },\n /**\n * #slot\n */\n scopes: {\n description: 'optional scopes for the authorization call',\n type: 'string',\n defaultValue: 'https://www.googleapis.com/auth/drive.readonly',\n },\n /**\n * #slot\n */\n domains: {\n description:\n 'array of valid domains the url can contain to use this account',\n type: 'stringArray',\n defaultValue: ['drive.google.com\"'],\n },\n /**\n * #slot\n */\n responseType: {\n description: 'the type of response from the authorization endpoint',\n type: 'string',\n defaultValue: 'token',\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: OAuthConfigSchema,\n explicitlyTyped: true,\n },\n)\n\nexport type GoogleDriveOAuthInternetAccountConfigModel =\n typeof GoogleDriveOAuthConfigSchema\n\nexport type GoogleDriveOAuthInternetAccountConfig =\n Instance<GoogleDriveOAuthInternetAccountConfigModel>\nexport default GoogleDriveOAuthConfigSchema\n","import { getResponseError } from '../util'\n\ninterface GoogleDriveError {\n error: {\n errors: {\n domain: string\n reason: string\n message: string\n locationType?: string\n location?: string\n }[]\n code: number\n message: string\n }\n}\n\nexport async function getDescriptiveErrorMessage(\n response: Response,\n reason?: string,\n) {\n let errorMessage = ''\n try {\n const err = JSON.parse(await response.text()) as GoogleDriveError\n errorMessage = err.error.message\n } catch (error) {\n /* do nothing */\n }\n return getResponseError({ response, reason, statusText: errorMessage })\n}\n","import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io'\nimport {\n FilehandleOptions,\n Stats,\n PolyfilledResponse,\n} from 'generic-filehandle'\n\nexport interface RequestInitWithMetadata extends RequestInit {\n metadataOnly?: boolean\n}\n\ninterface GoogleDriveFilehandleOptions extends FilehandleOptions {\n fetch(\n input: RequestInfo,\n opts?: RequestInitWithMetadata,\n ): Promise<PolyfilledResponse>\n}\n\nexport class GoogleDriveFile extends RemoteFileWithRangeCache {\n private statsPromise: Promise<{ size: number }>\n constructor(source: string, opts: GoogleDriveFilehandleOptions) {\n super(source, opts)\n this.statsPromise = this.fetch(source, {\n metadataOnly: true,\n }).then((response: Response) => response.json())\n }\n\n async fetch(\n input: RequestInfo,\n opts?: RequestInitWithMetadata,\n ): Promise<PolyfilledResponse> {\n return super.fetch(input, opts)\n }\n\n async stat(): Promise<Stats> {\n return this.statsPromise\n }\n}\n","import React from 'react'\nimport { SvgIconProps, SvgIcon } from '@mui/material'\n\nexport default function GoogleDriveIcon(props: SvgIconProps) {\n return (\n <SvgIcon {...props}>\n <path d=\"M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z\" />\n </SvgIcon>\n )\n}\n","import React from 'react'\nimport { ConfigurationReference } from '@jbrowse/core/configuration'\nimport { Instance, types } from 'mobx-state-tree'\nimport { UriLocation } from '@jbrowse/core/util/types'\n\n// locals\nimport { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema'\nimport baseModel from '../OAuthModel/model'\nimport { configSchema as OAuthConfigSchema } from '../OAuthModel'\nimport { getDescriptiveErrorMessage } from './util'\nimport { GoogleDriveFile } from './GoogleDriveFilehandle'\nimport GoogleDriveIcon from './GoogleDriveIcon'\n\nexport interface RequestInitWithMetadata extends RequestInit {\n metadataOnly?: boolean\n}\n\nfunction getUri(str: string) {\n const urlId = /[-\\w]{25,}/.exec(str)\n return `https://www.googleapis.com/drive/v3/files/${urlId}`\n}\n\n/**\n * #stateModel GoogleDriveOAuthInternetAccount\n */\nexport default function stateModelFactory(\n configSchema: GoogleDriveOAuthInternetAccountConfigModel,\n) {\n return baseModel(OAuthConfigSchema)\n .named('GoogleDriveOAuthInternetAccount')\n .props({\n /**\n * #property\n */\n type: types.literal('GoogleDriveOAuthInternetAccount'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .views(() => ({\n /**\n * #getter\n * The FileSelector icon for Google drive\n */\n get toggleContents() {\n return <GoogleDriveIcon />\n },\n /**\n * #getter\n */\n get selectorLabel() {\n return 'Enter Google Drive share link'\n },\n }))\n .actions(self => ({\n /**\n * #method\n */\n getFetcher(location?: UriLocation) {\n return async (input: RequestInfo, init?: RequestInitWithMetadata) => {\n const driveUrl = new URL(getUri(String(input)))\n const searchParams = new URLSearchParams()\n if (init?.metadataOnly) {\n searchParams.append('fields', 'size')\n } else {\n searchParams.append('alt', 'media')\n }\n driveUrl.search = searchParams.toString()\n const authToken = await self.getToken(location)\n const response = await fetch(\n driveUrl,\n self.addAuthHeaderToInit(\n { ...init, method: 'GET', credentials: 'same-origin' },\n authToken,\n ),\n )\n if (!response.ok) {\n throw new Error(await getDescriptiveErrorMessage(response))\n }\n return response\n }\n },\n /**\n * #method\n */\n openLocation(location: UriLocation) {\n return new GoogleDriveFile(location.uri, {\n fetch: this.getFetcher(location),\n })\n },\n /**\n * #action\n */\n async validateToken(token: string, location: UriLocation) {\n const response = await fetch(getUri(location.uri), {\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n })\n if (!response.ok) {\n throw new Error(\n await getDescriptiveErrorMessage(\n response,\n 'Token could not be validated',\n ),\n )\n }\n return token\n },\n }))\n}\n\nexport type GoogleDriveOAuthStateModel = ReturnType<typeof stateModelFactory>\nexport type GoogleDriveOAuthModel = Instance<GoogleDriveOAuthStateModel>\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport InternetAccountType from '@jbrowse/core/pluggableElementTypes/InternetAccountType'\nimport {\n configSchema as OAuthConfigSchema,\n modelFactory as OAuthInternetAccountModelFactory,\n} from './OAuthModel'\nimport {\n configSchema as ExternalTokenConfigSchema,\n modelFactory as ExternalTokenInternetAccountModelFactory,\n} from './ExternalTokenModel'\nimport {\n configSchema as HTTPBasicConfigSchema,\n modelFactory as HTTPBasicInternetAccountModelFactory,\n} from './HTTPBasicModel'\nimport {\n configSchema as DropboxOAuthConfigSchema,\n modelFactory as DropboxOAuthInternetAccountModelFactory,\n} from './DropboxOAuthModel'\nimport {\n configSchema as GoogleDriveOAuthConfigSchema,\n modelFactory as GoogleDriveOAuthInternetAccountModelFactory,\n} from './GoogleDriveOAuthModel'\n\nexport default class AuthenticationPlugin extends Plugin {\n name = 'AuthenticationPlugin'\n\n exports = {\n OAuthConfigSchema,\n OAuthInternetAccountModelFactory,\n ExternalTokenConfigSchema,\n ExternalTokenInternetAccountModelFactory,\n HTTPBasicConfigSchema,\n HTTPBasicInternetAccountModelFactory,\n DropboxOAuthConfigSchema,\n DropboxOAuthInternetAccountModelFactory,\n GoogleDriveOAuthConfigSchema,\n GoogleDriveOAuthInternetAccountModelFactory,\n }\n\n install(pluginManager: PluginManager) {\n pluginManager.addInternetAccountType(() => {\n return new InternetAccountType({\n name: 'OAuthInternetAccount',\n configSchema: OAuthConfigSchema,\n stateModel: OAuthInternetAccountModelFactory(OAuthConfigSchema),\n })\n })\n pluginManager.addInternetAccountType(() => {\n return new InternetAccountType({\n name: 'ExternalTokenInternetAccount',\n configSchema: ExternalTokenConfigSchema,\n stateModel: ExternalTokenInternetAccountModelFactory(\n ExternalTokenConfigSchema,\n ),\n })\n })\n pluginManager.addInternetAccountType(() => {\n return new InternetAccountType({\n name: 'HTTPBasicInternetAccount',\n configSchema: HTTPBasicConfigSchema,\n stateModel: HTTPBasicInternetAccountModelFactory(HTTPBasicConfigSchema),\n })\n })\n pluginManager.addInternetAccountType(() => {\n return new InternetAccountType({\n name: 'DropboxOAuthInternetAccount',\n configSchema: DropboxOAuthConfigSchema,\n stateModel: DropboxOAuthInternetAccountModelFactory(\n DropboxOAuthConfigSchema,\n ),\n })\n })\n pluginManager.addInternetAccountType(() => {\n return new InternetAccountType({\n name: 'GoogleDriveOAuthInternetAccount',\n configSchema: GoogleDriveOAuthConfigSchema,\n stateModel: GoogleDriveOAuthInternetAccountModelFactory(\n GoogleDriveOAuthConfigSchema,\n ),\n })\n })\n }\n}\n\nexport {\n configSchema as OAuthConfigSchema,\n modelFactory as OAuthInternetAccountModelFactory,\n} from './OAuthModel'\nexport {\n configSchema as ExternalTokenConfigSchema,\n modelFactory as ExternalTokenInternetAccountModelFactory,\n} from './ExternalTokenModel'\n\nexport {\n configSchema as HTTPBasicConfigSchema,\n modelFactory as HTTPBasicInternetAccountModelFactory,\n} from './HTTPBasicModel'\n\nexport {\n configSchema as DropboxOAuthConfigSchema,\n modelFactory as DropboxOAuthInternetAccountModelFactory,\n} from './DropboxOAuthModel'\n\nexport {\n configSchema as GoogleDriveOAuthConfigSchema,\n modelFactory as GoogleDriveOAuthInternetAccountModelFactory,\n} from './GoogleDriveOAuthModel'\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BigBedAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BigBedAdapter = ConfigurationSchema(\n 'BigBedAdapter',\n {\n /**\n * #slot\n */\n bigBedLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.bb', locationType: 'UriLocation' },\n },\n\n /**\n * #slot\n */\n scoreColumn: {\n type: 'string',\n description: 'The column to use as a \"score\" attribute',\n defaultValue: '',\n },\n\n /**\n * #slot\n */\n aggregateField: {\n type: 'string',\n description: 'An attribute to aggregate features with',\n defaultValue: 'geneName',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default BigBedAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BedpeAdapter\n * intended for SVs in a single assembly\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BedpeAdapter = ConfigurationSchema(\n 'BedpeAdapter',\n {\n /**\n * #slot\n * can be plaintext or gzipped, not indexed so loaded into memory on startup\n */\n bedpeLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.bedpe.gz',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n columnNames: {\n type: 'stringArray',\n description: 'List of column names',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true },\n)\nexport default BedpeAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config BedTabixAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BedTabixAdapter = ConfigurationSchema(\n 'BedTabixAdapter',\n {\n /**\n * #slot\n */\n bedGzLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.bed.gz', locationType: 'UriLocation' },\n },\n\n index: ConfigurationSchema('TabixIndex', {\n /**\n * #slot index.indexType\n */\n indexType: {\n model: types.enumeration('IndexType', ['TBI', 'CSI']),\n type: 'stringEnum',\n defaultValue: 'TBI',\n },\n /**\n * #slot index.location\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.bed.gz.tbi',\n locationType: 'UriLocation',\n },\n },\n }),\n\n /**\n * #slot\n */\n columnNames: {\n type: 'stringArray',\n description: 'List of column names',\n defaultValue: [],\n },\n\n /**\n * #slot\n */\n scoreColumn: {\n type: 'string',\n description: 'The column to use as a \"score\" attribute',\n defaultValue: '',\n },\n\n /**\n * #slot\n */\n autoSql: {\n type: 'string',\n description: 'The autoSql definition for the data fields in the file',\n defaultValue: '',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default BedTabixAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config BedAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BedAdapter = ConfigurationSchema(\n 'BedAdapter',\n {\n /**\n * #slot\n */\n bedLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.bed.gz', locationType: 'UriLocation' },\n },\n /**\n * #slot\n */\n columnNames: {\n type: 'stringArray',\n description: 'List of column names',\n defaultValue: [],\n },\n /**\n * #slot\n */\n scoreColumn: {\n type: 'string',\n description: 'The column to use as a \"score\" attribute',\n defaultValue: '',\n },\n /**\n * #slot\n */\n autoSql: {\n type: 'string',\n description: 'The autoSql definition for the data fields in the file',\n defaultValue: '',\n },\n /**\n * #slot\n */\n colRef: {\n type: 'number',\n description: 'The column to use as a \"refName\" attribute',\n defaultValue: 0,\n },\n /**\n * #slot\n */\n colStart: {\n type: 'number',\n description: 'The column to use as a \"start\" attribute',\n defaultValue: 1,\n },\n /**\n * #slot\n */\n colEnd: {\n type: 'number',\n description: 'The column to use as a \"end\" attribute',\n defaultValue: 2,\n },\n },\n { explicitlyTyped: true },\n)\nexport default BedAdapter\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport BigBedAdapterF from './BigBedAdapter'\nimport BedpeAdapterF from './BedpeAdapter'\nimport BedTabixAdapterF from './BedTabixAdapter'\nimport BedAdapterF from './BedAdapter'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n getFileName,\n makeIndex,\n makeIndexType,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default class BedPlugin extends Plugin {\n name = 'BedPlugin'\n\n install(pluginManager: PluginManager) {\n BigBedAdapterF(pluginManager)\n BedAdapterF(pluginManager)\n BedpeAdapterF(pluginManager)\n BedTabixAdapterF(pluginManager)\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.(bb|bigbed)$/i\n const adapterName = 'BigBedAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n bigBedLocation: file,\n }\n\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.bedpe(\\.gz)?$/i\n const adapterName = 'BedpeAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n bedpeLocation: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.bed\\.b?gz$/i\n const adapterName = 'BedTabixAdapter'\n const fileName = getFileName(file)\n const indexName = index && getFileName(index)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n bedGzLocation: file,\n index: {\n location: index || makeIndex(file, '.tbi'),\n indexType: makeIndexType(indexName, 'CSI', 'TBI'),\n },\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.bed$/i\n const adapterName = 'BedAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n bedLocation: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => (adapterName: string) =>\n adapterName === 'BedpeAdapter'\n ? 'VariantTrack'\n : trackTypeGuesser(adapterName),\n )\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function BigBedAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BigBedAdapter',\n displayName: 'BigBed adapter',\n configSchema,\n getAdapterClass: () => import('./BigBedAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function BedAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BedAdapter',\n displayName: 'BED adapter',\n configSchema,\n getAdapterClass: () => import('./BedAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function BedpeAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BedpeAdapter',\n displayName: 'BEDPE adapter',\n configSchema,\n getAdapterClass: () => import('./BedpeAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function BedTabixAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BedTabixAdapter',\n displayName: 'BED tabix adapter',\n configSchema,\n getAdapterClass: () => import('./BedTabixAdapter').then(r => r.default),\n }),\n )\n}\n","import { lazy } from 'react'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { types } from 'mobx-state-tree'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\n\nconst configSchema = ConfigurationSchema('BreakpointAlignmentsWidget', {})\n\nconst stateModel = types\n .model('BreakpointAlignmentsWidget', {\n id: ElementId,\n type: types.literal('BreakpointAlignmentsWidget'),\n featureData: types.frozen(),\n })\n .actions(self => ({\n setFeatureData(data: unknown) {\n self.featureData = data\n },\n clearFeatureData() {\n self.featureData = undefined\n },\n }))\n\nexport default function BreakpointAlignmentsFeatureDetailF(\n pluginManager: PluginManager,\n) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'BreakpointAlignmentsWidget',\n heading: 'Breakpoint feature details',\n configSchema,\n stateModel,\n ReactComponent: lazy(() => import('./BreakpointAlignmentsFeatureDetail')),\n })\n })\n}\n","import { getSession, Feature, Region } from '@jbrowse/core/util'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\nimport { parseBreakend } from '@gmod/vcf'\nimport { IStateTreeNode } from 'mobx-state-tree'\nimport { Assembly } from '@jbrowse/core/assemblyManager/assembly'\n\nexport default class BreakpointSplitViewType extends ViewType {\n getBreakendCoveringRegions({\n feature,\n assembly,\n }: {\n feature: Feature\n assembly: Assembly\n }) {\n const alt = feature.get('ALT')?.[0]\n const bnd = alt ? parseBreakend(alt) : undefined\n const startPos = feature.get('start')\n const refName = feature.get('refName')\n let endPos: number\n\n let mateRefName: string | undefined\n\n // a VCF breakend feature\n if (alt === '<TRA>') {\n const INFO = feature.get('INFO')\n endPos = INFO.END[0] - 1\n mateRefName = INFO.CHR2[0]\n } else if (bnd?.MatePosition) {\n const matePosition = bnd.MatePosition.split(':')\n endPos = +matePosition[1]! - 1\n mateRefName = matePosition[0]!\n } else if (feature.get('mate')) {\n // a generic 'mate' feature\n const mate = feature.get('mate')\n mateRefName = mate.refName\n endPos = mate.start\n } else {\n endPos = startPos + 1\n }\n\n if (!mateRefName) {\n throw new Error(\n `unable to resolve mate refName ${mateRefName} in reference genome`,\n )\n }\n\n return {\n pos: startPos,\n refName: assembly.getCanonicalRefName(refName),\n mateRefName: assembly.getCanonicalRefName(mateRefName),\n matePos: endPos,\n }\n }\n\n singleLevelSnapshotFromBreakendFeature(\n feature: Feature,\n view: { displayedRegions: Region[] } & IStateTreeNode,\n ) {\n const session = getSession(view)\n const bpPerPx = 10\n const { assemblyName } = view.displayedRegions[0]!\n\n const { assemblyManager } = session\n const assembly = assemblyManager.get(assemblyName)\n if (!assembly) {\n throw new Error(`assembly ${assemblyName} not found`)\n }\n if (!assembly.regions) {\n throw new Error(`assembly ${assemblyName} regions not loaded`)\n }\n const {\n refName,\n pos: startPos,\n mateRefName,\n matePos: endPos,\n } = this.getBreakendCoveringRegions({\n feature,\n assembly,\n })\n\n const topRegion = assembly.regions.find(f => f.refName === refName)!\n const bottomRegion = assembly.regions.find(f => f.refName === mateRefName)!\n const topMarkedRegion = [{ ...topRegion }, { ...topRegion }]\n const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }]\n topMarkedRegion[0]!.end = startPos\n topMarkedRegion[1]!.start = startPos\n bottomMarkedRegion[0]!.end = endPos\n bottomMarkedRegion[1]!.start = endPos\n return {\n type: 'BreakpointSplitView',\n views: [\n {\n type: 'LinearGenomeView',\n displayedRegions: topMarkedRegion,\n hideHeader: true,\n bpPerPx,\n offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,\n },\n ],\n displayName: `${\n feature.get('name') || feature.get('id') || 'breakend'\n } split detail`,\n featureData: undefined as unknown,\n }\n }\n\n snapshotFromBreakendFeature(\n feature: Feature,\n view: { displayedRegions: Region[] } & IStateTreeNode,\n ) {\n const session = getSession(view)\n const bpPerPx = 10\n const { assemblyName } = view.displayedRegions[0]!\n\n const { assemblyManager } = session\n const assembly = assemblyManager.get(assemblyName)\n if (!assembly) {\n throw new Error(`assembly ${assemblyName} not found`)\n }\n if (!assembly.regions) {\n throw new Error(`assembly ${assemblyName} regions not loaded`)\n }\n const {\n refName,\n pos: startPos,\n mateRefName,\n matePos: endPos,\n } = this.getBreakendCoveringRegions({\n feature,\n assembly,\n })\n\n const topRegion = assembly.regions.find(f => f.refName === refName)!\n const bottomRegion = assembly.regions.find(f => f.refName === mateRefName)!\n const topMarkedRegion = [{ ...topRegion }, { ...topRegion }]\n const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }]\n topMarkedRegion[0]!.end = startPos\n topMarkedRegion[1]!.start = startPos\n bottomMarkedRegion[0]!.end = endPos\n bottomMarkedRegion[1]!.start = endPos\n return {\n type: 'BreakpointSplitView',\n views: [\n {\n type: 'LinearGenomeView',\n displayedRegions: topMarkedRegion,\n hideHeader: true,\n bpPerPx,\n offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,\n },\n {\n type: 'LinearGenomeView',\n displayedRegions: bottomMarkedRegion,\n hideHeader: true,\n bpPerPx,\n offsetPx: (bottomRegion.start + endPos) / bpPerPx,\n },\n ],\n displayName: `${\n feature.get('name') || feature.get('id') || 'breakend'\n } split detail`,\n }\n }\n}\n","import React, { lazy } from 'react'\nimport {\n types,\n onAction,\n addDisposer,\n getPath,\n Instance,\n} from 'mobx-state-tree'\nimport { autorun } from 'mobx'\nimport { saveAs } from 'file-saver'\n\n// jbrowse\nimport {\n LinearGenomeViewModel,\n LinearGenomeViewStateModel,\n} from '@jbrowse/plugin-linear-genome-view'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { getSession, Feature, notEmpty } from '@jbrowse/core/util'\nimport { AnyConfigurationModel, getConf } from '@jbrowse/core/configuration'\n\n// icons\nimport PhotoCamera from '@mui/icons-material/PhotoCamera'\nimport LinkIcon from '@mui/icons-material/Link'\n\n// locals\nimport { intersect } from './util'\n\n// lazies\nconst ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'))\n\ninterface Display {\n searchFeatureByID?: (str: string) => LayoutRecord\n}\n\ninterface Track {\n displays: Display[]\n}\n\nfunction calc(track: Track, f: Feature) {\n return track.displays[0]!.searchFeatureByID?.(f.id())\n}\n\nexport interface ExportSvgOptions {\n rasterizeLayers?: boolean\n filename?: string\n Wrapper?: React.FC<{ children: React.ReactNode }>\n fontSize?: number\n rulerHeight?: number\n textHeight?: number\n paddingHeight?: number\n headerHeight?: number\n cytobandHeight?: number\n trackLabels?: string\n themeName?: string\n}\n\ntype LGV = LinearGenomeViewModel\n\nexport interface Breakend {\n MateDirection: string\n Join: string\n Replacement: string\n MatePosition: string\n}\n\nexport type LayoutRecord = [number, number, number, number]\n\nasync function getBlockFeatures(\n model: BreakpointViewModel,\n track: { configuration: AnyConfigurationModel },\n) {\n const { views } = model\n const { rpcManager, assemblyManager } = getSession(model)\n const assemblyName = model.views[0]?.assemblyNames[0]\n if (!assemblyName) {\n return undefined\n }\n const assembly = await assemblyManager.waitForAssembly(assemblyName)\n if (!assembly) {\n return undefined // throw new Error(`assembly not found: \"${assemblyName}\"`)\n }\n const sessionId = track.configuration.trackId\n return Promise.all(\n views.map(async view =>\n (\n (await rpcManager.call(sessionId, 'CoreGetFeatures', {\n adapterConfig: getConf(track, ['adapter']),\n sessionId,\n regions: view.staticBlocks.contentBlocks,\n })) as Feature[][]\n ).flat(),\n ),\n )\n}\n\n/**\n * #stateModel BreakpointSplitView\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nexport default function stateModelFactory(pluginManager: PluginManager) {\n const minHeight = 40\n const defaultHeight = 400\n return types\n .compose(\n 'BreakpointSplitView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n type: types.literal('BreakpointSplitView'),\n /**\n * #property\n */\n height: types.optional(\n types.refinement(\n 'viewHeight',\n types.number,\n (n: number) => n >= minHeight,\n ),\n defaultHeight,\n ),\n /**\n * #property\n */\n trackSelectorType: 'hierarchical',\n /**\n * #property\n */\n showIntraviewLinks: true,\n /**\n * #property\n */\n linkViews: false,\n /**\n * #property\n */\n interactToggled: false,\n /**\n * #property\n */\n views: types.array(\n pluginManager.getViewType('LinearGenomeView')!\n .stateModel as LinearGenomeViewStateModel,\n ),\n }),\n )\n .volatile(() => ({\n width: 800,\n matchedTrackFeatures: {} as Record<string, Feature[][]>,\n }))\n .views(self => ({\n /**\n * #method\n * creates an svg export and save using FileSaver\n */\n async exportSvg(opts: ExportSvgOptions = {}) {\n const { renderToSvg } = await import(\n './svgcomponents/SVGBreakpointSplitView'\n )\n const html = await renderToSvg(self as BreakpointViewModel, opts)\n const blob = new Blob([html], { type: 'image/svg+xml' })\n saveAs(blob, opts.filename || 'image.svg')\n },\n }))\n .views(self => ({\n /**\n * #getter\n * Find all track ids that match across multiple views, or return just\n * the single view's track if only a single row is used\n */\n get matchedTracks() {\n return self.views.length === 1\n ? self.views[0]!.tracks\n : intersect(\n elt => elt.configuration.trackId,\n ...self.views.map(\n view => view.tracks as { configuration: { trackId: string } }[],\n ),\n )\n },\n\n /**\n * #method\n * Get tracks with a given trackId across multiple views\n */\n getMatchedTracks(trackConfigId: string) {\n return self.views\n .map(view => view.getTrack(trackConfigId))\n .filter(f => !!f)\n },\n\n /**\n * #method\n * Translocation features are handled differently since they do not have\n * a mate e.g. they are one sided\n */\n hasTranslocations(trackConfigId: string) {\n return [...this.getTrackFeatures(trackConfigId).values()].find(\n f => f.get('type') === 'translocation',\n )\n },\n\n /**\n * #method\n * Paired features similar to breakends, but simpler, like BEDPE\n */\n hasPairedFeatures(trackConfigId: string) {\n return [...this.getTrackFeatures(trackConfigId).values()].find(\n f => f.get('type') === 'paired_feature',\n )\n },\n\n /**\n * #method\n * Get a composite map of featureId-\\>feature map for a track across\n * multiple views\n */\n getTrackFeatures(trackConfigId: string) {\n return new Map(\n self.matchedTrackFeatures[trackConfigId]\n ?.flat()\n .map(f => [f.id(), f] as const),\n )\n },\n\n /**\n * #method\n */\n getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]) {\n // use reverse to search the second track first\n const tracks = this.getMatchedTracks(trackConfigId)\n return features.map(c =>\n c\n .map(feature => {\n const level = tracks.findIndex(track => calc(track, feature))\n return level !== -1\n ? {\n feature,\n layout: calc(tracks[level], feature),\n level,\n }\n : undefined\n })\n .filter(notEmpty),\n )\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n onAction(\n self,\n ({\n name,\n path,\n args,\n }: {\n name: string\n path?: string\n args?: unknown[]\n }) => {\n if (self.linkViews) {\n const actions = [\n 'horizontalScroll',\n 'zoomTo',\n 'setScaleFactor',\n 'showTrack',\n 'toggleTrack',\n 'hideTrack',\n 'setTrackLabels',\n 'toggleCenterLine',\n ]\n if (actions.includes(name) && path) {\n this.onSubviewAction(name, path, args)\n }\n }\n },\n ),\n )\n },\n\n onSubviewAction(actionName: string, path: string, args?: unknown[]) {\n self.views.forEach(view => {\n const ret = getPath(view)\n if (!ret.endsWith(path)) {\n // @ts-ignore\n view[actionName](args?.[0])\n }\n })\n },\n\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.width = newWidth\n self.views.forEach(v => {\n v.setWidth(newWidth)\n })\n },\n\n /**\n * #action\n */\n removeView(view: LGV) {\n self.views.remove(view)\n },\n\n /**\n * #action\n */\n toggleInteract() {\n self.interactToggled = !self.interactToggled\n },\n\n /**\n * #action\n */\n toggleIntraviewLinks() {\n self.showIntraviewLinks = !self.showIntraviewLinks\n },\n\n /**\n * #action\n */\n toggleLinkViews() {\n self.linkViews = !self.linkViews\n },\n\n /**\n * #action\n */\n setMatchedTrackFeatures(obj: Record<string, Feature[][]>) {\n self.matchedTrackFeatures = obj\n },\n /**\n * #action\n */\n reverseViewOrder() {\n self.views.reverse()\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(async () => {\n try {\n if (!self.views.every(view => view.initialized)) {\n return\n }\n self.setMatchedTrackFeatures(\n Object.fromEntries(\n await Promise.all(\n self.matchedTracks.map(async track => [\n track.configuration.trackId,\n await getBlockFeatures(self as any, track),\n ]),\n ),\n ),\n )\n } catch (e) {\n console.error(e)\n getSession(self).notifyError(`${e}`, e)\n }\n }),\n )\n },\n\n /**\n * #method\n */\n menuItems() {\n return [\n ...self.views\n .map((view, idx) => [idx, view.menuItems()] as const)\n .map(f => ({\n label: `Row ${f[0] + 1} view menu`,\n subMenu: f[1],\n })),\n\n {\n label: 'Reverse view order',\n onClick: () => {\n self.reverseViewOrder()\n },\n },\n {\n label: 'Show intra-view links',\n type: 'checkbox',\n checked: self.showIntraviewLinks,\n onClick: () => {\n self.toggleIntraviewLinks()\n },\n },\n {\n label: 'Allow clicking alignment squiggles?',\n type: 'checkbox',\n checked: self.interactToggled,\n onClick: () => {\n self.toggleInteract()\n },\n },\n\n {\n label: 'Link views',\n type: 'checkbox',\n icon: LinkIcon,\n checked: self.linkViews,\n onClick: () => {\n self.toggleLinkViews()\n },\n },\n {\n label: 'Export SVG',\n icon: PhotoCamera,\n onClick: (): void => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }))\n}\n\nexport type BreakpointViewStateModel = ReturnType<typeof stateModelFactory>\nexport type BreakpointViewModel = Instance<BreakpointViewStateModel>\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\nimport BreakpointAlignmentsWidgetF from './BreakpointAlignmentsFeatureDetail'\nimport BreakpointSplitViewF from './BreakpointSplitView'\n\nexport default class BreakpointSplitViewPlugin extends Plugin {\n name = 'BreakpointSplitViewPlugin'\n\n install(pluginManager: PluginManager) {\n BreakpointSplitViewF(pluginManager)\n BreakpointAlignmentsWidgetF(pluginManager)\n }\n\n configure() {}\n}\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport BreakpointSplitView from './BreakpointSplitView'\nimport stateModelFactory from './model'\n\nexport default function BreakpointSplitViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new BreakpointSplitView({\n name: 'BreakpointSplitView',\n displayName: 'Breakpoint split view',\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/BreakpointSplitView')),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config PAFAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst PAFAdapter = ConfigurationSchema(\n 'PAFAdapter',\n {\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',\n },\n /**\n * #slot\n */\n targetAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the target assembly name',\n },\n /**\n * #slot\n */\n queryAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the query assembly name',\n },\n /**\n * #slot\n */\n pafLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/file.paf',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default PAFAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config PairwiseIndexedPAFAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst PairwiseIndexedPAFAdapter = ConfigurationSchema(\n 'PairwiseIndexedPAFAdapter',\n {\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',\n },\n /**\n * #slot\n */\n targetAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the target assembly name',\n },\n /**\n * #slot\n */\n queryAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the query assembly name',\n },\n /**\n * #slot\n */\n pifGzLocation: {\n type: 'fileLocation',\n description: 'location of pairwise tabix indexed PAF (pif)',\n defaultValue: {\n uri: '/path/to/data/file.pif.gz',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n index: ConfigurationSchema('TabixIndex', {\n /**\n * #slot index.indexType\n */\n indexType: {\n model: types.enumeration('IndexType', ['TBI', 'CSI']),\n type: 'stringEnum',\n defaultValue: 'TBI',\n },\n /**\n * #slot index.location\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.paf.gz.tbi',\n locationType: 'UriLocation',\n },\n },\n }),\n },\n { explicitlyTyped: true },\n)\n\nexport default PairwiseIndexedPAFAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config MCScanAnchorsAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst MCScanAnchorsAdapter = ConfigurationSchema(\n 'MCScanAnchorsAdapter',\n {\n /**\n * #slot\n */\n mcscanAnchorsLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/mcscan.anchors',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n bed1Location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/file.bed',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n bed2Location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/file.bed',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default MCScanAnchorsAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config MCScanSimpleAnchorsAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst MCScanSimpleAnchorsAdapter = ConfigurationSchema(\n 'MCScanSimpleAnchorsAdapter',\n {\n /**\n * #slot\n */\n mcscanSimpleAnchorsLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/mcscan.anchors.simple',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n bed1Location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/file.bed',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n bed2Location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/file.bed',\n locationType: 'UriLocation',\n },\n },\n\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n },\n },\n { explicitlyTyped: true },\n)\nexport default MCScanSimpleAnchorsAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config MashMapAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst MashMapAdapter = ConfigurationSchema(\n 'MashMapAdapter',\n {\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Target is the first value in the array, query is the second',\n },\n\n /**\n * #slot\n */\n targetAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames array: the target assembly',\n },\n /**\n * #slot\n */\n queryAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames array: the query assembly',\n },\n /**\n * #slot\n */\n outLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/mashmap.out',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default MashMapAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config DeltaAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst DeltaAdapter = ConfigurationSchema(\n 'DeltaAdapter',\n {\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Array of assembly names to use for this file. The target assembly name is the first value in the array, query assembly name is the second',\n },\n /**\n * #slot\n * alternative to assembly names\n */\n targetAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the target assembly name',\n },\n /**\n * #slot\n * alternative to assembly names\n */\n queryAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames: the query assembly name',\n },\n /**\n * #slot\n */\n deltaLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/file.delta', locationType: 'UriLocation' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default DeltaAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config ChainAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst ChainAdapter = ConfigurationSchema(\n 'ChainAdapter',\n {\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Target is the first value in the array, query is the second',\n },\n /**\n * #slot\n * can be specified as alternative to assemblyNames\n */\n targetAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames array: the target assembly',\n },\n /**\n * #slot\n * can be specified as alternative to assemblyNames\n */\n queryAssembly: {\n type: 'string',\n defaultValue: '',\n description: 'Alternative to assemblyNames array: the query assembly',\n },\n /**\n * #slot\n */\n chainLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/file.chain', locationType: 'UriLocation' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default ChainAdapter\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\n\nimport PAFAdapterF from './PAFAdapter'\nimport PairwiseIndexedPAFAdapterF from './PairwiseIndexedPAFAdapter'\nimport MCScanAnchorsAdapterF from './MCScanAnchorsAdapter'\nimport MCScanSimpleAnchorsAdapterF from './MCScanSimpleAnchorsAdapter'\nimport MashMapAdapterF from './MashMapAdapter'\nimport DeltaAdapterF from './DeltaAdapter'\nimport ChainAdapterF from './ChainAdapter'\n\nimport {\n getFileName,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default class ComparativeAdaptersPlugin extends Plugin {\n name = 'ComparativeAdaptersPlugin'\n\n install(pluginManager: PluginManager) {\n PAFAdapterF(pluginManager)\n PairwiseIndexedPAFAdapterF(pluginManager)\n DeltaAdapterF(pluginManager)\n ChainAdapterF(pluginManager)\n MCScanAnchorsAdapterF(pluginManager)\n MCScanSimpleAnchorsAdapterF(pluginManager)\n MashMapAdapterF(pluginManager)\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.paf/i\n const adapterName = 'PAFAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n pafLocation: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) =>\n adapterName === 'PAFAdapter'\n ? 'SyntenyTrack'\n : trackTypeGuesser(adapterName)\n },\n )\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function PAFAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'PAFAdapter',\n displayName: 'PAF adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () => import('./PAFAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function PairwiseIndexedPAFAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'PairwiseIndexedPAFAdapter',\n displayName: 'Pairwise indexed PAF adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./PairwiseIndexedPAFAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function DeltaAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'DeltaAdapter',\n displayName: 'MUMmer delta adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () => import('./DeltaAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function ChainAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'ChainAdapter',\n displayName: 'Liftover chain adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () => import('./ChainAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function MCScanAnchorsAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'MCScanAnchorsAdapter',\n displayName: 'MCScan anchors adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n\n getAdapterClass: () =>\n import('./MCScanAnchorsAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function MCScanSimpleAnchorsAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'MCScanSimpleAnchorsAdapter',\n displayName: 'MCScan anchors.simple adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./MCScanSimpleAnchorsAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport configSchema from './configSchema'\n\nexport default function MashMapAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'MashMapAdapter',\n displayName: 'MashMap adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () => import('./MashMapAdapter').then(r => r.default),\n }),\n )\n}\n","import { getParent, Instance } from 'mobx-state-tree'\nimport { observable } from 'mobx'\nimport Base1DView from '@jbrowse/core/util/Base1DViewModel'\nimport calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks'\n\n/**\n * #stateModel Dotplot1DView\n * ref https://mobx-state-tree.js.org/concepts/volatiles on volatile state used here\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst Dotplot1DView = Base1DView.extend(self => {\n const scaleFactor = observable.box(1)\n return {\n views: {\n /**\n * #getter\n * this uses padding=false and elision=false\n */\n get dynamicBlocks() {\n return calculateDynamicBlocks(self, false, false)\n },\n /**\n * #getter\n */\n\n get scaleFactor() {\n return scaleFactor.get()\n },\n\n /**\n * #getter\n */\n get maxBpPerPx() {\n return self.totalBp / (self.width - 50)\n },\n\n /**\n * #getter\n */\n get minBpPerPx() {\n return 1 / 50\n },\n\n /**\n * #getter\n */\n get maxOffset() {\n return self.displayedRegionsTotalPx - self.width * 0.2\n },\n\n /**\n * #getter\n */\n get minOffset() {\n return -self.width * 0.8\n },\n },\n actions: {\n /**\n * #action\n */\n setScaleFactor(n: number) {\n scaleFactor.set(n)\n },\n\n /**\n * #action\n */\n center() {\n const centerBp = self.totalBp / 2\n const centerPx = centerBp / self.bpPerPx\n self.scrollTo(centerPx - self.width / 2)\n },\n },\n }\n})\n\nconst DotplotHView = Dotplot1DView.extend(self => ({\n views: {\n get width() {\n return getParent<any>(self).viewWidth\n },\n },\n}))\n\nconst DotplotVView = Dotplot1DView.extend(self => ({\n views: {\n get width() {\n return getParent<any>(self).viewHeight\n },\n },\n}))\n\nexport { DotplotVView, DotplotHView, Dotplot1DView }\nexport type Dotplot1DViewModel = Instance<typeof Dotplot1DView>\n","import React, { lazy } from 'react'\nimport {\n addDisposer,\n cast,\n getParent,\n getRoot,\n getSnapshot,\n resolveIdentifier,\n types,\n Instance,\n SnapshotIn,\n} from 'mobx-state-tree'\nimport { saveAs } from 'file-saver'\nimport { autorun, transaction } from 'mobx'\n\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport { BaseTrackStateModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel'\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport {\n getSession,\n isSessionModelWithWidgets,\n minmax,\n measureText,\n max,\n localStorageGetItem,\n getTickDisplayStr,\n} from '@jbrowse/core/util'\nimport { getConf, AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\n\n// icons\nimport { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\nimport PhotoCameraIcon from '@mui/icons-material/PhotoCamera'\n\n// locals\nimport { Dotplot1DView, DotplotHView, DotplotVView } from './1dview'\nimport { getBlockLabelKeysToHide, makeTicks } from './components/util'\nimport { BaseBlock } from '@jbrowse/core/util/blockTypes'\n\n// lazies\nconst ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'))\nconst ReturnToImportFormDialog = lazy(\n () => import('@jbrowse/core/ui/ReturnToImportFormDialog'),\n)\ntype Coord = [number, number]\n\nexport interface ExportSvgOptions {\n rasterizeLayers?: boolean\n filename?: string\n Wrapper?: React.FC<{ children: React.ReactNode }>\n themeName?: string\n}\n\nfunction stringLenPx(a: string) {\n return measureText(a.slice(0, 30))\n}\n\nfunction pxWidthForBlocks(\n blocks: BaseBlock[],\n bpPerPx: number,\n hide: Set<string>,\n) {\n return max([\n ...blocks.filter(b => !hide.has(b.key)).map(b => stringLenPx(b.refName)),\n ...blocks\n .filter(b => !hide.has(b.key))\n .map(b => stringLenPx(getTickDisplayStr(b.end, bpPerPx))),\n ])\n}\n\n/**\n * #stateModel DotplotView\n * #category view\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nexport default function stateModelFactory(pm: PluginManager) {\n return types\n .compose(\n 'DotplotView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('DotplotView'),\n /**\n * #property\n */\n height: 600,\n /**\n * #property\n */\n borderSize: 20,\n /**\n * #property\n */\n tickSize: 5,\n /**\n * #property\n */\n vtextRotation: 0,\n /**\n * #property\n */\n htextRotation: -90,\n /**\n * #property\n */\n fontSize: 15,\n /**\n * #property\n */\n trackSelectorType: 'hierarchical',\n /**\n * #property\n */\n assemblyNames: types.array(types.string),\n /**\n * #property\n */\n drawCigar: true,\n /**\n * #property\n */\n hview: types.optional(DotplotHView, {}),\n /**\n * #property\n */\n vview: types.optional(DotplotVView, {}),\n\n /**\n * #property\n */\n tracks: types.array(\n pm.pluggableMstType('track', 'stateModel') as BaseTrackStateModel,\n ),\n\n /**\n * #property\n * this represents tracks specific to this view specifically used\n * for read vs ref dotplots where this track would not really apply\n * elsewhere\n */\n viewTrackConfigs: types.array(pm.pluggableConfigSchemaType('track')),\n }),\n )\n .volatile(() => ({\n volatileWidth: undefined as number | undefined,\n volatileError: undefined as unknown,\n\n // these are 'personal preferences', stored in volatile and\n // loaded/written to localStorage\n cursorMode: localStorageGetItem('dotplot-cursorMode') || 'crosshair',\n showPanButtons: Boolean(\n JSON.parse(localStorageGetItem('dotplot-showPanbuttons') || 'true'),\n ),\n wheelMode: localStorageGetItem('dotplot-wheelMode') || 'zoom',\n borderX: 100,\n borderY: 100,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get width(): number {\n if (!self.volatileWidth) {\n throw new Error('width not initialized')\n }\n return self.volatileWidth\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get assemblyErrors() {\n const { assemblyManager } = getSession(self)\n return self.assemblyNames\n .map(a => assemblyManager.get(a)?.error)\n .filter(f => !!f)\n .join(', ')\n },\n /**\n * #getter\n */\n get assembliesInitialized() {\n const { assemblyManager } = getSession(self)\n return self.assemblyNames.every(\n n => assemblyManager.get(n)?.initialized ?? true,\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get initialized() {\n return (\n self.volatileWidth !== undefined &&\n self.hview.displayedRegions.length > 0 &&\n self.vview.displayedRegions.length > 0 &&\n self.assembliesInitialized\n )\n },\n /**\n * #getter\n */\n get hticks() {\n const { hview } = self\n const { dynamicBlocks, staticBlocks, bpPerPx } = hview\n return dynamicBlocks.contentBlocks.length > 5\n ? []\n : makeTicks(staticBlocks.contentBlocks, bpPerPx)\n },\n /**\n * #getter\n */\n get vticks() {\n const { vview } = self\n const { dynamicBlocks, staticBlocks, bpPerPx } = vview\n return dynamicBlocks.contentBlocks.length > 5\n ? []\n : makeTicks(staticBlocks.contentBlocks, bpPerPx)\n },\n /**\n * #getter\n */\n get loading() {\n return self.assemblyNames.length > 0 && !this.initialized\n },\n /**\n * #getter\n */\n get viewWidth() {\n return self.width - self.borderX\n },\n /**\n * #getter\n */\n get viewHeight() {\n return self.height - self.borderY\n },\n /**\n * #getter\n */\n get views() {\n return [self.hview, self.vview]\n },\n\n /**\n * #method\n */\n renderProps() {\n const session = getSession(self)\n return {\n ...getParentRenderProps(self),\n drawCigar: self.drawCigar,\n highResolutionScaling: getConf(session, 'highResolutionScaling'),\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setShowPanButtons(flag: boolean) {\n self.showPanButtons = flag\n },\n /**\n * #action\n */\n setWheelMode(str: string) {\n self.wheelMode = str\n },\n /**\n * #action\n */\n setCursorMode(str: string) {\n self.cursorMode = str\n },\n /**\n * #action\n */\n setDrawCigar(flag: boolean) {\n self.drawCigar = flag\n },\n /**\n * #action\n * returns to the import form\n */\n clearView() {\n self.hview.setDisplayedRegions([])\n self.vview.setDisplayedRegions([])\n self.assemblyNames = cast([])\n self.tracks.clear()\n },\n /**\n * #action\n */\n setBorderX(n: number) {\n self.borderX = n\n },\n /**\n * #action\n */\n setBorderY(n: number) {\n self.borderY = n\n },\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.volatileWidth = newWidth\n return self.volatileWidth\n },\n /**\n * #action\n */\n setHeight(newHeight: number) {\n self.height = newHeight\n return self.height\n },\n\n /**\n * #action\n */\n setError(e: unknown) {\n self.volatileError = e\n },\n\n /**\n * #action\n */\n zoomOutButton() {\n self.hview.zoomOut()\n self.vview.zoomOut()\n },\n /**\n * #action\n */\n zoomInButton() {\n self.hview.zoomIn()\n self.vview.zoomIn()\n },\n /**\n * #action\n */\n activateTrackSelector() {\n if (self.trackSelectorType === 'hierarchical') {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const selector = session.addWidget(\n 'HierarchicalTrackSelectorWidget',\n 'hierarchicalTrackSelector',\n { view: self },\n )\n session.showWidget(selector)\n return selector\n }\n }\n throw new Error(`invalid track selector type ${self.trackSelectorType}`)\n },\n\n /**\n * #action\n */\n showTrack(trackId: string, initialSnapshot = {}) {\n const schema = pm.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n const trackType = pm.getTrackType(conf.type)\n if (!trackType) {\n throw new Error(`unknown track type ${conf.type}`)\n }\n const viewType = pm.getViewType(self.type)!\n const displayConf = conf.displays.find((d: AnyConfigurationModel) =>\n viewType.displayTypes.find(type => type.name === d.type),\n )\n if (!displayConf) {\n throw new Error(\n `could not find a compatible display for view type ${self.type}`,\n )\n }\n const track = trackType.stateModel.create({\n ...initialSnapshot,\n type: conf.type,\n configuration: conf,\n displays: [{ type: displayConf.type, configuration: displayConf }],\n })\n self.tracks.push(track)\n },\n\n /**\n * #action\n */\n hideTrack(trackId: string) {\n const schema = pm.pluggableConfigSchemaType('track')\n const conf = resolveIdentifier(schema, getRoot(self), trackId)\n const t = self.tracks.filter(t => t.configuration === conf)\n transaction(() => {\n t.forEach(t => self.tracks.remove(t))\n })\n return t.length\n },\n /**\n * #action\n */\n toggleTrack(trackId: string) {\n const hiddenCount = this.hideTrack(trackId)\n if (!hiddenCount) {\n this.showTrack(trackId)\n return true\n }\n return false\n },\n /**\n * #action\n */\n setAssemblyNames(target: string, query: string) {\n self.assemblyNames = cast([target, query])\n },\n /**\n * #action\n */\n setViews(arr: SnapshotIn<Base1DViewModel>[]) {\n self.hview = cast(arr[0])\n self.vview = cast(arr[1])\n },\n\n /**\n * #action\n */\n getCoords(mousedown: Coord, mouseup: Coord) {\n const [xmin, xmax] = minmax(mouseup[0], mousedown[0])\n const [ymin, ymax] = minmax(mouseup[1], mousedown[1])\n return Math.abs(xmax - xmin) > 3 && Math.abs(ymax - ymin) > 3\n ? [\n self.hview.pxToBp(xmin),\n self.hview.pxToBp(xmax),\n self.vview.pxToBp(self.viewHeight - ymin),\n self.vview.pxToBp(self.viewHeight - ymax),\n ]\n : undefined\n },\n\n /**\n * #action\n * zooms into clicked and dragged region\n */\n zoomIn(mousedown: Coord, mouseup: Coord) {\n const result = this.getCoords(mousedown, mouseup)\n if (result) {\n const [x1, x2, y1, y2] = result\n self.hview.moveTo(x1, x2)\n self.vview.moveTo(y2, y1)\n }\n },\n /**\n * #action\n */\n showAllRegions() {\n self.hview.zoomTo(self.hview.maxBpPerPx)\n self.vview.zoomTo(self.vview.maxBpPerPx)\n self.vview.center()\n self.hview.center()\n },\n /**\n * #action\n * creates a linear synteny view from the clicked and dragged region\n */\n onDotplotView(mousedown: Coord, mouseup: Coord) {\n const result = this.getCoords(mousedown, mouseup)\n if (result) {\n const [x1, x2, y1, y2] = result\n const session = getSession(self)\n\n const d1 = Dotplot1DView.create({\n ...getSnapshot(self.hview),\n minimumBlockWidth: 0,\n interRegionPaddingWidth: 0,\n })\n const d2 = Dotplot1DView.create({\n ...getSnapshot(self.vview),\n minimumBlockWidth: 0,\n interRegionPaddingWidth: 0,\n })\n d1.setVolatileWidth(self.hview.width)\n d2.setVolatileWidth(self.vview.width)\n d1.moveTo(x1, x2)\n d2.moveTo(y2, y1)\n d1.zoomTo(d1.bpPerPx / (self.width / self.hview.width), 0)\n d2.zoomTo(d2.bpPerPx / (self.width / self.vview.width), 0)\n\n // add the specific evidence tracks to the LGVs in the split view\n // note: scales the bpPerPx by scaling proportional of the dotplot\n // width to the eventual lgv width\n const tracks = self.tracks\n .map(track =>\n track.configuration.displays.find(\n (display: { type: string }) =>\n display.type === 'LinearSyntenyDisplay',\n ),\n )\n .filter(f => !!f)\n .map(displayConf => {\n const trackConf = getParent<AnyConfigurationModel>(displayConf, 2)\n return {\n type: trackConf.type,\n configuration: trackConf,\n displays: [\n { type: displayConf.type, configuration: displayConf },\n ],\n }\n })\n\n const { id: _unused1, ...rest1 } = getSnapshot(d1)\n const { id: _unused2, ...rest2 } = getSnapshot(d2)\n const viewSnapshot = {\n type: 'LinearSyntenyView',\n views: [\n {\n type: 'LinearGenomeView',\n tracks: [],\n hideHeader: true,\n ...rest1,\n },\n {\n type: 'LinearGenomeView',\n tracks: [],\n hideHeader: true,\n ...rest2,\n },\n ],\n tracks,\n }\n\n session.addView('LinearSyntenyView', viewSnapshot)\n }\n },\n }))\n .actions(self => ({\n /**\n * #action\n * creates an svg export and save using FileSaver\n */\n async exportSvg(opts: ExportSvgOptions = {}) {\n const { renderToSvg } = await import('./svgcomponents/SVGDotplotView')\n const html = await renderToSvg(self as DotplotViewModel, opts)\n const blob = new Blob([html], { type: 'image/svg+xml' })\n saveAs(blob, opts.filename || 'image.svg')\n },\n // if any of our assemblies are temporary assemblies\n beforeDestroy() {\n const session = getSession(self)\n for (const name in self.assemblyNames) {\n session.removeTemporaryAssembly?.(name)\n }\n },\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n const s = (s: unknown) => JSON.stringify(s)\n const { showPanButtons, wheelMode, cursorMode } = self\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem('dotplot-showPanbuttons', s(showPanButtons))\n localStorage.setItem('dotplot-cursorMode', cursorMode)\n localStorage.setItem('dotplot-wheelMode', wheelMode)\n }\n }),\n )\n addDisposer(\n self,\n autorun(\n () => {\n const session = getSession(self)\n\n // don't operate if width not set yet\n if (\n self.volatileWidth === undefined ||\n !self.assembliesInitialized\n ) {\n return\n }\n\n // also don't operate if displayedRegions already set, this is a\n // helper autorun to load regions from assembly\n if (\n self.hview.displayedRegions.length > 0 &&\n self.vview.displayedRegions.length > 0\n ) {\n return\n }\n\n const views = [self.hview, self.vview]\n transaction(() => {\n self.assemblyNames.forEach((name, index) => {\n const assembly = session.assemblyManager.get(name)\n const view = views[index]!\n view.setDisplayedRegions(assembly?.regions || [])\n })\n self.showAllRegions()\n })\n },\n { delay: 1000 },\n ),\n )\n addDisposer(\n self,\n autorun(function borderSetter() {\n // make sure we have a width on the view before trying to load\n if (self.volatileWidth === undefined) {\n return\n }\n const { vview, hview, viewHeight, viewWidth } = self\n const padding = 40\n const vblocks = vview.dynamicBlocks.contentBlocks\n const hblocks = hview.dynamicBlocks.contentBlocks\n const hoffset = hview.offsetPx\n const voffset = vview.offsetPx\n\n const vhide = getBlockLabelKeysToHide(vblocks, viewHeight, voffset)\n const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset)\n const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide)\n const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide)\n\n // these are set via autorun to avoid dependency cycle\n self.setBorderY(Math.max(by + padding, 50))\n self.setBorderX(Math.max(bx + padding, 50))\n }),\n )\n },\n /**\n * #action\n */\n squareView() {\n const { hview, vview } = self\n const avg = (hview.bpPerPx + vview.bpPerPx) / 2\n const hpx = hview.pxToBp(hview.width / 2)\n const vpx = vview.pxToBp(vview.width / 2)\n hview.setBpPerPx(avg)\n hview.centerAt(hpx.coord, hpx.refName, hpx.index)\n vview.setBpPerPx(avg)\n vview.centerAt(vpx.coord, vpx.refName, vpx.index)\n },\n /**\n * #action\n */\n squareViewProportional() {\n const { hview, vview } = self\n const ratio = hview.width / vview.width\n const avg = (hview.bpPerPx + vview.bpPerPx) / 2\n const hpx = hview.pxToBp(hview.width / 2)\n const vpx = vview.pxToBp(vview.width / 2)\n hview.setBpPerPx(avg / ratio)\n hview.centerAt(hpx.coord, hpx.refName, hpx.index)\n vview.setBpPerPx(avg)\n vview.centerAt(vpx.coord, vpx.refName, vpx.index)\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n menuItems() {\n const session = getSession(self)\n return [\n {\n label: 'Return to import form',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ReturnToImportFormDialog,\n { model: self, handleClose },\n ])\n },\n icon: FolderOpenIcon,\n },\n {\n label: 'Square view - same bp per pixel',\n onClick: () => {\n self.squareView()\n },\n },\n {\n label: 'Rectangular view - same total bp',\n onClick: () => {\n self.squareView()\n },\n },\n {\n label: 'Show all regions',\n onClick: () => {\n self.showAllRegions()\n },\n },\n {\n label: 'Export SVG',\n icon: PhotoCameraIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n ...(isSessionModelWithWidgets(session)\n ? [\n {\n label: 'Open track selector',\n onClick: self.activateTrackSelector,\n icon: TrackSelectorIcon,\n },\n ]\n : []),\n ]\n },\n /**\n * #getter\n */\n get error(): unknown {\n return self.volatileError || self.assemblyErrors\n },\n }))\n}\n\nexport type DotplotViewStateModel = ReturnType<typeof stateModelFactory>\nexport type DotplotViewModel = Instance<DotplotViewStateModel>\n\nexport { type Dotplot1DViewModel, Dotplot1DView } from './1dview'\n","import React, { useEffect, useState, CSSProperties } from 'react'\nimport { makeStyles } from 'tss-react/mui'\nimport { Typography } from '@mui/material'\nimport { LoadingEllipses } from '@jbrowse/core/ui'\nimport { observer } from 'mobx-react'\n\nconst useStyles = makeStyles()(theme => {\n const bg = theme.palette.action.disabledBackground\n return {\n loading: {\n paddingLeft: '0.6em',\n backgroundColor: theme.palette.background.default,\n backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,\n textAlign: 'center',\n },\n\n blockMessage: {\n backgroundColor: bg,\n padding: '10px',\n },\n blockError: {\n backgroundColor: bg,\n padding: '10px',\n color: 'red',\n },\n }\n})\n\nfunction LoadingMessage() {\n // only show the loading message after 300ms to prevent excessive flickering\n const [shown, setShown] = useState(false)\n const { classes } = useStyles()\n useEffect(() => {\n const timeout = setTimeout(() => {\n setShown(true)\n }, 300)\n return () => {\n clearTimeout(timeout)\n }\n }, [])\n\n return shown ? (\n <div className={classes.loading}>\n <LoadingEllipses />\n </div>\n ) : null\n}\n\nfunction BlockMessage({ messageText }: { messageText: string }) {\n const { classes } = useStyles()\n return (\n <div className={classes.blockMessage}>\n <Typography>{messageText}</Typography>\n </div>\n )\n}\n\nfunction BlockError({ error }: { error: unknown }) {\n const { classes } = useStyles()\n return (\n <div className={classes.blockError}>\n <Typography>{`${error}`}</Typography>\n </div>\n )\n}\n\nconst ServerSideRenderedDotplotContent = observer(function ({\n model,\n style,\n}: {\n model: {\n error?: unknown\n message?: string\n filled?: boolean\n shouldDisplay?: boolean\n reactElement?: React.ReactElement\n }\n style: CSSProperties\n}) {\n if (model.error) {\n return <BlockError error={model.error} data-testid=\"reload_button\" />\n } else if (model.message) {\n return <BlockMessage messageText={model.message} />\n } else if (!model.filled) {\n return <LoadingMessage />\n } else if (model.shouldDisplay) {\n return <div style={style}>{model.reactElement}</div>\n }\n return null\n})\n\nexport default ServerSideRenderedDotplotContent\n","import clone from 'clone'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { getSnapshot, IAnyStateTreeNode } from 'mobx-state-tree'\nimport { getContainingView, getSession } from '@jbrowse/core/util'\n\nimport { DotplotViewModel } from '../DotplotView/model'\n\nexport function renderBlockData(self: IAnyStateTreeNode) {\n const { rpcManager } = getSession(self)\n const { rendererType } = self\n const { adapterConfig } = self\n const parent = getContainingView(self) as DotplotViewModel\n\n // Alternative to readConfObject(config) is below used because renderProps is\n // something under our control. Compare to serverSideRenderedBlock\n readConfObject(self.configuration)\n getSnapshot(parent)\n\n if (parent.initialized) {\n const { viewWidth, viewHeight, borderSize, borderX, borderY } = parent\n return {\n rendererType,\n rpcManager,\n renderProps: {\n ...self.renderProps(),\n view: clone(getSnapshot(parent)),\n width: viewWidth,\n height: viewHeight,\n borderSize,\n borderX,\n borderY,\n adapterConfig,\n rendererType: rendererType.name,\n sessionId: getRpcSessionId(self),\n timeout: 1000000, // 10000,\n },\n }\n }\n return undefined\n}\n\nexport async function renderBlockEffect(\n props?: ReturnType<typeof renderBlockData>,\n) {\n if (!props) {\n return\n }\n\n const { rendererType, rpcManager, renderProps } = props\n const { reactElement, ...data } = await rendererType.renderInClient(\n rpcManager,\n renderProps,\n )\n return {\n reactElement,\n data,\n renderingComponent: rendererType.ReactComponent,\n }\n}\n","import React from 'react'\nimport { ThemeOptions } from '@mui/material'\nimport { types, Instance } from 'mobx-state-tree'\nimport {\n getConf,\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport {\n getContainingView,\n makeAbortableReaction,\n ReactRendering,\n} from '@jbrowse/core/util'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'\n\n// locals\nimport ServerSideRenderedBlockContent from '../ServerSideRenderedBlockContent'\nimport { renderBlockData, renderBlockEffect } from './renderDotplotBlock'\nimport { DotplotViewModel, ExportSvgOptions } from '../DotplotView/model'\n\n/**\n * #stateModel DotplotDisplay\n * #category display\n */\nexport function stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'DotplotDisplay',\n BaseDisplay,\n types\n .model({\n /**\n * #property\n */\n type: types.literal('DotplotDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n })\n .volatile(() => ({\n warnings: [] as { message: string; effect: string }[],\n renderInProgress: undefined as AbortController | undefined,\n filled: false,\n data: undefined as any,\n reactElement: undefined as React.ReactElement | undefined,\n message: undefined as string | undefined,\n renderingComponent: undefined as any,\n ReactComponent2:\n ServerSideRenderedBlockContent as unknown as React.FC<any>,\n })),\n )\n .views(self => ({\n get shouldDisplay() {\n const { vview, hview } = getContainingView(self) as DotplotViewModel\n return (\n vview.bpPerPx === self.data.bpPerPxY &&\n hview.bpPerPx === self.data.bpPerPxX\n )\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return getConf(self, ['renderer', 'type'])\n },\n /**\n * #method\n */\n renderProps() {\n return {\n ...getParentRenderProps(self),\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n config: self.configuration.renderer,\n }\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n async renderSvg(opts: ExportSvgOptions & { theme?: ThemeOptions }) {\n const props = renderBlockData(self)\n if (!props) {\n return null\n }\n\n const { rendererType, rpcManager, renderProps } = props\n const rendering = await rendererType.renderInClient(rpcManager, {\n ...renderProps,\n exportSVG: opts,\n theme: opts.theme || renderProps.theme,\n })\n const { hview, vview } = getContainingView(self) as DotplotViewModel\n const offX = -hview.offsetPx + rendering.offsetX\n const offY = -vview.offsetPx + rendering.offsetY\n return (\n <g transform={`translate(${offX} ${-offY})`}>\n <ReactRendering rendering={rendering} />\n </g>\n )\n },\n }))\n .actions(self => {\n let renderInProgress: undefined | AbortController\n\n return {\n afterAttach() {\n makeAbortableReaction(\n self,\n () => renderBlockData(self),\n blockData => renderBlockEffect(blockData),\n {\n name: `${self.type} ${self.id} rendering`,\n delay: 500,\n fireImmediately: true,\n },\n this.setLoading,\n this.setRendered,\n this.setError,\n )\n },\n /**\n * #action\n */\n setLoading(abortController: AbortController) {\n self.filled = false\n self.message = undefined\n self.reactElement = undefined\n self.data = undefined\n self.error = undefined\n self.renderingComponent = undefined\n renderInProgress = abortController\n },\n /**\n * #action\n */\n setMessage(messageText: string) {\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n self.filled = false\n self.message = messageText\n self.reactElement = undefined\n self.data = undefined\n self.error = undefined\n self.renderingComponent = undefined\n renderInProgress = undefined\n },\n /**\n * #action\n */\n setRendered(args?: {\n data: any\n reactElement: React.ReactElement\n renderingComponent: React.Component\n }) {\n if (args === undefined) {\n return\n }\n const { data, reactElement, renderingComponent } = args\n self.warnings = data.warnings\n self.filled = true\n self.message = undefined\n self.reactElement = reactElement\n self.data = data\n self.error = undefined\n self.renderingComponent = renderingComponent\n renderInProgress = undefined\n },\n /**\n * #action\n */\n setError(error: unknown) {\n console.error(error)\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n // the rendering failed for some reason\n self.filled = false\n self.message = undefined\n self.reactElement = undefined\n self.data = undefined\n self.error = error\n self.renderingComponent = undefined\n renderInProgress = undefined\n },\n }\n })\n}\n\nexport type DotplotDisplayStateModel = ReturnType<typeof stateModelFactory>\nexport type DotplotDisplayModel = Instance<DotplotDisplayStateModel>\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { getContainingView } from '@jbrowse/core/util'\n\n// locals\nimport { DotplotDisplayModel } from '../stateModelFactory'\nimport { DotplotViewModel } from '../../DotplotView/model'\n\nconst DotplotDisplay = observer(function DotplotDisplay(props: {\n model: DotplotDisplayModel\n children?: React.ReactNode\n}) {\n const { model, children } = props\n const { offsetX = 0, offsetY = 0 } = model.data || {}\n const view = getContainingView(model) as DotplotViewModel\n\n const top = view.vview.offsetPx - offsetY\n const left = -(view.hview.offsetPx - offsetX)\n return (\n <div style={{ position: 'relative' }}>\n <model.ReactComponent2\n {...props}\n style={{\n position: 'absolute',\n top,\n left,\n }}\n />\n {children}\n </div>\n )\n})\n\nexport default DotplotDisplay\n","import React from 'react'\nimport { PrerenderedCanvas } from '@jbrowse/core/ui'\nimport { observer } from 'mobx-react'\n\n// locals\nimport { DotplotRenderArgsDeserialized } from '../DotplotRenderer'\n\nconst DotplotRendering = observer(function (\n props: DotplotRenderArgsDeserialized,\n) {\n return <PrerenderedCanvas {...props} />\n})\n\nexport default DotplotRendering\n","import { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport {\n renameRegionsIfNeeded,\n renderToAbstractCanvas,\n Region,\n} from '@jbrowse/core/util'\nimport ComparativeRenderer, {\n RenderArgsDeserialized,\n RenderArgs,\n} from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType'\n\n// locals\nimport { Dotplot1DView, Dotplot1DViewModel } from '../DotplotView/model'\n\nexport interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {\n adapterConfig: AnyConfigurationModel\n height: number\n width: number\n highResolutionScaling: number\n view: {\n hview: Dotplot1DViewModel\n vview: Dotplot1DViewModel\n }\n}\n\ninterface DotplotRenderArgs extends RenderArgs {\n adapterConfig: AnyConfigurationModel\n sessionId: string\n view: {\n hview: { displayedRegions: Region[] }\n vview: { displayedRegions: Region[] }\n }\n}\n\nexport default class DotplotRenderer extends ComparativeRenderer {\n supportsSVG = true\n\n async renameRegionsIfNeeded(args: DotplotRenderArgs) {\n const pm = this.pluginManager\n const assemblyManager = pm.rootModel?.session?.assemblyManager\n\n const { view, sessionId, adapterConfig } = args\n\n async function process(regions?: Region[]) {\n if (!assemblyManager) {\n throw new Error('No assembly manager provided')\n }\n const result = await renameRegionsIfNeeded(assemblyManager, {\n sessionId,\n adapterConfig,\n regions,\n })\n return result.regions\n }\n\n view.hview.displayedRegions = await process(view.hview.displayedRegions)\n view.vview.displayedRegions = await process(view.vview.displayedRegions)\n\n return args\n }\n\n async render(renderProps: DotplotRenderArgsDeserialized) {\n const {\n width,\n height,\n view: { hview, vview },\n } = renderProps\n const dimensions = [width, height]\n const views = [hview, vview].map((snap, idx) => {\n const view = Dotplot1DView.create(snap)\n view.setVolatileWidth(dimensions[idx]!)\n return view\n })\n const target = views[0]!\n const feats = await this.getFeatures({\n ...renderProps,\n regions: target.dynamicBlocks.contentBlocks,\n })\n target.setFeatures(feats)\n\n const { drawDotplot } = await import('./drawDotplot')\n const ret = await renderToAbstractCanvas(width, height, renderProps, ctx =>\n drawDotplot(ctx, { ...renderProps, views }),\n )\n\n const results = await super.render({\n ...renderProps,\n ...ret,\n height,\n width,\n })\n\n return {\n ...results,\n ...ret,\n height,\n width,\n offsetX: views[0]!.dynamicBlocks.blocks[0]?.offsetPx || 0,\n offsetY: views[1]!.dynamicBlocks.blocks[0]?.offsetPx || 0,\n bpPerPxX: views[0]!.bpPerPx,\n bpPerPxY: views[1]!.bpPerPx,\n }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config DotplotRenderer\n * #category renderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default ConfigurationSchema(\n 'DotplotRenderer',\n {\n /**\n * #slot\n */\n color: {\n type: 'color',\n description:\n 'the color of each feature in a synteny, used with colorBy:default',\n defaultValue: '#f0f',\n contextVariable: ['feature'],\n },\n\n /**\n * #slot\n */\n posColor: {\n type: 'color',\n description: 'the color for forward alignments, used with colorBy:strand',\n defaultValue: 'blue',\n },\n /**\n * #slot\n */\n negColor: {\n type: 'color',\n description: 'the color for reverse alignments, used with colorBy:strand',\n defaultValue: 'red',\n },\n\n /**\n * #slot\n */\n lineWidth: {\n type: 'number',\n description: 'width of the lines to be drawn',\n defaultValue: 2.5, // 2.5 is similar to D-GENIES\n },\n\n /**\n * #slot\n */\n colorBy: {\n type: 'stringEnum',\n model: types.enumeration('colorBy', [\n 'identity',\n 'meanQueryIdentity',\n 'mappingQuality',\n 'strand',\n 'default',\n ]),\n description: `Color by options:<br/>\n<ul>\n <li>\"identity\" - the identity of the particular hit, similar to D-GENIES, use the other config slots 'thresholds' and 'thresholdsPalette' to define colors for this setting</li>\n <li>\"meanQueryIdentity\" - calculates the weighted mean identity (weighted by alignment length) of all the hits that the query maps to (e.g. if the query is split aligned to many target, uses their weighted mean. can help show patterns of more related and distant synteny after WGD)</li>\n <li>\"mappingQuality\" - uses mapping quality from PAF, some adapters don't have this setting</li>\n <li>\"strand\" - colors negative alignments with negColor and positive alignments with posColor</li>\n <li>\"default\" - uses the 'color' config slot</li>\n</ul>`,\n defaultValue: 'default',\n },\n\n /**\n * #slot\n */\n thresholdsPalette: {\n type: 'stringArray',\n defaultValue: ['#094b09', '#2ebd40', '#d5670b', '#ffd84b'],\n description: 'threshold colors, used with colorBy:identity',\n },\n\n /**\n * #slot\n */\n thresholds: {\n type: 'stringArray',\n defaultValue: ['0.75', '0.5', '0.25', '0'],\n description: 'threshold breakpoints, used with colorBy:identity',\n },\n },\n { explicitlyTyped: true },\n)\n","import { checkAbortSignal } from '@jbrowse/core/util'\nimport RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'\nimport ComparativeRenderer, {\n RenderArgs as ComparativeRenderArgs,\n RenderArgsSerialized as ComparativeRenderArgsSerialized,\n RenderResults,\n ResultsSerialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType'\nimport { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'\n\ninterface RenderArgs extends ComparativeRenderArgs {\n adapterConfig: Record<string, unknown>\n rendererType: string\n}\n\ninterface RenderArgsSerialized extends ComparativeRenderArgsSerialized {\n adapterConfig: Record<string, unknown>\n rendererType: string\n}\n\n/**\n * call a synteny renderer with the given args\n * param views: a set of views that each contain a set of regions\n * used instead of passing regions directly as in render()\n */\nexport default class ComparativeRender extends RpcMethodType {\n name = 'ComparativeRender'\n\n async renameRegionsIfNeeded(args: RenderArgs, rend: ComparativeRenderer) {\n return rend.renameRegionsIfNeeded(args)\n }\n\n getRenderer(rendererType: string) {\n const pm = this.pluginManager\n return pm.getRendererType(rendererType) as ComparativeRenderer\n }\n\n async serializeArguments(args: RenderArgs, rpcDriver: string) {\n const { rendererType } = args\n const renderer = this.getRenderer(rendererType)\n const n = (await super.serializeArguments(args, rpcDriver)) as RenderArgs\n const result = await this.renameRegionsIfNeeded(n, renderer)\n\n return rpcDriver === 'MainThreadRpcDriver'\n ? result\n : renderer.serializeArgsInClient(result)\n }\n\n async execute(\n args: RenderArgsSerialized & { signal?: RemoteAbortSignal },\n rpcDriver: string,\n ) {\n let deserializedArgs = args\n if (rpcDriver !== 'MainThreadRpcDriver') {\n deserializedArgs = await this.deserializeArguments(args, rpcDriver)\n }\n const { sessionId, rendererType, signal } = deserializedArgs\n if (!sessionId) {\n throw new Error('must pass a unique session id')\n }\n\n checkAbortSignal(signal)\n\n const renderer = this.getRenderer(rendererType)\n return rpcDriver === 'MainThreadRpcDriver'\n ? renderer.render(deserializedArgs)\n : renderer.renderInWorker(deserializedArgs)\n }\n\n async deserializeReturn(\n val: RenderResults | ResultsSerialized,\n args: RenderArgs,\n rpcDriver: string,\n ): Promise<unknown> {\n const ret = (await super.deserializeReturn(\n val,\n args,\n rpcDriver,\n )) as ResultsSerialized\n if (rpcDriver === 'MainThreadRpcDriver') {\n return ret\n }\n\n const renderer = this.getRenderer(args.rendererType)\n return renderer.deserializeResultsInClient(ret, args)\n }\n}\n","import { getConf } from '@jbrowse/core/configuration'\nimport { getSession, Feature, gatherOverlaps } from '@jbrowse/core/util'\nimport {\n LinearPileupDisplayModel,\n MismatchParser,\n} from '@jbrowse/plugin-alignments'\n\n// locals\nimport { ReducedFeature } from '../util'\n\nconst { featurizeSA, getClip, getTag, getLength, getLengthSansClipping } =\n MismatchParser\n\nexport function onClick(feature: Feature, self: LinearPileupDisplayModel) {\n const session = getSession(self)\n try {\n const cigar = feature.get('CIGAR')\n const clipPos = getClip(cigar, 1)\n const flags = feature.get('flags')\n const strand = feature.get('strand')\n const readName = feature.get('name')\n const readAssembly = `${readName}_assembly_${Date.now()}`\n const { parentTrack } = self\n const [trackAssembly] = getConf(parentTrack, 'assemblyNames')\n const assemblyNames = [trackAssembly, readAssembly]\n const trackId = `track-${Date.now()}`\n const trackName = `${readName}_vs_${trackAssembly}`\n const SA = (getTag(feature, 'SA') as string) || ''\n const SA2 = featurizeSA(SA, feature.id(), strand, readName, true)\n\n const feat = feature.toJSON()\n feat.strand = 1\n feat.mate = {\n refName: readName,\n start: clipPos,\n end: clipPos + getLengthSansClipping(cigar),\n }\n\n // if secondary alignment or supplementary, calculate length from SA[0]'s\n // CIGAR which is the primary alignments. otherwise it is the primary\n // alignment just use seq.length if primary alignment\n const totalLength = getLength(flags & 2048 ? SA2[0]!.CIGAR : cigar)\n\n const features = [feat, ...SA2] as ReducedFeature[]\n\n features.sort((a, b) => a.clipPos - b.clipPos)\n\n const refLength = features.reduce((a, f) => a + f.end - f.start, 0)\n\n session.addView('DotplotView', {\n type: 'DotplotView',\n hview: {\n offsetPx: 0,\n bpPerPx: refLength / 800,\n displayedRegions: gatherOverlaps(\n features.map((f, index) => {\n const { start, end, refName } = f\n return {\n start,\n end,\n refName,\n index,\n assemblyName: trackAssembly,\n }\n }),\n ),\n },\n vview: {\n offsetPx: 0,\n bpPerPx: totalLength / 400,\n minimumBlockWidth: 0,\n interRegionPaddingWidth: 0,\n displayedRegions: [\n {\n assemblyName: readAssembly,\n start: 0,\n end: totalLength,\n refName: readName,\n },\n ],\n },\n\n viewTrackConfigs: [\n {\n type: 'SyntenyTrack',\n assemblyNames,\n adapter: {\n type: 'FromConfigAdapter',\n features,\n },\n trackId,\n name: trackName,\n },\n ],\n assemblyNames,\n tracks: [\n {\n configuration: trackId,\n type: 'SyntenyTrack',\n displays: [\n {\n type: 'DotplotDisplay',\n configuration: `${trackId}-DotplotDisplay`,\n },\n ],\n },\n ],\n\n displayName: `${readName} vs ${trackAssembly}`,\n })\n } catch (e) {\n console.error(e)\n session.notifyError(`${e}`, e)\n }\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'\n\n// icons\nimport TimelineIcon from '@mui/icons-material/Timeline'\n\n// locals\nimport DotplotViewF from './DotplotView'\nimport DotplotDisplayF from './DotplotDisplay'\nimport DotplotRendererF from './DotplotRenderer'\nimport LaunchDotplotViewF from './LaunchDotplotView'\nimport ComparativeRenderer from './ComparativeRenderer'\nimport DotplotReadVsRefMenuItem from './DotplotReadVsRef'\n\nexport default class DotplotPlugin extends Plugin {\n name = 'DotplotPlugin'\n\n install(pluginManager: PluginManager) {\n DotplotViewF(pluginManager)\n DotplotDisplayF(pluginManager)\n DotplotRendererF(pluginManager)\n LaunchDotplotViewF(pluginManager)\n DotplotReadVsRefMenuItem(pluginManager)\n\n // install our comparative rendering rpc callback\n pluginManager.addRpcMethod(() => new ComparativeRenderer(pluginManager))\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToSubMenu(['Add'], {\n label: 'Dotplot view',\n icon: TimelineIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('DotplotView', {})\n },\n })\n }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport { stateModelFactory } from './stateModelFactory'\nimport ReactComponent from './components/DotplotDisplay'\n\nexport default function DotplotDisplayF(pm: PluginManager) {\n pm.addDisplayType(() => {\n const configSchema = configSchemaFactory(pm)\n return new DisplayType({\n name: 'DotplotDisplay',\n displayName: 'Dotplot display',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'SyntenyTrack',\n viewType: 'DotplotView',\n ReactComponent,\n })\n })\n}\n\n/**\n * #config DotplotDisplay\n */\nexport function configSchemaFactory(pm: any) {\n return ConfigurationSchema(\n 'DotplotDisplay',\n {\n /**\n * #slot\n */\n renderer: types.optional(pm.pluggableConfigSchemaType('renderer'), {\n type: 'DotplotRenderer',\n }),\n },\n {\n /**\n * #identifier\n */\n explicitIdentifier: 'displayId',\n explicitlyTyped: true,\n },\n )\n}\n","import { lazy } from 'react'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n// locals\nimport stateModelFactory from './model'\n\nexport default function DotplotViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new ViewType({\n name: 'DotplotView',\n displayName: 'Dotplot view',\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/DotplotView')),\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport ReactComponent from './components/DotplotRendering'\nimport DotplotRenderer from './DotplotRenderer'\nimport configSchema from './configSchema'\n\nexport default function DotplotRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new DotplotRenderer({\n name: 'DotplotRenderer',\n configSchema: configSchema,\n ReactComponent,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport { DotplotViewModel } from './DotplotView/model'\nimport { transaction } from 'mobx'\n\nexport default function LaunchDotplotView(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-DotplotView',\n // @ts-expect-error\n async ({\n session,\n views,\n tracks = [],\n }: {\n session: AbstractSessionModel\n views: { loc: string; assembly: string; tracks?: string[] }[]\n tracks?: string[]\n }) => {\n try {\n const model = session.addView('DotplotView', {}) as DotplotViewModel\n const assemblyNames = views.map(view => view.assembly)\n\n transaction(() => {\n model.setViews([\n { bpPerPx: 0.1, offsetPx: 0 },\n { bpPerPx: 0.1, offsetPx: 0 },\n ])\n model.setAssemblyNames(assemblyNames[0]!, assemblyNames[1]!)\n })\n\n // http://localhost:3000/?config=test_data%2Fvolvox%2Fconfig.json&session=spec-{\"views\":[{\"type\":\"DotplotView\",\"views\":[{\"assembly\":\"volvox\"},{\"assembly\":\"volvox\"}],\"tracks\":[\"volvox_fake_synteny\"]}]}\n\n const idsNotFound = [] as string[]\n tracks.forEach(track => {\n tryTrack(model, track, idsNotFound)\n })\n\n if (idsNotFound.length) {\n throw new Error(\n `Could not resolve identifiers: ${idsNotFound.join(',')}`,\n )\n }\n } catch (e) {\n session.notifyError(`${e}`, e)\n throw e\n }\n },\n )\n}\n\nfunction tryTrack(\n model: { showTrack: (arg: string) => void },\n trackId: string,\n idsNotFound: string[],\n) {\n try {\n model.showTrack(trackId)\n } catch (e) {\n if (/Could not resolve identifier/.exec(`${e}`)) {\n idsNotFound.push(trackId)\n } else {\n throw e\n }\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport {\n DisplayType,\n PluggableElementType,\n} from '@jbrowse/core/pluggableElementTypes'\nimport { LinearPileupDisplayModel } from '@jbrowse/plugin-alignments'\n\n// icons\nimport AddIcon from '@mui/icons-material/Add'\n\n// local\nimport { onClick } from './DotplotReadVsRef'\n\nexport default function DotplotReadVsRefMenuItem(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-extendPluggableElement',\n (pluggableElement: PluggableElementType) => {\n if (pluggableElement.name === 'LinearPileupDisplay') {\n const { stateModel } = pluggableElement as DisplayType\n const newStateModel = stateModel.extend(\n (self: LinearPileupDisplayModel) => {\n const superContextMenuItems = self.contextMenuItems\n return {\n views: {\n contextMenuItems() {\n const feature = self.contextMenuFeature\n return [\n ...superContextMenuItems(),\n ...(feature\n ? [\n {\n label: 'Dotplot of read vs ref',\n icon: AddIcon,\n onClick: () => {\n onClick(feature, self)\n },\n },\n ]\n : []),\n ]\n },\n },\n }\n },\n )\n\n ;(pluggableElement as DisplayType).stateModel = newStateModel\n }\n return pluggableElement\n },\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config GtfAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst GtfAdapter = ConfigurationSchema(\n 'GtfAdapter',\n {\n /**\n * #slot\n */\n gtfLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.gtf', locationType: 'UriLocation' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default GtfAdapter\n","import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\nimport { configSchema as gtfAdapterConfigSchema } from './GtfAdapter'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport { AdapterGuesser, getFileName } from '@jbrowse/core/util/tracks'\n\nexport default class GtfPlugin extends Plugin {\n name = 'GTFPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'GtfAdapter',\n displayName: 'GTF adapter',\n configSchema: gtfAdapterConfigSchema,\n getAdapterClass: () =>\n import('./GtfAdapter/GtfAdapter').then(r => r.default),\n }),\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.gtf(\\.gz)?$/i\n const adapterName = 'GtfAdapter'\n const fileName = getFileName(file)\n\n const obj = {\n type: adapterName,\n gtfLocation: file,\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n } else if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n }\n}\n","import { types } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config Gff3TabixAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst Gff3TabixAdapter = ConfigurationSchema(\n 'Gff3TabixAdapter',\n {\n /**\n * #slot\n */\n gffGzLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.gff.gz', locationType: 'UriLocation' },\n },\n\n index: ConfigurationSchema('Gff3TabixIndex', {\n /**\n * #slot index.indexType\n */\n indexType: {\n model: types.enumeration('IndexType', ['TBI', 'CSI']),\n type: 'stringEnum',\n defaultValue: 'TBI',\n },\n /**\n * #slot index.indexType\n */\n location: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.gff.gz.tbi',\n locationType: 'UriLocation',\n },\n },\n }),\n /**\n * #slot\n * the Gff3TabixAdapter has to \"redispatch\" if it fetches a region and\n * features it finds inside that region extend outside the region we requested.\n * you can disable this for certain feature types to avoid fetching e.g. the\n * entire chromosome\n */\n dontRedispatch: {\n type: 'stringArray',\n defaultValue: ['chromosome', 'region', 'contig'],\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default Gff3TabixAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config Gff3Adapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst Gff3Adapter = ConfigurationSchema(\n 'Gff3Adapter',\n {\n /**\n * #slot\n */\n gffLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.gff', locationType: 'UriLocation' },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default Gff3Adapter\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\n\nimport Gff3TabixAdapterF from './Gff3TabixAdapter'\nimport Gff3AdapterF from './Gff3Adapter'\nimport GuessGff3F from './GuessGff3'\n\nexport default class GFF3Plugin extends Plugin {\n name = 'GFF3Plugin'\n\n install(pluginManager: PluginManager) {\n Gff3TabixAdapterF(pluginManager)\n Gff3AdapterF(pluginManager)\n GuessGff3F(pluginManager)\n }\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\n\nexport default function Gff3TabixAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'Gff3TabixAdapter',\n displayName: 'GFF3 tabix adapter',\n configSchema,\n getAdapterClass: () =>\n import('./Gff3TabixAdapter').then(r => r.default),\n }),\n )\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\n\nexport default function Gff3AdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'Gff3Adapter',\n displayName: 'GFF3 adapter',\n configSchema,\n getAdapterClass: () => import('./Gff3Adapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n makeIndex,\n makeIndexType,\n getFileName,\n AdapterGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default function GuessGff3F(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.gff3?\\.b?gz$/i\n const adapterName = 'Gff3TabixAdapter'\n const fileName = getFileName(file)\n const indexName = index && getFileName(index)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n bamLocation: file,\n gffGzLocation: file,\n index: {\n location: index || makeIndex(file, '.tbi'),\n indexType: makeIndexType(indexName, 'CSI', 'TBI'),\n },\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.gff3?$/i\n const adapterName = 'Gff3Adapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n gffLocation: file,\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n}\n","import { types } from 'mobx-state-tree'\n\n/**\n * #stateModel\n */\nexport const Job = types\n .model('Job', {\n /**\n * #property\n */\n name: types.string,\n /**\n * #property\n */\n statusMessage: types.maybe(types.string),\n /**\n * #property\n */\n progressPct: types.number,\n })\n .volatile(() => ({\n cancelCallback() {},\n }))\n .actions(self => ({\n /**\n * #action\n */\n setCancelCallback(cancelCallback: () => void) {\n self.cancelCallback = cancelCallback\n },\n\n /**\n * #action\n */\n setStatusMessage(message?: string) {\n self.statusMessage = message\n },\n\n /**\n * #action\n */\n setProgressPct(pct: number) {\n self.progressPct = pct\n },\n }))\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport { lazy } from 'react'\n\nimport { stateModelFactory } from './model'\nexport const configSchema = ConfigurationSchema('JobsListWidget', {})\n\nexport default function JobsListWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'JobsListWidget',\n heading: 'Jobs list',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/JobsListWidget')),\n })\n })\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { SessionWithWidgets, isAbstractMenuManager } from '@jbrowse/core/util'\nimport { Indexing } from '@jbrowse/core/ui/Icons'\nimport { isSessionModelWithWidgets } from '@jbrowse/core/util'\nimport JobsListWidgetF from './JobsListWidget'\n\nexport default class JobsManagementPlugin extends Plugin {\n name = 'JobsManagementPlugin'\n\n install(pluginManager: PluginManager) {\n JobsListWidgetF(pluginManager)\n }\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToMenu('Tools', {\n label: 'Jobs list',\n icon: Indexing, // TODO: pick a better icon\n onClick: (session: SessionWithWidgets) => {\n if (isSessionModelWithWidgets(session)) {\n const { widgets } = session\n let jobStatusWidget = widgets.get('JobsList')\n if (!jobStatusWidget) {\n jobStatusWidget = session.addWidget('JobsListWidget', 'JobsList')\n session.showWidget(jobStatusWidget)\n } else {\n session.showWidget(jobStatusWidget)\n }\n }\n },\n })\n }\n }\n}\n","import { types, Instance, SnapshotIn } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { Job } from './jobModel'\n\nexport interface NewJob extends SnapshotIn<typeof Job> {\n cancelCallback(): void\n setStatusMessage(msg?: string): void\n}\n\n/**\n * #stateModel JobsListModel\n */\nexport function stateModelFactory(_pluginManager: PluginManager) {\n return types\n .model('JobsListModel', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('JobsListWidget'),\n /**\n * #property\n */\n jobs: types.array(Job),\n /**\n * #property\n */\n finished: types.array(Job),\n /**\n * #property\n */\n queued: types.array(Job),\n /**\n * #property\n */\n aborted: types.array(Job),\n })\n .actions(self => ({\n /**\n * #action\n */\n addJob(job: NewJob) {\n const { cancelCallback } = job\n const length = self.jobs.push(job)\n const addedJob = self.jobs[length - 1]!\n addedJob.setCancelCallback(cancelCallback)\n return addedJob\n },\n /**\n * #action\n */\n removeJob(jobName: string) {\n const indx = self.jobs.findIndex(job => job.name === jobName)\n const removed = self.jobs[indx]\n self.jobs.splice(indx, 1)\n return removed\n },\n /**\n * #action\n */\n addFinishedJob(job: NewJob) {\n self.finished.push(job)\n return self.finished\n },\n /**\n * #action\n */\n addQueuedJob(job: NewJob) {\n self.queued.push(job)\n return self.finished\n },\n /**\n * #action\n */\n addAbortedJob(job: NewJob) {\n self.aborted.push(job)\n return self.aborted\n },\n /**\n * #action\n */\n removeQueuedJob(jobName: string) {\n const indx = self.queued.findIndex(job => job.name === jobName)\n const removed = self.queued[indx]\n self.queued.splice(indx, 1)\n return removed\n },\n /**\n * #action\n */\n updateJobStatusMessage(jobName: string, message?: string) {\n const job = self.jobs.find(job => job.name === jobName)\n if (!job) {\n throw new Error(`No job found with name ${jobName}`)\n }\n job.setStatusMessage(message)\n },\n /**\n * #action\n */\n updateJobProgressPct(jobName: string, pct: number) {\n const job = self.jobs.find(job => job.name === jobName)\n if (!job) {\n throw new Error(`No job found with name ${jobName}`)\n }\n job.setProgressPct(pct)\n },\n }))\n}\n\nexport type JobsListStateModel = ReturnType<typeof stateModelFactory>\nexport type JobsListModel = Instance<JobsListStateModel>\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config NCListAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst NCListAdapter = ConfigurationSchema(\n 'NCListAdapter',\n {\n /**\n * #slot\n */\n rootUrlTemplate: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my/{refseq}/trackData.json',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n refNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of refNames used by the NCList used for aliasing',\n },\n },\n { explicitlyTyped: true },\n)\nexport default NCListAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config JBrowse1TextSearchAdapter\n * note: metadata about tracks and assemblies covered by text search adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default ConfigurationSchema(\n 'JBrowse1TextSearchAdapter',\n {\n /**\n * #slot\n */\n namesIndexLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/volvox/names', locationType: 'UriLocation' },\n description: 'the location of the JBrowse1 names index data directory',\n },\n /**\n * #slot\n */\n tracks: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of tracks covered by text search adapter',\n },\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of assemblies covered by text search adapter',\n },\n },\n {\n explicitlyTyped: true,\n /**\n * #identifier\n */\n explicitIdentifier: 'textSearchAdapterId',\n },\n)\n","import { baseConnectionConfig } from '@jbrowse/core/pluggableElementTypes/models'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config JBrowse1Connection\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst JBrowse1Connection = ConfigurationSchema(\n 'JBrowse1Connection',\n {\n /**\n * #slot\n */\n dataDirLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: 'http://mysite.com/jbrowse/data/',\n locationType: 'UriLocation',\n },\n description:\n 'the location of the JBrowse 1 data directory, often something like http://mysite.com/jbrowse/data/',\n },\n /**\n * #slot\n */\n assemblyNames: {\n description:\n 'name of the assembly the connection belongs to, should be a single entry',\n type: 'stringArray',\n defaultValue: [],\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseConnectionConfig,\n },\n)\n\nexport default JBrowse1Connection\n","import {\n ConfigurationReference,\n getConf,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseConnectionModelFactory } from '@jbrowse/core/pluggableElementTypes/models'\nimport { types } from 'mobx-state-tree'\n\n// locals\nimport configSchema from './configSchema'\n\nexport default function stateModelFactory(pluginManager: PluginManager) {\n return types\n .compose(\n 'JBrowse1Connection',\n BaseConnectionModelFactory(pluginManager),\n types.model({\n configuration: ConfigurationReference(configSchema),\n type: types.literal('JBrowse1Connection'),\n }),\n )\n\n .actions(self => ({\n async connect() {\n const session = getSession(self)\n try {\n const dataDirLocation = getConf(self, 'dataDirLocation')\n const { fetchJb1 } = await import('./jb1ConfigLoad')\n const { convertTrackConfig } = await import('./jb1ToJb2')\n const config = await fetchJb1(dataDirLocation)\n const assemblyName = getConf(self, 'assemblyNames')[0]\n if (!assemblyName) {\n throw new Error('assembly name required for JBrowse 1 connection')\n }\n const conf = session.assemblies.find(\n a => readConfObject(a, 'name') === assemblyName,\n )\n if (!conf) {\n throw new Error(`Assembly \"${assemblyName}\" not found`)\n }\n const sequenceAdapter = readConfObject(conf, ['sequence', 'adapter'])\n\n // @ts-expect-error\n const jb2Tracks = config.tracks?.map(jb1Track => ({\n ...convertTrackConfig(\n jb1Track,\n config.dataRoot || '',\n sequenceAdapter,\n ),\n assemblyNames: [assemblyName],\n }))\n\n self.setTrackConfs(jb2Tracks)\n } catch (error) {\n console.error(error)\n session.notifyError(\n `There was a problem connecting to the JBrowse 1 data directory \"${self.name}\". Please make sure you have entered a valid location. The error that was thrown is: \"${error}\"`,\n error,\n )\n session.breakConnection?.(self.configuration)\n }\n },\n }))\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport NCListAdapterF from './NCListAdapter'\nimport JBrowse1TextSearchAdapterF from './JBrowse1TextSearchAdapter'\nimport JBrowse1ConnectionF from './JBrowse1Connection'\nimport GuessNCListF from './GuessNCList'\n\nexport default class LegacyJBrowsePlugin extends Plugin {\n name = 'LegacyJBrowsePlugin'\n\n install(pluginManager: PluginManager) {\n NCListAdapterF(pluginManager)\n GuessNCListF(pluginManager)\n JBrowse1TextSearchAdapterF(pluginManager)\n JBrowse1ConnectionF(pluginManager)\n }\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport configSchema from './configSchema'\n\nexport default function NCListAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'NCListAdapter',\n displayName: 'NCList adapter',\n configSchema,\n getAdapterClass: () => import('./NCListAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AdapterGuesser, getFileName } from '@jbrowse/core/util/tracks'\nimport { FileLocation } from '@jbrowse/core/util/types'\n\nexport default function GuessNCListF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /trackData.jsonz?$/i\n const adapterName = 'NCListAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n rootUrlTemplate: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType'\n\n// locals\nimport configSchema from './configSchema'\n\nexport default function JBrowse1TextSearchAdapterF(\n pluginManager: PluginManager,\n) {\n pluginManager.addTextSearchAdapterType(\n () =>\n new TextSearchAdapterType({\n name: 'JBrowse1TextSearchAdapter',\n configSchema,\n description: 'A JBrowse 1 text search adapter',\n getAdapterClass: () =>\n import('./JBrowse1TextSearchAdapter').then(t => t.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport ConnectionType from '@jbrowse/core/pluggableElementTypes/ConnectionType'\n\n// locals\nimport modelFactory from './model'\nimport configSchema from './configSchema'\n\nexport default function JBrowse1ConnectionF(pluginManager: PluginManager) {\n pluginManager.addConnectionType(\n () =>\n new ConnectionType({\n name: 'JBrowse1Connection',\n configSchema,\n stateModel: modelFactory(pluginManager),\n displayName: 'JBrowse 1 Data',\n description: 'A JBrowse 1 data directory',\n url: '//jbrowse.org/',\n }),\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config LinearComparativeDisplay\n */\nfunction configSchemaFactory(_pluginManager: any) {\n return ConfigurationSchema(\n 'LinearComparativeDisplay',\n {},\n {\n explicitlyTyped: true,\n\n /**\n * #identifier\n */\n explicitIdentifier: 'displayId',\n },\n )\n}\n\nexport default configSchemaFactory\n","import {\n readConfObject,\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport { types, getSnapshot, Instance } from 'mobx-state-tree'\nimport {\n dedupe,\n Feature,\n getContainingView,\n getSession,\n makeAbortableReaction,\n} from '@jbrowse/core/util'\nimport { getRpcSessionId } from '@jbrowse/core/util/tracks'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'\nimport { LinearComparativeViewModel } from '../LinearComparativeView/model'\n\n/**\n * #stateModel LinearComparativeDisplay\n * extends\n * - [BaseDisplay](../basedisplay)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearComparativeDisplay',\n BaseDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearComparativeDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n height: 100,\n }),\n )\n .volatile((/* self */) => ({\n renderInProgress: undefined as AbortController | undefined,\n features: undefined as Feature[] | undefined,\n message: undefined as string | undefined,\n }))\n .views(self => ({\n /**\n * #getter\n */\n renderProps() {\n return {\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n highResolutionScaling: 2,\n }\n },\n }))\n .actions(self => {\n let renderInProgress: undefined | AbortController\n\n return {\n /**\n * #action\n * controlled by a reaction\n */\n setLoading(abortController: AbortController) {\n self.message = undefined\n self.error = undefined\n renderInProgress = abortController\n },\n\n /**\n * #action\n * controlled by a reaction\n */\n setMessage(messageText: string) {\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n self.message = messageText\n self.error = undefined\n renderInProgress = undefined\n },\n\n /**\n * #action\n * controlled by a reaction\n */\n setRendered(args?: { features: Feature[] }) {\n if (!args) {\n return\n }\n const { features } = args\n const existingFeatures = self.features || []\n\n const featIds = new Set(existingFeatures.map(f => f.id()))\n const newFeatIds = new Set(features.map(f => f.id()))\n\n let foundNewFeatureNotInExistingMap = false\n let foundExistingFeatureNotInNewMap = false\n for (const feat of features) {\n if (!featIds.has(feat.id())) {\n foundNewFeatureNotInExistingMap = true\n break\n }\n }\n for (const existingFeat of existingFeatures) {\n if (!newFeatIds.has(existingFeat.id())) {\n foundExistingFeatureNotInNewMap = true\n break\n }\n }\n\n self.message = undefined\n self.error = undefined\n renderInProgress = undefined\n\n if (\n foundNewFeatureNotInExistingMap ||\n foundExistingFeatureNotInNewMap ||\n !self.features\n ) {\n self.features = features\n }\n },\n\n /**\n * #action\n * controlled by a reaction\n */\n setError(error: unknown) {\n console.error(error)\n if (renderInProgress && !renderInProgress.signal.aborted) {\n renderInProgress.abort()\n }\n // the rendering failed for some reason\n self.message = undefined\n self.error = error\n renderInProgress = undefined\n },\n }\n })\n .actions(self => ({\n afterAttach() {\n makeAbortableReaction(\n // @ts-expect-error\n self,\n renderBlockData,\n renderBlockEffect,\n {\n name: `${self.type} ${self.id} rendering`,\n delay: 1000,\n fireImmediately: true,\n },\n self.setLoading,\n self.setRendered,\n self.setError,\n )\n },\n }))\n}\nfunction renderBlockData(self: LinearComparativeDisplay) {\n const { rpcManager } = getSession(self)\n const display = self\n\n // Alternative to readConfObject(config) is below used because renderProps is\n // something under our control. Compare to serverSideRenderedBlock\n readConfObject(self.configuration)\n\n const { adapterConfig } = self\n const parent = getContainingView(self) as LinearComparativeViewModel\n const sessionId = getRpcSessionId(self)\n getSnapshot(parent)\n\n return parent.initialized\n ? {\n rpcManager,\n renderProps: {\n ...display.renderProps(),\n view: parent,\n adapterConfig,\n sessionId,\n timeout: 1000000,\n self,\n },\n }\n : undefined\n}\n\nasync function renderBlockEffect(props: ReturnType<typeof renderBlockData>) {\n if (!props) {\n return\n }\n\n const { rpcManager, renderProps } = props\n const { adapterConfig } = renderProps\n const view0 = renderProps.view.views[0]\n\n const features = (await rpcManager.call('getFeats', 'CoreGetFeatures', {\n regions: view0.staticBlocks.contentBlocks,\n sessionId: 'getFeats',\n adapterConfig,\n })) as Feature[]\n\n return {\n features: dedupe(features, f => f.id()),\n }\n}\n\nexport default stateModelFactory\nexport type LinearComparativeDisplayModel = ReturnType<typeof stateModelFactory>\nexport type LinearComparativeDisplay = Instance<LinearComparativeDisplayModel>\n","import { lazy } from 'react'\nimport {\n addDisposer,\n cast,\n getPath,\n getRoot,\n resolveIdentifier,\n types,\n Instance,\n SnapshotIn,\n} from 'mobx-state-tree'\nimport { autorun, transaction } from 'mobx'\n\n// jbrowse\nimport BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport { getSession, isSessionModelWithWidgets, avg } from '@jbrowse/core/util'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport {\n LinearGenomeViewModel,\n LinearGenomeViewStateModel,\n} from '@jbrowse/plugin-linear-genome-view'\n\n// icons\nimport { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\n\n// lazies\nconst ReturnToImportFormDialog = lazy(\n () => import('@jbrowse/core/ui/ReturnToImportFormDialog'),\n)\n\n/**\n * #stateModel LinearComparativeView\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nfunction stateModelFactory(pluginManager: PluginManager) {\n return types\n .compose(\n 'LinearComparativeView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('LinearComparativeView'),\n /**\n * #property\n */\n trackSelectorType: 'hierarchical',\n /**\n * #property\n */\n showIntraviewLinks: true,\n /**\n * #property\n */\n interactToggled: false,\n /**\n * #property\n */\n middleComparativeHeight: 100,\n /**\n * #property\n */\n tracks: types.array(\n pluginManager.pluggableMstType('track', 'stateModel'),\n ),\n /**\n * #property\n * currently this is limited to an array of two\n */\n views: types.array(\n pluginManager.getViewType('LinearGenomeView')!\n .stateModel as LinearGenomeViewStateModel,\n ),\n\n /**\n * #property\n * this represents tracks specific to this view specifically used for\n * read vs ref dotplots where this track would not really apply\n * elsewhere\n */\n viewTrackConfigs: types.array(\n pluginManager.pluggableConfigSchemaType('track'),\n ),\n }),\n )\n .volatile(() => ({\n /**\n * #volatile\n */\n width: undefined as number | undefined,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get highResolutionScaling() {\n return 2\n },\n /**\n * #getter\n */\n get initialized() {\n return (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n self.width !== undefined &&\n self.views.length > 0 &&\n self.views.every(view => view.initialized)\n )\n },\n\n /**\n * #getter\n */\n get refNames() {\n return self.views.map(v => [\n ...new Set(v.staticBlocks.map(m => m.refName)),\n ])\n },\n\n /**\n * #getter\n */\n get assemblyNames() {\n return [...new Set(self.views.flatMap(v => v.assemblyNames))]\n },\n }))\n .actions(self => ({\n // automatically removes session assemblies associated with this view\n // e.g. read vs ref\n beforeDestroy() {\n const session = getSession(self)\n for (const name of self.assemblyNames) {\n session.removeTemporaryAssembly?.(name)\n }\n },\n\n onSubviewAction(actionName: string, path: string, args?: unknown[]) {\n self.views.forEach(view => {\n const ret = getPath(view)\n if (!ret.endsWith(path)) {\n // @ts-expect-error\n view[actionName](args?.[0])\n }\n })\n },\n\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.width = newWidth\n },\n\n /**\n * #action\n */\n setViews(views: SnapshotIn<LinearGenomeViewModel>[]) {\n self.views = cast(views)\n },\n\n /**\n * #action\n */\n removeView(view: LinearGenomeViewModel) {\n self.views.remove(view)\n },\n\n /**\n * #action\n */\n setMiddleComparativeHeight(n: number) {\n self.middleComparativeHeight = n\n return self.middleComparativeHeight\n },\n\n /**\n * #action\n */\n activateTrackSelector() {\n if (self.trackSelectorType === 'hierarchical') {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const selector = session.addWidget(\n 'HierarchicalTrackSelectorWidget',\n 'hierarchicalTrackSelector',\n { view: self },\n )\n session.showWidget(selector)\n return selector\n }\n return undefined\n }\n throw new Error(`invalid track selector type ${self.trackSelectorType}`)\n },\n\n /**\n * #action\n */\n toggleTrack(trackId: string) {\n const hiddenCount = this.hideTrack(trackId)\n if (!hiddenCount) {\n this.showTrack(trackId)\n return true\n }\n return false\n },\n\n /**\n * #action\n */\n showTrack(trackId: string, initialSnapshot = {}) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const configuration = resolveIdentifier(schema, getRoot(self), trackId)\n if (!configuration) {\n throw new Error(`track not found ${trackId}`)\n }\n const trackType = pluginManager.getTrackType(configuration.type)\n if (!trackType) {\n throw new Error(`unknown track type ${configuration.type}`)\n }\n const viewType = pluginManager.getViewType(self.type)!\n const supportedDisplays = new Set(\n viewType.displayTypes.map(d => d.name),\n )\n const displayConf = configuration.displays.find(\n (d: AnyConfigurationModel) => supportedDisplays.has(d.type),\n )\n if (!displayConf) {\n throw new Error(\n `could not find a compatible display for view type ${self.type}`,\n )\n }\n self.tracks.push(\n trackType.stateModel.create({\n ...initialSnapshot,\n type: configuration.type,\n configuration,\n displays: [{ type: displayConf.type, configuration: displayConf }],\n }),\n )\n },\n\n /**\n * #action\n */\n hideTrack(trackId: string) {\n const schema = pluginManager.pluggableConfigSchemaType('track')\n const config = resolveIdentifier(schema, getRoot(self), trackId)\n const shownTracks = self.tracks.filter(t => t.configuration === config)\n transaction(() => {\n shownTracks.forEach(t => self.tracks.remove(t))\n })\n return shownTracks.length\n },\n /**\n * #action\n */\n squareView() {\n const average = avg(self.views.map(v => v.bpPerPx))\n self.views.forEach(view => {\n const center = view.pxToBp(view.width / 2)\n view.setNewView(average, view.offsetPx)\n if (!center.refName) {\n return\n }\n view.centerAt(center.coord, center.refName, center.index)\n })\n },\n /**\n * #action\n */\n clearView() {\n self.views = cast([])\n self.tracks = cast([])\n },\n }))\n .views(() => ({\n /**\n * #method\n * includes a subset of view menu options because the full list is a\n * little overwhelming. overridden by subclasses\n */\n headerMenuItems(): MenuItem[] {\n return []\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n menuItems(): MenuItem[] {\n return [\n ...self.views\n .map((view, idx) => [idx, view.menuItems()] as const)\n .map(f => ({ label: `View ${f[0] + 1} Menu`, subMenu: f[1] })),\n {\n label: 'Return to import form',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ReturnToImportFormDialog,\n { model: self, handleClose },\n ])\n },\n icon: FolderOpenIcon,\n },\n {\n label: 'Open track selector',\n onClick: self.activateTrackSelector,\n icon: TrackSelectorIcon,\n },\n ]\n },\n /**\n * #method\n */\n rubberBandMenuItems() {\n return [\n {\n label: 'Zoom to region(s)',\n onClick: () => {\n self.views.forEach(view => {\n const { leftOffset, rightOffset } = view\n if (leftOffset && rightOffset) {\n view.moveTo(leftOffset, rightOffset)\n }\n })\n },\n },\n ]\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n if (self.width) {\n self.views.forEach(v => {\n v.setWidth(self.width)\n })\n }\n }),\n )\n },\n }))\n}\n\nexport type LinearComparativeViewStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearComparativeViewModel =\n Instance<LinearComparativeViewStateModel>\n\nexport default stateModelFactory\n","import { types, Instance } from 'mobx-state-tree'\nimport {\n getConf,\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport { Feature } from '@jbrowse/core/util'\n\n// locals\nimport baseModelFactory from '../LinearComparativeDisplay/stateModelFactory'\n\ninterface Pos {\n offsetPx: number\n}\n\nexport interface FeatPos {\n p11: Pos\n p12: Pos\n p21: Pos\n p22: Pos\n f: Feature\n cigar: string[]\n}\n\n/**\n * #stateModel LinearSyntenyDisplay\n * extends\n * - [LinearComparativeDisplay](../linearcomparativedisplay)\n */\nfunction stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearSyntenyDisplay',\n baseModelFactory(configSchema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearSyntenyDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n .volatile(() => ({\n // canvas used for drawing visible screen\n mainCanvas: null as HTMLCanvasElement | null,\n\n // canvas used for drawing click map with feature ids\n // this renders a unique color per alignment, so that it can be re-traced\n // after a feature click with getImageData at that pixel\n clickMapCanvas: null as HTMLCanvasElement | null,\n\n // canvas used for drawing click map with cigar data\n // this can show if you are mousing over a insertion/deletion. it is similar\n // in purpose to the clickMapRef but was not feasible to pack this into the\n // clickMapRef\n cigarClickMapCanvas: null as HTMLCanvasElement | null,\n\n // canvas for drawing mouseover shading\n // this is separate from the other code for speed: don't have to redraw\n // entire canvas to do a feature's mouseover shading\n mouseoverCanvas: null as HTMLCanvasElement | null,\n\n // assigned by reaction\n featPositions: [] as FeatPos[],\n\n // currently mouse'd over feature\n mouseoverId: undefined as string | undefined,\n\n // currently click'd over feature\n clickId: undefined as string | undefined,\n\n // currently mouseover'd CIGAR subfeature\n cigarMouseoverId: -1,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setFeatPositions(arg: FeatPos[]) {\n self.featPositions = arg\n },\n /**\n * #action\n */\n setMainCanvasRef(ref: HTMLCanvasElement | null) {\n self.mainCanvas = ref\n },\n /**\n * #action\n */\n setClickMapCanvasRef(ref: HTMLCanvasElement | null) {\n self.clickMapCanvas = ref\n },\n /**\n * #action\n */\n setCigarClickMapCanvasRef(ref: HTMLCanvasElement | null) {\n self.cigarClickMapCanvas = ref\n },\n /**\n * #action\n */\n setMouseoverCanvasRef(ref: HTMLCanvasElement | null) {\n self.mouseoverCanvas = ref\n },\n /**\n * #action\n */\n setMouseoverId(arg?: string) {\n self.mouseoverId = arg\n },\n /**\n * #action\n */\n setCigarMouseoverId(arg: number) {\n self.cigarMouseoverId = arg\n },\n /**\n * #action\n */\n setClickId(arg?: string) {\n self.clickId = arg\n },\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get adapterConfig() {\n return {\n name: self.parentTrack.configuration.adapter.type,\n assemblyNames: getConf(self, 'assemblyNames'),\n ...getConf(self.parentTrack, 'adapter'),\n }\n },\n /**\n * #getter\n */\n get trackIds() {\n return getConf(self, 'trackIds') as string[]\n },\n /**\n * #getter\n */\n get numFeats() {\n return self.featPositions.length\n },\n /**\n * #getter\n * used for synteny svg rendering\n */\n get ready() {\n return this.numFeats > 0\n },\n\n /**\n * #getter\n */\n get featMap() {\n return Object.fromEntries(self.featPositions.map(f => [f.f.id(), f]))\n },\n }))\n .actions(self => ({\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n const { doAfterAttach } = await import('./afterAttach')\n doAfterAttach(self)\n } catch (e) {\n console.error(e)\n self.setError(e)\n }\n })()\n },\n }))\n}\n\nexport type LinearSyntenyDisplayStateModel = ReturnType<\n typeof stateModelFactory\n>\nexport type LinearSyntenyDisplayModel = Instance<LinearSyntenyDisplayStateModel>\n\nexport default stateModelFactory\n","import { lazy } from 'react'\nimport {\n ConfigurationReference,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport { getSession } from '@jbrowse/core/util'\nimport { SharedLinearPileupDisplayMixin } from '@jbrowse/plugin-alignments'\nimport { types } from 'mobx-state-tree'\n\nconst LaunchSyntenyViewDialog = lazy(\n () => import('./components/LaunchSyntenyViewDialog'),\n)\n\n/**\n * #stateModel LGVSyntenyDisplay\n * displays location of \"synteny\" feature in a plain LGV, allowing linking out\n * to external synteny views\n *\n * extends\n * - [SharedLinearPileupDisplayMixin](../sharedlinearpileupdisplaymixin)\n */\nfunction stateModelFactory(schema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LGVSyntenyDisplay',\n SharedLinearPileupDisplayMixin(schema),\n types.model({\n /**\n * #property\n */\n type: types.literal('LGVSyntenyDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(schema),\n }),\n )\n .views(self => {\n const superContextMenuItems = self.contextMenuItems\n return {\n /**\n * #method\n */\n contextMenuItems() {\n const feature = self.contextMenuFeature\n return [\n ...superContextMenuItems(),\n ...(feature\n ? [\n {\n label: 'Open synteny view for this position',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n LaunchSyntenyViewDialog,\n {\n model: self,\n handleClose,\n feature,\n },\n ])\n },\n },\n ]\n : []),\n ]\n },\n }\n })\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n colorSchemeSubMenuItems: superColorSchemeSubMenuItems,\n } = self\n return {\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Color scheme',\n subMenu: [...superColorSchemeSubMenuItems()],\n },\n ]\n },\n }\n })\n .actions(self => ({\n afterCreate() {\n // use color by stand to help indicate inversions better on first load,\n // otherwise use selected orientation\n if (self.colorBy) {\n self.setColorScheme({ ...self.colorBy })\n } else {\n self.setColorScheme({ type: 'strand' })\n }\n },\n }))\n}\n\nexport default stateModelFactory\n","import React from 'react'\nimport { SvgIcon, SvgIconProps } from '@mui/material'\n\nexport function Curves(props: SvgIconProps) {\n return (\n <SvgIcon {...props}>\n <path\n fill=\"currentColor\"\n d=\"M16.5,21C13.5,21 12.31,16.76 11.05,12.28C10.14,9.04 9,5 7.5,5C4.11,5 4,11.93 4,12H2C2,11.63 2.06,3 7.5,3C10.5,3 11.71,7.25 12.97,11.74C13.83,14.8 15,19 16.5,19C19.94,19 20.03,12.07 20.03,12H22.03C22.03,12.37 21.97,21 16.5,21Z\"\n />\n </SvgIcon>\n )\n}\n\nexport function StraightLines(props: SvgIconProps) {\n return (\n <SvgIcon {...props}>\n <path\n fill=\"currentColor\"\n d=\"M22 12L17 22L7.1 6.04L4.24 12H2L7 2L16.9 17.96L19.76 12H22Z\"\n />\n </SvgIcon>\n )\n}\n","import React, { lazy } from 'react'\nimport { types, Instance } from 'mobx-state-tree'\nimport { transaction } from 'mobx'\nimport { getSession } from '@jbrowse/core/util'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { saveAs } from 'file-saver'\n\n// icons\nimport CropFreeIcon from '@mui/icons-material/CropFree'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport PhotoCameraIcon from '@mui/icons-material/PhotoCamera'\nimport { Curves } from './components/Icons'\n\n// locals\nimport baseModel from '../LinearComparativeView/model'\n\n// lazies\nconst ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'))\n\nexport interface ExportSvgOptions {\n rasterizeLayers?: boolean\n scale?: number\n filename?: string\n Wrapper?: React.FC<{ children: React.ReactNode }>\n fontSize?: number\n rulerHeight?: number\n textHeight?: number\n paddingHeight?: number\n headerHeight?: number\n cytobandHeight?: number\n themeName?: string\n trackLabels?: string\n}\n\n/**\n * #stateModel LinearSyntenyView\n * extends\n * - [LinearComparativeView](../linearcomparativeview)\n */\nexport default function stateModelFactory(pluginManager: PluginManager) {\n return types\n .compose(\n 'LinearSyntenyView',\n baseModel(pluginManager),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearSyntenyView'),\n /**\n * #property/\n */\n drawCIGAR: true,\n /**\n * #property\n */\n drawCurves: false,\n }),\n )\n .actions(self => ({\n /**\n * #action\n */\n toggleCurves() {\n self.drawCurves = !self.drawCurves\n },\n /**\n * #action\n */\n toggleCIGAR() {\n self.drawCIGAR = !self.drawCIGAR\n },\n /**\n * #action\n */\n showAllRegions() {\n transaction(() => {\n self.views.forEach(view => {\n view.showAllRegionsInAssembly()\n })\n })\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n async exportSvg(opts: ExportSvgOptions) {\n const { renderToSvg } = await import(\n './svgcomponents/SVGLinearSyntenyView'\n )\n const html = await renderToSvg(self as LinearSyntenyViewModel, opts)\n const blob = new Blob([html], { type: 'image/svg+xml' })\n saveAs(blob, opts.filename || 'image.svg')\n },\n }))\n .views(self => {\n const superHeaderMenuItems = self.headerMenuItems\n const superMenuItems = self.menuItems\n return {\n /**\n * #method\n * includes a subset of view menu options because the full list is a\n * little overwhelming\n */\n headerMenuItems() {\n return [\n ...superHeaderMenuItems(),\n {\n label: 'Square view',\n onClick: self.squareView,\n description:\n 'Makes both views use the same zoom level, adjusting to the average of each',\n icon: CropFreeIcon,\n },\n {\n label: 'Show all regions',\n onClick: self.showAllRegions,\n description: 'Show entire genome assemblies',\n icon: VisibilityIcon,\n },\n {\n label: 'Draw CIGAR',\n onClick: self.toggleCIGAR,\n checked: self.drawCIGAR,\n type: 'checkbox',\n description: 'Draws per-base CIGAR level alignments',\n },\n {\n label: 'Use curved lines',\n type: 'checkbox',\n checked: self.drawCurves,\n onClick: self.toggleCurves,\n icon: Curves,\n },\n {\n label: 'Export SVG',\n icon: PhotoCameraIcon,\n onClick: (): void => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n /**\n * #method\n */\n menuItems() {\n return [\n ...superMenuItems(),\n {\n label: 'Export SVG',\n icon: PhotoCameraIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ExportSvgDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n }\n })\n}\nexport type LinearSyntenyViewStateModel = ReturnType<typeof stateModelFactory>\nexport type LinearSyntenyViewModel = Instance<LinearSyntenyViewStateModel>\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport { when } from 'mobx'\n\n// locals\nimport { LinearSyntenyViewModel } from './LinearSyntenyView/model'\n\ntype LSV = LinearSyntenyViewModel\n\ninterface ViewData {\n loc: string\n assembly: string\n tracks?: string[]\n}\n\nexport default function LaunchLinearSyntenyView(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-LinearSyntenyView',\n // @ts-expect-error\n async ({\n session,\n views,\n tracks = [],\n }: {\n session: AbstractSessionModel\n views: ViewData[]\n tracks?: string[]\n }) => {\n try {\n const { assemblyManager } = session\n const model = session.addView('LinearSyntenyView', {}) as LSV\n\n await when(() => !!model.width)\n\n model.setViews(\n await Promise.all(\n views.map(async view => {\n const asm = await assemblyManager.waitForAssembly(view.assembly)\n if (!asm) {\n throw new Error(`Assembly ${view.assembly} failed to load`)\n }\n return {\n type: 'LinearGenomeView' as const,\n bpPerPx: 1,\n offsetPx: 0,\n hideHeader: true,\n displayedRegions: asm.regions,\n }\n }),\n ),\n )\n\n await Promise.all(model.views.map(view => when(() => view.initialized)))\n\n const idsNotFound = [] as string[]\n await Promise.all(\n views.map(async (data, idx) => {\n const view = model.views[idx]!\n const { assembly, loc, tracks = [] } = data\n const asm = await assemblyManager.waitForAssembly(assembly)\n if (!asm) {\n throw new Error(`Assembly ${data.assembly} failed to load`)\n }\n await view.navToSearchString({ input: loc, assembly: asm })\n tracks.forEach(track => {\n tryTrack(view, track, idsNotFound)\n })\n }),\n )\n\n tracks.forEach(track => {\n tryTrack(model, track, idsNotFound)\n })\n\n if (idsNotFound.length) {\n throw new Error(\n `Could not resolve identifiers: ${idsNotFound.join(',')}`,\n )\n }\n } catch (e) {\n session.notifyError(`${e}`, e)\n throw e\n }\n },\n )\n}\n\nfunction tryTrack(\n model: { showTrack: (arg: string) => void },\n trackId: string,\n idsNotFound: string[],\n) {\n try {\n model.showTrack(trackId)\n } catch (e) {\n if (/Could not resolve identifier/.exec(`${e}`)) {\n idsNotFound.push(trackId)\n } else {\n throw e\n }\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes/models'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config SyntenyTrack\n * extends\n * - [BaseTrack](../basetrack)\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'SyntenyTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n\nexport default configSchema\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport { PluggableElementType } from '@jbrowse/core/pluggableElementTypes'\nimport { getSession, getContainingTrack } from '@jbrowse/core/util'\n\n// icons\nimport AddIcon from '@mui/icons-material/Add'\n\n// locals\nconst ReadVsRefDialog = lazy(() => import('./LinearReadVsRef'))\n\nfunction isDisplay(elt: { name: string }): elt is DisplayType {\n return elt.name === 'LinearPileupDisplay'\n}\n\nexport default function LinearReadVsRefMenuItemF(pm: PluginManager) {\n pm.addToExtensionPoint(\n 'Core-extendPluggableElement',\n (pluggableElement: PluggableElementType) => {\n if (!isDisplay(pluggableElement)) {\n return pluggableElement\n }\n pluggableElement.stateModel = pluggableElement.stateModel.extend(self => {\n const superContextMenuItems = self.contextMenuItems\n return {\n views: {\n contextMenuItems() {\n const feature = self.contextMenuFeature\n const track = getContainingTrack(self)\n return [\n ...superContextMenuItems(),\n ...(feature\n ? [\n {\n label: 'Linear read vs ref',\n icon: AddIcon,\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n ReadVsRefDialog,\n {\n track,\n feature,\n handleClose,\n },\n ])\n },\n },\n ]\n : []),\n ]\n },\n },\n }\n })\n return pluggableElement\n },\n )\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'\n\nimport CalendarIcon from '@mui/icons-material/CalendarViewDay'\nimport LinearComparativeDisplayF from './LinearComparativeDisplay'\nimport LinearComparativeViewF from './LinearComparativeView'\nimport LinearSyntenyDisplayF from './LinearSyntenyDisplay'\nimport LGVSyntenyDisplayF from './LGVSyntenyDisplay'\nimport LinearSyntenyViewF from './LinearSyntenyView'\nimport LaunchLinearSyntenyViewF from './LaunchLinearSyntenyView'\nimport SyntenyTrackF from './SyntenyTrack'\nimport LinearReadVsRefMenuItemF from './LinearReadVsRef'\n\nexport default class LinearComparativeViewPlugin extends Plugin {\n name = 'LinearComparativeViewPlugin'\n\n install(pluginManager: PluginManager) {\n LinearComparativeViewF(pluginManager)\n LinearSyntenyViewF(pluginManager)\n LinearComparativeDisplayF(pluginManager)\n LinearSyntenyDisplayF(pluginManager)\n LGVSyntenyDisplayF(pluginManager)\n LaunchLinearSyntenyViewF(pluginManager)\n SyntenyTrackF(pluginManager)\n LinearReadVsRefMenuItemF(pluginManager)\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToSubMenu(['Add'], {\n label: 'Linear synteny view',\n icon: CalendarIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('LinearSyntenyView', {})\n },\n })\n }\n }\n}\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\nimport modelFactory from './model'\n\nexport default function LinearComparativeViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new ViewType({\n name: 'LinearComparativeView',\n displayName: 'Linear comparative view',\n stateModel: modelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/LinearComparativeView')),\n })\n })\n}\n","import { lazy } from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport modelFactory from './model'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\n\nexport default function LinearSyntenyViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new ViewType({\n name: 'LinearSyntenyView',\n displayName: 'Linear synteny view',\n stateModel: modelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/LinearSyntenyView')),\n })\n })\n}\n","import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport configSchemaFactory from './configSchemaF'\nimport stateModelFactory from './stateModelFactory'\n\nexport default function LinearComparativeDisplayF(\n pluginManager: PluginManager,\n) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearComparativeDisplay',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'SyntenyTrack',\n viewType: 'LinearComparativeView',\n ReactComponent: () => {\n return null\n },\n })\n })\n}\n","import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport configSchemaF from './configSchemaF'\nimport stateModelFactory from './model'\nimport { lazy } from 'react'\n\nexport default function LinearSyntenyDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new DisplayType({\n name: 'LinearSyntenyDisplay',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'SyntenyTrack',\n viewType: 'LinearSyntenyView',\n ReactComponent: lazy(() => import('./components/Component')),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport baseConfigFactory from '../LinearComparativeDisplay/configSchemaF'\n\n/**\n * #config LinearSyntenyDisplay\n */\nfunction configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearSyntenyDisplay',\n {\n /**\n * #slot\n * currently unused\n */\n trackIds: {\n type: 'stringArray',\n defaultValue: [],\n },\n\n /**\n * #slot\n * currently unused\n */\n middle: { type: 'boolean', defaultValue: true },\n },\n {\n /**\n * #baseConfiguration\n * this refers to the LinearComparativeDisplay\n */\n baseConfiguration: baseConfigFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaFactory\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'\nimport configSchemaF from './configSchemaF'\nimport stateModelF from './model'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nexport default function LGVSyntenyDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaF(pluginManager)\n const stateModel = stateModelF(configSchema)\n return new DisplayType({\n name: 'LGVSyntenyDisplay',\n configSchema,\n stateModel,\n trackType: 'SyntenyTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { linearPileupDisplayConfigSchemaFactory } from '@jbrowse/plugin-alignments'\n\n/**\n * #config LGVSyntenyDisplay\n * extends config\n * - [LinearPileupDisplay](../linearpileupdisplay)\n */\nfunction configSchemaF(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LGVSyntenyDisplay',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: linearPileupDisplayConfigSchemaFactory(pluginManager),\n explicitlyTyped: true,\n },\n )\n}\n\nexport default configSchemaF\n","import { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchemaF from './configSchema'\n\nexport default function registerSyntenyTrack(pluginManager: PluginManager) {\n pluginManager.addTrackType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new TrackType({\n name: 'SyntenyTrack',\n configSchema,\n stateModel: createBaseTrackModel(\n pluginManager,\n 'SyntenyTrack',\n configSchema,\n ),\n })\n })\n}\n","import {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n} from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #stateModel LinearLollipopDisplay\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nexport function stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearLollipopDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearLollipopDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n }),\n )\n\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #getter\n */\n get blockType() {\n return 'dynamicBlocks'\n },\n /**\n * #getter\n */\n get renderDelay() {\n return 500\n },\n /**\n * #method\n */\n renderProps() {\n return {\n ...superRenderProps(),\n rpcDriverName: self.rpcDriverName,\n config: self.configuration.renderer,\n }\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return self.configuration.renderer.type\n },\n }\n })\n}\n","import { readConfObject } from '@jbrowse/core/configuration'\nimport { doesIntersect2 } from '@jbrowse/core/util/range'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\n\ninterface LayoutItem {\n uniqueId: string\n anchorLocation: number\n width: number\n height: number\n data: { score: number }\n}\n\ntype LayoutEntry = LayoutItem & { x: number; y: number }\n\ntype LayoutMap = Map<string, LayoutEntry>\n\nexport class FloatingLayout {\n width: number\n\n totalHeight = 0\n\n constructor({ width }: { width: number }) {\n if (!width) {\n throw new Error('width required to make a new FloatingLayout')\n }\n this.width = width\n }\n\n items: LayoutItem[] = []\n\n layout: LayoutMap = new Map()\n\n layoutDirty = false\n\n add(\n uniqueId: string,\n anchorLocation: number,\n width: number,\n height: number,\n data: { score: number },\n ) {\n this.items.push({ uniqueId, anchorLocation, width, height, data })\n this.layoutDirty = true\n }\n\n /**\n * @returns Map of `uniqueId => {x,y,anchorLocation,width,height,data}`\n */\n getLayout(configuration?: AnyConfigurationModel) {\n if (!this.layoutDirty) {\n return this.layout\n }\n if (!configuration) {\n throw new Error('configuration object required')\n }\n\n const minY = readConfObject(configuration, 'minStickLength')\n\n // sort them by score ascending, so higher scores will always end up\n // stacked last (toward the bottom)\n const sorted = this.items.sort((a, b) => a.data.score - b.data.score)\n\n // bump them\n let maxBottom = 0\n const layoutEntries: [string, LayoutEntry][] = new Array(sorted.length)\n for (let i = 0; i < sorted.length; i += 1) {\n const currentItem = sorted[i]!\n const { anchorLocation, width, height } = currentItem\n const start = anchorLocation - width / 2\n const end = start + width\n let top = minY\n let bottom = top + height\n\n // figure out how far down to put it\n for (let j = 0; j < i; j += 1) {\n const [, previouslyLaidOutItem] = layoutEntries[j]!\n const {\n x: prevStart,\n y: prevTop,\n width: prevWidth,\n height: prevHeight,\n } = previouslyLaidOutItem\n const prevEnd = prevStart + prevWidth\n const prevBottom = prevTop + prevHeight\n if (\n doesIntersect2(prevStart, prevEnd, start, end) &&\n doesIntersect2(prevTop, prevBottom, top, bottom)\n ) {\n // bump this one to the bottom of the previous one\n top = prevBottom\n bottom = top + height\n j = -1 // we need to check all of them again after bumping\n }\n }\n\n // record the entry and update the maxBottom\n layoutEntries[i] = [\n currentItem.uniqueId,\n { ...currentItem, x: start, y: top },\n ]\n if (bottom > maxBottom) {\n maxBottom = bottom\n }\n }\n\n // try to tile them left to right all at the same level\n // if they don't fit, try to alternate them on 2 levels, then 3\n this.totalHeight = maxBottom\n this.layout = new Map(layoutEntries)\n this.layoutDirty = false\n return this.layout\n }\n\n getTotalHeight() {\n if (this.layoutDirty) {\n throw new Error('getTotalHeight does not work when the layout is dirty.')\n }\n return this.totalHeight\n }\n\n serializeRegion() {\n return this.toJSON()\n }\n\n toJSON() {\n if (this.layoutDirty) {\n throw new Error('toJSON does not work when the layout is dirty.')\n }\n return { pairs: [...this.getLayout()], totalHeight: this.getTotalHeight() }\n }\n\n static fromJSON() {\n throw new Error('not supported')\n }\n}\n\nexport class PrecomputedFloatingLayout {\n layout: LayoutMap\n\n totalHeight: number\n\n constructor({\n pairs,\n totalHeight,\n }: {\n pairs: [string, LayoutEntry][]\n totalHeight: number\n }) {\n this.layout = new Map(pairs)\n this.totalHeight = totalHeight\n }\n\n add(uniqueId: string) {\n if (!this.layout.has(uniqueId)) {\n throw new Error(`layout error, precomputed layout is missing ${uniqueId}`)\n }\n }\n\n getLayout() {\n return this.layout\n }\n\n getTotalHeight() {\n return this.totalHeight\n }\n\n static fromJSON(\n json: ConstructorParameters<typeof PrecomputedFloatingLayout>[0],\n ) {\n return new PrecomputedFloatingLayout(json)\n }\n}\n","import BoxRendererType, {\n LayoutSession,\n} from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'\nimport MultiLayout from '@jbrowse/core/util/layouts/MultiLayout'\nimport { FloatingLayout, PrecomputedFloatingLayout } from './Layout'\n\nclass FloatingLayoutSession extends LayoutSession {\n makeLayout() {\n 'sequenceAdapter'\n\n const { end, start } = this.regions[0]\n const widthPx = (end - start) / this.bpPerPx\n return new MultiLayout(FloatingLayout, { width: widthPx })\n }\n\n layoutIsValid(/* layout */) {\n return false // layout.left layout.width === this.width\n }\n}\n\nexport default class LollipopRenderer extends BoxRendererType {\n createSession(args) {\n return new FloatingLayoutSession(args)\n }\n\n deserializeLayoutInClient(json) {\n return new PrecomputedFloatingLayout(json)\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport default ConfigurationSchema(\n 'LollipopRenderer',\n {\n strokeColor: {\n type: 'color',\n description: 'the outer color of each lollipop',\n defaultValue: 'green',\n contextVariable: ['feature'],\n },\n innerColor: {\n type: 'color',\n description: 'the inner color of each lollipop',\n defaultValue: '#7fc75f',\n contextVariable: ['feature'],\n },\n strokeWidth: {\n type: 'number',\n description: 'width of the stroked border',\n defaultValue: 4,\n contextVariable: ['feature'],\n },\n radius: {\n type: 'number',\n description: 'radius in pixels of each lollipop body',\n defaultValue: `jexl:sqrt(max(3, (get(feature,'score')*10)/3.14))`,\n contextVariable: ['feature'],\n },\n caption: {\n type: 'string',\n description:\n 'the tooltip caption displayed when the mouse hovers over a lollipop',\n defaultValue: `jexl:get(feature,'name')`,\n contextVariable: ['feature'],\n },\n minStickLength: {\n type: 'number',\n description: 'minimum lollipop \"stick\" length, in pixels',\n defaultValue: 5,\n },\n stickColor: {\n type: 'color',\n description: 'color of the lollipop stick',\n defaultValue: 'black',\n contextVariable: ['feature'],\n },\n stickWidth: {\n type: 'number',\n description: 'width in pixels of the lollipop stick',\n defaultValue: 2,\n contextVariable: ['feature'],\n },\n score: {\n type: 'number',\n description:\n 'the \"score\" of each lollipop, displayed as a number in the center of the circle',\n defaultValue: `jexl:get(feature,'score')`,\n contextVariable: ['feature'],\n },\n },\n { explicitlyTyped: true },\n)\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport LinearLollipopDisplayF from './LinearLollipopDisplay'\nimport LollipopRendererF from './LollipopRenderer'\n\nexport default class LollipopPlugin extends Plugin {\n name = 'LollipopPlugin'\n\n install(pluginManager: PluginManager) {\n LollipopRendererF(pluginManager)\n LinearLollipopDisplayF(pluginManager)\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { lazy } from 'react'\nimport LollipopRenderer from './LollipopRenderer'\nimport configSchema from './configSchema'\n\nexport default function LollipopRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new LollipopRenderer({\n name: 'LollipopRenderer',\n ReactComponent: lazy(() => import('./components/LollipopRendering')),\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nimport { stateModelFactory } from './model'\nimport { configSchemaFactory } from './configSchema'\n\nexport default function LinearLollipopDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearLollipopDisplay',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'LollipopTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #config LinearLollipopDisplay\n */\nexport function configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearLollipopDisplay',\n {\n /**\n * #slot\n */\n renderer: pluginManager.pluggableConfigSchemaType('renderer'),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\nimport { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'\nimport { getEnv } from '@jbrowse/core/util'\n\n/**\n * #stateModel LinearArcDisplay\n * extends\n * - [BaseLinearDisplay](../baselineardisplay)\n */\nexport function stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearArcDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearArcDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n displayMode: types.maybe(types.string),\n }),\n )\n\n .views(self => ({\n /**\n * #getter\n */\n get blockType() {\n return 'staticBlocks'\n },\n /**\n * #getter\n */\n get renderDelay() {\n return 500\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return self.configuration.renderer.type\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get displayModeSetting() {\n return self.displayMode ?? getConf(self, ['renderer', 'displayMode'])\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get rendererConfig() {\n const configBlob = getConf(self, ['renderer']) || {}\n const config = configBlob as Omit<typeof configBlob, symbol>\n return self.rendererType.configSchema.create(\n {\n ...config,\n displayMode: self.displayModeSetting,\n },\n getEnv(self),\n )\n },\n }))\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #method\n */\n renderProps() {\n return {\n ...superRenderProps(),\n rpcDriverName: self.rpcDriverName,\n config: self.rendererConfig,\n height: self.height,\n }\n },\n }\n })\n .actions(self => ({\n /**\n * #action\n */\n setDisplayMode(flag: string) {\n self.displayMode = flag\n },\n }))\n .views(self => {\n const superMenuItems = self.trackMenuItems\n return {\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...superMenuItems(),\n {\n label: 'Display mode',\n subMenu: [\n {\n type: 'radio',\n label: 'Arcs',\n onClick: () => {\n self.setDisplayMode('arcs')\n },\n checked: self.displayMode === 'arcs',\n },\n {\n type: 'radio',\n label: 'Semi-circles',\n onClick: () => {\n self.setDisplayMode('semicircles')\n },\n checked: self.displayMode === 'semicircles',\n },\n ],\n },\n ]\n },\n }\n })\n}\n","import React from 'react'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { Instance, types } from 'mobx-state-tree'\nimport {\n Feature,\n getSession,\n isSessionModelWithWidgets,\n getContainingView,\n getContainingTrack,\n isSelectionContainer,\n} from '@jbrowse/core/util'\nimport { BaseDisplay } from '@jbrowse/core/pluggableElementTypes'\nimport {\n FeatureDensityMixin,\n TrackHeightMixin,\n} from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #stateModel LinearPairedArcDisplay\n * this is a non-block-based track type, and can connect arcs across multiple\n * displayedRegions\n *\n * extends\n * - [BaseDisplay](../basedisplay)\n * - [TrackHeightMixin](../trackheightmixin)\n * - [FeatureDensityMixin](../featuredensitymixin)\n */\nexport function stateModelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearPairedArcDisplay',\n BaseDisplay,\n TrackHeightMixin(),\n FeatureDensityMixin(),\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearPairedArcDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n displayMode: types.maybe(types.string),\n }),\n )\n .volatile(() => ({\n lastDrawnOffsetPx: 0,\n features: undefined as Feature[] | undefined,\n loading: false,\n drawn: true,\n }))\n\n .views(self => ({\n /**\n * #getter\n */\n get displayModeSetting() {\n return self.displayMode ?? getConf(self, ['renderer', 'displayMode'])\n },\n }))\n\n .actions(self => ({\n /**\n * #action\n */\n selectFeature(feature: Feature) {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n const featureWidget = session.addWidget(\n 'VariantFeatureWidget',\n 'variantFeature',\n {\n view: getContainingView(self),\n track: getContainingTrack(self),\n featureData: feature.toJSON(),\n },\n )\n\n session.showWidget(featureWidget)\n }\n if (isSelectionContainer(session)) {\n session.setSelection(feature)\n }\n },\n /**\n * #action\n */\n setLoading(flag: boolean) {\n self.loading = flag\n },\n /**\n * #action\n */\n setFeatures(f: Feature[]) {\n self.features = f\n },\n /**\n * #action\n */\n setDisplayMode(flag: string) {\n self.displayMode = flag\n },\n }))\n\n .actions(self => ({\n afterAttach() {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ;(async () => {\n try {\n const { doAfterAttach } = await import('./afterAttach')\n doAfterAttach(self)\n } catch (e) {\n console.error(e)\n self.setError(e)\n }\n })()\n },\n /**\n * #action\n */\n async renderSvg(opts: {\n rasterizeLayers?: boolean\n }): Promise<React.ReactNode> {\n const { renderArcSvg } = await import('./renderSvg')\n // @ts-expect-error\n return renderArcSvg(self, opts)\n },\n }))\n}\n\nexport type LinearArcDisplayStateModel = ReturnType<typeof stateModelFactory>\nexport type LinearArcDisplayModel = Instance<LinearArcDisplayStateModel>\n","import React, { lazy, Suspense, useState } from 'react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { Feature, Region, bpSpanPx, getStrokeProps } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\n\n// locals\nconst ArcTooltip = lazy(() => import('../ArcTooltip'))\n\nfunction Arc({\n selectedFeatureId,\n region,\n bpPerPx,\n config,\n height: displayHeight,\n feature,\n onFeatureClick,\n}: {\n selectedFeatureId?: string\n region: Region\n config: AnyConfigurationModel\n bpPerPx: number\n height: number\n feature: Feature\n onFeatureClick: (event: React.MouseEvent, featureId: string) => void\n}) {\n const [isMouseOvered, setIsMouseOvered] = useState(false)\n const [left, right] = bpSpanPx(\n feature.get('start'),\n feature.get('end'),\n region,\n bpPerPx,\n )\n const featureId = feature.id()\n const selected =\n selectedFeatureId && String(selectedFeatureId) === String(feature.id())\n const stroke = selected ? 'red' : readConfObject(config, 'color', { feature })\n const textStroke = selected ? 'red' : 'black'\n const label = readConfObject(config, 'label', { feature })\n const caption = readConfObject(config, 'caption', { feature })\n const strokeWidth = readConfObject(config, 'thickness', { feature }) || 2\n const height = Math.min(\n readConfObject(config, 'height', { feature }) || 100,\n displayHeight,\n )\n const ref = React.createRef<SVGPathElement>()\n\n // formula: https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves\n const t = 0.5\n const t1 = 1 - t\n const textYCoord = 3 * (t1 * t1) * (t * height) + 3 * t1 * (t * t) * height\n\n return (\n <g>\n <path\n ref={ref}\n {...getStrokeProps(stroke)}\n d={`M ${left} 0 C ${left} ${height}, ${right} ${height}, ${right} 0`}\n strokeWidth={strokeWidth}\n fill=\"transparent\"\n onClick={e => {\n onFeatureClick(e, featureId)\n }}\n onMouseOver={() => {\n setIsMouseOvered(true)\n }}\n onMouseLeave={() => {\n setIsMouseOvered(false)\n }}\n pointerEvents=\"stroke\"\n />\n\n {isMouseOvered ? (\n <Suspense fallback={null}>\n <ArcTooltip contents={caption} />\n </Suspense>\n ) : null}\n <text\n x={left + (right - left) / 2}\n y={textYCoord + 3}\n stroke=\"white\"\n strokeWidth=\"0.6em\"\n >\n {label}\n </text>\n <text\n x={left + (right - left) / 2}\n y={textYCoord + 3}\n stroke={textStroke}\n >\n {label}\n </text>\n </g>\n )\n}\n\nfunction polarToCartesian(\n centerX: number,\n centerY: number,\n radius: number,\n angleInDegrees: number,\n) {\n const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180\n\n return {\n x: centerX + radius * Math.cos(angleInRadians),\n y: centerY + radius * Math.sin(angleInRadians),\n }\n}\n\nfunction describeArc(\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n) {\n const start = polarToCartesian(x, y, radius, endAngle)\n const end = polarToCartesian(x, y, radius, startAngle)\n const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1'\n\n return [\n 'M',\n start.x,\n start.y,\n 'A',\n radius,\n radius,\n 0,\n largeArcFlag,\n 0,\n end.x,\n end.y,\n ].join(' ')\n}\n\nfunction SemiCircles({\n selectedFeatureId,\n region,\n bpPerPx,\n config,\n onFeatureClick,\n feature,\n}: {\n selectedFeatureId?: string\n region: Region\n config: AnyConfigurationModel\n onFeatureClick: (event: React.MouseEvent, featureId: string) => void\n bpPerPx: number\n feature: Feature\n}) {\n const [isMouseOvered, setIsMouseOvered] = useState(false)\n const [left, right] = bpSpanPx(\n feature.get('start'),\n feature.get('end'),\n region,\n bpPerPx,\n )\n\n const featureId = feature.id()\n const selected =\n selectedFeatureId && String(selectedFeatureId) === String(feature.id())\n const stroke = selected ? 'red' : readConfObject(config, 'color', { feature })\n const textStroke = selected ? 'red' : 'black'\n const label = readConfObject(config, 'label', { feature })\n const caption = readConfObject(config, 'caption', { feature })\n const strokeWidth = readConfObject(config, 'thickness', { feature }) || 2\n const ref = React.createRef<SVGPathElement>()\n const textYCoord = (right - left) / 2\n\n return (\n <g>\n <path\n d={describeArc(\n left + (right - left) / 2,\n 0,\n (right - left) / 2,\n 90,\n 270,\n )}\n {...getStrokeProps(stroke)}\n strokeWidth={strokeWidth}\n fill=\"transparent\"\n onClick={e => {\n onFeatureClick(e, featureId)\n }}\n onMouseOver={() => {\n setIsMouseOvered(true)\n }}\n onMouseLeave={() => {\n setIsMouseOvered(false)\n }}\n ref={ref}\n pointerEvents=\"stroke\"\n />\n {isMouseOvered ? <ArcTooltip contents={caption} /> : null}\n <text\n x={left + (right - left) / 2}\n y={textYCoord + 3}\n stroke=\"white\"\n strokeWidth=\"0.6em\"\n >\n {label}\n </text>\n <text\n x={left + (right - left) / 2}\n y={textYCoord + 3}\n stroke={textStroke}\n >\n {label}\n </text>\n </g>\n )\n}\nconst ArcRendering = observer(function ({\n features,\n config,\n regions,\n bpPerPx,\n height,\n exportSVG,\n displayModel,\n onFeatureClick,\n}: {\n features: Map<string, Feature>\n config: AnyConfigurationModel\n regions: Region[]\n bpPerPx: number\n height: number\n displayModel?: { selectedFeatureId: string }\n onFeatureClick: (event: React.MouseEvent, featureId: string) => void\n exportSVG: boolean\n}) {\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n const semicircles = readConfObject(config, 'displayMode') === 'semicircles'\n const { selectedFeatureId } = displayModel || {}\n\n return (\n <Wrapper exportSVG={exportSVG} width={width} height={height}>\n {[...features.values()].map(f =>\n semicircles ? (\n <SemiCircles\n key={f.id()}\n config={config}\n region={region}\n bpPerPx={bpPerPx}\n selectedFeatureId={selectedFeatureId}\n onFeatureClick={onFeatureClick}\n feature={f}\n />\n ) : (\n <Arc\n key={f.id()}\n height={height}\n config={config}\n region={region}\n bpPerPx={bpPerPx}\n selectedFeatureId={selectedFeatureId}\n onFeatureClick={onFeatureClick}\n feature={f}\n />\n ),\n )}\n </Wrapper>\n )\n})\n\nfunction Wrapper({\n exportSVG,\n width,\n height,\n children,\n}: {\n exportSVG: boolean\n width: number\n height: number\n children: React.ReactNode\n}) {\n return exportSVG ? (\n children\n ) : (\n <svg width={width} height={height}>\n {children}\n </svg>\n )\n}\n\nexport default ArcRendering\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config ArcRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst ArcRenderer = ConfigurationSchema(\n 'ArcRenderer',\n {\n /**\n * #slot\n */\n color: {\n type: 'color',\n description: 'the color of the arcs',\n defaultValue: 'darkblue',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n thickness: {\n type: 'number',\n description: 'the thickness of the arcs',\n defaultValue: `jexl:logThickness(feature,'score')`,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n label: {\n type: 'string',\n description: 'the label to appear at the apex of the arcs',\n defaultValue: `jexl:get(feature,'score')`,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n height: {\n type: 'number',\n description: 'the height of the arcs',\n defaultValue: `jexl:log10(get(feature,'end')-get(feature,'start'))*50`,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n caption: {\n type: 'string',\n description:\n 'the caption to appear when hovering over any point on the arcs',\n defaultValue: `jexl:get(feature,'name')`,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n displayMode: {\n type: 'enum',\n defaultValue: 'arcs',\n model: types.enumeration('DisplayMode', ['arcs', 'semicircles']),\n description: 'render semi-circles instead of arcs',\n },\n },\n { explicitlyTyped: true },\n)\nexport default ArcRenderer\n","import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType'\n\nexport default class ArcRenderer extends FeatureRendererType {}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport LinearArcDisplayF from './LinearArcDisplay'\nimport LinearPairedArcDisplayF from './LinearPairedArcDisplay'\nimport ArcRendererF from './ArcRenderer'\nimport { Feature } from '@jbrowse/core/util'\nimport { set1 } from '@jbrowse/core/ui/colors'\n\nexport default class ArcPlugin extends Plugin {\n name = 'ArcRenderer'\n install(pluginManager: PluginManager) {\n ArcRendererF(pluginManager)\n LinearArcDisplayF(pluginManager)\n LinearPairedArcDisplayF(pluginManager)\n\n pluginManager.jexl.addFunction(\n 'logThickness',\n (feature: Feature, attributeName: string) =>\n Math.log(feature.get(attributeName) + 1),\n )\n pluginManager.jexl.addFunction(\n 'defaultPairedArcColor',\n (_feature: Feature, alt?: string) => {\n if (alt?.startsWith('<DEL')) {\n return set1[0]\n } else if (alt?.startsWith('<DUP')) {\n return set1[1]\n } else if (alt?.startsWith('<INV')) {\n return set1[2]\n } else if (alt?.startsWith('<TRA')) {\n return set1[3]\n } else if (alt?.startsWith('<CNV')) {\n return set1[4]\n } else {\n return set1[6] // skip 5, yellow\n }\n },\n )\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport ReactComponent from './ArcRendering'\nimport configSchema from './configSchema'\nimport ArcRenderer from './ArcRenderer'\n\nexport default function ArcRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new ArcRenderer({\n name: 'ArcRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nimport { configSchemaFactory } from './configSchema'\nimport { stateModelFactory } from './model'\n\nexport default function LinearArcDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearArcDisplay',\n displayName: 'Arc display',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'FeatureTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { types } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #config LinearArcDisplay\n */\nexport function configSchemaFactory(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearArcDisplay',\n {\n /**\n * #slot\n */\n renderer: types.optional(\n pluginManager.pluggableConfigSchemaType('renderer'),\n { type: 'ArcRenderer' },\n ),\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { DisplayType } from '@jbrowse/core/pluggableElementTypes'\n\nimport { configSchemaFactory } from './configSchema'\nimport { stateModelFactory } from './model'\nimport { lazy } from 'react'\n\nexport default function LinearPairedArcDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory()\n return new DisplayType({\n name: 'LinearPairedArcDisplay',\n displayName: 'Arc display',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'VariantTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: lazy(() => import('./components/ReactComponent')),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\n\n/**\n * #config LinearPairedArcDisplay\n */\nexport function configSchemaFactory() {\n return ConfigurationSchema(\n 'LinearPairedArcDisplay',\n {\n /**\n * #slot\n */\n color: {\n type: 'color',\n description: 'the color of the arcs',\n defaultValue: 'jexl:defaultPairedArcColor(feature,alt)',\n contextVariable: ['feature', 'alt'],\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { types } from 'mobx-state-tree'\n\nexport const configSchema = ConfigurationSchema('AboutWidget', {})\n\nexport const stateModel = types.model('AboutWidget', {\n id: ElementId,\n type: types.literal('AboutWidget'),\n})\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { types } from 'mobx-state-tree'\n\nexport const configSchema = ConfigurationSchema('HelpWidget', {})\n\nexport const stateModel = types.model('HelpWidget', {\n id: ElementId,\n type: types.literal('HelpWidget'),\n})\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { types } from 'mobx-state-tree'\n\nexport const configSchema = ConfigurationSchema('ImportSessionWidget', {})\n\nexport const stateModel = types.model('ImportSessionWidget', {\n id: ElementId,\n type: types.literal('ImportSessionWidget'),\n})\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { types } from 'mobx-state-tree'\n\nexport const configSchema = ConfigurationSchema('SessionManager', {})\n\nexport const stateModel = types.model('SessionManager', {\n id: ElementId,\n type: types.literal('SessionManager'),\n})\n","import { lazy } from 'react'\nimport WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { SessionWithWidgets, isAbstractMenuManager } from '@jbrowse/core/util'\n\nimport HelpIcon from '@mui/icons-material/Help'\nimport InfoIcon from '@mui/icons-material/Info'\n\nimport {\n configSchema as aboutConfigSchema,\n stateModel as aboutStateModel,\n} from './AboutWidget'\nimport {\n configSchema as helpConfigSchema,\n stateModel as helpStateModel,\n} from './HelpWidget'\nimport {\n configSchema as importSessionConfigSchema,\n stateModel as importSessionStateModel,\n} from './ImportSessionWidget'\nimport {\n configSchema as sessionManagerConfigSchema,\n stateModel as sessionManagerStateModel,\n} from './SessionManager'\n\nexport default class MenusPlugin extends Plugin {\n name = 'MenusPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'AboutWidget',\n heading: 'About',\n configSchema: aboutConfigSchema,\n stateModel: aboutStateModel,\n ReactComponent: lazy(\n () => import('./AboutWidget/components/AboutWidget'),\n ),\n })\n })\n\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'HelpWidget',\n heading: 'Help',\n configSchema: helpConfigSchema,\n stateModel: helpStateModel,\n ReactComponent: lazy(\n () => import('./HelpWidget/components/HelpWidget'),\n ),\n })\n })\n\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'ImportSessionWidget',\n heading: 'Import session',\n configSchema: importSessionConfigSchema,\n stateModel: importSessionStateModel,\n ReactComponent: lazy(\n () => import('./ImportSessionWidget/components/ImportSessionWidget'),\n ),\n })\n })\n\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'SessionManager',\n heading: 'Sessions',\n configSchema: sessionManagerConfigSchema,\n stateModel: sessionManagerStateModel,\n ReactComponent: lazy(\n () => import('./SessionManager/components/SessionManager'),\n ),\n })\n })\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToMenu('Help', {\n label: 'About',\n icon: InfoIcon,\n onClick: (session: SessionWithWidgets) => {\n const widget = session.addWidget('AboutWidget', 'aboutWidget')\n session.showWidget(widget)\n },\n })\n pluginManager.rootModel.appendToMenu('Help', {\n label: 'Help',\n icon: HelpIcon,\n onClick: (session: SessionWithWidgets) => {\n const widget = session.addWidget('HelpWidget', 'helpWidget')\n session.showWidget(widget)\n },\n })\n }\n }\n}\n","import {\n BaseFeatureDataAdapter,\n BaseOptions,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { NoAssemblyRegion } from '@jbrowse/core/util/types'\nimport { ObservableCreate } from '@jbrowse/core/util/rxjs'\nimport SimpleFeature, { Feature } from '@jbrowse/core/util/simpleFeature'\nimport format from 'string-template'\nimport { Instance } from 'mobx-state-tree'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\n\nimport type MyConfigSchema from './configSchema'\n\ninterface SPARQLEntry {\n type: string\n value: string\n dataTypes?: string\n}\n\ntype SPARQLBinding = Record<string, SPARQLEntry>\n\ninterface SPARQLResponseHead {\n vars: string[]\n}\n\ninterface SPARQLResponseResults {\n bindings?: SPARQLBinding[]\n}\n\ninterface SPARQLResponse {\n head: SPARQLResponseHead\n results: SPARQLResponseResults\n}\n\ninterface SPARQLFeatureData {\n start: number\n end: number\n strand: number\n refName: string\n subfeatures?: SPARQLFeatureData[]\n uniqueId: string\n\n [propName: string]: any\n}\n\ninterface SPARQLFeature {\n data: SPARQLFeatureData\n}\n\nexport default class SPARQLAdapter extends BaseFeatureDataAdapter {\n private endpoint: string\n\n private queryTemplate: string\n\n private refNamesQueryTemplate: string\n\n private additionalQueryParams: string[]\n\n private configRefNames: string[]\n\n private refNames: string[] | undefined\n\n public constructor(\n config: Instance<typeof MyConfigSchema>,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n this.endpoint = readConfObject(config, 'endpoint').uri\n this.queryTemplate = readConfObject(config, 'queryTemplate')\n this.additionalQueryParams = readConfObject(config, 'additionalQueryParams')\n this.refNamesQueryTemplate = readConfObject(config, 'refNamesQueryTemplate')\n this.configRefNames = readConfObject(config, 'refNames')\n }\n\n public async getRefNames(opts: BaseOptions = {}): Promise<string[]> {\n if (this.refNames) {\n return this.refNames\n }\n if (this.refNamesQueryTemplate) {\n const queryTemplate = encodeURIComponent(this.refNamesQueryTemplate)\n const results = await this.querySparql(queryTemplate, opts)\n this.refNames = this.resultsToRefNames(results)\n } else {\n this.refNames = this.configRefNames\n }\n return this.refNames\n }\n\n public getFeatures(query: NoAssemblyRegion, opts: BaseOptions = {}) {\n return ObservableCreate<Feature>(async observer => {\n const filledTemplate = encodeURIComponent(\n format(this.queryTemplate, query),\n )\n const { refName } = query\n const results = await this.querySparql(filledTemplate, opts)\n this.resultsToFeatures(results, refName).forEach(feature => {\n observer.next(feature)\n })\n observer.complete()\n }, opts.signal)\n }\n\n private async querySparql(query: string, opts?: BaseOptions): Promise<any> {\n let additionalQueryParams = ''\n if (this.additionalQueryParams.length) {\n additionalQueryParams = `&${this.additionalQueryParams.join('&')}`\n }\n const signal = opts?.signal\n const response = await fetch(\n `${this.endpoint}?query=${query}${additionalQueryParams}`,\n {\n headers: { accept: 'application/json,application/sparql-results+json' },\n signal,\n },\n )\n return response.json()\n }\n\n private resultsToRefNames(response: SPARQLResponse): string[] {\n const rows = response.results.bindings || []\n const fields = response.head.vars\n if (!fields.includes('refName')) {\n throw new Error('\"refName\" not found in refNamesQueryTemplate response')\n }\n return rows.map(row => row.refName!.value)\n }\n\n private resultsToFeatures(\n results: SPARQLResponse,\n refName: string,\n ): SimpleFeature[] {\n const rows = results.results.bindings || []\n const fields = results.head.vars\n const requiredFields = ['start', 'end', 'uniqueId']\n requiredFields.forEach(requiredField => {\n if (!fields.includes(requiredField)) {\n console.error(\n `Required field ${requiredField} missing from feature data`,\n )\n }\n })\n const seenFeatures: Record<string, SPARQLFeature> = {}\n rows.forEach(row => {\n const rawData: Record<string, string>[] = [{}]\n fields.forEach(field => {\n if (field in row) {\n const { value } = row[field]!\n let idx = 0\n while (field.startsWith('sub_')) {\n field = field.slice(4)\n idx += 1\n }\n while (idx > rawData.length - 1) {\n rawData.push({})\n }\n rawData[idx]![field] = value\n }\n })\n\n rawData.forEach((rd, idx) => {\n const { uniqueId, start, end, strand } = rd\n if (idx < rawData.length - 1) {\n rawData[idx + 1]!.parentUniqueId = uniqueId!\n }\n seenFeatures[uniqueId!] = {\n data: {\n ...rd,\n uniqueId: uniqueId!,\n refName,\n start: Number.parseInt(start!, 10),\n end: Number.parseInt(end!, 10),\n strand: Number.parseInt(strand!, 10) || 0,\n },\n }\n })\n })\n\n // resolve subfeatures, keeping only top-level features in seenFeatures\n for (const [uniqueId, f] of Object.entries(seenFeatures)) {\n const pid = f.data.parentUniqueId\n f.data.parentUniqueId = undefined\n if (pid) {\n const p = seenFeatures[pid]\n if (p) {\n if (!p.data.subfeatures) {\n p.data.subfeatures = []\n }\n p.data.subfeatures.push({\n ...f.data,\n uniqueId,\n })\n delete seenFeatures[uniqueId]\n } else {\n const subfeatures = Object.values(seenFeatures)\n .map(sf => sf.data.subfeatures)\n .filter(sf => !!sf)\n .flat()\n let found = false\n for (const subfeature of subfeatures) {\n if (subfeature.uniqueId === pid) {\n if (!subfeature.subfeatures) {\n subfeature.subfeatures = []\n }\n subfeature.subfeatures.push({\n ...f.data,\n uniqueId,\n })\n delete seenFeatures[uniqueId]\n found = true\n break\n }\n if (subfeature.subfeatures) {\n subfeatures.push(...subfeature.subfeatures)\n }\n }\n if (!found) {\n console.error(`Could not find parentID ${pid}`)\n }\n }\n }\n }\n\n return Object.keys(seenFeatures).map(\n seenFeature =>\n new SimpleFeature({\n ...seenFeatures[seenFeature]!.data,\n uniqueId: seenFeature,\n subfeatures: seenFeatures[seenFeature]!.data.subfeatures,\n }),\n )\n }\n\n public async hasDataForRefName(\n refName: string,\n opts: BaseOptions = {},\n ): Promise<boolean> {\n const refNames = await this.getRefNames(opts)\n if (refNames.length && !refNames.includes(refName)) {\n return false\n }\n return true\n }\n\n public freeResources(/* { region } */): void {}\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport default ConfigurationSchema(\n 'SPARQLAdapter',\n {\n endpoint: {\n type: 'fileLocation',\n defaultValue: {\n uri: 'https://somesite.com/sparql',\n locationType: 'UriLocation',\n },\n description: 'URL of the SPARQL endpoint',\n },\n queryTemplate: {\n type: 'text',\n defaultValue: '',\n description:\n 'SPARQL query where {start} {end} and {refName} will get replaced for each call',\n },\n refNamesQueryTemplate: {\n type: 'text',\n defaultValue: '',\n description:\n 'SPARQL query that returns the possible refNames in a ?refName column',\n },\n refNames: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Possible refNames used by the SPARQL endpoint (ignored if \"refNamesQueryTemplate\" is provided)',\n },\n additionalQueryParams: {\n type: 'stringArray',\n defaultValue: [],\n description:\n 'Additional parameters to add to the query, e.g. \"format=JSON\"',\n },\n },\n { explicitlyTyped: true },\n)\n","import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n AdapterClass as SPARQLAdapterClass,\n configSchema as sparqlAdapterConfigSchema,\n} from './SPARQLAdapter'\nimport { AdapterGuesser, getFileName } from '@jbrowse/core/util/tracks'\n\nexport default class RdfPlugin extends Plugin {\n name = 'RdfPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'SPARQLAdapter',\n displayName: 'SPARQL adapter',\n configSchema: sparqlAdapterConfigSchema,\n AdapterClass: SPARQLAdapterClass,\n }),\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\/sparql$/i\n const adapterName = 'SPARQLAdapter'\n const fileName = getFileName(file)\n if (regexGuess.test(fileName) || adapterHint === adapterName) {\n return {\n type: adapterName,\n endpoint: file,\n }\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n }\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config TwoBitAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst TwoBitAdapter = ConfigurationSchema(\n 'TwoBitAdapter',\n {\n /**\n * #slot\n */\n twoBitLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/my.2bit', locationType: 'UriLocation' },\n },\n /**\n * #slot\n */\n chromSizesLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/default.chrom.sizes',\n locationType: 'UriLocation',\n },\n description:\n 'An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time',\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default TwoBitAdapter\n","import React from 'react'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { createJBrowseTheme } from '@jbrowse/core/ui'\nimport { observer } from 'mobx-react'\nimport {\n Feature,\n Region,\n bpSpanPx,\n revcom,\n complement,\n defaultStarts,\n defaultStops,\n defaultCodonTable,\n generateCodonTable,\n Frame,\n} from '@jbrowse/core/util'\nimport { Theme } from '@mui/material'\n\nfunction Translation({\n codonTable,\n seq,\n frame,\n bpPerPx,\n colorByCDS,\n region,\n seqStart,\n height,\n y,\n reverse = false,\n theme,\n}: {\n codonTable: Record<string, string>\n seq: string\n frame: Frame\n colorByCDS: boolean\n bpPerPx: number\n region: Region\n seqStart: number\n reverse?: boolean\n height: number\n y: number\n theme?: Theme\n}) {\n const normalizedFrame = Math.abs(frame) - 1\n const seqFrame = seqStart % 3\n const frameShift = (normalizedFrame - seqFrame + 3) % 3\n\n const frameShiftAdjustedSeqLength = seq.length - frameShift\n const multipleOfThreeLength =\n frameShiftAdjustedSeqLength - (frameShiftAdjustedSeqLength % 3)\n const seqSliced = seq.slice(frameShift, frameShift + multipleOfThreeLength)\n\n const translated: { letter: string; codon: string }[] = []\n for (let i = 0; i < seqSliced.length; i += 3) {\n const codon = seqSliced.slice(i, i + 3)\n const normalizedCodon = reverse ? revcom(codon) : codon\n const aminoAcid = codonTable[normalizedCodon] || ''\n translated.push({\n letter: aminoAcid,\n codon: normalizedCodon.toUpperCase(),\n })\n }\n\n const width = (region.end - region.start) / bpPerPx\n const codonWidth = (1 / bpPerPx) * 3\n const renderLetter = 1 / bpPerPx >= 12\n const frameOffset = frameShift / bpPerPx\n const startOffset = (region.start - seqStart) / bpPerPx\n const offset = frameOffset - startOffset\n const defaultFill = colorByCDS\n ? theme?.palette.framesCDS.at(frame)?.main\n : theme?.palette.frames.at(frame)?.main\n return (\n <>\n <rect x={0} y={y} width={width} height={height} fill={defaultFill} />\n {translated.map((element, index) => {\n const x = region.reversed\n ? width - (index + 1) * codonWidth - offset\n : codonWidth * index + offset\n const { letter, codon } = element\n const codonFill = defaultStarts.includes(codon)\n ? theme?.palette.startCodon\n : defaultStops.includes(codon)\n ? theme?.palette.stopCodon\n : undefined\n return !(renderLetter || codonFill) ? null : (\n <React.Fragment key={`${index}-${letter}`}>\n <rect\n x={x}\n y={y}\n width={\n renderLetter\n ? codonWidth\n : codonWidth + 0.7 /* small fudge factor when zoomed out*/\n }\n height={height}\n stroke={renderLetter ? '#555' : 'none'}\n fill={codonFill || 'none'}\n />\n {renderLetter ? (\n <text\n x={x + codonWidth / 2}\n fontSize={height - 2}\n y={y + height / 2}\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {letter}\n </text>\n ) : null}\n </React.Fragment>\n )\n })}\n </>\n )\n}\n\nfunction Sequence({\n bpPerPx,\n region,\n feature,\n sequenceType,\n theme,\n height,\n seq,\n y,\n}: {\n seq: string\n theme: Theme\n bpPerPx: number\n sequenceType: string\n height: number\n region: Region\n feature: Feature\n y: number\n}) {\n const render = 1 / bpPerPx >= 12\n const s = feature.get('start')\n const e = feature.get('end')\n const [leftPx, rightPx] = bpSpanPx(s, e, region, bpPerPx)\n const reverse = region.reversed\n const len = e - s\n const w = Math.max((rightPx - leftPx) / len, 0.8)\n\n return (\n <>\n {seq.split('').map((letter, index) => {\n const color =\n sequenceType === 'dna'\n ? // @ts-expect-error\n theme.palette.bases[letter.toUpperCase()]\n : undefined\n const x = reverse ? rightPx - (index + 1) * w : leftPx + index * w\n return (\n /* biome-ignore lint/suspicious/noArrayIndexKey: */\n <React.Fragment key={`${letter}-${index}`}>\n <rect\n x={x}\n y={y}\n width={w}\n height={height}\n fill={color ? color.main : '#aaa'}\n stroke={render ? '#555' : 'none'}\n />\n {render ? (\n <text\n x={x + w / 2}\n y={y + height / 2}\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n fontSize={height - 2}\n fill={\n color ? theme.palette.getContrastText(color.main) : 'black'\n }\n >\n {letter}\n </text>\n ) : null}\n </React.Fragment>\n )\n })}\n </>\n )\n}\n\nfunction SequenceSVG({\n regions,\n theme: configTheme,\n colorByCDS,\n features = new Map(),\n showReverse = true,\n showForward = true,\n showTranslation = true,\n sequenceType = 'dna',\n bpPerPx,\n rowHeight,\n}: {\n regions: Region[]\n theme?: Theme\n features: Map<string, Feature>\n colorByCDS: boolean\n showReverse?: boolean\n showForward?: boolean\n showTranslation?: boolean\n sequenceType?: string\n bpPerPx: number\n rowHeight: number\n}) {\n const region = regions[0]!\n const theme = createJBrowseTheme(configTheme)\n const codonTable = generateCodonTable(defaultCodonTable)\n const [feature] = [...features.values()]\n if (!feature) {\n return null\n }\n const seq: string = feature.get('seq')\n if (!seq) {\n return null\n }\n\n // incrementer for the y-position of the current sequence being rendered\n // (applies to both translation rows and dna rows)\n let currY = -rowHeight\n\n const showSequence = bpPerPx <= 1\n\n const forwardFrames: Frame[] = showTranslation && showForward ? [3, 2, 1] : []\n const reverseFrames: Frame[] =\n showTranslation && showReverse ? [-1, -2, -3] : []\n\n // if region.reversed, the forward translation is on bottom, reverse on top\n const [topFrames, bottomFrames] = region.reversed\n ? [reverseFrames.toReversed(), forwardFrames.toReversed()]\n : [forwardFrames, reverseFrames]\n return (\n <>\n {topFrames.map(index => (\n <Translation\n key={`translation-${index}`}\n colorByCDS={colorByCDS}\n seq={seq}\n y={(currY += rowHeight)}\n codonTable={codonTable}\n frame={index}\n bpPerPx={bpPerPx}\n region={region}\n seqStart={feature.get('start')}\n theme={theme}\n height={rowHeight}\n reverse={region.reversed}\n />\n ))}\n\n {showForward && showSequence ? (\n <Sequence\n height={rowHeight}\n sequenceType={sequenceType}\n y={(currY += rowHeight)}\n feature={feature}\n region={region}\n seq={region.reversed ? complement(seq) : seq}\n bpPerPx={bpPerPx}\n theme={theme}\n />\n ) : null}\n\n {showReverse && showSequence ? (\n <Sequence\n height={rowHeight}\n sequenceType={sequenceType}\n y={(currY += rowHeight)}\n feature={feature}\n region={region}\n seq={region.reversed ? seq : complement(seq)}\n bpPerPx={bpPerPx}\n theme={theme}\n />\n ) : null}\n\n {bottomFrames.map(index => (\n <Translation\n key={`rev-translation-${index}`}\n colorByCDS={colorByCDS}\n seq={seq}\n y={(currY += rowHeight)}\n codonTable={codonTable}\n frame={index}\n bpPerPx={bpPerPx}\n region={region}\n seqStart={feature.get('start')}\n theme={theme}\n height={rowHeight}\n reverse={!region.reversed}\n />\n ))}\n </>\n )\n}\n\nfunction Wrapper({\n exportSVG,\n width,\n totalHeight,\n children,\n}: {\n exportSVG?: { rasterizeLayers: boolean }\n width: number\n totalHeight: number\n children: React.ReactNode\n}) {\n return exportSVG ? (\n children\n ) : (\n <svg\n data-testid=\"sequence_track\"\n width={width}\n height={totalHeight}\n style={{\n // use block because svg by default is inline, which adds a margin\n display: 'block',\n width,\n height: totalHeight,\n userSelect: 'none',\n }}\n >\n {children}\n </svg>\n )\n}\n\nconst DivSequenceRendering = observer(function (props: {\n exportSVG?: { rasterizeLayers: boolean }\n features: Map<string, Feature>\n regions: Region[]\n colorByCDS: boolean\n bpPerPx: number\n rowHeight: number\n sequenceHeight: number\n config: AnyConfigurationModel\n theme?: Theme\n showForward?: boolean\n showReverse?: boolean\n showTranslation?: boolean\n}) {\n const { regions, bpPerPx, sequenceHeight } = props\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n\n return (\n <Wrapper {...props} totalHeight={sequenceHeight} width={width}>\n <SequenceSVG {...props} />\n </Wrapper>\n )\n})\n\nexport default DivSequenceRendering\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config DivSequenceRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst DivSequenceRenderer = ConfigurationSchema(\n 'DivSequenceRenderer',\n {\n /**\n * #slot\n */\n height: {\n type: 'number',\n description: 'height in pixels of each line of sequence',\n defaultValue: 16,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default DivSequenceRenderer\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport { Region } from '@jbrowse/core/util/types'\nimport FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType'\nimport ReactComponent from './components/DivSequenceRendering'\nimport configSchema from './configSchema'\n\n/* adjust in both directions */\nclass DivSequenceRenderer extends FeatureRendererType {\n supportsSVG = true\n\n getExpandedRegion(region: Region) {\n return {\n ...region,\n start: Math.max(region.start - 3, 0),\n end: region.end + 3,\n }\n }\n}\n\nexport default function DivSequenceRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new DivSequenceRenderer({\n name: 'DivSequenceRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n/**\n * #config BgzipFastaAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst BgzipFastaAdapter = ConfigurationSchema(\n 'BgzipFastaAdapter',\n {\n /**\n * #slot\n */\n fastaLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/seq.fa.gz', locationType: 'UriLocation' },\n },\n /**\n * #slot\n */\n faiLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/seq.fa.gz.fai',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n metadataLocation: {\n description: 'Optional metadata file',\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/fa.metadata.yaml',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n gziLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/seq.fa.gz.gzi',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\nexport default BgzipFastaAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config ChromSizesAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst ChromSizesAdapter = ConfigurationSchema(\n 'ChromSizesAdapter',\n {\n /**\n * #slot\n */\n chromSizesLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/species.chrom.sizes',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default ChromSizesAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config IndexedFastaAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst IndexedFastaAdapter = ConfigurationSchema(\n 'IndexedFastaAdapter',\n {\n /**\n * #slot\n */\n fastaLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/seq.fa', locationType: 'UriLocation' },\n },\n /**\n * #slot\n */\n faiLocation: {\n type: 'fileLocation',\n defaultValue: { uri: '/path/to/seq.fa.fai', locationType: 'UriLocation' },\n },\n /**\n * #slot\n */\n metadataLocation: {\n description: 'Optional metadata file',\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/fa.metadata.yaml',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\nexport default IndexedFastaAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config UnindexedFastaAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst UnindexedFastaAdapter = ConfigurationSchema(\n 'UnindexedFastaAdapter',\n {\n rewriteRefNames: {\n type: 'string',\n defaultValue: '',\n contextVariable: ['refName'],\n },\n /**\n * #slot\n */\n fastaLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/seq.fa',\n locationType: 'UriLocation',\n },\n },\n /**\n * #slot\n */\n metadataLocation: {\n description: 'Optional metadata file',\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/fa.metadata.yaml',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\nexport default UnindexedFastaAdapter\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config SequenceSearchAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = ConfigurationSchema(\n 'SequenceSearchAdapter',\n {\n /**\n * #slot\n */\n search: {\n type: 'string',\n defaultValue: '',\n description: 'Search string or regex to search for',\n },\n /**\n * #slot\n */\n sequenceAdapter: {\n type: 'frozen',\n defaultValue: null,\n },\n /**\n * #slot\n */\n searchForward: {\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n searchReverse: {\n type: 'boolean',\n defaultValue: true,\n },\n /**\n * #slot\n */\n caseInsensitive: {\n type: 'boolean',\n defaultValue: true,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default configSchema\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { default as divSequenceRendererConfigSchema } from '../DivSequenceRenderer/configSchema'\n\n/**\n * #config LinearReferenceSequenceDisplay\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport const configSchema = ConfigurationSchema(\n 'LinearReferenceSequenceDisplay',\n {\n /**\n * #slot\n */\n renderer: divSequenceRendererConfigSchema,\n },\n { explicitIdentifier: 'displayId', explicitlyTyped: true },\n)\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\nimport TwoBitAdapterF from './TwoBitAdapter'\nimport DivSequenceRendererF from './DivSequenceRenderer'\nimport BgzipFastaAdapterF from './BgzipFastaAdapter'\nimport ChromSizesAdapterF from './ChromSizesAdapter'\nimport IndexedFastaAdapterF from './IndexedFastaAdapter'\nimport UnindexedFastaAdapterF from './UnindexedFastaAdapter'\nimport SequenceSearchAdapterF from './SequenceSearchAdapter'\nimport ReferenceSequenceTrackF from './ReferenceSequenceTrack'\nimport LinearReferenceSequenceDisplayF from './LinearReferenceSequenceDisplay'\nimport createExtensionPoints from './createExtensionPoints'\n\nexport default class SequencePlugin extends Plugin {\n name = 'SequencePlugin'\n\n install(pluginManager: PluginManager) {\n DivSequenceRendererF(pluginManager)\n TwoBitAdapterF(pluginManager)\n BgzipFastaAdapterF(pluginManager)\n ChromSizesAdapterF(pluginManager)\n IndexedFastaAdapterF(pluginManager)\n UnindexedFastaAdapterF(pluginManager)\n SequenceSearchAdapterF(pluginManager)\n ReferenceSequenceTrackF(pluginManager)\n LinearReferenceSequenceDisplayF(pluginManager)\n createExtensionPoints(pluginManager)\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function TwoBitAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'TwoBitAdapter',\n displayName: 'TwoBit adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () => import('./TwoBitAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function BgzipFastaAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'BgzipFastaAdapter',\n displayName: 'Bgzip-indexed FASTA adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./BgzipFastaAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function ChromSizesAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'ChromSizesAdapter',\n displayName: 'Chrom sizes adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./ChromSizesAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function IndexedFastaAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'IndexedFastaAdapter',\n displayName: 'Indexed FASTA adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./IndexedFastaAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function UnindexedFastaAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'UnindexedFastaAdapter',\n displayName: 'Unindexed FASTA adapter',\n configSchema,\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n getAdapterClass: () =>\n import('./UnindexedFastaAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchema from './configSchema'\n\nexport default function SequenceSearchAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'SequenceSearchAdapter',\n displayName: 'Sequence search adapter',\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n configSchema,\n getAdapterClass: () =>\n import('./SequenceSearchAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { createReferenceSeqTrackConfig } from './configSchema'\n\nexport default function ReferenceSequenceTrackF(pluginManager: PluginManager) {\n pluginManager.addTrackType(() => {\n const configSchema = createReferenceSeqTrackConfig(pluginManager)\n\n return new TrackType({\n name: 'ReferenceSequenceTrack',\n displayName: 'Reference sequence track',\n configSchema,\n stateModel: createBaseTrackModel(\n pluginManager,\n 'ReferenceSequenceTrack',\n configSchema,\n ),\n })\n })\n}\n","import { types } from 'mobx-state-tree'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// Note: this is primarily a copy of createBaseTrackConfig, except with a\n// subset of the config slots, to avoid including fields that don't make sense\n// for the ReferenceSequenceTrack\n\n/**\n * #config ReferenceSequenceTrack\n * used to display base level DNA sequence tracks\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport function createReferenceSeqTrackConfig(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'ReferenceSequenceTrack',\n {\n /**\n * #slot\n * configuration for track adapter\n */\n adapter: pluginManager.pluggableConfigSchemaType('adapter'),\n\n /**\n * #slot\n * configuration for the displays e.g. LinearReferenceSequenceDisplay\n */\n displays: types.array(pluginManager.pluggableConfigSchemaType('display')),\n\n /**\n * #slot\n */\n name: {\n type: 'string',\n description:\n 'optional track name, otherwise uses the \"Reference sequence (assemblyName)\"',\n defaultValue: '',\n },\n\n /**\n * #slot\n */\n sequenceType: {\n type: 'string',\n description: 'either dna or pep',\n defaultValue: 'dna',\n },\n\n /**\n * #slot\n */\n description: {\n description: 'a description of the track',\n type: 'string',\n defaultValue: '',\n },\n\n /**\n * #slot\n */\n metadata: {\n type: 'frozen',\n description: 'anything to add about this track',\n defaultValue: {},\n },\n\n formatAbout: ConfigurationSchema('FormatAbout', {\n /**\n * #slot formatAbout.config\n */\n config: {\n type: 'frozen',\n description: 'formats configuration in about dialog',\n defaultValue: {},\n contextVariable: ['config'],\n },\n\n /**\n * #slot formatAbout.hideUris\n */\n hideUris: {\n type: 'boolean',\n defaultValue: false,\n },\n }),\n },\n {\n preProcessSnapshot: s => {\n const snap = JSON.parse(JSON.stringify(s))\n const displayTypes = new Set()\n const { displays = [] } = snap\n if (snap.trackId !== 'placeholderId') {\n // Gets the displays on the track snapshot and the possible displays\n // from the track type and adds any missing possible displays to the\n // snapshot\n displays.forEach((d: any) => d && displayTypes.add(d.type))\n const trackType = pluginManager.getTrackType(snap.type)\n trackType?.displayTypes.forEach(displayType => {\n if (!displayTypes.has(displayType.name)) {\n displays.push({\n displayId: `${snap.trackId}-${displayType.name}`,\n type: displayType.name,\n })\n }\n })\n }\n return { ...snap, displays }\n },\n /**\n * #identifier\n * all tracks have a globally unique 'trackId'\n */\n explicitIdentifier: 'trackId',\n explicitlyTyped: true,\n actions: (self: any) => ({\n addDisplayConf(displayConf: { type: string; displayId: string }) {\n const { type } = displayConf\n if (!type) {\n throw new Error(`unknown display type ${type}`)\n }\n const display = self.displays.find(\n (d: any) => d && d.displayId === displayConf.displayId,\n )\n if (display) {\n return display\n }\n const length = self.displays.push(displayConf)\n return self.displays[length - 1]\n },\n }),\n },\n )\n}\n","import { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nimport { configSchema } from './configSchema'\nimport { modelFactory } from './model'\n\nexport default function LinearReferenceSequenceDisplayF(\n pluginManager: PluginManager,\n) {\n pluginManager.addDisplayType(() => {\n const stateModel = modelFactory(configSchema)\n return new DisplayType({\n name: 'LinearReferenceSequenceDisplay',\n configSchema,\n stateModel,\n displayName: 'Reference sequence display',\n trackType: 'ReferenceSequenceTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import { addDisposer, types } from 'mobx-state-tree'\nimport {\n BaseLinearDisplay,\n LinearGenomeViewModel,\n} from '@jbrowse/plugin-linear-genome-view'\nimport {\n AnyConfigurationSchemaType,\n ConfigurationReference,\n getConf,\n} from '@jbrowse/core/configuration'\nimport { getParentRenderProps } from '@jbrowse/core/util/tracks'\nimport { getContainingTrack, getContainingView } from '@jbrowse/core/util'\nimport { autorun } from 'mobx'\n\ntype LGV = LinearGenomeViewModel\n\n/**\n * #stateModel LinearReferenceSequenceDisplay\n * base model `BaseLinearDisplay`\n */\nexport function modelFactory(configSchema: AnyConfigurationSchemaType) {\n return types\n .compose(\n 'LinearReferenceSequenceDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearReferenceSequenceDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n showForward: true,\n /**\n * #property\n */\n showReverse: true,\n /**\n * #property\n */\n showTranslation: true,\n }),\n )\n .volatile(() => ({\n /**\n * #property\n */\n rowHeight: 15,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get sequenceType() {\n return getConf(getContainingTrack(self), 'sequenceType')\n },\n\n /**\n * #getter\n * showReverse setting, it is NOT disabled for non-dna sequences\n */\n get showForwardActual() {\n return self.showForward\n },\n\n /**\n * #getter\n * showReverse setting, is disabled for non-dna sequences\n */\n get showReverseActual() {\n return this.sequenceType === 'dna' ? self.showReverse : false\n },\n\n /**\n * #getter\n * showTranslation setting is disabled for non-dna sequences\n */\n get showTranslationActual() {\n return this.sequenceType === 'dna' ? self.showTranslation : false\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get sequenceHeight() {\n const {\n rowHeight,\n showTranslationActual,\n showReverseActual,\n showForwardActual,\n } = self\n const r1 =\n showReverseActual && showTranslationActual ? rowHeight * 3 : 0\n const r2 =\n showForwardActual && showTranslationActual ? rowHeight * 3 : 0\n const t = r1 + r2\n const r = showReverseActual ? rowHeight : 0\n const s = showForwardActual ? rowHeight : 0\n return t + r + s\n },\n }))\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #method\n */\n renderProps() {\n const {\n rpcDriverName,\n showForwardActual,\n showReverseActual,\n showTranslationActual,\n rowHeight,\n sequenceHeight,\n sequenceType,\n } = self\n return {\n ...superRenderProps(),\n ...getParentRenderProps(self),\n config: self.configuration.renderer,\n rpcDriverName,\n showForward: showForwardActual,\n showReverse: showReverseActual,\n showTranslation: showTranslationActual,\n sequenceType,\n rowHeight,\n sequenceHeight,\n }\n },\n }\n })\n .views(self => ({\n /**\n * #method\n */\n regionCannotBeRendered(/* region */) {\n const view = getContainingView(self) as LGV\n return view.bpPerPx > 3 ? 'Zoom in to see sequence' : undefined\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return self.configuration.renderer.type\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n toggleShowForward() {\n self.showForward = !self.showForward\n },\n /**\n * #action\n */\n toggleShowReverse() {\n self.showReverse = !self.showReverse\n },\n /**\n * #action\n */\n toggleShowTranslation() {\n self.showTranslation = !self.showTranslation\n },\n afterAttach() {\n addDisposer(\n self,\n autorun(() => {\n const view = getContainingView(self) as LGV\n if (view.bpPerPx > 3) {\n self.setHeight(50)\n } else {\n self.setHeight(self.sequenceHeight)\n }\n }),\n )\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n trackMenuItems() {\n return [\n ...(self.sequenceType === 'dna'\n ? [\n {\n label: 'Show forward',\n type: 'checkbox',\n checked: self.showForward,\n onClick: () => {\n self.toggleShowForward()\n },\n },\n {\n label: 'Show reverse',\n type: 'checkbox',\n checked: self.showReverse,\n onClick: () => {\n self.toggleShowReverse()\n },\n },\n {\n label: 'Show translation',\n type: 'checkbox',\n checked: self.showTranslation,\n onClick: () => {\n self.toggleShowTranslation()\n },\n },\n ]\n : []),\n ]\n },\n }))\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport {\n makeIndex,\n getFileName,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\nexport default function ExtensionPointsF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.2bit$/i\n const adapterName = 'TwoBitAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n twoBitLocation: file,\n }\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'TwoBitAdapter') {\n return 'ReferenceSequenceTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.(fa|fasta|fas|fna|mfa)$/i\n const adapterName = 'IndexedFastaAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n fastaLocation: file,\n faiLocation: index || makeIndex(file, '.fai'),\n }\n\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'IndexedFastaAdapter') {\n return 'ReferenceSequenceTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.(fa|fasta|fas|fna|mfa)\\.b?gz$/i\n const adapterName = 'BgzipFastaAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n faiLocation: makeIndex(file, '.fai'),\n gziLocation: makeIndex(file, '.gzi'),\n }\n\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n }\n if (adapterHint === adapterName) {\n return obj\n }\n return adapterGuesser(file, index, adapterHint)\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) => {\n if (adapterName === 'BgzipFastaAdapter') {\n return 'ReferenceSequenceTrack'\n }\n return trackTypeGuesser(adapterName)\n }\n },\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { useTheme } from '@mui/material'\nimport { observer } from 'mobx-react'\nimport { isAlive, isStateTreeNode } from 'mobx-state-tree'\nimport {\n measureText,\n getViewParams,\n Feature,\n Region,\n stripAlpha,\n} from '@jbrowse/core/util'\nimport { DisplayModel } from './util'\n\ninterface ViewParams {\n start: number\n end: number\n offsetPx: number\n offsetPx1: number\n}\n\nconst FeatureLabel = observer(function ({\n text,\n x,\n y,\n region,\n reversed,\n bpPerPx,\n exportSVG,\n feature,\n viewParams,\n color = 'black',\n fontHeight = 11,\n featureWidth = 0,\n allowedWidthExpansion = 0,\n displayModel = {},\n}: {\n text: string\n x: number\n y: number\n color?: string\n fontHeight?: number\n featureWidth?: number\n bpPerPx: number\n allowedWidthExpansion?: number\n feature: Feature\n reversed?: boolean\n displayModel?: DisplayModel\n exportSVG?: unknown\n region: Region\n viewParams: ViewParams\n}) {\n const totalWidth = featureWidth + allowedWidthExpansion\n const measuredTextWidth = measureText(text, fontHeight)\n const params =\n isStateTreeNode(displayModel) && isAlive(displayModel) && !exportSVG\n ? getViewParams(displayModel)\n : viewParams\n\n const viewLeft = reversed ? params.end : params.start\n\n const [labelVisible, setLabelVisible] = useState(exportSVG)\n const theme = useTheme()\n\n // we use an effect to set the label visible because there can be a\n // mismatch between the server and the client after hydration due to the\n // floating labels. if we are exporting an SVG we allow it as is though and\n // do not use the effect\n useEffect(() => {\n setLabelVisible(true)\n }, [])\n\n if (isStateTreeNode(region) && !isAlive(region)) {\n return null\n }\n\n const rstart = region.start\n const rend = region.end\n const fstart = feature.get('start')\n const fend = feature.get('end')\n\n const featureWidthBp = measuredTextWidth * bpPerPx\n\n // this tricky bit of code helps smooth over block boundaries\n // not supported for reverse mode currently\n // reason: reverse mode allocates space for the label in the \"normal\n // forward orientation\" making it hard to slide. The reverse mode should\n // allocate the label space in the reverse orientation to slide it\n if (\n viewLeft < rend &&\n viewLeft > rstart &&\n fstart < viewLeft &&\n viewLeft + featureWidthBp < fend\n ) {\n x = params.offsetPx\n } else if (\n fstart < viewLeft &&\n viewLeft + featureWidthBp < fend &&\n viewLeft + featureWidthBp > rstart &&\n viewLeft + featureWidthBp < rend\n ) {\n x = params.offsetPx1\n }\n\n return labelVisible ? (\n <text\n x={x}\n y={y + fontHeight}\n fill={color === '#f0f' ? stripAlpha(theme.palette.text.primary) : color}\n fontSize={fontHeight}\n >\n {measuredTextWidth > totalWidth\n ? `${text.slice(0, totalWidth / (fontHeight * 0.6))}...`\n : text}\n </text>\n ) : null\n})\n\nexport default FeatureLabel\n","import React from 'react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { Feature, Region } from '@jbrowse/core/util'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport { observer } from 'mobx-react'\n\n// locals\nimport type { DisplayModel } from './util'\nimport FeatureLabel from './FeatureLabel'\n\nconst FeatureGlyph = observer(function (props: {\n feature: Feature\n rootLayout: SceneGraph\n config: AnyConfigurationModel\n name: string\n description: string\n shouldShowName: boolean\n shouldShowDescription: boolean\n colorByCDS: boolean\n fontHeight: number\n allowedWidthExpansion: number\n exportSVG?: unknown\n displayModel?: DisplayModel\n selected?: boolean\n reversed?: boolean\n topLevel?: boolean\n region: Region\n viewParams: {\n end: number\n start: number\n offsetPx: number\n offsetPx1: number\n }\n bpPerPx: number\n}) {\n const {\n feature,\n rootLayout,\n config,\n name,\n description,\n shouldShowName,\n shouldShowDescription,\n } = props\n\n const featureLayout = rootLayout.getSubRecord(String(feature.id()))\n if (!featureLayout) {\n return null\n }\n const { GlyphComponent } = featureLayout.data || {}\n\n return (\n <g>\n <GlyphComponent featureLayout={featureLayout} {...props} />\n {shouldShowName ? (\n <FeatureLabel\n text={name}\n x={rootLayout.getSubRecord('nameLabel')?.absolute.left || 0}\n y={rootLayout.getSubRecord('nameLabel')?.absolute.top || 0}\n color={readConfObject(config, ['labels', 'nameColor'], { feature })}\n featureWidth={featureLayout.width}\n {...props}\n />\n ) : null}\n {shouldShowDescription ? (\n <FeatureLabel\n text={description}\n x={rootLayout.getSubRecord('descriptionLabel')?.absolute.left || 0}\n y={rootLayout.getSubRecord('descriptionLabel')?.absolute.top || 0}\n color={readConfObject(config, ['labels', 'descriptionColor'], {\n feature,\n })}\n featureWidth={featureLayout.width}\n {...props}\n />\n ) : null}\n </g>\n )\n})\n\nexport default FeatureGlyph\n","import React, { useEffect, useState } from 'react'\nimport { bpSpanPx, Feature, Region } from '@jbrowse/core/util'\nimport { observer } from 'mobx-react'\n\ntype LayoutRecord = [number, number, number, number]\n\ninterface OverlayRectProps extends React.SVGProps<SVGRectElement> {\n rect?: LayoutRecord\n region: Region\n bpPerPx: number\n}\n\nfunction OverlayRect({\n rect,\n region,\n bpPerPx,\n ...rectProps\n}: OverlayRectProps) {\n if (!rect) {\n return null\n }\n const [leftBp, topPx, rightBp, bottomPx] = rect\n const [leftPx, rightPx] = bpSpanPx(leftBp, rightBp, region, bpPerPx)\n const rectTop = Math.round(topPx)\n const screenWidth = (region.end - region.start) / bpPerPx\n const rectHeight = Math.round(bottomPx - topPx)\n const width = rightPx - leftPx\n\n if (leftPx + width < 0) {\n return null\n }\n const leftWithinBlock = Math.max(leftPx, 0)\n const diff = leftWithinBlock - leftPx\n const widthWithinBlock = Math.max(1, Math.min(width - diff, screenWidth))\n\n return (\n <rect\n x={leftWithinBlock - 2}\n y={rectTop - 2}\n width={widthWithinBlock + 4}\n height={rectHeight + 4}\n {...rectProps}\n />\n )\n}\n\ntype ME = React.MouseEvent<SVGRectElement>\ntype MEFE = ME | React.FocusEvent<SVGRectElement>\n\nconst SvgOverlay = observer(function ({\n displayModel = {},\n blockKey,\n region,\n bpPerPx,\n movedDuringLastMouseDown,\n ...handlers\n}: {\n region: Region\n displayModel?: {\n getFeatureByID?: (arg0: string, arg1: string) => LayoutRecord\n selectedFeatureId?: string\n featureIdUnderMouse?: string\n contextMenuFeature?: Feature\n }\n bpPerPx: number\n blockKey: string\n movedDuringLastMouseDown?: boolean\n onFeatureMouseDown?(event: ME, featureId: string): void\n onFeatureMouseEnter?(event: ME, featureId: string): void\n onFeatureMouseOut?(event: MEFE, featureId: string): void\n onFeatureMouseOver?(event: MEFE, featureId: string): void\n onFeatureMouseUp?(event: ME, featureId: string): void\n onFeatureMouseLeave?(event: ME, featureId: string): void\n onFeatureMouseMove?(event: ME, featureId: string): void\n // synthesized from mouseup and mousedown\n onFeatureClick?(event: ME, featureId: string): void\n onFeatureContextMenu?(event: ME, featureId: string): void\n}) {\n const { selectedFeatureId, featureIdUnderMouse, contextMenuFeature } =\n displayModel\n\n const mouseoverFeatureId = featureIdUnderMouse || contextMenuFeature?.id()\n const [renderOverlay, setRenderOverlay] = useState(false)\n useEffect(() => {\n setRenderOverlay(true)\n }, [])\n\n function onFeatureMouseDown(event: ME) {\n const { onFeatureMouseDown: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseEnter(event: ME) {\n const { onFeatureMouseEnter: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseOut(event: ME | React.FocusEvent<SVGRectElement>) {\n const { onFeatureMouseOut: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseOver(event: ME | React.FocusEvent<SVGRectElement>) {\n const { onFeatureMouseOver: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseUp(event: ME) {\n const { onFeatureMouseUp: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseLeave(event: ME) {\n const { onFeatureMouseLeave: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureMouseMove(event: ME) {\n const { onFeatureMouseMove: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureClick(event: ME) {\n if (movedDuringLastMouseDown) {\n return undefined\n }\n const { onFeatureClick: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n event.stopPropagation()\n handler(event, mouseoverFeatureId)\n }\n\n function onFeatureContextMenu(event: ME) {\n const { onFeatureContextMenu: handler } = handlers\n if (!(handler && mouseoverFeatureId)) {\n return undefined\n }\n handler(event, mouseoverFeatureId)\n }\n\n return renderOverlay ? (\n <>\n {mouseoverFeatureId ? (\n <OverlayRect\n rect={displayModel.getFeatureByID?.(blockKey, mouseoverFeatureId)}\n region={region}\n bpPerPx={bpPerPx}\n fill=\"#000\"\n fillOpacity=\"0.2\"\n onMouseDown={onFeatureMouseDown}\n onMouseEnter={onFeatureMouseEnter}\n onMouseOut={onFeatureMouseOut}\n onMouseOver={onFeatureMouseOver}\n onMouseUp={onFeatureMouseUp}\n onMouseLeave={onFeatureMouseLeave}\n onMouseMove={onFeatureMouseMove}\n onClick={onFeatureClick}\n onContextMenu={onFeatureContextMenu}\n onFocus={onFeatureMouseOver}\n onBlur={onFeatureMouseOut}\n data-testid={mouseoverFeatureId}\n />\n ) : null}\n {selectedFeatureId ? (\n <OverlayRect\n rect={displayModel.getFeatureByID?.(blockKey, selectedFeatureId)}\n region={region}\n bpPerPx={bpPerPx}\n stroke=\"#00b8ff\"\n fill=\"none\"\n />\n ) : null}\n </>\n ) : null\n})\n\nexport default SvgOverlay\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport { Region, Feature, stripAlpha } from '@jbrowse/core/util'\nimport { useTheme } from '@mui/material'\n\nconst Arrow = observer(function Arrow({\n feature,\n featureLayout,\n config,\n region,\n}: {\n region: Region\n feature: Feature\n featureLayout: SceneGraph\n config: AnyConfigurationModel\n}) {\n const strand = feature.get('strand')\n const size = 5\n const reverseFlip = region.reversed ? -1 : 1\n const offset = 7 * strand * reverseFlip\n const { left = 0, top = 0, width = 0, height = 0 } = featureLayout.absolute\n\n const c = readConfObject(config, 'color2', { feature })\n const theme = useTheme()\n const color2 = c === '#f0f' ? stripAlpha(theme.palette.text.secondary) : c\n const p =\n strand * reverseFlip === -1\n ? left\n : strand * reverseFlip === 1\n ? left + width\n : null\n const y = top + height / 2\n\n return p ? (\n <>\n <line x1={p} x2={p + offset} y1={y} y2={y} stroke={color2} />\n <polygon\n points={[\n [p + offset / 2, y - size / 2],\n [p + offset / 2, y + size / 2],\n [p + offset, y],\n ].toString()}\n stroke={color2}\n fill={color2}\n />\n </>\n ) : null\n})\n\nexport default Arrow\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { Region, Feature, getFrame } from '@jbrowse/core/util'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport { useTheme } from '@mui/material'\n\n// locals\nimport { isUTR } from './util'\nimport Arrow from './Arrow'\n\nconst utrHeightFraction = 0.65\n\nconst Box = observer(function Box(props: {\n feature: Feature\n region: Region\n config: AnyConfigurationModel\n featureLayout: SceneGraph\n bpPerPx: number\n selected?: boolean\n topLevel?: boolean\n colorByCDS: boolean\n}) {\n const theme = useTheme()\n const {\n colorByCDS,\n feature,\n region,\n config,\n featureLayout,\n bpPerPx,\n topLevel,\n } = props\n const { start, end } = region\n const screenWidth = (end - start) / bpPerPx\n const featureStart = feature.get('start')\n const featureEnd = feature.get('end')\n const featureType: string | undefined = feature.get('type')\n const featureStrand: -1 | 1 | undefined = feature.get('strand')\n const featurePhase: 0 | 1 | 2 | undefined = feature.get('phase')\n const width = (featureEnd - featureStart) / bpPerPx\n const { left = 0 } = featureLayout.absolute\n let { top = 0, height = 0 } = featureLayout.absolute\n\n if (left + width < 0) {\n return null\n }\n\n if (isUTR(feature)) {\n top += ((1 - utrHeightFraction) / 2) * height\n height *= utrHeightFraction\n }\n const leftWithinBlock = Math.max(left, 0)\n const diff = leftWithinBlock - left\n const widthWithinBlock = Math.max(2, Math.min(width - diff, screenWidth))\n\n let fill: string = isUTR(feature)\n ? readConfObject(config, 'color3', { feature })\n : readConfObject(config, 'color1', { feature })\n if (\n colorByCDS &&\n featureType === 'CDS' &&\n featureStrand !== undefined &&\n featurePhase !== undefined\n ) {\n const frame = getFrame(\n featureStart,\n featureEnd,\n featureStrand,\n featurePhase,\n )\n const frameColor = theme.palette.framesCDS.at(frame)?.main\n if (frameColor) {\n fill = frameColor\n }\n }\n\n // if feature has parent and type is intron, then don't render the intron\n // subfeature (if it doesn't have a parent, then maybe the introns are\n // separately displayed features that should be displayed)\n return feature.parent() && featureType === 'intron' ? null : (\n <>\n {topLevel ? <Arrow {...props} /> : null}\n <rect\n data-testid={`box-${feature.id()}`}\n x={leftWithinBlock}\n y={top}\n width={widthWithinBlock}\n height={height}\n fill={fill}\n stroke={readConfObject(config, 'outline', { feature }) as string}\n />\n </>\n )\n})\n\nexport default Box\n","import React from 'react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { observer } from 'mobx-react'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport { Region, Feature, stripAlpha } from '@jbrowse/core/util'\nimport { useTheme } from '@mui/material'\n\n// locals\nimport Arrow from './Arrow'\n\nconst Segments = observer(function Segments(props: {\n region: Region\n feature: Feature\n featureLayout: SceneGraph\n config: AnyConfigurationModel\n selected?: boolean\n reversed?: boolean\n subfeatures?: Feature[]\n children?: React.ReactNode\n}) {\n const {\n feature,\n featureLayout,\n selected,\n config,\n // some subfeatures may be computed e.g. makeUTRs,\n // so these are passed as a prop, or feature.get('subfeatures') by default\n subfeatures = feature.get('subfeatures'),\n } = props\n\n const theme = useTheme()\n const c = readConfObject(config, 'color2', { feature })\n const color2 = c === '#f0f' ? stripAlpha(theme.palette.text.secondary) : c\n\n const { left = 0, top = 0, width = 0, height = 0 } = featureLayout.absolute\n\n const y = top + height / 2\n return (\n <>\n <line\n data-testid={feature.id()}\n x1={left}\n y1={y}\n y2={y}\n x2={left + width}\n stroke={color2}\n />\n {subfeatures?.map(subfeature => {\n const subfeatureId = String(subfeature.id())\n const subfeatureLayout = featureLayout.getSubRecord(subfeatureId)\n // This subfeature got filtered out\n if (!subfeatureLayout) {\n return null\n }\n const { GlyphComponent } = subfeatureLayout.data || {}\n return (\n <GlyphComponent\n key={`glyph-${subfeatureId}`}\n {...props}\n feature={subfeature}\n topLevel={false}\n featureLayout={subfeatureLayout}\n selected={selected}\n />\n )\n })}\n <Arrow {...props} />\n </>\n )\n})\n\nexport default Segments\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\n\nimport Segments from './Segments'\nimport { ExtraGlyphValidator, layOutFeature, layOutSubfeatures } from './util'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport { Region, Feature, SimpleFeature } from '@jbrowse/core/util'\n\n// returns a callback that will filter features features according to the\n// subParts conf var\nfunction makeSubpartsFilter(\n confKey: string | string[],\n config: AnyConfigurationModel,\n) {\n const filter = readConfObject(config, confKey) as string[] | string\n const ret = typeof filter === 'string' ? filter.split(/\\s*,\\s*/) : filter\n\n return (feature: Feature) =>\n ret\n .map(typeName => typeName.toLowerCase())\n .includes(feature.get('type').toLowerCase())\n}\n\nfunction filterSubpart(feature: Feature, config: AnyConfigurationModel) {\n return makeSubpartsFilter('subParts', config)(feature)\n}\n\nfunction isUTR(feature: Feature) {\n return /(\\bUTR|_UTR|untranslated[_\\s]region)\\b/.test(\n feature.get('type') || '',\n )\n}\n\nfunction makeUTRs(parent: Feature, subs: Feature[]) {\n // based on Lincoln's UTR-making code in\n // Bio::Graphics::Glyph::processed_transcript\n const subparts = [...subs]\n\n let codeStart = Number.POSITIVE_INFINITY\n let codeEnd = Number.NEGATIVE_INFINITY\n\n let haveLeftUTR: boolean | undefined\n let haveRightUTR: boolean | undefined\n\n // gather exons, find coding start and end, and look for UTRs\n const exons = []\n for (const subpart of subparts) {\n const type = subpart.get('type')\n if (/^cds/i.test(type)) {\n if (codeStart > subpart.get('start')) {\n codeStart = subpart.get('start')\n }\n if (codeEnd < subpart.get('end')) {\n codeEnd = subpart.get('end')\n }\n } else if (/exon/i.test(type)) {\n exons.push(subpart)\n } else if (isUTR(subpart)) {\n haveLeftUTR = subpart.get('start') === parent.get('start')\n haveRightUTR = subpart.get('end') === parent.get('end')\n }\n }\n\n // bail if we don't have exons and CDS\n if (\n !(\n exons.length &&\n codeStart < Number.POSITIVE_INFINITY &&\n codeEnd > Number.NEGATIVE_INFINITY\n )\n ) {\n return subparts\n }\n\n // make sure the exons are sorted by coord\n exons.sort((a, b) => a.get('start') - b.get('start'))\n\n const strand = parent.get('strand')\n\n // make the left-hand UTRs\n let start: number | undefined\n let end: number | undefined\n if (!haveLeftUTR) {\n for (let i = 0; i < exons.length; i++) {\n start = exons[i]!.get('start')\n if (start >= codeStart) {\n break\n }\n end = codeStart > exons[i]!.get('end') ? exons[i]!.get('end') : codeStart\n const type = strand >= 0 ? 'five_prime_UTR' : 'three_prime_UTR'\n subparts.unshift(\n new SimpleFeature({\n parent,\n id: `${parent.id()}_${type}_${i}`,\n data: { start, end, strand, type },\n }),\n )\n }\n }\n\n // make the right-hand UTRs\n if (!haveRightUTR) {\n for (let i = exons.length - 1; i >= 0; i--) {\n end = exons[i]!.get('end')\n if (end <= codeEnd) {\n break\n }\n\n start =\n codeEnd < exons[i]!.get('start') ? exons[i]!.get('start') : codeEnd\n const type = strand >= 0 ? 'three_prime_UTR' : 'five_prime_UTR'\n subparts.push(\n new SimpleFeature({\n parent,\n id: `${parent.id()}_${type}_${i}`,\n data: { start, end, strand, type },\n }),\n )\n }\n }\n\n return subparts\n}\n\nfunction getSubparts(f: Feature, config: AnyConfigurationModel) {\n let c = f.get('subfeatures')\n if (!c || c.length === 0) {\n return []\n }\n const hasUTRs = c.some(child => isUTR(child))\n const isTranscript = ['mRNA', 'transcript'].includes(f.get('type'))\n const impliedUTRs = !hasUTRs && isTranscript\n\n // if we think we should use impliedUTRs, or it is specifically in the\n // config, then makeUTRs\n if (impliedUTRs || readConfObject(config, 'impliedUTRs')) {\n c = makeUTRs(f, c)\n }\n\n return c.filter(element => filterSubpart(element, config))\n}\n\nconst ProcessedTranscript = observer(function ProcessedTranscript(props: {\n feature: Feature\n region: Region\n config: AnyConfigurationModel\n featureLayout: SceneGraph\n selected?: boolean\n reversed?: boolean\n [key: string]: unknown\n}) {\n const { feature, config } = props\n const subfeatures = getSubparts(feature, config)\n\n // we manually compute some subfeatures, so pass these separately\n return <Segments {...props} subfeatures={subfeatures} />\n})\n\n// @ts-expect-error\nProcessedTranscript.layOut = ({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n}: {\n layout: SceneGraph\n feature: Feature\n bpPerPx: number\n reversed: boolean\n config: AnyConfigurationModel\n extraGlyphs: ExtraGlyphValidator[]\n}) => {\n const subLayout = layOutFeature({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n const subfeatures = getSubparts(feature, config)\n layOutSubfeatures({\n layout: subLayout,\n subfeatures,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n return subLayout\n}\n\nexport default ProcessedTranscript\n","import React from 'react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { observer } from 'mobx-react'\nimport { Feature } from '@jbrowse/core/util/simpleFeature'\nimport { SceneGraph } from '@jbrowse/core/util/layouts'\nimport {\n chooseGlyphComponent,\n ExtraGlyphValidator,\n layOut,\n layOutFeature,\n} from './util'\n\nconst Subfeatures = observer(function Subfeatures(props: {\n feature: Feature\n featureLayout: SceneGraph\n selected?: boolean\n}) {\n const { feature, featureLayout, selected } = props\n\n return feature.get('subfeatures')?.map(subfeature => {\n const subfeatureId = String(subfeature.id())\n const subfeatureLayout = featureLayout.getSubRecord(subfeatureId)\n if (!subfeatureLayout) {\n return null\n }\n const { GlyphComponent } = subfeatureLayout.data || {}\n return (\n <GlyphComponent\n key={`glyph-${subfeatureId}`}\n {...props}\n feature={subfeature}\n featureLayout={subfeatureLayout}\n selected={selected}\n />\n )\n })\n})\n\n// @ts-expect-error\nSubfeatures.layOut = ({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n}: {\n layout: SceneGraph\n feature: Feature\n bpPerPx: number\n reversed: boolean\n config: AnyConfigurationModel\n extraGlyphs: ExtraGlyphValidator[]\n}) => {\n const subLayout = layOutFeature({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n const displayMode = readConfObject(config, 'displayMode')\n if (displayMode !== 'reducedRepresentation') {\n let topOffset = 0\n feature.get('subfeatures')?.forEach(subfeature => {\n const SubfeatureGlyphComponent = chooseGlyphComponent(\n subfeature,\n extraGlyphs,\n )\n const subfeatureHeight = readConfObject(config, 'height', {\n feature: subfeature,\n }) as number\n\n const subSubLayout = (SubfeatureGlyphComponent.layOut || layOut)({\n layout: subLayout,\n feature: subfeature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n subSubLayout.move(0, topOffset)\n topOffset +=\n displayMode === 'collapse'\n ? 0\n : (displayMode === 'compact'\n ? subfeatureHeight / 3\n : subfeatureHeight) + 2\n })\n }\n return subLayout\n}\n\nexport default Subfeatures\n","import React from 'react'\nimport {\n readConfObject,\n AnyConfigurationModel,\n} from '@jbrowse/core/configuration'\nimport SceneGraph from '@jbrowse/core/util/layouts/SceneGraph'\nimport { Feature, Region } from '@jbrowse/core/util'\n\n// locals\nimport Box from './Box'\nimport ProcessedTranscript from './ProcessedTranscript'\nimport Segments from './Segments'\nimport Subfeatures from './Subfeatures'\n\nexport interface Glyph\n extends React.FC<{\n colorByCDS: boolean\n feature: Feature\n featureLayout: SceneGraph\n selected?: boolean\n config: AnyConfigurationModel\n region: Region\n bpPerPx: number\n topLevel?: boolean\n [key: string]: unknown\n }> {\n layOut?: (arg: FeatureLayOutArgs) => SceneGraph\n}\n\ntype LayoutRecord = [number, number, number, number]\n\nexport interface DisplayModel {\n getFeatureByID?: (arg0: string, arg1: string) => LayoutRecord\n getFeatureOverlapping?: (\n blockKey: string,\n bp: number,\n y: number,\n ) => string | undefined\n selectedFeatureId?: string\n featureIdUnderMouse?: string\n contextMenuFeature?: Feature\n}\n\nexport interface ExtraGlyphValidator {\n glyph: Glyph\n validator: (feature: Feature) => boolean\n}\n\nexport function chooseGlyphComponent(\n feature: Feature,\n extraGlyphs?: ExtraGlyphValidator[],\n): Glyph {\n const type = feature.get('type')\n const subfeatures = feature.get('subfeatures')\n\n if (subfeatures?.length && type !== 'CDS') {\n const hasSubSub = subfeatures.find(sub => !!sub.get('subfeatures'))\n if (\n ['mRNA', 'transcript', 'primary_transcript'].includes(type) &&\n subfeatures.some(f => f.get('type') === 'CDS')\n ) {\n return ProcessedTranscript\n }\n if (!feature.parent() && hasSubSub) {\n // only do sub-sub on parent level features like gene\n return Subfeatures\n }\n return Segments\n }\n\n return extraGlyphs?.find(f => f.validator(feature))?.glyph || Box\n}\n\ninterface BaseLayOutArgs {\n layout: SceneGraph\n bpPerPx: number\n reversed?: boolean\n config: AnyConfigurationModel\n}\n\ninterface FeatureLayOutArgs extends BaseLayOutArgs {\n feature: Feature\n extraGlyphs?: ExtraGlyphValidator[]\n}\n\ninterface SubfeatureLayOutArgs extends BaseLayOutArgs {\n subfeatures: Feature[]\n extraGlyphs?: ExtraGlyphValidator[]\n}\n\nexport function layOut({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n}: FeatureLayOutArgs): SceneGraph {\n const displayMode = readConfObject(config, 'displayMode')\n const subLayout = layOutFeature({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n if (displayMode !== 'reducedRepresentation') {\n layOutSubfeatures({\n layout: subLayout,\n subfeatures: feature.get('subfeatures') || [],\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n }\n return subLayout\n}\n\nexport function layOutFeature(args: FeatureLayOutArgs) {\n const { layout, feature, bpPerPx, reversed, config, extraGlyphs } = args\n const displayMode = readConfObject(config, 'displayMode') as string\n const GlyphComponent =\n displayMode === 'reducedRepresentation'\n ? Box\n : chooseGlyphComponent(feature, extraGlyphs)\n const parentFeature = feature.parent()\n let x = 0\n if (parentFeature) {\n x =\n (reversed\n ? parentFeature.get('end') - feature.get('end')\n : feature.get('start') - parentFeature.get('start')) / bpPerPx\n }\n const height = readConfObject(config, 'height', { feature }) as number\n const width = (feature.get('end') - feature.get('start')) / bpPerPx\n const layoutParent = layout.parent\n const top = layoutParent ? layoutParent.top : 0\n return layout.addChild(\n String(feature.id()),\n x,\n displayMode === 'collapse' ? 0 : top,\n Math.max(width, 1), // has to be at least one to register in the layout\n displayMode === 'compact' ? height / 2 : height,\n { GlyphComponent },\n )\n}\n\nexport function layOutSubfeatures(args: SubfeatureLayOutArgs) {\n const { layout, subfeatures, bpPerPx, reversed, config, extraGlyphs } = args\n subfeatures.forEach(feature => {\n ;(chooseGlyphComponent(feature, extraGlyphs).layOut || layOut)({\n layout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n })\n}\n\nexport function isUTR(feature: Feature) {\n return /(\\bUTR|_UTR|untranslated[_\\s]region)\\b/.test(\n feature.get('type') || '',\n )\n}\n","import React, { useEffect, useRef, useState, useCallback } from 'react'\nimport { observer } from 'mobx-react'\nimport {\n AnyConfigurationModel,\n readConfObject,\n} from '@jbrowse/core/configuration'\nimport { bpToPx, measureText, Region, Feature } from '@jbrowse/core/util'\nimport { BaseLayout, SceneGraph } from '@jbrowse/core/util/layouts'\n\n// locals\nimport FeatureGlyph from './FeatureGlyph'\nimport SvgOverlay from './SvgOverlay'\nimport {\n chooseGlyphComponent,\n layOut,\n ExtraGlyphValidator,\n DisplayModel,\n} from './util'\n\n// used to make features have a little padding for their labels\nconst xPadding = 3\nconst yPadding = 5\n\n// used so that user can click-away-from-feature below the laid out features\n// (issue #1248)\nconst svgHeightPadding = 100\n\nfunction RenderedFeatureGlyph(props: {\n feature: Feature\n bpPerPx: number\n region: Region\n config: AnyConfigurationModel\n colorByCDS: boolean\n layout: BaseLayout<unknown>\n extraGlyphs?: ExtraGlyphValidator[]\n displayMode: string\n exportSVG?: unknown\n displayModel?: DisplayModel\n detectRerender?: () => void\n viewParams: {\n start: number\n end: number\n offsetPx: number\n offsetPx1: number\n }\n [key: string]: unknown\n}) {\n const {\n feature,\n detectRerender,\n bpPerPx,\n region,\n config,\n displayMode,\n layout,\n extraGlyphs,\n } = props\n\n // used for unit testing, difficult to mock out so it is in actual source code\n detectRerender?.()\n\n const { reversed } = region\n const start = feature.get(reversed ? 'end' : 'start')\n const startPx = bpToPx(start, region, bpPerPx)\n const labelAllowed = displayMode !== 'collapsed'\n\n const rootLayout = new SceneGraph('root', 0, 0, 0, 0)\n const GlyphComponent = chooseGlyphComponent(feature, extraGlyphs)\n const featureLayout = (GlyphComponent.layOut || layOut)({\n layout: rootLayout,\n feature,\n bpPerPx,\n reversed,\n config,\n extraGlyphs,\n })\n let shouldShowName = false\n let shouldShowDescription = false\n let name = ''\n let description = ''\n let fontHeight = 0\n let expansion = 0\n if (labelAllowed) {\n const showLabels = readConfObject(config, 'showLabels')\n const showDescriptions = readConfObject(config, 'showDescriptions')\n fontHeight = readConfObject(config, ['labels', 'fontSize'], { feature })\n expansion = readConfObject(config, 'maxFeatureGlyphExpansion') || 0\n name = String(readConfObject(config, ['labels', 'name'], { feature }) || '')\n shouldShowName = /\\S/.test(name) && showLabels\n\n const getWidth = (text: string) => {\n const glyphWidth = rootLayout.width + expansion\n const textWidth = measureText(text, fontHeight)\n return Math.round(Math.min(textWidth, glyphWidth))\n }\n\n description = String(\n readConfObject(config, ['labels', 'description'], { feature }) || '',\n )\n shouldShowDescription = /\\S/.test(description) && showDescriptions\n\n if (shouldShowName) {\n rootLayout.addChild(\n 'nameLabel',\n 0,\n featureLayout.bottom,\n getWidth(name),\n fontHeight,\n )\n }\n\n if (shouldShowDescription) {\n const aboveLayout = shouldShowName\n ? rootLayout.getSubRecord('nameLabel')\n : featureLayout\n if (!aboveLayout) {\n throw new Error('failed to layout nameLabel')\n }\n\n rootLayout.addChild(\n 'descriptionLabel',\n 0,\n aboveLayout.bottom,\n getWidth(description),\n fontHeight,\n )\n }\n }\n\n const topPx = layout.addRect(\n feature.id(),\n feature.get('start'),\n feature.get('start') + rootLayout.width * bpPerPx + xPadding * bpPerPx,\n rootLayout.height + yPadding,\n )\n if (topPx === null) {\n return null\n }\n rootLayout.move(startPx, topPx)\n\n return (\n <FeatureGlyph\n rootLayout={rootLayout}\n name={name}\n shouldShowName={shouldShowName}\n description={description}\n shouldShowDescription={shouldShowDescription}\n fontHeight={fontHeight}\n allowedWidthExpansion={expansion}\n reversed={region.reversed}\n topLevel={true}\n {...props}\n />\n )\n}\n\nconst RenderedFeatures = observer(function RenderedFeatures(props: {\n features?: Map<string, Feature>\n isFeatureDisplayed?: (f: Feature) => boolean\n bpPerPx: number\n config: AnyConfigurationModel\n displayMode: string\n colorByCDS: boolean\n displayModel?: DisplayModel\n region: Region\n exportSVG?: unknown\n extraGlyphs?: ExtraGlyphValidator[]\n layout: BaseLayout<unknown>\n viewParams: {\n start: number\n end: number\n offsetPx: number\n offsetPx1: number\n }\n [key: string]: unknown\n}) {\n const { features = new Map(), isFeatureDisplayed } = props\n return (\n <>\n {[...features.values()]\n .filter(feature =>\n isFeatureDisplayed ? isFeatureDisplayed(feature) : true,\n )\n .map(feature => (\n <RenderedFeatureGlyph\n key={feature.id()}\n feature={feature}\n {...props}\n />\n ))}\n </>\n )\n})\n\nconst SvgFeatureRendering = observer(function SvgFeatureRendering(props: {\n layout: BaseLayout<unknown>\n blockKey: string\n regions: Region[]\n bpPerPx: number\n detectRerender?: () => void\n config: AnyConfigurationModel\n colorByCDS: boolean\n features: Map<string, Feature>\n displayModel?: DisplayModel\n exportSVG?: boolean\n viewParams: {\n start: number\n end: number\n offsetPx: number\n offsetPx1: number\n }\n featureDisplayHandler?: (f: Feature) => boolean\n extraGlyphs?: ExtraGlyphValidator[]\n onMouseOut?: React.MouseEventHandler\n onMouseDown?: React.MouseEventHandler\n onMouseLeave?: React.MouseEventHandler\n onMouseEnter?: React.MouseEventHandler\n onMouseOver?: React.MouseEventHandler\n onMouseMove?: (event: React.MouseEvent, featureId?: string) => void\n onMouseUp?: React.MouseEventHandler\n onClick?: React.MouseEventHandler\n}) {\n const {\n layout,\n blockKey,\n regions = [],\n bpPerPx,\n config,\n displayModel = {},\n exportSVG,\n featureDisplayHandler,\n onMouseOut,\n onMouseDown,\n onMouseLeave,\n onMouseEnter,\n onMouseOver,\n onMouseMove,\n onMouseUp,\n onClick,\n } = props\n\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n const displayMode = readConfObject(config, 'displayMode') as string\n const maxConfHeight = readConfObject(config, 'maxHeight') as number\n\n const ref = useRef<SVGSVGElement>(null)\n const [mouseIsDown, setMouseIsDown] = useState(false)\n const [height, setHeight] = useState(maxConfHeight)\n const [movedDuringLastMouseDown, setMovedDuringLastMouseDown] =\n useState(false)\n\n const mouseDown = useCallback(\n (event: React.MouseEvent) => {\n setMouseIsDown(true)\n setMovedDuringLastMouseDown(false)\n return onMouseDown?.(event)\n },\n [onMouseDown],\n )\n\n const mouseUp = useCallback(\n (event: React.MouseEvent) => {\n setMouseIsDown(false)\n return onMouseUp?.(event)\n },\n [onMouseUp],\n )\n\n const mouseMove = useCallback(\n (event: React.MouseEvent) => {\n if (!ref.current) {\n return\n }\n if (mouseIsDown) {\n setMovedDuringLastMouseDown(true)\n }\n const { left, top } = ref.current.getBoundingClientRect()\n const offsetX = event.clientX - left\n const offsetY = event.clientY - top\n const px = region.reversed ? width - offsetX : offsetX\n const clientBp = region.start + bpPerPx * px\n\n const featureIdCurrentlyUnderMouse = displayModel.getFeatureOverlapping?.(\n blockKey,\n clientBp,\n offsetY,\n )\n\n if (onMouseMove) {\n onMouseMove(event, featureIdCurrentlyUnderMouse)\n }\n },\n [\n blockKey,\n bpPerPx,\n mouseIsDown,\n onMouseMove,\n region.reversed,\n region.start,\n displayModel,\n width,\n ],\n )\n\n const click = useCallback(\n (event: React.MouseEvent) => {\n // don't select a feature if we are clicking and dragging\n if (movedDuringLastMouseDown) {\n return\n }\n onClick?.(event)\n },\n [movedDuringLastMouseDown, onClick],\n )\n\n useEffect(() => {\n setHeight(layout.getTotalHeight())\n }, [layout])\n\n return exportSVG ? (\n <RenderedFeatures\n displayMode={displayMode}\n isFeatureDisplayed={featureDisplayHandler}\n region={region}\n {...props}\n />\n ) : (\n <svg\n ref={ref}\n data-testid=\"svgfeatures\"\n width={width}\n height={height + svgHeightPadding}\n style={{\n // use block because svg by default is inline, which adds a margin\n display: 'block',\n }}\n onMouseDown={mouseDown}\n onMouseUp={mouseUp}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseOver={onMouseOver}\n onMouseOut={onMouseOut}\n onMouseMove={mouseMove}\n onClick={click}\n >\n <RenderedFeatures\n displayMode={displayMode}\n region={region}\n movedDuringLastMouseDown={movedDuringLastMouseDown}\n isFeatureDisplayed={featureDisplayHandler}\n {...props}\n />\n\n <SvgOverlay\n {...props}\n region={region}\n movedDuringLastMouseDown={movedDuringLastMouseDown}\n />\n </svg>\n )\n})\n\nexport default SvgFeatureRendering\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { types } from 'mobx-state-tree'\n\n/**\n * #config SvgFeatureRenderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst SvgFeatureRenderer = ConfigurationSchema(\n 'SvgFeatureRenderer',\n {\n /**\n * #slot\n */\n color1: {\n type: 'color',\n description: 'the main color of each feature',\n defaultValue: 'goldenrod',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n color2: {\n type: 'color',\n description:\n 'the secondary color of each feature, used for connecting lines, etc',\n defaultValue: '#f0f',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n color3: {\n type: 'color',\n description:\n 'the tertiary color of each feature, often used for contrasting fills, like on UTRs',\n defaultValue: '#357089',\n contextVariable: ['feature'],\n },\n\n /**\n * #slot\n */\n outline: {\n type: 'color',\n description: 'the outline for features',\n defaultValue: '',\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n height: {\n type: 'number',\n description: 'height in pixels of the main body of each feature',\n defaultValue: 10,\n contextVariable: ['feature'],\n },\n /**\n * #slot\n */\n showLabels: {\n type: 'boolean',\n defaultValue: true,\n },\n\n /**\n * #slot\n */\n showDescriptions: {\n type: 'boolean',\n defaultValue: true,\n },\n\n labels: ConfigurationSchema('SvgFeatureLabels', {\n /**\n * #slot labels.name\n */\n name: {\n type: 'string',\n description:\n 'the primary name of the feature to show, if space is available',\n defaultValue: `jexl:get(feature,'name') || get(feature,'id')`,\n contextVariable: ['feature'],\n },\n /**\n * #slot labels.nameColor\n */\n nameColor: {\n type: 'color',\n description: 'the color of the name label, if shown',\n defaultValue: '#f0f',\n contextVariable: ['feature'],\n },\n /**\n * #slot labels.description\n */\n description: {\n type: 'string',\n description: 'the text description to show, if space is available',\n defaultValue: `jexl:get(feature,'note') || get(feature,'description')`,\n contextVariable: ['feature'],\n },\n /**\n * #slot labels.descriptionColor\n */\n descriptionColor: {\n type: 'color',\n description: 'the color of the description, if shown',\n defaultValue: 'blue',\n contextVariable: ['feature'],\n },\n\n /**\n * #slot labels.fontSize\n */\n fontSize: {\n type: 'number',\n description:\n 'height in pixels of the text to use for names and descriptions',\n defaultValue: 12,\n contextVariable: ['feature'],\n },\n }),\n\n /**\n * #slot\n */\n displayMode: {\n type: 'stringEnum',\n model: types.enumeration('displayMode', [\n 'normal',\n 'compact',\n 'reducedRepresentation',\n 'collapse',\n ]),\n description: 'Alternative display modes',\n defaultValue: 'normal',\n },\n\n /**\n * #slot\n */\n maxFeatureGlyphExpansion: {\n type: 'number',\n description:\n \"maximum number of pixels on each side of a feature's bounding coordinates that a glyph is allowed to use\",\n defaultValue: 500,\n },\n\n /**\n * #slot\n */\n maxHeight: {\n type: 'integer',\n description: 'the maximum height to be used in a svg rendering',\n defaultValue: 1200,\n },\n\n /**\n * #slot\n */\n subParts: {\n type: 'string',\n description: 'subparts for a glyph',\n defaultValue: 'CDS,UTR,five_prime_UTR,three_prime_UTR',\n },\n\n /**\n * #slot\n */\n impliedUTRs: {\n type: 'boolean',\n description: 'imply UTR from the exon and CDS differences',\n defaultValue: false,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default SvgFeatureRenderer\n","import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport {\n configSchema as svgFeatureRendererConfigSchema,\n ReactComponent as SvgFeatureRendererReactComponent,\n} from './SvgFeatureRenderer'\n\nclass SvgFeatureRenderer extends BoxRendererType {\n supportsSVG = true\n}\n\nexport default class SVGPlugin extends Plugin {\n name = 'SVGPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new SvgFeatureRenderer({\n name: 'SvgFeatureRenderer',\n ReactComponent: SvgFeatureRendererReactComponent,\n configSchema: svgFeatureRendererConfigSchema,\n pluginManager,\n }),\n )\n }\n}\n\nexport {\n configSchema as svgFeatureRendererConfigSchema,\n ReactComponent as SvgFeatureRendererReactComponent,\n} from './SvgFeatureRenderer'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config GCContentAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst GCContentAdapterF = (_pluginManager: PluginManager) => {\n return ConfigurationSchema(\n 'GCContentAdapter',\n {\n /**\n * #slot\n */\n sequenceAdapter: {\n type: 'frozen',\n defaultValue: null,\n },\n /**\n * #slot\n */\n windowSize: {\n type: 'number',\n defaultValue: 100,\n },\n /**\n * #slot\n */\n windowDelta: {\n type: 'number',\n defaultValue: 100,\n },\n },\n { explicitlyTyped: true },\n )\n}\n\nexport default GCContentAdapterF\n","import {\n getConf,\n AnyConfigurationSchemaType,\n} from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getSession } from '@jbrowse/core/util'\nimport { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle'\nimport { types } from 'mobx-state-tree'\nimport { lazy } from 'react'\n\nconst EditGCContentParamsDialog = lazy(\n () => import('./components/EditGCContentParams'),\n)\n\n/**\n * #stateModel SharedGCContentModel\n * #category display\n * extends\n * - [LinearWiggleDisplay](../linearwiggledisplay)\n */\nexport default function SharedModelF(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'SharedGCContentModel',\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types.model({\n /**\n * #property\n */\n windowSize: types.maybe(types.number),\n /**\n * #property\n */\n windowDelta: types.maybe(types.number),\n }),\n )\n .actions(self => ({\n setGCContentParams({\n windowSize,\n windowDelta,\n }: {\n windowSize: number\n windowDelta: number\n }) {\n self.windowSize = windowSize\n self.windowDelta = windowDelta\n },\n }))\n .views(self => ({\n get windowSizeSetting() {\n return self.windowSize ?? getConf(self, 'windowSize')\n },\n get windowDeltaSetting() {\n return self.windowDelta ?? getConf(self, 'windowDelta')\n },\n }))\n .views(self => {\n const {\n trackMenuItems: superTrackMenuItems,\n renderProps: superRenderProps,\n } = self\n return {\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Change GC parameters',\n onClick: () => {\n getSession(self).queueDialog(handleClose => [\n EditGCContentParamsDialog,\n { model: self, handleClose },\n ])\n },\n },\n ]\n },\n /**\n * #method\n * retrieves the sequence adapter from parent track, and puts it as a\n * subadapter on a GCContentAdapter\n */\n renderProps() {\n const sequenceAdapter = getConf(self.parentTrack, 'adapter')\n return {\n ...superRenderProps(),\n adapterConfig: {\n type: 'GCContentAdapter',\n sequenceAdapter,\n windowSize: self.windowSizeSetting,\n windowDelta: self.windowDeltaSetting,\n },\n }\n },\n }\n })\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport GCContentAdapterF from './GCContentAdapter'\nimport GCContentTrackF from './GCContentTrack'\nimport LinearGCContentDisplayF from './LinearGCContentDisplay'\n\nexport default class GCContentPlugin extends Plugin {\n name = 'GCContentPlugin'\n\n install(pluginManager: PluginManager) {\n GCContentAdapterF(pluginManager)\n GCContentTrackF(pluginManager)\n LinearGCContentDisplayF(pluginManager)\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport configSchemaF from './configSchema'\n\nexport default function GCContentTrackF(pm: PluginManager) {\n pm.addTrackType(() => {\n const configSchema = configSchemaF(pm)\n return new TrackType({\n name: 'GCContentTrack',\n displayName: 'GCContent track',\n configSchema,\n stateModel: createBaseTrackModel(pm, 'GCContentTrack', configSchema),\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'\n\nimport configSchemaF from './configSchema'\n\nexport default function GCContentAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'GCContentAdapter',\n displayName: 'GC content adapter',\n adapterMetadata: {\n hiddenFromGUI: true,\n },\n configSchema: configSchemaF(pluginManager),\n getAdapterClass: () =>\n import('./GCContentAdapter').then(r => r.default),\n }),\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config GCContentTrack\n * used for having a gc content track outside of the \"reference sequence display\"\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'GCContentTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n\nexport default configSchema\n","import { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { LinearWiggleDisplayReactComponent } from '@jbrowse/plugin-wiggle'\n\nimport configSchemaFactory1 from './config1'\nimport configSchemaFactory2 from './config2'\nimport stateModelF1 from './stateModel1'\nimport stateModelF2 from './stateModel2'\n\nexport default function LinearGCContentDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory1(pluginManager)\n const stateModel = stateModelF1(pluginManager, configSchema)\n return new DisplayType({\n name: 'LinearGCContentDisplay',\n configSchema,\n stateModel,\n displayName: 'GC content display',\n trackType: 'ReferenceSequenceTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: LinearWiggleDisplayReactComponent,\n })\n })\n\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory2(pluginManager)\n const stateModel = stateModelF2(pluginManager, configSchema)\n return new DisplayType({\n name: 'LinearGCContentTrackDisplay',\n configSchema,\n stateModel,\n displayName: 'GC content display',\n trackType: 'GCContentTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: LinearWiggleDisplayReactComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearGCContentDisplay\n * #category display\n * extends LinearWiggleDisplay\n */\nexport default function LinearGCContentDisplay(pluginManager: PluginManager) {\n return ConfigurationSchema(\n 'LinearGCContentDisplay',\n {\n windowSize: {\n type: 'number',\n defaultValue: 100,\n },\n windowDelta: {\n type: 'number',\n defaultValue: 100,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: pluginManager.getDisplayType('LinearWiggleDisplay')!\n .configSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { types } from 'mobx-state-tree'\n// locals\nimport SharedModelF from './shared'\n\n/**\n * #stateModel LinearGCContentDisplay\n * #category display\n * base model `SharedGCContentModel`\n */\nexport default function stateModelF(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types.compose(\n 'LinearGCContentDisplay',\n SharedModelF(pluginManager, configSchema),\n types.model({\n type: types.literal('LinearGCContentDisplay'),\n }),\n )\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearGCContentTrackDisplay\n * #category display\n * extends LinearWiggleDisplay, used specifically for GCContentTrack\n */\nexport default function LinearGCContentTrackDisplayF(\n pluginManager: PluginManager,\n) {\n return ConfigurationSchema(\n 'LinearGCContentTrackDisplay',\n {\n windowSize: {\n type: 'number',\n defaultValue: 100,\n },\n windowDelta: {\n type: 'number',\n defaultValue: 100,\n },\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: pluginManager.getDisplayType('LinearWiggleDisplay')!\n .configSchema,\n explicitlyTyped: true,\n },\n )\n}\n","import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { types } from 'mobx-state-tree'\n// locals\nimport SharedModelF from './shared'\n\n/**\n * #stateModel LinearGCContentTrackDisplay\n * #category display\n *\n * used on GCContentTrack, separately from the display type on the\n * ReferenceSequenceTrack\n *\n * extends\n * - [SharedGCContentModel](../sharedgccontentmodel)\n */\nexport default function stateModelF(\n pluginManager: PluginManager,\n configSchema: AnyConfigurationSchemaType,\n) {\n return types.compose(\n 'LinearGCContentTrackDisplay',\n SharedModelF(pluginManager, configSchema),\n types.model({\n type: types.literal('LinearGCContentTrackDisplay'),\n }),\n )\n}\n","import React from 'react'\nimport { types } from 'mobx-state-tree'\n\n/** utility function for assembling the MST model of a column data type */\nexport default function MakeSpreadsheetColumnType(\n name: string,\n {\n DataCellReactComponent = null,\n FilterModelType = null,\n compare,\n displayName = undefined,\n categoryName = undefined,\n }: {\n compare?: any\n DataCellReactComponent?: React.FC<any> | null\n FilterModelType?: any\n displayName?: string\n categoryName?: string\n },\n) {\n return types\n .model(`ColumnDataType${name}`, {\n type: types.literal(name),\n })\n .volatile(() => ({\n DataCellReactComponent,\n FilterModelType: FilterModelType,\n displayName: displayName || name,\n categoryName,\n }))\n .views(() => ({\n compare,\n get hasFilter() {\n return !!FilterModelType\n },\n }))\n}\n","import React from 'react'\nimport {\n IconButton,\n TextField,\n MenuItem,\n InputAdornment,\n Select,\n} from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { observer } from 'mobx-react'\nimport { types, getParent, getPropertyMembers } from 'mobx-state-tree'\n\n// jbrowse imports\nimport {\n getPropertyType,\n getEnumerationValues,\n getSubType,\n} from '@jbrowse/core/util/mst-reflection'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport {\n doesIntersect2,\n isContainedWithin,\n compareLocs,\n getSession,\n parseLocString,\n} from '@jbrowse/core/util'\n\n// icons\nimport ClearIcon from '@mui/icons-material/Clear'\n\n// locals\nimport MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\n\ntype LGV = LinearGenomeViewModel\n\nconst useStyles = makeStyles()({\n textFilterControlAdornment: { marginRight: '-18px' },\n textFilterControl: {\n '& .MuiInput-formControl': {\n marginTop: 8,\n },\n '& .MuiInputLabel-formControl': {\n top: '-7px',\n '&.MuiInputLabel-shrink': {\n top: '-3px',\n },\n },\n },\n})\n\n// React component for the column filter control\nconst FilterReactComponent = observer(function ({\n filterModel,\n}: {\n filterModel: any\n}) {\n const { classes } = useStyles()\n const operationChoices = getEnumerationValues(\n getSubType(getPropertyType(getPropertyMembers(filterModel), 'operation')),\n )\n return (\n <>\n <Select\n value={filterModel.operation}\n onChange={event => filterModel.setOperation(String(event.target.value))}\n >\n {operationChoices.map(name => (\n <MenuItem key={name} value={name}>\n {name}\n </MenuItem>\n ))}\n </Select>{' '}\n <TextField\n label=\"range\"\n placeholder=\"chr1:100-200\"\n error={filterModel.locStringIsInvalid}\n value={filterModel.locString}\n onChange={evt => filterModel.setLocString(evt.target.value)}\n className={classes.textFilterControl}\n InputProps={{\n endAdornment: (\n <InputAdornment\n className={classes.textFilterControlAdornment}\n position=\"end\"\n >\n <IconButton\n aria-label=\"clear filter\"\n onClick={() => filterModel.setLocString('')}\n >\n <ClearIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n </>\n )\n})\n\nconst OPERATIONS = [\n 'overlaps with',\n 'contained within',\n 'fully contains',\n 'does not overlap',\n 'not contained within',\n 'does not contain',\n] as const\n\ninterface Loc {\n start: number\n end: number\n refName: string\n}\n\n// NOTE: assembly names, if present, are ignored in all of these predicates\nconst OPERATION_PREDICATES = {\n 'overlaps with': (cellLocation, specifiedLocation) => {\n return (\n cellLocation.refName === specifiedLocation.refName &&\n doesIntersect2(\n cellLocation.start,\n cellLocation.end,\n specifiedLocation.start,\n specifiedLocation.end,\n )\n )\n },\n 'contained within': (cellLocation, specifiedLocation) => {\n return (\n cellLocation.refName === specifiedLocation.refName &&\n isContainedWithin(\n cellLocation.start,\n cellLocation.end,\n specifiedLocation.start,\n specifiedLocation.end,\n )\n )\n },\n 'fully contains': (cellLocation, specifiedLocation) => {\n return (\n cellLocation.refName === specifiedLocation.refName &&\n isContainedWithin(\n specifiedLocation.start,\n specifiedLocation.end,\n cellLocation.start,\n cellLocation.end,\n )\n )\n },\n} as Record<string, (a: Loc, b: Loc) => boolean>\n\nOPERATION_PREDICATES['does not overlap'] = (\n cellLocation,\n specifiedLocation,\n) => {\n return !OPERATION_PREDICATES['overlaps with']!(\n cellLocation,\n specifiedLocation,\n )\n}\nOPERATION_PREDICATES['not contained within'] = (\n cellLocation,\n specifiedLocation,\n) => {\n return !OPERATION_PREDICATES['contained within']!(\n cellLocation,\n specifiedLocation,\n )\n}\nOPERATION_PREDICATES['does not contain'] = (\n cellLocation,\n specifiedLocation,\n) => {\n return !OPERATION_PREDICATES['fully contains']!(\n cellLocation,\n specifiedLocation,\n )\n}\n\n// MST model for the column filter control\nconst FilterModelType = types\n .model('ColumnLocStringFilter', {\n type: types.literal('LocString'),\n columnNumber: types.integer,\n locString: '',\n operation: types.optional(types.string, OPERATIONS[0]),\n })\n .views(self => ({\n get locStringIsInvalid() {\n if (self.locString) {\n const parsed = this.parsedLocString\n return (\n !parsed ||\n parsed.refName === '' ||\n typeof parsed.start !== 'number' ||\n typeof parsed.end !== 'number' ||\n parsed.start > parsed.end\n )\n }\n return false\n },\n get parsedLocString() {\n const session = getSession(self)\n\n const model = getParent<any>(self, 3).spreadsheet\n const { assemblyName } = model\n try {\n return parseLocString(self.locString, refName =>\n session.assemblyManager.isValidRefName(refName, assemblyName),\n )\n } catch (e) {\n return undefined\n }\n },\n }))\n .views(self => ({\n // returns a function that tests the given row\n get predicate() {\n const {\n locString,\n locStringIsInvalid,\n parsedLocString,\n operation,\n columnNumber,\n } = self // avoid closing over self\n if (!locString || locStringIsInvalid || !parsedLocString) {\n return function alwaysTrue() {\n return true\n }\n }\n\n return function stringPredicate(_sheet: any, row: any) {\n const { cellsWithDerived: cells } = row\n const cell = cells[columnNumber]\n\n if (!cell?.text || !cell.extendedData) {\n return false\n }\n const parsedCellText = cell.extendedData\n if (!parsedCellText.refName) {\n return false\n }\n\n const predicate = OPERATION_PREDICATES[operation]\n if (!predicate) {\n throw new Error(`\"${operation}\" not implemented in location filter`)\n }\n\n return predicate(parsedCellText, parsedLocString as Loc)\n }\n },\n }))\n .actions(self => ({\n setLocString(s: string) {\n self.locString = s\n },\n setOperation(op: string) {\n self.operation = op\n },\n }))\n .volatile(() => ({ ReactComponent: FilterReactComponent }))\n\n// opens a new LGV at the location described in the locString in the cell text\n\nasync function locationLinkClick(\n spreadsheet: any,\n _columnNumber: number,\n\n cell: any,\n) {\n const session = getSession(spreadsheet)\n const { assemblyName } = spreadsheet\n\n const { id } = getParent<any>(spreadsheet)\n\n const newViewId = `${id}_${assemblyName}`\n let view = session.views.find(v => v.id === newViewId) as LGV | undefined\n if (!view) {\n view = session.addView('LinearGenomeView', {\n id: newViewId,\n }) as LGV\n }\n await view.navToLocString(cell.text, assemblyName)\n}\n\ntype DataCell = any\n\nconst DataCellReactComponent = observer(function ({\n cell,\n columnNumber,\n spreadsheet,\n}: DataCell) {\n return (\n <a\n onClick={async evt => {\n evt.preventDefault()\n const session = getSession(spreadsheet)\n try {\n await locationLinkClick(spreadsheet, columnNumber, cell)\n } catch (e) {\n console.error(e)\n session.notifyError(`${e}`, e)\n }\n }}\n title=\"open a new linear genome view here\"\n href=\"#\"\n >\n {cell.text}\n </a>\n )\n})\n\nconst LocStringColumnType = MakeSpreadsheetColumnType('LocString', {\n categoryName: 'Location',\n displayName: 'Full location',\n\n compare(cellA: { extendedData: any }, cellB: { extendedData: any }) {\n return compareLocs(cellA.extendedData, cellB.extendedData)\n },\n FilterModelType,\n DataCellReactComponent,\n})\n\nexport default LocStringColumnType\n","import React from 'react'\nimport {\n IconButton,\n TextField,\n MenuItem,\n InputAdornment,\n Select,\n} from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\nimport { types, getPropertyMembers } from 'mobx-state-tree'\nimport { observer } from 'mobx-react'\nimport {\n getPropertyType,\n getEnumerationValues,\n getSubType,\n} from '@jbrowse/core/util/mst-reflection'\n\n// icons\nimport ClearIcon from '@mui/icons-material/Clear'\n\nconst OPERATIONS = [\n 'equals',\n 'contains',\n 'does not contain',\n 'does not equal',\n 'starts with',\n 'ends with',\n]\n\n// NOTE: assembly names, if present, are ignored in all of these predicates\nconst OPERATION_PREDICATES = {\n contains: (textInCell, stringToFind) => {\n return textInCell.toLowerCase().includes(stringToFind)\n },\n equals: (textInCell, stringToFind) => {\n return textInCell.toLowerCase() === stringToFind\n },\n 'starts with': (textInCell, stringToFind) => {\n return textInCell.toLowerCase().startsWith(stringToFind)\n },\n 'ends with': (textInCell, stringToFind) => {\n const index = textInCell.toLowerCase().indexOf(stringToFind)\n if (index === -1) {\n return false\n }\n return index === textInCell.length - stringToFind.length\n },\n} as Record<string, (a: string, b: string) => boolean>\n\nOPERATION_PREDICATES['does not contain'] = (textInCell, stringToFind) => {\n return !OPERATION_PREDICATES.contains!(textInCell, stringToFind)\n}\nOPERATION_PREDICATES['does not equal'] = (textInCell, stringToFind) => {\n return !OPERATION_PREDICATES.equals!(textInCell, stringToFind)\n}\n\nconst useStyles = makeStyles()({\n textFilterControlAdornment: { marginRight: '-18px' },\n textFilterControl: {\n margin: 0,\n '& .MuiInput-formControl': {\n marginTop: 8,\n },\n '& .MuiInputLabel-formControl': {\n top: '-7px',\n '&.MuiInputLabel-shrink': {\n top: '-3px',\n },\n },\n },\n})\n\n// React component for the column filter control\nconst FilterReactComponent = observer(\n ({ filterModel }: { filterModel: any }) => {\n const { classes } = useStyles()\n const operationChoices = getEnumerationValues(\n getSubType(getPropertyType(getPropertyMembers(filterModel), 'operation')),\n )\n return (\n <>\n <Select\n value={filterModel.operation}\n onChange={event => {\n filterModel.setOperation(String(event.target.value))\n }}\n >\n {operationChoices.map(name => (\n <MenuItem key={name} value={name}>\n {name}\n </MenuItem>\n ))}\n </Select>{' '}\n <TextField\n label=\"text\"\n value={filterModel.stringToFind}\n onChange={evt => filterModel.setString(evt.target.value)}\n className={classes.textFilterControl}\n InputProps={{\n endAdornment: (\n <InputAdornment\n className={classes.textFilterControlAdornment}\n position=\"end\"\n >\n <IconButton\n aria-label=\"clear filter\"\n onClick={() => filterModel.setString('')}\n >\n <ClearIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n </>\n )\n },\n)\n\n// MST model for the column filter control\nconst ColumnTextFilter = types\n .model('ColumnTextFilter', {\n type: types.literal('Text'),\n columnNumber: types.integer,\n stringToFind: '',\n operation: types.optional(types.enumeration(OPERATIONS), OPERATIONS[0]!),\n })\n .views(self => ({\n // returns a function that tests the given row\n get predicate() {\n const { stringToFind, columnNumber, operation } = self // avoid closing over self\n if (!stringToFind) {\n return function alwaysTrue() {\n return true\n }\n }\n const s = stringToFind.toLowerCase() // case insensitive match\n\n return function stringPredicate(_sheet: any, row: any) {\n const { cellsWithDerived } = row\n const cell = cellsWithDerived[columnNumber]\n if (!cell?.text) {\n return false\n }\n const predicate = OPERATION_PREDICATES[operation]\n if (!predicate) {\n throw new Error(`\"${operation}\" not implemented in location filter`)\n }\n return predicate(cell.text, s)\n }\n },\n }))\n .actions(self => ({\n setString(s: string) {\n self.stringToFind = s\n },\n setOperation(op: string) {\n self.operation = op\n },\n }))\n .volatile(() => ({ ReactComponent: FilterReactComponent }))\n\nconst TextColumnType = MakeSpreadsheetColumnType('Text', {\n compare(cellA: { text: string }, cellB: { text: string }) {\n return cellA.text.localeCompare(cellB.text)\n },\n FilterModelType: ColumnTextFilter,\n})\n\nexport { TextColumnType as TextColumn, ColumnTextFilter as FilterModelType }\n","import MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\nimport { FilterModelType as NumberFilterModel } from './Text'\nimport { types } from 'mobx-state-tree'\n\nconst FilterModelType = types.compose(\n NumberFilterModel,\n types.model({\n type: types.literal('LocRef'),\n }),\n)\n\nconst LocRef = MakeSpreadsheetColumnType('LocRef', {\n categoryName: 'Location',\n displayName: 'Reference seq',\n compare(cellA: { text: string }, cellB: { text: string }) {\n return cellA.text.localeCompare(cellB.text)\n },\n FilterModelType,\n})\n\nexport default LocRef\n","import React from 'react'\nimport { types } from 'mobx-state-tree'\nimport { observer } from 'mobx-react'\nimport { MenuItem, Select, TextField } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\n\nconst OPERATIONS = [\n 'equals',\n 'greater than',\n 'less than',\n 'between',\n 'not between',\n]\n\n// NOTE: assembly names, if present, are ignored in all of these predicates\nconst OPERATION_PREDICATES = {\n equals: (numberInCell, firstNumber) => {\n return numberInCell === firstNumber\n },\n 'greater than': (numberInCell, firstNumber) => {\n return numberInCell > firstNumber\n },\n 'less than': (numberInCell, firstNumber) => {\n return numberInCell < firstNumber\n },\n between: (numberInCell, firstNumber, secondNumber) => {\n return (\n numberInCell > firstNumber &&\n secondNumber !== undefined &&\n numberInCell < secondNumber\n )\n },\n} as Record<string, (arg0: number, a: number, b?: number) => boolean>\n\nOPERATION_PREDICATES['not between'] = (\n numberInCell,\n firstNumber,\n secondNumber,\n) => {\n return !OPERATION_PREDICATES.between!(numberInCell, firstNumber, secondNumber)\n}\n\nconst useStyles = makeStyles()({\n textFilterControlAdornment: { marginRight: '-18px' },\n textFilterControl: {\n '& .MuiInput-formControl': {\n marginTop: 8,\n },\n '& .MuiInputLabel-formControl': {\n top: '-7px',\n '&.MuiInputLabel-shrink': {\n top: '-3px',\n },\n },\n },\n})\n\n// React component for the column filter control\nconst FilterReactComponent = observer(\n ({ filterModel }: { filterModel: any }) => {\n const { classes } = useStyles()\n\n const operationChoices = OPERATIONS\n\n return (\n <>\n <Select\n value={filterModel.operation}\n onChange={e => filterModel.setOperation(String(e.target.value))}\n >\n {operationChoices.map(name => (\n <MenuItem key={name} value={name}>\n {name}\n </MenuItem>\n ))}\n </Select>{' '}\n <TextField\n label=\"number\"\n placeholder=\"123\"\n type=\"number\"\n error={filterModel.firstNumberIsInvalid}\n defaultValue={filterModel.firstNumber}\n onChange={evt => {\n filterModel.setFirstNumber(Number.parseFloat(evt.target.value))\n }}\n className={classes.textFilterControl}\n />\n {filterModel.operation !== 'between' &&\n filterModel.operation !== 'not between' ? null : (\n <>\n {' and '}\n <TextField\n label=\"number\"\n placeholder=\"456\"\n type=\"number\"\n error={filterModel.secondNumberIsInvalid}\n defaultValue={filterModel.secondNumber}\n onChange={evt =>\n filterModel.setSecondNumber(Number.parseFloat(evt.target.value))\n }\n className={classes.textFilterControl}\n />\n </>\n )}\n </>\n )\n },\n)\n\n// MST model for the column filter control\nconst FilterModelType = types\n .model('ColumnNumberFilter', {\n type: types.literal('Number'),\n columnNumber: types.integer,\n firstNumber: types.maybe(types.number),\n secondNumber: types.maybe(types.number),\n operation: types.optional(types.enumeration(OPERATIONS), OPERATIONS[0]!),\n })\n .views(self => ({\n // returns a function that tests the given row\n get predicate() {\n if (typeof self.firstNumber !== 'number') {\n return function alwaysTrue() {\n return true\n }\n }\n\n const { firstNumber, secondNumber, operation, columnNumber } = self // avoid closing over self\n\n return function stringPredicate(_sheet: any, row: any) {\n const { cellsWithDerived } = row\n const cell = cellsWithDerived[columnNumber]\n\n if (!cell?.text) {\n return false\n }\n\n const parsedCellText = Number.parseFloat(cell.text)\n if (typeof parsedCellText !== 'number') {\n return false\n }\n\n const predicate = OPERATION_PREDICATES[operation]\n if (!predicate) {\n throw new Error(`\"${operation}\" not implemented in location filter`)\n }\n\n return predicate(parsedCellText, firstNumber, secondNumber)\n }\n },\n }))\n .actions(self => ({\n setFirstNumber(n: number) {\n self.firstNumber =\n Number.isNaN(n) || typeof n !== 'number' ? undefined : n\n },\n setSecondNumber(n: number) {\n self.secondNumber =\n Number.isNaN(n) || typeof n !== 'number' ? undefined : n\n },\n setOperation(op: string) {\n self.operation = op\n },\n }))\n .volatile(() => ({ ReactComponent: FilterReactComponent }))\n\nconst NumberColumn = MakeSpreadsheetColumnType('Number', {\n compare(cellA: { text: string }, cellB: { text: string }) {\n return Number.parseFloat(cellA.text) - Number.parseFloat(cellB.text)\n },\n FilterModelType,\n})\n\nexport { NumberColumn, FilterModelType }\n","import LocString from './LocString'\nimport LocRef from './LocRef'\nimport LocStart from './LocStart'\nimport LocEnd from './LocEnd'\nimport { NumberColumn } from './Number'\nimport { TextColumn as Text } from './Text'\nimport { types, IAnyModelType } from 'mobx-state-tree'\n\nconst ColumnTypes = {\n Number: NumberColumn,\n Text,\n LocString,\n LocRef,\n LocStart,\n LocEnd,\n}\n\nconst allColumnTypes = Object.values(ColumnTypes)\nconst AnyColumnType = types.union(...allColumnTypes)\nconst AnyFilterModelType = types.union(\n ...allColumnTypes\n .map(columnType => {\n // just instantiate the blank types to get their filter model types\n const { FilterModelType } = columnType.create({\n // @ts-expect-error\n type: columnType.properties.type.value,\n })\n return FilterModelType as unknown as IAnyModelType | undefined\n })\n // some column types might not have filter machinery, filter those out\n .filter(t => !!t),\n)\n\nexport { ColumnTypes, AnyColumnType, AnyFilterModelType }\n","import MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\nimport { types } from 'mobx-state-tree'\nimport { FilterModelType as NumberFilterModel } from './Number'\n\nconst FilterModelType = types.compose(\n NumberFilterModel,\n types.model({\n type: types.literal('LocStart'),\n }),\n)\n\nconst LocStart = MakeSpreadsheetColumnType('LocStart', {\n categoryName: 'Location',\n displayName: 'Start',\n compare(cellA: { text: string }, cellB: { text: string }) {\n return Number.parseFloat(cellA.text) - Number.parseFloat(cellB.text)\n },\n FilterModelType,\n})\n\nexport default LocStart\n","import MakeSpreadsheetColumnType from './MakeSpreadsheetColumnType'\nimport { FilterModelType as NumberFilterModel } from './Number'\nimport { types } from 'mobx-state-tree'\n\nconst FilterModelType = types.compose(\n NumberFilterModel,\n types.model({\n type: types.literal('LocEnd'),\n }),\n)\n\nconst LocEnd = MakeSpreadsheetColumnType('LocEnd', {\n categoryName: 'Location',\n displayName: 'End',\n compare(cellA: { text: string }, cellB: { text: string }) {\n return Number.parseFloat(cellA.text) - Number.parseFloat(cellB.text)\n },\n FilterModelType,\n})\n\nexport default LocEnd\n","import { types, getParent } from 'mobx-state-tree'\n\nconst CellModel = types.model('SpreadsheetCell', {\n text: types.string,\n extendedData: types.maybe(types.frozen()),\n})\n\nconst RowModel = types\n .model('SpreadsheetRow', {\n id: types.identifier,\n cells: types.array(CellModel),\n extendedData: types.maybe(types.frozen()),\n isSelected: false,\n })\n .actions(self => ({\n toggleSelect() {\n self.isSelected = !self.isSelected\n },\n unSelect() {\n self.isSelected = false\n },\n select() {\n self.isSelected = true\n },\n setExtendedData(data: unknown) {\n self.extendedData = data\n },\n }))\n .views(self => ({\n get cellsWithDerived() {\n const { columns } = getParent<any>(self, 3)\n let i = 0\n\n return columns.map((column: { isDerived: boolean; expr: any }) => {\n if (column.isDerived) {\n return column.expr.evalSync({\n row: self,\n })\n }\n return self.cells[i++]\n })\n },\n }))\n\nexport default RowModel\n","import RowModel from './Row'\nimport { types, getParent } from 'mobx-state-tree'\n\nconst StaticRowModel = types\n .model('StaticRowSet', {\n isLoaded: types.literal(true),\n rows: types.array(RowModel),\n })\n .views(self => ({\n get count() {\n return self.rows.length\n },\n\n get passingFiltersCount() {\n return this.sortedFilteredRows.length\n },\n\n get selectedCount() {\n return this.selectedRows.length\n },\n\n get selectedAndPassingFiltersCount() {\n return this.selectedFilteredRows.length\n },\n\n get sortedRows() {\n const parent = getParent<any>(self)\n return [...self.rows].sort(parent.rowSortingComparisonFunction)\n },\n\n get selectedRows() {\n return self.rows.filter(r => r.isSelected)\n },\n\n get selectedFilteredRows() {\n const sheet = getParent<any>(self)\n\n const view = getParent<any>(sheet)\n const { filterControls } = view\n return this.selectedRows.filter(row =>\n filterControls.rowPassesFilters(sheet, row),\n )\n },\n\n // the set of all rows that pass the filters, sorted\n get sortedFilteredRows() {\n const sheet = getParent<any>(self)\n\n const view = getParent<any>(sheet)\n const { filterControls } = view\n return self.rows\n .filter(row => filterControls.rowPassesFilters(sheet, row))\n .sort(sheet.rowSortingComparisonFunction)\n },\n }))\n .actions(self => ({\n unselectAll() {\n self.rows.forEach(row => {\n row.unSelect()\n })\n },\n }))\n\nexport default StaticRowModel\n","import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings'\nimport { getSession, getEnv } from '@jbrowse/core/util'\nimport { autorun } from 'mobx'\nimport {\n addDisposer,\n types,\n getParent,\n SnapshotIn,\n Instance,\n} from 'mobx-state-tree'\n\n// locals\nimport { ColumnTypes, AnyColumnType } from './ColumnDataTypes'\nimport StaticRowSetModel from './StaticRowSet'\nimport type RowModel from './Row'\n\ntype Row = Instance<typeof RowModel>\n\nconst ColumnDefinition = types\n .model('ColumnDefinition', {\n name: types.maybe(types.string),\n dataType: types.optional(AnyColumnType, () => ({\n type: 'Text',\n })),\n // set to true if column is derived from other columns\n // if the column is derived, each cell will have a\n // `derivationFunction` that is called to get its value\n isDerived: false,\n // if this cell is derived from other cells, execute this function to get\n // the value\n derivationFunctionText: types.maybe(types.string),\n })\n .views(self => ({\n get expr() {\n if (self.isDerived) {\n // compile this as a jexl expression\n return stringToJexlExpression(\n String(self.derivationFunctionText),\n getEnv(self).pluginManager.jexl,\n )\n }\n return undefined\n },\n }))\n\ntype RowMenuPosition = { anchorEl: Element; rowNumber: string } | null\n\n/**\n * #stateModel SpreadsheetViewSpreadsheet\n * #category view\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst Spreadsheet = types\n .model('Spreadsheet', {\n /**\n * #property\n */\n rowSet: types.optional(StaticRowSetModel, () => StaticRowSetModel.create()),\n /**\n * #property\n */\n columns: types.array(ColumnDefinition),\n /**\n * #property\n */\n columnDisplayOrder: types.array(types.number),\n /**\n * #property\n */\n hasColumnNames: false,\n /**\n * #property\n */\n sortColumns: types.array(\n types\n .model('SortColumns', {\n columnNumber: types.number,\n descending: false,\n })\n .actions(self => ({\n switchDirection() {\n self.descending = !self.descending\n },\n })),\n ),\n\n assemblyName: types.maybe(types.string),\n })\n .volatile(() => ({\n defaultDataType: ColumnTypes.Text,\n rowMenuPosition: null as RowMenuPosition,\n isLoaded: false,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get initialized() {\n const session = getSession(self)\n const name = self.assemblyName\n return name ? session.assemblyManager.get(name)?.initialized : false\n },\n /**\n * #getter\n */\n get hideRowSelection() {\n // just delegates to parent\n\n return getParent<any>(self).hideRowSelection\n },\n\n /**\n * #getter\n * list of data type names to be made available in the column\n * dropdown menu\n */\n get dataTypeChoices() {\n const typeNames = Object.keys(ColumnTypes) as (keyof typeof ColumnTypes)[]\n return typeNames.map(typeName => {\n const dataType = ColumnTypes[typeName].create({ type: typeName })\n const { displayName, categoryName } = dataType\n return { typeName, displayName, categoryName }\n })\n },\n\n /**\n * #method\n */\n rowSortingComparisonFunction(rowA: Row, rowB: Row) {\n for (const { columnNumber, descending } of self.sortColumns) {\n const { dataType } = self.columns[columnNumber]!\n const result = dataType.compare(\n rowA.cellsWithDerived[columnNumber],\n rowB.cellsWithDerived[columnNumber],\n )\n if (result) {\n return descending ? -result : result\n }\n }\n return 0\n },\n }))\n .actions(self => ({\n afterAttach() {\n addDisposer(\n self,\n autorun(async () => {\n const session = getSession(self)\n const { assemblyManager } = session\n try {\n if (self.assemblyName) {\n await assemblyManager.waitForAssembly(self.assemblyName)\n this.setLoaded(true)\n }\n } catch (error) {\n session.notify(\n `failed to load assembly ${self.assemblyName} ${error}`,\n 'error',\n )\n }\n }),\n )\n },\n\n /**\n * #action\n */\n setLoaded(flag: boolean) {\n self.isLoaded = flag\n },\n\n /**\n * #action\n */\n setRowMenuPosition(newPosition: RowMenuPosition) {\n self.rowMenuPosition = newPosition\n },\n\n /**\n * #action\n */\n setSortColumns(newSort: NonNullable<SnapshotIn<typeof self.sortColumns>>) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (newSort) {\n // @ts-expect-error\n self.sortColumns = newSort\n }\n },\n\n /**\n * #action\n */\n setColumnType(columnNumber: number, newTypeName: string) {\n self.columns[columnNumber]!.dataType = { type: newTypeName }\n },\n\n /**\n * #action\n */\n unselectAll() {\n self.rowSet.unselectAll()\n },\n }))\n\nexport type SpreadsheetStateModel = typeof Spreadsheet\nexport type SpreadsheetModel = Instance<SpreadsheetStateModel>\n\nexport default Spreadsheet\n","import { types, getParent, Instance } from 'mobx-state-tree'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { getSession, getEnv } from '@jbrowse/core/util'\n\n// 30MB\nconst IMPORT_SIZE_LIMIT = 30_000_000\n\nconst fileTypes = ['CSV', 'TSV', 'VCF', 'BED', 'BEDPE', 'STAR-Fusion']\nconst fileTypeParsers = {\n CSV: () =>\n import('../importAdapters/ImportUtils').then(r => r.parseCsvBuffer),\n TSV: () =>\n import('../importAdapters/ImportUtils').then(r => r.parseTsvBuffer),\n VCF: () => import('../importAdapters/VcfImport').then(r => r.parseVcfBuffer),\n BED: () => import('../importAdapters/BedImport').then(r => r.parseBedBuffer),\n BEDPE: () =>\n import('../importAdapters/BedImport').then(r => r.parseBedPEBuffer),\n 'STAR-Fusion': () =>\n import('../importAdapters/STARFusionImport').then(\n r => r.parseSTARFusionBuffer,\n ),\n}\n// regexp used to guess the type of a file or URL from its file extension\nconst fileTypesRegexp = new RegExp(`\\\\.(${fileTypes.join('|')})(\\\\.gz)?$`, 'i')\n\n/**\n * #stateModel SpreadsheetImportWizard\n * #category view\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst ImportWizard = types\n .model('SpreadsheetImportWizard', {\n /**\n * #property\n */\n fileType: types.optional(types.enumeration(fileTypes), 'CSV'),\n /**\n * #property\n */\n hasColumnNameLine: true,\n /**\n * #property\n */\n columnNameLineNumber: 1,\n /**\n * #property\n */\n selectedAssemblyName: types.maybe(types.string),\n })\n .volatile(() => ({\n fileTypes,\n\n fileSource: undefined as any,\n error: undefined as unknown,\n loading: false,\n }))\n .views(self => ({\n get isReadyToOpen() {\n return (\n !self.error &&\n self.fileSource &&\n (self.fileSource.blobId ||\n self.fileSource.localPath ||\n self.fileSource.uri)\n )\n },\n get canCancel() {\n return getParent<any>(self).readyToDisplay\n },\n\n get fileName() {\n return (\n self.fileSource.uri ||\n self.fileSource.localPath ||\n (self.fileSource.blobId && self.fileSource.name)\n )\n },\n\n get requiresUnzip() {\n return this.fileName.endsWith('gz')\n },\n\n isValidRefName(refName: string, assemblyName?: string) {\n const { assemblyManager } = getSession(self)\n if (!assemblyName) {\n return false\n }\n return assemblyManager.isValidRefName(refName, assemblyName)\n },\n }))\n .actions(self => ({\n setSelectedAssemblyName(s: string) {\n self.selectedAssemblyName = s\n },\n setFileSource(newSource: unknown) {\n self.fileSource = newSource\n self.error = undefined\n\n if (self.fileSource) {\n // try to autodetect the file type, ignore errors\n const name = self.fileName\n\n if (name) {\n const firstMatch = fileTypesRegexp.exec(name)?.[1]\n if (firstMatch) {\n self.fileType =\n firstMatch === 'tsv' && name.includes('star-fusion')\n ? 'STAR-Fusion'\n : firstMatch.toUpperCase()\n }\n }\n }\n },\n\n toggleHasColumnNameLine() {\n self.hasColumnNameLine = !self.hasColumnNameLine\n },\n\n setColumnNameLineNumber(newnumber: number) {\n if (newnumber > 0) {\n self.columnNameLineNumber = newnumber\n }\n },\n\n setFileType(typeName: string) {\n self.fileType = typeName\n },\n\n setError(error: unknown) {\n console.error(error)\n self.loading = false\n self.error = error\n },\n\n setLoaded() {\n self.loading = false\n self.error = undefined\n },\n\n cancelButton() {\n self.error = undefined\n\n getParent<any>(self).setDisplayMode()\n },\n\n // fetch and parse the file, make a new Spreadsheet model for it,\n // then set the parent to display it\n async import(assemblyName: string) {\n if (!self.fileSource) {\n return\n }\n\n if (self.loading) {\n throw new Error('Cannot import, load already in progress')\n }\n\n self.selectedAssemblyName = assemblyName\n self.loading = true\n const type = self.fileType as keyof typeof fileTypeParsers\n const typeParser = await fileTypeParsers[type]()\n\n const { unzip } = await import('@gmod/bgzf-filehandle')\n const { pluginManager } = getEnv(self)\n const filehandle = openLocation(self.fileSource, pluginManager)\n try {\n const stat = await filehandle.stat()\n if (stat.size > IMPORT_SIZE_LIMIT) {\n throw new Error(\n `File is too big. Tabular files are limited to at most ${(\n IMPORT_SIZE_LIMIT / 1000\n ).toLocaleString()}kb.`,\n )\n }\n } catch (e) {\n // not required for stat to succeed to proceed, but it is helpful\n console.warn(e)\n }\n\n try {\n await filehandle\n .readFile()\n .then(buffer => (self.requiresUnzip ? unzip(buffer) : buffer))\n .then(buffer => typeParser(buffer, self))\n .then(spreadsheet => {\n this.setLoaded()\n\n getParent<any>(self).displaySpreadsheet(spreadsheet)\n })\n } catch (e) {\n this.setError(e)\n }\n },\n }))\n\nexport type ImportWizardStateModel = typeof ImportWizard\nexport type ImportWizardModel = Instance<ImportWizardStateModel>\n\nexport default ImportWizard\n","import { types, getParent, SnapshotIn } from 'mobx-state-tree'\nimport { AnyFilterModelType as AnyColumnFilter } from './ColumnDataTypes'\n\n// filter that finds a simple string in any of the cells of a row\nconst RowFullTextFilter = types\n .model('RowFullTextFilter', {\n type: types.literal('RowFullText'),\n stringToFind: '',\n })\n .views(self => ({\n // returns a function that tests the given row\n get predicate() {\n let s = self.stringToFind // avoid closing over self\n if (!s) {\n return function alwaysTrue() {\n return true\n }\n }\n s = s.toLowerCase()\n return function stringPredicate(\n _sheet: unknown,\n row: { cellsWithDerived: { text: string }[] },\n ) {\n const { cellsWithDerived } = row\n for (const cell of cellsWithDerived) {\n // note: case insensitive\n if (cell.text.toLowerCase().includes(s)) {\n return true\n }\n }\n return false\n }\n },\n }))\n .actions(self => ({\n setString(s: string) {\n self.stringToFind = s\n },\n clear() {\n self.stringToFind = ''\n },\n }))\n\nconst model = types\n .model('SpreadsheetFilterControls', {\n rowFullText: types.optional(\n RowFullTextFilter,\n () =>\n ({\n type: 'RowFullText',\n stringToFind: '',\n }) as SnapshotIn<typeof RowFullTextFilter>,\n ),\n columnFilters: types.array(AnyColumnFilter),\n })\n .views(self => ({\n get filters() {\n return [self.rowFullText, ...self.columnFilters].filter(f => !!f)\n },\n setRowFullTextFilter(stringToFind: string) {\n // @ts-expect-error\n self.rowFullText = {\n type: 'RowFullText',\n stringToFind,\n }\n },\n rowPassesFilters(sheet: unknown, row: unknown) {\n for (const filter of this.filters) {\n if (!filter.predicate(sheet, row)) {\n return false\n }\n }\n return true\n },\n }))\n .actions(self => ({\n addBlankColumnFilter(columnNumber: number) {\n const { dataType } =\n getParent<any>(self).spreadsheet.columns[columnNumber]\n self.columnFilters.push({\n type: dataType.type,\n columnNumber,\n })\n },\n removeColumnFilter(filter: typeof AnyColumnFilter) {\n return self.columnFilters.remove(filter)\n },\n clearAllFilters() {\n self.columnFilters.clear()\n self.rowFullText.clear()\n },\n }))\n\nexport default model\n","import { types, getEnv, cast, SnapshotIn, Instance } from 'mobx-state-tree'\nimport { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { MenuItem } from '@jbrowse/core/ui'\nimport { getSession } from '@jbrowse/core/util'\n\n// icons\nimport DoneIcon from '@mui/icons-material/Done'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\n\nimport SpreadsheetModel from './Spreadsheet'\nimport ImportWizardModel from './ImportWizard'\nimport FilterControlsModel from './FilterControls'\n\ntype Spreadsheet = Instance<typeof SpreadsheetModel>\n\nexport type MenuItemWithDisabledCallback = MenuItem & {\n disabled?:\n | boolean\n | ((\n viewModel: unknown,\n spreadsheetModel: Spreadsheet,\n rowNumber: number,\n row: Spreadsheet['rowSet']['rows'][0],\n ) => boolean)\n}\n\nconst defaultRowMenuItems: MenuItemWithDisabledCallback[] = [\n {\n label: 'Toggle select',\n icon: DoneIcon,\n onClick(_view: unknown, spreadsheet: Spreadsheet) {\n const rowNumber = spreadsheet.rowMenuPosition?.rowNumber\n if (rowNumber !== undefined) {\n spreadsheet.rowSet.rows[+rowNumber - 1]!.toggleSelect()\n }\n },\n },\n]\n\nconst minHeight = 40\nconst defaultHeight = 440\n\n/**\n * #stateModel SpreadsheetView\n * #category view\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst model = types\n .model('SpreadsheetView', {\n /**\n * #property\n */\n type: types.literal('SpreadsheetView'),\n /**\n * #property\n */\n offsetPx: 0,\n /**\n * #property\n */\n height: types.optional(\n types.refinement(\n 'SpreadsheetViewHeight',\n types.number,\n n => n >= minHeight,\n ),\n defaultHeight,\n ),\n /**\n * #property\n */\n hideVerticalResizeHandle: false,\n /**\n * #property\n */\n hideFilterControls: false,\n /**\n * #property\n */\n filterControls: types.optional(FilterControlsModel, () =>\n FilterControlsModel.create({}),\n ),\n /**\n * #property\n * switch specifying whether we are showing the import wizard or the\n * spreadsheet in our viewing area\n */\n mode: types.optional(\n types.enumeration('SpreadsheetViewMode', ['import', 'display']),\n 'import',\n ),\n /**\n * #property\n */\n importWizard: types.optional(ImportWizardModel, () =>\n ImportWizardModel.create(),\n ),\n /**\n * #property\n */\n spreadsheet: types.maybe(SpreadsheetModel),\n })\n .volatile(() => ({\n width: 400,\n rowMenuItems: defaultRowMenuItems,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get readyToDisplay() {\n return !!self.spreadsheet && self.spreadsheet.isLoaded\n },\n /**\n * #getter\n */\n get hideRowSelection() {\n return !!getEnv(self).hideRowSelection\n },\n /**\n * #getter\n */\n get outputRows() {\n if (self.spreadsheet?.rowSet.isLoaded) {\n const selected = self.spreadsheet.rowSet.selectedFilteredRows\n if (selected.length) {\n return selected\n }\n return self.spreadsheet.rowSet.sortedFilteredRows\n }\n return undefined\n },\n /**\n * #getter\n */\n get assembly() {\n const name = self.spreadsheet?.assemblyName\n if (name) {\n const assemblies = getSession(self).assemblies\n return assemblies.find(asm => readConfObject(asm, 'name') === name)\n }\n return undefined\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setRowMenuItems(newItems: MenuItem[]) {\n self.rowMenuItems = newItems\n },\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.width = newWidth\n return self.width\n },\n /**\n * #action\n */\n setHeight(newHeight: number) {\n self.height = newHeight > minHeight ? newHeight : minHeight\n return self.height\n },\n /**\n * #action\n */\n resizeHeight(distance: number) {\n const oldHeight = self.height\n const newHeight = this.setHeight(self.height + distance)\n return newHeight - oldHeight\n },\n /**\n * #action\n */\n resizeWidth(distance: number) {\n const oldWidth = self.width\n const newWidth = this.setWidth(self.width + distance)\n return newWidth - oldWidth\n },\n\n /**\n * #action\n * load a new spreadsheet and set our mode to display it\n */\n displaySpreadsheet(spreadsheet: SnapshotIn<typeof SpreadsheetModel>) {\n self.filterControls.clearAllFilters()\n self.spreadsheet = cast(spreadsheet)\n self.mode = 'display'\n },\n /**\n * #action\n */\n setImportMode() {\n self.mode = 'import'\n },\n /**\n * #action\n */\n setDisplayMode() {\n if (self.readyToDisplay) {\n self.mode = 'display'\n }\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n menuItems() {\n return [\n {\n label: 'Return to import form',\n onClick: () => {\n self.setImportMode()\n },\n icon: FolderOpenIcon,\n },\n ]\n },\n }))\n\nconst SpreadsheetView = types.compose(BaseViewModel, model)\n\nexport type SpreadsheetViewStateModel = typeof SpreadsheetView\nexport type SpreadsheetViewModel = Instance<SpreadsheetViewStateModel>\n\nexport default SpreadsheetView\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\nimport { AbstractSessionModel, isAbstractMenuManager } from '@jbrowse/core/util'\n\n// icons\nimport ViewComfyIcon from '@mui/icons-material/ViewComfy'\n\n// locals\nimport SpreadsheetViewF from './SpreadsheetView'\n\nimport LaunchSpreadsheetViewF from './LaunchSpreadsheetView'\n\nexport default class SpreadsheetViewPlugin extends Plugin {\n name = 'SpreadsheetViewPlugin'\n\n install(pluginManager: PluginManager) {\n SpreadsheetViewF(pluginManager)\n LaunchSpreadsheetViewF(pluginManager)\n }\n\n configure(pluginManager: PluginManager) {\n const { rootModel } = pluginManager\n if (isAbstractMenuManager(rootModel)) {\n rootModel.appendToSubMenu(['Add'], {\n label: 'Spreadsheet view',\n icon: ViewComfyIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('SpreadsheetView', {})\n },\n })\n }\n }\n}\n\nexport {\n type SpreadsheetViewModel,\n type SpreadsheetViewStateModel,\n} from './SpreadsheetView'\n","import { lazy } from 'react'\nimport { ViewType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport stateModel from './models/SpreadsheetView'\n\nexport default function SpreadsheetViewF(pluginManager: PluginManager) {\n pluginManager.addViewType(() => {\n return new ViewType({\n name: 'SpreadsheetView',\n displayName: 'Spreadsheet view',\n stateModel,\n ReactComponent: lazy(() => import('./components/SpreadsheetView')),\n })\n })\n}\n\nexport {\n type SpreadsheetViewModel,\n type SpreadsheetViewStateModel,\n} from './models/SpreadsheetView'\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport { SpreadsheetViewModel } from '../SpreadsheetView'\n\nexport default function LaunchSpreadsheetViewF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-SpreadsheetView',\n // @ts-expect-error\n async ({\n session,\n assembly,\n uri,\n fileType,\n }: {\n session: AbstractSessionModel\n assembly: string\n uri: string\n fileType?: string\n }) => {\n const view = session.addView('SpreadsheetView') as SpreadsheetViewModel\n const exts = uri.split('.')\n let ext = exts.pop()?.toUpperCase()\n if (ext === 'GZ') {\n ext = exts.pop()?.toUpperCase()\n }\n\n view.importWizard.setFileType(fileType || ext || '')\n view.importWizard.setSelectedAssemblyName(assembly)\n view.importWizard.setFileSource({\n uri,\n locationType: 'UriLocation',\n })\n await view.importWizard.import(assembly)\n },\n )\n}\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { Grid, FormControlLabel, Checkbox } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\n\n// locals\nimport { SvInspectorViewModel } from '../models/SvInspectorView'\n\nconst useStyles = makeStyles()(theme => ({\n circularViewOptions: {\n padding: theme.spacing(1),\n },\n}))\n\nconst CircularViewOptions = observer(function ({\n svInspector,\n}: {\n svInspector: SvInspectorViewModel\n}) {\n const { classes } = useStyles()\n\n return (\n <Grid\n container\n className={classes.circularViewOptions}\n style={{ height: svInspector.circularViewOptionsBarHeight }}\n >\n <Grid item>\n <FormControlLabel\n control={\n <Checkbox\n checked={svInspector.onlyDisplayRelevantRegionsInCircularView}\n onChange={e => {\n svInspector.setOnlyDisplayRelevantRegionsInCircularView(\n e.target.checked,\n )\n }}\n />\n }\n label=\"show only regions with data\"\n />\n </Grid>\n </Grid>\n )\n})\n\nexport default CircularViewOptions\n","import React from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { ResizeHandle } from '@jbrowse/core/ui'\n\n// locals\nimport { SvInspectorViewModel } from '../models/SvInspectorView'\nimport CircularViewOptions from './CircularViewOptions'\n\nconst useStyles = makeStyles()(theme => ({\n resizeHandleVert: {\n background: theme.palette.action.selected,\n width: 4,\n boxSizing: 'border-box',\n borderTop: '1px solid #fafafa',\n },\n resizeHandleHoriz: {\n background: theme.palette.action.selected,\n height: 4,\n boxSizing: 'border-box',\n borderTop: '1px solid #fafafa',\n },\n viewControls: {\n margin: 0,\n },\n viewsContainer: {\n display: 'flex',\n },\n container: {\n overflow: 'hidden',\n },\n}))\n\nconst SvInspectorView = observer(function ({\n model,\n}: {\n model: SvInspectorViewModel\n}) {\n const { classes } = useStyles()\n\n const {\n SpreadsheetViewReactComponent,\n CircularViewReactComponent,\n showCircularView,\n } = model\n\n return (\n <div className={classes.container}>\n <div className={classes.viewsContainer}>\n <div\n style={{ width: model.spreadsheetView.width }}\n className={classes.container}\n >\n <SpreadsheetViewReactComponent model={model.spreadsheetView} />\n </div>\n\n {showCircularView ? (\n <>\n <ResizeHandle\n onDrag={distance => {\n const ret1 = model.circularView.resizeWidth(-distance)\n return model.spreadsheetView.resizeWidth(-ret1)\n }}\n vertical\n flexbox\n className={classes.resizeHandleVert}\n />\n <div style={{ width: model.circularView.width }}>\n <CircularViewOptions svInspector={model} />\n <CircularViewReactComponent model={model.circularView} />\n </div>\n </>\n ) : null}\n </div>\n <ResizeHandle\n onDrag={model.resizeHeight}\n className={classes.resizeHandleHoriz}\n />\n </div>\n )\n})\n\nexport default SvInspectorView\n","// @ts-nocheck\n// this file contains the rather verbose functions for\n// creating features from CSV/TSV lines\nimport { parseLocString } from '@jbrowse/core/util'\n\nexport function makeAdHocFeature(\n columns,\n columnsAlreadyUsedInLocations,\n row,\n loc1,\n loc2,\n rowNumber,\n) {\n // load all the other data in the row into an `otherData` object\n const otherData = {}\n columns.forEach((column, columnNumber) => {\n if (columnsAlreadyUsedInLocations.includes(columnNumber)) {\n return\n }\n let { text } = row.cells[columnNumber]\n if (column.dataType.type === 'Number') {\n text = Number.parseFloat(text)\n }\n otherData[column.name] = text\n })\n\n // make the final feature data out of otherData + the parsed locations\n return {\n ...otherData,\n uniqueId: `sv-inspector-adhoc-${rowNumber}`,\n refName: loc1.refName,\n start: loc1.start,\n end: loc1.end,\n mate: {\n refName: loc2.refName,\n start: loc2.start,\n end: loc2.end,\n },\n }\n}\n\nexport function makeAdHocSvFeatureFromTwoLocations(\n columns,\n locationColumnNumbers,\n row,\n rowNumber,\n isValidRefName,\n) {\n // use the first two locations we found (first according to *displayed* order)\n const loc1 = parseLocString(\n row.cells[locationColumnNumbers[0]].text,\n isValidRefName,\n )\n const loc2 = parseLocString(\n row.cells[locationColumnNumbers[1]].text,\n isValidRefName,\n )\n\n const columnsAlreadyUsedInLocations = [\n locationColumnNumbers[0],\n locationColumnNumbers[1],\n ]\n\n return makeAdHocFeature(\n columns,\n columnsAlreadyUsedInLocations,\n row,\n loc1,\n loc2,\n rowNumber,\n )\n}\n\nexport function makeAdHocSvFeatureFromTwoRefStartEndSets(\n columns,\n locRefColumnNumbers,\n locStartColumnNumbers,\n locEndColumnNumbers,\n row,\n rowNumber,\n) {\n const textOf = colno => row.cells[colno].text\n const loc1 = {\n refName: textOf(locRefColumnNumbers[0]),\n start: Number.parseInt(textOf(locStartColumnNumbers[0]), 10) - 1,\n end: Number.parseInt(textOf(locEndColumnNumbers[0]), 10),\n }\n const loc2 = {\n refName: textOf(locRefColumnNumbers[1]),\n start: Number.parseInt(textOf(locStartColumnNumbers[1]), 10) - 1,\n end: Number.parseInt(textOf(locEndColumnNumbers[1]), 10),\n }\n const columnsAlreadyUsedInLocations = [\n locRefColumnNumbers[0],\n locStartColumnNumbers[0],\n locEndColumnNumbers[0],\n locRefColumnNumbers[1],\n locStartColumnNumbers[1],\n locEndColumnNumbers[1],\n ]\n return makeAdHocFeature(\n columns,\n columnsAlreadyUsedInLocations,\n row,\n loc1,\n loc2,\n rowNumber,\n )\n}\n\n// makes a feature data object (passed as `data` to a SimpleFeature constructor)\n// out of table row if the row has 2 location columns. undefined if not\nexport function makeAdHocSvFeature(sheet, rowNumber, row, isValidRefName) {\n const { columns, columnDisplayOrder } = sheet\n const columnTypes = {}\n columnDisplayOrder.forEach(columnNumber => {\n const columnDefinition = columns[columnNumber]\n if (!columnTypes[columnDefinition.dataType.type]) {\n columnTypes[columnDefinition.dataType.type] = []\n }\n columnTypes[columnDefinition.dataType.type].push(columnNumber)\n })\n const locationColumnNumbers = columnTypes.LocString || []\n const locStartColumnNumbers = columnTypes.LocStart || []\n const locEndColumnNumbers = columnTypes.LocEnd || []\n const locRefColumnNumbers = columnTypes.LocRef || []\n\n // if we have 2 or more columns of type location, make a feature from them\n if (locationColumnNumbers.length >= 2) {\n return makeAdHocSvFeatureFromTwoLocations(\n columns,\n locationColumnNumbers,\n row,\n rowNumber,\n isValidRefName,\n )\n }\n if (\n locRefColumnNumbers.length >= 2 &&\n locStartColumnNumbers.length >= 2 &&\n locEndColumnNumbers.length >= 2\n ) {\n return makeAdHocSvFeatureFromTwoRefStartEndSets(\n columns,\n locRefColumnNumbers,\n locStartColumnNumbers,\n locEndColumnNumbers,\n row,\n rowNumber,\n )\n }\n return undefined\n}\n","// @ts-nocheck\nimport { SimpleFeature, getEnv, getSession } from '@jbrowse/core/util'\nimport { makeAdHocSvFeature } from './adhocFeatureUtils'\n\nexport function getFeatureForRow(session, spreadsheetView, row, rowNumber) {\n return (\n row.extendedData?.vcfFeature ||\n row.extendedData?.feature ||\n makeAdHocSvFeature(\n spreadsheetView.spreadsheet,\n rowNumber,\n row,\n session.assemblyManager.isValidRefName,\n )\n )\n}\n\nexport function breakpointSplitViewSnapshotFromTableRow(\n svInspectorView,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n) {\n const { pluginManager } = getEnv(svInspectorView)\n const session = getSession(spreadsheetView)\n const featureData = getFeatureForRow(session, spreadsheet, row, rowNumber)\n\n if (featureData) {\n const feature = new SimpleFeature(featureData)\n session.setSelection(feature)\n return pluginManager\n .getViewType('BreakpointSplitView')\n .snapshotFromBreakendFeature(feature, svInspectorView.circularView)\n }\n return undefined\n}\n\nexport function openBreakpointSplitViewFromTableRow(\n svInspectorView,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n) {\n const viewSnapshot = breakpointSplitViewSnapshotFromTableRow(\n svInspectorView,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n )\n if (viewSnapshot) {\n // try to center the offsetPx\n const { circularView } = svInspectorView\n viewSnapshot.views[0].offsetPx -= circularView.width / 2 + 100\n viewSnapshot.views[1].offsetPx -= circularView.width / 2 + 100\n\n const session = getSession(spreadsheetView)\n session.addView('BreakpointSplitView', viewSnapshot)\n }\n}\n\nexport function canOpenBreakpointSplitViewFromTableRow(\n svInspectorView,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n) {\n try {\n return Boolean(\n breakpointSplitViewSnapshotFromTableRow(\n svInspectorView,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n ),\n )\n } catch (e) {\n console.error('Unable to open breakpoint split view from table row', e)\n return false\n }\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport ViewType from '@jbrowse/core/pluggableElementTypes/ViewType'\n\nimport ReactComponent from './components/SvInspectorView'\nimport stateModelFactory from './models/SvInspectorView'\nimport { Feature, getContainingView, getSession } from '@jbrowse/core/util'\nimport { IAnyStateTreeNode } from 'mobx-state-tree'\nimport BreakpointSplitViewType from '@jbrowse/plugin-breakpoint-split-view/src/BreakpointSplitView/BreakpointSplitView'\nimport { CircularViewModel } from '@jbrowse/plugin-circular-view'\n\nfunction defaultOnChordClick(\n feature: Feature,\n chordTrack: IAnyStateTreeNode,\n pluginManager: PluginManager,\n) {\n const session = getSession(chordTrack)\n session.setSelection(feature)\n const view = getContainingView(chordTrack) as CircularViewModel\n const viewType = pluginManager.getViewType(\n 'BreakpointSplitView',\n ) as BreakpointSplitViewType\n const viewSnapshot = viewType.snapshotFromBreakendFeature(feature, view)\n\n // try to center the offsetPx\n viewSnapshot.views[0]!.offsetPx -= view.width / 2 + 100\n viewSnapshot.views[1]!.offsetPx -= view.width / 2 + 100\n\n session.addView('BreakpointSplitView', viewSnapshot)\n}\n\nexport default function SvInspectorViewF(pluginManager: PluginManager) {\n pluginManager.jexl.addFunction('defaultOnChordClick', defaultOnChordClick)\n\n pluginManager.addViewType(() => {\n const stateModel = stateModelFactory(pluginManager)\n return new ViewType({\n name: 'SvInspectorView',\n displayName: 'SV inspector',\n stateModel,\n ReactComponent,\n })\n })\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport Plugin from '@jbrowse/core/Plugin'\nimport {\n AbstractSessionModel,\n isAbstractMenuManager,\n} from '@jbrowse/core/util/types'\n\n// icons\nimport TableChartIcon from '@mui/icons-material/TableChart'\n\n// locals\nimport SvInspectorViewF from './SvInspectorView'\nimport LaunchSvInspectorViewF from './LaunchSvInspectorView'\n\nexport default class SvInspectorViewPlugin extends Plugin {\n name = 'SvInspectorViewPlugin'\n\n install(pluginManager: PluginManager) {\n SvInspectorViewF(pluginManager)\n LaunchSvInspectorViewF(pluginManager)\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToSubMenu(['Add'], {\n label: 'SV inspector',\n icon: TableChartIcon,\n onClick: (session: AbstractSessionModel) => {\n session.addView('SvInspectorView', {})\n },\n })\n }\n }\n}\n","import clone from 'clone'\nimport { autorun, reaction } from 'mobx'\nimport { types, addDisposer, Instance } from 'mobx-state-tree'\n\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getSession, Region } from '@jbrowse/core/util'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { ElementId } from '@jbrowse/core/util/types/mst'\nimport { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport { SpreadsheetViewStateModel } from '@jbrowse/plugin-spreadsheet-view'\nimport { CircularViewStateModel } from '@jbrowse/plugin-circular-view'\n\n// icons\nimport OpenInNewIcon from '@mui/icons-material/OpenInNew'\nimport FolderOpenIcon from '@mui/icons-material/FolderOpen'\n\n// locals\nimport {\n canOpenBreakpointSplitViewFromTableRow,\n openBreakpointSplitViewFromTableRow,\n getFeatureForRow,\n} from './breakpointSplitViewFromTableRow'\n\n/**\n * #stateModel SvInspectorView\n * #category view\n * does not extend, but is a combination of a\n * - [SpreadsheetView](../spreadsheetview)\n * - [CircularView](../circularview)\n *\n * extends\n * - [BaseViewModel](../baseviewmodel)\n */\nfunction SvInspectorViewF(pluginManager: PluginManager) {\n const SpreadsheetViewType = pluginManager.getViewType('SpreadsheetView')!\n const CircularViewType = pluginManager.getViewType('CircularView')!\n\n const SpreadsheetModel =\n SpreadsheetViewType.stateModel as SpreadsheetViewStateModel\n const CircularModel = CircularViewType.stateModel as CircularViewStateModel\n\n const minHeight = 400\n const defaultHeight = 550\n const headerHeight = 52\n const circularViewOptionsBarHeight = 52\n return types\n .compose(\n 'SvInspectorView',\n BaseViewModel,\n types.model({\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('SvInspectorView'),\n\n /**\n * #property\n */\n height: types.optional(\n types.refinement(\n 'SvInspectorViewHeight',\n types.number,\n n => n >= minHeight,\n ),\n defaultHeight,\n ),\n /**\n * #property\n */\n onlyDisplayRelevantRegionsInCircularView: false,\n /**\n * #property\n * switch specifying whether we are showing the import wizard or the\n * spreadsheet in our viewing area\n */\n mode: types.optional(\n types.enumeration('SvInspectorViewMode', ['import', 'display']),\n 'import',\n ),\n /**\n * #property\n */\n spreadsheetView: types.optional(SpreadsheetModel, () =>\n SpreadsheetModel.create({\n type: 'SpreadsheetView',\n hideVerticalResizeHandle: true,\n }),\n ),\n /**\n * #property\n */\n circularView: types.optional(CircularModel, () =>\n CircularModel.create({\n type: 'CircularView',\n hideVerticalResizeHandle: true,\n hideTrackSelectorButton: true,\n disableImportForm: true,\n }),\n ),\n }),\n )\n .volatile(() => ({\n width: 800,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get selectedRows() {\n return self.spreadsheetView.spreadsheet?.rowSet.selectedRows\n },\n /**\n * #getter\n */\n get assemblyName() {\n const { assembly } = self.spreadsheetView\n return assembly\n ? (readConfObject(assembly, 'name') as string)\n : undefined\n },\n /**\n * #getter\n */\n get showCircularView() {\n return self.spreadsheetView.mode === 'display'\n },\n\n /**\n * #getter\n */\n get features() {\n const session = getSession(self)\n const { spreadsheetView } = self\n const { outputRows = [] } = spreadsheetView\n return outputRows\n .map((r, i) => getFeatureForRow(session, spreadsheetView, r, i))\n .filter(f => !!f)\n },\n /**\n * #getter\n */\n get featuresAdapterConfigSnapshot() {\n return {\n type: 'FromConfigAdapter',\n features: this.features,\n }\n },\n /**\n * #getter\n */\n get featureRefNames() {\n const refs = this.features.map(r => r.refName)\n const CHR2 = this.features.flatMap(r => r.INFO?.CHR2).filter(f => !!f)\n return [...refs, ...CHR2]\n },\n /**\n * #getter\n */\n get featuresCircularTrackConfiguration() {\n return {\n type: 'VariantTrack',\n trackId: `sv-inspector-variant-track-${self.id}`,\n name: 'features from tabular data',\n adapter: this.featuresAdapterConfigSnapshot,\n assemblyNames: [this.assemblyName],\n displays: [\n {\n type: 'ChordVariantDisplay',\n displayId: `sv-inspector-variant-track-chord-display-${self.id}`,\n onChordClick:\n 'jexl:defaultOnChordClick(feature, track, pluginManager)',\n renderer: { type: 'StructuralVariantChordRenderer' },\n },\n ],\n }\n },\n }))\n .volatile(() => ({\n SpreadsheetViewReactComponent: SpreadsheetViewType.ReactComponent,\n CircularViewReactComponent: CircularViewType.ReactComponent,\n circularViewOptionsBarHeight,\n }))\n .actions(self => ({\n /**\n * #action\n */\n setWidth(newWidth: number) {\n self.width = newWidth\n },\n /**\n * #action\n */\n setHeight(newHeight: number) {\n self.height = newHeight > minHeight ? newHeight : minHeight\n return self.height\n },\n /**\n * #action\n */\n setImportMode() {\n self.spreadsheetView.setImportMode()\n },\n /**\n * #action\n */\n setDisplayMode() {\n self.spreadsheetView.setDisplayMode()\n },\n\n /**\n * #action\n */\n setDisplayedRegions(regions: Region[]) {\n self.circularView.setDisplayedRegions(regions)\n },\n /**\n * #action\n */\n setOnlyDisplayRelevantRegionsInCircularView(val: boolean) {\n self.onlyDisplayRelevantRegionsInCircularView = Boolean(val)\n },\n }))\n .views(self => ({\n /**\n * #method\n */\n menuItems() {\n return [\n {\n label: 'Return to import form',\n onClick: () => {\n self.setImportMode()\n },\n icon: FolderOpenIcon,\n },\n ]\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n resizeHeight(distance: number) {\n const oldHeight = self.height\n const newHeight = self.setHeight(self.height + distance)\n return newHeight - oldHeight\n },\n afterAttach() {\n // synchronize subview widths\n addDisposer(\n self,\n autorun(\n () => {\n const borderWidth = 1\n if (self.showCircularView) {\n const spreadsheetWidth = Math.round(self.width * 0.66)\n const circularViewWidth = self.width - spreadsheetWidth\n self.spreadsheetView.setWidth(spreadsheetWidth - borderWidth)\n self.circularView.setWidth(circularViewWidth)\n } else {\n self.spreadsheetView.setWidth(self.width)\n }\n },\n { name: 'SvInspectorView width binding' },\n ),\n )\n // synchronize subview heights\n addDisposer(\n self,\n autorun(\n () => {\n self.spreadsheetView.setHeight(self.height - headerHeight)\n self.circularView.setHeight(\n self.height - headerHeight - circularViewOptionsBarHeight,\n )\n },\n { name: 'SvInspectorView height binding' },\n ),\n )\n\n // bind circularview displayedRegions to spreadsheet assembly, mediated\n // by the onlyRelevantRegions toggle\n addDisposer(\n self,\n autorun(\n async () => {\n const {\n assemblyName,\n onlyDisplayRelevantRegionsInCircularView,\n circularView,\n featureRefNames,\n } = self\n const { tracks } = circularView\n const { assemblyManager } = getSession(self)\n if (!assemblyName) {\n return\n }\n const asm = await assemblyManager.waitForAssembly(assemblyName)\n if (!asm) {\n return\n }\n\n const { getCanonicalRefName, regions = [] } = asm\n if (onlyDisplayRelevantRegionsInCircularView) {\n if (tracks.length === 1) {\n try {\n // canonicalize the store's ref names if necessary\n const refSet = new Set(\n featureRefNames.map(r => getCanonicalRefName(r) || r),\n )\n\n circularView.setDisplayedRegions(\n clone(regions.filter(r => refSet.has(r.refName))),\n )\n } catch (e) {\n circularView.setError(e)\n }\n }\n } else {\n circularView.setDisplayedRegions(regions)\n }\n },\n { name: 'SvInspectorView displayed regions bind' },\n ),\n )\n\n // bind circularview tracks to our track snapshot view\n addDisposer(\n self,\n reaction(\n () => ({\n generatedTrackConf: self.featuresCircularTrackConfiguration,\n assemblyName: self.assemblyName,\n }),\n data => {\n const { assemblyName, generatedTrackConf } = data\n const { circularView } = self\n // hide any visible tracks\n circularView.tracks.forEach(t =>\n circularView.hideTrack(t.configuration.trackId),\n )\n\n // put our track in as the only track\n if (assemblyName) {\n // @ts-expect-error\n circularView.addTrackConf(generatedTrackConf, {\n assemblyName,\n })\n }\n },\n {\n name: 'SvInspectorView track configuration binding',\n fireImmediately: true,\n },\n ),\n )\n\n // bind spreadsheetView row menu actions to us\n addDisposer(\n self,\n autorun(() => {\n self.spreadsheetView.setRowMenuItems(\n // these are the MenuItem entries for the row menu actions in the\n // spreadsheet view. these are installed into the child\n // SpreadsheetView using an autorun below\n [\n {\n label: 'Open split detail view',\n icon: OpenInNewIcon,\n // @ts-expect-error\n disabled(spreadsheetView, spreadsheet, rowNumber, row) {\n return !canOpenBreakpointSplitViewFromTableRow(\n self,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n )\n },\n\n onClick(spreadsheetView, spreadsheet, rowNumber, row) {\n openBreakpointSplitViewFromTableRow(\n self,\n spreadsheetView,\n spreadsheet,\n row,\n rowNumber,\n )\n },\n },\n ],\n )\n }),\n )\n },\n }))\n}\n\nexport type SvInspectorViewStateModel = ReturnType<typeof SvInspectorViewF>\nexport type SvInspectorViewModel = Instance<SvInspectorViewStateModel>\n\nexport default SvInspectorViewF\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport { AbstractSessionModel } from '@jbrowse/core/util'\nimport { SvInspectorViewModel } from '../SvInspectorView/models/SvInspectorView'\n\nexport default function LaunchSvInspectorViewF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LaunchView-SvInspectorView',\n // @ts-expect-error\n async ({\n session,\n assembly,\n uri,\n fileType,\n }: {\n session: AbstractSessionModel\n assembly: string\n uri: string\n fileType?: string\n }) => {\n const view = session.addView('SvInspectorView') as SvInspectorViewModel\n const exts = uri.split('.')\n let ext = exts.pop()?.toUpperCase()\n if (ext === 'GZ') {\n ext = exts.pop()?.toUpperCase()\n }\n\n view.spreadsheetView.importWizard.setFileType(fileType || ext || '')\n view.spreadsheetView.importWizard.setSelectedAssemblyName(assembly)\n view.spreadsheetView.importWizard.setFileSource({\n uri,\n locationType: 'UriLocation',\n })\n await view.spreadsheetView.importWizard.import(assembly)\n },\n )\n}\n","import React from 'react'\nimport { Region } from '@jbrowse/core/util/types'\nimport { PrerenderedCanvas } from '@jbrowse/core/ui'\nimport { observer } from 'mobx-react'\n\nconst HicRendering = observer(function HicRendering(props: {\n blockKey: string\n width: number\n height: number\n regions: Region[]\n bpPerPx: number\n}) {\n const { width, height } = props\n const canvasWidth = Math.ceil(width)\n // need to call this in render so we get the right observer behavior\n return (\n <div style={{ position: 'relative', width: canvasWidth, height }}>\n <PrerenderedCanvas\n {...props}\n style={{ position: 'absolute', left: 0, top: 0 }}\n />\n </div>\n )\n})\n\nexport default HicRendering\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config HicRenderer\n * #category renderer\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst HicRenderer = ConfigurationSchema(\n 'HicRenderer',\n {\n /**\n * #slot\n */\n baseColor: {\n type: 'color',\n description: 'base color to be used in the hic alignment',\n defaultValue: '#f00',\n },\n /**\n * #slot\n */\n color: {\n type: 'color',\n description: 'the color of each feature in a hic alignment',\n defaultValue: 'jexl:interpolate(count,scale)',\n contextVariable: ['count', 'maxScore', 'baseColor', 'scale'],\n },\n\n /**\n * #slot\n */\n maxHeight: {\n type: 'integer',\n description: 'the maximum height to be used in a hic rendering',\n defaultValue: 600,\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default HicRenderer\n","import ServerSideRendererType, {\n RenderArgs as ServerSideRenderArgs,\n RenderArgsDeserialized as ServerSideRenderArgsDeserialized,\n ResultsSerialized as ServerSideResultsSerialized,\n ResultsDeserialized as ServerSideResultsDeserialized,\n} from '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType'\nimport { Region } from '@jbrowse/core/util/types'\nimport { renderToAbstractCanvas } from '@jbrowse/core/util/offscreenCanvasUtils'\nimport { toArray } from 'rxjs/operators'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration'\nimport { firstValueFrom } from 'rxjs'\n\ninterface HicFeature {\n bin1: number\n bin2: number\n counts: number\n}\n\ninterface HicDataAdapter extends BaseFeatureDataAdapter {\n getResolution: (bp: number) => Promise<number>\n}\n\nexport interface RenderArgs extends ServerSideRenderArgs {\n regions: Region[]\n}\n\nexport interface RenderArgsDeserialized\n extends ServerSideRenderArgsDeserialized {\n regions: Region[]\n dataAdapter: HicDataAdapter\n bpPerPx: number\n highResolutionScaling: number\n resolution: number\n adapterConfig: AnyConfigurationModel\n}\n\nexport interface RenderArgsDeserializedWithFeatures\n extends RenderArgsDeserialized {\n features: HicFeature[]\n}\n\nexport type ResultsSerialized = ServerSideResultsSerialized\n\nexport type ResultsDeserialized = ServerSideResultsDeserialized\n\nexport default class HicRenderer extends ServerSideRendererType {\n supportsSVG = true\n\n async render(renderProps: RenderArgsDeserialized) {\n const { config, regions, bpPerPx } = renderProps\n const region = regions[0]!\n const width = (region.end - region.start) / bpPerPx\n const height = readConfObject(config, 'maxHeight')\n const features = await this.getFeatures(renderProps)\n\n const { makeImageData } = await import('./makeImageData')\n const res = await renderToAbstractCanvas(width, height, renderProps, ctx =>\n makeImageData(ctx, {\n ...renderProps,\n features,\n pluginManager: this.pluginManager,\n }),\n )\n const results = await super.render({\n ...renderProps,\n ...res,\n features,\n region: renderProps.regions[0],\n height,\n width,\n })\n\n return {\n ...results,\n ...res,\n height,\n width,\n }\n }\n\n async getFeatures(args: RenderArgsDeserialized) {\n const { regions, sessionId, adapterConfig } = args\n const { dataAdapter } = await getAdapter(\n this.pluginManager,\n sessionId,\n adapterConfig,\n )\n const features = await firstValueFrom(\n (dataAdapter as BaseFeatureDataAdapter)\n .getFeatures(regions[0]!, args)\n .pipe(toArray()),\n )\n // cast to any to avoid return-type conflict, because the\n // types of features returned by our getFeatures are quite\n // different from the base interface\n\n return features as any\n }\n}\n\nexport {\n type RenderArgsSerialized,\n type RenderResults,\n} from '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType'\n","import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'\nimport { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view'\nimport { types, getEnv } from 'mobx-state-tree'\nimport { AnyConfigurationSchemaType } from '@jbrowse/core/configuration'\n\n/**\n * #stateModel LinearHicDisplay\n * #category display\n * extends `BaseLinearDisplay`\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nexport default function stateModelFactory(\n configSchema: AnyConfigurationSchemaType,\n) {\n return types\n .compose(\n 'LinearHicDisplay',\n BaseLinearDisplay,\n types.model({\n /**\n * #property\n */\n type: types.literal('LinearHicDisplay'),\n /**\n * #property\n */\n configuration: ConfigurationReference(configSchema),\n /**\n * #property\n */\n resolution: types.optional(types.number, 1),\n /**\n * #property\n */\n useLogScale: false,\n /**\n * #property\n */\n colorScheme: types.maybe(types.string),\n }),\n )\n .views(self => {\n const { renderProps: superRenderProps } = self\n return {\n /**\n * #getter\n */\n get blockType() {\n return 'dynamicBlocks'\n },\n /**\n * #getter\n */\n get rendererTypeName() {\n return 'HicRenderer'\n },\n /**\n * #method\n */\n renderProps() {\n const config = self.rendererType.configSchema.create(\n {\n ...getConf(self, 'renderer'),\n\n // add specific jexl color callback when using pre-defined color schemes\n ...(self.colorScheme\n ? { color: 'jexl:interpolate(count,scale)' }\n : {}),\n },\n getEnv(self),\n )\n\n return {\n ...superRenderProps(),\n config,\n rpcDriverName: self.rpcDriverName,\n displayModel: self,\n resolution: self.resolution,\n useLogScale: self.useLogScale,\n colorScheme: self.colorScheme,\n }\n },\n }\n })\n .actions(self => ({\n /**\n * #action\n */\n setResolution(n: number) {\n self.resolution = n\n },\n /**\n * #action\n */\n setUseLogScale(f: boolean) {\n self.useLogScale = f\n },\n /**\n * #action\n */\n setColorScheme(f?: string) {\n self.colorScheme = f\n },\n }))\n .views(self => {\n const { trackMenuItems: superTrackMenuItems } = self\n return {\n /**\n * #getter\n */\n trackMenuItems() {\n return [\n ...superTrackMenuItems(),\n {\n label: 'Use log scale',\n type: 'checkbox',\n checked: self.useLogScale,\n onClick: () => {\n self.setUseLogScale(!self.useLogScale)\n },\n },\n {\n label: 'Color scheme',\n type: 'subMenu',\n subMenu: [\n {\n label: 'Fall',\n onClick: () => {\n self.setColorScheme('fall')\n },\n },\n {\n label: 'Viridis',\n onClick: () => {\n self.setColorScheme('viridis')\n },\n },\n {\n label: 'Juicebox',\n onClick: () => {\n self.setColorScheme('juicebox')\n },\n },\n {\n label: 'Clear',\n onClick: () => {\n self.setColorScheme(undefined)\n },\n },\n ],\n },\n {\n label: 'Resolution',\n subMenu: [\n {\n label: 'Finer resolution',\n onClick: () => {\n self.setResolution(self.resolution * 2)\n },\n },\n {\n label: 'Coarser resolution',\n onClick: () => {\n self.setResolution(self.resolution / 2)\n },\n },\n ],\n },\n ]\n },\n }\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config HicAdapter\n * #category adapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst HicAdapter = ConfigurationSchema(\n 'HicAdapter',\n {\n /**\n * #slot\n */\n hicLocation: {\n type: 'fileLocation',\n defaultValue: {\n uri: '/path/to/my.hic',\n locationType: 'UriLocation',\n },\n },\n },\n { explicitlyTyped: true },\n)\n\nexport default HicAdapter\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { FileLocation } from '@jbrowse/core/util/types'\nimport { colord, Colord } from '@jbrowse/core/util/colord'\nimport {\n getFileName,\n AdapterGuesser,\n TrackTypeGuesser,\n} from '@jbrowse/core/util/tracks'\n\n// locals\nimport HicRendererF from './HicRenderer'\nimport HicTrackF from './HicTrack'\nimport LinearHicDisplayF from './LinearHicDisplay'\nimport HicAdapterF from './HicAdapter'\n\nexport default class HicPlugin extends Plugin {\n name = 'HicPlugin'\n\n install(pluginManager: PluginManager) {\n HicAdapterF(pluginManager)\n HicRendererF(pluginManager)\n HicTrackF(pluginManager)\n LinearHicDisplayF(pluginManager)\n\n pluginManager.addToExtensionPoint(\n 'Core-guessAdapterForLocation',\n (adapterGuesser: AdapterGuesser) => {\n return (\n file: FileLocation,\n index?: FileLocation,\n adapterHint?: string,\n ) => {\n const regexGuess = /\\.hic/i\n const adapterName = 'HicAdapter'\n const fileName = getFileName(file)\n const obj = {\n type: adapterName,\n hicLocation: file,\n }\n\n if (regexGuess.test(fileName) && !adapterHint) {\n return obj\n } else if (adapterHint === adapterName) {\n return obj\n } else {\n return adapterGuesser(file, index, adapterHint)\n }\n }\n },\n )\n pluginManager.addToExtensionPoint(\n 'Core-guessTrackTypeForLocation',\n (trackTypeGuesser: TrackTypeGuesser) => {\n return (adapterName: string) =>\n adapterName === 'HicAdapter'\n ? 'HicTrack'\n : trackTypeGuesser(adapterName)\n },\n )\n }\n\n configure(pluginManager: PluginManager) {\n const { jexl } = pluginManager\n jexl.addFunction('alpha', (color: Colord, n: number) => color.alpha(n))\n jexl.addFunction('hsl', (color: Colord) => colord(color.toHsl()))\n jexl.addFunction('colorString', (color: Colord) => color.toHex())\n jexl.addFunction(\n 'interpolate',\n (count: number, scale: (n: number) => string) => scale(count),\n )\n }\n}\n","import { AdapterType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './configSchema'\n\nexport default function HicAdapterF(pluginManager: PluginManager) {\n pluginManager.addAdapterType(\n () =>\n new AdapterType({\n name: 'HicAdapter',\n displayName: 'Hi-C adapter',\n configSchema,\n getAdapterClass: () => import('./HicAdapter').then(r => r.default),\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\n\nimport ReactComponent from './components/HicRendering'\nimport configSchema from './configSchema'\nimport HicRenderer from './HicRenderer'\n\nexport default function HicRendererF(pluginManager: PluginManager) {\n pluginManager.addRendererType(\n () =>\n new HicRenderer({\n name: 'HicRenderer',\n ReactComponent,\n configSchema,\n pluginManager,\n }),\n )\n}\n","import PluginManager from '@jbrowse/core/PluginManager'\nimport TrackType from '@jbrowse/core/pluggableElementTypes/TrackType'\nimport { createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models'\nimport configSchemaF from './configSchema'\n\nexport default function HicTrackF(pluginManager: PluginManager) {\n pluginManager.addTrackType(() => {\n const configSchema = configSchemaF(pluginManager)\n return new TrackType({\n name: 'HicTrack',\n displayName: 'Hi-C track',\n configSchema,\n stateModel: createBaseTrackModel(pluginManager, 'HicTrack', configSchema),\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config HicTrack\n * #category track\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst configSchema = (pluginManager: PluginManager) =>\n ConfigurationSchema(\n 'HicTrack',\n {},\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: createBaseTrackConfig(pluginManager),\n },\n )\n\nexport default configSchema\n","import { DisplayType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view'\n\nimport configSchemaFactory from './configSchema'\nimport stateModelFactory from './model'\n\nexport default function LinearHicDisplayF(pluginManager: PluginManager) {\n pluginManager.addDisplayType(() => {\n const configSchema = configSchemaFactory(pluginManager)\n return new DisplayType({\n name: 'LinearHicDisplay',\n displayName: 'Hi-C contact matrix display',\n configSchema,\n stateModel: stateModelFactory(configSchema),\n trackType: 'HicTrack',\n viewType: 'LinearGenomeView',\n ReactComponent: BaseLinearDisplayComponent,\n })\n })\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view'\nimport { Instance } from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n/**\n * #config LinearHicDisplay\n * #category display\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst HicTrackConfigFactory = (pluginManager: PluginManager) => {\n return ConfigurationSchema(\n 'LinearHicDisplay',\n {\n /**\n * #slot\n */\n renderer: pluginManager.getRendererType('HicRenderer')!.configSchema,\n },\n {\n /**\n * #baseConfiguration\n */\n baseConfiguration: baseLinearDisplayConfigSchema,\n explicitlyTyped: true,\n },\n )\n}\n\nexport type HicTrackConfigModel = ReturnType<typeof HicTrackConfigFactory>\nexport type HicTrackConfig = Instance<HicTrackConfigModel>\nexport default HicTrackConfigFactory\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\n/**\n * #config TrixTextSearchAdapter\n */\nfunction x() {} // eslint-disable-line @typescript-eslint/no-unused-vars\n\nconst TrixTextSearchAdapter = ConfigurationSchema(\n 'TrixTextSearchAdapter',\n {\n /**\n * #slot\n */\n ixFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ix', locationType: 'UriLocation' },\n description: 'the location of the trix ix file',\n },\n /**\n * #slot\n */\n ixxFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ixx', locationType: 'UriLocation' },\n description: 'the location of the trix ixx file',\n },\n /**\n * #slot\n */\n metaFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'meta.json', locationType: 'UriLocation' },\n description: 'the location of the metadata json file for the trix index',\n },\n /**\n * #slot\n */\n tracks: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of tracks covered by text search adapter',\n },\n /**\n * #slot\n */\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of assemblies covered by text search adapter',\n },\n },\n {\n explicitlyTyped: true,\n /**\n * #identifier\n */\n explicitIdentifier: 'textSearchAdapterId',\n },\n)\n\nexport default TrixTextSearchAdapter\n","import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport configSchema from './TrixTextSearchAdapter/configSchema'\n\nexport default class TrixPlugin extends Plugin {\n name = 'TrixPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addTextSearchAdapterType(() => {\n return new TextSearchAdapterType({\n name: 'TrixTextSearchAdapter',\n displayName: 'Trix text search adapter',\n configSchema,\n description: 'Trix text search adapter',\n getAdapterClass: () =>\n import('./TrixTextSearchAdapter/TrixTextSearchAdapter').then(\n d => d.default,\n ),\n })\n })\n }\n}\n","import {\n types,\n cast,\n Instance,\n SnapshotIn,\n IMSTArray,\n addDisposer,\n} from 'mobx-state-tree'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { Region } from '@jbrowse/core/util/types'\nimport { Region as RegionModel, ElementId } from '@jbrowse/core/util/types/mst'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\n\nimport {\n getSession,\n localStorageGetItem,\n localStorageSetItem,\n} from '@jbrowse/core/util'\nimport { autorun } from 'mobx'\n\nconst LabeledRegionModel = types\n .compose(\n RegionModel,\n types.model('Label', {\n label: types.optional(types.string, ''),\n highlight: types.optional(types.string, 'rgba(247, 129, 192, 0.35)'),\n }),\n )\n .actions(self => ({\n setLabel(label: string) {\n self.label = label\n },\n setHighlight(color: string) {\n self.highlight = color\n },\n }))\n\nconst SharedBookmarksModel = types.model('SharedBookmarksModel', {\n sharedBookmarks: types.maybe(types.array(LabeledRegionModel)),\n})\n\nexport interface IExtendedLGV extends LinearGenomeViewModel {\n showBookmarkHighlights: boolean\n showBookmarkLabels: boolean\n toggleShowBookmarkHighlights: (arg: boolean) => void\n toggleShowBookmarkLabels: (arg: boolean) => void\n}\n\nexport interface ILabeledRegionModel\n extends SnapshotIn<typeof LabeledRegionModel> {\n refName: string\n start: number\n end: number\n reversed: boolean\n highlight: string\n assemblyName: string\n label: string\n setRefName: (newRefName: string) => void\n setLabel: (label: string) => void\n setHighlight: (color: string) => void\n}\n\nexport interface IExtendedLabeledRegionModel extends ILabeledRegionModel {\n id: number\n correspondingObj: ILabeledRegionModel\n}\n\nconst localStorageKeyF = () =>\n typeof window !== 'undefined'\n ? `bookmarks-${[window.location.host + window.location.pathname].join('-')}`\n : 'empty'\n\n/**\n * #stateModel GridBookmarkWidgetModel\n */\nexport default function f(_pluginManager: PluginManager) {\n return types\n .model('GridBookmarkModel', {\n /**\n * #property\n */\n id: ElementId,\n /**\n * #property\n */\n type: types.literal('GridBookmarkWidget'),\n /**\n * #property\n * removed by postProcessSnapshot, only loaded from localStorage\n */\n bookmarks: types.optional(types.array(LabeledRegionModel), () =>\n JSON.parse(localStorageGetItem(localStorageKeyF()) || '[]'),\n ),\n })\n .volatile(() => ({\n selectedBookmarks: [] as IExtendedLabeledRegionModel[],\n selectedAssembliesPre: undefined as string[] | undefined,\n }))\n .views(self => ({\n /**\n * #getter\n */\n get bookmarkAssemblies() {\n return [...new Set(self.bookmarks.map(r => r.assemblyName))]\n },\n /**\n * #getter\n */\n get validAssemblies() {\n const { assemblyManager } = getSession(self)\n return new Set(\n this.bookmarkAssemblies.filter(a => assemblyManager.get(a)),\n )\n },\n /**\n * #getter\n */\n get areBookmarksHighlightedOnAllOpenViews() {\n const { views } = getSession(self)\n return views.every(v =>\n 'showBookmarkHighlights' in v ? v.showBookmarkHighlights : true,\n )\n },\n /**\n * #getter\n */\n get areBookmarksHighlightLabelsOnAllOpenViews() {\n const { views } = getSession(self)\n return views.every(v =>\n 'showBookmarkLabels' in v ? v.showBookmarkLabels : true,\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get bookmarksWithValidAssemblies() {\n return self.bookmarks.filter(e =>\n self.validAssemblies.has(e.assemblyName),\n )\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get sharedBookmarksModel() {\n // requires cloning bookmarks with JSON.stringify/parse to avoid duplicate\n // reference to same object in the same state tree, will otherwise error\n // when performing share\n return SharedBookmarksModel.create({\n sharedBookmarks: JSON.parse(JSON.stringify(self.selectedBookmarks)),\n })\n },\n /**\n * #getter\n */\n get allBookmarksModel() {\n // requires cloning bookmarks with JSON.stringify/parse to avoid duplicate\n // reference to same object in the same state tree, will otherwise error\n // when performing share\n return SharedBookmarksModel.create({\n sharedBookmarks: JSON.parse(\n JSON.stringify(self.bookmarksWithValidAssemblies),\n ),\n })\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n setSelectedAssemblies(assemblies?: string[]) {\n self.selectedAssembliesPre = assemblies\n },\n }))\n .views(self => ({\n /**\n * #getter\n */\n get selectedAssemblies() {\n return (\n self.selectedAssembliesPre?.filter(f =>\n self.validAssemblies.has(f),\n ) ?? [...self.validAssemblies]\n )\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n importBookmarks(regions: Region[]) {\n self.bookmarks = cast([...self.bookmarks, ...regions])\n },\n /**\n * #action\n */\n addBookmark(region: Region) {\n self.bookmarks.push(region)\n },\n /**\n * #action\n */\n removeBookmark(index: number) {\n self.bookmarks.splice(index, 1)\n },\n /**\n * #action\n */\n updateBookmarkLabel(\n bookmark: IExtendedLabeledRegionModel,\n label: string,\n ) {\n bookmark.correspondingObj.setLabel(label)\n },\n /**\n * #action\n */\n updateBookmarkHighlight(\n bookmark: IExtendedLabeledRegionModel,\n color: string,\n ) {\n bookmark.correspondingObj.setHighlight(color)\n },\n /**\n * #action\n */\n updateBulkBookmarkHighlights(color: string) {\n self.selectedBookmarks.forEach(bookmark => {\n this.updateBookmarkHighlight(bookmark, color)\n })\n },\n /**\n * #action\n */\n setSelectedBookmarks(bookmarks: IExtendedLabeledRegionModel[]) {\n self.selectedBookmarks = bookmarks\n },\n /**\n * #action\n */\n setBookmarkedRegions(regions: IMSTArray<typeof LabeledRegionModel>) {\n self.bookmarks = cast(regions)\n },\n /**\n * #action\n */\n setHighlightToggle(toggle: boolean) {\n const { views } = getSession(self)\n views.forEach(view => {\n // @ts-expect-error\n view.toggleShowBookmarkHighlights?.(toggle)\n })\n },\n /**\n * #action\n */\n setLabelToggle(toggle: boolean) {\n const { views } = getSession(self)\n views.forEach(view => {\n // @ts-expect-error\n view.toggleShowBookmarkLabels?.(toggle)\n })\n },\n }))\n .actions(self => ({\n /**\n * #action\n */\n clearAllBookmarks() {\n self.setBookmarkedRegions(\n self.bookmarks.filter(\n bookmark => !self.validAssemblies.has(bookmark.assemblyName),\n ) as IMSTArray<typeof LabeledRegionModel>,\n )\n },\n /**\n * #action\n */\n clearSelectedBookmarks() {\n for (const bookmark of self.selectedBookmarks) {\n self.bookmarks.remove(bookmark.correspondingObj)\n }\n self.selectedBookmarks = []\n },\n\n removeBookmarkObject(arg: Instance<typeof LabeledRegionModel>) {\n self.bookmarks.remove(arg)\n },\n }))\n .actions(self => ({\n afterAttach() {\n const key = localStorageKeyF()\n function handler(e: StorageEvent) {\n if (e.key === key) {\n const localStorage = JSON.parse(localStorageGetItem(key) || '[]')\n self.setBookmarkedRegions(localStorage)\n }\n }\n window.addEventListener('storage', handler)\n addDisposer(self, () => {\n window.removeEventListener('storage', handler)\n })\n addDisposer(\n self,\n autorun(() => {\n localStorageSetItem(key, JSON.stringify(self.bookmarks))\n }),\n )\n },\n }))\n .postProcessSnapshot(snap => {\n const { bookmarks: _, ...rest } = snap as Omit<typeof snap, symbol>\n return rest\n })\n}\n\nexport type GridBookmarkStateModel = ReturnType<typeof f>\nexport type GridBookmarkModel = Instance<GridBookmarkStateModel>\n","import React, { useEffect } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { SessionWithWidgets, getSession, notEmpty } from '@jbrowse/core/util'\nimport { colord } from '@jbrowse/core/util/colord'\nimport { Tooltip } from '@mui/material'\nimport CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'\n\n// icons\nimport BookmarkIcon from '@mui/icons-material/Bookmark'\n\n// locals\nimport { GridBookmarkModel } from '../../model'\nimport { IExtendedLGV } from '../../model'\n\ntype LGV = IExtendedLGV\n\nconst useStyles = makeStyles()({\n highlight: {\n // when the highlight is small, overflow:hidden makes the icon/indicators\n // invisible\n overflow: 'hidden',\n height: '100%',\n position: 'absolute',\n zIndex: 100,\n pointerEvents: 'none',\n },\n highlightButton: {\n // re-enable pointerEvents on the button\n pointerEvents: 'auto',\n },\n})\n\nconst Highlight = observer(function Highlight({ model }: { model: LGV }) {\n const { classes } = useStyles()\n const session = getSession(model) as SessionWithWidgets\n const { assemblyManager } = session\n const { showBookmarkHighlights, showBookmarkLabels } = model\n\n const bookmarkWidget = session.widgets.get('GridBookmark') as\n | GridBookmarkModel\n | undefined\n\n useEffect(() => {\n if (!bookmarkWidget) {\n session.addWidget('GridBookmarkWidget', 'GridBookmark')\n }\n }, [session, bookmarkWidget])\n\n const set = new Set(model.assemblyNames)\n\n return showBookmarkHighlights && bookmarkWidget?.bookmarks\n ? bookmarkWidget.bookmarks\n .filter(value => set.has(value.assemblyName))\n .map(r => {\n const asm = assemblyManager.get(r.assemblyName)\n const refName = asm?.getCanonicalRefName(r.refName) ?? r.refName\n const s = model.bpToPx({ refName, coord: r.start })\n const e = model.bpToPx({ refName, coord: r.end })\n return s && e\n ? {\n width: Math.max(Math.abs(e.offsetPx - s.offsetPx), 3),\n left: Math.min(s.offsetPx, e.offsetPx) - model.offsetPx,\n highlight: r.highlight,\n label: r.label,\n bookmark: r,\n }\n : undefined\n })\n .filter(notEmpty)\n .map(({ left, width, highlight, label, bookmark }, idx) => (\n <div\n /* biome-ignore lint/suspicious/noArrayIndexKey: */\n key={`${left}_${width}_${idx}`}\n className={classes.highlight}\n style={{\n left,\n width,\n background: highlight,\n }}\n >\n {showBookmarkLabels ? (\n <div className={classes.highlightButton}>\n <CascadingMenuButton\n menuItems={[\n {\n label: 'Open bookmark widget',\n onClick: () => {\n session.showWidget(bookmarkWidget)\n },\n },\n {\n label: 'Remove bookmark',\n onClick: () => {\n bookmarkWidget.removeBookmarkObject(bookmark)\n },\n },\n ]}\n >\n <Tooltip title={label} arrow>\n <BookmarkIcon\n fontSize=\"small\"\n sx={{\n color:\n colord(highlight).alpha() !== 0\n ? colord(highlight).alpha(0.8).toRgbString()\n : colord(highlight).alpha(0).toRgbString(),\n }}\n />\n </Tooltip>\n </CascadingMenuButton>\n </div>\n ) : null}\n </div>\n ))\n : null\n})\n\nexport default Highlight\n","import React, { useEffect } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { SessionWithWidgets, getSession, notEmpty } from '@jbrowse/core/util'\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\nimport { Tooltip } from '@mui/material'\n\n// locals\nimport { GridBookmarkModel } from '../../model'\nimport { IExtendedLGV } from '../../model'\n\ntype LGV = IExtendedLGV\n\nconst useStyles = makeStyles()({\n highlight: {\n height: '100%',\n position: 'absolute',\n },\n})\n\nconst OverviewHighlight = observer(function OverviewHighlight({\n model,\n overview,\n}: {\n model: LGV\n overview: Base1DViewModel\n}) {\n const { cytobandOffset } = model\n const session = getSession(model) as SessionWithWidgets\n const { classes } = useStyles()\n const { assemblyManager } = session\n const { showBookmarkHighlights, showBookmarkLabels } = model\n const bookmarkWidget = session.widgets.get('GridBookmark') as\n | GridBookmarkModel\n | undefined\n\n useEffect(() => {\n if (!bookmarkWidget) {\n session.addWidget('GridBookmarkWidget', 'GridBookmark')\n }\n }, [session, bookmarkWidget])\n\n const assemblyNames = new Set(model.assemblyNames)\n return showBookmarkHighlights && bookmarkWidget?.bookmarks\n ? bookmarkWidget.bookmarks\n .filter(r => assemblyNames.has(r.assemblyName))\n .map(r => {\n const asm = assemblyManager.get(r.assemblyName)\n const refName = asm?.getCanonicalRefName(r.refName) ?? r.refName\n const rev = r.reversed\n const s = overview.bpToPx({ refName, coord: rev ? r.end : r.start })\n const e = overview.bpToPx({ refName, coord: rev ? r.start : r.end })\n return s !== undefined && e !== undefined\n ? {\n width: Math.abs(e - s),\n left: s + cytobandOffset,\n highlight: r.highlight,\n label: r.label,\n }\n : undefined\n })\n .filter(notEmpty)\n .map((obj, idx) => {\n const { left, width, highlight, label } = obj\n return (\n <Tooltip\n key={`${JSON.stringify(obj)}-${idx}`}\n title={showBookmarkLabels ? label : ''}\n arrow\n >\n <div\n className={classes.highlight}\n style={{\n left,\n width,\n background: highlight,\n borderLeft: `1px solid ${highlight}`,\n borderRight: `1px solid ${highlight}`,\n }}\n />\n </Tooltip>\n )\n })\n : null\n})\n\nexport default OverviewHighlight\n","import { lazy } from 'react'\nimport { ConfigurationSchema } from '@jbrowse/core/configuration'\nimport { WidgetType } from '@jbrowse/core/pluggableElementTypes'\nimport PluginManager from '@jbrowse/core/PluginManager'\n\n// locals\nimport stateModelFactory from './model'\nimport AddHighlightModelF from './components/Highlight'\n\nconst configSchema = ConfigurationSchema('GridBookmarkWidget', {})\n\nexport default function GridBookmarkWidgetF(pluginManager: PluginManager) {\n pluginManager.addWidgetType(() => {\n return new WidgetType({\n name: 'GridBookmarkWidget',\n heading: 'Bookmarked regions',\n configSchema,\n stateModel: stateModelFactory(pluginManager),\n ReactComponent: lazy(() => import('./components/GridBookmarkWidget')),\n })\n })\n AddHighlightModelF(pluginManager)\n}\n","import Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { LinearGenomeViewStateModel } from '@jbrowse/plugin-linear-genome-view'\nimport {\n SessionWithWidgets,\n getSession,\n isAbstractMenuManager,\n isSessionModelWithWidgets,\n} from '@jbrowse/core/util'\nimport {\n PluggableElementType,\n ViewType,\n} from '@jbrowse/core/pluggableElementTypes'\n\n// icons\nimport BookmarkIcon from '@mui/icons-material/Bookmark'\nimport BookmarksIcon from '@mui/icons-material/Bookmarks'\nimport HighlightIcon from '@mui/icons-material/Highlight'\nimport LabelIcon from '@mui/icons-material/Label'\n\nimport GridBookmarkWidgetF from './GridBookmarkWidget'\nimport { GridBookmarkModel } from './GridBookmarkWidget/model'\n\nexport default class GridBookmarkPlugin extends Plugin {\n name = 'GridBookmarkPlugin'\n\n install(pluginManager: PluginManager) {\n GridBookmarkWidgetF(pluginManager)\n\n pluginManager.addToExtensionPoint(\n 'Core-extendPluggableElement',\n (pluggableElement: PluggableElementType) => {\n if (pluggableElement.name === 'LinearGenomeView') {\n const { stateModel } = pluggableElement as ViewType\n const lgv = stateModel as LinearGenomeViewStateModel\n const newStateModel = lgv\n .props({\n /**\n * #property\n * show the bookmark highlights on this track\n */\n showBookmarkHighlights: true,\n /**\n * #property\n * show the bookmark labels on this track\n */\n showBookmarkLabels: true,\n })\n .actions(self => ({\n /**\n * #action\n */\n toggleShowBookmarkHighlights(toggle?: boolean) {\n self.showBookmarkHighlights =\n toggle !== undefined ? toggle : !self.showBookmarkHighlights\n },\n /**\n * #action\n */\n toggleShowBookmarkLabels(toggle?: boolean) {\n self.showBookmarkLabels =\n toggle !== undefined ? toggle : !self.showBookmarkLabels\n },\n activateBookmarkWidget() {\n const session = getSession(self)\n if (isSessionModelWithWidgets(session)) {\n let bookmarkWidget = session.widgets.get('GridBookmark')\n if (!bookmarkWidget) {\n bookmarkWidget = session.addWidget(\n 'GridBookmarkWidget',\n 'GridBookmark',\n )\n }\n\n session.showWidget(bookmarkWidget)\n return session.widgets.get(\n 'GridBookmark',\n ) as GridBookmarkModel\n }\n\n throw new Error('Could not open bookmark widget')\n },\n }))\n .actions(self => ({\n navigateNewestBookmark() {\n const session = getSession(self)\n const bookmarkWidget = self.activateBookmarkWidget()\n if (bookmarkWidget.bookmarks.length) {\n self.navTo(bookmarkWidget.bookmarks.at(-1)!)\n } else {\n session.notify(\n 'There are no recent bookmarks to navigate to.',\n 'info',\n )\n }\n },\n\n bookmarkCurrentRegion() {\n if (self.id === getSession(self).focusedViewId) {\n const selectedRegions = self.getSelectedRegions(\n undefined,\n undefined,\n )\n const bookmarkWidget = self.activateBookmarkWidget()\n if (!selectedRegions.length) {\n throw new Error('no region selected')\n } else {\n bookmarkWidget.addBookmark(selectedRegions[0]!)\n }\n }\n },\n }))\n .views(self => {\n const superMenuItems = self.menuItems\n const superRubberBandMenuItems = self.rubberBandMenuItems\n return {\n menuItems() {\n return [\n ...superMenuItems(),\n { type: 'divider' },\n {\n label: 'Bookmarks',\n icon: BookmarksIcon,\n subMenu: [\n {\n label: 'Open bookmark widget',\n icon: BookmarksIcon,\n onClick: () => self.activateBookmarkWidget(),\n },\n {\n label: 'Bookmark current region',\n icon: BookmarkIcon,\n onClick: () => {\n self.bookmarkCurrentRegion()\n },\n },\n {\n label: 'Toggle bookmark highlights',\n icon: HighlightIcon,\n type: 'checkbox',\n checked: self.showBookmarkHighlights,\n onClick: () => {\n self.toggleShowBookmarkHighlights()\n },\n },\n {\n label: 'Toggle bookmark labels',\n icon: LabelIcon,\n type: 'checkbox',\n checked: self.showBookmarkLabels,\n onClick: () => {\n self.toggleShowBookmarkLabels()\n },\n },\n ],\n },\n ]\n },\n\n rubberBandMenuItems() {\n return [\n ...superRubberBandMenuItems(),\n {\n label: 'Bookmark region',\n icon: BookmarkIcon,\n onClick: () => {\n const { leftOffset, rightOffset } = self\n const selectedRegions = self.getSelectedRegions(\n leftOffset,\n rightOffset,\n )\n const bookmarkWidget = self.activateBookmarkWidget()\n if (!selectedRegions.length) {\n throw new Error('no regions selected')\n } else {\n bookmarkWidget.addBookmark(selectedRegions[0]!)\n }\n },\n },\n ]\n },\n }\n })\n .actions(self => ({\n afterCreate() {\n document.addEventListener('keydown', e => {\n const activationSequence =\n (e.ctrlKey || e.metaKey) && e.shiftKey\n // ctrl+shift+d or cmd+shift+d\n if (activationSequence && e.code === 'KeyD') {\n e.preventDefault()\n self.activateBookmarkWidget()\n self.bookmarkCurrentRegion()\n getSession(self).notify('Bookmark created.', 'success')\n }\n // ctrl+shift+m or cmd+shift+m\n if (activationSequence && e.code === 'KeyM') {\n e.preventDefault()\n self.navigateNewestBookmark()\n }\n })\n },\n }))\n\n ;(pluggableElement as ViewType).stateModel = newStateModel\n }\n return pluggableElement\n },\n )\n }\n\n configure(pluginManager: PluginManager) {\n if (isAbstractMenuManager(pluginManager.rootModel)) {\n pluginManager.rootModel.appendToMenu('Tools', {\n label: 'Bookmarks',\n icon: BookmarksIcon,\n onClick: (session: SessionWithWidgets) => {\n let bookmarkWidget = session.widgets.get('GridBookmark')\n if (!bookmarkWidget) {\n bookmarkWidget = session.addWidget(\n 'GridBookmarkWidget',\n 'GridBookmark',\n )\n }\n session.showWidget(bookmarkWidget)\n },\n })\n }\n }\n}\n","import React from 'react'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'\n\n// locals\nimport Highlight from './Highlight'\nimport OverviewHighlight from './OverviewHighlight'\nimport { IExtendedLGV } from '../../model'\n\nexport default function AddHighlightModelF(pluginManager: PluginManager) {\n pluginManager.addToExtensionPoint(\n 'LinearGenomeView-TracksContainerComponent',\n // @ts-expect-error\n (\n rest: React.ReactNode[] | undefined,\n { model }: { model: IExtendedLGV },\n ) => {\n return [\n ...(rest || []),\n <Highlight key=\"highlight_grid_bookmark\" model={model} />,\n ]\n },\n )\n pluginManager.addToExtensionPoint(\n 'LinearGenomeView-OverviewScalebarComponent',\n // @ts-expect-error\n (\n rest: React.ReactNode[] | undefined,\n { model, overview }: { model: IExtendedLGV; overview: Base1DViewModel },\n ) => {\n return [\n ...(rest || []),\n <OverviewHighlight\n key=\"overview_highlight_grid_bookmark\"\n model={model}\n overview={overview}\n />,\n ]\n },\n )\n}\n","import Alignments from '@jbrowse/plugin-alignments'\nimport Authentication from '@jbrowse/plugin-authentication'\nimport Bed from '@jbrowse/plugin-bed'\nimport BreakpointSplitView from '@jbrowse/plugin-breakpoint-split-view'\nimport CircularView from '@jbrowse/plugin-circular-view'\nimport Config from '@jbrowse/plugin-config'\nimport ComparativeAdapters from '@jbrowse/plugin-comparative-adapters'\nimport DataManagement from '@jbrowse/plugin-data-management'\nimport DotplotView from '@jbrowse/plugin-dotplot-view'\nimport GtfPlugin from '@jbrowse/plugin-gtf'\nimport Gff3 from '@jbrowse/plugin-gff3'\nimport JobsManagementPlugin from '@jbrowse/plugin-jobs-management'\nimport LegacyJBrowse from '@jbrowse/plugin-legacy-jbrowse'\nimport LinearGenomeView from '@jbrowse/plugin-linear-genome-view'\nimport LinearComparativeView from '@jbrowse/plugin-linear-comparative-view'\nimport Lollipop from '@jbrowse/plugin-lollipop'\nimport Arc from '@jbrowse/plugin-arc'\nimport Menus from '@jbrowse/plugin-menus'\nimport RDF from '@jbrowse/plugin-rdf'\nimport Sequence from '@jbrowse/plugin-sequence'\nimport SVG from '@jbrowse/plugin-svg'\nimport Variants from '@jbrowse/plugin-variants'\nimport Wiggle from '@jbrowse/plugin-wiggle'\nimport GCContent from '@jbrowse/plugin-gccontent'\nimport SpreadsheetViewPlugin from '@jbrowse/plugin-spreadsheet-view'\nimport SvInspectorPlugin from '@jbrowse/plugin-sv-inspector'\nimport HicPlugin from '@jbrowse/plugin-hic'\nimport TrixPlugin from '@jbrowse/plugin-trix'\nimport GridBookmarkPlugin from '@jbrowse/plugin-grid-bookmark'\n\nconst corePlugins = [\n SVG,\n LinearGenomeView,\n Alignments,\n Authentication,\n Bed,\n CircularView,\n Config,\n DataManagement,\n DotplotView,\n GtfPlugin,\n Gff3,\n JobsManagementPlugin,\n LegacyJBrowse,\n LinearComparativeView,\n Lollipop,\n Menus,\n RDF,\n Sequence,\n Variants,\n Wiggle,\n GCContent,\n SpreadsheetViewPlugin,\n SvInspectorPlugin,\n BreakpointSplitView,\n HicPlugin,\n TrixPlugin,\n GridBookmarkPlugin,\n ComparativeAdapters,\n Arc,\n]\n\nexport default corePlugins\n"],"names":["configSchema","ConfigurationSchema","localStorageGetNumber","key","defaultVal","localStorageGetItem","formatSubfeatures","obj","depth","parse","currentDepth","returnObj","subfeatures","map","sub","stateModelFactory","pluginManager","types","model","id","ElementId","type","literal","featureData","frozen","formattedFields","unformattedFeatureData","view","safeReference","pluggableMstType","track","trackId","maybe","string","trackType","maxDepth","number","sequenceFeatureDetails","optional","volatile","showCoordinatesSetting","intronBp","upDownBp","upperCaseCDS","Boolean","JSON","charactersPerRow","feature","undefined","mode","actions","self","setFeature","f","setUpDownBp","setIntronBp","setUpperCaseCDS","setShowCoordinates","setMode","views","showCoordinates","showGenomicCoordsOption","hasCDS","some","hasExon","hasExonOrCDS","this","afterAttach","addDisposer","autorun","localStorageSetItem","stringify","error","setFeatureData","clearFeatureData","setFormattedData","feat","setExtra","setError","e","afterCreate","session","getSession","configuration","getConf","clone","combine","arg2","__jbrowsefmt","console","preProcessSnapshot","snap","finalizedFeatureData","rest","postProcessSnapshot","_","v","Plugin","install","_pluginManager","configure","CoreGetRefNames","RpcMethodType","name","execute","args","rpcDriver","pm","deserializedArgs","deserializeArguments","sessionId","adapterConfig","dataAdapter","getAdapter","isFeatureAdapter","getRefNames","CoreGetFeatureDetails","serializeArguments","rootModel","assemblyManager","renamedArgs","renameRegionsIfNeeded","superArgs","super","rendererType","getRendererType","serializeArgsInClient","featureId","RendererType","sessions","getLayoutId","cachedLayout","layout","getDataByID","toJSON","CoreGetMetadata","getMetadata","CoreGetFileInfo","getHeader","CoreGetFeatures","deserializeReturn","feats","SimpleFeature","signal","regions","opts","Error","ret","getFeaturesInMultipleRegions","firstValueFrom","pipe","toArray","validateRendererType","ReactComponent","CoreRender","checkAbortSignal","result","render","renderInWorker","serializedReturn","des","deserializeResultsInClient","CoreFreeResources","specification","deleteCount","freeAdapterResources","getRendererTypes","forEach","renderer","count","freeResources","_rpcDriver","CoreGetFeatureDensityStats","filters","getMultiRegionFeatureDensityStats","cytobandLocation","defaultValue","uri","explicitlyTyped","CorePlugin","Object","values","coreRpcMethods","RpcMethod","addRpcMethod","addAdapterType","AdapterType","getAdapterClass","then","default","CytobandAdapterF","addWidgetType","WidgetType","heading","stateModel","lazy","PhasedScheduler","phaseCallbacks","Map","phaseOrder","constructor","add","phase","callback","includes","get","set","push","run","phaseName","TypeRecord","registeredTypes","typeName","baseClass","t","has","all","PluginManager","plugins","jexl","createJexlInstance","pluginMetadata","runtimePluginDefinitions","elementCreationSchedule","rendererTypes","adapterTypes","textSearchAdapterTypes","TextSearchAdapterType","trackTypes","TrackType","displayTypes","DisplayType","connectionTypes","ConnectionType","viewTypes","ViewType","widgetTypes","rpcMethods","addTrackWidgets","AddTrackWorkflowType","internetAccountTypes","InternetAccountType","configured","extensionPoints","initialPlugins","addPlugin","plugin","metadata","isCore","pluginConfigurationSchemas","configurationSchemas","configurationSchema","load","definition","getPlugin","find","p","hasPlugin","createPluggableElements","setRootModel","getElementTypeRecord","groupName","addElementType","creationCallback","typeRecord","newElement","evaluateExtensionPoint","getElementType","getElementTypesInGroup","getTrackElements","getConnectionElements","getAddTrackWorkflowElements","getRpcElements","getDisplayElements","getAdapterElements","fieldName","fallback","null","pluggableTypes","filter","isType","isModelType","length","jest","warn","union","pluggableConfigSchemaType","typeGroup","isBareConfigurationSchemaType","jbrequireCache","lib","ReExports","jbrequire","pack","TypeError","getAdapterType","getTextSearchAdapterType","getTrackType","getDisplayType","getViewType","getAddTrackWorkflow","getWidgetType","getConnectionType","getRpcMethodType","methodName","getInternetAccountType","addRendererType","cb","addTextSearchAdapterType","addTrackType","display","addDisplayType","addViewType","newView","viewType","extendedName","addConnectionType","addInternetAccountType","addAddTrackWorkflowType","addToExtensionPoint","extensionPointName","callbacks","extendee","props","accumulator","evaluateAsyncExtensionPoint","Entries","Accordion","AccordionActions","AccordionDetails","Alert","AlertTitle","Autocomplete","Avatar","AvatarGroup","Backdrop","Badge","Box","Breadcrumbs","Button","ButtonGroup","Card","CardActions","CardActionArea","CardContent","CardHeader","CardMedia","CircularProgress","Collapse","ClickAwayListener","Chip","Checkbox","Container","Dialog","DialogActions","DialogTitle","DialogContent","DialogContentText","Divider","Drawer","Fab","Fade","FilledInput","FormLabel","FormControl","FormControlLabel","FormHelperText","FormGroup","Grid","Grow","Icon","IconButton","Input","InputBase","InputLabel","InputAdornment","Link","LinearProgress","List","ListItem","ListItemAvatar","ListItemSecondaryAction","ListItemIcon","ListSubheader","ListItemText","Menu","MenuItem","MenuList","Modal","NativeSelect","OutlinedInput","Pagination","PaginationItem","Paper","Popover","Popper","Portal","Radio","RadioGroup","Rating","ScopedCssBaseline","Select","Skeleton","Slider","Snackbar","SnackbarContent","SpeedDial","SpeedDialAction","SpeedDialIcon","Stack","Step","StepButton","StepConnector","StepLabel","StepIcon","Stepper","SvgIcon","Switch","Tab","Table","TableBody","TableCell","TableContainer","TableFooter","TableHead","TablePagination","TableRow","TableSortLabel","Tabs","TextField","TextareaAutosize","ToggleButton","ToggleButtonGroup","Toolbar","Tooltip","Typography","LazyMUICore","fromEntries","entries","Component","React","ref","Suspense","_extends","displayName","MaterialPrefixMUI","value","MuiPrefixMUI","Attributes","FeatureDetails","BaseCard","DataGridEntries","DataGrid","module","GridActionsCellItem","GridAddIcon","GridArrowDownwardIcon","GridArrowUpwardIcon","GridCellCheckboxForwardRef","GridCellCheckboxRenderer","GridCheckCircleIcon","GridCheckIcon","GridCloseIcon","GridColumnHeaderSeparator","GridColumnHeaderSortIcon","GridColumnIcon","GridColumnMenu","GridColumnMenuContainer","GridDragIcon","GridExpandMoreIcon","GridFilterAltIcon","GridFilterForm","GridFilterListIcon","GridFilterPanel","GridFooter","GridFooterContainer","GridHeader","GridHeaderCheckbox","GridKeyboardArrowRight","GridLoadIcon","GridLoadingOverlay","GridMenuIcon","GridMoreVertIcon","GridNoRowsOverlay","GridOverlay","GridPagination","GridPanel","GridPanelWrapper","GridRemoveIcon","GridRoot","GridRowCount","GridSaveAltIcon","GridSearchIcon","GridSelectedRowCount","GridSeparatorIcon","GridTableRowsIcon","GridToolbar","GridToolbarColumnsButton","GridToolbarContainer","GridToolbarDensitySelector","GridToolbarExport","GridToolbarExportContainer","GridToolbarFilterButton","GridTripleDotsVerticalIcon","GridViewHeadlineIcon","GridViewStreamIcon","LazyDataGridComponents","LazyAttributes","LazyFeatureDetails","LazyBaseCard","libs","mobx","mst","react","ReactJSXRuntime","ReactDom","mxreact","useGridApiContext","useGridApiRef","useGridRootProps","MUIUtils","makeStyles","useTheme","alpha","MUIStyles","useStyles","classes","pluggableElementTypes","pluggableElementTypeModels","ServerSideRendererType","CircularChordRendererType","BoxRendererType","FeatureRendererType","Configuration","mstTypes","coreUi","coreUtil","coreColor","coreLayouts","trackUtils","Base1DView","coreIo","coreMstReflection","rxjs","BaseAdapterExports","libsList","keys","inLibsOnly","mod","reExportsList","join","inReExportsOnly","BaseResult","label","locString","renderingComponent","displayString","matchedAttribute","matchedObject","textSearchAdapter","relevance","score","results","getLabel","getDisplayString","getRenderingComponent","getTrackId","getScore","updateScore","newScore","getId","getLocation","hasLocation","getComboResults","RefSequenceResult","refName","TextSearchManager","adapterCache","QuickLRU","maxSize","loadTextSearchAdapters","searchScope","Promise","relevantAdapters","async","adapterId","readConfObject","conf","r","adapterType","adapterInstance","aggregateTextSearchAdapters","jbrowse","tracks","assemblyName","getAdaptersWithAssembly","getTrackAdaptersWithAssembly","confs","c","textSearching","search","rankFn","adapters","a","searchIndex","sortResults","flat","sort","b","localeCompare","r1","r2","typeModels","stringArray","array","stringArrayMap","numberMap","boolean","color","refinement","integer","text","fileLocation","FileLocation","fallbackDefaults","locationType","literalJSON","valueJSON","objectJSON","typeModelExtensions","val","removeAtIndex","idx","splice","setAtIndex","remove","delete","addToKey","ar","removeAtKeyIndex","setAtKeyIndex","JexlStringType","str","startsWith","isEmptyArray","thing","Array","isArray","modelName","inputSchemaDefinition","inputOptions","schemaDefinition","options","baseConfiguration","jbrowseSchemaDefinition","jbrowseSchemaOptions","preprocessConfigurationSchemaArguments","schemaType","modelDefinition","identifier","explicitIdentifier","implicitIdentifier","volatileConstants","isJBrowseConfigurationSchema","jbrowseSchema","slotName","slotDefinition","isLateType","isConfigurationSchemaType","description","contextVariable","configSlotModelName","charAt","toUpperCase","slice","slot","isCallback","String","expr","getEnv","stringToJexlExpression","evalSync","newVal","reset","convertToCallback","convertToValue","funcResult","extend","m","defineProperty","ConfigSlot","completeModel","setSubschema","data","newSchema","isStateTreeNode","create","identifierDefault","modelDefault","defaultSnap","getSnapshot","newSnap","matchesDefault","makeConfigurationSchemaModel","ConfigurationReference","reference","confObject","slotPath","isMapType","getType","newPath","subConf","isConfigurationModel","getTypeNamesFromExplicitlyTypedUnion","maybeUnionType","resolveLateType","isUnionType","typeNames","getUnionSubTypes","getDefaultValue","every","isOptionalType","getSubType","isArrayType","isConfigurationSlotType","isSequenceAdapter","isRegionsAdapter","isRefNameAliasAdapter","isTextSearchAdapter","EmptyConfig","BaseAdapter","static","config","getSubAdapter","idMaker","arg","BaseFeatureDataAdapter","_opts","getFeaturesInRegion","region","ObservableCreate","hasData","hasDataForRefName","getFeatures","subscribe","observer","complete","merge","getRegionQuantitativeStats","scoresToStats","getMultiRegionQuantitativeStats","blankStats","scoreMax","max","scoreMin","min","scoreSum","sum","scoreSumSquares","featureCount","basesCovered","rectifyStats","getRegionFeatureDensityStats","lastTime","Date","now","statsFromInterval","expansionTime","start","end","sampleCenter","features","Math","round","maybeRecordStats","featureDensity","interval","stats","statsSampleFeatures","refLen","currTime","Number","POSITIVE_INFINITY","BaseSequenceAdapter","PluggableElementBase","stuff","AdapterClass","adapterCapabilities","adapterMetadata","AddTrackWorkflow","url","configEditorComponent","subDisplay","maybeDisplayName","isObject","isObjectCustom","RegExp","globalThis","Blob","object","mapper","isSeen","WeakSet","mapArray","element","rpcDriverClassName","blobMap","getBlobMap","augmentLocationObjects","serializeNewAuthArguments","loc","isAppRootModel","internetAccountPreAuthorization","account","findAppropriateInternetAccount","getPreAuthorizationInformation","serializedArgs","_rpcDriverClassName","setBlobMap","isRemoteAbortSignal","deserializeAbortSignal","serializeReturn","originalReturn","_args","isAuthNeededException","retryAccount","createEphemeralInternetAccount","URL","origin","RetryError","internetAccountId","uris","mapObject","isUriLocation","HeadingComponent","BaseViewModel","minimized","width","menuItems","setDisplayName","setWidth","newWidth","setMinimized","flag","displayedRegions","Region","assemblyNames","connect","_arg","addTrackConf","trackConf","addTrackConfs","trackConfs","setTrackConfs","cast","clear","BaseDisplay","rpcDriverName","rendererTypeName","message","RenderingComponent","DisplayBlurb","parentTrack","getParent","isRoot","renderProps","getParentRenderProps","notReady","getContainingView","displayModel","DisplayMessageComponent","trackMenuItems","viewMenuActions","regionCannotBeRendered","setMessage","setRpcDriverName","reload","BaseInternetAccountConfig","authHeader","tokenType","domains","inWebWorker","sessionStorage","InternetAccount","toggleContents","SelectorComponent","selectorLabel","handlesLocation","location","domain","tokenKey","getTokenFromUser","_resolve","_reject","storeToken","token","setItem","removeToken","removeItem","retrieveToken","getItem","validateToken","_loc","tokenPromise","getToken","authInfo","resolve","reject","addAuthHeaderToInit","init","headers","Headers","authToken","validatedToken","internetAccountType","getFetcher","input","newInit","fetch","openLocation","RemoteFileWithRangeCache","createBaseTrackModel","baseTrackConfig","displays","rpcSessionId","flatMap","d","canConfigure","sessionTracks","adminMode","isSessionModelWithConfigEditing","showDisplay","displayId","initialSnapshot","schema","resolveIdentifier","getRoot","displayType","hideDisplay","transaction","replaceDisplay","oldId","newId","findIndex","shownId","compatDisp","compatTypes","Set","getCompatibleDisplays","priority","subMenu","checked","onClick","createBaseTrackConfig","category","adapter","indexingAttributes","indexingFeatureTypesToExclude","formatDetails","formatAbout","hideUris","s2","configDisplayTypes","addDisplayConf","LayoutSession","bpPerPx","update","assign","makeLayout","MultiLayout","GranularRectLayout","maxHeight","displayMode","pitchX","pitchY","cachedLayoutIsValid","subLayoutConstructorArgs","deepEqual","getWorkerSession","createSession","getExpandedRegion","renderArgs","maxFeatureGlyphExpansion","bpExpansion","floor","ceil","freeResourcesInClient","rpcManager","discardRange","deserializeLayoutInClient","json","PrecomputedLayout","createLayoutInWorker","getSublayout","serializeResultsInWorker","serialized","serializeRegion","rectangles","uniqueId","maxHeightReached","NewHydrate","html","theme","useRef","rootRef","hydrateRoot","hydrateFn","useEffect","renderTimeout","rIC","current","jbrowseTheme","createJBrowseTheme","ThemeProvider","clearTimeout","root","setTimeout","unmount","dangerouslySetInnerHTML","__html","OldHydrate","domNode","innerHTML","unmountComponentAtNode","style","outline","hydrate","FeatureRenderer","supportsSVG","res","deserializedFeatures","fromJSON","exportSVG","blockKey","reactElement","RpcRenderedSvgGroup","ComparativeServerSideRenderer","ServerSideRenderer","renderInClient","call","getSerializedSvg","featurePassesFilters","passes","requestRegions","requestRegion","dedupe","iterMap","size","_renderArgs","featureObservable","ServerSideRenderedContent","deserializeArgsInWorker","deserialized","SerializableFilterChain","renderToString","statusCallback","updateStatus","filterChain","trim","inputFilter","entry","tooltip","position","pointerEvents","backgroundColor","palette","grey","borderRadius","shape","common","white","fontFamily","typography","padding","fontSize","pxToRem","lineHeight","maxWidth","wordWrap","BaseTooltip","clientPoint","clientPointCoords","children","placement","popperTheme","components","MuiPopper","refs","floatingStyles","context","useFloating","strategy","useClientPoint","getFloatingProps","useInteractions","container","defaultProps","className","setFloating","zIndex","visibility","transform","closeAfterItemClick","stopPropagation","setOpen","onClickExtra","popupState","usePopupState","popupId","variant","onTouchStart","rest2","bindTrigger","isOpen","event","disabled","CascadingMenu","bindPopover","onMenuItemClick","ResetComponent","onFactoryReset","resetButtonText","dialogOpen","setDialogOpen","useState","FactoryResetDialog","onClose","open","FatalErrorDialog","componentStack","ErrorMessage","window","isBlobLocation","filename","marginLeft","spacing","setLocation","localPath","needToReload","getBlob","blobId","flexDirection","alignItems","fullWidth","component","hidden","onChange","target","file","files","isElectron","webUtils","require","getPathForFile","storeBlobLocation","blob","inputProps","dots","content","textAlign","animation","keyframes","LoadingEllipses","bg","margin","overflow","background","border","divider","RedErrorMessageBox","category10","dark2","set1","set2","tableau10","ggplot2Colors6","ggplot2Colors5","ggplot2Colors4","ggplot2Colors3","moveTo","interRegionPaddingWidth","minimumBlockWidth","len","bpSoFar","index","offset","s","i","lengthBetween","numBlocksWideEnough","targetBpPerPx","newBpPerPx","zoomTo","extraBp","bpToStart","scrollTo","coord","bp","reversed","pxToBp","px","offsetPx","staticBlocks","blocks","contentBlocks","oob","interRegionPaddingBp","currBlock","regionNumber","at","bpToPx","volatileWidth","setDisplayedRegions","setBpPerPx","setVolatileWidth","displayedRegionsTotalPx","totalBp","maxOffset","minOffset","dynamicBlocks","calculateDynamicBlocks","calculateStaticBlocks","currBp","setFeatures","showAllRegions","zoomOut","zoomIn","clamp","minBpPerPx","maxBpPerPx","oldBpPerPx","abs","newOffsetPx","centerAt","centerPx","scroll","distance","oldOffsetPx","AbortError","AbortSignal","aborted","makeAbortError","abortBreakPoint","DOMException","code","observeAbortSignal","fromEvent","Observable","isAbortException","exception","test","blobToDataURL","FileReader","onload","readAsDataURL","BlockSet","block","lastBlock","getBlocks","getRegions","toRegion","func","thisarg","totalWidthPx","widthPx","totalWidthPxWithoutBorders","BaseBlock","ContentBlock","ElidedBlock","elidedBlockCount","otherBlock","InterRegionPaddingBlock","elision","displayedRegionLeftPx","windowLeftPx","windowRightPx","regionStart","regionEnd","displayedRegionRightPx","regionWidthPx","parentRegion","leftPx","rightPx","intersection2","isLeftEndOfDisplayedRegion","isRightEndOfDisplayedRegion","blockOffsetPx","blockData","assembleLocStringFast","extra","modelWidth","windowLeftBp","windowRightBp","blockSizePx","blockSizeBp","regionBpOffset","regionBlockCount","windowRightBlockNum","windowLeftBlockNum","blockNum","colors","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellow","yellowgreen","namedColorToHex","isNamedColor","contrastingTextColor","getLuminance","convertedColor","muiGetLuminance","emphasize","coefficient","muiEmphasize","makeContrasting","foreground","minContrastRatio","convertedForeground","convertedBackground","backgroundLuminance","contrastRatio","getContrastRatio","originalColor","darken","lighten","mix","names","list","hasher","lookup","hashed","hashCode","fetchers","globalRangeCache","HttpRangeFetcher","fetcher","chunkSize","maxFetchSize","minimumTTL","RemoteFile","fetchBinaryRange","bind","range","rangeParse","exec","parseInt","buffer","getRange","Response","status","requestDate","responseDate","ok","errorMessage","hint","k","arrayBuffer","Buffer","from","resolveUriLocation","baseUri","href","isLocalPathLocation","isNode","LocalFile","BlobFile","absoluteLocation","internetAccount","getInternetAccount","checkAuthNeededFetch","isRootModelWithInternetAccounts","response","AuthNeededError","toString","JexlF","j","addFunction","parent","log","sqrt","log10","parseFloat","char","split","charCodeAt","pos","codePointAt","endsWith","pad","padEnd","fill","padStart","repeat","match","replace","replaceAll","substring","toLowerCase","trimEnd","trimStart","tags","addBinaryOp","compilationCache","cacheKey","compiled","compile","minSizeToBotherWith","segmentsIntersect","x1","x2","y1","y2","LayoutRow","widthLimit","setAllFilled","allFilled","getItemAt","x","rowState","bits","isRangeClear","left","right","maxX","initialize","rectWidth","addRect","rect","l","oLeft","oRight","currLength","additionalLength","w","leftTrimAmount","rightTrimAmount","trimAmount","desiredLength","hardRowLimit","bitmap","pTotalHeight","height","storedRec","top","addRectToBitmap","pLeft","pRight","pHeight","rectangle","h","originalHeight","maxTop","collides","maxY","y","row","autovivifyRow","yEnd","hasSeen","getByCoord","pY","pX","getByID","cleanup","getTotalHeight","totalHeight","getRectangles","regionRectangles","containsNoTransferables","subLayouts","SubLayoutClass","layoutName","subLayout","sublayout","rbush","RBush","insert","minX","minY","_rect","_top","_data","_left","_right","_region","ThrowingLayout","PrecomputedMultiLayout","sublayoutJson","SceneGraph","absoluteCache","dirty","addChild","nameOrSceneGraph","child","childLeft","childRight","childTop","bottom","childBottom","absolute","expand","getSubRecord","newLeft","newRight","newTop","newBottom","diff","walkParents","walkChildren","xOffset","yOffset","node","move","_subtype","_subType","subType","unionType","_types","getPropertyType","propertyName","properties","_defaultValue","getEnumerationValues","maybeLate","nanoid","crypto","getRandomValues","Uint8Array","reduce","byte","createCanvas","createImageBitmap","ImageBitmapType","drawImageOntoCanvasContext","imageData","serializedCommands","CanvasSequence","drawImage","weHave","OffscreenCanvas","ImageBitmap","nodeCreateCanvas","dataUri","canvas","toDataURL","img","nodeImage","onerror","src","getContext","ctx","renderToAbstractCanvas","highResolutionScaling","rasterizeLayers","scale","xlinkHref","convertToBlob","fakeCtx","canvasRecordedData","getSvg","ReactRendering","rendering","left1","right1","left2","right2","doesIntersect2","isContainedWithin","catch","takeUntil","isFeature","isSimpleFeatureSerialized","parentHandle","aliases","strand","parentId","calcStdFromSums","sumSquares","n","population","variance","scoreMean","scoreStdDev","seed","MAX_VALUE","MIN_VALUE","found","acc","summary","isViewContainer","isSessionModel","isSessionWithAddTracks","disableAddTracks","isSessionWithShareURL","shareURL","isSessionModelWithWidgets","isSessionModelWithConnections","isSessionModelWithConnectionEditing","isSessionWithSessionPlugins","isSelectionContainer","isViewModel","isTrackModel","isDisplayModel","isTrackViewModel","isAbstractMenuManager","setPrototypeOf","prototype","isRetryException","useMeasure","dims","setDims","RS","ResizeObserver","contentRect","observe","disconnect","when","getter","timeout","finished","whenPromise","mobxWhen","timeoutId","finishTimeout","cancel","addEventListener","err","whenPresent","mdRegex","modificationRegex","cigarRegex","startClip","endClip","parseCigar","cigar","cigarToMismatches","ops","seq","qual","roffset","soffset","mismatches","hasRefAndSeq","op","base","altbase","q","subarray","cliplen","mdToMismatches","mdstring","cigarMismatches","curr","lastCigar","lastTemplateOffset","lastRefOffset","lastSkipPos","mismatchRecords","skips","getTemplateCoordLocal","refCoord","templateOffset","refOffset","md","num","isNaN","mismatch","getMismatches","concat","getNextRefPos","cigarOps","positions","readPos","refPos","currPos","getModificationProbabilities","getTagAlt","elt","getMethBins","fstart","fend","fstrand","flen","mm","methBins","methProbs","probabilities","modifications","getModificationPositions","probIndex","prob","fseq","revcom","mods","basemod","matches","typestr","delta","temp","getModificationTypes","getOrientedCigar","flip","getOrientedMismatches","getLengthOnRef","lengthOnRef","getLength","getLengthSansClipping","getClip","getTag","tag","featurizeSA","SA","readName","normalize","aln","saRef","saStart","saStrand","saCigar","saLengthOnRef","saLength","saLengthSansClipping","saStrandNormalized","saClipPos","saRealStart","seqLength","clipPos","CIGAR","mate","fetchSizeLimit","cramLocation","craiLocation","sequenceAdapter","CramAdapterF","bamLocation","indexType","enumeration","BamAdapterF","htsgetBase","htsgetTrackId","HtsgetBamAdapterF","hiddenFromGUI","subadapter","SNPCoverageAdapterF","clipColor","indicatorThreshold","drawArcs","drawInterbaseCounts","drawIndicators","SNPCoverageRenderer","WiggleBaseRenderer","draw","displayCrossHatches","modificationTagMap","scaleOpts","unadjustedHeight","configTheme","cfg","ticks","YSCALEBAR_LABEL_OFFSET","viewScale","getScale","indicatorViewScale","scaleType","originY","getOrigin","originLinear","toY","toHeight","toY2","toHeight2","bases","colorForBase","A","main","C","G","T","insertion","softclip","hardclip","total","meth","unmeth","coverage","fillStyle","featureSpanPx","fillRect","prevTotal","extraHorizontallyFlippedOffset","snpinfo","totalScore","cov","interbaseEvents","noncov","indicatorHeight","accum","maxBase","indicatorComparatorScore","beginPath","lineTo","bpSpanPx","xs","neg","neutral","strokeStyle","lineWidth","bezierCurveTo","stroke","tick","register","WiggleRendering","PileupLayoutSession","showSoftClip","sortedBy","filterBy","PileupRenderer","fetchSequence","maxClippingSize","layoutRecords","featureMap","sortFeature","featureArray","featuresInCenterLine","featuresOutsideCenter","innerArray","isCram","baseSortArray","baseMap","aMismatch","bMismatch","acode","bcode","heightPx","expansionBefore","expansionAfter","topPx","layoutFeature","layoutFeats","regionSequence","shouldFetchReferenceSequence","colorBy","makeImageData","notEmpty","canvasWidth","orientationType","minSubfeatureWidth","noSpacing","largeInsertionIndicatorScale","mismatchAlpha","onMouseMove","selectedFeatureId","featureIdUnderMouse","contextMenuFeature","firstRender","setFirstRender","mouseIsDown","setMouseIsDown","movedDuringLastMouseDown","setMovedDuringLastMouseDown","selectedRect","getFeatureByID","highlightedFeature","highlightedRect","makeRect","leftBp","rightBp","bottomPx","selected","highlight","callMouseHandler","handlerName","featureHandler","canvasHandler","tagFilter","onMouseDown","onMouseEnter","onMouseOut","onMouseOver","onMouseUp","onMouseLeave","getBoundingClientRect","offsetX","clientX","offsetY","clientY","clientBp","getFeatureOverlapping","mouseMove","onContextMenu","onFocus","onBlur","PrerenderedCanvas","boxSizing","getLowerPanelDisplays","lowerPanel","deepSnap","preCheck","PileupDisplay","SNPCoverageDisplay","isAlive","compose","snpCovHeight","heightPreConfig","userFeatureScreenDensity","lowerPanelType","LinearAlignmentsDisplayMixin","scrollTop","setScrollTop","setSNPCoverageHeight","pileupConf","searchFeatureByID","coverageConf","setSNPCoverageDisplay","setFeatureDensityStatsLimit","setPileupDisplay","setHeight","setFilterBy","setLowerPanelType","resizeHeight","oldHeight","setConfig","setColorBy","propagateColorBy","propagateFilterBy","renderSvg","pileupHeight","overrideHeight","superTrackMenuItems","resizeHandle","AlignmentsDisplay","ResizeHandle","onDrag","LinearAlignmentsDisplayF","pileupDisplay","snpCoverageDisplay","baseLinearDisplayConfigSchema","modelFactory","linearWiggleDisplayModelFactory","FilterModel","jexlFilters","observable","modificationsReady","setJexlFilters","updateModificationColorMap","uniqueModifications","modificationColors","randomColor","superRenderProps","rendererConfig","configBlob","drawArcsSetting","drawInterbaseCountsSetting","drawIndicatorsSetting","autorunReady","initialized","featureDensityStatsReady","regionTooLarge","renderReady","ready","superProps","setModificationsReady","toggleDrawIndicators","toggleDrawInterbaseCounts","toggleDrawArcs","createAutorun","vals","getUniqueModificationValues","delay","TooltipComponent","needsScalebar","contextMenuItems","autoscale","minScore","maxScore","inverted","multiTicks","renderers","configSchemaFactory","LinearWiggleDisplayReactComponent","FilterByTagDialog","TrackHeightMixin","FeatureDensityMixin","jitter","drawInter","drawLongRange","loading","chainData","lastDrawnOffsetPx","lastDrawnBpPerPx","setLastDrawnOffsetPx","setLastDrawnBpPerPx","setLoading","setRef","setColorScheme","setChainData","setDrawInter","setDrawLongRange","setLineWidth","setJitter","drawn","lineWidthSetting","jitterVal","icon","FilterListIcon","queueDialog","handleClose","PaletteIcon","drawFeats","doAfterAttach","maxFeatureScreenDensity","colorScheme","linearBasicDisplayConfigSchemaFactory","configSchemaF","stateModelF","drawSingletons","setDrawSingletons","featureHeight","linearAlignmentsDisplay","baseModel","baseModelFactory","AlignmentFeatureDetailsF","PileupBaseRPC","PileupGetReducedFeatures","featuresArray","reduced","flags","tlen","pair_orientation","next_ref","next_pos","filtered","sum2","avg","sd","upper","lower","getInsertSizeStats","chains","groupBy","hasPaired","PileupGetVisibleModifications","uniqueValues","PileupGetGlobalValueForTag","PileupRPCMethodsF","GuessAlignmentsTypesF","adapterGuesser","adapterHint","adapterName","fileName","getFileName","makeIndex","indexName","makeIndexType","trackTypeGuesser","defaultRendering","LinearPileupDisplayBlurb","ColorByTagDialog","SetFeatureHeightDialog","SetMaxHeightDialog","SharedLinearPileupDisplayMixin","BaseLinearDisplay","fadeLikelihood","trackMaxHeight","ColorByModel","colorTagMap","featureUnderMouseVolatile","tagsReady","setTagsReady","setMaxHeight","setFeatureHeight","setNoSpacing","updateColorTagMap","uniqueTag","colorPalette","totalKeys","setFeatureUnderMouse","selectFeature","featureWidget","addWidget","getContainingTrack","showWidget","setSelection","copyFeatureToClipboard","copy","notify","featureHeightSetting","featureUnderMouse","viewName","MenuOpenIcon","clearFeatureSelection","ContentCopyIcon","renderPropsPre","onFeatureClick","getRpcSessionId","layoutId","onFeatureContextMenu","setContextMenuFeature","colorSchemeSubMenuItems","getUniqueTagValues","notifyError","SortByTagDialog","GroupByDialog","ModificationsDialog","showSoftClipping","sortReady","currSortBpPerPx","setCurrSortBpPerPx","setSortReady","clearSelected","toggleSoftClipping","toggleMismatchAlpha","setSortedBy","centerLineInfo","centerBp","superReload","superRenderReady","mismatchAlphaSetting","superRenderPropsPre","superColorSchemeSubMenuItems","SortIcon","option","ColorLensIcon","doneCallback","WorkspacesIcon","VisibilityIcon","BaseLinearDisplayComponent","AlignmentsPlugin","LinearPileupDisplayF","LinearSNPCoverageDisplayF","AlignmentsTrackF","PileupRendererF","SNPCoverageRendererF","LinearReadArcsDisplayF","LinearReadCloudDisplayF","AlignmentsFeatureWidgetF","fillColor","color_fwd_strand_not_proper","color_rev_strand_not_proper","color_fwd_strand","color_rev_strand","color_fwd_missing_mate","color_rev_missing_mate","color_fwd_diff_chr","color_rev_diff_chr","color_pair_lr","color_pair_rr","color_pair_rl","color_pair_ll","color_nostrand","color_interchrom","color_longinsert","color_shortinsert","color_unknown","strokeColor","getPairedInsertSizeColor","f1","f2","sameRef","defaultColor","getPairedInsertSizeAndOrientationColor","getPairedOrientationColorOrDefault","orientationTypes","fr","type2","pairMap","getPairedOrientationColor","flagInclude","flagExclude","alt","F1R2","F2R1","F1F2","F2F1","R1R2","R2R1","R1F2","R2F1","rf","ff","LR","LL","RR","RL","originalRefName","o","g","random","TOP","BOTTOM","heightFromSpecificLevel","level","getYPosOverride","trackRefs","getPxFromCoordinate","yPos","chunk","useNextFrame","variable","setNextFrameState","intersect","a1","a2","ids","a12","findCircleIntersectionX","cx","cy","resultArray","solution","findCircleIntersectionY","cartesianToPolar","rho","theta","atan","PI","cartesianToTheta","twoPi","Slice","offsetRadians","radianWidth","bpPerRadian","assembleLocString","flipped","startRadians","endRadians","widthBp","freeze","bpToXY","radiusPx","offsetBp","elided","totalRadians","polarToCartesian","ExportSvgDialog","hideVerticalResizeHandle","hideTrackSelectorButton","lockedFitToWindow","disableImportForm","scrollX","scrollY","minimumRadiusPx","spacingPx","paddingPx","lockedPaddingPx","minVisibleWidth","trackSelectorType","visibleSection","viewSides","circleCenter","circleRadius","viewL","viewR","viewT","viewB","vertices","maxRho","NEGATIVE_INFINITY","reflect","rhoMin","rhoMax","thetaMin","thetaMax","vx","vy","viewportVisibleSection","centerXY","circumferencePx","elidedBp","elidedRegions","pxPerRadian","maximumRadiusPx","minCircumferencePx","maxCircumferencePx","atMaxBpPerPx","atMinBpPerPx","tooSmallToLock","figureDimensions","figureWidth","figureHeight","visible","lastVisible","displayedRegion","staticSlices","slices","currentRadianOffset","calculateStaticSlices","visibleStaticSlices","visibleThetaMin","visibleThetaMax","r1start","r2start","r2length","r1length","sliceIsVisible","newHeight","setModelViewWhenAdjust","resizeWidth","oldWidth","rotateClockwiseButton","rotateClockwise","rotateCounterClockwiseButton","rotateCounterClockwise","zoomInButton","zoomOutButton","secondCondition","previouslyEmpty","activateTrackSelector","selector","toggleTrack","hideTrack","showTrack","supportedDisplays","displayConf","toggleFitToWindowLock","exportSvg","renderToSvg","saveAs","FolderOpenIcon","PhotoCameraIcon","TrackSelectorIcon","primary","secondary","tertiary","quaternary","path","strokeDasharray","strokeDashoffset","light","radius","shown","setShown","patternTransform","patternUnits","strokeWidth","dominantBaseline","textAnchor","strokeLinecap","DisplayError","filled","Loading","renderReactionData","blockDefinitions","renderReactionEffect","cannotBeRenderedReason","isCompatibleWithRenderer","baseChordDisplayConfig","onChordClick","BaseChordDisplayModel","bezierRadiusRatio","refNameMap","origSlices","renamed","bezierRadius","selection","renderStarted","renderSuccess","renderError","setRefNameMap","makeAbortableReaction","fireImmediately","getTrackAssemblyNames","getRefNameMapForAdapter","CircularViewPlugin","CircularViewF","assembly","addView","asm","waitForAssembly","LaunchCircularViewF","appendToSubMenu","DataUsageIcon","callbackEditor","marginTop","callbackContainer","overflowX","textAreaFont","contents","setContents","shrink","htmlFor","helperText","multiline","InputProps","refNameColumn","setTarget","newTarget","LazyConfigurationEditorComponent","useUcscNameOverride","ConfigurationPlugin","FromConfigAdapterF","FromConfigRegionsAdapterF","FromConfigSequenceAdapterF","RefNameAliasAdapterF","ConfigurationEditorWidgetF","NcbiSequenceReportAliasAdapterF","AddConnectionWidgetF","isAbsoluteUrl","trackSource","trackData","indexTrackData","altAssemblyName","altTrackName","altTrackType","textIndexTrack","textIndexingConf","setAdapterHint","setTrackSource","setTextIndexingConf","setTextIndexTrack","setTrackData","setIndexTrackData","setAssembly","setTrackName","setTrackType","clearData","trackAdapter","guessAdapter","trackName","isFtp","isRelativeTrackUrl","isRelativeIndexUrl","isRelativeUrl","trackHttp","indexHttp","wrongProtocol","protocol","unsupported","UNSUPPORTED","guessTrackType","warningMessage","AddTrackWidgetF","getRowStr","facet","hasAnyOverlap","s1","query","categories","queryLower","getTrackName","findSubCategories","paths","hasSubs","findTopLevelCategories","filterTracks","trackListAssemblies","trackAssemblyNames","trackAssemblies","trackSelectorAnyOverlap","hasAllOverlap","generateHierarchy","noCategories","hierarchy","collapsed","filterText","activeSortTrackNames","activeSortCategories","viewTracks","sortNames","sortCategories","sortConfs","unshift","currLevel","isOpenByDefault","findNonSparseKeys","rows","nonMetadataKeys","keyConfigPostFix","pathname","URLSearchParams","recentlyUsedK","favoritesK","collapsedK","localStorageGetJSON","localStorageSetJSON","MAX_RECENTLY_USED","stateTreeFactory","faceted","showSparse","showFilters","showOptions","panelWidth","useShoppingCart","setFilter","setPanelWidth","setUseShoppingCart","setFilterText","setShowSparse","setShowOptions","setShowFilters","allTrackConfigurations","filteredNonMetadataKeys","metadataKeys","getRootKeys","filteredMetadataKeys","fields","filteredRows","arrFilters","setVisible","favorites","recentlyUsed","sortTrackNames","recentlyUsedCounter","favoritesCounter","shownTrackIds","selectionSet","favoritesSet","recentlyUsedSet","setSortTrackNames","setSortCategories","addToSelection","removeFromSelection","clearSelection","addToFavorites","removeFromFavorites","clearFavorites","setRecentlyUsedCounter","setRecentlyUsed","setFavorites","setFavoritesCounter","addToRecentlyUsed","clearRecentlyUsed","setView","toggleCategory","pathName","setCategoryCollapsed","expandAllCategories","setCollapsedCategories","clearFilterText","newText","isSelected","isFavorite","isRecentlyUsed","getRefSeqTrackConf","sequence","configAndSessionTrackConfigurations","connectionInstances","allTrackConfigurationTrackIdSet","favoriteTracks","recentlyUsedTracks","allTracks","group","collapseSubCategories","collapseTopLevelCategories","trackGroups","hasAnySubcategories","lc","HierarchicalTrackSelectorWidgetF","PluginStoreWidgetF","hubTxtLocation","baseConnectionConfig","UCSCTrackHubConnection","BaseConnectionModelFactory","doConnect","UCSCTrackHubConnectionF","locstr","includeAsm","toLocaleString","getBlockLabelKeysToHide","viewOffsetPx","blockLabelKeysToHide","sortedBlocks","alen","labelBounds","makeTicks","emitMajor","emitMinor","gridPitch","minMajorPitchBp","majorPitch","toExponential","majorPitchPx","minorPitch","chooseGridPitch","iterPitch","minBase","contentBlock","minHeight","whiteSpace","elidedBlock","backgroundImage","interRegionPaddingBlock","boundaryPaddingBlock","action","disabledBackground","boundary","ellipses","textOverflow","BlockMsg","severity","title","TooltipContents","SanitizedHTML","clientMouseCoord","ErrorMessageStackTraceDialog","paddingLeft","LoadingMessage","blockStatus","displayStatus","RefreshIcon","ReportIcon","reloadFlag","renderInProgress","ServerSideRenderedBlockContent","doReload","getContainingDisplay","renderBlockData","renderBlockEffect","renderDelay","setRendered","setStatus","abortController","abort","messageText","beforeDestroy","optDisplay","regionAsm","hasName","displayError","viewParams","getViewParams","getDisplayStr","totalBytes","toPrecision","notJest","getFeatureDensityStatsPre","rightRoundedRect","leftTriangle","rightTriangle","colorMap","gneg","gpos25","gpos50","gpos100","gpos75","gvar","stalk","acen","overview","cytobands","getCytobands","lcap","rcap","HEADER_OVERVIEW_HEIGHT","centromereSeen","points","getFillProps","dragHandle","cursor","dragHandleIcon","verticalAlign","draggable","onDragStart","currentTarget","parentNode","dataTransfer","setDragImage","setDraggingTrackId","onDragEnd","DragIcon","paper","iconButton","items","AddIcon","MinimizeIcon","KeyboardDoubleArrowUpIcon","moveTrackToTop","KeyboardArrowUpIcon","moveTrackUp","KeyboardArrowDownIcon","moveTrackDown","KeyboardDoubleArrowDownIcon","moveTrackToBottom","getTrackActionMenuItems","TrackLabelDragHandle","CloseIcon","CascadingMenuButton","MoreVertIcon","trackLabel","trackLabelOffset","trackLabelOverlap","labelStyle","trackLabelsSetting","prefersOffset","TrackLabel","renderingComponentContainer","trackRenderingContainer","overflowY","onDragEnter","scaleFactor","onScroll","evt","onHorizontalScroll","horizontalScroll","draggingTrackId","showTrackOutlines","elevation","detail","TrackLabelContainer","ErrorBoundary","FallbackComponent","TrackRenderingContainer","moveTrack","useRangeSelect","shiftOnly","startX","setStartX","currentX","setCurrentX","anchorPosition","setAnchorPosition","guideX","setGuideX","mouseDragging","mouseDown","shiftKey","preventDefault","relativeX","getRelativeX","mouseOut","setOffsets","handleMenuItemClick","globalMouseMove","globalMouseUp","leftOffset","rightOffset","computeOffsets","removeEventListener","rubberbandOn","leftBpOffset","rightBpOffset","numOfBpSelected","guide","coordX","arrow","rubberbandControl","ControlComponent","VerticalGuide","RubberbandSpan","anchorReference","rubberBandMenuItems","majorTickLabel","justifyContent","ContentBlockComponent","baseNumber","getTickDisplayStr","ScalebarCoordinateTicks","ElidedBlockComponent","InterRegionPaddingBlockComponent","refLabel","fontWeight","b0","scaleBarDisplayPrefix","lastLeftBlock","last","zoomContainer","scalebar","other","offsetLeft","ScalebarCoordinateLabels","ScalebarRefNameLabels","verticalGuidesZoomContainer","verticalGuidesContainer","majorTick","minorTick","RenderedBlockLines","RenderedVerticalGuides","centerLineContainer","active","borderTop","borderBottom","centerLineText","CenterLine","trackHeights","startingPosition","role","colord","toRgbString","linkIcon","Highlight","anchorEl","dismissHighlight","removeHighlight","mapCoords","getCanonicalRefName","LinkIcon","_event","BookmarkIcon","bookmarkWidget","widgets","addBookmark","tracksContainer","mouseDown1","mouseUp","setMouseDragging","scheduled","prevX","requestAnimationFrame","dataset","resizer","button","useSideScroll","mouseDown2","onWheel","ctrlKey","deltaY","setScaleFactor","deltaX","useWheelScroll","additional","showGridlines","Gridlines","showCenterLine","Rubberband","Scalebar","SCALE_BAR_HEIGHT","HighlightGroup","ImportForm","NoTracksActiveButton","note","paddingTop","paddingBottom","rel","LinearGenomeView","hasDisplayedRegions","handleSelectView","Element","contains","setFocusedViewId","document","MiniControlsComponent","HeaderComponent","setHovered","hoverPosition","hoverFeature","TracksContainer","TrackContainer","useOffset","multiplier","cytobandOffset","polygonColor","first","topLeft","topRight","startPx","endPx","HEADER_BAR_HEIGHT","getStrokeProps","HelpDialog","HelpAdornment","isHelpDialogDisplayed","setHelpDialogDisplayed","HelpIcon","EndAdornment","showHelp","endAdornment","marginRight","SearchIcon","AutocompleteTextField","TextFieldProps","inputBoxVal","params","setInputValue","setCurrentSearch","slotProps","placeholder","onSelect","fetchResults","minWidth","loaded","setLoaded","currentSearch","inputValue","searchOptions","setSearchOptions","debouncedSearch","useDebounce","coarseVisibleLocStrings","aggregateResults","getDeduplicatedResult","measureText","refNames","regionOptions","disableListWrap","disableClearable","freeSolo","includeInputInList","selectOnFocus","onInputChange","newInputValue","loadingText","onOpen","selectedOption","getOptionDisabled","filterOptions","searchQuery","toLocaleLowerCase","getFiltered","renderInput","getOptionLabel","opt","rubberband","rubberbandText","contrastText","popover","mouseEvents","paddingRight","anchorOrigin","vertical","horizontal","transformOrigin","keepMounted","disableRestoreFocus","toLocale","queryString","searchType","rankSearchResults","textSearchManager","textSearchResults","refNameResults","allRefNames","RESIZE_HANDLE_HEIGHT","INTER_REGION_PADDING_WIDTH","SPACING","WIDGET_HEIGHT","SVGBackground","shift","stripAlpha","SVGRegionSeparators","SVGTrackLabel","trackLabels","xoff","yoff","coarseStripHTML","SVGTracks","displayResults","textHeight","textOffset","Ruler","major","minor","hideText","SVGRuler","renderRuler","clipid","clipPath","SVGScalebar","displayBp","getBpDisplayStr","x0","SVGHeader","cytobandHeight","rulerHeight","showCytobands","visibleRegions","firstOverviewPx","lastOverviewPx","Cytobands","fillOpacity","OverviewScalebarPolygon","headerHeight","themeName","Wrapper","allThemes","createRootFn","trackLabelMaxLen","renderToStaticMarkup","xmlns","xmlnsXlink","viewBox","minMajorPitchPx","minMinorPitchPx","generateLocations","asmName","canonicalRefName","parseLocStrings","isValidRefName","inputs","parseLocString","isInteger","mouseover","CompositeMap","submaps","submap","Symbol","iterator","minDisplayHeight","displayHeight","regionTooLargeReason","featureDensityStats","userBpPerPxLimit","userByteSizeLimit","featureDensityStatsP","currStatsBpPerPx","currentBytesRequested","bytes","currentFeatureScreenDensity","maxAllowableBytes","setCurrStatsBpPerPx","clearFeatureDensityStats","getFeatureDensityStats","setFeatureDensityStats","autorunFeatureDensityStats","setFeatureDensityStatsP","req","regionCannotBeRenderedText","TooLargeMessage","blockState","BlockState","blockType","featureMaps","addBlock","deleteBlock","navToFeature","navTo","setFeatureIdUnderMouse","CenterFocusStrongIcon","renderBaseLinearDisplaySvg","blocksPresent","linearBlocks","heightOverflowed","textShadow","RenderedBlocks","state","LinearBlocks","viewModel","clientRect","setClientRect","offsetMouseCoord","setOffsetMouseCoord","setClientMouseCoord","contextCoord","setContextCoord","mouseCoord","TransitionProps","onExit","focusedBackground","MiniControls","hideHeader","focusedViewId","ArrowDown","zoom","ZoomOut","ZoomIn","HoverTooltip","cytoband","OverviewRubberband","controlsRef","click","globalKeyDown","borderLeft","borderRight","OverviewHighlight","scalebarLabel","OverviewScalebarTickLabels","refNameColor","getRefNameColor","tickLabels","offsetLabel","tickLabel","labelIdx","scalebarBorder","scalebarContig","scalebarContigForward","backgroundRepeat","scalebarContigReverse","scalebarRefName","scalebarVisibleRegion","overviewSvg","OverviewBox","canDisplayCytobands","borderColor","overviewVisibleRegions","scalebarColor","transparency","OverviewScalebar","modWidth","useMemo","slider","ZoomControls","setValue","log2","onChangeCommitted","headerRefName","SearchBox","RefNameAutocomplete","navToOption","setSearchResults","handleSelectedRegion","headerBar","headerForm","flexWrap","spacer","flexGrow","panButton","toggleButton","buttonSpacer","HeaderButtons","PanControls","slide","ArrowBackIcon","ArrowForwardIcon","RegionWidth","coarseTotalBp","Controls","LinearGenomeViewHeader","hideHeaderOverview","ReturnToImportFormDialog","SequenceSearchDialog","GetSequenceDialog","SearchResultsDialog","calculateVisibleLocStrings","isSingleAssemblyName","hideNoTracksActive","showCytobandsSetting","colorByCDS","volatileError","afterDisplayedRegionsSetCallbacks","coarseDynamicBlocks","sessionSetting","Header","assemblyErrors","assembliesInitialized","scaleBarHeight","trackHeightsWithResizeHandles","includeAggregateIndexes","getTrack","openTrackIds","rewriteOnClicks","holdOnClick","apply","trackTypeActions","allActions","setShowTrackOutlines","setColorByCDS","setShowCytobands","setHideHeader","setHideHeaderOverview","setHideNoTracksActive","setShowGridlines","addToHighlights","setHighlight","centerAtOffset","searchResults","setNewView","horizontallyFlip","reverse","displayInitialSnapshot","movingId","targetId","oldIndex","newIndex","setTrackLabels","setting","localStorage","setShowCenterLine","getSelectedRegions","simView","afterDisplayedRegionsSet","center","showAllRegionsInAssembly","factor","clearView","cancelLastAnimation","viewWidths","animate","cancelAnimation","springAnimate","canShowCytobands","anyCytobandsExist","SyncAltIcon","LabelIcon","currentlyCalculatedStaticBlocks","stringifiedCurrentlyCalculatedStaticBlocks","sret","roundedDynamicBlocks","visibleLocStrings","setCoarseDynamicBlocks","navToLocString","optAssemblyName","navToLocations","navToSearchString","parsedLocStrings","locations","navToMultiple","assembly1","assembly2","ref1","ref2","findLast","e1","e2","index2","ed","ZoomInIcon","handler","metaKey","AddFiltersDialog","trackShowLabels","trackShowDescriptions","trackDisplayMode","activeFilters","showLabels","showDescriptions","toggleShowLabels","toggleShowDescriptions","setDisplayMode","LinearGenomeViewPlugin","exports","BasicTrackF","LinearBasicDisplayF","LinearGenomeViewF","LinearBareDisplayF","tracklist","nav","idsNotFound","tryTrack","LaunchLinearGenomeViewF","LineStyleIcon","allRefs","allRefNamesWithLowerCase","lastIndex","lastIndexOf","splitLast","checkRef","altTypeToSO","DEL","INS","DUP","INV","INVDUP","CNV","TRA","NON_REF","getSOTermAndDescription","parser","soTerms","descriptions","soTerm","getSOAndDescFromAltDefs","parseBreakend","makeDescriptionString","lena","getSOAndDescByExamination","descs","prefixes","desc","prefix","suffixes","pref","modAlt","VCFFeature","dataFromVariant","_id","field","SAMPLES","REF","ALT","POS","CHROM","INFO","ID","isTRA","isSymbolic","END","samples","vcfLocation","vcfGzLocation","linearBasicDisplayModelFactory","strokeColorSelected","strokeColorHover","bpToRadians","blockStart","blockEnd","blocksForRefs","hovered","startBlock","svType","endPosition","endBlock","SVTYPE","bnd","startPos","matePosition","MatePosition","chr2","CHR2","startXY","endXY","controlXY","hoverStrokeColor","blocksForRefsMemo","Chord","VariantsPlugin","VcfAdapterF","VcfTabixAdapterF","VariantFeatureWidgetF","ExtensionPointsF","LinearVariantDisplayF","ChordRendererType","StructuralVariantChordRendererF","BaseChordDisplayComponent","ChordVariantDisplayF","en","toP","YScaleBar","hoverVertical","useClientY","reducedFeatures","bigWigLocation","source","subadapters","bigWigs","posColor","negColor","bicolorPivot","bicolorPivotValue","baseWiggleRendererConfigSchema","drawDensity","pivot","pivotValue","crossing","niceMin","niceMax","prevLeftPx","hasClipping","save","fillRectCtx","restore","DensityRenderer","getFeatureUnderMouse","eventClientX","amount","hslColor","toHsl","fudgeFactor","drawXY","colorCallback","summaryScoreMode","minSize","getHeight","toOrigin","crossingOrigin","lastCol","lastMix","effectiveC","toHex","XYPlotRenderer","_score","drawLine","lastVal","lowClipping","highClipping","LinePlotRenderer","sharedWiggleConfigFactory","minimalTicks","numStdDev","SetMinMaxDialog","SharedWiggleMixin","selectedRendering","resolution","rendererTypeNameState","constraints","statsFetchInProgress","updateQuantitativeStats","EPSILON","setColor","setPosColor","setNegColor","aborter","statsFetch","setResolution","setFill","toggleLogScale","setScaleType","setSummaryScoreMode","setAutoscale","setMaxScore","setRendererType","setMinScore","toggleCrossHatches","setCrossHatches","cross","adapterTypeName","rendererTypeNameSimple","autoscaleType","oldDomain","getNiceDomain","bounds","summaryScoreModeSetting","canHaveFill","displayCrossHatchesSetting","hatches","hasResolution","hasGlobalStats","scoreTrackMenuItems","SetColorDialog","axisPropsFromTickScale","fillSetting","hasRenderings","superRenderSvg","quantitativeStatsAutorun","sourcesVolatile","setLayout","clearLayout","setSources","sources","needsFullHeightScalebar","isMultiRow","needsCustomLegend","renderColorBoxes","iter","rowHeight","rowHeightTooSmallForScalebar","useMinimalTicks","eventClientY","mouseoverBp","featuresUnderMouse","MultiXYPlotRenderer","groups","translate","MultiLineRenderer","MultiRowLineRenderer","ConfirmDialog","MultiWiggleGetSources","getSources","WiggleGetMultiRegionQuantitativeStats","WiggleGetGlobalQuantitativeStats","getGlobalStats","WigglePlugin","QuantitativeTrackF","MultiQuantitativeTrackF","XYPlotRendererConfigSchema","DensityRendererConfigSchema","LinePlotRendererConfigSchema","LinearWiggleDisplayF","MultiXYPlotRendererConfigSchema","MultiDensityRendererConfigSchema","MultiRowXYPlotRendererConfigSchema","MultiLineRendererConfigSchema","MultiRowLineRendererConfigSchema","MultiDensityRenderer","MultiRowXYPlotRenderer","MultiLinearWiggleDisplayF","LinePlotRendererF","XYPlotRendererF","DensityRendererF","MultiXYPlotRendererF","MultiRowXYPlotRendererF","MultiDensityRendererF","MultiLineRendererF","MultiRowLineRendererF","MultiWiggleAddTrackWorkflowF","trackIds","arg1","makeTrack","CreateMultiWiggleExtensionF","XYPlotRendererReactComponent","xyPlotRendererConfigSchema","utils","orientation","Axis","shadow","format","orient","LEFT","RIGHT","fg","scaleLinear","scaleLog","scaleQuantize","nice","rangeMin","rangeMax","getScaleType","getQuantitativeStats","AbortController","statsRegion","wiggleStats","authEndpoint","tokenEndpoint","needsPKCE","clientId","scopes","responseType","fixup","buf","processError","invalidErrorCb","error_description","processTokenResponse","storeRefreshTokenCb","refresh_token","access_token","getResponseError","reason","statusText","getError","named","codeVerifier","codeVerifierPKCE","refreshTokenKey","storeRefreshToken","refreshToken","removeRefreshToken","retrieveRefreshToken","exchangeAuthorizationForAccessToken","redirectUri","grant_type","client_id","redirect_uri","code_verifier","method","body","exchangeRefreshForAccessToken","listener","exchangedTokenPromise","addMessageChannel","finishOAuthWindow","deleteMessageChannel","redirectUriWithInfo","fixedQueryString","redirectUrl","queryStringSearch","urlParams","useEndpointForAuthorization","response_type","token_access_type","scope","code_challenge","sha256","generateChallenge","code_challenge_method","eventName","ipcRenderer","invoke","eventFromDesktop","MessageEvent","doUserFlow","newToken","superGetFetcher","validateWithHEAD","ExternalTokenEntryForm","setToken","required","HTTPBasicLoginForm","username","setUsername","password","setPassword","onSubmit","btoa","autoComplete","OAuthConfigSchema","dropboxErrorMessages","shared_link_not_found","shared_link_access_denied","unsupported_link_type","shared_link_is_directory","getDescriptiveErrorMessage","DropboxIcon","append","Authorization","GoogleDriveFile","statsPromise","metadataOnly","stat","GoogleDriveIcon","getUri","driveUrl","searchParams","credentials","AuthenticationPlugin","OAuthInternetAccountModelFactory","ExternalTokenConfigSchema","ExternalTokenInternetAccountModelFactory","HTTPBasicConfigSchema","HTTPBasicInternetAccountModelFactory","DropboxOAuthConfigSchema","DropboxOAuthInternetAccountModelFactory","GoogleDriveOAuthConfigSchema","GoogleDriveOAuthInternetAccountModelFactory","bigBedLocation","scoreColumn","aggregateField","bedpeLocation","columnNames","bedGzLocation","autoSql","bedLocation","colRef","colStart","colEnd","BedPlugin","BigBedAdapterF","BedAdapterF","BedpeAdapterF","BedTabixAdapterF","BreakpointSplitViewType","getBreakendCoveringRegions","endPos","mateRefName","matePos","singleLevelSnapshotFromBreakendFeature","topRegion","bottomRegion","topMarkedRegion","bottomMarkedRegion","snapshotFromBreakendFeature","calc","getBlockFeatures","showIntraviewLinks","linkViews","interactToggled","matchedTrackFeatures","matchedTracks","getMatchedTracks","trackConfigId","hasTranslocations","getTrackFeatures","hasPairedFeatures","getMatchedFeaturesInLayout","onAction","onSubviewAction","actionName","getPath","removeView","toggleInteract","toggleIntraviewLinks","toggleLinkViews","setMatchedTrackFeatures","reverseViewOrder","PhotoCamera","BreakpointSplitViewPlugin","BreakpointSplitView","BreakpointSplitViewF","BreakpointAlignmentsWidgetF","targetAssembly","queryAssembly","pafLocation","pifGzLocation","mcscanAnchorsLocation","bed1Location","bed2Location","mcscanSimpleAnchorsLocation","outLocation","deltaLocation","chainLocation","ComparativeAdaptersPlugin","PAFAdapterF","PairwiseIndexedPAFAdapterF","DeltaAdapterF","ChainAdapterF","MCScanAnchorsAdapterF","MCScanSimpleAnchorsAdapterF","MashMapAdapterF","Dotplot1DView","box","DotplotHView","viewWidth","DotplotVView","viewHeight","stringLenPx","pxWidthForBlocks","hide","blockMessage","blockError","BlockMessage","BlockError","ServerSideRenderedDotplotContent","shouldDisplay","borderSize","borderX","borderY","warnings","ReactComponent2","vview","hview","bpPerPxY","bpPerPxX","offX","offY","DotplotDisplay","DotplotRenderer","ComparativeRenderer","process","dimensions","drawDotplot","thresholdsPalette","thresholds","ComparativeRender","rend","getRenderer","MismatchParser","DotplotPlugin","tickSize","vtextRotation","htextRotation","drawCigar","viewTrackConfigs","cursorMode","showPanButtons","wheelMode","hticks","vticks","setShowPanButtons","setWheelMode","setCursorMode","setDrawCigar","setBorderX","setBorderY","setAssemblyNames","setViews","arr","getCoords","mousedown","mouseup","xmin","xmax","minmax","ymin","ymax","onDotplotView","d1","d2","_unused1","rest1","_unused2","viewSnapshot","removeTemporaryAssembly","vblocks","hblocks","hoffset","voffset","vhide","hhide","by","bx","squareView","hpx","vpx","squareViewProportional","ratio","DotplotViewF","DotplotRendererF","LaunchDotplotViewF","pluggableElement","newStateModel","superContextMenuItems","readAssembly","trackAssembly","SA2","totalLength","refLength","gatherOverlaps","DotplotReadVsRefMenuItem","TimelineIcon","gtfLocation","GtfPlugin","gtfAdapterConfigSchema","gffGzLocation","dontRedispatch","gffLocation","GFF3Plugin","Gff3TabixAdapterF","Gff3AdapterF","GuessGff3F","Job","statusMessage","progressPct","cancelCallback","setCancelCallback","setStatusMessage","setProgressPct","pct","JobsManagementPlugin","jobs","queued","addJob","job","addedJob","removeJob","jobName","indx","removed","addFinishedJob","addQueuedJob","addAbortedJob","removeQueuedJob","updateJobStatusMessage","updateJobProgressPct","JobsListWidgetF","appendToMenu","Indexing","jobStatusWidget","rootUrlTemplate","namesIndexLocation","dataDirLocation","fetchJb1","convertTrackConfig","assemblies","jb2Tracks","jb1Track","dataRoot","breakConnection","LegacyJBrowsePlugin","NCListAdapterF","GuessNCListF","JBrowse1TextSearchAdapterF","JBrowse1ConnectionF","view0","existingFeatures","featIds","newFeatIds","foundNewFeatureNotInExistingMap","foundExistingFeatureNotInNewMap","existingFeat","middleComparativeHeight","setMiddleComparativeHeight","shownTracks","average","headerMenuItems","mainCanvas","clickMapCanvas","cigarClickMapCanvas","mouseoverCanvas","featPositions","mouseoverId","clickId","cigarMouseoverId","setFeatPositions","setMainCanvasRef","setClickMapCanvasRef","setCigarClickMapCanvasRef","setMouseoverCanvasRef","setMouseoverId","setCigarMouseoverId","setClickId","numFeats","featMap","LaunchSyntenyViewDialog","Curves","drawCIGAR","drawCurves","toggleCurves","toggleCIGAR","superHeaderMenuItems","superMenuItems","CropFreeIcon","ReadVsRefDialog","LinearComparativeViewPlugin","LinearComparativeViewF","LinearSyntenyViewF","LinearComparativeDisplayF","middle","baseConfigFactory","LinearSyntenyDisplayF","linearPileupDisplayConfigSchemaFactory","LGVSyntenyDisplayF","LaunchLinearSyntenyViewF","SyntenyTrackF","CalendarIcon","FloatingLayout","layoutDirty","anchorLocation","getLayout","sorted","maxBottom","layoutEntries","currentItem","previouslyLaidOutItem","prevStart","prevTop","prevWidth","prevHeight","prevEnd","prevBottom","pairs","PrecomputedFloatingLayout","FloatingLayoutSession","layoutIsValid","LollipopRenderer","innerColor","caption","minStickLength","stickColor","stickWidth","LollipopPlugin","LollipopRendererF","LinearLollipopDisplayF","displayModeSetting","renderArcSvg","ArcTooltip","Arc","isMouseOvered","setIsMouseOvered","textStroke","textYCoord","centerX","centerY","angleInDegrees","angleInRadians","cos","sin","describeArc","startAngle","endAngle","largeArcFlag","SemiCircles","semicircles","thickness","ArcRenderer","ArcPlugin","ArcRendererF","LinearArcDisplayF","LinearPairedArcDisplayF","attributeName","_feature","MenusPlugin","aboutConfigSchema","aboutStateModel","helpConfigSchema","helpStateModel","importSessionConfigSchema","importSessionStateModel","sessionManagerConfigSchema","sessionManagerStateModel","InfoIcon","widget","SPARQLAdapter","endpoint","queryTemplate","additionalQueryParams","refNamesQueryTemplate","configRefNames","encodeURIComponent","querySparql","resultsToRefNames","filledTemplate","resultsToFeatures","next","accept","bindings","head","vars","requiredField","seenFeatures","rawData","rd","parentUniqueId","pid","sf","subfeature","seenFeature","RdfPlugin","sparqlAdapterConfigSchema","SPARQLAdapterClass","twoBitLocation","chromSizesLocation","Translation","codonTable","frame","seqStart","frameShift","frameShiftAdjustedSeqLength","multipleOfThreeLength","seqSliced","translated","codon","normalizedCodon","aminoAcid","letter","codonWidth","renderLetter","defaultFill","framesCDS","frames","codonFill","defaultStarts","startCodon","defaultStops","stopCodon","Sequence","sequenceType","getContrastText","SequenceSVG","showReverse","showForward","showTranslation","generateCodonTable","defaultCodonTable","currY","showSequence","forwardFrames","reverseFrames","topFrames","bottomFrames","toReversed","complement","userSelect","sequenceHeight","DivSequenceRenderer","fastaLocation","faiLocation","metadataLocation","gziLocation","rewriteRefNames","searchForward","searchReverse","caseInsensitive","divSequenceRendererConfigSchema","SequencePlugin","DivSequenceRendererF","TwoBitAdapterF","BgzipFastaAdapterF","ChromSizesAdapterF","IndexedFastaAdapterF","UnindexedFastaAdapterF","SequenceSearchAdapterF","createReferenceSeqTrackConfig","ReferenceSequenceTrackF","showForwardActual","showReverseActual","showTranslationActual","toggleShowForward","toggleShowReverse","toggleShowTranslation","LinearReferenceSequenceDisplayF","createExtensionPoints","fontHeight","featureWidth","allowedWidthExpansion","totalWidth","measuredTextWidth","viewLeft","labelVisible","setLabelVisible","rstart","featureWidthBp","offsetPx1","rootLayout","shouldShowName","shouldShowDescription","featureLayout","GlyphComponent","FeatureLabel","OverlayRect","rectProps","rectTop","screenWidth","rectHeight","leftWithinBlock","widthWithinBlock","handlers","mouseoverFeatureId","renderOverlay","setRenderOverlay","onFeatureMouseOut","onFeatureMouseOver","onFeatureMouseDown","onFeatureMouseEnter","onFeatureMouseUp","onFeatureMouseLeave","onFeatureMouseMove","reverseFlip","color2","topLevel","featureStart","featureEnd","featureType","featureStrand","featurePhase","isUTR","getFrame","frameColor","Arrow","subfeatureId","subfeatureLayout","getSubparts","hasUTRs","isTranscript","subs","subparts","haveLeftUTR","haveRightUTR","codeStart","codeEnd","exons","subpart","makeUTRs","confKey","makeSubpartsFilter","filterSubpart","ProcessedTranscript","Segments","layOut","extraGlyphs","layOutFeature","layOutSubfeatures","Subfeatures","topOffset","SubfeatureGlyphComponent","chooseGlyphComponent","subfeatureHeight","hasSubSub","validator","glyph","parentFeature","layoutParent","RenderedFeatureGlyph","detectRerender","labelAllowed","expansion","getWidth","glyphWidth","textWidth","aboveLayout","FeatureGlyph","RenderedFeatures","isFeatureDisplayed","featureDisplayHandler","maxConfHeight","useCallback","featureIdCurrentlyUnderMouse","SvgOverlay","color1","color3","labels","nameColor","descriptionColor","subParts","impliedUTRs","SvgFeatureRenderer","SVGPlugin","SvgFeatureRendererReactComponent","svgFeatureRendererConfigSchema","EditGCContentParamsDialog","SharedModelF","windowSize","windowDelta","setGCContentParams","windowSizeSetting","windowDeltaSetting","GCContentPlugin","GCContentAdapterF","configSchemaFactory1","stateModelF1","configSchemaFactory2","stateModelF2","LinearGCContentDisplayF","MakeSpreadsheetColumnType","DataCellReactComponent","FilterModelType","compare","categoryName","hasFilter","textFilterControlAdornment","textFilterControl","FilterReactComponent","filterModel","operationChoices","getPropertyMembers","operation","setOperation","locStringIsInvalid","setLocString","ClearIcon","OPERATION_PREDICATES","overlaps with","cellLocation","specifiedLocation","contained within","fully contains","columnNumber","parsed","parsedLocString","spreadsheet","predicate","_sheet","cellsWithDerived","cells","cell","extendedData","parsedCellText","cellA","cellB","compareLocs","_columnNumber","newViewId","locationLinkClick","OPERATIONS","textInCell","stringToFind","equals","starts with","ends with","indexOf","setString","ColumnTextFilter","TextColumnType","NumberFilterModel","numberInCell","firstNumber","greater than","less than","between","secondNumber","firstNumberIsInvalid","setFirstNumber","secondNumberIsInvalid","setSecondNumber","ColumnTypes","Text","LocString","LocRef","LocStart","LocEnd","allColumnTypes","AnyColumnType","AnyFilterModelType","columnType","CellModel","toggleSelect","unSelect","select","setExtendedData","columns","column","isDerived","isLoaded","RowModel","passingFiltersCount","sortedFilteredRows","selectedCount","selectedRows","selectedAndPassingFiltersCount","selectedFilteredRows","sortedRows","rowSortingComparisonFunction","sheet","filterControls","rowPassesFilters","unselectAll","ColumnDefinition","dataType","derivationFunctionText","rowSet","StaticRowSetModel","columnDisplayOrder","hasColumnNames","sortColumns","descending","switchDirection","defaultDataType","rowMenuPosition","hideRowSelection","dataTypeChoices","rowA","rowB","setRowMenuPosition","newPosition","setSortColumns","newSort","setColumnType","newTypeName","fileTypes","fileTypeParsers","CSV","parseCsvBuffer","TSV","parseTsvBuffer","VCF","parseVcfBuffer","BED","parseBedBuffer","BEDPE","parseBedPEBuffer","STAR-Fusion","parseSTARFusionBuffer","fileTypesRegexp","ImportWizard","fileType","hasColumnNameLine","columnNameLineNumber","selectedAssemblyName","fileSource","isReadyToOpen","canCancel","readyToDisplay","requiresUnzip","setSelectedAssemblyName","setFileSource","newSource","firstMatch","toggleHasColumnNameLine","setColumnNameLineNumber","newnumber","setFileType","cancelButton","import","typeParser","unzip","filehandle","readFile","displaySpreadsheet","RowFullTextFilter","rowFullText","columnFilters","AnyColumnFilter","setRowFullTextFilter","addBlankColumnFilter","removeColumnFilter","clearAllFilters","defaultRowMenuItems","DoneIcon","_view","rowNumber","hideFilterControls","FilterControlsModel","importWizard","ImportWizardModel","SpreadsheetModel","rowMenuItems","outputRows","setRowMenuItems","newItems","setImportMode","SpreadsheetViewPlugin","SpreadsheetViewF","exts","ext","pop","LaunchSpreadsheetViewF","ViewComfyIcon","circularViewOptions","svInspector","circularViewOptionsBarHeight","item","control","onlyDisplayRelevantRegionsInCircularView","setOnlyDisplayRelevantRegionsInCircularView","resizeHandleVert","resizeHandleHoriz","viewControls","viewsContainer","SvInspectorView","SpreadsheetViewReactComponent","CircularViewReactComponent","showCircularView","spreadsheetView","ret1","circularView","flexbox","CircularViewOptions","makeAdHocFeature","columnsAlreadyUsedInLocations","loc1","loc2","otherData","getFeatureForRow","vcfFeature","columnTypes","columnDefinition","locationColumnNumbers","locStartColumnNumbers","locEndColumnNumbers","locRefColumnNumbers","makeAdHocSvFeatureFromTwoLocations","textOf","colno","makeAdHocSvFeatureFromTwoRefStartEndSets","makeAdHocSvFeature","breakpointSplitViewSnapshotFromTableRow","svInspectorView","defaultOnChordClick","chordTrack","SvInspectorViewPlugin","SpreadsheetViewType","CircularViewType","CircularModel","featuresAdapterConfigSnapshot","featureRefNames","featuresCircularTrackConfiguration","spreadsheetWidth","circularViewWidth","refSet","reaction","generatedTrackConf","OpenInNewIcon","canOpenBreakpointSplitViewFromTableRow","openBreakpointSplitViewFromTableRow","SvInspectorViewF","LaunchSvInspectorViewF","TableChartIcon","baseColor","HicRenderer","useLogScale","setUseLogScale","hicLocation","HicPlugin","HicAdapterF","HicRendererF","HicTrackF","LinearHicDisplayF","ixFilePath","ixxFilePath","metaFilePath","TrixPlugin","LabeledRegionModel","RegionModel","setLabel","SharedBookmarksModel","sharedBookmarks","localStorageKeyF","host","highlightButton","showBookmarkHighlights","showBookmarkLabels","bookmarks","bookmark","removeBookmarkObject","sx","rev","GridBookmarkPlugin","selectedBookmarks","selectedAssembliesPre","bookmarkAssemblies","validAssemblies","areBookmarksHighlightedOnAllOpenViews","areBookmarksHighlightLabelsOnAllOpenViews","bookmarksWithValidAssemblies","sharedBookmarksModel","allBookmarksModel","setSelectedAssemblies","selectedAssemblies","importBookmarks","removeBookmark","updateBookmarkLabel","correspondingObj","updateBookmarkHighlight","updateBulkBookmarkHighlights","setSelectedBookmarks","setBookmarkedRegions","setHighlightToggle","toggle","toggleShowBookmarkHighlights","setLabelToggle","toggleShowBookmarkLabels","clearAllBookmarks","clearSelectedBookmarks","AddHighlightModelF","GridBookmarkWidgetF","activateBookmarkWidget","navigateNewestBookmark","bookmarkCurrentRegion","selectedRegions","superRubberBandMenuItems","BookmarksIcon","HighlightIcon","activationSequence","SVG","Alignments","Authentication","Bed","CircularView","Config","DataManagement","DotplotView","Gff3","LegacyJBrowse","LinearComparativeView","Lollipop","Menus","RDF","Variants","Wiggle","GCContent","SvInspectorPlugin","ComparativeAdapters"],"sourceRoot":""}