Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def addCoulombBasePair(object1, object2, value):
"""
Adding the Coulomb interaction (a base pair):
the lower pKa is lowered
"""
label1 = object1.label
label2 = object2.label
if object1.pKa_mod < object2.pKa_mod:
newDeterminant = Determinant(label2, -value)
object1.determinants[2].append(newDeterminant)
else:
newDeterminant = Determinant(label1, -value)
object2.determinants[2].append(newDeterminant)
def addCoulombAcidPair(object1, object2, value):
"""
Adding the Coulomb interaction (an acid pair):
the higher pKa is raised
"""
label1 = object1.label
label2 = object2.label
if object1.pKa_mod > object2.pKa_mod:
newDeterminant = Determinant(label2, value)
object1.determinants[2].append(newDeterminant)
else:
newDeterminant = Determinant(label1, value)
object2.determinants[2].append(newDeterminant)
def setIonDeterminants(protein, version=None):
"""
adding ion determinants/perturbations
"""
ionizable_residues = lib.residueList("propka1")
for residue in protein.propka_residues:
if residue.resName in ionizable_residues:
for ion in protein.residue_dictionary["ION"]:
distance = calculate.InterResidueDistance(residue, ion)
if distance < version.coulomb_cutoff[1]:
label = "%s%4d%2s" % (ion.resName, ion.resNumb, ion.chainID)
weight = version.calculatePairWeight(residue.Nmass, ion.Nmass)
# the pKa of both acids and bases are shifted up by negative ions (and vice versa)
value = (-ion.Q) * version.calculateCoulombEnergy(distance, weight)
newDeterminant = Determinant(label, value)
residue.determinants[2].append(newDeterminant)
weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
exception, value = version.checkExceptions(residue1, residue2)
# exception = False # circumventing exception
if exception == True:
""" do nothing, value should have been assigned """
#pka_print(" exception for %s %s %6.2lf" % (residue1.label, residue2.label, value))
else:
value = version.calculateSideChainEnergy(distance, dpka_max, cutoff, weight, f_angle)
if residue1.Q == residue2.Q:
# acid pair or base pair
if residue1.pKa_mod < residue2.pKa_mod:
newDeterminant1 = Determinant(residue2.label, -value)
newDeterminant2 = Determinant(residue1.label, value)
else:
newDeterminant1 = Determinant(residue2.label, value)
newDeterminant2 = Determinant(residue1.label, -value)
else:
newDeterminant1 = Determinant(residue2.label, value*residue1.Q)
newDeterminant2 = Determinant(residue1.label, value*residue2.Q)
if residue1.resName not in version.exclude_sidechain_interactions:
residue1.determinants[0].append(newDeterminant1)
if residue2.resName not in version.exclude_sidechain_interactions:
residue2.determinants[0].append(newDeterminant2)
def addCoulombAcidPair(object1, object2, value):
"""
Adding the Coulomb interaction (an acid pair):
the higher pKa is raised
"""
label1 = object1.label
label2 = object2.label
if object1.pKa_mod > object2.pKa_mod:
newDeterminant = Determinant(label2, value)
object1.determinants[2].append(newDeterminant)
else:
newDeterminant = Determinant(label1, value)
object2.determinants[2].append(newDeterminant)
else:
# i.e. no angular dependence
f_angle = 1.0
weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
exception, value = version.checkExceptions(residue1, residue2)
# exception = False # circumventing exception
if exception == True:
""" do nothing, value should have been assigned """
#pka_print(" exception for %s %s %6.2lf" % (residue1.label, residue2.label, value))
else:
value = version.calculateSideChainEnergy(distance, dpka_max, cutoff, weight, f_angle)
if residue1.Q == residue2.Q:
# acid pair or base pair
if residue1.pKa_mod < residue2.pKa_mod:
newDeterminant1 = Determinant(residue2.label, -value)
newDeterminant2 = Determinant(residue1.label, value)
else:
newDeterminant1 = Determinant(residue2.label, value)
newDeterminant2 = Determinant(residue1.label, -value)
else:
newDeterminant1 = Determinant(residue2.label, value*residue1.Q)
newDeterminant2 = Determinant(residue1.label, value*residue2.Q)
if residue1.resName not in version.exclude_sidechain_interactions:
residue1.determinants[0].append(newDeterminant1)
if residue2.resName not in version.exclude_sidechain_interactions:
residue2.determinants[0].append(newDeterminant2)
weight = version.calculatePairWeight(residue1.Nmass, residue2.Nmass)
exception, value = version.checkExceptions(residue1, residue2)
# exception = False # circumventing exception
if exception == True:
""" do nothing, value should have been assigned """
#pka_print(" exception for %s %s %6.2lf" % (residue1.label, residue2.label, value))
else:
value = version.calculateSideChainEnergy(distance, dpka_max, cutoff, weight, f_angle)
if residue1.Q == residue2.Q:
# acid pair or base pair
if residue1.pKa_mod < residue2.pKa_mod:
newDeterminant1 = Determinant(residue2.label, -value)
newDeterminant2 = Determinant(residue1.label, value)
else:
newDeterminant1 = Determinant(residue2.label, value)
newDeterminant2 = Determinant(residue1.label, -value)
else:
newDeterminant1 = Determinant(residue2.label, value*residue1.Q)
newDeterminant2 = Determinant(residue1.label, value*residue2.Q)
if residue1.resName not in version.exclude_sidechain_interactions:
residue1.determinants[0].append(newDeterminant1)
if residue2.resName not in version.exclude_sidechain_interactions:
residue2.determinants[0].append(newDeterminant2)