EPAM Indigo Documentation

repository·master·Indexed 19 days ago

https://github.com/epam/indigo

A cheminformatics ecosystem providing core algorithms, search engines (Bingo), and language bindings for Java, Python, .NET, and WASM. Features include the indigo_service REST JSON:API for molecular operations, a WASM module for the Ketcher sketcher, and the Bingo Elastic SDK for chemical similarity and substructure searches in Elasticsearch. Also includes the Bingo PostgreSQL cartridge for database-integrated chemical data processing.

Tokens
45K
Snippets
125
Records
210
Agent score
64%

What's inside EPAM Indigo

  1. Overview of the C++ Indigo API

    master
    The C++ Indigo API is a wrapper built on top of the core Indigo C API. It is designed to mimic the behavior and interface of the Indigo wrappers available for other languages such as Python, Java, and .NET. Currently, its primary use case is for running tests.
  2. Overview of EPAM Indigo projects

    master

    EPAM Indigo is a suite of cheminformatics tools and libraries. The repository contains several distinct projects:

    • Bingo: A chemistry search engine supporting Oracle, Microsoft SQL Server, and PostgreSQL.
    • Bingo-Elastic: APIs for chemistry search in Elasticsearch (available for Java and Python).
    • Indigo: A universal cheminformatics library with bindings for .NET, Java, Python, R, and WebAssembly. It includes several utilities:
      • Legio: GUI for combinatorial chemistry.
      • ChemDiff: Visual comparison of SDF or SMILES files.
      • indigo-depict: Molecule and reaction rendering.
      • indigo-cano: Canonical SMILES generator.
      • indigo-deco: R-Group deconvolution utility.
  3. Explore InChI Software source code and examples

    master

    The third_party/inchi directory contains the source code for the International Chemical Identifier (InChI) software, including the core library, executables, and API examples.

    Developers can find usage examples in the following subdirectories:

    • C API Examples: Located in demos/inchi_main/src, demos/mol2inchi/src, and demos/test_ixa/src. These include projects for MS Visual Studio 2015 (in vc14) and gcc/Linux (in gcc).
    • Python 3 Examples: Located in demos/python_sample.
  4. Use the Indigo WASM module for Ketcher

    master

    The Indigo WASM module provides a subset of the Indigo API compiled to WebAssembly, specifically designed for integration with the Ketcher molecule sketcher. It allows for performing chemical informatics operations directly in the browser or a WASM-compatible environment.

    Supported methods for molecule and reaction manipulation include:

    • aromatize
    • dearomatize
    • layout
    • clean2d
    • convert
    • check
    • calculate
    • render
    • calculateCip
    • automap

    For implementation details and usage patterns, refer to the test.js file in the module directory.

  5. Access the Indigo Service frontend paths

    master

    The Indigo Service frontend is a React application that provides two main functional areas:

    1. /search: Used for molecule searching. It includes a Ketcher window for drawing molecules and supports searching via Bingo-Elastic or Postgres. You can perform exact matches, similarity matches, or submatches.
    2. /libs: Used for library management. This path is password-protected. Once authenticated, you can add or remove libraries and upload .sdf files to existing libraries.
  6. Understand the InChI source code organization

    master

    The InChI software distribution is organized into specific functional areas. Use the following directory structure to locate the components you need:

    • Common Codebase: INCHI-1-SRC/INCHI_BASE/src contains C source files used by both the InChI Library and the inchi-1 executable.
    • Executable Source: INCHI-1-SRC/INCHI_EXE/inchi-1/src contains C source files specific to the inchi-1 executable.
    • API Library Source: INCHI-1-SRC/INCHI_API/libinchi/src contains C source files specific to the InChI Software Library (API).
    • Demos/Examples:
      • demos/inchi_main/src: C source files for the inchi_main demo.
      • demos/mol2inchi/src: C source files for the mol2inchi demo.
      • demos/test_ixa/src: C source files for the test_ixa demo.
      • demos/python_sample: Python 3 source files for the Python demo.
  7. How cppcodec's template-based architecture works

    master

    cppcodec uses a shared template-based implementation to support multiple codecs. This design provides several benefits:

    1. Header-only: Only the codecs you actually include and use in your code are compiled into your binary.
    2. Consistent API: Every codec variant exposes the same set of encode and decode methods, making it easy to switch variants.
    3. Flexible Types: The API supports various input/output types including raw pointers, std::string, and templated character vectors, provided they implement necessary methods like .data(), .size(), .reserve(), and .push_back().
    4. Performance Trade-offs: While highly flexible, the heavy use of templates means debug builds can be significantly slower. For production, always use release or minimum-size builds.
  8. How TinyXML-2 memory management works

    master

    TinyXML-2 uses a Document Object Model (DOM) where an XMLDocument acts as the owner of all nodes.

    • An XMLDocument can be allocated on the stack or the heap.
    • All sub-nodes (e.g., XMLElement, XMLText, etc.) must be created via the appropriate XMLDocument methods, such as XMLDocument::NewElement() or XMLDocument::NewText().
    • Even if you hold pointers to these sub-nodes, they are owned by the XMLDocument. When the XMLDocument is deleted, all contained nodes are also deleted.
  9. Implement high-performance row-level locking with `safe_obj<>` and `contfree_safe_ptr<>`

    master

    For maximum performance in large containers, combine sf::contfree_safe_ptr for the container (table-level locking) with sf::safe_obj<T, Mutex> for individual elements (row-level locking). This pattern allows multiple threads to modify different elements of the same container simultaneously without blocking the entire container.

    #include "safe_ptr.h"
    #include <map>
    
    using namespace sf;
    
    struct field_t { int money, time; };
    // Define a thread-safe object type using a spinlock
    typedef safe_obj<field_t, spinlock_t> safe_obj_field_t;
    
    // A map where the map itself is contention-free, but elements have their own locks
    contfree_safe_ptr< std::map<int, safe_obj_field_t> > safe_map_global;
    
    // Pattern for updating an element:
    // 1. Get a shared lock on the container to find the element
    // 2. Get an exclusive lock on the specific element (row-lock)
    void update_element(int key, int value) {
        auto s_safe_map = slock_safe_ptr(safe_map_global); // S-lock on Table
        auto it = s_safe_map->find(key);
        if (it != s_safe_map->cend()) {
            auto x_field = xlock_safe_ptr(it->second); // X-lock on field
            x_field->money += value;
        }
    }
  10. Run Indigo KNIME tests

    master

    Tests for the Indigo KNIME implementation can be executed using the provided scripts located in the tests/ directory:

    • Linux: Use run-indigo-knime-tests.sh
    • Windows: Use run-indigo-knime-tests.bat

    The tests/workflows/ directory contains the specific test workflows used during this process.

    # Linux
    ./tests/run-indigo-knime-tests.sh
    
    # Windows
    ./tests/run-indigo-knime-tests.bat