本文整理汇总了Python中rdkit.Chem.MolFragmentToSmiles方法的典型用法代码示例。如果您正苦于以下问题:Python Chem.MolFragmentToSmiles方法的具体用法?Python Chem.MolFragmentToSmiles怎么用?Python Chem.MolFragmentToSmiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdkit.Chem
的用法示例。
在下文中一共展示了Chem.MolFragmentToSmiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getSubstructSmi
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFragmentToSmiles [as 别名]
def getSubstructSmi(mol,env,propsToSmiles=True):
"""
>>> getSubstructSmi(Chem.MolFromSmiles('Cc1ncccc1'),((0,1,2)))
'[cH;R;D2]:[n;R;D2]:[c;R;D3]-[CH3;R0;D1]'
"""
atomsToUse=set()
if not len(env):
return ''
for b in env:
atomsToUse.add(mol.GetBondWithIdx(b).GetBeginAtomIdx())
atomsToUse.add(mol.GetBondWithIdx(b).GetEndAtomIdx())
# no isomeric smiles since we don't include that in the fingerprints
smi = Chem.MolFragmentToSmiles(mol,atomsToUse,isomericSmiles=False,
bondsToUse=env,allHsExplicit=True, allBondsExplicit=True)
if propsToSmiles:
order = eval(mol.GetProp("_smilesAtomOutputOrder"))
smi = writePropsToSmiles(mol,smi,order)
return smi
示例2: get_clique_mol
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFragmentToSmiles [as 别名]
def get_clique_mol(mol, atoms):
smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)
new_mol = Chem.MolFromSmiles(smiles, sanitize=False)
new_mol = copy_edit_mol(new_mol).GetMol()
new_mol = sanitize(new_mol)
#if tmp_mol is not None: new_mol = tmp_mol
return new_mol
示例3: get_clique_mol
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFragmentToSmiles [as 别名]
def get_clique_mol(mol, atoms):
smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)
new_mol = Chem.MolFromSmiles(smiles, sanitize=False)
new_mol = copy_edit_mol(new_mol).GetMol()
new_mol = sanitize(new_mol) #We assume this is not None
return new_mol
示例4: get_frag_around_tetrahedral_center
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFragmentToSmiles [as 别名]
def get_frag_around_tetrahedral_center(mol, idx):
'''Builds a MolFragment using neighbors of a tetrahedral atom,
where the molecule has already been updated to include isotopes'''
ids_to_include = [idx]
for neighbor in mol.GetAtomWithIdx(idx).GetNeighbors():
ids_to_include.append(neighbor.GetIdx())
symbols = ['[{}{}]'.format(a.GetIsotope(), a.GetSymbol()) if a.GetIsotope() != 0\
else '[#{}]'.format(a.GetAtomicNum()) for a in mol.GetAtoms()]
return Chem.MolFragmentToSmiles(mol, ids_to_include, isomericSmiles=True,
atomSymbols=symbols, allBondsExplicit=True,
allHsExplicit=True)
示例5: get_clique_mol
# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFragmentToSmiles [as 别名]
def get_clique_mol(mol: Chem.rdchem.Mol, atoms: List[int]) -> Chem.rdchem.Mol:
smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)
new_mol = Chem.MolFromSmiles(smiles, sanitize=False)
new_mol = copy_edit_mol(new_mol).GetMol()
new_mol = sanitize(new_mol) # We assume this is not None
return new_mol