PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/rcdk/man/viewmol2d.Rd

http://github.com/rajarshi/cdkr
Unknown | 81 lines | 75 code | 6 blank | 0 comment | 0 complexity | 0200994f8934db42bf26500da21ddab4 MD5 | raw file
  1. \name{view.molecule.2d}
  2. \alias{view.molecule.2d}
  3. \alias{view.image.2d}
  4. \alias{copy.image.to.clipboard}
  5. \alias{depict}
  6. \title{
  7. View and Copy 2D Structure Diagrams
  8. }
  9. \description{
  10. The CDK is capable of generating 2D structure diagrams. These methods
  11. allow one to view 2D structure diagrams. Depending on the method called
  12. a Swing JFrame is displayed which allows resizing of the image or a
  13. raster image (derived from a PNG byte stream) is is returned, which can
  14. be viewed using \code{\link{rasterImage}}. It is also possible to copy
  15. a 2D depiction to the system clipboard, which can then be pasted into
  16. various external applications.
  17. }
  18. \usage{
  19. view.molecule.2d(molecule, ncol = 4, cellx = 200, celly = 200)
  20. view.image.2d(molecule, width = 200, height = 200)
  21. copy.image.to.clipboard(molecule, width = 200, height = 200)
  22. }
  23. \arguments{
  24. \item{molecule}{If a single molecule is to be viewed this should be a
  25. reference to a \code{IAtomContainer} object. If multiple molecules
  26. are to be viewed this should be a \code{list} of such objects. If a
  27. character is specified then it is taken as the name of a file and
  28. the molecules are loaded from the file}
  29. \item{ncol}{The number of columns if a grid is desired}
  30. \item{cellx}{The width of the grid cells}
  31. \item{celly}{The height of the grid cells}
  32. \item{width}{The width of the image}
  33. \item{height}{The height of the image}
  34. }
  35. \value{
  36. \code{view.molecule.2d} and \code{copy.image.to.ckipboard} do not return anything.
  37. \code{view.image.2d} returns
  38. an array of the dimensions height x width x channels, from the original
  39. PNG version of the 2D depiction.
  40. }
  41. \details{
  42. For the case of \code{view.molecule.2d}, if a \code{jobjRef} is passed it should be a reference to an
  43. \code{IAtomContainer} object. In case the first argument is of class
  44. character it is assumed to be a file and is loaded by the function.
  45. This function can be used to view a single molecule or multiple
  46. molecules. If a \code{list} of molecule objects is supplied the
  47. molecules are displayed as a grid of 2D viewers. In case a file is
  48. specified, it will display a single molecule or multiple molecules
  49. depending on how many molecules are loaded.
  50. For \code{view.image.2d}, the image can be viewed via \code{\link{rasterImage}}.
  51. \code{copy.image.to.clipboard} copies the 2D depiction to the system clipboard in
  52. PNG format. You can then paste into other applications.
  53. Due to event handling issues, the depiction will show on OS X, but
  54. the window will be unresponsive. Also copying images to the clipboard will not work.
  55. As a result, on OS X we make use of a standalone
  56. helper that is run via the \code{system} command. Currently, this is supported
  57. for the \code{view.molecule.2d} method (for a single molecule) and the
  58. \code{copy.image.to.clipboard} method. In the future, other view methods will also
  59. be accessible via this mechanism. While this allows OS X users to view molecules, it is
  60. slow due to invoking a new process.
  61. The depictions will work fine (i.e., no need to shell out) on Linux and Windows.
  62. }
  63. \examples{
  64. m <- parse.smiles('c1ccccc1C(=O)NC')[[1]]
  65. \dontrun{
  66. img <- view.image.2d(m, 100,100)
  67. plot(1:10, 1:10, pch=19)
  68. rasterImage(img, 0,8, 2,10)
  69. }
  70. }
  71. \seealso{
  72. \code{\link{view.table}}, \code{\link{rasterImage}}, \code{link{readPNG}}
  73. }
  74. \keyword{programming}
  75. \author{Rajarshi Guha (\email{rajarshi.guha@gmail.com})}