當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。