Skip to content

Commit

Permalink
Added to workflow function to create and save pos/neg data for each r…
Browse files Browse the repository at this point in the history
…epitition and remove any pos/neg files not being used. Can either give files to run as repititions or generate all new pos/neg files.
  • Loading branch information
amnorman committed Jun 20, 2024
1 parent 67043d6 commit 3115af3
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 26 deletions.
3 changes: 2 additions & 1 deletion classes/hypergeometric_distribution_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
"""
Uses a Hypergeometric distribution to calculate a confidence value for the relationship between a protein of
Expand All @@ -54,7 +55,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)

i = 1
Expand Down
3 changes: 2 additions & 1 deletion classes/hypergeometric_distribution_class_V2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
"""
Uses a Hypergeometric distribution to calculate a confidence value for the relationship between a protein of
Expand All @@ -54,7 +55,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)

i = 1
Expand Down
3 changes: 2 additions & 1 deletion classes/overlapping_neighbors_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
"""
evaluate overlapping neighbors method on a protein protein interaction network with go term annotation.
Expand All @@ -53,7 +54,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)
i = 1
for positive_protein, positive_go, negative_protein, negative_go in zip(
Expand Down
3 changes: 2 additions & 1 deletion classes/overlapping_neighbors_v2_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
"""
evaluate overlapping neighbors method on a protein protein interaction network with go term annotation.
Expand All @@ -50,7 +51,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)

G = import_graph_from_pickle(graph_file_path)
i = 1
Expand Down
3 changes: 2 additions & 1 deletion classes/overlapping_neighbors_v3_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
"""
evaluate overlapping neighbors method on a protein protein interaction network with go term annotation.
Expand All @@ -51,7 +52,7 @@ def predict(
}
i = 1

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)

for positive_protein, positive_go, negative_protein, negative_go in zip(
Expand Down
3 changes: 2 additions & 1 deletion classes/protein_degree_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
colorama_init()
data = {
Expand All @@ -41,7 +42,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)

i = 1
Expand Down
3 changes: 2 additions & 1 deletion classes/protein_degree_v2_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
data = {
"protein": [],
Expand All @@ -44,7 +45,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)
i = 1
for positive_protein, positive_go, negative_protein, negative_go in zip(
Expand Down
3 changes: 2 additions & 1 deletion classes/protein_degree_v3_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def predict(
input_directory_path,
graph_file_path,
output_path,
rep_num,
):
data = {
"protein": [],
Expand All @@ -45,7 +46,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)
i = 1
for positive_protein, positive_go, negative_protein, negative_go in zip(
Expand Down
3 changes: 2 additions & 1 deletion classes/sample_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def predict(
input_directory_path,
graph_file_path,
output_data_directory,
rep_num,
):
"""
evaluate a random approach method on a protein protein interaction network with go term annotation.
Expand All @@ -44,7 +45,7 @@ def predict(
"true_label": [],
}

positive_dataset, negative_dataset = get_datasets(input_directory_path)
positive_dataset, negative_dataset = get_datasets(input_directory_path, rep_num)
G = import_graph_from_pickle(graph_file_path)

i = 1
Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def main():
dataset_directory_path = Path("./output/dataset")
graph_file_path = Path(dataset_directory_path, "graph.pickle")
sample_size = 1000
repeats = 5
new_random_lists = False

testing_output_data_path = Path("./output/data/")
testing_output_image_path = Path("./output/images/")
Expand Down Expand Up @@ -85,8 +87,6 @@ def main():
"HypergeometricDistributionV2": HypergeometricDistributionV2,
}

repeats = 20

run_workflow(
algorithm_classes,
go_protein_pairs,
Expand All @@ -97,6 +97,7 @@ def main():
output_data_path,
output_image_path,
repeats,
new_random_lists,
)

sys.exit()
Expand Down
Loading

0 comments on commit 3115af3

Please sign in to comment.