From 9a9274bc62585fe8d6163915e1b486f2e28f9645 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Fri, 26 Jun 2020 10:03:49 +0200 Subject: [PATCH 01/13] fix project homepage for PyPi --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e4a5201..aa125e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ dist-name = "spyrmsd" description-file = "README.md" author = "Rocco Meli" author-email = "rocco.meli@biodtp.ox.ac.uk" -home-page = "https://pyrmsd.readthedocs.io" +home-page = "https://spyrmsd.readthedocs.io" classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3",] From 08285b3ae63b8543b73bbcdf913b36f217c7934f Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Sat, 11 Jul 2020 15:19:24 +0200 Subject: [PATCH 02/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b42569..21d1dfc 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![DOI](https://zenodo.org/badge/214157073.svg)](https://zenodo.org/badge/latestdoi/214157073) [![License](https://img.shields.io/github/license/RMeli/pyrmsd?color=%2333BBFF)](https://opensource.org/licenses/MIT) -[![PyPI](https://img.shields.io/badge/PyPI-v0.3.3%20-ff69b4)](https://pypi.org/project/spyrmsd/) +[![PyPI](https://img.shields.io/badge/PyPI-v0.3.4%20-ff69b4)](https://pypi.org/project/spyrmsd/) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/spyrmsd.svg)](https://anaconda.org/conda-forge/spyrmsd) Python tool for symmetry-corrected RMSD calculations. From d52ace1b31b7cc3d5153c11a0302ed23513edee1 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 10 Aug 2020 18:37:58 +0200 Subject: [PATCH 03/13] better error message when graphs are different --- spyrmsd/graphs/gt.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spyrmsd/graphs/gt.py b/spyrmsd/graphs/gt.py index 85d8d47..8338397 100644 --- a/spyrmsd/graphs/gt.py +++ b/spyrmsd/graphs/gt.py @@ -87,7 +87,10 @@ def match_graphs(G1, G2) -> List[Tuple[List[int], List[int]]]: # Check if graphs are actually isomorphic if len(maps) == 0: # TODO: Create a new exception - raise ValueError(f"Graphs {G1} and {G2} are not isomorphic.") + raise ValueError( + f"Graphs are not isomorphic." + "\nMake sure graphs have the same connectivity." + ) n = num_vertices(G1) From 6a81f571910092d294a8d78949df9ea010825e5e Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 10 Aug 2020 18:38:48 +0200 Subject: [PATCH 04/13] better error message for no isomorphism --- spyrmsd/graphs/nx.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spyrmsd/graphs/nx.py b/spyrmsd/graphs/nx.py index cdd5c5c..9dbc1b3 100644 --- a/spyrmsd/graphs/nx.py +++ b/spyrmsd/graphs/nx.py @@ -84,7 +84,10 @@ def match_atomicnum(node1, node2): # Check if graphs are actually isomorphic if not GM.is_isomorphic(): # TODO: Create a new exception - raise ValueError(f"Graphs {G1} and {G2} are not isomorphic.") + raise ValueError( + f"Graphs are not isomorphic." + "\nMake sure graphs have the same connectivity." + ) return [ (list(isomorphism.keys()), list(isomorphism.values())) From 289a171f381082873cab37d91d07273fd77e5f53 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 10 Aug 2020 18:47:52 +0200 Subject: [PATCH 05/13] fix linting --- spyrmsd/graphs/gt.py | 2 +- spyrmsd/graphs/nx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spyrmsd/graphs/gt.py b/spyrmsd/graphs/gt.py index 8338397..8e725bb 100644 --- a/spyrmsd/graphs/gt.py +++ b/spyrmsd/graphs/gt.py @@ -88,7 +88,7 @@ def match_graphs(G1, G2) -> List[Tuple[List[int], List[int]]]: if len(maps) == 0: # TODO: Create a new exception raise ValueError( - f"Graphs are not isomorphic." + "Graphs are not isomorphic." "\nMake sure graphs have the same connectivity." ) diff --git a/spyrmsd/graphs/nx.py b/spyrmsd/graphs/nx.py index 9dbc1b3..64675bf 100644 --- a/spyrmsd/graphs/nx.py +++ b/spyrmsd/graphs/nx.py @@ -85,7 +85,7 @@ def match_atomicnum(node1, node2): if not GM.is_isomorphic(): # TODO: Create a new exception raise ValueError( - f"Graphs are not isomorphic." + "Graphs are not isomorphic." "\nMake sure graphs have the same connectivity." ) From d3ffacb698601eacfb37c61a370e43c1a791b294 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 18 Aug 2020 22:40:12 +0100 Subject: [PATCH 06/13] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..838ab18 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,54 @@ +name: "CodeQL" + +on: + push: + branches: [develop, master] + pull_request: + # The branches below must be a subset of the branches above + branches: [develop] + schedule: + - cron: '0 0 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From 115967179440fe2323a46dc2cbdbe694faebd68a Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Thu, 27 Aug 2020 21:58:51 +0100 Subject: [PATCH 07/13] additional tests --- spyrmsd/__init__.py | 2 +- spyrmsd/hungarian.py | 2 +- spyrmsd/qcp.py | 2 +- tests/test_rmsd.py | 20 +++++++++++--------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/spyrmsd/__init__.py b/spyrmsd/__init__.py index 4f59222..80d1731 100644 --- a/spyrmsd/__init__.py +++ b/spyrmsd/__init__.py @@ -2,8 +2,8 @@ Python RMSD tool with symmetry correction. """ -from .due import due, Doi from ._version import get_versions +from .due import Doi, due versions = get_versions() __version__ = versions["version"] diff --git a/spyrmsd/hungarian.py b/spyrmsd/hungarian.py index 1c36393..a8f411f 100644 --- a/spyrmsd/hungarian.py +++ b/spyrmsd/hungarian.py @@ -1,7 +1,7 @@ import numpy as np import scipy -from .due import due, Doi +from .due import Doi, due due.cite( Doi("10.1021/ci400534h"), # lgtm[py/procedure-return-value-used] diff --git a/spyrmsd/qcp.py b/spyrmsd/qcp.py index 988cc2d..62d8fd7 100644 --- a/spyrmsd/qcp.py +++ b/spyrmsd/qcp.py @@ -3,7 +3,7 @@ import numpy as np from scipy import optimize -from .due import due, Doi +from .due import Doi, due due.cite( Doi("10.1107/S0108767305015266"), # lgtm[py/procedure-return-value-used] diff --git a/tests/test_rmsd.py b/tests/test_rmsd.py index 93f41bb..3ea6812 100644 --- a/tests/test_rmsd.py +++ b/tests/test_rmsd.py @@ -219,34 +219,36 @@ def test_rmsd_hungarian_benzene_rotated(angle: float, tol: float) -> None: ) == pytest.approx(0, abs=tol) +@pytest.mark.parametrize("d", [-0.5, 0.0, 0.5, 1.0, 1.5]) @pytest.mark.parametrize( "angle, tol", [(60, 1e-4), (120, 1e-4), (180, 1e-4), (240, 1e-4), (300, 1e-4)] ) -def test_rmsd_hungarian_benzene_shifted_rotated(angle: float, tol: float) -> None: +def test_rmsd_hungarian_benzene_shifted_rotated( + d: float, angle: float, tol: float +) -> None: mol1 = copy.deepcopy(molecules.benzene) mol2 = copy.deepcopy(molecules.benzene) - mol2.translate([0, 0, 1]) + mol2.translate([0, 0, d]) assert rmsd.rmsd( mol1.coordinates, mol2.coordinates, mol1.atomicnums, mol2.atomicnums - ) == pytest.approx(1) + ) == pytest.approx(abs(d)) assert rmsd.hrmsd( mol1.coordinates, mol2.coordinates, mol1.atomicnums, mol2.atomicnums - ) == pytest.approx(1) + ) == pytest.approx(abs(d)) # Rotations different than 180 degrees introduce numerical errors (~1e-11) mol2.rotate(angle, [0, 0, 1], units="deg") - assert ( - rmsd.rmsd(mol1.coordinates, mol2.coordinates, mol1.atomicnums, mol2.atomicnums) - > 1 - ) + assert rmsd.rmsd( + mol1.coordinates, mol2.coordinates, mol1.atomicnums, mol2.atomicnums + ) > abs(d) assert rmsd.hrmsd( mol1.coordinates, mol2.coordinates, mol1.atomicnums, mol2.atomicnums - ) == pytest.approx(1, abs=tol) + ) == pytest.approx(abs(d), abs=tol) @pytest.mark.parametrize("mol", molecules.allmolecules) From 78e12b313d30826a19ae7fc4fd9e83714ebf8442 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 31 Aug 2020 17:05:28 +0100 Subject: [PATCH 08/13] update readme --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 21d1dfc..4c240cd 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,29 @@ [![Docs](https://img.shields.io/badge/docs-spyrmsd.readthedocs.io-blueviolet)](https://spyrmsd.readthedocs.io) [![Documentation Status](https://readthedocs.org/projects/spyrmsd/badge/?version=develop)](https://spyrmsd.readthedocs.io/en/develop/?badge=develop) -[![DOI](https://zenodo.org/badge/214157073.svg)](https://zenodo.org/badge/latestdoi/214157073) [![License](https://img.shields.io/github/license/RMeli/pyrmsd?color=%2333BBFF)](https://opensource.org/licenses/MIT) [![PyPI](https://img.shields.io/badge/PyPI-v0.3.4%20-ff69b4)](https://pypi.org/project/spyrmsd/) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/spyrmsd.svg)](https://anaconda.org/conda-forge/spyrmsd) +[![J. Cheminform.](https://img.shields.io/badge/J.%20Cheminform.-10.1186%2Fs13321--020--00455--2-blue)](https://doi.org/10.1186/s13321-020-00455-2) +[![Zenodo](https://zenodo.org/badge/214157073.svg)](https://zenodo.org/badge/latestdoi/214157073) + Python tool for symmetry-corrected RMSD calculations. +--- + +If you find `spyrmsd` useful, please consider citing the following paper: + +> @article{spyrmsd, +> Author = {Meli, Rocco and Biggin, Philip C.}, +> Journal = {Journal of Cheminformatics}, +> Number = {1}, +> Pages = {49}, +> Title = {spyrmsd: symmetry-corrected RMSD calculations in Python}, +> Volume = {12}, +> Year = {2020} +> } + ## Installation `spyrmsd` is available on [PyPI](https://pypi.org/project/spyrmsd/) and [conda-forge](https://github.com/conda-forge/spyrmsd-feedstock) and can be easily installed from source. See [Dependencies](###Dependencies) for a description of all the dependencies. From 5581c987225aa7708cab72a429f23e5ebb69a92b Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 31 Aug 2020 17:09:25 +0100 Subject: [PATCH 09/13] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index b6bd69c..9dfe1d1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: ["https://www.buymeacoffee.com/rmeli"] +custom: # ["https://www.buymeacoffee.com/rmeli"] From 582683bbf555d3cc0e3bbf213a7b7a159a6e14d6 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 1 Sep 2020 09:57:00 +0100 Subject: [PATCH 10/13] added doi to J Cheminform paper --- spyrmsd/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spyrmsd/__init__.py b/spyrmsd/__init__.py index 80d1731..7fe05d0 100644 --- a/spyrmsd/__init__.py +++ b/spyrmsd/__init__.py @@ -14,5 +14,11 @@ due.cite( Doi("10.5281/zenodo.3631876"), # lgtm[py/procedure-return-value-used] path="spyrmsd", - description="spyRMSD: Symmetry-Corrected RMSD in Python", + description="spyrmsd", +) + +due.cite( + Doi("10.1186/s13321-020-00455-2"), # lgtm[py/procedure-return-value-used] + path="spyrmsd", + description="spyrmsd", ) From 871a0e103c5eca76ea5de048db1ffcb05a7da618 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Tue, 1 Sep 2020 13:19:42 +0100 Subject: [PATCH 11/13] update readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4c240cd..644ccc3 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ The following packages are required to use `spyrmsd` as a module: * [scipy](https://www.scipy.org/) * [qcelemental](http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/) -_Note_: `spyrmsd` uses [graph-tool](https://graph-tool.skewed.de/) by default but will fall back to [NetworkX](https://networkx.github.io/) if the former is not installed (e.g. on Windows). +_Note_: `spyrmsd` uses [graph-tool](https://graph-tool.skewed.de/) by default but will fall back to [NetworkX](https://networkx.github.io/) if the former is not installed (e.g. on Windows). However, in order to support cross-platform installation [NetworkX](https://networkx.github.io/) is installed by default. #### Standalone Tool @@ -81,7 +81,7 @@ 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/) has to be installed using `conda` ([Why the RDKit isn't available on PyPi](https://rdkit.blogspot.com/2019/11/why-rdkit-isnt-available-on-pypi.html)). +_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 @@ -92,8 +92,7 @@ python -m spyrmsd.spyrmsd -h ``` ```text -usage: spyrmsd.py [-h] [-m] [-c] [--hydrogens] [-n] - reference molecules [molecules ...] +usage: spyrmsd.py [-h] [-m] [-c] [--hydrogens] [-n] reference molecules [molecules ...] Python RMSD tool. From 99fb844a3c381a0dace54e96c599ef3219385467 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Wed, 2 Sep 2020 16:07:07 +0100 Subject: [PATCH 12/13] change citation style in readme --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 644ccc3..2fe24a9 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,17 @@ Python tool for symmetry-corrected RMSD calculations. If you find `spyrmsd` useful, please consider citing the following paper: -> @article{spyrmsd, -> Author = {Meli, Rocco and Biggin, Philip C.}, -> Journal = {Journal of Cheminformatics}, -> Number = {1}, -> Pages = {49}, -> Title = {spyrmsd: symmetry-corrected RMSD calculations in Python}, -> Volume = {12}, -> Year = {2020} -> } +``` +@article{spyrmsd2020, + Author = {Meli, Rocco and Biggin, Philip C.}, + Journal = {Journal of Cheminformatics}, + Number = {1}, + Pages = {49}, + Title = {spyrmsd: symmetry-corrected RMSD calculations in Python}, + Volume = {12}, + Year = {2020} +} +``` ## Installation From 388544f3af283e119e0c359d0fb0d19da847139d Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Sun, 6 Sep 2020 16:50:36 +0100 Subject: [PATCH 13/13] prepare for release --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fe24a9..bcf373e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![Documentation Status](https://readthedocs.org/projects/spyrmsd/badge/?version=develop)](https://spyrmsd.readthedocs.io/en/develop/?badge=develop) [![License](https://img.shields.io/github/license/RMeli/pyrmsd?color=%2333BBFF)](https://opensource.org/licenses/MIT) -[![PyPI](https://img.shields.io/badge/PyPI-v0.3.4%20-ff69b4)](https://pypi.org/project/spyrmsd/) +[![PyPI](https://img.shields.io/badge/PyPI-v0.3.5%20-ff69b4)](https://pypi.org/project/spyrmsd/) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/spyrmsd.svg)](https://anaconda.org/conda-forge/spyrmsd) [![J. Cheminform.](https://img.shields.io/badge/J.%20Cheminform.-10.1186%2Fs13321--020--00455--2-blue)](https://doi.org/10.1186/s13321-020-00455-2)