Пример #1
0
def check_ob223():
    import openbabel
    from chemfp import openbabel
    assert openbabel._ob_version == "2.2.3", openbabel._ob_version
    assert not support.can_skip("ob")
    assert not support.can_skip("ob223")
Пример #2
0
def check_ob23svn1():
    import openbabel
    from chemfp import openbabel
    assert openbabel._ob_version == "2.3.90", openbabel._ob_version
    assert not support.can_skip("ob")
    assert not support.can_skip("ob23svn1")
Пример #3
0
def check_x64():
    assert sys.maxint == 9223372036854775807
    assert not support.can_skip("x64")
Пример #4
0
def check_oe2011Oct():
    from openeye.oechem import OEChemGetRelease
    version = OEChemGetRelease()
    assert version == "1.7.6", version
    assert not support.can_skip("oe")
    assert not support.can_skip("oe2011Oct")
Пример #5
0
def check_py27():
    version = sys.version_info[:2]
    assert version == (2,7), version
    assert not support.can_skip("py27")
Пример #6
0
def check_x32():
    assert sys.maxint == 2147483647
    assert not support.can_skip("x32")
Пример #7
0
import unittest2
import sys
import os
from cStringIO import StringIO as SIO

import support

try:
    from openeye import oechem  # These tests require OEChem
    has_oechem = True
    skip_oechem = False
except ImportError:
    has_oechem = False
    skip_oechem = True
    if not support.can_skip("oe"):
        skip_oechem = False
        from openeye import oechem

if has_oechem:
    from chemfp.commandline import oe2fps
    import chemfp.openeye
    chemfp.openeye._USE_SELECT = False  # Grrr. Needed to automate testing.

    real_stdout = sys.stdout
    real_stderr = sys.stderr

    PUBCHEM_SDF = support.fullpath("pubchem.sdf")
    PUBCHEM_SDF_GZ = support.fullpath("pubchem.sdf.gz")
    PUBCHEM_ANOTHER_EXT = support.fullpath("pubchem.should_be_sdf_but_is_not")

    oeerrs = oechem.oeosstream()
import sys
import unittest2
import support

try:
    from openeye.oechem import OEGraphMol, OEParseSmiles
    skip_oechem = False
except ImportError:
    skip_oechem = support.can_skip("oe")
else:
    from chemfp import openeye_patterns

import test_patterns


def parse_smiles(smiles):
    mol = OEGraphMol()
    OEParseSmiles(mol, smiles)
    return mol


def _count(it):
    return sum(1 for item in it)


class ReferenceMixin(object):
    def test_reference_data_set(self):
        largest = min(self.reference_limit,
                      max(v for (k, v) in self.reference_cases))

        matcher = self.reference_class(largest)
Пример #9
0
import os
from cStringIO import StringIO as SIO

import support

try:
    from openeye import oechem  # These tests require OEChem
    if not oechem.OEChemIsLicensed():
        print >>sys.stderr, "oechem library available but not license found. Skipping its tests."
        raise ImportError
    has_oechem = True
    skip_oechem = False
except ImportError:
    has_oechem = False
    skip_oechem = True
    if not support.can_skip("oe"):
        skip_oechem = False
        from openeye import oechem

if has_oechem:
    from chemfp.commandline import oe2fps
    import chemfp.openeye
    OEGRAPHSIM_API_VERSION = chemfp.openeye.OEGRAPHSIM_API_VERSION
    chemfp.openeye._USE_SELECT = False # Grrr. Needed to automate testing.

    real_stdout = sys.stdout
    real_stderr = sys.stderr

    PUBCHEM_SDF = support.fullpath("pubchem.sdf")
    PUBCHEM_SDF_GZ = support.fullpath("pubchem.sdf.gz")
    PUBCHEM_ANOTHER_EXT = support.fullpath("pubchem.should_be_sdf_but_is_not")
Пример #10
0
import os
import shutil
import tempfile
import unittest2

import support

try:
    import openbabel
    has_openbabel = True
    skip_openbabel = False
except ImportError:
    has_openbabel = False
    skip_openbabel = True

    if not support.can_skip("ob"):
        skip_openbabel = False
        import openbabel
        
if has_openbabel:
    import chemfp.openbabel
    from chemfp.commandline import ob2fps
    VERSION = chemfp.openbabel._ob_version

    runner = support.Runner(ob2fps.main)
    run = runner.run
    run_fps = runner.run_fps
    run_split = runner.run_split
    run_exit = runner.run_exit

    HAS_MACCS = chemfp.openbabel.HAS_MACCS
Пример #11
0
import os
import shutil
import tempfile
import unittest2

import support

try:
    import openbabel
    has_openbabel = True
    skip_openbabel = False
except ImportError:
    has_openbabel = False
    skip_openbabel = True

    if not support.can_skip("ob"):
        skip_openbabel = False
        import openbabel
        
if has_openbabel:
    import chemfp.openbabel
    from chemfp.commandline import ob2fps
    VERSION = chemfp.openbabel._ob_version

    runner = support.Runner(ob2fps.main)
    run = runner.run
    run_fps = runner.run_fps
    run_split = runner.run_split
    run_exit = runner.run_exit

    HAS_MACCS = chemfp.openbabel.HAS_MACCS
Пример #12
0
import shutil
import os
from cStringIO import StringIO
import tempfile

import support

try:
    import chemfp.rdkit
    has_rdkit = True
    skip_rdkit = False
except ImportError:
    has_rdkit = False
    skip_rdkit = True

    if not support.can_skip("rdkit"):
        skip_rdkit = False
        import rdkit

if has_rdkit:
    from chemfp.commandline import rdkit2fps

    runner = support.Runner(rdkit2fps.main)
else:
    runner = None

MACCS_SMI = support.fullpath("maccs.smi")
TRP = open(support.fullpath("tryptophan.sdf")).read()

class TestMACCS(unittest2.TestCase):
    def test_bitorder(self):
from __future__ import with_statement
import sys
import unittest2
import support

try:
    from openeye.oechem import OEGraphMol, OEParseSmiles, OEChemIsLicensed
    if not OEChemIsLicensed():
        raise ImportError
    skip_oechem = False
except ImportError:
    skip_oechem = support.can_skip("oe")

if not skip_oechem:
    from chemfp import openeye_patterns
    from chemfp.openeye import OEGRAPHSIM_API_VERSION

import test_patterns
from chemfp import types

MACCS_SMI = support.fullpath("maccs.smi")

def parse_smiles(smiles):
    mol = OEGraphMol()
    OEParseSmiles(mol, smiles)
    return mol

def _count(it):
    return sum(1 for item in it)

class ReferenceMixin(object):