Skip to main content

molecular descriptor calculator

Project description

molecular descriptor calculator. Code Climate

number of descriptors

>>> from mordred import Calculator, descriptors
>>> n_all = len(Calculator(descriptors, ignore_3D=False).descriptors)
>>> n_2D = len(Calculator(descriptors, ignore_3D=True).descriptors)
>>> print("2D:    {:5}\n3D:    {:5}\n------------\ntotal: {:5}".format(n_2D, n_all - n_2D, n_all))
2D:     1681
3D:      482
total:  2163



  1. install rdkit python package

  2. install mordred

    $ pip install mordred


as command

calculate all descriptors

$ python -m mordred example.smi
name,ECIndex,WPath,WPol,Zagreb1, (snip)
benzene,36,27,3,24.0, (snip)
chrolobenzene,45,42,5,30.0, (snip)

save to file (display progress bar)

$ python -m mordred example.smi -o example.csv
50%|███████████████████████████████████████▌                                       | 1/2 [00:00<00:00,  7.66it/s]

stream read (low memory, no number of molecules information)

$ python -m mordred example.smi -s -o example.csv
0it [00:00, ?it/s]

only ABCIndex

$ python -m mordred example.smi -d ABCIndex

ABCIndex and AcidBase

$ python -m mordred example.smi -d ABCIndex -d AcidBase

multiple input

$ python -m mordred example.smi example2.smi -d ABCIndex

show help

$ python -m mordred --help
usage: python -m mordred [-h] [--version] [-t {auto,sdf,mol,smi}] [-o OUTPUT]
                         [-p PROCESSES] [-q] [-s] [-d DESC] [-3] [-v]
                         INPUT [INPUT ...]

positional arguments:

optional arguments:
  -h, --help            show this help message and exit
  --version             input molecular file
  -t {auto,sdf,mol,smi}, --type {auto,sdf,mol,smi}
                        input filetype (default: auto)
  -o OUTPUT, --output OUTPUT
                        output file path (default: stdout)
  -p PROCESSES, --processes PROCESSES
                        number of processes (default: number of logical
  -q, --quiet           hide progress bar
  -s, --stream          stream read
  -d DESC, --descriptor DESC
                        descriptors to calculate (default: all)
  -3, --3D              use 3D descriptors (require sdf or mol file)
  -v, --verbosity       verbosity

descriptors: ABCIndex AcidBase AdjacencyMatrix Aromatic AtomCount
Autocorrelation BalabanJ BaryszMatrix BCUT BertzCT BondCount CarbonTypes Chi
Constitutional CPSA DetourMatrix DistanceMatrix EccentricConnectivityIndex
EState ExtendedTopochemicalAtom FragmentComplexity Framework GeometricalIndex
GravitationalIndex HydrogenBond InformationContent KappaShapeIndex Lipinski
McGowanVolume MoeType MolecularDistanceEdge MolecularId MomentOfInertia MoRSE
PathCount Polarizability RingCount RotatableBond SLogP TopologicalCharge
TopologicalIndex TopoPSA VdwVolumeABC VertexAdjacencyInformation WalkCount
Weight WienerIndex ZagrebIndex

as library

>>> from rdkit import Chem
>>> from mordred import Calculator, descriptors

# create descriptor calculator with all descriptors
>>> calc = Calculator(descriptors, ignore_3D=True)

# calculate single molecule
>>> mol = Chem.MolFromSmiles('c1ccccc1')
>>> calc(mol)[:3]
[4.242640687119286, 3.9999999999999996, 0]

# calculate multiple molecule
>>> mols = [Chem.MolFromSmiles(smi) for smi in ['c1ccccc1Cl', 'c1ccccc1O', 'c1ccccc1N']]

# as pandas
>>> df = calc.pandas(mols)
>>> df['SLogP']
0    2.3400
1    1.3922
2    1.2688
Name: SLogP, dtype: float64

see examples


Moriwaki H, Tian Y-S, Kawashita N, Takagi T (2018) Mordred: a molecular descriptor calculator. Journal of Cheminformatics 10:4 . doi: 10.1186/s13321-018-0258-y


Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
mordred-1.1.1.tar.gz (127.7 kB) Copy SHA256 hash SHA256 Source None May 31, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page