locate modeller pdb95.fsa file

This commit is contained in:
root
2024-01-19 16:30:08 +08:00
parent 69a79f4188
commit c27b484660

View File

@@ -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("***************************************************")
@@ -70,6 +72,26 @@ class PDBModeler:
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 列表,收集所有成功生成的模型文件
model_files = []