rnb.set.annotation {RnBeads} | R Documentation

## rnb.set.annotation

### Description

Adds or replaces a region annotation table.

### Usage

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

### Arguments

`type` | 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.
`regions` | 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 `integer`s. The row names of this `data.frame` are used as region identifiers.
`description` | 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.
`assembly` | Genome assembly of interest. See `rnb.get.assemblies` for the list of supported genomes.

### Details

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.

### Value

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

### Author(s)

Yassen Assenov

### See Also

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

### Examples

    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)

[Package RnBeads version 2.2.0 Index]