Closed tagirshin closed 3 years ago
Molecule Queries now have extra attrs. implicit_hydrogens - for searching atoms with specified amount of hydrogens. ring_sizes - for searching atoms in rings.
For example double bonded CC fragment in 6-member ring where one of atoms contains only one implicit H.
query = QueryContainer()
query.add_atom('C', rings_sizes=6)
query.add_atom('C', rings_sizes=6, hydrogens=1)
query.add_bond(1, 2, 2)
This is fix:
for _, atom in query.atoms():
atom.neighbors = None
atom.hybridization = None
atom.implicit_hydrogens = None
atom.ring_sizes = None
query
Thanks a lot!
I wanted to create a query from SMILES, so I decided to use molecule.substructure(as_query=True). Then I needed to use isomorphism, but it didn't work as I expected:
Next, I decided to delete all hybridization and neighbors marks, but it didn't change anything:
Finally, when I constructed query myself, it worked as supposed:
So, I don't understand if it is supposed to be like that or it's a bug.
Notebook to reproduce this experiment: query_bug.ipynb.zip