Sorry for the slow reply; this one got lost. I would guess that the only reason you're able to read this molecule in successfully is that you've turned sanitization off. The default RDKit ring finding algorithm fails on molecules like this where all atoms have 4 or more bonds, so standard sanitization will not work. When you try to generate a Mol block, the toolkit tries to generate a set of 2D coordinates (since mol blocks without 2D coords don't make a lot of sense). The 2D coordinate generation also calls the ring finding algorithm, and that fails, so you can't write the molecule out.
I will eventually fix the problem with ring finding in these systems (it has come up repeatedly recently), but in the meantime your options are to manually generate a set of coordinates for the molecule (you could set them all to zero) or to manually call the alternate ring finding algorithm before generating coordinates: m = Chem.MolFromMolBlock("""boron containing OpenBabel08161816583D 12 30 0 0 0 0 0 0 0 0999 V2000 0.7000 -4.9240 -0.0370 B 0 0 0 0 0 0 0 0 0 0 0 0 1.5320 -2.2270 -0.0390 B 0 0 0 0 0 0 0 0 0 0 0 0 0.0470 -3.3430 -0.0100 B 0 0 0 0 0 0 0 0 0 0 0 0 3.9570 -0.6710 -0.0740 B 0 0 0 0 0 0 0 0 0 0 0 0 -1.3100 0.9460 0.0290 B 0 0 0 0 0 0 0 0 0 0 0 0 -0.7380 -1.0010 0.0270 B 0 0 0 0 0 0 0 0 0 0 0 0 3.8030 -1.9300 -0.2150 B 0 0 0 0 0 0 0 0 0 0 0 0 2.0560 0.0860 -0.0260 B 0 0 0 0 0 0 0 0 0 0 0 0 -0.7320 -1.1240 -0.0280 B 0 0 0 0 0 0 0 0 0 0 0 0 -1.8540 -2.5110 -0.1560 B 0 0 0 0 0 0 0 0 0 0 0 0 0.8030 1.3740 0.1040 C 0 0 0 0 0 0 0 0 0 0 0 0 1.2660 -0.0510 -0.0220 C 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 1 3 1 0 0 0 0 1 4 1 0 0 0 0 1 5 1 0 0 0 0 1 6 1 0 0 0 0 2 3 1 0 0 0 0 2 4 1 0 0 0 0 2 7 1 0 0 0 0 2 8 1 0 0 0 0 3 6 1 0 0 0 0 3 7 1 0 0 0 0 3 10 1 0 0 0 0 4 5 1 0 0 0 0 4 8 1 0 0 0 0 4 9 1 0 0 0 0 5 6 1 0 0 0 0 5 9 1 0 0 0 0 5 12 1 0 0 0 0 6 10 1 0 0 0 0 6 12 1 0 0 0 0 7 8 1 0 0 0 0 7 10 1 0 0 0 0 7 11 1 0 0 0 0 8 9 1 0 0 0 0 8 11 1 0 0 0 0 9 11 1 0 0 0 0 9 12 1 0 0 0 0 10 11 1 0 0 0 0 10 12 1 0 0 0 0 11 12 1 0 0 0 0 M END """, sanitize=False) m.UpdatePropertyCache(False) Chem.FastFindRings(m) Chem.MolToMolBlock(m) Best, -greg On Tue, Sep 25, 2018 at 11:29 PM Bennion, Brian via Rdkit-discuss < rdkit-discuss@lists.sourceforge.net> wrote: > Hello, > > Awhile back I had noticed that rdkit has issues with boron containing > compounds. One is below, and I admit it is a strange one. I read in an sdf > file and write it out after calculating a formal charge on the molecule. > > It seems to be read into rdkit ok but writing errored out with > “ValueError: could not find number of expected rings.” > > I think it odd that the compound can be read in, but not written out. > Should I just ignore this molecule? > > Brian > > > > > > > > > > OpenBabel08161816583D > > > > 12 30 0 0 0 0 0 0 0 0999 V2000 > > 0.7000 -4.9240 -0.0370 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 1.5320 -2.2270 -0.0390 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.0470 -3.3430 -0.0100 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 3.9570 -0.6710 -0.0740 B 0 0 0 0 0 0 0 0 0 0 0 0 > > -1.3100 0.9460 0.0290 B 0 0 0 0 0 0 0 0 0 0 0 0 > > -0.7380 -1.0010 0.0270 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 3.8030 -1.9300 -0.2150 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 2.0560 0.0860 -0.0260 B 0 0 0 0 0 0 0 0 0 0 0 0 > > -0.7320 -1.1240 -0.0280 B 0 0 0 0 0 0 0 0 0 0 0 0 > > -1.8540 -2.5110 -0.1560 B 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.8030 1.3740 0.1040 C 0 0 0 0 0 0 0 0 0 0 0 0 > > 1.2660 -0.0510 -0.0220 C 0 0 0 0 0 0 0 0 0 0 0 0 > > 1 2 1 0 0 0 0 > > 1 3 1 0 0 0 0 > > 1 4 1 0 0 0 0 > > 1 5 1 0 0 0 0 > > 1 6 1 0 0 0 0 > > 2 3 1 0 0 0 0 > > 2 4 1 0 0 0 0 > > 2 7 1 0 0 0 0 > > 2 8 1 0 0 0 0 > > 3 6 1 0 0 0 0 > > 3 7 1 0 0 0 0 > > 3 10 1 0 0 0 0 > > 4 5 1 0 0 0 0 > > 4 8 1 0 0 0 0 > > 4 9 1 0 0 0 0 > > 5 6 1 0 0 0 0 > > 5 9 1 0 0 0 0 > > 5 12 1 0 0 0 0 > > 6 10 1 0 0 0 0 > > 6 12 1 0 0 0 0 > > 7 8 1 0 0 0 0 > > 7 10 1 0 0 0 0 > > 7 11 1 0 0 0 0 > > 8 9 1 0 0 0 0 > > 8 11 1 0 0 0 0 > > 9 11 1 0 0 0 0 > > 9 12 1 0 0 0 0 > > 10 11 1 0 0 0 0 > > 10 12 1 0 0 0 0 > > 11 12 1 0 0 0 0 > > M END > > > > $$$$ > > > > > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss