Open lz100 opened 2 years ago
I would recommend checking JDK and rJava configurations. Normally, this would return a proper NA
:
library(magrittr)
"CCCC" %>%
rcdk::parse.smiles() %>%
.[[1]] %>%
Rcpi::extractDrugLongestAliphaticChain()
#> nAtomLAC
#> 1 4
x <- "[H]OC1=C2OC(=O)C34C5=C6C7([H])C8=C(C([H])([H])C([H])(C79C([H])([H])C5([H])C(=C([H])C([H])(C%10([H])C([H])([H])C([H])([H])C([H])([H])C%10([H])[H])C([H])([H])C4([H])C%11(OC(=O)C=%12C%11=C([H])C([H])=C([H])C%12C([H])([H])C([H])([H])C([H])([H])N([H])[H])C23C([H])([H])C6([H])[H])C([H])([H])C9([H])[H])C([H])([H])[H])C([H])([H])C([H])([H])C%13([H])N8C([H])([H])C%14([H])C%15([H])N(C%16([H])C%17(C([H])([H])C%18(C([H])([H])C%17([H])[H])C([H])([H])C([H])([H])C([H])([H])C%18([H])[H])C([H])([H])C([H])([H])C%15([H])C([H])([H])C1%16[H])C([H])([H])C%13([H])C%14([H])[H]"
x %>%
rcdk::parse.smiles() %>%
.[[1]] %>%
Rcpi::extractDrugLongestAliphaticChain()
#> nAtomLAC
#> 1 NA
If that's really not possible, perhaps wrapping calls with callr could be a workaround to avoid crashing the main process and to allow exception handling. See an example at https://nanx.me/blog/post/disposable-computing-with-callr/.
Thanks for the recommendation. I suspect this is OS related. Both my attempts on Centos 7 and Ubuntu 20 crashed. I wonder if you are using a non-Linux system?
Just tested on macOS with Oracle JDK installed via homebrew cask and Windows 10 with Amazon Corretto JDK installed via chocolatey. They all work ok out of the box.
Some SMILEs break
extractDrugLongestAliphaticChain
Then, if you don't run
extractDrugLongestAliphaticChain
but run with other randomRcpi
functions, the entire R session crashesThe first issue may be CDK java issue, but can we do something in the second case to prevent R crash?