I am trying to create a GRanges object form package GenomicRanges from an RleViewsList but I am getting the following error >Error in normalizeSingleBracketSubscript(i, x) : invalid subscript type. Do you know why this is happening? More details about the objects and the R session below:
Thank you very much!
The RleViewsList has been created using the "coverage" function then the "slice" function to filter areas with a continuous coverage >3. A Granges object was first created with the "subsetByOverlaps" function:
>inp
GRanges with 4162112 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] 10 [111068, 111109] *
[2] 10 [118972, 119013] *
[3] 10 [119395, 119436] *
[4] 10 [119879, 119920] *
[5] 10 [119881, 119922] *
... ... ... ...
[4162108] X [154509640, 154509681] *
[4162109] X [154509645, 154509686] *
[4162110] X [154509645, 154509686] *
[4162111] X [154595860, 154595901] *
[4162112] X [154595873, 154595914] *
---
seqlengths:
10 11 12 13 14 15 16 17 18 19 1 20 2 3 4 5 6 7 8 9 X
NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
>cov <- coverage(inp)
>rle.i <- slice(cov, lower = 3)
>reduce(as(rle.i, "GRanges"))
>Error in normalizeSingleBracketSubscript(i, x) : invalid subscript type.
>rle.i
RleViewsList of length 21
names(21): 10 11 12 13 14 15 16 17 18 19 1 20 2 3 4 5 6 7 8 9 X
>rle.i[[1]]
Views on a 112160197-length Rle subject
views:
start end width
[1] 1658660 1658715 56 [3 3 3 3 3 3 5 4 4 4 4 4 3 3 5 5 5 6 6 6 ...]
[2] 1658738 1658783 46 [4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 7 ...]
[3] 1658819 1658868 50 [3 3 3 3 3 3 4 4 5 5 5 5 5 5 5 5 5 5 5 6 ...]
[4] 1658984 1659042 59 [3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 ...]
[5] 1659044 1659099 56 [3 3 3 3 3 3 3 4 4 4 4 4 4 4 6 6 6 6 6 6 ...]
[6] 1659116 1659308 193 [3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 4 5 5 5 ...]
[7] 1659330 1659377 48 [3 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5 5 5 5 ...]
[8] 2240603 2240845 243 [ 4 4 4 4 4 4 7 7 7 7 7 7 7 ...]
[9] 2240847 2240906 60 [ 4 4 5 5 5 5 9 9 11 11 11 12 12 ...]
... ... ... ... ...
[2147] 110693912 110693978 67 [3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 ...]
[2148] 110694171 110694215 45 [4 4 4 5 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 ...]
[2149] 110694440 110694488 49 [4 4 5 5 5 5 5 6 6 5 5 5 5 5 5 5 5 5 5 5 ...]
[2150] 110694497 110694566 70 [3 3 3 3 3 3 3 4 4 4 5 5 5 5 5 5 5 5 5 4 ...]
[2151] 110694615 110694670 56 [3 3 3 4 4 4 4 4 4 4 4 4 4 5 6 7 7 7 7 7 ...]
[2152] 110694675 110694793 119 [3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 ...]
[2153] 112071553 112071610 58 [ 3 3 3 3 3 3 3 3 3 4 5 8 9 ...]
[2154] 112080357 112080432 76 [ 4 4 4 6 6 6 6 6 6 6 6 6 6 ...]
[2155] 112146168 112146211 44 [3 3 4 4 4 4 4 4 4 5 6 6 6 6 6 6 6 6 6 6 ...]
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] rtracklayer_1.22.0 GenomicFeatures_1.14.0 AnnotationDbi_1.24.0
[4] Biobase_2.22.0 Rsamtools_1.14.1 Biostrings_2.30.0
[7] GenomicRanges_1.14.1 XVector_0.2.0 IRanges_1.20.0
[10] BiocGenerics_0.8.0
loaded via a namespace (and not attached):
[1] biomaRt_2.18.0 bitops_1.0-6 BSgenome_1.30.0 DBI_0.2-7
[5] RCurl_1.95-4.1 RSQLite_0.11.4 stats4_3.0.2 tools_3.0.2
[9] XML_3.98-1.1 zlibbioc_1.8.0
Could you please try the small example code I posted too? This can serve as a reproducible example when submitting a bug report.