nimbus 0.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
 
@@ -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 if @config.do_training && @config.load_training_data
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
- # Provide exception handling for the given block.
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 the error message that caused the exception.
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}"
@@ -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
@@ -40,7 +40,7 @@ module Nimbus
40
40
  end
41
41
 
42
42
  def bag
43
- @bag ||= (1..@options.training_set.individuals.size).to_a
43
+ @bag ||= @options.training_set.all_ids
44
44
  end
45
45
 
46
46
  def acumulate_predictions(preds)
@@ -7,6 +7,11 @@ module Nimbus
7
7
  @individuals = individuals
8
8
  @ids_fenotypes = ids_fenotypes
9
9
  end
10
+
11
+ def all_ids
12
+ @all_ids ||= @ids_fenotypes.keys
13
+ @all_ids
14
+ end
10
15
  end
11
16
 
12
17
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nimbus
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.3"
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-19 00:00:00 Z
14
+ date: 2011-08-20 00:00:00 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec