diff options
author | gebele <gebele@in-silico.ch> | 2018-07-25 15:16:27 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2018-07-25 15:16:27 +0000 |
commit | c26965b89c307f9370ca5a3cf75646aad76dba3b (patch) | |
tree | 99f791ec1269beacedfad68068d4a0d341cf474d /batch.rb | |
parent | c93afb84a46af1500679cc5b314b0aeffcd7e6e9 (diff) |
handle original ids in batch object;
Diffstat (limited to 'batch.rb')
-rw-r--r-- | batch.rb | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -29,9 +29,8 @@ module OpenTox # original IDs if table[0][0] =~ /ID/i - ids = table.collect{|row| row.shift} - ids.shift - batch.ids = ids + @original_ids = table.collect{|row| row.shift} + @original_ids.shift end # features @@ -60,8 +59,7 @@ module OpenTox end table.each_with_index do |vals,i| - identifier = vals.shift.strip - batch.identifiers << identifier + identifier = vals.shift.strip.gsub(/^'|'$/,"") begin case compound_format when /SMILES/i @@ -72,13 +70,17 @@ module OpenTox rescue compound = nil end - if compound.nil? # compound parsers may return nil + # collect only for present compounds + unless compound.nil? + batch.identifiers << identifier + batch.compounds << compound.id + batch.ids << @original_ids[i] if @original_ids + else batch.warnings << "Cannot parse #{compound_format} compound '#{identifier}' at line #{i+2} of #{source}." - next end - batch.compounds << compound.id end batch.compounds.duplicates.each do |duplicate| + $logger.debug "Duplicates found in #{name}." dup = Compound.find duplicate positions = [] batch.compounds.each_with_index do |co,i| |