nimbus 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nimbus.rb +8 -8
- data/lib/nimbus/application.rb +3 -3
- data/lib/nimbus/configuration.rb +3 -1
- data/lib/nimbus/forest.rb +1 -1
- data/lib/nimbus/training_set.rb +5 -0
- metadata +2 -2
data/lib/nimbus.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'optparse'
|
3
|
-
require 'nimbus/exceptions'
|
4
|
-
require 'nimbus/training_set'
|
5
|
-
require 'nimbus/configuration'
|
6
|
-
require 'nimbus/loss_functions'
|
7
|
-
require 'nimbus/individual'
|
8
|
-
require 'nimbus/tree'
|
9
|
-
require 'nimbus/forest'
|
10
|
-
require 'nimbus/application'
|
3
|
+
require './lib/nimbus/exceptions'
|
4
|
+
require './lib/nimbus/training_set'
|
5
|
+
require './lib/nimbus/configuration'
|
6
|
+
require './lib/nimbus/loss_functions'
|
7
|
+
require './lib/nimbus/individual'
|
8
|
+
require './lib/nimbus/tree'
|
9
|
+
require './lib/nimbus/forest'
|
10
|
+
require './lib/nimbus/application'
|
11
11
|
|
12
12
|
module Nimbus
|
13
13
|
|
data/lib/nimbus/application.rb
CHANGED
@@ -25,7 +25,7 @@ module Nimbus
|
|
25
25
|
nimbus_exception_handling do
|
26
26
|
if @config.do_training && @config.load_training_data
|
27
27
|
forest = ::Nimbus::Forest.new @config
|
28
|
-
forest.grow
|
28
|
+
forest.grow
|
29
29
|
output_random_forest_file(forest)
|
30
30
|
output_training_file_predictions(forest)
|
31
31
|
end
|
@@ -37,7 +37,7 @@ module Nimbus
|
|
37
37
|
@config ||= ::Nimbus::Configuration.new
|
38
38
|
end
|
39
39
|
|
40
|
-
#
|
40
|
+
# Provides the default exception handling for the given block.
|
41
41
|
def nimbus_exception_handling
|
42
42
|
begin
|
43
43
|
yield
|
@@ -55,7 +55,7 @@ module Nimbus
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
# Display
|
58
|
+
# Display an error message that caused a exception.
|
59
59
|
def display_error_message(ex)
|
60
60
|
Nimbus.error_message "* Nimbus encountered an error! The random forest was not generated *"
|
61
61
|
Nimbus.error_message "#{ex.class}: #{ex.message}"
|
data/lib/nimbus/configuration.rb
CHANGED
@@ -98,7 +98,7 @@ module Nimbus
|
|
98
98
|
@tree_max_branches = user_config_params['forest']['max_branches'].to_i if user_config_params['forest']['max_branches']
|
99
99
|
@tree_node_min_size = user_config_params['forest']['node_min_size'].to_i if user_config_params['forest']['node_min_size']
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
check_configuration
|
103
103
|
log_configuration
|
104
104
|
end
|
@@ -110,6 +110,8 @@ module Nimbus
|
|
110
110
|
next if line.strip == ''
|
111
111
|
data_feno, data_id, *snp_list = line.strip.split
|
112
112
|
raise Nimbus::InputFileError, "Individual ##{data_id} from training set has no value for all #{@tree_SNP_total_count} SNPs" unless snp_list.size == @tree_SNP_total_count
|
113
|
+
raise Nimbus::InputFileError, "There are individuals with no ID, please check data in training file." unless (!data_id.nil? && data_id.strip != '')
|
114
|
+
raise Nimbus::InputFileError, "Individual ##{data_id} has no fenotype value, please check data in training file." unless (!data_feno.nil? && data_feno.strip != '')
|
113
115
|
@training_set.individuals[data_id.to_i] = Nimbus::Individual.new(data_id.to_i, data_feno.to_f, snp_list.map{|snp| snp.to_i})
|
114
116
|
@training_set.ids_fenotypes[data_id.to_i] = data_feno.to_f
|
115
117
|
end
|
data/lib/nimbus/forest.rb
CHANGED
data/lib/nimbus/training_set.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: nimbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "0.
|
5
|
+
version: "0.4"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Juanjo Baz\xC3\xA1n"
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-08-
|
14
|
+
date: 2011-08-20 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|