diff options
author | gebele <gebele@in-silico.ch> | 2018-04-23 10:58:39 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2018-04-23 10:58:39 +0000 |
commit | de849d5b6cc553cc6969dd6b9b486b808ac89f3d (patch) | |
tree | 85010b2683179df101cd643318978924fb41a937 /batch.rb | |
parent | 19eb655f4af1a4631692989a30a59b7b78e6669b (diff) |
batch download with extra duplicate on ID message column
Diffstat (limited to 'batch.rb')
-rw-r--r-- | batch.rb | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -65,12 +65,22 @@ module OpenTox compound = nil end if compound.nil? # compound parsers may return nil - #warn "Cannot parse #{compound_format} compound '#{identifier}' at line #{i+2} of #{source}, all entries are ignored." - batch.compounds << "Cannot parse #{compound_format} compound '#{identifier}' at line #{i+2} of #{source}." + 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| + dup = Compound.find duplicate + positions = [] + batch.compounds.each_with_index do |co,i| + c = Compound.find co + if !c.blank? and c.inchi and c.inchi == dup.inchi + positions << i+1 + end + end + batch.warnings << "Duplicate compound at ID #{positions.join(' and ')}." + end batch.save end batch |