Bioconductor / GenomicRanges

Representation and manipulation of genomic intervals
https://bioconductor.org/packages/GenomicRanges
41 stars 17 forks source link

Can't create GRanges Object with more than 11 peaks #48

Closed eonurk closed 3 years ago

eonurk commented 3 years ago

I updated my GenomicRanges to 1.40.0 and I can't create objects bigger than 11 peaks now. There was no such problem with 1.38.0.

suppressWarnings(suppressPackageStartupMessages(library(GenomicRanges)))
bed <- structure(list(Chr = c("chr5", "chr17", "chr8", "chr4", "chr1", 
                              "chr3", "chr12", "chr12", "chr3", "chr9", "chr7", "chr11"), Start = c("24841478", 
                                                                                                    "8162955", "40577584", "145277698", "180808752", "88732151", 
                                                                                                    "72461561", "69816610", "135579997", "83868473", "80131463", 
                                                                                                    "106556431"), End = c("24845196", "8164380", "40578029", "145278483", 
                                                                                                                          "180815472", "88732652", "72462310", "69818185", "135580952", 
                                                                                                                          "83868703", "80131945", "106557146")), row.names = c(NA, 12L), class = "data.frame")
colnames(bed) <- c("Chr", "Start", "End")

GRanges(head(bed, n = 11))
#> GRanges object with 11 ranges and 0 metadata columns:
#>        seqnames              ranges strand
#>           <Rle>           <IRanges>  <Rle>
#>    [1]     chr5   24841478-24845196      *
#>    [2]    chr17     8162955-8164380      *
#>    [3]     chr8   40577584-40578029      *
#>    [4]     chr4 145277698-145278483      *
#>    [5]     chr1 180808752-180815472      *
#>    [6]     chr3   88732151-88732652      *
#>    [7]    chr12   72461561-72462310      *
#>    [8]    chr12   69816610-69818185      *
#>    [9]     chr3 135579997-135580952      *
#>   [10]     chr9   83868473-83868703      *
#>   [11]     chr7   80131463-80131945      *
#>   -------
#>   seqinfo: 9 sequences from an unspecified genome; no seqlengths
GRanges(head(bed, n = 12))
#> GRanges object with 12 ranges and 0 metadata columns:
#> Error in dimnames(x) <- dn: length of 'dimnames' [1] not equal to array extent

Created on 2020-12-30 by the reprex package (v0.3.0)

Any help would be appreciated, Onur

sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Mojave 10.14.6
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#> 
#> 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     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_4.0.2  magrittr_2.0.1  tools_4.0.2     htmltools_0.5.0
#>  [5] yaml_2.2.1      stringi_1.5.3   rmarkdown_2.6   highr_0.8      
#>  [9] knitr_1.30      stringr_1.4.0   xfun_0.19       digest_0.6.27  
#> [13] rlang_0.4.10    evaluate_0.14

Created on 2020-12-30 by the reprex package (v0.3.0)

hpages commented 3 years ago

Hi,

I don't see GenomicRanges or any of its dependencies (e.g. IRanges or GenomeInfoDb) in the output of your call to sessionInfo(). Of course you need to run sessionInfo() in the session where you're having the issue, and typically right after the error occurred, otherwise it's kind of pointless.

Everything works fine for me:

GRanges(head(bed, n = 12))
# GRanges object with 12 ranges and 0 metadata columns:
#        seqnames              ranges strand
#           <Rle>           <IRanges>  <Rle>
#    [1]     chr5   24841478-24845196      *
#    [2]    chr17     8162955-8164380      *
#    [3]     chr8   40577584-40578029      *
#    [4]     chr4 145277698-145278483      *
#    [5]     chr1 180808752-180815472      *
#    ...      ...                 ...    ...
#    [8]    chr12   69816610-69818185      *
#    [9]     chr3 135579997-135580952      *
#   [10]     chr9   83868473-83868703      *
#   [11]     chr7   80131463-80131945      *
#   [12]    chr11 106556431-106557146      *
#   -------
#   seqinfo: 10 sequences from an unspecified genome; no seqlengths

Here is my sessionInfo():

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.10

Matrix products: default
BLAS:   /home/hpages/R/R-4.0.3/lib/libRblas.so
LAPACK: /home/hpages/R/R-4.0.3/lib/libRlapack.so

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  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
[1] GenomicRanges_1.42.0 GenomeInfoDb_1.26.2  IRanges_2.24.1      
[4] S4Vectors_0.28.1     BiocGenerics_0.36.0 

loaded via a namespace (and not attached):
[1] zlibbioc_1.36.0        compiler_4.0.3         tools_4.0.3           
[4] XVector_0.30.0         GenomeInfoDbData_1.2.4 RCurl_1.98-1.2        
[7] bitops_1.0-6          

Note that I'm running an up-to-date version of Bioconductor 3.12 (the current release). Any older release is unsupported. To make sure that my packages are up-to-date I just run BiocManager::install() (with no arguments). This will make sure to update all my packages to their very latest version. In the case of GenomicRanges, this is version 1.42.0, not version 1.40.0. Cherry picking a particular version of a particular package is usually a very bad idea as it's almost always guaranteed to lead to version mismatch problems. To avoid version mismatch problems, always use BiocManager::install() to install packages or update your installation.

Best, H.

eonurk commented 3 years ago

Oh, yeah sorry about that. Upgrading my BiocManager solved my problem, thank you so much!

Best, Onur