readBed {genomation} | R Documentation

## Read a BED file and convert it to GRanges.

### Description

The function reads a BED file that contains location and other information on genomic features and returns a `GRanges` object. The minimal information that the BED file has to have is chromosome, start and end columns. it can handle all BED formats up to 12 columns.

### Usage

    readBed(file, track.line = FALSE, remove.unusual = FALSE,
      zero.based = TRUE)

### Arguments

`file` | location of the file, a character string such as: "/home/user/my.bed" or the input itself as a string (containing at least one \n). The file can end in `.gz`, `.bz2`, `.xz`, or `.zip` and/or start with `http://` or `ftp://`. If the file is not compressed it can also start with `https://` or `ftps://`.
`track.line` | the number of track lines to skip, "auto" to detect them automatically or FALSE(default) if the bed file doesn't have track lines
`remove.unusual` | if TRUE remove the chromosomes with unsual names, such as chrX_random (Default:FALSE)
`zero.based` | a boolean which tells whether the ranges in the bed file are 0 or 1 base encoded. (Default: TRUE)

### Value

`GRanges` object

### Examples

    my.file=system.file("extdata","chr21.refseq.hg19.bed",package="genomation")
    refseq = readBed(my.file,track.line=FALSE,remove.unusual=FALSE)
    head(refseq)

[Package genomation version 1.20.0 Index]