From 35423518f2c620926cb7f8818fa3bea86190dea1 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 28 Jun 2018 11:59:22 +0000 Subject: allow ID column for uploads --- batch.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'batch.rb') 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} -- cgit v1.2.3