Skip to content

Commit

Permalink
towards v1
Browse files Browse the repository at this point in the history
strong improvements :)
  • Loading branch information
RiesBen authored Sep 10, 2024
1 parent 193a55d commit 8a625ab
Show file tree
Hide file tree
Showing 90 changed files with 9,284 additions and 1,762 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ _version.py

#IDE
.idea
.vscode
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
30 changes: 30 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Ries"
given-names: "Benjamin"
orcid: "https://orcid.org/0000-0002-0945-8304"
- family-names: "Gowers"
given-names: "Richard J."
orcid: "https://orcid.org/0000-0002-3241-1846"
- family-names: "Baumann"
given-names: "Hannah M."
orcid: "https://orcid.org/0000-0002-1736-7744"
- family-names: "Swenson"
given-names: "David W.H."
orcid: "https://orcid.org/0000-0001-9922-7923"
- family-names: "Alibay"
given-names: "Irfan"
orcid: "https://orcid.org/0000-0001-5787-9130"
- family-names: "Henry"
given-names: "Michael M."
orcid: "https://orcid.org/0000-0002-3870-9993"
- family-names: "Eastwood"
given-names: "James R. B."
orcid: "https://orcid.org/0000-0003-3895-5227"
title: "Konnektor: A Tool for Planning Free Energy Networks"
version: 1.0
date-released: -
url: "https://openfree.energy/"
repository-code: "https://github.com/OpenFreeEnergy/konnektor"
doi: -
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It contains multiple algorithms and tools for network planning, that make settin
As an example imagen you are given a set of drug candidates that shall be ranked with relative binding free energies.
In theory you could calculate all the possible network transformations, in order to get your ligand ranking (we call this a Maximal Network).
However this leads to an explosion in time and compute cost, therefore we need more efficient ways on how to caluclate a drug candidate ranking.
From a thermodynamic perspective not all transformations are actually required to retrieve a ranking.
From a thermodynamic perspective not all transformations are actually required to retrieve a ranking.
In fact you only need one conection per small molecules to the others in order to get the ranking, like for example in Star Networks or Minimal Spanning Tree (MST) Networks.
However we found the very efficient networks to be sensitive to transformation failures, this can be solved with network building algorithms, that are slightly more redundant.

Expand All @@ -34,25 +34,16 @@ Last we want to bring to your attention our Network visualization tools and the
Try our interactive demo: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/OpenFreeEnergy/konnektor/blob/main/examples/konnektor_example.ipynb#scrollTo=GU32PaMkzD7x)


👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷

**WARNING: Konnektor is under development and is in its beta phase!**

This translates to the core features are implemented and we hope to only introduce minor changes to the repository form here, i.e. fixing bugs.


👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷👷

## Content
### Implemented Network Layouts
Several Network layout generating algorithms are implemented in Konnektor, with different advantages and disadvantages.
From an algorithmic perspective most of the algorithms are actually a reduction method of the Maximal Network.
From an algorithmic perspective most of the algorithms are actually a reduction method of the Maximal Network.
To speed-up the Maximal Network Algorithm we implemented an parallelization scheme to it. Below you can find some of our layouts:

![image](.img/network_layouts.png)

### Tools for handling Networks
Konnektor implements tools, that allow for example to merge (if a node is shared in the networks) or concatenate (if no node is shared) networks,
Konnektor implements tools, that allow for example to merge (if a node is shared in the networks) or concatenate (if no node is shared) networks,
append single molecules (nodes) to a network or delete transformations/molecules from a network.

