[Rdkit-discuss] How many bonds of a Type in a molecule
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: José E. S. A. <Jos...@ua...> - 2020-12-08 16:35:44
|
Dear all,
I need to find how many bonds of a certain type are in a molecule. For example, for DOUBLE bonds, I would do:
bond_number = 0
for bond in mol.GetBonds():
if bond.GetType() == Chem.BondType.DOUBLE:
bond_number += 1
However, searching for faster manners to do this, I found "rdqueries". For example, to find how many atoms of Carbon there are in a molecule, you could do:
q = rdqueries.AtomNumEqualsQueryAtom(6)
carbon_number = len(mol.GetAtomsMatchingQuery(q))
I'm wondering if some of you know the equivalent in "rdqueries" to find the number of bonds that match a type.
Many thanks in advance. Best,
José-Emilio Sánchez
|