boscoh / pdbremix

analyse PDB files, run molecular-dynamics & analyse trajectories
MIT License
61 stars 25 forks source link

AttributeError: Atom instance has no attribute 'radius' #12

Closed Vedasheersh closed 6 years ago

Vedasheersh commented 6 years ago

Hi there,

I downloaded your package to use it for ASA calculations for protein structures. I am following your README file. I tried to run the following code but it shows error.

from pdbremix import fetch
from pdbremix import pdbatoms 
fetch.get_pdbs_with_http('1be9')
soup = pdbatoms.Soup("1be9.pdb") 
atoms = soup.atoms()
asa.calculate_asa(atoms, probe=1.4)

---------------------------------------------------------------------------
AttributeError                            
Traceback (most recent call last)
<ipython-input-19-bcab971c3e11> in <module>()
----> 1 asa.calculate_asa(atoms, probe=1.4)

/pdbremix-.-py2.7.egg/pdbremix/asa.pyc in calculate_asa(atoms, probe, n_sphere_point)
     66   for i, atom_i in enumerate(atoms):
     67 
---> 68     neighbor_indices = find_neighbor_indices(atoms, probe, i)
     69     n_neighbor = len(neighbor_indices)
     70     j_closest_neighbor = 0

/pdbremix-.-py2.7.egg/pdbremix/asa.pyc in find_neighbor_indices(atoms, probe, k)
     43   neighbor_indices = []
     44   atom_k = atoms[k]
---> 45   radius = atom_k.radius + probe + probe
     46   indices = range(k)
     47   indices.extend(range(k+1, len(atoms)))

AttributeError: Atom instance has no attribute 'radius'

Is there a way around this or am I doing something wrong here? Please let me know.

Vedasheersh commented 6 years ago

I found a method in pdbatoms.py which adds radii to atoms. I think we have to run that first before running calculate_asa. It works now. pdbatoms.add_radii(atoms) asa.calculate_asa(atoms, probe=1.4)