增加受体准备说明与增加分批提交参数灵活性
This commit is contained in:
@@ -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
|
||||
"""
|
||||
Reference in New Issue
Block a user