Cross entropy clustering

My kids love mickey mouse. ;-) If you have mickey mouse plot, can you cluster the data reasonably ? R package named gmum.r provides interesting solution to do it. The package has many features for data analysis. If reader who has interest it please use it. I used the package to cluster mickey mouse data!Continue reading “Cross entropy clustering”

Draw radar chart with R

A radar chart is a graphical method of displaying multivariate data in the form of a two-dimensional chart of three or more quantitative variables represented on axes starting from the same point. The relative position and angle of the axes is typically uninformative. (from wikipedia) It’s useful for visualize multi parameters in drug discovery. ForContinue reading “Draw radar chart with R”

Find MCS in R

Find maximum common substructure is useful for finding core scaffold. I think that finding MCS, using commercially available tools is common (pipeline pilot ?). I often use RDkit. ;-) Today I found the library that search MCS in R, named fmcsR. That’s sounds nice, because if fmcsR works fine, I’ll implement the library to SpotfireContinue reading “Find MCS in R”

PKPD in R.

You know, to drug development understanding PKPD is important. I’m not DMPK dept. but I think it’s better to know about basic PKPD theory. There are some packages about pkpd analysis in R. And I found cool library developed ronkeiser named “PKPDsim”. This library can integrate shiny, so user can calculate PKPD on theContinue reading “PKPD in R.”

Array or sparse array ?

In a process of lead optimization, chemist often do SAR expansion around potent compound. If lead compound can be break down three parts A(head), B(core), C(tail), chemist(me…) often fix one part(e.g core B) and change two parts. After optimize A and C then, fix A, C and change B. This approach is called array synthesisContinue reading “Array or sparse array ?”

Get distance matrix via tibco spotfire.

I often calculate molecular distance matrix or similarity matrix. Distance matrix is useful for visualise molecular similarity but some time it is bother to calculate it. Today I wrote data function that calculate distance matrix for molecular set. There are not native function to calculate that in Spotfire. And RCDK can not install TERR. So,Continue reading “Get distance matrix via tibco spotfire.”

Calculate PK param. using TIBCO Spotfire?

Somedays ago,my colleague asked me how to calculate PK parameters in TIBCO Spotfire ? Hmm. That’s sounds difficult, because Spotfire is not tool for analyse DMPK data. But, there are some packages in CRAN for DMPK. So I thought that using TERR, some PK params could calculate. Let’s do it. ;-) At first I installedContinue reading “Calculate PK param. using TIBCO Spotfire?”

Implementation of machine learning in Spotfire.

Today I coded for functions that predict molecular property using e1071. Following code is almost pure R, but the code get data from Spotifre. So, users don’t need to think about R coding. User can build model and predict data only using spotfire. At first I get sample data in from Bursi Mutagenicity Dataset(link). ConvertContinue reading “Implementation of machine learning in Spotfire.”

ggplot with spotfire

ggplot2 is nice tool for visualise data in R. TIBCO Spotfire does not have density plot function. So, I implemented density plot in spotfire. I did it using RinR function and ggplot2. * This is simple sample. In spotfire data function, I wrote following… “idx” is column name which you want plot In Spotfire’s input tab,Continue reading “ggplot with spotfire”

Interactive view in ggplot.

Somedays ago, I knew R package “shiny“. This package is good tool to make interactive view in R. There is a famous tool Spotfire. Use with ggplot, it will be cool. To use shiny, I wrote two scripts, server.R and ui.R. ui.R defines user interface, and server.R defines plot. I wrote interactive view about iris.Continue reading “Interactive view in ggplot.”

Make biplot using ggplot.

Principal Component Analysis (PCA) is a statistical procedure that uses an orthogonal transformation to convert a set of observations of possibly correlated variables into set of values of linearly un correlated variables. (from wiki) R can preform PCA very simple command “prcomp”. The result can visualise using biplot function. ggplot2 is a plotting system forContinue reading “Make biplot using ggplot.”


最近Rの勉強をしています。 TSは散布図は一度に一個なので、フィールドが複数ある場合不便です。 その点Rはデーターフレームであればplotで一気に描けるのでいいなあって思います。 そんなRできれいな図を描くツールとしてggplot2があります。 さらにプロットマトリックスを作るツールとしてGGallyが素敵です。 インストールはこんな感じで でggpairsでマトリックスプロットを作ります。 data引数にデーターフレームを columnsに使用するカラムを colors にファクターを入れると とすると、以下のようなグラフができます。 いいでね


引き続きR、2コンパートメントモデル。 central compartment の濃度をy[1] peripheral compartmentの濃度をy[2] k10, k12, k21をそれぞれ k12=1.49 , k21=0.495 , k10=0.789と設定する 初期値をy[1] = 1000, y[2] = 0としてみる。 dy1/dt = k21y2 – k12y1 – k10y1 dy2/dt = k12y1 – k21y2 がそれぞれのコンパートメントでの収支 軸設定がおかしいのはスキルが無いため、、


Rで非線形回帰、2コンパートメントモデル。 p176 1コンパートメントモデル、IV投与 Rでやってみる PKのパッケージにbiexp関数があるので これを使う。 Estimation of initial and terminal half-life by fitting a biexponential model. 傾きがα、βに相当するので α=2.69h-1, β=0.15h-1, 切片の値からA=8.59 mg/L, B=1.40 mg/L k21 = (Aβ+Bα) / (A+B) = 0.50 k10 = αβ/k21 = 0.80 k12 = α+β-k10-k21 = 1.54 で AUC = A/a + B/b = 12.5 より CL = S*F*D/AUC = 100 /Continue reading “Rで勉強2”


Rで線形回帰 テキストはこれ webリンクもあってよいですね。 p151 1コンパートメントモデル、IV投与 Rでやってみる  time <- c(0.1,0.2,0.5,1,1.5,2,3,5,7,10,12,15)  conc<-c(2.45,2.40,2.26,2.04,1.85,1.67,1.37,0.92,0.61,0.33,0.22,0.12)  lnc<-log(conc)  test2<-cbind(lnc,time)   reg<-lm(lnc~time,data=data.frame(test2))   reg Call: lm(formula = lnc ~ time, data = data.frame(test2)) Coefficients: (Intercept) time 0.9187 -0.2025 ということでk=0.20h-1 lnCp0 = 0.919 Cp0 = exp(0.919)=2.5mg/L となりました。 lm(formura, data)にて線形回帰を実行する


職場でRを使おうとするとライブラリのインストールに四苦八苦する。 プロキシを超えねばならないのです。 調べると、Rのショートカットの後ろに –internet2と入れたらいいとあるのですが これだと、ブラウザのプロキシ設定は読むけど、認証は別途入れる形なのでリポジトリにつながらない。 さらに調べた結果、 ホームディレクトリに .Rprofileを作って Sys.setenv(http_proxy=”http://proxy:port/&#8221; Sys.setenv(http_proxy_user=”ask” と入れると良いと分かった。 ちなみにこれを書いていても–internet2の記載を残しっぱなしだとそっちの設定になるみたいで つながらない。 このことに気がつくのにかなりの時間を費やした。。。。 今はいい感じになったのでまずはe1071, rcdkを入れました。