当前位置: 首页>>代码示例>>Python>>正文


Python Chem.MolFragmentToSmiles方法代码示例

本文整理汇总了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 
开发者ID:rdkit,项目名称:CheTo,代码行数:22,代码来源:utilsFP.py

示例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 
开发者ID:wengong-jin,项目名称:hgraph2graph,代码行数:9,代码来源:chemutils.py

示例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 
开发者ID:dmlc,项目名称:dgl,代码行数:8,代码来源:chemutils.py

示例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) 
开发者ID:Hanjun-Dai,项目名称:GLN,代码行数:13,代码来源:template_extractor.py

示例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 
开发者ID:wengong-jin,项目名称:chemprop,代码行数:9,代码来源:jtnn.py


注:本文中的rdkit.Chem.MolFragmentToSmiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。