From 5fba8239960e94add6039422bc1027a17daaa39a Mon Sep 17 00:00:00 2001 From: Maxx Tessmer Date: Thu, 13 Feb 2025 15:00:52 -0800 Subject: [PATCH 1/3] Bump version Bump version in preparation for new feature --- src/chilife/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chilife/__init__.py b/src/chilife/__init__.py index 1c8d887..518ea62 100644 --- a/src/chilife/__init__.py +++ b/src/chilife/__init__.py @@ -26,4 +26,4 @@ # SpinLabel = SpinLabel.SpinLabel # dSpinLabel = dSpinLabel.dSpinLabel -__version__ = '1.1.1' +__version__ = '1.1.2' From 175115e094cc87b4614160c40ce7475f920a78cc Mon Sep 17 00:00:00 2001 From: Maxx Tessmer Date: Thu, 13 Feb 2025 15:08:05 -0800 Subject: [PATCH 2/3] Add ignore_waters option to mutate. --- src/chilife/protein_utils.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/chilife/protein_utils.py b/src/chilife/protein_utils.py index 50dd882..592b07d 100644 --- a/src/chilife/protein_utils.py +++ b/src/chilife/protein_utils.py @@ -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. @@ -467,6 +468,7 @@ def get_missing_residues( protein=protein, chain=res.segid, use_H=use_H, + ignore_waters=ignore_waters ) ) @@ -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. @@ -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 @@ -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 = {} @@ -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})") From 0c4fcc86c66df5b30286d4dbc91af46ab56f1c48 Mon Sep 17 00:00:00 2001 From: Maxx Tessmer Date: Thu, 13 Feb 2025 15:12:38 -0800 Subject: [PATCH 3/3] Add missing quote --- src/chilife/protein_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chilife/protein_utils.py b/src/chilife/protein_utils.py index 592b07d..fa6c67d 100644 --- a/src/chilife/protein_utils.py +++ b/src/chilife/protein_utils.py @@ -543,7 +543,7 @@ def mutate( 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)) + 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})")