Skip to content

Commit

Permalink
Merge pull request #23 from RMeli/develop
Browse files Browse the repository at this point in the history
graph-tool Support and General Refactoring
  • Loading branch information
RMeli authored Feb 25, 2020
2 parents 4970dff + e981043 commit 1c0d03a
Show file tree
Hide file tree
Showing 135 changed files with 21,364 additions and 494 deletions.
11 changes: 8 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ environment:
- PYTHON: "C:\\Miniconda36-x64"
PYTHON_VERSION: "3.6"
CHEM: "obabel"
GRAPH: "nx"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Miniconda36-x64"
PYTHON_VERSION: "3.6"
CHEM: "rdkit"
GRAPH: "nx"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Miniconda37-x64"
PYTHON_VERSION: "3.7"
CHEM: "obabel"
GRAPH: "nx"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Miniconda37-x64"
PYTHON_VERSION: "3.7"
CHEM: "rdkit"
GRAPH: "nx"
PYTHON_ARCH: "64"

# graph-tool not supported on Windows

install:
# Make sure pip is around
Expand All @@ -35,7 +41,7 @@ install:
- conda update --all

# Create test environment for package
- python devtools\\scripts\\create_conda_env.py -n=test -p=%PYTHON_VERSION% devtools\\conda-envs\\spyrmsd-test-%CHEM%.yaml
- python devtools\\scripts\\create_conda_env.py -n=test -p=%PYTHON_VERSION% devtools\\conda-envs\\spyrmsd-test-%CHEM%-%GRAPH%.yaml

# Activate the test environment
- activate test
Expand All @@ -47,10 +53,9 @@ build: false

test_script:
# Run test and get coverage report
- pytest -v --cov=spyrmsd tests
- pytest -v --cov=spyrmsd tests --runslow

# Run checks
- black .
- flake8
- mypy

Expand Down
62 changes: 58 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,98 @@ matrix:
env:
- PYTHON_VER=3.6
- CHEM=obabel
- GRAPH=nx
- os: osx
language: generic
env:
- PYTHON_VER=3.6
- CHEM=rdkit
- GRAPH=nx
- os: osx
language: generic
env:
- PYTHON_VER=3.7
- CHEM=obabel
- GRAPH=nx
- os: osx
language: generic
env:
- PYTHON_VER=3.7
- CHEM=rdkit
- GRAPH=nx
- os: osx
language: generic
env:
- PYTHON_VER=3.6
- CHEM=obabel
- GRAPH=gt
- os: osx
language: generic
env:
- PYTHON_VER=3.6
- CHEM=rdkit
- GRAPH=gt
- os: osx
language: generic
env:
- PYTHON_VER=3.7
- CHEM=obabel
- GRAPH=gt
- os: osx
language: generic
env:
- PYTHON_VER=3.7
- CHEM=rdkit
- GRAPH=gt


- os: linux
language: generic
env:
- PYTHON_VER=3.6
- CHEM=obabel
- GRAPH=nx
- os: linux
language: generic
env:
- PYTHON_VER=3.6
- CHEM=rdkit
- GRAPH=nx
- os: linux
language: generic
env:
- PYTHON_VER=3.7
- CHEM=obabel
- GRAPH=nx
- os: linux
language: generic
env:
- PYTHON_VER=3.7
- CHEM=rdkit
- GRAPH=nx
- os: linux
language: generic
env:
- PYTHON_VER=3.6
- CHEM=obabel
- GRAPH=gt
- os: linux
language: generic
env:
- PYTHON_VER=3.6
- CHEM=rdkit
- GRAPH=gt
- os: linux
language: generic
env:
- PYTHON_VER=3.7
- CHEM=obabel
- GRAPH=gt
- os: linux
language: generic
env:
- PYTHON_VER=3.7
- CHEM=rdkit
- GRAPH=gt

before_install:
# Additional info about the build
Expand All @@ -57,18 +112,17 @@ before_install:

install:
# Create test environment for package
- python devtools/scripts/create_conda_env.py -n=test -p=${PYTHON_VER} devtools/conda-envs/spyrmsd-test-${CHEM}.yaml
- python devtools/scripts/create_conda_env.py -n=test -p=${PYTHON_VER} devtools/conda-envs/spyrmsd-test-${CHEM}-${GRAPH}.yaml
# Activate the test environment
- conda activate test
# Build and install package
- python setup.py develop --no-deps

script:
# Run test and get coverage report
- pytest -v --cov=spyrmsd tests/
- pytest -v --cov=spyrmsd tests/ --runslow

# Run checks
- black .
- flake8
- mypy

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

MIT License

