-
Notifications
You must be signed in to change notification settings - Fork 13
Adding a generic atom mapping scorer #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d29027a
Adding a generic atom mapping scorer
RiesBen 4240960
This is a start for a generic ligand network planner.
RiesBen c6d6508
Update atom_mapping_scorer.py
RiesBen 6813c0a
Update ligand_network_planner.py
RiesBen 1e6658d
Update atom_mapping_scorer.py
RiesBen e4d4223
finalizing the setup interface for atom_mapping_scorer
RiesBen 6242eb1
adjusting catched error.
RiesBen 4af7656
pep formatting
RiesBen a024691
fix test
RiesBen be4b7d2
Update __init__.py
RiesBen ae66af5
Merge branch 'main' into adding_atom_mapping_scorer
RiesBen b3442bb
fix test
RiesBen a002cfb
Merge branch 'main' into adding_ligand_network_planner
IAlibay 24a1081
Update atom_mapping_scorer.py
RiesBen e1c021b
Merge branch 'adding_ligand_network_planner' into adding_atom_mapping…
RiesBen c0bae83
Merge branch 'main' into adding_atom_mapping_scorer
RiesBen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # This code is part of kartograf and is licensed under the MIT license. | ||
| # For details, see https://github.com/OpenFreeEnergy/gufe | ||
|
|
||
| import abc | ||
| from ..tokenization import GufeTokenizable | ||
|
|
||
| from . import AtomMapping | ||
|
|
||
|
|
||
| class AtomMappingScorer(GufeTokenizable): | ||
| """A generic class for scoring Atom mappings. | ||
| this class can be used for example to build graph algorithm based networks. | ||
|
|
||
| Implementations of this class can require an arbitrary and non-standardised | ||
| number of input arguments to create. | ||
|
|
||
| Implementations of this class provide the :meth:`.get_score` method | ||
|
|
||
| """ | ||
|
|
||
| def __call__(self, mapping: AtomMapping) -> float: | ||
| return self.get_score(mapping) | ||
|
|
||
| @abc.abstractmethod | ||
| def get_score(self, mapping: AtomMapping) -> float: | ||
| """ calculate the score for an :class:`.AtomMapping` | ||
| the scoring function returns a value between 0 and 1. | ||
| a value close to 1.0 indicates a small distance, a score close to zero indicates a large cost/error. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| mapping: AtomMapping | ||
| the mapping to be scored | ||
| args | ||
| kwargs | ||
|
|
||
| Returns | ||
| ------- | ||
| float | ||
| a value between [0,1] where zero is a very bad score and one a very good one. | ||
|
|
||
| """ | ||
| pass | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # This code is part of OpenFE and is licensed under the MIT license. | ||
| # For details, see https://github.com/OpenFreeEnergy/gufe | ||
|
|
||
| import pytest | ||
| from gufe import AtomMappingScorer, AtomMapper | ||
|
|
||
|
|
||
| def test_atom_mapping_scorer(): | ||
| with pytest.raises(TypeError, match="Can't instantiate abstract class AtomMappingScorer"): | ||
| scorer = AtomMappingScorer() | ||
|
|
||
|
|
||
| def test_atom_mapper(): | ||
| with pytest.raises(TypeError, match="Can't instantiate abstract class AtomMapper"): | ||
| mapper = AtomMapper() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.