Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Set the state of the CYS object.
If SS-bonded, use CYX. If negatively charged, use CYM. If HG is not
present, use CYX.
"""
if "CYX" in self.patches or self.name == "CYX":
self.ffname = "CYX"
elif self.ss_bonded:
self.ffname = "CYX"
elif "CYM" in self.patches or self.name == "CYM":
self.ffname = "CYM"
elif not self.has_atom("HG"):
self.ffname = "CYX"
Amino.set_state(self)
class GLN(Amino):
"""Glutamine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'Q'
class GLU(Amino):
"""Glutamic Acid class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'E'
def set_state(self):
"""Set the name to use for the forcefield based on the current state."""
if "GLH" in self.patches or self.name == "GLH":
self.ffname = "GLH"
Amino.set_state(self)
class GLY(Amino):
"""Glycine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'G'
class HIS(Amino):
"""Histidine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def update_internal_bonds(self):
"""Update the internal bonding network using the reference objects in each atom."""
for residue in self.residues:
if isinstance(residue, (aa.Amino, aa.WAT, na.Nucleic)):
for atom in residue.atoms:
if not atom.has_reference:
continue
for bond in atom.reference.bonds:
if not residue.has_atom(bond):
continue
bondatom = residue.get_atom(bond)
if bondatom not in atom.bonds:
atom.add_bond(bondatom)
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'D'
def set_state(self):
"""Set the name to use for the forcefield based on the current state."""
if "ASH" in self.patches or self.name == "ASH":
self.ffname = "ASH"
Amino.set_state(self)
class CYS(Amino):
"""Cysteine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
self.ss_bonded = 0
self.ss_bonded_partner = None
def letter_code(self):
return 'C'
def set_state(self):
"""Set the state of the CYS object.
If SS-bonded, use CYX. If negatively charged, use CYM. If HG is not
present, use CYX.
"""
_LOGGER.warn("WARNING: PDB2PQR could not successfully parameterize the desired ligand; it has been left out of the PQR file.")
# remove the ligand
myProtein.residues.remove(residue)
for myChain in myProtein.chains:
if residue in myChain.residues: myChain.residues.remove(residue)
else:
ligsuccess = 1
# Mark these atoms as hits
hitlist = hitlist + templist
# Temporary fix; if ligand was successful, pull all ligands from misslist
if ligsuccess:
templist = misslist[:]
for atom in templist:
if isinstance(atom.residue, (aa.Amino, na.Nucleic)):
continue
misslist.remove(atom)
# Create the Typemap
if options.typemap:
typemapname = "%s-typemap.html" % outroot
myProtein.createHTMLTypeMap(myDefinition, typemapname)
# Grab the protein charge
reslist, charge = myProtein.getCharge()
# If we want a different naming scheme, use that
if options.ffout is not None:
scheme = ffout
userff = None # Currently not supported
else:
self.ffname = "C%s" % self.ffname
class SER(Amino):
"""Serine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'S'
class THR(Amino):
"""Threonine class"""
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
def letter_code(self):
return 'T'
class TRP(Amino):
"""Tryptophan class """
def __init__(self, atoms, ref):
Amino.__init__(self, atoms, ref)
self.reference = ref
There are three ways to identify a residue:
1. By name (i.e. HIS)
2. By reference name - a PDB file HSP has
a HIS reference name
3. By patch - applied by PropKa, terminal selection
Args:
residue: The residue in question (Residue)
Returns:
optinstance: None if not optimizeable, otherwise
the OptimizationHolder instance that
corresponds to the residue.
"""
optinstance = None
if not isinstance(residue, (aa.Amino, aa.WAT)):
return optinstance
if residue.name in self.map:
optinstance = self.map[residue.name]
elif residue.reference.name in self.map:
optinstance = self.map[residue.reference.name]
else:
for patch in residue.patches:
if patch in self.map:
optinstance = self.map[patch]
break
# If alcoholic, make sure the hydrogen is present
if optinstance != None:
if optinstance.opttype == "Alcoholic":
atomname = list(optinstance.map.keys())[0]
def cleanup(self):
"""If there are any extra carboxlyic *1 atoms, delete them.
This may occur when no optimization is chosen
"""
for residue in self.routines.protein.residues:
if not isinstance(residue, Amino):
continue
if residue.name == "GLH" or "GLH" in residue.patches:
if residue.has_atom("HE1") and residue.has_atom("HE2"):
residue.remove_atom("HE1")
elif residue.name == "ASH" or "ASH" in residue.patches:
if residue.has_atom("HD1") and residue.has_atom("HD2"):
residue.remove_atom("HD1")
def get_bump_score(self, residue):
"""Get an bump score for the current structure"""
# Do some setup
self.cells = cells.Cells(CELL_SIZE)
self.cells.assign_cells(self.protein)
self.protein.calculate_dihedral_angles()
self.protein.set_donors_acceptors()
self.protein.update_internal_bonds()
self.protein.set_reference_distance()
bumpscore = 0.0
if not isinstance(residue, aa.Amino):
return 0.0
# Initialize variables
for atom in residue.atoms:
atomname = atom.name
if atomname[0] != "H":
continue
bumpscore = bumpscore + self.get_bump_score_atom(atom)
return bumpscore