Skip to content

Commit fd424b5

Browse files
committed
🔀 Merge: solve merge conflicts and merge updated main into config-generator branch
2 parents 19d7e82 + bcd91ad commit fd424b5

File tree

13 files changed

+175
-56
lines changed

13 files changed

+175
-56
lines changed

‎.github/workflows/cdci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'pip' # caching pip dependencies
25+
cache-dependency-path: '**/pyproject.toml'
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install pytest
30+
pip install -e .
31+
- name: Run tests
32+
run: python -m pytest tests
33+

‎README.md‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,46 @@ Also, the class diagram for the project is presented below to illustrate the arc
3434
</p>
3535

3636
## Installation
37-
......
37+
38+
You can install the package for development from this repository by running the following command:
39+
40+
```bash
41+
pip install -e path/to/vuegen # specify location
42+
pip install -e . # in case you pwd is in the vuegen directory
43+
```
44+
45+
### Quatro installation
46+
47+
Install quatro with vueguen if you don't have it globally installed.
48+
49+
```bash
50+
pip install -e ".[quarto]" # specify location
51+
```
52+
53+
if you use conda a conda environement you can install quatro from the conda-forge channel
54+
in case it did not work.
55+
56+
```bash
57+
conda install -c conda-forge quarto
58+
```
59+
60+
Test your quarto installation by running the following command:
61+
62+
```bash
63+
quarto check
64+
```
65+
3866

