# PocketXMol

A unified generative model for pocket-specific molecular generation, supporting molecular docking, structure-based drug design, and peptide design.

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. Dock a small molecule or peptide into a protein binding pocket using PocketXMol generative model.

**Tool Name:** `dock_gpu_dock_gpu_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `noise_mode` | `select` | ✗ | Docking noise mode (options: gaussian, flexible, default: gaussian) | `gaussian`, `flexible` |
| `protein` | `file` | ✓ | Protein structure file (supported formats: pdb, required)<br/>file suffix: `pdb` |  |
| `ligand_smiles` | `string` | ✗ | Ligand SMILES string for docking (provide either SMILES, ligand file, or peptide sequence, required if no ligand file or peptide sequence) |  |
| `ligand_file` | `file` | ✗ | Ligand structure file for docking (supported formats: sdf, pdb, optional, provide either SMILES, ligand file, or peptide sequence)<br/>file suffix: `sdf`, `pdb` |  |
| `peptide_sequence` | `string` | ✗ | Amino acid sequence for peptide docking using one-letter codes (e.g. DTVDFFEVFL). When is_cyclic is true, the sequence is converted through the cyclic peptide construction path. |  |
| `is_cyclic` | `boolean` | ✗ | Whether the peptide ligand is cyclic. For peptide_sequence input, this routes through the cyclic peptide construction path instead of the linear peptide path. |  |
| `binding_site` | `string` | ✓ | Binding site center and box size (format: Center:X,Y,Z;Size:S, required) |  |
| `num_mols` | `number` | ✗ | Number of molecules to generate (range: 1-100, default: 10) |  |
| `num_steps` | `number` | ✗ | Number of denoising steps (range: 10-200, default: 100) |  |
| `batch_size` | `number` | ✗ | Batch size for sampling (range: 1-100, default: 50) |  |

### 示例代码

#### 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": "PocketXMol",
    "tool_name": "dock_gpu_dock_gpu_post",
    "parameters": {
    "noise_mode": "<NOISE_MODE>",
    "protein": "<PROTEIN_FILE_ID>",
    "ligand_smiles": "<LIGAND_SMILES>",
    "ligand_file": "<LIGAND_FILE_FILE_ID>",
    "peptide_sequence": "<PEPTIDE_SEQUENCE>",
    "is_cyclic": false,
    "binding_site": "<BINDING_SITE>",
    "num_mols": 10,
    "num_steps": 100,
    "batch_size": 50
},
    # 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.")
```


---

## 2. Design novel small molecules with PocketXMol for SBDD, fragment linking, or fragment growing.

