CDK-R / cdkr

Integrating R and the CDK
https://cdk-r.github.io/cdkr/
42 stars 27 forks source link

Unable to use view.molecule.2d and view.image.rd #58

Closed iutomo closed 6 years ago

iutomo commented 6 years ago

I've been struggling to view the 2d structure of any molecule. I tried with R version 3.3.1, version 3.3.2 and R version 3.4.2

Latest sessionInfo(): R version 3.4.2 (2017-09-28), png_0.1-7 , fingerprint_3.5.6, rcdk_3.4.3, rcdklibs_2.0, rJava_0.9-9 root@eb2bc2d30d3d:/# javac -version javac 1.8.0_121

curcumin = parse.smiles("O=C(\C=C\c1ccc(O)c(OC)c1)CC(=O)\C=C\c2cc(OC)c(O)cc2")[[1]] dep <- get.depictor(width = 200, height = 200, zoom = 1.3, style = "cow",

  • annotate = "off", abbr = "on", suppressh = TRUE,
  • showTitle = FALSE, smaLimit = 100, sma = NULL) imp <- view.image.2d(curcumin, dep) Error in .jcall(mi, "[B", "getBytes", as.integer(depictor$getWidth()), : java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment view.image.2d(curcumin, dep) Error in .jcall(mi, "[B", "getBytes", as.integer(depictor$getWidth()), : java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment view.molecule.2d(curcumin, dep) Error in .jnew("org/guha/rcdk/view/ViewMolecule2D", molecule, as.integer(width), : java.lang.NoSuchMethodError:
rajarshi commented 6 years ago

Can you try the latest rcdk code from Github? On OS X the last call (view.molecule.2d(curcumin, dep)) works OK. I'll look into the other two

schymane commented 6 years ago

view.image.2d works fine for me but not view.molecule.2d - but I thought I was doing something wrong there and I get all I need from view.image.2d ...

m <- parse.smiles("OS(=O)(=O)c1ccc(cc1)C(CC)CC |Sg:n:13:m:ht,Sg:n:11:n:ht|")[[1]] dep <- get.depictor() img <- view.image.2d(m, dep) plot(1:10, 1:10, pch=19) rasterImage(img, 2,2,8,10)

(looks fine)

copy.image.to.clipboard(m, depictor = dep)

(looks fine)

view.molecule.2d(m,depictor = dep)

Error in .jnew("org/guha/rcdk/view/ViewMolecule2D", molecule, as.integer(width), : java.lang.NoSuchMethodError:

I'm on probably outdated versions on this machine, but iirc had the same issue on fresh installs of everything at work a couple of days ago, Windows 10.

R version 3.2.5 (2016-04-14) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) [1] rcdk_3.4.3 rcdklibs_2.0 rJava_0.9-8 Rcpp_0.12.9

iutomo commented 6 years ago

I did pull the latest rcdk code from github when I was getting the errors. It seems like it is an RStudio related issue. view.image.2d(mol) works in the terminal. view.molecule.rd(mol) still showing java.lang.NoSuchMethodError: