Collapse a vector of gene names

collapseGenes(
  x,
  sort = TRUE,
  dedup = TRUE,
  format = "_",
  sep = ", ",
  last = " and ",
  numeric = TRUE,
  width = Inf,
  ...
)

Arguments

x

character vector representing gene names

sort

logical(1) Should the names be sorted alphabetically

dedup

logical(1) Should duplicate names be removed

format

character string for markdown formatting of each element

sep

separator between vector elements

last

character string to place before the last element

numeric

logical(1) sort digits numerically, instead of as strings

width

The maximum width of the string before truncating to ...

...

passed to str_sort

Value

a glue object

Details

Convenience function to collapse a vector of gene names into a character/glue object of length 1. By default, symbols are deduplicated, sorted alpha-numerically and italicised with an underscore.

Examples

genes <- c("FOXP3", "BRCA1", "TP53")
collapseGenes(genes)
#> _BRCA1_, _FOXP3_ and _TP53_