De-lint groups.py
I did my best (via Google) to make sure that renamed public members and methods had minimal impact on others' code.
This commit is contained in:
@@ -342,7 +342,7 @@ common_charge_centre 0
|
|||||||
remove_penalised_group 1
|
remove_penalised_group 1
|
||||||
|
|
||||||
# non-covalent coupling
|
# non-covalent coupling
|
||||||
max_intrinsic_pKa_diff 2.0
|
max_intrinsic_pka_diff 2.0
|
||||||
min_interaction_energy 0.5
|
min_interaction_energy 0.5
|
||||||
max_free_energy_diff 1.0
|
max_free_energy_diff 1.0
|
||||||
min_swap_pka_shift 1.0
|
min_swap_pka_shift 1.0
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ def setup_bonding_and_protonation(parameters, molecular_container):
|
|||||||
my_bond_maker.add_pi_electron_information(molecular_container)
|
my_bond_maker.add_pi_electron_information(molecular_container)
|
||||||
# Protonate atoms
|
# Protonate atoms
|
||||||
if molecular_container.options.protonate_all:
|
if molecular_container.options.protonate_all:
|
||||||
my_protonator = propka.protonate.Protonate(verbose=False)
|
PROTONATOR = propka.protonate.Protonate(verbose=False)
|
||||||
my_protonator.protonate(molecular_container)
|
PROTONATOR.protonate(molecular_container)
|
||||||
|
|
||||||
|
|
||||||
def setup_bonding(molecular_container):
|
def setup_bonding(molecular_container):
|
||||||
@@ -386,10 +386,10 @@ def radial_volume_desolvation(parameters, group):
|
|||||||
"""
|
"""
|
||||||
all_atoms = group.atom.conformation_container.get_non_hydrogen_atoms()
|
all_atoms = group.atom.conformation_container.get_non_hydrogen_atoms()
|
||||||
volume = 0.0
|
volume = 0.0
|
||||||
# TODO - Nathan really wants to rename the Nmass variable.
|
# TODO - Nathan really wants to rename the num_volume variable.
|
||||||
# He had to re-read the original paper to figure out what it was.
|
# He had to re-read the original paper to figure out what it was.
|
||||||
# A better name would be num_volume.
|
# A better name would be num_volume.
|
||||||
group.Nmass = 0
|
group.num_volume = 0
|
||||||
min_dist_4th = MIN_DISTANCE_4TH
|
min_dist_4th = MIN_DISTANCE_4TH
|
||||||
for atom in all_atoms:
|
for atom in all_atoms:
|
||||||
# ignore atoms in the same residue
|
# ignore atoms in the same residue
|
||||||
@@ -410,11 +410,11 @@ def radial_volume_desolvation(parameters, group):
|
|||||||
volume += dv_inc
|
volume += dv_inc
|
||||||
# buried
|
# buried
|
||||||
if sq_dist < parameters.buried_cutoff_squared:
|
if sq_dist < parameters.buried_cutoff_squared:
|
||||||
group.Nmass += 1
|
group.num_volume += 1
|
||||||
group.buried = calculate_weight(parameters, group.Nmass)
|
group.buried = calculate_weight(parameters, group.num_volume)
|
||||||
scale_factor = calculate_scale_factor(parameters, group.buried)
|
scale_factor = calculate_scale_factor(parameters, group.buried)
|
||||||
volume_after_allowance = max(0.00, volume-parameters.desolvationAllowance)
|
volume_after_allowance = max(0.00, volume-parameters.desolvationAllowance)
|
||||||
group.Emass = group.charge * parameters.desolvationPrefactor \
|
group.energy_volume = group.charge * parameters.desolvationPrefactor \
|
||||||
* volume_after_allowance * scale_factor
|
* volume_after_allowance * scale_factor
|
||||||
|
|
||||||
|
|
||||||
@@ -589,7 +589,7 @@ def hydrogen_bond_interaction(group1, group2, version):
|
|||||||
# is closer to the titratable atom than the hydrogen. In either
|
# is closer to the titratable atom than the hydrogen. In either
|
||||||
# case, we set the angle factor to 0
|
# case, we set the angle factor to 0
|
||||||
f_angle = 0.0
|
f_angle = 0.0
|
||||||
weight = version.calculate_pair_weight(group1.Nmass, group2.Nmass)
|
weight = version.calculate_pair_weight(group1.num_volume, group2.num_volume)
|
||||||
exception, value = version.check_exceptions(group1, group2)
|
exception, value = version.check_exceptions(group1, group2)
|
||||||
if exception:
|
if exception:
|
||||||
# Do nothing, value should have been assigned.
|
# Do nothing, value should have been assigned.
|
||||||
@@ -614,7 +614,7 @@ def electrostatic_interaction(group1, group2, dist, version):
|
|||||||
# check if we should do coulomb interaction at all
|
# check if we should do coulomb interaction at all
|
||||||
if not version.check_coulomb_pair(group1, group2, dist):
|
if not version.check_coulomb_pair(group1, group2, dist):
|
||||||
return None
|
return None
|
||||||
weight = version.calculate_pair_weight(group1.Nmass, group2.Nmass)
|
weight = version.calculate_pair_weight(group1.num_volume, group2.num_volume)
|
||||||
value = version.calculate_coulomb_energy(dist, weight)
|
value = version.calculate_coulomb_energy(dist, weight)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@@ -633,7 +633,7 @@ def check_coulomb_pair(parameters, group1, group2, dist):
|
|||||||
Returns:
|
Returns:
|
||||||
Boolean
|
Boolean
|
||||||
"""
|
"""
|
||||||
num_volume = group1.Nmass + group2.Nmass
|
num_volume = group1.num_volume + group2.num_volume
|
||||||
do_coulomb = True
|
do_coulomb = True
|
||||||
# check if both groups are titratable (ions are taken care of in
|
# check if both groups are titratable (ions are taken care of in
|
||||||
# determinants::set_ion_determinants)
|
# determinants::set_ion_determinants)
|
||||||
@@ -695,7 +695,7 @@ def backbone_reorganization(parameters, conformation):
|
|||||||
value = 1.0 - (dist-UNK_BACKBONE_DISTANCE2) \
|
value = 1.0 - (dist-UNK_BACKBONE_DISTANCE2) \
|
||||||
/ (UNK_BACKBONE_DISTANCE1-UNK_BACKBONE_DISTANCE2)
|
/ (UNK_BACKBONE_DISTANCE1-UNK_BACKBONE_DISTANCE2)
|
||||||
dpka += UNK_PKA_SCALING2*min(1.0, value)
|
dpka += UNK_PKA_SCALING2*min(1.0, value)
|
||||||
titratable_group.Elocl = dpka*weight
|
titratable_group.energy_local = dpka*weight
|
||||||
|
|
||||||
|
|
||||||
def check_exceptions(version, group1, group2):
|
def check_exceptions(version, group1, group2):
|
||||||
@@ -799,7 +799,7 @@ def check_coo_coo_exception(group1, group2, version):
|
|||||||
closest_atom2)
|
closest_atom2)
|
||||||
f_angle = 1.00
|
f_angle = 1.00
|
||||||
value = hydrogen_bond_energy(dist, dpka_max, cutoff, f_angle)
|
value = hydrogen_bond_energy(dist, dpka_max, cutoff, f_angle)
|
||||||
weight = calculate_pair_weight(version.parameters, group1.Nmass, group2.Nmass)
|
weight = calculate_pair_weight(version.parameters, group1.num_volume, group2.num_volume)
|
||||||
value = value * (1.0 + weight)
|
value = value * (1.0 + weight)
|
||||||
return exception, value
|
return exception, value
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ def check_coo_his_exception(group1, group2, version):
|
|||||||
2. value associated with atypical interaction (None if Boolean is False)
|
2. value associated with atypical interaction (None if Boolean is False)
|
||||||
"""
|
"""
|
||||||
exception = False
|
exception = False
|
||||||
if check_buried(group1.Nmass, group2.Nmass):
|
if check_buried(group1.num_volume, group2.num_volume):
|
||||||
exception = True
|
exception = True
|
||||||
return exception, version.parameters.COO_HIS_exception
|
return exception, version.parameters.COO_HIS_exception
|
||||||
|
|
||||||
@@ -833,7 +833,7 @@ def check_oco_his_exception(group1, group2, version):
|
|||||||
2. value associated with atypical interaction (None if Boolean is False)
|
2. value associated with atypical interaction (None if Boolean is False)
|
||||||
"""
|
"""
|
||||||
exception = False
|
exception = False
|
||||||
if check_buried(group1.Nmass, group2.Nmass):
|
if check_buried(group1.num_volume, group2.num_volume):
|
||||||
exception = True
|
exception = True
|
||||||
return exception, version.parameters.OCO_HIS_exception
|
return exception, version.parameters.OCO_HIS_exception
|
||||||
|
|
||||||
@@ -850,7 +850,7 @@ def check_cys_his_exception(group1, group2, version):
|
|||||||
2. value associated with atypical interaction (None if Boolean is False)
|
2. value associated with atypical interaction (None if Boolean is False)
|
||||||
"""
|
"""
|
||||||
exception = False
|
exception = False
|
||||||
if check_buried(group1.Nmass, group2.Nmass):
|
if check_buried(group1.num_volume, group2.num_volume):
|
||||||
exception = True
|
exception = True
|
||||||
return exception, version.parameters.CYS_HIS_exception
|
return exception, version.parameters.CYS_HIS_exception
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ def check_cys_cys_exception(group1, group2, version):
|
|||||||
2. value associated with atypical interaction (None if Boolean is False)
|
2. value associated with atypical interaction (None if Boolean is False)
|
||||||
"""
|
"""
|
||||||
exception = False
|
exception = False
|
||||||
if check_buried(group1.Nmass, group2.Nmass):
|
if check_buried(group1.num_volume, group2.num_volume):
|
||||||
exception = True
|
exception = True
|
||||||
return exception, version.parameters.CYS_CYS_exception
|
return exception, version.parameters.CYS_CYS_exception
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class NonCovalentlyCoupledGroups:
|
|||||||
return {'coupling_factor': -1.0}
|
return {'coupling_factor': -1.0}
|
||||||
# calculate intrinsic pKa's, if not already done
|
# calculate intrinsic pKa's, if not already done
|
||||||
for group in [group1, group2]:
|
for group in [group1, group2]:
|
||||||
if not hasattr(group, 'intrinsic_pKa'):
|
if group.intrinsic_pka is None:
|
||||||
group.calculate_intrinsic_pka()
|
group.calculate_intrinsic_pka()
|
||||||
use_ph = self.parameters.pH
|
use_ph = self.parameters.pH
|
||||||
if self.parameters.pH == 'variable':
|
if self.parameters.pH == 'variable':
|
||||||
@@ -70,12 +70,12 @@ class NonCovalentlyCoupledGroups:
|
|||||||
and return_on_fail:
|
and return_on_fail:
|
||||||
return {'coupling_factor': -1.0}
|
return {'coupling_factor': -1.0}
|
||||||
# check intrinsic pka diff
|
# check intrinsic pka diff
|
||||||
if abs(group1.intrinsic_pKa - group2.intrinsic_pKa) \
|
if abs(group1.intrinsic_pka - group2.intrinsic_pka) \
|
||||||
> self.parameters.max_intrinsic_pKa_diff and return_on_fail:
|
> self.parameters.max_intrinsic_pka_diff and return_on_fail:
|
||||||
return {'coupling_factor': -1.0}
|
return {'coupling_factor': -1.0}
|
||||||
# if everything is OK, calculate the coupling factor and return all info
|
# if everything is OK, calculate the coupling factor and return all info
|
||||||
factor = self.get_free_energy_diff_factor(default_energy, swapped_energy) \
|
factor = self.get_free_energy_diff_factor(default_energy, swapped_energy) \
|
||||||
* self.get_pka_diff_factor(group1.intrinsic_pKa, group2.intrinsic_pKa) \
|
* self.get_pka_diff_factor(group1.intrinsic_pka, group2.intrinsic_pka) \
|
||||||
* self.get_interaction_factor(interaction_energy)
|
* self.get_interaction_factor(interaction_energy)
|
||||||
return {'coupling_factor': factor, 'default_energy': default_energy,
|
return {'coupling_factor': factor, 'default_energy': default_energy,
|
||||||
'swapped_energy': swapped_energy,
|
'swapped_energy': swapped_energy,
|
||||||
@@ -95,8 +95,8 @@ class NonCovalentlyCoupledGroups:
|
|||||||
"""
|
"""
|
||||||
intrinsic_pka_diff = abs(pka1-pka2)
|
intrinsic_pka_diff = abs(pka1-pka2)
|
||||||
res = 0.0
|
res = 0.0
|
||||||
if intrinsic_pka_diff <= self.parameters.max_intrinsic_pKa_diff:
|
if intrinsic_pka_diff <= self.parameters.max_intrinsic_pka_diff:
|
||||||
res = 1-(intrinsic_pka_diff/self.parameters.max_intrinsic_pKa_diff)**2
|
res = 1-(intrinsic_pka_diff/self.parameters.max_intrinsic_pka_diff)**2
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_free_energy_diff_factor(self, energy1, energy2):
|
def get_free_energy_diff_factor(self, energy1, energy2):
|
||||||
@@ -147,7 +147,7 @@ class NonCovalentlyCoupledGroups:
|
|||||||
info(' Detecting non-covalently coupled residues')
|
info(' Detecting non-covalently coupled residues')
|
||||||
info('-' * 103)
|
info('-' * 103)
|
||||||
info(' Maximum pKa difference: %4.2f pKa units' \
|
info(' Maximum pKa difference: %4.2f pKa units' \
|
||||||
% self.parameters.max_intrinsic_pKa_diff)
|
% self.parameters.max_intrinsic_pka_diff)
|
||||||
info(' Minimum interaction energy: %4.2f pKa units' \
|
info(' Minimum interaction energy: %4.2f pKa units' \
|
||||||
% self.parameters.min_interaction_energy)
|
% self.parameters.min_interaction_energy)
|
||||||
info(' Maximum free energy diff.: %4.2f pKa units' \
|
info(' Maximum free energy diff.: %4.2f pKa units' \
|
||||||
@@ -263,7 +263,7 @@ class NonCovalentlyCoupledGroups:
|
|||||||
str_ = ' ' + '-' * 113 + '\n'
|
str_ = ' ' + '-' * 113 + '\n'
|
||||||
for group in system:
|
for group in system:
|
||||||
str_ += self.tagged_format(' %-8s|' % tag,
|
str_ += self.tagged_format(' %-8s|' % tag,
|
||||||
group.getDeterminantString(),
|
group.get_determinant_string(),
|
||||||
all_labels)
|
all_labels)
|
||||||
return str_ + '\n'
|
return str_ + '\n'
|
||||||
|
|
||||||
@@ -355,8 +355,8 @@ class NonCovalentlyCoupledGroups:
|
|||||||
(group1.label, group2.label, data['coupling_factor'],
|
(group1.label, group2.label, data['coupling_factor'],
|
||||||
data['default_energy'], data['swapped_energy'],
|
data['default_energy'], data['swapped_energy'],
|
||||||
data['default_energy'] - data['swapped_energy'], data['pH'],
|
data['default_energy'] - data['swapped_energy'], data['pH'],
|
||||||
data['interaction_energy'], group1.intrinsic_pKa, group2.intrinsic_pKa,
|
data['interaction_energy'], group1.intrinsic_pka, group2.intrinsic_pka,
|
||||||
group1.intrinsic_pKa-group2.intrinsic_pKa, data['swapped_pka1'],
|
group1.intrinsic_pka-group2.intrinsic_pka, data['swapped_pka1'],
|
||||||
data['swapped_pka2'], data['pka_shift1'], data['pka_shift2'])
|
data['swapped_pka2'], data['pka_shift1'], data['pka_shift2'])
|
||||||
|
|
||||||
return str_
|
return str_
|
||||||
|
|||||||
@@ -188,8 +188,8 @@ def set_ion_determinants(conformation_container, version):
|
|||||||
for ion_group in conformation_container.get_ions():
|
for ion_group in conformation_container.get_ions():
|
||||||
dist_sq = squared_distance(titratable_group, ion_group)
|
dist_sq = squared_distance(titratable_group, ion_group)
|
||||||
if dist_sq < version.parameters.coulomb_cutoff2_squared:
|
if dist_sq < version.parameters.coulomb_cutoff2_squared:
|
||||||
weight = version.calculate_pair_weight(titratable_group.Nmass,
|
weight = version.calculate_pair_weight(titratable_group.num_volume,
|
||||||
ion_group.Nmass)
|
ion_group.num_volume)
|
||||||
# the pKa of both acids and bases are shifted up by negative
|
# the pKa of both acids and bases are shifted up by negative
|
||||||
# ions (and vice versa)
|
# ions (and vice versa)
|
||||||
value = (-ion_group.charge) \
|
value = (-ion_group.charge) \
|
||||||
|
|||||||
1253
propka/group.py
1253
propka/group.py
File diff suppressed because it is too large
Load Diff
@@ -339,8 +339,8 @@ class Iterative:
|
|||||||
coulomb += value
|
coulomb += value
|
||||||
|
|
||||||
self.pKa_NonIterative = group.model_pka
|
self.pKa_NonIterative = group.model_pka
|
||||||
self.pKa_NonIterative += group.Emass
|
self.pKa_NonIterative += group.energy_volume
|
||||||
self.pKa_NonIterative += group.Elocl
|
self.pKa_NonIterative += group.energy_local
|
||||||
self.pKa_NonIterative += side_chain
|
self.pKa_NonIterative += side_chain
|
||||||
self.pKa_NonIterative += back_bone
|
self.pKa_NonIterative += back_bone
|
||||||
self.pKa_NonIterative += coulomb
|
self.pKa_NonIterative += coulomb
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ def getDeterminantSection(protein, conformation, parameters):
|
|||||||
groups = [g for g in protein.conformations[conformation].groups if g.atom.chain_id == chain]
|
groups = [g for g in protein.conformations[conformation].groups if g.atom.chain_id == chain]
|
||||||
for group in groups:
|
for group in groups:
|
||||||
if group.residue_type == residue_type:
|
if group.residue_type == residue_type:
|
||||||
str += "%s" % ( group.getDeterminantString(parameters.remove_penalised_group) )
|
str += "%s" % ( group.get_determinant_string(parameters.remove_penalised_group) )
|
||||||
|
|
||||||
# Add a warning in case of coupled residues
|
# Add a warning in case of coupled residues
|
||||||
if protein.conformations[conformation].non_covalently_coupled_groups and not protein.options.display_coupled_residues:
|
if protein.conformations[conformation].non_covalently_coupled_groups and not protein.options.display_coupled_residues:
|
||||||
@@ -151,7 +151,7 @@ def getSummarySection(protein, conformation, parameters):
|
|||||||
for residue_type in parameters.write_out_order:
|
for residue_type in parameters.write_out_order:
|
||||||
for group in protein.conformations[conformation].groups:
|
for group in protein.conformations[conformation].groups:
|
||||||
if group.residue_type == residue_type:
|
if group.residue_type == residue_type:
|
||||||
str += "%s" % ( group.getSummaryString(parameters.remove_penalised_group) )
|
str += "%s" % ( group.get_summary_string(parameters.remove_penalised_group) )
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ parameters = ['Nmin','Nmax','desolvationSurfaceScalingFactor','desolvat
|
|||||||
'include_H_in_interactions','coupling_max_number_of_bonds',
|
'include_H_in_interactions','coupling_max_number_of_bonds',
|
||||||
'min_bond_distance_for_hydrogen_bonds','coupling_penalty',
|
'min_bond_distance_for_hydrogen_bonds','coupling_penalty',
|
||||||
'shared_determinants','common_charge_centre','hide_penalised_group', 'remove_penalised_group',
|
'shared_determinants','common_charge_centre','hide_penalised_group', 'remove_penalised_group',
|
||||||
'max_intrinsic_pKa_diff','min_interaction_energy','max_free_energy_diff','min_swap_pka_shift',
|
'max_intrinsic_pka_diff','min_interaction_energy','max_free_energy_diff','min_swap_pka_shift',
|
||||||
'min_pka','max_pka','sidechain_interaction']
|
'min_pka','max_pka','sidechain_interaction']
|
||||||
|
|
||||||
strings = ['version','output_file_tag','ligand_typing','pH','reference']
|
strings = ['version','output_file_tag','ligand_typing','pH','reference']
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ common_charge_centre 0
|
|||||||
remove_penalised_group 1
|
remove_penalised_group 1
|
||||||
|
|
||||||
# non-covalent coupling
|
# non-covalent coupling
|
||||||
max_intrinsic_pKa_diff 2.0
|
max_intrinsic_pka_diff 2.0
|
||||||
min_interaction_energy 0.5
|
min_interaction_energy 0.5
|
||||||
max_free_energy_diff 1.0
|
max_free_energy_diff 1.0
|
||||||
min_swap_pka_shift 1.0
|
min_swap_pka_shift 1.0
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class version:
|
|||||||
def calculate_desolvation(self, group):
|
def calculate_desolvation(self, group):
|
||||||
return self.desolvation_model(self.parameters, group)
|
return self.desolvation_model(self.parameters, group)
|
||||||
|
|
||||||
def calculate_pair_weight(self, Nmass1, Nmass2):
|
def calculate_pair_weight(self, num_volume1, num_volume2):
|
||||||
return self.weight_pair_method(self.parameters, Nmass1, Nmass2)
|
return self.weight_pair_method(self.parameters, num_volume1, num_volume2)
|
||||||
|
|
||||||
# side chains
|
# side chains
|
||||||
def hydrogen_bond_interaction(self, group1, group2):
|
def hydrogen_bond_interaction(self, group1, group2):
|
||||||
|
|||||||
Reference in New Issue
Block a user