-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathregistry.R
37 lines (25 loc) · 1.13 KB
/
registry.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#' @import pkgmaker
#' @import registry
KINOMORegistry <- function(...) pkgmaker::packageRegistry(...)
# Returns the names of all the packages that contibute to all or a given
# package's primary registry
registryContributors <- function(package, regname = NULL){
regs <- packageRegistries(regname = regname, package = package, primary = TRUE)
if( length(regs) ) unique(names(unlist(lapply(paste0(package, '::', regs), packageRegistries))))
}
KINOMOGet <- function(regname, name=NULL, ...){
# retrieve from the given package's sub-registry
pkgmaker::pkgreg_fetch(regname, key=name, ...)
}
###%
setGeneric('KINOMORegister', function(key, method, ...) standardGeneric('KINOMORegister') )
setMethod('KINOMORegister', signature(key='character'),
function(key, method, regname, ...){
#TODO: add functionality to save the registered strategy into a file for use is other R sessions
parent.method <- attr(method, 'parent')
tmpl <- if( !is.null(parent.method) && parent.method != key ){
str_c(" based on template '", parent.method, "'")
}
setPackageRegistryEntry(regname, key, method, ..., where='KINOMO', msg=tmpl)
}
)