Source code for schrodinger.application.msv.dependencies

"""
Module for checking what dependencies are currently installed. Should generally
only be used when in DEBUG_MODE (found in msv.utils).
"""

from enum import Enum

from schrodinger.infra.util import enum_speedup
from schrodinger.job.util import hunt

Dependency = enum_speedup(
    Enum('Dependency', ['Prime', 'Clustal', 'Bioluminate']))


def _get_installed_dependencies():
    """
    Returns what dependencies are installed.

    :return: A set of `Dependency` that are installed.
    :rtype: set(Dependency)
    """
    installed_dependencies = set()
    bioluminateInstalled = bool(hunt('bioluminate', dir='data'))
    if bioluminateInstalled:
        installed_dependencies.add(Dependency.Bioluminate)
    try:
        from schrodinger.application.prime.packages import antibody  # noqa: F401
    except ImportError:
        pass
    else:
        installed_dependencies.add(Dependency.Prime)

    # Import here to prevent circular import
    from schrodinger.protein.tasks.clustal import get_clustal_path
    if get_clustal_path():
        installed_dependencies.add(Dependency.Clustal)

    return installed_dependencies


INSTALLED_DEPENDENCIES = _get_installed_dependencies()


[docs]def is_prime_installed(): return Dependency.Prime in INSTALLED_DEPENDENCIES