File: README.md

package info (click to toggle)
python-pubchempy 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 648 kB
  • sloc: python: 1,619; makefile: 13; sh: 5
file content (64 lines) | stat: -rw-r--r-- 2,549 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# PubChemPy

[![PyPI Version](https://img.shields.io/pypi/v/PubChemPy?logo=python&logoColor=%23ffffff)](https://pypi.python.org/pypi/PubChemPy)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pubchempy?logo=anaconda&logoColor=%23ffffff)](https://anaconda.org/conda-forge/pubchempy)
[![License](https://img.shields.io/pypi/l/PubChemPy)](https://github.com/mcs07/PubChemPy/blob/main/LICENSE)
[![DOI](https://zenodo.org/badge/7462957.svg)](https://zenodo.org/badge/latestdoi/7462957)
[![Tests](https://img.shields.io/github/actions/workflow/status/mcs07/pubchempy/test.yml?logo=github&logoColor=%23ffffff&label=tests)](https://github.com/mcs07/PubChemPy/actions/workflows/test.yml)
[![Docs](https://img.shields.io/readthedocs/pubchempy?logo=readthedocs&logoColor=%23ffffff)](https://docs.pubchempy.org)

PubChemPy provides a way to interact with PubChem in Python. It allows chemical searches by name, substructure and similarity, chemical standardization, conversion between chemical file formats, depiction and retrieval of chemical properties.

## Installation

Install PubChemPy with pip:

```shell
pip install pubchempy
```

Or with conda:

```shell
conda install -c conda-forge pubchempy
```

For detailed instructions, see the [installation guide](https://docs.pubchempy.org/en/latest/guide/install.html).

## Example usage

Retrieve a compound by its PubChem Compound Identifier (CID) and print its SMILES and IUPAC name:

```pycon
>>> import pubchempy as pcp
>>> comp = pcp.Compound.from_cid(1423)
>>> print(comp.smiles)
CCCCCCCNC1CCCC1CCCCCCC(=O)O
>>> print(comp.iupac_name)
7-[2-(heptylamino)cyclopentyl]heptanoic acid
```

Search compounds by name and print the SMILES and molecular weight of the first result:

```pycon
>>> results = pcp.get_compounds("Aspirin", "name")
>>> print(results[0].smiles)
CC(=O)OC1=CC=CC=C1C(=O)O
>>> print(results[0].molecular_weight)
180.16
```

## Documentation

Full documentation is available at <https://docs.pubchempy.org>.

This includes a [step-by-step guide on how to use PubChemPy](https://docs.pubchempy.org/en/latest/guide/gettingstarted.html), as well as a [complete API reference](https://docs.pubchempy.org/en/latest/api.html).

## Contributing

- Feature ideas and bug reports are welcome on the [Issue Tracker](https://github.com/mcs07/PubChemPy/issues).
- Fork the [source code](https://github.com/mcs07/PubChemPy) on GitHub, make changes and file a pull request.

## License

PubChemPy is licensed under the [MIT license](https://github.com/mcs07/PubChemPy/blob/main/LICENSE).