ChemInformant

ChemInformant: A Robust and Workflow-Centric Python Client for High-Throughput PubChem Access - Published in JOSS (2025)

https://github.com/hzacode/cheminformant

Science Score: 98.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: ncbi.nlm.nih.gov, joss.theoj.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Scientific Fields

Engineering Computer Science - 60% confidence
Psychology Social Sciences - 40% confidence
Last synced: 4 months ago · JSON representation ·

Repository

⚗️ An all-in-one solution for chemical property retrieval from PubChem.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 2
Created almost 2 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Zenodo

README.md

# ChemInformant *A Robust Data Acquisition Engine for the Modern Scientific Workflow*
[![Total Downloads](https://img.shields.io/pepy/dt/cheminformant?style=for-the-badge&color=306998&label=Downloads&logo=python)](https://pepy.tech/project/cheminformant)

DOI PyPI version Python Version License

Build Status coverage Code style: black Codacy Badge


ChemInformant is a robust data acquisition engine for the PubChem database, engineered for the modern scientific workflow. It intelligently manages network requests, performs rigorous runtime data validation, and delivers analysis-ready results, providing a dependable foundation for any computational chemistry project in Python.


✨ Key Features

  • Analysis-Ready Pandas/SQL Output: The core API (get_properties) returns either a clean Pandas DataFrame or a direct SQL output, eliminating data wrangling boilerplate and enabling immediate integration with both the Python data science ecosystem and modern database workflows.

  • Automated Network Reliability: Ensures your workflows run flawlessly with built-in persistent caching, smart rate-limiting, and automatic retries. It also transparently handles API pagination (ListKey) for large-scale queries, delivering complete result sets without any manual intervention.

  • Flexible & Fault-Tolerant Input: Natively accepts mixed lists of identifiers (names, CIDs, SMILES) and intelligently handles any invalid inputs by flagging them with a clear status in the output, ensuring a single bad entry never fails an entire batch operation.

  • A Dual API for Simplicity and Power: Offers a clear get_<property>() convenience layer for quick lookups, backed by a powerful get_properties engine for high-performance batch operations.

  • Guaranteed Data Integrity: Employs Pydantic v2 models for rigorous, runtime data validation when using the object-based API, preventing malformed or unexpected data from corrupting your analysis pipeline.

  • Terminal-Ready CLI Tools: Includes chemfetch and chemdraw for rapid data retrieval and 2D structure visualization directly from your terminal, perfect for quick lookups without writing a script.

  • Modern and Actively Maintained: Built on a contemporary tech stack for long-term consistency and compatibility, providing a reliable alternative to older or less frequently updated libraries.


📦 Installation

Install the library from PyPI:

bash pip install ChemInformant

To include plotting capabilities for use with the tutorial, install the [plot] extra:

bash pip install "ChemInformant[plot]"


🚀 Quick Start

Retrieve multiple properties for multiple compounds, directly into a Pandas DataFrame, in a single function call:

```python import ChemInformant as ci

1. Define your identifiers

identifiers = ["aspirin", "caffeine", 1983] # 1983 is paracetamol's CID

2. Specify the properties you need

properties = ["molecular_weight", "xlogp", "cas"]

3. Call the core function

df = ci.get_properties(identifiers, properties)

4. Save the results to an SQL database

ci.dftosql(df, "sqlite:///chemdata.db", "results", ifexists="replace")

5. Analyze your results!

print(df) ```

Output:

input_identifier cid status molecular_weight xlogp cas 0 aspirin 2244 OK 180.16 1.2 50-78-2 1 caffeine 2519 OK 194.19 -0.1 58-08-2 2 1983 1983 OK 151.16 0.5 103-90-2

➡️ Click to see Convenience API Cheatsheet
| Function | Description | | -------------------------- | ------------------------------------------------------------- | | `get_weight(id)` | Molecular weight *(float)* | | `get_formula(id)` | Molecular formula *(str)* | | `get_cas(id)` | CAS Registry Number *(str)* | | `get_iupac_name(id)` | IUPAC name *(str)* | | `get_canonical_smiles(id)` | Canonical SMILES with Canonical→Connectivity fallback *(str)* | | `get_isomeric_smiles(id)` | Isomeric SMILES with Isomeric→SMILES fallback *(str)* | | `get_xlogp(id)` | XLogP (calculated hydrophobicity) *(float)* | | `get_synonyms(id)` | List of synonyms *(List\[str])* | | `get_compound(id)` | Full, validated **`Compound`** object (Pydantic v2 model) | *Note: This table shows key convenience functions for demonstration. ChemInformant provides **22 convenience functions** in total, covering molecular descriptors, mass properties, stereochemistry, and more.* *All functions accept a **CID, name, or SMILES** and return `None`/`[]` on failure.*

ChemInformant also includes handy command-line tools for quick lookups directly from your terminal:

  • chemfetch: Fetches properties for one or more compounds.

    bash chemfetch aspirin --props "cas,molecular_weight,iupac_name"

  • chemdraw: Renders the 2D structure of a compound.

    bash chemdraw aspirin


📚 Documentation & Examples

For a deep dive, please see our detailed guides:

  • ➡️ Online Documentation: The official documentation site contains complete API references, guides, and usage examples. This is the most comprehensive resource.
  • ➡️ Interactive User Manual: Our Jupyter Notebook Tutorial provides a complete, end-to-end walkthrough. This is the best place to start for a hands-on experience.
  • ➡️ Performance Benchmarks: You can review and run our Benchmark Script to see the performance advantages of batching and caching.

🤔 Why ChemInformant?

ChemInformant's core mission is to serve as a high-performance data backbone for the Python cheminformatics ecosystem. By delivering clean, validated, and analysis-ready Pandas DataFrames, it enables researchers to effortlessly pipe PubChem data into powerful toolkits like RDKit, Scikit-learn, or custom machine learning models, transforming multi-step data acquisition and wrangling tasks into single, elegant lines of code.

A detailed comparison with other existing tools is provided in our JOSS paper.

🤝 Contributing

Contributions are welcome! For guidelines on how to get started, please read our contributing guide. You can open an issue to report bugs or suggest features, or submit a pull request to contribute code.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📑 Citation

```bibtex @article{He2025, doi = {10.21105/joss.08341}, url = {https://doi.org/10.21105/joss.08341}, year = {2025}, publisher = {The Open Journal}, volume = {10}, number = {112}, pages = {8341}, author = {He, Zhiang}, title = {ChemInformant: A Robust and Workflow-Centric Python Client for High-Throughput PubChem Access}, journal = {Journal of Open Source Software} }

Owner

  • Name: Ang
  • Login: HzaCode
  • Kind: user

JOSS Publication

ChemInformant: A Robust and Workflow-Centric Python Client for High-Throughput PubChem Access
Published
August 13, 2025
Volume 10, Issue 112, Page 8341
Authors
Zhiang He ORCID
Independent Researcher
Editor
Evan Spotte-Smith ORCID
Tags
python pubchem chemistry api pandas cache pydantic cheminformatics data science high-throughput

Citation (CITATION.cff)

cff-version: 2.1.1
message: "If you use this software, please cite it as below."
authors:
  - family-names: "He"
    given-names: "Zhiang"
    orcid: "https://orcid.org/0009-0009-0171-4578"
title: "ChemInformant"
version: 2.4.0
date-released: 2025
url: "https://github.com/HzaCode/ChemInformant"
license: MIT
keywords:
  - python
  - pubchem
  - chemistry
  - api
  - client
  - cache
  - pydantic
  - cheminformatics
  - computational chemistry
  - research software
  - data validation
  - open source

GitHub Events

Total
  • Create event: 25
  • Release event: 2
  • Issues event: 14
  • Watch event: 1
  • Delete event: 12
  • Issue comment event: 18
  • Push event: 284
  • Pull request event: 27
Last Year
  • Create event: 25
  • Release event: 2
  • Issues event: 14
  • Watch event: 1
  • Delete event: 12
  • Issue comment event: 18
  • Push event: 284
  • Pull request event: 27

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 13
  • Total pull requests: 32
  • Average time to close issues: 21 days
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 1.15
  • Average comments per pull request: 0.44
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 32
  • Average time to close issues: 21 days
  • Average time to close pull requests: about 3 hours
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 1.15
  • Average comments per pull request: 0.44
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cthoyt (13)
Pull Request Authors
  • HzaCode (30)
  • robertpepelnjak (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 321 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 18
  • Total maintainers: 1
pypi.org: cheminformant

A robust and high-throughput Python client for the PubChem API, designed for automated data retrieval and analysis

  • Homepage: https://github.com/HzaCode/ChemInformant
  • Documentation: https://github.com/HzaCode/ChemInformant#readme
  • License: MIT License Copyright (c) 2024‑2025 Zhiang “Ang” He (HzaCode) <ang@hezhiang.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 2.4.1
    published 4 months ago
  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 321 Last month
Rankings
Dependent packages count: 9.4%
Average: 31.2%
Dependent repos count: 53.0%
Maintainers (1)
Last synced: 4 months ago

Dependencies

requirements.txt pypi
  • pandas *
  • requests *