Skip to main content

Identify silly molecules

Project description

molspotter

Disclaimer

This repository is based on the awesome silly_walks work of Patrick Walters.

Summary

Identify silly molecules.

molspotter helps finding unusual/silly atom arrangements in molecules. To do so a reference dataset of molecules is used. Any fingerprint bit of a new molecule not appearing in the reference set is considered silly.

Installation

pip install molspotter

Usage

Three prepared spotters are included in molspotter. They are respectively trained on:

API

One can easily load a spotter as follows:

from molspotter import SillyMolSpotter

sms = SillyMolSpotter.from_pretrained('chembl')

New molecules can easily be scored using this spotter instance:

from rdkit import Chem

mol = Chem.MolFromSmiles('C=C=C1CN(C)CCN1Cc5ccc(C(=O)Nc4ccc(C)c(Nc3nccc(c2cccnc2)n3)c4)cc5')
sms.score_mol(mol)
# 0.023809523809523808

The silly bit score is defined as $score = \frac{n_{silly bits}}{n_{on bits}}$. A value of 0.0 means that the molecule does not contain any silly bit, while a value of 1.0 means the molecule is only made of silly bits.

Silly bits can also be displayed:

img = sms.show_mol(mol)

Silly bits highlighted in the molecular structure

One can create their own spotter using the following:

# Instantiate a spotter with radius of Morgan fingerprint value of 2
sms = SillyMolSpotter(fp_radius=2)

sms.add_file('PATH_TO_MOLECULAR_FILE')

Finally, a spotter can be saved and loaded back from disk:

sms.save('PATH_TO_SAVE_SPOTTER_TO')

sms2 = SillyMolSpotter.from_file('PATH_TO_SAVED_SPOTTER')

Command-line interface

  • Create a spotter
molspotter create -o examples/chembl_drugs.sp -i examples/chembl_drugs.sd
  • Score with a spotter
molspotter score -s examples/chembl_drugs.sp -i examples/chembl_drugs.sd
molspotter score -s chembl -i examples/chembl_drugs.sd

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molspotter-0.0.2.tar.gz (274.5 kB view hashes)

Uploaded Source

Built Distribution

molspotter-0.0.2-py3-none-any.whl (272.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page