增加受体准备说明与增加分批提交参数灵活性
This commit is contained in:
46
README.md
46
README.md
@@ -32,6 +32,52 @@ project_root/
|
|||||||
└── analyze_results.py
|
└── 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 构象准备
|
||||||
|
|
||||||
需要给小分子一个初始化的 3d 构象存放到`ligand/sdf`
|
需要给小分子一个初始化的 3d 构象存放到`ligand/sdf`
|
||||||
|
|||||||
@@ -3,8 +3,27 @@ import shutil
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
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')
|
src_dir = Path('./ligand/pdbqt')
|
||||||
dst_root = Path('./ligand')
|
dst_root = Path('./ligand')
|
||||||
|
|
||||||
@@ -34,8 +53,8 @@ sh_template = """#!/bin/bash
|
|||||||
date
|
date
|
||||||
echo "autodock vina docking task{idx}, version: 1.2.7"
|
echo "autodock vina docking task{idx}, version: 1.2.7"
|
||||||
cd /share/home/lyzeng24/rdkit_script/vina
|
cd /share/home/lyzeng24/rdkit_script/vina
|
||||||
./scripts/batch_docking.sh ./receptor/TrpE_entry_1.pdbqt \\
|
./scripts/batch_docking.sh {receptor_path} \\
|
||||||
./config/TrpE_entry_1.box.txt \\
|
{config_path} \\
|
||||||
./ligand/pdbqt{idx} \\
|
./ligand/pdbqt{idx} \\
|
||||||
./result/poses{idx} \\
|
./result/poses{idx} \\
|
||||||
./result/batch_docking{idx}.log ./vina
|
./result/batch_docking{idx}.log ./vina
|
||||||
@@ -47,7 +66,11 @@ date
|
|||||||
|
|
||||||
submit_sh_list = []
|
submit_sh_list = []
|
||||||
for i in range(1, n_splits + 1):
|
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')
|
sh_path = Path(f'./submit_vina{i}.sh')
|
||||||
with open(sh_path, 'w') as f:
|
with open(sh_path, 'w') as f:
|
||||||
f.write(sh_content)
|
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.")
|
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):
|
for i, sh_path in enumerate(submit_sh_list, 1):
|
||||||
print(f"提交: dsub -s {sh_path}")
|
print(f"提交: dsub -s {sh_path}")
|
||||||
subprocess.run(['dsub', '-s', str(sh_path)])
|
subprocess.run(['dsub', '-s', str(sh_path)])
|
||||||
time.sleep(1) # 每次提交后等待1秒
|
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
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user