Beispiel #1
0
from __future__ import print_function
import unittest
import os, copy
import math
import numpy

from rdkit.six.moves import cPickle as pickle
from rdkit.six import next
from rdkit import Chem
from rdkit.Chem import rdDistGeom, ChemicalForceFields, rdMolAlign
from rdkit import RDConfig
from rdkit.Geometry import rdGeometry as geom
from rdkit.RDLogger import logger
logger = logger()


def feq(v1, v2, tol=1.e-4):
    return abs(v1 - v2) < tol


def lstEq(l1, l2, tol=1.0e-4):
    ln = len(l1)
    if (ln != len(l2)):
        return 0

    for i in range(ln):
        if abs(l1[i] - l2[i]) > tol:
            return 0
    return 1

Beispiel #2
0
# $Id$
#
#  Copyright (C) 2003-2005  Rational Discovery LLC
#         All Rights Reserved
#
""" This is a rough coverage test of the python wrapper

it's intended to be shallow, but broad

"""
import unittest, os
from rdkit.six.moves import cPickle
from rdkit import RDConfig
from rdkit.RDLogger import logger
logger = logger()
from rdkit import Chem
from rdkit.Chem import FragmentCatalog
from rdkit import DataStructs


class TestCase(unittest.TestCase):

  def setUp(self):
    self.fName = os.path.join(RDConfig.RDBaseDir, 'Code', 'GraphMol', 'FragCatalog', 'test_data',
                              'funcGroups.txt')
    self.smiName = os.path.join(RDConfig.RDBaseDir, 'Code', 'GraphMol', 'FragCatalog', 'test_data',
                                'mols.smi')

  def test0Params(self):
    fparams = FragmentCatalog.FragCatParams(1, 6, self.fName, 1.0e-8)
Beispiel #3
0
from shutil import move
from subprocess import call
from typing import List, Union

import pymongo
from pymongo.errors import ServerSelectionTimeoutError
from rdkit.Chem import AllChem
from rdkit.RDLogger import logger

from minedatabase import utils

# from minedatabase.NP_Score import npscorer as nps

# nps_model = nps.readNPModel()

lg = logger()
lg.setLevel(4)


def establish_db_client(uri: str = None) -> pymongo.MongoClient:
    """Establish a connection to a mongo database given a URI.

    Uses the provided URI to connect to a mongoDB. If none is given
    the default URI is used when using pymongo.

    Parameters
    ----------
    uri : str, optional
        URI to connect to mongo DB, by default None.

    Returns