The first three columns of the file specified by file_name
must
contain data in the standard bed format (i.e., a genomic interval
represented by 0-based half-open interval with seq-id, start and end position).
These columns will be renamed to 'chrom', 'start' and 'end', respectively. Any
other columns present in the data will be left unmodified.
read_bed(file_name, tibble = FALSE, ...)
file_name | Path to the bed file to be read in |
---|---|
tibble | logical If TRUE, the genomic intervals are returned as
a tidy |
... | Other arguments passed to |
Either a data.frame
or a tbl_df
with at least three
columns named 'chrom', 'start' and 'end'
The file is read into memory with read.table
, with the
argument sep
set to '\t'
and stringsAsFactors
set to
FALSE. All other arguments are left as default, but arguments can be passed
from read_bed
to read.table
.
bed_path <- system.file("extdata", "Q_centro.bed", package="pafr") centro <- read_bed(bed_path) centro#> chrom start end #> 1 Q_chr1 1305119 1325119 #> 2 Q_chr2 3311000 3331000 #> 3 Q_chr5 1780000 1800000 #> 4 Q_chr6 1005337 1025337 #> 5 Q_chr4 951000 971000 #> 6 Q_chr7 449000 469000 #> 7 Q_chr3 625000 645000# Can pass arguments to read.table miss_two <- read_bed(bed_path, skip=2) miss_two#> chrom start end #> 1 Q_chr5 1780000 1800000 #> 2 Q_chr6 1005337 1025337 #> 3 Q_chr4 951000 971000 #> 4 Q_chr7 449000 469000 #> 5 Q_chr3 625000 645000