Skip to content

Commit 2996174

Browse files
committed
🎨 add brief vuecore example with latest release
1 parent 714c590 commit 2996174

File tree

2 files changed

+94
-5
lines changed

2 files changed

+94
-5
lines changed

3_vuecore.ipynb

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@
1919
"metadata": {},
2020
"outputs": [],
2121
"source": [
22-
"import vuecore"
22+
"import pathlib\n",
23+
"\n",
24+
"import pandas as pd\n",
25+
"from vuecore.plots.basic.histogram import create_histogram_plot"
26+
]
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"id": "5410e0c2",
31+
"metadata": {},
32+
"source": [
33+
"## Proteomics data example"
2334
]
2435
},
2536
{
@@ -29,16 +40,59 @@
2940
"metadata": {},
3041
"outputs": [],
3142
"source": [
32-
"# ## Proteomics data example"
43+
"dir_data = pathlib.Path(\"data\")\n",
44+
"df = (\n",
45+
" pd.read_csv(dir_data / \"proteins\" / \"proteins.csv\", index_col=0)\n",
46+
" .rename_axis(\"Protein_ID\", axis=1)\n",
47+
" .stack()\n",
48+
" .reset_index(name=\"Intensity\")\n",
49+
")\n",
50+
"df"
3351
]
3452
},
3553
{
3654
"cell_type": "code",
3755
"execution_count": null,
3856
"id": "16458ab0",
57+
"metadata": {
58+
"lines_to_next_cell": 2
59+
},
60+
"outputs": [],
61+
"source": [
62+
"# to be continued\n",
63+
"# Generate the advanced histogram plot\n",
64+
"fig = create_histogram_plot(\n",
65+
" data=df,\n",
66+
" x=\"Intensity\",\n",
67+
" color=\"Reference\",\n",
68+
" barmode=\"overlay\",\n",
69+
" histnorm=\"probability density\",\n",
70+
" title=\"Protein intensities by sample\",\n",
71+
" subtitle=\"Histogram with probability density normalized\",\n",
72+
" labels={\"Intensity\": \"Protein Intensity\", \"Reference\": \"Sample\"},\n",
73+
" hover_data=[\"Protein_ID\"],\n",
74+
" opacity=0.75,\n",
75+
")\n",
76+
"fig"
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"id": "9d569777",
82+
"metadata": {},
83+
"source": [
84+
"For now vuecore is built on top of ploltly:"
85+
]
86+
},
87+
{
88+
"cell_type": "code",
89+
"execution_count": null,
90+
"id": "127fe4b1",
3991
"metadata": {},
4092
"outputs": [],
41-
"source": []
93+
"source": [
94+
"type(fig)"
95+
]
4296
}
4397
],
4498
"metadata": {

3_vuecore.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,44 @@
66
# - at the moment only support the plotly backend
77

88
# %%
9-
import vuecore
9+
import pathlib
1010

11-
# %%
11+
import pandas as pd
12+
from vuecore.plots.basic.histogram import create_histogram_plot
13+
14+
# %% [markdown]
1215
# ## Proteomics data example
1316

1417
# %%
18+
dir_data = pathlib.Path("data")
19+
df = (
20+
pd.read_csv(dir_data / "proteins" / "proteins.csv", index_col=0)
21+
.rename_axis("Protein_ID", axis=1)
22+
.stack()
23+
.reset_index(name="Intensity")
24+
)
25+
df
26+
27+
# %%
28+
# to be continued
29+
# Generate the advanced histogram plot
30+
fig = create_histogram_plot(
31+
data=df,
32+
x="Intensity",
33+
color="Reference",
34+
barmode="overlay",
35+
histnorm="probability density",
36+
title="Protein intensities by sample",
37+
subtitle="Histogram with probability density normalized",
38+
labels={"Intensity": "Protein Intensity", "Reference": "Sample"},
39+
hover_data=["Protein_ID"],
40+
opacity=0.75,
41+
)
42+
fig
43+
44+
45+
# %% [markdown]
46+
# For now vuecore is built on top of ploltly:
47+
48+
# %%
49+
type(fig)

0 commit comments

Comments
 (0)