Closed schymane closed 7 years ago
I haven't come across this representation, but I'm guessing this is because in absence of kekulization the bond orders are not set properly. As a result the dashed line represents an undefined/unset bond order
In general, keukilze should always be TRUE
. The option of FALSE
is to force parsing in some cases. An example is imidazole. If represented as an aromatic SMILES with no explicit H
, parsing will fail, but you can force it to by setting kekulize=FALSE
.
So in short, you should set kekulize=TRUE
by default, but if you want to support ill-defined SMILES allow the option of FALSE
library(rcdk)
> is.null(parse.smiles('c1cncn1', kekulise=TRUE)[[1]])
[1] TRUE
> is.null(parse.smiles('c1cncn1', kekulise=FALSE)[[1]])
[1] FALSE
> is.null(parse.smiles('c1c[nH]cn1', kekulise=TRUE)[[1]])
[1] FALSE
Thanks for the clarification - if the SMILES is invalid this can be caught, but can be plotted if you set kekulise=FALSE:
library(rcdk) library(RChemMass) plot.new() plot.window(xlim=c(0,200), ylim=c(0,100)) is.null(parse.smiles('c1cncn1', kekulise=TRUE)[[1]]) [1] TRUE renderSMILES.rcdk("c1cncn1",kekulise=TRUE) [1] "Invalid SMILES not rendered: c1cncn1" is.null(parse.smiles('c1cncn1', kekulise=FALSE)[[1]]) [1] FALSE renderSMILES.rcdk("c1cncn1",kekulise=FALSE)
but if the SMILES is valid it's harder to catch the error, you can plot either without error:
plot.new() plot.window(xlim=c(0,200), ylim=c(0,100)) is.null(parse.smiles('c1c[nH]cn1', kekulise=TRUE)[[1]]) [1] FALSE renderSMILES.rcdk("c1c[nH]cn1",kekulise=TRUE) is.null(parse.smiles('c1c[nH]cn1', kekulise=FALSE)[[1]]) [1] FALSE renderSMILES.rcdk("c1c[nH]cn1",kekulise=FALSE, coords=c(100,0,200,100))
I'll update my documentation to reflect that, thanks!
The new depiction with kekulise=TRUE looks awesome, but with kekulise=FALSE rather bizarre. In earlier versions this would have been the aromatic delocalised ring representation - any reason for the change? Should I "block" the kekulise=FALSE option? I'd rather keep it in for backwards compatibility...