CDK-R / cdkr

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

view.molecule.2D not working on Rstudio #122

Open garimaloh opened 3 years ago

garimaloh commented 3 years ago

mols <- parse.smiles(peptide_file[2,SMILES]) class(mols) kk=view.molecule.2d(m)

Getting error:

view.molecule.2d(m) Error in view.molecule.2d(m) : java.lang.NoSuchMethodError:

garimaloh commented 3 years ago

this is what happening:

mols <- parse.smiles(peptide_file[2,SMILES])[[1]] class(mols) [1] "jobjRef" attr(,"package") [1] "rJava" kk=view.molecule.2d(mols) Error in view.molecule.2d(mols) : java.lang.NoSuchMethodError:

drscottsimpson commented 2 years ago

I am having the same issue right now. Not too sure what is going on or how to fix it.

PaiboonJ commented 2 years ago

I also have the same error. I did come across the article: https://reflectoring.io/nosuchmethod/ I have very limited experience with R, so I don't completely understand the article.

Emma-Palm commented 1 year ago

I have the same issue. When running the following code: smiles <- c('CCC', 'CCN', 'CCN(C)(C)', 'c1ccccc1Cc1ccccc1', 'C1CCC1CC(CN(C)(C))CC(=O)CC') molecules <- data.frame(smiles) mols <- parse.smiles(smiles) view.molecule.2d(mols[[1]])

I get this error message: Error in view.molecule.2d(mols[1]) : java.lang.NoSuchMethodError:

I also get an error from the view.table() function which I suspect is related: smiles <- c('CCC', 'CCN', 'CCN(C)(C)', 'c1ccccc1Cc1ccccc1', 'C1CCC1CC(CN(C)(C))CC(=O)CC') mols <- parse.smiles(smiles) dframe <- data.frame(x = runif(4), toxicity = factor(c('Toxic', 'Toxic', 'Nontoxic', 'Nontoxic')), solubility = c('yes', 'yes', 'no', 'yes')) view.table(mols[1:4], dframe) Error in view.table(mols, molecules, depictor = NULL) : java.awt.HeadlessException In addition: Warning messages: 1: In [<-(*tmp*, j, value = .jnew("java/lang/String", as.character(dat[i, : implicit list embedding of S4 objects is deprecated

This is my session info: R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)

Matrix products: default locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] knitr_1.40 gt_0.7.0 ChemmineOB_1.34.0 webchem_1.1.3 shinythemes_1.2.0
[6] forcats_0.5.2 stringr_1.4.1 purrr_0.3.4 readr_2.1.3 tidyr_1.2.1
[11] tibble_3.1.8 tidyverse_1.3.2 data.table_1.14.2 shinyjs_2.1.0 DBI_1.1.3
[16] ggplot2_3.3.6 dplyr_1.0.10 DT_0.25 shinydashboard_0.7.2 shiny_1.7.2
[21] RChemMass_0.1.28 httr_1.4.4 rjson_0.2.21 enviPat_2.4 rsvg_2.3.1
[26] curl_4.3.2 RMassBank_3.6.1 Rcpp_1.0.9 rcdk_3.7.0 rcdklibs_2.8
[31] devtools_2.4.4 usethis_2.1.6 ChemmineR_3.48.0 rJava_1.0-6

zachcp commented 1 year ago

Sorry about the late reply. The rcdk image viz code is a bit brittle. I would recommend checking out the depict repo for your image visualization needs. It also used rcdklibs but taps into the more recent CDK DepictionGenerator class which is really quite nice. You can see it in action here.

In theory anything you see on that page, you should be able to implement from R.