-
Notifications
You must be signed in to change notification settings - Fork 12
gufe: Network Planning Stage - make this part ready for new methods. #346
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
Open
RiesBen
wants to merge
14
commits into
main
Choose a base branch
from
FE_setup_Structure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8c59863
initial drafting
RiesBen c13f414
initial drafting
RiesBen c5839b7
Merge branch 'main' into FE_setup_Structure
RiesBen 2a243c8
minor improvements to the draft.
RiesBen 36cb409
Merge branch 'main' into FE_setup_Structure
RiesBen df4aff4
fix imports, so they are not api breaking.
RiesBen 3437e02
reverting alchemical_network file renaming. this will be part of a di…
RiesBen 232c228
moving alchemical generator and ChemicalSystem to other PR
RiesBen 054f2d0
moving alchemical generator and ChemicalSystem to other PR
RiesBen e697323
AtomMappingScorer is a child of ComponentMappingScorer
RiesBen 7656cf2
AtomMapper is a child of ComponentMapper
RiesBen 3863092
import fix.
RiesBen 711adfb
the component attributs are very general.
RiesBen 1d2e63d
Merge branch 'main' into FE_setup_Structure
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 was deleted.
Oops, something went wrong.
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
Empty file.
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,18 @@ | ||
|
|
||
| # Factory Classes | ||
| from .component_mapper import ComponentMapper | ||
| from .component_mapping_scorer import ComponentMappingScorer | ||
| from .network_planner import NetworkPlanner | ||
|
|
||
| # Result Types | ||
| from .component_mapping import ComponentMapping | ||
| from .network_plan import NetworkPlan | ||
|
|
||
|
|
||
| # RBFE Protocol: | ||
| from .atom_mapping_based.atom_mapping import AtomMapping | ||
| from .atom_mapping_based.atom_mapper import AtomMapper | ||
| from .atom_mapping_based.atom_mapping_scorer import AtomMappingScorer | ||
|
|
||
| from .atom_mapping_based.ligand_atom_mapping import LigandAtomMapping | ||
| from .atom_mapping_based.ligandnetwork import LigandNetwork |
Empty file.
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
43 changes: 43 additions & 0 deletions
43
gufe/setup/network_planning/atom_mapping_based/atom_mapping_scorer.py
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 ..component_mapping_scorer import ComponentMappingScorer | ||
| from .atom_mapping import AtomMapping | ||
|
|
||
|
|
||
| class AtomMappingScorer(ComponentMappingScorer): | ||
| """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 change - good score, a score close to zero indicates a large cost/change - bad score. | ||
|
|
||
| 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. | ||
|
|
||
| """ | ||
| raise NotImplementedError("This function was not implemented.") |
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,30 @@ | ||
| # This code is part of gufe and is licensed under the MIT license. | ||
| # For details, see https://github.com/OpenFreeEnergy/gufe | ||
| import abc | ||
| from collections.abc import Iterator | ||
| import gufe | ||
|
|
||
| from gufe.tokenization import GufeTokenizable | ||
| from .component_mapping import ComponentMapping | ||
|
|
||
|
|
||
| class ComponentMapper(GufeTokenizable): | ||
|
RiesBen marked this conversation as resolved.
|
||
| """A class for manufacturing mappings | ||
|
|
||
| Implementations of this class can require an arbitrary and non-standardised | ||
| number of input arguments to create. | ||
|
|
||
| Implementations of this class provide the :meth:`.suggest_mappings` method | ||
| """ | ||
|
|
||
| @abc.abstractmethod | ||
| def suggest_mappings(self, | ||
| A: gufe.Component, | ||
| B: gufe.Component | ||
| ) -> Iterator[ComponentMapping]: | ||
| """Suggests possible mappings between two Components | ||
|
|
||
| Suggests zero or more :class:`.AtomMapping` objects, which are possible | ||
| atom mappings between two :class:`.Component` objects. | ||
| """ | ||
| raise NotImplementedError("This function was not implemented.") | ||
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,36 @@ | ||
| # This code is part of kartograf and is licensed under the MIT license. | ||
| # For details, see https://github.com/OpenFreeEnergy/gufe | ||
|
|
||
| import abc | ||
| from gufe.tokenization import GufeTokenizable | ||
|
|
||
| from .component_mapping import ComponentMapping | ||
|
|
||
| class ComponentMappingScorer(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: ComponentMapping) -> float: | ||
| return self.get_score(mapping) | ||
|
|
||
| @abc.abstractmethod | ||
| def get_score(self, mapping: ComponentMapping) -> 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 change, a score close to zero indicates a large cost/change. | ||
| 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. | ||
| """ | ||
| raise NotImplementedError("This function was not implemented.") |
Oops, something went wrong.
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.