readCustomBedFile: Read bed-file into GRanges

Description Usage Arguments Value Author(s) Examples

View source: R/readCustomBedFile.R

Description

This is a simple convenience function to read a bed(.gz)-file into a GRanges-class object. The bed-file is expected to have the following fields: chromosome, start, end, name, score, strand.

Usage

1
2
3
4
5
6
7
8
readCustomBedFile(
  bedfile,
  col.names = c("chromosome", "start", "end", "name", "score", "strand"),
  col.classes = NULL,
  skip = 0,
  chromosome.format = "NCBI",
  sep = ""
)

Arguments

bedfile

Filename of the bed or bed.gz file.

col.names

A character vector giving the names of the columns in the bedfile. Must contain at least c('chromosome','start','end').

col.classes

A character vector giving the classes of the columns in bedfile. Speeds up the import.

skip

Number of lines to skip at the beginning.

chromosome.format

Desired format of the chromosomes. Either 'NCBI' for (1,2,3 ...) or 'UCSC' for (chr1,chr2,chr3 ...) or NULL to keep the original names.

sep

Field separator from read.table.

Value

A GRanges-class object with the contents of the bed-file.

Author(s)

Aaron Taudt

Examples

1
2
3
4
5
## Get an example BED file
bedfile <- system.file("extdata", "liver-H3K4me3-BN-male-bio2-tech1.bed.gz",
                       package="chromstaRData")
## Import the file and skip the first 10 lines
data <- readCustomBedFile(bedfile, skip=10)

chromstaR documentation built on Nov. 8, 2020, 8:29 p.m.