Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 11 additions & 7 deletions docs/examples_single_analysis/enrichment_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"source": [
"# Enrichment analysis\n",
"requires\n",
"- some cluster of proteins/genes (e.g. up- and downregulated proteins/genes)\n",
"- some cluster of proteins/genes (e.g. upregulated proteins/genes in a certain condition)\n",
"- functional annotations, i.e. a category summarizing a set of proteins/genes.\n",
"\n",
"You can start with watching Lars Juhl Jensen's brief introduction to enrichment analysis\n",
Expand Down Expand Up @@ -194,8 +194,9 @@
"id": "4bbf5dc4",
"metadata": {},
"source": [
"# ANOVA: Compute up and downregulated genes\n",
"These will be used to find enrichments in the set of both up and downregulated genes."
"# ANOVA: Compute upregulated genes for each condition\n",
"These will be used to find enrichments in the set of both upregulated pathways in\n",
"deceased and alive patients."
]
},
{
Expand Down Expand Up @@ -232,7 +233,11 @@
"metadata": {},
"source": [
"# Download functional annotations, here pathways, for the protein groups\n",
"in our selection of the dataset."
"in our selection of the dataset.\n",
"\n",
"Check the `acore.io.uniprot` module for more details on how to fetch and process\n",
"annotations from UniProt, especially check the link given there on all the available\n",
"fields: [return_fields](https://www.uniprot.org/help/return_fields)"
]
},
{
Expand All @@ -257,7 +262,6 @@
" # cache the annotations\n",
" fname.parent.mkdir(exist_ok=True, parents=True)\n",
" annotations.to_csv(fname, index=True)\n",
"\n",
"annotations"
]
},
Expand Down Expand Up @@ -310,8 +314,8 @@
"metadata": {},
"source": [
"# Enrichment analysis\n",
"Is done separately for up- and downregulated genes as it's assumed that biological\n",
"processes are regulated in one direction."
"Is done separately for upregulated genes in each group as it's assumed that biological\n",
"processes are regulated in one direction together."
]
},
{
Expand Down
11 changes: 6 additions & 5 deletions docs/examples_single_analysis/enrichment_analysis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# %% [markdown]
# # Enrichment analysis
# requires
# - some cluster of proteins/genes (e.g. up- and downregulated proteins/genes)
# - some cluster of proteins/genes (e.g. upregulated proteins/genes in a certain condition)
# - functional annotations, i.e. a category summarizing a set of proteins/genes.
#
# You can start with watching Lars Juhl Jensen's brief introduction to enrichment analysis
Expand Down Expand Up @@ -93,8 +93,9 @@


# %% [markdown]
# # ANOVA: Compute up and downregulated genes
# These will be used to find enrichments in the set of both up and downregulated genes.
# # ANOVA: Compute upregulated genes for each condition
# These will be used to find enrichments in the set of both upregulated pathways in
# deceased and alive patients.

# %%
group = "Status"
Expand Down Expand Up @@ -158,8 +159,8 @@

# %% [markdown]
# # Enrichment analysis
# Is done separately for up- and downregulated genes as it's assumed that biological
# processes are regulated in one direction.
# Is done separately for upregulated genes in each group as it's assumed that biological
# processes are regulated in one direction together.

# %% tags=["hide-input"]
diff_reg.query("rejected")[
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown_ref/acore.enrichment_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ result = run_site_regulation_enrichment(regulation_data,
### run_up_down_regulation_enrichment(regulation_data: DataFrame, annotation: DataFrame, identifier: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'identifier', groups: [list](https://docs.python.org/3/library/stdtypes.html#list)[[str](https://docs.python.org/3/library/stdtypes.html#str)] = ('group1', 'group2'), annotation_col: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'annotation', pval_col: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'pval', group_col: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'group', log2fc_col: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'log2FC', method: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'fisher', min_detected_in_set: [int](https://docs.python.org/3/library/functions.html#int) = 2, correction: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'fdr_bh', correction_alpha: [float](https://docs.python.org/3/library/functions.html#float) = 0.05, lfc_cutoff: [float](https://docs.python.org/3/library/functions.html#float) = 1) → [DataFrame](https://pandera.readthedocs.io/en/stable/reference/generated/pandera.typing.DataFrame.html#pandera.typing.DataFrame)[[EnrichmentAnalysisSchema](acore.types.md#acore.types.enrichment_analysis.EnrichmentAnalysisSchema)]

This function runs a simple enrichment analysis for significantly regulated proteins
distinguishing between up- and down-regulated.
distinguishing between upregulation per group defined by the groups.

* **Parameters:**
* **regulation_data** ([*pandas.DataFrame*](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame)) – pandas.DataFrame resulting from differential regulation
Expand Down
7 changes: 4 additions & 3 deletions example_data/MTBLS13311/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ spray assay. In this study, comparative transcriptomic and energy metabolomic an
showed that the differentially expressed genes and differentially accumulated metabolites
from WRP and rapZE227Stop were mostly enriched in metabolic pathways, mainly in GlcN6P
biosynthesis. Additionally, GlcN6P biosynthesis-related gene expression was significantly
upregulated or downregulated in phage-resistant mutants compared to that in wild type (WT).
Some metabolites involved in GlcN6P metabolic pathways, such as GlcN6P, GlcNAc-6P,
GlcNAc-1P and UDP-GlcNAc were upregulated in phage-resistant mutants. Furthermore,
upregulated or downregulated (upregulated in WT) in phage-resistant mutants compared to
that in wild type (WT). Some metabolites involved in GlcN6P metabolic pathways, such as
GlcN6P, GlcNAc-6P, GlcNAc-1P and UDP-GlcNAc were upregulated in phage-resistant mutants.
Furthermore,
the reduction in LPS content and the resensitization to antibiotics reveal the
important role of the GlcN6P metabolic pathway in RapZ mediated phage resistance.
These results suggest that GlcN6P metabolic pathways play important roles in ETEC
Expand Down
2 changes: 1 addition & 1 deletion example_data/syntethic_pep_enrichment/1_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
print(f"Fisher exact test p-value: {res.pvalue:.4f}")

# %% [markdown]
# We have a population of M peptides of which n are up-regulated (or down-regulated)
# We have a population of M peptides of which n are upregulated in a condition
# defining the foreground.
# We find N peptides in a pathway of interest, of which x are in the foreground.
# - fixed for a certain foreground and background population (constant)
Expand Down
4 changes: 2 additions & 2 deletions src/acore/enrichment_analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def run_up_down_regulation_enrichment(
) -> DataFrame[EnrichmentAnalysisSchema]:
"""
This function runs a simple enrichment analysis for significantly regulated proteins
distinguishing between up- and down-regulated.
distinguishing between upregulation per group defined by the `groups`.

:param pandas.DataFrame regulation_data: pandas.DataFrame resulting from differential regulation
analysis (CKG's regulation table).
Expand Down Expand Up @@ -214,7 +214,7 @@ def run_up_down_regulation_enrichment(

for rej_col, direction in zip(
("up_pairwise_regulation", "down_pairwise_regulation"),
("upregulated", "downregulated"),
(f"upregulated in {g1}", f"upregulated in {g2}"),
):
Comment thread
enryH marked this conversation as resolved.
_enrichment = run_regulation_enrichment(
df,
Expand Down
Loading
Loading