# Peptide-Tools

Computes molecular descriptors (MW, logP, sequence length), UV extinction coefficients (e205/e214/e280), isoelectric point (pI) and net charge across multiple pKa sets, and chemical sequence liabilities for a single peptide or small molecule, given as a SMILES string, a FASTA sequence, or an uploaded SMILES/SDF/FASTA file containing one entry. Also converts multi-record SDF/SMILES files to scrambled FASTA and FASTA files to SDF.

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. Calculate molecular weight, logP, sequence length, UV extinction coefficients
(e205/e214/e280), isoelectric point (pI), net charge, and chemical sequence
liabilities for one peptide or molecule.

Provide `input_text` (SMILES, a bare peptide sequence, or a FASTA record;
format detected automatically) or `input_file` (.smi, .sdf, or .fasta containing
exactly one entry). FASTA
options control terminal ionization, cysteine thiols, and disulfide pairing.
Optional fragment pKa values and images provide detail on the pI calculation.

For head-to-tail cyclic FASTA, set `cyclic=true` or add `[cyclic]` to the FASTA
header. The peptide is cyclized before all calculations, including molecular
weight, logP, pI/charge, and structure-based liabilities. There are no free
termini. This supports standard uppercase residues only, with at least two
residues. FASTA ionization/cysteine/disulfide options apply to linear sequence
calculations; cyclic FASTA is processed as a structure without additional
side-chain modifications. Cyclic SMILES/SDF can be supplied directly.

Returns a task ID immediately. Completed results include a CSV summary,
a liabilities table, full JSON, and a charge-versus-pH plot when available,
with a ZIP download of the result files.

**Tool Name:** `predict_async_predict_async_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `input_text` | `string` | ✗ | One molecule as SMILES or one peptide as a bare sequence or FASTA record. The format is detected automatically. Add [cyclic] to the FASTA header or set cyclic=true for head-to-tail cyclization. Provide input_text or input_file, not both. |  |
| `input_file` | `file` | ✗ | Molecule input file containing exactly one entry (supported formats: SMILES .smi, SDF .sdf, FASTA .fasta). Provide input_text or input_file, not both.<br/>file suffix: `smi`, `sdf`, `fasta` |  |
| `ionizable_nterm` | `boolean` | ✗ | Applies to FASTA input only. If True, the N-terminus is a free amine; if False, the N-terminus is capped (default: True) |  |
| `ionizable_cterm` | `boolean` | ✗ | Applies to FASTA input only. If True, the C-terminus is a free acid; if False, the C-terminus is capped (default: True) |  |
| `no_free_cys_thiols` | `boolean` | ✗ | Applies to FASTA input only. If True, all cysteine side chains are treated as capped/disulfide-bridged rather than free thiols (default: True) |  |
| `n_disulfide_bonds` | `string` | ✗ | Applies to FASTA input only. Number of disulfide bonds to pair among the sequence's cysteines (format: 'max' to pair as many cysteines as possible, or a non-negative integer, optional, default: 'max') |  |
| `print_fragment_pkas` | `boolean` | ✗ | Include the per-fragment pKa values used in the pI calculation in the output (default: False) |  |
| `generate_fragment_images` | `boolean` | ✗ | Include base64-encoded 2D depictions of the pI-calculation fragments in the output (default: False) |  |
| `cyclic` | `boolean` | ✗ | FASTA input only: form a head-to-tail cyclic peptide before prediction. A [cyclic] FASTA header also enables this. Requires at least two standard uppercase residues. Uses the closed molecular structure for predictions; FASTA terminal-ionization and cysteine/disulfide options do not apply to this structure. |  |

### 示例代码

#### 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": "Peptide-Tools",
    "tool_name": "predict_async_predict_async_post",
    "parameters": {
    "input_text": "<INPUT_TEXT>",
    "input_file": "<INPUT_FILE_FILE_ID>",
    "ionizable_nterm": false,
    "ionizable_cterm": false,
    "no_free_cys_thiols": false,
    "n_disulfide_bonds": "max",
    "print_fragment_pkas": false,
    "generate_fragment_images": false,
    "cyclic": false
},
    # 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. Convert peptides and display sequences, residue counts, and topology in a table.
FASTA-to-SDF results include molecular drawings. Structure-to-FASTA results
include a FASTA text preview. Converted files and a complete ZIP are downloadable.
Returns a task ID immediately while conversion runs in the background.

Structure-to-FASTA loses residue order,
maps unknown residues to X, and cannot reconstruct the original structure.
FASTA-to-SDF constructs linear L peptides with free termini, or head-to-tail
cyclic peptides for records labeled [cyclic] or when cyclic=true.
Cyclic structures are detected from backbone bonds and labeled [cyclic].

**Tool Name:** `convert_convert_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `input_text` | `string` | ✗ | SMILES to scrambled FASTA, or peptide text (a bare sequence or FASTA records) to SDF. The format is detected automatically. Supports [cyclic] headers and cyclic=true for head-to-tail cyclization. Provide input_text or input_file, not both. |  |
| `input_file` | `file` | ✗ | SDF (.sdf) or SMILES (.smi) to scrambled FASTA; FASTA (.fasta) to SDF. Supports multiple records. FASTA requires uppercase standard amino acids. Provide input_text or input_file, not both.<br/>file suffix: `smi`, `sdf`, `fasta` |  |
| `cyclic` | `boolean` | ✗ | FASTA input only: cyclize every record head-to-tail. Individual records can also be marked with [cyclic] in their headers, allowing mixed topologies. |  |

### 示例代码

#### 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": "Peptide-Tools",
    "tool_name": "convert_convert_post",
    "parameters": {
    "input_text": "<INPUT_TEXT>",
    "input_file": "<INPUT_FILE_FILE_ID>",
    "cyclic": false
},
    # 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/Peptide-Tools>
