Skip to content

Commit

Permalink
merge and fix docs doc
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli committed Sep 7, 2023
2 parents 83b0e52 + a123614 commit 68f8364
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 37 deletions.
3 changes: 0 additions & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

# OpenBabel2
except ImportError:
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,32 @@
Date: XXX/XX/XXX
Contributors: @RMeli

### Improved

* Documentation on loading RDKit and Open Babel molecules [PR #77 | @RMeli]

### Changed

* Version of several GitHub actions [PR #76 | @RMeli]
* Versioneer to `0.28` [PR #76 | @RMeli]
* Minimum Python version to `3.7` to match CI [PR #76 | @RMeli]
* Code according to `black==23.3.0` [PR #76 | @RMeli]

### Added

* Pin to `sphinx<7` to avoid compatibility with RTD theme [PR #77 | @RMeli]

### Removed

* Outdated information about RDKit from the documentation [PR #84 | @RMeli]
* Support for Open Babel 2 [PR #84 | @RMeli]
* LGTM badge and code annotations [PR #76 | @RMeli]

### Added

* `extras_require` to `setup.py` for RDKit and Open Babel [PR #84 | @RMeli]
* Error message when `spyrmsd` is used as module but neither OpenBabel nor RDKit are installed [PR #81 | @RMeli]

------------------------------------------------------------------------------

## Version 0.5.2
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ If you find `spyrmsd` useful, please consider citing the following paper:

_Note_: `spyrmsd` will install [NetworkX](https://networkx.github.io/) (multi-platform). You can install [graph-tool](https://graph-tool.skewed.de/) on macOS and Linux for higher performance.

_Note_: If `spyrmsd` is used as a standalone tool, it is required to install either [RDKit](https://rdkit.org/) or [Open Babel](http://openbabel.org/). Neither is automatically installed with `pip` nor `conda`.

### PyPI

```bash
Expand Down Expand Up @@ -80,8 +82,6 @@ Additionally, one of the following packages is required to use `spyrmsd` as a st
* [Open Babel](http://openbabel.org/)
* [RDKit](https://rdkit.org/)

_Note_: [RDKit](https://rdkit.org/) is not available on PyPI ([Why the RDKit isn't available on PyPi](https://rdkit.blogspot.com/2019/11/why-rdkit-isnt-available-on-pypi.html)). See [RDKit Installation](http://www.rdkit.org/docs/Install.html) for installation instructions.

## Usage

### Standalone Tool
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/spyrmsd-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
- codecov

# Doc
- sphinx
- sphinx<7
- sphinx_rtd_theme
- pip:
- duecredit
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/spyrmsd-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ dependencies:
- rdkit

# Doc
- sphinx
- sphinx<7
- sphinx_rtd_theme
11 changes: 10 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The docs for this project are built with [Sphinx](http://www.sphinx-doc.org/en/m

## Installation

Ensure that Sphinx and the ReadTheDocs theme are installed:
Ensure that Sphinx and the [Read the Docs](https://sphinx-rtd-theme.readthedocs.io/en/stable/index.html) theme are installed:

```bash
conda install sphinx sphinx_rtd_theme
Expand All @@ -20,6 +20,15 @@ Create API documentation automatically with `sphinx-apidoc`:
sphinx-apidoc -f -M -e -T -o source/api ../spyrmsd
```

### Convert Tutorial Jupyter Notebooks to HTML

Jupyter Notebooks need to be converted to HTML:

```bash
pip install pandoc
jupyter nbconvert --to rst tutorial.ipynb
```

### Build Documentation

Use the `Makefile` to compile static HTML pages:
Expand Down
4 changes: 0 additions & 4 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ Additionally, one of the following packages is required to use ``spyrmsd`` as a
* `Open Babel`_
* RDKit_

.. note::
RDKit_ has to be installed using ``conda`` (see `Why the RDKit isn't available on PyPi`_).

.. _PyPI: https://pypi.org/project/spyrmsd/
.. _conda-forge: https://github.com/conda-forge/spyrmsd-feedstock
.. _RDKit: https://rdkit.org/
.. _Why the RDKit isn't available on PyPi: https://rdkit.blogspot.com/2019/11/why-rdkit-isnt-available-on-pypi.html
.. _Open Babel: http://openbabel.org/
.. _graph-tool: https://graph-tool.skewed.de/
.. _NetworkX: https://networkx.github.io/
Expand Down
94 changes: 83 additions & 11 deletions docs/source/tutorials/tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -9,21 +10,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from spyrmsd import io, rmsd"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### OpenBabel or RDKit"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -37,13 +40,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Loading Molecules"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -52,14 +57,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"ref = io.loadmol(\"molecules/1a4k_ligand.sdf\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -68,21 +74,82 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"mols = io.loadallmols(\"molecules/1a4k_dock.sdf\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Loading RDKit or OpenBabel Molecules"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"`spyrmsd` natively supports Open Babel and RDKit (if installed). The `Molecule` class provides `from_openbabel()` and `from_rdkit()` constructors."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<frozen importlib._bootstrap>:241: RuntimeWarning: to-Python converter for std::__1::pair<double, double> already registered; second conversion method ignored.\n",
"[18:44:03] Molecule does not have explicit Hs. Consider calling AddHs()\n",
"[18:44:03] Molecule does not have explicit Hs. Consider calling AddHs()\n"
]
},
{
"data": {
"text/plain": [
"[0.019162902039384797]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from rdkit import Chem\n",
"from rdkit.Chem import AllChem\n",
"\n",
"rdmol1 = Chem.MolFromSmiles(\"c1ccccc1\")\n",
"rdmol2 = Chem.MolFromSmiles(\"c1ccccc1\")\n",
"AllChem.EmbedMolecule(rdmol1)\n",
"AllChem.EmbedMolecule(rdmol2)\n",
"\n",
"from spyrmsd.molecule import Molecule\n",
"from spyrmsd.rmsd import rmsdwrapper\n",
"\n",
"mol1 = Molecule.from_rdkit(rdmol1)\n",
"mol2 = Molecule.from_rdkit(rdmol2)\n",
"\n",
"rmsdwrapper(mol1, mol2)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Removing Hydrogen Atoms"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -91,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -109,13 +176,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Symmetry-Corrected RMSD"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -124,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -135,7 +204,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -145,6 +214,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -153,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -178,13 +248,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"### Minimum RMSD"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -193,14 +265,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1.2012368667355435, 1.0533413220699535, 1.153253104575529, 1.036542688936588, 0.8407673221224143, 1.1758143217869736, 0.7817315189656655, 1.0933314311267845, 1.0260767175206462, 0.9586369647000478]\n"
"[1.2012368667355435, 1.0533413220699535, 1.153253104575529, 1.036542688936588, 0.8407673221224187, 1.1758143217869736, 0.7817315189656655, 1.0933314311267845, 1.0260767175206462, 0.9586369647000478]\n"
]
}
],
Expand Down Expand Up @@ -235,7 +307,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 68f8364

Please sign in to comment.