Gviz issue: crashing when AnnotationTrack( ... , just.group="above")
3
0
Entering edit mode
@philip-lijnzaad-2499
Last seen 2.3 years ago
European Union

(Is there a bug tracker for bioconductor packages? I couldn't find one. I sent this post to the maintainer as well).

There is an insiduous bug in Gviz that probably has to do with getting the geometry wrong if group labels are used in densely populated plots. I managed to isolate the bug, you can reproduce it as follows:


library(Gviz)

pdf(file="crash.pdf", width=12, height=3)
tfbs <- GRanges(ranges=IRanges(start=c(100,300,200,400), width=10),
                seqnames='chrX',strand='*', ID=LETTERS[c(1,1,2,2)])
tfbs <- AnnotationTrack(range=tfbs,group=mcols(tfbs)$ID,groupAnnotation="group",                         shape='box',just.group='above')
plotTracks(trackList=list(GenomeAxisTrack(), tfbs), sizes=c(15, 1))

This example on transcription factor binding sites is of course very contrived, but it happens very often if I use viewports to display many promoters on one page using the trick described in the Vignette (chapter 6, Composite plots for multiple chromosomes). The problem seems to be the placement of the group labels above or below the boxes, because specifying just.group="left" (or right) makes the problem disappear. Usually, if Gviz can't fit things into the space you give it, you get the "Too many stacks to draw. Either increase the device size or limit the drawing to a smaller region."-error, which is of course exactly what is needed.  Instead, I get the following (I include the stack trace):

> options(error=browser)
> plotTracks(trackList=list(GenomeAxisTrack(), tfbs), sizes=c(15, 1))
Error in normalizeDoubleBracketSubscript(i, x, exact = exact, error.if.nomatch = FALSE) :
  subscript is out of bounds
Called from: stop("subscript is out of bounds")
Browse[1]> where
where 1: stop("subscript is out of bounds")
where 2: normalizeDoubleBracketSubscript(i, x, exact = exact, error.if.nomatch = FALSE)
where 3: getListElement(x, i, ...)
where 4: getListElement(x, i, ...)
where 5: levels[[cur.level]]
where 6: levels[[cur.level]]
where 7: resize(levels[[cur.level]], width = width(levels[[cur.level]]) -
    1)
where 8: setdiff(IRanges(start = b$x1, end = b$x2), resize(levels[[cur.level]],
    width = width(levels[[cur.level]]) - 1))
where 9: .arrowBar(bar$sx1, bar$sx2, y = bar$y, bar$strand, box[, 1:4,
    drop = FALSE], col = if (is.null(col.line)) bar$col else rep(col.line,
    length(bar$col)), lwd = lwd, lty = lty, alpha = alpha, barOnly = (!"smallArrow" %in%
    .dpOrDefault(GdObject, "shape", "box") || stacking(GdObject) ==
    "dense"), diff = res, min.height = .dpOrDefault(GdObject,
    "min.height", 3))
where 10: .local(GdObject, ...)
where 11: drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"],
    subset = FALSE)
where 12: drawGD(expandedTrackList[[i]], minBase = ranges["from"], maxBase = ranges["to"],
    subset = FALSE)
where 13: plotTracks(trackList = list(GenomeAxisTrack(), tfbs), sizes = c(15,
    1))

The sessionInfo() is:

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

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

other attached packages:
[1] Gviz_1.17.3          GenomicRanges_1.24.2 GenomeInfoDb_1.8.1  
[4] IRanges_2.6.0        S4Vectors_0.10.1     BiocGenerics_0.18.0

loaded via a namespace (and not attached):
 [1] SummarizedExperiment_1.2.3    VariantAnnotation_1.18.1     
 [3] splines_3.3.0                 lattice_0.20-33              
 [5] colorspace_1.2-6              htmltools_0.3.5              
 [7] rtracklayer_1.32.1            GenomicFeatures_1.24.2       
 [9] chron_2.3-47                  interactiveDisplayBase_1.10.3
