Giter Site home page Giter Site logo

drugbankr's Introduction

Introduction

This package can be used to query the newest version (e.g. 5.1.3) of DrugBank database in R. It can transform the original DrugBank database in xml file format, which is available here, into a dataframe and store the dataframe into a SQLite database. The generated DrugBank SQLite database in specific version can be queried by using queryDB function. We can

  • Get the entire DrugBank dataframe

  • Get all the DrugBank ids

  • Determine whether the query drugs are FDA approved

  • Get targets of the query drugs.

Installation and load

The drugbankR package can be directly installed from github

# install.packages("devtools")
devtools::install_github("yduan004/drugbankR")

load the package into R

library(drugbankR)

Generate your own DrugBank SQLite database

Download and unzip the full DrugBank database (xml file) from here to your present working directory of R session, rename the unziped xml file as drugbank.xml. The dbxml2df function will read in the xml file and transform it into a data.frame object in R. This process may take about 20 minutes. Argument version is a character indicating the version of the downloaded DrugBank database. Since now, the newest version is 5.1.3. Note, you need to creat a DrugBank account and log in to access the data.

drugbank_dataframe <- dbxml2df(xmlfile="drugbank.xml", version="5.1.3") 

The df2SQLite function stores the drugbank dataframe into a SQLite database. The created SQLite database (drugbank_versionNumber.db) is under your present working direcotry of R, you could check your current R working directory by running getwd() in R.

df2SQLite(dbdf=drugbank_dataframe, version="5.1.3")

Query the DrugBank SQLite database generated above

all <- queryDB(type = "getAll", db_path="drugbank_5.1.3.db") # get the entire drugbank dataframe
dim(all)
ids <- queryDB(type = "getIDs", db_path="drugbank_5.1.3.db") # get all the drugbank ids
ids[1:4]

# given drugbank ids, determine whether they are FDA approved
queryDB(ids = c("DB00001","DB00002"),type = "whichFDA", db_path="drugbank_5.1.3.db") 

# given drugbank ids, get their targets
queryDB(ids = c("DB00001","DB00002"),type = "getTargets", db_path="drugbank_5.1.3.db") 

drugbankr's People

Contributors

yduan004 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.