Skip to content

Commit 91f6878

Browse files
authored
Merge branch 'main' into os_installers
2 parents fafc95c + 82fc94e commit 91f6878

File tree

4 files changed

+140
-12
lines changed

4 files changed

+140
-12
lines changed

CITATION.cff

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
cff-version: 1.2.0
2+
message: "If you use VueGen in your research, please cite it as below."
3+
title: "VueGen: Automating the generation of scientific reports"
4+
version: 1.0.0
5+
authors:
6+
- family-names: "Ayala-Ruano"
7+
given-names: "Sebastian"
8+
orcid: "http://orcid.org/0000-0001-9756-6745"
9+
- family-names: "Webel"
10+
given-names: "Henry"
11+
orcid: "http://orcid.org/0000-0001-8833-7617"
12+
- family-names: "Santos"
13+
given-names: "Alberto"
14+
orcid: "http://orcid.org/0000-0002-9163-7730"
15+
doi: "10.1101/2025.03.05.641152"
16+
date-released: "2025-03-05"
17+
url: "https://github.com/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME"
18+
preferred-citation:
19+
type: article
20+
authors:
21+
- family-names: "Ayala-Ruano"
22+
given-names: "Sebastian"
23+
orcid: "http://orcid.org/0000-0001-9756-6745"
24+
- family-names: "Webel"
25+
given-names: "Henry"
26+
orcid: "http://orcid.org/0000-0001-8833-7617"
27+
- family-names: "Santos"
28+
given-names: "Alberto"
29+
orcid: "http://orcid.org/0000-0002-9163-7730"
30+
title: "VueGen: Automating the generation of scientific reports"
31+
journal: "bioRxiv"
32+
year: 2025
33+
doi: "10.1101/2025.03.05.641152"
34+
url: "https://www.biorxiv.org/content/10.1101/2025.03.05.641152v1"

