Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cdci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
pip install ruff
- name: Lint with ruff
run: |
ruff check .
ruff check src
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
38 changes: 25 additions & 13 deletions docs/api_examples/scatter_plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"\n",
"[![Open In Colab][colab_badge]][colab_link]\n",
"\n",
"[VueCore][vuecore_repo] is a Python package for creating interactive and static visualizations of multi-omics data. \n",
"[VueCore][vuecore_repo] is a Python package for creating interactive and static visualizations of multi-omics data.\n",
"It is part of a broader ecosystem of tools—including [ACore][acore_repo] for data processing and [VueGen][vuegen_repo] for automated reporting—that together enable end-to-end workflows for omics analysis.\n",
"\n",
"This notebook demonstrates how to generate scatter plots using plotting functions from VueCore. We showcase basic and \n",
"advanced plot configurations, highlighting key customization options such as grouping, color mapping, text annotations, and export \n",
"This notebook demonstrates how to generate scatter plots using plotting functions from VueCore. We showcase basic and\n",
"advanced plot configurations, highlighting key customization options such as grouping, color mapping, text annotations, and export\n",
"to multiple file formats.\n",
"\n",
"## Notebook structure\n",
"\n",
"First, we will set up the work environment by installing the necessary packages and importing the required libraries. Next, we will create \n",
"First, we will set up the work environment by installing the necessary packages and importing the required libraries. Next, we will create\n",
"basic and advanced scatter plots.\n",
"\n",
"0. [Work environment setup](#0-work-environment-setup)\n",
Expand Down Expand Up @@ -294,7 +294,8 @@
"# Imports\n",
"import pandas as pd\n",
"import plotly.io as pio\n",
"from vuecore.plots.basic.scatter import create_scatter_plot\n",
"\n",
"from vuecore.plots.basic.scatter import create_scatter_plot\n",
"\n",
"# Set the Plotly renderer based on the environment\n",
"pio.renderers.default = \"notebook\""
Expand Down Expand Up @@ -449,14 +450,25 @@
],
"source": [
"# Created sample data\n",
"sample_df = pd.DataFrame({\n",
" \"gene_expression\": [1.2, 2.5, 3.1, 4.5, 5.2, 6.8, 3.9, 2.1],\n",
" \"log_p_value\": [0.5, 1.5, 2.0, 3.5, 4.0, 5.5, 1.8, 0.9],\n",
" \"regulation\": [\"Up\", \"Up\", \"None\", \"Down\", \"Down\", \"Down\", \"None\", \"Up\"],\n",
" \"significance_score\": [10, 20, 5, 40, 55, 80, 15, 25],\n",
" \"gene_name\": [\"GENE_A\", \"GENE_B\", \"GENE_C\", \"GENE_D\", \"GENE_E\", \"GENE_F\", \"GENE_G\", \"GENE_H\"],\n",
" \"cell_type\": [\"A\", \"B\", \"A\", \"B\", \"A\", \"B\", \"A\", \"B\"],\n",
"})\n",
"sample_df = pd.DataFrame(\n",
" {\n",
" \"gene_expression\": [1.2, 2.5, 3.1, 4.5, 5.2, 6.8, 3.9, 2.1],\n",
" \"log_p_value\": [0.5, 1.5, 2.0, 3.5, 4.0, 5.5, 1.8, 0.9],\n",
" \"regulation\": [\"Up\", \"Up\", \"None\", \"Down\", \"Down\", \"Down\", \"None\", \"Up\"],\n",
" \"significance_score\": [10, 20, 5, 40, 55, 80, 15, 25],\n",
" \"gene_name\": [\n",
" \"GENE_A\",\n",
" \"GENE_B\",\n",
" \"GENE_C\",\n",
" \"GENE_D\",\n",
" \"GENE_E\",\n",
" \"GENE_F\",\n",
" \"GENE_G\",\n",
" \"GENE_H\",\n",
" ],\n",
" \"cell_type\": [\"A\", \"B\", \"A\", \"B\", \"A\", \"B\", \"A\", \"B\"],\n",
" }\n",
")\n",
"\n",
"sample_df"
]
Expand Down
129 changes: 84 additions & 45 deletions docs/api_examples/scatter_plot.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,92 @@
"""
Title: Scatter Plot Examples using VueCore
Description:
This script demonstrates how to generate scatter plots using VueCore — a Python package for creating
interactive and static visualizations of multi-omics data. It is part of an ecosystem including ACore
for data processing and VueGen for automated reporting.

We showcase basic and advanced plot configurations, highlighting customization options such as grouping,
color mapping, annotations, and export to multiple formats.

Script Structure:
0. Work environment setup
1. Basic scatter plot
2. Advanced scatter plot

Authors:
Sebastián Ayala-Ruano
Supervisors:
Henry Webel, Alberto Santos (Multiomics Network Analytics Group, DTU Biosustain)

Institution:
Multiomics Network Analytics Group (MoNA),
Novo Nordisk Foundation Center for Biosustainability (DTU Biosustain)
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.17.2
# kernelspec:
# display_name: vuecore-dev
# language: python
# name: python3
# ---

# %% [markdown]
# # Scatter Plot
#
# ![VueCore logo][vuecore_logo]
#
# [![Open In Colab][colab_badge]][colab_link]
#
# [VueCore][vuecore_repo] is a Python package for creating interactive and static visualizations of multi-omics data.
# It is part of a broader ecosystem of tools—including [ACore][acore_repo] for data processing and [VueGen][vuegen_repo] for automated reporting—that together enable end-to-end workflows for omics analysis.
#
# This notebook demonstrates how to generate scatter plots using plotting functions from VueCore. We showcase basic and
# advanced plot configurations, highlighting key customization options such as grouping, color mapping, text annotations, and export
# to multiple file formats.
#
# ## Notebook structure
#
# First, we will set up the work environment by installing the necessary packages and importing the required libraries. Next, we will create
# basic and advanced scatter plots.
#
# 0. [Work environment setup](#0-work-environment-setup)
# 1. [Basic scatter plot](#1-basic-scatter-plot)
# 2. [Advanced scatter plot](#2-advanced-scatter-plot)
#
# ## Credits and Contributors
# - This notebook was created by Sebastián Ayala-Ruano under the supervision of Henry Webel and Alberto Santos, head of the [Multiomics Network Analytics Group (MoNA)][Mona] at the [Novo Nordisk Foundation Center for Biosustainability (DTU Biosustain)][Biosustain].
# - You can find more details about the project in this [GitHub repository][vuecore_repo].
#
# [colab_badge]: https://colab.research.google.com/assets/colab-badge.svg
# [colab_link]: https://colab.research.google.com/github/Multiomics-Analytics-Group/vuecore/blob/main/docs/api_examples/scatter_plot.ipynb
# [vuecore_logo]: https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuecore/main/docs/images/logo/vuecore_logo.svg
# [Mona]: https://multiomics-analytics-group.github.io/
# [Biosustain]: https://www.biosustain.dtu.dk/
# [vuecore_repo]: https://github.com/Multiomics-Analytics-Group/vuecore
# [vuegen_repo]: https://github.com/Multiomics-Analytics-Group/vuegen
# [acore_repo]: https://github.com/Multiomics-Analytics-Group/acore

# %% [markdown]
# ## 0. Work environment setup

# %% [markdown]
# ### 0.1. Installing libraries and creating global variables for platform and working directory
#
# 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.

# %% tags=["hide-output"]
# VueCore library
# %pip install vuecore

# %% tags=["hide-cell"]
import os

Project Repository:
https://github.com/Multiomics-Analytics-Group/vuecore
IN_COLAB = "COLAB_GPU" in os.environ

License:
MIT License
# %% tags=["hide-cell"]
# Create a directory for outputs
output_dir = "./outputs"
os.makedirs(output_dir, exist_ok=True)

Created: 2025-06-25
Last Updated: 2025-06-25
"""
# %% [markdown]
# ### 0.2. Importing libraries

