Skip to contents

Computes and visualizes Receiver Operating Characteristic (ROC) curves for a list of predicted adjacency matrices compared against a binary ground truth network.

Usage

plotROC(matrices_list, ground_truth, plot_title, is_binary = FALSE)

Arguments

matrices_list

A list of square matrices representing predicted interactions. Each must share dimnames with ground_truth; entries may be binary (0/1) or continuous weights.

ground_truth

A square binary matrix indicating true interactions (1) in the upper triangle. Must match dims and names of each element of matrices_list.

plot_title

Character string. Title for the ROC plot.

is_binary

Logical. If TRUE, treat matrices as binary predictions. Default FALSE for weighted predictions.

Value

A list with:
auc: data frame of AUC per matrix.
plot: the ROC plot (via ggplot2).

Details

For binary matrices, a single TPR/FPR point is computed per matrix. For weighted ones, a full ROC curve is computed from continuous scores. Diagonals are ignored; symmetry is not enforced.

Examples

data(count_matrices)
data(adj_truth)

networks <- infer_networks(
    count_matrices_list = count_matrices,
    method = "GENIE3",
    nCores = 1
)
head(networks[[1]])
#>   regulatoryGene targetGene    weight
#> 1          ARPC2      ARPC3 0.1991800
#> 2          HLA-A       CD74 0.1780468
#> 3          HLA-E        FOS 0.1595771
#> 4          ARPC2      HLA-E 0.1536369
#> 5          ARPC3      ARPC2 0.1525041
#> 6           CD3E       CD3D 0.1486902

wadj_list <- generate_adjacency(networks)
swadj_list <- symmetrize(wadj_list, weight_function = "mean")

roc_res <- plotROC(
    swadj_list,
    adj_truth,
    plot_title = "ROC Curve: GENIE3",
    is_binary = FALSE
)
roc_res$plot

auc_joint <- roc_res$auc