Skip to content
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<!-- https://myst-parser.readthedocs.io/en/latest/faq/index.html
#include-a-file-from-outside-the-docs-folder-like-readme-md -->

```{include} ../README.md
:start-line: 0
:relative-docs: docs
Expand All @@ -18,6 +19,7 @@ vuegen_demo
:maxdepth: 1
:caption: Building a report

vuegen_basic_case_study
vuegen_case_study_earth_microbiome
example_report
```
Expand Down
83 changes: 57 additions & 26 deletions docs/vuegen_basic_case_study.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@
"source": [
"### 0.1. Installing libraries and creating global variables for platform and working directory\n",
"\n",
"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`."
"To run this notebook locally, you should create a virtual environment with the required libraries. If you are running this notebook on Google Colab, everything should be set."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [],
"source": [
"# Vuegen library \n",
Expand All @@ -69,11 +73,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}"
"import os\n",
"IN_COLAB = \"COLAB_GPU\" in os.environ"
]
},
{
Expand All @@ -83,11 +88,11 @@
"outputs": [],
"source": [
"# Set working directory\n",
"if platform == 'colab':\n",
"if IN_COLAB:\n",
" # Clone the repository in Colab\n",
" !git clone --depth=1 https://github.com/Multiomics-Analytics-Group/vuegen.git\n",
" base_output_dir = \"vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/\"\n",
"elif platform == 'local_notebook':\n",
"else:\n",
" # Output directory for local execution\n",
" base_output_dir = \"./example_data/Basic_example_vuegen_demo_notebook/\""
]
Expand All @@ -99,7 +104,7 @@
"outputs": [],
"source": [
"# Optional library to launch a streamlit app from colab\n",
"if platform == 'colab':\n",
"if IN_COLAB:\n",
" !npm install localtunnel"
]
},
Expand All @@ -112,7 +117,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -122,7 +127,7 @@
"from vuegen import report_generator\n",
"from vuegen.utils import get_logger, load_yaml_config\n",
"\n",
"if platform == 'colab':\n",
"if IN_COLAB:\n",
" import urllib"
]
},
Expand All @@ -146,7 +151,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.1. Streamlit report"
"### 1.1. Streamlit report\n",
"\n",
"To launch the Streamlit web application from Colab, open the generated URL and copy the localtunnel entry point IP into the corresponding field on the opened page. Once submited, you will be redirected to your Streamlit web application."
]
},
{
Expand All @@ -164,15 +171,30 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Streamlit report not executed, set run_streamlit to True to run the report\n"
]
}
],
"source": [
"run_streamlit = False\n",
"# run_streamlit = True # uncomment line to run the streamlit report\n",
"# Launch the Streamlit report depneding on the platform\n",
"# if platform == \"local_notebook\":\n",
"# !streamlit run streamlit_report/sections/report_manager.py\n",
"# elif platform == \"colab\": # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
"# !npx localtunnel --port 8501"
"if not IN_COLAB and run_streamlit:\n",
" !streamlit run streamlit_report/sections/report_manager.py\n",
"elif run_streamlit:\n",
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
" # Run the Streamlit app in the background\n",
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
" # Expose the Streamlit app on port 8501\n",
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
"else:\n",
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
]
},
{
Expand Down Expand Up @@ -289,7 +311,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2.5. Stremlit report with the extended configuration file"
"### 2.5. Stremlit report with the extended configuration file\n",
"\n",
"To launch the Streamlit web application from Colab, open the generated URL and copy the localtunnel entry point IP into the corresponding field on the opened page. Once submited, you will be redirected to your Streamlit web application."
]
},
{
Expand All @@ -309,13 +333,20 @@
"metadata": {},
"outputs": [],
"source": [
"run_streamlit = False\n",
"# run_streamlit = True # uncomment line to run the streamlit report\n",
"# Launch the Streamlit report depneding on the platform\n",
"#if platform == \"local_notebook\":\n",
"# !streamlit run streamlit_report/sections/report_manager.py\n",
"#elif platform == \"colab\":\n",
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
"# !npx localtunnel --port 8501"
"if not IN_COLAB and run_streamlit:\n",
" !streamlit run streamlit_report/sections/report_manager.py\n",
"elif run_streamlit:\n",
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
" # Run the Streamlit app in the background\n",
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
" # Expose the Streamlit app on port 8501\n",
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
"else:\n",
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
]
},
{
Expand All @@ -339,7 +370,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "vuegen-IFxaxej_-py3.12",
"display_name": "vuegen",
"language": "python",
"name": "python3"
},
Expand All @@ -353,7 +384,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.9.21"
}
},
"nbformat": 4,
Expand Down
59 changes: 39 additions & 20 deletions docs/vuegen_case_study_earth_microbiome.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source": [
"### 0.1. Installing libraries and creating global variables for platform and working directory\n",
"\n",
"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`."
"To run this notebook locally, you should create a virtual environment with the required libraries. If you are running this notebook on Google Colab, everything should be set."
]
},
{
Expand Down Expand Up @@ -90,7 +90,8 @@
"metadata": {},
"outputs": [],
"source": [
"platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}"
"import os\n",
"IN_COLAB = \"COLAB_GPU\" in os.environ"
]
},
{
Expand All @@ -100,7 +101,7 @@
"outputs": [],
"source": [
"# Optional library to launch a streamlit app from colab\n",
"if platform == 'colab':\n",
"if IN_COLAB:\n",
" !npm install localtunnel"
]
},
Expand Down Expand Up @@ -148,7 +149,7 @@
"from vuegen import report_generator\n",
"from vuegen.utils import get_logger, load_yaml_config\n",
"\n",
"if platform == 'colab':\n",
"if IN_COLAB:\n",
" import urllib"
]
},
Expand Down Expand Up @@ -1368,7 +1369,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4.1. Streamlit report"
"### 4.1. Streamlit report\n",
"\n",
"To launch the Streamlit web application from Colab, open the generated URL and copy the localtunnel entry point IP into the corresponding field on the opened page. Once submited, you will be redirected to your Streamlit web application."
]
},
{
Expand All @@ -1388,13 +1391,20 @@
"metadata": {},
"outputs": [],
"source": [
"run_streamlit = False\n",
"# run_streamlit = True # uncomment line to run the streamlit report\n",
"# Launch the Streamlit report depneding on the platform\n",
"#if platform == \"local_notebook\":\n",
"# !streamlit run streamlit_report/sections/report_manager.py\n",
"#elif platform == \"colab\": # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
"# !npx localtunnel --port 8501"
"if not IN_COLAB and run_streamlit:\n",
" !streamlit run streamlit_report/sections/report_manager.py\n",
"elif run_streamlit:\n",
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
" # Run the Streamlit app in the background\n",
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
" # Expose the Streamlit app on port 8501\n",
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
"else:\n",
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
]
},
{
Expand Down Expand Up @@ -1547,7 +1557,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.5. Stremlit report with the extended configuration file"
"### 5.5. Stremlit report with the extended configuration file\n",
"\n",
"To launch the Streamlit web application from Colab, open the generated URL and copy the localtunnel entry point IP into the corresponding field on the opened page. Once submited, you will be redirected to your Streamlit web application."
]
},
{
Expand All @@ -1567,13 +1579,20 @@
"metadata": {},
"outputs": [],
"source": [
"run_streamlit = False\n",
"# run_streamlit = True # uncomment line to run the streamlit report\n",
"# Launch the Streamlit report depneding on the platform\n",
"#if platform == \"local_notebook\":\n",
"# !streamlit run streamlit_report/sections/report_manager.py\n",
"#elif platform == \"colab\":\n",
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
"# !npx localtunnel --port 8501"
"if not IN_COLAB and run_streamlit:\n",
" !streamlit run streamlit_report/sections/report_manager.py\n",
"elif run_streamlit:\n",
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
" # Run the Streamlit app in the background\n",
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
" # Expose the Streamlit app on port 8501\n",
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
"else:\n",
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
]
},
{
Expand All @@ -1597,7 +1616,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "vuegen-IFxaxej_-py3.12",
"display_name": "vuegen",
"language": "python",
"name": "python3"
},
Expand All @@ -1611,7 +1630,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.9.21"
}
},
"nbformat": 4,
Expand Down