plot_faust_count: Plot counts of FAUST pops by sample

Description Usage Arguments Details Examples

View source: R/plot_faust_count.R

Description

Saves plots of counts to project_path/faustData/plotData/pop_stats for specified FAUST-identified subsets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_faust_count(
  project_path,
  pop,
  font_size = 10,
  point_size_max = 2,
  breaks = NULL,
  trans_x = "asinh",
  p_width = NULL,
  p_height = NULL,
  exhaustive = FALSE,
  limitsize = FALSE
)

Arguments

project_path

character. FAUST project directory.

pop

list or named character vector. If a character vector, then counts of all subsets matching the set of marker levels are plotted. If a list, then each list element must be a character vector. In that case, one boxplot of frequencies is plotted for each element of the list of where the frequency is the sum of all cells that match the population specified. If NULL, then all subsets found are plotted.

breaks

numeric vector. If supplied, then this is the breaks for the x-axis. If not supplied, then the default breaks are used of c(0, 0.001, 0.005, 0.01, 0.02, 0.5, 0.1, 0.5, 1, 2, 5, 10, 20, 50, 100).

trans_x

character or Transformation object (from scales package). the name of a transformation object or the object itself. Built-in transformations include "asinh", "asn", "atanh", "boxcox", "date", "exp", "hms", "identity", "log", "log10", "log1p", "log2", "logit", "modulus", "probability", "probit", "pseudo_log", "reciprocal", "reverse", "sqrt" and "time". Default is asinh.

p_width

numeric. Width of saved plot in cm. If NULL, then set to 40.

p_height

numeric. Height of saved plot in cm. If NULL, then it is set to max(5, n_pop * 1.25), where n_pop is the number of sub-populations in pop.

exhaustive

logical. If TRUE, then counts are taken from the exhaustive FAUST count matrix rather than the count matrix after excluding subsets that don't appear in sufficiently many experimental units. Default is FALSE.

limitsize

logical. If TRUE, then plots of size 125cm x 125cm or more are not saved but an error is returned when cowplot::ggsave2 is run. Default is FALSE.

Details

The key parameter is pop. If pop is a list, then each element is treated as a population for which counts are required on aggregate (rather than for individual subsets of that population). If pop is a character vector, then it is treated as a population for which counts are required for individual subsets.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
project_path <- usethis::proj_path(ext = "/inst/extdata")
# plot all subsets of pop, as it is a character vector
pop <- c("CD3" = "+", "CD4" = "+", "CD8-IgD" = "-",
         "CD20" = "-", "CD33" = "-", "CD14" = "-",
         "TCRgd-CD19" = "-")
plot_faust_count(project_path = project_path,
                 pop = pop)
# plot counts of cells matching annotation of each
# element in pop, as pop is a list
pop <- list(c("CD3" = "+", "CD4" = "+", "CD8-IgD" = "-",
"CD20" = "-", "CD33" = "-", "CD14" = "-",
"TCRgd-CD19" = "-"),
c("CD3" = "+", "CD4" = "-", "CD8-IgD" = "+",
  "CD20" = "-", "CD33" = "-", "CD14" = "-",
 "TCRgd-CD19" = "-"))
plot_faust_count(project_path = project_path,
pop = pop)

MiguelRodo/faustutils documentation built on March 26, 2021, 11:50 p.m.