comparison KeggConn.R @ 1:45e985cd8e9e draft

planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8-dirty
author prog
date Tue, 31 Jan 2017 05:27:24 -0500
parents 3afe41d3e9e7
children
comparison
equal deleted inserted replaced
0:3afe41d3e9e7 1:45e985cd8e9e
1 if ( ! exists('KeggConn')) { # Do not load again if already loaded 1 #####################
2 # CLASS DECLARATION #
3 #####################
2 4
3 source('BiodbConn.R') 5 KeggConn <- methods::setRefClass("KeggConn", contains = "RemotedbConn")
4 source('KeggCompound.R')
5
6 #####################
7 # CLASS DECLARATION #
8 #####################
9
10 KeggConn <- setRefClass("KeggConn", contains = "BiodbConn")
11 6
12 ########################## 7 ##########################
13 # GET ENTRY CONTENT TYPE # 8 # GET ENTRY CONTENT TYPE #
14 ########################## 9 ##########################
15 10
16 KeggConn$methods( getEntryContentType = function(type) { 11 KeggConn$methods( getEntryContentType = function() {
17 return(RBIODB.TXT) 12 return(BIODB.TXT)
18 }) 13 })
19 14
20 ##################### 15 #####################
21 # GET ENTRY CONTENT # 16 # GET ENTRY CONTENT #
22 ##################### 17 #####################
23 18
24 KeggConn$methods( getEntryContent = function(type, id) { 19 KeggConn$methods( getEntryContent = function(id) {
25 20
26 if (type == RBIODB.COMPOUND) { 21 # Initialize return values
22 content <- rep(NA_character_, length(id))
27 23
28 # Initialize return values 24 # Request
29 content <- rep(NA_character_, length(id)) 25 content <- vapply(id, function(x) .self$.get.url(get.entry.url(BIODB.KEGG, x, content.type = BIODB.TXT)), FUN.VALUE = '')
30 26
31 # Request 27 return(content)
32 content <- vapply(id, function(x) .self$.scheduler$getUrl(get.entry.url(RBIODB.KEGG, x, content.type = RBIODB.TXT)), FUN.VALUE = '') 28 })
33 29
34 return(content) 30 ################
35 } 31 # CREATE ENTRY #
32 ################
36 33
37 return(NULL) 34 KeggConn$methods( createEntry = function(content, drop = TRUE) {
38 }) 35 return(createKeggEntryFromTxt(content, drop = drop))
39 36 })
40 ################
41 # CREATE ENTRY #
42 ################
43
44 KeggConn$methods( createEntry = function(type, content, drop = TRUE) {
45 return(if (type == RBIODB.COMPOUND) createKeggCompoundFromTxt(content, drop = drop) else NULL)
46 })
47
48 } # end of load safe guard