Clean up line breaks in calculations.py
See https://github.com/jensengroup/propka-3.1/issues/43.
This commit is contained in:
@@ -259,14 +259,14 @@ def add_amd_hydrogen(residue):
|
|||||||
o_atom = None
|
o_atom = None
|
||||||
n_atom = None
|
n_atom = None
|
||||||
for atom in residue:
|
for atom in residue:
|
||||||
if (atom.res_name == "GLN" and atom.name == "CD") \
|
if ((atom.res_name == "GLN" and atom.name == "CD")
|
||||||
or (atom.res_name == "ASN" and atom.name == "CG"):
|
or (atom.res_name == "ASN" and atom.name == "CG")):
|
||||||
c_atom = atom
|
c_atom = atom
|
||||||
elif (atom.res_name == "GLN" and atom.name == "OE1") \
|
elif ((atom.res_name == "GLN" and atom.name == "OE1")
|
||||||
or (atom.res_name == "ASN" and atom.name == "OD1"):
|
or (atom.res_name == "ASN" and atom.name == "OD1")):
|
||||||
o_atom = atom
|
o_atom = atom
|
||||||
elif (atom.res_name == "GLN" and atom.name == "NE2") \
|
elif ((atom.res_name == "GLN" and atom.name == "NE2")
|
||||||
or (atom.res_name == "ASN" and atom.name == "ND2"):
|
or (atom.res_name == "ASN" and atom.name == "ND2")):
|
||||||
n_atom = atom
|
n_atom = atom
|
||||||
if (c_atom is None) or (o_atom is None) or (n_atom is None):
|
if (c_atom is None) or (o_atom is None) or (n_atom is None):
|
||||||
errstr = "Unable to find all atoms for %s %s" % (residue[0].res_name,
|
errstr = "Unable to find all atoms for %s %s" % (residue[0].res_name,
|
||||||
@@ -445,8 +445,8 @@ def radial_volume_desolvation(parameters, group):
|
|||||||
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
|
||||||
if atom.res_num == group.atom.res_num \
|
if (atom.res_num == group.atom.res_num
|
||||||
and atom.chain_id == group.atom.chain_id:
|
and atom.chain_id == group.atom.chain_id):
|
||||||
continue
|
continue
|
||||||
sq_dist = squared_distance(group, atom)
|
sq_dist = squared_distance(group, atom)
|
||||||
# desolvation
|
# desolvation
|
||||||
@@ -466,8 +466,9 @@ def radial_volume_desolvation(parameters, group):
|
|||||||
group.buried = calculate_weight(parameters, group.num_volume)
|
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.energy_volume = group.charge * parameters.desolvationPrefactor \
|
group.energy_volume = (
|
||||||
* volume_after_allowance * scale_factor
|
group.charge * parameters.desolvationPrefactor
|
||||||
|
* volume_after_allowance * scale_factor)
|
||||||
|
|
||||||
|
|
||||||
def calculate_scale_factor(parameters, weight):
|
def calculate_scale_factor(parameters, weight):
|
||||||
@@ -494,8 +495,9 @@ def calculate_weight(parameters, num_volume):
|
|||||||
Returns:
|
Returns:
|
||||||
desolvation weight
|
desolvation weight
|
||||||
"""
|
"""
|
||||||
weight = float(num_volume - parameters.Nmin) \
|
weight = (
|
||||||
/ float(parameters.Nmax - parameters.Nmin)
|
float(num_volume - parameters.Nmin)
|
||||||
|
/ float(parameters.Nmax - parameters.Nmin))
|
||||||
weight = min(1.0, weight)
|
weight = min(1.0, weight)
|
||||||
weight = max(0.0, weight)
|
weight = max(0.0, weight)
|
||||||
return weight
|
return weight
|
||||||
@@ -647,8 +649,8 @@ def hydrogen_bond_interaction(group1, group2, version):
|
|||||||
# Do nothing, value should have been assigned.
|
# Do nothing, value should have been assigned.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
value = version.calculate_side_chain_energy(dist, dpka_max, cutoff, weight,
|
value = version.calculate_side_chain_energy(
|
||||||
f_angle)
|
dist, dpka_max, cutoff, weight, f_angle)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
@@ -712,15 +714,16 @@ def coulomb_energy(dist, weight, parameters):
|
|||||||
"""
|
"""
|
||||||
diel = UNK_DIELECTRIC1 - (UNK_DIELECTRIC1 - UNK_DIELECTRIC2)*weight
|
diel = UNK_DIELECTRIC1 - (UNK_DIELECTRIC1 - UNK_DIELECTRIC2)*weight
|
||||||
dist = max(dist, parameters.coulomb_cutoff1)
|
dist = max(dist, parameters.coulomb_cutoff1)
|
||||||
scale = (dist - parameters.coulomb_cutoff2)/(parameters.coulomb_cutoff1 \
|
scale = (
|
||||||
- parameters.coulomb_cutoff2)
|
(dist - parameters.coulomb_cutoff2)
|
||||||
|
/ (parameters.coulomb_cutoff1 - parameters.coulomb_cutoff2))
|
||||||
scale = max(0.0, scale)
|
scale = max(0.0, scale)
|
||||||
scale = min(1.0, scale)
|
scale = min(1.0, scale)
|
||||||
dpka = UNK_PKA_SCALING1/(diel*dist)*scale
|
dpka = UNK_PKA_SCALING1/(diel*dist)*scale
|
||||||
return abs(dpka)
|
return abs(dpka)
|
||||||
|
|
||||||
|
|
||||||
def backbone_reorganization(parameters, conformation):
|
def backbone_reorganization(_, conformation):
|
||||||
"""Perform calculations related to backbone reorganizations.
|
"""Perform calculations related to backbone reorganizations.
|
||||||
|
|
||||||
NOTE - this was described in the code as "adding test stuff"
|
NOTE - this was described in the code as "adding test stuff"
|
||||||
@@ -728,7 +731,7 @@ def backbone_reorganization(parameters, conformation):
|
|||||||
TODO - figure out why a similar function exists in version.py
|
TODO - figure out why a similar function exists in version.py
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
parameters: not used
|
_: not used
|
||||||
conformation: specific molecule conformation
|
conformation: specific molecule conformation
|
||||||
"""
|
"""
|
||||||
titratable_groups = conformation.get_backbone_reorganisation_groups()
|
titratable_groups = conformation.get_backbone_reorganisation_groups()
|
||||||
@@ -744,9 +747,10 @@ def backbone_reorganization(parameters, conformation):
|
|||||||
atom3=bbc_group.atom,
|
atom3=bbc_group.atom,
|
||||||
center=center)
|
center=center)
|
||||||
if dist < UNK_BACKBONE_DISTANCE1 and f_angle > UNK_FANGLE_MIN:
|
if dist < UNK_BACKBONE_DISTANCE1 and f_angle > UNK_FANGLE_MIN:
|
||||||
value = 1.0 - (dist-UNK_BACKBONE_DISTANCE2) \
|
value = (
|
||||||
/ (UNK_BACKBONE_DISTANCE1-UNK_BACKBONE_DISTANCE2)
|
1.0 - (dist-UNK_BACKBONE_DISTANCE2)
|
||||||
dpka += UNK_PKA_SCALING2*min(1.0, value)
|
/ (UNK_BACKBONE_DISTANCE1-UNK_BACKBONE_DISTANCE2))
|
||||||
|
dpka += UNK_PKA_SCALING2 * min(1.0, value)
|
||||||
titratable_group.energy_local = dpka*weight
|
titratable_group.energy_local = dpka*weight
|
||||||
|
|
||||||
|
|
||||||
@@ -774,14 +778,14 @@ def check_exceptions(version, group1, group2):
|
|||||||
exception, value = check_coo_coo_exception(group1, group2, version)
|
exception, value = check_coo_coo_exception(group1, group2, version)
|
||||||
elif (res_type1 == "CYS") and (res_type2 == "CYS"):
|
elif (res_type1 == "CYS") and (res_type2 == "CYS"):
|
||||||
exception, value = check_cys_cys_exception(group1, group2, version)
|
exception, value = check_cys_cys_exception(group1, group2, version)
|
||||||
elif (res_type1 == "COO") and (res_type2 == "HIS") or \
|
elif ((res_type1 == "COO") and (res_type2 == "HIS")
|
||||||
(res_type1 == "HIS") and (res_type2 == "COO"):
|
or (res_type1 == "HIS") and (res_type2 == "COO")):
|
||||||
exception, value = check_coo_his_exception(group1, group2, version)
|
exception, value = check_coo_his_exception(group1, group2, version)
|
||||||
elif (res_type1 == "OCO") and (res_type2 == "HIS") or \
|
elif ((res_type1 == "OCO") and (res_type2 == "HIS")
|
||||||
(res_type1 == "HIS") and (res_type2 == "OCO"):
|
or (res_type1 == "HIS") and (res_type2 == "OCO")):
|
||||||
exception, value = check_oco_his_exception(group1, group2, version)
|
exception, value = check_oco_his_exception(group1, group2, version)
|
||||||
elif (res_type1 == "CYS") and (res_type2 == "HIS") or \
|
elif ((res_type1 == "CYS") and (res_type2 == "HIS")
|
||||||
(res_type1 == "HIS") and (res_type2 == "CYS"):
|
or (res_type1 == "HIS") and (res_type2 == "CYS")):
|
||||||
exception, value = check_cys_his_exception(group1, group2, version)
|
exception, value = check_cys_his_exception(group1, group2, version)
|
||||||
else:
|
else:
|
||||||
# do nothing, no exception for this pair
|
# do nothing, no exception for this pair
|
||||||
@@ -933,8 +937,8 @@ def check_buried(num_volume1, num_volume2):
|
|||||||
Returns:
|
Returns:
|
||||||
True if interaction is buried, False otherwise
|
True if interaction is buried, False otherwise
|
||||||
"""
|
"""
|
||||||
if (num_volume1 + num_volume2 <= COMBINED_NUM_BURIED_MAX) \
|
if ((num_volume1 + num_volume2 <= COMBINED_NUM_BURIED_MAX)
|
||||||
and (num_volume1 <= SEPARATE_NUM_BURIED_MAX \
|
and (num_volume1 <= SEPARATE_NUM_BURIED_MAX
|
||||||
or num_volume2 <= SEPARATE_NUM_BURIED_MAX):
|
or num_volume2 <= SEPARATE_NUM_BURIED_MAX)):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user