Skip to content

Commit

Permalink
Add tinkerxyz reference lookup function
Browse files Browse the repository at this point in the history
  • Loading branch information
jessbade committed Feb 23, 2024
1 parent 63a3929 commit 9094ace
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions isicle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from importlib import resources
import shutil
import tempfile
from ast import literal_eval


def safelist(x):
Expand Down Expand Up @@ -130,6 +131,13 @@ def tinker_lookup():
return pd.read_csv(path, sep="\t")


def tinkerxyz_lookup():
path = resources.files("isicle") / "resources/tinkerxyz_lookup.tsv"
df = pd.read_csv(path, sep="\t", index_col=[0, 1])
df["lookup"] = df["lookup"].apply(lambda x: literal_eval(x))
return df


def gettempdir():
"""
Return the name of the directory used for temporary files.
Expand All @@ -140,16 +148,16 @@ def gettempdir():
Path to temporary directory.
"""
root = os.path.join(tempfile.gettempdir(), 'isicle')

root = os.path.join(tempfile.gettempdir(), "isicle")
os.makedirs(root, exist_ok=True)

return root


def mkdtemp(prefix=None, suffix=None):
"""
An ISiCLE-specific wrapper of :func:`~tempfile.mkdtemp` to create a
An ISiCLE-specific wrapper of :func:`~tempfile.mkdtemp` to create a
temporary directory for temporary ISiCLE files. The temporary directory
is not automatically removed.
Expand Down

0 comments on commit 9094ace

Please sign in to comment.