lawremi / ggbio

Grid and ggplot2 based visualization for biological data
111 stars 24 forks source link

autoplot fails to draw indel from VRanges object #96

Closed andronekomimi closed 6 years ago

andronekomimi commented 6 years ago

Hello,

I experience some difficulties with the plotting of VRanges objects. I can't draw the plot with geom = NULL or geom = "text". geom = "rect" works better but fails to display indel.

Here is a small example (sessionInfo at the end of the post) :

vr1 <- VRanges(seqnames = c("chr1", "chr1", "chr1"),
                           ranges = IRanges(c(1, 10, 30), c(1, 10, 30)),
                           ref = c("T", "A", "G"), alt = c("C", "T", "GA"), 
                           sampleNames = "YEAY")
autoplot(vr1)
#text geom is used
#Erreur : Insufficient values in manual scale. 5 needed but only 4 provided.
autoplot(vr1 , geom = "text")
#text geom is used
#Erreur : Insufficient values in manual scale. 5 needed but only 4 provided.
autoplot(vr1 , geom = "rect")

rplot

Regarding, the issue with indel, I found the origin in autoplot-method.R file : https://github.com/tengfei/ggbio/blob/24310c0aee39badda43b15deb6bf872c6d41295c/R/autoplot-method.R#L1337 https://github.com/tengfei/ggbio/blob/24310c0aee39badda43b15deb6bf872c6d41295c/R/autoplot-method.R#L1338

"indel" should be replaced by "Indel" to match the color mapping.

with this small correction, the indel is displayed : rplot01

Thank you very much ! Audrey

sessionInfo : R version 3.3.2 (2016-10-31) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: macOS 10.13.3

locale: [1] fr_CA.UTF-8/fr_CA.UTF-8/fr_CA.UTF-8/C/fr_CA.UTF-8/fr_CA.UTF-8

attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] BiocInstaller_1.24.0 biovizBase_1.22.0 VariantAnnotation_1.20.3 Rsamtools_1.26.2
[5] Biostrings_2.42.1 XVector_0.14.1 SummarizedExperiment_1.4.0 Homo.sapiens_1.3.1
[9] org.Hs.eg.db_3.4.0 GO.db_3.3.0 OrganismDbi_1.16.0 ggbio_1.22.4
[13] ggplot2_2.2.1 TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2 GenomicFeatures_1.26.4 AnnotationDbi_1.36.2
[17] Biobase_2.34.0 data.table_1.10.4-3 rtracklayer_1.34.2 liftOver_0.99.120929
[21] GenomicRanges_1.26.4 GenomeInfoDb_1.10.3 IRanges_2.8.2 S4Vectors_0.12.2
[25] BiocGenerics_0.20.0

loaded via a namespace (and not attached): [1] colorspace_1.3-2 htmlTable_1.11.2 base64enc_0.1-3 dichromat_2.0-0 rstudioapi_0.7
[6] bit64_0.9-7 interactiveDisplayBase_1.12.0 codetools_0.2-15 splines_3.3.2 snpStats_1.24.0
[11] doParallel_1.0.11 knitr_1.20 Formula_1.2-2 gQTLBase_1.6.0 cluster_2.0.6
[16] graph_1.52.0 shiny_1.0.5 httr_1.3.1 backports_1.1.2 assertthat_0.2.0
[21] Matrix_1.2-12 lazyeval_0.2.1 limma_3.30.13 acepack_1.4.1 htmltools_0.3.6
[26] tools_3.3.2 bindrcpp_0.2 gtable_0.2.0 glue_1.2.0 reshape2_1.4.3
[31] dplyr_0.7.4 fastmatch_1.1-0 Rcpp_0.12.15 nlme_3.1-131 iterators_1.0.9
[36] ffbase_0.12.3 stringr_1.3.0 mime_0.5 ensembldb_1.6.2 XML_3.98-1.10
[41] AnnotationHub_2.6.5 zlibbioc_1.20.0 scales_0.5.0 BSgenome_1.42.0 RBGL_1.50.0
[46] RColorBrewer_1.1-2 BBmisc_1.11 gwascat_2.6.0 yaml_2.1.17 memoise_1.1.0
[51] gridExtra_2.3 biomaRt_2.30.0 rpart_4.1-13 reshape_0.8.7 latticeExtra_0.6-28
[56] stringi_1.1.6 RSQLite_2.0 foreach_1.4.4 checkmate_1.8.5 BiocParallel_1.8.2
[61] matrixStats_0.53.1 rlang_0.2.0 pkgconfig_2.0.1 BatchJobs_1.7 GenomicFiles_1.10.3
[66] bitops_1.0-6 lattice_0.20-35 bindr_0.1 labeling_0.3 GenomicAlignments_1.10.1
[71] htmlwidgets_1.0 bit_1.1-12 GGally_1.3.2 plyr_1.8.4 magrittr_1.5
[76] sendmailR_1.2-1 R6_2.2.2 Hmisc_4.1-1 DBI_0.8 pillar_1.2.1
[81] foreign_0.8-69 mgcv_1.8-17 survival_2.41-3 RCurl_1.95-4.10 nnet_7.3-12
[86] tibble_1.4.2 grid_3.3.2 blob_1.1.0 gQTLstats_1.6.0 digest_0.6.15
[91] xtable_1.8-2 httpuv_1.3.6.2 ff_2.2-13 brew_1.0-6 munsell_0.4.3
[96] beeswarm_0.2.3 Gviz_1.18.2

andronekomimi commented 6 years ago

Thank you !!!