From 37e9e397133d5dbf5f857f90a03769e9e6ee1ceb Mon Sep 17 00:00:00 2001 From: amnorman Date: Tue, 11 Jun 2024 11:34:38 -0700 Subject: [PATCH] Update pytest for hypergeometric distribution ROC and PR values --- .ipynb_checkpoints/main-checkpoint.py | 14 ++++++++++---- main.py | 3 ++- tests/test_pytest.py | 8 ++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.ipynb_checkpoints/main-checkpoint.py b/.ipynb_checkpoints/main-checkpoint.py index ca7cc9b..6ce19f6 100644 --- a/.ipynb_checkpoints/main-checkpoint.py +++ b/.ipynb_checkpoints/main-checkpoint.py @@ -9,6 +9,7 @@ from classes.hypergeometric_distribution_class_V2 import HypergeometricDistributionV2 from classes.hypergeometric_distribution_class_V3 import HypergeometricDistributionV3 from classes.hypergeometric_distribution_class_V4 import HypergeometricDistributionV4 + import matplotlib.pyplot as plt from random import sample from pathlib import Path @@ -45,6 +46,11 @@ def main(): graph_file_path = Path(dataset_directory_path, "graph.pickle") sample_size = 1000 + testing_output_data_path = Path("./output/data/") + testing_output_image_path = Path("./output/images/") + testing_input_directory_path = Path("./tests/testing-dataset/") + testing_graph_file_path = Path(testing_input_directory_path, "graph.pickle") + interactome_columns = [0, 1, 4, 5] interactome = read_specific_columns(interactome_path, interactome_columns, "\t") @@ -81,10 +87,10 @@ def main(): results = run_workflow( algorithm_classes, - dataset_directory_path, - graph_file_path, - output_data_path, - output_image_path, + testing_input_directory_path, + testing_graph_file_path, + testing_output_data_path, + testing_output_image_path, True, True, ) diff --git a/main.py b/main.py index 0419d29..6ce19f6 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ from classes.hypergeometric_distribution_class_V2 import HypergeometricDistributionV2 from classes.hypergeometric_distribution_class_V3 import HypergeometricDistributionV3 from classes.hypergeometric_distribution_class_V4 import HypergeometricDistributionV4 + import matplotlib.pyplot as plt from random import sample from pathlib import Path @@ -49,7 +50,7 @@ def main(): testing_output_image_path = Path("./output/images/") testing_input_directory_path = Path("./tests/testing-dataset/") testing_graph_file_path = Path(testing_input_directory_path, "graph.pickle") - + interactome_columns = [0, 1, 4, 5] interactome = read_specific_columns(interactome_path, interactome_columns, "\t") diff --git a/tests/test_pytest.py b/tests/test_pytest.py index 20acc85..75a0e8e 100644 --- a/tests/test_pytest.py +++ b/tests/test_pytest.py @@ -77,6 +77,10 @@ def test_algorithm_workflow(): "ProteinDegree": 0.825, "ProteinDegreeV2": 0.675, "ProteinDegreeV3": 0.89, + "HypergeometricDistribution": 0.78, + "HypergeometricDistributionV2": 0.89, + "HypergeometricDistributionV3": 0.675, + "HypergeometricDistributionV4": 0.6 } pr_results = { @@ -87,6 +91,10 @@ def test_algorithm_workflow(): "ProteinDegreeV2": 0.6367757242757243, "OverlappingNeighbors": 0.5329058916229968, "SampleAlgorithm": 0.4093791854859966, + "HypergeometricDistribution": 0.7899246806, + "HypergeometricDistributionV2": 0.8519169719, + "HypergeometricDistributionV3": 0.7142573629, + "HypergeometricDistributionV4": 0.6967847007, } for algorithm, metrics in results.items():