diff options
-rw-r--r-- | ext/lazar/Makefile | 5 | ||||
-rw-r--r-- | ext/lazar/extconf.rb | 32 | ||||
-rw-r--r-- | ext/lazar/rinstall.R | 12 | ||||
-rw-r--r-- | lazar.gemspec | 1 | ||||
-rw-r--r-- | lib/lazar.rb | 7 | ||||
-rw-r--r-- | test/Rpackages.rb | 1 |
6 files changed, 1 insertions, 57 deletions
diff --git a/ext/lazar/Makefile b/ext/lazar/Makefile deleted file mode 100644 index 1d51914..0000000 --- a/ext/lazar/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - true - -install: - true diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb deleted file mode 100644 index 9997106..0000000 --- a/ext/lazar/extconf.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'fileutils' -require 'rbconfig' -require 'mkmf' - -main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..","..")) - -# check for required programs -programs = ["R","Rscript","mongod","java","getconf"] -programs.each do |program| - abort "Please install #{program} on your system." unless find_executable program -end - -abort "Please install Rserve on your system. Execute 'install.packages('Rserve')' in a R console running as root ('sudo R')." unless `R CMD Rserve --version`.match(/^Rserve/) - -# install R packages -r_dir = File.join main_dir, "R" -FileUtils.mkdir_p r_dir -#FileUtils.mkdir_p File.join(main_dir,"bin") # for Rserve binary -rinstall = File.expand_path(File.join(File.dirname(__FILE__),"rinstall.R")) -puts `Rscript --vanilla #{rinstall} #{r_dir}` - -r_libs = Dir[File.join(r_dir,"*")].collect{|l| l.sub(r_dir, '').sub('/','')}.sort -["caret","doMC","foreach","ggplot2","gridExtra","iterators","pls"].each do |lib| - abort "Failed to install R package '#{lib}'." unless r_libs.include?(lib) -end - -# create a fake Makefile -File.open(File.join(File.dirname(__FILE__),"Makefile"),"w+") do |makefile| - makefile.puts "all:\n\ttrue\n\ninstall:\n\ttrue\n" -end - -$makefile_created = true diff --git a/ext/lazar/rinstall.R b/ext/lazar/rinstall.R deleted file mode 100644 index 98e612d..0000000 --- a/ext/lazar/rinstall.R +++ /dev/null @@ -1,12 +0,0 @@ -libdir = commandArgs(trailingOnly=TRUE)[1] -repo = "https://stat.ethz.ch/CRAN/" -#install.packages("Rserve",lib=libdir,repos=repo,dependencies=TRUE) -install.packages("stringi",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("iterators",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("foreach",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("gridExtra",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("ggplot2",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("pls",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("randomForest",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("caret",lib=libdir,repos=repo,dependencies=TRUE); -install.packages("doMC",lib=libdir,repos=repo,dependencies=TRUE); diff --git a/lazar.gemspec b/lazar.gemspec index 3c704c8..a4929fa 100644 --- a/lazar.gemspec +++ b/lazar.gemspec @@ -14,7 +14,6 @@ Gem::Specification.new do |s| s.rubyforge_project = "lazar" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.extensions = %w[ext/lazar/extconf.rb] s.require_paths = ["lib"] # specify any dependencies here; for example: diff --git a/lib/lazar.rb b/lib/lazar.rb index 32f0317..1f909b7 100644 --- a/lib/lazar.rb +++ b/lib/lazar.rb @@ -19,7 +19,7 @@ ENV["MONGOID_ENV"] = ENV["LAZAR_ENV"] ENV["RACK_ENV"] = ENV["LAZAR_ENV"] # should set sinatra environment # search for a central mongo database in use # http://opentox.github.io/installation/2017/03/07/use-central-mongodb-in-docker-environment -CENTRAL_MONGO_IP = `grep -oP '^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(?=.*mongodb)' /etc/hosts`.chomp +CENTRAL_MONGO_IP = "mongodb" Mongoid.load_configuration({ :clients => { :default => { @@ -46,9 +46,6 @@ end # R setup rlib = File.expand_path(File.join(File.dirname(__FILE__),"..","R")) -# should work on POSIX including os x -# http://stackoverflow.com/questions/19619582/number-of-processors-cores-in-command-line -NR_CORES = `getconf _NPROCESSORS_ONLN`.to_i R = Rserve::Connection.new R.eval ".libPaths('#{rlib}')" R.eval " @@ -64,10 +61,8 @@ suppressPackageStartupMessages({ library(doMC,lib=\"#{rlib}\") library(randomForest,lib=\"#{rlib}\") library(plyr,lib=\"#{rlib}\") - registerDoMC(#{NR_CORES}) }) " - # OpenTox classes and includes CLASSES = ["Feature","Substance","Dataset","LazarPrediction","CrossValidation","LeaveOneOutValidation","RepeatedCrossValidation","Experiment"]# Algorithm and Models are modules diff --git a/test/Rpackages.rb b/test/Rpackages.rb index d197dd6..b9f9294 100644 --- a/test/Rpackages.rb +++ b/test/Rpackages.rb @@ -11,4 +11,3 @@ class LazarRpackagesTest < MiniTest::Test end end - |