plotting
Plotting functions for electropherogram analysis
Author: Anja Hess
Date: 2025-AUG-06
Functions
|
Generate line plot for DNA fragment sizes with masking option for marker peaks |
|
Add asterisk based on p-value |
|
Plot statistical results |
|
Plot the peaks detected in a DNA size profile |
|
Core line plot function for DNA fragment sizes |
|
Plot multiple ladders into one plot |
Module Contents
- plotting.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
- Parameters:
df – pandas.DataFrame
x – str, the plot’s x variable
y – str, the plot’s y variable
save_dir – str, path to save the figure
title – str, title of the figure
y_label – str, y label of the figure
x_label – str, x label of the figure
cols_not_to_plot – list of columns to exclude from plot to get categorical vars
- Returns:
plot is generated and saved to disk.
- plotting.p2stars(p)
Add asterisk based on p-value :param p: float, the p-value :return: str
- plotting.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
- plotting.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
- Parameters:
array – np.ndarray
peaks – list of int
ladder_id – str or int, name of the ladder
ref – dtr, type of reference
i – int, index of the ladder (potentially multiple)
qc_save_dir – str, path to folder to save the figure to
y_label – str, y label name
x_label – str, x label name
- Returns:
plots are generated and saved to disk.
- plotting.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
- Parameters:
df – pandas.DataFrame
x – x variable
y – y variable
save_dir – str, path to save the figure
title – str, title of the figure
y_label – str, y label of the figure
x_label – str, x label of the figure
hue – str, optional to set hue parameter
units – bool
plot_lower – bool
estimator – str, which estimator to use
style – str, style of line plot
window – bool or tuple for x axis limits
- Returns:
plots are generated and saved to disk.
- plotting.ladderplot(df, ladder2type, qc_save_dir, y_label='', x_label='')
Plot multiple ladders into one plot
- Parameters:
df – pandas.DataFrame
ladder2type – dict
qc_save_dir – str
y_label – str, y label of the figure
x_label – str, x label of the figure
- Returns:
plot generated and saved to the QC directory