addMissingAtoms PDBFixer fails with InSty/WatFinder tutorial file
jamesmkrieger opened this issue · comments
The file is at https://github.com/prody/ProDy-website/blob/master/tutorials/watfinder_tutorial/watFinder_tutorial_files/5kqm_all_sci.pdb and https://github.com/prody/ProDy-website/blob/master/tutorials/insty_tutorial/insty_tutorial_files/5kqm_all_sci.pdb
This file lacks headers but I don't know if that's related to the problem or not
In [4]: x = addMissingAtoms('5kqm_all_sci.pdb', method='pdbfixer')
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
Cell In[4], line 1
----> 1 x = addMissingAtoms('5kqm_all_sci.pdb', method='pdbfixer')
File ~/software/scipion3/software/em/ProDy/prody/proteins/fixer.py:93, in addMissingAtoms(infile, method, pH, outfile, **kwargs)
90 except ImportError:
91 from simtk.openmm.app import PDBFile
---> 93 fixer = PDBFixer(filename=infile)
95 if model_residues:
96 fixer.findMissingResidues()
File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/pdbfixer/pdbfixer.py:247, in PDBFixer.__init__(self, filename, pdbfile, pdbxfile, url, pdbid)
245 self._initializeFromPDBx(file)
246 else:
--> 247 self._initializeFromPDB(file)
248 file.close()
249 elif pdbfile:
250 # A file-like object has been specified.
File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/pdbfixer/pdbfixer.py:284, in PDBFixer._initializeFromPDB(self, file)
281 def _initializeFromPDB(self, file):
282 """Initialize this object by reading a PDB file."""
--> 284 structure = PdbStructure(file)
285 pdb = app.PDBFile(structure)
286 self.topology = pdb.topology
File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/openmm/app/internal/pdbstructure.py:152, in PdbStructure.__init__(self, input_stream, load_all_models, extraParticleIdentifier)
150 self.modified_residues = []
151 # read file
--> 152 self._load(input_stream)
File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/openmm/app/internal/pdbstructure.py:198, in PdbStructure._load(self, input_stream)
196 beta = float(pdb_line[40:47])*math.pi/180.0
197 gamma = float(pdb_line[47:54])*math.pi/180.0
--> 198 self._periodic_box_vectors = computePeriodicBoxVectors(a_length, b_length, c_length, alpha, beta, gamma)
199 elif command == "SEQRES":
200 chain_id = pdb_line[11]
File ~/software/miniconda/envs/prody-github/lib/python3.9/site-packages/openmm/app/internal/unitcell.py:78, in computePeriodicBoxVectors(a_length, b_length, c_length, alpha, beta, gamma)
74 c = Vec3(*c)
76 # Make sure they're in the reduced form required by OpenMM.
---> 78 c = c - b*round(c[1]/b[1])
79 c = c - a*round(c[0]/a[0])
80 b = b - a*round(b[0]/a[0])
ZeroDivisionError: float division by zero
Hey @jamesmkrieger which version of ProDy/pdbfixer are you using? I was struggling with addMissingAtoms (for something else) and found this issue. I tried the pdb you linked and it worked for me on the first try. I don't think the lack of a header should be an issue.
Hi Anthony,
I am using PDBFixer 1.8.1 (with Python 3.9.15), and everything works fine.
Let me know if you need some other information. You can also send me the structure with which you have problems, and I can try it on my computer.
@jamesmkrieger:
Regarding your problem. '5kqm_all_sci.pdb' contains hydrogens - I prepared this file for MD simulations in NAMD. It is used in InSty tutorials, where we don't need to add hydrogen. That is why addMissingAtoms() is not working correctly.
Yes, I know but I was thinking something happen rather than getting an error. Other files work fine
@jamesmkrieger: Regarding your problem. '5kqm_all_sci.pdb' contains hydrogens - I prepared this file for MD simulations in NAMD. It is used in InSty tutorials, where we don't need to add hydrogen. That is why addMissingAtoms() is not working correctly.
Hey @jamesmkrieger which version of ProDy/pdbfixer are you using? I was struggling with addMissingAtoms (for something else) and found this issue. I tried the pdb you linked and it worked for me on the first try. I don't think the lack of a header should be an issue.
I don’t remember. I’ll have to check which environment this was
ProDy 2.4.1 /home/jkrieger/software/scipion3/software/em/ProDy - so one of the latest branches
pdbfixer 1.8.1
OpenMM 7.6.0