Skip to content

Commit f160609

Browse files
committed
Fixed pytest
1 parent 6f59c78 commit f160609

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def main():
9292
go_protein_pairs,
9393
sample_size,
9494
protein_list,
95-
graph_file_path,
96-
dataset_directory_path,
95+
testing_graph_file_path,
96+
testing_input_directory_path,
9797
output_data_path,
9898
output_image_path,
9999
repeats,

tests/test_pytest.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
from classes.protein_degree_v3_class import ProteinDegreeV3
99
from classes.sample_algorithm import SampleAlgorithm
1010
from classes.base_algorithm_class import BaseAlgorithm
11+
from classes.hypergeometric_distribution_class import HypergeometricDistribution
12+
from classes.hypergeometric_distribution_class_V2 import HypergeometricDistributionV2
13+
1114
from pathlib import Path
12-
from tools.helper import (
13-
read_specific_columns,
14-
import_graph_from_pickle,
15-
)
16-
from tools.workflow import run_workflow
15+
from tools.workflow import run_experiement
1716
import os
1817

1918

20-
2119
def test_algorithm_attributes():
2220
algorithm_classes = {
2321
"OverlappingNeighbors": OverlappingNeighbors,
@@ -26,7 +24,8 @@ def test_algorithm_attributes():
2624
"ProteinDegree": ProteinDegree,
2725
"ProteinDegreeV2": ProteinDegreeV2,
2826
"ProteinDegreeV3": ProteinDegreeV3,
29-
"SampleAlgorithm": SampleAlgorithm,
27+
"HypergeometricDistribution": HypergeometricDistribution,
28+
"HypergeometricDistributionV2": HypergeometricDistributionV2,
3029
}
3130
for algorithm in algorithm_classes:
3231
assert hasattr(algorithm_classes[algorithm](), "y_score")
@@ -41,14 +40,15 @@ def test_algorithm_inherits_class():
4140
"ProteinDegree": ProteinDegree,
4241
"ProteinDegreeV2": ProteinDegreeV2,
4342
"ProteinDegreeV3": ProteinDegreeV3,
44-
"SampleAlgorithm": SampleAlgorithm,
43+
"HypergeometricDistribution": HypergeometricDistribution,
44+
"HypergeometricDistributionV2": HypergeometricDistributionV2,
4545
}
4646

4747
for algorithm in algorithm_classes:
4848
assert issubclass(algorithm_classes[algorithm], BaseAlgorithm)
4949

5050

51-
def test_algorithm_workflow():
51+
def test_algorithm_experiment():
5252
if not os.path.exists("output"):
5353
os.makedirs("output")
5454
if not os.path.exists("output/dataset"):
@@ -70,9 +70,11 @@ def test_algorithm_workflow():
7070
"ProteinDegree": ProteinDegree,
7171
"ProteinDegreeV2": ProteinDegreeV2,
7272
"ProteinDegreeV3": ProteinDegreeV3,
73+
"HypergeometricDistribution": HypergeometricDistribution,
74+
"HypergeometricDistributionV2": HypergeometricDistributionV2,
7375
}
7476

75-
results = run_workflow(
77+
results = run_experiement(
7678
algorithm_classes,
7779
input_directory_path,
7880
graph_file_path,
@@ -88,10 +90,8 @@ def test_algorithm_workflow():
8890
"ProteinDegree": 0.825,
8991
"ProteinDegreeV2": 0.675,
9092
"ProteinDegreeV3": 0.89,
91-
"HypergeometricDistribution": 0.78,
92-
"HypergeometricDistributionV2": 0.89,
93-
"HypergeometricDistributionV3": 0.675,
94-
"HypergeometricDistributionV4": 0.6
93+
"HypergeometricDistribution": 0.76,
94+
"HypergeometricDistributionV2": 0.86,
9595
}
9696

9797
pr_results = {
@@ -101,11 +101,8 @@ def test_algorithm_workflow():
101101
"OverlappingNeighborsV2": 0.7467907092907092,
102102
"ProteinDegreeV2": 0.6367757242757243,
103103
"OverlappingNeighbors": 0.5329058916229968,
104-
"SampleAlgorithm": 0.4093791854859966,
105-
"HypergeometricDistribution": 0.7899246806,
106-
"HypergeometricDistributionV2": 0.8519169719,
107-
"HypergeometricDistributionV3": 0.7142573629,
108-
"HypergeometricDistributionV4": 0.6967847007,
104+
"HypergeometricDistribution": 0.7899246805825753,
105+
"HypergeometricDistributionV2": 0.8519169719169718,
109106
}
110107

111108
for algorithm, metrics in results.items():

tools/workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def run_workflow(
6060
): # Creates a pos/neg list each replicate then runs workflow like normal
6161
print("\n\nReplicate: " + str(i) + "\n")
6262

63-
positive_dataset, negative_dataset = sample_data(
64-
go_protein_pairs, sample_size, protein_list, G, dataset_directory_path
65-
)
63+
# positive_dataset, negative_dataset = sample_data(
64+
# go_protein_pairs, sample_size, protein_list, G, dataset_directory_path
65+
# )
6666

6767
results = run_experiement(
6868
algorithm_classes,

0 commit comments

Comments
 (0)