LoginSignup
8
5

More than 3 years have passed since last update.

mordredで1分子1記述子の計算を行う

Last updated at Posted at 2019-02-10

背景

フリーの化合物の記述子計算ソフトであるmordredにおいて、1分子毎、1記述子毎に記述子計算を行いたいが、github上に用意されているマニュアルにはあまり詳しい情報がなかった

環境

  • Windows 10
  • Anaconda
  • Python 3.X
  • mordred 1.1.1

やりかた

まずは、calc = Calculator(descriptors, ignore_3D=False)をやると、用意されているすべての記述子オブジェクトがcalc.descriptorsで取得できる。
ソースをハックすればわかるのだが、記述子オブジェクトの__str__()メソッドで記述子の名前が取得できるのでそれをキーとし、値を記述子オブジェクトとするdictionaryを作成する。

from rdkit import Chem
from mordred import Calculator, descriptors

descs = {}
calc = Calculator(descriptors, ignore_3D=False)
for i, desc in enumerate(calc.descriptors):
   descs[desc.__str__()] = desc

後は、計算したい記述の名前を指定して記述子オブジェクトを取得し、計算したいmolオブジェクトを指定するだけ。

mol = Chem.MolFromSmiles("CCCC")
result = descs["GATS6i"](mol)

ここまで扱えるとかなりシステムに自由自在に組み込めそう。

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5