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

2019-08-24 Thread Michael Lawrence via Bioc-devel
Sorry about that. I bumped the version and ported to release.

On Thu, Aug 22, 2019 at 7:50 AM Leonardo Collado Torres
 wrote:
>
> Hi Michael,
>
> That was using rtracklayer 1.45.3. However I see at
> https://github.com/lawremi/rtracklayer/commit/90d4209eae05ae2a4af550072c35cada662b4c89
> that you made a recent change. If I use the GitHub version, it all
> works =)
>
> > result <- rtracklayer::import(sampleFile,
> + selection = regs,
> + as = 'RleList'
> + )
> > result2 <- rtracklayer::import(sampleFile,
> + selection = GenomicRanges::reduce(regs),
> + as = 'RleList'
> + )
> > identical(result, result2)
> [1] TRUE
>
> library('sessioninfo')
> options(width = 120)
> session_info()
>
> ## Same as yesterday except:
>  rtracklayer1.45.32019-08-22 [1] Github
> (lawremi/rtracklayer@2dac472)
>
> Best,
> Leo
>
> On Wed, Aug 21, 2019 at 3:33 PM Michael Lawrence
>  wrote:
> >
> > Sorry, please try 1.45.3. If that works then I'll push it over to release.
> >
> > On Wed, Aug 21, 2019 at 11:48 AM Leonardo Collado Torres
> >  wrote:
> > >
> > > 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(
> > > 'SRR38' = 
> > > 'http://duffel.rail.bio/recount/SRP009615/bw/SRR38.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
> > > #  ctypeen_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)
> > > #  Biobase2.45.02019-05-02 [1] Bioconductor
> > > #  BiocGenerics   0.31.52019-07-03 [1] Bioconductor
> > > #  BiocParallel   1.19.22019-08-07 [1] Bioconductor
> > > #  Biostrings 2.53.22019-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)
> > > #  cli1.1.0 2019-03-19 [1] CRAN (R 3.6.0)
> > > #  colorout * 1.2-1 2019-07-27 [1] Github
> > > (jalvesaq/colorout@7ea9440)
> > > #  crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
> > > #  DelayedArray   

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

2019-08-22 Thread Leonardo Collado Torres
Hi Michael,

That was using rtracklayer 1.45.3. However I see at
https://github.com/lawremi/rtracklayer/commit/90d4209eae05ae2a4af550072c35cada662b4c89
that you made a recent change. If I use the GitHub version, it all
works =)

> result <- rtracklayer::import(sampleFile,
+ selection = regs,
+ as = 'RleList'
+ )
> result2 <- rtracklayer::import(sampleFile,
+ selection = GenomicRanges::reduce(regs),
+ as = 'RleList'
+ )
> identical(result, result2)
[1] TRUE

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

## Same as yesterday except:
 rtracklayer1.45.32019-08-22 [1] Github
(lawremi/rtracklayer@2dac472)

Best,
Leo

On Wed, Aug 21, 2019 at 3:33 PM Michael Lawrence
 wrote:
>
> Sorry, please try 1.45.3. If that works then I'll push it over to release.
>
> On Wed, Aug 21, 2019 at 11:48 AM Leonardo Collado Torres
>  wrote:
> >
> > 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(
> > 'SRR38' = 'http://duffel.rail.bio/recount/SRP009615/bw/SRR38.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
> > #  ctypeen_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)
> > #  Biobase2.45.02019-05-02 [1] Bioconductor
> > #  BiocGenerics   0.31.52019-07-03 [1] Bioconductor
> > #  BiocParallel   1.19.22019-08-07 [1] Bioconductor
> > #  Biostrings 2.53.22019-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)
> > #  cli1.1.0 2019-03-19 [1] CRAN (R 3.6.0)
> > #  colorout * 1.2-1 2019-07-27 [1] Github
> > (jalvesaq/colorout@7ea9440)
> > #  crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
> > #  DelayedArray   0.11.42019-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.202019-07-04 [1] CRAN (R 3.6.0)
> > #  fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0)
> > #  GenomeInfoDb   1.21.12019-05-16 [1] 

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

2019-08-21 Thread Michael Lawrence via Bioc-devel
Sorry, please try 1.45.3. If that works then I'll push it over to release.

On Wed, Aug 21, 2019 at 11:48 AM Leonardo Collado Torres
 wrote:
>
> 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(
> 'SRR38' = 'http://duffel.rail.bio/recount/SRP009615/bw/SRR38.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
> #  ctypeen_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)
> #  Biobase2.45.02019-05-02 [1] Bioconductor
> #  BiocGenerics   0.31.52019-07-03 [1] Bioconductor
> #  BiocParallel   1.19.22019-08-07 [1] Bioconductor
> #  Biostrings 2.53.22019-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)
> #  cli1.1.0 2019-03-19 [1] CRAN (R 3.6.0)
> #  colorout * 1.2-1 2019-07-27 [1] Github
> (jalvesaq/colorout@7ea9440)
> #  crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
> #  DelayedArray   0.11.42019-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.202019-07-04 [1] CRAN (R 3.6.0)
> #  fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0)
> #  GenomeInfoDb   1.21.12019-05-16 [1] Bioconductor
> #  GenomeInfoDbData   1.2.1 2019-07-27 [1] Bioconductor
> #  GenomicAlignments  1.21.42019-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)
> #  IRanges2.19.10   2019-06-11 [1] Bioconductor
> #  lattice0.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-172019-03-22 [1] CRAN (R 3.6.1)
> #  matrixStats0.54.02018-07-23 [1] CRAN (R 3.6.0)
> #  memoise1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
> #  pkgbuild   1.0.4 2019-08-05 [1] CRAN (R 3.6.0)
> #  pkgload1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
> #  prettyunits1.0.2 2015-07-13 [1] CRAN (R 3.6.0)
> #  processx   3.4.1 

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

2019-08-21 Thread Leonardo Collado Torres
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(
'SRR38' = 'http://duffel.rail.bio/recount/SRP009615/bw/SRR38.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
#  ctypeen_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)
#  Biobase2.45.02019-05-02 [1] Bioconductor
#  BiocGenerics   0.31.52019-07-03 [1] Bioconductor
#  BiocParallel   1.19.22019-08-07 [1] Bioconductor
#  Biostrings 2.53.22019-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)
#  cli1.1.0 2019-03-19 [1] CRAN (R 3.6.0)
#  colorout * 1.2-1 2019-07-27 [1] Github
(jalvesaq/colorout@7ea9440)
#  crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.0)
#  DelayedArray   0.11.42019-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.202019-07-04 [1] CRAN (R 3.6.0)
#  fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0)
#  GenomeInfoDb   1.21.12019-05-16 [1] Bioconductor
#  GenomeInfoDbData   1.2.1 2019-07-27 [1] Bioconductor
#  GenomicAlignments  1.21.42019-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)
#  IRanges2.19.10   2019-06-11 [1] Bioconductor
#  lattice0.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-172019-03-22 [1] CRAN (R 3.6.1)
#  matrixStats0.54.02018-07-23 [1] CRAN (R 3.6.0)
#  memoise1.1.0 2017-04-21 [1] CRAN (R 3.6.0)
#  pkgbuild   1.0.4 2019-08-05 [1] CRAN (R 3.6.0)
#  pkgload1.0.2 2018-10-29 [1] CRAN (R 3.6.0)
#  prettyunits1.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)
#  remotes2.1.0 2019-06-24 [1] CRAN (R