vuecore.viz module#

To be broken down into modules.

vuecore.viz.create_violinplot(df, x, y, color, color_map={})[source]#

This function creates traces for a simple violin plot.

Parameters:
  • df – pandas dataframe with samples as rows and dependent variables as columns.

  • x ((str)) – name of the column containing the group.

  • y ((str)) – name of the column with the dependent variable.

  • color ((str)) – name of the column used for coloring.

  • color_map ((dict)) – dictionary with custom colors

Returns:

plotly figure.

Example:

result = create_violinplot(df, x='group', y='protein a', color='group', color_map={})
vuecore.viz.generate_configuration_tree(report_pipeline, dataset_type)[source]#

This function retrieves the analysis pipeline from a dataset .yml file and creates a Cytoscape network, organized hierarchically.

Parameters:
  • report_pipeline (dict) – dictionary with dataset type analysis and visualization pipeline (conversion of .yml files to python dictionary).

  • dataset_type (str) – type of dataset (‘clinical’, ‘proteomics’, ‘DNAseq’, ‘RNAseq’, ‘multiomics’).

Returns:

new Dash div with title and Cytoscape network, summarizing analysis pipeline.

vuecore.viz.getMapperFigure(data, identifier, title)[source]#

This function uses the KeplerMapper python package to visualize high-dimensional data and generate a FigureWidget that can be shown or editted. This method is suitable for use in Jupyter notebooks. For more information visit https://kepler-mapper.scikit-tda.org/reference/stubs/kmapper.plotlyviz.plotlyviz.html.

Parameters:
  • data – dictionary. Simplicial complex output from the KeplerMapper map method.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • title (str) – plot title.

Returns:

plotly FigureWidget within <div id=”_dash-app-content”> .

vuecore.viz.getPlotTraces(data, key='full', type='lines', div_factor=10010.0, horizontal=False)[source]#

This function returns traces for different kinds of plots.

Parameters:
  • data – Pandas DataFrame with one variable as data.index (i.e. ‘x’) and all others as columns (i.e. ‘y’).

  • type (str) – ‘lines’, ‘scaled markers’, ‘bars’.

  • div_factor (float) – relative size of the markers.

  • horizontal (bool) – bar orientation.

Returns:

list of traces.

Example 1:

result = getPlotTraces(data, key='full', type = 'lines', horizontal=False)

Example 2:

result = getPlotTraces(data, key='full', type = 'scaled markers',
                       div_factor=float(10^3000), horizontal=True)
vuecore.viz.get_2_venn_diagram(data, identifier, cond1, cond2, args)[source]#

This function extracts the exlusive features in cond1 and cond2 and their common features, and build a two-circle venn diagram.

Parameters:
  • data – pandas dataframe with features as rows and group identifiers as columns.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • cond1 (str) – identifier of first group.

  • cond2 (str) – identifier of second group.

  • args (dict) – see below.

Arguments:
  • colors (dict) – dictionary with cond1 and cond2 as keys, and color codes as values.

  • title (str) – plot title.

Returns:

two-circle venn diagram figure within <div id=”_dash-app-content”>.

Example:

result = get_2_venn_diagram(data,
                            identifier='venn2',
                            cond1='group1',
                            cond2='group2',
                            args={'color':{'group1':'blue', 'group2':'red'},
                                  'title':'Two-circle Venn diagram'}
                        )
vuecore.viz.get_WGCNAPlots(data, identifier)[source]#

Takes data from runWGCNA function and builds WGCNA plots.

Parameters:
  • data – tuple with multiple pandas dataframes.

  • identifier (str) – is the id used to identify the div where the figure will be generated.

Returns:

list of dcc.Graph.

vuecore.viz.get_barplot(data, identifier, args)[source]#

This function plots a simple barplot.

Parameters:
  • data – pandas DataFrame with three columns: ‘name’ of the bars, ‘x’ values and ‘y’ values to plot.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • title (str) – plot title.

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • height (str) – plot height.

  • width (str) – plot width.

Returns:

