diff --git a/README.md b/README.md index c0aeac2..bb83be3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,14 @@ VueGen is a Python library that automates the creation of scientific reports.

+| Information | Links | +| :--- | :--- | +| **Package** |[ ![PyPI Latest Release](https://img.shields.io/pypi/v/vuegen.svg)](https://pypi.org/project/vuegen/) [![Supported versions](https://img.shields.io/pypi/pyversions/vuegen.svg)](https://pypi.org/project/vuegen/)| +| **Documentation** | [![Docs](https://readthedocs.org/projects/vuegen/badge/?style=flat)](https://vuegen.readthedocs.io/)| +| **Build** | [![CI](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/cdci.yml/badge.svg)](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/cdci.yml) [![Docs](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/docs.yml/badge.svg)](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/docs.yml)| +| **Examples** | [![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)](https://multiomics-analytics-group.github.io/vuegen/) [![Streamlit](https://img.shields.io/badge/Streamlit-%23FE4B4B.svg?style=for-the-badge&logo=streamlit&logoColor=white)](https://multiomics-analytics-group.github.io/vuegen/)| +| **Discuss on GitHub** | [![GitHub issues](https://img.shields.io/github/issues/Multiomics-Analytics-Group/vuegen)](https://github.com/Multiomics-Analytics-Group/vuegen/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/Multiomics-Analytics-Group/vuegen)](https://github.com/Multiomics-Analytics-Group/vuegen/pulls) | + ## Table of contents: - [About the project](#about-the-project) - [Installation](#installation) @@ -100,7 +108,6 @@ The current report types supported by VueGen are: ## Contact If you have comments or suggestions about this project, you can [open an issue][issues] in this repository. -[issues]: https://github.com/Multiomics-Analytics-Group/vuegen/issues/new [streamlit]: https://streamlit.io/ [vuegen-pypi]: https://pypi.org/project/vuegen/ [quarto]: https://quarto.org/ diff --git a/docs/vuegen_case_study_earth_microbiome.ipynb b/docs/vuegen_case_study_earth_microbiome.ipynb index 4945c0b..4f8b19e 100644 --- a/docs/vuegen_case_study_earth_microbiome.ipynb +++ b/docs/vuegen_case_study_earth_microbiome.ipynb @@ -6,7 +6,7 @@ "source": [ "# Vuegen Case Study - Earth Microbiome Project\n", "\n", - "\"Open\n", + "[![Open In Colab][colab_badge]][colab_link]\n", "\n", "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", "\n", @@ -14,7 +14,7 @@ "\n", "An overview of the VueGen workflow is shown in the figure below:\n", "\n", - "![Vuegen graphical abstarct](./images/vuegen_graph_abstract.png)\n", + "![Vuegen graphical abstarct][abstractfig_vuegen]\n", "\n", "## About the data\n", "\n", @@ -38,6 +38,9 @@ "- Part of this notebook's code was inspired by the scripts and notebooks from the [EMP GitHub repository][emp_repo].\n", "- You can find more details about the project in this [GitHub repository][githubrepo].\n", "\n", + "[colab_badge]: https://colab.research.google.com/assets/colab-badge.svg\n", + "[colab_link]: https://colab.research.google.com/github/Multiomics-Analytics-Group/vuegen/blob/main/docs/vuegen_case_study_earth_microbiome.ipynb\n", + "[abstractfig_vuegen]: https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_graph_abstract.png\n", "[emp_repo]: https://github.com/biocore/emp/tree/master\n", "[emp_paper]: https://www.nature.com/articles/nature24621\n", "[Mona]: https://multiomics-analytics-group.github.io/\n", @@ -49,14 +52,42 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 0. Work environment setup" + "## 0. Work environment setup and helper functions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### 0.1. Installing libraries" + "### 0.1. 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`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Output directory\n", + "base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 0.2. Installing libraries" ] }, { @@ -79,16 +110,27 @@ "%pip install cartopy seaborn biom-format" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Optional library to launch a streamlit app from colab\n", + "if platform == 'colab':\n", + " !npm install localtunnel" + ] + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### 0.2. Importing libraries" + "### 0.3. Importing libraries" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -111,24 +153,25 @@ "import networkx as nx\n", "\n", "from vuegen import report_generator\n", - "from vuegen.utils import get_logger, load_yaml_config" + "from vuegen.utils import get_logger, load_yaml_config\n", + "\n", + "if platform == 'colab':\n", + " import urllib" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### 0.3. Working directory" + "### 0.4. Create working directory" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# Create the output directory\n", - "base_output_dir = \"./example_data/Earth_microbiome_vuegen_demo_notebook/\"\n", "os.makedirs(base_output_dir, exist_ok=True)" ] }, @@ -136,13 +179,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### 0.4. Markdown project description\n", + "### 0.5. Markdown project description\n", "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." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -165,12 +208,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### 0.5. Helper functions" + "### 0.6. Helper functions" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -244,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 31, "metadata": {}, "outputs": [], "source": [ @@ -267,7 +310,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 32, "metadata": {}, "outputs": [], "source": [ @@ -499,7 +542,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -514,7 +557,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -722,7 +765,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -739,7 +782,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -877,7 +920,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 33, "metadata": {}, "outputs": [], "source": [ @@ -906,7 +949,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 34, "metadata": {}, "outputs": [], "source": [ @@ -1156,7 +1199,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": {}, "outputs": [], "source": [ @@ -1178,7 +1221,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ @@ -1200,7 +1243,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": {}, "outputs": [], "source": [ @@ -1220,7 +1263,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 28, "metadata": {}, "outputs": [], "source": [ @@ -1240,7 +1283,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -1257,7 +1300,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 30, "metadata": {}, "outputs": [], "source": [ @@ -1353,42 +1396,24 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# The streamlit web application can be run with the following command:\n", - "# streamlit run streamlit_report/sections/report_manager.py" + "# 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" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### 4.2. Revealjs report" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": {}, - "outputs": [], - "source": [ - "# report_type = \"revealjs\"\n", - "# report_name = \"Earth_microbiome_vuegen_demo_notebook_dir\"\n", - "\n", - "# Initialize logger\n", - "# logger = get_logger(f\"{report_type}_report_{report_name}\")\n", - "\n", - "# Generate the report\n", - "# report_generator.get_report(dir_path = base_output_dir, report_type = report_type, logger = logger)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### 4.3. HTML report" + "### 4.2. HTML and other report types" ] }, { @@ -1424,7 +1449,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -1447,7 +1472,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -1473,7 +1498,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -1504,7 +1529,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 23, "metadata": {}, "outputs": [], "source": [ @@ -1561,43 +1586,24 @@ }, { "cell_type": "code", - "execution_count": 41, - "metadata": {}, - "outputs": [], - "source": [ - "# The streamlit web application can be run with the following command:\n", - "# streamlit run streamlit_report/sections/report_manager.py" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### 5.6. Revealjs report with the extended configuration file" - ] - }, - { - "cell_type": "code", - "execution_count": 42, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# Test the changes by generarating the report from the modified YAML file\n", - "# report_type = \"revealjs\"\n", - "# report_name = \"Earth_microbiome_vuegen_demo_notebook_config_extended\"\n", - "\n", - "# Initialize logger\n", - "# logger = get_logger(f\"{report_type}_report_{report_name}\")\n", - "\n", - "# Generate the report\n", - "# report_generator.get_report(config_path = config_path, report_type = report_type, logger = logger)" + "# 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" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### 5.7. HTML report with the extended configuration file" + "### 5.6. HTML and other report types with the extended configuration file" ] }, { @@ -1620,7 +1626,7 @@ ], "metadata": { "kernelspec": { - "display_name": "vuegen", + "display_name": "vuegen-IFxaxej_-py3.12", "language": "python", "name": "python3" }, @@ -1634,7 +1640,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.21" + "version": "3.12.6" } }, "nbformat": 4, diff --git a/requirements.txt b/requirements.txt index 73ca905..4578f31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -55,7 +55,6 @@ ipywidgets==8.1.5 isoduration==20.11.0 itables==2.2.4 jedi==0.19.2 -jinja2==3.1.4 json5==0.10.0 jsonpickle==4.0.1 jsonpointer==3.0.0