Learn R Programming

rcdk (version 2.9.21)

view.molecule.2d: View 2D Structure Diagrams

Description

The CDK is capable of generating 2D structure diagrams. These methods allow one to view 2D structure diagrams. Depending on the method called a Swing JFrame is displayed which allows resizing of the image or a raster image (derived from a PNG bytestream) is is returned, which can be viewed using rasterImage

Usage

view.molecule.2d(molecule, ncol = 4, cellx = 200, celly = 200)
view.image.2d(molecule, width = 200, height = 200)

Arguments

molecule
If a single molecule is to be viewed this should be a reference to a IAtomContainer object. If multiple molecules are to be viewed this should be a list of such objects. If a character is specified then it is taken as
ncol
The number of columns if a grid is desired
cellx
The width of the grid cells
celly
The height of the grid cells
width
The width of the image
height
The height of the image

Value

  • view.molecule.2d does not return anything. view.image.2d returns an array of the dimensions height x width x channels, from the original PNG version of the 2D depiction.

Details

For the case of view.molecule.2d, if a jobjRef is passed it should be a reference to an IAtomContainer object. In case the first argument is of class character it is assumed to be a file and is loaded by the function. This function can be used to view a single molecule or multiple molecules. If a list of molecule objects is supplied the molecules are displayed as a grid of 2D viewers. In case a file is specified, it will display a single molecule or multiple molecules depending on how many molecules are loaded.

For view.image.2d, the image can be viewed via rasterImage.

Due to event handling issues, the depiction will show on OS X, but the window will be unresponsive. The depictions will work fine on Linux and Windows.

See Also

view.table, rasterImage, link{readPNG}

Examples

Run this code
m <- parse.smiles('c1ccccc1C(=O)NC')
img <- view.image.2d(m, 100,100)
plot(1:10, 1:10, pch=19)
rasterImage(img, 0,8, 2,10)

Run the code above in your browser using DataLab