Skip to main content

A python library for controlling chemical space

Project description

chem_templates

chem_templates provides an expressive and flexible way of defining desired chemical spaces

See the documentation for documentation and tutorials

Install

pip install chem_templates

Basic Usage

For more detail on the API, see the basic tutorial

from rdkit.Chem import rdMolDescriptors, Descriptors
from chem_templates.filter import RangeFunctionFilter, Template
from chem_templates.chem import Molecule

def hbd(molecule):
    return rdMolDescriptors.CalcNumHBD(molecule.mol)

def hba(molecule):
    return rdMolDescriptors.CalcNumHBA(molecule.mol)

def molwt(molecule):
    return rdMolDescriptors.CalcExactMolWt(molecule.mol)

def logp(molecule):
    return Descriptors.MolLogP(molecule.mol)

hbd_filter = RangeFunctionFilter(hbd, 'hydrogen_bond_donor', None, 5)
hba_filter = RangeFunctionFilter(hba, 'hydrogen_bond_acceptor', None, 10)
molwt_filter = RangeFunctionFilter(molwt, 'mol_weight', None, 500)
logp_filter = RangeFunctionFilter(logp, 'logp', None, 5)

filters = [
    hbd_filter,
    hba_filter,
    molwt_filter,
    logp_filter
]

ro5_template = Template(filters)

smiles = ['C=CCNC(=O)N1CCN(C(=O)[C@H]2C[C@@H]2c2cccc(F)c2F)CC1',
 'C[C@@H]1CCCC[C@@H]1OCC(=O)OCc1nnc(-c2cccc(Br)c2)o1',
 'CCC[C@@H](OC)C(=O)N[C@@H](CNc1cnc(F)cn1)C(C)C',
 'CC(C)/C=C\\C(=O)N1CCC[C@@](CO)(NC(=O)OC(C)(C)C)C1',
 'C(c1ccccc1)CCC[C@@H](C)c1nnc(N2CCN(C(=O)OC(C)(C)C)[C@@H](C)C2)n1Cc1csc(C(C)(C)C)n1',
 'O=C(c1cccc(F)c1)N1CC[C@]2(CN(CC3=CCCCC3)CCO2)C1']

molecules = [Molecule(i) for i in smiles]
results = [ro5_template(i).result for i in molecules]
>[True, True, True, True, False, True]

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

chem_templates-0.0.7.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

chem_templates-0.0.7-py3-none-any.whl (56.6 kB view details)

Uploaded Python 3

File details

Details for the file chem_templates-0.0.7.tar.gz.

File metadata

  • Download URL: chem_templates-0.0.7.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for chem_templates-0.0.7.tar.gz
Algorithm Hash digest
SHA256 3f72c79aad4984d1015234109f7d0e15921a4aeabc3ac7a8b8ac5df428c66ced
MD5 3ae0b1cd03bd7949c75836e7ec3b2453
BLAKE2b-256 bfb8a2820dfb3bda95176777e67b140b4777b2a0c4fc3ef841c5bb6c0f8ca953

See more details on using hashes here.

File details

Details for the file chem_templates-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for chem_templates-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf58207bd27575b9ba7db08b2b9873b5ceb3cad9a0c9aa6d6258e595b268e71
MD5 c51a05e078b1ae08b6e47ad77f7c624c
BLAKE2b-256 7f3ddffe789929b70d702b3d049e41e4ebc25d711c23aca429dcb6082cd98568

See more details on using hashes here.

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