Skip to contents

An R package of tested helpers for single-cell, bulk RNA-seq and cancer-genomics analyses: volcano plots, gene-gene correlation, Gene Ontology over-representation, mouse-human ortholog conversion, TCGA overall-survival analysis and UMAP parameter sweeps. It started as the shared code behind the analysis repositories in this account and is kept small, documented and covered by tests.

Documentation: https://eomesodermin.github.io/r-utility-functions/

Design

  • Light install. Only ggplot2, dplyr and a few small packages are required. Seurat, clusterProfiler, biomaRt, TCGAbiolinks and the other heavy dependencies are optional; each function checks for what it needs when called and says what to install.
  • Functions return objects. Plot functions return ggplot objects (or the paths they wrote) rather than only drawing to the active device, so results can be tested and reused.
  • Tested. Pure logic (stratification, ortholog lookup, barcode handling, plot construction) is unit tested; calls to external services are isolated so they can be mocked.

Installation

# install.packages("remotes")
remotes::install_github("Eomesodermin/r-utility-functions")

Examples

library(usefulfunctions)

# Volcano plot with a highlighted gene
res <- data.frame(logFC = rnorm(500), FDR = runif(500)^3, row.names = paste0("gene", 1:500))
volcano_plot(res, fc_cutoff = 1, label_genes = "gene1")

# Genes correlated with NKG7 across cells, ranked
cor_df <- sc_correlation(expr_matrix, goi = "NKG7", output.tables = NULL)
plot_correlation(cor_df, output.dir = NULL, goi = "NKG7")

# TCGA overall survival, high versus low expression of a gene or signature
tcga_survival("TCGA-LAML", gene.signature = c("NKG7", "GZMB"))

The getting-started vignette walks through these on simulated data.

Development

devtools::document()   # regenerate man/ and NAMESPACE
devtools::test()       # run the test suite
devtools::check()      # R CMD check
lintr::lint_package()

Citation

See CITATION.cff. Released under the MIT License.