Skip to content

Commit f300e1a

Browse files
committed
💥 Write config file based on directory to output directory of report
- read-only situation of result directories: One cannot always write to directory which contains the results if -dir option is used - ✨ Return paths for easier reporting - adapt example notebooks accordingly
1 parent c2d1fbf commit f300e1a

File tree

6 files changed

+73
-57
lines changed

6 files changed

+73
-57
lines changed

docs/vuegen_basic_case_study.ipynb

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
{
7575
"cell_type": "code",
76-
"execution_count": 1,
76+
"execution_count": null,
7777
"metadata": {},
7878
"outputs": [],
7979
"source": [
@@ -164,22 +164,18 @@
164164
"source": [
165165
"# Generate the report\n",
166166
"report_type = \"streamlit\"\n",
167-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
167+
"report_dir, config_path = report_generator.get_report(\n",
168+
" dir_path=base_output_dir, report_type=report_type, logger=None\n",
169+
")\n",
170+
"print(f\"\\nReport generated in {report_dir}\")\n",
171+
"print(f\"\\nConfig file generated in {config_path}\")"
168172
]
169173
},
170174
{
171175
"cell_type": "code",
172176
"execution_count": null,
173177
"metadata": {},
174-
"outputs": [
175-
{
176-
"name": "stdout",
177-
"output_type": "stream",
178-
"text": [
179-
"Streamlit report not executed, set run_streamlit to True to run the report\n"
180-
]
181-
}
182-
],
178+
"outputs": [],
183179
"source": [
184180
"run_streamlit = False\n",
185181
"# run_streamlit = True # uncomment line to run the streamlit report\n",
@@ -212,7 +208,8 @@
212208
"source": [
213209
"# Generate the report\n",
214210
"report_type = \"html\"\n",
215-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
211+
"report_dir, config_path = report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)\n",
212+
"print(f\"Report generated at: {report_dir}\")"
216213
]
217214
},
218215
{
@@ -232,14 +229,14 @@
232229
},
233230
{
234231
"cell_type": "code",
235-
"execution_count": 20,
232+
"execution_count": null,
236233
"metadata": {},
237234
"outputs": [],
238235
"source": [
239236
"vuegen_logo_path = \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg\"\n",
240237
"\n",
241238
"# Load the YAML file\n",
242-
"config_path = os.path.join(base_output_dir, \"Basic_example_vuegen_demo_notebook_config.yaml\")\n",
239+
"print(f\"Loading the YAML config file from: {config_path}\") # generated based on directory path above\n",
243240
"config = load_yaml_config(config_path)\n",
244241
"\n",
245242
"# Update the logo and graphical abstract with the URL\n",
@@ -255,7 +252,7 @@
255252
},
256253
{
257254
"cell_type": "code",
258-
"execution_count": 21,
255+
"execution_count": null,
259256
"metadata": {},
260257
"outputs": [],
261258
"source": [
@@ -281,7 +278,7 @@
281278
},
282279
{
283280
"cell_type": "code",
284-
"execution_count": 22,
281+
"execution_count": null,
285282
"metadata": {},
286283
"outputs": [],
287284
"source": [
@@ -324,7 +321,7 @@
324321
"source": [
325322
"# Test the changes by generarating the report from the modified YAML file\n",
326323
"report_type = \"streamlit\"\n",
327-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
324+
"_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
328325
]
329326
},
330327
{
@@ -364,7 +361,7 @@
364361
"source": [
365362
"# Test the changes by generarating the report from the modified YAML file\n",
366363
"report_type = \"html\"\n",
367-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
364+
"_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
368365
]
369366
}
370367
],

docs/vuegen_case_study_earth_microbiome.ipynb

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
},
125125
{
126126
"cell_type": "code",
127-
"execution_count": 27,
127+
"execution_count": null,
128128
"metadata": {},
129129
"outputs": [],
130130
"source": [
@@ -179,7 +179,7 @@
179179
},
180180
{
181181
"cell_type": "code",
182-
"execution_count": 29,
182+
"execution_count": null,
183183
"metadata": {},
184184
"outputs": [],
185185
"source": [
@@ -207,7 +207,7 @@
207207
},
208208
{
209209
"cell_type": "code",
210-
"execution_count": 30,
210+
"execution_count": null,
211211
"metadata": {},
212212
"outputs": [],
213213
"source": [
@@ -281,7 +281,7 @@
281281
},
282282
{
283283
"cell_type": "code",
284-
"execution_count": 31,
284+
"execution_count": null,
285285
"metadata": {},
286286
"outputs": [],
287287
"source": [
@@ -304,7 +304,7 @@
304304
},
305305
{
306306
"cell_type": "code",
307-
"execution_count": 32,
307+
"execution_count": null,
308308
"metadata": {},
309309
"outputs": [],
310310
"source": [
@@ -536,7 +536,7 @@
536536
},
537537
{
538538
"cell_type": "code",
539-
"execution_count": 11,
539+
"execution_count": null,
540540
"metadata": {},
541541
"outputs": [],
542542
"source": [
@@ -551,7 +551,7 @@
551551
},
552552
{
553553
"cell_type": "code",
554-
"execution_count": 12,
554+
"execution_count": null,
555555
"metadata": {},
556556
"outputs": [],
557557
"source": [
@@ -759,7 +759,7 @@
759759
},
760760
{
761761
"cell_type": "code",
762-
"execution_count": 15,
762+
"execution_count": null,
763763
"metadata": {},
764764
"outputs": [],
765765
"source": [
@@ -776,7 +776,7 @@
776776
},
777777
{
778778
"cell_type": "code",
779-
"execution_count": 16,
779+
"execution_count": null,
780780
"metadata": {},
781781
"outputs": [],
782782
"source": [
@@ -914,7 +914,7 @@
914914
},
915915
{
916916
"cell_type": "code",
917-
"execution_count": 33,
917+
"execution_count": null,
918918
"metadata": {},
919919
"outputs": [],
920920
"source": [
@@ -943,7 +943,7 @@
943943
},
944944
{
945945
"cell_type": "code",
946-
"execution_count": 34,
946+
"execution_count": null,
947947
"metadata": {},
948948
"outputs": [],
949949
"source": [
@@ -1193,7 +1193,7 @@
11931193
},
11941194
{
11951195
"cell_type": "code",
1196-
"execution_count": 25,
1196+
"execution_count": null,
11971197
"metadata": {},
11981198
"outputs": [],
11991199
"source": [
@@ -1215,7 +1215,7 @@
12151215
},
12161216
{
12171217
"cell_type": "code",
1218-
"execution_count": 26,
1218+
"execution_count": null,
12191219
"metadata": {},
12201220
"outputs": [],
12211221
"source": [
@@ -1237,7 +1237,7 @@
12371237
},
12381238
{
12391239
"cell_type": "code",
1240-
"execution_count": 27,
1240+
"execution_count": null,
12411241
"metadata": {},
12421242
"outputs": [],
12431243
"source": [
@@ -1257,7 +1257,7 @@
12571257
},
12581258
{
12591259
"cell_type": "code",
1260-
"execution_count": 28,
1260+
"execution_count": null,
12611261
"metadata": {},
12621262
"outputs": [],
12631263
"source": [
@@ -1277,7 +1277,7 @@
12771277
},
12781278
{
12791279
"cell_type": "code",
1280-
"execution_count": 29,
1280+
"execution_count": null,
12811281
"metadata": {},
12821282
"outputs": [],
12831283
"source": [
@@ -1294,7 +1294,7 @@
12941294
},
12951295
{
12961296
"cell_type": "code",
1297-
"execution_count": 30,
1297+
"execution_count": null,
12981298
"metadata": {},
12991299
"outputs": [],
13001300
"source": [
@@ -1382,7 +1382,7 @@
13821382
"source": [
13831383
"# Generate the report\n",
13841384
"report_type = \"streamlit\"\n",
1385-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
1385+
"_ = report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
13861386
]
13871387
},
13881388
{
@@ -1422,7 +1422,9 @@
14221422
"source": [
14231423
"# Generate the report\n",
14241424
"report_type = \"html\"\n",
1425-
"report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)"
1425+
"report_dir, config_path = report_generator.get_report(\n",
1426+
" dir_path=base_output_dir, report_type=report_type, logger=None\n",
1427+
")"
14261428
]
14271429
},
14281430
{
@@ -1442,14 +1444,13 @@
14421444
},
14431445
{
14441446
"cell_type": "code",
1445-
"execution_count": 20,
1447+
"execution_count": null,
14461448
"metadata": {},
14471449
"outputs": [],
14481450
"source": [
14491451
"empo_logo_path = \"https://raw.githubusercontent.com/ElDeveloper/cogs220/master/emp-logo.svg\"\n",
14501452
"\n",
14511453
"# Load the YAML file\n",
1452-
"config_path = os.path.join(base_output_dir, \"Earth_microbiome_vuegen_demo_notebook_config.yaml\")\n",
14531454
"config = load_yaml_config(config_path)\n",
14541455
"\n",
14551456
"# Update the logo and graphical abstract with the URL\n",
@@ -1465,7 +1466,7 @@
14651466
},
14661467
{
14671468
"cell_type": "code",
1468-
"execution_count": 21,
1469+
"execution_count": null,
14691470
"metadata": {},
14701471
"outputs": [],
14711472
"source": [
@@ -1491,7 +1492,7 @@
14911492
},
14921493
{
14931494
"cell_type": "code",
1494-
"execution_count": 22,
1495+
"execution_count": null,
14951496
"metadata": {},
14961497
"outputs": [],
14971498
"source": [
@@ -1522,7 +1523,7 @@
15221523
},
15231524
{
15241525
"cell_type": "code",
1525-
"execution_count": 23,
1526+
"execution_count": null,
15261527
"metadata": {},
15271528
"outputs": [],
15281529
"source": [
@@ -1570,7 +1571,7 @@
15701571
"source": [
15711572
"# Test the changes by generarating the report from the modified YAML file\n",
15721573
"report_type = \"streamlit\"\n",
1573-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
1574+
"_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
15741575
]
15751576
},
15761577
{
@@ -1610,7 +1611,7 @@
16101611
"source": [
16111612
"# Test the changes by generarating the report from the modified YAML file\n",
16121613
"report_type = \"html\"\n",
1613-
"report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
1614+
"_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)"
16141615
]
16151616
}
16161617
],

gui/app.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
app_path.parent / "example_data/Basic_example_vuegen_demo_notebook"
5454
).resolve()
5555
quarto_bin_path = os.path.join(sys._MEIPASS, "quarto_cli", "bin")
56+
# /.venv/lib/python3.12/site-packages/quarto_cli/bin
57+
# source activate .venv/bin/activate
5658
quarto_share_path = os.path.join(sys._MEIPASS, "quarto_cli", "share")
5759
_PATH = os.pathsep.join([quarto_bin_path, quarto_share_path, _PATH])
5860
os.environ["PATH"] = _PATH
@@ -146,10 +148,14 @@ def inner():
146148
kwargs["logger"].info("logfile: %s", log_file)
147149
kwargs["logger"].debug("sys.path: %s", sys.path)
148150
kwargs["logger"].debug("PATH (in app): %s ", os.environ["PATH"])
149-
report_generator.get_report(**kwargs)
151+
report_dir, gen_config_path = report_generator.get_report(**kwargs)
152+
kwargs["logger"].info("Report generated at %s", report_dir)
150153
messagebox.showinfo(
151154
"Success",
152-
"Report generation completed successfully." f"\nLogs at {log_file}",
155+
"Report generation completed successfully."
156+
f"\n\nLogs at:\n{log_file}"
157+
f"\n\nReport in folder:\n{report_dir}"
158+
f"\n\nConfiguration file at:\n{gen_config_path}",
153159
)
154160
print_completion_message(report_type.get())
155161
except Exception as e:
@@ -245,7 +251,7 @@ def select_directory():
245251
ctk_label_report.grid(row=row_count, column=0, columnspan=2, padx=20, pady=20)
246252
row_count += 1
247253
##########################################################################################
248-
report_type = tk.StringVar(value=report_types[0])
254+
report_type = tk.StringVar(value=report_types[1])
249255
report_dropdown = customtkinter.CTkOptionMenu(
250256
app,
251257
values=report_types,

src/vuegen/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def main():
3939
logger, logfile = get_logger(f"{logger_suffix}")
4040
logger.info("logfile: %s", logfile)
4141
# Generate the report
42-
report_generator.get_report(
42+
_, _ = report_generator.get_report(
4343
report_type=report_type,
4444
logger=logger,
4545
config_path=config_path,
@@ -48,6 +48,7 @@ def main():
4848
)
4949

5050
# Print completion message
51+
# ! Could use now report_dir and config_path as information
5152
print_completion_message(report_type)
5253

5354

0 commit comments

Comments
 (0)