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

Dummy node logic #187

Merged
merged 23 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions config/egfr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ algorithms:
- 0.1
mu:
- 0.008
dummy_mode: ["file"]
-
name: omicsintegrator2
params:
Expand Down
23 changes: 3 additions & 20 deletions input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ All other columns specify additional node attributes such as prizes.
Any nodes that are listed in a node file but are not present in one or more edges in the edge file will be removed.
For example:
```
NODEID prize sources targets active
A 1.0 True True
B 3.3 True True
NODEID prize sources targets dummy
sumedhars marked this conversation as resolved.
Show resolved Hide resolved
A 1.0 True True True
B 3.3 True True
C 2.5 True True
D 1.9 True True True
```
Expand All @@ -26,23 +26,6 @@ There are 4 dummy mode possibilities:
4. file -> custom nodes - connect the dummy node to a specific list of nodes provided in a file
To support the `file` dummy node logic as part of OmicsIntegrator1, you can either add a seperate `dummy.txt` file (and add this to the `node_files` argument in `config.yaml `) or add a `dummy` column node attribute to a file that contains `NODEID`, `prize`, `source`, etc.

If adding a seperate `dummy.txt` file:
Make a file with the name `dummy.txt` and list the dummy nodes, each seperated by a new line. Example:
```
A
B
C
```

If adding the `dummy` column node attribute, then add the dummy column and specify boolean values for the `dummy` attribute:
```
NODEID prize sources targets dummy
A 1.0 True True True
B 3.3 True True
C 2.5 True True
D 1.9 True True True
```

A secondary format provides only a list of node identifiers and uses the filename as the node attribute, as in the example `sources.txt`.
This format may be deprecated.

Expand Down
9 changes: 5 additions & 4 deletions spras/omicsintegrator1.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ def run(edges=None, prizes=None, dummy_nodes=None, dummy_mode=None, mu_squared=N
# 4. file -> custom nodes - connect the dummy node to a specific list of nodes provided in a file

# add dummy node file to the volume if dummy_mode is not None and it is 'file'
if dummy_mode is not None and dummy_mode == 'file':
# needs to use dummy node file that was put in the dataset
bind_path, dummy_file = prepare_volume(dummy_nodes, work_dir)
volumes.append(bind_path)
if dummy_mode == 'file':
if dummy_nodes is None:
raise ValueError("dummy_nodes file is required when dummy_mode is set to 'file'")
bind_path, dummy_file = prepare_volume(dummy_nodes, work_dir)
volumes.append(bind_path)

out_dir = Path(output_file).parent
# Omics Integrator 1 requires that the output directory exist
Expand Down
Loading