Skip to content

Commit

Permalink
Merge branch 'release/v1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
philopon committed May 30, 2018
2 parents 43a7ac8 + 09bff65 commit 5e86fad
Show file tree
Hide file tree
Showing 81 changed files with 605 additions and 321 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ env:
- [email protected]:mordred-descriptor/documentation.git
- secure: IrmS3kBWNvkC/bFObF0jIHUpdFTasEH8QXXK9mh6M+mfdy34qvpnWffzDcuS2ZD1oyLE1YsMxA9MDVmw/PBY27q1wxmQ1ZQFpBoMDsjmczZ4bI/5oiaAekVktAGc4lX3knmQju2nqqb/MZRB9qmpiPFM3xNRDVikSBdOw92SHwGOIsq5r9Rlp0o5vzj0Qo9HREmlAtpbhtdWpWRU94hnDTgwlQJyd4xBq9Y0CLO45KDV6gkq5sEkfiKQnUzElMPEy8NNGKmK3pLD1PCwLt/42dNSEdIXSw9w/pMWk/fGiS2ebsf+Ch/8jTFTdW3Oq3P/NxJuA8t3aYrdcvDy5lmQHrEr+bf4D/xsMtAVS3igIQHKBBp2fSqwIm+KpMyHmA3//jG76+kmE8j1GpBjctdz4ExbCyRlQFhI3r7qQ/tQ9pHHwcZwx8MX/hzslpNhSuBRTIR/4mi3wckYU2kq7UjKbwuHUkcbMwgkKrH1D2cjhQypOnzEBindd+T9mPQYoewdtSQLAbpPsmJbFE/q9SgG/XjmH4k/mlItFLZiOIKTKFGTkXNY1Wqbht95365O4uSbnmzDEwTSISR0qhtjoDVBMowY/1ZBQUM9/Y9aS5KD5uU8FBUbQ3lR641zD14kGBallpCCRTRxgRt19q5R469jKoBA5eWWzRGp86Q19Ywdnbc=
matrix:
- PYTHON_VERSION=3.6 COVERAGE=true DOCUMENTATION=true
- PYTHON_VERSION=3.6 COVERAGE=true DOCUMENTATION=true LINT=true
- PYTHON_VERSION=3.5 COVERAGE=true
- PYTHON_VERSION=2.7 COVERAGE=true
os:
- linux
- osx
sudo: false
before_install: "./scripts/travis/before_install.sh"
install: "./scripts/install.sh"
script: "./scripts/test_script.sh"
after_success: "./scripts/after_success.sh"
before_install: "./extra/ci/before_install.sh"
install: "./extra/ci/install.sh"
script: "./extra/ci/test_script.sh"
after_success: "./extra/ci/after_success.sh"
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ molecular descriptor calculator.
.. image:: https://img.shields.io/badge/doi-10.1186%2Fs13321--018--0258--y-blue.svg
:target: https://doi.org/10.1186/s13321-018-0258-y

number of descriptors
---------------------
.. code:: python
>>> from mordred import Calculator, descriptors
>>> n_all = len(Calculator(descriptors, ignore_3D=False).descriptors)
>>> n_2D = len(Calculator(descriptors, ignore_3D=True).descriptors)
>>> print("2D: {:5}\n3D: {:5}\n------------\ntotal: {:5}".format(n_2D, n_all - n_2D, n_all))
2D: 1613
3D: 212
------------
total: 1825
Installation
------------
Expand Down Expand Up @@ -161,7 +173,10 @@ as library
>>> calc = Calculator(descriptors, ignore_3D=True)
>>> len(calc.descriptors)
1615
1613
>>> len(Calculator(descriptors, ignore_3D=True, version="1.0.0"))
1612
# calculate single molecule
>>> mol = Chem.MolFromSmiles('c1ccccc1')
Expand Down Expand Up @@ -191,4 +206,5 @@ Documentation
- `master <http://mordred-descriptor.github.io/documentation/master>`__
- `develop <http://mordred-descriptor.github.io/documentation/develop>`__

- `v1.1.0 <http://mordred-descriptor.github.io/documentation/v1.1.0>`__
- `v1.0.0 <http://mordred-descriptor.github.io/documentation/v1.0.0>`__
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ environment:
- PYTHON_VERSION: 2.7
MINICONDA: C:\Miniconda

install: '%CYG_ROOT%/bin/bash ./scripts/install.sh'
test_script: '%CYG_ROOT%/bin/bash ./scripts/test_script.sh'
on_success: '%CYG_ROOT%/bin/bash ./scripts/after_success.sh'
install: '%CYG_ROOT%/bin/bash ./extra/ci/install.sh'
test_script: '%CYG_ROOT%/bin/bash ./extra/ci/test_script.sh'
on_success: '%CYG_ROOT%/bin/bash ./extra/ci/after_success.sh'
4 changes: 3 additions & 1 deletion examples/article/Code4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from distutils.version import StrictVersion

