Skip to content

Commit

Permalink
Tests for capped AAs (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijpulidos authored Oct 21, 2024
1 parent 90d49a8 commit 4d52587
Show file tree
Hide file tree
Showing 11 changed files with 387 additions and 39 deletions.
38 changes: 24 additions & 14 deletions feflow/mapping/protein_mutation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Module with mapping objects that are useful for the protein mutation protocol.
"""

import re
from gufe import ProteinComponent
from gufe.mapping import AtomMapping
Expand All @@ -17,17 +18,18 @@ class ProteinMutationMapping(AtomMapping):
:class:`.ProteinComponent` which stores the mapping as a dict of
integers.
"""

componentA: ProteinComponent
componentB: ProteinComponent
_mutation_spec: re.Match[regex_mut_str]
_compA_to_compB: dict[int, int]

def __init__(
self,
componentA: ProteinComponent,
componentB: ProteinComponent,
componentA_to_componentB: dict[int, int],
mutation_spec: re.Match[regex_mut_str],
self,
componentA: ProteinComponent,
componentB: ProteinComponent,
componentA_to_componentB: dict[int, int],
mutation_spec: re.Match[regex_mut_str],
):
"""
Parameters
Expand All @@ -50,11 +52,13 @@ def __init__(
nB = self.componentB.to_openmm_topology().getNumAtoms()
for i, j in componentA_to_componentB.items():
if not (0 <= i < nA):
raise ValueError(f"Got invalid index for ComponentA ({i}); "
f"must be 0 <= n < {nA}")
raise ValueError(
f"Got invalid index for ComponentA ({i}); " f"must be 0 <= n < {nA}"
)
if not (0 <= j < nB):
raise ValueError(f"Got invalid index for ComponentB ({i}); "
f"must be 0 <= n < {nB}")
raise ValueError(
f"Got invalid index for ComponentB ({i}); " f"must be 0 <= n < {nB}"
)

self._compA_to_compB = componentA_to_componentB
self._mutation_spec = mutation_spec
Expand All @@ -69,13 +73,19 @@ def componentB_to_componentA(self) -> dict[int, int]:

@property
def componentA_unique(self):
return (i for i in range(self.componentA.to_openmm_topology().getNumAtoms())
if i not in self._compA_to_compB)
return (
i
for i in range(self.componentA.to_openmm_topology().getNumAtoms())
if i not in self._compA_to_compB
)

@property
def componentB_unique(self):
return (i for i in range(self.componentB.to_openmm_topology().getNumAtoms())
if i not in self._compA_to_compB.values())
return (
i
for i in range(self.componentB.to_openmm_topology().getNumAtoms())
if i not in self._compA_to_compB.values()
)

@property
def mutation_spec(self):
Expand Down Expand Up @@ -106,4 +116,4 @@ def _from_dict(cls, dct: dict):
componentB=dct["componentB"],
componentA_to_componentB=fixed,
mutation_spec=dct["mutation_spec"],
)
)
1 change: 1 addition & 0 deletions feflow/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
NonEquilibriumCyclingProtocol,
NonEquilibriumCyclingProtocolResult,
)
from .protein_mutation import ProteinMutationProtocol
25 changes: 3 additions & 22 deletions feflow/protocols/protein_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,9 @@
Implementation of protein mutation protocol based on Nonequilibrium Cycling, using OpenMM as
MD engine.
"""
from typing import Dict, Any

from gufe import ChemicalSystem, Context, ProtocolUnit, AtomMapping
from gufe.protocols import Protocol


class SetupUnit(ProtocolUnit):
"""
Initial unit of the protocol. Creates a hybrid topology for the protein mutation and
generates the OpenMM.
"""
def _execute(ctx: Context, *, state_a: ChemicalSystem, state_b: ChemicalSystem, mapping: AtomMapping, **inputs) -> Dict[str, Any]:
"""
Parameters
----------
state_a
state_b
mapping
inputs
Returns
-------
"""
return NotImplementedError
class ProteinMutationProtocol(Protocol):
pass
2 changes: 1 addition & 1 deletion feflow/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def benzene_modifications(gufe_data_dir):
# Components fixtures


@pytest.fixture
@pytest.fixture(scope="session")
def solvent_comp():
yield gufe.SolventComponent(positive_ion="Na", negative_ion="Cl")

Expand Down
39 changes: 39 additions & 0 deletions feflow/tests/data/capped_AAs/ALA_capped.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
REMARK 1 CREATED WITH OPENMM 7.7, 2022-08-08
HETATM 1 H1 ACE 1 1 1.328 2.173 -0.000 1.00 0.00 H
HETATM 2 CH3 ACE 1 1 2.006 1.318 -0.000 1.00 0.00 C
HETATM 3 H2 ACE 1 1 2.634 1.352 0.890 1.00 0.00 H
HETATM 4 H3 ACE 1 1 2.634 1.352 -0.890 1.00 0.00 H
HETATM 5 C ACE 1 1 1.229 0.000 0.000 1.00 0.00 C
HETATM 6 O ACE 1 1 0.000 0.000 0.000 1.00 0.00 O
ATOM 7 N ALA 1 2 1.954 -1.121 -0.000 1.00 0.00 N
ATOM 8 H ALA 1 2 2.963 -1.070 -0.000 1.00 0.00 H
ATOM 9 CA ALA 1 2 1.337 -2.432 -0.001 1.00 0.00 C
ATOM 10 HA ALA 1 2 0.717 -2.542 -0.891 1.00 0.00 H
ATOM 11 CB ALA 1 2 2.391 -3.535 -0.001 1.00 0.00 C
ATOM 12 HB1 ALA 1 2 3.014 -3.443 0.889 1.00 0.00 H
ATOM 13 HB2 ALA 1 2 1.899 -4.507 -0.001 1.00 0.00 H
ATOM 14 HB3 ALA 1 2 3.014 -3.442 -0.891 1.00 0.00 H
ATOM 15 C ALA 1 2 0.461 -2.626 1.229 1.00 0.00 C
ATOM 16 O ALA 1 2 -0.621 -3.201 1.139 1.00 0.00 O
HETATM 17 N NME 1 3 0.933 -2.143 2.381 1.00 0.00 N
HETATM 18 H NME 1 3 1.829 -1.678 2.404 1.00 0.00 H
HETATM 19 C NME 1 3 0.194 -2.264 3.621 1.00 0.00 C
HETATM 20 H1 NME 1 3 -0.745 -2.786 3.436 1.00 0.00 H
HETATM 21 H2 NME 1 3 0.786 -2.827 4.344 1.00 0.00 H
HETATM 22 H3 NME 1 3 -0.014 -1.271 4.019 1.00 0.00 H
TER 23 NME 1 3
CONECT 1 2
CONECT 2 3 4 1 5
CONECT 3 2
CONECT 4 2
CONECT 5 6 7 2
CONECT 6 5
CONECT 7 5
CONECT 15 17
CONECT 17 18 15 19
CONECT 18 17
CONECT 19 20 21 22 17
CONECT 20 19
CONECT 21 19
CONECT 22 19
END
42 changes: 42 additions & 0 deletions feflow/tests/data/capped_AAs/ASP_capped.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
REMARK 1 CREATED WITH OPENMM 8.1.1, 2024-09-07
CRYST1 21.573 21.573 21.573 90.00 90.00 90.00 P 1 1
HETATM 1 C ACE A 1 -0.422 0.355 0.335 1.00 0.00 C
HETATM 2 O ACE A 1 -1.381 0.231 -0.410 1.00 0.00 O
HETATM 3 CH3 ACE A 1 -0.620 0.215 1.832 1.00 0.00 C
HETATM 4 H1 ACE A 1 -0.357 1.152 2.323 1.00 0.00 H
HETATM 5 H2 ACE A 1 -0.005 -0.601 2.210 1.00 0.00 H
HETATM 6 H3 ACE A 1 -1.670 -0.008 2.024 1.00 0.00 H
ATOM 7 N ASP A 2 0.787 0.621 -0.157 1.00 0.00 N
ATOM 8 H ASP A 2 0.859 0.517 -1.158 1.00 0.00 H
ATOM 9 CA ASP A 2 2.047 0.800 0.570 1.00 0.00 C
ATOM 10 HA ASP A 2 1.844 1.218 1.554 1.00 0.00 H
ATOM 11 CB ASP A 2 2.721 -0.570 0.745 1.00 0.00 C
ATOM 12 HB2 ASP A 2 2.848 -0.711 1.820 1.00 0.00 H
ATOM 13 HB3 ASP A 2 3.733 -0.505 0.342 1.00 0.00 H
ATOM 14 C ASP A 2 2.979 1.781 -0.171 1.00 0.00 C
ATOM 15 O ASP A 2 2.852 1.973 -1.378 1.00 0.00 O
ATOM 16 CG ASP A 2 2.114 -1.877 0.199 1.00 0.00 C
ATOM 17 OD1 ASP A 2 1.032 -1.872 -0.434 1.00 0.00 O
ATOM 18 OD2 ASP A 2 2.778 -2.921 0.392 1.00 0.00 O
HETATM 19 N NME A 3 3.929 2.385 0.555 1.00 0.00 N
HETATM 20 H NME A 3 3.986 2.172 1.540 1.00 0.00 H
HETATM 21 C NME A 3 4.899 3.328 0.000 1.00 0.00 C
HETATM 22 H1 NME A 3 5.524 2.821 -0.736 1.00 0.00 H
HETATM 23 H2 NME A 3 5.531 3.733 0.790 1.00 0.00 H
HETATM 24 H3 NME A 3 4.376 4.145 -0.497 1.00 0.00 H
TER 25 NME A 3
CONECT 1 3 2 7
CONECT 2 1
CONECT 3 1 4 5 6
CONECT 4 3
CONECT 5 3
CONECT 6 3
CONECT 7 1
CONECT 14 19
CONECT 19 14 21 20
CONECT 20 19
CONECT 21 22 23 24 19
CONECT 22 21
CONECT 23 21
CONECT 24 21
END
36 changes: 36 additions & 0 deletions feflow/tests/data/capped_AAs/GLY_capped.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
REMARK 1 CREATED WITH OPENMM 8.1.1, 2024-09-26
HETATM 1 H1 ACE A 1 1.328 2.173 0.000 1.00 0.00 H
HETATM 2 CH3 ACE A 1 2.006 1.318 0.000 1.00 0.00 C
HETATM 3 H2 ACE A 1 2.634 1.352 0.890 1.00 0.00 H
HETATM 4 H3 ACE A 1 2.634 1.352 -0.890 1.00 0.00 H
HETATM 5 C ACE A 1 1.229 0.000 0.000 1.00 0.00 C
HETATM 6 O ACE A 1 0.000 0.000 0.000 1.00 0.00 O
ATOM 7 N GLY A 2 1.954 -1.121 0.000 1.00 0.00 N
ATOM 8 H GLY A 2 3.108 -1.173 -0.285 1.00 0.00 H
ATOM 9 CA GLY A 2 1.337 -2.432 -0.001 1.00 0.00 C
ATOM 10 HA2 GLY A 2 2.093 -3.358 0.013 1.00 0.00 H
ATOM 11 HA3 GLY A 2 0.710 -2.575 -1.009 1.00 0.00 H
ATOM 12 C GLY A 2 0.461 -2.626 1.229 1.00 0.00 C
ATOM 13 O GLY A 2 -0.621 -3.201 1.139 1.00 0.00 O
HETATM 14 N NME A 3 0.933 -2.143 2.381 1.00 0.00 N
HETATM 15 H NME A 3 1.829 -1.678 2.404 1.00 0.00 H
HETATM 16 C NME A 3 0.194 -2.264 3.621 1.00 0.00 C
HETATM 17 H1 NME A 3 -0.745 -2.786 3.436 1.00 0.00 H
HETATM 18 H2 NME A 3 0.786 -2.827 4.344 1.00 0.00 H
HETATM 19 H3 NME A 3 -0.014 -1.271 4.019 1.00 0.00 H
TER 20 NME A 3
CONECT 1 2
CONECT 2 5 1 3 4
CONECT 3 2
CONECT 4 2
CONECT 5 2 6 7
CONECT 6 5
CONECT 7 5
CONECT 12 14
CONECT 14 12 16 15
CONECT 15 14
CONECT 16 17 18 19 14
CONECT 17 16
CONECT 18 16
CONECT 19 16
END
49 changes: 49 additions & 0 deletions feflow/tests/data/capped_AAs/LEU_capped.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
REMARK 1 CREATED WITH OPENMM 8.1.1, 2024-09-26
CRYST1 21.573 21.573 21.573 90.00 90.00 90.00 P 1 1
HETATM 1 C ACE A 1 -0.422 0.355 0.335 1.00 0.00 C
HETATM 2 O ACE A 1 -1.381 0.231 -0.410 1.00 0.00 O
HETATM 3 CH3 ACE A 1 -0.620 0.215 1.832 1.00 0.00 C
HETATM 4 H1 ACE A 1 -0.357 1.152 2.323 1.00 0.00 H
HETATM 5 H2 ACE A 1 -0.005 -0.601 2.210 1.00 0.00 H
HETATM 6 H3 ACE A 1 -1.670 -0.008 2.024 1.00 0.00 H
ATOM 7 N LEU A 2 0.787 0.621 -0.157 1.00 0.00 N
ATOM 8 H LEU A 2 0.585 1.302 -1.114 1.00 0.00 H
ATOM 9 CA LEU A 2 2.047 0.800 0.570 1.00 0.00 C
ATOM 10 HA LEU A 2 1.872 1.402 1.585 1.00 0.00 H
ATOM 11 CB LEU A 2 2.721 -0.570 0.745 1.00 0.00 C
ATOM 12 HB2 LEU A 2 2.896 -0.707 1.921 1.00 0.00 H
ATOM 13 HB3 LEU A 2 3.802 -0.518 0.236 1.00 0.00 H
ATOM 14 C LEU A 2 2.979 1.781 -0.171 1.00 0.00 C
ATOM 15 O LEU A 2 2.852 1.973 -1.378 1.00 0.00 O
ATOM 16 CG LEU A 2 2.114 -1.877 0.199 1.00 0.00 C
ATOM 17 HG LEU A 2 1.155 -2.230 0.816 1.00 0.00 H
ATOM 18 CD1 LEU A 2 3.027 -3.075 0.432 1.00 0.00 C
ATOM 19 HD11 LEU A 2 3.670 -3.474 -0.502 1.00 0.00 H
ATOM 20 HD12 LEU A 2 3.864 -2.952 1.286 1.00 0.00 H
ATOM 21 HD13 LEU A 2 2.416 -4.046 0.795 1.00 0.00 H
ATOM 22 CD2 LEU A 2 1.603 -1.815 -1.240 1.00 0.00 C
ATOM 23 HD21 LEU A 2 0.588 -1.372 -1.700 1.00 0.00 H
ATOM 24 HD22 LEU A 2 2.443 -1.412 -1.995 1.00 0.00 H
ATOM 25 HD23 LEU A 2 1.412 -2.946 -1.601 1.00 0.00 H
HETATM 26 N NME A 3 3.929 2.385 0.555 1.00 0.00 N
HETATM 27 H NME A 3 3.986 2.172 1.540 1.00 0.00 H
HETATM 28 C NME A 3 4.899 3.328 0.000 1.00 0.00 C
HETATM 29 H1 NME A 3 5.524 2.821 -0.736 1.00 0.00 H
HETATM 30 H2 NME A 3 5.531 3.733 0.790 1.00 0.00 H
HETATM 31 H3 NME A 3 4.376 4.145 -0.497 1.00 0.00 H
TER 32 NME A 3
CONECT 1 3 2 7
CONECT 2 1
CONECT 3 1 4 5 6
CONECT 4 3
CONECT 5 3
CONECT 6 3
CONECT 7 1
CONECT 14 26
CONECT 26 14 28 27
CONECT 27 26
CONECT 28 29 30 31 26
CONECT 29 28
CONECT 30 28
CONECT 31 28
END
Loading

0 comments on commit 4d52587

Please sign in to comment.