De-lint propka/atom.py

Other changes are a result of Atom use in other files.
This commit is contained in:
Nathan Baker
2020-05-17 17:08:38 -07:00
parent 303aaae25a
commit 10efc3c7f9
10 changed files with 178 additions and 177 deletions

View File

@@ -68,22 +68,22 @@ def protonate_30_style(molecular_container):
O=None
C=None
for atom in molecular_container.conformations[name].atoms:
if atom.resNumb != curres:
curres = atom.resNumb
if atom.res_num != curres:
curres = atom.res_num
if len(residue)>0:
#backbone
[O, C]= addBackBoneHydrogen(residue,O,C)
#arginine
if residue[0].resName == 'ARG':
if residue[0].res_name == 'ARG':
addArgHydrogen(residue)
#histidine
if residue[0].resName == 'HIS':
if residue[0].res_name == 'HIS':
addHisHydrogen(residue)
#tryptophan
if residue[0].resName == 'TRP':
if residue[0].res_name == 'TRP':
addTrpHydrogen(residue)
#amides
if residue[0].resName in ['GLN','ASN']:
if residue[0].res_name in ['GLN','ASN']:
addAmdHydrogen(residue)
@@ -159,7 +159,7 @@ def addTrpHydrogen(residue):
elif atom.name == "CE2":
CE = atom
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)
sys.exit(0)
@@ -176,15 +176,15 @@ def addAmdHydrogen(residue):
O = None
N = None
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
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
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
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)
sys.exit(0)
@@ -222,7 +222,7 @@ def addBackBoneHydrogen(residue, O, C):
return [new_O,new_C]
if N.resName == "PRO":
if N.res_name == "PRO":
""" PRO doesn't have an H-atom; do nothing """
else:
H = protonateDirection([N, O, C])
@@ -311,11 +311,11 @@ def protonateSP2(list):
def make_new_H(atom, x,y,z):
new_H = propka.atom.Atom()
new_H.setProperty(numb = None,
new_H.set_property(numb = None,
name = 'H%s'%atom.name[1:],
resName = atom.resName,
chainID = atom.chainID,
resNumb = atom.resNumb,
res_name = atom.res_name,
chain_id = atom.chain_id,
res_num = atom.res_num,
x = x,
y = y,
z = z,
@@ -329,7 +329,7 @@ def make_new_H(atom, x,y,z):
new_H.steric_number = 0
new_H.number_of_lone_pairs = 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.conformation_container.add_atom(new_H)
@@ -357,7 +357,7 @@ def radial_volume_desolvation(parameters, group):
for atom in all_atoms:
# 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
sq_dist = squared_distance(group, atom)
@@ -409,15 +409,15 @@ def contactDesolvation(parameters, group):
'N+': 4.5}
all_atoms = group.atom.conformation_container.get_non_hydrogen_atoms()
if residue.resName in version.desolvationRadii:
local_cutoff = version.desolvationRadii[residue.resName]
if residue.res_name in version.desolvationRadii:
local_cutoff = version.desolvationRadii[residue.res_name]
else:
local_cutoff = 0.00
residue.Nmass = 0
residue.Nlocl = 0
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
dY = atom.y - residue.y
dZ = atom.z - residue.z