-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoptions.R
50 lines (37 loc) · 1.07 KB
/
options.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#' @name options-KINOMO
NULL
.OPTIONS <- setupPackageOptions(
# default algorithm
default.algorithm='brunet'
# default seeding method
, default.seed='random'
# track error during KINOMO updates
, error.track = option_symlink('track') # for backward compatibility
, track=FALSE
# define the tracking interval
, track.interval=30
# define garbage collection interval
, gc=50
# define default parallel backend
, parallel.backend= option_symlink('pbackend') # for backward compatibility
, pbackend= if( parallel::detectCores() > 1 ) 'par' else 'seq'
# toogle verbosity
, verbose=FALSE
# toogle debug mode
, debug=FALSE
, RESET=TRUE)
#'
KINOMO.options <- .OPTIONS$options
KINOMO.getOption <- .OPTIONS$getOption
KINOMO.resetOptions <- .OPTIONS$resetOptions
KINOMO.printOptions <- .OPTIONS$printOptions
# debugging utility
KINOMO.debug <- function(fun, ...){
if( KINOMO.getOption('debug') ){
call.stack <- sys.calls()
n <- length(call.stack)
if( is.null(fun) ) fun <- as.character(call.stack[[n-1]])
message('DEBUG::', fun, ' -> ', ...)
}
return(invisible())
}