get_feature_ranks: Get feature ranking vector from differential abundance...

get_feature_ranksR Documentation

Get feature ranking vector from differential abundance testing results

Description

Calculate ranking values to sort features from most upregulated to most downregulated for GSEA

Usage

get_feature_ranks(
  data,
  rank_by = "stat",
  rank_type = "",
  id_col = NULL,
  direction_by = NULL,
  ...
)

Arguments

rank_type

Examples

df <- data.frame(id = rgenes(n = 100), stat = rnorm(100), mean = runif(100))
df[1:50,-1] <- df[51:100,-1] # make duplicates
df |> get_feature_ranks(rank_by = c("stat", "mean"), rank_type = c("", ""), id_col="id")

dds <- DESeq2::makeExampleDESeqDataSet(n = 10000, interceptMean = c(2,5))
res <- dds |> runDESeq2(formula = ~ condition, contrasts = list(BvsA = c("condition", "B", "A")))
res$results$BvsA |> get_feature_ranks(rank_by = c("pvalue", "baseMean"), rank_type = c("p", ""), direction_by = "log2FC")

AlexanderKirchmair/datamisc documentation built on June 13, 2025, 5:26 a.m.