Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chilife/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# SpinLabel = SpinLabel.SpinLabel
# dSpinLabel = dSpinLabel.dSpinLabel

__version__ = '1.1.1'
__version__ = '1.1.2'
19 changes: 12 additions & 7 deletions src/chilife/protein_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def get_missing_residues(
protein: Union[MDAnalysis.Universe, MDAnalysis.AtomGroup],
ignore: Set[int] = None,
use_H: bool = False,
ignore_waters = True
) -> List:
"""Get a list of RotamerEnsemble objects corresponding to the residues of the provided protein that are missing
heavy atoms.
Expand Down Expand Up @@ -467,6 +468,7 @@ def get_missing_residues(
protein=protein,
chain=res.segid,
use_H=use_H,
ignore_waters=ignore_waters
)
)

Expand All @@ -478,6 +480,7 @@ def mutate(
*ensembles: 'RotamerEnsemble',
add_missing_atoms: bool = True,
rotamer_index: Union[int, str, None] = None,
ignore_waters = True
) -> MDAnalysis.Universe:
"""Create a new Universe where the native residue is replaced with the highest probability rotamer from a
RotamerEnsemble or SpinLabel object.
Expand All @@ -494,7 +497,8 @@ def mutate(
rotamer.
add_missing_atoms : bool
Model side chains missing atoms if they are not present in the provided structure.

ignore_waters : bool
ignore waters when selecting conforers for mutation.
Returns
-------
U : MDAnalysis.Universe
Expand Down Expand Up @@ -524,9 +528,7 @@ def mutate(
else:
use_H = False

missing_residues = get_missing_residues(
protein, ignore={res.site for res in ensembles}, use_H=use_H
)
missing_residues = get_missing_residues(protein, ignore={res.site for res in ensembles}, use_H=use_H, ignore_waters=ignore_waters)
ensembles = list(ensembles) + missing_residues

label_sites = {}
Expand All @@ -537,9 +539,12 @@ def mutate(
else:
label_sites[spin_label.site, spin_label.icode, spin_label.chain] = spin_label

protein = protein.select_atoms(
f'(not altloc B) and (not (byres name OH2 or resname HOH))'
)
# Remove waters if they are being ignored.
if ignore_waters:
protein = protein.select_atoms(f'(not altloc B) and (not (byres name OH2 or resname HOH))')
else:
protein = protein.select_atoms(f'(not altloc B)')

label_selstr = " or ".join([f"({label.selstr})" for label in ensembles])
other_atoms = protein.select_atoms(f"not ({label_selstr})")

Expand Down
Loading