Source code for promod3
# enable access to loop and modelling via "import promod3"
import promod3.core
import promod3.sidechain
import promod3.loop
import promod3.scoring
import promod3.modelling
# load compounds library
# That way we do not need to call our scripts with the OST starter and are more
# flexible.
import os
import ost
from ost import conop
from ost import io
[docs]def SetCompoundsChemlib(path_to_chemlib="/users/staff/bioz/taurielg/GT/Code/ost/build/stage/share/openstructure/compounds.chemlib"):
"""SetCompoundsChemlib(path_to_chemlib)
Load a compounds library. Does not return anything, the library is just
enabled globally.
:param path_to_chemlib: Points to the file to be loaded.
:type path_to_chemlib: :class:`str`
"""
if not path_to_chemlib or not os.path.exists(path_to_chemlib):
raise RuntimeError("Invalid path to chemlib '" + str(path_to_chemlib)
+ "' specified!\nA compounds library must either be "
+ "set at compile-time ('compounds.chemlib' file in "
+ "$OST_ROOT/share or below) or set in OST with "
+ "ost.conop.SetDefaultLib before importing any "
+ "promod3 module!")
compound_lib_path = path_to_chemlib
compound_lib = conop.CompoundLib.Load(compound_lib_path)
conop.SetDefaultLib(compound_lib)
io.profiles['DEFAULT'].processor = conop.RuleBasedProcessor(compound_lib)
def GetProMod3SharedDataPath():
"""Get path to the shared data folder. Used for binaries.
Returns None if not set.
"""
return os.getenv("PROMOD3_SHARED_DATA_PATH")
def SetProMod3SharedDataPath(path):
"""Set path to the shared data folder. Used for binaries."""
os.environ["PROMOD3_SHARED_DATA_PATH"] = path
# check if we already have an OST PrefixPath
try:
ost.GetSharedDataPath()
except RuntimeError, rt_err:
ost.SetPrefixPath("/users/staff/bioz/taurielg/GT/Code/ost/build/stage")
except:
raise
# check if we do have a compounds library
if not conop.GetDefaultLib():
SetCompoundsChemlib()
# ensure that PROMOD3_SHARED_DATA_PATH env. var. set and override if needed
if GetProMod3SharedDataPath() is None:
# module_path = PROMOD3_ROOT/lib64/python2.7/site-packages/promod3
module_path = os.path.dirname(os.path.abspath(__file__))
# get PROMOD3_ROOT
promod3_lib = os.path.dirname(os.path.dirname(os.path.dirname(module_path)))
promod3_root = os.path.dirname(promod3_lib)
SetProMod3SharedDataPath(os.path.join(promod3_root, "share", "promod3"))
# set version
__version__ = "1.1.0"
__version_extended__ = "1.1.0 (release-1.1|ed199a7)"
__all__ = ('SetCompoundsChemlib', 'GetProMod3SharedDataPath',
'SetProMod3SharedDataPath')
# LocalWords: OST os ost conop io SetCompoundsChemlib CHEMLIB param chemlib
# LocalWords: str SetDefaultLib RuleBasedProcessor PrefixPath RuntimeError
# LocalWords: GetSharedDataPath SetPrefixPath GetDefaultLib