From d68b536aec83c935e035addac8c7704a0c7516d6 Mon Sep 17 00:00:00 2001 From: lingyuzeng Date: Sat, 2 Aug 2025 23:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=97=E4=BD=93=E5=87=86?= =?UTF-8?q?=E5=A4=87=E8=AF=B4=E6=98=8E=E4=B8=8E=E5=A2=9E=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E6=89=B9=E6=8F=90=E4=BA=A4=E5=8F=82=E6=95=B0=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++ vina_split_and_submit.py | 40 ++++++++++++++++++++++++++++------ 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 119ce78..682b78e 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,52 @@ project_root/ └── analyze_results.py ``` +## 受体准备 pdbqt 文件 + +使用 alphafold 预测 pdb 文件 cif 文件。 + +修复使用 moderller 同源建模,或者 pdbfixer,MOE,maestro 等 + +这里使用 maestro 的 `Protein reparation Workflow` 模块 + +然后导出 pdb 文件 + +使用 meeko 准备受体文件 pdbqt 文件,详细可以[参考](https://meeko.readthedocs.io/en/release-doc/rec_overview.html) + +```shell +micromamba run -n vina mk_prepare_receptor.py -i receptor/FgBar1_cut_proteinprep.pdb --write_pdbqt receptor/FgBar1_cut_proteinprep.pdbqt +``` + +选项组合用法 + +### 举例1:用默认输出名生成 pdbqt 和 vina box 配置 + +mk_prepare_receptor.py -i 1abc.pdb -o 1abc_clean --write_pdbqt --write_vina_box + +得到 1abc_clean_rigid.pdbqt, 1abc_clean.vina.txt + +### 举例2:为指定残基设置模板/柔性,并生成 box 配置 + +```shell +mk_prepare_receptor.py -i system.pdb \ + --output_basename system_prep \ + -f "A:42,B:23" \ + -n "A:5,7=CYX,B:17=HID" \ + --write_pdbqt --write_vina_box +``` + + +### 举例3:自动包络某配体生成 box 配置 + +``` +mk_prepare_receptor.py -i prot.pdb \ + --box_enveloping ligand.pdb \ + --padding 3.0 \ + --output_basename dock_ready \ + --write_pdbqt --write_vina_box +``` + + ## 小分子 3D 构象准备 需要给小分子一个初始化的 3d 构象存放到`ligand/sdf` diff --git a/vina_split_and_submit.py b/vina_split_and_submit.py index 93d053e..52b7317 100644 --- a/vina_split_and_submit.py +++ b/vina_split_and_submit.py @@ -3,8 +3,27 @@ import shutil from pathlib import Path import sys import subprocess +import argparse +import time + +parser = argparse.ArgumentParser( + description="Split pdbqt files and generate & submit vina shell scripts." +) +parser.add_argument( + '-n', '--n_splits', type=int, default=12, help="Number of splits/folders. Default: 12" +) +parser.add_argument( + '-r', '--receptor', type=str, required=True, help="Path to receptor pdbqt file" +) +parser.add_argument( + '-c', '--config', type=str, required=True, help="Path to box config txt file" +) +args = parser.parse_args() + +n_splits = args.n_splits +receptor_path = args.receptor +config_path = args.config -n_splits = int(sys.argv[1]) if len(sys.argv) > 1 else 12 # 默认12份,可传参修改 src_dir = Path('./ligand/pdbqt') dst_root = Path('./ligand') @@ -34,8 +53,8 @@ sh_template = """#!/bin/bash date echo "autodock vina docking task{idx}, version: 1.2.7" cd /share/home/lyzeng24/rdkit_script/vina -./scripts/batch_docking.sh ./receptor/TrpE_entry_1.pdbqt \\ - ./config/TrpE_entry_1.box.txt \\ +./scripts/batch_docking.sh {receptor_path} \\ + {config_path} \\ ./ligand/pdbqt{idx} \\ ./result/poses{idx} \\ ./result/batch_docking{idx}.log ./vina @@ -47,7 +66,11 @@ date submit_sh_list = [] for i in range(1, n_splits + 1): - sh_content = sh_template.format(idx=i) + sh_content = sh_template.format( + idx=i, + receptor_path=receptor_path, + config_path=config_path + ) sh_path = Path(f'./submit_vina{i}.sh') with open(sh_path, 'w') as f: f.write(sh_content) @@ -56,11 +79,16 @@ for i in range(1, n_splits + 1): print(f"Done! {total} pdbqt files split to {n_splits} folders, {n_splits} shell scripts generated.") -import time - # 自动提交 for i, sh_path in enumerate(submit_sh_list, 1): print(f"提交: dsub -s {sh_path}") subprocess.run(['dsub', '-s', str(sh_path)]) time.sleep(1) # 每次提交后等待1秒 +""" +使用示例: +python vina_split_and_submit.py \ + -n 128 \ + -r ./receptor/FgBar1_cut_proteinprep.pdbqt \ + -c ./config/FgBar1_entry_1.box.txt +""" \ No newline at end of file