# RFdiffusion2

RFdiffusion 2 (RFD2) is a next-generation atomic-level protein design model focused on enzyme active-site scaffolding and small-molecule binding. It enables joint sequence–structure optimization and provides comprehensive design evaluation metrics.

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. Enzyme active-site design: scaffold new protein backbones around a preserved catalytic motif, optionally with bound ligands.

**Tool Name:** `get_enzyme_design_get_enzyme_design_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `contig_as_guidepost` | `select` | ✗ | Whether to treat contigs as guideposts.  | `True`, `False` |
| `pdb_file` | `file` | ✓ | Protein structure file in PDB format. <br/>file suffix: `pdb`, `cif` |  |
| `pdb_ORI_coordinates` | `string` | ✗ | Enter the coordinates to create the ORI atom (e.g., 6.0,22.0,8.5).  |  |
| `pdb_ORI_residues` | `string` | ✗ | Select pocket residues for creating the ORI atom (e.g., A: 1-172).  |  |
| `design_motif` | `string` | ✓ | Motif to preserve during design (e.g., A: 1-172; B: 1-18,30-34).  |  |
| `design_template` | `string` | ✓ | Scaffold template defining linker and motif layout (e.g., A: 46,m1,59,m2,2,m3,23,m4,46).  |  |
| `design_motif_atom` | `string` | ✗ | Motif residue atoms (e.g., A1051: OH,CZ\nA1083: NZ,CE).  |  |
| `ligand_residues_name` | `string` | ✗ | Ligand residue names in the input PDB (e.g., NAD,OXM).  |  |
| `partially_fixed_ligand` | `string` | ✗ | Ligands with partially fixed atoms (e.g., LLK:C12,C13).  |  |
| `only_guidepost_positions` | `string` | ✗ | Residues used as guideposts within the catalytic motif, picked with the residue selector (format: ChainID: start-end, semicolon-separated, e.g., A: 106-106; A: 166-166; must be a subset of design_motif, optional).  |  |
| `num_designs` | `number` | ✓ | Number of design results to generate (1-20).  |  |

### 示例代码

#### 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": "RFdiffusion2",
    "tool_name": "get_enzyme_design_get_enzyme_design_post",
    "parameters": {
    "contig_as_guidepost": "True",
    "pdb_file": "<PDB_FILE_FILE_ID>",
    "pdb_ORI_coordinates": "<PDB_ORI_COORDINATES>",
    "pdb_ORI_residues": "<PDB_ORI_RESIDUES>",
    "design_motif": "<DESIGN_MOTIF>",
    "design_template": "<DESIGN_TEMPLATE>",
    "design_motif_atom": "<DESIGN_MOTIF_ATOM>",
    "ligand_residues_name": "<LIGAND_RESIDUES_NAME>",
    "partially_fixed_ligand": "<PARTIALLY_FIXED_LIGAND>",
    "only_guidepost_positions": "<ONLY_GUIDEPOST_POSITIONS>",
    "num_designs": ""
},
    # 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. De novo small-molecule binder design: generate a novel binding protein around the ligand in the input PDB, with RASA-enforced burial.

**Tool Name:** `get_small_molecule_binder_design_get_small_molecule_binder_design_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `pdb_file` | `file` | ✓ | Protein structure file in PDB format. <br/>file suffix: `pdb`, `cif` |  |
| `pdb_ORI_coordinates` | `string` | ✗ | Enter the coordinates to create the ORI atom (e.g., 6.0,22.0,8.5).  |  |
| `pdb_ORI_residues` | `string` | ✗ | Select pocket residues for creating the ORI atom (e.g., A: 1-172).  |  |
| `ligand_residues_name` | `string` | ✓ | Ligand residue names in the input PDB (e.g., NAD,OXM).  |  |
| `design_length` | `number` | ✓ | Designed binder length specified as a single integer value (5-500).  |  |
| `num_designs` | `number` | ✓ | Number of design results to generate (1-20).  |  |

### 示例代码

#### 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": "RFdiffusion2",
    "tool_name": "get_small_molecule_binder_design_get_small_molecule_binder_design_post",
    "parameters": {
    "pdb_file": "<PDB_FILE_FILE_ID>",
    "pdb_ORI_coordinates": "<PDB_ORI_COORDINATES>",
    "pdb_ORI_residues": "<PDB_ORI_RESIDUES>",
    "ligand_residues_name": "<LIGAND_RESIDUES_NAME>",
    "design_length": "",
    "num_designs": ""
},
    # 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/RFdiffusion2>
