Library for SMILES parsing and molecular graph depiction.
Project description
A library and accompanying program for parsing SMILES (simplified molecular-input line-entry system) strings and generating 2D depictions of chemical structures from these strings.
It was originally developed as part of a 3rd year computer science dissertation project.
Prerequisites
pydepict requires Python 3.7 or newer, and uses the following packages:
pygame
NetworkX
Specific versions of these libraries can be found in requirements.txt.
Setup
The recommended method of installation is via pip, which installs pydepict as a package:
python3 -m pip install pydepict
Use py -3 instead of python3 if you are on Windows.
Using pip installs the latest release of pydepict. Alternatively, if you want the latest development version, then you can clone the repository from GitHub:
git clone https://github.com/WilliamWFLee/pydepict
cd pydepict
If you want to run the program straight from the cloned repository then you must install pydepict’s package requirements using pip:
python3 -m pip install -r requirements.txt
Or to install the development version as a package:
python3 -m pip install .
Usage
If you have installed pydepict as a package, then you can run the program by simply running:
pydepict
Or you can invoke the module as a program:
python3 -m pydepict
If you want to run the program straight from the cloned repository, then you can execute the script src/main.py:
python3 src/main.py
Executing the program without any command-line arguments opens a GUI allowing SMILES string input. Passing a SMILES string as the first command-line argument only displays the renderer window showing only the corresponding diagram. For example:
python3 src/main.py CCO
parses the SMILES string CCO and displays the corresponding diagram.
Minimal Code Example
from pydepict import depict, parse, render
graph, _ = parse(input("Enter your SMILES string: "))
positions = depict(graph)
render(graph, positions)
License
This library is licensed under the MIT Licence. See LICENSE for license and copyright details. Code files will also include a header explicitly stating that the license and copyright applies.
NetworkX is licensed under the 3-clause BSD license, while pygame is licensed under the GNU Lesser General Public License (LGPL). See LICENSE.networkx and LICENSE.pygame respectively for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydepict-0.1.1.post2.tar.gz
.
File metadata
- Download URL: pydepict-0.1.1.post2.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d4d1a3df4e91850378e55d7bbbf91f44abbbb636288296853b4b35ad4dbe382 |
|
MD5 | b0446bca71eb0af93f7da66a08810b02 |
|
BLAKE2b-256 | 25c9bcbcb94039028d9f637964869d9f8b40db0f4e49900b91c4b8c090a76c56 |
File details
Details for the file pydepict-0.1.1.post2-py3-none-any.whl
.
File metadata
- Download URL: pydepict-0.1.1.post2-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a67f0c5fa57a75866ff68ec18d7217740b0f631f7d0716afef992b5386111d8 |
|
MD5 | ac13adf2ba043231d79ae7a91189f3c6 |
|
BLAKE2b-256 | d6967fc80c4917665085a482b6d553ddbd118b2052eea2c932cd2923c83b334a |