barplot figure within the <div id=”_dash-app-content”>.

Example:

result = get_barplot(data, identifier='barplot', args={'title':'Figure with Barplot'})
vuecore.viz.get_boxplot_grid(data, identifier, args)[source]#

This function plots a boxplot in a grid based on column values.

Parameters:
  • data – pandas DataFrame with columns: ‘x’ values and ‘y’ values to plot, ‘color’ and ‘facet’ (color and facet can be the same).

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • title (str) – plot title.

  • x (str) – name of column with x values.

  • y (str) – name of column with y values.

  • color (str) – name of column with colors

  • facet (str) – name of column specifying grouping

  • height (str) – plot height.

  • width (str) – plot width.

Returns:

boxplot figure within the <div id=”_dash-app-content”>.

Example:

result = get_boxplot_grid(data,
                          identifier='Boxplot',
                          args:{"title":"Boxplot",
                               'x':'sample',
                               'y':'identifier',
                               'color':'group',
                               'facet':'qc_class',
                               'axis':'cols'}
                        )
vuecore.viz.get_clustergrammer_plot(data, identifier, args)[source]#

This function takes a pandas dataframe, calculates clustering, and generates the visualization json.

For more information visit MaayanLab/clustergrammer-py.

Parameters:
  • data – long-format pandas dataframe with columns ‘node1’ (source), ‘node2’ (target) and ‘weight’

  • identifier (str) – id used to identify the div where the figure will be generated

  • args (dict) – see below

Arguments:
  • format (str) – defines if dataframe needs to be converted from ‘edgelist’ to matrix

  • title (str) – plot title

Returns:

Dash Div with heatmap plot from Clustergrammer web-based tool

vuecore.viz.get_complex_heatmapplot(data, identifier, args)[source]#
vuecore.viz.get_cumulative_hazard_plot(data, identifier, args)[source]#
vuecore.viz.get_cytoscape_network(net, identifier, args)[source]#

This function creates a Cytoscpae network in dash.

For more information visit https://dash.plot.ly/cytoscape.

Parameters:
  • net (dict) – dictionary in which each element (key) is defined by a dictionary with ‘id’ and ‘label’ (if it is a node) or ‘source’, ‘target’ and ‘label’ (if it is an edge).

  • identifier (str) – is the id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • title (str) – title of the figure.

  • stylesheet (list[dict]) – specifies the style for a group of elements, a class of elements, or a single element (accepts two keys ‘selector’ and ‘style’).

  • layout (dict) – specifies how the nodes should be positioned on the screen.

Returns:

network figure within <div id=”_dash-app-content”>.

vuecore.viz.get_density(x: ndarray, y: ndarray)[source]#

Get kernal density estimate for each (x, y) point.

vuecore.viz.get_distplot(data, identifier, args)[source]#
Parameters:
  • data

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • group (str) – name of the column containing the group.

vuecore.viz.get_enrichment_plots(enrichment_results, identifier, args)[source]#

This function generates a scatter plot with enriched terms (y-axis) and their adjusted pvalues (x-axis)

Parameters:
  • enrichment_results (pandas.DataFrame) – dataframe with the enrichment data to plot (see enrichment functions for format)

  • identifier (str) – identifier to be used in the app

  • args (dict) – dictionary containing the arguments needed to plot the figure (width, height, title)

Return list:

list of scatter plots one for each enrichment table available (i.e pairwise comparisons)

Example:

figure = get_enrichment_plots(df,
                             identifier='enrichment',
                             args={'width':1500,
                                   'height':800,
                                   'title':'Enrichment'}
                            )
vuecore.viz.get_facet_grid_plot(data, identifier, args)[source]#

This function plots a scatterplot matrix where we can plot one variable against another to form a regular scatter plot, and we can pick a third faceting variable to form panels along the columns to segment the data even further, forming a bunch of vertical panels.

For more information visit https://plot.ly/python/facet-trellis/.

