-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull_reactome_cache.sh
More file actions
executable file
·47 lines (40 loc) · 1.52 KB
/
Copy pathpull_reactome_cache.sh
File metadata and controls
executable file
·47 lines (40 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# pre-stage the Reactome cache gpath2vec needs.
set -euo pipefail
CACHE_DIR="${1:-$HOME/.gpath2vec/cache}"
PYTHON="${PYTHON:-python}"
mkdir -p "$CACHE_DIR"
# resolve to an absolute path so the env var is unambiguous on other nodes
CACHE_DIR="$(cd "$CACHE_DIR" && pwd)"
export GPATH2VEC_REACTOME_DIR="$CACHE_DIR"
echo "interpreter : $("$PYTHON" -c 'import sys; print(sys.executable)')"
echo "cache dir : $CACHE_DIR"
echo "warming Reactome cache (requires internet)..."
"$PYTHON" - <<'PY'
# call the package's real fetchers; each populates one cached file.
from gpath2vec import ea, net, utils
steps = [
("ReactomePathways.gmt.zip", ea.gene_mappings),
("ehld/svgsummary.txt", ea.ehld_stids),
("homo_sapiens.sbgn.tar.gz", ea.sbgn_stids),
("ReactomePathwaysRelation.txt", net.fetch_human_hierarchy),
("ReactomePathways.txt", utils.pathway_name_mappings),
("events_hierarchy_9606.json", lambda: utils.get_event_hierarchy("9606")),
("pathway parent mappings", utils.pathway_parent_mappings),
]
for label, fn in steps:
print(f" fetching: {label} ...", flush=True)
fn()
print("all package fetchers completed.")
PY
echo
echo "cache contents:"
ls -la "$CACHE_DIR"
if [ -z "$(ls -A "$CACHE_DIR" 2>/dev/null)" ]; then
echo "ERROR: cache dir is empty after warm-up" >&2
exit 1
fi
echo
echo "done. on the compute node either:"
echo " export GPATH2VEC_REACTOME_DIR='$CACHE_DIR'"
echo " # or pass --reactome-dir '$CACHE_DIR' to gpath2vec niche-pipeline"