CDK-R / cdkr

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

view.molecule.2d gives NoSuchMethodError #106

Closed adelenelai closed 4 years ago

adelenelai commented 4 years ago

Hi again,

Tried replicating the vignette's example:

smiles <- c('CCC', 'CCN', 'CCN(C)(C)',
            'c1ccccc1Cc1ccccc1',
            'C1CCC1CC(CN(C)(C))CC(=O)CC')
mols <- parse.smiles(smiles)
view.molecule.2d(mols[[1]])

Out:

Error in .jnew("org/guha/rcdk/view/ViewMolecule2DTable", array, as.integer(ncol), : java.lang.NoSuchMethodError: <init>
Traceback:

1. view.molecule.2d(mols[[1]])
2. .jnew("org/guha/rcdk/view/ViewMolecule2DTable", array, as.integer(ncol), 
 .     depictor)

With sessionInfo():

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=de_DE.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=de_DE.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=de_DE.UTF-8          LC_NAME=de_DE.UTF-8          
 [9] LC_ADDRESS=de_DE.UTF-8        LC_TELEPHONE=de_DE.UTF-8     
[11] LC_MEASUREMENT=de_DE.UTF-8    LC_IDENTIFICATION=de_DE.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rcdk_3.5.0     rcdklibs_2.3   rJava_0.9-11   devtools_2.2.2 usethis_1.5.1 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        pillar_1.4.2      compiler_3.6.1    iterators_1.0.12 
 [5] prettyunits_1.1.1 base64enc_0.1-3   remotes_2.1.1     tools_3.6.1      
 [9] testthat_2.3.2    digest_0.6.22     pkgbuild_1.0.6    uuid_0.1-4       
[13] pkgload_1.0.2     jsonlite_1.6      evaluate_0.14     memoise_1.1.0    
[17] png_0.1-7         rlang_0.4.5       IRdisplay_0.7.0   cli_2.0.2        
[21] parallel_3.6.1    curl_4.3          IRkernel_1.1      repr_1.1.0       
[25] withr_2.1.2       vctrs_0.2.3       desc_1.2.0        fs_1.3.2         
[29] rprojroot_1.3-2   glue_1.3.1        R6_2.4.0          processx_3.4.2   
[33] fansi_0.4.0       sessioninfo_1.1.1 pbdZMQ_0.3-3      callr_3.4.2      
[37] magrittr_1.5      itertools_0.1-3   backports_1.1.5   ps_1.3.2         
[41] ellipsis_0.3.0    htmltools_0.4.0   fingerprint_3.5.7 assertthat_0.2.1 
[45] crayon_1.3.4 
zachcp commented 4 years ago

Works fine for me. I'm wondering about a couple of things:

  1. What are the class of your mol object?
.jclass(mols)
.jclass(mols[[1]])
  1. Class loading: can you load the class (I would expect so)
library(rcdk)
J("org/guha/rcdk/view/ViewMolecule2DTable")`
  1. Name Shadowing. The error message doesn't make sense unless you are passing the wrong args. Perhaps they are being shadowed by names from another package? Can you try a fresh R session and see how it looks?
# launch R with R --vanilla
library(rcdk)
smiles <- c('CCC', 'CCN', 'CCN(C)(C)',
            'c1ccccc1Cc1ccccc1',
            'C1CCC1CC(CN(C)(C))CC(=O)CC')
mols <- parse.smiles(smiles)
view.molecule.2d(mols[[1]])

or from bash

Rscript -e "library(rcdk); smiles <- c('CCC', 'CCN', 'CCN(C)(C)','c1ccccc1Cc1ccccc1','C1CCC1CC(CN(C)(C))CC(=O)CC')
mols <- parse.smiles(smiles)
view.molecule.2d(mols[[1]])"

both of those work fine on my machine.

adelenelai commented 4 years ago

Thanks Zach, I'll check when I have access to my original machine tomorrow.

adelenelai commented 4 years ago

closing because don't have access to the original machine I used any more, thanks anyway to Zach for some tips