Search by

omnilab / pubchem

GlitchArt

Omnilab PubChem: a compound by CID, name, InChIKey, InChI, CAS number or SMILES - its computed properties with units (formula, weight, XLogP, TPSA...), synonyms, description, 2D structure image and its identifiers in ChEBI, ChEMBL, Wikidata, CAS, UNII, DSSTox and KEGG - through PubChem's PUG-REST, n

1.x-dev 2026-10-26 05:24 UTC

This package is auto-updated.

Last update: 2026-10-26 10:05:48 UTC


README

PubChem for omnisense/omnilab: a compound by its CID, a name, an InChIKey, an InChI, a CAS number, a SMILES, or an identifier of another base PubChem keeps among its synonyms (ChEBI, ChEMBL, Wikidata, UNII, DSSTox); its computed properties with their units, its synonyms, its description, the image of its 2D structure, and its identifiers in other bases for the Collector to follow; a search by name. No key.

$pubchem = (new PubChemSourceFactory($http))->create(['mailto' => 'support@glitchr.io']);
$caffeine = $pubchem->entity('caffeine');
$caffeine->property('molecular_weight');        // 194.19 g/mol
$caffeine->value('tpsa');                       // Quantity: 58.4 Ų
$caffeine->identifier(Scheme::CHEBI);           // 27732
$caffeine->image;                               // https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2519/PNG
$pubchem->entity('CN1C=NC2=C1C(=O)N(C(=O)N2C)C'); // the same, by its SMILES
$pubchem->search(new Query('caffeine', limit: 10));
omnilab:
    sources:
        pubchem:
            factory: pubchem
            options:
                mailto: 'support@glitchr.io'   # in the User-Agent: whom NCBI writes to before it blocks a caller
                synonyms: 20                   # how many to keep; 0: none, one call less per compound
                description: true              # false: one call less per compound
                throttle: 0.2                  # PubChem allows five calls a second: never lower

Terms of use

PubChem is run by the NCBI (U.S. National Library of Medicine), free and without a key. Its usage policy asks for at most five calls a second, 400 a minute and 300 seconds of running time a minute; a caller over it is blocked for a while. The source leaves 0.2 s between two calls and a compound costs up to four: cache what it answers. PubChem's records are free to use; some depositors attach terms to what they deposited (each source's page on PubChem says), and NCBI's policies apply.

See docs/ for what is read, how it maps, and what PubChem does not give here.

Responsibility

This package is an independent, unofficial client: it is not affiliated with, endorsed by or sponsored by NCBI (PubChem). It reaches their service on behalf of whoever runs it, and it does not redistribute their data beyond the short excerpts recorded as test fixtures. Its MIT licence covers this package's code only and grants no right to the service or to its data.

Whoever installs and runs this package is responsible for complying with the terms above, for obtaining whatever they require (an account, a key, a licence or subscription, an attribution or a citation, a rate limit to respect), and for any use made of what it returns. The authors publish it free of charge, make no commercial use of it, and accept no liability for how it is used (see LICENSE).

License: MIT.