Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MCF Wrapper Code #144

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-spras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
docker pull reedcompbio/omics-integrator-2:v2
docker pull reedcompbio/pathlinker:v2
docker pull reedcompbio/meo:latest
docker pull reedcompbio/mincostflow:latest
docker pull reedcompbio/mincostflow:v2
docker pull reedcompbio/allpairs:v2
docker pull reedcompbio/domino:latest
docker pull reedcompbio/py4cytoscape:v2
Expand Down Expand Up @@ -126,7 +126,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
Expand Down
4 changes: 4 additions & 0 deletions docker-wrappers/MinCostFlow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
12 changes: 3 additions & 9 deletions spras/mincostflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,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,
Expand Down Expand Up @@ -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')

Loading