Mercurial > repos > prog > lcmsmatching
comparison NcbigeneConn.R @ 2:20d69a062da3 draft
planemo upload for repository https://github.com/workflow4metabolomics/lcmsmatching.git commit d4048accde6bdfd5b3e14f5394902d38991854f8
author | prog |
---|---|
date | Thu, 02 Mar 2017 08:55:00 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:253d531a0193 | 2:20d69a062da3 |
---|---|
1 ##################### | |
2 # CLASS DECLARATION # | |
3 ##################### | |
4 | |
5 NcbigeneConn <- methods::setRefClass("NcbigeneConn", contains = "RemotedbConn") | |
6 | |
7 ############### | |
8 # CONSTRUCTOR # | |
9 ############### | |
10 | |
11 NcbigeneConn$methods( initialize = function(...) { | |
12 # From NCBI E-Utility manual: "In order not to overload the E-utility servers, NCBI recommends that users post no more than three URL requests per second and limit large jobs to either weekends or between 9:00 PM and 5:00 AM Eastern time during weekdays". | |
13 callSuper(scheduler = UrlRequestScheduler$new(n = 3), ...) | |
14 }) | |
15 | |
16 ########################## | |
17 # GET ENTRY CONTENT TYPE # | |
18 ########################## | |
19 | |
20 NcbigeneConn$methods( getEntryContentType = function() { | |
21 return(BIODB.XML) | |
22 }) | |
23 | |
24 ##################### | |
25 # GET ENTRY CONTENT # | |
26 ##################### | |
27 | |
28 NcbigeneConn$methods( getEntryContent = function(id) { | |
29 | |
30 # Initialize return values | |
31 content <- rep(NA_character_, length(id)) | |
32 | |
33 # Request | |
34 content <- vapply(id, function(x) .self$.get.url(get.entry.url(BIODB.NCBIGENE, x, content.type = BIODB.XML)), FUN.VALUE = '') | |
35 | |
36 return(content) | |
37 }) | |
38 | |
39 ################ | |
40 # CREATE ENTRY # | |
41 ################ | |
42 | |
43 NcbigeneConn$methods( createEntry = function(content, drop = TRUE) { | |
44 return(createNcbigeneEntryFromXml(content, drop = drop)) | |
45 }) |