Skip to content

Commit 3beeb0e

Browse files
committed
📝 Docs: Fix samll issues in demo notebooks
1 parent ae3bd8f commit 3beeb0e

File tree

2 files changed

+42
-73
lines changed

2 files changed

+42
-73
lines changed

docs/vuegen_basic_case_study.ipynb

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,28 @@
4545
"cell_type": "markdown",
4646
"metadata": {},
4747
"source": [
48-
"## 0. Work environment setup and helper functions"
48+
"## 0. Work environment setup"
4949
]
5050
},
5151
{
5252
"cell_type": "markdown",
5353
"metadata": {},
5454
"source": [
55-
"### 0.1. Global variables for platform and working directory\n",
55+
"### 0.1. Installing libraries and creating global variables for platform and working directory\n",
5656
"\n",
5757
"To run this notebook locally, you should create a virtual environment with the required libraries and set the `platform` variable to `local_notebook`. If you are running this notebook on Google Colab, set the `platform` variable to `colab`."
5858
]
5959
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {},
64+
"outputs": [],
65+
"source": [
66+
"# Vuegen library \n",
67+
"%pip install vuegen"
68+
]
69+
},
6070
{
6171
"cell_type": "code",
6272
"execution_count": null,
@@ -82,23 +92,6 @@
8292
" base_output_dir = \"./example_data/Basic_example_vuegen_demo_notebook/\""
8393
]
8494
},
85-
{
86-
"cell_type": "markdown",
87-
"metadata": {},
88-
"source": [
89-
"### 0.2. Installing libraries"
90-
]
91-
},
92-
{
93-
"cell_type": "code",
94-
"execution_count": null,
95-
"metadata": {},
96-
"outputs": [],
97-
"source": [
98-
"# Vuegen library \n",
99-
"%pip install vuegen"
100-
]
101-
},
10295
{
10396
"cell_type": "code",
10497
"execution_count": null,
@@ -114,7 +107,7 @@
114107
"cell_type": "markdown",
115108
"metadata": {},
116109
"source": [
117-
"### 0.3. Importing libraries"
110+
"### 0.2. Importing libraries"
118111
]
119112
},
120113
{
@@ -125,6 +118,7 @@
125118
"source": [
126119
"# Imports\n",
127120
"import os\n",
121+
"import yaml\n",
128122
"from vuegen import report_generator\n",
129123
"from vuegen.utils import get_logger, load_yaml_config\n",
130124
"\n",
@@ -270,7 +264,7 @@
270264
"outputs": [],
271265
"source": [
272266
"# Define new plot with a URL as the file path\n",
273-
"chem_prop_plot = {\n",
267+
"vuegen_abst_fig = {\n",
274268
" \"title\": \"Graphical overview of VueGen’s workflow and components\",\n",
275269
" \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\", \n",
276270
" \"description\": \"\",\n",
@@ -284,7 +278,11 @@
284278
" if section[\"title\"] == \"Plots\":\n",
285279
" for subsection in section[\"subsections\"]:\n",
286280
" if subsection[\"title\"] == \"Static\":\n",
287-
" subsection[\"components\"].append(chem_prop_plot)"
281+
" subsection[\"components\"].append(vuegen_abst_fig)\n",
282+
"\n",
283+
"# Save the modified YAML file\n",
284+
"with open(config_path, \"w\") as file:\n",
285+
" yaml.dump(config, file, default_flow_style=False)"
288286
]
289287
},
290288
{

docs/vuegen_case_study_earth_microbiome.ipynb

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"\n",
99
"[![Open In Colab][colab_badge]][colab_link]\n",
1010
"\n",
11-
"This notebook is a demo of the Vuegen Python library. This sofwtare automates the creation of reports based on a directory with plots, dataframes, and other files in different formats. A YAML configuration file is generated from the directory to define the structure of the report. Users can customize the report by modifying the configuration file, or they can create their own configuration file instead of passing a directory as input. \n",
11+
"This notebook is an end-to-end demo of the Vuegen Python package, starting from content generation. This sofwtare automates the creation of reports based on a directory with plots, dataframes, and other files in different formats. A YAML configuration file is generated from the directory to define the structure of the report. Users can customize the report by modifying the configuration file, or they can create their own configuration file instead of passing a directory as input. \n",
1212
"\n",
1313
"The configuration file specifies the structure of the report, including sections, subsections, and various components such as plots, dataframes, markdown, html, and API calls. Reports can be generated in various formats, including documents (PDF, HTML, DOCX, ODT), presentations (PPTX, Reveal.js), notebooks (Jupyter) or Streamlit web applications.\n",
1414
"\n",
@@ -59,7 +59,7 @@
5959
"cell_type": "markdown",
6060
"metadata": {},
6161
"source": [
62-
"### 0.1. Global variables for platform and working directory\n",
62+
"### 0.1. Installing libraries and creating global variables for platform and working directory\n",
6363
"\n",
6464
"To run this notebook locally, you should create a virtual environment with the required libraries and set the `platform` variable to `local_notebook`. If you are running this notebook on Google Colab, set the `platform` variable to `colab`."
6565
]
@@ -70,7 +70,8 @@
7070
"metadata": {},
7171
"outputs": [],
7272
"source": [
73-
"platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}"
73+
"# Vuegen library \n",
74+
"%pip install vuegen"
7475
]
7576
},
7677
{
@@ -79,15 +80,8 @@
7980
"metadata": {},
8081
"outputs": [],
8182
"source": [
82-
"# Output directory\n",
83-
"base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\""
84-
]
85-
},
86-
{
87-
"cell_type": "markdown",
88-
"metadata": {},
89-
"source": [
90-
"### 0.2. Installing libraries"
83+
"# Libraries for the notebook\n",
84+
"%pip install cartopy seaborn biom-format"
9185
]
9286
},
9387
{
@@ -96,8 +90,7 @@
9690
"metadata": {},
9791
"outputs": [],
9892
"source": [
99-
"# Vuegen library \n",
100-
"%pip install vuegen"
93+
"platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}"
10194
]
10295
},
10396
{
@@ -106,8 +99,9 @@
10699
"metadata": {},
107100
"outputs": [],
108101
"source": [
109-
"# Libraries for the notebook\n",
110-
"%pip install cartopy seaborn biom-format"
102+
"# Optional library to launch a streamlit app from colab\n",
103+
"if platform == 'colab':\n",
104+
" !npm install localtunnel"
111105
]
112106
},
113107
{
@@ -116,16 +110,15 @@
116110
"metadata": {},
117111
"outputs": [],
118112
"source": [
119-
"# Optional library to launch a streamlit app from colab\n",
120-
"if platform == 'colab':\n",
121-
" !npm install localtunnel"
113+
"# Output directory\n",
114+
"base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\""
122115
]
123116
},
124117
{
125118
"cell_type": "markdown",
126119
"metadata": {},
127120
"source": [
128-
"### 0.3. Importing libraries"
121+
"### 0.2. Importing libraries"
129122
]
130123
},
131124
{
@@ -163,7 +156,7 @@
163156
"cell_type": "markdown",
164157
"metadata": {},
165158
"source": [
166-
"### 0.4. Create working directory"
159+
"### 0.3. Creating working directory"
167160
]
168161
},
169162
{
@@ -179,7 +172,7 @@
179172
"cell_type": "markdown",
180173
"metadata": {},
181174
"source": [
182-
"### 0.5. Markdown project description\n",
175+
"### 0.4. Markdown project description\n",
183176
"Create a markdown file with the project description to be displayed in the main page of the report. It is also possible to do this for the sections and subsections of the report by creating a `description.md` file in the corresponding directory."
184177
]
185178
},
@@ -208,7 +201,7 @@
208201
"cell_type": "markdown",
209202
"metadata": {},
210203
"source": [
211-
"### 0.6. Helper functions"
204+
"### 0.5. Helper functions"
212205
]
213206
},
214207
{
@@ -1384,14 +1377,9 @@
13841377
"metadata": {},
13851378
"outputs": [],
13861379
"source": [
1387-
"report_type = \"streamlit\"\n",
1388-
"report_name = \"Earth_microbiome_vuegen_demo_notebook_dir\"\n",
1389-
"\n",
1390-
"# Initialize logger\n",
1391-
"logger = get_logger(f\"{report_type}_report_{report_name}\")\n",
1392-
"\n",
13931380
"# Generate the report\n",
1394-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = logger)"
1381+
"report_type = \"streamlit\"\n",
1382+
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example\"))"
13951383
]
13961384
},
13971385
{
@@ -1422,14 +1410,9 @@
14221410
"metadata": {},
14231411
"outputs": [],
14241412
"source": [
1425-
"report_type = \"html\"\n",
1426-
"report_name = \"Earth_microbiome_vuegen_demo_notebook_dir\"\n",
1427-
"\n",
1428-
"# Initialize logger\n",
1429-
"logger = get_logger(f\"{report_type}_report_{report_name}\")\n",
1430-
"\n",
14311413
"# Generate the report\n",
1432-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = logger)"
1414+
"report_type = \"html\"\n",
1415+
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example\"))"
14331416
]
14341417
},
14351418
{
@@ -1575,13 +1558,7 @@
15751558
"source": [
15761559
"# Test the changes by generarating the report from the modified YAML file\n",
15771560
"report_type = \"streamlit\"\n",
1578-
"report_name = \"Earth_microbiome_vuegen_demo_notebook_config_extended\"\n",
1579-
"\n",
1580-
"# Initialize logger\n",
1581-
"logger = get_logger(f\"{report_type}_report_{report_name}\")\n",
1582-
"\n",
1583-
"# Generate the report\n",
1584-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = logger)"
1561+
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example_extended\"))"
15851562
]
15861563
},
15871564
{
@@ -1614,13 +1591,7 @@
16141591
"source": [
16151592
"# Test the changes by generarating the report from the modified YAML file\n",
16161593
"report_type = \"html\"\n",
1617-
"report_name = \"Earth_microbiome_vuegen_demo_notebook_config_extended\"\n",
1618-
"\n",
1619-
"# Initialize logger\n",
1620-
"logger = get_logger(f\"{report_type}_report_{report_name}\")\n",
1621-
"\n",
1622-
"# Generate the report\n",
1623-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = logger)"
1594+
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = get_logger(f\"{report_type}_report_EMP_example_extended\"))"
16241595
]
16251596
}
16261597
],

0 commit comments

Comments
 (0)