Skip to content

Instantly share code, notes, and snippets.

@jhjensen2
Created December 4, 2017 13:26
Show Gist options
  • Save jhjensen2/5b11757cb1e82c70137bd937f1595d28 to your computer and use it in GitHub Desktop.
Save jhjensen2/5b11757cb1e82c70137bd937f1595d28 to your computer and use it in GitHub Desktop.
from rdkit import Chem
from rdkit.Chem import AllChem
#reactant_smiles = "C12=CC=CC=CC1CC=C2"
#reactant_smiles = "N#CC1(C#N)C2C=CC=CC=C2C=C1C3=CC=CC=C3"
reactant_smiles = "N#CC1(C#N)C2C=CC=C(C=CC=C3)C3=C2C=C1C4=CC=CC=C4"
reactant = Chem.MolFromSmiles(reactant_smiles)
print Chem.MolToSmiles(reactant)
Chem.Kekulize(reactant,clearAromaticFlags=True)
print Chem.MolToSmiles(reactant)
rxn_smarts = "[C:1]12=[C:2][C:3]=[C:4][C:5]=[C:6][C:7]1[C:8][C:9]=[C:10]2>>[C:8]=[C:9][C:10]=[C:1]1[C:2]=[C:3][C:4]=[C:5][C:6]=[C:7]1"
rxn = AllChem.ReactionFromSmarts(rxn_smarts)
product = rxn.RunReactants((reactant,))
print Chem.MolToSmiles(product[0][0])
molecules = []
molecules.append(reactant)
molecules.append(product[0][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment