MolecularGraph.jl
MolecularGraph.jl copied to clipboard
A question about how SMILES is being parsed
Assume I have constructed a molecule from the following SMILES:
using Graphs, MolecularGraph
sml = "CC(=O)OC1=CC=CC=C1C(=O)O";
mol = smilestomol(sml);
We see in Pluto that mol has one ring.
Now, I would like to extract all the bonds that belong to the ring:
ringbonds = [(s, t) for (s, (t, _)) in zip(is_edge_in_ring(mol), [(k, v) for (k, v) in mol.eprops]) if s == 1];
#=
6-element Vector{Tuple{Bool, MolecularGraph.EdgeKey{Int64}}}:
(1, MolecularGraph.EdgeKey{Int64}(Edge 8 => 9))
(1, MolecularGraph.EdgeKey{Int64}(Edge 6 => 7))
(1, MolecularGraph.EdgeKey{Int64}(Edge 5 => 6))
(1, MolecularGraph.EdgeKey{Int64}(Edge 4 => 5))
(1, MolecularGraph.EdgeKey{Int64}(Edge 1 => 2))
(1, MolecularGraph.EdgeKey{Int64}(Edge 9 => 10))
=#
However, as the image indicates, (1, 2) and (4, 5) are not ring bonds. Is this an error, or have I misunderstood the purpose and nature of is_edge_in_ring?
Thank you in advance for your help.