Combines log fold change and p-value into a single significance score (Xiao et al. 2014). By default returns the signed variant log2FC * -log10(p) for directional ranking; set signed = FALSE for the paper's original |log2FC| * -log10(p).

piScore(
  de_results,
  logfc_col = "avg_log2FC",
  pval_col = "p_val_adj",
  signed = TRUE,
  pval_floor = .Machine$double.xmin,
  add_column = TRUE,
  rank = FALSE
)

Arguments

de_results

A data.frame-like object containing differential expression results.

logfc_col

Character. Column containing log2 fold change. If the default is absent, common alternatives are detected automatically.

pval_col

Character. Column containing p-values. If the default is absent, common alternatives are detected automatically.

signed

Logical. If TRUE, preserve the direction of the log fold change. If FALSE, use the unsigned Xiao et al. definition.

pval_floor

Numeric. Minimum p-value used before applying -log10(p), avoiding infinite scores when p-values are zero.

add_column

Logical. If TRUE, append pi_score to de_results. If FALSE, return a numeric vector.

rank

Logical. If TRUE and add_column = TRUE, append pi_rank where rank 1 is the largest pi-score.

Value

If add_column = TRUE, a data.frame with pi_score and optionally pi_rank appended. Otherwise, a numeric vector aligned to the input rows.

References

Xiao Y, Hsiao T-H, Suresh U, et al. (2014) A novel significance score for gene selection and ranking. Bioinformatics 30(6):801-807. doi:10.1093/bioinformatics/btr671

Examples

de <- data.frame(gene = c("g1", "g2", "g3"), avg_log2FC = c(2, -1, 0.5),
                 p_val_adj = c(1e-10, 0.01, 0.5))
piScore(de, rank = TRUE)