Skip to content
Merged
26 changes: 26 additions & 0 deletions docker-wrappers/OmicsIntegrator2/0001-disable-graph-exports.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 5dc0e69fa3d1049ae8e1d8f51859335910245ad7 Mon Sep 17 00:00:00 2001
From: "Tristan F.-R." <pub.tristanf@gmail.com>
Date: Mon, 26 May 2025 09:52:34 -0700
Subject: [PATCH] fix: disable graph exports

this allows OI2 to work offline; plus, SPRAS already has graph visualizers.
---
src/__main__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/__main__.py b/src/__main__.py
index 49ef402..b7afbca 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -80,7 +80,7 @@ def main():
forest, augmented_forest = graph.output_forest_as_networkx(vertex_indices, edge_indices)

#oi.output_networkx_graph_as_graphml_for_cytoscape(augmented_forest, args.output_dir)
- oi.output_networkx_graph_as_interactive_html(augmented_forest, args.output_dir, args.filename+'.html')
+ # oi.output_networkx_graph_as_interactive_html(augmented_forest, args.output_dir, args.filename+'.html')
augmented_forest_df = oi.get_networkx_graph_as_dataframe_of_edges(augmented_forest)
output_dataframe_to_tsv(augmented_forest_df, args.output_dir, args.filename+'.tsv')

--
2.47.0

9 changes: 9 additions & 0 deletions docker-wrappers/OmicsIntegrator2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
# https://github.com/fraenkel-lab/OmicsIntegrator2
FROM continuumio/miniconda3:4.9.2

COPY 0001-disable-graph-exports.patch .
Comment thread
tristan-f-r marked this conversation as resolved.

RUN git clone https://github.com/agitter/OmicsIntegrator2 && \
Comment thread
tristan-f-r marked this conversation as resolved.
cd OmicsIntegrator2 && \
git reset --hard 568f170eae388e42e923c478ac9f3308b487760b && \
git config user.email "email@example.com" && \
git config user.name "Non-existent User" && \
Comment thread
tristan-f-r marked this conversation as resolved.
git am /0001-disable-graph-exports.patch

COPY environment.yml .
RUN conda env update --name base --file environment.yml --prune
2 changes: 1 addition & 1 deletion docker-wrappers/OmicsIntegrator2/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dependencies:
- pcst_fast==1.0.7
- goenrich==1.7.0
- axial==0.1.10
- git+https://github.com/agitter/OmicsIntegrator2@568f170eae388e42e923c478ac9f3308b487760b
- git+file:///OmicsIntegrator2
6 changes: 4 additions & 2 deletions spras/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def prepare_dsub_cmd(flags: dict):
# run_container_singularity assumes a single string
# Follow docker-py's naming conventions (https://docker-py.readthedocs.io/en/stable/containers.html)
# Technically the argument is an image, not a container, but we use container here.
def run_container(framework: str, container_suffix: str, command: List[str], volumes: List[Tuple[PurePath, PurePath]], working_dir: str, environment: str = 'SPRAS=True'):
def run_container(framework: str, container_suffix: str, command: List[str], volumes: List[Tuple[PurePath, PurePath]], working_dir: str, environment: str = 'SPRAS=True', network_disabled=False):
"""
Runs a command in the container using Singularity or Docker
@param framework: singularity or docker
Expand All @@ -134,6 +134,7 @@ def run_container(framework: str, container_suffix: str, command: List[str], vol
@param volumes: a list of volumes to mount where each item is a (source, destination) tuple
@param working_dir: the working directory in the container
@param environment: environment variables to set in the container
@param network_disabled: Disables the network on the container. Only works for docker for now. This acts as a 'runtime assertion' that a container works w/o networking.
@return: output from Singularity execute or Docker run
"""
normalized_framework = framework.casefold()
Expand All @@ -150,7 +151,7 @@ def run_container(framework: str, container_suffix: str, command: List[str], vol


# TODO any issue with creating a new client each time inside this function?
def run_container_docker(container: str, command: List[str], volumes: List[Tuple[PurePath, PurePath]], working_dir: str, environment: str = 'SPRAS=True'):
def run_container_docker(container: str, command: List[str], volumes: List[Tuple[PurePath, PurePath]], working_dir: str, environment: str = 'SPRAS=True', network_disabled=False):
"""
Runs a command in the container using Docker.
Attempts to automatically correct file owner and group for new files created by the container, setting them to the
Expand Down Expand Up @@ -189,6 +190,7 @@ def run_container_docker(container: str, command: List[str], volumes: List[Tuple
stderr=True,
volumes=bind_paths,
working_dir=working_dir,
network_disabled=network_disabled,
environment=[environment]).decode('utf-8')

# TODO does this cleanup need to still run even if there was an error in the above run command?
Expand Down
3 changes: 2 additions & 1 deletion spras/omicsintegrator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def run(edges=None, prizes=None, output_file=None, w=None, b=None, g=None, noise
container_suffix,
command,
volumes,
work_dir)
work_dir,
network_disabled=True)
Comment thread
tristan-f-r marked this conversation as resolved.
Outdated
print(out)

# TODO do we want to retain other output files?
Expand Down
Loading