ToppPlot database function

topppy.topp_plot

topp_balloon

topp_balloon(toppdata: DataFrame, categories: list = None, balloons: int = 3, x_axis_text_size: int = 6, cluster_col: str = 'Cluster', filename: str = None, save: bool = False, height: int = 5, width: int = 10) -> ggplot | dict

Create a balloon plot from toppdata results

Parameters:
  • toppdata (DataFrame) –

    A toppdata results dataframe

  • categories (list, default: None ) –

    The topp categories to plot

  • balloons (int, default: 3 ) –

    Number of balloons per group to plot

  • x_axis_text_size (int, default: 6 ) –

    Size of the text on the x axis

  • cluster_col (str, default: 'Cluster' ) –

    The column name for clusters (default: "Cluster")

  • filename (str, default: None ) –

    Filename of the saved balloon plot

  • save (bool, default: False ) –

    Save the balloon plot if TRUE

  • height (int, default: 5 ) –

    Height of the saved balloon plot

  • width (int, default: 10 ) –

    Width of the saved balloon plot

Returns: A ggplot object or a dict where the keys are the names of clusters and the values are ggplot objects

Examples:

from topppy import *
topp_balloon(topp_data, balloons = 3, save = True, filename = "Balloon_plot")

topp_plot

topp_plot(toppdata: DataFrame, category: str, clusters: list | int | str = None, cluster_col: str = 'Cluster', num_terms: int = 10, p_val_adj: str = 'BH', p_val_display: str = 'log', save: bool = False, save_dir: str = None, width: int = 5, height: int = 6, file_prefix: str = None, y_axis_text_size: int = 8, combine: bool = False, ncols: int = None) -> ggplot | dict

Create a dotplot from toppdata results

Parameters:
  • toppdata (DataFrame) –

    A toppdata results dataframe

  • category (str) –

    The topp categories to plot

  • clusters (list | int | str, default: None ) –

    The cluster(s) to plot

  • cluster_col (str, default: 'Cluster' ) –

    The column name for clusters (default: "Cluster")

  • num_terms (int, default: 10 ) –

    The number of terms from the toppdata results to be plotted, per cluster

  • p_val_adj (str, default: 'BH' ) –

    The P-value correction method: "BH", "Bonferroni", "BY", or "none"

  • p_val_display (str, default: 'log' ) –

    If "log", display the p-value in terms of -log10(p_value)

  • save (bool, default: False ) –

    Whether to save the file automatically

  • save_dir (str, default: None ) –

    Directory to save file

  • width (int, default: 5 ) –

    width of the saved file (inches)

  • height (int, default: 6 ) –

    height of the saved file (inches)

  • file_prefix (str, default: None ) –

    file prefix if saving the plot - the cluster name is also added automatically

  • y_axis_text_size (int, default: 8 ) –

    Size of the Y axis text - for certain categories, it's helpful to decrease this

  • combine (bool, default: False ) –

    If TRUE and multiple clusters selected, return a patchwork object of all plots; if FALSE return list of plots

  • ncols (int, default: None ) –

    If patchwork element returned, number of columns for subplots

Returns: A ggplot object or a dict where the keys are the names of clusters and the values are ggplot objects

Examples:

from topppy import *
topp_plot(topp_data,category="GeneOntologyMolecularFunction",clusters=0,save=False,file_prefix="MF_cluster0")