Skip to content

Conversation

@ntalluri
Copy link
Collaborator

@ntalluri ntalluri commented Oct 30, 2025

Adding the code for the edge specific visualization function for the PCA chosen pathways. Closes #374

  • add in test cases / fix node test cases
  • update the docstrings
  • fix the visualization spacing

@ntalluri ntalluri added analysis Analysis of PRA outputs needed for benchmarking Priority PRs needed for the benchmarking paper labels Oct 30, 2025
@read-the-docs-community
Copy link

read-the-docs-community bot commented Oct 30, 2025

Documentation build overview

📚 spras | 🛠️ Build #30577429 | 📁 Comparing e3c69d7 against latest (24fe346)


🔍 Preview build

Show files changed (5 files in total): 📝 5 modified | ➕ 0 added | ➖ 0 deleted
File Status
genindex.html 📝 modified
fordevs/modules.html 📝 modified
fordevs/spras.analysis.html 📝 modified
fordevs/spras.config.html 📝 modified
fordevs/spras.html 📝 modified

@ntalluri ntalluri requested a review from agitter November 7, 2025 21:25
Copy link
Collaborator

@tristan-f-r tristan-f-r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@agitter agitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left initial comments and have not run it locally yet. The pre-commit check test is failing.

edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-not-provided_edges.png')
edge_output_png.unlink(missing_ok=True)

file_paths = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a minute to remember what is "not provided" in these node and edge test cases. Adding a single line docstring or a comment to these empty file paths would help with that.

Comment on lines +120 to +122
node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.txt')
node_output_file.unlink(missing_ok=True)
node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.png')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.txt')
node_output_file.unlink(missing_ok=True)
node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_nodes.png')
node_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-nodes.txt')
node_output_file.unlink(missing_ok=True)
node_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-nodes.png')

Comment on lines +144 to +146
edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.txt')
edge_output_file.unlink(missing_ok=True)
edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.png')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.txt')
edge_output_file.unlink(missing_ok=True)
edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen_edges.png')
edge_output_file = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-edges.txt')
edge_output_file.unlink(missing_ok=True)
edge_output_png = Path(OUT_DIR + 'pr-per-pathway-pca-chosen-edges.png')

Comment on lines +265 to +273
all_edges_mixed = y_true_mixed.union(y_pred)
y_true_mixed_binary = [1 if edge in y_true_mixed else 0 for edge in all_edges_mixed]
y_pred_mixed_binary = [1 if edge in y_pred else 0 for edge in all_edges_mixed]
# default to 0.0 if there is a divide by 0 error
# not using precision_recall_curve because thresholds are binary (0 or 1); rather we are directly
# calculating precision and recall per pathway
precision_mixed = precision_score(y_true_mixed_binary, y_pred_mixed_binary, zero_division=0.0)
recall_mixed = recall_score(y_true_mixed_binary, y_pred_mixed_binary, zero_division=0.0)
results.append({'Pathway': f, 'Precision': precision_mixed, 'Recall': recall_mixed, 'Gold_Standard_Type': "mixed"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block is repeated three times, right? Is there a way to reuse the same code three times and keep it this readable, or does it become harder to follow the logic? I do value the readability.


else:
title = "PCA-Chosen Pathway Across All Algorithms Precision and Recall Plot"
if aggregate_per_algorithm :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if aggregate_per_algorithm :
if aggregate_per_algorithm:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

analysis Analysis of PRA outputs needed for benchmarking Priority PRs needed for the benchmarking paper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update evaluation code to include edge evaluation

3 participants