| name | drug-screening-docking |
| description | Comprehensive drug screening pipeline from molecular filtering through QED/ADMET criteria to protein-ligand docking, identifying promising drug candidates. |
| license | MIT license |
| metadata | {"skill-author":"PJLab"} |
Drug Screening and Molecular Docking Workflow
Usage
1. MCP Server Definition
import json
from contextlib import AsyncExitStack
from mcp.client.streamable_http import streamablehttp_client
from mcp import ClientSession
class DrugSDAClient:
def __init__(self, server_url: str):
self.server_url = server_url
self.session = None
async def connect(self):
print(f"server url: {self.server_url}")
try:
self.transport = streamablehttp_client(
url=self.server_url,
headers={"SCP-HUB-API-KEY": "<your-api-key>"}
)
self._stack = AsyncExitStack()
await self._stack.__aenter__()
self.read, self.write, self.get_session_id = await self._stack.enter_async_context(self.transport)
self.session_ctx = ClientSession(self.read, self.write)
self.session = await self._stack.enter_async_context(self.session_ctx)
await self.session.initialize()
session_id = self.get_session_id()
print(f"✓ connect success")
return True
except Exception as e:
print(f"✗ connect failure: {e}")
import traceback
traceback.print_exc()
return False
async def disconnect(self):
"""Disconnect from server"""
try:
if hasattr(self, '_stack'):
await self._stack.aclose()
print("✓ already disconnect")
except Exception as e:
print(f"✗ disconnect error: {e}")
def parse_result(self, result):
try:
if hasattr(result, 'content') and result.content:
content = result.content[0]
if hasattr(content, 'text'):
return json.loads(content.text)
return str(result)
except Exception as e:
return {"error": f"parse error: {e}", "raw": str(result)}
2. Drug Screening and Docking Workflow
This workflow screens candidate molecules using drug-likeness and ADMET criteria, then performs molecular docking with a target protein to identify promising drug candidates.
Workflow Steps:
- Calculate QED Scores - Assess drug-likeness using Quantitative Estimate of Drug-likeness
- Predict ADMET Properties - Calculate LD50 toxicity prediction
- Filter Molecules - Apply criteria (QED ≥ 0.6 and LD50 ≥ 3.0)
- Retrieve Protein Structure - Download target protein from RCSB PDB
- Extract Main Chain - Isolate primary protein chain
- Fix Protein Structure - Repair PDB file using PDBFixer
- Identify Binding Pocket - Locate binding site using Fpocket
- Convert Ligand Format - Convert SMILES to PDBQT format
- Convert Protein Format - Convert protein PDB to PDBQT
- Perform Molecular Docking - Dock ligands and calculate binding affinity
- Filter by Affinity - Select molecules with affinity ≤ -7.0 kcal/mol
Implementation:
tool_client = DrugSDAClient("https://scp.intern-ai.org.cn/api/v1/mcp/2/DrugSDA-Tool")
model_client = DrugSDAClient("https://scp.intern-ai.org.cn/api/v1/mcp/3/DrugSDA-Model")
if not await tool_client.connect() or not await model_client.connect():
print("connection failed")
return
smiles_list = ['O=C(Nc1cccc2c1CCCC2)N1CCc2c([nH]c3ccccc23)C1c1cccc(F)c1F', ...]
result = await tool_client.session.call_tool(
"calculate_mol_drug_chemistry",
arguments={"smiles_list": smiles_list}
)
QED_result = tool_client.parse_result(result)["metrics"]
result = await model_client.session.call_tool(
"pred_molecule_admet",
arguments={"smiles_list": smiles_list}
)
LD50_result = model_client.parse_result(result)["admet_preds"]
select_smiles_list = []
for i in range(len(smiles_list)):
QED = QED_result[i]["qed"]
LD50 = LD50_result[i]["LD50_Zhu"]
if QED >= 0.6 and LD50 >= 3.0:
select_smiles_list.append(smiles_list[i])
pdb_code = "6vkv"
result = await tool_client.session.call_tool(
"retrieve_protein_data_by_pdbcode",
arguments={: pdb_code}
)
pdb_path = tool_client.parse_result(result)[]
result = tool_client.session.call_tool(
,
arguments={: pdb_path, : }
)
pdb_path = tool_client.parse_result(result)[]
result = tool_client.session.call_tool(
,
arguments={: pdb_path}
)
pdb_path = tool_client.parse_result(result)[]
result = model_client.session.call_tool(
,
arguments={: pdb_path}
)
best_pocket = tool_client.parse_result(result)[][]
result = tool_client.session.call_tool(
,
arguments={: select_smiles_list, : }
)
ligand_paths = [x[] x tool_client.parse_result(result)[]]
result = tool_client.session.call_tool(
,
arguments={: pdb_path}
)
receptor_path = tool_client.parse_result(result)[]
result = model_client.session.call_tool(
,
arguments={
: receptor_path,
: ligand_paths,
: best_pocket[],
: best_pocket[],
: best_pocket[],
: best_pocket[],
: best_pocket[],
: best_pocket[]
}
)
docking_results = model_client.parse_result(result)[]
final_smiles_list = []
item docking_results:
item[] <= -:
final_smiles_list.append(select_smiles_list[item[]])
()
tool_client.disconnect()
model_client.disconnect()
Tool Descriptions
DrugSDA-Tool Server Tools:
calculate_mol_drug_chemistry: Compute QED score and Lipinski's Rule of Five violations
retrieve_protein_data_by_pdbcode: Download protein structure from RCSB PDB
save_main_chain_pdb: Extract main protein chain
fix_pdb_dock: Repair PDB file using PDBFixer
convert_smiles_to_other_format: Convert SMILES to various formats (PDBQT, SDF, etc.)
convert_pdb_to_pdbqt_dock: Convert PDB to PDBQT format for docking
DrugSDA-Model Server Tools:
pred_molecule_admet: Predict ADMET properties including LD50 toxicity
run_fpocket: Identify protein binding pockets
quick_molecule_docking: Perform AutoDock Vina molecular docking
Input/Output
Input:
smiles_list: List of SMILES strings representing candidate molecules
pdb_code: PDB code of target protein structure
Output:
final_smiles_list: SMILES strings of molecules with QED ≥ 0.6, LD50 ≥ 3.0, and binding affinity ≤ -7.0 kcal/mol
Filtering Criteria
- QED Threshold: ≥ 0.6 (drug-likeness)
- LD50 Threshold: ≥ 3.0 (toxicity)
- Affinity Threshold: ≤ -7.0 kcal/mol (binding strength)
Adjust these thresholds based on your specific requirements.