read_bed {HodgesTools} | R Documentation |
Read bed file
Description
Reads in a tab-delimited BED formatted file into R.
Usage
read_bed(file, extra_col_names = c(), length = FALSE, verbose = TRUE)
Arguments
file |
bed file |
extra_col_names |
list of strings specifying extra column names |
length |
boolean of whether to add length column |
verbose |
boolean set to see function behavior |
Details
First three columns of file must be the genomic coordinates of the regions (i.e. chr start end).
read_bed will auto-detect BED3 and BED6 formats. It will also detect BED3+ and BED6+ formats assigning generic or user-defined col_names to the additional column(s).
Value
tibble
Author(s)
Tyler Hansen & Tim Scott
Examples
#load external data.
BED3 <- system.file(package = "HodgesTools", "extdata", "test_BED3.bed")
BED6 <- system.file(package = "HodgesTools", "extdata", "test_BED6.bed")
BED4 <- system.file(package = "HodgesTools", "extdata", "test_BED4.bed")
BED8 <- system.file(package = "HodgesTools", "extdata", "test_BED8.bed")
# Read 3-column BED file.
read_bed(BED3)
# Read 6-column BED file.
read_bed(BED6)
# Read 3-column BED file and add length column.
read_bed(BED3, length = TRUE)
# Read 3 column format BED file with additional fourth column. Add generic column names.
read_bed(BED4)
# Read 3 column format BED file with additional fourth column. Specify additional column names.
read_bed(BED4, extra_col_names = c("fourthColumn"))
# Read 6 column format BED file with additional columns. Specify additional column names.
read_bed(BED8, extra_col_names = c("seventhColumn", "eigthColumn"))
[Package HodgesTools version 1.0.0 Index]