VueCore

VueCore#

  • implements at the moment not too many figures

  • will be used to define plotting functions for certain analysis types in our core analysis library

  • at the moment only support the plotly backend

Colab specific setup:

import os

IN_COLAB = "COLAB_GPU" in os.environ

if IN_COLAB:
    !pip install vuecore

Import libraries

import os
import pathlib

import pandas as pd
from vuecore.plots.basic.histogram import create_histogram_plot

IN_COLAB = "COLAB_GPU" in os.environ

Proteomics data example#

  • load from repository if in colab

dir_data = pathlib.Path("data")
fname = dir_data / "proteins" / "proteins.csv"
if IN_COLAB:
    fname = (
        "https://raw.githubusercontent.com/biosustain/dsp_workshop_dataviz_python"
        "/refs/heads/main/data/proteins/proteins.csv"
    )
df = (
    pd.read_csv(fname, index_col=0)
    .rename_axis("Protein_ID", axis=1)
    .stack()
    .reset_index(name="Intensity")
)
df
Reference Protein_ID Intensity
0 DMSO_rep1 A5A613 27.180209
1 DMSO_rep1 P00350 28.151576
2 DMSO_rep1 P00363 30.247131
3 DMSO_rep1 P00370 27.459171
4 DMSO_rep1 P00393 26.823758
... ... ... ...
15084 Suf_rep4 Q47710 27.071346
15085 Suf_rep4 Q57261 26.643479
15086 Suf_rep4 Q59385 27.847610
15087 Suf_rep4 Q7DFV3 27.605449
15088 Suf_rep4 Q93K97 26.177716

15089 rows × 3 columns

# to be continued
# Generate the advanced histogram plot
fig = create_histogram_plot(
    data=df,
    x="Intensity",
    color="Reference",
    barmode="overlay",
    histnorm="probability density",
    title="Protein intensities by sample",
    subtitle="Histogram with probability density normalized",
    labels={"Intensity": "Protein Intensity", "Reference": "Sample"},
    hover_data=["Protein_ID"],
    opacity=0.75,
)
fig

For now vuecore is built on top of ploltly:

type(fig)
plotly.graph_objs._figure.Figure