forked from Reed-CompBio/spras
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added generate inputs test, cleaned up code
- Loading branch information
Showing
12 changed files
with
97 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Interactor1 Interactor2 Weight | ||
A B 0.98 | ||
B C 0.77 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ID_interactor_A ppi ID_interactor_B | ||
ENSG0A ppi ENSG0B | ||
ENSG0B ppi ENSG0C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
A B 0.98 | ||
B C 0.77 | ||
B A 0.98 | ||
C B 0.77 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
A (pp) B 0.98 | ||
B (pp) C 0.77 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
protein1 protein2 weight directionality | ||
A B 0.98 U | ||
B C 0.77 U |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
protein1 protein2 cost | ||
A B 0.52 | ||
B C 0.73 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Interactor1 Interactor2 Weight | ||
A B 0.98 | ||
B C 0.77 | ||
B A 0.98 | ||
C B 0.77 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import filecmp | ||
import os | ||
import shutil | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
from src import runner | ||
|
||
OUTDIR = "test/PrepareInputs/output/" | ||
EXPDIR = "test/PrepareInputs/expected/" | ||
class TestPrepareInputs: | ||
def setup_class(cls): | ||
""" | ||
Create the expected output directory | ||
""" | ||
Path(OUTDIR).mkdir(parents=True, exist_ok=True) | ||
|
||
def test_prepare_inputs(self): | ||
config_loc = os.path.join("config", "config.yaml") | ||
|
||
with open(config_loc) as config_file: | ||
config = yaml.load(config_file, Loader=yaml.FullLoader) | ||
test_file = "test/PrepareInputs/output/test_pickled_dataset.pkl" | ||
|
||
for dataset in config["datasets"]: | ||
runner.merge_input(dataset, test_file) | ||
|
||
# Test PathLinker | ||
filename_map = {"nodetypes": os.path.join("test","PrepareInputs", "output", "pl-nodetypes.txt"), | ||
"network": os.path.join("test","PrepareInputs", "output", "pl-network.txt")} | ||
runner.prepare_inputs("pathlinker", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'pl-network.txt', EXPDIR + 'pl-network-expected.txt') | ||
|
||
# Test OmicsIntegrator1 | ||
filename_map = {"prizes": os.path.join("test","PrepareInputs", "output", "oi1-prizes.txt"), | ||
"edges": os.path.join("test","PrepareInputs", "output", "oi1-network.txt")} | ||
runner.prepare_inputs("omicsintegrator1", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'oi1-network.txt', EXPDIR + 'oi1-network-expected.txt') | ||
|
||
# Test OmicsIntegrator2 | ||
filename_map = {"prizes": os.path.join("test","PrepareInputs", "output", "oi2-prizes.txt"), | ||
"edges": os.path.join("test","PrepareInputs", "output", "oi2-network.txt")} | ||
runner.prepare_inputs("omicsintegrator2", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'oi2-network.txt', EXPDIR + 'oi2-network-expected.txt') | ||
|
||
# Test MEO | ||
filename_map = {"sources": os.path.join("test","PrepareInputs", "output", "meo-sources.txt"), | ||
"targets": os.path.join("test","PrepareInputs", "output", "meo-targets.txt"), | ||
"edges": os.path.join("test","PrepareInputs", "output", "meo-edges.txt")} | ||
runner.prepare_inputs("meo", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'meo-edges.txt', EXPDIR + 'meo-edges-expected.txt') | ||
|
||
# Test MCF | ||
filename_map = {"sources": os.path.join("test","PrepareInputs", "output", "mcf-sources.txt"), | ||
"targets": os.path.join("test","PrepareInputs", "output", "mcf-targets.txt"), | ||
"edges": os.path.join("test","PrepareInputs", "output", "mcf-edges.txt")} | ||
runner.prepare_inputs("mincostflow", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'mcf-edges.txt', EXPDIR + 'mcf-edges-expected.txt') | ||
|
||
# Test AllPairs | ||
filename_map = {"nodetypes": os.path.join("test","PrepareInputs", "output", "ap-nodetypes.txt"), | ||
"network": os.path.join("test","PrepareInputs", "output", "ap-network.txt")} | ||
runner.prepare_inputs("allpairs", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'ap-network.txt', EXPDIR + 'ap-network-expected.txt') | ||
|
||
# Test Domino | ||
filename_map = {"network": os.path.join("test","PrepareInputs", "output", "d-network.txt"), | ||
"active_genes": os.path.join("test","PrepareInputs", "output", "d-active_genes.txt")} | ||
runner.prepare_inputs("domino", test_file, filename_map) | ||
assert filecmp.cmp(OUTDIR +'d-network.txt', EXPDIR + 'd-network-expected.txt') | ||
|
||
break # only run dataset 0 |
This file was deleted.
Oops, something went wrong.