Strange error in bsseq when trying to assign seqinfo
1
1
Entering edit mode
rcavalca ▴ 140
@rcavalca-7718
Last seen 5.8 years ago
United States

 

Hello,

I'm having a strange issue in R 3.5.0 / Bioc 3.7 when trying to assign seqinfo to a bsseq object that I don't have in R 3.4.3 / Bioc 3.6. The particular error I get can be reproduced with the following code:

# Do not load any libraries
seqinfo_hg19 = GenomeInfoDb::Seqinfo(genome = 'hg19')

M <- matrix(0:8, 3, 3)
Cov <- matrix(1:9, 3, 3)
bs <- bsseq::BSseq(chr = c("chr1", "chr2", "chr1"), pos = c(1,2,3),
                    M = M, Cov = Cov, sampleNames = c("A","B","C"))

GenomeInfoDb::seqinfo(bs) = seqinfo_hg19[GenomeInfoDb::seqlevelsInUse(bs)]

And the last line produces the error:

Error in methods::slot(object, name) : 
  no slot of name "call" for this object of class "GRanges"

I have boiled it down to the following toy examples, tested on R 3.5.0 / Bioc 3.7 with the Bioc docker images, and R 3.4.z / Bioc 3.6 locally / on some servers at work (session infos at the end). The 1B and 2B blocks below are closer to the style in which I'm actually calling these functions from within a package that imports GenomicRanges, GenomeInfoDb, and bsseq, among other packages.

# Run each in different R sessions

################################################################################
# BLOCK 1A
# WORKS in R 3.4.z / Bioc 3.6 and WORKS in R 3.5.0 / Bioc 3.7

library(GenomicRanges)

seqinfo_hg19 = Seqinfo(genome = 'hg19')

gr <- GRanges(Rle(c("chr2", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)), 
    IRanges(1:10, width=10:1))

seqlevelsInUse(gr)

seqinfo(gr) = seqinfo_hg19[seqlevelsInUse(gr)]


################################################################################
# BLOCK 1B
# WORKS in R 3.4.z / Bioc 3.6 and WORKS in R 3.5.0 / Bioc 3.7

seqinfo_hg19 = GenomeInfoDb::Seqinfo(genome = 'hg19')

gr <- GenomicRanges::GRanges(S4Vectors::Rle(c("chr2", "chr2", "chr1", "chr3"), c(1, 3, 2, 4)), 
    IRanges::IRanges(1:10, width=10:1))

GenomeInfoDb::seqlevelsInUse(gr)

GenomeInfoDb::seqinfo(gr) = seqinfo_hg19[GenomeInfoDb::seqlevelsInUse(gr)]


################################################################################
# BLOCK 2A
# WORKS in R 3.4.z / Bioc 3.6 and WORKS in R 3.5.0 / Bioc 3.7

library(bsseq)

seqinfo_hg19 = Seqinfo(genome = 'hg19')

M <- matrix(0:8, 3, 3)
Cov <- matrix(1:9, 3, 3)
bs <- BSseq(chr = c("chr1", "chr2", "chr1"), pos = c(1,2,3),
                    M = M, Cov = Cov, sampleNames = c("A","B","C"))

seqinfo(bs) = seqinfo_hg19[seqlevelsInUse(bs)]


################################################################################
# BLOCK 2B
# WORKS in R 3.4.z / Bioc 3.6 and FAILS in R 3.5.0 / Bioc 3.7

seqinfo_hg19 = GenomeInfoDb::Seqinfo(genome = 'hg19')

M <- matrix(0:8, 3, 3)
Cov <- matrix(1:9, 3, 3)
bs <- bsseq::BSseq(chr = c("chr1", "chr2", "chr1"), pos = c(1,2,3),
                    M = M, Cov = Cov, sampleNames = c("A","B","C"))

GenomeInfoDb::seqinfo(bs) = seqinfo_hg19[GenomeInfoDb::seqlevelsInUse(bs)]

The fact that blocks 1A and 1B don't fail indicates that the issue is in bsseq, and not GenomicRanges. Also, calling library(bsseq) appears to change the NAMESPACE in such a way that the error isn't produced in R 3.5.0 / Bioc 3.7. Since the code being executed is within a package, the best I can do is import the package, and not use library(bsseq).

Any insight into what might be causing this would greatly be appreciated. I'm rather stumped.

Below is the session info for R 3.4.3 / Bioc 3.6:

Session info ------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.3 (2017-11-30)
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       <NA>                        
 date     2018-05-14                  