Parameters:
  • data – pandas dataframe with format: ‘group’, ‘name’, ‘type’, and ‘x’ and ‘y’ values to be plotted.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • x (str) – name of the column containing values to plot in the x axis.

  • y (str) – name of the column containing values to plot in the y axis.

  • group (str) – name of the column containing the group.

  • class (str) – name of the column to be used as ‘facet’ column.

  • plot_type (str) – decides the type of plot to appear in the facet grid. The options are ‘scatter’, ‘scattergl’, ‘histogram’, ‘bar’, and ‘box’.

  • title (str) – plot title.

Returns:

facet grid figure within the <div id=”_dash-app-content”>.

Example:

result = get_facet_grid_plot(data,
                             identifier='facet_grid',
                             args={'x':'a',
                                   'y':'b',
                                   'group':'group',
                                   'class':'type',
                                   'plot_type':'bar',
                                   'title':'Facet Grid Plot'}
                            )
vuecore.viz.get_heatmapplot(data, identifier, args)[source]#

This function plots a simple Heatmap.

Parameters:
  • data – is a Pandas DataFrame with the shape of the heatmap where index corresponds to rows and column names corresponds to columns, values in the heatmap corresponds to the row values.

  • identifier (str) – is the id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • format (str) – defines the format of the input dataframe.

  • source (str) – name of the column containing the source.

  • target (str) – name of the column containing the target.

  • values (str) – name of the column containing the values to be plotted.

  • title (str) – title of the figure.

Returns:

heatmap figure within the <div id=”_dash-app-content”>.

Example:

result = get_heatmapplot(data,
                        identifier='heatmap',
                        args={'format':'edgelist',
                              'source':'node1',
                              'target':'node2',
                              'values':'score',
                              'title':'Heatmap Plot'})
vuecore.viz.get_histogram(data, identifier, args)[source]#

Basic histogram figure allows facets cols and rows

Parameters:
  • data – pandas dataframe with at least values to be plotted.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • x (str) – name of the column containing values to plot in the x axis.

  • y (str) – name of the column containing values to plot in the y axis (if used).

  • color (str) – name of the column that defines how the histogram is colored (if used).

  • facet_row (str) – name of the column to be used as ‘facet’ row (if used).

  • facet_col (str) – name of the column to be used as ‘facet’ column (if used).

  • height (int) – height of the plot

  • width (int) – width of the plot

  • title (str) – plot title.

Returns:

dash componenet with histogram figure

Example:

result = get_histogram(data,
                       identifier='histogram',
                       args={'x':'a',
                             'color':'group',
                             'facet_row':'sample',
                             'title':'Facet Grid Plot'}
                    )
vuecore.viz.get_km_plot(data, identifier, args)[source]#
vuecore.viz.get_km_plot_old(data, identifier, args)[source]#
vuecore.viz.get_markdown(text, args={})[source]#

Converts a given text into a Dash Markdown component. It includes a syntax for things like bold text and italics, links, inline code snippets, lists, quotes, and more.

For more information visit https://dash.plot.ly/dash-core-components/markdown.

Parameters:
Returns:

dash Markdown component.

vuecore.viz.get_multi_table(data, identifier, title)[source]#
vuecore.viz.get_network(data, identifier, args)[source]#

This function filters an input dataframe based on a threshold score and builds a cytoscape network. For more information on ‘node_size’ parameter, visit https://networkx.github.io/documentation/networkx-1.10/reference/generated/networkx.algorithms.centrality.betweenness_centrality.html and https://networkx.github.io/documentation/networkx-1.10/reference/generated/networkx.algorithms.centrality.eigenvector_centrality_numpy.html.

Parameters:
  • data – long-format pandas dataframe with at least three columns: source node, target node and value (e.g. weight, score).

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • source (str) – name of the column containing the source.

  • target (str) – name of the column containing the target.

  • cutoff (float) – value threshold for network building.

  • cutoff_abs (bool) – if True will take both positive and negative sides of the cutoff value.

  • values (str) – name of the column containing the values to be plotted.

  • node_size (str) – method used to determine node radius (‘betweenness’, ‘ev_centrality’, ‘degree’).

  • title (str) – plot title.

  • color_weight (bool) – if True, edges in network are colored red if score > 0 and blue if score < 0.

