I encountered a problem regard to coordinate transformation when using tracks
function in ggbio
package. An example is here:
# Create a GRanges and plot it normally
library(ggbio) gr = GRanges('chr2', IRanges(start = 50, end = 100)) p = ggplot(gr) + geom_rect() p
# However, when it is wrapped into tracks, the coordinate are not matched with the rectangular.
tracks(p)
# Using GRanges as xlim will fix this, however, using IRanges or numeric will make the coordinate even weird.
tracks(p, xlim = c(1,100))
tracks(p, xlim = IRanges(start = 1, end = 100))
# Also, the +
method for adding xlim
seems not working correctly.
tracks(p) + xlim(gr)
As the ggbio manual stated:
|
limits on x. could be |
I would like to know,
1. Could anyone reproduce these problems?
2. Is this a known bug or something?
Session Info:
R version 3.3.1 (2016-06-21) Platform: i686-pc-linux-gnu (32-bit) Running under: Ubuntu 16.04.1 LTS 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] stats4 parallel stats graphics grDevices utils [7] datasets methods base other attached packages: [1] ggbio_1.20.2 ggplot2_2.1.0 GenomicRanges_1.24.2 [4] GenomeInfoDb_1.8.3 IRanges_2.6.1 S4Vectors_0.10.2 [7] BiocGenerics_0.18.0 loaded via a namespace (and not attached): [1] Rcpp_0.12.6 Formula_1.2-1 [3] AnnotationHub_2.4.2 XVector_0.12.1 [5] magrittr_1.5 cluster_2.0.4 [7] GenomicAlignments_1.8.4 splines_3.3.1 [9] zlibbioc_1.18.0 xtable_1.8-2 [11] colorspace_1.2-6 biovizBase_1.20.0 [13] lattice_0.20-33 BSgenome_1.40.1 [15] R6_2.1.3 latticeExtra_0.6-28 [17] htmltools_0.3.5 digest_0.6.10 [19] interactiveDisplayBase_1.10.3 Matrix_1.2-6 [21] shiny_0.13.2 acepack_1.3-3.3 [23] RCurl_1.95-4.8 BiocInstaller_1.22.3 [25] scales_0.4.0 Hmisc_3.17-4 [27] Biostrings_2.40.2 Rsamtools_1.24.0 [29] GenomicFeatures_1.24.5 reshape_0.8.5 [31] httpuv_1.3.3 graph_1.50.0 [33] AnnotationDbi_1.34.4 OrganismDbi_1.14.1 [35] GGally_1.2.0 munsell_0.4.3 [37] BiocParallel_1.6.3 httr_1.2.1 [39] plyr_1.8.4 stringr_1.1.0 [41] ensembldb_1.4.7 tools_3.3.1 [43] grid_3.3.1 nnet_7.3-12 [45] dichromat_2.0-0 SummarizedExperiment_1.2.3 [47] Biobase_2.32.0 data.table_1.9.6 [49] gtable_0.2.0 DBI_0.5 [51] RBGL_1.48.1 survival_2.39-5 [53] gridExtra_2.2.1 rtracklayer_1.32.2 [55] reshape2_1.4.1 RColorBrewer_1.1-2 [57] bitops_1.0-6 biomaRt_2.28.0 [59] rpart_4.1-10 RSQLite_1.0.0 [61] mime_0.5 labeling_0.3 [63] stringi_1.1.1 XML_3.98-1.4 [65] VariantAnnotation_1.18.6 foreign_0.8-66 [67] chron_2.3-47
Thanks in advance !