PDB-REDO/dssp

why i can not use dssp in python

Closed this issue · 1 comments

my os is windows,
`from Bio.PDB import PDBParser
from Bio.PDB.DSSP import DSSP
import matplotlib.pyplot as plt

解析PDB文件

p = PDBParser()
structure = p.get_structure("protein_name", "01.pdb")

使用DSSP分析二级结构

model = structure[0]
dssp = DSSP(model, "01.pdb")

提取阿尔法螺旋和贝塔折叠的片段

helices = [res for res in dssp if res[2] == 'H'] # 阿尔法螺旋
sheets = [res for res in dssp if res[2] == 'E'] # 贝塔折叠

打印片段信息

print("Alpha helices:")
for res in helices:
print(f"Residue {res[0]}: {res[1]}")

print("\nBeta sheets:")
for res in sheets:
print(f"Residue {res[0]}: {res[1]}")

可视化

plt.figure(figsize=(10, 6))
plt.plot([res[1] for res in dssp], label='DSSP index')
plt.scatter([res[0] for res in helices], [res[1] for res in helices], color='r', label='Alpha helices')
plt.scatter([res[0] for res in sheets], [res[1] for res in sheets], color='b', label='Beta sheets')
plt.xlabel('Residue number')
plt.ylabel('DSSP index')
plt.legend()
plt.show()
`

and some error :
C:\Users\zhaol.conda\envs\tom\python.exe D:\CodePro\py\pdb\01.py
Traceback (most recent call last):
File "C:\Users\zhaol.conda\envs\tom\lib\site-packages\Bio\PDB\DSSP.py", line 386, in init
[dssp, "--version"], universal_newlines=True
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 411, in check_output
**kwargs).stdout
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 800, in init
restore_signals, start_new_session)
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\CodePro\py\pdb\01.py", line 11, in
dssp = DSSP(model, "01.pdb")
File "C:\Users\zhaol.conda\envs\tom\lib\site-packages\Bio\PDB\DSSP.py", line 400, in init
[dssp, "--version"], universal_newlines=True
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 411, in check_output
**kwargs).stdout
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 488, in run
with Popen(*popenargs, **kwargs) as process:
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 800, in init
restore_signals, start_new_session)
File "C:\Users\zhaol.conda\envs\tom\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

Process finished with exit code 1

The Python package is not ours but let's have a look anyway. The error message says file not found. Do you actually have the dssp executable installed? If so, is it in your Python environment?