[11] survival_2.39-4               XML_3.98-1.4                 
[13] foreign_0.8-66                DBI_0.4-1                    
[15] ensembldb_1.4.6               BiocParallel_1.6.2           
[17] RColorBrewer_1.1-2            matrixStats_0.50.2           
[19] plyr_1.8.4                    zlibbioc_1.18.0              
[21] Biostrings_2.40.2             munsell_0.4.3                
[23] gtable_0.2.0                  latticeExtra_0.6-28          
[25] Biobase_2.32.0                biomaRt_2.28.0               
[27] BiocInstaller_1.22.2          httpuv_1.3.3                 
[29] AnnotationDbi_1.34.3          Rcpp_0.12.5                  
[31] acepack_1.3-3.3               xtable_1.8-2                 
[33] BSgenome_1.40.1               scales_0.4.0                 
[35] Hmisc_3.17-4                  XVector_0.12.0               
[37] mime_0.4                      Rsamtools_1.24.0             
[39] gridExtra_2.2.1               AnnotationHub_2.4.2          
[41] ggplot2_2.1.0                 digest_0.6.9                 
[43] biovizBase_1.20.0             shiny_0.13.2                 
[45] tools_3.3.0                   bitops_1.0-6                 
[47] RCurl_1.95-4.8                RSQLite_1.0.0                
[49] dichromat_2.0-0               Formula_1.2-1                
[51] cluster_2.0.4                 Matrix_1.2-6                 
[53] data.table_1.9.6              httr_1.2.0                   
[55] R6_2.1.2                      rpart_4.1-10                 
[57] GenomicAlignments_1.8.3       nnet_7.3-12                  

BTW, the same occurs with the stable version.

software error bug crash Gviz • 4.5k views
ADD COMMENT
1
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.2 years ago
Switzerland

fixed in devel 1.17.4 and release 1.16.3

ADD COMMENT
0
Entering edit mode
Brian Smith ▴ 120
@brian-smith-6197
Last seen 4.2 years ago
United States

Hi Florian,

I am getting the same error. The bioconductor website still appears to have Gviz 1.16.1 (https://bioconductor.org/packages/release/bioc/html/Gviz.html). How can I get release 1.16.3?

My error is: 

Error in .local(GdObject, ...) : 
  Too many stacks to draw. Either increase the device size or limit the drawing to a smaller region.

 

my sessionInfo():

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.4 (El Capitan)

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] grid      splines   stats4    parallel  stats     graphics  grDevices utils     datasets 
[10] methods   base     

other attached packages:
 [1] BiocInstaller_1.22.3                    Gviz_1.16.1                            
 [3] TxDb.Hsapiens.UCSC.hg38.knownGene_3.1.3 GenomicFeatures_1.24.5                 
 [5] AnnotationDbi_1.34.4                    hash_2.2.6                             
 [7] DSS_2.12.0                              bsseq_1.8.2                            
 [9] limma_3.28.17                           SummarizedExperiment_1.2.3             
[11] Biobase_2.32.0                          GenomicRanges_1.24.2                   
[13] GenomeInfoDb_1.8.3                      IRanges_2.6.1                          
[15] S4Vectors_0.10.2                        BiocGenerics_0.18.0                    

loaded via a namespace (and not attached):
       
[43] xtable_1.8-2                  gtable_0.2.0                  DBI_0.4-1                    
[46] scales_0.4.0                  XVector_0.12.1                latticeExtra_0.6-28          
[49] Formula_1.2-1                 RColorBrewer_1.1-2            ensembldb_1.4.7              
[52] tools_3.3.1                   dichromat_2.0-0               BSgenome_1.40.1              
[55] survival_2.39-5               colorspace_1.2-6              cluster_2.0.4                
[58] VariantAnnotation_1.18.6 

ADD COMMENT
0
Entering edit mode

But this is not the same error?!?

Solution for this is in the error message: increase the device size! You are most likely trying to cram to much stuff on too little vertical space.

Florian

ADD REPLY
0
Entering edit mode

I do have 7 tracks - is that too many? It works fine if I leave off the knownGenes track.

I get the same error even if I increase the pdf size:

pdf(file='test_plot.pdf',onefile=T,width=14,length=14)

The gene track is for the region chr20:58887626-58892145

 

 

ADD REPLY
0
Entering edit mode

d'oh! My mistake! 

ADD REPLY
0
Entering edit mode
@florianhahnenovartiscom-3784
Last seen 6.2 years ago
Switzerland

You could try and play around with the size parameters of the tracks. They govern how much vertical space is used for each of them. The defaults are chosen to make sense in the majority of cases, but if you have a lot of individual tracks it could make sense to adjust. The default for the GeneRegionTrack is 1, but if you set this to 2 it will occupy twice the vertical space and that should get rid of the error. 

Florian

ADD COMMENT

Login before adding your answer.

Traffic: 829 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