Hi Sergio,
On Sunday, September 22, 2013, Sergio Martinez Cuesta wrote:
> Dear Greg,
>
> I was wondering whether you could let me know your insights regarding the
> following error below? Please find the input molecule.mol attached.
>
> Many thanks
> Sergio
>
> ---------------------------------------------
>
> from rdkit.Chem import AllChem
> from rdkit import Chem
> m = Chem.MolFromMolFile('molecule.mol')
> info={}
> fp = AllChem.GetMorganFingerprint(m,2,useChirality=True,bitInfo=info)
> for element in fp.GetNonzeroElements():
> for i in info[element]:
> print i
> if i[1]==0:
> smarts=m.GetAtomWithIdx(i[0]).GetSmarts()
> else:
> env = Chem.FindAtomEnvironmentOfRadiusN(m,i[1],i[0])
> amap={}
> submol=Chem.PathToSubmol(m,env,atomMap=amap)
> smarts=Chem.MolToSmarts(submol,isomericSmiles=True)
>
>
> (12, 2)
> (8, 1)
> (13, 1)
> (2, 2)
> [13:15:25]
>
> ****
> Range Error
> idx
> Violation occurred on line 153 in file
> /home/RDKit_2013_03_2/Code/GraphMol/ROMol.cpp
> Failed Expression: 0 <= 12 <= 6
> ****
>
> Traceback (most recent call last):
> File "<stdin>", line 10, in <module>
> RuntimeError: Range Error
>
It's a bug. I will try to fix it, but in the meantime, you can work around
it like by making a copy of the molecule that comes back from
PathToSubmol():
info={}
fp = AllChem.GetMorganFingerprint(m,2,useChirality=True,bitInfo=info)
for element in fp.GetNonzeroElements():
for i in info[element]:
print i
if i[1]==0:
smarts=m.GetAtomWithIdx(i[0]).GetSmarts()
else:
env = Chem.FindAtomEnvironmentOfRadiusN(m,i[1],i[0])
amap={}
submol=Chem.Mol(Chem.PathToSubmol(m,env,atomMap=amap).ToBinary())
smarts=Chem.MolToSmarts(submol,isomericSmiles=True)
Best,
-greg
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13.
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss