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

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入门

 

from indigo import *

indigo = Indigo()

获取版本

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

 

Accessing Neighbor Atoms

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

 

Accessing R-Groups

for rg in mol.iterateRGroups():
  print ("RGROUP #" + rg.index())
  for frag in rg.iterateRGroupFragments():
     print ("  FRAGMENT #" + rg.index())
     print (frag.molfile())

Indigo | Indigo(Python)简介、安装与入门_第1张图片

 

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.
IndigoObject mol = indigo.loadMolecule("chiral.mol");

print mol.countStereocenters(), "chiral atoms"
for atom in mol.iterateStereocenters():
   print "atom", atom.index(), "-- stereocenter type", atom.stereocenterType()
   atom.invertStereo();

for bond in mol.iterateBonds():
   if bond.bondStereo() != 0:
     print "bond", bond.index(), "-- stereo type", bond.bondStereo()

print mol.smiles()
mol.clearStereocenters()
mol.clearCisTrans()
print mol.smiles()

 

Reaction Products Enumeration

reaction = indigo.loadQueryReaction("Cl[C:1]([*:3])=O.[OH:2][*:4]>>[*:4][O:2][C:1]([*:3])=O")

monomers_table = indigo.createArray()

monomers_table.arrayAdd(indigo.createArray())
monomers_table.at(0).arrayAdd(indigo.loadMolecule("CC(Cl)=O"))
monomers_table.at(0).arrayAdd(indigo.loadMolecule("OC1CCC(CC1)C(Cl)=O"))

monomers_table.arrayAdd(indigo.createArray())
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"))

output_reactions = indigo.reactionProductEnumerate(reaction, monomers_table)

indigo.setOption("render-comment", "Results")
rxn_array = indigo.createArray();
for elem in output_reactions.iterateArray():
    rxn = elem.clone();
    rxn_array.arrayAdd(rxn)

indigoRenderer.renderGridToFile(rxn_array, None, 2, 'result_rpe.png')

 

Reaction-based Molecule Transformations

reaction = indigo.loadQueryReaction("[*+:1][*-:2]>>[*:2]=[*:1]")
molecule = indigo.loadMolecule("[O-][C+]1CCCC1[N+]([O-])=O")
indigo.transform(reaction, molecule)
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

 

你可能感兴趣的:(化学信息学,Indigo)