Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
968bd09
precommit
ntalluri Aug 14, 2025
7202a99
updating the baseline
ntalluri Aug 19, 2025
1b3be75
make it all input nodes, not the intersection between gold standard a…
ntalluri Aug 19, 2025
8ca0e9e
update to be the baseline with gold standard intersection, added data…
ntalluri Aug 20, 2025
dda6264
debugging error in test cases
ntalluri Aug 20, 2025
d8a16fc
fix input-nodes file with tristan's update
ntalluri Aug 21, 2025
7f3c7f6
update test case
ntalluri Aug 21, 2025
8492f70
clean up code and outputs
ntalluri Aug 22, 2025
9b8e31c
update to use input nodes and interactome from the snakefile instead …
ntalluri Aug 22, 2025
04ddc1f
update test cases
ntalluri Aug 22, 2025
e98d1e2
removed unnecessary code
ntalluri Aug 22, 2025
5e10e95
Merge branch 'main' of github.com:ntalluri/spras into new-baseline
ntalluri Aug 25, 2025
2004c9a
update code to use helper function for input nodes
ntalluri Aug 25, 2025
82fbfce
update test case to use new helper function
ntalluri Aug 25, 2025
dcab781
update comment
ntalluri Aug 25, 2025
a57ef19
fix space formatting
ntalluri Aug 26, 2025
58b4e04
make config back to what it was
ntalluri Apr 30, 2026
7eca4a0
Merge branch 'main' of github.com:Reed-CompBio/spras
ntalluri May 11, 2026
cadcae7
Merge branch 'main' of github.com:Reed-CompBio/spras
ntalluri Jun 8, 2026
9da6aed
Merge branch 'main' of github.com:Reed-CompBio/spras
ntalluri Jun 25, 2026
6c9e57c
Merge branch 'main' of github.com:Reed-CompBio/spras
ntalluri Jul 6, 2026
2136cd5
merge main
ntalluri Jul 6, 2026
7325833
another merge
ntalluri Jul 6, 2026
c9845dd
Apply suggestions from code review
ntalluri Jul 6, 2026
0aef46e
remove interesting terminology
ntalluri Jul 6, 2026
f7d9828
draft of baselines
ntalluri Jul 7, 2026
1aa6a9c
add the new baseline
ntalluri Jul 8, 2026
8ee40ba
changes
ntalluri Jul 9, 2026
363628c
Merge branch 'main' of github.com:Reed-CompBio/spras
ntalluri Jul 9, 2026
c645053
Merge branch 'main' of github.com:ntalluri/spras into new-baseline
ntalluri Jul 9, 2026
b2a642b
revert configs
ntalluri Jul 9, 2026
0c70db3
clean up the code
ntalluri Jul 9, 2026
b7b12d5
updated the test cases, fixed minor bug
ntalluri Jul 9, 2026
9929f19
fix test cases
ntalluri Jul 9, 2026
441498b
revert g parameter
ntalluri Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,17 @@ def get_gold_standard_pickle_file(wildcards):
gs = parts[1]
return SEP.join([out_dir, f'gs-{gs}-merged.pickle'])

# Return the dataset pickle file for a specific dataset
def get_dataset_pickle_file(wildcards):
dataset_label = get_dataset_label(wildcards)
return SEP.join([out_dir, f'dataset-{dataset_label}-merged.pickle'])

# Returns the dataset corresponding to the gold standard pair
def get_dataset_label(wildcards):
parts = wildcards.dataset_gold_standard_pair.split('-')
dataset = parts[0]
return dataset


# Returns all pathways for a specific dataset
def collect_pathways_per_dataset(wildcards):
dataset_label = get_dataset_label(wildcards)
Expand All @@ -446,14 +450,16 @@ def collect_pathways_per_dataset(wildcards):
rule evaluation_pr_per_pathways:
input:
node_gold_standard_file = get_gold_standard_pickle_file,
dataset_file = get_dataset_pickle_file,
pathways = collect_pathways_per_dataset
output:
node_pr_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', "pr-per-pathway-nodes.txt"]),
node_pr_png = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-per-pathway-nodes.png']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
pr_df = Evaluation.node_precision_and_recall(input.pathways, node_table)
Evaluation.precision_and_recall_per_pathway(pr_df, output.node_pr_file, output.node_pr_png)
Evaluation.precision_and_recall_per_pathway(pr_df, input_nodes, node_table, output.node_pr_file, output.node_pr_png)

# Returns all pathways for a specific algorithm and dataset
def collect_pathways_per_algo_per_dataset(wildcards):
Expand All @@ -465,14 +471,16 @@ def collect_pathways_per_algo_per_dataset(wildcards):
rule evaluation_per_algo_pr_per_pathways:
input:
node_gold_standard_file = get_gold_standard_pickle_file,
dataset_file = get_dataset_pickle_file,
pathways = collect_pathways_per_algo_per_dataset,
output:
node_pr_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', "pr-per-pathway-for-{algorithm}-nodes.txt"]),
node_pr_png = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-per-pathway-for-{algorithm}-nodes.png']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
pr_df = Evaluation.node_precision_and_recall(input.pathways, node_table)
Evaluation.precision_and_recall_per_pathway(pr_df, output.node_pr_file, output.node_pr_png, include_aggregate_algo_eval)
Evaluation.precision_and_recall_per_pathway(pr_df, input_nodes, node_table, output.node_pr_file, output.node_pr_png, include_aggregate_algo_eval)

