21 __all__=[
'CharList',
'Correl',
'FileLogSink',
'FloatList',
'FloatMatrix',
'FloatMatrix3',
'FloatMatrix4',
'GetCurrentLogSink',
'GetPrefixPath',
'GetSharedDataPath',
'GetVerbosityLevel',
'Histogram',
'IntList',
'LogDebug',
'LogError',
'LogInfo',
'LogScript',
'LogSink',
'LogTrace',
'LogVerbose',
'LogWarning',
'Max',
'Mean',
'Median',
'Min',
'MultiLogSink',
'PopLogSink',
'PopVerbosityLevel',
'PushLogSink',
'PushVerbosityLevel',
'Range',
'SetPrefixPath',
'StdDev',
'StreamLogSink',
'StringList',
'StringLogSink',
'Units',
'VERSION',
'VERSION_MAJOR',
'VERSION_MINOR',
'VERSION_PATCH',
'conop',
'geom',
'io',
'mol',
'seq',
'stutil' ,
'gui',
'gfx',
'img',
'info']
23 from ._ost_base
import *
27 __version__ = _ost_base.VERSION
29 class StreamLogSink(LogSink):
31 LogSink.__init__(self)
34 self.
_stream_stream.write(message)
37 def _GetPrefixFromPythonPath():
38 """Get the prefix from this file's path"""
39 prefix_path = __file__
41 prefix_path = os.path.dirname(prefix_path)
45 def _SetupOstPrefix():
46 """ This function attempts to set the OST prefix path if $OST_ROOT was not
49 It does so by assuming that the __init__.py file is located under
50 $OST_ROOT/lib(64)?/pythonX.XX/site-packages/ost. This might not be the case
51 in all settings (conda, pip?). In that case this function should be
61 prefix_path = _GetPrefixFromPythonPath()
65 def _TrySetCompoundsLib(path):
66 """Tries to set the compound lib to 'path', or raises a ValueError."""
67 if path
is not None and os.path.exists(path):
68 compound_lib = conop.CompoundLib.Load(path)
69 if compound_lib
is not None:
70 conop.SetDefaultLib(compound_lib)
72 raise ValueError(
"Could not load %s" % path)
75 def _SetupCompoundsLib():
76 """ This function sets up the compound lib.
78 By order of priority, the following heuristics are used:
80 1. The $OST_COMPOUNDS_CHEMLIB environment variable
81 2. The 'compounds.chemlib' file in the shared path under the folder pointed
82 by the $OST_ROOT environment variable
83 3. The 'compounds.chemlib' file in the shared path under the OST prefix where
84 the ost python module is installed.
86 If no compound library can be loaded with any of these strategies, a warning
91 compound_lib_path = os.getenv(
"OST_COMPOUNDS_CHEMLIB")
93 compound_lib = conop.CompoundLib.Load(compound_lib_path)
94 if compound_lib
is None:
95 raise RuntimeError(
"Could not load $OST_COMPOUNDS_CHEMLIB as a compound "
96 "library: '%s'." % compound_lib_path)
98 conop.SetDefaultLib(compound_lib)
104 _TrySetCompoundsLib(compound_lib_path)
105 except (RuntimeError, ValueError):
114 prefix_path = _GetPrefixFromPythonPath()
117 _TrySetCompoundsLib(compound_lib_path)
118 except (RuntimeError, ValueError):
124 LogWarning(
"$OST_ROOT is pointing to an invalid OST prefix: '%s'" % (
125 os.getenv(
"OST_ROOT")))
128 LogWarning(
"Compound library not available. Some functionality may not " \
virtual void LogMessage(const String &message, int severity)
def __init__(self, stream)
def PushVerbosityLevel(value)
void DLLEXPORT_OST_BASE SetPrefixPath(const String &prefix)
set path prefix
String DLLEXPORT_OST_BASE GetSharedDataPath()
String DLLEXPORT_OST_BASE GetPrefixPath()
get the path prefix