summaryrefslogtreecommitdiff
path: root/scripts/functional-groups-images.rb
blob: 346bd5f8e23eb0366273e242ed68a147ee5a386e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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