From 32bd0e68375c00faed8698358f0ce907d3559c09 Mon Sep 17 00:00:00 2001 From: ntalluri Date: Wed, 24 Jan 2024 16:52:44 -0600 Subject: [PATCH 1/2] update mcf wrapper code --- spras/mincostflow.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/spras/mincostflow.py b/spras/mincostflow.py index e3c75708..744db736 100644 --- a/spras/mincostflow.py +++ b/spras/mincostflow.py @@ -53,11 +53,8 @@ def generate_inputs(data, filename_map): # create the network of edges edges = data.get_interactome() - # Format network edges - edges = convert_undirected_to_directed(edges) - # creates the edges files that contains the head and tail nodes and the weights after them - edges.to_csv(filename_map['edges'], sep='\t', index=False, columns=["Interactor1", "Interactor2", "Weight"], + edges.to_csv(filename_map['edges'], sep='\t', index=False, columns=["Interactor1", "Interactor2", "Weight", "Direction"], header=False) @staticmethod @@ -152,8 +149,5 @@ def parse_output(raw_pathway_file, standardized_pathway_file): df = pd.read_csv(raw_pathway_file, sep='\t', header=None) df = add_rank_column(df) - # TODO update MinCostFlow version to support mixed graphs - # Currently directed edges in the input will be converted to undirected edges in the output - df = reinsert_direction_col_undirected(df) - df.to_csv(standardized_pathway_file, header=False, index=False, sep='\t') + df.to_csv(standardized_pathway_file, header=True, index=False, sep='\t') From a9d68691c701e2efd0344e18dc59ebd85c727e8e Mon Sep 17 00:00:00 2001 From: ntalluri Date: Mon, 24 Jun 2024 11:33:19 -0500 Subject: [PATCH 2/2] update SPRAS mcf to use versioned image --- .github/workflows/test-spras.yml | 4 ++-- docker-wrappers/MinCostFlow/README.md | 4 ++++ spras/mincostflow.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-spras.yml b/.github/workflows/test-spras.yml index 3dc2ab85..a5db25f1 100644 --- a/.github/workflows/test-spras.yml +++ b/.github/workflows/test-spras.yml @@ -80,7 +80,7 @@ jobs: docker pull reedcompbio/omics-integrator-2:v2 docker pull reedcompbio/pathlinker:latest docker pull reedcompbio/meo:latest - docker pull reedcompbio/mincostflow:latest + docker pull reedcompbio/mincostflow:v2 docker pull reedcompbio/allpairs:latest docker pull reedcompbio/domino:latest - name: Build Omics Integrator 1 Docker image @@ -125,7 +125,7 @@ jobs: path: docker-wrappers/MinCostFlow/. dockerfile: docker-wrappers/MinCostFlow/Dockerfile repository: reedcompbio/mincostflow - tags: latest + tags: v2 cache_froms: reedcompbio/mincostflow:latest push: false - name: Build All Pairs Shortest Paths Docker image diff --git a/docker-wrappers/MinCostFlow/README.md b/docker-wrappers/MinCostFlow/README.md index 014a3d75..5d585eea 100644 --- a/docker-wrappers/MinCostFlow/README.md +++ b/docker-wrappers/MinCostFlow/README.md @@ -36,3 +36,7 @@ docker run -w /data --mount type=bind,source=/${PWD},target=/data reedcompbio/mi This will run MinCostFlow on the test input files and write the output files to the root of the `spras` repository. Windows users may need to escape the absolute paths so that `/data` becomes `//data`, etc. + +## Versions +- v1: Initial version. Handles undirected edges only. +- v2: Updated to handle both directed and undirected edges. \ No newline at end of file diff --git a/spras/mincostflow.py b/spras/mincostflow.py index 744db736..25790526 100644 --- a/spras/mincostflow.py +++ b/spras/mincostflow.py @@ -111,7 +111,7 @@ def run(sources=None, targets=None, edges=None, output_file=None, flow=None, cap command.extend(['--capacity', str(capacity)]) # choosing to run in docker or singularity container - container_suffix = "mincostflow" + container_suffix = "mincostflow:v2" # constructs a docker run call out = run_container(container_framework,