This document provides comprehensive documentation for all functions in the JBrowse2 Rich Annotations Plugin, organized by module and functionality.
The plugin provides four main views for genomic feature visualization:
- SelectImageGalleryView: Image display for selected features
- SelectTextualDescriptionsView: Markdown document rendering for selected features
- FlexibleImageGalleryView: Searchable image gallery with assembly/track selection
- FlexibleTextualDescriptionsView: Searchable textual descriptions with assembly/track selection
Main plugin class that manages view registration and feature selection monitoring.
install(pluginManager: PluginManager): Registers four view types with the plugin managerconfigure(pluginManager: PluginManager): Adds menu items for manual view creation and sets up autorun for feature selection monitoringmanageSelectImageGalleryView(session, featureSummary): Updates SelectImageGalleryView based on current feature selectionmanageSelectImageGalleryViewWithoutImages(session, featureSummary): Updates SelectImageGalleryView for features without imagesmanageSelectTextualDescriptionsView(session, featureSummary): Updates SelectTextualDescriptionsView based on current feature selectionclearSelectImageGalleryView(session): Clears the SelectImageGalleryViewclearSelectTextualDescriptionsView(session): Clears the SelectTextualDescriptionsViewcollectImagesFromFeatureAndSubfeatures(feature): Extracts image data from a feature and all its subfeaturescollectTextualContentFromFeatureAndSubfeatures(feature): Extracts textual content from a feature and all its subfeatures
State model for the select image gallery view.
updateFeature(featureId, featureType, images, labels?, types?): Updates the view with feature image dataclearFeature(): Clears the current feature dataupdateFeatureWithoutImages(featureId, featureType): Updates the view for a feature without images
defaultDisplayName: Returns the default display name for the viewmaxItems: Returns the maximum number of items to displayimageSize: Returns the image size configurationgff3AttributeNames: Returns the GFF3 attribute names configurationhasContent(): Returns whether the view has content to displaydeduplicatedImages(): Returns deduplicated list of images
State model for the select textual descriptions view.
updateFeature(featureId, featureType, markdownUrls, descriptions?, contentTypes?): Updates the view with feature textual dataclearFeature(): Clears the current feature data
defaultDisplayName: Returns the default display name for the viewmaxItems: Returns the maximum number of items to displaygff3AttributeNames: Returns the GFF3 attribute names configurationhasContent(): Returns whether the view has content to displaydeduplicatedMarkdownUrls(): Returns deduplicated list of markdown URLs
State model for the flexible image gallery view with search capabilities.
updateFeature(featureId, featureType, images?, labels?, types?): Updates the view with feature image dataclearFeature(): Clears the current feature datasetSelectedAssembly(assemblyId): Sets the selected assemblysetSelectedTrack(trackId): Sets the selected tracksetSearchTerm(searchTerm): Sets the search termclearSearch(): Clears the searchselectFeature(featureId, featureType): Selects a featuresetSelectedFeature(featureId?, featureType?, images?, labels?, types?): Sets the selected feature with dataselectFeatureWithImageData(featureId?): Selects a feature and fetches its image dataclearFeatureSelection(): Clears the feature selectionclearSelections(): Clears all selectionssetLoadingFeatures(loading): Sets the loading state for featuressearchFeatures(): Searches for features
defaultDisplayName: Returns the default display name for the viewhasContent(): Returns whether the view has content to displaydisplayTitle: Returns the display title for the viewcanSelectFeature: Returns whether a feature can be selected
State model for the flexible textual descriptions view with search capabilities.
updateFeature(featureId, featureType, content, descriptions?, contentTypes?): Updates the view with feature textual dataclearFeature(): Clears the current feature datasetSelectedAssembly(assemblyId): Sets the selected assemblysetSelectedTrack(trackId): Sets the selected tracksetSearchTerm(searchTerm): Sets the search termclearSearch(): Clears the searchselectFeature(featureId, featureType): Selects a featuresetSelectedFeature(featureId?, featureType?, markdownUrls?, descriptions?, contentTypes?): Sets the selected feature with dataclearFeatureSelection(): Clears the feature selectionclearSelections(): Clears all selectionssetLoadingFeatures(loading): Sets the loading state for featuressearchFeatures(): Searches for features
defaultDisplayName: Returns the default display name for the viewhasContent(): Returns whether the view has content to display
Base state model providing common functionality for all views.
setWidth(newWidth): Sets the width of the view panelsetDisplayName(name): Sets the display name for the viewsetMinimized(flag): Sets the minimized state for the viewcloseView(): Closes the view by removing it from the sessionupdateFeature(featureId, featureType, content, descriptions?, contentTypes?): Updates the feature and content displayed in this viewclearFeature(): Clears the current feature
pluginManager: Access to the JBrowse plugin managersession: Access to the current JBrowse sessionassemblyManager: Access to the assembly manageravailableAssemblies: List of available assembly namestrackConfigurations: Track configurations using proper JBrowse patternsgetTracksForAssembly(assemblyName): Gets track configurations filtered by assemblygetAssembly(assemblyId): Gets assembly object using proper async patternconfig: Access to JBrowse configurationdefaultDisplayName: Default display name for the viewmenuItems(): Menu items for the viewhasContent(): Whether the view has content to displaydisplayTitle: Display title for the view
Mixin providing search functionality for flexible views.
availableAssemblies: Available assemblies in the sessionavailableTracks: Available tracks for the selected assemblyassemblyName: Name of the selected assemblyselectedAssembly: Selected assembly objectselectedTrack: Selected track objecthasSelectedAssembly: Whether an assembly is selectedhasSelectedTrack: Whether a track is selectedhasSearchResults: Whether there are search resultshasSearchTerm: Whether there is a search termfeatures: List of features from search resultscanSearch: Whether search is availableisReady: Whether the view is ready for interactionisTrackReady: Whether the track is readyviewDisplayName: Display name including selected featureselectedFeature: Currently selected feature from search results
setSelectedAssembly(assemblyId): Sets the selected assemblysetSelectedTrack(trackId): Sets the selected tracksetSearchTerm(searchTerm): Sets the search termclearSearchBase(): Base implementation for clearing searchclearSearch(): Clears the searchselectFeature(featureId, featureType): Selects a featureclearFeatureSelection(): Clears the feature selectionclearSelectionsBase(): Base implementation for clearing all selectionsclearSelections(): Clears all selectionssearchFeatures(): Searches for features
Utility functions for flexible views and feature searching.
searchTrackFeatures(session, trackConf, searchTerm, maxResults?): Searches track features using text search adaptergetBaseTrackConfigs(session): Gets all track configurations from sessionfindTrackById(trackConfs, trackId): Finds a track configuration by IDsafeGetAdapter(trackConf): Safely gets adapter configuration from trackgetAssemblyDisplayName(assembly): Gets display name for assemblygetAllTracksForAssembly(self, requestedAssemblyName): Gets all tracks for a specific assemblyextractTrackInfo(trackConf): Extracts track information for UI displaysearchFeatureRangeQueries(contentExtractor): Creates a search flow for feature range queriessearchFeatureTextIndex(contentExtractor): Creates a search flow using text indexgetFeatureId(feature): Gets feature ID from various possible attributesgetFeatureName(feature): Gets feature name from various possible attributes
Main wrapper component for the select image gallery view.
Main observer component that renders the image gallery content.
Component that handles image grouping, lazy loading, and display.
Component for lazy loading images with error handling.
Main wrapper component for the select textual descriptions view.
Main observer component that renders markdown content with custom components.
Component for rendering Cytoscape diagrams from JSON format.
Test component for flowchart content.
Component for rendering phylogenetic trees from Newick format.
Custom markdown components including code block handlers for visualizations.
FlexibleImageGalleryViewComponent (src/FlexibleImageGalleryView/components/FlexibleImageGalleryView.tsx)
Main component for the flexible image gallery view with search interface.
FlexibleTextualDescriptionsViewComponent (src/FlexibleTextualDescriptionsView/components/FlexibleTextualDescriptionsView.tsx)
Main component for the flexible textual descriptions view with search interface.
Component for selecting assemblies from available options.
Component for selecting tracks from the selected assembly.
Component for searching and selecting features with autocomplete.
Container component for flexible views.
Component displaying contextual instructions for users.
Component for displaying error messages.
Component for clearing all current selections.
Type declarations for external libraries:
phylojs: Types for phylogenetic tree parsing and manipulationcytoscape-dagre: Types for DAG layout extensioncytoscape-cola: Types for force-directed layout extensioncytoscape-klay: Types for hierarchical layout extension
Used for parsing Newick format phylogenetic trees in textual descriptions.
Used for rendering interactive diagrams and phylogenetic trees.
Used for rendering markdown content with custom components for visualizations.
- State Management: All state modifications happen within MobX actions
- Error Handling: Comprehensive error handling with user-friendly messages
- Performance: Lazy loading, intersection observers, and dynamic imports
- TypeScript: Full TypeScript support with proper type definitions
- JBrowse Best Practices: Follows AGENT.md guidelines for configuration access and state management
- Modularity: Clean separation between view types and shared functionality
- Testing: Functions designed to be testable with clear inputs/outputs