kinoml.modeling.MDAnalysisModeling¶
Module Contents¶
- kinoml.modeling.MDAnalysisModeling.logger¶
- kinoml.modeling.MDAnalysisModeling.read_molecule(path: str | pathlib.Path, guess_bonds: bool = True) MDAnalysis.core.universe.Universe ¶
Read a molecule from a file. Uses Biopython to support reading of the CIF format.
- Parameters:
path (str, pathlib.Path) – Path to molecule file.
guess_bonds (bool, default=True) – If bonds should be guessed by the van-der-Waals radius.
- Returns:
molecule – The MDAnalysis universe.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.write_molecule(molecule: MDAnalysis.core.groups.AtomGroup, file_path: str | pathlib.Path, delete_segid: bool = True)¶
Write an AtomGroup to a file. If written in PDB format and delete_segid is True the segid will be deleted from the PDB file. (https://docs.mdanalysis.org/1.0.0/documentation_pages/coordinates/PDB.html)
- Parameters:
molecule (MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
file_path (str or pathlib.Path) – The path to the output file.
delete_segid (bool, default=True) – If the segid shell be deleted in case of PDB format. (https://docs.mdanalysis.org/1.0.0/documentation_pages/coordinates/PDB.html)
- kinoml.modeling.MDAnalysisModeling.select_chain(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, chain_id: str) MDAnalysis.core.universe.Universe ¶
Select a chain from an MDAnalysis molecule.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
chain_id (str) – Chain identifier.
- Returns:
An MDAnalysis universe holding the selected chain.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.select_altloc(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, altloc_id: str, altloc_fallback: bool = True) MDAnalysis.core.universe.Universe ¶
Select an alternate location from an MDAnalysis molecule.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
altloc_id (str) – Alternate location identifier.
altloc_fallback (bool) – If the alternate location “A” should be used for residues that do not contain the given alternate location identifier.
- Returns:
selection – An MDAnalysis universe holding the selected alternate location.
- Return type:
MDAnalysis.core.universe.Universe
- Raises:
ValueError – No atoms were found with given altloc id.
- kinoml.modeling.MDAnalysisModeling.remove_non_protein(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, exceptions: None | Iterable[str] = None, only_standard_amino_acids: bool = True, remove_water: bool = False) MDAnalysis.core.universe.Universe ¶
Remove non-protein atoms from an OpenEye molecule. Water will be kept by default.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
exceptions (None or iterable of str) – Exceptions that should not be removed.
only_standard_amino_acids (bool, default=True) – If only standard amino acids shell be retained, .i.e. ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SEC, SER, THR, TRP, TYR, VAL.
remove_water (bool, default=False) – If water should be removed.
- Returns:
An MDAnalysis universe holding the filtered structure.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.delete_residues(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, residues: Iterable[MDAnalysis.core.groups.Residue])¶
Delete residues from an MDAnalysis molecule.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
residues (iterable of MDAnalysis.core.groups.Residue)
- Returns:
An MDAnalysis molecule holding a molecular structure without given residues.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.delete_incomplete_backbone_residues(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup) MDAnalysis.core.universe.Universe ¶
Delete protein residues with incomplete backbone, i.e. less than 4 backbone heavy atoms.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a molecular structure.
- Returns:
An MDAnalysis molecule holding a molecular structure without protein residues with incomplete backbone.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.delete_expression_tags(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, pdb_path: str | pathlib.Path) MDAnalysis.core.universe.Universe ¶
Delete expression tags listed in the PDB header section “SEQADV”.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule.
pdb_path (str or pathlib.Path) – The path to the PDB file containing the information about expression tags.
- Returns:
The MDAnalysis universe without expression tags.
- Return type:
Universe
- kinoml.modeling.MDAnalysisModeling.get_sequence(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup) str ¶
Get the amino acid sequence with one letter characters of an MDAnalysis molecule. All residues not named as standard amino acid will receive the character ‘X’.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule.
- Returns:
sequence – The amino acid sequence with one letter characters.
- Return type:
str
- kinoml.modeling.MDAnalysisModeling.get_structure_sequence_alignment(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, sequence: str) Tuple[str, str] ¶
Generate an alignment between an MDAnalysis protein structure and an amino acid sequence. The provided protein structure should only contain protein residues to prevent unexpected behavior. Also, this alignment was optimized for highly similar sequences, i.e. only few mutations, deletions and insertions. Non protein residues will be marked with “X”. The provided MDAnalysis molecule needs bond information to properly work, hence use “guess_bonds=True” when loading the universe.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a protein structure.
sequence (str) – A one letter amino acid sequence.
- Returns:
structure_sequence_aligned (str) – The aligned protein structure sequence with gaps denoted as “-“.
sequence_aligned (str) – The aligned amino acid sequence with gaps denoted as “-“.
- kinoml.modeling.MDAnalysisModeling.delete_alterations(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, sequence: str, delete_n_anchors: int = 2, short_protein_segments_cutoff: int = 3) MDAnalysis.core.universe.Universe ¶
Delete residues from an MDAnalysis molecule that are not covered by the given sequence, i.e. mutations and insertions. The provided protein structure should only contain protein residues to prevent unexpected behavior.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a protein structure.
sequence (str) – A one letter amino acid sequence.
delete_n_anchors (int, default=2) – The number of anchoring residues to delete when deleting insertions.
short_protein_segments_cutoff (int, default=3) – If deleting residues will lead to short protein segments, delete these segments with a length up to the specified cutoff.
- Returns:
An MDAnalysis molecule holding a protein structure without alterations deleted.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.delete_short_protein_segments(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, cutoff: int = 3) MDAnalysis.core.universe.Universe ¶
Delete protein segments consisting of 3 or less residues. Needs to have bonding information to work correctly.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a protein with possibly short segments.
cutoff (int, default=3) – The upper bound defining a short protein segment.
- Returns:
An MDAnalysis molecule holding the protein without short segments.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.renumber_protein_residues(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, template_sequence: str) MDAnalysis.core.universe.Universe ¶
Renumber a protein structure according to the provided sequence.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – An MDAnalysis molecule holding a protein structure.
template_sequence (str) – The amino acid sequence to use for renumbering.
- Returns:
An MDAnalysis molecule holding the renumbered protein structure.
- Return type:
MDAnalysis.core.universe.Universe
- kinoml.modeling.MDAnalysisModeling.update_residue_identifiers(molecule: MDAnalysis.core.universe.Universe | MDAnalysis.core.groups.AtomGroup, keep_protein_residue_ids: bool = True, keep_chain_ids: bool = False) MDAnalysis.core.universe.Universe ¶
Update the atom, residue and chain IDs of the given molecular structure. All residues become part of chain A, unless ‘keep_chain_ids’ is set True. Atom IDs will start from 1. Residue IDs will start from 1, except ‘keep_protein_residue_ids’ is set True. This is especially useful, if molecules were merged, which can result in overlapping atom and residue IDs as well as separate chains.
- Parameters:
molecule (MDAnalysis.core.universe.Universe or MDAnalysis.core.groups.Atomgroup) – The MDAnalysis molecule structure for updating atom and residue ids.
keep_protein_residue_ids (bool) – If the protein residues should be kept.
keep_chain_ids (bool) – If the chain IDS should be kept.
- Returns:
The MDAnalysis molecule structure with updated atom and residue ids.
- Return type:
MDAnalysis.core.universe.Universe