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
21 changes: 21 additions & 0 deletions docs/examples_single_analysis/diff_regulation_ancova.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"import pandas as pd\n",
"import sklearn.impute\n",
"import vuecore.plots.basic.scatter\n",
"from vuecore.interactive import get_differential_regulation_plot\n",
"\n",
"import acore.differential_regulation as ad\n",
"\n",
Expand Down Expand Up @@ -350,6 +351,26 @@
")\n",
"scatter_plot_adv"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0fdb7bd6",
"metadata": {},
"outputs": [],
"source": [
"get_differential_regulation_plot(\n",
" data=ancova,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1af558dc",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 8 additions & 0 deletions docs/examples_single_analysis/diff_regulation_ancova.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import pandas as pd
import sklearn.impute
import vuecore.plots.basic.scatter
from vuecore.interactive import get_differential_regulation_plot

import acore.differential_regulation as ad

Expand Down Expand Up @@ -193,3 +194,10 @@
height=600,
)
scatter_plot_adv

# %%
get_differential_regulation_plot(
data=ancova,
)

# %%
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"source": [
"import dsp_pandas\n",
"import pandas as pd\n",
"import vuecore.plots.basic.scatter\n",
"import vuecore.interactive\n",
"\n",
"import acore.differential_regulation as ad\n",
"\n",
Expand Down Expand Up @@ -315,7 +315,9 @@
{
"cell_type": "markdown",
"id": "5fb1bebd",
"metadata": {},
"metadata": {
"lines_to_next_cell": 2
},
"source": [
"## View Volcano plot for the ANOVA results\n",
"- p-value (unadjusted) using the -log10 transformation on the y-axis, using\n",
Expand All @@ -332,33 +334,14 @@
"cell_type": "code",
"execution_count": null,
"id": "37085bf1",
"metadata": {},
"metadata": {
"lines_to_next_cell": 0
},
"outputs": [],
"source": [
"scatter_plot_adv = vuecore.plots.basic.scatter.create_scatter_plot(\n",
" data=anova.reset_index(),\n",
" x=\"log2FC\",\n",
" y=\"-log10 pvalue\",\n",
" color=\"rejected\",\n",
" title=\"Simple Volcano Plot\",\n",
" subtitle=\"Visualizing ANOVA results\",\n",
" labels={\n",
" \"log2FC\": \"Log2 Fold Change\",\n",
" \"-log10 pvalue\": \"-log10(p-value)\",\n",
" \"rejected\": \"FDR corrected Significant\",\n",
" \"identifier\": \"Protein Identifier\",\n",
" },\n",
" hover_data=[\"identifier\"],\n",
" # currently does not work:\n",
" # color_discrete_map={False: \"#2166AC\", True: \"#B2182B\"}, # Blue # Red\n",
" color_discrete_sequence=[\"red\", \"blue\"],\n",
" opacity=1,\n",
" marker_line_width=1,\n",
" marker_line_color=\"darkgray\",\n",
" width=800,\n",
" height=600,\n",
")\n",
"scatter_plot_adv"
"vuecore.interactive.get_differential_regulation_plot(\n",
" data=anova,\n",
")"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# %% tags=["hide-input"]
import dsp_pandas
import pandas as pd
import vuecore.plots.basic.scatter
import vuecore.interactive

import acore.differential_regulation as ad

Expand Down Expand Up @@ -167,31 +167,10 @@
# which is True for significant features and False for non-significant features, and
# is calculated based on the `padj` column and a significance threshold (default 0.05)


# %%
scatter_plot_adv = vuecore.plots.basic.scatter.create_scatter_plot(
data=anova.reset_index(),
x="log2FC",
y="-log10 pvalue",
color="rejected",
title="Simple Volcano Plot",
subtitle="Visualizing ANOVA results",
labels={
"log2FC": "Log2 Fold Change",
"-log10 pvalue": "-log10(p-value)",
"rejected": "FDR corrected Significant",
"identifier": "Protein Identifier",
},
hover_data=["identifier"],
# currently does not work:
# color_discrete_map={False: "#2166AC", True: "#B2182B"}, # Blue # Red
color_discrete_sequence=["red", "blue"],
opacity=1,
marker_line_width=1,
marker_line_color="darkgray",
width=800,
height=600,
vuecore.interactive.get_differential_regulation_plot(
data=anova,
)
scatter_plot_adv

# %% [markdown]
# Done.
4 changes: 2 additions & 2 deletions docs/markdown_ref/acore.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@
* [`AncovaSchema.posthoc_comparison`](acore.types.md#acore.types.differential_analysis.AncovaSchema.posthoc_comparison)
* [`AncovaSchema.t_statistics`](acore.types.md#acore.types.differential_analysis.AncovaSchema.t_statistics)
* [`AncovaSchema.posthoc_pvalue`](acore.types.md#acore.types.differential_analysis.AncovaSchema.posthoc_pvalue)
* [`AncovaSchema.f_statistics`](acore.types.md#acore.types.differential_analysis.AncovaSchema.f_statistics)
* [`AncovaSchema.posthoc_padj`](acore.types.md#acore.types.differential_analysis.AncovaSchema.posthoc_padj)
* [`AncovaSchema.posthoc_rejected`](acore.types.md#acore.types.differential_analysis.AncovaSchema.posthoc_rejected)
* [`AncovaSchema.coef`](acore.types.md#acore.types.differential_analysis.AncovaSchema.coef)
* [`AncovaSchema.std_err`](acore.types.md#acore.types.differential_analysis.AncovaSchema.std_err)
* [`AncovaSchema.conf_int_low`](acore.types.md#acore.types.differential_analysis.AncovaSchema.conf_int_low)
* [`AncovaSchema.conf_int_upp`](acore.types.md#acore.types.differential_analysis.AncovaSchema.conf_int_upp)
* [`AncovaSchema.f_statistics`](acore.types.md#acore.types.differential_analysis.AncovaSchema.f_statistics)
* [`AncovaSchema.posthoc_padj`](acore.types.md#acore.types.differential_analysis.AncovaSchema.posthoc_padj)
* [`AncovaSchema.Config`](acore.types.md#acore.types.differential_analysis.AncovaSchema.Config)
* [`AncovaSchema.build_schema_()`](acore.types.md#acore.types.differential_analysis.AncovaSchema.build_schema_)
* [`AncovaSchema.empty()`](acore.types.md#acore.types.differential_analysis.AncovaSchema.empty)
Expand Down
12 changes: 6 additions & 6 deletions docs/markdown_ref/acore.types.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ containing NaN values.

Bases: [`DataFrameModel`](https://pandera.readthedocs.io/en/stable/reference/generated/pandera.api.pandas.model.DataFrameModel.html#pandera.api.pandas.model.DataFrameModel)

Schema for the enrichment analysis results DataFrame.
Schema for the differential regulation analysis results DataFrame.

#### group1 *: [str](https://docs.python.org/3/builtins/stdtypes.html#str)* *= 'group1'*

Expand Down Expand Up @@ -527,14 +527,18 @@ Validate a DataFrame based on the schema specification.

Bases: [`DataFrameModel`](https://pandera.readthedocs.io/en/stable/reference/generated/pandera.api.pandas.model.DataFrameModel.html#pandera.api.pandas.model.DataFrameModel)

Schema for the enrichment analysis results DataFrame.
Schema for the differential regulation analysis results DataFrame.

#### posthoc_comparison *: [str](https://docs.python.org/3/builtins/stdtypes.html#str)* *= 'posthoc comparison'*

#### t_statistics *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'posthoc T-Statistics'*

#### posthoc_pvalue *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'posthoc pvalue'*

#### f_statistics *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'F-statistics'*

#### posthoc_padj *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'posthoc pvalue adj'*

#### posthoc_rejected *: [bool](https://docs.python.org/3/builtins/functions.html#bool)* *= 'posthoc rejected'*

#### coef *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'coef'*
Expand All @@ -545,10 +549,6 @@ Schema for the enrichment analysis results DataFrame.

#### conf_int_upp *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'Conf. Int. Upp.'*

#### f_statistics *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'F-statistics'*

#### posthoc_padj *: [float](https://docs.python.org/3/builtins/functions.html#float)* *= 'posthoc pvalue adj'*

#### *class* Config

Bases: [`BaseConfig`](https://pandera.readthedocs.io/en/stable/reference/generated/pandera.api.pandas.model_config.BaseConfig.html#pandera.api.pandas.model_config.BaseConfig)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ docs = [
"sphinx-copybutton",
"sphinx-llms-txt",
# Multi-Omics-Analysis group package for visualisation of results in the documentation
"vuecore",
"vuecore>=0.3.0",
]
dev = [
"black[jupyter]",
Expand Down
10 changes: 6 additions & 4 deletions src/acore/types/differential_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class AnovaSchema(DataFrameModel):
"""
Schema for the enrichment analysis results DataFrame.
Schema for the differential regulation analysis results DataFrame.
"""

group1: str = Field(nullable=False)
Expand Down Expand Up @@ -57,16 +57,18 @@ class AnovaSchemaMultiGroup(AnovaSchema):

class AncovaSchema(DataFrameModel):
"""
Schema for the enrichment analysis results DataFrame.
Schema for the differential regulation analysis results DataFrame.
"""

# same as in AnovaSchemaMultiGroup
posthoc_comparison: str = Field(alias="posthoc comparison", nullable=False)
t_statistics: float = Field(alias="posthoc T-Statistics")
posthoc_pvalue: float = Field(alias="posthoc pvalue")
f_statistics: float = Field(alias="F-statistics")
posthoc_padj: float = Field(alias="posthoc pvalue adj", ge=0, le=1)
posthoc_rejected: bool = Field(alias="posthoc rejected", nullable=False)

coef: float = Field()
std_err: float = Field(alias="std err")
conf_int_low: float = Field(alias="Conf. Int. Low")
conf_int_upp: float = Field(alias="Conf. Int. Upp.")
f_statistics: float = Field(alias="F-statistics")
posthoc_padj: float = Field(alias="posthoc pvalue adj", ge=0, le=1)
Loading