mordred package

modred descriptor calculator.

class mordred.Descriptor[source]

abstract base class of descriptors.

mol

rdkit.Mol – target molecule

classmethod preset()[source]

generate preset descriptor instances.

Returns:preset descriptors
Return type:Iterable[Descriptor]
parameters()[source]

[abstractmethod] get __init__ arguments of this descriptor instance.

this method used in pickling and identifying descriptor instance.

Returns:tuple of __init__ arguments
Return type:tuple
calculate()[source]

[abstractmethod] calculate descriptor value.

Returns:rtype
dependencies()[source]

descriptor dependencies.

Returns:dict[str, Descriptor or None] or None
as_argument

argument representation of descriptor

Returns:any
mol

get molecule

Returns:rdkit.Mol
coord

get 3D coordinate

Returns:coordinate matrix
Return type:numpy.array[3, N]
fail(exception)[source]

raise known exception and return missing value

Raises:MissingValueException
rethrow_zerodiv()[source]

[contextmanager] treat zero div as known exception

rethrow_na(exception)[source]

[contextmanager] treat any exceptions as known exception

class mordred.Calculator(descs=[], ignore_3D=False)[source]

descriptor calculator.

Parameters:
  • descs – see Calculator.register() method
  • ignore_3D – see Calculator.register() method
descriptors

all descriptors.

you can get/set/delete descriptor.

Returns:registered descriptors
Return type:tuple[Descriptor]
register(desc, ignore_3D=False)[source]

register descriptors.

Descriptor-like:
  • Descriptor instance: self
  • Descriptor class: use Descriptor.preset() method
  • module: use Descriptor-likes in module
  • Iterable: use Descriptor-likes in Iterable
Parameters:
  • desc (Descriptor-like) – descriptors to register
  • ignore_3D (bool) – ignore 3D descriptors
echo(s, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, end='\n')[source]

output message

Parameters:
  • s (str) – message to output
  • file (file-like) – output to
  • end (str) – end mark of message
Returns:

None

map(mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1)[source]

calculate descriptors over mols.

Parameters:
  • mols (Iterable[rdkit.Mol]) – moleculars
  • nproc (int) – number of process to use. default: multiprocessing.cpu_count()
  • nmols (int) – number of all mols to use in progress-bar. default: mols.__len__()
  • quiet (bool) – don’t show progress bar. default: False
  • ipynb (bool) – use ipython notebook progress bar. default: False
  • id (int) – conformer id to use. default: -1.
Returns:

Iterator[scalar]

pandas(mols, nproc=None, nmols=None, quiet=False, ipynb=False, id=-1)[source]

calculate descriptors over mols.

Returns:pandas.DataFrame
mordred.all_descriptors()[source]

[deprecated] use mordred.descriptors module instead.

yield all descriptor modules.

Returns:all modules
Return type:Iterator (Descriptor)
mordred.get_descriptors_from_module(mdl, submodule=False)[source]

get descriptors from module.

Parameters:mdl (module) – module to search
Returns:[Descriptor]