Skip to content

Commit

Permalink
finishing first pass of generator docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
atravitz committed Oct 25, 2024
1 parent d7a7481 commit 0ad0d9c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def __init__(
Parameters
----------
mapper: AtomMapper
the atom mapper is required, to define the connection between two ligands.
Defines the connection between two ligands.
scorer: AtomMappingScorer
scoring function evaluating an atom mapping, and giving a score between [0,1].
n_processes: int
number of processes used to build the ligand network
number of processes to use to build the ligand network
progress: bool, optional
if true a progress bar will be displayed. (default: False)
"""
Expand All @@ -48,7 +48,7 @@ def generate_ligand_network(
"""
Create a network with pre-defined edges.
This class is can be used as initial_edge_lister
This can be used as initial_edge_lister
Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ def __init__(
n_processes: int = 1,
):
"""
The `MaximalNetworkGenerator` builds for given set of `Component` s a fully connected graph under the assumption each `Component` can be connected to another.
The `Transformation` s of this graph are realized as `AtomMapping` s of pairwise `Component` s. If not all mappings can be created, it will ignore the mapping failure, and return a nearly fully connected graph.
The `MaximalNetworkGenerator` builds a fully connected graph for given set of `Component` s.
It assumes each `Component` can be connected to every other `Component`.
The `Transformation` s of this graph are realized as `AtomMapping` s of pairwise `Component` s.
If not all mappings can be created, it will ignore the mapping failure and return a nearly fully connected graph.
Note: This approach is not very suitable for Free Energy calculations in application cases. However, this approach is very important, as all above approaches use this as an initial solution, they filter down to gain the desired design.
Note: This approach is not very suitable for Free Energy calculations in application cases.
However, this approach is very important, as all other approaches use the Maximal Network as an initial solution,
then remove edges to achieve the desired design.
This class is recommended as initial_edge_lister for other approaches.
> **Note**: the `MaximalNetworkGenerator` is parallelized and the number of CPUs can be given with `n_processes`.
This class is recommended as an `initial_edge_lister` for other approaches.
> **Note**: the `MaximalNetworkGenerator` is parallelized and the number of CPUs can be given with `n_processes`.
> All other approaches in Konnektor benefit from this parallelization and you can use this parallelization with `n_processes` key word during class construction.
Parameters
Expand Down Expand Up @@ -58,7 +61,7 @@ def generate_ligand_network(self, components: Iterable[Component]) -> LigandNetw
This will attempt to create (and optionally score) all possible mappings
(up to $N(N-1)/2$ for each mapper given). There may be fewer actual
mappings that this because, when a mapper cannot return a mapping for a
mappings than this, because when a mapper cannot return a mapping for a
given pair, there is simply no suggested mapping for that pair.
This network is typically used as the starting point for other network
generators (which then optimize based on the scores) or to debug atom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ def __init__(
_initial_edge_lister: NetworkGenerator = None,
):
"""
The `MinimalSpanningTreeNetworkGenerator`, builds an minimal spanning tree (MST) network for a given set of `Component` s. The `Transformation` s of the Network,
are represented by an `AtomMapping` s, which are scored by a `AtomMappingScorer`.
The `MinimalSpanningTreeNetworkGenerator`, builds an minimal spanning tree (MST) network for a given set of `Component` s.\
The `Transformation` s of the Network are represented by an `AtomMapping` s, which are scored by a `AtomMappingScorer`.
For the MST algorithm the Kruskal Algorithm is used.
For the MST algorithm, the Kruskal Algorithm is used.
The MST algorithm gives the optimal graph score possible and the minimal required set of `Transformations`.
This makes the MST Network very efficient. However, the MST is not very robust, in case of one failing `Transformation`, the Network is immediatly disconnected.
This makes the MST Network very efficient. However, the MST is not very robust, in case of one failing
`Transformation`, the Network is immediatly disconnected.
The disconnectivity will translate to a loss of `Component` s in the final FE Network.
Parameters
Expand All @@ -41,7 +42,8 @@ def __init__(
if true a progress bar will be displayed. (default: False)
_initial_edge_lister: NetworkPlanner, optional
this NetworkPlanner is used to give the initial set of edges. For standard usage, the Maximal NetworPlanner is used.
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner.. (default: MaximalNetworkPlanner)
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner.
(default: MaximalNetworkPlanner)
"""
if _initial_edge_lister is None:
_initial_edge_lister = MaximalNetworkGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def __init__(
"""
The N-Node Edges Network tries to add more redundancy to the MST Network and tries to improve the robustness.
The algorithm first build a MST Network.
After this it will add best score performing `Transformations` in order to guarantee a 'Component' connectivity of `target_node_connectivity`.
The algorithm first build a MST Network. Then it will add best score performing `Transformations`
to guarantee a 'Component' connectivity of `target_node_connectivity`.
Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ def __init__(
_initial_edge_lister: NetworkGenerator = None,
):
"""
The `RedundantMinimalSpanningTreeNetworkGenerator` is an approach, that tries to increase the robustness over `Transformation` failures in an MST like network.
The `RedundantMinimalSpanningTreeNetworkGenerator` is an approach that tries to increase
robustness to `Transformation` failures in an MST-like network.
The algorithm executes the MST algorithm `n_redundancy` times, always removes already selected `Transformations` in each iteration, and finally builds the overlay of all the newtorks.
This is constructing the Redundant MST Network.
This algorithm executes the MST algorithm `n_redundancy` times, always removing
already-selected`Transformations` in each iteration, and finally builds the overlay of all the newtorks.
This is constructs the Redundant MST Network.
In this way the number of edges is increased, but also the network is less vulnerable to `Transformation` failures.
In this way, the number of edges is increased, but the network is also less vulnerable to `Transformation` failures.
Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ def __init__(
_initial_edge_lister: NetworkGenerator = None,
):
"""
The Star Network is one of the most edge efficient layouts, it basically places all `Transformations` around one central `Component`.
The Star Network is one of the most edge efficient layouts, it basically places
all `Transformations` around one central `Component`.
The algorithm constructs in a first step all possilbe `Transformations`.
The algorithm constructs in a first step all possible `Transformations`.
Next it selects in the default variant the in average best transformation score performing `Component` as the central component.
Finally all Components are connected with a `Transformation` to the central `Component`
The Star Netwrok is most edge efficient, but not most graph score efficient, as it has to find a central `Component`, which usually is a compromise for all 'Component's.
The Star Netwrok is most edge efficient, but not most graph score efficient, as it has to find a
central `Component`, which usually is a compromise for all 'Component's.
From a robustness point of view, the Star Network, will immediatly be disconnected if one `Transformation` fails.
However the loss of `Component` s is very limited, as only one ligand is lost per `Transformation` failure.
Expand All @@ -44,7 +46,8 @@ def __init__(
if true a progress bar will be displayed. (default: False)
_initial_edge_lister: NetworkPlanner, optional
this NetworkPlanner is used to give the initial set of edges. For standard usage, the Maximal NetworPlanner is used.
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner.. (default: MaximalNetworkPlanner)
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner..
(default: MaximalNetworkPlanner)
"""
if _initial_edge_lister is None:
_initial_edge_lister = MaximalNetworkGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ def __init__(
_initial_edge_lister: NetworkGenerator = None,
):
"""
The Twin Star Network is an expansion to the Star Network. It can be described as multiple star networks, that are overlayed.
The algorithm is first calculating all possible `Transformation` s for all `Component` s.
Next the in average `n_centers` (default: 2) best performing `Component` s over all transfromation scores are selected and placed into the center of the network.
Finally all components are connected to the selected centers, resulting in $n_{Transformations} = n_{centers}*(n_{Componentes}-n_{centers})$
This approach has in the default version the doubled number of `Transformations` compared to the Star Network and therefore also has an increase graph cost.
However on the plus side, this approach builds a lot graph cycles, which could be used to estimate the uncertainty of FE calculations.
Another important aspect is that the node connectivity is centralized around the `n_centers`. This means,
that the selection of the central ligands is very important, as they have a large impact on the `Transformations`.
The Twin Star Network is an expansion to the Star Network. It can be described as multiple star networks that are overlayed.
The algorithm first calculates all possible `Transformation` s for all `Component` s.
Next, the in average `n_centers` (default: 2) best performing `Component` s over all
transfromation scores are selected and placed into the center of the network.
Finally all components are connected to the selected centers, resulting
in $n_{Transformations} = n_{centers}*(n_{Componentes}-n_{centers})$
This approach has, in the default version, double the number of `Transformations`
compared to the Star Network, and therefore also an increased graph cost.
On the plus side, this approach builds many graph cycles, which could be used to estimate the uncertainty of FE calculations.
Another important aspect is that the node connectivity is centralized around the `n_centers`
This means that the selection of the central ligands is very important, as they have a large
impact on the `Transformations`.
The `n_centers` option allows you to change the Twin Star to a Triplet Star Network or more.
Parameters
Expand All @@ -47,7 +51,8 @@ def __init__(
if true a progress bar will be displayed. (default: False)
_initial_edge_lister: NetworkPlanner, optional
this NetworkPlanner is used to give the initial set of edges. For standard usage, the Maximal NetworPlanner is used.
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner.. (default: MaximalNetworkPlanner)
However in large scale approaches, it might be interesting to use the heuristicMaximalNetworkPlanner..
(default: MaximalNetworkPlanner)
"""
if _initial_edge_lister is None:
_initial_edge_lister = MaximalNetworkGenerator(
Expand Down

0 comments on commit 0ad0d9c

Please sign in to comment.