# %%
# 0. Work environment setup
# 0.1. Installing libraries and creating global variables for platform and working directory
# To run this notebook locally, you should create a virtual environment with the required libraries.
# pip install vuecore

# 0.2. Importing libraries
import os
# Imports
import pandas as pd
import plotly.io as pio

from vuecore.plots.basic.scatter import create_scatter_plot

# Set the Plotly renderer based on the environment, default to notebook, but you can change it
# to "browser" if you do not want to use jupyter widgets.
# Set the Plotly renderer based on the environment
pio.renderers.default = "notebook"

# 0.3. Create a directory for outputs
output_dir = "./outputs"
os.makedirs(output_dir, exist_ok=True)
# %% [markdown]
# ## 1. Basic Scatter Plot

# %%
# 1. Basic Scatter Plot
# Created sample data
sample_df = pd.DataFrame(
{
Expand All @@ -75,6 +108,9 @@
}
)

sample_df

# %%
# Define output path
file_path_png = os.path.join(output_dir, "scatter_basic.png")

Expand All @@ -83,13 +119,16 @@
data=sample_df,
x="gene_expression",
y="log_p_value",
title="Basic Gene Expression Scatter Plot",
file_path=file_path_png,
)

fig.show()

# %% [markdown]
# ## 2. Advanced Scatter Plot

# %%
# 2. Advanced Scatter Plot
# Define output path
file_path_adv_html = os.path.join(output_dir, "scatter_advanced.html")

Expand All @@ -101,7 +140,7 @@
group="regulation",
size="significance_score",
text="gene_name",
title="Advanced Gene Expression Plot",
title="Advanced Gene Expression Scatter Plot",
x_title="Log2 Fold Change",
y_title="-Log10(P-value)",
colors={"Up": "#FF5733", "Down": "#3380FF", "None": "#33FF57"},
Expand Down
64 changes: 33 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
[project]
authors = [{ name = "Alberto Santos Delgado", email = "[email protected]" },
{ name = "Henry Webel", email = "[email protected]"}]
authors = [
{ name = "Alberto Santos Delgado", email = "[email protected]" },
{ name = "Henry Webel", email = "[email protected]" },
]
name = "vuecore"
dynamic = ["version"]
description = "A Python package for plotting related to multimodal molecular data. Works with acore."
license = { text = "GNU General Public License v3" }
readme = "README.md"
requires-python = ">=3.9,<3.13"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

dependencies = [
"numpy",
"pandas",
# "dsp-pandas", # has only pandas related dependencies
"scipy",
"plotly",
# "biopython",
"beautifulsoup4",
"requests",
"dash", # from dash import html
"networkx",
"matplotlib",
"kaleido",
"pyvis",
"wordcloud",
"cyjupyter",
"nltk",
"webweb",
"acore",
"dash-cytoscape",
"pydantic",
"nbformat>=4.2.0",
"numpy",
"pandas",
# "dsp-pandas", # has only pandas related dependencies
"scipy",
"plotly",
# "biopython",
"beautifulsoup4",
"requests",
"dash", # from dash import html
"networkx",
"matplotlib",
"kaleido",
"pyvis",
"wordcloud",
"cyjupyter",
"nltk",
"webweb",
"acore",
"dash-cytoscape",
"pydantic",
"nbformat>=4.2.0",
]

[project.optional-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion src/vuecore/engines/plotly/scatter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from vuecore.schemas.distribution.scatter import ScatterConfig

from vuecore.schemas.basic.scatter import ScatterConfig
from vuecore.utils.statistics import get_density

from .theming import apply_scatter_theme


Expand Down
3 changes: 2 additions & 1 deletion src/vuecore/engines/plotly/theming.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import plotly.graph_objects as go
from vuecore.schemas.distribution.scatter import ScatterConfig

from vuecore.schemas.basic.scatter import ScatterConfig


def apply_scatter_theme(fig: go.Figure, config: ScatterConfig) -> go.Figure:
Expand Down
Empty file.
6 changes: 3 additions & 3 deletions src/vuecore/plots/basic/scatter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pandas as pd
from typing import Any

from vuecore.schemas.distribution.scatter import ScatterConfig
import pandas as pd

from vuecore.engines import get_builder, get_saver
from vuecore import EngineType
from vuecore.engines import get_builder, get_saver
from vuecore.schemas.basic.scatter import ScatterConfig


def create_scatter_plot(
Expand Down
Empty file.
Empty file added src/vuecore/utils/__init__.py
Empty file.