moleculekit.tools.modelling module#
- moleculekit.tools.modelling.detectSequenceGaps(mol, sequences)#
Detect missing-residue gaps per protein chain by aligning the observed sequence to the supplied full sequence.
- Parameters:
- Returns:
gaps (
listofdict) – Each{"chain", "after_resid", "before_resid", "missing_seq", "is_terminal"}.after_residis the observed resid immediately before the gap (Nonefor an N-terminal gap);before_residis the observed resid immediately after it (Nonefor a C-terminal gap).skipped_ncaa_chains (
listofstr) – Protein chains skipped because they contain non-canonical residues.
- moleculekit.tools.modelling.detectSplicedClashes(mol, new_mask, cutoff=2.0, targets='not protein')#
Report steric overlaps between the newly modelled residues and other atoms.
aceboltz models from the protein template alone, so a modelled loop can be placed into an ion / water / ligand site. This checks the
new_maskatoms againsttargets(default the non-protein components) withincutoff.- Parameters:
mol (
Molecule) – The spliced structure.new_mask (
numpy.ndarray) – Boolean mask overmolmarking the newly modelled atoms.cutoff (
float) – Heavy-atom distance (Angstrom) below which a pair is a clash.targets (
str) – Atom selection for the atoms the new residues must not clash with.
- Returns:
clashes –
{"new_chain", "new_resid", "target_resname", "target_resid", "target_segid", "min_distance"}, one per clashing new-residue / target pair, empty if clean.- Return type:
- moleculekit.tools.modelling.model_gaps(mol, sequence, segid, promod_img, minimize=False, build_sidechains=True, merge_distance=4)#
Closes residue gaps in a Molecule by sequence using ProMod3. Requires a ProMod3 Singularity image; see Notes.
This method will also mutate any residues in the Molecule that do not match the input sequence.
- Parameters:
mol (
Molecule) – The molecule containing the segment to model.sequence (
str) – The sequence to model.segid (
str) – The segment ID of the segment to model.promod_img (
str) – The path to the ProMod3 apptainer/singularity image. Follow the instructions at https://openstructure.org/promod3/3.4/container/singularity/ to obtain this image.minimize (
bool) – Whether to minimize the model after building it.build_sidechains (
bool) – Whether to build sidechains after building the model.merge_distance (
float) – The distance to merge fragments at.
- Returns:
modeled_segment – The modeled segment.
- Return type:
Notes
This function requires a ProMod3 Singularity / Apptainer image. Follow the instructions at https://openstructure.org/promod3/ to obtain the image, then pass the path to the downloaded
.siffile aspromod_img. The function executes the modelling script inside the container viasingularity exec, so Singularity or Apptainer must be available on$PATH.Examples
>>> from moleculekit.molecule import Molecule >>> from moleculekit.tools.modelling import model_gaps >>> mol = Molecule("5VQ6") >>> sequence = "HMTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHHYREQIKRVKDSEDVPMVLVGNKSDLPSRTVDTKQAQDLARSYGIPFIETSAKTRQGVDDAFYTLVREIRKHKEK" >>> res = model_gaps(mol, sequence, "0", "./promod.img")
- moleculekit.tools.modelling.prepareGapModellingInput(mol, sequences, gaps, outdir)#
Write the FASTA + gapped template PDB that aceboltz
gapmodelconsumes.- Parameters:
- Returns:
- moleculekit.tools.modelling.spliceMissingResidues(mol, donor, chain_map=None, graft_flanks=1, min_identity=0.95)#
Insert only the newly added residues from
donorintomol.All original atoms (protein + ligands/metals/cofactors) are kept at their deposited coordinates AND with their deposited residue numbering, except the
graft_flanksresidues on each side of a filled gap (see below). Each modelled chain is rebuilt as its original residues plus the residues present indonorbut absent from the original; each inserted residue is numbered to fall between its flanking original residues, using the natural integer gap where there is room and insertion codes otherwise.Each original protein chain is paired with the best-matching donor protein chain by sequence identity (labels are ignored), so donor chain/segid relabelling (e.g. aceboltz’s
model.pdb) does not need achain_map.- Parameters:
mol (
Molecule) – The original (gapped) structure.donor (
Molecule) – The structure supplying the missing residues (a different crystal form, a higher-resolution entry, or an aceboltzmodel.pdb).chain_map (
dict, optional) –{donor_label: original_chain}overrides for chains that auto-pairing would get wrong or leave unpaired; the donor label is resolved against donor chain ids, then segids. Auto-pairing fills in every chain not pinned here. DefaultNone(pure auto-pairing).min_identity (
float) – Minimum sequence identity (fraction of the original chain’s observed residues that match the donor) required to auto-pair an original chain to a donor chain. Original chains with no donor chain meeting this threshold are left unmodelled and reported via a warning.graft_flanks (
int) – Number of original residues on each side of an inserted run to also take fromdonor(default 1). A loop modeller rebuilds the backbone of the residues immediately flanking a gap so the new segment closes; keeping the original flanking residue instead would leave a stretched junction peptide bond, which downstream preparation reads as a chain break and caps. Grafting the flanking residues fromdonor(keeping their original numbering) restores a continuous backbone. Set to 0 to keep every original residue exactly.
- Returns:
spliced (
Molecule) –molwith the modelled residues inserted.new_mask (
numpy.ndarray) – Boolean mask oversplicedmarking the inserted atoms.