micom.stats

Data warngling and statistics for MICOM.

Module Contents

Functions

fdr_adjust(p)

Get FDR cutoffs for p-values with Benjamini-Hochberg.

_run_test(args)

_run_corr(args)

compare_groups(fluxes, metadata_column[, groups, ...])

Compare fluxes form different sample groups.

correlate_fluxes(fluxes, metadata_column[, threads, ...])

Correlate fluxes with a continuous covariate.

micom.stats.fdr_adjust(p)[source]

Get FDR cutoffs for p-values with Benjamini-Hochberg.

Parameters:

p (list[float]) – The original p-values. Can not contain naNs.

Returns:

  • A numpy array of FDR cutoffs (q-values). This is commonly known as “adjusted”

  • p-values.

micom.stats._run_test(args)[source]
micom.stats._run_corr(args)[source]
micom.stats.compare_groups(fluxes, metadata_column, groups=None, threads=1, progress=True)[source]

Compare fluxes form different sample groups.

Note

This uses a non-parametric test by default. By default it will use a Mann-Whitney test for two groups and a Kruskal-Wallis test for >2 groups. q are the FDR-corrected p-values (Benjamini-Hochberg correction).

Parameters:
  • fluxes (pandas.DataFrame) – A frame with net fluxes as returned by production_rates or consumption_rates.

  • metatdata_column (str) – The column of the DataFrame denoting the groups.

  • groups (list[str] or None) – Specify a subset of groups you want to compare or define the order (1st will be the reference group). If None will use the groups as they appear in the DataFrame.

  • threads (int) – How many threads to use to run tests in parallel.

  • progress (bool) – Whether to show a progress bar.

Return type:

Returns the metabolite with their respective test statistics.

micom.stats.correlate_fluxes(fluxes, metadata_column, threads=1, progress=True)[source]

Correlate fluxes with a continuous covariate.

Note

This uses a non-parametric test by default (Spearman rank correlation). q are the FDR-corrected p-values (Benjamini-Hochberg correction).

Parameters:
  • fluxes (pandas.DataFrame) – A frame with net fluxes as returned by production_rates or consumption_rates.

  • metatdata_column (str) – The column of the DataFrame denoting the covariate.

  • threads (int) – How many threads to use to run tests in parallel.

  • progress (bool) – Whether to show a progress bar.

Return type:

Returns the metabolite with their respective test statistics.