summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2014-10-10 12:33:25 +0200
committermguetlein <martin.guetlein@gmail.com>2014-10-10 12:33:25 +0200
commit30e213383d432536c252dd237cdeab96973411e6 (patch)
tree858214f37562ccd62efb02380fbc1e73ce62dcf3
parentcbea6288f1fb52fc57aad8119884345a55b6e222 (diff)
fix inchi csv upload
-rw-r--r--helper.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/helper.rb b/helper.rb
index b479280..4648c46 100644
--- a/helper.rb
+++ b/helper.rb
@@ -113,25 +113,24 @@ module OpenTox
when /SMILES/i
c = OpenTox::Compound.from_smiles(compound)
if c.inchi.empty?
- @warnings << "Cannot parse compound '#{compound}' at position #{j+2}, all entries are ignored."
+ @warnings << "Cannot parse #{compound_format} compound '#{compound}' at position #{j+2}, all entries are ignored."
next
else
compound_uri = c.uri
end
when /InChI/i
- compound = OpenTox::Compound.from_inchi(compound)
+ c = OpenTox::Compound.from_inchi(compound)
if c.inchi.empty?
- @warnings << "Cannot parse compound '#{compound}' at position #{j+2}, all entries are ignored."
+ @warnings << "Cannot parse #{compound_format} compound '#{compound}' at position #{j+2}, all entries are ignored."
next
else
compound_uri = c.uri
end
- when ""
- @warnings << "Cannot parse compound '#{compound}' at position #{j+2}, all entries are ignored." # be careful with double quotes in literals! \C in smiles is an illegal Turtle string
- next
+ else
+ raise "wrong compound format" #should be checked above
end
rescue
- @warnings << "Cannot parse compound '#{compound}' at position #{j+2}, all entries are ignored." # be careful with double quotes in literals! \C in smiles is an illegal Turtle string
+ @warnings << "Cannot parse #{compound_format} compound '#{compound}' at position #{j+2}, all entries are ignored." # be careful with double quotes in literals! \C in smiles is an illegal Turtle string
next
end