Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli committed Aug 2, 2022
1 parent cc8f6ca commit 9fe23f2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
48 changes: 41 additions & 7 deletions docs/source/GNINA.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
GNINA_ Models
=============

Thanks to `Andrew McNutt`_, who converted the original Caffe_ models to PyTorch_, all GNINA_ models are available in gninatorch_.
Thanks to `Andrew McNutt`_, who converted the weights of the original Caffe_ models to PyTorch_, all GNINA_ models are available in gninatorch_.

You can find more information about the Caffe_ implementation at `gnina/models`_.

Loading GNINA_ Models
---------------------

The pre-trained models can be easily loaded as follows:
The pre-trained models can be loaded as follows:

.. code-block:: python
from gninatorch import gnina
model, ensemble: bool = setup_gnina_model(model_name)
where :code:`model_name` corresponds accepts the same values as the :code:`--cnn` argument in GNINA_.

where :code:`model_name` accepts the same values as the :code:`--cnn` argument in GNINA_ (see :ref:`gnina-models` and :ref:`gnina-models-ensemble`).
:code:`ensemble` is a boolean flag that indicates whether the model is an ensemble of models or not.

A single model returns :code:`log_CNNscore`, and :code:`CNNaffinity`:

.. code-block:: python
assert ensemble == False
# Grid based-representation of protein-ligand binding site
# x : torch.Tensor
log_CNNscore, CNNaffinity = model(x)
CNNscore = torch.exp(log_CNNscore)
An ensemble of models returns :code:`log_CNNscore`, :code:`CNNaffinity` and :code:`CNNvariance`:

.. code-block:: python
assert ensemble == True
# Grid based-representation of protein-ligand binding site
# x : torch.Tensor
log_CNNscore, CNNaffinity, CNNvariance = model(x)
CNNscore = torch.exp(log_CNNscore)
.. warning::
In contrast to GNINA_, which returns :code:`CNNscore`, the PyTorch models return :code:`log_CNNscore`.

.. _gnina-models:

Supported GNINA Models
~~~~~~~~~~~~~~~~~~~~~~

The following models are provided:

* :code:`default2017` :cite:`ragoza2017protein`
Expand All @@ -31,7 +59,12 @@ The following models are provided:
* :code:`crossdock_default2018` or :code:`crossdock_default2018_[1-4]` :cite:`francoeur2020three`
* :code:`dense` or :code:`dense_[1-4]` :cite:`francoeur2020three`

The following ensembles of models are also provided:
.. _gnina-models-ensemble:

Supported GNINA Ensembles of Models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following ensembles of models are also available:

* :code:`default` (GNINA_ default model) :cite:`mcnutt2021gnina` :cite:`francoeur2020three`
* :code:`redock_default2018_ensemble` :cite:`francoeur2020three`
Expand All @@ -53,7 +86,7 @@ You can build your own ensemble of models as follows:
from gninatorch import gnina
model = gnina.setup_gnina_models([model_name1, model_name2, ...])
model = gnina.load_gnina_models([model_name1, model_name2, ...])
The :code:`default` model used by GNINA_ corresponds to the following ensemble:

Expand All @@ -71,7 +104,8 @@ The :code:`default` model used by GNINA_ corresponds to the following ensemble:
model = gnina.load_gnina_models(names)
The :code:`default` optimises accuracy and inference speed. See :cite:`mcnutt2021gnina` for more information.
The :code:`default` model is chosen to optimise accuracy and inference speed.
See :cite:`mcnutt2021gnina` for more information.

Inference with GNINA_ Models
----------------------------
Expand Down
7 changes: 4 additions & 3 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Installation
Installation from Source
~~~~~~~~~~~~~~~~~~~~~~~~

Clone the repository from GitHub:
Clone the repository from GitHub_:

.. code-block:: bash
git clone https://github.com/RMeli/gnina-torch.git
cd gnina-torch
Create conda_ or mamba_ environment with all the dependencies:
Create a conda_ or mamba_ environment with all the dependencies:

.. code-block:: bash
Expand Down Expand Up @@ -69,4 +69,5 @@ Run tests with pytest_ and report code coverage:
.. _libmolgrid: https://gnina.github.io/libmolgrid/
.. _NVIDIA: https://www.nvidia.com/
.. _PyTorch: https://pytorch.org/
.. _pytest: https://docs.pytest.org/en/7.1.x/contents.html
.. _pytest: https://docs.pytest.org/en/7.1.x/contents.html
.. _GitHub: https://github.com/

0 comments on commit 9fe23f2

Please sign in to comment.