Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,80 @@
# 3decision_plugin_maestro
# 3decision Maestro Plugin

A Maestro plugin to search and load structures from the 3decision database.

## Features

- **Search**: Search for structures by keyword, PDB code, target name, or other criteria
- **Column Filters**: Filter results by any column (supports numeric filters like `<2.0` for resolution)
- **Projects**: Browse and load structures from your 3decision projects
- **Transformation Matrices**: Structures from projects are loaded with their alignment transformations
- **Associated Files**: View and open associated files (CCP4, MTZ, PDB, CIF, etc.)
- **Metadata**: Structure properties are preserved in the Maestro Project Table

## Installation

1. In Maestro, go to **Scripts > Install Custom Scripts...**

2. Navigate to the `3decision_plugin_maestro` folder and select `threedecision_maestro.py`

3. Click **Install**

4. Restart Maestro

5. The plugin appears in **Scripts > 3decision**

**Note:** The installer automatically copies both `threedecision_maestro.py` and the `threedecision_maestro_dir/` folder containing the plugin files.

## Configuration

1. Open the plugin from **Scripts > 3decision**
2. Click **Settings**
3. Enter your 3decision API URL (e.g., `https://your-instance.discngine.cloud`)
4. Enter your API Key
5. Click **Test Connection** to verify
6. Click **Save**

Configuration is saved to `~/.3decision_maestro_config`.

## Usage

### Search Tab
- Enter a search term and click **Submit**
- Use the filter fields below the search to narrow results
- Resolution filter supports: `<2.0`, `>1.5`, `1.5-3.0`, `<=2.0`
- Select structures and click **Load Selected in Maestro**

### Projects Tab
- Click **Refresh Projects** to load your projects
- Click a project to see its structures
- Use filters to narrow down structures
- Click **View** to see associated files for a structure
- Select structures and click **Load Selected Structures**

### Associated Files Tab
- Shows files for the selected structure (CCP4 maps, MTZ, etc.)
- **Open in Maestro**: Import structure/map files directly
- **Download & Open**: Open with system default application

## Loaded Structure Properties

Structures imported into Maestro include these properties:
- `s_user_3decision_structure_id`
- `s_user_3decision_external_code`
- `s_user_3decision_label`
- `s_user_3decision_source`

## Requirements

- Maestro 2020-1 or later
- Network access to your 3decision server

## Troubleshooting

**Plugin doesn't appear in Scripts menu:**
- Restart Maestro after installation

**Connection failed:**
- Verify your API URL includes `https://`
- Check that your API key is valid
- Check network/proxy settings
66 changes: 66 additions & 0 deletions threedecision_maestro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#Name: Discngine 3decision
#Command: pythonrun threedecision_maestro.run_plugin
"""
3decision Maestro Plugin

Search and load structures from 3decision database into Maestro.
"""

__version__ = "1.0"
_panel = None


def run_plugin():
"""Launch the 3decision plugin panel."""
global _panel
import sys
import os

# The plugin files are in threedecision_maestro_dir/ next to this script
script_dir = os.path.dirname(os.path.abspath(__file__))
plugin_dir = os.path.join(script_dir, "threedecision_maestro_dir")

# Fallback: check if files are in the same directory (development mode)
if not os.path.exists(os.path.join(plugin_dir, "gui.py")):
plugin_dir = script_dir

if plugin_dir not in sys.path:
sys.path.insert(0, plugin_dir)

try:
from gui import ThreeDecisionPanel
_panel = ThreeDecisionPanel.panel(run=True)
return _panel
except ImportError as e:
msg = (
f"Failed to load 3decision plugin: {e}\n\n"
"The plugin folder must contain: gui.py, api_client.py\n\n"
f"Current location: {plugin_dir}"
)
print(f"ERROR: {msg}")
try:
from schrodinger.Qt.QtWidgets import QMessageBox
QMessageBox.critical(None, "3decision Plugin Error", msg)
except ImportError:
# QMessageBox not available (running outside Maestro)
pass
except Exception as ui_error:
# Log unexpected errors without crashing
print(f"WARNING: Could not display error dialog: {ui_error}")
return None


def open_panel():
"""
Alternative entry point for opening the panel.

This can be used from the Maestro Python console:
import threedecision_maestro
threedecision_maestro.open_panel()
"""
return run_plugin()


if __name__ == "__main__":
# Allow running the script directly for testing
run_plugin()
19 changes: 19 additions & 0 deletions threedecision_maestro_dir/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
3decision Maestro Plugin v1.0

A plugin to search and load structures from 3decision database into Maestro.
"""
#Name: 3decision
#Command: pythonrun threedecision_maestro.run_plugin

# Plugin version
__version__ = "1.0"

def run_plugin():
"""
Launch the 3decision plugin panel.
This is the entry point called by Maestro's pythonrun command.
"""
from .gui import ThreeDecisionPanel
panel = ThreeDecisionPanel.panel(run=True)
return panel
Loading