This guide explains how to use the enhanced interactive UI for directly interacting with ChimeraX through the Hashi web interface.
The interactive UI provides a direct bridge between the web application and ChimeraX, allowing:
- Real-time execution of ChimeraX commands
- Interactive visualization of molecular structures
- Structure manipulation with live updates
- Snapshot generation with custom settings
- Command history and reuse
- WebSocket-based real-time feedback
To use the interactive UI:
- Make sure ChimeraX is installed at
/Applications/ChimeraX.app
- Install OSMesa:
brew install mesa
- Run the interactive server:
./run-interactive.sh
- Open your browser to: http://localhost:9876
- Start/Stop: Control the ChimeraX process lifecycle
- Status Monitoring: See real-time status of the ChimeraX process
- Console Output: View ChimeraX console output directly in the UI
- PDB ID: Load structures directly by PDB ID
- Quick Load: Pre-configured structures for quick testing
- Structure Tracking: UI automatically tracks the currently loaded structure
- Representation Styles: Switch between cartoon, sphere, stick, ball+stick, ribbon, surface
- Color Schemes: Apply different coloring schemes (chain, element, rainbow, etc.)
- Background Color: Change the rendering background color
- View Orientations: Set standard orientations (front, back, top, bottom)
- Direct Command Execution: Run any ChimeraX command directly
- Command History: Recall and reuse previous commands
- Command Queue: Commands are executed in order to prevent conflicts
- Resolution Control: Select from different output resolutions
- Image Downloading: Ctrl+Click on images to download
- Background Settings: Control transparency and background color
- WebSocket Communication: Real-time updates about ChimeraX state
- Loading Indicators: Visual feedback during operations
- Console Log: Command execution and process feedback in real-time
The interactive UI implementation consists of:
-
Frontend:
test-interactive.html
: A comprehensive UI with controls and viewers- WebSocket client for real-time updates
- Command queue management for reliable execution
-
Backend:
standalone-interactive.js
: Enhanced server with WebSocket support- ChimeraX process management with OSMesa integration
- Command queueing system to prevent race conditions
- Snapshot management with file handling
-
WebSocket Communication:
- Real-time event propagation from ChimeraX to UI
- Event types: process status, command execution, snapshots, etc.
- Bi-directional communication for interactive responses
This interactive UI provides a foundation for integration with the main Hashi application:
- The WebSocket communication pattern can be integrated with the main application
- The command execution and queueing system can be adapted for the production server
- The visualization controls showcase best practices for ChimeraX interaction
- The responsive UI design patterns can be incorporated into the main interface
Common issues and solutions:
- ChimeraX not found: Ensure ChimeraX is installed at the expected path
- OSMesa missing: Install with
brew install mesa
for off-screen rendering - Blank images: OSMesa may not be properly configured
- Command not executing: Check the console for error messages
- WebSocket disconnection: Restart the server if connection is lost
Future enhancements planned for the interactive UI:
- Structure manipulation controls (rotation, translation, zoom)
- Selection tools for atoms, residues, and chains
- Measurement tools for distances, angles, etc.
- Animation and trajectory support
- Multiple structure handling and comparison
- Integration with computational analysis tools