Returns:

dictionary with the network in multiple formats: jupyetr-notebook compatible, web brower compatibles, data table, and json.

Example:

result = get_network(data, identifier='network', args={'source':'node1', 'target':'node2', 'cutoff':0.5, 'cutoff_abs':True, 'values':'weight',                             'node_size':'degree', 'title':'Network Figure', 'color_weight': True})
vuecore.viz.get_network_style(node_colors, color_edges)[source]#

This function uses a dictionary of nodes and colors and creates a stylesheet and layout for a network.

Parameters:
  • node_colors (dict) – dictionary with node names as keys and colors as values.

  • color_edges (bool) – if True, add edge coloring to stylesheet (red for positive width, blue for negative).

Returns:

stylesheet (list of dictionaries specifying the style for a group of elements, a class of elements, or a single element) and layout (dictionary specifying how the nodes should be positioned on the canvas).

vuecore.viz.get_notebook_network_pyvis(graph, args={})[source]#

This function converts a Networkx graph into a PyVis graph supporting Jupyter notebook embedding.

Parameters:
  • graph (graph) – networkX graph.

  • args (dict) – see below.

Arguments:
  • height (int) – network canvas height.

  • width (int) – network canvas width.

Returns:

PyVis graph.

Example:

result = get_notebook_network_pyvis(graph, args={'height':100, 'width':100})
vuecore.viz.get_notebook_network_web(graph, args)[source]#

This function converts a networkX graph into a webweb interactive network in a browser.

Parameters:

graph (graph) – networkX graph.

Returns:

web network.

vuecore.viz.get_parallel_coord_plot(data, identifier, args)[source]#
vuecore.viz.get_parallel_plot(data, identifier, args)[source]#

This function creates a parallel coordinates plot, with sample groups as the different dimensions.

Parameters:
  • data – pandas dataframe with groups as rows and dependent variables as columns.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • group (str) – name of the column containing the groups.

  • zscore (bool) – if True, calculates the z score of each values in the row, relative to the row mean and standard deviation.

  • color (str) – line color.

  • title (str) – plot title.

Returns:

parallel plot figure within <div id=”_dash-app-content”> .

Example:

result = get_parallel_plot(data,
                           identifier='parallel plot',
                           args={'group':'group',
                                 'zscore':True,
                                 'color':'blue',
                                 'title':'Parallel Plot'}
                            )
vuecore.viz.get_pca_plot(data, identifier, args)[source]#

This function creates a pca plot with scores and top “args[‘loadings’]” loadings.

Parameters:
  • data (tuple) – tuple with two pandas dataframes: scores and loadings.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below

Arguments:
  • loadings (int) – number of features with highest loading values to be displayed in the pca plot

  • title (str) – title of the figure

  • x_title (str) – plot x axis title

  • y_title (str) – plot y axis title

  • height (int) – plot height

  • width (int) – plot width

Returns:

PCA figure within the <div id=”_dash-app-content”>.

Example:

result = get_pca_plot(data,
                      identifier='pca',
                      args={'loadings':15,
                            'title':'PCA Plot',
                            'x_title':'PC1',
                            'y_title':'PC2',
                            'height':100,
                            'width':100}
                    )
vuecore.viz.get_pieplot(data, identifier, args)[source]#

This function plots a simple Pie plot.

Parameters:
  • data – pandas DataFrame with values to plot as columns and labels as index.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • valueCol (str) – name of the column with the values to be plotted.

  • textCol (str) – name of the column containing information for the hoverinfo parameter.

  • height (str) – height of the plot.

  • width (str) – width of the plot.

Returns:

Pieplot figure within the <div id=”_dash-app-content”>.

vuecore.viz.get_polar_plot(df, identifier, args)[source]#

This function creates a Polar plot with data aggregated for a given group.