**Tool Name:** `sbdd_gpu_sbdd_gpu_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `task_type` | `select` | ✗ | Small-molecule generation task (options: sbdd, linking, growing, default: sbdd) | `sbdd`, `linking`, `growing` |
| `mode` | `select` | ✗ | Generation mode (options: autoregressive, one_shot, default: autoregressive) | `autoregressive`, `one_shot` |
| `fragment_pose_mode` | `select` | ✗ | How to treat input fragment positions for linking/growing (options: fixed, free, small, default: fixed). Use small for fragment redesign-like cases. | `fixed`, `free`, `small` |
| `protein` | `file` | ✓ | Protein structure file (supported formats: pdb, required)<br/>file suffix: `pdb` |  |
| `ligand_file` | `file` | ✗ | Input ligand/fragment structure file for linking or growing (supported formats: sdf, required for linking and growing)<br/>file suffix: `sdf`, `pdb` |  |
| `binding_site` | `string` | ✗ | Binding site center and box size (format: Center:X,Y,Z;Size:S, required for sbdd; optional for linking and growing) |  |
| `fragment_groups` | `string` | ✗ | Grouped fragment atom indices for linking/growing. Use JSON like [[0,1,2],[10,11]] or '0,1,2;10,11'. Required for linking/growing. |  |
| `anchor_groups` | `string` | ✗ | Optional grouped anchor atom indices for linking, matching fragment_groups. Use JSON like [[6],[23]]. |  |
| `use_input_pose` | `boolean` | ✗ | For linking/growing with free or small fragment perturbation, whether to start from the uploaded fragment pose instead of sampling fragment positions from the prior. |  |
| `part1_level_min` | `number` | ✗ | Minimum denoising level for fragment part1. Set higher values such as 0.8 to keep fragments closer to the input pose, as in approximate/redesign examples. |  |
| `init_step` | `number` | ✗ | Initial noise level. Use values below 1.0 to start closer to the input structure for optimization-like cases. |  |
| `num_atoms` | `number` | ✗ | Target number of heavy atoms for generated molecules (range: 5-80, default: 28) |  |
| `num_mols` | `number` | ✗ | Number of molecules to generate (range: 1-100, default: 10) |  |
| `num_steps` | `number` | ✗ | Number of denoising steps (range: 10-200, default: 100) |  |
| `batch_size` | `number` | ✗ | Batch size for sampling (range: 1-100, default: 50) |  |

### 示例代码

#### 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": "PocketXMol",
    "tool_name": "sbdd_gpu_sbdd_gpu_post",
    "parameters": {
    "task_type": "<TASK_TYPE>",
    "mode": "<MODE>",
    "fragment_pose_mode": "<FRAGMENT_POSE_MODE>",
    "protein": "<PROTEIN_FILE_ID>",
    "ligand_file": "<LIGAND_FILE_FILE_ID>",
    "binding_site": "<BINDING_SITE>",
    "fragment_groups": "<FRAGMENT_GROUPS>",
    "anchor_groups": "<ANCHOR_GROUPS>",
    "use_input_pose": false,
    "part1_level_min": 0,
    "init_step": 1,
    "num_atoms": 28,
    "num_mols": 10,
    "num_steps": 100,
    "batch_size": 50
},
    # 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.")
```


---

## 3. Design peptides for a protein binding pocket using PocketXMol generative model. Supports de novo design, inverse folding, and side-chain packing.

**Tool Name:** `pepdesign_gpu_pepdesign_gpu_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `mode` | `select` | ✗ | Peptide design mode (options: denovo, inverse_folding, sc_packing, default: denovo) | `denovo`, `inverse_folding`, `sc_packing` |
| `protein` | `file` | ✓ | Protein structure file (supported formats: pdb, required)<br/>file suffix: `pdb` |  |
| `binding_site` | `string` | ✗ | Binding site center and box size (format: Center:X,Y,Z;Size:S, required for denovo mode; inferred from peptide_file for inverse_folding and sc_packing) |  |
| `is_cyclic` | `boolean` | ✗ | Whether to design a cyclic peptide. Used in denovo mode to generate cycpeplen_<n>; ignored when peptide_file is provided. |  |
| `peptide_length` | `string` | ✗ | Target peptide length for de novo design (range: 3-30, default: 10, only used in denovo mode) |  |
| `peptide_file` | `file` | ✗ | Input peptide structure file for inverse folding or side-chain packing (supported formats: pdb, required for inverse_folding and sc_packing modes)<br/>file suffix: `pdb` |  |
| `num_mols` | `number` | ✗ | Number of peptides to generate (range: 1-100, default: 10) |  |
| `num_steps` | `number` | ✗ | Number of denoising steps (range: 10-200, default: 100) |  |
| `batch_size` | `number` | ✗ | Batch size for sampling (range: 1-100, default: 50) |  |

### 示例代码

#### 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": "PocketXMol",
    "tool_name": "pepdesign_gpu_pepdesign_gpu_post",
    "parameters": {
    "mode": "<MODE>",
    "protein": "<PROTEIN_FILE_ID>",
    "binding_site": "<BINDING_SITE>",
    "is_cyclic": false,
    "peptide_length": "<PEPTIDE_LENGTH>",
    "peptide_file": "<PEPTIDE_FILE_FILE_ID>",
    "num_mols": 10,
    "num_steps": 100,
    "batch_size": 50
},
    # 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/PocketXMol>
