[Bioc-devel] rtracklayer::import.bw error situation when there's repeated input ranges in the "selection", leads to S4Vectors

Leonardo Collado Torres |co||@dotor @end|ng |rom gm@||@com
Wed Aug 21 20:47:15 CEST 2019


Dear Bioc-devel,

In BioC 3.9 and 3.10 I've noticed some errors on recount which today I
finally traced. It looks like the internals of
rtracklayer::import.bw() changed (or mabye S4Vectors:::normarg_names)
in such a way that if you specify as input to rtracklayer::import()
the "selection" argument with a named GRanges object that has repeated
ranges, the function call fails. This can be avoided from a user's
perspective by using GenomicRanges::reduce() on the input to
"selection", which I guess is ultimately the best option. I now use
GenomicRanges::reduce() on derfinder version 1.18.4 (BioC 3.9) and
1.19.4 (BioC 3.10) to solve this issue for recount. But well, I
thought that it would be best to share this with all of you.

Best,
Leo

Here's the actual R code for reproducing this situation:



sampleFile <- c(
    'SRR387777' = 'http://duffel.rail.bio/recount/SRP009615/bw/SRR387777.bw'
)
regs <- GenomicRanges::GRanges(
    'chrY',
    IRanges::IRanges(start = c(1, 1), width = 10),
    strand = '-'
)
names(regs) <- c(1:2)
result <- rtracklayer::import(sampleFile,
    selection = regs,
    as = 'RleList'
)
# Error in S4Vectors:::normarg_names(value, class(x), length(x)) :
#   attempt to set too many names (2) on IRanges object of length 1

# 12: stop(wmsg("attempt to set too many names (", names_len, ") ",
#         "on ", x_class, " object of length ", x_len))
# 11: S4Vectors:::normarg_names(value, class(x), length(x))
# 10: `names<-`(`*tmp*`, value = nm)
# 9: `names<-`(`*tmp*`, value = nm)
# 8: setNames(ranges(x), value)
# 7: `names<-`(`*tmp*`, value = names(flatWhich))
# 6: `names<-`(`*tmp*`, value = names(flatWhich))
# 5: .local(con, format, text, ...)
# 4: import(FileForFormat(con), ...)
# 3: import(FileForFormat(con), ...)
# 2: rtracklayer::import(sampleFile, selection = regs, as = "RleList")
# 1: rtracklayer::import(sampleFile, selection = regs, as = "RleList")

result <- rtracklayer::import(sampleFile,
    selection = GenomicRanges::reduce(regs),
    as = 'RleList'
)

library('sessioninfo')
options(width = 120)
session_info()

# ─ Session info
───────────────────────────────────────────────────────────────────────────────────────────────────────
#  setting  value
#  version  R version 3.6.1 (2019-07-05)
#  os       macOS Mojave 10.14.6
#  system   x86_64, darwin15.6.0
#  ui       X11
#  language (EN)
#  collate  en_US.UTF-8
#  ctype    en_US.UTF-8
#  tz       America/New_York
#  date     2019-08-21
#
# ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
#  package              * version   date       lib source
#  assertthat             0.2.1     2019-03-21 [1] CRAN (R 3.6.0)
#  backports              1.1.4     2019-04-10 [1] CRAN (R 3.6.0)
#  Biobase                2.45.0    2019-05-02 [1] Bioconductor
#  BiocGenerics           0.31.5    2019-07-03 [1] Bioconductor
#  BiocParallel           1.19.2    2019-08-07 [1] Bioconductor
#  Biostrings             2.53.2    2019-07-09 [1] Bioconductor
#  bitops                 1.0-6     2013-08-17 [1] CRAN (R 3.6.0)
#  callr                  3.3.1     2019-07-18 [1] CRAN (R 3.6.0)
#  cli                    1.1.0     2019-03-19 [1] CRAN (R 3.6.0)
#  colorout             * 1.2-1     2019-07-27 [1] Github
(jalvesaq/colorout using 7ea9440)
#  crayon                 1.3.4     2017-09-16 [1] CRAN (R 3.6.0)
#  DelayedArray           0.11.4    2019-07-03 [1] Bioconductor
#  desc                   1.2.0     2018-05-01 [1] CRAN (R 3.6.0)
#  devtools             * 2.1.0     2019-07-06 [1] CRAN (R 3.6.0)
#  digest                 0.6.20    2019-07-04 [1] CRAN (R 3.6.0)
#  fs                     1.3.1     2019-05-06 [1] CRAN (R 3.6.0)
#  GenomeInfoDb           1.21.1    2019-05-16 [1] Bioconductor
#  GenomeInfoDbData       1.2.1     2019-07-27 [1] Bioconductor
#  GenomicAlignments      1.21.4    2019-06-28 [1] Bioconductor
#  GenomicRanges          1.37.14   2019-06-24 [1] Bioconductor
#  glue                   1.3.1     2019-03-12 [1] CRAN (R 3.6.0)
#  IRanges                2.19.10   2019-06-11 [1] Bioconductor
#  lattice                0.20-38   2018-11-04 [1] CRAN (R 3.6.1)
#  magrittr               1.5       2014-11-22 [1] CRAN (R 3.6.0)
#  Matrix                 1.2-17    2019-03-22 [1] CRAN (R 3.6.1)
#  matrixStats            0.54.0    2018-07-23 [1] CRAN (R 3.6.0)
#  memoise                1.1.0     2017-04-21 [1] CRAN (R 3.6.0)
#  pkgbuild               1.0.4     2019-08-05 [1] CRAN (R 3.6.0)
#  pkgload                1.0.2     2018-10-29 [1] CRAN (R 3.6.0)
#  prettyunits            1.0.2     2015-07-13 [1] CRAN (R 3.6.0)
#  processx               3.4.1     2019-07-18 [1] CRAN (R 3.6.0)
#  ps                     1.3.0     2018-12-21 [1] CRAN (R 3.6.0)
#  R6                     2.4.0     2019-02-14 [1] CRAN (R 3.6.0)
#  Rcpp                   1.0.2     2019-07-25 [1] CRAN (R 3.6.0)
#  RCurl                  1.95-4.12 2019-03-04 [1] CRAN (R 3.6.0)
#  remotes                2.1.0     2019-06-24 [1] CRAN (R 3.6.0)
#  rlang                  0.4.0     2019-06-25 [1] CRAN (R 3.6.0)
#  rprojroot              1.3-2     2018-01-03 [1] CRAN (R 3.6.0)
#  Rsamtools              2.1.3     2019-07-05 [1] Bioconductor
#  rtracklayer            1.45.3    2019-08-16 [1] Bioconductor
#  S4Vectors              0.23.18   2019-08-16 [1] Bioconductor
#  sessioninfo          * 1.1.1     2018-11-05 [1] CRAN (R 3.6.0)
#  SummarizedExperiment   1.15.6    2019-07-31 [1] Bioconductor
#  testthat             * 2.2.1     2019-07-25 [1] CRAN (R 3.6.0)
#  usethis              * 1.5.1     2019-07-04 [1] CRAN (R 3.6.0)
#  withr                  2.1.2     2018-03-15 [1] CRAN (R 3.6.0)
#  XML                    3.98-1.20 2019-06-06 [1] CRAN (R 3.6.0)
#  XVector                0.25.0    2019-05-02 [1] Bioconductor
#  zlibbioc               1.31.0    2019-05-02 [1] Bioconductor
#
# [1] /Library/Frameworks/R.framework/Versions/3.6devel/Resources/library



More information about the Bioc-devel mailing list