3967
## Execution
40-
``` shell
41-
python vuegen/main.py --config report_config_micw2graph.yaml --report_type streamlit
68+
69+
```bash
70+
python vuegen/main.py --config example_data/MicW2Graph/report_config_micw2graph.yaml --report_type streamlit
4271
```
72+
4373
The current report types are streamlit, html, pdf, docx, odt, revealjs, pptx, and jupyter.
4474

4575
## Contact
4676
If you have comments or suggestions about this project, you can [open an issue][issues] in this repository.
4777

4878
[issues]: https://github.com/Multiomics-Analytics-Group/vuegen/issues/new
49-
[streamlit]: https://streamlit.io/
79+
[streamlit]: https://streamlit.io/

‎example_data/MicW2Graph/report_config_micw2graph.yaml‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ report:
99
infer potential interactions among microorganisms through microbial association networks (MANs). MicW2Graph enables the
1010
investigation of research questions related to WWT, focusing on aspects such as microbial connections, community memberships,
1111
and potential ecological functions.
12-
graphical_abstract: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/Methods_MicW2Graph.png
13-
logo: /Users/asaru/Documents/DTU/MoNA/vuegen/docs/images/vuegen_logo.png
12+
graphical_abstract: example_data/MicW2Graph/Methods_MicW2Graph.png
13+
logo: docs/images/vuegen_logo.png
1414
sections:
1515
- title: Exploratory Data Analysis
1616
subsections:
@@ -25,34 +25,34 @@ sections:
2525
- title: Multiline plot (altair)
2626
component_type: plot
2727
plot_type: altair
28-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/1_Abundance_data/2_multilineplot_altair.json
28+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/1_Abundance_data/2_multilineplot_altair.json
2929
- title: Abundance data for all studies (csv)
3030
component_type: dataframe
3131
file_path: https://raw.githubusercontent.com/sayalaruano/report_generator_st_cloud_test/main/example_data/MicW2Graph/abundance_data_allbiomes.csv
3232
file_format: csv
3333
delimiter: ','
3434
- title: Abundance data for all studies (xls)
3535
component_type: dataframe
36-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/1_Abundance_data/4_abundance_data_allbiomes.xls
36+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/1_Abundance_data/4_abundance_data_allbiomes.xls
3737
file_format: xls
3838
delimiter: ','
3939
- title: Sample data
4040
components:
4141
- title: Number of samples per study (png)
4242
component_type: plot
4343
plot_type: static
44-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/3_number_samples_per_study.png
44+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/3_number_samples_per_study.png
4545
- title: Sampling countries for all studies (plotly)
4646
component_type: plot
4747
plot_type: plotly
48-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/1_pie_plot_countries_plotly.json
48+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/1_pie_plot_countries_plotly.json
4949
- title: Sample data for all studies (parquet)
5050
component_type: dataframe
51-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/4_sample_info_allbiomes.parquet
51+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/4_sample_info_allbiomes.parquet
5252
file_format: parquet
5353
- title: Sample data for all studies (txt)
5454
component_type: dataframe
55-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/5_sample_info_allbiomes.txt
55+
file_path: example_data/MicW2Graph/1_Exploratory_Data_Analysis/2_Sample_data/5_sample_info_allbiomes.txt
5656
file_format: txt
5757
- title: Extra information
5858
components:
@@ -66,17 +66,17 @@ sections:
6666
- title: Network1 (graphml)
6767
component_type: plot
6868
plot_type: interactive_network
69-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/2_Microbial_Association_Networks/1_Network_visualization1/1_man_example.graphml
69+
file_path: example_data/MicW2Graph/2_Microbial_Association_Networks/1_Network_visualization1/1_man_example.graphml
7070
- title: Network Visualization2
7171
components:
7272
- title: Network2 (edge list csv)
7373
component_type: plot
7474
plot_type: interactive_network
7575
csv_network_format: edgelist
76-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/2_Microbial_Association_Networks/2_Network_visualization2/1_man_example.csv
76+
file_path: example_data/MicW2Graph/2_Microbial_Association_Networks/2_Network_visualization2/1_man_example.csv
7777
- title: Edge list (csv)
7878
component_type: dataframe
79-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/2_Microbial_Association_Networks/2_Network_visualization2/1_man_example.csv
79+
file_path: example_data/MicW2Graph/2_Microbial_Association_Networks/2_Network_visualization2/1_man_example.csv
8080
file_format: csv
8181
delimiter: ','
8282
caption: This is the edge list of the network
@@ -85,13 +85,13 @@ sections:
8585
- title: Network3 (cyjs)
8686
component_type: plot
8787
plot_type: interactive_network
88-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/2_Microbial_Association_Networks/3_Network_visualization3/1_man_example.cyjs
88+
file_path: example_data/MicW2Graph/2_Microbial_Association_Networks/3_Network_visualization3/1_man_example.cyjs
8989
- title: Network Visualization4
9090
components:
9191
- title: Network4 (html)
9292
component_type: plot
9393
plot_type: interactive_network
94-
file_path: /Users/asaru/Documents/DTU/MoNA/vuegen/example_data/MicW2Graph/2_Microbial_Association_Networks/4_Network_visualization4/1_ckg_network.html
94+
file_path: example_data/MicW2Graph/2_Microbial_Association_Networks/4_Network_visualization4/1_ckg_network.html
9595
- title: Network Visualization5
9696
components:
9797
- title: Network5 (remote html)

‎pyproject.toml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[tool.poetry]
2-
name = "report-generator"
2+
name = "vuegen"
33
version = "0.1.0"
44
description = "Module to generate automatic web interface reports with visualizations"
55
authors = ["MoNA group"]
66
license = "MIT"
77
readme = "README.md"
8+
repository = "https://github.com/Multiomics-Analytics-Group/vuegen"
89

910
[tool.poetry.dependencies]
1011
python = ">=3.9,<3.9.7 || >3.9.7,<4.0"
@@ -25,11 +26,20 @@ itables = "^2.2.2"
2526
kaleido = "0.2.0"
2627
vl-convert-python = "^1.7.0"
2728
dataframe-image = "^0.2.6"
28-
29+
strenum = { version = "^0.4.15", python = "<3.11" }
2930

3031
[tool.poetry.group.dev.dependencies]
3132
ipykernel = "^6.29.5"
3233

34+
3335
[build-system]
3436
requires = ["poetry-core"]
3537
build-backend = "poetry.core.masonry.api"
38+
39+
# https://stackoverflow.com/a/60990574/9684872
40+
[tool.poetry.extras]
41+
streamlit = ["streamlit"]
42+
quarto = ["quarto", "ipykernel"]
43+
44+
# [project.scripts]
45+
# my-script = "vuegen.main:main"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
def test_imports():
3+
import vuegen
4+
import vuegen.main
5+
import vuegen.quarto_reportview
6+
import vuegen.report
7+
import vuegen.report_generator
8+
import vuegen.streamlit_reportview
9+
import vuegen.utils
10+
11+
assert vuegen.__version__
12+

‎vuegen/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from importlib.metadata import version
2+
3+
__version__ = version("vuegen")

‎vuegen/config_manager.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import os
2-
import report as r
32
from pathlib import Path
43
from typing import Dict, List, Union, Tuple
5-
from utils import get_logger, assert_enum_value
4+
5+
from . import report as r
6+
from .utils import assert_enum_value, get_logger
7+
68

79
class ConfigManager:
810
"""
@@ -518,4 +520,4 @@ def _create_chatbot_component(self, component_data: dict) -> r.ChatBot:
518520
caption = component_data.get('caption'),
519521
headers = component_data.get('headers'),
520522
params = component_data.get('params')
521-
)
523+
)

‎vuegen/main.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import report_generator
21
from pathlib import Path
3-
from utils import get_logger, get_args
2+
3+
from vuegen import report_generator
4+
from vuegen.utils import get_args, get_logger
45

56
if __name__ == '__main__':
67
# Parse command-line arguments

‎vuegen/quarto_reportview.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import os
22
import subprocess
3-
import report as r
43
from typing import List
4+
55
import networkx as nx
66
import pandas as pd
7-
from utils import create_folder, is_url
7+
8+
from . import report as r
9+
from .utils import create_folder, is_url
10+
811

912
class QuartoReportView(r.ReportView):
1013
"""
@@ -117,6 +120,9 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
117120
except subprocess.CalledProcessError as e:
118121
self.report.logger.error(f"Error running '{self.report.title}' {self.report_type} report: {str(e)}")
119122
raise
123+
except FileNotFoundError as e:
124+
self.report.logger.error(f"Quarto is not installed. Please install Quarto to run the report: {str(e)}")
125+
raise
120126

121127
def _create_yaml_header(self) -> str:
122128
"""

‎vuegen/report.py‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1+
import json
2+
import logging
13
import os
24
from abc import ABC, abstractmethod
35
from dataclasses import dataclass, field
4-
from typing import ClassVar
5-
from enum import StrEnum, auto
6-
from typing import List, Optional
6+
from enum import auto
7+
8+
try:
9+
from enum import StrEnum
10+
except ImportError:
11+
from strenum import StrEnum
12+
13+
from typing import ClassVar, List, Optional
14+
15+
import matplotlib.pyplot as plt
716
import networkx as nx
817
import pandas as pd
9-
import logging
1018
import requests
11-
import json
12-
import matplotlib.pyplot as plt
1319
from pyvis.network import Network
14-
from utils import cyjs_to_networkx, pyvishtml_to_networkx, fetch_file_stream
20+
21+
from .utils import cyjs_to_networkx, fetch_file_stream, pyvishtml_to_networkx
22+
1523

1624
class ReportType(StrEnum):
1725
STREAMLIT = auto()
@@ -741,4 +749,4 @@ def _generate_subsection(self, subsection: Subsection) -> tuple[List[str], List[
741749
- list of subsection content lines (List[str])
742750
- list of imports for the subsection (List[str])
743751
"""
744-
pass
752+
pass

0 commit comments

Comments
 (0)