GithubHelp home page GithubHelp logo

orionisbio / mordred Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mordred-descriptor/mordred

0.0 1.0 0.0 1.12 MB

a molecular descriptor calculator

Home Page: http://mordred-descriptor.github.io/documentation/master/

License: BSD 3-Clause "New" or "Revised" License

Python 98.41% Shell 1.59%

mordred's Introduction

mordred

molecular descriptor calculator.

https://travis-ci.org/mordred-descriptor/mordred.svg?branch=master https://coveralls.io/repos/github/mordred-descriptor/mordred/badge.svg?branch=master 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:     1613
3D:      213
------------
total:  1826

Installation

conda(recommended)

  1. install conda

  2. install mordred

    $ conda install -c rdkit -c mordred-descriptor mordred

pip

  1. install rdkit python package

  2. install mordred

    $ pip install 'mordred[full]'  # install with extra requires
    # or
    $ pip install mordred

Testing the installation

$ python -m mordred.tests

examples

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
name,ABC,ABCGG
benzene,4.242640687119286,3.9999999999999996
chlorobenzene,5.059137268047012,4.785854275382693

ABCIndex and AcidBase

$ python -m mordred example.smi -d ABCIndex -d AcidBase
name,ABC,ABCGG,nAcid,nBase
benzene,4.242640687119286,3.9999999999999996,0,0
chlorobenzene,5.059137268047012,4.785854275382693,0,0

multiple input

$ python -m mordred example.smi example2.smi -d ABCIndex
name,ABC,ABCGG
benzene,4.242640687119286,3.9999999999999996
chlorobenzene,5.059137268047012,4.785854275382693
pentane,2.8284271247461903,3.1462643699419726

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:
  INPUT

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
                        processors)
  -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)

>>> len(calc.descriptors)
1613

>>> len(Calculator(descriptors, ignore_3D=True, version="1.0.0"))
1612

# 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

Citation

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

Documentation

mordred's People

Contributors

philopon avatar unixjunkie avatar riccardosabatini avatar hirotomo-moriwaki avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.