Hi Maxim,
if you change your query to SMARTS it would be possible to delete
what you want
m=Chem.MolFromSmiles('C1(C2=NC=CC=C2)=CC=CC(C)=C1')
ss = Chem.MolFromSmarts('c1ccccc1C')
frag = AllChem.DeleteSubstructs(m, ss)
print(Chem.MolToSmiles(frag))
Pavel.
On 03/31/2017 07:41 AM, Popov, Maxim (Ext) wrote:
Dear RDKit users,
I am trying to remove a common substructure from a number of molecules
(with AllChem.DeleteSubstructs). My problem is best illustrated by
this short code:
fromrdkit importChem
fromrdkit.Chem importAllChem
m=Chem.MolFromSmiles(/'C1(C2=NC=CC=C2)=CC=CC(C)=C1'/)
ss = Chem.MolFromSmiles(/'C1=CC=CC(C)=C1'/)
hyd=Chem.MolFromSmiles(/'[H]'/)
print(/"Substituting substructure with hydrogen"/)
frags = AllChem.ReplaceSubstructs(m, ss,hyd)
forfrag infrags:
print(Chem.MolToSmiles(frag))
print(/"\nDeleting substructure"/)
frag = AllChem.DeleteSubstructs(m, ss)
print(Chem.MolToSmiles(frag))
I create a toluene connected to pyridine and try to remove toluene.
When replacing toluene substructure with hydrogen
(AllChem.ReplaceSubstructs), I receive two sets of results: pyridine
(with explicit hydrogen) and single carbon plus single hydrogen plus
aromatic open chain (what is left from pyridine after removing one
ring atom).
When deleting the toluene substructure (AllChem.DeleteSubstructs), I
receive just the open chain of ex-pyridine (corresponding to second
set of the ReplaceSubstructs results).
Is there a way of directing DeleteSubstructs method to a specific
variant (in this case, leaving pyridine as a ring seems to be logical).
Best regards,
Maxim
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss