|
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 | }, |
|
164 | 165 | "source": [ |
165 | 166 | "# Generate the report\n", |
166 | 167 | "report_type = \"streamlit\"\n", |
167 | | - "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)" |
| 168 | + "report_generator.get_report(\n", |
| 169 | + " dir_path=base_output_dir, report_type=report_type, logger=None\n", |
| 170 | + ")" |
168 | 171 | ] |
169 | 172 | }, |
170 | 173 | { |
|
185 | 188 | "# run_streamlit = True # uncomment line to run the streamlit report\n", |
186 | 189 | "# Launch the Streamlit report depneding on the platform\n", |
187 | 190 | "if not IN_COLAB and run_streamlit:\n", |
188 | | - " !streamlit run streamlit_report/sections/report_manager.py\n", |
| 191 | + " !streamlit run streamlit_report/sections/report_manager.py\n", |
189 | 192 | "elif run_streamlit:\n", |
190 | | - " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
191 | | - " print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
192 | | - " # Run the Streamlit app in the background\n", |
193 | | - " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
194 | | - " # Expose the Streamlit app on port 8501\n", |
195 | | - " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
| 193 | + " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
| 194 | + " print(\n", |
| 195 | + " \"Password/Enpoint IP for localtunnel is:\",\n", |
| 196 | + " urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n", |
| 197 | + " .read()\n", |
| 198 | + " .decode(\"utf8\")\n", |
| 199 | + " .strip(\"\\n\"),\n", |
| 200 | + " )\n", |
| 201 | + " # Run the Streamlit app in the background\n", |
| 202 | + " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
| 203 | + " # Expose the Streamlit app on port 8501\n", |
| 204 | + " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
196 | 205 | "else:\n", |
197 | 206 | " print(\"Streamlit report not executed, set run_streamlit to True to run the report\")" |
198 | 207 | ] |
|
212 | 221 | "source": [ |
213 | 222 | "# Generate the report\n", |
214 | 223 | "report_type = \"html\"\n", |
215 | | - "report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = None)" |
| 224 | + "report_generator.get_report(\n", |
| 225 | + " dir_path=base_output_dir, report_type=report_type, logger=None\n", |
| 226 | + ")" |
216 | 227 | ] |
217 | 228 | }, |
218 | 229 | { |
|
239 | 250 | "vuegen_logo_path = \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg\"\n", |
240 | 251 | "\n", |
241 | 252 | "# Load the YAML file\n", |
242 | | - "config_path = os.path.join(base_output_dir, \"Basic_example_vuegen_demo_notebook_config.yaml\")\n", |
| 253 | + "config_path = os.path.join(\n", |
| 254 | + " base_output_dir, \"Basic_example_vuegen_demo_notebook_config.yaml\"\n", |
| 255 | + ")\n", |
243 | 256 | "config = load_yaml_config(config_path)\n", |
244 | 257 | "\n", |
245 | 258 | "# Update the logo and graphical abstract with the URL\n", |
246 | | - "config[\"report\"].update({\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path})" |
| 259 | + "config[\"report\"].update(\n", |
| 260 | + " {\"logo\": vuegen_logo_path, \"graphical_abstract\": vuegen_logo_path}\n", |
| 261 | + ")" |
247 | 262 | ] |
248 | 263 | }, |
249 | 264 | { |
|
261 | 276 | "source": [ |
262 | 277 | "# Update the description for the EDA section\n", |
263 | 278 | "for section in config[\"sections\"]:\n", |
264 | | - " if section[\"title\"] == \"Plots\": \n", |
| 279 | + " if section[\"title\"] == \"Plots\":\n", |
265 | 280 | " section[\"description\"] = \"This section contains example plots\"\n", |
266 | 281 | "\n", |
267 | 282 | "# Update the description for the alpha diversity subsection from the Metagenomics section\n", |
268 | 283 | "for section in config[\"sections\"]:\n", |
269 | 284 | " if section[\"title\"] == \"Dataframes\":\n", |
270 | 285 | " for subsection in section[\"subsections\"]:\n", |
271 | 286 | " if subsection[\"title\"] == \"All Formats\":\n", |
272 | | - " subsection[\"description\"] = \"This subsection contains example dataframes.\"\n" |
| 287 | + " subsection[\"description\"] = (\n", |
| 288 | + " \"This subsection contains example dataframes.\"\n", |
| 289 | + " )" |
273 | 290 | ] |
274 | 291 | }, |
275 | 292 | { |
|
288 | 305 | "# Define new plot with a URL as the file path\n", |
289 | 306 | "vuegen_abst_fig = {\n", |
290 | 307 | " \"title\": \"Graphical overview of VueGen’s workflow and components\",\n", |
291 | | - " \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\", \n", |
| 308 | + " \"file_path\": \"https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\",\n", |
292 | 309 | " \"description\": \"\",\n", |
293 | 310 | " \"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", |
294 | 311 | " \"component_type\": \"plot\",\n", |
295 | | - " \"plot_type\": \"static\"\n", |
| 312 | + " \"plot_type\": \"static\",\n", |
296 | 313 | "}\n", |
297 | 314 | "\n", |
298 | 315 | "# Add the plot to the Sample Provenance subsection in the EDA section\n", |
|
324 | 341 | "source": [ |
325 | 342 | "# Test the changes by generarating the report from the modified YAML file\n", |
326 | 343 | "report_type = \"streamlit\"\n", |
327 | | - "report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)" |
| 344 | + "report_generator.get_report(\n", |
| 345 | + " config_path=config_path, report_type=report_type, logger=None\n", |
| 346 | + ")" |
328 | 347 | ] |
329 | 348 | }, |
330 | 349 | { |
|
337 | 356 | "# run_streamlit = True # uncomment line to run the streamlit report\n", |
338 | 357 | "# Launch the Streamlit report depneding on the platform\n", |
339 | 358 | "if not IN_COLAB and run_streamlit:\n", |
340 | | - " !streamlit run streamlit_report/sections/report_manager.py\n", |
| 359 | + " !streamlit run streamlit_report/sections/report_manager.py\n", |
341 | 360 | "elif run_streamlit:\n", |
342 | | - " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
343 | | - " print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
344 | | - " # Run the Streamlit app in the background\n", |
345 | | - " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
346 | | - " # Expose the Streamlit app on port 8501\n", |
347 | | - " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
| 361 | + " # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
| 362 | + " print(\n", |
| 363 | + " \"Password/Enpoint IP for localtunnel is:\",\n", |
| 364 | + " urllib.request.urlopen(\"https://ipv4.icanhazip.com\")\n", |
| 365 | + " .read()\n", |
| 366 | + " .decode(\"utf8\")\n", |
| 367 | + " .strip(\"\\n\"),\n", |
| 368 | + " )\n", |
| 369 | + " # Run the Streamlit app in the background\n", |
| 370 | + " !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
| 371 | + " # Expose the Streamlit app on port 8501\n", |
| 372 | + " !npx localtunnel --port 8501 --subdomain vuegen-demo\n", |
348 | 373 | "else:\n", |
349 | 374 | " print(\"Streamlit report not executed, set run_streamlit to True to run the report\")" |
350 | 375 | ] |
|
364 | 389 | "source": [ |
365 | 390 | "# Test the changes by generarating the report from the modified YAML file\n", |
366 | 391 | "report_type = \"html\"\n", |
367 | | - "report_generator.get_report(config_path = config_path, report_type = report_type, logger = None)" |
| 392 | + "report_generator.get_report(\n", |
| 393 | + " config_path=config_path, report_type=report_type, logger=None\n", |
| 394 | + ")" |
368 | 395 | ] |
369 | 396 | } |
370 | 397 | ], |
|
0 commit comments