# Assay2mol

Generate candidate small molecules for target proteins using large language models (ChatGPT or DeepSeek). The input includes a list of PDB IDs, a UniProt mapping file, and optional PAINS filter data. You can configure generation parameters such as number of molecules, BioAssay count, and molecular size limits.

## 基础信息

| 项目 | 值 |
|------|-----|
| 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 Assay2Mol Result Via Sciminercredits

**Tool Name:** `get_Assay2Mol_result_via_SciMinerCredits_get_Assay2Mol_result_via_SciMinerCredits_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `model_name` | `select` | ✓ |  | `gpt-5.2-chat-latest`, `Deepseek-V3` |
| `ProteinDescription` | `array` | ✓ | Target protein description for molecule generation. |  |
| `pdb_id` | `string` | ✗ | Target protein PDB ID for molecule generation. |  |
| `ID_mapping_file` | `file` | ✗ | PDB-UniProt mapping to filter redundant BioAssay data.<br/>file suffix: `csv`, `tsv` |  |
| `uniprot_id` | `string` | ✗ | UniProt ID of the target protein for molecule generation. |  |
| `pains_file` | `file` | ✗ | Pains File (optional). If provided, the generated molecules will be checked against PAINS compounds.<br/>file suffix: `txt` |  |
| `num_mol` | `number` | ✗ | Used to separately extract num_mol samples from the active/inactive data of BioAssay. |  |
| `num_assays` | `number` | ✗ | How many BioAssays can be selected at most for each protein target for analysis and learning. |  |
| `max_molecule_size` | `number` | ✗ | The maximum number of atoms allowed in the generated molecules. Default is 50. |  |
| `num_generated_molecules` | `number` | ✗ | Number of molecules to generate per target protein. Default is 10. |  |

### 示例代码

#### 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": "Assay2mol",
    "tool_name": "get_Assay2Mol_result_via_SciMinerCredits_get_Assay2Mol_result_via_SciMinerCredits_post",
    "parameters": {
    "model_name": "<MODEL_NAME>",
    "ProteinDescription": [],
    "pdb_id": "<PDB_ID>",
    "ID_mapping_file": "<ID_MAPPING_FILE_FILE_ID>",
    "uniprot_id": "<UNIPROT_ID>",
    "pains_file": "<PAINS_FILE_FILE_ID>",
    "num_mol": 8,
    "num_assays": 10,
    "max_molecule_size": 50,
    "num_generated_molecules": 10
},
    # 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. Get Assay2Mol Result By Llmkeyauth

**Tool Name:** `get_Assay2Mol_result_by_LLMKeyAuth_get_Assay2Mol_result_by_LLMKeyAuth_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `model_name` | `select` | ✓ |  | `gpt-5.2-chat-latest`, `Deepseek-V3` |
| `ProteinDescription` | `array` | ✓ | Target protein description for molecule generation. |  |
| `pdb_id` | `string` | ✗ | Target protein PDB ID for molecule generation. |  |
| `ID_mapping_file` | `file` | ✗ | PDB-UniProt mapping to filter redundant BioAssay data.<br/>file suffix: `csv`, `tsv` |  |
| `uniprot_id` | `string` | ✗ | UniProt ID of the target protein for molecule generation. |  |
| `pains_file` | `file` | ✗ | Pains File (optional). If provided, the generated molecules will be checked against PAINS compounds.<br/>file suffix: `txt` |  |
| `openai_api_key` | `string` | ✓ | Model API Key |  |
| `deepseek_api_key` | `string` | ✓ | DeepSeek API Key, if using DeepSeek model. |  |
| `num_mol` | `number` | ✗ | Used to separately extract num_mol samples from the active/inactive data of BioAssay. |  |
| `num_assays` | `number` | ✗ | How many BioAssays can be selected at most for each protein target for analysis and learning. |  |
| `max_molecule_size` | `number` | ✗ | The maximum number of atoms allowed in the generated molecules. Default is 50. |  |
| `num_generated_molecules` | `number` | ✗ | Number of molecules to generate per target protein. Default is 10. |  |

### 示例代码

#### 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": "Assay2mol",
    "tool_name": "get_Assay2Mol_result_by_LLMKeyAuth_get_Assay2Mol_result_by_LLMKeyAuth_post",
    "parameters": {
    "model_name": "<MODEL_NAME>",
    "ProteinDescription": [],
    "pdb_id": "<PDB_ID>",
    "ID_mapping_file": "<ID_MAPPING_FILE_FILE_ID>",
    "uniprot_id": "<UNIPROT_ID>",
    "pains_file": "<PAINS_FILE_FILE_ID>",
    "openai_api_key": "<OPENAI_API_KEY>",
    "deepseek_api_key": "<DEEPSEEK_API_KEY>",
    "num_mol": 8,
    "num_assays": 10,
    "max_molecule_size": 50,
    "num_generated_molecules": 10
},
    # 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/Assay2mol>
