From a507dbf3f2c04f12f70886c6dddf276fdc37ae82 Mon Sep 17 00:00:00 2001 From: Jake Crawford Date: Tue, 20 Dec 2016 13:42:48 -0700 Subject: [PATCH] added simple test data --- testdata/test_network.ppi | 6 ++++++ testdata/test_seed.txt | 2 ++ walker.py | 12 ++++-------- 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 testdata/test_network.ppi create mode 100644 testdata/test_seed.txt diff --git a/testdata/test_network.ppi b/testdata/test_network.ppi new file mode 100644 index 0000000..7bebbd8 --- /dev/null +++ b/testdata/test_network.ppi @@ -0,0 +1,6 @@ +0 1 .25 +0 2 .25 +1 2 .25 +2 3 .80 +3 4 .85 +1 4 .50 diff --git a/testdata/test_seed.txt b/testdata/test_seed.txt new file mode 100644 index 0000000..0d66ea1 --- /dev/null +++ b/testdata/test_seed.txt @@ -0,0 +1,2 @@ +0 +1 diff --git a/walker.py b/walker.py index 138d7d9..0d3a014 100644 --- a/walker.py +++ b/walker.py @@ -192,15 +192,11 @@ def _build_og(self, original_ppi): # parse network input for line in graph_fp.readlines(): split_line = line.rstrip().split('\t') - if len(split_line) > 2: + if len(split_line) > 3: # assume input graph is in the form of HIPPIE network - try: - edge_list.append((split_line[1], split_line[3], - float(split_line[4]))) - except ValueError: - print line - exit() - elif len(split_line) < 2: + edge_list.append((split_line[1], split_line[3], + float(split_line[4]))) + elif len(split_line) < 3: # assume input graph is a simple edgelist without weights edge_list.append((split_line[0], split_line[1], float(1))) else: