分子描述仪
mordred的Python项目详细描述
分子描述符计算器。
描述符数
>>>frommordredimportCalculator,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:16133D:213------------total:1826
安装
PIP
安装rdkitpython包
安装mordred
$ pip install 'mordred[full]'# install with extra requires # or $ pip install mordred
测试安装
$ python -m mordred.tests
示例
as命令
计算所有描述符
$ 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)
保存到文件(显示进度条)
$ python -m mordred example.smi -o example.csv
50%|███████████████████████████████████████▌ | 1/2 [00:00<00:00, 7.66it/s]
流读取(内存不足,没有分子信息)
$ python -m mordred example.smi -s -o example.csv
0it [00:00, ?it/s]
仅限ABCIndex
$ python -m mordred example.smi -d ABCIndex
name,ABC,ABCGG
benzene,4.242640687119286,3.9999999999999996
chlorobenzene,5.059137268047012,4.785854275382693
abcindex和酸碱性
$ 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
多输入
$ 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
显示帮助
$ 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
作为库
>>>fromrdkitimportChem>>>frommordredimportCalculator,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)forsmiin['c1ccccc1Cl','c1ccccc1O','c1ccccc1N']]# as pandas>>>df=calc.pandas(mols)>>>df['SLogP']02.340011.392221.2688Name:SLogP,dtype:float64
作为库
>>>fromrdkitimportChem>>>frommordredimportCalculator,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)forsmiin['c1ccccc1Cl','c1ccccc1O','c1ccccc1N']]# as pandas>>>df=calc.pandas(mols)>>>df['SLogP']02.340011.392221.2688Name:SLogP,dtype:float64
引文
Moriwaki H,Tian Y-S,Kawashita N,Takagi T(2018)Mordred:分子描述符计算器。化学信息学杂志10:4。doi:10.1186/s13321-018-0258-y