|
67 | 67 | }, |
68 | 68 | "outputs": [], |
69 | 69 | "source": [ |
70 | | - "# Vuegen library \n", |
| 70 | + "# Vuegen library\n", |
71 | 71 | "%pip install vuegen" |
72 | 72 | ] |
73 | 73 | }, |
|
78 | 78 | "outputs": [], |
79 | 79 | "source": [ |
80 | 80 | "import os\n", |
| 81 | + "\n", |
81 | 82 | "IN_COLAB = \"COLAB_GPU\" in os.environ" |
82 | 83 | ] |
83 | 84 | }, |
|
181 | 182 | "# run_streamlit = True # uncomment line to run the streamlit report\n", |
182 | 183 | "# Launch the Streamlit report depneding on the platform\n", |
183 | 184 | "if not IN_COLAB and run_streamlit:\n", |
184 | | - " !streamlit run streamlit_report/sections/report_manager.py\n", |
| 185 | + " !streamlit run streamlit_report/sections/report_manager.py\n", |
185 | 186 | "elif run_streamlit:\n", |
186 | | - " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
187 | | - " print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
188 | | - " # Run the Streamlit app in the background\n", |
189 | | - " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
190 | | - " # Expose the Streamlit app on port 8501\n", |
191 | | - " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
| 187 | + " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
| 188 | + " print(\n", |
| 189 | + " \"Password/Enpoint IP for localtunnel is:\",\n", |
| 190 | + " urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n", |
| 191 | + " .read()\n", |
| 192 | + " .decode(\"utf8\")\n", |
| 193 | + " .strip(\"\\n\"),\n", |
| 194 | + " )\n", |
| 195 | + " # Run the Streamlit app in the background\n", |
| 196 | + " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
| 197 | + " # Expose the Streamlit app on port 8501\n", |
| 198 | + " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
192 | 199 | "else:\n", |
193 | 200 | " print(\"Streamlit report not executed, set run_streamlit to True to run the report\")" |
194 | 201 | ] |
|
208 | 215 | "source": [ |
209 | 216 | "# Generate the report\n", |
210 | 217 | "report_type = \"html\"\n", |
211 | | - "report_dir, config_path = report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)\n", |
| 218 | + "report_dir, config_path = report_generator.get_report(\n", |
| 219 | + " dir_path=base_output_dir, report_type=report_type, logger=None\n", |
| 220 | + ")\n", |
212 | 221 | "print(f\"Report generated at: {report_dir}\")" |
213 | 222 | ] |
214 | 223 | }, |
|
236 | 245 | "vuegen_logo_path = \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg\"\n", |
237 | 246 | "\n", |
238 | 247 | "# Load the YAML file\n", |
239 | | - "print(f\"Loading the YAML config file from: {config_path}\") # generated based on directory path above\n", |
| 248 | + "print(\n", |
| 249 | + " f\"Loading the YAML config file from: {config_path}\"\n", |
| 250 | + ") # generated based on directory path above\n", |
240 | 251 | "config = load_yaml_config(config_path)\n", |
241 | 252 | "\n", |
242 | 253 | "# Update the logo and graphical abstract with the URL\n", |
243 | | - "config[\"report\"].update({\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path})" |
| 254 | + "config[\"report\"].update(\n", |
| 255 | + " {\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path}\n", |
| 256 | + ")" |
244 | 257 | ] |
245 | 258 | }, |
246 | 259 | { |
|
258 | 271 | "source": [ |
259 | 272 | "# Update the description for the EDA section\n", |
260 | 273 | "for section in config[\"sections\"]:\n", |
261 | | - " if section[\"title\"] == \"Plots\": \n", |
| 274 | + " if section[\"title\"] == \"Plots\":\n", |
262 | 275 | " section[\"description\"] = \"This section contains example plots\"\n", |
263 | 276 | "\n", |
264 | 277 | "# Update the description for the alpha diversity subsection from the Metagenomics section\n", |
265 | 278 | "for section in config[\"sections\"]:\n", |
266 | 279 | " if section[\"title\"] == \"Dataframes\":\n", |
267 | 280 | " for subsection in section[\"subsections\"]:\n", |
268 | 281 | " if subsection[\"title\"] == \"All Formats\":\n", |
269 | | - " subsection[\"description\"] = \"This subsection contains example dataframes.\"\n" |
| 282 | + " subsection[\"description\"] = (\n", |
| 283 | + " \"This subsection contains example dataframes.\"\n", |
| 284 | + " )" |
270 | 285 | ] |
271 | 286 | }, |
272 | 287 | { |
|
285 | 300 | "# Define new plot with a URL as the file path\n", |
286 | 301 | "vuegen_abst_fig = {\n", |
287 | 302 | " \"title\": \"Graphical overview of VueGen’s workflow and components\",\n", |
288 | | - " \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\", \n", |
| 303 | + " \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\",\n", |
289 | 304 | " \"description\": \"\",\n", |
290 | 305 | " \"caption\": \"The diagram illustrates the processing pipeline of VueGen, starting from either a directory or a YAML configuration file. Reports consist of hierarchical sections and subsections, each containing various components such as plots, dataframes, Markdown, HTML, and data retrieved via API calls.\",\n", |
291 | 306 | " \"component_type\": \"plot\",\n", |
292 | | - " \"plot_type\": \"static\"\n", |
| 307 | + " \"plot_type\": \"static\",\n", |
293 | 308 | "}\n", |
294 | 309 | "\n", |
295 | 310 | "# Add the plot to the Sample Provenance subsection in the EDA section\n", |
|
321 | 336 | "source": [ |
322 | 337 | "# Test the changes by generarating the report from the modified YAML file\n", |
323 | 338 | "report_type = \"streamlit\"\n", |
324 | | - "_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)" |
| 339 | + "_ = report_generator.get_report(\n", |
| 340 | + " config_path=config_path, report_type=report_type, logger=None\n", |
| 341 | + ")" |
325 | 342 | ] |
326 | 343 | }, |
327 | 344 | { |
|
334 | 351 | "# run_streamlit = True # uncomment line to run the streamlit report\n", |
335 | 352 | "# Launch the Streamlit report depneding on the platform\n", |
336 | 353 | "if not IN_COLAB and run_streamlit:\n", |
337 | | - " !streamlit run streamlit_report/sections/report_manager.py\n", |
| 354 | + " !streamlit run streamlit_report/sections/report_manager.py\n", |
338 | 355 | "elif run_streamlit:\n", |
339 | | - " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
340 | | - " print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
341 | | - " # Run the Streamlit app in the background\n", |
342 | | - " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
343 | | - " # Expose the Streamlit app on port 8501\n", |
344 | | - " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
| 356 | + " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
| 357 | + " print(\n", |
| 358 | + " \"Password/Enpoint IP for localtunnel is:\",\n", |
| 359 | + " urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n", |
| 360 | + " .read()\n", |
| 361 | + " .decode(\"utf8\")\n", |
| 362 | + " .strip(\"\\n\"),\n", |
| 363 | + " )\n", |
| 364 | + " # Run the Streamlit app in the background\n", |
| 365 | + " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
| 366 | + " # Expose the Streamlit app on port 8501\n", |
| 367 | + " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
345 | 368 | "else:\n", |
346 | 369 | " print(\"Streamlit report not executed, set run_streamlit to True to run the report\")" |
347 | 370 | ] |
|
361 | 384 | "source": [ |
362 | 385 | "# Test the changes by generarating the report from the modified YAML file\n", |
363 | 386 | "report_type = \"html\"\n", |
364 | | - "_ = report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)" |
| 387 | + "_ = report_generator.get_report(\n", |
| 388 | + " config_path=config_path, report_type=report_type, logger=None\n", |
| 389 | + ")" |
365 | 390 | ] |
366 | 391 | } |
367 | 392 | ], |
368 | 393 | "metadata": { |
369 | 394 | "kernelspec": { |
370 | | - "display_name": "vuegen", |
| 395 | + "display_name": "vuegen_py312", |
371 | 396 | "language": "python", |
372 | 397 | "name": "python3" |
373 | 398 | }, |
|
381 | 406 | "name": "python", |
382 | 407 | "nbconvert_exporter": "python", |
383 | 408 | "pygments_lexer": "ipython3", |
384 | | - "version": "3.9.21" |
| 409 | + "version": "3.12.9" |
385 | 410 | } |
386 | 411 | }, |
387 | 412 | "nbformat": 4, |
|
0 commit comments