Class: RCDK::Util::Image

Inherits:
Object
  • Object
show all
Includes:
Net::Sf::Structure::Cdk::Util
Defined in:
lib/rcdk/util.rb

Overview

Raster and SVG 2-D molecular images.

Class Method Summary collapse

Class Method Details

.iupac_to_jpg(iupac_name, path_to_jpg, width, height) ⇒ Object

Writes a width by height JPG image to path_to_jpg using iupac_name. Coordinates are automatically assigned.



210
211
212
213
214
# File 'lib/rcdk/util.rb', line 210

def self.iupac_to_jpg(iupac_name, path_to_jpg, width, height)
  mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
  
  ImageKit.writeJPG(mol, width, height, path_to_jpg)
end

.iupac_to_png(iupac_name, path_to_png, width, height) ⇒ Object

Writes a width by height PNG image to path_to_png using iupac_name. Coordinates are automatically assigned.



192
193
194
195
196
# File 'lib/rcdk/util.rb', line 192

def self.iupac_to_png(iupac_name, path_to_png, width, height)
  mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
  
  ImageKit.writePNG(mol, width, height, path_to_png)
end

.iupac_to_svg(iupac_name, path_to_svg, width, height) ⇒ Object

Writes a width by height SVG document to path_to_svg using iupac_name. Coordinates are automatically assigned.



201
202
203
204
205
# File 'lib/rcdk/util.rb', line 201

def self.iupac_to_svg(iupac_name, path_to_svg, width, height)
  mol = XY.coordinate_molecule(Lang.read_iupac(iupac_name))
  
  ImageKit.writeSVG(mol, width, height, path_to_svg)
end

.molfile_to_jpg(molfile, path_to_jpg, width, height) ⇒ Object

Writes a width by height JPG image to path_to_jpg using molfile.



158
159
160
# File 'lib/rcdk/util.rb', line 158

def self.molfile_to_jpg(molfile, path_to_jpg, width, height)
  ImageKit.writeJPG(Lang.read_molfile(molfile), width, height, path_to_jpg)
end

.molfile_to_png(molfile, path_to_png, width, height) ⇒ Object

Writes a width by height PNG image to path_to_png using molfile.



146
147
148
# File 'lib/rcdk/util.rb', line 146

def self.molfile_to_png(molfile, path_to_png, width, height)
  ImageKit.writePNG(Lang.read_molfile(molfile), width, height, path_to_png)
end

.molfile_to_svg(molfile, path_to_svg, width, height) ⇒ Object

Writes a width by height SVG document to path_to_svg using molfile.



152
153
154
# File 'lib/rcdk/util.rb', line 152

def self.molfile_to_svg(molfile, path_to_svg, width, height)
  ImageKit.writeSVG(Lang.read_molfile(molfile), width, height, path_to_svg)
end

.smiles_to_jpg(smiles, path_to_jpg, width, height) ⇒ Object

Writes a width by height JPG image to path_to_jpg using smiles. Coordinates are automatically assigned.



183
184
185
186
187
# File 'lib/rcdk/util.rb', line 183

def self.smiles_to_jpg(smiles, path_to_jpg, width, height)
  mol = XY.coordinate_molecule(Lang.read_smiles(smiles))
  
  ImageKit.writeJPG(mol, width, height, path_to_jpg)
end

.smiles_to_png(smiles, path_to_png, width, height) ⇒ Object

Writes a width by height PNG image to path_to_png using smiles. Coordinates are automatically assigned.



165
166
167
168
169
# File 'lib/rcdk/util.rb', line 165

def self.smiles_to_png(smiles, path_to_png, width, height)
  mol = XY.coordinate_molecule(Lang.read_smiles(smiles))
  
  ImageKit.writePNG(mol, width, height, path_to_png)
end

.smiles_to_svg(smiles, path_to_svg, width, height) ⇒ Object

Writes a width by height SVG document to path_to_svg using smiles. Coordinates are automatically assigned.



174
175
176
177
178
# File 'lib/rcdk/util.rb', line 174

def self.smiles_to_svg(smiles, path_to_svg, width, height)
  mol = XY.coordinate_molecule(Lang.read_smiles(smiles))
  
  ImageKit.writeSVG(mol, width, height, path_to_svg)
end