diff --git a/propka/determinants.py b/propka/determinants.py index b3ed586..4299432 100644 --- a/propka/determinants.py +++ b/propka/determinants.py @@ -168,11 +168,16 @@ def setIonDeterminants(conformation_container, version): def setBackBoneDeterminants(titratable_groups, backbone_groups, version): 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 for backbone_group in backbone_groups: # find the interacting atoms 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 [backbone_atom, distance, titratable_atom] = propka.calculations.get_smallest_distance(backbone_interaction_atoms, diff --git a/propka/group.py b/propka/group.py index ac52d3e..b5c5a06 100644 --- a/propka/group.py +++ b/propka/group.py @@ -420,6 +420,9 @@ class Group: return self.interaction_atoms_for_acids #default is acid interaction atoms - cf. 3.0 def set_center(self, atoms): + if not atoms: + raise ValueError("At least one atom must be specified") + # reset center 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 the_oxygens = self.atom.get_bonded_elements('O') - # set the center using the two oxygen carboxyl atoms - self.set_center(the_oxygens) + # set the center using the two oxygen carboxyl atoms (if present) + if 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) return @@ -636,7 +645,12 @@ class HIS_group(Group): my_protonator.protonate_atom(r) # set the center using the ring atoms - self.set_center(ring_atoms) + if 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 hydrogens = [] @@ -751,14 +765,19 @@ class Cterm_group(Group): def setup_atoms(self): # Identify the carbon and other oxygen carboxyl atoms - the_carbon = self.atom.get_bonded_elements('C') - the_other_oxygen = the_carbon[0].get_bonded_elements('O') - the_other_oxygen.remove(self.atom) + the_carbons = self.atom.get_bonded_elements('C') + 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) - # set the center and interaction atoms - the_oxygens = [self.atom]+ the_other_oxygen - self.set_center(the_oxygens) - self.set_interaction_atoms(the_oxygens, the_oxygens) + # set the center and interaction atoms + the_oxygens = [self.atom]+ the_other_oxygen + self.set_center(the_oxygens) + self.set_interaction_atoms(the_oxygens, the_oxygens) return diff --git a/propka/protonate.py b/propka/protonate.py index 396790b..34b8a01 100644 --- a/propka/protonate.py +++ b/propka/protonate.py @@ -47,7 +47,9 @@ class Protonate: 'As':5, 'Se':6, 'Br':7, - 'Kr':8} + 'Kr':8, + 'I':7, + }