Webapp data and scripts#77
Open
jaceybronte wants to merge 3 commits into
Open
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
MikeLippincott
approved these changes
Jun 9, 2026
MikeLippincott
left a comment
Member
There was a problem hiding this comment.
LGTM. Ready to merge after addressing comments!
Comment on lines
+13
to
+15
| script_directory = pathlib.Path("../utils/").resolve() | ||
| sys.path.insert(0, str(script_directory)) | ||
| from data_loader import load_model_data, load_train_test_data |
Member
There was a problem hiding this comment.
pointing out package anti-pattern here
Comment on lines
+61
to
+68
|
|
||
| features = combined_df[gene_cols] | ||
|
|
||
|
|
||
| # In[8]: | ||
|
|
||
|
|
||
| features |
Member
There was a problem hiding this comment.
Consider merging these two into one cell and calling "head"
Comment on lines
+74
to
+75
| import random | ||
| import colorsys |
Comment on lines
+77
to
+90
| def generate_random_palette(num_colors, seed=12): | ||
| # Generate random colors with varied lightness and saturation | ||
| random.seed(seed) | ||
|
|
||
| colors = [] | ||
|
|
||
| for _ in range(num_colors): | ||
| h = random.random() # Random hue between 0 and 1 | ||
| l = random.uniform(0.2, 0.8) # Lightness between 0.3 and 0.9 for contrast | ||
| s = random.uniform(0.5, 1.0) # Saturation between 0.6 and 1.0 for vivid colors | ||
| color = colorsys.hls_to_rgb(h, l, s) # Convert HLS to RGB color | ||
| colors.append(color) | ||
|
|
||
| return colors |
Member
There was a problem hiding this comment.
Helper function might live better in the utils file, if not then consider moving to the top.
Add docstrings and type hints also
Comment on lines
+96
to
+99
| import plotly.graph_objects as go | ||
| import plotly.express as px | ||
| from sklearn.decomposition import PCA | ||
| from sklearn.preprocessing import StandardScaler |
|
|
||
|
|
||
| # Step 2: Subset based on matching keys | ||
| subset_keys = ["model", "latent_dim_total", "init", "z"] |
| # In[18]: | ||
|
|
||
|
|
||
| def generate_random_palette(num_colors, seed=12): |
Member
There was a problem hiding this comment.
consider moving to top, adding type hints and adding docstrings
| # In[19]: | ||
|
|
||
|
|
||
| def make_dropdown_pca_with_selection(df, title="PCA Interactive Plot"): |
| out = widgets.Output() # Create a fresh output for this plot! | ||
|
|
||
| # Prepare PCA input | ||
| pca_input = df.drop(columns=["OncotreePrimaryDisease", "source", "ModelID"], errors="ignore").fillna(0) |
Member
There was a problem hiding this comment.
fillna with - might not be the correct strategy here? TBD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This has all of the data that should be necessary for the webapp, as well as a few shiny PCAs and the code for that.