/
You are viewing the documentation for metbit 8.7.7. Change release context

metbit.utility

Statistics and utilities module in metbit 8.7.7.

import metbit.utility

Classes

lazypair

Utility for generating all pairwise groupings and related dataset splits.

Methods

__init__(self, dataset: pd.DataFrame, column_name: str)
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_pathstr

The path to the data folder. gen_page(data_path).get_files()

get_files(self)

oplsda_path

Methods

__init__(self, data_path)

This function takes in the path to the data folder and returns the path to the OPLS-DA plots.

Parameters

data_pathstr

The path to the data folder. oplsda_path(data_path).get_path()

make_path(self)

Create report folders under the provided data path and cache paths.

Call this before `get_path()` to ensure directories exist.

get_path(self)

Normality_distribution

Methods

__init__(self, data: pd.DataFrame)
plot_distribution(self, feature: str)
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

decimalsint

The 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

lowerfloat

The lower bound for clipping.

upperfloat

The 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.DataFrame

Input DataFrame containing the measurement and group columns.

x_colstr

Column name for the grouping variable.

y_colstr

Column name for the measurement variable.

group_orderlist of str, optional

Custom group plotting order.

custom_colorsdict of str -> str, optional

Mapping from group name to color.

stats_optionslist of str, optional
Supported["t-test", "anova", "nonparametric", "effect-size"].
p_value_thresholdfloat, default=0.05

Significance threshold.

annotate_style{'value', 'symbol'}, default='value'
Annotation stylenumeric or stars.
y_offset_factorfloat, default=0.35

Vertical spacing factor for annotations.

show_non_significantbool, default=True

Whether 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, optional

Plot title.

y_labelstr, optional

Y-axis label.

x_labelstr, optional

X-axis label.

fig_heightint, default=800

Figure height.

fig_widthint, default=600

Figure width.

plot_type{'box', 'violin'}, default='box'

Plot type.

show_axis_linesbool, default=True

Whether 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.

Functions

project_name_generator()

Source

metbit/utility.py at v8.7.7
Downloads for metbit 8.7.7PyPI and GitHub measure different distribution channels. Statistics refresh daily.

Counts are distribution activity, not unique users. GitHub source archives and Git clones are not included. Sources: PyPI Stats, Pepy, ClickPy, and GitHub Releases.

metbit 8.7.7 documentation