from mordred.RingCount import RingCount

# Start Code 4
presets = list(RingCount.preset())
presets = list(RingCount.preset(version=StrictVersion("1.0.0")))
print(len(presets))
7 changes: 6 additions & 1 deletion scripts/after_success.sh → extra/ci/after_success.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash

set -e
source ./scripts/add_path.sh

if [[ ! -f ~/.ssh/id_rsa ]]; then
exit 0
fi

source ./extra/ci/conda.sh

[[ -n "$COVERAGE" ]] && coveralls

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

set -e

openssl aes-256-cbc -K $encrypted_9f3357583363_key -iv $encrypted_9f3357583363_iv -in ./scripts/id_rsa.enc -out ~/.ssh/id_rsa -d
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo this is PR
exit 0
fi

openssl aes-256-cbc -K $encrypted_9f3357583363_key -iv $encrypted_9f3357583363_iv -in ./extra/id_rsa.enc -out ~/.ssh/id_rsa -d
chmod 600 ~/.ssh/id_rsa

echo "StrictHostKeyChecking no" >> ~/.ssh/config
Expand Down
File renamed without changes.
21 changes: 13 additions & 8 deletions scripts/install.sh → extra/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -e

REQUIREMENTS=./extra/requirements
CONDA_REQ_FILE=requirements-conda.txt
PIP_REQ_FILE=requirements-pip.txt

# install conda

if [[ "$TRAVIS_OS_NAME" == osx ]]; then
Expand All @@ -17,7 +21,7 @@ if [[ -n "$TRAVIS_OS_NAME" ]]; then
bash miniconda.sh -b -p $HOME/miniconda
fi

source ./scripts/add_path.sh
source ./extra/ci/conda.sh

# setup conda

Expand All @@ -28,19 +32,20 @@ conda config --add channels rdkit --add channels mordred-descriptor

# install requirements

CONDA_REQ_FILE=requirements-conda.txt
PIP_REQ_FILE=requirements-pip.txt
cat $REQUIREMENTS/requirements-conda.txt $REQUIREMENTS/requirements.txt > $CONDA_REQ_FILE

cat ./scripts/requirements-conda.txt ./scripts/requirements.txt > $CONDA_REQ_FILE
if [[ "$PYTHON_VERSION" < 3.4 ]]; then
echo enum34 >> $CONDA_REQ_FILE
fi

[[ "$PYTHON_VERSION" < 3.4 ]] && echo enum34 >> $CONDA_REQ_FILE

[[ -n "$COVERAGE" ]] && echo coveralls >> $PIP_REQ_FILE
if [[ -n "$LINT" ]]; then
cat $REQUIREMENTS/requirements-flake8.txt >> $PIP_REQ_FILE
fi

if [[ -n "$DOCUMENTATION" ]]; then
echo sphinx >> $CONDA_REQ_FILE
echo sphinx_rtd_theme >> $CONDA_REQ_FILE
echo sphinxcontrib-bibtex >> $PIP_REQ_FILE
cat $REQUIREMENTS/requirements-documentation.txt >> $PIP_REQ_FILE
fi

conda install python=$PYTHON_VERSION --file $CONDA_REQ_FILE
Expand Down
7 changes: 6 additions & 1 deletion scripts/test_script.sh → extra/ci/test_script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

set -e
source ./scripts/add_path.sh
source ./extra/ci/conda.sh

if [[ -n "$COVERAGE" ]]; then
python -m mordred.tests -q --with-coverage
Expand All @@ -16,3 +16,8 @@ for example in `find examples -name '*.py'`; do
echo "test $example" >&2
PYTHONPATH=. python $example > /dev/null
done

if [[ -n "$LINT" ]]; then
python setup.py flake8
python setup.py isort
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions extra/requirements/requirements-documentation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
sphinx_rtd_theme
sphinxcontrib-bibtex
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions mordred/ABCIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from ._base import Descriptor
from ._graph_matrix import DistanceMatrix

__all__ = ("ABCIndex", "ABCGGIndex",)
__all__ = ("ABCIndex", "ABCGGIndex")


class ABCIndexBase(Descriptor):
__slots__ = ()

@classmethod
def preset(cls):
def preset(cls, version):
yield cls()

explicit_hydrogens = False
Expand All @@ -39,6 +39,7 @@ class ABCIndex(ABCIndexBase):
"""

since = "1.0.0"
__slots__ = ()

def description(self):
Expand Down Expand Up @@ -68,6 +69,7 @@ class ABCGGIndex(ABCIndexBase):
""" # noqa: E501

since = "1.0.0"
__slots__ = ()

def description(self):
Expand Down
10 changes: 6 additions & 4 deletions mordred/AcidBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

from ._base import Descriptor

__all__ = ("AcidicGroupCount", "BasicGroupCount",)
__all__ = ("AcidicGroupCount", "BasicGroupCount")


class SmartsCountBase(Descriptor):
__slots__ = "_mol",
__slots__ = ("_mol",)

@classmethod
def preset(cls):
def preset(cls, version):
yield cls()

def _create_smarts(self):
Expand All @@ -43,12 +43,13 @@ def calculate(self):

rtype = int

_extra_docs = "SMARTS",
_extra_docs = ("SMARTS",)


class AcidicGroupCount(SmartsCountBase):
r"""acidic group count descriptor."""

since = "1.0.0"
__slots__ = ()

def description(self):
Expand All @@ -67,6 +68,7 @@ def description(self):
class BasicGroupCount(SmartsCountBase):
r"""basic group count descriptor."""

since = "1.0.0"
__slots__ = ()

def description(self):
Expand Down
17 changes: 13 additions & 4 deletions mordred/AdjacencyMatrix.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
from distutils.version import StrictVersion

from ._base import Descriptor
from ._graph_matrix import AdjacencyMatrix as A
from ._matrix_attributes import methods, get_method
from ._matrix_attributes import SM1, methods, get_method

__all__ = ("AdjacencyMatrix",)


_version_remove_SM1_A = StrictVersion("1.1.0")


class AdjacencyMatrix(Descriptor):
r"""adjacency matrix descriptor.
:type type: :py:class:`str`
:param type: :ref:`matrix_aggregating_methods`
"""

since = "1.0.0"
__slots__ = ("_type",)
explicit_hydrogens = False

def description(self):
return "{} of adjacency matrix".format(self._type.__name__)

@classmethod
def preset(cls):
return map(cls, methods)
def preset(cls, version):
if version >= _version_remove_SM1_A:
return (cls(m) for m in methods if m != SM1)
else:
return map(cls, methods)

def __str__(self):
return "{}_A".format(self._type.__name__)

def parameters(self):
return self._type,
return (self._type,)

def __init__(self, type="SpMax"):
self._type = get_method(type)
Expand Down
4 changes: 3 additions & 1 deletion mordred/Aromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AromaticBase(Descriptor):
__slots__ = ()

@classmethod
def preset(cls):
def preset(cls, version):
yield cls()

def __str__(self):
Expand All @@ -24,6 +24,7 @@ def parameters(self):
class AromaticAtomsCount(AromaticBase):
r"""aromatic atoms count descriptor."""

since = "1.0.0"
__slots__ = ()
_name = "nAromAtom"

Expand All @@ -41,6 +42,7 @@ def calculate(self):
class AromaticBondsCount(AromaticBase):
r"""aromatic bonds count descriptor."""

since = "1.0.0"
__slots__ = ()
_name = "nAromBond"

Expand Down
28 changes: 21 additions & 7 deletions mordred/AtomCount.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from distutils.version import StrictVersion

from rdkit.Chem import rdMolDescriptors

from ._base import Descriptor
Expand All @@ -11,12 +13,15 @@
"Atom": "all",
"Bridgehead": "bridgehead",
"HeavyAtom": "heavy",
"Spiro": "spiro",
"Hetero": "hetero",
"Spiro": "spiro",
"X": "halogen",
}


_version_add_Nhetero = StrictVersion("1.1.0")


class AtomCount(Descriptor):
r"""atom count descriptor.
Expand All @@ -32,17 +37,26 @@ class AtomCount(Descriptor):
* element symbol
"""

since = "1.0.0"
__slots__ = ("_type",)

def description(self):
return "number of {} atoms".format(_desc_conv.get(self._type, self._type))

@classmethod
def preset(cls):
return map(cls, [
"Atom", "HeavyAtom", "Spiro", "Bridgehead", "Hetero",
"H", "B", "C", "N", "O", "S", "P", "F", "Cl", "Br", "I", "X",
])
def preset(cls, version):
if version >= _version_add_Nhetero:
t = [
"Atom", "HeavyAtom", "Spiro", "Bridgehead", "Hetero",
"H", "B", "C", "N", "O", "S", "P", "F", "Cl", "Br", "I", "X",
]
else:
t = [
"Atom", "HeavyAtom", "Spiro", "Bridgehead",
"H", "B", "C", "N", "O", "S", "P", "F", "Cl", "Br", "I", "X",
]

return map(cls, t)

@property
def explicit_hydrogens(self):
Expand All @@ -53,7 +67,7 @@ def __str__(self):
return "n" + self._type

def parameters(self):
return self._type,
return (self._type,)

def __init__(self, type="Atom"):
self._type = type
Expand Down
Loading

0 comments on commit 5e86fad

Please sign in to comment.