metbit.utility
Statistics and utilities module in metbit 8.4.3.
import metbit.utilityClasses
lazypair
Methods
__init__(self, dataset, column_name)
get_index(self)
get_name(self)
get_meta(self)
get_column_name(self)
get_dataset(self)
gen_page
Methods
__init__(self, data_path)
This function takes in the path to the data folder and returns the HTML files for the OPLS-DA plots.
Parameters
data_pathstrThe path to the data folder. gen_page(data_path).get_files()
get_files(self)
oplsda_path
Methods
__init__(self, data_path)
make_path(self)
get_path(self)
Normality_distribution
Methods
__init__(self, data: pd.DataFrame)
plot_distribution(self, feature)
pca_distributions(self)
Normalise
Methods
__init__(self, data: pd.DataFrame, compute_missing: bool=True)
pqn_normalise(self, ref_index: list=None, plot: bool=True)
decimal_place_normalisation(self, decimals: int=2)
This function returns the dataframe with values rounded to a specified number of decimal places.
Parameters
decimalsintThe number of decimal places to round to.
z_score_normalisation(self)
This function returns the dataframe normalized using Z-Score.
linear_normalisation(self)
This function returns the dataframe normalized using Min-Max (linear normalization).
normalize_to_100(self)
This function returns the dataframe with values normalized to 100.
clipping_normalisation(self, lower: float, upper: float)
This function returns the dataframe with values clipped to the specified range.
Parameters
lowerfloatThe lower bound for clipping.
upperfloatThe upper bound for clipping.
standard_deviation_normalisation(self)
This function returns the dataframe normalized using Standard Deviation.
UnivarStats
Perform univariate statistical analysis and visualization using Plotly.
Parameters
dfpd.DataFrameInput DataFrame containing the measurement and group columns.
x_colstrColumn name for the grouping variable.
y_colstrColumn name for the measurement variable.
group_orderlist of str, optionalCustom group plotting order.
custom_colorsdict of str -> str, optionalMapping from group name to color.
stats_optionslist of str, optionalSupported["t-test", "anova", "nonparametric", "effect-size"].p_value_thresholdfloat, default=0.05Significance threshold.
annotate_style{'value', 'symbol'}, default='value'Annotation stylenumeric or stars.y_offset_factorfloat, default=0.35Vertical spacing factor for annotations.
show_non_significantbool, default=TrueWhether to display 'ns'.
correct_pstr or None, default='bonferroni'Method for multiple testing correction. Supported: - 'bonferroni', 'holm', 'hochberg', 'hommel' - 'fdr_bh', 'fdr_by', 'fdr_tsbh', 'fdr_tsbky' - None or 'none' = no correction
title_str, optionalPlot title.
y_labelstr, optionalY-axis label.
x_labelstr, optionalX-axis label.
fig_heightint, default=800Figure height.
fig_widthint, default=600Figure width.
plot_type{'box', 'violin'}, default='box'Plot type.
show_axis_linesbool, default=TrueWhether to show axis lines.
Methods
__init__(self, df: pd.DataFrame, x_col: str, y_col: str, group_order: Optional[List[str]]=None, custom_colors: Optional[Dict[str, str]]=None, stats_options: Optional[List[str]]=None, p_value_threshold: float=0.05, annotate_style: str='value', y_offset_factor: float=0.35, show_non_significant: bool=True, correct_p: Optional[str]='bonferroni', title_: Optional[str]=None, y_label: Optional[str]=None, x_label: Optional[str]=None, fig_height: int=800, fig_width: int=600, plot_type: str='box', show_axis_lines: bool=True)
compute_effsize(a, b, eftype: str='cohen')
plot(self, show_description: bool=True)
get_stats_table(self)
Return a DataFrame of statistical results.