Plotting Backends

The only available plotting backend at the moment is the matplotlib backend

import with:

from mspypeline.plotting_backend import matplotlib_plots

Matplotlib Backend

class mspypeline.plotting_backend.matplotlib_plots.QuantileNormalize(quantiles)

Can be used to color the values of a dataset according to the quantiles.

__init__(quantiles)
Parameters

quantiles (pandas.core.series.Series) – calculated quantiles of the dataset

mspypeline.plotting_backend.matplotlib_plots.get_path_and_name_from_kwargs(name, **kwargs)

creates a the path and file name for a plot

Parameters
  • name (str) –

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Returns

The path where the file will be saved and a name for the file without a file type.

Return type

tuple(str, str)

mspypeline.plotting_backend.matplotlib_plots.save_bar_venn(named_sets, ex, show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: plots/venn_bar_{ex}

Parameters
  • named_sets (Dict[str, set]) – a mapping of samples to protein names

  • ex (str) – figure title

  • show_suptitle (bool) – should the figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Optional[Tuple[matplotlib.figure.Figure, Tuple[matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]]]

mspypeline.plotting_backend.matplotlib_plots.save_boxplot_results(protein_intensities, intensity_label='Intensity', plot=None, vertical=False, close_plots='all', **kwargs)

Boxplot of intensities. Saves the plot with prefix: boxplot

Parameters
  • protein_intensities (pandas.core.frame.DataFrame) – DataFrame where each column are the intensities to boxplot, column names will be used as labels

  • intensity_label (str) – label of the x axis of the plot

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • vertical (bool) – should a vertical boxplot be created

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_correlation_heatmap_results(correlations, intensity_label='Intensity', show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

Saves the plot with prefix: {source}_correlation_heatmap

Parameters
  • correlations (pandas.core.frame.DataFrame) – DataFrame containing the correlations to be plotted

  • intensity_label (str) – label of the dataframe

  • show_suptitle (bool) – should the figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_csvs(name_map)

Saves all dataframes as csv which are specified as dict keys. The values are the file names.

Parameters

name_map (Dict[str, str]) – mapping of kwarg name to file name

mspypeline.plotting_backend.matplotlib_plots.save_detected_proteins_per_replicate_results(all_heights, intensity_label='Intensity', show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: detection_per_replicate

Parameters
  • all_heights (Dict[str, pandas.core.series.Series]) – mapping of sample to a pd.Series of heights

  • intensity_label (str) – name of the experiment

  • show_suptitle (bool) – should the figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

mspypeline.plotting_backend.matplotlib_plots.save_detection_counts_results(counts, intensity_label='Intensity', show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

Saves the plot with prefix: detected_counts

Parameters
  • counts (pandas.core.frame.DataFrame) – DataFrame containing the counts to be plotted

  • intensity_label (str) – label of the dataframe

  • show_suptitle (bool) – should the figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_experiment_comparison_results(protein_intensities_sample1, protein_intensities_sample2, exclusive_sample1, exclusive_sample2, sample1, sample2, intensity_label='Intensity', show_suptitle=True, plot=None, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: scatter_comparison_{sample1}_vs_{sample2}

Parameters
  • protein_intensities_sample1 (pandas.core.series.Series) – intensities of sample 1

  • protein_intensities_sample2 (pandas.core.series.Series) – intensities of sample 2

  • exclusive_sample1 (pandas.core.series.Series) – intensities exclusive to sample 1

  • exclusive_sample2 (pandas.core.series.Series) – intensities exclusive to sample 2

  • sample1 (str) – name of sample 1

  • sample2 (str) – name of sample 2

  • intensity_label (str) – name of experiment

  • show_suptitle (bool) – should the figure title be shown

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_go_analysis_results(heights, test_results, go_length, go_analysis_gene_names, show_suptitle=True, intensity_label='Intensity', close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: go_analysis

Parameters
  • heights (Dict[str, list]) – mapping from samples to bar height

  • test_results (Dict[str, list]) – mapping from samples to p value

  • go_length (Dict[str, list]) – mapping of name to number of proteins of go terms

  • go_analysis_gene_names (list) – names of the go term lists

  • show_suptitle (bool) – should the figure title be shown

  • intensity_label – name of the experiment

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_intensities_heatmap_result(intensities, cmap='autumn_r', cmap_bad='dimgray', cax=None, plot=None, vmax=None, vmin=None, intensity_label='Intensity', show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: intensities_heatmap

Parameters
  • intensities (pandas.core.frame.DataFrame) – DataFrame containing protein intensities of samples

  • cmap (Union[str, matplotlib.colors.Colormap]) – color map to use for heatmap coloring

  • cmap_bad (str) – color for missing values

  • cax (matplotlib.axes._axes.Axes) – axis for the color bar

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • vmax (Optional[float]) – passed to imshow

  • vmin (Optional[float]) – passed to imshow

  • intensity_label (str) – name of the experiment

  • show_suptitle (bool) – should figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, Tuple[matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]]

mspypeline.plotting_backend.matplotlib_plots.save_intensity_histogram_results(hist_data, intensity_label='Intensity', show_suptitle=False, compare_to_remaining=False, legend=True, n_bins=25, show_mean=True, histtype='bar', color=None, plot=None, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: intensity_histograms

Parameters
  • hist_data (pandas.core.frame.DataFrame) – data to be plotted

  • intensity_label (str) – name of experiment

  • show_suptitle (bool) – should the figure title be shown

  • compare_to_remaining (bool) – should the sample be compared to the overall samples

  • legend (bool) – should the legend of the sample names be shown

  • show_mean (bool) – should the mean intensity be shown

  • n_bins (int) – how many bins should the histograms have

  • histtype – passed to hist

  • color – passed to hist

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

mspypeline.plotting_backend.matplotlib_plots.save_kde_results(intensities, quantile_range=None, n_points=1000, cmap='viridis', plot=None, intensity_label='Intensity', close_plots='all', **kwargs)

saves the plot with prefix: kde

Parameters
  • intensities (pandas.core.frame.DataFrame) – protein intensities to be plotted

  • quantile_range (Optional[numpy.array]) – default is np.arange(0.05, 1, 0.05)

  • n_points (int) – number of points to sample from distribution

  • cmap (Union[str, matplotlib.colors.Colormap]) – color map to use

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • intensity_label (str) – label to be put on x axis

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_n_proteins_vs_quantile_results(quantiles, n_proteins, nstd=1, cmap='viridis', plot=None, cbar_ax=None, intensity_label='Intensity', fill_between=False, close_plots='all', **kwargs)

saves plot with prefix: n_proteins_vs_quantile

Parameters
  • quantiles (pandas.core.frame.DataFrame) – quantiles to be plotted

  • n_proteins (pandas.core.series.Series) – number of identified proteins

  • nstd (int) – how many standard deviations should the the line will between

  • cmap (Union[str, matplotlib.colors.Colormap]) – color map to use

  • plot (Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]) – figure to put plot

  • cbar_ax (Optional[matplotlib.axes._axes.Axes]) – axis for colorbar

  • intensity_label (str) – label to put on x label

  • fill_between (bool) – should the area around the line be filled

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, Tuple[matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]]

mspypeline.plotting_backend.matplotlib_plots.save_normalization_overview_results(quantiles, n_proteins, intensities, protein_intensities, height=15, intensity_label='Intensity', close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: normalization_overview

Parameters
  • quantiles – quantiles for save_n_proteins_vs_quantile_results

  • n_proteins – n_proteins for save_n_proteins_vs_quantile_results

  • intensities – intensities for save_kde_results

  • protein_intensities – intensities for boxplot data

  • height (int) – height of the figure

  • intensity_label (str) – name of the experiment

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, Tuple[matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]]

mspypeline.plotting_backend.matplotlib_plots.save_pathway_analysis_results(protein_intensities, significances=None, pathway='', show_suptitle=True, threshold=0.05, intensity_label='Intensity', color_map=None, close_plots='all', exp_has_techrep=False, **kwargs)

Saves plots into the pathway_analysis dir.

Parameters
  • protein_intensities (pandas.core.frame.DataFrame) – data of intensities

  • significances (pandas.core.frame.DataFrame) – significances between different conditions

  • pathway (str) – name of the pathway

  • show_suptitle (bool) – should the pathway name be shown as figure title

  • threshold (float) – maximum p value indicating significance

  • intensity_label (str) – from which intensity was the data. will be shown on x axis

  • color_map (Optional[dict]) – a mapping from the column names to a color

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_pathway_timecourse_results()

Not Implemented at the moment

mspypeline.plotting_backend.matplotlib_plots.save_pca_results(pca_data, pca_fit=None, normalize=True, intensity_label='Intensity', color_map=None, show_suptitle=True, marker_size=150, legend_marker_size=12, close_plots='all', exp_has_techrep=False, **kwargs)

Saves image containing the pca results with prefix: pca_overview

Parameters
  • pca_data (pandas.core.frame.DataFrame) – DataFrame containing transformed/dimensionally-reduced data with which PCA was performed

  • pca_fit (sklearn.decomposition._pca.PCA) – PCA object that was fitted to normalized input data

  • normalize (bool) – should the transformed data be normalized with the singular values before plotting

  • intensity_label (str) – figure title

  • color_map (Optional[dict]) – mapping from column name to color if custom colors are wanted

  • show_suptitle (bool) – should the figure title be shown

  • marker_size (int) – size of the points in the scatter plots

  • legend_marker_size (int) – size of the legend marker

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_plot(plot_name)

Decorator to save figures, which are returned by the decorated function. Assumes that a tuple of figure, axes is returned. Plot is saved by using get_path_and_name_from_kwargs and save_plot_func.

Parameters

plot_name (str) – string to be saved to. Sting can contain “/” to indicate a folder structure where the plot should be saved. Also can contain preformatted parts like: “plot_{name}”. The {name} will then be replaced by a passed kwarg “name”.

mspypeline.plotting_backend.matplotlib_plots.save_plot_func(fig, path, plot_name, func, fig_format='.pdf', dpi=200, **kwargs)

Saves figure in path. Directories will be created if they not exist.

Parameters
  • fig (matplotlib.figure.Figure) – figure to be saved

  • path (str) – path to the plot

  • plot_name (str) – name of the saved figure

  • func (Callable) – function used to save the plots

  • fig_format (str) – figure format of the plot. default is PDF.

  • dpi (int) – DPI of saved figure

  • kwargs – accepts kwargs

Return type

None

mspypeline.plotting_backend.matplotlib_plots.save_rank_results(rank_data, interesting_proteins, intensity_label='Intensity', full_name='Experiment', close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: rank_{full_name}

Parameters
  • rank_data (pandas.core.series.Series) – data for rank plot

  • interesting_proteins – mapping of pathway names to a list of proteins

  • intensity_label (str) – name of the experiment

  • full_name – name of the sample/group plotted

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_relative_std_results(intensities, experiment_name, intensity_label='Intensity', show_suptitle=True, bins=10, 20, 30, cmap=None, close_plots='all', exp_has_techrep=False, **kwargs)

Relative standard deviations of passed intensities with color marking based on the specified bins and color map. Save the plot with prefix: rel_std_{experiment_name}

Parameters
  • intensities (pandas.core.frame.DataFrame) – DataFrame with experiment intensities to be plotted

  • experiment_name (str) – name of the overall experiment

  • intensity_label (str) – name of the intensities for the x label

  • show_suptitle (bool) – should the figure title be shown

  • bins – in which bins should the standard deviations be categorized

  • cmap (dict) – mapping for the digitized labels to a color

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_scatter_replicates_results(scatter_data, intensity_label='Intensity', show_suptitle=True, close_plots='all', exp_has_techrep=False, **kwargs)

saves plot with prefix: scatter_replicates_{full_name}

Parameters
  • scatter_data (pandas.core.frame.DataFrame) – data to create scatter plots

  • intensity_label (str) – name of the experiment

  • show_suptitle (bool) – should the figure title be shown

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

mspypeline.plotting_backend.matplotlib_plots.save_venn(named_sets, ex, show_suptitle=True, title_font_size=20, set_label_font_size=16, subset_label_font_size=14, close_plots='all', exp_has_techrep=False, **kwargs)

Creates Venn Diagrams from passed data. saves plot with prefix: plots/venn_replicate_{ex}

Parameters
  • named_sets (Dict[str, set]) – a mapping of samples to protein names

  • ex (str) – title for the plot

  • show_suptitle (bool) – should the figure title be shown

  • title_font_size – font size of the title

  • set_label_font_size – font size of sets

  • subset_label_font_size – font size of subsets

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Optional[Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]]

mspypeline.plotting_backend.matplotlib_plots.save_volcano_results(volcano_data, interesting_proteins, unique_g1=None, unique_g2=None, g1='group1', g2='group2', adj_pval=False, intensity_label='Intensity', show_suptitle=True, pval_threshold=0.05, fchange_threshold=2, scatter_size=20, n_labelled_proteins=10, close_plots='all', exp_has_techrep=False, **kwargs)

Saves multiple csv files and images containing the information of the volcano plot

Parameters
  • volcano_data (pandas.core.frame.DataFrame) – DataFrame containing data for the volcano plot with columns logFC and column specified under col. The index should be protein names or gene names

  • interesting_proteins – mapping of pathways that shoul be annotated in the volcano plot

  • unique_g1 (pandas.core.series.Series) – Series containing intensities of proteins or genes unique to group one

  • unique_g2 (pandas.core.series.Series) – Series containing intensities of proteins or genes unique to group two

  • g1 (str) – name of first sample that should be analysed (downregulated)

  • g2 (str) – name of second sample that should be analysed (upregulated)

  • adj_pval (bool) – should adjusted p values be used

  • intensity_label (str) – from which intensities were the fold changes calculated

  • show_suptitle (bool) – should the figure title be shown

  • pval_threshold (float) – maximum p value to be considered significant

  • fchange_threshold (float) – minimum fold change threshold (before log2 transformation) to be labelled significant

  • scatter_size (float) – size of the points in the scatter plots

  • n_labelled_proteins (int) – number of points that will be annotated in th plot

  • close_plots (str) – which plots should be closed when creating the plot, if None no plots will be closed

  • exp_has_techrep (bool) – whether technical replicates were aggregated for the plot

  • kwargs

    Uses following kwargs to generate a path and file name.

    • save_path (str): directory where file should be saved

    • df_to_use (str): used to generate a name suffix

    • level (int): used to generate a name suffix

    • split_files (bool): should the file be saved in a subdirectory

    Additionally, all parts of the passed name enclosed by curly brackets will be replaced from passed kwargs.

Return type

Tuple[matplotlib.figure.Figure, Tuple[matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]]