Skip to content

Commit

Permalink
fixing mapper/s to avoid api break
Browse files Browse the repository at this point in the history
  • Loading branch information
atravitz committed Nov 15, 2024
1 parent 7f0cfe1 commit 144d345
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions openfe/setup/ligand_network_planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def generate_minimal_redundant_network(

def generate_network_from_names(
ligands: list[SmallMoleculeComponent],
mappers: Union[AtomMapper, Iterable[AtomMapper]],
mapper: AtomMapper,
names: list[tuple[str, str]],
) -> LigandNetwork:
"""
Expand Down Expand Up @@ -344,7 +344,7 @@ def generate_network_from_names(
"""
nodes = list(ligands)

network_planner = ExplicitNetworkGenerator(mappers=mappers, scorer=None)
network_planner = ExplicitNetworkGenerator(mappers=mapper, scorer=None)

network = network_planner.generate_network_from_names(
ligands=nodes, names=names
Expand All @@ -355,7 +355,7 @@ def generate_network_from_names(

def generate_network_from_indices(
ligands: list[SmallMoleculeComponent],
mappers: Union[AtomMapper, Iterable[AtomMapper]],
mapper: AtomMapper,
indices: list[tuple[int, int]],
) -> LigandNetwork:
"""
Expand Down Expand Up @@ -383,7 +383,7 @@ def generate_network_from_indices(
"""
nodes = list(ligands)

network_planner = ExplicitNetworkGenerator(mappers=mappers, scorer=None)
network_planner = ExplicitNetworkGenerator(mappers=mapper, scorer=None)
network = network_planner.generate_network_from_indices(
ligands=nodes, indices=indices
)
Expand All @@ -392,7 +392,7 @@ def generate_network_from_indices(

def load_orion_network(
ligands: list[SmallMoleculeComponent],
mappers: Union[AtomMapper, Iterable[AtomMapper]],
mapper: AtomMapper,
network_file: Union[str, Path],
) -> LigandNetwork:
"""Load a :class:`.LigandNetwork` from an Orion NES network file.
Expand Down Expand Up @@ -431,7 +431,7 @@ def load_orion_network(

names.append((entry[0], entry[2]))

network_planner = ExplicitNetworkGenerator(mappers=mappers, scorer=None)
network_planner = ExplicitNetworkGenerator(mappers=mapper, scorer=None)
network = network_planner.generate_network_from_names(
ligands=ligands, names=names
)
Expand All @@ -441,7 +441,7 @@ def load_orion_network(

def load_fepplus_network(
ligands: list[SmallMoleculeComponent],
mappers: Union[AtomMapper, Iterable[AtomMapper]],
mapper: AtomMapper,
network_file: Union[str, Path],
) -> LigandNetwork:
"""Load a :class:`.LigandNetwork` from an FEP+ edges network file.
Expand Down Expand Up @@ -480,7 +480,7 @@ def load_fepplus_network(

names.append((entry[2], entry[4]))

network_planner = ExplicitNetworkGenerator(mappers=mappers, scorer=None)
network_planner = ExplicitNetworkGenerator(mappers=mapper, scorer=None)
network = network_planner.generate_network_from_names(
ligands=ligands, names=names
)
Expand Down
20 changes: 10 additions & 10 deletions openfe/tests/setup/test_network_planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def test_network_from_names(atom_mapping_basic_test_files, lomap_old_mapper):
network = openfe.setup.ligand_network_planning.generate_network_from_names(
ligands=ligs,
names=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)

assert len(network.nodes) == len(ligs)
Expand All @@ -464,7 +464,7 @@ def test_network_from_names_bad_name(
_ = openfe.setup.ligand_network_planning.generate_network_from_names(
ligands=ligs,
names=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)


Expand All @@ -483,7 +483,7 @@ def test_network_from_names_duplicate_name(
_ = openfe.setup.ligand_network_planning.generate_network_from_names(
ligands=ligs,
names=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)


Expand All @@ -497,7 +497,7 @@ def test_network_from_indices(
network = openfe.setup.ligand_network_planning.generate_network_from_indices(
ligands=ligs,
indices=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)

assert len(network.nodes) == len(ligs)
Expand All @@ -522,7 +522,7 @@ def test_network_from_indices_indexerror(
network = openfe.setup.ligand_network_planning.generate_network_from_indices(
ligands=ligs,
indices=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)


Expand All @@ -536,7 +536,7 @@ def test_network_from_indices_disconnected_warning(
_ = openfe.setup.ligand_network_planning.generate_network_from_indices(
ligands=ligs,
indices=requested,
mappers=lomap_old_mapper,
mapper=lomap_old_mapper,
)


Expand All @@ -553,7 +553,7 @@ def test_network_from_external(file_fixture, loader, request,

network = loader(
ligands=[l for l in benzene_modifications.values()],
mappers=openfe.LomapAtomMapper(),
mapper=openfe.LomapAtomMapper(),
network_file=network_file,
)

Expand Down Expand Up @@ -589,7 +589,7 @@ def test_network_from_external_unknown_edge(file_fixture, loader, request,
with pytest.raises(KeyError, match="Invalid name"):
network = loader(
ligands=ligs,
mappers=openfe.LomapAtomMapper(),
mapper=openfe.LomapAtomMapper(),
network_file=network_file,
)

Expand All @@ -614,7 +614,7 @@ def test_bad_orion_network(benzene_modifications, tmpdir):
with pytest.raises(KeyError, match="line does not match"):
network = openfe.setup.ligand_network_planning.load_orion_network(
ligands=[l for l in benzene_modifications.values()],
mappers=openfe.LomapAtomMapper(),
mapper=openfe.LomapAtomMapper(),
network_file='bad_orion_net.dat',
)

Expand All @@ -637,6 +637,6 @@ def test_bad_edges_network(benzene_modifications, tmpdir):
with pytest.raises(KeyError, match="line does not match"):
network = openfe.setup.ligand_network_planning.load_fepplus_network(
ligands=[l for l in benzene_modifications.values()],
mappers=openfe.LomapAtomMapper(),
mapper=openfe.LomapAtomMapper(),
network_file='bad_edges.edges',
)

0 comments on commit 144d345

Please sign in to comment.