API

Import decoupler as:

import decoupler as dc

Preprocessing:

extract(mat[, use_raw, verbose, dtype])

Processes different input types so that they can be used downstream.

filt_min_n(c, net[, min_n])

Removes sources of a net with less than min_n targets.

match(c, r, net)

Matches mat with a regulatory adjacency matrix.

rename_net(net[, source, target, weight])

Renames input network to match decoupler's format (source, target, weight).

get_net_mat(net)

Transforms a given network to a regulatory adjacency matrix (targets x sources).

break_ties(m, c, seed)

Methods:

run_aucell(mat, net[, source, target, n_up, ...])

AUCell.

run_gsea(mat, net[, source, target, times, ...])

Gene Set Enrichment Analysis (GSEA).

run_gsva(mat, net[, source, target, kcdf, ...])

Gene Set Variation Analysis (GSVA).

run_mdt(mat, net[, source, target, weight, ...])

Multivariate Decision Tree (MDT).

run_mlm(mat, net[, source, target, weight, ...])

Multivariate Linear Model (MLM).

run_ora(mat, net[, source, target, n_up, ...])

Over Representation Analysis (ORA).

run_udt(mat, net[, source, target, weight, ...])

Univariate Decision Tree (UDT).

run_ulm(mat, net[, source, target, weight, ...])

Univariate Linear Model (ULM).

run_viper(mat, net[, source, target, ...])

Virtual Inference of Protein-activity by Enriched Regulon (VIPER).

run_wmean(mat, net[, source, target, ...])

Weighted mean (WMEAN).

run_wsum(mat, net[, source, target, weight, ...])

Weighted sum (WSUM).

run_consensus(mat, net[, source, target, ...])

Consensus score from top methods.

Running multiple methods:

decouple(mat, net[, source, target, weight, ...])

Decouple function.

cons(res)

Consensus score between methods.

dense_run(func, mat, net[, source, target, ...])

Run a method without zero values.

General utils:

melt(df)

Function to generate a long format dataframe similar to the one obtained in the R implementation of decoupler.

show_methods()

Shows available methods.

check_corr(net[, source, target, weight, ...])

Checks the correlation across the regulators in a network.

get_toy_data([n_samples, seed])

Generate a toy mat and net for testing.

summarize_acts(acts, groupby[, obs, mode, ...])

Summarizes activities obtained per group by their mean or median and removes features that do not change across samples.

assign_groups(summary)

Assigns group labels based on summary activities.

dense_run(func, mat, net[, source, target, ...])

Run a method without zero values.

p_adjust_fdr(p)

Benjamini-Hochberg p-value correction for multiple hypothesis testing.

shuffle_net(net[, target, weight, seed, ...])

Shuffle network to make it random.

read_gmt(path)

Read a GMT file and return a pd.DataFrame.

AnnData utils:

get_acts(adata, obsm_key[, dtype])

Extracts activities as AnnData object.

swap_layer(adata, layer_key[, X_layer_key, ...])

Swaps an adata.X for a given layer.

get_pseudobulk(adata, sample_col, groups_col)

Summarizes expression profiles across cells per sample and group.

get_contrast(adata, group_col, ...[, ...])

Computes Differential Expression Analysis using scanpy's rank_genes_groups function between two conditions from pseudo-bulk profiles.

get_top_targets(logFCs, pvals, contrast[, ...])

Return significant target features for a given source and contrast.

format_contrast_results(logFCs, pvals)

Formats the results from get_contrast into a long format data-frame.

filter_by_expr(adata[, obs, group, ...])

Determine which genes have sufficiently large counts to be retained in a statistical analysis.

filter_by_prop(adata[, min_prop, min_smpls])

Determine which genes are expressed in a sufficient proportion of cells across samples.

get_metadata_associations(data[, obs_keys, ...])

Associate the data to sample metadata using ANOVA.

rank_sources_groups(adata, groupby[, ...])

Rank sources for characterizing groups.

Omnipath wrappers:

show_resources()

Shows available resources in Omnipath.

get_resource(name[, organism, ...])

Wrapper to access resources inside Omnipath.

get_progeny([organism, top, genesymbol_resource])

Pathway RespOnsive GENes for activity inference (PROGENy).

get_dorothea([organism, levels, ...])

DoRothEA gene regulatory network.

get_collectri([organism, split_complexes, ...])

CollecTRI gene regulatory network.

translate_net(net[, columns, ...])

Translate networks between species by orthology.

Plotting

plot_volcano(logFCs, pvals, contrast[, ...])

Plot logFC and p-values.

plot_violins(mat[, thr, log, use_raw, ...])

Plot distribution of features' values per sample.

plot_barplot(acts, contrast[, top, ...])

Plot barplots showing the top absolute value activities.

plot_metrics_scatter(df[, x, y, groupby, ...])

Plot scatter plot of metrics across two different axes.

plot_metrics_scatter_cols(df, col[, x, y, ...])

Extension of the function plot_metrics_scatter to group metrics by two categories at the same time.

plot_metrics_boxplot(df, metric[, groupby, ...])

Plot boxplots showing the distribution of scores between methods for a metric.

plot_psbulk_samples(adata, groupby[, ...])

Quality Control plot to assess the quality of the obtained pseudobulk samples.

plot_filter_by_expr(adata[, obs, group, ...])

Plot to help determining the thresholds of the decoupler.filter_by_expr function.

plot_filter_by_prop(adata[, min_prop, ...])

Plot to help determining the thresholds of the decoupler.filter_by_prop function.

plot_volcano_df(data, x, y[, top, sign_thr, ...])

Plot logFC and p-values from a long formated data-frame.

plot_targets(data, stat, source_name, net[, ...])

Plot the weight and statistic of the target genes of a given source.

plot_running_score(df, stat, net, set_name)

Plot the running score of GSEA.

plot_barplot_df(df, x, y[, color, thr, ...])

Plot results of enrichment analysis as bars.

plot_dotplot(df, x, y, c, s[, scale, cmap, ...])

Plot results of enrichment analysis as dots.

plot_associations(data, uns_key[, ...])

Create a composite plot displaying association results between scores (bottom) and summary statistics (top) using a clustermap.

plot_network(net[, obs, act, n_sources, ...])

Plot results of enrichment analysis as network.

Metrics

metric_auroc(y_true, y_score)

Area Under the Receiver Operating characteristic Curve (AUROC)

metric_auprc(y_true, y_score[, pi0])

Area Under the Precision-Recall Curve (AUPRC)

metric_mcauroc(y_true, y_score[, n_iter, seed])

Monte-Carlo Area Under the Receiver Operating characteristic Curve (AUROC)

metric_mcauprc(y_true, y_score[, n_iter, seed])

Monte-Carlo Area Under the Precision-Recall Curve (AUPRC)

Benchmark utils

get_toy_benchmark_data([n_samples, seed, ...])

Generate a toy mat, net and obs for testing the benchmark pipeline.

show_metrics()

Shows available evaluation metrics.

Benchmark

benchmark(mat, obs, net, perturb, sign[, ...])

Benchmark methods or networks on a given set of perturbation experiments using activity inference with decoupler.

format_benchmark_inputs(mat, obs, perturb, ...)

get_performances(res, obs, groupby, by, metrics)

Other

get_ora_df(df, net[, source, target, ...])

Wrapper to run ORA for results of differential analysis (long format dataframe).

get_gsea_df(df, stat, net[, source, target, ...])

Wrapper to run GSEA for results of differential analysis (long format dataframe).