read_anno: Read annotation file

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

View source: R/process_data.R

Description

read_anno reads a file containing annotation data, which will be used to select genomic regions of interest for downstream analysis. The annotation file format is the following: "chromosome", "start", "end", "strand", "id", "name" (optional). Read the Important section below for more details.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
read_anno(
  file,
  chrom_size_file = NULL,
  chr_discarded = NULL,
  is_centre = FALSE,
  is_window = TRUE,
  upstream = -5000,
  downstream = 5000,
  is_anno_region = TRUE,
  delimiter = "\t"
)

Arguments

file

File name.

chrom_size_file

Optional file name to read genome chromosome sizes.

chr_discarded

Optional vector with chromosomes to be discarded.

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.

is_anno_region

Logical, whether or not to create genomic region. It should be set to TRUE, if you want to use the object as input to create_region_object function.

delimiter

Delimiter format the columns are splitted. Default is tab.

Value

A GRanges object.

The GRanges object contains two or three additional metadata columns:

These columns can be accessed as follows: granges_obj$id

Important

Author(s)

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

See Also

read_met, create_anno_region, create_region_object

Examples

1
2
3
4
5
6
# Obtain the path to files
file <- system.file("extdata", "dummy_anno.bed", package = "BPRMeth")
anno_dt <- read_anno(file, chr_discarded = c("X"))

# Extract feature id
anno_ids <- anno_dt$id

andreaskapou/BPRMeth documentation built on June 11, 2020, 10:49 p.m.