Indigo | Indigo(Python)简介、安装与入门

举报
DrugAI 发表于 2021/07/15 02:17:17 2021/07/15
【摘要】 Indigo简介 Bingo: 针对Oracle,Microsoft SQL Server和PostgreSQL数据库的化学搜索引擎Indigo: U具有与.NET,Java和Python绑定的通用化学信息库,以及以下工具:Legio: 组合化学GUI应用程序ChemDiff: SDF或SMILES文件的可视化比较indigo-depict: 分子和反应渲染工具indigo...

Indigo简介

  • Bingo: 针对Oracle,Microsoft SQL Server和PostgreSQL数据库的化学搜索引擎
  • Indigo: U具有与.NET,Java和Python绑定的通用化学信息库,以及以下工具:
  • Legio: 组合化学GUI应用程序
  • ChemDiff: SDF或SMILES文件的可视化比较
  • indigo-depict: 分子和反应渲染工具
  • indigo-cano: Canonical SMILES 生成器
  • indigo-deco: R-Group反卷积实用程序

 

Indigo安装

Indigo的Python绑定安装

pip install epam.indigo
 

 

Indigo入门

 


  
  1. from indigo import *
  2. indigo = Indigo()

获取版本

print ("Indigo version " + indigo.version())
 

 

Accessing Neighbor Atoms


  
  1. for atom in mol.iterateAtoms():
  2. print ("atom %d: %d neighbors" % (atom.index(), atom.degree()))
  3. for nei in atom.iterateNeighbors():
  4. print ("neighbor atom %d is connected by bond %d\n" % (nei.index(), nei.bond().index()))

 

Accessing R-Groups


  
  1. for rg in mol.iterateRGroups():
  2. print ("RGROUP #" + rg.index())
  3. for frag in rg.iterateRGroupFragments():
  4. print (" FRAGMENT #" + rg.index())
  5. print (frag.molfile())

 

Stereochemistry

The following methods of IndigoObject are available for accessing molecule’s stereo configuration:

  • countStereocenters returns the number of the chiral atoms in a molecule
  • iterateStereocenters returns an iterator for molecule’s atoms that are stereocenters
  • countAlleneCenters returns the number of allene-like stereo fragments
  • iterateAlleneCenters returns an iterator for molecule’s atoms that are centers of allene fragments (the middle ‘C’ in ‘C=C=C’)
  • bondStereo returns one of the following constants:
    • Indigo.UP — stereo “up” bond
    • Indigo.DOWN — stereo “down” bond
    • Indigo.EITHER — stereo “either” bond
    • Indigo.CIS — “Cis” double bond
    • Indigo.TRANS — “Trans” double bond
    • zero — not a stereo bond of any kind
  • stereocenterType returns one of the following constants:
    • Indigo.ABS — “absolute” stereocenter
    • Indigo.OR — “or” stereocenter
    • Indigo.AND — “and” stereocenter
    • Indigo.EITHER — “any” stereocenter
    • zero — not a stereocenter
  • invertStereo inverts the stereo configuration of an atom
  • resetStereo resets the stereo configuration of an atom or a bond
  • changeStereocenterType(newType) changes current stereocenter type to a specified type
  • addStereocenter(type, idx1, idx2, idx3, [idx4]) adds new stereocenter build on a atom pyramid with a specified atom indices
  • clearStereocenters resets the chiral configurations of a molecule’s atoms
  • clearAlleneCenters resets the chiral configurations of a molecule’s allene-like fragments
  • clearCisTrans resets the cis-trans configurations of a molecule’s bonds

The following methods are useful for keeping cis-trans stereochemistry intact when converting to/from SMILES:

  • resetSymmetricCisTrans can be called on a molecule loaded from a Molfile or CML. After this call, the cis-trans configurations remain only on nonsymmetric cis-trans bonds. The method returns the number of bonds that have been reset.
  • markEitherCisTrans can be called prior to saving a molecule loaded from SMILES to Molfile format. It guarantees that the bonds that have no cis-trans configuration in SMILES will not have a cis-trans configuration in the resulting Molfile.

  
  1. IndigoObject mol = indigo.loadMolecule("chiral.mol");
  2. print mol.countStereocenters(), "chiral atoms"
  3. for atom in mol.iterateStereocenters():
  4. print "atom", atom.index(), "-- stereocenter type", atom.stereocenterType()
  5. atom.invertStereo();
  6. for bond in mol.iterateBonds():
  7. if bond.bondStereo() != 0:
  8. print "bond", bond.index(), "-- stereo type", bond.bondStereo()
  9. print mol.smiles()
  10. mol.clearStereocenters()
  11. mol.clearCisTrans()
  12. print mol.smiles()

 

Reaction Products Enumeration


  
  1. reaction = indigo.loadQueryReaction("Cl[C:1]([*:3])=O.[OH:2][*:4]>>[*:4][O:2][C:1]([*:3])=O")
  2. monomers_table = indigo.createArray()
  3. monomers_table.arrayAdd(indigo.createArray())
  4. monomers_table.at(0).arrayAdd(indigo.loadMolecule("CC(Cl)=O"))
  5. monomers_table.at(0).arrayAdd(indigo.loadMolecule("OC1CCC(CC1)C(Cl)=O"))
  6. monomers_table.arrayAdd(indigo.createArray())
  7. monomers_table.at(1).arrayAdd(indigo.loadMolecule("O[C@H]1[C@H](O)[C@@H](O)[C@H](O)[C@@H](O)[C@@H]1O"))
  8. output_reactions = indigo.reactionProductEnumerate(reaction, monomers_table)
  9. indigo.setOption("render-comment", "Results")
  10. rxn_array = indigo.createArray();
  11. for elem in output_reactions.iterateArray():
  12. rxn = elem.clone();
  13. rxn_array.arrayAdd(rxn)
  14. indigoRenderer.renderGridToFile(rxn_array, None, 2, 'result_rpe.png')

 

Reaction-based Molecule Transformations


  
  1. reaction = indigo.loadQueryReaction("[*+:1][*-:2]>>[*:2]=[*:1]")
  2. molecule = indigo.loadMolecule("[O-][C+]1CCCC1[N+]([O-])=O")
  3. indigo.transform(reaction, molecule)
  4. print(molecule.smiles())

运行结果 

O=N(C1CCCC1=O)=O
 

 


参考

1. https://github.com/epam/Indigo

2. https://lifescience.opensource.epam.com/

3. https://pypi.org/project/epam.indigo/

4. https://lifescience.opensource.epam.com/indigo/api/index.html

 

文章来源: drugai.blog.csdn.net,作者:DrugAI,版权归原作者所有,如需转载,请联系作者。

原文链接:drugai.blog.csdn.net/article/details/103662058

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。