diff --git a/build_modeller.py b/build_modeller.py index da8b2a1..e613a6d 100755 --- a/build_modeller.py +++ b/build_modeller.py @@ -4,6 +4,8 @@ from modeller import * from modeller.automodel import * import time from typing import List +import sys +import glob @dataclass class PDBModeler: @@ -19,7 +21,7 @@ class PDBModeler: self.sequence = self.fasta_file.stem self.ali_file = self.fasta_to_ali() - def make_model(self): + def make_model(self): # 单模板建模 print("***************************************************") print("md_level ====", self.md_level) print("***************************************************") @@ -69,6 +71,26 @@ class PDBModeler: print("No model files found.") return model_files + + def find_pdb95_fsa_file(self) -> Path: + """在 Conda 环境中查找 pdb95.fsa 文件的路径。""" + # 获取当前 Python 解释器的路径 + python_executable_path = Path(sys.executable) + + # 获取 Conda 环境的根目录 + conda_env_root = python_executable_path.parent.parent + + # 获取可能的 Modeller 目录 + modeller_dirs = list(conda_env_root.glob("lib/modeller-*/examples/commands")) + + # 选择最新版本的 Modeller 目录 + modeller_dirs.sort(reverse=True) + if modeller_dirs: + latest_modeller_dir = modeller_dirs[0] + pdb95_fsa_path = latest_modeller_dir / "pdb95.fsa" + return pdb95_fsa_path + else: + raise FileNotFoundError("Modeller directory not found.") def get_model_files(self, loop_model) -> List[Path]: # 检查 loop_model.loop.outputs 列表,收集所有成功生成的模型文件