Preparation of the example data"

  collapse = TRUE,
  comment = "#>"

The example data used in this package was originally published by Yamanishi et al, 2008. They used the KEGG data base to get information drug-target interaction for different groups of enzymes. We used their supplementary material as a basis for the example data provided to the package. Their supplementary datasets can be downloaded from here.

Obtaining the original data

The original adjacency matrix and similarity of the targets were downloaded from that website using the following code:

adjAddress <- ""

targetAddress <- ""

drugTargetInteraction <- as.matrix(
  read.table(adjAddress, header = TRUE, row.names = 1, sep = "\t")
targetSim <- as.matrix(
  read.table(targetAddress, header =TRUE, row.names = 1, sep = "\t")

This data was used as is from the website.

Processing the drug similarities

In the original paper the authors relied on the SIMCOMP algorithm, but this method returns non-symmetric matrices and hence the original data cannot be used in a meaningful way for a two-step kernel ridge regression. Hence we decided to recreate the similarities between the different drugs, this time using the algorithms provided in the fmcsR package v1.20.0. The code used to obtain and process the drug similarities is heavily based on code kindly provided by Dr. Thomas Girke on the BioConductor support forum.

Obtaining the data

To read in the structural data for all compounds we create a function that constructs the actual link and retrieves the data from KEGG. This function is based on the tools provided in the ChemmineR package v2.30.2:

importKEGG <- function(ids){
  sdfset <- SDFset() # creates an empty SDF set

  # We use the link format for obtaining the data
  urlp <- ""

  # Combine everything in an sdfset
  for(i in ids){
    url <- paste0(urlp, i)
    tmp <- as(read.SDFset(url), "SDFset")
    cid(tmp) <- i
    sdfset <- c(sdfset, tmp)
# Now read the SDF information for all compounds in the research
keggsdf <- importKEGG(colnames(drugTargetInteraction))

Calculating the similarities

The fmcs function in the fmcsR package allows to compute a similarity score between two compounds. It returns a few different similarity measures, including the Tanimoto coefficient. This coefficient turns out to be a valid kernel for chemical similarities (Ralaivola et al, 2005 , Bajusz et al, 2015). So in this example we continue with the Tanimoto coefficients.

# Keep in mind this needs some time to run! 
drugSim <- sapply(cid(keggsdf),
                    fmcsBatch(keggsdf[x], keggsdf,
                              au = 0, bu = 0)[,"Tanimoto_Coefficient"]

All data is stored in the package and can be accessed using


Try the xnet package in your browser

Any scripts or data that you put into this service are public.

xnet documentation built on Feb. 4, 2020, 9:10 a.m.