De-lint propka/atom.py
Other changes are a result of Atom use in other files.
This commit is contained in:
157
propka/atom.py
157
propka/atom.py
@@ -2,6 +2,7 @@
|
|||||||
import string
|
import string
|
||||||
import propka.lib
|
import propka.lib
|
||||||
import propka.group
|
import propka.group
|
||||||
|
# TODO - what is hybrid36?
|
||||||
from . import hybrid36
|
from . import hybrid36
|
||||||
|
|
||||||
|
|
||||||
@@ -17,12 +18,12 @@ class Atom(object):
|
|||||||
"""
|
"""
|
||||||
self.occ = None
|
self.occ = None
|
||||||
self.numb = None
|
self.numb = None
|
||||||
self.resName = None
|
self.res_name = None
|
||||||
self.type = None
|
self.type = None
|
||||||
self.chainID = None
|
self.chain_id = None
|
||||||
self.beta = None
|
self.beta = None
|
||||||
self.icode = None
|
self.icode = None
|
||||||
self.resNumb = None
|
self.res_num = None
|
||||||
self.name = None
|
self.name = None
|
||||||
self.element = None
|
self.element = None
|
||||||
self.x = None
|
self.x = None
|
||||||
@@ -37,18 +38,18 @@ class Atom(object):
|
|||||||
self.conformation_container = None
|
self.conformation_container = None
|
||||||
self.molecular_container = None
|
self.molecular_container = None
|
||||||
self.is_protonated = False
|
self.is_protonated = False
|
||||||
self.steric_number_and_lone_pairs_set = False
|
self.steric_num_lone_pairs_set = False
|
||||||
self.terminal = None
|
self.terminal = None
|
||||||
self.charge = 0
|
self.charge = 0
|
||||||
self.charge_set = False
|
self.charge_set = False
|
||||||
self.steric_number = 0
|
self.steric_number = 0
|
||||||
self.number_of_lone_pairs = 0
|
self.number_of_lone_pairs = 0
|
||||||
self.number_of_protons_to_add = 0
|
self.number_of_protons_to_add = 0
|
||||||
self.number_of_pi_electrons_in_double_and_triple_bonds = 0
|
self.num_pi_elec_2_3_bonds = 0
|
||||||
self.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = 0
|
self.num_pi_elec_conj_2_3_bonds = 0
|
||||||
self.groups_extracted = 0
|
self.groups_extracted = 0
|
||||||
self.set_properties(line)
|
self.set_properties(line)
|
||||||
self.residue_label = "%-3s%4d%2s" % (self.name, self.resNumb, self.chainID)
|
self.residue_label = "%-3s%4d%2s" % (self.name, self.res_num, self.chain_id)
|
||||||
|
|
||||||
# ligand atom types
|
# ligand atom types
|
||||||
self.sybyl_type = ''
|
self.sybyl_type = ''
|
||||||
@@ -66,9 +67,9 @@ class Atom(object):
|
|||||||
self.x = 0.0
|
self.x = 0.0
|
||||||
self.y = 0.0
|
self.y = 0.0
|
||||||
self.z = 0.0
|
self.z = 0.0
|
||||||
self.resNumb = 0
|
self.res_num = 0
|
||||||
self.resName = ''
|
self.res_name = ''
|
||||||
self.chainID = 'A'
|
self.chain_id = 'A'
|
||||||
self.type = ''
|
self.type = ''
|
||||||
self.occ = '1.0'
|
self.occ = '1.0'
|
||||||
self.beta = '0.0'
|
self.beta = '0.0'
|
||||||
@@ -81,15 +82,15 @@ class Atom(object):
|
|||||||
self.x = float(line[30:38].strip())
|
self.x = float(line[30:38].strip())
|
||||||
self.y = float(line[38:46].strip())
|
self.y = float(line[38:46].strip())
|
||||||
self.z = float(line[46:54].strip())
|
self.z = float(line[46:54].strip())
|
||||||
self.resNumb = int(line[22:26].strip())
|
self.res_num = int(line[22:26].strip())
|
||||||
self.resName = "%-3s" % (line[17:20].strip())
|
self.res_name = "%-3s" % (line[17:20].strip())
|
||||||
self.chainID = line[21]
|
self.chain_id = line[21]
|
||||||
# Set chain id to "_" if it is just white space.
|
# Set chain id to "_" if it is just white space.
|
||||||
if not self.chainID.strip():
|
if not self.chain_id.strip():
|
||||||
self.chainID = '_'
|
self.chain_id = '_'
|
||||||
self.type = line[:6].strip().lower()
|
self.type = line[:6].strip().lower()
|
||||||
|
|
||||||
if self.resName in ['DA ', 'DC ', 'DG ', 'DT ']:
|
if self.res_name in ['DA ', 'DC ', 'DG ', 'DT ']:
|
||||||
self.type = 'hetatm'
|
self.type = 'hetatm'
|
||||||
|
|
||||||
self.occ = line[55:60].strip()
|
self.occ = line[55:60].strip()
|
||||||
@@ -123,8 +124,8 @@ class Atom(object):
|
|||||||
number of bonded atoms.
|
number of bonded atoms.
|
||||||
"""
|
"""
|
||||||
res = 0
|
res = 0
|
||||||
for ba in self.bonded_atoms:
|
for bonded_atom in self.bonded_atoms:
|
||||||
if element == ba.element:
|
if element == bonded_atom.element:
|
||||||
res += 1
|
res += 1
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@@ -170,44 +171,44 @@ class Atom(object):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def setProperty(self, numb=None, name=None, resName=None, chainID=None,
|
def set_property(self, numb=None, name=None, res_name=None, chain_id=None,
|
||||||
resNumb=None, x=None, y=None, z=None, occ=None, beta=None):
|
res_num=None, x=None, y=None, z=None, occ=None, beta=None):
|
||||||
"""Set properties of the atom object.
|
"""Set properties of the atom object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
numb: Atom number
|
numb: Atom number
|
||||||
name: Atom name
|
name: Atom name
|
||||||
resName: residue name
|
res_name: residue name
|
||||||
chainId: chain ID
|
chain_id: chain ID
|
||||||
resNumb: residue number
|
res_num: residue number
|
||||||
x: atom x-coordinate
|
x: atom x-coordinate
|
||||||
y: atom y-coordinate
|
y: atom y-coordinate
|
||||||
z: atom z-coordinate
|
z: atom z-coordinate
|
||||||
occ: atom occupancy
|
occ: atom occupancy
|
||||||
beta: atom temperature factor
|
beta: atom temperature factor
|
||||||
"""
|
"""
|
||||||
if numb != None:
|
if numb is not None:
|
||||||
self.numb = numb
|
self.numb = numb
|
||||||
if name != None:
|
if name is not None:
|
||||||
self.name = name
|
self.name = name
|
||||||
if resName != None:
|
if res_name is not None:
|
||||||
self.resName = resName
|
self.res_name = res_name
|
||||||
if chainID != None:
|
if chain_id is not None:
|
||||||
self.chainID = chainID
|
self.chain_id = chain_id
|
||||||
if resNumb != None:
|
if res_num is not None:
|
||||||
self.resNumb = resNumb
|
self.res_num = res_num
|
||||||
if x != None:
|
if x is not None:
|
||||||
self.x = x
|
self.x = x
|
||||||
if y != None:
|
if y is not None:
|
||||||
self.y = y
|
self.y = y
|
||||||
if z != None:
|
if z is not None:
|
||||||
self.z = z
|
self.z = z
|
||||||
if occ != None:
|
if occ is not None:
|
||||||
self.occ = occ
|
self.occ = occ
|
||||||
if beta != None:
|
if beta is not None:
|
||||||
self.beta = beta
|
self.beta = beta
|
||||||
|
|
||||||
def makeCopy(self):
|
def make_copy(self):
|
||||||
"""Make a copy of this atom.
|
"""Make a copy of this atom.
|
||||||
|
|
||||||
TODO - this could be a property method/attribute
|
TODO - this could be a property method/attribute
|
||||||
@@ -215,29 +216,29 @@ class Atom(object):
|
|||||||
Returns:
|
Returns:
|
||||||
Another atom object copy of this one.
|
Another atom object copy of this one.
|
||||||
"""
|
"""
|
||||||
newAtom = Atom()
|
new_atom = Atom()
|
||||||
newAtom.type = self.type
|
new_atom.type = self.type
|
||||||
newAtom.numb = self.numb
|
new_atom.numb = self.numb
|
||||||
newAtom.name = self.name
|
new_atom.name = self.name
|
||||||
newAtom.element = self.element
|
new_atom.element = self.element
|
||||||
newAtom.resName = self.resName
|
new_atom.res_name = self.res_name
|
||||||
newAtom.resNumb = self.resNumb
|
new_atom.res_num = self.res_num
|
||||||
newAtom.chainID = self.chainID
|
new_atom.chain_id = self.chain_id
|
||||||
newAtom.x = self.x
|
new_atom.x = self.x
|
||||||
newAtom.y = self.y
|
new_atom.y = self.y
|
||||||
newAtom.z = self.z
|
new_atom.z = self.z
|
||||||
newAtom.occ = self.occ
|
new_atom.occ = self.occ
|
||||||
newAtom.beta = self.beta
|
new_atom.beta = self.beta
|
||||||
newAtom.terminal = self.terminal
|
new_atom.terminal = self.terminal
|
||||||
newAtom.residue_label = self.residue_label
|
new_atom.residue_label = self.residue_label
|
||||||
newAtom.icode = self.icode
|
new_atom.icode = self.icode
|
||||||
return newAtom
|
return new_atom
|
||||||
|
|
||||||
def make_input_line(self):
|
def make_input_line(self):
|
||||||
"""PDB line for this atom.
|
"""PDB line for this atom.
|
||||||
|
|
||||||
TODO - Could be @property method/attribute
|
TODO - Could be @property method/attribute
|
||||||
TODO - figure out difference between make_pdb_line, make_input_line, and makePDBLine
|
TODO - figure out difference between make_pdb_line, make_input_line, and make_pdb_line2
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
String with PDB-format line.
|
String with PDB-format line.
|
||||||
@@ -253,8 +254,8 @@ class Atom(object):
|
|||||||
model_pka = '%6.2f'%self.group.model_pka
|
model_pka = '%6.2f'%self.group.model_pka
|
||||||
str_ = "%-6s%5d %s " % (self.type.upper(), self.numb,
|
str_ = "%-6s%5d %s " % (self.type.upper(), self.numb,
|
||||||
propka.lib.makeTidyAtomLabel(self.name, self.element))
|
propka.lib.makeTidyAtomLabel(self.name, self.element))
|
||||||
str_ += "%s%2s%4d%12.3lf%8.3lf%8.3lf%6s%6s \n" % (self.resName, self.chainID,
|
str_ += "%s%2s%4d%12.3lf%8.3lf%8.3lf%6s%6s \n" % (self.res_name, self.chain_id,
|
||||||
self.resNumb, self.x, self.y,
|
self.res_num, self.x, self.y,
|
||||||
self.z, group, model_pka)
|
self.z, group, model_pka)
|
||||||
return str_
|
return str_
|
||||||
|
|
||||||
@@ -291,7 +292,7 @@ class Atom(object):
|
|||||||
self.charge = -1
|
self.charge = -1
|
||||||
# generic ions
|
# generic ions
|
||||||
if self.occ in ['1P', '2P', '1N', '2N']:
|
if self.occ in ['1P', '2P', '1N', '2N']:
|
||||||
self.resName = self.occ
|
self.res_name = self.occ
|
||||||
self.occ = 'Ion'
|
self.occ = 'Ion'
|
||||||
# correct the group type
|
# correct the group type
|
||||||
self.occ = self.occ.replace('N+', 'Nterm')
|
self.occ = self.occ.replace('N+', 'Nterm')
|
||||||
@@ -318,15 +319,15 @@ class Atom(object):
|
|||||||
"""Create PDB line.
|
"""Create PDB line.
|
||||||
|
|
||||||
TODO - this could/should be a @property method/attribute
|
TODO - this could/should be a @property method/attribute
|
||||||
TODO - figure out difference between make_pdb_line, make_input_line, and makePDBLine
|
TODO - figure out difference between make_pdb_line, make_input_line, and make_pdb_line2
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
String with PDB line.
|
String with PDB line.
|
||||||
"""
|
"""
|
||||||
str_ = "%-6s%5d " % (self.type.upper(), self.numb)
|
str_ = "%-6s%5d " % (self.type.upper(), self.numb)
|
||||||
str_ += "%s %s" % (propka.lib.makeTidyAtomLabel(self.name, self.element),
|
str_ += "%s %s" % (propka.lib.makeTidyAtomLabel(self.name, self.element),
|
||||||
self.resName)
|
self.res_name)
|
||||||
str_ += "%2s%4d%12.3lf%8.3lf%8.3lf%6s%6s\n" % (self.chainID, self.resNumb,
|
str_ += "%2s%4d%12.3lf%8.3lf%8.3lf%6s%6s\n" % (self.chain_id, self.res_num,
|
||||||
self.x, self.y, self.z,
|
self.x, self.y, self.z,
|
||||||
self.occ, self.beta)
|
self.occ, self.beta)
|
||||||
return str_
|
return str_
|
||||||
@@ -336,7 +337,7 @@ class Atom(object):
|
|||||||
|
|
||||||
Format: 1 S1 3.6147 2.0531 1.4795 S.3 1 noname -0.1785
|
Format: 1 S1 3.6147 2.0531 1.4795 S.3 1 noname -0.1785
|
||||||
|
|
||||||
TODO - this could/shoudl be a @property method/attribute
|
TODO - this could/should be a @property method/attribute
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
String with MOL2 line.
|
String with MOL2 line.
|
||||||
@@ -345,15 +346,15 @@ class Atom(object):
|
|||||||
self.element))
|
self.element))
|
||||||
str_ += "%10.4f %10.4f %10.4f " % (self.x, self.y, self.z)
|
str_ += "%10.4f %10.4f %10.4f " % (self.x, self.y, self.z)
|
||||||
str_ += "%6s %6d %10s %10.4f\n" % (self.sybyl_type.replace('-', ''),
|
str_ += "%6s %6d %10s %10.4f\n" % (self.sybyl_type.replace('-', ''),
|
||||||
self.resNumb, self.resName, 0.0)
|
self.res_num, self.res_name, 0.0)
|
||||||
return str_
|
return str_
|
||||||
|
|
||||||
def makePDBLine(self, numb=None, name=None, resName=None, chainID=None,
|
def make_pdb_line2(self, numb=None, name=None, res_name=None, chain_id=None,
|
||||||
resNumb=None, x=None, y=None, z=None, occ=None, beta=None):
|
res_num=None, x=None, y=None, z=None, occ=None, beta=None):
|
||||||
"""Create a PDB line.
|
"""Create a PDB line.
|
||||||
|
|
||||||
TODO - this could/should be a @property method/attribute
|
TODO - this could/should be a @property method/attribute
|
||||||
TODO - figure out difference between make_pdb_line, make_input_line, and makePDBLine
|
TODO - figure out difference between make_pdb_line, make_input_line, and make_pdb_line2
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
String with PDB line.
|
String with PDB line.
|
||||||
@@ -362,12 +363,12 @@ class Atom(object):
|
|||||||
numb = self.numb
|
numb = self.numb
|
||||||
if name is None:
|
if name is None:
|
||||||
name = self.name
|
name = self.name
|
||||||
if resName is None:
|
if res_name is None:
|
||||||
resName = self.resName
|
res_name = self.res_name
|
||||||
if chainID is None:
|
if chain_id is None:
|
||||||
chainID = self.chainID
|
chain_id = self.chain_id
|
||||||
if resNumb is None:
|
if res_num is None:
|
||||||
resNumb = self.resNumb
|
res_num = self.res_num
|
||||||
if x is None:
|
if x is None:
|
||||||
x = self.x
|
x = self.x
|
||||||
if y is None:
|
if y is None:
|
||||||
@@ -381,9 +382,9 @@ class Atom(object):
|
|||||||
str_ = "ATOM "
|
str_ = "ATOM "
|
||||||
str_ += "%6d" % (numb)
|
str_ += "%6d" % (numb)
|
||||||
str_ += " %s" % (propka.lib.makeTidyAtomLabel(name, self.element))
|
str_ += " %s" % (propka.lib.makeTidyAtomLabel(name, self.element))
|
||||||
str_ += " %s" % (resName)
|
str_ += " %s" % (res_name)
|
||||||
str_ += "%2s" % (chainID)
|
str_ += "%2s" % (chain_id)
|
||||||
str_ += "%4d" % (resNumb)
|
str_ += "%4d" % (res_num)
|
||||||
str_ += "%12.3lf" % (x)
|
str_ += "%12.3lf" % (x)
|
||||||
str_ += "%8.3lf" % (y)
|
str_ += "%8.3lf" % (y)
|
||||||
str_ += "%8.3lf" % (z)
|
str_ += "%8.3lf" % (z)
|
||||||
@@ -392,7 +393,7 @@ class Atom(object):
|
|||||||
str_ += '\n'
|
str_ += '\n'
|
||||||
return str_
|
return str_
|
||||||
|
|
||||||
def getTidyLabel(self):
|
def get_tidy_label(self):
|
||||||
"""Returns a 'tidier' atom label for printing the new pdbfile
|
"""Returns a 'tidier' atom label for printing the new pdbfile
|
||||||
|
|
||||||
TODO - this could/should be a @property method/attribute
|
TODO - this could/should be a @property method/attribute
|
||||||
@@ -404,8 +405,8 @@ class Atom(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Return an undefined-format string version of this atom."""
|
"""Return an undefined-format string version of this atom."""
|
||||||
return '%5d-%4s %5d-%3s (%1s) [%8.3f %8.3f %8.3f] %s' % (self.numb, self.name,
|
return '%5d-%4s %5d-%3s (%1s) [%8.3f %8.3f %8.3f] %s' % (self.numb, self.name,
|
||||||
self.resNumb, self.resName,
|
self.res_num, self.res_name,
|
||||||
self.chainID, self.x, self.y,
|
self.chain_id, self.x, self.y,
|
||||||
self.z, self.element)
|
self.z, self.element)
|
||||||
|
|
||||||
def set_residue(self, residue):
|
def set_residue(self, residue):
|
||||||
|
|||||||
@@ -105,15 +105,15 @@ class bondmaker:
|
|||||||
# side chains
|
# side chains
|
||||||
for chain in protein.chains:
|
for chain in protein.chains:
|
||||||
for residue in chain.residues:
|
for residue in chain.residues:
|
||||||
if residue.resName.replace(' ', '') not in ['N+', 'C-']:
|
if residue.res_name.replace(' ', '') not in ['N+', 'C-']:
|
||||||
self.find_bonds_for_side_chain(residue.atoms)
|
self.find_bonds_for_side_chain(residue.atoms)
|
||||||
info('++++ Backbones ++++')
|
info('++++ Backbones ++++')
|
||||||
# backbone
|
# backbone
|
||||||
last_residues = []
|
last_residues = []
|
||||||
for chain in protein.chains:
|
for chain in protein.chains:
|
||||||
for i in range(1, len(chain.residues)):
|
for i in range(1, len(chain.residues)):
|
||||||
if chain.residues[i-1].resName.replace(' ', '') not in ['N+', 'C-']:
|
if chain.residues[i-1].res_name.replace(' ', '') not in ['N+', 'C-']:
|
||||||
if chain.residues[i].resName.replace(' ', '') not in ['N+', 'C-']:
|
if chain.residues[i].res_name.replace(' ', '') not in ['N+', 'C-']:
|
||||||
self.connect_backbone(chain.residues[i-1], chain.residues[i])
|
self.connect_backbone(chain.residues[i-1], chain.residues[i])
|
||||||
last_residues.append(chain.residues[i])
|
last_residues.append(chain.residues[i])
|
||||||
info('++++ terminal oxygen ++++')
|
info('++++ terminal oxygen ++++')
|
||||||
@@ -124,9 +124,9 @@ class bondmaker:
|
|||||||
# Cysteines
|
# Cysteines
|
||||||
for chain in protein.chains:
|
for chain in protein.chains:
|
||||||
for i in range(0, len(chain.residues)):
|
for i in range(0, len(chain.residues)):
|
||||||
if chain.residues[i].resName == 'CYS':
|
if chain.residues[i].res_name == 'CYS':
|
||||||
for j in range(0, len(chain.residues)):
|
for j in range(0, len(chain.residues)):
|
||||||
if chain.residues[j].resName == 'CYS' and j != i:
|
if chain.residues[j].res_name == 'CYS' and j != i:
|
||||||
self.check_for_cysteine_bonds(chain.residues[i],
|
self.check_for_cysteine_bonds(chain.residues[i],
|
||||||
chain.residues[j])
|
chain.residues[j])
|
||||||
|
|
||||||
@@ -180,9 +180,9 @@ class bondmaker:
|
|||||||
def find_bonds_for_residue_backbone(self, residue):
|
def find_bonds_for_residue_backbone(self, residue):
|
||||||
for atom1 in residue.atoms:
|
for atom1 in residue.atoms:
|
||||||
if atom1.name in list(self.number_of_pi_electrons_in_bonds_in_backbone.keys()):
|
if atom1.name in list(self.number_of_pi_electrons_in_bonds_in_backbone.keys()):
|
||||||
atom1.number_of_pi_electrons_in_double_and_triple_bonds = self.number_of_pi_electrons_in_bonds_in_backbone[atom1.name]
|
atom1.num_pi_elec_2_3_bonds = self.number_of_pi_electrons_in_bonds_in_backbone[atom1.name]
|
||||||
if atom1.name in list(self.number_of_pi_electrons_in_conjugate_bonds_in_backbone.keys()) and len(atom1.bonded_atoms)>1: # last part to avoid including N-term
|
if atom1.name in list(self.number_of_pi_electrons_in_conjugate_bonds_in_backbone.keys()) and len(atom1.bonded_atoms)>1: # last part to avoid including N-term
|
||||||
atom1.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_backbone[atom1.name]
|
atom1.num_pi_elec_conj_2_3_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_backbone[atom1.name]
|
||||||
|
|
||||||
if atom1.name in self.backbone_atoms:
|
if atom1.name in self.backbone_atoms:
|
||||||
for atom2 in residue.atoms:
|
for atom2 in residue.atoms:
|
||||||
@@ -196,16 +196,16 @@ class bondmaker:
|
|||||||
""" Finds bonds for a side chain """
|
""" Finds bonds for a side chain """
|
||||||
for atom1 in atoms:
|
for atom1 in atoms:
|
||||||
|
|
||||||
key = '%s-%s'%(atom1.resName,atom1.name)
|
key = '%s-%s'%(atom1.res_name,atom1.name)
|
||||||
if key in list(self.number_of_pi_electrons_in_bonds_in_sidechains.keys()):
|
if key in list(self.number_of_pi_electrons_in_bonds_in_sidechains.keys()):
|
||||||
atom1.number_of_pi_electrons_in_double_and_triple_bonds = self.number_of_pi_electrons_in_bonds_in_sidechains[key]
|
atom1.num_pi_elec_2_3_bonds = self.number_of_pi_electrons_in_bonds_in_sidechains[key]
|
||||||
if key in list(self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains.keys()):
|
if key in list(self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains.keys()):
|
||||||
atom1.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains[key]
|
atom1.num_pi_elec_conj_2_3_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains[key]
|
||||||
|
|
||||||
if not atom1.name in self.backbone_atoms:
|
if not atom1.name in self.backbone_atoms:
|
||||||
if not atom1.name in self.terminal_oxygen_names:
|
if not atom1.name in self.terminal_oxygen_names:
|
||||||
for atom2 in atoms:
|
for atom2 in atoms:
|
||||||
if atom2.name in self.protein_bonds[atom1.resName][atom1.name]:
|
if atom2.name in self.protein_bonds[atom1.res_name][atom1.name]:
|
||||||
self.make_bond(atom1,atom2)
|
self.make_bond(atom1,atom2)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -225,22 +225,22 @@ class bondmaker:
|
|||||||
# for ligands
|
# for ligands
|
||||||
if atom.type == 'hetatm':
|
if atom.type == 'hetatm':
|
||||||
if atom.sybyl_type in self.number_of_pi_electrons_in_bonds_ligands.keys():
|
if atom.sybyl_type in self.number_of_pi_electrons_in_bonds_ligands.keys():
|
||||||
atom.number_of_pi_electrons_in_double_and_triple_bonds = self.number_of_pi_electrons_in_bonds_ligands[atom.sybyl_type]
|
atom.num_pi_elec_2_3_bonds = self.number_of_pi_electrons_in_bonds_ligands[atom.sybyl_type]
|
||||||
if atom.sybyl_type in self.number_of_pi_electrons_in_conjugate_bonds_in_ligands.keys():
|
if atom.sybyl_type in self.number_of_pi_electrons_in_conjugate_bonds_in_ligands.keys():
|
||||||
atom.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_ligands[atom.sybyl_type]
|
atom.num_pi_elec_conj_2_3_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_ligands[atom.sybyl_type]
|
||||||
|
|
||||||
# for protein
|
# for protein
|
||||||
if atom.type == 'atom':
|
if atom.type == 'atom':
|
||||||
key = '%s-%s'%(atom.resName,atom.name)
|
key = '%s-%s'%(atom.res_name,atom.name)
|
||||||
if key in list(self.number_of_pi_electrons_in_bonds_in_sidechains.keys()):
|
if key in list(self.number_of_pi_electrons_in_bonds_in_sidechains.keys()):
|
||||||
atom.number_of_pi_electrons_in_double_and_triple_bonds = self.number_of_pi_electrons_in_bonds_in_sidechains[key]
|
atom.num_pi_elec_2_3_bonds = self.number_of_pi_electrons_in_bonds_in_sidechains[key]
|
||||||
if key in list(self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains.keys()):
|
if key in list(self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains.keys()):
|
||||||
atom.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains[key]
|
atom.num_pi_elec_conj_2_3_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_sidechains[key]
|
||||||
|
|
||||||
if atom.name in list(self.number_of_pi_electrons_in_bonds_in_backbone.keys()):
|
if atom.name in list(self.number_of_pi_electrons_in_bonds_in_backbone.keys()):
|
||||||
atom.number_of_pi_electrons_in_double_and_triple_bonds = self.number_of_pi_electrons_in_bonds_in_backbone[atom.name]
|
atom.num_pi_elec_2_3_bonds = self.number_of_pi_electrons_in_bonds_in_backbone[atom.name]
|
||||||
if atom.name in list(self.number_of_pi_electrons_in_conjugate_bonds_in_backbone.keys()) and len(atom.bonded_atoms)>1: # last part to avoid including N-term
|
if atom.name in list(self.number_of_pi_electrons_in_conjugate_bonds_in_backbone.keys()) and len(atom.bonded_atoms)>1: # last part to avoid including N-term
|
||||||
atom.number_of_pi_electrons_in_conjugate_double_and_triple_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_backbone[atom.name]
|
atom.num_pi_elec_conj_2_3_bonds = self.number_of_pi_electrons_in_conjugate_bonds_in_backbone[atom.name]
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ class bondmaker:
|
|||||||
atoms = []
|
atoms = []
|
||||||
for chain in molecule.chains:
|
for chain in molecule.chains:
|
||||||
for residue in chain.residues:
|
for residue in chain.residues:
|
||||||
if residue.resName.replace(' ','') not in ['N+','C-']:
|
if residue.res_name.replace(' ','') not in ['N+','C-']:
|
||||||
for atom in residue.atoms:
|
for atom in residue.atoms:
|
||||||
atoms.append(atom)
|
atoms.append(atom)
|
||||||
|
|
||||||
@@ -423,9 +423,9 @@ class bondmaker:
|
|||||||
|
|
||||||
for atom in atoms:
|
for atom in atoms:
|
||||||
for bonded_atom in atom.bonded_atoms:
|
for bonded_atom in atom.bonded_atoms:
|
||||||
resi_i = atom.resName
|
resi_i = atom.res_name
|
||||||
name_i = atom.name
|
name_i = atom.name
|
||||||
resi_j = bonded_atom.resName
|
resi_j = bonded_atom.res_name
|
||||||
name_j = bonded_atom.name
|
name_j = bonded_atom.name
|
||||||
|
|
||||||
if not name_i in self.backbone_atoms or\
|
if not name_i in self.backbone_atoms or\
|
||||||
|
|||||||
@@ -68,22 +68,22 @@ def protonate_30_style(molecular_container):
|
|||||||
O=None
|
O=None
|
||||||
C=None
|
C=None
|
||||||
for atom in molecular_container.conformations[name].atoms:
|
for atom in molecular_container.conformations[name].atoms:
|
||||||
if atom.resNumb != curres:
|
if atom.res_num != curres:
|
||||||
curres = atom.resNumb
|
curres = atom.res_num
|
||||||
if len(residue)>0:
|
if len(residue)>0:
|
||||||
#backbone
|
#backbone
|
||||||
[O, C]= addBackBoneHydrogen(residue,O,C)
|
[O, C]= addBackBoneHydrogen(residue,O,C)
|
||||||
#arginine
|
#arginine
|
||||||
if residue[0].resName == 'ARG':
|
if residue[0].res_name == 'ARG':
|
||||||
addArgHydrogen(residue)
|
addArgHydrogen(residue)
|
||||||
#histidine
|
#histidine
|
||||||
if residue[0].resName == 'HIS':
|
if residue[0].res_name == 'HIS':
|
||||||
addHisHydrogen(residue)
|
addHisHydrogen(residue)
|
||||||
#tryptophan
|
#tryptophan
|
||||||
if residue[0].resName == 'TRP':
|
if residue[0].res_name == 'TRP':
|
||||||
addTrpHydrogen(residue)
|
addTrpHydrogen(residue)
|
||||||
#amides
|
#amides
|
||||||
if residue[0].resName in ['GLN','ASN']:
|
if residue[0].res_name in ['GLN','ASN']:
|
||||||
addAmdHydrogen(residue)
|
addAmdHydrogen(residue)
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ def addTrpHydrogen(residue):
|
|||||||
elif atom.name == "CE2":
|
elif atom.name == "CE2":
|
||||||
CE = atom
|
CE = atom
|
||||||
if CD == None or NE == None or CE == None:
|
if CD == None or NE == None or CE == None:
|
||||||
str = "Did not find all atoms in %s%4d - in %s" % (self.resName, self.resNumb, "addTrpHydrogen()")
|
str = "Did not find all atoms in %s%4d - in %s" % (self.res_name, self.res_num, "addTrpHydrogen()")
|
||||||
info(str)
|
info(str)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
@@ -176,15 +176,15 @@ def addAmdHydrogen(residue):
|
|||||||
O = None
|
O = None
|
||||||
N = None
|
N = None
|
||||||
for atom in residue:
|
for atom in residue:
|
||||||
if (atom.resName == "GLN" and atom.name == "CD") or (atom.resName == "ASN" and atom.name == "CG"):
|
if (atom.res_name == "GLN" and atom.name == "CD") or (atom.res_name == "ASN" and atom.name == "CG"):
|
||||||
C = atom
|
C = atom
|
||||||
elif (atom.resName == "GLN" and atom.name == "OE1") or (atom.resName == "ASN" and atom.name == "OD1"):
|
elif (atom.res_name == "GLN" and atom.name == "OE1") or (atom.res_name == "ASN" and atom.name == "OD1"):
|
||||||
O = atom
|
O = atom
|
||||||
elif (atom.resName == "GLN" and atom.name == "NE2") or (atom.resName == "ASN" and atom.name == "ND2"):
|
elif (atom.res_name == "GLN" and atom.name == "NE2") or (atom.res_name == "ASN" and atom.name == "ND2"):
|
||||||
N = atom
|
N = atom
|
||||||
|
|
||||||
if C == None or O == None or N == None:
|
if C == None or O == None or N == None:
|
||||||
str = "Did not find N, C and/or O in %s%4d - in %s" % (atom.resName, atom.resNumb, "addAmdHydrogen()")
|
str = "Did not find N, C and/or O in %s%4d - in %s" % (atom.res_name, atom.res_num, "addAmdHydrogen()")
|
||||||
info(str)
|
info(str)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ def addBackBoneHydrogen(residue, O, C):
|
|||||||
return [new_O,new_C]
|
return [new_O,new_C]
|
||||||
|
|
||||||
|
|
||||||
if N.resName == "PRO":
|
if N.res_name == "PRO":
|
||||||
""" PRO doesn't have an H-atom; do nothing """
|
""" PRO doesn't have an H-atom; do nothing """
|
||||||
else:
|
else:
|
||||||
H = protonateDirection([N, O, C])
|
H = protonateDirection([N, O, C])
|
||||||
@@ -311,11 +311,11 @@ def protonateSP2(list):
|
|||||||
def make_new_H(atom, x,y,z):
|
def make_new_H(atom, x,y,z):
|
||||||
|
|
||||||
new_H = propka.atom.Atom()
|
new_H = propka.atom.Atom()
|
||||||
new_H.setProperty(numb = None,
|
new_H.set_property(numb = None,
|
||||||
name = 'H%s'%atom.name[1:],
|
name = 'H%s'%atom.name[1:],
|
||||||
resName = atom.resName,
|
res_name = atom.res_name,
|
||||||
chainID = atom.chainID,
|
chain_id = atom.chain_id,
|
||||||
resNumb = atom.resNumb,
|
res_num = atom.res_num,
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
z = z,
|
z = z,
|
||||||
@@ -329,7 +329,7 @@ def make_new_H(atom, x,y,z):
|
|||||||
new_H.steric_number = 0
|
new_H.steric_number = 0
|
||||||
new_H.number_of_lone_pairs = 0
|
new_H.number_of_lone_pairs = 0
|
||||||
new_H.number_of_protons_to_add = 0
|
new_H.number_of_protons_to_add = 0
|
||||||
new_H.number_of_pi_electrons_in_double_and_triple_bonds = 0
|
new_H.num_pi_elec_2_3_bonds = 0
|
||||||
|
|
||||||
atom.bonded_atoms.append(new_H)
|
atom.bonded_atoms.append(new_H)
|
||||||
atom.conformation_container.add_atom(new_H)
|
atom.conformation_container.add_atom(new_H)
|
||||||
@@ -357,7 +357,7 @@ def radial_volume_desolvation(parameters, group):
|
|||||||
|
|
||||||
for atom in all_atoms:
|
for atom in all_atoms:
|
||||||
# ignore atoms in the same residue
|
# ignore atoms in the same residue
|
||||||
if atom.resNumb == group.atom.resNumb and atom.chainID == group.atom.chainID:
|
if atom.res_num == group.atom.res_num and atom.chain_id == group.atom.chain_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
sq_dist = squared_distance(group, atom)
|
sq_dist = squared_distance(group, atom)
|
||||||
@@ -409,15 +409,15 @@ def contactDesolvation(parameters, group):
|
|||||||
'N+': 4.5}
|
'N+': 4.5}
|
||||||
|
|
||||||
all_atoms = group.atom.conformation_container.get_non_hydrogen_atoms()
|
all_atoms = group.atom.conformation_container.get_non_hydrogen_atoms()
|
||||||
if residue.resName in version.desolvationRadii:
|
if residue.res_name in version.desolvationRadii:
|
||||||
local_cutoff = version.desolvationRadii[residue.resName]
|
local_cutoff = version.desolvationRadii[residue.res_name]
|
||||||
else:
|
else:
|
||||||
local_cutoff = 0.00
|
local_cutoff = 0.00
|
||||||
residue.Nmass = 0
|
residue.Nmass = 0
|
||||||
residue.Nlocl = 0
|
residue.Nlocl = 0
|
||||||
|
|
||||||
for atom in all_atoms:
|
for atom in all_atoms:
|
||||||
if atom.resNumb != group.atom.resNumb or atom.chainID != group.atom.chainID:
|
if atom.res_num != group.atom.res_num or atom.chain_id != group.atom.chain_id:
|
||||||
dX = atom.x - residue.x
|
dX = atom.x - residue.x
|
||||||
dY = atom.y - residue.y
|
dY = atom.y - residue.y
|
||||||
dZ = atom.z - residue.z
|
dZ = atom.z - residue.z
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class Conformation_container:
|
|||||||
titrate_only = self.molecular_container.options.titrate_only
|
titrate_only = self.molecular_container.options.titrate_only
|
||||||
if titrate_only is not None:
|
if titrate_only is not None:
|
||||||
at = group.atom
|
at = group.atom
|
||||||
if not (at.chainID, at.resNumb, at.icode) in titrate_only:
|
if not (at.chain_id, at.res_num, at.icode) in titrate_only:
|
||||||
group.titratable = False
|
group.titratable = False
|
||||||
if group.residue_type == 'CYS':
|
if group.residue_type == 'CYS':
|
||||||
group.exclude_cys_from_results = True
|
group.exclude_cys_from_results = True
|
||||||
@@ -376,7 +376,7 @@ class Conformation_container:
|
|||||||
return [atom for atom in self.atoms if atom.type=='hetatm' and atom.element != 'H']
|
return [atom for atom in self.atoms if atom.type=='hetatm' and atom.element != 'H']
|
||||||
|
|
||||||
def get_chain(self,chain):
|
def get_chain(self,chain):
|
||||||
return [atom for atom in self.atoms if atom.chainID != chain]
|
return [atom for atom in self.atoms if atom.chain_id != chain]
|
||||||
|
|
||||||
|
|
||||||
def add_atom(self, atom):
|
def add_atom(self, atom):
|
||||||
@@ -388,13 +388,13 @@ class Conformation_container:
|
|||||||
atom.molecular_container = self.molecular_container
|
atom.molecular_container = self.molecular_container
|
||||||
|
|
||||||
# store chain id for bookkeeping
|
# store chain id for bookkeeping
|
||||||
if not atom.chainID in self.chains:
|
if not atom.chain_id in self.chains:
|
||||||
self.chains.append(atom.chainID)
|
self.chains.append(atom.chain_id)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def copy_atom(self, atom):
|
def copy_atom(self, atom):
|
||||||
new_atom = atom.makeCopy()
|
new_atom = atom.make_copy()
|
||||||
self.atoms.append(new_atom)
|
self.atoms.append(new_atom)
|
||||||
new_atom.conformation_container = self
|
new_atom.conformation_container = self
|
||||||
|
|
||||||
@@ -443,8 +443,8 @@ class Conformation_container:
|
|||||||
return
|
return
|
||||||
|
|
||||||
def sort_atoms_key(self, atom):
|
def sort_atoms_key(self, atom):
|
||||||
key = ord(atom.chainID)*1e7
|
key = ord(atom.chain_id)*1e7
|
||||||
key += atom.resNumb*1000
|
key += atom.res_num*1000
|
||||||
if len(atom.name) > len(atom.element):
|
if len(atom.name) > len(atom.element):
|
||||||
key += ord(atom.name[len(atom.element)])
|
key += ord(atom.name[len(atom.element)])
|
||||||
#info(atom,ord(atom.name[len(atom.element)]), '|%s||%s|'%(atom.name,atom.element))
|
#info(atom,ord(atom.name[len(atom.element)]), '|%s||%s|'%(atom.name,atom.element))
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def addDeterminants(group1, group2, distance, version):
|
|||||||
def addSidechainDeterminants(group1, group2, version=None):
|
def addSidechainDeterminants(group1, group2, version=None):
|
||||||
"""
|
"""
|
||||||
adding side-chain determinants/perturbations
|
adding side-chain determinants/perturbations
|
||||||
Note, resNumb1 > resNumb2
|
Note, res_num1 > res_num2
|
||||||
"""
|
"""
|
||||||
|
|
||||||
hbond_interaction = version.hydrogen_bond_interaction(group1, group2)
|
hbond_interaction = version.hydrogen_bond_interaction(group1, group2)
|
||||||
|
|||||||
@@ -111,22 +111,22 @@ class Group:
|
|||||||
self.common_charge_centre = False
|
self.common_charge_centre = False
|
||||||
|
|
||||||
|
|
||||||
self.residue_type = self.atom.resName
|
self.residue_type = self.atom.res_name
|
||||||
if self.atom.terminal:
|
if self.atom.terminal:
|
||||||
self.residue_type = self.atom.terminal
|
self.residue_type = self.atom.terminal
|
||||||
|
|
||||||
if self.atom.type=='atom':
|
if self.atom.type=='atom':
|
||||||
self.label = '%-3s%4d%2s'%(self.residue_type, atom.resNumb, atom.chainID)
|
self.label = '%-3s%4d%2s'%(self.residue_type, atom.res_num, atom.chain_id)
|
||||||
elif self.atom.resName in ['DA ','DC ','DG ','DT ']:
|
elif self.atom.res_name in ['DA ','DC ','DG ','DT ']:
|
||||||
self.label = '%1s%1s%1s%4d%2s'%(self.residue_type[1],
|
self.label = '%1s%1s%1s%4d%2s'%(self.residue_type[1],
|
||||||
atom.element,
|
atom.element,
|
||||||
atom.name.replace('\'','')[-1],
|
atom.name.replace('\'','')[-1],
|
||||||
atom.resNumb,
|
atom.res_num,
|
||||||
atom.chainID)
|
atom.chain_id)
|
||||||
|
|
||||||
# self.label = '%1s%1s%1s%4d%2s'%(self.residue_type[1], atom.element,atom.name[-1], atom.resNumb, atom.chainID)
|
# self.label = '%1s%1s%1s%4d%2s'%(self.residue_type[1], atom.element,atom.name[-1], atom.res_num, atom.chain_id)
|
||||||
else:
|
else:
|
||||||
self.label = '%-3s%4s%2s'%(self.residue_type, atom.name, atom.chainID)
|
self.label = '%-3s%4s%2s'%(self.residue_type, atom.name, atom.chain_id)
|
||||||
|
|
||||||
|
|
||||||
# container for squared distances
|
# container for squared distances
|
||||||
@@ -253,7 +253,7 @@ class Group:
|
|||||||
return self.label==other.label
|
return self.label==other.label
|
||||||
else:
|
else:
|
||||||
# For heterogene atoms we also need to check the residue number
|
# For heterogene atoms we also need to check the residue number
|
||||||
return self.label==other.label and self.atom.resNumb == other.atom.resNumb
|
return self.label==other.label and self.atom.res_num == other.atom.res_num
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
""" Needed together with __eq__ - otherwise we can't make sets of groups """
|
""" Needed together with __eq__ - otherwise we can't make sets of groups """
|
||||||
@@ -361,7 +361,7 @@ class Group:
|
|||||||
if not self.model_pka_set:
|
if not self.model_pka_set:
|
||||||
self.model_pka = self.parameters.model_pkas[self.residue_type]
|
self.model_pka = self.parameters.model_pkas[self.residue_type]
|
||||||
# check if we should apply a custom model pka
|
# check if we should apply a custom model pka
|
||||||
key = '%s-%s'%(self.atom.resName.strip(), self.atom.name.strip())
|
key = '%s-%s'%(self.atom.res_name.strip(), self.atom.name.strip())
|
||||||
if key in self.parameters.custom_model_pkas.keys():
|
if key in self.parameters.custom_model_pkas.keys():
|
||||||
self.model_pka = self.parameters.custom_model_pkas[key]
|
self.model_pka = self.parameters.custom_model_pkas[key]
|
||||||
|
|
||||||
@@ -1122,7 +1122,7 @@ class Ion_group(Group):
|
|||||||
def __init__(self, atom):
|
def __init__(self, atom):
|
||||||
Group.__init__(self,atom)
|
Group.__init__(self,atom)
|
||||||
self.type = 'ION'
|
self.type = 'ION'
|
||||||
self.residue_type = atom.resName.strip()
|
self.residue_type = atom.res_name.strip()
|
||||||
info('Found ion group:', atom)
|
info('Found ion group:', atom)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1201,7 +1201,7 @@ def is_protein_group(parameters,atom):
|
|||||||
### Backbone
|
### Backbone
|
||||||
if atom.type == 'atom' and atom.name == 'N':
|
if atom.type == 'atom' and atom.name == 'N':
|
||||||
# ignore proline backbone nitrogens
|
# ignore proline backbone nitrogens
|
||||||
if atom.resName != 'PRO':
|
if atom.res_name != 'PRO':
|
||||||
return BBN_group(atom)
|
return BBN_group(atom)
|
||||||
if atom.type == 'atom' and atom.name == 'C':
|
if atom.type == 'atom' and atom.name == 'C':
|
||||||
# ignore C- carboxyl
|
# ignore C- carboxyl
|
||||||
@@ -1209,7 +1209,7 @@ def is_protein_group(parameters,atom):
|
|||||||
return BBC_group(atom)
|
return BBC_group(atom)
|
||||||
|
|
||||||
### Filters for side chains based on PDB protein atom names
|
### Filters for side chains based on PDB protein atom names
|
||||||
key = '%s-%s'%(atom.resName, atom.name)
|
key = '%s-%s'%(atom.res_name, atom.name)
|
||||||
|
|
||||||
if key in parameters.protein_group_mapping.keys():
|
if key in parameters.protein_group_mapping.keys():
|
||||||
return eval('%s_group(atom)'%parameters.protein_group_mapping[key])
|
return eval('%s_group(atom)'%parameters.protein_group_mapping[key])
|
||||||
@@ -1342,7 +1342,7 @@ def is_ligand_group_by_marvin_pkas(parameters, atom):
|
|||||||
|
|
||||||
def is_ion_group(parameters, atom):
|
def is_ion_group(parameters, atom):
|
||||||
|
|
||||||
if atom.resName.strip() in parameters.ions.keys():
|
if atom.res_name.strip() in parameters.ions.keys():
|
||||||
return Ion_group(atom)
|
return Ion_group(atom)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ def addIterativeIonPair(object1, object2, interaction, version):
|
|||||||
Q2 = object2.Q
|
Q2 = object2.Q
|
||||||
comp1 = object1.pKa_old + annihilation[0] + Q1*coulomb_value
|
comp1 = object1.pKa_old + annihilation[0] + Q1*coulomb_value
|
||||||
comp2 = object2.pKa_old + annihilation[1] + Q2*coulomb_value
|
comp2 = object2.pKa_old + annihilation[1] + Q2*coulomb_value
|
||||||
if object1.resName not in version.parameters.exclude_sidechain_interactions:
|
if object1.res_name not in version.parameters.exclude_sidechain_interactions:
|
||||||
comp1 += Q1*hbond_value
|
comp1 += Q1*hbond_value
|
||||||
if object2.resName not in version.parameters.exclude_sidechain_interactions:
|
if object2.res_name not in version.parameters.exclude_sidechain_interactions:
|
||||||
comp2 += Q2*hbond_value
|
comp2 += Q2*hbond_value
|
||||||
|
|
||||||
if Q1 == -1.0 and comp1 < comp2:
|
if Q1 == -1.0 and comp1 < comp2:
|
||||||
@@ -155,12 +155,12 @@ def addIterativeIonPair(object1, object2, interaction, version):
|
|||||||
# Side-chain
|
# Side-chain
|
||||||
if hbond_value > 0.005:
|
if hbond_value > 0.005:
|
||||||
# residue1
|
# residue1
|
||||||
if object1.resName not in version.parameters.exclude_sidechain_interactions:
|
if object1.res_name not in version.parameters.exclude_sidechain_interactions:
|
||||||
interaction = [object2, Q1*hbond_value]
|
interaction = [object2, Q1*hbond_value]
|
||||||
annihilation[0] += -Q1*hbond_value
|
annihilation[0] += -Q1*hbond_value
|
||||||
object1.determinants['sidechain'].append(interaction)
|
object1.determinants['sidechain'].append(interaction)
|
||||||
# residue2
|
# residue2
|
||||||
if object2.resName not in version.parameters.exclude_sidechain_interactions:
|
if object2.res_name not in version.parameters.exclude_sidechain_interactions:
|
||||||
interaction = [object1, Q2*hbond_value]
|
interaction = [object1, Q2*hbond_value]
|
||||||
annihilation[1] += -Q2*hbond_value
|
annihilation[1] += -Q2*hbond_value
|
||||||
object2.determinants['sidechain'].append(interaction)
|
object2.determinants['sidechain'].append(interaction)
|
||||||
@@ -309,7 +309,7 @@ class Iterative:
|
|||||||
|
|
||||||
self.label = group.label
|
self.label = group.label
|
||||||
self.atom = group.atom
|
self.atom = group.atom
|
||||||
self.resName = group.residue_type
|
self.res_name = group.residue_type
|
||||||
self.Q = group.charge
|
self.Q = group.charge
|
||||||
self.pKa_old = None
|
self.pKa_old = None
|
||||||
self.pKa_new = None
|
self.pKa_new = None
|
||||||
@@ -357,7 +357,7 @@ class Iterative:
|
|||||||
return self.label==other.label
|
return self.label==other.label
|
||||||
else:
|
else:
|
||||||
# For heterogene atoms we also need to check the residue number
|
# For heterogene atoms we also need to check the residue number
|
||||||
return self.label==other.label and self.atom.resNumb == other.atom.resNumb
|
return self.label==other.label and self.atom.res_num == other.atom.res_num
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
""" Needed together with __eq__ - otherwise we can't make sets of groups """
|
""" Needed together with __eq__ - otherwise we can't make sets of groups """
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ def writePDB(protein, file=None, filename=None, include_hydrogens=False, options
|
|||||||
numb = 0
|
numb = 0
|
||||||
for chain in protein.chains:
|
for chain in protein.chains:
|
||||||
for residue in chain.residues:
|
for residue in chain.residues:
|
||||||
if residue.resName not in ["N+ ", "C- "]:
|
if residue.res_name not in ["N+ ", "C- "]:
|
||||||
for atom in residue.atoms:
|
for atom in residue.atoms:
|
||||||
if include_hydrogens == False and atom.name[0] == "H":
|
if include_hydrogens == False and atom.name[0] == "H":
|
||||||
""" don't print """
|
""" don't print """
|
||||||
else:
|
else:
|
||||||
numb += 1
|
numb += 1
|
||||||
line = atom.makePDBLine(numb=numb)
|
line = atom.make_pdb_line2(numb=numb)
|
||||||
line += "\n"
|
line += "\n"
|
||||||
file.write(line)
|
file.write(line)
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ def getDeterminantSection(protein, conformation, parameters):
|
|||||||
# printing determinants
|
# printing determinants
|
||||||
for chain in protein.conformations[conformation].chains:
|
for chain in protein.conformations[conformation].chains:
|
||||||
for residue_type in parameters.write_out_order:
|
for residue_type in parameters.write_out_order:
|
||||||
groups = [g for g in protein.conformations[conformation].groups if g.atom.chainID == 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.getDeterminantString(parameters.remove_penalised_group) )
|
||||||
@@ -226,8 +226,8 @@ def writeJackalScapFile(mutationData=None, filename="1xxx_scap.list", options=No
|
|||||||
"""
|
"""
|
||||||
file = open(filename, 'w')
|
file = open(filename, 'w')
|
||||||
|
|
||||||
for chainID, code1, resNumb, code2 in mutationData:
|
for chain_id, code1, res_num, code2 in mutationData:
|
||||||
str = "%s, %d, %s\n" % (chainID, resNumb, code2)
|
str = "%s, %d, %s\n" % (chain_id, res_num, code2)
|
||||||
file.write(str)
|
file.write(str)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|||||||
@@ -63,27 +63,27 @@ def protein_precheck(conformations, names):
|
|||||||
atoms_by_residue[res_id] = [a]
|
atoms_by_residue[res_id] = [a]
|
||||||
|
|
||||||
for res_id, res_atoms in atoms_by_residue.items():
|
for res_id, res_atoms in atoms_by_residue.items():
|
||||||
resname = res_atoms[0].resName
|
res_name = res_atoms[0].res_name
|
||||||
residue_label = '%3s%5s'%(resname, res_id)
|
residue_label = '%3s%5s'%(res_name, res_id)
|
||||||
|
|
||||||
# ignore ligand residues
|
# ignore ligand residues
|
||||||
if resname not in expected_atom_numbers:
|
if res_name not in expected_atom_numbers:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# check for c-terminal
|
# check for c-terminal
|
||||||
if 'C-' in [a.terminal for a in res_atoms]:
|
if 'C-' in [a.terminal for a in res_atoms]:
|
||||||
if len(res_atoms) != expected_atom_numbers[resname]+1:
|
if len(res_atoms) != expected_atom_numbers[res_name]+1:
|
||||||
warning('Unexpected number (%d) of atoms in residue %s in conformation %s' % (len(res_atoms), residue_label, name))
|
warning('Unexpected number (%d) of atoms in residue %s in conformation %s' % (len(res_atoms), residue_label, name))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# check number of atoms in residue
|
# check number of atoms in residue
|
||||||
if len(res_atoms) != expected_atom_numbers[resname]:
|
if len(res_atoms) != expected_atom_numbers[res_name]:
|
||||||
warning('Unexpected number (%d) of atoms in residue %s in conformation %s' % (len(res_atoms), residue_label, name))
|
warning('Unexpected number (%d) of atoms in residue %s in conformation %s' % (len(res_atoms), residue_label, name))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def resid_from_atom(a):
|
def resid_from_atom(a):
|
||||||
return '%4d %s %s'%(a.resNumb,a.chainID,a.icode)
|
return '%4d %s %s'%(a.res_num,a.chain_id,a.icode)
|
||||||
|
|
||||||
|
|
||||||
def get_atom_lines_from_pdb(pdb_file, ignore_residues = [], keep_protons=False, tags = ['ATOM ', 'HETATM'], chains=None):
|
def get_atom_lines_from_pdb(pdb_file, ignore_residues = [], keep_protons=False, tags = ['ATOM ', 'HETATM'], chains=None):
|
||||||
@@ -197,7 +197,7 @@ def write_mol2_for_atoms(atoms, filename):
|
|||||||
|
|
||||||
substructure_section = '@<TRIPOS>SUBSTRUCTURE\n\n'
|
substructure_section = '@<TRIPOS>SUBSTRUCTURE\n\n'
|
||||||
if len(atoms)>0:
|
if len(atoms)>0:
|
||||||
substructure_section = '@<TRIPOS>SUBSTRUCTURE\n%-7d %10s %7d\n'%(atoms[0].resNumb,atoms[0].resName,atoms[0].numb)
|
substructure_section = '@<TRIPOS>SUBSTRUCTURE\n%-7d %10s %7d\n'%(atoms[0].res_num,atoms[0].res_name,atoms[0].numb)
|
||||||
|
|
||||||
out = propka.lib.open_file_for_writing(filename)
|
out = propka.lib.open_file_for_writing(filename)
|
||||||
out.write(header%(len(atoms),id-1))
|
out.write(header%(len(atoms),id-1))
|
||||||
@@ -210,8 +210,8 @@ def write_mol2_for_atoms(atoms, filename):
|
|||||||
|
|
||||||
def get_bond_order(atom1, atom2):
|
def get_bond_order(atom1, atom2):
|
||||||
type = '1'
|
type = '1'
|
||||||
pi_electrons1 = atom1.number_of_pi_electrons_in_double_and_triple_bonds
|
pi_electrons1 = atom1.num_pi_elec_2_3_bonds
|
||||||
pi_electrons2 = atom2.number_of_pi_electrons_in_double_and_triple_bonds
|
pi_electrons2 = atom2.num_pi_elec_2_3_bonds
|
||||||
|
|
||||||
if '.ar' in atom1.sybyl_type:
|
if '.ar' in atom1.sybyl_type:
|
||||||
pi_electrons1 -=1
|
pi_electrons1 -=1
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class Protonate:
|
|||||||
def set_charge(self, atom):
|
def set_charge(self, atom):
|
||||||
# atom is a protein atom
|
# atom is a protein atom
|
||||||
if atom.type=='atom':
|
if atom.type=='atom':
|
||||||
key = '%3s-%s'%(atom.resName, atom.name)
|
key = '%3s-%s'%(atom.res_name, atom.name)
|
||||||
if atom.terminal:
|
if atom.terminal:
|
||||||
debug(atom.terminal)
|
debug(atom.terminal)
|
||||||
key=atom.terminal
|
key=atom.terminal
|
||||||
@@ -172,8 +172,8 @@ class Protonate:
|
|||||||
debug('Valence eletrons: %4d'%-self.valence_electrons[atom.element])
|
debug('Valence eletrons: %4d'%-self.valence_electrons[atom.element])
|
||||||
atom.number_of_protons_to_add -= len(atom.bonded_atoms)
|
atom.number_of_protons_to_add -= len(atom.bonded_atoms)
|
||||||
debug('Number of bonds: %4d'%- len(atom.bonded_atoms))
|
debug('Number of bonds: %4d'%- len(atom.bonded_atoms))
|
||||||
atom.number_of_protons_to_add -= atom.number_of_pi_electrons_in_double_and_triple_bonds
|
atom.number_of_protons_to_add -= atom.num_pi_elec_2_3_bonds
|
||||||
debug('Pi electrons: %4d'%-atom.number_of_pi_electrons_in_double_and_triple_bonds)
|
debug('Pi electrons: %4d'%-atom.num_pi_elec_2_3_bonds)
|
||||||
atom.number_of_protons_to_add += int(atom.charge)
|
atom.number_of_protons_to_add += int(atom.charge)
|
||||||
debug('Charge: %4.1f'%atom.charge)
|
debug('Charge: %4.1f'%atom.charge)
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ class Protonate:
|
|||||||
def set_steric_number_and_lone_pairs(self, atom):
|
def set_steric_number_and_lone_pairs(self, atom):
|
||||||
|
|
||||||
# If we already did this, there is no reason to do it again
|
# If we already did this, there is no reason to do it again
|
||||||
if atom.steric_number_and_lone_pairs_set:
|
if atom.steric_num_lone_pairs_set:
|
||||||
return
|
return
|
||||||
|
|
||||||
debug('='*10)
|
debug('='*10)
|
||||||
@@ -211,11 +211,11 @@ class Protonate:
|
|||||||
debug('%65s: %4d'%('Number of hydrogen atoms to add',atom.number_of_protons_to_add))
|
debug('%65s: %4d'%('Number of hydrogen atoms to add',atom.number_of_protons_to_add))
|
||||||
atom.steric_number += atom.number_of_protons_to_add
|
atom.steric_number += atom.number_of_protons_to_add
|
||||||
|
|
||||||
debug('%65s: %4d'%('Number of pi-electrons in double and triple bonds(-)',atom.number_of_pi_electrons_in_double_and_triple_bonds))
|
debug('%65s: %4d'%('Number of pi-electrons in double and triple bonds(-)',atom.num_pi_elec_2_3_bonds))
|
||||||
atom.steric_number -= atom.number_of_pi_electrons_in_double_and_triple_bonds
|
atom.steric_number -= atom.num_pi_elec_2_3_bonds
|
||||||
|
|
||||||
debug('%65s: %4d'%('Number of pi-electrons in conjugated double and triple bonds(-)',atom.number_of_pi_electrons_in_conjugate_double_and_triple_bonds))
|
debug('%65s: %4d'%('Number of pi-electrons in conjugated double and triple bonds(-)',atom.num_pi_elec_conj_2_3_bonds))
|
||||||
atom.steric_number -= atom.number_of_pi_electrons_in_conjugate_double_and_triple_bonds
|
atom.steric_number -= atom.num_pi_elec_conj_2_3_bonds
|
||||||
|
|
||||||
debug('%65s: %4d'%('Number of donated co-ordinated bonds',0))
|
debug('%65s: %4d'%('Number of donated co-ordinated bonds',0))
|
||||||
atom.steric_number += 0
|
atom.steric_number += 0
|
||||||
@@ -231,7 +231,7 @@ class Protonate:
|
|||||||
debug('%65s: %4d'%('Steric number',atom.steric_number))
|
debug('%65s: %4d'%('Steric number',atom.steric_number))
|
||||||
debug('%65s: %4d'%('Number of lone pairs',atom.number_of_lone_pairs))
|
debug('%65s: %4d'%('Number of lone pairs',atom.number_of_lone_pairs))
|
||||||
|
|
||||||
atom.steric_number_and_lone_pairs_set = True
|
atom.steric_num_lone_pairs_set = True
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -364,11 +364,11 @@ class Protonate:
|
|||||||
def add_proton(self, atom, position):
|
def add_proton(self, atom, position):
|
||||||
# Create the new proton
|
# Create the new proton
|
||||||
new_H = propka.atom.Atom()
|
new_H = propka.atom.Atom()
|
||||||
new_H.setProperty(numb = None,
|
new_H.set_property(numb = None,
|
||||||
name = 'H%s'%atom.name[1:],
|
name = 'H%s'%atom.name[1:],
|
||||||
resName = atom.resName,
|
res_name = atom.res_name,
|
||||||
chainID = atom.chainID,
|
chain_id = atom.chain_id,
|
||||||
resNumb = atom.resNumb,
|
res_num = atom.res_num,
|
||||||
x = round(position.x,3), # round of to three digimal points
|
x = round(position.x,3), # round of to three digimal points
|
||||||
y = round(position.y,3), # to avoid round-off differences
|
y = round(position.y,3), # to avoid round-off differences
|
||||||
z = round(position.z,3), # when input file
|
z = round(position.z,3), # when input file
|
||||||
@@ -382,7 +382,7 @@ class Protonate:
|
|||||||
new_H.steric_number = 0
|
new_H.steric_number = 0
|
||||||
new_H.number_of_lone_pairs = 0
|
new_H.number_of_lone_pairs = 0
|
||||||
new_H.number_of_protons_to_add = 0
|
new_H.number_of_protons_to_add = 0
|
||||||
new_H.number_of_pi_electrons_in_double_and_triple_bonds = 0
|
new_H.num_pi_elec_2_3_bonds = 0
|
||||||
new_H.is_protonates = True
|
new_H.is_protonates = True
|
||||||
|
|
||||||
atom.bonded_atoms.append(new_H)
|
atom.bonded_atoms.append(new_H)
|
||||||
@@ -390,13 +390,13 @@ class Protonate:
|
|||||||
atom.conformation_container.add_atom(new_H)
|
atom.conformation_container.add_atom(new_H)
|
||||||
|
|
||||||
# update names of all protons on this atom
|
# update names of all protons on this atom
|
||||||
new_H.residue_label = "%-3s%4d%2s" % (new_H.name,new_H.resNumb, new_H.chainID)
|
new_H.residue_label = "%-3s%4d%2s" % (new_H.name,new_H.res_num, new_H.chain_id)
|
||||||
no_protons = atom.count_bonded_elements('H')
|
no_protons = atom.count_bonded_elements('H')
|
||||||
if no_protons > 1:
|
if no_protons > 1:
|
||||||
i = 1
|
i = 1
|
||||||
for proton in atom.get_bonded_elements('H'):
|
for proton in atom.get_bonded_elements('H'):
|
||||||
proton.name = 'H%s%d'%(atom.name[1:],i)
|
proton.name = 'H%s%d'%(atom.name[1:],i)
|
||||||
proton.residue_label = "%-3s%4d%2s" % (proton.name,proton.resNumb, proton.chainID)
|
proton.residue_label = "%-3s%4d%2s" % (proton.name,proton.res_num, proton.chain_id)
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user