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, I used RinR. Using RinR, Spotfire can use local R environment function.
I set input parameter ‘smiles’ as column and output parameter ‘res’ as table.
Then register following data function to TS server.

res <- REvaluate(
         { library( rcdk );
           mols <- parse.smiles( smiles );
           fps <- lapply( mols, get.fingerprint, type='extended' );
           fp.sim <- fp.sim.matrix( fps, method=tanimoto'' );
           dist <- 1 - fp.sim;
           dist.df <- data.frame( smiles, dist );
           res <- dist.df;
          }, data = 'smiles'

I could get distance matrix when I ran the function.
RinR is very flexible to extend function of spotfire.


Published by iwatobipen

I'm medicinal chemist in mid size of pharmaceutical company. I love chemoinfo, cording, organic synthesis, my family.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: