Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def protonateBackBone(self, residue, C, O):
"""
Protonates an atom, X1, given a direction (X2 -> X3) [X1, X2, X3]
"""
N = residue.getAtom(name='N')
if C == None and O == None:
""" do nothing, first residue """
elif N == None:
pka_print("could not find N atom in '%s' (protonateBackBone())" % (residue.label))
exit(9)
elif residue.resName == "PRO":
""" do nothing, proline doesn't have a proton """
else:
H = self.protonateDirection(atoms=[N, O, C])
residue.atoms.append(H)
return residue.getAtom(name='C'), residue.getAtom(name='O')
for atom in residue.atoms:
if atom.name == 'N':
atom.charge = self.standard_charges['NTERM']
#pka_print('Charge', atom, atom.charge)
# set c-terminal charges
for chain in protein.chains:
for residue in chain.residues:
if residue.resName.replace(' ', '') == 'C-':
for atom in residue.atoms:
if atom.name in self.my_bond_maker.terminal_oxygen_names:
atom.charge = self.standard_charges['CTERM']
#pka_print('Charge', atom, atom.charge)
else:
pka_print('Custom protonation state choosen - don\'t know what to do')
return
def set_bond_distance(self, a, element):
d = 1.0
if element in list(self.bond_lengths.keys()):
d = self.bond_lengths[element]
else:
pka_print('WARNING: Bond length for %s not found, using the standard value of %f' % (element, d))
a = a.rescale(d)
return a
def add_protons(self, atom):
# decide which method to use
# pka_print('PROTONATING',atom)
if atom.steric_number in list(self.protonation_methods.keys()):
self.protonation_methods[atom.steric_number](atom)
else:
pka_print('Warning: Do not have a method for protonating', atom, '(steric number: %d)' % atom.steric_number)
return
def radialVolumeDesolvation(residue, atoms, version, options=None):
"""
calculates the desolvation according to the ScaledRadialVolumeModel
"""
if residue.label == "BKB 50 A":
pka_print("found %s [%6.3lf%6.3lf%6.3lf]!" % (residue.label, residue.x, residue.y, residue.z))
pka_print("buried_cutoff_sqr = %s!" % (version.buried_cutoff_sqr))
pka_print("desolv_cutoff_sqr = %s!" % (version.desolv_cutoff_sqr))
scale_factor = 0.8527*1.36 # temporary weight for printing out contributions
residue.Nlocl = 0
residue.Nmass = 0
residue.Elocl = 0.00
dV = 0.00
volume = 0.00
min_distance_4th = pow(2.75, 4)
for chainID in atoms.keys():
for key in atoms[chainID]["keys"]:
for atom in atoms[chainID][key]:
if atom.element != "H":
if atom.resNumb != residue.resNumb or atom.chainID != residue.chainID:
# selecting atom type
if atom.name in ["C", "CA"]:
atomtype = "C"
tagged_pka_print(' Original|', residue2.getDeterminantString(), [residue1.label, residue2.label])
# swap the interactions!
transfer_determinant(residue1.determinants[2], residue2.determinants[2], residue1.label, residue2.label)
if include_side_chain_hbs:
transfer_determinant(residue1.determinants[0], residue2.determinants[0], residue1.label, residue2.label)
# re-calculate pKa values
residue1.calculateTotalPKA()
residue2.calculateTotalPKA()
if verbose:
tagged_pka_print(' Swapped |', residue1.getDeterminantString(), [residue1.label, residue2.label])
tagged_pka_print(' Swapped |', residue2.getDeterminantString(), [residue1.label, residue2.label])
pka_print(' '+'='*113)
pka_print('')
return
""" Finds coupled residues in protein """
verbose = options.display_coupled_residues
if True:
pka_print('')
pka_print(' Detecting coupled residues')
pka_print(' Maximum pKa difference: %4.2f pKa units' % max_intrinsic_pKa_diff)
pka_print(' Minimum interaction energy: %4.2f pKa units' % min_interaction_energy)
pka_print(' Maximum free energy diff.: %4.2f pKa units' % max_free_energy_diff)
pka_print(' Minimum swap pKa shift: %4.2f pKa units' % min_swap_pka_shift)
pka_print(' pH: %6s ' % str(pH))
pka_print(' Reference: %s' % reference)
pka_print(' Min pKa: %4.2f' % min_pka)
pka_print(' Max pKa: %4.2f' % max_pka)
pka_print('')
# make a single list of all residues in the protein
all_residues = []
for chain in protein.chains:
for residue in chain.residues:
if not residue in protein.residue_dictionary["ION"]:
all_residues.append(residue)
# find coupled residues
for i in range(len(all_residues)):
for j in range(len(all_residues)):
if i == j:
break
swap = 0
if do_intrinsic:
(coupling_factor_intrinsic_pka, interaction_energy) = is_coupled_intrinsic_pka(all_residues[i], all_residues[j])