Entering edit mode
Janet Young
▴
740
@janet-young-2360
Last seen 5.1 years ago
Fred Hutchinson Cancer Research Center,…
Hi there,
A quick question - I'm a little confused about how to use the "blocks"
function of rtracklayer - can you help? I think perhaps I'm just not
understanding the help page right and not understanding what should be
possible and what should not. I'm looking at ?blocks (and
?import.bed). From those pages, it seems like the following code
should work, but I get errors. I'm missing something, I think....
I think i'll be able to find another more convoluted way to do what I
want to do, which is to get the total transcript size from a bed file
that contains block information, but it seems like this simpler way
should work - any suggestions?
Thanks,
Janet Young
----------
library(rtracklayer)
### read in a bed file: (this example is from the help page
?import.bed and has some block information)
test_path <- system.file("tests", package = "rtracklayer")
test_bed <- file.path(test_path, "test.bed")
test <- import(test_bed)
class(test)
#[1] "UCSCData"
#attr(,"package")
#[1] "rtracklayer"
test2 <- as(test, "RangedData")
class(test2)
#[1] "RangedData"
#attr(,"package")
#[1] "IRanges"
blocks(test2)
#Error in blocks(as(x, "GenomicRanges")) :
# error in evaluating the argument 'x' in selecting a method for
function 'blocks': Error in as(x, "GenomicRanges") :
# no method or default for coercing "RangedData" to "GenomicRanges"
blocks(asBED(test2))
#Error in blocks(asBED(test2)) :
# error in evaluating the argument 'x' in selecting a method for
function 'blocks': Error in function (classes, fdef, mtable) :
# unable to find an inherited method for function "asBED", for
signature "RangedData"
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rtracklayer_1.16.3 GenomicRanges_1.8.11 IRanges_1.14.4
BiocGenerics_0.2.0
loaded via a namespace (and not attached):
[1] Biostrings_2.24.1 bitops_1.0-4.1 BSgenome_1.24.0 RCurl_1.91-1
Rsamtools_1.8.6 stats4_2.15.1 tools_2.15.1
[8] XML_3.9-4 zlibbioc_1.2.0