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

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 sum (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.

AnnData utils:

get_acts(adata, obsm_key)

Extracts activities as AnnData object.

get_pseudobulk(adata, sample_col, groups_col)

Generates an unormalized pseudo-bulk profile 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.

Omnipath wrappers:

show_resources()

Shows available resources in Omnipath.

get_resource(name[, organism])

Wrapper to access resources inside Omnipath.

get_progeny([organism, top])

Pathway RespOnsive GENes for activity inference (PROGENy).

get_dorothea([organism, levels, weight_dict])

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

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)