-
Notifications
You must be signed in to change notification settings - Fork 1
feat: apply multiple testing correction (p-adj) for statistical significance #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hjn0415a
wants to merge
7
commits into
OpenMS:main
Choose a base branch
from
hjn0415a:feature/p-adj
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d8e402d
test commit
hjn0415a 9bf39df
feat: temporal commit
hjn0415a 272924f
feat: integrate GO term analysis into execution method
hjn0415a c1b5bc9
refactor: extract GO enrichment analysis into a separate method
hjn0415a ebeb023
refactor: pass results_dir to _run_go_enrichment to handle output paths
hjn0415a b754582
fix: remove incorrect reassignment of results_dir to input-files
hjn0415a 589965a
feat: upgrade statistical analysis from p-value to p-adj (FDR)
hjn0415a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| from pathlib import Path | ||
| import streamlit as st | ||
| import pandas as pd | ||
| import numpy as np | ||
| import plotly.express as px | ||
|
|
||
| from src.common.common import page_setup | ||
| from src.common.results_helpers import get_abundance_data | ||
|
|
||
| # ================================ | ||
| # Page setup | ||
| # ================================ | ||
| params = page_setup() | ||
| st.title("ProteomicsLFQ Results") | ||
|
|
||
| # ================================ | ||
| # Workspace check | ||
| # ================================ | ||
| if "workspace" not in st.session_state: | ||
| st.warning("Please initialize your workspace first.") | ||
| st.stop() | ||
|
|
||
| # ================================ | ||
| # Load abundance data | ||
| # ================================ | ||
| res = get_abundance_data(st.session_state["workspace"]) | ||
| if res is None: | ||
| st.info( | ||
| "Abundance data not available or incomplete. " | ||
| "Please run the workflow and configure sample groups first." | ||
| ) | ||
| st.stop() | ||
|
|
||
| pivot_df, expr_df, group_map = res | ||
|
|
||
| # ================================ | ||
| # Tabs | ||
| # ================================ | ||
| protein_tab, = st.tabs(["🧬 Protein Table"]) | ||
|
|
||
| # ================================ | ||
| # Protein-level results | ||
| # ================================ | ||
| with protein_tab: | ||
| st.markdown("### 🧬 Protein-Level Abundance Table") | ||
| st.info( | ||
| "This protein-level table is generated by grouping all PSMs that map to the " | ||
| "same protein and aggregating their intensities across samples.\n\n" | ||
| "Additionally, log2 fold change and p-values are calculated between sample groups." | ||
| ) | ||
|
|
||
| if pivot_df.empty: | ||
| st.info("No protein-level data available.") | ||
| else: | ||
| st.session_state["pivot_df"] = pivot_df | ||
| st.dataframe(pivot_df.sort_values("p-value"), use_container_width=True) | ||
|
|
||
| # ====================================================== | ||
| # GO Enrichment Results | ||
| # ====================================================== | ||
| st.markdown("---") | ||
| st.subheader("🧬 GO Enrichment Analysis") | ||
|
|
||
| results_dir = Path(st.session_state["workspace"]) / "topp-workflow" / "results" / "go-terms" | ||
| go_json_file = results_dir / "go_results.json" | ||
|
|
||
| if not go_json_file.exists(): | ||
| st.info("GO Enrichment results are not available yet. Please run the analysis first.") | ||
| else: | ||
| import json | ||
| import plotly.io as pio | ||
|
|
||
| with open(go_json_file, "r") as f: | ||
| go_data = json.load(f) | ||
|
|
||
| bp_tab, cc_tab, mf_tab = st.tabs([ | ||
| "🧬 Biological Process", | ||
| "🏠 Cellular Component", | ||
| "⚙️ Molecular Function", | ||
| ]) | ||
|
|
||
| for tab, go_type in zip([bp_tab, cc_tab, mf_tab], ["BP", "CC", "MF"]): | ||
| with tab: | ||
| if go_type not in go_data: | ||
| st.info(f"No enriched {go_type} terms found.") | ||
| continue | ||
|
|
||
| fig_json = go_data[go_type]["fig_json"] | ||
| df_dict = go_data[go_type]["df_dict"] | ||
|
|
||
| fig = pio.from_json(fig_json) | ||
|
|
||
| df_go = pd.DataFrame(df_dict) | ||
|
|
||
| if df_go.empty: | ||
| st.info(f"No enriched {go_type} terms found.") | ||
| else: | ||
| st.plotly_chart(fig, use_container_width=True) | ||
|
|
||
| st.markdown(f"#### {go_type} Enrichment Results") | ||
| st.dataframe(df_go, use_container_width=True) | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,4 @@ | |
| params = page_setup() | ||
|
|
||
| wf = WorkflowTest() | ||
|
|
||
| wf.show_execution_section() | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorting by
p-valueinstead ofp-adj— inconsistent with the PR's goal.All other result pages (PCA, Volcano) have been migrated to use
p-adj. This page still sorts the protein table by rawp-value.Proposed fix
🤖 Prompt for AI Agents