Mercurial > repos > prog > lcmsmatching
comparison EnzymeConn.R @ 1:253d531a0193 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit 36c9d8099c20a1ae848f1337c16564335dd8fb2b
| author | prog |
|---|---|
| date | Sat, 03 Sep 2016 17:02:01 -0400 |
| parents | e66bb061af06 |
| children | 20d69a062da3 |
comparison
equal
deleted
inserted
replaced
| 0:e66bb061af06 | 1:253d531a0193 |
|---|---|
| 1 if ( ! exists('EnzymeConn')) { # Do not load again if already loaded | 1 if ( ! exists('EnzymeConn')) { # Do not load again if already loaded |
| 2 | 2 |
| 3 source('BiodbConn.R') | 3 source('RemotedbConn.R') |
| 4 source('EnzymeCompound.R') | 4 source('EnzymeCompound.R') |
| 5 | 5 |
| 6 ##################### | 6 ##################### |
| 7 # CLASS DECLARATION # | 7 # CLASS DECLARATION # |
| 8 ##################### | 8 ##################### |
| 9 | 9 |
| 10 EnzymeConn <- setRefClass("EnzymeConn", contains = "BiodbConn") | 10 EnzymeConn <- setRefClass("EnzymeConn", contains = "RemotedbConn") |
| 11 | 11 |
| 12 ########################## | 12 ########################## |
| 13 # GET ENTRY CONTENT TYPE # | 13 # GET ENTRY CONTENT TYPE # |
| 14 ########################## | 14 ########################## |
| 15 | 15 |
| 16 EnzymeConn$methods( getEntryContentType = function(type) { | 16 EnzymeConn$methods( getEntryContentType = function(type) { |
| 17 return(RBIODB.TXT) | 17 return(BIODB.TXT) |
| 18 }) | 18 }) |
| 19 | 19 |
| 20 ##################### | 20 ##################### |
| 21 # GET ENTRY CONTENT # | 21 # GET ENTRY CONTENT # |
| 22 ##################### | 22 ##################### |
| 23 | 23 |
| 24 EnzymeConn$methods( getEntryContent = function(type, id) { | 24 EnzymeConn$methods( getEntryContent = function(type, id) { |
| 25 | 25 |
| 26 if (type == RBIODB.COMPOUND) { | 26 if (type == BIODB.COMPOUND) { |
| 27 | 27 |
| 28 # Initialize return values | 28 # Initialize return values |
| 29 content <- rep(NA_character_, length(id)) | 29 content <- rep(NA_character_, length(id)) |
| 30 | 30 |
| 31 # Request | 31 # Request |
| 32 content <- vapply(id, function(x) .self$.scheduler$getUrl(get.entry.url(RBIODB.ENZYME, accession = x, content.type = RBIODB.TXT)), FUN.VALUE = '') | 32 content <- vapply(id, function(x) .self$.scheduler$getUrl(get.entry.url(BIODB.ENZYME, accession = x, content.type = BIODB.TXT)), FUN.VALUE = '') |
| 33 | 33 |
| 34 return(content) | 34 return(content) |
| 35 } | 35 } |
| 36 | 36 |
| 37 return(NULL) | 37 return(NULL) |
| 40 ################ | 40 ################ |
| 41 # CREATE ENTRY # | 41 # CREATE ENTRY # |
| 42 ################ | 42 ################ |
| 43 | 43 |
| 44 EnzymeConn$methods( createEntry = function(type, content, drop = TRUE) { | 44 EnzymeConn$methods( createEntry = function(type, content, drop = TRUE) { |
| 45 return(if (type == RBIODB.COMPOUND) createEnzymeCompoundFromTxt(content, drop = drop) else NULL) | 45 return(if (type == BIODB.COMPOUND) createEnzymeCompoundFromTxt(content, drop = drop) else NULL) |
| 46 }) | 46 }) |
| 47 } | 47 } |