Packages ----------------------------------------------------------------------
 package              * version   date       source        
 base                 * 3.4.3     2018-02-25 local         
 Biobase                2.38.0    2018-04-11 Bioconductor  
 BiocGenerics           0.24.0    2018-04-11 Bioconductor  
 bitops                 1.0-6     2013-08-17 CRAN (R 3.4.3)
 bsseq                  1.14.0    2018-04-11 Bioconductor  
 colorspace             1.3-2     2016-12-14 CRAN (R 3.4.3)
 compiler               3.4.3     2018-02-25 local         
 data.table             1.10.4-3  2017-10-27 CRAN (R 3.4.3)
 datasets             * 3.4.3     2018-02-25 local         
 DelayedArray           0.4.1     2018-04-11 Bioconductor  
 devtools               1.13.5    2018-02-18 CRAN (R 3.4.3)
 digest                 0.6.15    2018-01-28 CRAN (R 3.4.3)
 GenomeInfoDb           1.14.1    2018-04-11 Bioconductor  
 GenomeInfoDbData       1.0.0     2018-04-11 Bioconductor  
 GenomicRanges          1.30.3    2018-04-11 Bioconductor  
 graphics             * 3.4.3     2018-02-25 local         
 grDevices            * 3.4.3     2018-02-25 local         
 grid                   3.4.3     2018-02-25 local         
 gtools                 3.5.0     2015-05-29 CRAN (R 3.4.3)
 IRanges                2.12.0    2018-04-11 Bioconductor  
 lattice                0.20-35   2017-03-25 CRAN (R 3.4.3)
 limma                  3.34.9    2018-04-11 Bioconductor  
 locfit                 1.5-9.1   2013-04-20 CRAN (R 3.4.3)
 Matrix                 1.2-14    2018-04-09 CRAN (R 3.4.3)
 matrixStats            0.53.1    2018-02-11 CRAN (R 3.4.3)
 memoise                1.1.0     2017-04-21 CRAN (R 3.4.3)
 methods              * 3.4.3     2018-02-25 local         
 munsell                0.4.3     2016-02-13 CRAN (R 3.4.3)
 packrat                0.4.9-1   2018-03-12 CRAN (R 3.4.3)
 parallel               3.4.3     2018-02-25 local         
 permute                0.9-4     2016-09-09 CRAN (R 3.4.3)
 plyr                   1.8.4     2016-06-08 CRAN (R 3.4.3)
 R.methodsS3            1.7.1     2016-02-16 CRAN (R 3.4.3)
 R.oo                   1.21.0    2016-11-01 CRAN (R 3.4.3)
 R.utils                2.6.0     2017-11-05 CRAN (R 3.4.3)
 Rcpp                   0.12.16   2018-03-13 CRAN (R 3.4.3)
 RCurl                  1.95-4.10 2018-01-04 CRAN (R 3.4.3)
 S4Vectors              0.16.0    2018-04-11 Bioconductor  
 scales                 0.5.0     2017-08-24 CRAN (R 3.4.3)
 stats                * 3.4.3     2018-02-25 local         
 stats4                 3.4.3     2018-02-25 local         
 SummarizedExperiment   1.8.1     2018-04-11 Bioconductor  
 tools                  3.4.3     2018-02-25 local         
 utils                * 3.4.3     2018-02-25 local         
 withr                  2.1.2     2018-03-15 CRAN (R 3.4.3)
 XVector                0.18.0    2018-04-11 Bioconductor  
 zlibbioc               1.24.0    2018-04-11 Bioconductor

And below is for R 3.5.0 / Bioc 3.7:

Session info ------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       Etc/UTC                     
 date     2018-05-14                  

