Skip to main content

A Python package to extract chemical, biochemical, and bioactivity data from public databases like ORD, ChEMBL and PubChem.

Project description

biochemical-data-connectors

biochemical-data-connectors is a Python package for extracting chemical, biochemical, and bioactivity data from public databases like ChEMBL, PubChem, BindingDB, IUPHAR/BPS Guide to PHARMACOLOGY, and the Open Reaction Database (ORD).

Overview

biochemical-data-connectors provides a simple and consistent interface to query major cheminformatics bioinformatics databases for compounds. It is designed to be a modular and reusable tool for researchers and developers in computational chemistry and drug discovery, enabling the rapid curation of high-quality datasets for machine learning and analysis.

Key Features

  1. Bioactive Compounds
    • Unified Interface: A single, easy-to-use abstract base class for fetching bioactives for a given target.
    • Multiple Data Sources: Includes concrete connectors for major public databases:
      1. ChEMBL (ChemblBioactivesExtractor)
      2. PubChem (PubChemBioactivesExtractor)
      3. BindingDB (BindingDbBioactivesConnector)
      4. IUPHAR/BPS Guide to PHARMACOLOGY (IUPHARBioactivesConnector)
    • Powerful Filtering: Filter compounds by bioactivity type (e.g., Kd, IC50) and potency value.
    • Efficient Fetching: Uses concurrency to fetch data from APIs efficiently.
  2. Chemical Reactions
    • Local ORD Processing: Includes a connector (OpenReactionDatabaseConnector) to efficiently process a local copy of the Open Reaction Database.
    • Reaction Role Correction: Uses RDKit to automatically correct and reassign reactant/product roles from the source data, improving data quality.
    • Robust SMILES Extraction: Canonicalizes and validates SMILES strings for both reactants and products to ensure high-quality, standardized output.
    • Memory-Efficient Processing: Employs a generator-based extraction method, allowing for iteration over massive reaction datasets with a low memory footprint.

Installation

You can install this package locally via:

pip install biochemical-data-connectors

Quick Start

Here is a simple example of how to retrieve all compounds from ChEMBL with a measured Kd of less than or equal to 1000 nM for the EGFR protein (UniProt ID: P00533).

import logging
from biochemical_data_connectors import ChEMBLConnector

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# 1. Instantiate the connector for the desired database
chembl_connector = ChEMBLConnector(
    bioactivity_measure='Kd',
    bioactivity_threshold=1000.0, # in nM
    logger=logger
)

# 2. Specify the target's UniProt ID
target_uniprot_id = "P00533" # EGFR

# 3. Get the bioactive compounds
print(f"Fetching bioactive compounds for {target_uniprot_id} from ChEMBL...")
smiles_list = chembl_connector.get_bioactive_compounds(target_uniprot_id)

# 4. Print the results
if smiles_list:
    print(f"\nFound {len(smiles_list)} compounds.")
    print("First 5 compounds:")
    for smiles in smiles_list[:5]:
        print(smiles)
else:
    print("No compounds found matching the criteria.")

Package Structure

biochemical-data-connectors/
├── pyproject.toml
├── requirements-dev.txt
├── src/
│   └── biochemical_data_connectors/
│       ├── __init__.py
│       ├── constants.py
│       ├── models.py
│       ├── connectors/
│       │   ├── __init__.py
│       │   ├── ord_connectors.py
│       │   └── bioactive_compounds
│       │       ├── __init__.py
│       │       ├── base_bioactives_connector.py
│       │       ├── bindingdb_bioactives_connector.py
│       │       ├── chembl_bioactives_connector.py
│       │       ├── iuphar_bioactives_connector.py
│       │       └── pubchem_bioactives_connector.py
│       └── utils/
│           ├── __init__.py
│           ├── files_utils.py
│           ├── iter_utils.py
│           ├── standardization_utils.py
│           └── api/
│               ├── __init__.py
│               ├── base_api.py
│               ├── bindingbd_api.py
│               ├── chembl_api.py
│               ├── iuphar_api.py
│               ├── mappings.py
│               └── pubchem_api.py
├── tests/
│   └── ...
└── README.md

License

This project is licensed under the terms of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biochemical_data_connectors-3.2.1.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biochemical_data_connectors-3.2.1-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file biochemical_data_connectors-3.2.1.tar.gz.

File metadata

File hashes

Hashes for biochemical_data_connectors-3.2.1.tar.gz
Algorithm Hash digest
SHA256 0cae3e97ef0fc5265bdb3aaf5c10153120256039fc57b0018b695a14f7d051b2
MD5 c129b15cf4247a5484be0ef20f80949a
BLAKE2b-256 789130a67b285bdbba9653c4aab5229099d6353ab2062ddbf32777414fbbfc56

See more details on using hashes here.

Provenance

The following attestation bundles were made for biochemical_data_connectors-3.2.1.tar.gz:

Publisher: publish-to-pypi.yml on c-vandenberg/biochemical-data-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biochemical_data_connectors-3.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for biochemical_data_connectors-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99b4bae5f1587d78e02e4e204253bad2b18284576a6ecd1ab39b19be0b1d6a56
MD5 7082aeb2e36d3398404cf1b2263eee1c
BLAKE2b-256 0fb6eb4d744b45d138908f5d26554ad558f54d6430351c98e7e72e3b5f1f969f

See more details on using hashes here.

Provenance

The following attestation bundles were made for biochemical_data_connectors-3.2.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on c-vandenberg/biochemical-data-connectors

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page