Parameter Database#

Use tmol.database.ParameterDatabase to load the chemical and scoring parameters used to construct poses and score functions.

Chemical and scoring parameter databases used by TMol.

class tmol.database.AtomType(name: str, element: str, is_acceptor: bool = False, is_donor: bool = False, is_hydroxyl: bool = False, is_polarh: bool = False, acceptor_hybridization: AcceptorHybridization | None = None, is_metal: bool = False, oxidation_state: int | None = None, is_metal_donor: bool = False, conjugated_type: str | None = None)[source]#

Bases: object

Chemical atom-type properties used by scoring terms.

class tmol.database.ChemicalDatabase(element_types: Tuple[Element, ...], atom_types: Tuple[AtomType, ...], residues: Tuple[RawResidueType, ...], variants: Tuple[VariantType, ...], name3_aliases: Tuple[Name3Alias, ...] = ())[source]#

Bases: object

Immutable collection of chemical types, residues, and patches.

classmethod get_default() → ChemicalDatabase[source]#

Load and return default parameter database.

classmethod from_file(path: str | PathLike[str]) → ChemicalDatabase[source]#

Load chemical definitions and their generated residue tables.

class tmol.database.ParameterDatabase(scoring: ScoringDatabase, chemical: PatchedChemicalDatabase)[source]#

Bases: object

Immutable chemical and scoring parameter container used by tmol.

The process-global accessor get_default() returns a shared read-only instance. To add ligand or custom residue data, use inject_residue_params() which returns a new database.

classmethod get_default() → ParameterDatabase[source]#

Return the process-global cached parameter database (read-only).

classmethod from_file(path: str) → ParameterDatabase[source]#

Load chemical and scoring parameters rooted at path.

with_symmetric_gly() → ParameterDatabase[source]#

A copy with symmetric glycine backbone tables and C-alpha hydrogens.

Glycine is achiral, but the tables derived from PDB statistics are not, so by default a structure and its mirror image score differently. This points glycine at the symmetrized tables instead. Its two C-alpha hydrogen ideal lengths and bonded targets are averaged, so rebuilding glycine also preserves reflection when the equivalent H names exchange. Other residues are untouched.

This optional model uses uniformly trans glycine bbdep-omega tables. Uniformity is a modeling choice, not a consequence of achirality.

create_stable_subset(desired_names: list[str], desired_variants: list[str]) → ParameterDatabase[source]#

Create a ParameterDatabase representing a subset of the RefinedResidueTypes in this PD’s PatchedChemicalDatabase from a list of RRT names and patched with the given variants (identified by their display names) where the order in which RRTs will appear in the subset will be stable over time (as long as this source PCD is only accumulating new RRTs over time and not losing the RRTs that it starts with).

class tmol.database.PatchedChemicalDatabase(element_types: Tuple[Element, ...], atom_types: Tuple[AtomType, ...], residues: Tuple[RawResidueType, ...], variants: Tuple[VariantType, ...], name3_aliases: Tuple[Name3Alias, ...] = ())[source]#

Bases: object

Chemical database containing residue types after variant application.

with_variants_applied(variants)[source]#

Return a copy with new patches applied to the residues already held.

with_added_residues patches only what it adds, which is right for a patch a new residue brings with it. A conjugation patch instead acts on a residue the database already has – serine gains a connection at OG – so its forms are built here and appended alongside the base.

with_added_residues(residues, atom_types=None, variants=None)[source]#

Return a copy with residues patched and appended.

variants are extra patches the residues bring with them, scoped to their own base types; they are kept on the database so a later addition is patched against the same set.

class tmol.database.RawResidueType(name: str, base_name: str, name3: str, io_equiv_class: str, atoms: Tuple[Atom, ...], atom_aliases: Tuple[AtomAlias, ...], bonds: Tuple[tuple, ...], connections: Tuple[Connection, ...], torsions: Tuple[Torsion, ...], icoors: Tuple[Icoor, ...], properties: ChemicalProperties, chi_samples: Tuple[ChiSamples, ...], default_jump_connection_atom: str, hydrogens_regenerated: bool = False, is_ligand_fragment: bool = False, rama_reference: str | None = None, dunbrack_reference: str | None = None, na_base_reference: str | None = None, reference_mirrored: bool = False, one_letter_code: str | None = None, conjugation_context: Tuple[Tuple[str, str, str], ...] = (), metal_sites: Tuple[MetalSite, ...] = (), io_bond_orders: Tuple[Tuple[str, str, str], ...] = ())[source]#

Bases: object

Unpatched residue definition loaded from the chemical database.

atom_name(index: int) → str[source]#

Return the name of the atom at index.

class tmol.database.ScoringDatabase(cartbonded: CartBondedDatabase, genbonded: GenBondedDatabase, disulfide: DisulfideDatabase, metal_coordination: MetalCoordinationDatabase, na_torsion: NaTorsionDatabase, dun: DunbrackRotamerLibrary, elec: ElecDatabase, hbond: HBondDatabase, ljlk: LJLKDatabase, omega_bbdep: OmegaBBDepDatabase, rama: RamaDatabase, ref: RefDatabase)[source]#

Bases: object

Immutable parameters for all standard TMol energy terms.

classmethod from_file(path: str | PathLike[str] = '/home/runner/work/tmol/tmol/tmol/database/scoring') → ScoringDatabase[source]#

Load all scoring-term databases rooted at path.

tmol.database.inject_residue_params(param_db: ParameterDatabase, residue_types: list[RawResidueType], atom_types: list[AtomType] | None = None, partial_charges: Mapping[str, dict[str, float]] | None = None, cartbonded_params: Mapping[str, CartRes] | None = None, variants: list | None = None, connection_params: tuple[ConnectionCartRes, ...] | None = None) → ParameterDatabase[source]#

Return a new ParameterDatabase with additional residue type data.

This is the primary API for extending a database with ligand or custom residue types. The input param_db is not modified.

Parameters:
  • param_db – Base database to extend.

  • residue_types – New RawResidueType entries to add.

  • atom_types – Optional new AtomType entries (deduplicated by name).

  • partial_charges – Per-residue charge dicts {res_name: {atom: charge}}.

  • cartbonded_params – Per-residue CartRes {res_name: CartRes}.

  • connection_params – Complete length/angle records for named connection pairs.

  • variants – Optional patches the new residues bring with them, applied alongside the database’s own.

Returns:

A new frozen ParameterDatabase with the additional data.