# AlphaFold3

AlphaFold3 protein structure prediction with support for protein, DNA, RNA, and small molecule ligands

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. Get Alphafold3 Info From Params

**Tool Name:** `get_alphafold3_info_from_params`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `protein_MSA_method` | `select` | ✗ | Select how protein MSAs are obtained. If Upload File is selected, provide the corresponding A3M file. | `Jackhmmer/Nhmmer`, `MMseqs2`, `Upload File`, `No MSA` |
| `protein_template_method` | `select` | ✗ | Select how protein structure templates are obtained. If Upload File is selected, provide mmCIF files via protein_template_file. | `Jackhmmer/Nhmmer`, `Upload File`, `No Template` |
| `protein` | `array` | ✗ | Enter one or more protein amino acid sequences. Click the plus icon to add more sequences. |  |
| `protein_unpaired_MSA_file` | `file` | ✗ | Upload an unpaired MSA file for a single protein in A3M format.
If multiple protein sequences are entered, use another MSA method; otherwise, the same file will be applied to all sequences.<br/>file suffix: `a3m` |  |
| `protein_paired_MSA_file` | `file` | ✗ | Upload an A3M file for multi-chain protein pairing.
Use it together with protein_unpaired_MSA_file; using it alone is not recommended.<br/>file suffix: `a3m` |  |
| `protein_template_file` | `file_array` | ✗ | Upload one or more custom single-chain structure templates in mmCIF format.<br/>file suffix: `cif` |  |
| `rna` | `array` | ✗ | Enter one or more RNA sequences using A, C, G and U. Click the plus icon to add more sequences. |  |
| `dna` | `array` | ✗ | Enter one or more DNA sequences using A, C, G and T. Click the plus icon to add more sequences. |  |
| `modifications` | `array` | ✗ | Specify modified residues using CCD codes.
Format: ChainID-CCDCode-Position (1-based), e.g., P1-SEPH-45.
Supports single or multiple modifications. |  |
| `ligand_smiles` | `array` | ✗ | Enter small-molecule ligands as SMILES. Click the structure selector on the right to highlight and select the covalent atom. |  |
| `ligand_ccd` | `array` | ✗ | Enter one or more ligand codes from the Chemical Component Dictionary.
Use CCDCode for non-covalent ligands or CCDCode,AtomName to specify the covalent atom. |  |
| `userCCD_mmcif` | `file_array` | ✗ | Upload a custom CCD in mmCIF format to define modified residues or ligands unavailable in the standard CCD.<br/>file suffix: `cif`, `mmcif` |  |
| `bondedAtomPairs` | `array` | ✗ | Specify covalent bonds between a protein, DNA or RNA chain and a ligand, or between ligands.
Format: ChainA-ResPosA-AtomA-ChainB-ResPosB-AtomB, e.g. P1-45-SG-L1-1-C1.
Residue positions are 1-based; use 1 for a single-component ligand. Bonds between polymer entities are not supported. |  |
| `num_diffusion_samples` | `number` | ✗ | Number of diffusion samples for prediction (range: 1-50, default: 5) |  |

### 示例代码

#### 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": "AlphaFold3",
    "tool_name": "get_alphafold3_info_from_params",
    "parameters": {
    "protein_MSA_method": "<PROTEIN_MSA_METHOD>",
    "protein_template_method": "<PROTEIN_TEMPLATE_METHOD>",
    "protein": [],
    "protein_unpaired_MSA_file": "<PROTEIN_UNPAIRED_MSA_FILE_FILE_ID>",
    "protein_paired_MSA_file": "<PROTEIN_PAIRED_MSA_FILE_FILE_ID>",
    "protein_template_file": [
        "<FILE_ID1>",
        "<FILE_ID2>"
    ],
    "rna": [],
    "dna": [],
    "modifications": [],
    "ligand_smiles": [],
    "ligand_ccd": [],
    "userCCD_mmcif": [
        "<FILE_ID1>",
        "<FILE_ID2>"
    ],
    "bondedAtomPairs": [],
    "num_diffusion_samples": 5
},
    # 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. Batch Alphafold3

**Tool Name:** `batch_alphafold3_batch_alphafold3_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `protein_MSA_method` | `select` | ✗ | Method for Multiple Sequence Alignment generation: Jackhmmer/Nhmmer (default), MMseqs2, No MSA | `Jackhmmer/Nhmmer`, `MMseqs2`, `No MSA` |
| `protein_template_method` | `select` | ✗ | Method for template retrieval:
 Jackhmmer/Nhmmer (default), No Template | `Jackhmmer/Nhmmer`, `No Template` |
| `batch_file` | `file` | ✓ | Batch JSON file. 
 Format: [{'task_name':'name','protein':['SEQ']}, ...] or {'tasks': [{'task_name':'name','protein':['SEQ']}, ...]}. 
 Task fields: task_name(optional), protein/dna/rna (arrays), ligand_smiles, ligand_ccd, modifications, bondedAtomPairs<br/>file suffix: `json` |  |
| `num_diffusion_samples` | `number` | ✗ | Number of diffusion samples for prediction (range: 1-50, default: 5) |  |

### 示例代码

#### 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": "AlphaFold3",
    "tool_name": "batch_alphafold3_batch_alphafold3_post",
    "parameters": {
    "protein_MSA_method": "<PROTEIN_MSA_METHOD>",
    "protein_template_method": "<PROTEIN_TEMPLATE_METHOD>",
    "batch_file": "<BATCH_FILE_FILE_ID>",
    "num_diffusion_samples": 5
},
    # 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/AlphaFold3>
