Objective

A plot method for AnyHermesData objects to produce following plots in default setting: 1. Histogram of the library sizes using draw_libsize_hist() 2. Q-Q plot of the library sizes using draw_libsize_qq() 3. Density plot of the (log) counts distributions using draw_libsize_densities() 4. Boxplot, with overlaid data points, of the number of non-zero expressed genes per sample using draw_nonzero_boxplot() 5. Stacked barplot of low expression genes by chromosome using draw_genes_barplot()

Idea

setMethod(
  f = "autoplot",
  signature = c(object = "AnyHermesData"),
  definition = function(object) {
    assert_that(
      is_hermes_data(object)
    )
  a <- draw_libsize_hist(object)
  b <- draw_libsize_qq(object)
  c <- draw_libsize_densities(object)
  d <- draw_nonzero_boxplot(object)
  e <- draw_genes_barplot(object)
  result <- list(a, b, c, d, e)
  sapply(result, grid::grid.draw)
  invisible(result)
  }
)

# Test 
result <- hermes_data
autoplot(result)


insightsengineering/hermes documentation built on Sept. 19, 2024, 9:06 p.m.