Hi Josh,
I've done a fair bit of breaking bonds and putting things back together, and
I've tended to use the EditableMol class to do this. However I haven't been
breaking any ring bonds.
As I'm sure you can see by looking at the molecule the reason you're getting
this behaviour is because you're breaking the 'wrong' bond here. You might want
to have a look at doing a different way, having a quick look at the code you
might want to try PathToSubmol here.
m3 = Chem.MolFromSmiles('n1ccc2nc3cc4cc5ccncc5cc4nc3nc2c1')
r = m3.GetRingInfo()
aMap={}
nm = Chem.PathToSubmol(m3,r.AtomRings()[0], atomMap = aMap)
Will give you the first ring, however it will break some bonds, but this is
easily fixed as aMap now contains the mapping from the previous molecule to the
new molecule. So a quick fix would be to iterate over each of the bonds in the
old molecule and then create the corresponding bonds in the new one.
em = Chem.EditableMol(nm)
for bond in m3.GetBonds():
if(bond.GetBeginAtomIdx() in aMap and bond.GetEndAtomIdx() in aMap):
try:
em.AddBond(aMap[bond.GetBeginAtomIdx()],
aMap[bond.GetEndAtomIdx()], Chem.BondType.AROMATIC)
except:
pass
nnm = em.GetMol()
Which I thought would solve your problem, however the Chem.PathToSubmol command
seems to give me an extra atom… Maybe someone else can help with that one??
Best,
Nick
Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey
| SM2 5NG
T 020 8722 4033 | E [email protected]<mailto:[email protected]> |
W www.icr.ac.uk<http://www.icr.ac.uk/> | Twitter
@ICRnews<https://twitter.com/ICRnews>
Facebook
www.facebook.com/theinstituteofcancerresearch<http://www.facebook.com/theinstituteofcancerresearch>
Making the discoveries that defeat cancer
[cid:[email protected]]
On 9 Dec 2014, at 14:23, Campbell J.E.
<[email protected]<mailto:[email protected]>> wrote:
break_atoms = [list(x) for x in
m3.GetSubstructMatches(Chem.MolFromSmarts('[R2]'))]
break_bonds = ((3,20), (5,18), (7,16), (9,14))
em = Chem.EditableMol(m3)
em.RemoveBond(3,20)
nm = em.GetMol()
frags = Chem.GetMolFrags(nm,asMols=True)
[Chem.MolToSmiles(x,True) for x in frags]
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company
Limited by Guarantee, Registered in England under Company No. 534147 with its
Registered Office at 123 Old Brompton Road, London SW7 3RP.
This e-mail message is confidential and for use by the addressee only. If the
message is received by anyone other than the addressee, please return the
message to the sender by replying to it and then delete the message from your
computer and network.------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss