Skip to content

Commit 767188f

Browse files
authored
Merge pull request #7 from MachineLearningLifeScience/updating-index-w-new-readme
Updates the readme to incorporate the new readme from poli
2 parents 3b2294c + 6fd86f9 commit 767188f

File tree

11 files changed

+46
-17
lines changed

11 files changed

+46
-17
lines changed
Binary file not shown.
7.04 KB
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

docs/poli-docs/_build/html/_sources/index.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
# poli 🧪: a library of discrete objective functions
22

3-
This page contains documentation on how to use `poli`, a library of discrete objective functions in biology, cheminformatics, and more. This page also presents `poli-baselines`, a collection of optimizers of these discrete black box functions.
3+
[![Testing (conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-including-conda.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-including-conda.yml) [![Test (conda, python 3.9)](https://github.com/MachineLearningLifeScience/poli-baselines/actions/workflows/python-tox-testing.yml/badge.svg)](https://github.com/MachineLearningLifeScience/poli-baselines/actions/workflows/python-tox-testing.yml)
44

5-
A core feature of `poli` is isolating calls to complicated objective functions which might, for example, depend on simulators, binaries, and highly specific package requirements.
6-
Our promise is: if you can run your objective function reliably in a `conda` environment, then you can register it and call it from other projects and environments without having to worry about re-installing all the dependencies.
5+
[poli](https://github.com/MachineLearningLifeScience/poli) is a library of discrete objective functions for benchmarking optimization algorithms. Examples include:
6+
- 🔬 **stability** of mutations from a wildtype protein (using [foldx](https://foldxsuite.crg.eu/) or [rasp](https://github.com/KULL-Centre/_2022_ML-ddG-Blaabjerg)).
7+
- 🧪 **docking scores** of ligands to proteins (using [dockstring](https://github.com/dockstring/dockstring), [pyscreener](https://github.com/coleygroup/pyscreener) and [pytdc](https://tdcommons.ai/functions/oracles/)).
8+
- 💊 **druglikeness** or **synthetic acccesibility** of small molecules (using [rdkit](https://github.com/rdkit/rdkit) and [pytdc](https://tdcommons.ai/functions/oracles/)).
9+
10+
Some of `poli`'s features:
11+
- 🔲 **isolation** of black box function calls inside conda environments. Don't worry about clashes w. black box requirements, poli will create the relevant conda environments for you.
12+
- 🗒️ **logging** logic at the black box `__call__` level using observers.
13+
- A numpy interface. Inputs are `np.array`s of strings, outputs are `np.array`s of floats.
14+
- `SMILES` and `SELFIES` support for small molecule manipulation.
15+
16+
This documentation also discusses [`poli-baselines`](https://github.com/MachineLearningLifeScience/poli-baselines), a collection of optimizers of these discrete black box functions which is currently in alpha stage.
717

818
## Getting started
919

@@ -18,7 +28,7 @@ pip install git+https://github.com/MachineLearningLifeScience/poli.git@dev
1828
pip install git+https://github.com/MachineLearningLifeScience/poli-baselines.git@main
1929
```
2030

21-
`poli` also [runs on colab](https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls?usp=sharing).
31+
`poli` also runs on Google Colab. [Here is a small example of how to run one of the objective functions.](https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls?usp=sharing).
2232

2333
## Black-box objective functions
2434

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Isolating black box objective functions"]},{"cell_type":"markdown","metadata":{"vscode":{"languageId":"plaintext"}},"source":["Each black-box objective function in `poli` lives inside a `conda` environment. For example:\n","- the `foldx` stability objective lives inside `poli__protein`, which has `biopython`, `pdb-tools` and other libraries that are required to interface well with proteins and their representations.\n","- the `dockstring` objective lives inside `poli__dockstring`, which includes babel as part of its installation.\n","\n","There are two ways of running objective functions: **having the right dependencies**, or **in isolation**.\n","\n","[TODO: add diagram]"]},{"cell_type":"markdown","metadata":{},"source":["## Running objective functions in isolation"]},{"cell_type":"markdown","metadata":{},"source":["Let's say that your current environment doesn't have the package `dockstring` installed. You can still run the objective function:"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[],"source":["# No output: we don't have it installed.\n","!pip freeze | grep dockstring"]},{"cell_type":"code","execution_count":7,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["poli 🧪: creating an isolated black box function.\n","poli 🧪: starting the isolated objective process.\n"]},{"name":"stderr","output_type":"stream","text":["/Users/sjt972/anaconda3/envs/poli__dockstring/lib/python3.9/site-packages/dockstring/utils.py:77: DockstringWarning: Although Mac use is supported, docking scores on Mac do not always perfectly match scores from Linux. Therefore, extra care should be taken when comparing results to other platforms. In particular, the baselines in the DOCKSTRING paper were computed on Linux, so please do not directly compare your docking scores to the scores reported on the paper.\n"," warnings.warn(\n"]}],"source":["from poli import create\n","\n","problem_info, f, x0, y0, _ = create(\n"," name=\"dockstring\",\n"," target_name=\"drd2\" # The target protein.\n",")"]},{"cell_type":"markdown","metadata":{},"source":["As you can see, `poli` warns us that it is creating the conda environment associated with the black box function, and it is creating an isolated process where the objective can be run.\n","\n","This can be verified by checking the type of `f`:"]},{"cell_type":"code","execution_count":8,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["ExternalBlackBox(L=inf, num_evaluations=0)\n"]}],"source":["print(f)"]},{"cell_type":"markdown","metadata":{},"source":["This black box is an `ExternalBlackBox`, meaning that it is listening to an isolated process running `python` inside the `poli__dockstring` environment."]},{"cell_type":"markdown","metadata":{},"source":["We can still evaluate `f` like normal:"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":["/Users/sjt972/anaconda3/envs/poli__dockstring/lib/python3.9/site-packages/dockstring/utils.py:77: DockstringWarning: Although Mac use is supported, docking scores on Mac do not always perfectly match scores from Linux. Therefore, extra care should be taken when comparing results to other platforms. In particular, the baselines in the DOCKSTRING paper were computed on Linux, so please do not directly compare your docking scores to the scores reported on the paper.\n"," warnings.warn(\n"]},{"data":{"text/plain":["array([[11.9]])"]},"execution_count":10,"metadata":{},"output_type":"execute_result"}],"source":["f(x0)"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["ExternalBlackBox(L=inf, num_evaluations=1)\n"]}],"source":["print(f)"]},{"cell_type":"markdown","metadata":{},"source":["## When you have the right dependencies..."]},{"cell_type":"markdown","metadata":{},"source":["However, when you have the right dependencies, the `create` method returns the actual objective function. Let's use for example `rdkit_logp`:"]},{"cell_type":"code","execution_count":12,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["poli 🧪: Creating the objective from the repository.\n"]}],"source":["problem_info, f_logp, x0_logp, y0_logp, _ = create(\n"," name=\"rdkit_logp\"\n",")"]},{"cell_type":"markdown","metadata":{},"source":["Now, if we print `f_logp`, we can see that the create method returned the actual objective black box."]},{"cell_type":"code","execution_count":13,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["LogPBlackBox(L=inf, num_evaluations=1)\n"]}],"source":["print(f_logp)"]},{"cell_type":"markdown","metadata":{},"source":["## Conclusions"]},{"cell_type":"markdown","metadata":{},"source":["- `poli` is able to instantiate objective functions inside isolated environments.\n","- If the dependencies are met, the objective function is created directly instead."]},{"cell_type":"markdown","metadata":{},"source":["## Read more"]},{"cell_type":"markdown","metadata":{},"source":["You can check the individual dependencies of each black box inside their implementation, or in [their documentation](../objective_repository/all_objectives.md)."]}],"metadata":{"kernelspec":{"display_name":"poli-docs","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.9.18"}},"nbformat":4,"nbformat_minor":2}
1+
{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Isolating black box objective functions"]},{"cell_type":"markdown","metadata":{"vscode":{"languageId":"plaintext"}},"source":["Each black-box objective function in `poli` lives inside a `conda` environment. For example:\n","- the `foldx` stability objective lives inside `poli__protein`, which has `biopython`, `pdb-tools` and other libraries that are required to interface well with proteins and their representations.\n","- the `dockstring` objective lives inside `poli__dockstring`, which includes babel as part of its installation.\n","\n","There are two ways of running objective functions: **having the right dependencies**, or **in isolation**."]},{"cell_type":"markdown","metadata":{},"source":["## Running objective functions in isolation"]},{"cell_type":"markdown","metadata":{},"source":["Let's say that your current environment doesn't have the package `dockstring` installed. You can still run the objective function:"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[],"source":["# No output: we don't have it installed.\n","!pip freeze | grep dockstring"]},{"cell_type":"code","execution_count":7,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["poli 🧪: creating an isolated black box function.\n","poli 🧪: starting the isolated objective process.\n"]},{"name":"stderr","output_type":"stream","text":["/Users/sjt972/anaconda3/envs/poli__dockstring/lib/python3.9/site-packages/dockstring/utils.py:77: DockstringWarning: Although Mac use is supported, docking scores on Mac do not always perfectly match scores from Linux. Therefore, extra care should be taken when comparing results to other platforms. In particular, the baselines in the DOCKSTRING paper were computed on Linux, so please do not directly compare your docking scores to the scores reported on the paper.\n"," warnings.warn(\n"]}],"source":["from poli import create\n","\n","problem_info, f, x0, y0, _ = create(\n"," name=\"dockstring\",\n"," target_name=\"drd2\" # The target protein.\n",")"]},{"cell_type":"markdown","metadata":{},"source":["As you can see, `poli` warns us that it is creating the conda environment associated with the black box function, and it is creating an isolated process where the objective can be run.\n","\n","This can be verified by checking the type of `f`:"]},{"cell_type":"code","execution_count":8,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["ExternalBlackBox(L=inf, num_evaluations=0)\n"]}],"source":["print(f)"]},{"cell_type":"markdown","metadata":{},"source":["This black box is an `ExternalBlackBox`, meaning that it is listening to an isolated process running `python` inside the `poli__dockstring` environment."]},{"cell_type":"markdown","metadata":{},"source":["We can still evaluate `f` like normal:"]},{"cell_type":"code","execution_count":10,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":["/Users/sjt972/anaconda3/envs/poli__dockstring/lib/python3.9/site-packages/dockstring/utils.py:77: DockstringWarning: Although Mac use is supported, docking scores on Mac do not always perfectly match scores from Linux. Therefore, extra care should be taken when comparing results to other platforms. In particular, the baselines in the DOCKSTRING paper were computed on Linux, so please do not directly compare your docking scores to the scores reported on the paper.\n"," warnings.warn(\n"]},{"data":{"text/plain":["array([[11.9]])"]},"execution_count":10,"metadata":{},"output_type":"execute_result"}],"source":["f(x0)"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["ExternalBlackBox(L=inf, num_evaluations=1)\n"]}],"source":["print(f)"]},{"cell_type":"markdown","metadata":{},"source":["## When you have the right dependencies..."]},{"cell_type":"markdown","metadata":{},"source":["However, when you have the right dependencies, the `create` method returns the actual objective function. Let's use for example `rdkit_logp`:"]},{"cell_type":"code","execution_count":12,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["poli 🧪: Creating the objective from the repository.\n"]}],"source":["problem_info, f_logp, x0_logp, y0_logp, _ = create(\n"," name=\"rdkit_logp\"\n",")"]},{"cell_type":"markdown","metadata":{},"source":["Now, if we print `f_logp`, we can see that the create method returned the actual objective black box."]},{"cell_type":"code","execution_count":13,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["LogPBlackBox(L=inf, num_evaluations=1)\n"]}],"source":["print(f_logp)"]},{"cell_type":"markdown","metadata":{},"source":["## Conclusions"]},{"cell_type":"markdown","metadata":{},"source":["- `poli` is able to instantiate objective functions inside isolated environments.\n","- If the dependencies are met, the objective function is created directly instead."]},{"cell_type":"markdown","metadata":{},"source":["## Read more"]},{"cell_type":"markdown","metadata":{},"source":["You can check the individual dependencies of each black box inside their implementation, or in [their documentation](../objective_repository/all_objectives.md)."]}],"metadata":{"kernelspec":{"display_name":"poli-docs","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.9.18"}},"nbformat":4,"nbformat_minor":2}

docs/poli-docs/_build/html/index.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,21 @@ <h2> Contents </h2>
562562

563563
<section class="tex2jax_ignore mathjax_ignore" id="poli-a-library-of-discrete-objective-functions">
564564
<h1>poli 🧪: a library of discrete objective functions<a class="headerlink" href="#poli-a-library-of-discrete-objective-functions" title="Permalink to this heading">#</a></h1>
565-
<p>This page contains documentation on how to use <code class="docutils literal notranslate"><span class="pre">poli</span></code>, a library of discrete objective functions in biology, cheminformatics, and more. This page also presents <code class="docutils literal notranslate"><span class="pre">poli-baselines</span></code>, a collection of optimizers of these discrete black box functions.</p>
566-
<p>A core feature of <code class="docutils literal notranslate"><span class="pre">poli</span></code> is isolating calls to complicated objective functions which might, for example, depend on simulators, binaries, and highly specific package requirements.
567-
Our promise is: if you can run your objective function reliably in a <code class="docutils literal notranslate"><span class="pre">conda</span></code> environment, then you can register it and call it from other projects and environments without having to worry about re-installing all the dependencies.</p>
565+
<p><a class="reference external" href="https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-including-conda.yml"><img alt="Testing (conda, python 3.9)" src="https://github.com/MachineLearningLifeScience/poli/actions/workflows/python-tox-testing-including-conda.yml/badge.svg" /></a> <a class="reference external" href="https://github.com/MachineLearningLifeScience/poli-baselines/actions/workflows/python-tox-testing.yml"><img alt="Test (conda, python 3.9)" src="https://github.com/MachineLearningLifeScience/poli-baselines/actions/workflows/python-tox-testing.yml/badge.svg" /></a></p>
566+
<p><a class="reference external" href="https://github.com/MachineLearningLifeScience/poli">poli</a> is a library of discrete objective functions for benchmarking optimization algorithms. Examples include:</p>
567+
<ul class="simple">
568+
<li><p>🔬 <strong>stability</strong> of mutations from a wildtype protein (using <a class="reference external" href="https://foldxsuite.crg.eu/">foldx</a> or <a class="reference external" href="https://github.com/KULL-Centre/_2022_ML-ddG-Blaabjerg">rasp</a>).</p></li>
569+
<li><p>🧪 <strong>docking scores</strong> of ligands to proteins (using <a class="reference external" href="https://github.com/dockstring/dockstring">dockstring</a>, <a class="reference external" href="https://github.com/coleygroup/pyscreener">pyscreener</a> and <a class="reference external" href="https://tdcommons.ai/functions/oracles/">pytdc</a>).</p></li>
570+
<li><p>💊 <strong>druglikeness</strong> or <strong>synthetic acccesibility</strong> of small molecules (using <a class="reference external" href="https://github.com/rdkit/rdkit">rdkit</a> and <a class="reference external" href="https://tdcommons.ai/functions/oracles/">pytdc</a>).</p></li>
571+
</ul>
572+
<p>Some of <code class="docutils literal notranslate"><span class="pre">poli</span></code>’s features:</p>
573+
<ul class="simple">
574+
<li><p>🔲 <strong>isolation</strong> of black box function calls inside conda environments. Don’t worry about clashes w. black box requirements, poli will create the relevant conda environments for you.</p></li>
575+
<li><p>🗒️ <strong>logging</strong> logic at the black box <code class="docutils literal notranslate"><span class="pre">__call__</span></code> level using observers.</p></li>
576+
<li><p>A numpy interface. Inputs are <code class="docutils literal notranslate"><span class="pre">np.array</span></code>s of strings, outputs are <code class="docutils literal notranslate"><span class="pre">np.array</span></code>s of floats.</p></li>
577+
<li><p><code class="docutils literal notranslate"><span class="pre">SMILES</span></code> and <code class="docutils literal notranslate"><span class="pre">SELFIES</span></code> support for small molecule manipulation.</p></li>
578+
</ul>
579+
<p>This documentation also discusses <a class="reference external" href="https://github.com/MachineLearningLifeScience/poli-baselines"><code class="docutils literal notranslate"><span class="pre">poli-baselines</span></code></a>, a collection of optimizers of these discrete black box functions which is currently in alpha stage.</p>
568580
<section id="getting-started">
569581
<h2>Getting started<a class="headerlink" href="#getting-started" title="Permalink to this heading">#</a></h2>
570582
<p>A good place to start is the next chapter! <a class="reference internal" href="getting_started/getting_started.html"><span class="doc std std-doc">Go to Getting Started</span></a>.</p>
@@ -575,7 +587,7 @@ <h2>Getting started<a class="headerlink" href="#getting-started" title="Permalin
575587
pip<span class="w"> </span>install<span class="w"> </span>git+https://github.com/MachineLearningLifeScience/poli-baselines.git@main
576588
</pre></div>
577589
</div>
578-
<p><code class="docutils literal notranslate"><span class="pre">poli</span></code> also <a class="reference external" href="https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls?usp=sharing">runs on colab</a>.</p>
590+
<p><code class="docutils literal notranslate"><span class="pre">poli</span></code> also runs on Google Colab. <a class="reference external" href="https://colab.research.google.com/drive/1-IISCebWYfu0QhuCJ11wOag8aKOiPtls?usp=sharing">Here is a small example of how to run one of the objective functions.</a>.</p>
579591
</section>
580592
<section id="black-box-objective-functions">
581593
<h2>Black-box objective functions<a class="headerlink" href="#black-box-objective-functions" title="Permalink to this heading">#</a></h2>

docs/poli-docs/_build/html/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)