Code Monkey home page Code Monkey logo

ctsgetr's Introduction

CTSgetR

R interface to the [Chemical Translation Service (CTS)] (http://cts.fiehnlab.ucdavis.edu/)

Installation

#library(devtools) # install.packages("devtools") if missing
#install_github(repo = "CTSgetR", username = "dgrapov",ref="simple")
library(CTSgetR)

How to use the interface

help(CTSgetR)

View possible translation options between > 200 databases.

trans<-unlist(CTS.options())
head(trans,10)
##  [1] "BioCyc"                    "CAS"                      
##  [3] "ChEBI"                     "Chemical Name"            
##  [5] "Human Metabolome Database" "InChI Code"               
##  [7] "InChIKey"                  "KEGG"                     
##  [9] "LMSD"                      "LipidMAPS"

Find a database of interest.

want<-'zinc'
fuzzy<-1 # larger more fuzzy matching
trans[agrepl(want,trans,ignore.case=TRUE,max.distance=fuzzy)]
## [1] "InChI Code"                    "InChIKey"                     
## [3] "ZINC"                          "Tetrahedron Scientific Inc"   
## [5] "AK Scientific, Inc. (AKSCI)"   "Ark Pharm, Inc."              
## [7] "Zancheng Functional Chemicals"

Example usage

library(CTSgetR)
#translate from chemical name to InchiKey
id<-"alanine"
from<-"Chemical Name"
to<-"InChIKey"
CTSgetR(id,from,to,progress=FALSE)
##   fromIdentifier searchTerm toIdentifier                       value
## 1  Chemical Name    alanine     InChIKey QNAYBMKLOCPYGJ-REOHCLBHSA-N
#translate from one to many identifiers 
id<-c("DMULVCHRPCFFGV-UHFFFAOYSA-N","ZPUCINDJVBIVPJ-LJISPDSOSA-N","ZAGRKAFMISFKIO-QMTHXVAHSA-N")
from<-"InChIKey"
to<- c("Chemical Name", "PubChem CID", "KEGG","Human Metabolome Database")
CTSgetR(id,from,to,progress=FALSE,limit.values = FALSE)
##    fromIdentifier                  searchTerm              toIdentifier
## 1        InChIKey DMULVCHRPCFFGV-UHFFFAOYSA-N             Chemical Name
## 2        InChIKey DMULVCHRPCFFGV-UHFFFAOYSA-N             Chemical Name
## 3        InChIKey ZPUCINDJVBIVPJ-LJISPDSOSA-N             Chemical Name
## 4        InChIKey ZPUCINDJVBIVPJ-LJISPDSOSA-N             Chemical Name
## 5        InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N             Chemical Name
## 6        InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N             Chemical Name
## 7        InChIKey DMULVCHRPCFFGV-UHFFFAOYSA-N               PubChem CID
## 8        InChIKey ZPUCINDJVBIVPJ-LJISPDSOSA-N               PubChem CID
## 9        InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N               PubChem CID
## 10       InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N               PubChem CID
## 11       InChIKey DMULVCHRPCFFGV-UHFFFAOYSA-N                      KEGG
## 12       InChIKey ZPUCINDJVBIVPJ-LJISPDSOSA-N                      KEGG
## 13       InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N                      KEGG
## 14       InChIKey DMULVCHRPCFFGV-UHFFFAOYSA-N Human Metabolome Database
## 15       InChIKey ZPUCINDJVBIVPJ-LJISPDSOSA-N Human Metabolome Database
## 16       InChIKey ZAGRKAFMISFKIO-QMTHXVAHSA-N Human Metabolome Database
##                                                                                                  value
## 1                                                             2-(1H-Indol-3-yl)-N,N-dimethylethanamine
## 2                                                                1H-Indole-3-ethanamine, N,N-dimethyl-
## 3  8-Azabicyclo[3.2.1]octane-2-carboxylic acid, 3-(benzoyloxy)-8-methyl-, methyl ester, (1R,2R,3S,5S)-
## 4                 Methyl (1R,2R,3S,5S)-3-(benzoyloxy)-8-methyl-8-azabicyclo[3.2.1]octane-2-carboxylate
## 5                                            (8beta)-6-Methyl-9,10-didehydroergoline-8-carboxylic acid
## 6                                       Ergoline-8-carboxylic acid, 9,10-didehydro-6-methyl-, (8beta)-
## 7                                                                                                 6089
## 8                                                                                               446220
## 9                                                                                             11861108
## 10                                                                                                6717
## 11                                                                                              C08302
## 12                                                                                              C01416
## 13                                                                                                    
## 14                                                                                           HMDB05973
## 15                                                                                                    
## 16

Check out some more translation examples.

TODO

  • Get POST to work
  • Make it more awesome!

ctsgetr's People

Contributors

dgrapov avatar

Watchers

James Cloos avatar robinotn 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.