pubchem
Version:
pubchem simplifies the data retrieval from the PubChem API.
69 lines (44 loc) • 1.73 kB
Markdown
[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
Simplify the retrieval of information from [PubChem](https://pubchem.ncbi.nlm.nih.gov) using the [PubChem JSON API](https://pubchemdocs.ncbi.nlm.nih.gov/power-user-gateway).
`$ npm i pubchem`
```js
import { Compound } from 'pubchem';
async function doAll() {
const compound = await Compound.fromSmiles('CCCCCBr', { cache });
console.log(compound.getCID());
const compoundData = await compound.getData();
const ghs = compoundData.ghs;
console.log(ghs);
const detailedGHS = compoundData.getGHS();
console.log(detailedGHS);
const computed = compoundData.computed;
console.log(computed);
const experimentalData = compoundData.getExperimentalData({
pressure: { targetUnits: 'torr' },
temperature: { targetUnits: '°C' },
});
console.log(experimentalData);
}
doAll();
```
You can run a working example using:
`node test/simple.js`
[](./LICENSE)
[]: https://img.shields.io/npm/v/pubchem.svg
[]: https://www.npmjs.com/package/pubchem
[]: https://github.com/cheminfo/pubchem/workflows/Node.js%20CI/badge.svg?branch=master
[]: https://github.com/cheminfo/pubchem/actions?query=workflow%3A%22Node.js+CI%22
[]: https://img.shields.io/codecov/c/github/cheminfo/pubchem.svg
[]: https://codecov.io/gh/cheminfo/pubchem
[]: https://img.shields.io/npm/dm/pubchem.svg
[]: https://www.npmjs.com/package/pubchem