|
a |
|
b/R/package.R |
|
|
1 |
#' deepG for GenomeNet |
|
|
2 |
#' |
|
|
3 |
#' deepG is an open source software library for building deep neural |
|
|
4 |
#' networks for genomic modeling. |
|
|
5 |
#' |
|
|
6 |
#' This package generates \href{https://deepg.de}{deepG} |
|
|
7 |
#' |
|
|
8 |
#' For additional documentation on the deepG package see |
|
|
9 |
#' \href{https://genomenet.de}{https://genomenet.de} |
|
|
10 |
#' |
|
|
11 |
#' |
|
|
12 |
"_PACKAGE" |
|
|
13 |
|
|
|
14 |
# globals |
|
|
15 |
.globals <- new.env(parent = emptyenv()) |
|
|
16 |
|
|
|
17 |
.onLoad <- function(libname, pkgname) { |
|
|
18 |
|
|
|
19 |
# Minimal HDF5 operation to prevent errors from hdf5r package |
|
|
20 |
temp_file <- tempfile(fileext = ".h5") |
|
|
21 |
h5_file <- hdf5r::H5File$new(temp_file, mode = "w") |
|
|
22 |
h5_file$close_all() |
|
|
23 |
file.remove(temp_file) |
|
|
24 |
|
|
|
25 |
Sys.setenv(TF_CPP_MIN_LOG_LEVEL = 3) |
|
|
26 |
|
|
|
27 |
return(NULL) |
|
|
28 |
|
|
|
29 |
} |
|
|
30 |
|
|
|
31 |
# # Define a package-specific environment |
|
|
32 |
# deepG_env <- new.env(parent = emptyenv()) |
|
|
33 |
# |
|
|
34 |
# check_tensorflow <- function() { |
|
|
35 |
# # Check if TensorFlow availability has already been stored in the package environment |
|
|
36 |
# if (!exists(".tensorflow_checked", envir = deepG_env)) { |
|
|
37 |
# deepG_env$.tensorflow_checked <- reticulate::py_module_available("tensorflow") |
|
|
38 |
# } |
|
|
39 |
# return(deepG_env$.tensorflow_checked) |
|
|
40 |
# } |
|
|
41 |
|
|
|
42 |
.onAttach <- function(libname, pkgname) { |
|
|
43 |
|
|
|
44 |
#tf_available <- reticulate::py_module_available("tensorflow") |
|
|
45 |
|
|
|
46 |
# if (!.globals$tf_available) { |
|
|
47 |
# packageStartupMessage("TensorFlow is not available. Some examples will be skipped.") |
|
|
48 |
# } |
|
|
49 |
} |
|
|
50 |
|