Drkcore

04 11 2006 chemoinformatics Tweet

MT距離ってのがいまいちつかめてない

CRANのNewsletterが更新されていたので、一昨日の帰りの新幹線の中で読んでたら、fingerprintっていうパッケージが追加されてた。

CRAN - Package fingerprint

This package contains functions to manipulate binary fingerprints of arbitrary length. A fingerprint is represented by an object of S4 class 'fingerprint' which is internally represented a vector of integers, such that each element represents the position in the fingerprint that is set to 1. The bitwise logical functions in R are overridden so that they can be used directly with 'fingerprint' objects. Distances metrics are also available. Fingerprints can be converted to Euclidean vectors (i.e., points on the unit hypersphere)i and can also be folded using XOR. Arbitrary fingerprint formats can be handled via line handlers. Currently handlers are provided for CDK, MOE and BCI fingerprint data.

CDKとかMOE,BCI用のハンドラがついてるようです。で、Similarity metricは何使えんのかな?とマニュアル読んでみると、

  • tanimoto
  • euclidean
  • mt
  • dice

の4つ。このなかで、MT係数って聞いたことないナァ。ちょっと調べてみたけどわからなかったので直接ソースを読んでみることにした。はじめてのパッケージイントロスペクション。

で読んでみたら、あー、Rのパッケージ読むの単なる食わず嫌いだったかも。思ったよりややこしいことはしてませんな、これからは積極的に読んだほうがいいかもと思った。

というわけで、ちょっとまとめておいた。前提としてフィンガープリントの共通のビットが立つかどうかを下の表であらわしておく。

fp1 bitありfp1 bitなし
fp2 bitありCB
fp2 bitなしAD

tanimoto

まずはわかりやすいタニモト係数から。

 dist <- c / (a+b+c)

dは考慮されない、つまりビットの立たないもの同士は類似とみなされない。

euclidean

dist <- sqrt((d+c) / (a+b+c+d))

ユークリッド距離はお互いビットが立ってないという情報も似ていると判断されるわけですな。

dice

dist <- c / (.5*a + .5*b + c)

diceの距離も基本的にはタニモトと一緒。僕はあまり使わない。

mt

size <- length(fp1)

t1 <- c/(size-d)
t0 <- d/(size-c)
phat <- ((size-d) + c)/(2*size)
dist <- (2-phat)*t1/3 + (1+phat)*t0/3

t1はc/(a+b+c)、t0はd/(a+b+d)とかける。phatは全フィンガープリントでのビットの立っている割合(ビットの密度)。ビットの密度を考慮してるのはわかったんだが、t1,t0の分母の意味がちょっと理解できてないかも(aとbの情報を考慮してんだろうな)。おそらくビットの密度に偏りがある場合にできるだけ補正できるような距離なのかなとか思った。タニモトにビットが立たない場合の情報の扱いを加えた感じか。

と、ここまで考えてやっと気付いた。

MTってもしかしてModified Tanimoto?

ビンゴだった。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021