create_anno_region {BPRMeth} | R Documentation

## Create annotation regions

### Description

`create_anno_region` creates annotation regions from annotation data, using the central point of the annotation features as ground truth labels we create genomic regions `N` bp upstream and `M` bp downstream of central location.

### Usage

    create_anno_region(
      anno,
      chrom_size = NULL,
      is_centre = FALSE,
      is_window = TRUE,
      upstream = -5000,
      downstream = 5000
    )

### Arguments

`anno` | A `GRanges` object containing the annotation data, this normally would be the output from `read_anno` function.
`chrom_size` | Object containing genome chromosome sizes, normally would be the output of `read_chrom_size` function.
`is_centre` | Logical, whether 'start' and 'end' locations are pre-centred. If TRUE, the mean of the locations will be chosen as centre. If FALSE, the 'start' will be chosen as the center; e.g. for genes the 'start' denotes the TSS and we use this as centre to obtain K-bp upstream and downstream of TSS.
`is_window` | Whether to consider a predefined window region around centre. If TRUE, then 'upstream' and 'downstream' parameters are used, otherwise we consider the whole region from start to end location.
`upstream` | Integer defining the length of bp upstream of 'centre' for creating the genomic region. If is_window = FALSE, this parameter is ignored.
`downstream` | Integer defining the length of bp downstream of 'centre' for creating the genomic region. If is_window = FALSE, this parameter is ignored.

### Value

A `GRanges` object containing the genomic regions.

The GRanges object contains two or three additional metadata column:

- `id`: Genomic region id.

- `centre`: Central location of each genomic region.

- `name`: (Optional) Genomic region name.

This column can be accessed as follows: `granges_object$tss`

### Author(s)

C.A.Kapourani C.A.Kapourani@ed.ac.uk

### See Also

`create_region_object`, `read_anno`

### Examples

    # Obtain the path to files
    file <- system.file("extdata", "dummy_anno.bed", package = "BPRMeth")
    anno_dt <- read_anno(file, is_anno_region = FALSE)
    # Create genomic region
    gen_region <- create_anno_region(anno_dt)
    # Extract ID
    id <- gen_region$id

[Package BPRMeth version 1.16.0 Index]