protex.system.ProtexTemplates
- class protex.system.ProtexTemplates(states: list[dict[str, dict[str, str]]], allowed_updates: dict[frozenset[str], dict[str, float]])[source]
Bases:
object
Creates the basic foundation for the Protex System.
- Parameters:
states – A list of dictionary depicting the residue name and the atom name which should be changed, i.e.:
IM1H_IM1 = { "IM1H": {"atom_name": "H7", "canonical_name": "IM1"}, "IM1": {"atom_name": "N2", "canonical_name": "IM1"} } OAC_HOAC = { "OAC": {"atom_name": "O2", "canonical_name": "OAC"}, "HOAC": {"atom_name": "H", "canonical_name": "OAC"} } states = [IM1H_IM1, OAC_HOAC]
allowed_updates – A dictionary specifiying which updates are possile. Key is a frozenset with the two residue names for the update. The values is a dictionary which specifies the maximum distance (“r_max”) and the probability for this update (“prob”) r_max is in nanometer and the prob between 0 and 1
allowed_updates = {} allowed_updates[frozenset(["IM1H", "OAC"])] = {"r_max": 0.155, "prob": 1} allowed_updates[frozenset(["IM1", "HOAC"])] = {"r_max": 0.155, "prob": 1} allowed_updates[frozenset(["IM1H", "IM1"])] = {"r_max": 0.155, "prob": 0.201} allowed_updates[frozenset(["HOAC", "OAC"])] = {"r_max": 0.155, "prob": 0.684}
- Variables:
pairs – A list with the pairs where the hydrogen can be transfered
states – The passed states list as a joined dictionary
names – A list with the different residue names
allowed_updates – the allowed_updates passed to the class
overall_max_distance – the longest allowed distance for a possible transfer between two updates
Methods
Pickle the current ProtexTemplates object.
Get the atom name for a specific residue.
get_charge_template_for returns the charge template for a residue.
Get the name of the equivalent atom for a given residue name.
get_residue_name_of_paired_ion returns the paired residue name given a reisue name.
Returns the value in the allowed updates dictionary.
Check if a given residue has an equivalent atom defined.
Load a pickled ProtexTemplates instance.
set_allowed_updates
Update a value in the allowed updates dictionary.
- dump(fname: str) None [source]
Pickle the current ProtexTemplates object.
- Parameters:
fname (str) – The file name of the object
- get_atom_name_for(resname: str) str [source]
Get the atom name for a specific residue.
- Parameters:
resname (str) – The residue name
- Returns:
The atom name
- Return type:
str
- get_charge_template_for(name: str) list [source]
get_charge_template_for returns the charge template for a residue.
- Parameters:
name (str) – Name of the residue
- Returns:
charge state of residue
- Return type:
list
- Raises:
RuntimeError – [description]
- get_equivalent_atom_for(resname: str) str [source]
Get the name of the equivalent atom for a given residue name.
- Parameters:
resname (str) – The residue name
- Returns:
The atom name
- Return type:
str
- get_residue_name_for_coupled_state(name: str) str [source]
get_residue_name_of_paired_ion returns the paired residue name given a reisue name.
- Parameters:
name (str) – residue name
- Return type:
str
- Raises:
RuntimeError – is raised if no paired residue name can be found
- get_update_value_for(residue_set: frozenset[str], property: str) float [source]
Returns the value in the allowed updates dictionary.
- Parameters:
residue_set – dictionary key for residue_set, i.e [“IM1H”, “OAC”]
property – dictionary key for the property defined for the residue key, i.e. prob
- Returns:
the value of the property
- Return type:
float
- Raises:
RuntimeError – if keys do not exist
- has_equivalent_atom(resname: str) bool [source]
Check if a given residue has an equivalent atom defined.
- Parameters:
resname (str) – The residue name
- Returns:
True if this residue has an equivalent atom defined, false otherwise
- Return type:
bool
- static load(fname: str) ProtexTemplates [source]
Load a pickled ProtexTemplates instance.
- Parameters:
fname (str) – The file name
- Returns:
An instance of the ProtexTemplates
- Return type:
- set_update_value_for(residue_set: frozenset[str], property: str, value: float)[source]
Update a value in the allowed updates dictionary.
- Parameters:
residue – dictionary key for residue_set, i.e [“IM1H”,”OAC”]
property – dictionary key for the property defined for the residue key, i.e. prob
value – the value the property should be set to
- Return type:
None
- Raises:
RuntimeError – is raised if new residue_set or new property is trying to be inserted