diff --git a/openfe/setup/chemicalsystem_generator/easy_chemicalsystem_generator.py b/openfe/setup/chemicalsystem_generator/easy_chemicalsystem_generator.py index 2b5907dc8..36c03b15a 100644 --- a/openfe/setup/chemicalsystem_generator/easy_chemicalsystem_generator.py +++ b/openfe/setup/chemicalsystem_generator/easy_chemicalsystem_generator.py @@ -112,7 +112,7 @@ def __call__( RFEComponentLabels.PROTEIN: self.protein, } for i, c in enumerate(self.cofactors): - components.update({f'{RFEComponentLabels.COFACTOR}{i+1}': c}) + components.update({f'{RFEComponentLabels.COFACTOR.value}{i+1}': c}) if self.solvent is not None: components.update({RFEComponentLabels.SOLVENT: self.solvent}) chem_sys = ChemicalSystem( diff --git a/openfecli/tests/commands/test_plan_rbfe_network.py b/openfecli/tests/commands/test_plan_rbfe_network.py index 2fc4a9947..f05b6d047 100644 --- a/openfecli/tests/commands/test_plan_rbfe_network.py +++ b/openfecli/tests/commands/test_plan_rbfe_network.py @@ -2,7 +2,6 @@ import pytest from importlib import resources -import os import shutil from click.testing import CliRunner @@ -10,6 +9,9 @@ plan_rbfe_network, plan_rbfe_network_main, ) +from gufe import AlchemicalNetwork +from gufe.tokenization import JSON_HANDLER +import json @pytest.fixture(scope='session') @@ -148,6 +150,17 @@ def test_plan_rbfe_network_cofactors(eg5_files): print(result.output) assert result.exit_code == 0 + # make sure the cofactor is in the transformations + network = AlchemicalNetwork.from_dict( + json.load(open("alchemicalNetwork/alchemicalNetwork.json"), cls=JSON_HANDLER.decoder) + ) + for edge in network.edges: + if "protein" in edge.stateA.components: + assert "cofactor1" in edge.stateA.components + assert "cofactor1" in edge.stateB.components + else: + assert "cofactor1" not in edge.stateA.components + assert "cofactor1" not in edge.stateB.components @pytest.fixture