# Transformer-Based Proprietary Library Virtual Screen

A tiered virtual screening tool designed for proprietary, category-specific compound libraries. Users can select a proprietary compound library from a specific category available on the platform and apply optional PAINS, RO3, and RO5 filters. The filtered compounds are first subjected to protein sequence-based screening using TransformerCPI, and the top K candidates are selected based on their predicted scores. To enhance chemical diversity, these candidates are further clustered, with the highest-scoring compound in each cluster retained as the representative candidate. The resulting candidates are then evaluated using Boltz-2 for protein–ligand complex structure and binding affinity prediction. Additional binding interaction analysis can also be performed to characterize binding modes and identify key residues involved in compound–target interactions. 

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. 

**Tool Name:** `virtual_screening_virtual-screening-commercial-library-category_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `library` | `select` | ✗ | Select a built-in compound library. | `Covalent Library (156W)`, `Drug-like Library (995W)`, `Fragment Library (77W)`, `Macrocycle Library (3K)`, `Molecular Glue Library (669)`, `Natural Product Library (2K)`, `Peptidomimetic Library (1K)`, `PROTAC Library (22W)` |
| `filter_rules` | `select_array` | ✗ | Set basic filtering rules before screening | `PAINS`, `Ro5`, `Ro3` |
| `Interaction_type` | `select` | ✗ | Specify the interaction type to inspect | `None`, `Hydrophobic`, `HydrogenBond`, `WeakHydrogenBond`, `IonicInteraction`, `PiStacking`, `Cation-PiInteractions`, `HalogenBond`, `MetalCoordination` |
| `protein_sequence` | `string` | ✓ | Enter the protein amino acid sequence in one-letter format |  |
| `tCPI_topK` | `number` | ✓ | Keep the top K compounds ranked by TransformerCPI. N <= 20000 |  |
| `tCPI_num_clusters` | `number` | ✓ | Cluster the TopK results into the specified number of groups.  N<= 100 |  |
| `Boltz2_samples` | `number` | ✓ | Set the number of sampling runs for Boltz2 structure evaluation, N <= 5 |  |
| `Interaction_residue` | `string` | ✗ | Specify the key residue(s) to inspect. Eg: A:1600,1601-1604 |  |

### 示例代码

#### 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": "Transformer-Based Proprietary Library Virtual Screen",
    "tool_name": "virtual_screening_virtual-screening-commercial-library-category_post",
    "parameters": {
    "library": "<LIBRARY>",
    "filter_rules": [
        "OPTION VALUE1",
        "OPTION VALUE2"
    ],
    "Interaction_type": "<INTERACTION_TYPE>",
    "protein_sequence": "<PROTEIN_SEQUENCE>",
    "tCPI_topK": "",
    "tCPI_num_clusters": "",
    "Boltz2_samples": 2,
    "Interaction_residue": "<INTERACTION_RESIDUE>"
},
    # 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/Transformer-Based-Proprietary-Library-Virtual-Screen>