Parameters:
  • df (pandas.DataFrame) – dataframe with the data to plot

  • identifier (str) – identifier to be used in the app

  • args (dict) – dictionary containing the arguments needed to plot the figure ( value_col (value to aggregate), group_col (group by), color_col (color by))

Returns:

Dash Graph

Example:

figure = get_polar_plot(df,
                        identifier='polar',
                        args={'value_col':'intensity',
                              'group_col':'modifier',
                              'color_col':'group'}
                        )
vuecore.viz.get_ranking_plot(data, identifier, args)[source]#

Creates abundance multiplots (one per sample group).

Parameters:
  • data – long-format pandas dataframe with group as index, ‘name’ (protein identifiers) and ‘y’ (LFQ intensities) as columns.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below

Arguments:
  • group (str) – name of the column containing the group.

  • index (bool) – set to True when multi samples per group. Calculates the mean intensity for each protein in each group.

  • x_title (str) – title of plot x axis.

  • y_title (str) – title of plot y axis.

  • title (str) – plot title.

  • width (int) – plot width.

  • height (int) – plot height.

  • annotations (dict, optional) – dictionary where data points names are the keys and descriptions are the values.

Returns:

multi abundance plot figure within the <div id=”_dash-app-content”>.

Example:

result = get_ranking_plot(data,
                          identifier='ranking',
                          args={'group':'group',
                                'index':'',
                                'x_title':'x_axis',
                                'y_title':'y_axis',
                                'title':'Ranking Plot',
                                'width':100,
                                'height':150,
                                'annotations':{
                                    'GPT~P24298': 'liver disease',
                                    'CP~P00450': 'Wilson disease'}
                                }
                        )
vuecore.viz.get_sankey_plot(data, identifier, args={'font': 12, 'height': 800, 'orientation': 'h', 'source': 'source', 'source_colors': 'source_colors', 'target': 'target', 'target_colors': 'target_colors', 'title': 'Sankey plot', 'valueformat': '.0f', 'weight': 'weight', 'width': 800})[source]#

This function generates a Sankey plot in Plotly.

Parameters:
  • data – Pandas DataFrame with the format: source target weight.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below

Arguments:
  • source (str) – name of the column containing the source

  • target (str) – name of the column containing the target

  • weight (str) – name of the column containing the weight

  • source_colors (str) – name of the column in data that contains the colors of each source item

  • target_colors (str) – name of the column in data that contains the colors of each target item

  • title (str) – plot title

  • orientation (str) – whether to plot horizontal (‘h’) or vertical (‘v’)

  • valueformat (str) – how to show the value (‘.0f’)

  • width (int) – plot width

  • height (int) – plot height

  • font (int) – font size

Returns:

dcc.Graph

Example:

result = get_sankey_plot(data,
                         identifier='sankeyplot',
                         args={'source':'source',
                               'target':'target',
                               'weight':'weight',
                               'source_colors':'source_colors',
                               'target_colors':'target_colors','
                               'orientation': 'h',
                               'valueformat': '.0f',
                               'width':800, 'height':800,
                               'font':12,
                               'title':'Sankey plot'}
                        )
vuecore.viz.get_scatterplot(data, identifier, args)[source]#

This function plots a simple Scatterplot.

Parameters:
  • data – is a Pandas DataFrame with four columns: “name”, x values and y values (provided as variables) to plot.

  • identifier (str) – is the id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • title (str) – title of the figure.

  • x (str) – column in dataframe with values for x

  • y (str) – column in dataframe with values for y

  • group (str) – column in dataframe with the groups - translates into colors (default None)

  • hovering_cols (list) – list of columns in dataframe that will be shown when hovering over a dot

  • size (str) – column in dataframe that contains the size of the dots (default None)

  • trendline (bool) – whether or not to draw a trendline

  • text (str) – column in dataframe that contains the values shown for each dot

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • height (int) – plot height.

  • width (int) – plot width.

  • colors (dict) – dictionary with colors to be used for each group

Returns:

scatterplot figure within the <div id=”_dash-app-content”>.

Example:

result = get_scatterplot(data,
                         identifier='scatter plot',
                         args={'title':'Scatter Plot',
                                'x_title':'x_axis',
                                'y_title':'y_axis',
                                'height':100,
                                'width':100}
                        )
vuecore.viz.get_scatterplot_matrix(data, identifier, args)[source]#

This function pltos a multi scatterplot (one for each unique element in args[‘group’]).

Parameters:
  • data – pandas dataframe with four columns: ‘name’ of the data points, ‘x’ and ‘y’ values to plot, and ‘group’ they belong to.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below

Arguments:
  • group (str) – name of the column containing the group.

  • title (str) – plot title.

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • height (int) – plot height.

  • width (int) – plot width.

  • annotations (dict, optional) – dictionary where data points names are the keys and descriptions are the values.

Returns:

multi scatterplot figure within the <div id=”_dash-app-content”>.

Example:

result = get_scatterplot_matrix(data,
                                identifier='scatter matrix',
                                args={'group':'group',
                                      'title':'Scatter Plot Matrix',
                                      'x_title':'x_axis',
                                      'y_title':'y_axis',
                                      'height':100,
                                      'width':100,
                                      'annotations':{
                                          'GPT~P24298': 'liver disease',
                                          'CP~P00450': 'Wilson disease'}
                                        }
                                )
vuecore.viz.get_simple_scatterplot(data, identifier, args)[source]#

Plots a simple scatterplot with the possibility of including in-plot annotations of data points.

Parameters:
  • data – long-format pandas dataframe with columns: ‘x’ (ranking position), ‘group’ (original dataframe position), ‘name’ (protein identifier), ‘y’ (LFQ intensity), ‘symbol’ (data point shape) and ‘size’ (data point size).

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • annotations (dict) – dictionary where data points names are the keys and descriptions are the values.

  • title (str) – plot title.

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • height (int) – plot height.

  • width (int) – plot width.

Returns:

annotated scatterplot figure within the <div id=”_dash-app-content”>.

Example:

result = get_simple_scatterplot(data,
                                identifier='scatter plot',
                                args={'annotations':{'GPT~P24298': 'liver disease',
                                                     'CP~P00450': 'Wilson disease'}',
                                      'title':'Scatter Plot',
                                      'x_title':'x_axis',
                                      'y_title':'y_axis',
                                      'height':100,
                                      'width':100}
                                )
vuecore.viz.get_table(data, identifier, args)[source]#

This function converts a pandas dataframe into an interactive table for viewing, editing and exploring large datasets.

For more information visit https://dash.plot.ly/datatable.

Parameters:
  • data – pandas dataframe.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • title (str) – table title.

  • subset – selects columns from dataframe to be used. If None, the entire dataframe is used.

Returns:

new Dash div containing title and interactive table.

Example:

result = get_table(data, identifier='table', title='Table Figure', subset = None)
vuecore.viz.get_violinplot(data, identifier, args)[source]#

This function creates a violin plot for all columns in the input dataframe.

Parameters:
  • data – pandas dataframe with samples as rows and dependent variables as columns.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below

Arguments:
  • drop_cols (list) – column labels to be dropped from the dataframe.

  • group (str) – name of the column containing the group.

Returns:

list of violion plots within the <div id=”_dash-app-content”>.

Example:

result = get_violinplot(data,
                        identifier='violinplot,
                        args={'drop_cols':['sample', 'subject'],
                              'group':'group'}
                        )
vuecore.viz.get_volcanoplot(results, args)[source]#

This function plots volcano plots for each internal dictionary in a nested dictionary.

Parameters:
  • results (dict[dict]) – nested dictionary with pairwise group comparisons as keys and internal dictionaries containing ‘x’ (log2FC values), ‘y’ (-log10 p-values), ‘text’, ‘color’, ‘pvalue’ and ‘annotations’ (number of hits to be highlighted).

  • args (dict) – see below.

