import bed files contains annotations into R as GRanges object
import_bed(con, quite = FALSE)
GRange object
A path, URL, connection or BEDFile
object. For the
functions ending in .bed
, .bedGraph
and .bed15
,
the file format is indicated by the function name. For the base
export
and import
functions, the format must be
indicated another way. If con
is a path, URL or connection,
either the file extension or the format
argument needs to be
one of “bed”, “bed15”, “bedGraph”,
“bedpe”, “narrowPeak”, or
“broadPeak”. Compressed
files (“gz”, “bz2” and
“xz”) are handled transparently.
whether show message
If there is no genome annotation file in GFF format for your interest species, a BED file is convenient to custom a simple annotation file for a gene. Here we suggest two type of BED format: BED6 and BED4.
As the definition of UCSC. The BED6 contains 6 columns, which are 1) chrom, 2) chromStart, 3) chromEnd, 4) name, 5) score and 6) strand. The BED4 format contains the first 4 column of BED6 format.
However, in gene haplotype statistics, we only care about the type of each site. Thus we use the fourth column to definition the transcripts name and "CDS" or "URTs", separated by a space, eg.:
Chr8 678 890 HD1.1 CDS . -
Chr8 891 989 HD1.1 five_prime_UTR . -
Chr8 668 759 HD1.2 CDS . -
Chr8 908 989 HD1.2 CDS . -
This example indicate a small gene named as HD1 have two transcripts, named as HD1.1 and HD1.2, separately. HD1 has a CDS and a UTR region; while HD1.2 has two CDS region.
bed.Path <- system.file("extdata", "annotation.bed6", package = "geneHapR")
bed <- import_bed(bed.Path)
bed
Run the code above in your browser using DataLab