# Return pathway summary file per dataset
def collect_summary_statistics_per_dataset(wildcards):
Expand All @@ -490,16 +498,18 @@ def collect_pca_coordinates_per_dataset(wildcards):
rule evaluation_pca_chosen:
input:
node_gold_standard_file = get_gold_standard_pickle_file,
dataset_file = get_dataset_pickle_file,
pca_coordinates_file = collect_pca_coordinates_per_dataset,
pathway_summary_file = collect_summary_statistics_per_dataset
output:
node_pca_chosen_pr_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-pca-chosen-pathway-nodes.txt']),
node_pca_chosen_pr_png = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-pca-chosen-pathway-nodes.png']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
pca_chosen_pathway = Evaluation.pca_chosen_pathway(input.pca_coordinates_file, input.pathway_summary_file, out_dir)
pr_df = Evaluation.node_precision_and_recall(pca_chosen_pathway, node_table)
Evaluation.precision_and_recall_pca_chosen_pathway(pr_df, output.node_pca_chosen_pr_file, output.node_pca_chosen_pr_png)
Evaluation.precision_and_recall_pca_chosen_pathway(pr_df, input_nodes, node_table, output.node_pca_chosen_pr_file, output.node_pca_chosen_pr_png)

# Returns pca coordinates for a specific algorithm and dataset
def collect_pca_coordinates_per_algo_per_dataset(wildcards):
Expand All @@ -511,21 +521,18 @@ def collect_pca_coordinates_per_algo_per_dataset(wildcards):
rule evaluation_per_algo_pca_chosen:
input:
node_gold_standard_file = get_gold_standard_pickle_file,
dataset_file = get_dataset_pickle_file,
pca_coordinates_file = collect_pca_coordinates_per_algo_per_dataset,
pathway_summary_file = collect_summary_statistics_per_dataset
output:
node_pca_chosen_pr_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-pca-chosen-pathway-per-algorithm-nodes.txt']),
node_pca_chosen_pr_png = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-pca-chosen-pathway-per-algorithm-nodes.png']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
pca_chosen_pathways = Evaluation.pca_chosen_pathway(input.pca_coordinates_file, input.pathway_summary_file, out_dir)
pr_df = Evaluation.node_precision_and_recall(pca_chosen_pathways, node_table)
Evaluation.precision_and_recall_pca_chosen_pathway(pr_df, output.node_pca_chosen_pr_file, output.node_pca_chosen_pr_png, include_aggregate_algo_eval)

# Return the dataset pickle file for a specific dataset
def get_dataset_pickle_file(wildcards):
dataset_label = get_dataset_label(wildcards)
return SEP.join([out_dir, f'dataset-{dataset_label}-merged.pickle'])
Evaluation.precision_and_recall_pca_chosen_pathway(pr_df, input_nodes, node_table, output.node_pca_chosen_pr_file, output.node_pca_chosen_pr_png, include_aggregate_algo_eval)

# Returns ensemble file for each dataset
def collect_ensemble_per_dataset(wildcards):
Expand All @@ -543,8 +550,9 @@ rule evaluation_ensemble_pr_curve:
node_pr_curve_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-curve-ensemble-nodes.txt']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
node_ensemble_dict = Evaluation.edge_frequency_node_ensemble(node_table, input.ensemble_file, input.dataset_file)
Evaluation.precision_recall_curve_node_ensemble(node_ensemble_dict, node_table, output.node_pr_curve_png, output.node_pr_curve_file)
Evaluation.precision_recall_curve_node_ensemble(node_ensemble_dict, node_table, input_nodes, output.node_pr_curve_png, output.node_pr_curve_file)

# Returns list of algorithm specific ensemble files per dataset
def collect_ensemble_per_algo_per_dataset(wildcards):
Expand All @@ -562,8 +570,9 @@ rule evaluation_per_algo_ensemble_pr_curve:
node_pr_curve_file = SEP.join([out_dir, '{dataset_gold_standard_pair}-eval', 'pr-curve-ensemble-nodes-per-algorithm-nodes.txt']),
run:
node_table = Evaluation.from_file(input.node_gold_standard_file).node_table
node_ensembles_dict = Evaluation.edge_frequency_node_ensemble(node_table, input.ensemble_files, input.dataset_file)
Evaluation.precision_recall_curve_node_ensemble(node_ensembles_dict, node_table, output.node_pr_curve_png, output.node_pr_curve_file, include_aggregate_algo_eval)
input_nodes = Dataset.from_file(input.dataset_file).get_input_nodes()
node_ensembles_dict= Evaluation.edge_frequency_node_ensemble(node_table, input.ensemble_files, input.dataset_file)
Evaluation.precision_recall_curve_node_ensemble(node_ensembles_dict, node_table, input_nodes, output.node_pr_curve_png, output.node_pr_curve_file, include_aggregate_algo_eval)

rule evaluation_edge_dummy:
input:
Expand Down
9 changes: 9 additions & 0 deletions spras/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@ def contains_node_columns(self, col_names: list[str] | str):
return False
return True

def get_input_nodes(self) -> pd.DataFrame:
"""
Returns: a table listing the input nodes considered as starting points for pathway reconstruction algorithms,
restricted to nodes that have at least one of the specified attributes.
Comment thread
ntalluri marked this conversation as resolved.
"""
input_node_columns = ["sources", "targets", "prize", "active"] # TODO: do we want to add dummy nodes?
input_nodes = Dataset.get_node_columns(self, col_names = input_node_columns)
return input_nodes

def get_other_files(self):
return self.other_files.copy()

Expand Down
Loading
Loading