diff --git a/docs/example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml b/docs/example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml
deleted file mode 100644
index c7847d5..0000000
--- a/docs/example_data/Earth_microbiome_vuegen_demo_notebook/Earth_microbiome_vuegen_demo_notebook_config.yaml
+++ /dev/null
@@ -1,140 +0,0 @@
-report:
- title: Earth Microbiome Vuegen Demo Notebook
- description: "The Earth Microbiome Project (EMP) is a systematic attempt to characterize\
- \ global microbial taxonomic and functional diversity for the benefit of the planet\
- \ and humankind. \n It aimed to sample the Earth\u2019s microbial communities\
- \ at an unprecedented scale in order to advance our understanding of the organizing\
- \ biogeographic principles that govern microbial community structure. \n The\
- \ EMP dataset is generated from samples that individual researchers have compiled\
- \ and contributed to the EMP. \n The result is both a reference database giving\
- \ global context to DNA sequence data and a framework for incorporating data from\
- \ future studies, fostering increasingly complete characterization of Earth\u2019\
- s microbial diversity.\n \n You can find more information about the Earth Microbiome\
- \ Project at https://earthmicrobiome.org/ and in the [original article](https://www.nature.com/articles/nature24621).\n"
- graphical_abstract: ''
- logo: ''
-sections:
-- title: Exploratory Data Analysis
- description: ''
- subsections:
- - title: Sample Exploration
- description: ''
- components:
- - title: Metadata Random Subset
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/1_Exploratory_data_analysis/1_sample_exploration/1_metadata_random_subset.csv
- description: ''
- caption: ''
- component_type: DATAFRAME
- file_format: CSV
- delimiter: ','
- - title: Animal Samples Map
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/1_Exploratory_data_analysis/1_sample_exploration/2_animal_samples_map.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
- - title: Plant Samples Map
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/1_Exploratory_data_analysis/1_sample_exploration/3_plant_samples_map.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: PLOTLY
- - title: Saline Samples Map
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/1_Exploratory_data_analysis/1_sample_exploration/4_saline_samples_map.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: ALTAIR
-- title: Metagenomics
- description: ''
- subsections:
- - title: Alpha Diversity
- description: ''
- components:
- - title: Alpha Diversity Host Associated Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/1_alpha_diversity/1_alpha_diversity_host_associated_samples.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
- - title: Alpha Diversity Free Living Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/1_alpha_diversity/2_alpha_diversity_free_living_samples.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: PLOTLY
- - title: Average Copy Number
- description: ''
- components:
- - title: Average Copy Number Emp Ontology Level2
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/2_average_copy_number/1_average_copy_number_emp_ontology_level2.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
- - title: Average Copy Number Emp Ontology Level3
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/2_average_copy_number/2_average_copy_number_emp_ontology_level3.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: PLOTLY
- - title: Nestedness
- description: ''
- components:
- - title: Nestedness Random Subset
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/3_nestedness/1_nestedness_random_subset.csv
- description: ''
- caption: ''
- component_type: DATAFRAME
- file_format: CSV
- delimiter: ','
- - title: All Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/3_nestedness/2_all_samples.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: PLOTLY
- - title: Plant Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/3_nestedness/3_plant_samples.json
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: PLOTLY
- - title: Animal Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/3_nestedness/4_animal_samples.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
- - title: Non Saline Samples
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/2_Metagenomics/3_nestedness/5_non_saline_samples.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
-- title: Network Analysis
- description: ''
- subsections:
- - title: Phyla Association Networks
- description: ''
- components:
- - title: Phyla Counts Subset
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/3_Network_analysis/1_phyla_association_networks/1_phyla_counts_subset.csv
- description: ''
- caption: ''
- component_type: DATAFRAME
- file_format: CSV
- delimiter: ','
- - title: Phyla Correlation Network With 0.5 Threshold Edgelist
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/3_Network_analysis/1_phyla_association_networks/2_phyla_correlation_network_with_0.5_threshold_edgelist.csv
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: INTERACTIVE_NETWORK
- csv_network_format: EDGELIST
- - title: Phyla Correlation Network With 0.5 Threshold
- file_path: example_data/Earth_microbiome_vuegen_demo_notebook/3_Network_analysis/1_phyla_association_networks/3_phyla_correlation_network_with_0.5_threshold.png
- description: ''
- caption: ''
- component_type: PLOT
- plot_type: STATIC
diff --git a/src/vuegen/config_manager.py b/src/vuegen/config_manager.py
index 4832b08..f671601 100644
--- a/src/vuegen/config_manager.py
+++ b/src/vuegen/config_manager.py
@@ -63,7 +63,9 @@ def _create_component_config_fromfile(self, file_path: Path) -> Dict[str, str]:
# Add title, file path, and description
component_config["title"] = self._create_title_fromdir(file_path.name)
- component_config["file_path"] = str(file_path.resolve())
+ component_config["file_path"] = (
+ file_path.resolve().as_posix()
+ ) # ! needs to be posix for all OS support
component_config["description"] = ""
component_config["caption"] = ""
diff --git a/src/vuegen/quarto_reportview.py b/src/vuegen/quarto_reportview.py
index 600174d..1dfd75d 100644
--- a/src/vuegen/quarto_reportview.py
+++ b/src/vuegen/quarto_reportview.py
@@ -16,7 +16,7 @@ class QuartoReportView(r.ReportView):
"""
BASE_DIR = "quarto_report"
- STATIC_FILES_DIR = os.path.join(BASE_DIR, "static")
+ STATIC_FILES_DIR = Path(BASE_DIR) / "static"
def __init__(self, report: r.Report, report_type: r.ReportType):
super().__init__(report=report, report_type=report_type)
@@ -124,9 +124,7 @@ def generate_report(
report_formatted_imports = "\n".join(report_unique_imports)
# Write the navigation and general content to a Python file
- with open(
- os.path.join(output_dir, f"{self.BASE_DIR}.qmd"), "w"
- ) as quarto_report:
+ with open(Path(output_dir) / f"{self.BASE_DIR}.qmd", "w") as quarto_report:
quarto_report.write(yaml_header)
quarto_report.write(
f"""\n```{{python}}
@@ -156,7 +154,7 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
"""
try:
subprocess.run(
- ["quarto", "render", os.path.join(output_dir, f"{self.BASE_DIR}.qmd")],
+ ["quarto", "render", Path(output_dir) / f"{self.BASE_DIR}.qmd"],
check=True,
)
if self.report_type == r.ReportType.JUPYTER:
@@ -164,7 +162,7 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
[
"quarto",
"convert",
- os.path.join(output_dir, f"{self.BASE_DIR}.qmd"),
+ Path(output_dir) / f"{self.BASE_DIR}.qmd",
],
check=True,
)
@@ -227,7 +225,7 @@ def _create_yaml_header(self) -> str:
- | Ā© 2025 Multiomics Network Analytics Group (MoNA)
+ | Copyright 2025 Multiomics Network Analytics Group (MoNA)
""",
r.ReportType.PDF: """
pdf:
@@ -273,7 +271,7 @@ def _create_yaml_header(self) -> str:
- | Ā© 2025 Multiomics Network Analytics Group (MoNA)
+ | Copyright 2025 Multiomics Network Analytics Group (MoNA)
""",
r.ReportType.PPTX: """
pptx:
@@ -304,7 +302,7 @@ def _create_yaml_header(self) -> str:
- | Ā© 2025 Multiomics Network Analytics Group (MoNA)
+ | Copyright 2025 Multiomics Network Analytics Group (MoNA)
""",
}
# Create a key based on the report type and format
@@ -413,13 +411,9 @@ def _generate_plot_content(
# Define plot path
if is_report_static:
- static_plot_path = os.path.join(
- static_dir, f"{plot.title.replace(' ', '_')}.png"
- )
+ static_plot_path = Path(static_dir) / f"{plot.title.replace(' ', '_')}.png"
else:
- html_plot_file = os.path.join(
- static_dir, f"{plot.title.replace(' ', '_')}.html"
- )
+ html_plot_file = Path(static_dir) / f"{plot.title.replace(' ', '_')}.html"
# Add content for the different plot types
try:
@@ -431,7 +425,7 @@ def _generate_plot_content(
plot_content.append(self._generate_plot_code(plot))
if is_report_static:
plot_content.append(
- f"""fig_plotly.write_image("{os.path.abspath(static_plot_path)}")\n```\n"""
+ f"""fig_plotly.write_image("{static_plot_path.resolve()}")\n```\n"""
)
plot_content.append(self._generate_image_content(static_plot_path))
else:
@@ -440,7 +434,7 @@ def _generate_plot_content(
plot_content.append(self._generate_plot_code(plot))
if is_report_static:
plot_content.append(
- f"""fig_altair.save("{os.path.abspath(static_plot_path)}")\n```\n"""
+ f"""fig_altair.save("{static_plot_path.resolve()}")\n```\n"""
)
plot_content.append(self._generate_image_content(static_plot_path))
else:
@@ -513,7 +507,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
plot_json = response.text\n"""
else: # If it's a local file
plot_code += f"""
-with open('{os.path.join("..", plot.file_path)}', 'r') as plot_file:
+with open('{Path("..") / plot.file_path}', 'r') as plot_file:
plot_json = plot_file.read()\n"""
# Add specific code for each visualization tool
if plot.plot_type == r.PlotType.PLOTLY:
@@ -527,7 +521,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
if is_url(plot.file_path) and plot.file_path.endswith(".html"):
iframe_src = output_file
else:
- iframe_src = os.path.join("..", output_file)
+ iframe_src = Path("..") / output_file
# Embed the HTML file in an iframe
plot_code = f"""
@@ -573,7 +567,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
}
try:
# Check if the file extension matches any DataFrameFormat value
- file_extension = os.path.splitext(dataframe.file_path)[1].lower()
+ file_extension = Path(dataframe.file_path).suffix.lower()
if not any(
file_extension == fmt.value_with_dot for fmt in r.DataFrameFormat
):
@@ -585,7 +579,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
file_path = (
dataframe.file_path
if is_url(dataframe.file_path)
- else os.path.join("..", dataframe.file_path)
+ else Path("..") / dataframe.file_path
)
# Load the DataFrame using the correct function
@@ -648,7 +642,7 @@ def _generate_markdown_content(self, markdown) -> List[str]:
else: # If it's a local file
markdown_content.append(
f"""
-with open('{os.path.join("..", markdown.file_path)}', 'r') as markdown_file:
+with open('{Path("..") / markdown.file_path}', 'r') as markdown_file:
markdown_content = markdown_file.read()\n"""
)
@@ -694,7 +688,7 @@ def _generate_html_content(self, html) -> List[str]:
iframe_src = (
html.file_path
if is_url(html.file_path)
- else os.path.join("..", html.file_path)
+ else Path("..") / html.file_path
)
iframe_code = f"""