Fix a number of crashes and special conditions

- Fix an issue where non-existing interactions were analyzed.

  Bug fix in setIonDeterminants(): skip interactions if either
  titratable_group_interaction_atoms or the backbone_interaction_atoms
  is empty.

- Set center of COO_group to self.atom if no oxygens present in residue.

  COO_group: If self.atom.get_bonded_elements('O') returns an emtpy list
  (the residue has missing side-chain), simply set the center of the
  group to the <self.atom> atom, instead of the center of the
  (non-existing) oxygens.

- Raise more friendly exception in Group.set_center() if an empty atom
  set is passed in.

- Cterm_group: Fix crash if residue is missing a carbon.

  The previous code would crash if the C-termini residue group was
  missing the carbon atom.

- Fix a failure when a HIS residue has missing side-chain atoms.

- Added an entry for Iodine (I) to the valence electrons table.
This commit is contained in:
Matvey Adzhigirey
2012-12-04 20:10:09 -08:00
committed by Mike Beachy
parent 73c7a2a4be
commit 4566cd67f9
3 changed files with 38 additions and 12 deletions

View File

@@ -168,11 +168,16 @@ def setIonDeterminants(conformation_container, version):
def setBackBoneDeterminants(titratable_groups, backbone_groups, version): def setBackBoneDeterminants(titratable_groups, backbone_groups, version):
for titratable_group in titratable_groups: for titratable_group in titratable_groups:
titratable_group_interaction_atoms = titratable_group.interaction_atoms_for_acids
if not titratable_group_interaction_atoms:
continue
# find out which backbone groups this titratable is interacting with # find out which backbone groups this titratable is interacting with
for backbone_group in backbone_groups: for backbone_group in backbone_groups:
# find the interacting atoms # find the interacting atoms
backbone_interaction_atoms = backbone_group.get_interaction_atoms(titratable_group) backbone_interaction_atoms = backbone_group.get_interaction_atoms(titratable_group)
titratable_group_interaction_atoms = titratable_group.interaction_atoms_for_acids if not backbone_interaction_atoms:
continue
# find the smallest distance # find the smallest distance
[backbone_atom, distance, titratable_atom] = propka.calculations.get_smallest_distance(backbone_interaction_atoms, [backbone_atom, distance, titratable_atom] = propka.calculations.get_smallest_distance(backbone_interaction_atoms,

View File

@@ -420,6 +420,9 @@ class Group:
return self.interaction_atoms_for_acids #default is acid interaction atoms - cf. 3.0 return self.interaction_atoms_for_acids #default is acid interaction atoms - cf. 3.0
def set_center(self, atoms): def set_center(self, atoms):
if not atoms:
raise ValueError("At least one atom must be specified")
# reset center # reset center
self.x = 0.0; self.y = 0.0; self.z = 0.0 self.x = 0.0; self.y = 0.0; self.z = 0.0
@@ -614,8 +617,14 @@ class COO_group(Group):
# Identify the two caroxyl oxygen atoms # Identify the two caroxyl oxygen atoms
the_oxygens = self.atom.get_bonded_elements('O') the_oxygens = self.atom.get_bonded_elements('O')
# set the center using the two oxygen carboxyl atoms # set the center using the two oxygen carboxyl atoms (if present)
if the_oxygens:
self.set_center(the_oxygens) self.set_center(the_oxygens)
else:
self.set_center([self.atom])
# FIXME perhaps it would be better to ignore this group completely
# if the oxygen is missing from this residue?
self.set_interaction_atoms(the_oxygens, the_oxygens) self.set_interaction_atoms(the_oxygens, the_oxygens)
return return
@@ -636,7 +645,12 @@ class HIS_group(Group):
my_protonator.protonate_atom(r) my_protonator.protonate_atom(r)
# set the center using the ring atoms # set the center using the ring atoms
if ring_atoms:
self.set_center(ring_atoms) self.set_center(ring_atoms)
else:
# Missing side-chain atoms
self.set_center([self.atom])
# FIXME perhaps it would be better to ignore this group completely?
# find the hydrogens on the ring-nitrogens # find the hydrogens on the ring-nitrogens
hydrogens = [] hydrogens = []
@@ -751,8 +765,13 @@ class Cterm_group(Group):
def setup_atoms(self): def setup_atoms(self):
# Identify the carbon and other oxygen carboxyl atoms # Identify the carbon and other oxygen carboxyl atoms
the_carbon = self.atom.get_bonded_elements('C') the_carbons = self.atom.get_bonded_elements('C')
the_other_oxygen = the_carbon[0].get_bonded_elements('O') if not the_carbons:
self.set_center([self.atom])
# FIXME perhaps it would be better to ignore this group completely
# if the carbon is missing from this residue?
else:
the_other_oxygen = the_carbons[0].get_bonded_elements('O')
the_other_oxygen.remove(self.atom) the_other_oxygen.remove(self.atom)
# set the center and interaction atoms # set the center and interaction atoms

View File

@@ -47,7 +47,9 @@ class Protonate:
'As':5, 'As':5,
'Se':6, 'Se':6,
'Br':7, 'Br':7,
'Kr':8} 'Kr':8,
'I':7,
}