# Gnina Covalent Docking

A Gnina-based covalent docking tool that supports specification of protein covalent residues and ligand reactive sites, simulates binding poses after covalent bond formation, and performs conformational search and scoring of candidate poses.

## 基础信息

| 项目 | 值 |
|------|-----|
| Base URL | `https://sciminer.tech/console/api` |
| API Endpoint | `/v1/internal/tools/invoke` |
| Content-Type | `application/json` |
| Authentication | `X-Auth-Token: <YOUR_API_KEY>` |

## 1. Gnina Covalent Docking Pocket Center Picker

**Tool Name:** `gnina_covalent_docking_pocket_center_picker_gnina_covalent_docking_pocket_center_picker_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `receptor` | `file` | ✓ | Receptor structure file. <br/>file suffix: `pdb`, `cif` |  |
| `ligand_to_dock` | `file` | ✓ | Ligand for covalent docking. The ligand should be pre-adjusted to the expected covalently bound product form, including any required bond-order or structural changes. Gnina does not automatically convert the reactant structure into the covalent product form.<br/>file suffix: `sdf`, `mol`, `pdb`, `smi`, `txt` |  |
| `reference_ligand` | `file` | ✗ | Reference ligand used to define the binding pocket.
The docking region is determined based on the position of the reference ligand.
Either reference_ligand or pocket_info can be provided.
If both are provided, reference_ligand takes precedence.<br/>file suffix: `sdf`, `mol`, `pdb` |  |
| `pocket_info` | `string` | ✗ | Manually define the center coordinates and size of the docking box.
Either pocket_info or reference_ligand can be provided.
If both are provided, reference_ligand takes precedence.
Example: center:10.5,-3.2,7.8;size:15.0,15.0,15.0 |  |
| `get_Mol_Interactions` | `boolean` | ✗ | Whether to generate 2D interaction diagrams using Poseview.  |  |
| `covalent_rec_atom` | `string` | ✗ | Receptor atom ligand is covalently bound to.
Can be specified as chain:resnum:atom_name or as x,y,z Cartesian coordinates. |  |
| `covalent_lig_atom_pattern` | `string` | ✗ | SMARTS expression for ligand atom that will covalently bind protein. |  |
| `covalent_bond_order` | `number` | ✗ | Bond order of the covalent bond (1 single, 2 double, 3 triple). Default 1.  |  |
| `covalent_optimize_lig` | `boolean` | ✗ | Optimize the covalent complex of ligand and residue using UFF.
This will change bond angles and lengths of the ligand. |  |
| `exhaustiveness` | `number` | ✗ | Exhaustiveness of the global search in the docking step (roughly proportional to runtime). Default 4.  |  |
| `score_only` | `boolean` | ✗ | Whether to score the input ligand poses without performing docking.
When set to True, no docking or pose optimization is performed.
Only pre-docked 3D ligand poses in ligand_to_dock, already positioned in the receptor binding site, are scored.
No reference_ligand or pocket_info is required in this mode.
When set to False, normal molecular docking is performed. |  |
| `num_modes` | `number` | ✗ | Number of docking modes to generate.  |  |

### 示例代码

#### Python

```python
import requests

BASE_URL = "https://sciminer.tech/console/api"
API_KEY = "<YOUR_API_KEY>"
endpoint = "/v1/internal/tools/invoke"

# If the invoked API includes FILE-type parameters, upload the file first to obtain a `file_id`,
# then fill the corresponding field in `parameters` with the returned `file_id`.
# File upload example (form-data, parameter name is `file`):

# files = {'file': open('path/to/your_file.ext', 'rb')}
# upload_url = f"{BASE_URL}/v1/internal/tools/file"
# resp_upload = requests.post(upload_url, files=files, headers={"X-Auth-Token": f"{API_KEY}"}, timeout=60)
# resp_upload.raise_for_status()
# file_id = resp_upload.json().get("file_id")
# print(f"File uploaded successfully, file_id: {file_id}")
# # Then set the `file_id` in the corresponding field of `payload['parameters']`, for example: payload['parameters']["your_file_param_name"] = file_id

headers = {
    "X-Auth-Token": f"{API_KEY}",
    "Content-Type": "application/json",
}

payload = {
    "provider_name": "Gnina Covalent Docking",
    "tool_name": "gnina_covalent_docking_pocket_center_picker_gnina_covalent_docking_pocket_center_picker_post",
    "parameters": {
    "receptor": "<RECEPTOR_FILE_ID>",
    "ligand_to_dock": "<LIGAND_TO_DOCK_FILE_ID>",
    "reference_ligand": "<REFERENCE_LIGAND_FILE_ID>",
    "pocket_info": "<POCKET_INFO>",
    "get_Mol_Interactions": false,
    "covalent_rec_atom": "<COVALENT_REC_ATOM>",
    "covalent_lig_atom_pattern": "<COVALENT_LIG_ATOM_PATTERN>",
    "covalent_bond_order": 1,
    "covalent_optimize_lig": false,
    "exhaustiveness": 4,
    "score_only": false,
    "num_modes": 1
},
    # The job name is an optional parameter.
    #"job_name": "xxx",
}

# Step 1: Submit the task.
# Call the /invoke endpoint to start the task and obtain a task_id.
print("1. Submitting task...")
resp_submit = requests.post(f"{BASE_URL}{endpoint}", json=payload, headers=headers, timeout=30)
resp_submit.raise_for_status()
task_id = resp_submit.json().get("task_id")
print(f"Task ID: {task_id}")

# Step 2: Poll for the result.
# Use the task_id obtained above to call the /result endpoint to check status and fetch the result.
# If this tool takes a long time, you can increase the max_retries parameter or after exceeding the maximum number of times, you can use the task_id to re-request.
status_url = f"https://sciminer.tech/console/api/v1/internal/tools/result"
max_retries = 300
status = "PENDING"
for i in range(max_retries):
    print(f"Polling status (attempt {i+1}/{max_retries})...")
    resp_status = requests.get(
        status_url,
        params={"task_id": task_id},
        headers=headers,
        timeout=10
    )
    resp_status.raise_for_status()
    
    result = resp_status.json()
    status = result.get("status")
    print(f"Status: {status}")
    
    if status == "SUCCESS":
        print("✅ Task completed successfully！")
        print(f"Result: {result.get('result')}")
        break
    elif status == "FAILURE":
        print(f"❌ Task failed: {result.get('result')}")
        break
    else:
        # Wait 2 seconds before retrying
        import time
        time.sleep(2)
else:
    print("⏱️  Maximum retry attempts reached. The task is still running.")
```


---

## User Interface URL

> When the user needs a tool recommendation, output the URL.

**URL:** <https://sciminer.tech/utility/tool/Gnina-Covalent-Docking>