Copyright (c) 2019 Rocco Meli
Copyright (c) 2019-2020 Rocco Meli

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
70 changes: 32 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
[![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)
[![Docs](https://img.shields.io/badge/docs-pyrmsd.readthedocs.io-blueviolet)](https://pyrmsd.readthedocs.io)
[![PyPI](https://img.shields.io/badge/PyPI-0.2.1%20-ff69b4)](https://pypi.org/project/spyrmsd/)
[![Docs](https://img.shields.io/badge/docs-spyrmsd.readthedocs.io-blueviolet)](https://spyrmsd.readthedocs.io)
[![PyPI](https://img.shields.io/badge/PyPI-0.3.0%20-ff69b4)](https://pypi.org/project/spyrmsd/)
[![License](https://img.shields.io/github/license/RMeli/pyrmsd?color=%2333BBFF)](https://opensource.org/licenses/MIT)

Python-first tool for symmetry-corrected RMSD calculations.
Python tool for symmetry-corrected RMSD calculations.

## Installation

Expand All @@ -21,8 +21,6 @@ Python-first tool for symmetry-corrected RMSD calculations.
pip install spyrmsd
```

This install `spyrmsd` as a library. In order to use the standalone RMSD calculation tool, you will need to install [Open Babel](http://openbabel.org/) or [RDKit](https://rdkit.org/).

### GitHub

```bash
Expand All @@ -33,6 +31,26 @@ pip install .

### conda

### Dependencies

`spyrmsd` can be used both as a module or a standalone tool.

#### Module

The following packages are required to use `spyrmsd` as a module:

* [graph-tool](https://graph-tool.skewed.de/) or [NetworkX](https://networkx.github.io/)
* [numpy](https://numpy.org/)
* [scipy](https://www.scipy.org/)
* [qcelemental](http://docs.qcarchive.molssi.org/projects/qcelemental/en/latest/)

#### Standalone Tool

Additionally, one of the following packages are required to use `spyrmsd` as a standalone tool:

* [Open Babel](http://openbabel.org/)
* [RDKit](https://rdkit.org/)

## Usage

### Standalone
Expand Down Expand Up @@ -67,45 +85,21 @@ from spyrmsd import rmsd

#### RMSD

The function `rmsd.rmsd` computes RMSD without symmetry correction. The atoms are expected to be in the same order for both molecule being compared (no atom matching is performed).

#### Symmetric RMSD

The function `rmsd.rmsd_isomorphic` computes symmetry-corrected RMSD, using molecular graph isomorphisms. Symmetry correction requires molecular adjacency matrices but needs not the atoms to be in the same order.

## Contributions
The function `rmsd.rmsd` computes RMSD without symmetry correction. The atoms are expected to be in the same order for both molecules being compared (no atom matching is performed).

### List of Contributors
#### Symmetry-Corrected RMSD

| Name | GitHub |
| :----------------: | :-------------: |
| Rocco Meli | @RMeli |
The function `rmsd.symmrmsd` computes symmetry-corrected RMSD using molecular graph isomorphisms. Symmetry correction requires molecular adjacency matrices describing the connectivity but needs not the atoms to be in the same order.

### Tools
Atom matching is performed according to the molecular graph. Therefore, this function should be used when atoms in the molecules being compared are not in the same order (even if there is not symmetry).

#### Formatting
## Development

The code is automatically formatted using [black](https://black.readthedocs.io/en/stable/):
To ensure code quality and consistency the following tools are used during development:

```bash
black .
```

#### Style

Code style is enforced using [Flake 8](http://flake8.pycqa.org/en/latest/)

```bash
flake8
```

#### Static Checks

Static checks are performed using [mypy](http://mypy-lang.org/)

```bash
mypy
```
* [black](https://black.readthedocs.io/en/stable/)
* [Flake 8](http://flake8.pycqa.org/en/latest/) (CI)
* [mypy](http://mypy-lang.org/) (CI)

## Deployment

Expand Down
2 changes: 2 additions & 0 deletions devtools/conda-envs/spyrmsd-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
- pandas
- scipy
- networkx
- graph-tool
- scikit-learn

# Chemistry
Expand All @@ -29,6 +30,7 @@ dependencies:
# Testing
- pytest
- pytest-cov
- pytest-benchmark
- codecov

# Doc
Expand Down
3 changes: 1 addition & 2 deletions devtools/conda-envs/spyrmsd-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ channels:
dependencies:
# Base
- python
- pip
- ipython

# Maths
- numpy
- scipy
- networkx
- graph-tool

# Chemistry
- openbabel
Expand Down
26 changes: 26 additions & 0 deletions devtools/conda-envs/spyrmsd-test-obabel-gt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: spyrmsd
channels:
- conda-forge
dependencies:
# Base
- python

# Maths
- numpy
- scipy
- graph-tool

# Chemistry
- openbabel
- qcelemental

# Testing
- pytest
- pytest-cov
- pytest-benchmark

# Dev
- mypy
- flake8
- black
- codecov
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
# Testing
- pytest
- pytest-cov
- pytest-benchmark

# Dev
- mypy
Expand Down
27 changes: 27 additions & 0 deletions devtools/conda-envs/spyrmsd-test-rdkit-gt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: spyrmsd
channels:
- conda-forge
- rdkit
dependencies:
# Base
- python

# Maths
- numpy
- scipy
- graph-tool

# Chemistry
- rdkit
- qcelemental

# Testing
- pytest
- pytest-cov
- pytest-benchmark

# Dev
- mypy
- flake8
- black
- codecov
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
# Testing
- pytest
- pytest-cov
- pytest-benchmark

# Dev
- mypy
Expand Down
2 changes: 1 addition & 1 deletion devtools/conda-envs/spyrmsd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
# Maths
- numpy
- scipy
- networkx
- graph-tool

# Chemistry
- qcelemental
Loading

0 comments on commit 1c0d03a

Please sign in to comment.