Created
December 4, 2017 13:30
-
-
Save jhjensen2/e9458b89a319fcf95cdbc4bf50af8fc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rdkit import Chem | |
from rdkit.Chem import AllChem | |
from itertools import islice | |
smiles_list = ['C12=CC=CC=CC1CC=C2'] | |
#smiles_list = ['C1=CC2CC=CC2=c2ccccc2=C1'] | |
rxn_smarts_list = ['[CX3,cX3;H1:1]~[CX3,cX3;H1:2]>>[c:1]1[c:2]cccc1'] | |
molecules = [] | |
mol = Chem.MolFromSmiles(smiles_list[0]) | |
molecules.append(mol) | |
substitutions = 1 | |
for i in range(substitutions): | |
for smiles in islice(smiles_list,i,len(smiles_list)): | |
mol = Chem.MolFromSmiles(smiles) | |
for rxn_smarts in rxn_smarts_list: | |
rxn = AllChem.ReactionFromSmarts(rxn_smarts) | |
new_mols = rxn.RunReactants((mol,)) | |
for new_mol in new_mols: | |
new_smiles = Chem.MolToSmiles(new_mol[0]) | |
if new_smiles not in smiles_list: | |
smiles_list.append(new_smiles) | |
molecules.append(new_mol[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment