diff --git a/.travis.yml b/.travis.yml index dfda84d..c8527ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,10 @@ script: - conda config --add channels ${ORGNAME} # Add omnia dev channels - conda config --add channels https://conda.anaconda.org/omnia/label/dev + # Add the conda-forge channel + - conda config --add channels conda-forge + # Update everything + - conda update --quiet --yes --all # Install OpenEye toolkit - conda install --yes --quiet pip - pip install $OPENEYE_CHANNEL openeye-toolkits && python -c "import openeye; print(openeye.__version__)" @@ -55,12 +59,12 @@ env: matrix: # OpenEye production - CONDA_PY=27 python=2.7 OPENEYE_CHANNEL="-i https://pypi.anaconda.org/OpenEye/simple/" - - CONDA_PY=34 python=3.4 OPENEYE_CHANNEL="-i https://pypi.anaconda.org/OpenEye/simple/" - CONDA_PY=35 python=3.5 OPENEYE_CHANNEL="-i https://pypi.anaconda.org/OpenEye/simple/" + - CONDA_PY=36 python=3.6 OPENEYE_CHANNEL="-i https://pypi.anaconda.org/OpenEye/simple/" # OpenEye beta - CONDA_PY=27 python=2.7 OPENEYE_CHANNEL="--pre -i https://pypi.anaconda.org/OpenEye/simple/" - - CONDA_PY=34 python=3.4 OPENEYE_CHANNEL="--pre -i https://pypi.anaconda.org/OpenEye/simple/" - CONDA_PY=35 python=3.5 OPENEYE_CHANNEL="--pre -i https://pypi.anaconda.org/OpenEye/simple/" + - CONDA_PY=36 python=3.6 OPENEYE_CHANNEL="--pre -i https://pypi.anaconda.org/OpenEye/simple/" global: - ORGNAME="omnia" diff --git a/devtools/travis-ci/install.sh b/devtools/travis-ci/install.sh index e34e351..f74ef43 100755 --- a/devtools/travis-ci/install.sh +++ b/devtools/travis-ci/install.sh @@ -9,5 +9,5 @@ bash $MINICONDA -b -p $HOME/miniconda PIP_ARGS="-U" export PATH=$HOME/miniconda/bin:$PATH - -conda install --yes conda-build=2.1.5 jinja2 anaconda-client pip +conda update --yes conda +conda install --yes conda-build=2.1.7 jinja2 anaconda-client pip diff --git a/oe_license.txt.enc b/oe_license.txt.enc index 7dcb789..2460da8 100644 Binary files a/oe_license.txt.enc and b/oe_license.txt.enc differ diff --git a/openmoltools/openeye.py b/openmoltools/openeye.py index 1ca0ede..3e00c2d 100644 --- a/openmoltools/openeye.py +++ b/openmoltools/openeye.py @@ -105,7 +105,9 @@ def get_charges(molecule, max_confs=800, strictStereo=True, def normalize_molecule(molecule): - """Normalize a copy of the molecule by checking aromaticity, adding explicit hydrogens, and renaming by IUPAC name. + """ + Normalize a copy of the molecule by checking aromaticity, adding explicit hydrogens, and + (if possible) renaming by IUPAC name. Parameters ---------- @@ -119,9 +121,10 @@ def normalize_molecule(molecule): """ oechem = import_("openeye.oechem") - if not oechem.OEChemIsLicensed(): raise(ImportError("Need License for OEChem!")) + if not oechem.OEChemIsLicensed(): + raise(ImportError("Need License for OEChem!")) oeiupac = import_("openeye.oeiupac") - if not oeiupac.OEIUPACIsLicensed(): raise(ImportError("Need License for OEOmega!")) + has_iupac = oeiupac.OEIUPACIsLicensed() molcopy = oechem.OEMol(molecule) @@ -132,8 +135,9 @@ def normalize_molecule(molecule): oechem.OEAddExplicitHydrogens(molcopy) # Set title to IUPAC name. - name = oeiupac.OECreateIUPACName(molcopy) - molcopy.SetTitle(name) + if has_iupac: + name = oeiupac.OECreateIUPACName(molcopy) + molcopy.SetTitle(name) # Check for any missing atom names, if found reassign all of them. if any([atom.GetName() == '' for atom in molcopy.GetAtoms()]): @@ -141,6 +145,7 @@ def normalize_molecule(molecule): return molcopy + def iupac_to_oemol(iupac_name): """Create a OEMolBuilder from a iupac name. @@ -156,9 +161,11 @@ def iupac_to_oemol(iupac_name): """ oechem = import_("openeye.oechem") - if not oechem.OEChemIsLicensed(): raise(ImportError("Need License for OEChem!")) + if not oechem.OEChemIsLicensed(): + raise(ImportError("Need License for OEChem!")) oeiupac = import_("openeye.oeiupac") - if not oeiupac.OEIUPACIsLicensed(): raise(ImportError("Need License for OEOmega!")) + if not oeiupac.OEIUPACIsLicensed(): + raise(ImportError("Need License for OEIupac!")) # Create an OEMol molecule from IUPAC name. molecule = oechem.OEMol() # create a molecule @@ -171,6 +178,7 @@ def iupac_to_oemol(iupac_name): return molecule + def smiles_to_oemol(smiles): """Create a OEMolBuilder from a smiles string. diff --git a/openmoltools/tests/test_openeye.py b/openmoltools/tests/test_openeye.py index 708b496..b128d77 100644 --- a/openmoltools/tests/test_openeye.py +++ b/openmoltools/tests/test_openeye.py @@ -11,7 +11,7 @@ import openmoltools.openeye import pandas as pd import mdtraj as md -from mdtraj.testing import raises +from numpy.testing import assert_raises smiles_fails_with_strictStereo = "CN1CCN(CC1)CCCOc2cc3c(cc2OC)C(=[NH+]c4cc(c(cc4Cl)Cl)OC)C(=C=[N-])C=[NH+]3" @@ -237,17 +237,17 @@ def test_ffxml_simulation(): @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") -@raises(RuntimeError) def test_charge_fail1(): - with utils.enter_temp_directory(): - openmoltools.openeye.smiles_to_antechamber(smiles_fails_with_strictStereo, "test.mol2", "test.frcmod", strictStereo=True) + with assert_raises(RuntimeError): + with utils.enter_temp_directory(): + openmoltools.openeye.smiles_to_antechamber(smiles_fails_with_strictStereo, "test.mol2", "test.frcmod", strictStereo=True) @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") -@raises(RuntimeError) def test_charge_fail2(): - m = openmoltools.openeye.smiles_to_oemol(smiles_fails_with_strictStereo) - m = openmoltools.openeye.get_charges(m, strictStereo=True, keep_confs=1) + with assert_raises(RuntimeError): + m = openmoltools.openeye.smiles_to_oemol(smiles_fails_with_strictStereo) + m = openmoltools.openeye.get_charges(m, strictStereo=True, keep_confs=1) @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") @@ -262,11 +262,11 @@ def test_charge_success2(): m = openmoltools.openeye.get_charges(m, strictStereo=False) @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") -@raises(RuntimeError) def test_oeassigncharges_fail(): - # Fail test for OEToolkits (2017.2.1) new charging function - m = openmoltools.openeye.smiles_to_oemol(smiles_fails_with_strictStereo) - m = openmoltools.openeye.get_charges(m, strictStereo=False, legacy=False) + with assert_raises(RuntimeError): + # Fail test for OEToolkits (2017.2.1) new charging function + m = openmoltools.openeye.smiles_to_oemol(smiles_fails_with_strictStereo) + m = openmoltools.openeye.get_charges(m, strictStereo=False, legacy=False) @skipIf(not HAVE_OE, "Cannot test openeye module without OpenEye tools.") def test_oeassigncharges_success(): diff --git a/setup.py b/setup.py index ac9a2f1..b048181 100644 --- a/setup.py +++ b/setup.py @@ -21,11 +21,9 @@ setup_kwargs = {} cython_extension = 'c' - - ########################## -VERSION = "0.8.2dev0" -ISRELEASED = False +VERSION = "0.8.2" +ISRELEASED = True __version__ = VERSION ##########################