comparison UniProtConn.R @ 0:3afe41d3e9e7 draft

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