Hi Taka,

So this bug is fix thanks.



Now I have two others issues:

1. This cell gives also an error:

dataset = rg.GetRGroupsAsColumns()
core =  Chem.RemoveHs(dataset["Core"][0])

RDKit ERROR: [12:59:27] Explicit valence for atom # 6 N, 5, is greater than 
permitted
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-23-487b32336f27> in <module>
      1 dataset = rg.GetRGroupsAsColumns()
----> 2 core =  Chem.RemoveHs(dataset["Core"][0])

ValueError: Sanitization error: Explicit valence for atom # 6 N, 5, is greater 
than permitted



2. and after second issue when I’m running this cell:
res = enumeratemol(core,rg)


---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-25-04a5f3b3662f> in <module>
----> 1 res = enumeratemol(core,rg)

<ipython-input-4-8458dbd4277f> in enumeratemol(core, rg, maxmol)
     11         mol = core
     12         for idx,j in enumerate(i):
---> 13             mol = makebond(mol, rgs[idx][j])
     14         AllChem.Compute2DCoords(mol)
     15         mol = Chem.RemoveHs(mol)

<ipython-input-3-45dfd4e95811> in makebond(target, chain)
     14             nbr2 = [x.GetOtherAtom(newmol.GetAtomWithIdx(atm2)) for x 
in newmol.GetAtomWithIdx(atm2).GetBonds()][0]
     15             nbr2.SetAtomMapNum(idx)
---> 16     newmol.AddBond(nbr1.GetIdx(), nbr2.GetIdx(), 
order=Chem.rdchem.BondType.SINGLE)
     17     nbr1.SetAtomMapNum(0)
     18     nbr2.SetAtomMapNum(0)

UnboundLocalError: local variable 'nbr1' referenced before assignment


Thanks for helping

Guillaume

De : Taka Seri <serit...@gmail.com>
Date : mercredi, 20 novembre 2019 à 14:02
À : Guillaume GODIN <guillaume.go...@firmenich.com>
Cc : "rdkit-discuss@lists.sourceforge.net" <rdkit-discuss@lists.sourceforge.net>
Objet : [*External*] Re: [Rdkit-discuss] Try to reproduce a code working in 
January

Hi Guillaume,

I confirmed the issue.
RemoveHs does not work to invalid molecule.
So I updated my code example and uploaded gist.
Could you please check new version of my code?
https://gist.github.com/iwatobipen/77269b8a10eafe0e0cba8de5c1cae6ec

Any comments or suggestions will be appreciated.

Thanks,
Taka

2019年11月20日(水) 14:46 Guillaume GODIN 
<guillaume.go...@firmenich.com<mailto:guillaume.go...@firmenich.com>>:
Dear community,

I try to reproduce this code

https://iwatobipen.wordpress.com/2019/01/18/generate-possible-molecules-from-a-dataset-chemoinformatics-rdkit/

but got an error un panda / rdkit during generation:

frame = frame[["ROMol", "Smiles", "Core", "R1", "R2", "R3"]]
frame['Core']=frame['Core'].apply(Chem.RemoveHs)
frame.head(2)



RDKit ERROR: [05:02:02]
RDKit ERROR:
RDKit ERROR: ****
RDKit ERROR: Pre-condition Violation
RDKit ERROR: getExplicitValence() called without call to calcExplicitValence()
RDKit ERROR: Violation occurred on line 161 in file 
/opt/conda/conda-bld/rdkit_1561471048963/work/Code/GraphMol/Atom.cpp
RDKit ERROR: Failed Expression: d_explicitValence > -1
RDKit ERROR: ****
RDKit ERROR:
RDKit ERROR: [05:05:04] Explicit valence for atom # 6 N, 5, is greater than 
permitted

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-74-d2864fc13f85> in <module>
      1 frame = frame[["ROMol", "Smiles", "Core", "R1", "R2", "R3"]]
----> 2 frame['Core']=frame['Core'].apply(Chem.RemoveHs)
      3 frame.head(2)

~/miniconda/envs/py37/lib/python3.7/site-packages/pandas/core/series.py in 
apply(self, func, convert_dtype, args, **kwds)
   3589             else:
   3590                 values = self.astype(object).values
-> 3591                 mapped = lib.map_infer(values, f, convert=convert_dtype)
   3592
   3593         if len(mapped) and isinstance(mapped[0], Series):

pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

ValueError: Sanitization error: Explicit valence for atom # 6 N, 5, is greater 
than permitted



Any idea why ?

BR

Guillaume


***********************************************************************************
DISCLAIMER
This email and any files transmitted with it, including replies and forwarded 
copies (which may contain alterations) subsequently transmitted from Firmenich, 
are confidential and solely for the use of the intended recipient. The contents 
do not represent the opinion of Firmenich except to the extent that it relates 
to their official business.
***********************************************************************************
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

***********************************************************************************
DISCLAIMER  
This email and any files transmitted with it, including replies and forwarded 
copies (which may contain alterations) subsequently transmitted from Firmenich, 
are confidential and solely for the use of the intended recipient. The contents 
do not represent the opinion of Firmenich except to the extent that it relates 
to their official business.  
***********************************************************************************
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to