Typing: Atom members
This commit is contained in:
@@ -43,6 +43,43 @@ class Atom:
|
|||||||
:meth:`make_input_line` and :meth:`get_input_parameters` have been
|
:meth:`make_input_line` and :meth:`get_input_parameters` have been
|
||||||
removed as reading/writing PROPKA input is no longer supported.
|
removed as reading/writing PROPKA input is no longer supported.
|
||||||
"""
|
"""
|
||||||
|
group: Optional["Group"] = None
|
||||||
|
group_type: Optional[str] = None
|
||||||
|
cysteine_bridge: bool = False
|
||||||
|
residue: NoReturn = None # type: ignore[assignment]
|
||||||
|
conformation_container: Optional["ConformationContainer"] = None
|
||||||
|
molecular_container: Optional["MolecularContainer"] = None
|
||||||
|
is_protonated: bool = False
|
||||||
|
steric_num_lone_pairs_set: bool = False
|
||||||
|
terminal: Optional[str] = None
|
||||||
|
charge: float = 0.0
|
||||||
|
charge_set: bool = False
|
||||||
|
steric_number: int = 0
|
||||||
|
number_of_lone_pairs: int = 0
|
||||||
|
number_of_protons_to_add: int = 0
|
||||||
|
num_pi_elec_2_3_bonds: int = 0
|
||||||
|
num_pi_elec_conj_2_3_bonds: int = 0
|
||||||
|
groups_extracted: bool = False
|
||||||
|
|
||||||
|
# PDB attributes
|
||||||
|
name: str = ''
|
||||||
|
numb: int = 0
|
||||||
|
x: float = 0.0
|
||||||
|
y: float = 0.0
|
||||||
|
z: float = 0.0
|
||||||
|
res_num: int = 0
|
||||||
|
res_name: str = ''
|
||||||
|
chain_id: str = 'A'
|
||||||
|
type: str = ''
|
||||||
|
occ: str = '1.0'
|
||||||
|
beta: str = '0.0'
|
||||||
|
element: str = ''
|
||||||
|
icode: str = ''
|
||||||
|
|
||||||
|
# ligand atom types
|
||||||
|
sybyl_type = ''
|
||||||
|
sybyl_assigned = False
|
||||||
|
marvin_pka = False
|
||||||
|
|
||||||
def __init__(self, line: Optional[str] = None):
|
def __init__(self, line: Optional[str] = None):
|
||||||
"""Initialize Atom object.
|
"""Initialize Atom object.
|
||||||
@@ -51,53 +88,17 @@ class Atom:
|
|||||||
line: Line from a PDB file to set properties of atom.
|
line: Line from a PDB file to set properties of atom.
|
||||||
"""
|
"""
|
||||||
self.number_of_bonded_elements: NoReturn = cast(NoReturn, {}) # FIXME unused?
|
self.number_of_bonded_elements: NoReturn = cast(NoReturn, {}) # FIXME unused?
|
||||||
self.group: Optional[Group] = None
|
|
||||||
self.group_type: Optional[str] = None
|
|
||||||
self.cysteine_bridge: bool = False
|
|
||||||
self.bonded_atoms: List[Atom] = []
|
self.bonded_atoms: List[Atom] = []
|
||||||
self.residue = None
|
|
||||||
self.conformation_container: Optional[ConformationContainer] = None
|
|
||||||
self.molecular_container: Optional[MolecularContainer] = None
|
|
||||||
self.is_protonated = False
|
|
||||||
self.steric_num_lone_pairs_set = False
|
|
||||||
self.terminal: Optional[str] = None
|
|
||||||
self.charge = 0.0
|
|
||||||
self.charge_set = False
|
|
||||||
self.steric_number = 0
|
|
||||||
self.number_of_lone_pairs = 0
|
|
||||||
self.number_of_protons_to_add = 0
|
|
||||||
self.num_pi_elec_2_3_bonds = 0
|
|
||||||
self.num_pi_elec_conj_2_3_bonds = 0
|
|
||||||
self.groups_extracted = 0
|
|
||||||
self.set_properties(line)
|
self.set_properties(line)
|
||||||
fmt = "{r.name:3s}{r.res_num:>4d}{r.chain_id:>2s}"
|
fmt = "{r.name:3s}{r.res_num:>4d}{r.chain_id:>2s}"
|
||||||
self.residue_label = fmt.format(r=self)
|
self.residue_label = fmt.format(r=self)
|
||||||
|
|
||||||
# ligand atom types
|
|
||||||
self.sybyl_type = ''
|
|
||||||
self.sybyl_assigned = False
|
|
||||||
self.marvin_pka = False
|
|
||||||
|
|
||||||
def set_properties(self, line: Optional[str]):
|
def set_properties(self, line: Optional[str]):
|
||||||
"""Line from PDB file to set properties of atom.
|
"""Line from PDB file to set properties of atom.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
line: PDB file line
|
line: PDB file line
|
||||||
"""
|
"""
|
||||||
self.name = ''
|
|
||||||
self.numb = 0
|
|
||||||
self.x = 0.0
|
|
||||||
self.y = 0.0
|
|
||||||
self.z = 0.0
|
|
||||||
self.res_num = 0
|
|
||||||
self.res_name = ''
|
|
||||||
self.chain_id = 'A'
|
|
||||||
self.type = ''
|
|
||||||
self.occ = '1.0'
|
|
||||||
self.beta = '0.0'
|
|
||||||
self.element = ''
|
|
||||||
self.icode = ''
|
|
||||||
|
|
||||||
if line:
|
if line:
|
||||||
self.name = line[12:16].strip()
|
self.name = line[12:16].strip()
|
||||||
self.numb = int(hybrid36.decode(line[6:11]))
|
self.numb = int(hybrid36.decode(line[6:11]))
|
||||||
@@ -184,9 +185,17 @@ class Atom:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_property(self, numb=None, name=None, res_name=None, chain_id=None,
|
def set_property(self,
|
||||||
res_num=None, x=None, y=None, z=None, occ=None,
|
numb: Optional[int] = None,
|
||||||
beta=None):
|
name: Optional[str] = None,
|
||||||
|
res_name: Optional[str] = None,
|
||||||
|
chain_id: Optional[str] = None,
|
||||||
|
res_num: Optional[int] = None,
|
||||||
|
x: Optional[float] = None,
|
||||||
|
y: Optional[float] = None,
|
||||||
|
z: Optional[float] = None,
|
||||||
|
occ: Optional[str] = None,
|
||||||
|
beta: Optional[str] = None):
|
||||||
"""Set properties of the atom object.
|
"""Set properties of the atom object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -345,7 +354,7 @@ class Atom:
|
|||||||
"""Return an undefined-format string version of this atom."""
|
"""Return an undefined-format string version of this atom."""
|
||||||
return STR_FMT.format(r=self)
|
return STR_FMT.format(r=self)
|
||||||
|
|
||||||
def set_residue(self, residue):
|
def set_residue(self, residue: NoReturn):
|
||||||
""" Makes a reference to the parent residue
|
""" Makes a reference to the parent residue
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ def is_group(parameters: Parameters, atom: Atom) -> Optional[Group]:
|
|||||||
Returns:
|
Returns:
|
||||||
group for atom or None
|
group for atom or None
|
||||||
"""
|
"""
|
||||||
atom.groups_extracted = 1
|
atom.groups_extracted = True
|
||||||
# check if this atom belongs to a protein group
|
# check if this atom belongs to a protein group
|
||||||
protein_group = is_protein_group(parameters, atom)
|
protein_group = is_protein_group(parameters, atom)
|
||||||
if protein_group:
|
if protein_group:
|
||||||
@@ -1386,6 +1386,7 @@ def is_ligand_group_by_marvin_pkas(parameters: Parameters, atom: Atom) -> Option
|
|||||||
# calculate Marvin ligand pkas for this conformation container
|
# calculate Marvin ligand pkas for this conformation container
|
||||||
# if not already done
|
# if not already done
|
||||||
# TODO - double-check testing coverage of these functions.
|
# TODO - double-check testing coverage of these functions.
|
||||||
|
assert atom.molecular_container is not None
|
||||||
assert atom.conformation_container is not None
|
assert atom.conformation_container is not None
|
||||||
if not atom.conformation_container.marvin_pkas_calculated:
|
if not atom.conformation_container.marvin_pkas_calculated:
|
||||||
lpka = LigandPkaValues(parameters)
|
lpka = LigandPkaValues(parameters)
|
||||||
|
|||||||
@@ -15,10 +15,14 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
from typing import TYPE_CHECKING, NoReturn
|
||||||
|
|
||||||
from propka.output import write_mol2_for_atoms
|
from propka.output import write_mol2_for_atoms
|
||||||
from propka.lib import split_atoms_into_molecules
|
from propka.lib import split_atoms_into_molecules
|
||||||
from propka.parameters import Parameters
|
from propka.parameters import Parameters
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from propka.molecular_container import MolecularContainer
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -58,7 +62,8 @@ class LigandPkaValues:
|
|||||||
return loc
|
return loc
|
||||||
|
|
||||||
def get_marvin_pkas_for_pdb_file(
|
def get_marvin_pkas_for_pdb_file(
|
||||||
self, molecule, parameters, num_pkas=10, min_ph=-10.0, max_ph=20.0):
|
self, molecule: "MolecularContainer", parameters: NoReturn,
|
||||||
|
num_pkas=10, min_ph=-10.0, max_ph=20.0):
|
||||||
"""Use Marvin executables to get pKas for a PDB file.
|
"""Use Marvin executables to get pKas for a PDB file.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -72,7 +77,7 @@ class LigandPkaValues:
|
|||||||
self.get_marvin_pkas_for_molecular_container(
|
self.get_marvin_pkas_for_molecular_container(
|
||||||
molecule, num_pkas=num_pkas, min_ph=min_ph, max_ph=max_ph)
|
molecule, num_pkas=num_pkas, min_ph=min_ph, max_ph=max_ph)
|
||||||
|
|
||||||
def get_marvin_pkas_for_molecular_container(self, molecule, num_pkas=10,
|
def get_marvin_pkas_for_molecular_container(self, molecule: "MolecularContainer", num_pkas=10,
|
||||||
min_ph=-10.0, max_ph=20.0):
|
min_ph=-10.0, max_ph=20.0):
|
||||||
"""Use Marvin executables to calculate pKas for a molecular container.
|
"""Use Marvin executables to calculate pKas for a molecular container.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user