This function calculates the area under the curve (AUC) for pathway scores with respect to a specific cell type. It uses the AUC to evaluate the performance of the pathway scores in distinguishing the target cell type from others.

auc(celltype, pathway.scores, return.mean = TRUE, seed = 1)

Arguments

celltype

A factor or character vector representing the cell type labels for each cell.

pathway.scores

A matrix of pathway scores where rows represent cells and columns represent different pathways.

return.mean

Logical, indicating whether to return the weighted mean AUC across all cell types. If FALSE, returns the AUC for each pathway. Default is TRUE.

seed

An integer specifying the random seed for reproducibility. Default is 1.

Value

If return.mean = TRUE, a numeric vector containing the weighted mean AUC. If return.mean = FALSE, a numeric matrix of AUCs where rows represent pathways and columns represent cell types.

See also

AUC for the AUC calculation.

Examples

# Example usage:
celltype <- factor(rep(letters[1:5], each = 20))
pathway.scores <- matrix(runif(1000), nrow = 100, ncol = 10)
colnames(pathway.scores) <- letters[1:10]
auc_values <- auc(celltype, pathway.scores, return.mean = TRUE)
print(auc_values)
#> [1] 0.51335