Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/DESCRIPTION

This file was deleted.

3 changes: 0 additions & 3 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/NAMESPACE

This file was deleted.

2 changes: 0 additions & 2 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/R/test.R

This file was deleted.

18 changes: 0 additions & 18 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/README.md

This file was deleted.

91 changes: 0 additions & 91 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/man/CTS.getR.Rd

This file was deleted.

39 changes: 0 additions & 39 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/man/CTSgetR-package.Rd

This file was deleted.

113 changes: 0 additions & 113 deletions CTSgetR.Rcheck/00_pkg_src/CTSgetR/zCTS.r

This file was deleted.

14 changes: 0 additions & 14 deletions CTSgetR.Rcheck/00check.log

This file was deleted.

Binary file removed CTSgetR_1.0.tar.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ Author: Dmitry Grapov
Maintainer: <dgrapov@gmail.com>
Description: Translate between > 200 of the most common biological databases identifiers.
License: TBA
Imports: RCurl, jsonlite, KEGGREST, vwr, RJSONIO, utils
biocViews: Metabolomics
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ exportPattern("^[[:alpha:]]+")
export(CTSgetR,CTS.options,multi.CTSgetR,KEGGtoName,NametoKEGG,CIDtoName,NametoPubChem,NametoInchI)
import(RCurl)
import(jsonlite)
import(KEGGREST)
import(vwr)
import(RJSONIO)
import(utils)
4 changes: 2 additions & 2 deletions R/CTS.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ CTSgetR<-function(id,from,to,async=FALSE,limit.values=TRUE,progress=TRUE,server=
}

CTS.translate<-function(server,from,to,id,progress=TRUE){ #arguably parallel, seems more connection stable than asynchronous
#require("RCurl")

# results are returned as JSON encoded strings
id<-as.character(unlist(id))
url<-paste(server,curlEscape(from),curlEscape(to),curlEscape(id),sep="/") # seperate encoding because can have forward slash in args
Expand All @@ -72,7 +72,7 @@ CTS.translate<-function(server,from,to,id,progress=TRUE){ #arguably parallel, se

#asynchronous, need to debug
CTS.translate.async<-function(server,from,to,id,async.limit=100,...){
require("RCurl")

# results are returned as JSON encoded strings
# limit controls the maximum number of request per call to the server
id<-as.character(unlist(id))
Expand Down
12 changes: 6 additions & 6 deletions R/DB ID translation fxns.R → R/DB_ID_translation_fxns.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#convert KEGG id to chemical name
KEGGtoName<-function(id,all.values=FALSE,progress=TRUE){
library(KEGGREST)

#should vectorize
if(progress){pb = txtProgressBar(min = 0, max = length(id), style = 3)}
results<-do.call("rbind",lapply(1:length(id),function(i)
Expand Down Expand Up @@ -50,7 +50,7 @@ NametoKEGG<-function(name){

#CID to Name (Should make general PubChemtoName and sid support)
CIDtoName<-function(cid){
library(RCurl)

url<-paste0("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/",cid,"/synonyms/TXT")
content<-tryCatch(getURL(url, ssl.verifypeer = FALSE),error=function(e){character()})
res<-unlist(strsplit(content,"\n"))
Expand All @@ -63,7 +63,7 @@ CIDtoName<-function(cid){

#going from name to CID
NametoPubChem<-function(name,ID="cids", limit=FALSE){
library(RCurl)

url<-paste0("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/",gsub(" ","%20",name),"/",ID,"/TXT")
content<-tryCatch(getURL(url, ssl.verifypeer = FALSE),error=function(e){character()})
res<-unlist(strsplit(content,"\n"))
Expand Down Expand Up @@ -107,7 +107,7 @@ getIDEOM<-function(id,from,to,word.dist=0,agrep.dist=.15,progress=TRUE, DB = NUL
#avoid duplicates<
id<-make.unique(id)

library(vwr)

if(is.null(DB)){
DB<-IDEOMgetR()
}
Expand Down Expand Up @@ -157,8 +157,8 @@ getIDEOM<-function(id,from,to,word.dist=0,agrep.dist=.15,progress=TRUE, DB = NUL

#check synonym via chemify http://cts.fiehnlab.ucdavis.edu/chemify/rest
NametoInchI<-function(name,progress=TRUE){
library(RCurl)
library(RJSONIO)


url<-paste0("http://cts.fiehnlab.ucdavis.edu/chemify/rest/identify/",gsub("/","%2F",gsub(" ","%20",name)))
if(progress){;message(cat("Getting Keys from CTS \n"));pb = txtProgressBar(min = 0, max = length(url), style = 3)}
content<-lapply(1:length(url),function(i){
Expand Down
Loading