To whom it may concern,

I am trying to assign a priority score to each atom of a chemical by its
CIP values. However, it showed error if the molecule is added with H. Is
there any ways that I can assign like '-1' value to H atom?
My main purpose was as the following example:
Given:
mol=Chem.MolFromSmiles('CCC')
molH=Chem.AddHs(mol)
AtomId     Symbol
 0               C
 1               C
 2               C
 3               H
CIP(0,molH) = 0
CIP(3,molH) = -1

I tried to have a function defining the CIP rank for H:

def CIP(atomId,mol):
    if mol.GetAtomWithIdx(atomId).GetSymbol()=='H':
        CIP='-1'
    else:
        mol=Chem.RemoveHs(mol)
        CIP=mol.GetAtomWithIdx(atomId).GetProp('_CIPRank')
     return CIP

However, it gave me the KeyError f I do CIP(0,molH) even though I included
RemoveHs to molecule if the atom is not "H".

Could you please show me how to solve this?

Thank you so much for your help.
Phuong Chau
Smith College '20
Engineering and Data Science Major
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to