Arguments:
  • fc (float) – fold change threshold.

  • range_x (list) – list with minimum and maximum values for x axis.

  • range_y (list) – list with minimum and maximum values for y axis.

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • colorscale (str) – string for predefined plotly colorscales or dict containing one or more of the keys listed in https://plot.ly/python/reference/#layout-colorscale.

  • showscale (bool) – determines whether or not a colorbar is displayed for a trace.

  • marker_size (int) – sets the marker size (in px).

Returns:

list of volcano plot figures within the <div id=”_dash-app-content”>.

Example:

result = get_volcanoplot(results,
                         args={'fc':2.0,
                               'range_x':[0, 1],
                               'range_y':[-1, 1],
                               'x_title':'x_axis',
                               'y_title':'y_title',
                               'colorscale':'Blues',
                               'showscale':True, 'marker_size':7}
                        )
vuecore.viz.get_wordcloud(data, identifier, args={'height': 700, 'margin': 1, 'max_font_size': 100, 'max_words': 400, 'stopwords': [], 'width': 700})[source]#

This function generates a Wordcloud based on the natural text in a pandas dataframe column.

Parameters:
  • data – pandas dataframe with columns: ‘PMID’, ‘abstract’, ‘authors’, ‘date’, ‘journal’, ‘keywords’, ‘title’, ‘url’, ‘Proteins’, ‘Diseases’.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • text_col (str) – name of column containing the natural text used to generate the wordcloud.

  • stopwords (list) – list of words that will be eliminated.

  • max_words (int) – maximum number of words.

  • max_font_size (int) – maximum font size for the largest word.

  • margin (int) – plot margin size.

  • width (int) – width of the plot.

  • height (int) – height of the plot.

  • title (str) – plot title.

Returns:

wordcloud figure within <div id=”_dash-app-content”>.

Example:

result = get_wordcloud(data,
                       identifier='wordcloud',
                       args={'stopwords':['BACKGROUND',
                                          'CONCLUSION',
                                          'RESULT',
                                          'METHOD',
                                          'CONCLUSIONS',
                                          'RESULTS',
                                          'METHODS'],
                            'max_words': 400,
                            'max_font_size': 100,
                            'width':700,
                            'height':700,
                            'margin': 1}
                        )
vuecore.viz.mpl_to_plotly(fig, ci=True, legend=True)[source]#
vuecore.viz.network_to_tables(graph, source, target)[source]#

Creates the graph edge list and node list and returns them as separate Pandas DataFrames.

Parameters:

graph – networkX graph used to construct the Pandas DataFrame.

Returns:

two Pandas DataFrames.

vuecore.viz.plot_2_venn_diagram(cond1, cond2, unique1, unique2, intersection, identifier, args)[source]#

This function creates a simple non area-weighted two-circle venn diagram.

Parameters:
  • cond1 (str) – label of the first circle.

  • cond2 (str) – label of the second circle.

  • unique1 (int) – number of features exclusive to cond1.

  • unique2 (int) – number of features exclusive to cond2.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Parm int intersection:

number of features common to cond1 and cond2.

Arguments:
  • colors (dict) – dictionary with cond1 and cond2 as keys, and color codes as values.

  • title (str) – plot title.

Returns:

two-circle venn diagram figure within <div id=”_dash-app-content”>.

Example:

result = plot_2_venn_diagram(cond1='group1',
                             cond2='group2',
                             unique1=10,
                             unique2=15,
                             intersection=8,
                             identifier='vennplot',
                             args={'color':{'group1':'blue', 'group2':'red'},
                                   'title':'Two-circle Venn diagram'}
                            )
vuecore.viz.run_volcano(data, identifier, args={'alpha': 0.05, 'annotate_list': [], 'colorscale': 'Blues', 'fc': 2, 'marker_size': 8, 'num_annotations': 10, 'showscale': False, 'x_title': 'log2FC', 'y_title': '-log10(pvalue)'})[source]#

This function parsers the regulation data from statistical tests and creates volcano plots for all distinct group comparisons. Significant hits with lowest adjusted p-values are highlighed.

