This guide provides information for developers working with or modifying the 3decision ChimeraX plugin.
chimerax-plugin/
├── bundle_info.xml # ChimeraX bundle metadata
├── setup.py # Python package setup
├── toolshed.yml # Toolshed metadata
├── install.sh # Installation script
├── test_plugin.py # Component testing
├── LICENSE # MIT license
├── README.md # User documentation
├── DEVELOPMENT.md # This file
├── src/ # Plugin source code
│ ├── __init__.py # Bundle API and initialization
│ ├── api_client.py # 3decision API client
│ ├── gui.py # Main user interface
│ ├── settings.py # Configuration dialog
│ ├── commands.py # Command-line interface
│ └── tool_info.py # Tool metadata
└── docs/ # Documentation
└── user/
└── tools/
└── threedecision.html # User help documentation
The API client handles all communication with 3decision services:
- Authentication: Login with API key and token management
- Search: Structure search submission and result polling
- Structure Export: PDB format downloads
- Project Management: Project and structure listing
- Configuration: Persistent settings storage
Key features:
- Asynchronous job polling for search results
- GraphQL integration for structure details
- SSL verification disabled for development servers
- Comprehensive error handling and logging
The main GUI provides a tabbed interface:
- Search Tab: Structure search with results table
- Projects Tab: Project browser with structure selection
- Background Processing: All network operations in threads
- Progress Indicators: Real-time status updates
Key classes:
ThreeDecisionTool: Main tool classSearchThread: Background search operationsJobPollingThread: Result pollingLoadStructuresThread: Structure loading into ChimeraXProjectBrowserWidget: Project navigation
Configuration interface for API credentials:
- Connection Testing: Background validation
- Secure Storage: Local credential persistence
- User-friendly Interface: Clear status indicators
Command-line interface registration:
3decision: Open the main tool3decision search <query>: Direct search command
- ChimeraX 1.10.1 or later
- Python 3.9+ (comes with ChimeraX)
- Access to a 3decision server for testing
You can test the core components outside ChimeraX:
cd /path/to/chimerax-plugin
python test_plugin.pyThis will verify:
- Module imports
- API client creation
- Configuration handling
For development, install the plugin in development mode:
# Method 1: Using the install script
./install.sh
# Method 2: Direct ChimeraX installation
chimerax --nogui --cmd "toolshed install '/path/to/chimerax-plugin'"
# Method 3: Development installation (if you have chimerax python access)
python setup.py develop- Start ChimeraX
- Open the Log panel: Tools → General → Log
- Load the plugin: Tools → Structure Analysis → 3decision
- Configure settings with test credentials
- Test search and loading functionality
The plugin integrates with these 3decision API endpoints:
GET /auth/api/login- AuthenticationGET /search/{query}- Search submissionGET /queues/basicSearch/jobs/{id}- Result pollingPOST /graphql- Structure details (GraphQL)POST /exports/structure- PDB export requestGET /exports/structure/{id}- PDB downloadGET /projects- Project listingGET /projects/{id}/structures/matrix- Project structures
- User configures API key in settings
- Plugin calls
/auth/api/loginwith API key - Server returns access token
- Token used for all subsequent requests
- Token refresh handled automatically on 401/403 errors
- Submit search query to
/search/{query} - Get job ID from response
- Poll
/queues/basicSearch/jobs/{id}until complete - Extract structure IDs from results
- Fetch detailed info via GraphQL
- Display results in table
- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Comprehensive docstrings for classes and functions
- Clear variable and function names
- Use ChimeraX logging system for user messages
- Follow ChimeraX tool development patterns
- Handle threading properly with Qt signals
- Clean up resources in tool deletion
- Log errors at appropriate levels
- Provide user-friendly error messages
- Handle network timeouts gracefully
- Validate user input
- Add method to
ThreeDecisionAPIClientclass - Include proper error handling and logging
- Update documentation with new endpoint
- Add tests if applicable
- Update the GUI layout in
gui.py - Connect new widgets to appropriate handlers
- Update threading if network calls are involved
- Test responsiveness
- Add command function to
commands.py - Register with ChimeraX command system
- Update help documentation
- Test command-line interface
The plugin uses ChimeraX's logging system. Debug messages appear in the Log panel.
- Import Errors: Check ChimeraX Python environment
- Network Issues: Verify server accessibility and credentials
- Threading Issues: Use proper Qt signal/slot connections
- Memory Leaks: Clean up threads and temporary files
- ChimeraX Log panel for runtime messages
- Python debugger (pdb) for step-through debugging
- Network monitoring tools for API issues
- ChimeraX developer documentation
The test_plugin.py script provides basic component testing:
python test_plugin.py- Install plugin in ChimeraX
- Configure with test server
- Test all major workflows:
- Authentication
- Search functionality
- Structure loading
- Project browsing
- Error handling
- Test with large result sets
- Monitor memory usage during bulk loading
- Verify thread cleanup
- Test network timeout handling
- Ensure all files are included in bundle
- Test installation on clean ChimeraX instance
- Verify documentation is complete
- Update version numbers consistently
For distribution via ChimeraX Toolshed:
- Ensure
bundle_info.xmlis complete - Include proper dependencies
- Test on multiple platforms if possible
- Follow ChimeraX packaging guidelines
- Fork the repository
- Create feature branch
- Make changes with tests
- Submit pull request with description
- Update user documentation for new features
- Keep development documentation current
- Include code comments for complex logic
Include:
- ChimeraX version
- Plugin version
- Steps to reproduce
- Error messages
- Log output
- ChimeraX Developer Documentation
- ChimeraX Plugin Development
- Qt for Python Documentation
- 3decision API Documentation
This project is licensed under the MIT License - see the LICENSE file for details.