summaryrefslogtreecommitdiff
path: root/batch.rb
diff options
context:
space:
mode:
Diffstat (limited to 'batch.rb')
-rw-r--r--batch.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/batch.rb b/batch.rb
index 0002279..2f99000 100644
--- a/batch.rb
+++ b/batch.rb
@@ -12,6 +12,7 @@ module OpenTox
field :name, type: String
field :source, type: String
field :identifiers, type: Array
+ field :ids, type: Array
field :compounds, type: Array
field :warnings, type: Array, default: []
@@ -24,7 +25,14 @@ module OpenTox
else
$logger.debug "Parsing #{file}."
table = CSV.read file, :skip_blanks => true, :encoding => 'windows-1251:utf-8'
- batch = self.new(:source => source, :name => name, :identifiers => [], :compounds => [])
+ batch = self.new(:source => source, :name => name, :identifiers => [], :ids => [], :compounds => [])
+
+ # original IDs
+ if table[0][0] =~ /ID/i
+ ids = table.collect{|row| row.shift}
+ ids.shift
+ batch.ids = ids
+ end
# features
feature_names = table.shift.collect{|f| f.strip}