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

简介: 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())

image.png

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')


image.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月前
|
SQL 关系型数据库 数据库
Python SQLAlchemy模块:从入门到实战的数据库操作指南
免费提供Python+PyCharm编程环境,结合SQLAlchemy ORM框架详解数据库开发。涵盖连接配置、模型定义、CRUD操作、事务控制及Alembic迁移工具,以电商订单系统为例,深入讲解高并发场景下的性能优化与最佳实践,助你高效构建数据驱动应用。
259 7
|
2月前
|
测试技术 开发者 Python
Python单元测试入门:3个核心断言方法,帮你快速定位代码bug
本文介绍Python单元测试基础,详解`unittest`框架中的三大核心断言方法:`assertEqual`验证值相等,`assertTrue`和`assertFalse`判断条件真假。通过实例演示其用法,帮助开发者自动化检测代码逻辑,提升测试效率与可靠性。
310 1
|
2月前
|
人工智能 数据安全/隐私保护 异构计算
桌面版exe安装和Python命令行安装2种方法详细讲解图片去水印AI源码私有化部署Lama-Cleaner安装使用方法-优雅草卓伊凡
桌面版exe安装和Python命令行安装2种方法详细讲解图片去水印AI源码私有化部署Lama-Cleaner安装使用方法-优雅草卓伊凡
374 8
桌面版exe安装和Python命令行安装2种方法详细讲解图片去水印AI源码私有化部署Lama-Cleaner安装使用方法-优雅草卓伊凡
|
1月前
|
Cloud Native 算法 API
Python API接口实战指南:从入门到精通
🌟蒋星熠Jaxonic,技术宇宙的星际旅人。深耕API开发,以Python为舟,探索RESTful、GraphQL等接口奥秘。擅长requests、aiohttp实战,专注性能优化与架构设计,用代码连接万物,谱写极客诗篇。
Python API接口实战指南:从入门到精通
|
1月前
|
存储 Java 调度
Python定时任务实战:APScheduler从入门到精通
APScheduler是Python强大的定时任务框架,通过触发器、执行器、任务存储和调度器四大组件,灵活实现各类周期性任务。支持内存、数据库、Redis等持久化存储,适用于Web集成、数据抓取、邮件发送等场景,解决传统sleep循环的诸多缺陷,助力构建稳定可靠的自动化系统。(238字)
444 1
|
2月前
|
调度 数据库 Python
Python异步编程入门:asyncio让并发变得更简单
Python异步编程入门:asyncio让并发变得更简单
177 5
|
2月前
|
数据采集 存储 XML
Python爬虫入门(1)
在互联网时代,数据成为宝贵资源,Python凭借简洁语法和丰富库支持,成为编写网络爬虫的首选。本文介绍Python爬虫基础,涵盖请求发送、内容解析、数据存储等核心环节,并提供环境配置及实战示例,助你快速入门并掌握数据抓取技巧。
|
2月前
|
大数据 数据处理 数据安全/隐私保护
Python3 迭代器与生成器详解:从入门到实践
简介:本文深入解析Python中处理数据序列的利器——迭代器与生成器。通过通俗语言与实战案例,讲解其核心原理、自定义实现及大数据处理中的高效应用。
152 0
|
2月前
|
存储 缓存 安全
Python字典:从入门到精通的实用指南
Python字典如瑞士军刀般强大,以键值对实现高效数据存储与查找,广泛应用于配置管理、缓存、统计等场景。本文详解字典基础、进阶技巧、实战应用与常见陷阱,助你掌握这一核心数据结构,写出更高效、优雅的Python代码。
82 0
|
3月前
|
数据挖掘 数据处理 C++
Python Lambda:从入门到实战的轻量级函数指南
本文通过10个典型场景,详解Python中Lambda匿名函数的用法。Lambda适用于数据处理、排序、条件筛选、事件绑定等简洁逻辑,能提升代码简洁性和开发效率。同时提醒避免在复杂逻辑中过度使用。掌握Lambda,助你写出更高效的Python代码。
201 0

推荐镜像

更多