High-Level System Architecture
Relevant source files
The following files were used as context for generating this wiki page:
The DXKB (Data and Knowledge Base) web application is a complex bioinformatics platform built on a distributed service-oriented architecture. It integrates multiple backend bio-services, a centralized data API, and a workspace management system to provide genomic analysis tools, data visualization, and collaborative research environments. The frontend is primarily a Single Page Application (SPA) driven by the Dojo Toolkit, utilizing a custom routing system to navigate between specialized analysis widgets and data viewers.
Core System Components
The DXKB architecture consists of a web server layer, a specialized API gateway layer, and various backend analytical services. The system relies on a token-based authentication mechanism to secure user data across these distributed components.
Backend Infrastructure and APIs
The system communicates with several specialized backend services, which are monitored for health and availability. Key services include:
| Service Name | Purpose | Configuration Key |
|---|---|---|
| Auth | User registration, login, and token management. | userServiceURL |
| Data API | Centralized access to public and private PATRIC data. | dataAPI |
| Workspace | Management of user-created folders and analysis objects. | workspaceServiceURL |
| App Service | Handling of asynchronous genomic analysis job submissions. | serviceAPI |
| Homology | Specialized service for BLAST queries. | homologyServiceURL |
| Shock | Storage and retrieval of large data files. | shockServiceURL |
Sources: public/js/p3/widget/viewer/SystemStatus.js:15-55, public/js/p3/app/p3app.js:410-435
Client-Side Application Structure
The application logic is encapsulated in the p3app module, which extends a base App class. It manages the application lifecycle, including startup, login verification, and global topic subscriptions for inter-widget communication.
The diagram illustrates the relationship between the main application controller and backend service APIs.
Sources: public/js/p3/app/p3app.js:18-40, public/js/p3/app/p3app.js:410-430
Routing and Navigation
DXKB uses a custom client-side router to manage state transitions without full page reloads. The router maps URL patterns to specific Dojo widgets (viewers or apps) and handles complex state parameters passed via URL segments, query strings, and hashes.
Route Registration Examples
The application registers various routes that determine which widget class to instantiate based on the URL path:
| URL Pattern | Target Widget Class | Purpose |
|---|---|---|
/job(/.*) | p3/widget/JobManager | Monitoring analysis job status. |
/workspace(/.*) | p3/widget/WorkspaceManager | Browsing and managing files. |
/view/(.*) | p3/widget/viewer/[type] | Data-specific visualizations. |
/app/(.*) | p3/widget/app/[type] | Analytical tool submission forms. |
Sources: public/js/p3/app/p3app.js:180-380
State Management
The getState and populateState functions parse the current URL to build a state object that includes the pathname, search parameters, and hash parameters. This object is used to initialize the target widget with the correct context.
Sources: public/js/p3/app/p3app.js:115-160
Analysis Tool Architecture (AppBase)
Analysis tools (e.g., MSA, Primer Design, Comprehensive Genome Analysis) derive from AppBase.js. This base class provides a standardized framework for handling job submissions to the App Service.
Job Submission Flow
- Validation: Widgets perform local validation of user inputs (e.g., checking FASTA formats).
- Parameter Mapping: Form values are converted into a JSON payload compatible with the backend service.
- Authentication: Requests are signed with the
authorizationTokenstored in local storage. - Submission: The
doSubmitfunction calls theAppService.start_app2RPC method.
Sequence of events during an analysis job submission.
Sources: public/js/p3/widget/app/AppBase.js:250-300, public/js/p3/widget/app/AppBase.js:302-335
Workspace and Data Interaction
The WorkspaceBrowser acts as a central hub for interacting with data stored in the user's workspace. It utilizes a ContainerActionBar for global actions and an ActionBar for context-sensitive operations based on selected items.
Contextual Actions
Actions are dynamically available based on the validTypes of the selected workspace objects. For example:
- View: Navigates to a specific viewer based on file type (e.g.,
.nwkfiles triggerPhylogeneticTree2). - MSA: Only valid for
feature_grouptypes; it triggers a Multiple Sequence Alignment rerun. - Download: Handles single file downloads or zipping multiple files via the
WorkspaceManager.
Sources: public/js/p3/widget/WorkspaceBrowser.js:180-250, public/js/p3/widget/WorkspaceBrowser.js:400-450, public/js/p3/widget/WorkspaceBrowser.js:1050-1150
Authentication and Security
DXKB implements a persistent authentication state using browser localStorage.
- Token Persistence: The
tokenstringanduserProfileare stored locally. - Session Monitoring: The application performs a periodic check (
localStorageCheckInterval) to ensure the token hasn't been cleared in another tab or expired. - Automatic Refresh: If the mouse is active or an upload is in progress, the application automatically calls the
/authenticate/refresh/endpoint to extend the session. - Admin Elevation: Support for "Super User" (SU) mode allows administrators to switch identities, tracked via
AtokenstringandAauthstorage keys.
Sources: public/js/p3/app/p3app.js:460-520, public/js/p3/app/p3app.js:560-585, public/js/p3/app/p3app.js:630-650
Conclusion
The DXKB web application architecture is a modular, service-oriented system that decouples UI components from analytical logic. By utilizing a central application controller (p3app.js) and standardized base classes (AppBase.js), the project maintains a consistent interface for diverse genomic tools while effectively managing distributed backend resources and secure user sessions.