rnb.set.annotation: rnb.set.annotation

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/annotations.R


Adds or replaces a region annotation table.


rnb.set.annotation(type, regions, description = NULL, assembly = "hg19")



One-element character vector giving the name of the annotation. If this region type is already available, it will be overwritten for the current session. The type cannot be one of "CpG", "probes450" or "controls450", because these names are reserved for the annotation tables of CpG dinucleotides, and Infinium methylation and control probes, respectively.


BED file defining regions (see Details). Alternatively, the value of this parameter can be a table of genomic regions in the form of a data.frame, containing at least the following three columns - "Chromosome", "Start" and "End" (notice the upper case). The "chromosome" column must be a character or factor vector that lists chromosome names. The "start" and "end" columns are expected to contain genomic positions as integers. The row names of this data.frame are used as region identifiers.


Optional; short description in the form of a non-empty character vector. The elements in this vector are concatenated without a separator to form the description of the annotation.


Genome assembly of interest. See rnb.get.assemblies for the list of supported genomes.


In case the parameter regions specifies an existing BED file, regions are loaded from this file. The number of columns defined must be at least 3. Columns after the sixth one, if present, are dropped. The columns are given the following names: "chromosome", "start", "end", "id", "score" and "strand".

The annotation tables in RnBeads focus on chromosomes "chr1", "chr2", ..., "chr22", "chrX" and "chrY". Regions on other chromosomes are ignored. This function also recognizes the convention of chromosome names such as "1", adopted, for example, by Ensembl. Apart from this, the region definition table is not examined in details by this function; therefore, regions located on unsupported chromosomes or having invalid (e.g. negative) genomic coordinates are simply not mapped to any sites or probes.


Invisibly, TRUE if an existing annotation was replaced and FALSE otherwise.


Yassen Assenov

See Also

rnb.get.annotation for extracting annotation; rnb.region.types for all loaded region types in a genome assembly


my.regions <- data.frame(
    chromosome = c("chr1", "chr1"),
    start = c(49242278L, 49242372L),
    end = c(49242590L, 49242810L),
    rownames = c("BEND5E1", "CpG:38"))
txt <- "First exon of the BEND5 gene and an overlapping CpG island."
rnb.set.annotation("my regions", my.regions, txt)

RnBeads documentation built on March 3, 2021, 2 a.m.