drugex.molecules package

Subpackages

Submodules

drugex.molecules.interfaces module

interfaces

Created by: Martin Sicho On: 06.04.22, 16:54

class drugex.molecules.interfaces.BaseMolSupplier(converter, hide_duplicates=False)[source]

Bases: MolSupplier, ABC

Extended MolSupplier that produces instances of DrExMol that implements identification of duplicates and other useful features.

convert(representation)[source]

Can be used to convert a molecule from the supplied representation to a different one. This method is called automatically on the output of next. By default, it returns the produced representation as is.

Parameters:

next (representation - the output produced by) –

Return type:

molecule - molecule converted from “representation” to the desired output

exception drugex.molecules.interfaces.ItemException[source]

Bases: Exception

class drugex.molecules.interfaces.MolSupplier[source]

Bases: ABC

Generic class that defines the interface for data suppliers from molecules. Implementations of this class are used to wrap functionality that can be reused and evaluated in parallel with the ParallelSupplierEvaluator.

Suppliers are simply just Python generators that produce the desired output one item at a time. It is also possible to implement the convert method to customize the produced output.

convert(representation)[source]

Can be used to convert a molecule from the supplied representation to a different one. This method is called automatically on the output of next. By default, it returns the produced representation as is.

Parameters:

next (representation - the output produced by) –

Return type:

molecule - molecule converted from “representation” to the desired output

abstract next()[source]

Implement this method so that it provides iteration over molecules item by item. It should fetch next item from a generator, line from a file or next item from a remote API. If there are no more items, raise StopIteration.

Raises:

StopIteration – no more items to return

Returns:

one instance of a molecule annotations (optional): molecule associated metadata as a dict

Return type:

molecule

toList()[source]
class drugex.molecules.interfaces.Molecule[source]

Bases: ABC

abstract annotate(key, value)[source]
abstract asRDKit()[source]
abstract getAnnotation(key)[source]
abstract getMetadata()[source]
abstract getUniqueID()[source]

drugex.molecules.mol module

core

Created by: Martin Sicho On: 21.04.22, 22:03

class drugex.molecules.mol.DrExMol(rd_mol, identifier=None)[source]

Bases: Molecule

annotate(key, value)[source]
asRDKit()[source]
getAnnotation(key)[source]
getMetadata()[source]
getUniqueID()[source]
property smiles
exception drugex.molecules.mol.InitializationException[source]

Bases: Exception

drugex.molecules.suppliers module

suppliers

Created by: Martin Sicho On: 22.04.22, 13:50

class drugex.molecules.suppliers.ListSupplier(mols, converter=<drugex.molecules.converters.default.SmilesToDrEx object>, hide_duplicates=False)[source]

Bases: BaseMolSupplier

Basic supplier that converts molecules in a list to the desired representation (SMILES string to DrExMol by default).

next()[source]

Implement this method so that it provides iteration over molecules item by item. It should fetch next item from a generator, line from a file or next item from a remote API. If there are no more items, raise StopIteration.

Raises:

StopIteration – no more items to return

Returns:

one instance of a molecule annotations (optional): molecule associated metadata as a dict

Return type:

molecule

class drugex.molecules.suppliers.StandardizedSupplier(mols, standardizer)[source]

Bases: BaseMolSupplier

Supplies standardized molecules from the input molecules. It requires a standardizer.

next()[source]

Defines access to the next item to be processed.

Returns:

next molecule for processing

Module contents

__init__.py

Created by: Martin Sicho On: 06.04.22, 16:53