Fréchet ChemNet Distance on PyTorch
PyTorch implementation of Fréchet ChemNet Distance ported from the original repository https://github.com/bioinf-jku/FCD. The ported model produces the same outputs as the original Keras implementation and can be used for reproducible research. The PyTorch model of ChemNet weights tenfold less, resulting in faster loading.
Other features:
- You can precalculate mean and sigma for further usage, useful if you use the statistics from the same dataset multiple times
- Supports calculation on GPU and selection of GPU device number
- Multithreaded SMILES parsing
Installation
First, install RDKit: conda install -yq -c rdkit rdkit and then install fcd_torch from pip (pip install fcd_torch), or directly from the source:
git clone https://github.com/insilicomedicine/fcd_torch.git
cd fcd_torch
python setup.py install
Usage
Import the module from fcd_torch import FCD. You can run calculation directly or precalculate statistics to reuse them on the test set (see example below). If you run FCD on GPU, the GPU memory will be allocated only during calculation of FCD.
# Example 1:
fcd = FCD(device='cuda:0', n_jobs=8)
smiles_list1 = ['COc1cccc(NC(=O)Cc2coc3ccc(OC)cc23)c1', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
smiles_list2 = ['Oc1ccccc1-c1cccc2cnccc12', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
fcd(smiles_list1, smiles_list2)
# Example 2:
fcd = FCD(device='cuda:0', n_jobs=8)
smiles_list1 = ['COc1cccc(NC(=O)Cc2coc3ccc(OC)cc23)c1', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
smiles_list2 = ['Oc1ccccc1-c1cccc2cnccc12', 'Cc1noc(C)c1CN(C)C(=O)Nc1cc(F)cc(F)c1']
pgen = fcd.precalc(smiles_list2)
fcd(smiles_list1, pgen=pgen)
For the constructor, you can pass the device as device='cpu' for CPU and device='cuda:n' for GPU, where n is the GPU device number. n_jobs parameter specifies the number of threads for parsing SMILES. You can also vary the batch_size parameter. Call parameters for FCD are fcd(ref=None, gen=None, pref=None, pgen=None), where you should specify either ref (SMILES list), or pref (precalculated statistics), and the same for gen and pgen.
Metadata
Release files for fcd-torch 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fcd_torch-1.0.7.tar.gz | 5.2 MB | Without provenance | Details for fcd_torch-1.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fcd_torch-1.0.7-py3-none-any.whl | Python 3 | none | any | Details for fcd_torch-1.0.7-py3-none-any.whl |
Total release size: 10.5 MB
Release files / fcd_torch-1.0.7.tar.gz
| Download URL | fcd_torch-1.0.7.tar.gz |
|---|---|
| Size | 5.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cccb09ce79fbf6be84d2578332f8aa04668b0a34ecae3357e1af3cce3cc13d7
|
|
BLAKE2b-256 checksum How to use checksums |
1ff37dbae532d827a62d95ecfd025774f6c29f917c676034731844c70e1f2b9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
|
Release files / fcd_torch-1.0.7-py3-none-any.whl
| Download URL | fcd_torch-1.0.7-py3-none-any.whl |
|---|---|
| Size | 5.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63a24aae88c554a7ba6422cffdef3ad7c1befec73f835b70ead04097a1ebed6f
|
|
BLAKE2b-256 checksum How to use checksums |
4845476df503cd87d28486af12c37b2e71fc5d0b2730f9bd0539cf19782678b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7
|
Security for fcd-torch 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.