![image](https://github.com/OpenFreeEnergy/konnektor/assets/12428005/5fbb253c-f0d3-41bf-bd92-f520b1363b6d)
Expand All @@ -76,7 +67,7 @@ compounds = list(filter(lambda x: not x.name in ["lig_2", "lig_3", "lig_4", "lig
from openfe.setup import KartografAtomMapper, lomap_scorers
from konnektor.network_planners import CyclicNetworkGenerator

networker = CyclicNetworkGenerator(mapper=KartografAtomMapper(),
networker = CyclicNetworkGenerator(mappers=KartografAtomMapper(),
scorer=lomap_scorers.default_lomap_score)

# Generate Network
Expand Down
3 changes: 1 addition & 2 deletions docs/tutorial/building_networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ But of course you can use any `NetworkGenerator` from Konnektor in exactly the s
# Plan the Network
from konnektor.network_planners import CyclicNetworkGenerator

networker = CyclicNetworkGenerator(mapper=mapper,
networker = CyclicNetworkGenerator(mappers=mapper,
scorer=scorer,
n_processes=1)

Expand Down Expand Up @@ -53,4 +53,3 @@ As alternative, Konnektor offers an interactive IPython widget, that allows you
This yields the following visualization:

.. image:: ../_static/img/cyclic_graph_ipy_widget.png

924 changes: 850 additions & 74 deletions examples/konnektor_example.ipynb

Large diffs are not rendered by default.

729 changes: 501 additions & 228 deletions examples/konnektor_networks.ipynb

Large diffs are not rendered by default.

32 changes: 21 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ authors=[
{name="Mike Henry", email="[email protected]"},
{name="Richard J Gowers", email="[email protected]"},
]
dependencies = [
'scipy',
'numpy',
'networkx',
'gufe',
'rdkit',
'scikit-mol',
'scikit-learn',
'ipycytoscape'
]
description="Konnektor is a package for calculating networks."
readme="README.md"
requires-python = ">=3.9"
Expand All @@ -35,6 +25,26 @@ classifiers = [
"Operating System :: OS Independent",
]

dependencies = [
'gufe',
'numpy',
'rdkit',
'networkx',
'scikit-mol',
'scikit-learn',
'ipycytoscape',
]

[project.optional-dependencies]
test = [
'pytest',
'pytest-cov[all]',
]
dev = [
'black',
'pre-commit',
]

[project.urls]
"Homepage" = "https://github.com/OpenFreeEnergy/konnektor"

Expand All @@ -50,7 +60,7 @@ dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"

[tool.versioningit.vcs]
method = "git"
method = "git"
match = ["*"]
default-tag = "0.0.0"

Expand Down
40 changes: 26 additions & 14 deletions src/konnektor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/konnektor

from .network_planners import (MaximalNetworkGenerator,
HeuristicMaximalNetworkGenerator,
RadialLigandNetworkPlanner,
NNodeEdgesNetworkGenerator,
MinimalSpanningTreeNetworkGenerator,
CyclicNetworkGenerator,
ClusteredNetworkGenerator,
StarrySkyNetworkGenerator,
MstConcatenator,
)
# basic gufe types:
from gufe import Component, SmallMoleculeComponent, ProteinComponent

from .network_tools import concatenate_networks, merge_networks, append_component, \
delete_transformation
from .network_tools import ChargeClusterer, ScaffoldClusterer, \
ComponentsDiversityClusterer
# Konnektor content
from .network_planners import (
MaximalNetworkGenerator,
HeuristicMaximalNetworkGenerator,
RadialLigandNetworkPlanner,
NNodeEdgesNetworkGenerator,
MinimalSpanningTreeNetworkGenerator,
CyclicNetworkGenerator,
ClusteredNetworkGenerator,
StarrySkyNetworkGenerator,
MstConcatenator,
)

from .network_tools import (
concatenate_networks,
merge_networks,
append_component,
delete_transformation,
)
from .network_tools import (
ChargeClusterer,
ScaffoldClusterer,
ComponentsDiversityClusterer,
)

from . import network_analysis

Expand Down
33 changes: 29 additions & 4 deletions src/konnektor/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
root_path = os.path.dirname(__file__)
benzenes_sdf_path = f"{root_path}/benzenes_RHFE.sdf"
hif2a_sdf_path = f"{root_path}/hif2a_ligands.sdf"
charged_ligands_path = f"{root_path}/charged_ligands.sdf"

def get_benzene_ligands()->list[SmallMoleculeComponent]:

def get_benzene_ligands() -> list[SmallMoleculeComponent]:
"""
get the benzene test dataset parsed as SmallMoleculeComponents.
Expand All @@ -21,9 +23,29 @@ def get_benzene_ligands()->list[SmallMoleculeComponent]:
a list of the benzene compounds.
"""
return [SmallMoleculeComponent.from_rdkit(rdm) for rdm in Chem.SDMolSupplier(benzenes_sdf_path, removeHs=False)]
return [
SmallMoleculeComponent.from_rdkit(rdm)
for rdm in Chem.SDMolSupplier(benzenes_sdf_path, removeHs=False)
]


def get_hif2a_ligands() -> list[SmallMoleculeComponent]:
"""
get the benzene test dataset parsed as SmallMoleculeComponents.
Returns
-------
list[SmallMoleculeComponent]
a list of the benzene compounds.
"""
return [
SmallMoleculeComponent.from_rdkit(rdm)
for rdm in Chem.SDMolSupplier(hif2a_sdf_path, removeHs=False)
]


def get_hif2a_ligands()->list[SmallMoleculeComponent]:
def get_charged_ligands() -> list[SmallMoleculeComponent]:
"""
get the benzene test dataset parsed as SmallMoleculeComponents.
Expand All @@ -33,4 +55,7 @@ def get_hif2a_ligands()->list[SmallMoleculeComponent]:
a list of the benzene compounds.
"""
return [SmallMoleculeComponent.from_rdkit(rdm) for rdm in Chem.SDMolSupplier(hif2a_sdf_path, removeHs=False)]
return [
SmallMoleculeComponent.from_rdkit(rdm)
for rdm in Chem.SDMolSupplier(charged_ligands_path, removeHs=False)
]
Loading

0 comments on commit 8a625ab

Please sign in to comment.