{"id":25457844,"url":"https://github.com/sinagilassi/pubchemquery","last_synced_at":"2025-11-02T12:30:40.864Z","repository":{"id":250817147,"uuid":"834253928","full_name":"sinagilassi/PubChemQuery","owner":"sinagilassi","description":"Quickly find chemical information using the PubChem API","archived":false,"fork":false,"pushed_at":"2025-02-01T18:38:47.000Z","size":689,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T19:30:01.962Z","etag":null,"topics":["chemistry","pubchem","pubchem-api"],"latest_commit_sha":null,"homepage":"https://pubchemquery.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinagilassi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T19:10:06.000Z","updated_at":"2025-02-01T18:38:50.000Z","dependencies_parsed_at":"2025-02-01T19:25:44.991Z","dependency_job_id":"0cf2dc01-a222-4e6d-83d7-e01e75b13e8b","html_url":"https://github.com/sinagilassi/PubChemQuery","commit_stats":null,"previous_names":["sinagilassi/pubchemquery"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinagilassi%2FPubChemQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinagilassi%2FPubChemQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinagilassi%2FPubChemQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinagilassi%2FPubChemQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinagilassi","download_url":"https://codeload.github.com/sinagilassi/PubChemQuery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239394662,"owners_count":19631122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemistry","pubchem","pubchem-api"],"created_at":"2025-02-18T02:19:10.506Z","updated_at":"2025-11-02T12:30:40.810Z","avatar_url":"https://github.com/sinagilassi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PubChemQuery\n\n![Downloads](https://img.shields.io/pypi/dm/PubChemQuery) ![PyPI](https://img.shields.io/pypi/v/PubChemQuery) ![Python Version](https://img.shields.io/pypi/pyversions/PubChemQuery.svg) ![License](https://img.shields.io/pypi/l/PubChemQuery) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1hKrOe6K1L_fpd6_izhpVXaA1Zmq6Z8Fo?usp=sharing)\n\n**PubChemQuery:** A Python Package for Accessing Chemical Information from [PubChem](https://pubchem.ncbi.nlm.nih.gov/).\n\nPubChemQuery is a Python package that provides a simple and intuitive API for retrieving chemical information from the PubChem database. With this package, you can easily fetch chemical data, including:\n\n* CID (Compound ID) by name\n* All CIDs by name\n* 2D images by CID or name\n* SDF (Structure Data File) by CID or name\n* Compound properties, including:\n    - Molecular formula and weight\n    - SMILES and InChI representations\n    - IUPAC name and title\n    - Physicochemical properties (e.g., XLogP, exact mass, TPSA)\n    - Structural features (e.g., bond and atom counts, stereochemistry)\n    - 3D properties (e.g., volume, steric quadrupole moments, feature counts)\n    - Fingerprint and conformer information\n\nThe package offers a straightforward interface, allowing users to access PubChem data with minimal code. Whether you're a chemist, researcher, or developer, PubChemQuery simplifies the process of integrating chemical information into your projects.\n\n**Key Features:**\n\nRetrieve chemical data by name or CID\nAccess 2D images and SDF files\nGet compound properties, including physicochemical, structural, and 3D features\nEasy-to-use API with minimal code required\n\n**Simple and Concise API:**\n\nThere are functions that perform all of the above-mentioned tasks, making it easy to integrate PubChem data into your projects:\n\n* `get_cid_by_inchi(inchi)`: Get a CID by InChI\n* `get_cids_by_formula(formula)`: Get CIDs by formula\n* `get_cid_by_name(name)`: Get CID by name\n* `get_cids_by_name(name)`: Get all CIDs by name\n* `get_image_by_cid(cid)`: Get 2D image by CID\n* `get_image_by_name(name)`: Get 2D image by name\n* `get_image_by_inchi(inchi)`: Get 2D image by InChI\n* `get_structure_by_cid(cid)`: Get SDF by CID\n* `get_structure_by_name(name)`: Get SDF by name\n* `get_similar_structures_cids_by_compound_id(cid/SMILES/InChI)`: Get similar structures CIDs by cid, SMILES, InChI\n\n**Compound Object:**\nThe package also includes a `Compound` object that encapsulates the retrieved data, providing a convenient way\nto access and manipulate the data.\n\n* `compound(cid_or_name)`: Create a compound object with properties and methods\n\n**Getting Started:**\n\nTo use PubChemQuery, simply install the package and import it into your Python script. Refer to the example code snippets above for a quick start.\n\n## Installation\n\nInstall PubChemQuery with pip\n\n```python\n  pip install PubChemQuery\n```\n\n## Examples\n\nImport package as:\n\n```python\nimport pubchemquery as pcq\n```\n\nUse the functions to retrieve data:\n\n```python\n# get a cid by formula\ncid = pcq.get_cids_by_formula('C6H6')\nprint(type(cid), len(cid))\n```\n\n```python\n# get a cid by inchi\ncid = pcq.get_cid_by_inchi(\n    'InChI=1S/C6H5NO3/c8-6-3-1-5(2-4-6)7(9)10/h1-4,8H')\nprint(cid)\n```\n\n```python\n# get a cid by name\ncid = pcq.get_cid_by_name('benzene')\nprint(cid)\n```\n\n```python\n# get all cids by name\ncids = pcq.get_cids_by_name('benzene')\nprint(type(cids), len(cids))\n```\n\n```python\n# get 2d image\n# by cid\nimage = pcq.get_image_by_cid('241')\nimage\n\n# by name\nimage = pcq.get_image_by_name('benzene')\nimage\n\n# by inchi\nimage = pcq.get_image_by_inchi(\n    'InChI=1S/C6H5NO3/c8-6-3-1-5(2-4-6)7(9)10/h1-4,8H')\nprint(image)\n```\n\n```python\n# get sdf by cid\nsdf = pcq.get_structure_by_cid('241')\nprint(sdf)\n```\n\n```python\n# get sdf by name\nsdf = pcq.get_structure_by_name('benzene')\nprint(sdf)\n```\n\n```python\n# get similar structure cids by cid\n# cids = pcq.get_similar_structures_cids_by_compound_id('241')\n# cids = pcq.get_similar_structures_cids_by_compound_id(\n#     'C1=CC=CC=C1', compound_id='SMILES')\ncids = pcq.get_similar_structures_cids_by_compound_id(\n    'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H', compound_id='InChI')\nprint(type(cids), len(cids))\n```\n\nMake a compound and then get its properties:\n\n```python\n# make a compound\ncid = 2244\n# compound = pcq.compound(cid)\n# name\nname = '2-acetyloxybenzoic acid'\ncompound = pcq.compound(name)\nprint(compound)\n# properties\n# InChI\nprint(compound.InChI)\n# InChIKey\nprint(compound.InChIKey)\n# IUPACName\nprint(compound.IUPACName)\n# similar structure cids\nprint(len(compound.similar_structure_cids))\n# image\ncompound.image\n# dataframe\ncompound.prop_df()\n```\n\n## FAQ\n\nFor any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/) \n\n\n## Authors\n\n- [@sinagilassi](https://www.github.com/sinagilassi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinagilassi%2Fpubchemquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinagilassi%2Fpubchemquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinagilassi%2Fpubchemquery/lists"}