Reading data from a BED or WIG file to RleList

Share:

Description

Read a track object from a BED, bedGraph, WIG or BigWig file to RleList

Usage

1
importData(files, format=NA, ranges=GRanges())

Arguments

files

The path to the files to read.

format

The format of import file. Could be BAM, BED, bedGraph, WIG or BigWig

ranges

An object of GRanges to indicate the range to be imported

Value

a list of RleList.

Author(s)

Jianhong Ou

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#import a BED file
bedfile <- system.file("tests", "test.bed", package="rtracklayer",
                       mustWork=TRUE)
dat <- importData(files=bedfile, format="BED",
                    ranges=GRanges("chr7", IRanges(127471197, 127474697)))

##import a WIG file
wigfile <- system.file("tests", "step.wig", package = "rtracklayer",
                       mustWork=TRUE)
dat <- importData(files=wigfile, format="WIG", 
                  ranges=GRanges("chr19", 
                                 IRanges(59104701, 59110920)))

##import a BigWig file
if(.Platform$OS.type!="windows"){
    ##this is because we are using rtracklayer::import
    bwfile <- system.file("tests", "test.bw", package = "rtracklayer",
                       mustWork=TRUE)
    dat <- importData(files=bwfile, format="BigWig", 
                      ranges=GRanges("chr19", IRanges(1500, 2700)))
}