Packages ----------------------------------------------------------------------
 package              * version   date       source        
 base                 * 3.5.0     2018-05-01 local         
 Biobase                2.40.0    2018-05-08 Bioconductor  
 BiocGenerics           0.26.0    2018-05-08 Bioconductor  
 BiocInstaller        * 1.30.0    2018-05-08 Bioconductor  
 BiocParallel           1.14.1    2018-05-08 Bioconductor  
 bitops                 1.0-6     2013-08-17 CRAN (R 3.5.0)
 bsseq                  1.16.0    2018-05-11 Bioconductor  
 colorspace             1.3-2     2016-12-14 CRAN (R 3.5.0)
 compiler               3.5.0     2018-05-01 local         
 data.table             1.11.2    2018-05-08 CRAN (R 3.5.0)
 datasets             * 3.5.0     2018-05-01 local         
 DelayedArray           0.6.0     2018-05-11 Bioconductor  
 DelayedMatrixStats     1.2.0     2018-05-11 Bioconductor  
 devtools               1.13.5    2018-02-18 CRAN (R 3.5.0)
 digest                 0.6.15    2018-01-28 CRAN (R 3.5.0)
 GenomeInfoDb           1.16.0    2018-05-08 Bioconductor  
 GenomeInfoDbData       1.1.0     2018-05-08 Bioconductor  
 GenomicRanges          1.32.2    2018-05-08 Bioconductor  
 graphics             * 3.5.0     2018-05-01 local         
 grDevices            * 3.5.0     2018-05-01 local         
 grid                   3.5.0     2018-05-01 local         
 gtools                 3.5.0     2015-05-29 CRAN (R 3.5.0)
 HDF5Array              1.8.0     2018-05-11 Bioconductor  
 IRanges                2.14.8    2018-05-14 Bioconductor  
 lattice                0.20-35   2017-03-25 CRAN (R 3.5.0)
 limma                  3.36.1    2018-05-11 Bioconductor  
 locfit                 1.5-9.1   2013-04-20 CRAN (R 3.5.0)
 Matrix                 1.2-14    2018-04-09 CRAN (R 3.5.0)
 matrixStats            0.53.1    2018-02-11 CRAN (R 3.5.0)
 memoise                1.1.0     2017-04-21 CRAN (R 3.5.0)
 methods              * 3.5.0     2018-05-01 local         
 munsell                0.4.3     2016-02-13 CRAN (R 3.5.0)
 parallel               3.5.0     2018-05-01 local         
 permute                0.9-4     2016-09-09 CRAN (R 3.5.0)
 plyr                   1.8.4     2016-06-08 CRAN (R 3.5.0)
 R.methodsS3            1.7.1     2016-02-16 CRAN (R 3.5.0)
 R.oo                   1.22.0    2018-04-22 CRAN (R 3.5.0)
 R.utils                2.6.0     2017-11-05 CRAN (R 3.5.0)
 Rcpp                   0.12.16   2018-03-13 CRAN (R 3.5.0)
 RCurl                  1.95-4.10 2018-01-04 CRAN (R 3.5.0)
 rhdf5                  2.24.0    2018-05-11 Bioconductor  
 Rhdf5lib               1.2.0     2018-05-11 Bioconductor  
 S4Vectors              0.18.1    2018-05-08 Bioconductor  
 scales                 0.5.0     2017-08-24 CRAN (R 3.5.0)
 stats                * 3.5.0     2018-05-01 local         
 stats4                 3.5.0     2018-05-01 local         
 SummarizedExperiment   1.10.1    2018-05-11 Bioconductor  
 tools                  3.5.0     2018-05-01 local         
 utils                * 3.5.0     2018-05-01 local         
 withr                  2.1.2     2018-03-15 CRAN (R 3.5.0)
 XVector                0.20.0    2018-05-08 Bioconductor  
 zlibbioc               1.26.0    2018-05-08 Bioconductor
bsseq genomeinfodb genomicranges seqinfo • 2.1k views
ADD COMMENT
1
Entering edit mode

Thanks for the detailed bug report, @rcavalca. I can confirm that running 2B in a clean session leads to the error. However, it's not an issue with bsseq but rather something else, perhaps in SummarizedExpeirment. On BioC 3.7:

seqinfo_hg19 = GenomeInfoDb::Seqinfo(genome = 'hg19')

se <- SummarizedExperiment::SummarizedExperiment(
  rowRanges = GenomicRanges::GRanges(c("chr1", "chr2", "chr1"), 
                                     IRanges::IRanges(1:3, width = 1)))

GenomeInfoDb::seqinfo(se) = seqinfo_hg19[GenomeInfoDb::seqlevelsInUse(se)]
#> Error in methods::slot(object, name): no slot of name "call" for this object of class "GRanges"

Created on 2018-05-14 by the reprex package (v0.2.0).

Hopefully Hervé Pagès can chime in. It's a little unusual to use these packages in a script without first calling library() but you mention you encountered this issue in a package. Are you able to link to it (a GitHub repo, for example)?

ADD REPLY
1
Entering edit mode

Posted this as a GitHub issue.

ADD REPLY
4
Entering edit mode
@herve-pages-1542
Last seen 7 hours ago
Seattle, WA, United States

Thanks for the report. This should be fixed in GenomicRanges 1.32.3 (BioC 3.7) and 1.33.3 (BioC devel). Both versions of GenomicRanges should become available via biocLite() in the next 48 hours.

Cheers,

H.

ADD COMMENT
0
Entering edit mode

Sounds good, thanks for the fix!

ADD REPLY
0
Entering edit mode

Ahh that is great thank you ! Good for special needs too ! krunker

ADD REPLY

Login before adding your answer.

Traffic: 440 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6