tests/testthat/helper_functions.R

randomSimilarity <- function(dimensions = 10) {
  library(dplyr)
  counts <- rnorm(dimensions * dimensions) %>%
    rescale() %>%
    matrix(nrow = dimensions, ncol = dimensions)

  diag(counts) <- 1

  counts <- pmax(counts, t(counts))
  rownames(counts) <- make.names(seq(from = 1, to = dimensions))
  colnames(counts) <- make.names(seq(from = 1, to = dimensions))

  return(counts)
}

rescale <- function(x) {
  (x - min(x)) / (max(x) - min(x))
}

clusterProfilerGSEA <- function() {
  readRDS(testthat::test_path("fixtures", "clusterProfilerGSEA.RDS"))
}

clusterProfilerORA <- function() {
  readRDS(testthat::test_path("fixtures", "clusterProfilerORA.RDS"))
}

customEnrichment <- function() {
  readRDS(testthat::test_path("fixtures", "customEnrichment.RDS"))
}

gprofilerEnrichment <- function() {
  readRDS(testthat::test_path("fixtures", "gprofiler2.RDS"))
}

Try the aPEAR package in your browser

Any scripts or data that you put into this service are public.

aPEAR documentation built on July 9, 2023, 6:16 p.m.