Parameters:
  • data – pandas dataframe with format: ‘identifier’, ‘group1’, ‘group2’, ‘mean(group1’, ‘mean(group2)’, ‘log2FC’, ‘std_error’, ‘tail’, ‘t-statistics’, ‘padj_THSD’, ‘effsize’, ‘efftype’, ‘FC’, ‘rejected’, ‘F-statistics’, ‘pvalue’, ‘padj’, ‘correction’, ‘-log10 pvalue’ and ‘Method’.

  • identifier (str) – id used to identify the div where the figure will be generated.

  • args (dict) – see below.

Arguments:
  • alpha (float) – adjusted p-value threshold for significant hits.

  • fc (float) – fold change threshold.

  • colorscale (str or dict) – name of predefined plotly colorscale or dictionary containing one or more of the keys listed in https://plot.ly/python/reference/#layout-colorscale.

  • showscale (bool) – determines whether or not a colorbar is displayed for a trace.

  • marker_size (int) – sets the marker size (in px).

  • x_title (str) – plot x axis title.

  • y_title (str) – plot y axis title.

  • num_annotations (int) – number of hits to be highlighted (if num_annotations = 10, highlights 10 hits with lowest significant adjusted p-value).

Returns:

list of volcano plot figures within the <div id=”_dash-app-content”>.

Example:

result = run_volcano(data,
                     identifier='volvano data',
                     args={'alpha':0.05,
                           'fc':2.0,
                           'colorscale':'Blues',
                           'showscale':False,
                           'marker_size':6,
                           'x_title':'log2FC',
                           'y_title':'-log10(pvalue)',
                           'num_annotations':10}
                    )
vuecore.viz.save_DASH_plot(plot, name, plot_format='svg', directory='.', width=800, height=700)[source]#

This function saves a plotly figure to a specified directory, in a determined format.

Parameters:
  • plot – plotly figure (dictionary with data and layout)

  • name (str) – name of the figure

  • plot_format (str) – suffix of the saved file (‘svg’, ‘pdf’, ‘png’, ‘jpeg’, ‘jpg’)

  • directory (str) – folder where figure is to be saved

Returns:

figure saved in directory

Example:

result = save_DASH_plot(plot, name='Plot example',
                        plot_format='svg', directory='/data/plots')
vuecore.viz.visualize_notebook_network(network, notebook_type='jupyter', layout={})[source]#

This function returns a Cytoscape network visualization for Jupyter notebooks

Parameters:
  • network (tuple) – tuple with two dictionaries: network data and stylesheet (see get_network(data, identifier, args)).

  • notebook_type (str) – the type of notebook where the network will be visualized (currently only jupyter notebook is supported)

  • layout (dict) – specific layout properties (see https://dash.plot.ly/cytoscape/layout)

Returns:

cyjupyter.cytoscape.Cytoscape object

Example:

net = get_network(clincorr.dropna(), identifier='corr', args={'source':'node1', 'target':'node2',
                                                    'cutoff':0, 'cutoff_abs':True,
                                                    'values':'weight','node_size':'degree',
                                                    'title':'Network Figure', 'color_weight': True})
visualize_notebook_network(net['notebook'], notebook_type='jupyter', layout={'width':'100%', 'height':'700px'})
vuecore.viz.visualize_notebook_path(path, notebook_type='jupyter')[source]#

This function returns a Cytoscape network visualization for Jupyter notebooks

Parameters:
  • object (pathlib.Path) – dash_html_components object with the cytoscape network (returned by get_cytoscape_network())

  • notebook_type (str) – the type of notebook where the network will be visualized (currently only jupyter notebook is supported)

  • layout (dict) – specific layout properties (see https://dash.plot.ly/cytoscape/layout)

Returns:

cyjupyter.cytoscape.Cytoscape object

Example:

net = get_cytoscape_network(G, identifier='corr', args={'title':'Cytoscape path',
                                                    'stylesheet':stylesheet,
                                                    'layout': layout})
visualize_notebook_path(net, notebook_type='jupyter')