summaryrefslogtreecommitdiff
path: root/scripts/functional-groups-images.rb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/functional-groups-images.rb')
-rwxr-xr-xscripts/functional-groups-images.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/functional-groups-images.rb b/scripts/functional-groups-images.rb
new file mode 100755
index 0000000..346bd5f
--- /dev/null
+++ b/scripts/functional-groups-images.rb
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+# www.smartsview.de/smartsview/auto/<image-format>/<visualization-modus>/<legend-option>/<SMARTS>
+# syntax rules
+# image-format: pdf, png or svg
+# visualization modus: 1 or 2 (1 = Complete Visualization, 2 = Element Symbols)
+# legend option: both, none, static, dynamic
+# SMARTS: All special symbols used in SMARTS can be used except '#', which has to be escaped with %23
+
+require 'uri'
+SERVICE_URI = "http://www.smartsview.de/smartsview/auto/pdf/2/both/"
+
+
+inFile = File.join("data","functional-groups-smarts.csv")
+hash = {}
+File.readlines(inFile).each do |line|
+ columns = line.split(",",2)
+ group = columns[0].strip
+ smarts = columns[1].sub(/^'|'$/,"").strip.sub(/^'|'$/,"").strip
+ hash[group] = smarts
+end
+
+hash.each do |group,smarts|
+ `wget '#{URI.escape(SERVICE_URI+smarts)}' -O "#{File.join("figures",group+'.pdf')}"`
+end
+
+