Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with rem_vertex! with next-to-edge atoms #113

Closed
pw0908 opened this issue Sep 25, 2024 · 1 comment
Closed

Bug with rem_vertex! with next-to-edge atoms #113

pw0908 opened this issue Sep 25, 2024 · 1 comment

Comments

@pw0908
Copy link
Contributor

pw0908 commented Sep 25, 2024

Hi!
Thank you so much for building this package! It's helped a lot with our ability to process molecular structures.

I just wanted to report an issue I've noticed with rem_vertex! when you remove an atom next to the final atom of a molecule. For example, in hexanol, if you try to remove the carbon next to the oxygen:

mol = smilestomol("CCCCCCO")
rem_vertex!(mol, 6) # KeyError: key Edge 6 => 7 not found

I believe that this is due to how the final vertex is treated in MolecularGraph:

nv_ == v || begin mol.vprops[v] = mol.vprops[nv_] end
delete!(mol.vprops, nv_)

If this re-indexing is done, then this edge will no longer exist.

I'm not quite sure what the fix will be....

@mojaie
Copy link
Owner

mojaie commented Sep 25, 2024

Thank you for catching. I will merge your PR soon.

@mojaie mojaie closed this as completed Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants