# Rosetta cycpep

De novo cyclic peptide structure prediction and design with Rosetta simple_cycpep_predict (GenKIC closure). Supports head-to-tail, disulfide, thioether/lanthionine lariat, isopeptide and sidechain cyclization, sidechain crosslinkers, and optional sequence 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. Predict Cpu

**Tool Name:** `predict_cpu_predict_cpu_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `cyclization_type` | `select` | ✗ | Cyclization chemistry closing the macrocycle; at least 3 residues must lie between the bond-forming positions (violations are rejected with the exact fix).
- n_to_c_amide_bond: head-to-tail N-to-C amide bond (default)
- terminal_disulfide: disulfide between terminal Cys residues
- nterm_isopeptide_lariat: N-terminal amine to sidechain carboxyl (ASP/GLU), index >= 5
- cterm_isopeptide_lariat: C-terminal carboxyl to sidechain amine (LYS/ORN/DAB/DPP), index <= n-4
- sidechain_isopeptide: amine (LYS/ORN/DAB/DPP) to carboxylate (ASP/GLU) sidechains, gap >= 4
- thioether_lariat: Cys sidechain S to chain terminus, Cys index >= 5
- lanthipeptide: Cys to Ser/Thr-derived residue, ordered positions (1st = ALA/DALA, 2nd = CYS)
thioether_lariat and lanthipeptide output goes through a silent-file converter fallback and is still returned as PDB (bonds as PDB LINK records). | `n_to_c_amide_bond`, `terminal_disulfide`, `thioether_lariat`, `lanthipeptide`, `nterm_isopeptide_lariat`, `cterm_isopeptide_lariat`, `sidechain_isopeptide` |
| `sequence` | `string` | ✓ | Peptide sequence in ONE representation (mixing is rejected): (1) full residue names, whitespace/comma separated, e.g. 'ALA LYS DPRO HYP' — D-forms are D-prefixed (DPRO, DALA); non-canonical and β/γ residues MUST use this form; (2) one-letter codes, case encodes chirality — uppercase = L, lowercase = D ('AKpC' = ALA LYS DPRO CYS; 'G'/'g' both = GLY). Minimum 4 residues. Length does not affect price (priced by num_model). |  |
| `cyclization_positions` | `string` | ✗ | 1-based residue position(s) completing the cyclization; meaning depends on cyclization_type:
- thioether_lariat / nterm_isopeptide_lariat / cterm_isopeptide_lariat: one index, e.g. '5' (omit = auto-select the nearest suitable residue)
- sidechain_isopeptide: two indices, e.g. '3,9'
- lanthipeptide: REQUIRED two indices, e.g. '2,8' (1st = ALA/DALA, 2nd = CYS)
- n_to_c_amide_bond / terminal_disulfide: not applicable (rejected) |  |
| `crosslinkers` | `string` | ✗ | Sidechain crosslinkers, ';'-separated 'kind:indices' entries; each kind at most once:
- tbmb: Cys triples (multiple of 3), e.g. 'tbmb:2,6,9'
- tma: primary-amine triples LYS/ORN/DAB/DPP, e.g. 'tma:1,5,9'
- para_bbmb: Cys pairs, e.g. 'para_bbmb:3,8'
Example: 'tbmb:3,7,11; para_bbmb:2,8' |  |
| `require_disulfides` | `boolean` | ✗ | Require disulfide bonds between Cys residues (Rosetta require_disulfides). All pairings are enumerated and the lowest-energy one is kept; odd Cys count tries every leave-one-out combination. Pairs cannot be pinned. Default: false. |  |
| `n_methyl_positions` | `string` | ✗ | Comma-separated 1-based positions to N-methylate, e.g. '2,7'. PRO/DPRO positions and position 1 when the N-terminus is free are rejected. Omit for none. |  |
| `design_peptide` | `boolean` | ✗ | Design side-chain identities during prediction instead of keeping the input sequence fixed. Auto-enabled when allowed_residues_by_position is uploaded. Default: false. |  |
| `allowed_residues_by_position` | `file` | ✗ | Design-space file, one line per position: 'INDEX RES1 RES2 ...' or 'DEFAULT RES1 RES2 ...', e.g. '3 ALA VAL DPRO'. Uploading it enables design mode.<br/>file suffix: `txt` |  |
| `num_model` | `number` | ✗ | Number of structures to generate (Rosetta nstruct). Pricing: first 5 structures = 10 points / ~2 min; each additional 5 = +2 points / +2 min. |  |

### 示例代码

#### 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": "Rosetta cycpep",
    "tool_name": "predict_cpu_predict_cpu_post",
    "parameters": {
    "cyclization_type": "<CYCLIZATION_TYPE>",
    "sequence": "<SEQUENCE>",
    "cyclization_positions": "<CYCLIZATION_POSITIONS>",
    "crosslinkers": "<CROSSLINKERS>",
    "require_disulfides": false,
    "n_methyl_positions": "<N_METHYL_POSITIONS>",
    "design_peptide": false,
    "allowed_residues_by_position": "<ALLOWED_RESIDUES_BY_POSITION_FILE_ID>",
    "num_model": 1
},
    # 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/Rosetta-cycpep>
