schrodinger.livedesign.mmgbsa module

schrodinger.livedesign.mmgbsa.extract_mutations(wt_mol: Mol, mut_mol: Mol) → list[tuple[str, int, str]]

Return substitutions that transform wt_mol into mut_mol.

Insertions and deletions are not supported, so monomer positions can be compared directly. If wt and mut positions do not form a 1:1 mapping, an error is raised instead.

Parameters:
  • wt_mol – Wild-type monomeric molecule.

  • mut_mol – Mutant monomeric molecule.

Returns:

(polymer_id, residue_index, new_monomer) tuples.

Raises:

ValueError – If the molecules do not occupy the same positions.

schrodinger.livedesign.mmgbsa.get_mol_to_st_map(wt_st: Structure, wt_mol: Mol) → dict[tuple[str, int], tuple[str, int, str]]

Map monomer positions to structure residue positions.

Parameters:
  • wt_st – Wild-type Schrodinger structure.

  • wt_mol – Wild-type monomeric molecule.

Returns:

Mapping from (polymer_id, residue_index) to (chain, residue_number, insertion_code), e.g. {("PEPTIDE1", 1): ("A", 2, " ")}.

Raises:

ValueError – If the molecule cannot be mapped to the structure or a mapping is ambiguous.

This builds the raw position mapping only. It does not require every monomer position to be mapped or residue names to agree; callers that need those guarantees at mutated positions should use validate_mutation_sites.

schrodinger.livedesign.mmgbsa.validate_mutation_sites(mutations: list[tuple[str, int, str]], mol_to_st: dict[tuple[str, int], tuple[str, int, str]], wt_mol_positions: dict[tuple[str, int], str], structure_positions: dict[tuple[str, int, str], str]) → None

Check that each mutated position maps to a matching structure residue.

Only mutated positions are validated. Positions that are unmapped or whose residue names disagree elsewhere in the molecule are tolerated, since the calculation only modifies the mutated sites. At each mutated position this checks that the mapped wild-type molecule residue name matches the wild-type structure residue name (it does not consider the mutant residue name).

Parameters:
  • mutations – (polymer_id, residue_index, new_monomer) tuples.

  • mol_to_st – Mapping from monomer position to structure position.

  • wt_mol_positions – Mapping from monomer position to wild-type residue name.

  • structure_positions – Mapping from structure position to residue name.

Raises:

ValueError – If a mutated position is missing from the molecule or the structure map, or its wild-type residue name does not match the structure residue.

schrodinger.livedesign.mmgbsa.generate_mutant_structure_and_score(wt_st: Structure, mutations: list[tuple[str, int, str, str]], ncaa_sts: list[Structure] | None = None) → tuple[Structure, float]

Run residue scanning for one simultaneous mutation set.

Parameters:
  • wt_st – Wild-type Schrodinger structure.

  • mutations – Structure mutation tuples of the form (chain, residue_number, insertion_code, new_residue_name). All tuples are submitted as one simultaneous mutation set.

  • ncaa_sts – Optional non-canonical amino acid structures for the mutation-prediction backend. Each structure’s residue name must match a target residue name in mutations; several may be supplied to mutate different positions to different non-canonical residues in one run.

Returns:

A tuple containing the mutant Schrodinger structure and its Prime energy score.

Raises:
  • ValueError – If no mutations are supplied or a mutation target residue name is not recognized.

  • RuntimeError – If the backend fails, times out, produces no output, produces an unexpected number of mutants, or produces no score.

Temporary input, output, and Prime job files are removed before returning or raising an exception.

schrodinger.livedesign.mmgbsa.get_mmgbsa_mutant(mut_mol_binary_str: str, wt_mol_binary_str: str, wt_structure_mae: str, ncaa_structure_mae: str = None) → tuple[str, float, list[tuple[str, int, str, str]]]

Generate an LD residue-substitution mutant structure and MMGBSA score.

Parameters:
  • mut_mol_binary_str – mutant monomeric mol as RDMOL_BINARY_BASE64 string

  • wt_mol_binary_str – wild-type monomeric mol as RDMOL_BINARY_BASE64 string

  • wt_structure_mae – wild-type structure as MAE string

  • ncaa_structure_mae – non-canonical amino acid structure(s) as MAE string (optional); may hold multiple non-canonical residues

Returns:

MAE string of mutant structure, the mutant Prime energy score, and the applied mutations as (chain, residue_number, insertion_code, new_residue_name) tuples