Skip to content

Commit

Permalink
updated more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fratajcz committed Sep 26, 2024
1 parent 8b877fd commit 7226f11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
4 changes: 4 additions & 0 deletions speos/tests/files/dummy_graph/dummy_other_label.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
HGNC
BEND7
POTEF
AADAC
3 changes: 3 additions & 0 deletions speos/tests/files/dummy_graph/dummy_other_label_ensembl.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ENSG00000114771
ENSG00000196604
ENSG00000165626
26 changes: 13 additions & 13 deletions speos/tests/test_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import logging

logging.disable()
#logging.disable()

class GWASMapperTest(unittest.TestCase):

Expand Down Expand Up @@ -286,19 +286,19 @@ def setUp(self):
self.adjacencymapper = AdjacencyMapper(mapping_file=self.config.input.adjacency_mappings)

def test_single_adjacency(self):
gwasmappings = self.gwasmapper.get_mappings(tags="immune_dysregulation", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="BioPlex 3-0 293T", fields="name")
gwasmappings = self.gwasmapper.get_mappings(tags="dummy", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="DummyUndirectedGraph", fields="name")

preprocessor = PreProcessor(self.config, gwasmappings, adjacencies)
X, y, adj = preprocessor.get_data()
self.assertEqual(adj[adjacencies[0]["name"]].shape[1], 168892)
self.assertEqual(adj[adjacencies[0]["name"]].shape[1], 12)

gwasmappings = self.gwasmapper.get_mappings(tags="immune_dysregulation", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="hetionet_regulates", fields="name")
gwasmappings = self.gwasmapper.get_mappings(tags="dummy", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="DummyDirectedGraph", fields="name")

preprocessor = PreProcessor(self.config, gwasmappings, adjacencies)
X, y, adj = preprocessor.get_data()
self.assertEqual(adj[adjacencies[0]["name"]].shape[1], 242512)
self.assertEqual(adj[adjacencies[0]["name"]].shape[1], 6)

def test_two_adjacencies(self):
gwasmappings = self.gwasmapper.get_mappings(tags="dummy", fields="name")
Expand Down Expand Up @@ -482,8 +482,8 @@ def test_xswap_uneven_rows(self):
self.assertAlmostEqual(is_identical/len(adjacency), 1 - (10/11))

def test_xswap_runs_real_data(self):
gwasmappings = self.gwasmapper.get_mappings(tags="immune_dysregulation", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="BioPlex 3.0 293T", fields="name")
gwasmappings = self.gwasmapper.get_mappings(tags="dummy", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="DummyUndirectedGraph", fields="name")
config = self.config.deepcopy()
preprocessor = PreProcessor(config, gwasmappings, adjacencies)
X, y, adj = preprocessor.get_data()
Expand All @@ -499,8 +499,8 @@ def test_xswap_runs_real_data(self):
adj2 = list(adj2.values())[0]

def test_metrics(self):
gwasmappings = self.gwasmapper.get_mappings(tags="immune_dysregulation", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="BioPlex 3.0 293T", fields="name")
gwasmappings = self.gwasmapper.get_mappings(tags="dummy", fields="name")
adjacencies = self.adjacencymapper.get_mappings(tags="DummyUndirectedGraph", fields="name")
preprocessor = PreProcessor(self.config, gwasmappings, adjacencies)
preprocessor.build_graph()

Expand Down Expand Up @@ -639,7 +639,7 @@ def test_label_extension(self):
"match_type": "perfect",
"significant": "True",
"function": "test_preprocess_labels",
"args": ["./speos/tests/files/dummy_graph/labels.tsv"],
"args": ["./speos/tests/files/dummy_graph/dummy_other_label.tsv"],
"kwargs": {}
}]

Expand All @@ -663,7 +663,7 @@ def test_label_extension_other_symbol(self):
"match_type": "perfect",
"significant": "True",
"function": "test_preprocess_labels",
"args": ["./speos/tests/files/dummy_graph/labels_ensembl.tsv"],
"args": ["./speos/tests/files/dummy_graph/dummy_other_label_ensembl.tsv"],
"kwargs": {},
"symbol": "ensembl"}]

Expand Down

0 comments on commit 7226f11

Please sign in to comment.