예제 #1
0
def init():
    global catalog
    params = FilterCatalogParams()
    params.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_A)
    params.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_B)
    params.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_C)
    catalog = FilterCatalog(params)
예제 #2
0
def zinc_molecule_filter(mol):
    """
    Flags molecules based on problematic functional groups as
    provided set of ZINC rules from
    http://blaster.docking.org/filtering/rules_default.txt.
    :param mol: rdkit mol object
    :return: Returns True if molecule is okay (ie does not match any of
    therules), False if otherwise
    """
    params = FilterCatalogParams()
    params.AddCatalog(FilterCatalogParams.FilterCatalogs.ZINC)
    catalog = FilterCatalog(params)
    return not catalog.HasMatch(mol)
예제 #3
0
    def get_filters(self):
        """
        This loads in the filters which will be used.

        Returns:
        :returns: rdkit.Chem.rdfiltercatalog.FilterCatalog filters: A set of
            RDKit Filters
        """

        # Make a list of the NIH filter.
        params = FilterCatalogParams()
        params.AddCatalog(FilterCatalogParams.FilterCatalogs.NIH)
        # This is our set of all the NIH filters
        filters = FilterCatalog.FilterCatalog(params)
        return filters
예제 #4
0
    def get_filters_list(self):
        """
        This loads in the filters which will be used.

        Returns:
        :returns: rdkit.Chem.rdfiltercatalog.FilterCatalog filters: A set of
            RDKit Filters
        """

        # Make a list of all the different PAINS Filters. PAINS should include
        # PAINS_A,PAINS_B, and PAINS_C, but because RDKit documentation
        # doesn't specify this explicitly we have included all 4 of the PAINS
        # FilterCatalogs for precaution.
        params_PAINS_A = FilterCatalogParams()
        params_PAINS_A.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_A)
        params_PAINS_B = FilterCatalogParams()
        params_PAINS_B.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_B)
        params_PAINS_C = FilterCatalogParams()
        params_PAINS_C.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS_C)
        params_PAINS = FilterCatalogParams()
        params_PAINS.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS)

        params_list = [
            params_PAINS_A, params_PAINS_B, params_PAINS_C, params_PAINS
        ]
        filters_list = []
        for param in params_list:
            filter = FilterCatalog.FilterCatalog(param)
            filters_list.append(filter)

        return filters_list
예제 #5
0
# PAINS filter - RDKit
# https://projects.volkamerlab.org/teachopencadd/talktorials/T003_compound_unwanted_substructures.html
# https://www.rdkit.org/docs/source/rdkit.Chem.rdfiltercatalog.html

import pandas as pd
from rdkit import Chem
from rdkit.Chem.FilterCatalog import FilterCatalog, FilterCatalogParams
from rdkit.Chem import Draw
# from rdkit.Chem.Draw import IPythonConsole

# Read list with SMARTS for PAINS
pains_list = pd.read_csv("../pains/wehi_pains.csv", header=None)
pains_list.columns = ["SMARTS", "ID"]

# initialize filter
params = FilterCatalogParams()
params.AddCatalog(FilterCatalogParams.FilterCatalogs.PAINS)
catalog = FilterCatalog(params)


def pass_pains(smiles):
    # Returns True if mol has no PAINS substructures
    mol = Chem.MolFromSmiles(smiles)
    entry = catalog.GetFirstMatch(mol)  # Get first matching PAINS
    # entry.GetDescription().capitalize()
    if entry:
        return False
    return True


def pains_highlight(smiles):