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
51
|
require 'rubygems'
require "bundler/setup"
require "rest-client"
require 'yaml'
require 'json'
require 'logger'
require 'mongoid'
# TODO store development/test, validation, production in separate databases
ENV["MONGOID_ENV"] = "development"
Mongoid.load!("#{ENV['HOME']}/.opentox/config/mongoid.yml")
CLASSES = ["Compound", "Feature", "DataEntry","Dataset"]#, "Validation", "Task", "Investigation"]
#CLASSES = ["Feature", "Dataset", "Validation", "Task", "Investigation"]
# Regular expressions for parsing classification data
TRUE_REGEXP = /^(true|active|1|1.0|tox|activating|carcinogen|mutagenic)$/i
FALSE_REGEXP = /^(false|inactive|0|0.0|low tox|deactivating|non-carcinogen|non-mutagenic)$/i
[
"overwrite.rb",
"rest-client-wrapper.rb",
"error.rb",
#"authorization.rb",
#"policy.rb",
#"otlogger.rb",
"opentox.rb",
#"task.rb",
"compound.rb",
"feature.rb",
#"data_entry.rb",
"dataset.rb",
#"algorithm.rb",
#"model.rb",
"validation.rb"
].each{ |f| require_relative f }
#if defined?($aa) and $aa[:uri]
# OpenTox::Authorization.authenticate($aa[:user],$aa[:password])
# unauthorized_error "Failed to authenticate user \"#{$aa[:user]}\"." unless OpenTox::Authorization.is_token_valid(OpenTox::RestClientWrapper.subjectid)
#end
# defaults to stderr, may be changed to file output (e.g in opentox-service)
$logger = Logger.new STDOUT #OTLogger.new(STDOUT) # STDERR did not work on my development machine (CH)
$logger.level = Logger::DEBUG
#Mongo::Logger.logger = $logger
Mongo::Logger.level = Logger::WARN
$mongo = Mongo::Client.new('mongodb://127.0.0.1:27017/opentox')
$gridfs = $mongo.database.fs
Mongoid.logger.level = Logger::WARN
Mongoid.logger = $logger
|