konnektor 0.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- konnektor-0.0.0/LICENSE +21 -0
- konnektor-0.0.0/PKG-INFO +23 -0
- konnektor-0.0.0/README.md +10 -0
- konnektor-0.0.0/pyproject.toml +50 -0
- konnektor-0.0.0/setup.cfg +4 -0
- konnektor-0.0.0/src/konnektor/__init__.py +4 -0
- konnektor-0.0.0/src/konnektor/_version.py +1 -0
- konnektor-0.0.0/src/konnektor/mst_networker.py +55 -0
- konnektor-0.0.0/src/konnektor/radial_networker.py +76 -0
- konnektor-0.0.0/src/konnektor.egg-info/PKG-INFO +23 -0
- konnektor-0.0.0/src/konnektor.egg-info/SOURCES.txt +12 -0
- konnektor-0.0.0/src/konnektor.egg-info/dependency_links.txt +1 -0
- konnektor-0.0.0/src/konnektor.egg-info/requires.txt +4 -0
- konnektor-0.0.0/src/konnektor.egg-info/top_level.txt +1 -0
konnektor-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Open Free Energy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
konnektor-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: konnektor
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Konnektor is a package for calculating networks.
|
|
5
|
+
Author-email: Benjamin Ries <benjamin-ries@outlook.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/OpenFreeEnergy/konnektor
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
|
|
14
|
+
[](https://openfree.energy/)
|
|
15
|
+
[](https://github.com/OpenFreeEnergy/konnektor/actions/workflows/ci.yaml)
|
|
16
|
+
[](https://codecov.io/gh/OpenFreeEnergy/konnektor)
|
|
17
|
+
[](https://konnektor.readthedocs.io/en/latest/?badge=latest)
|
|
18
|
+
|
|
19
|
+
# Konnektor: The tools for mapping your FE calcuations
|
|
20
|
+
|
|
21
|
+
Konnektor offers at the moment basic network planers.
|
|
22
|
+
|
|
23
|
+
More will be here soon!
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[](https://openfree.energy/)
|
|
2
|
+
[](https://github.com/OpenFreeEnergy/konnektor/actions/workflows/ci.yaml)
|
|
3
|
+
[](https://codecov.io/gh/OpenFreeEnergy/konnektor)
|
|
4
|
+
[](https://konnektor.readthedocs.io/en/latest/?badge=latest)
|
|
5
|
+
|
|
6
|
+
# Konnektor: The tools for mapping your FE calcuations
|
|
7
|
+
|
|
8
|
+
Konnektor offers at the moment basic network planers.
|
|
9
|
+
|
|
10
|
+
More will be here soon!
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires=[
|
|
3
|
+
"setuptools>=61.0",
|
|
4
|
+
"versioningit",
|
|
5
|
+
]
|
|
6
|
+
build-backend = "setuptools.build_meta"
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "konnektor"
|
|
10
|
+
dynamic = ["version"]
|
|
11
|
+
authors=[
|
|
12
|
+
{name="Benjamin Ries", email="benjamin-ries@outlook.com"},
|
|
13
|
+
#{name="David Swenson", email="dwhswenson@gmail.com"},
|
|
14
|
+
#{name="Irfan Alibay", email="irfan.alibay@gmail.com"},
|
|
15
|
+
#{name="Mike Henry", email="mike.henry@choderalab.org"},
|
|
16
|
+
#{name="Richard J Gowers", email="richardjgowers@gmail.com"},
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
'rdkit',
|
|
20
|
+
'scipy',
|
|
21
|
+
'numpy',
|
|
22
|
+
'networkx',
|
|
23
|
+
]
|
|
24
|
+
description="Konnektor is a package for calculating networks."
|
|
25
|
+
readme="README.md"
|
|
26
|
+
requires-python = ">=3.9"
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Operating System :: OS Independent",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
"Homepage" = "https://github.com/OpenFreeEnergy/konnektor"
|
|
35
|
+
|
|
36
|
+
[tool.versioningit]
|
|
37
|
+
default-version = "1+unknown"
|
|
38
|
+
|
|
39
|
+
[tool.versioningit.format]
|
|
40
|
+
distance = "{base_version}+{distance}.{vcs}{rev}"
|
|
41
|
+
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
|
|
42
|
+
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
|
|
43
|
+
|
|
44
|
+
[tool.versioningit.vcs]
|
|
45
|
+
method = "git"
|
|
46
|
+
match = ["*"]
|
|
47
|
+
default-tag = "0.0.0"
|
|
48
|
+
|
|
49
|
+
[tool.versioningit.write]
|
|
50
|
+
file = "src/konnektor/_version.py"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.0"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# This code is part of OpenFE and is licensed under the MIT license.
|
|
2
|
+
# For details, see https://github.com/OpenFreeEnergy/kartograf
|
|
3
|
+
|
|
4
|
+
import itertools
|
|
5
|
+
import networkx as nx
|
|
6
|
+
|
|
7
|
+
from typing import Iterable, Callable
|
|
8
|
+
|
|
9
|
+
from gufe import AtomMapper, AtomMapping
|
|
10
|
+
from gufe import SmallMoleculeComponent
|
|
11
|
+
|
|
12
|
+
from openfe.setup.ligand_network import LigandNetwork # only temproary
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def generate_minimal_spanning_network(ligands: Iterable[SmallMoleculeComponent],
|
|
16
|
+
mappers: Iterable[AtomMapper],
|
|
17
|
+
scorer: Callable[[AtomMapping], float]):
|
|
18
|
+
"""Plan a Network which connects all ligands with minimal cost
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
ligands : Iterable[SmallMoleculeComponent]
|
|
23
|
+
the ligands to include in the Network
|
|
24
|
+
mappers : Iterable[AtomMapper]
|
|
25
|
+
the AtomMappers to use to propose mappings. At least 1 required,
|
|
26
|
+
but many can be given, in which case all will be tried to find the
|
|
27
|
+
lowest score edges
|
|
28
|
+
scorer : Scoring function
|
|
29
|
+
any callable which takes a AtomMapping and returns a float
|
|
30
|
+
"""
|
|
31
|
+
nodes = list(ligands)
|
|
32
|
+
|
|
33
|
+
# First create a network with all the proposed mappings (scored)
|
|
34
|
+
mapping_generator = itertools.chain.from_iterable(
|
|
35
|
+
mapper.suggest_mappings(molA, molB)
|
|
36
|
+
for molA, molB in itertools.combinations(nodes, 2)
|
|
37
|
+
for mapper in mappers
|
|
38
|
+
)
|
|
39
|
+
mappings = [mapping.with_annotations({'score': scorer(mapping)})
|
|
40
|
+
for mapping in mapping_generator]
|
|
41
|
+
network = LigandNetwork(mappings, nodes=nodes)
|
|
42
|
+
|
|
43
|
+
# Next analyze that network to create minimal spanning network. Because
|
|
44
|
+
# we carry the original (directed) AtomMapping, we don't lose
|
|
45
|
+
# direction information when converting to an undirected graph.
|
|
46
|
+
min_edges = nx.minimum_spanning_edges(nx.MultiGraph(network.graph),
|
|
47
|
+
weight='score')
|
|
48
|
+
min_mappings = [edge_data['object'] for _, _, _, edge_data in min_edges]
|
|
49
|
+
min_network = LigandNetwork(min_mappings)
|
|
50
|
+
missing_nodes = set(nodes) - set(min_network.nodes)
|
|
51
|
+
if missing_nodes:
|
|
52
|
+
raise RuntimeError("Unable to create edges to some nodes: "
|
|
53
|
+
+ str(list(missing_nodes)))
|
|
54
|
+
|
|
55
|
+
return min_network
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# This code is part of OpenFE and is licensed under the MIT license.
|
|
2
|
+
# For details, see https://github.com/OpenFreeEnergy/kartograf
|
|
3
|
+
|
|
4
|
+
import math
|
|
5
|
+
from typing import Iterable, Callable
|
|
6
|
+
import itertools
|
|
7
|
+
|
|
8
|
+
from gufe import AtomMapper, AtomMapping
|
|
9
|
+
from gufe import SmallMoleculeComponent
|
|
10
|
+
|
|
11
|
+
from openfe.setup import LigandNetwork # only temproary
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def generate_radial_network(ligands: Iterable[SmallMoleculeComponent],
|
|
15
|
+
central_ligand: SmallMoleculeComponent,
|
|
16
|
+
mappers: Iterable[AtomMapper],
|
|
17
|
+
scorer: Callable[[AtomMapping], float]=None):
|
|
18
|
+
"""Generate a radial network with all ligands connected to a central node
|
|
19
|
+
|
|
20
|
+
Also known as hub and spoke or star-map, this plans a Network where
|
|
21
|
+
all ligands are connected via a central ligand.
|
|
22
|
+
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
ligands : iterable of SmallMoleculeComponents
|
|
26
|
+
the ligands to arrange around the central ligand
|
|
27
|
+
central_ligand : SmallMoleculeComponent
|
|
28
|
+
the ligand to use as the hub/central ligand
|
|
29
|
+
mappers : iterable of AtomMappers
|
|
30
|
+
mappers to use, at least 1 required
|
|
31
|
+
scorer : scoring function, optional
|
|
32
|
+
a callable which returns a float for any AtomMapping. Used to
|
|
33
|
+
assign scores to potential mappings, higher scores indicate worse
|
|
34
|
+
mappings.
|
|
35
|
+
|
|
36
|
+
Raises
|
|
37
|
+
------
|
|
38
|
+
ValueError
|
|
39
|
+
if no mapping between the central ligand and any other ligand can be
|
|
40
|
+
found
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
network : Network
|
|
45
|
+
will have an edge between each ligand and the central ligand, with the
|
|
46
|
+
mapping being the best possible mapping found using the supplied atom
|
|
47
|
+
mappers.
|
|
48
|
+
If no scorer is supplied, the first mapping provided by the iterable
|
|
49
|
+
of mappers will be used.
|
|
50
|
+
"""
|
|
51
|
+
edges = []
|
|
52
|
+
|
|
53
|
+
for ligand in ligands:
|
|
54
|
+
best_score = math.inf
|
|
55
|
+
best_mapping = None
|
|
56
|
+
|
|
57
|
+
for mapping in itertools.chain.from_iterable(
|
|
58
|
+
mapper.suggest_mappings(central_ligand, ligand)
|
|
59
|
+
for mapper in mappers
|
|
60
|
+
):
|
|
61
|
+
if not scorer:
|
|
62
|
+
best_mapping = mapping
|
|
63
|
+
break
|
|
64
|
+
|
|
65
|
+
score = scorer(mapping)
|
|
66
|
+
mapping = mapping.with_annotations({"score": score})
|
|
67
|
+
|
|
68
|
+
if score < best_score:
|
|
69
|
+
best_mapping = mapping
|
|
70
|
+
best_score = score
|
|
71
|
+
|
|
72
|
+
if best_mapping is None:
|
|
73
|
+
raise ValueError(f"No mapping found for {ligand}")
|
|
74
|
+
edges.append(best_mapping)
|
|
75
|
+
|
|
76
|
+
return LigandNetwork(edges)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: konnektor
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Konnektor is a package for calculating networks.
|
|
5
|
+
Author-email: Benjamin Ries <benjamin-ries@outlook.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/OpenFreeEnergy/konnektor
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
|
|
14
|
+
[](https://openfree.energy/)
|
|
15
|
+
[](https://github.com/OpenFreeEnergy/konnektor/actions/workflows/ci.yaml)
|
|
16
|
+
[](https://codecov.io/gh/OpenFreeEnergy/konnektor)
|
|
17
|
+
[](https://konnektor.readthedocs.io/en/latest/?badge=latest)
|
|
18
|
+
|
|
19
|
+
# Konnektor: The tools for mapping your FE calcuations
|
|
20
|
+
|
|
21
|
+
Konnektor offers at the moment basic network planers.
|
|
22
|
+
|
|
23
|
+
More will be here soon!
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/konnektor/__init__.py
|
|
5
|
+
src/konnektor/_version.py
|
|
6
|
+
src/konnektor/mst_networker.py
|
|
7
|
+
src/konnektor/radial_networker.py
|
|
8
|
+
src/konnektor.egg-info/PKG-INFO
|
|
9
|
+
src/konnektor.egg-info/SOURCES.txt
|
|
10
|
+
src/konnektor.egg-info/dependency_links.txt
|
|
11
|
+
src/konnektor.egg-info/requires.txt
|
|
12
|
+
src/konnektor.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
konnektor
|