compact.gene.list: Make a compact version of gene annotation
Description
When adding gene annotation to genomic ranges, sometimes
there are many genes associated with a single feature, so
that compiling a table becomes awkward, if some rows contain
hundreds of genes. This function takes a character vector
of gene lists delimited by some separator and provides
a compact representation of the gene labels
Usage
compact.gene.list(x, n = 3, sep = ";", others = FALSE)
Arguments
x
is a character vector of gene label listings, where multiple hits
are delimited by 'sep'
n
number of genes to list before abbreviating
sep
character, separator used to delimit genes in elements of x
others
logical, TRUE to abbreviate with '+ # others' or FALSE to
append just the number of genes not listed.
Value
a character vector with the form:
gene-1, gene-2, ..., gene-n, + length(gene-n) - n [others]
# NOT RUN {my.genes <- c("ERAP1","HLA-C;CTLA4;IFIH","INS;MYC","AGAP1;APOE;DRDB1;FUT2;HCP5;BDNF;COMT")
compact.gene.list(my.genes)
compact.gene.list(my.genes,n=2,others=TRUE)
# }