[R] How to draw chemical structures with R?

LMH |mh_u@er@-group@ @end|ng |rom mo|conn@com
Tue Dec 6 03:11:13 CET 2022


Just my opinion, but I think you would be better off to draw the structures using a drawing program
like MarvinSketch (free, java based) and save the structure as a SMILES file, MOL file, or SDF. You
should be able to import any of those into R. A program like MarvinSketch will check the structure
for errors as you draw it and keep to standardized formats.

By the way, I see no error in the SMILEA string for the structure in your expamle so your error is
not in the drawing part of the process. Even so, I try to keep to well established tools for basic
tasks and Marvin as is well established as it gets.

I would look for an example of what you are trying and see if you can get the example to work.

LMH


Luigi Marongiu wrote:
> Hello,'
> I have seen from this link
> https://cran.r-project.org/web/packages/rcdk/vignettes/using-rcdk.html
> that there is a way to draw chemical structures using R via rcdk package.
> I tried to draw a simple structure but I got an error. What is it
> missing? What is the correct syntax?
> Thanks
> 
> ```
> library(rcdk)
> smile <- 'c1ccccc1CC(=O)C(N)CC1CCCCOC1'
> mol <- parse.smiles(smile)[[1]]
> view.molecule.2d(mol)
>> Error in view.molecule.2d(mol) : java.lang.NoSuchMethodError: <init>
> ```
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list