반응형
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdmolfiles,rdmolops
from rdkit.Chem.Draw import rdMolDraw2D
#dgl life에서 smilestobigraph가 molcule 순서 만드는것
smiles = 'C#Cc1cccc(Nc2ncnc3cc(OCCOC)c(OCCOC)cc23)c1'
mol = Chem.MolFromSmiles(smiles)
new_order = rdmolfiles.CanonicalRankAtoms(mol)
mol = rdmolops.RenumberAtoms(mol, new_order)
def mol_with_atom_index( mol ):
atoms = mol.GetNumAtoms()
for idx in range( atoms ):
mol.GetAtomWithIdx( idx ).SetProp( 'molAtomMapNumber', str( mol.GetAtomWithIdx( idx ).GetIdx() ) )
return mol
mol_with_atom_index( mol )
반응형