I guess that 'a.GetFormalCharge()' gives the formal charges of the whole
molecule although it's a property of the atom object. Notwithstanding,
assume that I have created an atom property named 'partial charge' which
stores the real partial charge of the atom. In that case would just suffice
to add this extra line in generateAtomInvariant() function?

descriptors.append(a.GetProp('partial charge'))


Could someone please answer my question below?


On Fri, 22 Nov 2019 at 15:38, Thomas Evangelidis <teva...@gmail.com> wrote:

> Greetings,
>
> Could someone please clarify how can I pass atomic partial charges to the
> ECFP fingerprint generator along with the default atomic properties that it
> considers? Can I pass the real charge values or do I have to group them
> into bins and pass the bin identifier? I found a function in utilsFP.py
> file which generates invariants as follows:
>
> def generateAtomInvariant(mol):
>     """
>     >>> generateAtomInvariant(Chem.MolFromSmiles("Cc1ncccc1"))
>     [341294046, 3184205312, 522345510, 1545984525, 1545984525, 1545984525, 
> 1545984525]
>     """
>     num_atoms = mol.GetNumAtoms()
>     invariants = [0]*num_atoms
>     for i,a in enumerate(mol.GetAtoms()):
>         descriptors=[]
>         descriptors.append(a.GetAtomicNum())
>         descriptors.append(a.GetTotalDegree())
>         descriptors.append(a.GetTotalNumHs())
>         descriptors.append(a.IsInRing())
>         descriptors.append(a.GetIsAromatic())
>         invariants[i]=hash(tuple(descriptors))& 0xffffffff
>     return invariants
>
>
> And then generate the fingerprint like this:
>
>
> fp = AllChem.GetMorganFingerprint(mol, radius=3, 
> invariants=generateAtomInvariant(mol))
>
>
> Would just suffice to add this extra line in generateAtomInvariant() function?
>
>
> descriptors.append(a.GetFormalCharge())
>
>
>
> I thank you in advance.
> Thomas
>
>
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to