plotting ======== .. py:module:: plotting .. autoapi-nested-parse:: Plotting functions for electropherogram analysis Author: Anja Hess Date: 2025-AUG-06 Functions --------- .. autoapisummary:: plotting.gridplot plotting.p2stars plotting.stats_plot plotting.peakplot plotting.lineplot plotting.ladderplot Module Contents --------------- .. py:function:: gridplot(df, x, y, save_dir='', title='', y_label='', x_label='', cols_not_to_plot=['bp_pos', 'normalized_fluorescent_units']) Generate line plot for DNA fragment sizes with masking option for marker peaks :param df: pandas.DataFrame :param x: str, the plot's x variable :param y: str, the plot's y variable :param save_dir: str, path to save the figure :param title: str, title of the figure :param y_label: str, y label of the figure :param x_label: str, x label of the figure :param cols_not_to_plot: list of columns to exclude from plot to get categorical vars :return: plot is generated and saved to disk. .. py:function:: p2stars(p) Add asterisk based on p-value :param p: float, the p-value :return: str .. py:function:: stats_plot(path_to_df, cols_not_to_plot=None, region_id='region_id', y='value', cut=False) Plot statistical results :param path_to_df: str :param cols_not_to_plot: list of columns to exclude from plot :return: plots statistics in same directory as input dataframe .. py:function:: peakplot(array, peaks, ladder_id, ref, i, qc_save_dir, y_label='', x_label='', size_values='') Plot the peaks detected in a DNA size profile :param array: np.ndarray :param peaks: list of int :param ladder_id: str or int, name of the ladder :param ref: dtr, type of reference :param i: int, index of the ladder (potentially multiple) :param qc_save_dir: str, path to folder to save the figure to :param y_label: str, y label name :param x_label: str, x label name :return: plots are generated and saved to disk. .. py:function:: lineplot(df, x, y, save_dir='', title='', y_label='', x_label='', hue=None, units=None, plot_lower=False, estimator='mean', style=None, window=False) Core line plot function for DNA fragment sizes :param df: pandas.DataFrame :param x: x variable :param y: y variable :param save_dir: str, path to save the figure :param title: str, title of the figure :param y_label: str, y label of the figure :param x_label: str, x label of the figure :param hue: str, optional to set hue parameter :param units: bool :param plot_lower: bool :param estimator: str, which estimator to use :param style: str, style of line plot :param window: bool or tuple for x axis limits :return: plots are generated and saved to disk. .. py:function:: ladderplot(df, ladder2type, qc_save_dir, y_label='', x_label='') Plot multiple ladders into one plot :param df: pandas.DataFrame :param ladder2type: dict :param qc_save_dir: str :param y_label: str, y label of the figure :param x_label: str, x label of the figure :return: plot generated and saved to the QC directory