README.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
| Information | Links |
88
| :--- | :--- |
9-
| **Package** |[ ![PyPI Latest Release](https://img.shields.io/pypi/v/vuegen.svg)][vuegen-pypi] [![Supported versions](https://img.shields.io/pypi/pyversions/vuegen.svg)][vuegen-pypi] [![Docker Repository on Quay](https://quay.io/repository/dtu_biosustain_dsp/vuegen/status "Docker Repository on Quay")][vuegen-docker-quay] ![License](https://img.shields.io/github/license/Multiomics-Analytics-Group/vuegen)|
10-
| **Documentation** | [![Docs](https://readthedocs.org/projects/vuegen/badge/?style=flat)][vuegen-docs]|
9+
| **Package** |[![PyPI Latest Release](https://img.shields.io/pypi/v/vuegen.svg)][vuegen-pypi] [![Conda Latest Release](https://img.shields.io/conda/v/bioconda/vuegen.svg)][vuegen-conda] [![Supported versions](https://img.shields.io/pypi/pyversions/vuegen.svg)][vuegen-pypi] [![Docker Repository on Quay](https://quay.io/repository/dtu_biosustain_dsp/vuegen/status "Docker Repository on Quay")][vuegen-docker-quay] [![License](https://img.shields.io/github/license/Multiomics-Analytics-Group/vuegen)][vuegen-license]|
10+
| **Documentation** | [![made-with-sphinx-doc](https://img.shields.io/badge/Made%20with-Sphinx-1f425f.svg)](https://www.sphinx-doc.org/) ![Docs](https://readthedocs.org/projects/vuegen/badge/?style=flat) [![View - Documentation](https://img.shields.io/badge/view-Documentation-blue?style=flat)][vuegen-docs]|
1111
| **Build** | [![CI](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/cdci.yml/badge.svg)][ci-gh-action] [![Docs](https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/docs.yml/badge.svg)][ci-docs]|
1212
| **Examples** | [![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)][emp-html-demo] [![Streamlit](https://img.shields.io/badge/Streamlit-%23FE4B4B.svg?style=for-the-badge&logo=streamlit&logoColor=white)][emp-st-demo]|
1313
| **Discuss on GitHub** | [![GitHub issues](https://img.shields.io/github/issues/Multiomics-Analytics-Group/vuegen)][issues] [![GitHub pull requests](https://img.shields.io/github/issues-pr/Multiomics-Analytics-Group/vuegen)][pulls]|
14+
| **Cite** | [![DOI:10.1101/2025.03.05.641152](https://img.shields.io/badge/DOI-10.1101/2025.03.05.641152-B31B1B.svg)][vuegen-preprint]|
1415

1516
## Table of contents:
1617
- [About the project](#about-the-project)
@@ -19,6 +20,7 @@
1920
- [Case studies](#case-studies)
2021
- [Web application deployment](#web-application-deployment)
2122
- [Credits and acknowledgements](#credits-and-acknowledgements)
23+
- [Citation](#citation)
2224
- [Contact and feedback](#contact-and-feedback)
2325

2426
## About the project
@@ -39,13 +41,14 @@ An extended version of the class diagram with attributes and methods is availabl
3941
The VueGen documentation is available at [vuegen.readthedocs.io][vuegen-docs], where you can find detailed information of the package’s classes and functions, installation and execution instructions, and case studies to demonstrate its functionality.
4042

4143
## Installation
42-
Vuegen is available on [PyPI][vuegen-pypi] and can be installed using pip:
44+
### Pip
45+
VueGen is available on [PyPI][vuegen-pypi] and can be installed using pip:
4346

4447
```bash
4548
pip install vuegen
4649
```
4750

48-
You can also install the package for development from this repository by running the following command:
51+
You can also install the package for development by cloning this repository and running the following command:
4952

5053
```bash
5154
pip install -e path/to/vuegen # specify location
@@ -55,7 +58,15 @@ pip install -e . # in case your pwd is in the vuegen directory
5558
> [!TIP]
5659
> It is recommended to install VueGen inside a virtual environment to manage depenendencies and avoid conflicts with existing packages. You can use the virtual environment manager of your choice, such as `poetry`, `conda`, or `pipenv`.
5760
58-
Vuegen uses [Quarto][quarto] to generate various report types. The pip insallation includes quarto using the [quarto-cli Python library][quarto-cli-pypi]. To test if quarto is installed in your computer, run the following command:
61+
### Conda
62+
VueGen is also available on [Bioconda][vuegen-conda] and can be installed using conda:
63+
64+
```bash
65+
conda install bioconda::vuegen
66+
```
67+
68+
### Dependencies
69+
VueGen uses [Quarto][quarto] to generate various report types. The pip insallation includes quarto using the [quarto-cli Python library][quarto-cli-pypi]. To test if quarto is installed in your computer, run the following command:
5970

6071
```bash
6172
quarto check
@@ -64,9 +75,16 @@ quarto check
6475
> [!TIP]
6576
> If quarto is not installed, you can download the command-line interface from the [Quarto website][quarto-cli] for your operating system.
6677
78+
### Docker
6779
If you prefer not to install VueGen on your system, a pre-configured Docker container is available. It includes all dependencies, ensuring a fully reproducible execution environment. See the [Execution section](#execution) for details on running VueGen with Docker. The official Docker image is available at [quay.io/dtu_biosustain_dsp/vuegen][vuegen-docker-quay].
6880

81+
### Nextflow and nf-core
82+
VueGen is also available as a [nf-core][nfcore] module, customised for compatibility with the [Nextflow][nextflow] environment. This module is designed to automate report generation from outputs produced by other modules, subworkflows, or pipelines. The code and documentation for the nf-core module are available in the [nf-VueGen repository][nf-vuegen].
83+
6984
## Execution
85+
> [!IMPORTANT]
86+
> Here we use the `Earth_microbiome_vuegen_demo_notebook` directory and the `Earth_microbiome_vuegen_demo_notebook.yaml` configuration file as examples, which are available in the `docs/example_data` and `docs/example_config_files` folders, respectively. Make sure to clone this reposiotry to access these contents, or use your own directory and configuration file.
87+
7088
Run VueGen using a directory with the following command:
7189

7290
```bash
@@ -79,7 +97,7 @@ vuegen --directory docs/example_data/Earth_microbiome_vuegen_demo_notebook --rep
7997
It's also possible to provide a configuration file instead of a directory:
8098

8199
```bash
82-
vuegen --config docs/example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml --report_type streamlit
100+
vuegen --config docs/example_config_files/Earth_microbiome_vuegen_demo_notebook.yaml --report_type streamlit
83101
```
84102

85103
The current report types supported by VueGen are:
@@ -97,7 +115,7 @@ Instead of installing VueGen locally, you can run it directly from a Docker cont
97115

98116
```bash
99117
docker run --rm \
100-
-v "$(pwd)docs/example_data/Earth_microbiome_vuegen_demo_notebook:/home/appuser/Earth_microbiome_vuegen_demo_notebook" \
118+
-v "$(pwd)/docs/example_data/Earth_microbiome_vuegen_demo_notebook:/home/appuser/Earth_microbiome_vuegen_demo_notebook" \
101119
-v "$(pwd)/output_docker:/home/appuser/quarto_report" \
102120
quay.io/dtu_biosustain_dsp/vuegen:docker --directory /home/appuser/Earth_microbiome_vuegen_demo_notebook --report_type streamlit
103121
```
@@ -147,16 +165,40 @@ Once a Streamlit report is generated, it can be deployed as a web application to
147165
These options provide flexibility depending on whether the goal is online accessibility, lightweight execution, or local application distribution.
148166

149167
## Credits and acknowledgements
150-
- Vuegen was developed by the [Multiomics Network Analytics Group (MoNA)][Mona] at the [Novo Nordisk Foundation Center for Biosustainability (DTU Biosustain)][Biosustain].
168+
- VueGen was developed by the [Multiomics Network Analytics Group (MoNA)][Mona] at the [Novo Nordisk Foundation Center for Biosustainability (DTU Biosustain)][Biosustain].
151169
- VueGen relies on the work of numerous open-source projects like [Streamlit](streamlit), [Quarto][quarto], and others. A big thank you to their authors for making this possible!
152170
- The vuegen logo was designed based on an image created by [Scriberia][scriberia] for The [Turing Way Community][turingway], which is shared under a CC-BY licence. The original image can be found at [Zenodo][zenodo-turingway].
153171

172+
## Citation
173+
If you use VueGen in your research or publications, please cite it as follows:
174+
175+
**APA:**
176+
177+
Ayala-Ruano, S., Webel, H., & Santos, A. (2025). *VueGen: Automating the generation of scientific reports*. bioRxiv. https://doi.org/10.1101/2025.03.05.641152
178+
179+
**BibTeX:**
180+
181+
```bibtex
182+
@article{Ayala-Ruano2025VueGen,
183+
author = {Ayala-Ruano, Sebastian and Webel, Henry and Santos, Alberto},
184+
title = {VueGen: Automating the generation of scientific reports},
185+
journal = {bioRxiv},
186+
year = {2025},
187+
doi = {10.1101/2025.03.05.641152},
188+
publisher = {Cold Spring Harbor Laboratory},
189+
url = {https://www.biorxiv.org/content/10.1101/2025.03.05.641152},
190+
eprint = {https://www.biorxiv.org/content/10.1101/2025.03.05.641152.full.pdf}
191+
}
192+
```
193+
154194
## Contact and feedback
155195
We appreciate your feedback! If you have any comments, suggestions, or run into issues while using VueGen, feel free to [open an issue][new-issue] in this repository. Your input helps us make VueGen better for everyone.
156196

157197
[streamlit]: https://streamlit.io/
158198
[vuegen-pypi]: https://pypi.org/project/vuegen/
199+
[vuegen-conda]: https://anaconda.org/bioconda/vuegen
159200
[vuegen-docker-quay]: https://quay.io/repository/dtu_biosustain_dsp/vuegen
201+
[vuegen-license]: https://github.com/Multiomics-Analytics-Group/vuegen/blob/main/LICENSE
160202
[vuegen-class-diag-att]: https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_classdiagram_withattmeth.pdf
161203
[vuegen-docs]: https://vuegen.readthedocs.io/
162204
[ci-gh-action]: https://github.com/Multiomics-Analytics-Group/vuegen/actions/workflows/cdci.yml
@@ -165,9 +207,13 @@ We appreciate your feedback! If you have any comments, suggestions, or run into
165207
[emp-st-demo]: https://earth-microbiome-vuegen-demo.streamlit.app/
166208
[issues]: https://github.com/Multiomics-Analytics-Group/vuegen/issues
167209
[pulls]: https://github.com/Multiomics-Analytics-Group/vuegen/pulls
210+
[vuegen-preprint]: https://doi.org/10.1101/2025.03.05.641152
168211
[quarto]: https://quarto.org/
169212
[quarto-cli-pypi]: https://pypi.org/project/quarto-cli/
170213
[quarto-cli]: https://quarto.org/docs/get-started/
214+
[nfcore]: https://nf-co.re/
215+
[nextflow]: https://www.nextflow.io/
216+
[nf-vuegen]: https://github.com/Multiomics-Analytics-Group/nf-vuegen/
171217
[colab_badge]: https://colab.research.google.com/assets/colab-badge.svg
172218
[colab_link_intro_demo]: https://colab.research.google.com/github/Multiomics-Analytics-Group/vuegen/blob/main/docs/vuegen_basic_case_study.ipynb
173219
[colab_link_emp_demo]: https://colab.research.google.com/github/Multiomics-Analytics-Group/vuegen/blob/main/docs/vuegen_case_study_earth_microbiome.ipynb

src/vuegen/quarto_reportview.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pandas as pd
1010

1111
from . import report as r
12-
from .utils import create_folder, is_url
12+
from .utils import create_folder, is_url, sort_imports
1313

1414

1515
class QuartoReportView(r.ReportView):
@@ -136,7 +136,16 @@ def generate_report(
136136
]
137137

138138
# Remove duplicated imports
139-
report_unique_imports = list(set(flattened_report_imports))
139+
report_unique_imports = set(flattened_report_imports)
140+
141+
# ! set leads to random import order
142+
# ! separate and sort import statements, separate from setup code
143+
144+
report_unique_imports, setup_statements = sort_imports(
145+
report_unique_imports
146+
)
147+
report_unique_imports += os.linesep
148+
report_unique_imports.extend(setup_statements)
140149

141150
# Format imports
142151
report_formatted_imports = "\n".join(report_unique_imports)
@@ -861,8 +870,9 @@ def _generate_component_imports(self, component: r.Component) -> List[str]:
861870
r.PlotType.PLOTLY: ["import plotly.io as pio", "import requests"],
862871
},
863872
"dataframe": [
873+
"init_notebook_mode(all_interactive=True)", # ! somehow order is random in qmd file
864874
"import pandas as pd",
865-
"from itables import show",
875+
"from itables import show, init_notebook_mode",
866876
"import dataframe_image as dfi",
867877
],
868878
"markdown": ["import IPython.display as display", "import requests"],

src/vuegen/utils.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from io import StringIO
1616
from pathlib import Path
17-
from typing import Type
17+
from typing import Iterable, Type
1818
from urllib.parse import urlparse
1919

2020
import networkx as nx
@@ -808,3 +808,41 @@ def generate_footer() -> str:
808808
</a>
809809
</footer>"""
810810
return footer
811+
812+
813+
def sort_imports(imp: Iterable[str]) -> tuple[list[str], list[str]]:
814+
"""Separte 'from' and 'import' statements from setup code.
815+
816+
Parameters
817+
----------
818+
imp : Iterable[str]
819+
A list of import statements and setup statements.
820+
821+
Returns
822+
-------
823+
Tuple[List[str], List[str]]
824+
A tuple of two lists: one for import statements and one for setup statements.
825+
826+
Examples
827+
--------
828+
>>> imp = [
829+
... 'import logging',
830+
... 'import shutil',
831+
... 'logging.basicConfig(level=logging.INFO)',
832+
... 'import pandas as pd',
833+
... 'import numpy as np',
834+
... ]
835+
>>> sort_imports(imp)
836+
(['import logging', 'import numpy as np', 'import pandas as pd', 'import shutil
837+
], ['logging.basicConfig(level=logging.INFO)'])
838+
"""
839+
imports_statements, setup_statements = [], []
840+
for line in imp:
841+
line = line.strip() # just for safety
842+
if line.startswith("from ") or line.startswith("import "):
843+
imports_statements.append(line)
844+
else:
845+
setup_statements.append(line)
846+
imports_statements.sort()
847+
setup_statements.sort()
848+
return imports_statements, setup_statements

0 commit comments

Comments
 (0)