firmo23
firmo23

Reputation: 8454

How to use Cheminformatics Toolkit for R to compare a set of SMILES structures

I have a set of SMILES codes of different molecules and I would like to know how to determine similarity among them. I have decided to use the ChemmineR package based on this tutorial. The issue is that I cannot understand how to connect my dataframe and use it like a ChemmineR object in order to run the analysis on SMILES.

DrugName<-c("alclofenac","alosetron")
DrugID_CID<-c("30951","2099")
DrugID<-c("CHEMBL94081","DB00969")
DrugBank<-c("DB13167","DB00969")
SMILES<-c("OC(=O)Cc1ccc(OCC=C)c(Cl)c1","Cc1[nH]cnc1CN1CCc2c(C1=O)c1ccccc1n2C")
Target<-c("PTGS1","HTR3A")

test<-data.frame(DrugName,DrugID_CID,DrugID,DrugBank,SMILES,Target)

I have used the read.SMIset function which imports one or many molecules from a SMILES file and stores them in a SMIset container but I cannot understand how to further proceed with this.

library("ChemmineR")

test; smiset <- smisample
write.SMI(smiset, file="sub.smi") 
smiset <- read.SMIset("sub.smi")

data(smisample) # Loads the same SMIset provided by the library 
smiset <- smisample
smiset 

view(smiset) 

cid(smiset) 
smi <- as.character(smiset)

  as(smi, "SMIset") 

Upvotes: 1

Views: 779

Answers (1)

neilfws
neilfws

Reputation: 33802

It's not entirely clear what you want to compare with what. However, here is one way to proceed with the SMILES in your example data frame.

First you need to convert the SMILES to a SDFset. This is the first step in most ChemmineR operations.

test_sdf <- smiles2sdf(test$SMILES)

For pairwise comparison using atom pairs, you need to convert again to an APset:

test_ap <- sdf2ap(test_sdf)

You could now compare, for example, the first compound in the APset with the second:

cmp.similarity(test_ap[1], test_ap[2])

[1] 0.1313131

I would spend some time reading and working through the Chemminer vignette linked in your question. It's a lot of information but it is well-presented, very clear and covers most things that you'll want to do.

Upvotes: 3

Related Questions