Omicscope visualization¶
Module for OmicScope Object Visualization
This module allows the user to extract and visualize information from OmicScope object. Here, it is possible to evaluate data normalization (MA-Plot, Volcano Plot, Dynamic range plot), individual protein abundance (barplot, boxplot), search for protein-protein interactions, and perform Principal Component Analysis (PCA), Hierarchical clustering analysis (heatmap, pearson correlation plot) and K-means clustering (k-trend).
Some functions below allow user to choose protein to be highlighted and/or plotted. For that, user must write protein ‘gene_name’ (See examples in OmicScope Object tab). Additionally, colors and color palettes follows the matplotlib and seaborn libraries options.
- omicscope.General.GeneralVisualization.DynamicRange(self, *Proteins, color='#565059', protein_color='orange', max_min=False, min_color='#18ab75', max_color='#ab4e18', dpi=300, save=None, vector=True)[source]¶
Dynamic range plot
- Parameters:
mean_color (str, optional) – default color for dots (mean abundance). Defaults to ‘#565059’.
protein_color (str, optional) – Color for specific proteins (Args). Defaults to ‘orange’.
max_min (bool, optional) – Plot the maximum and minimum abundance value for each protein. Defaults to False.
min_color (str, optional) – Color of minimum values. Defaults to ‘#1daec7’.
max_color (str, optional) – Color of maximum values. Defaults to ‘#f7463d’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.MAplot(self, *Proteins, pvalue=0.05, non_regulated='#606060', up_regulated='#E4001B', down_regulated='#6194BC', FoldChange_cutoff=0, save=None, dpi=300, vector=True)[source]¶
MA plot
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 0.05.
non_regulated (str, optional) – color for non-regulated proteins. Defaults to ‘#606060’.
up_regulated (str, optional) – color for up-regulated proteins. Defaults to ‘#E4001B’.
down_regulated (str, optional) – color for down-regulated proteins. Defaults to ‘#6194BC’.
FoldChange_cutoff (int, optional) – Foldchange threshold. Defaults to 0.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.PPInteractions(self, *Proteins, network_k=None, network_iterations=50, score_threshold=0.6, labels=False, modules=False, module_palette='Paired', species=9606, pvalue=0.05, network_type='functional', save=None, dpi=300, vector=True)[source]¶
Protein-Protein interaction
Using String API, OmicScope search or protein-protein interactions among the proteins from users’s dataset.
- Parameters:
network_k (int, optional) – Optimal distance between nodes. If None the distance is set to 1/sqrt(n) where n is the number of nodes. Defauts to None.
network_iterations (int, optional) – Maximum number of iterations taken. Defaults to 50.
score_threshold (float, optional) – String-score threshold. Defaults to 0.6.
labels (bool, optional) – Show protein names. Defaults to False.
modules (bool, optional) – Perform Louvain Method to find communities/modules. Defaults to False.
module_palette (str, optional) – Color palette to assign modules. Defaults to ‘Paired’.
species (int, optional) – String requires the definition of organism to search for proteins name, according to NCBI identifier. Defaults to 9606 (Human). Mus musculus = 10090; Rattus norvegicus = 10116.
pvalue (float, optional) – p-value threshold to proteins to be accepted. Defaults to 0.05 (differentially regulated).
network_type (str, optional) – Interactions can be defined as ‘functional’ or ‘physical’. Defaults to ‘functional’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- Returns:
Networkx object
- omicscope.General.GeneralVisualization.bar_ident(self, logscale=False, col='darkcyan', save=None, dpi=300, vector=True)[source]¶
Show the amount of entities identified and differentially regulated in the study.
- Parameters:
logscale (bool, optional) – Y-axis log-scaled. Defaults to True.
col (str, optional) – Color. Defaults to ‘darkcyan’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – Resolution to save figure. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- Returns:
ax [matplotlib object] – Barplot
- omicscope.General.GeneralVisualization.bar_protein(self, *Proteins, logscale=True, palette='Spectral', save=None, dpi=300, vector=True)[source]¶
Bar plot to show protein abundance in each condition
- Parameters:
logscale (bool, optional) – Apply log-transformed abundance.
Defaults to True.
palette (str, optional) – Palette for groups. Defaults to ‘Spectral’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.boxplot_protein(self, *Proteins, logscale=True, palette='Spectral', save=None, dpi=300, vector=True)[source]¶
Boxplot to show protein abundance in each condition
- Parameters:
logscale (bool, optional) – Apply abundance log-transformed.
Defaults to True.
palette (str, optional) – Palette for groups. Defaults to ‘Spectral’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to
True.
- omicscope.General.GeneralVisualization.color_scheme(df, palette)[source]¶
Generate colors to barplot and
- Parameters:
df (DataFrame) – dataframe
palette (str) – palette
- Returns:
color (dict) – dictionary assign each condition with respective color.
- omicscope.General.GeneralVisualization.correlation(self, *Proteins, pvalue=1.0, sample_method='pearson', clust_metric='euclidean', clust_method='average', palette='RdYlBu_r', linewidth=0.005, color_groups='tab20', sample_label=False, save=None, dpi=300, vector=True)[source]¶
Pairwise correlation plot for samples.
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 1.0.
sample_method (str, optional) – Method to compute pair-wise correlation. Options: pearson, kendal, spearman. Defaults to ‘pearson’.
clust_metric (str, optional) – The distance metric to use. Optionally: braycurtis, canberra, chebyshev, cityblock, correlation, cosine, dice, euclidean, hamming, jaccard, jensenshannon, kulczynski1, mahalanobis, matching, minkowski, rogerstanimoto, russellrao, seuclidean, sokalmichener, sokalsneath, sqeuclidean, yule.
clust_method (str, optional) – Linkage method to use for calculating clusters. Optionally: single, complete, average, weighted, centroid, median, or ward.
palette (str, optional) – Palette for R-distribution. Defaults to ‘RdYlBu_r’.
linewidth (float, optional) – Line width. Defaults to 0.005.
sample_label (bool, optional) – insert biological sample label and condition.
Defaults to False.
color_groups (str, optional) – Color of each group. Defaults to ‘tab20’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.heatmap(self, *Proteins, pvalue=0.05, c_cluster=True, clust_metric='euclidean', clust_method='average', palette='RdYlBu_r', linewidth=0.01, color_groups='tab20', sample_label=False, save=None, dpi=300, vector=True)[source]¶
Heatmap with hierarchical clustering
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 0.05.
c_cluster (bool, optional) – Applies Hierarchical clustering for columns. Defaults to True.
clust_metric (str, optional) – The distance metric to use. Optionally: braycurtis, canberra, chebyshev, cityblock, correlation, cosine, dice, euclidean, hamming, jaccard, jensenshannon, kulczynski1, mahalanobis, matching, minkowski, rogerstanimoto, russellrao, seuclidean, sokalmichener, sokalsneath, sqeuclidean, yule.
clust_method (str, optional) – Linkage method to use for calculating clusters. Optionally: single, complete, average, weighted, centroid, median, or ward.
color_groups (str, optional) – Palette for group colors. Defaults to ‘tab20’.
palette (str, optional) – Palette for protein abundance. Defaults to ‘RdYlBu_r’.
linewidth (float, optional) – Line width. Defaults to 0.01.
sample_label (bool, optional) – insert biological sample label and condition.
Defaults to False.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.k_trend(self, pvalue=0.05, k_cluster=None, save=None, dpi=300, vector=True)[source]¶
Perform a K-mean algorithm
BigTrend apply k-mean algorithm to identify co-expressed proteins/genes. For longitudinal analysis, k-means can help users to visualize the trends of proteins in the evaluated timecourse.
Optionally, the user can define the number of clusters that k-means will cluster proteins and samples. By default, OmicScope run KneeLocator algorithm to suggest an optimal number of clusters.
- Parameters:
OmicScope (_type_) – OmicScope object.
pvalue (float, optional) – _description_. Defaults to 0.05.
k_cluster (int, optional) – Number of cluster to perform k-means. If None, OmicScope defines k-clusters based on KneeLocator algorithm. Defaults to None.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- Returns:
_type_ – _description_
- omicscope.General.GeneralVisualization.normalization_boxplot(self, palette='Dark2', dpi=300, save=None, vector=True)[source]¶
Generates a boxplot of log2-transformed expression data for each sample to evaluate normalization.
Parameters: - palette (str): The color palette to use for the boxplot. Default is ‘Dark2’. - dpi (int): resolution of the saved figure. Default is 300. - save (str): Filepath to save the generated plot. If None, the plot is not saved. Default is None. - vector (bool): If True, save the plot in vector format (SVG). If False, save in raster format (PNG). Default is True.
- omicscope.General.GeneralVisualization.pca(self, pvalue=1.0, scree_color='#900C3F', sample_label=False, palette='tab20', FoldChange_cutoff=0, save=None, dpi=300, vector=True)[source]¶
Perform Principal Component Analysis.
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 1.00.
scree_color (str, optional) – Color of Scree plot. Defaults to ‘#900C3F’.
sample_label (bool, optional) – Insert biological sample label. Defaults to False.
palette (str, optional) – Palette for groups. Defaults to ‘tab20’. FoldChange_cutoff (int, optional): Fold change threshold. Defaults to 0.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.volcano(self, *Proteins, pvalue=0.05, bcol='#962558', palette='viridis', non_regulated='#606060', up_regulated='#E4001B', down_regulated='#6194BC', save=None, dpi=300, vector=True)[source]¶
Plot volcano plot.
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 0.05.
bcol (str, optional) – Density plot color. Defaults to ‘#962558’.
palette (str, optional) – Palette for Multiconditions volcano plot. Defaults to ‘viridis’.
non_regulated (str, optional) – Color of non-differentially regulated proteins. Defaults to ‘#606060’.
up_regulated (str, optional) – Color of up-regulated proteins for volcano with 2 conditions. Defaults to ‘#E4001B’.
down_regulated (str, optional) – Color of down-regulated proteins for volcano with 2 conditions. Defaults to ‘#6194BC’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – . Resolution to save figure. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.volcano_2cond(self, *Proteins, pvalue=0.05, bcol='darkcyan', non_regulated='#606060', up_regulated='#E4001B', down_regulated='#6194BC', save=None, dpi=300, vector=True)[source]¶
Plot a conventional volcano plot
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 0.05.
bcol (str, optional) – color for density plot. Defaults to ‘darkcyan’.
non_regulated (str, optional) – Proteins not differentially regulated. Defaults to ‘#606060’.
up_regulated (str, optional) – Proteins up-regulated in relation to Control group. Defaults to ‘#E4001B’.
down_regulated (str, optional) – Proteins down-regulated in relation to Control group. Defaults to ‘#6194BC’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.
- omicscope.General.GeneralVisualization.volcano_Multicond(self, *Proteins, pvalue=0.05, palette='viridis', bcol='#962558', non_regulated='#606060', save=None, dpi=300, vector=True)[source]¶
Creates a volcano plot for multiple conditions.
In general, volcano plots are designed to compare 2 conditions. Here, we aim to see the distribution of quantified proteins’ p-value and fold changes among multiple conditions.
- Parameters:
pvalue (float, optional) – p-value threshold. Defaults to 0.05.
palette (str, optional) – Color palette to differentiate dots. Defaults to ‘viridis’.
bcol (str, optional) – color for density plot. Defaults to ‘#962558’.
non_regulated (str, optional) – Proteins not differentially regulated. Defaults to ‘#606060’.
save (str, optional) – Path to save figure. Defaults to None.
dpi (int, optional) – figure resolution. Defaults to 300.
vector (bool, optional) – Save figure in as vector (.svg). Defaults to True.