Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/readRegionsFromBedFile.R
Reads a BED file and returns the genomic regions as GRanges
object
1 2 3 4 5 |
file |
the name of the file, text-mode connection, or URL to read data from |
header,sep,col.names |
arguments passed on to |
ignoreMcols |
if |
seqInfo |
can be |
This function is a simple wrapper around the
read.table
function that reads from a BED file
and returns the genomic regions as a GRanges
object. How the file is split into columns can be controlled by the
arguments header
, sep
, and col.names
. These
arguments are passed on to read.table
as they are.
The choice of the col.names
argument is crucial. A wrong
col.names
argument results in erroneous assignment of columns.
The function readRegionsFromBedFile
requires columns named
“chrom”, “chromStart”, and “chromEnd” to be
present in the object returned from read.table
upon
reading from the BED file. If a column named “strands” is
contained in the BED file, this column is used as strand info in
the resulting GRanges
object.
If ignoreMcols=TRUE
(default), further columns are
ignored. If ignoreMcols=FALSE
, all columns other than
“chrom”, “chromStart”, “chromEnd”,
“names”, “strand”, and “width” are appended
to the resulting GRanges
object as metadata
columns.
The seqInfo
argument can be used to assign the right metadata,
such as, genome, chromosome names, and chromosome lengths
to the resulting GRanges
object.
a GRanges
object
Ulrich Bodenhofer bodenhofer@bioinf.jku.at
http://www.bioinf.jku.at/software/podkat
http://genome.ucsc.edu/FAQ/FAQformat.html#format1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## basic example (hg38 regions of HBA1 and HBA2)
bedFile <- system.file("examples/HBA.bed", package="podkat")
readRegionsFromBedFile(bedFile)
## example with enforcing seqinfo
data(hg38Unmasked)
readRegionsFromBedFile(bedFile, seqInfo=seqinfo(hg38Unmasked))
##
## example with regions targeted by Illumina TruSeq Exome Enrichment kit:
## download file "truseq_exome_targeted_regions.hg19.bed.chr.gz" from
## http://support.illumina.com/downloads/truseq_exome_targeted_regions_bed_file.ilmn
## (follow link "TruSeq Exome Targeted Regions BED file"; these regions
## are based on hg19)
##
## Not run:
readRegionsFromBedFile("truseq_exome_targeted_regions.hg19.bed.chr.gz")
data(hg19Unmasked)
readRegionsFromBedFile("truseq_exome_targeted_regions.hg19.bed.chr.gz",
seqInfo=seqinfo(hg19Unmasked))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.