convert WIG format track to BED format track for a given range

parseWIG(trackScore, chrom, from, to)

Arguments

trackScore

an object of track with WIG format

chrom

sequence name of the chromosome

from

start coordinate

to

end coordinate

Value

an object of track

Examples

extdata <- system.file("extdata", package="trackViewer", mustWork=TRUE)
repA <- importScore(file.path(extdata, "cpsf160.repA_-.wig"),
                    file.path(extdata, "cpsf160.repA_+.wig"),
                    format="WIG")
strand(repA$dat) <- "-"
strand(repA$dat2) <- "+"
parseWIG(repA, chrom="chr11", from=122929275, to=122930122)
#> This is an object of track
#>  slot name:  
#>  slot type: data 
#>  slot format: BED 
#> slot dat:
#> GRanges object with 126 ranges and 1 metadata column:
#>         seqnames              ranges strand |     score
#>            <Rle>           <IRanges>  <Rle> | <numeric>
#>     [1]    chr11 122929304-122929339      - |   0.08199
#>     [2]    chr11 122929344-122929345      - |   0.16398
#>     [3]    chr11           122929346      - |   0.32796
#>     [4]    chr11           122929347      - |   0.49194
#>     [5]    chr11           122929348      - |   0.65592
#>     ...      ...                 ...    ... .       ...
#>   [122]    chr11           122929936      - |   1.80378
#>   [123]    chr11           122929937      - |   1.47582
#>   [124]    chr11 122929938-122929939      - |   0.73791
#>   [125]    chr11           122929940      - |   0.49194
#>   [126]    chr11 122929941-122929969      - |   0.08199
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
#> slot dat2:
#> GRanges object with 0 ranges and 1 metadata column:
#>    seqnames    ranges strand |     score
#>       <Rle> <IRanges>  <Rle> | <numeric>
#>   -------
#>   seqinfo: no sequences
#> slot style: try object$style to see details.