Bioconductor / GenomicRanges

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

Printing error with CompressedGRangesList #75

Closed llrs closed 1 year ago

llrs commented 1 year ago

Hi, I found a problem when printing a CompressedGRangesList after combining genes and promoters from a TxDB, here is a reprex with the latest release of Bioconductor:

suppressPackageStartupMessages(library("TxDb.Hsapiens.UCSC.hg19.knownGene"))
genes <- genes(TxDb.Hsapiens.UCSC.hg19.knownGene, column = "gene_id",
               single.strand.genes.only=FALSE)
genes <- sort(genes)
promoters <- promoters(TxDb.Hsapiens.UCSC.hg19.knownGene, column = "gene_id")
promoters <- sort(promoters)
gp <- c(genes, promoters)
gp
#> GRangesList object of length 106419:
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'object' in selecting a method for function 'show': error in evaluating the argument 'x' in selecting a method for function 'as.list': subscript is a NSBS object that is incompatible with the current
#>   subsetting operation

Created on 2023-01-13 with reprex v2.0.2 I also posted it to the support site, many thanks for these great packages!

hpages commented 1 year ago

Thanks @llrs for the report and sorry for the slow response.

Here is a more minimalistic way to reproduce (using BioC 3.16):

library(S4Vectors)
library(IRanges)

DF1 <- DataFrame(aa=letters[1:3])
DF2 <- DataFrame(aa=as(LETTERS[1:4], "CharacterList"))
DF12 <- rbind(DF1, DF2)
DF12
# DataFrame with 7 rows and 1 column
#          aa
#      <list>
# 1         a
# 2         b
# 3         c
# 4 A,B,C,...

Wrong, but not an error!

rownames(DF1) <- letters[1:3]
rownames(DF2) <- LETTERS[1:4]
DF12b <- rbind(DF1, DF2)
DF12b
# DataFrame with 7 rows and 1 column
# Error in dimnames(x) <- dn : 
#   length of 'dimnames' [1] not equal to array extent

Now an error.

Working on this...

sessionInfo():

R version 4.2.0 Patched (2022-05-04 r82318)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

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

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB              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] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] IRanges_2.32.0      S4Vectors_0.36.1    BiocGenerics_0.44.0

loaded via a namespace (and not attached):
[1] compiler_4.2.0
hpages commented 1 year ago

Should be fixed in S4Vectors 0.36.2 (release) and 0.37.4 (devel).

llrs commented 1 year ago

Many thanks!