haddocking / pdb-tools

A dependency-free cross-platform swiss army knife for PDB files.
https://haddocking.github.io/pdb-tools/
Apache License 2.0
372 stars 113 forks source link

molprobity.py gives a TypeError #104

Closed jbibbe4 closed 3 years ago

jbibbe4 commented 3 years ago

The bug When I use the molprobity.py script to predict the His protonation states, it gives a TypeError (Python 3.9.4 on MacOS Catalina, 10.15.7):

## Executing Reduce to assign histidine protonation states
## Input PDB: e2aP2_1f3g-clean.pdb
Traceback (most recent call last):
File "/Users/jbibbe/software/haddock-tools/molprobity.py", line 143, in <module> fout.write(line+'\n')
TypeError: can't concat str to bytes

This same error also happens in Python 3.7.10.

When I use Python 2.7.13, I get the following error:

Traceback (most recent call last):
File "/Users/jbibbe/software/haddock-tools/molprobity.py", line 137, in <module> hadded, process_error = run_molprobity(open_fhandle)
File "/Users/jbibbe/software/haddock-tools/molprobity.py", line 69, in run_molprobity tmp_file.write(cmd_stdin)
TypeError: expected a string or other character buffer object

Quick fix I fixed this for Python 3 by adding a line at line 138: hadded = hadded.decode() I haven’t tried to fix it for Python 2.7.13.

To Reproduce molprobity.py file.pdb

Expected behavior The script should return a list of the histidines in the protein structure, with their protonation states. Example:

## Executing Reduce to assign histidine protonation states
## Input PDB: 2J8S-renumbered-clean.pdb 
HIS ( 526 ) --> HISD
HIS ( 1042 )    --> HISD
HIS ( 2525 )    --> HISD
HIS ( 4526 )    --> HISD
HIS ( 338 ) --> HISE
HIS ( 505 ) --> HISE
HIS ( 525 ) --> HISE

Desktop:

JoaoRodrigues commented 3 years ago

Good bug report, wrong repository :) @amjjbonvin @brianjimenez @rvhonorato?

JoaoRodrigues commented 3 years ago

@jbibbe4 you could try submitting a pull request with this change to haddocking/haddock-tools