YuLab-SMU / ggmsa

:traffic_light: Visualizing publication-quality multiple sequence alignment using ggplot2
http://yulab-smu.top/ggmsa
200 stars 22 forks source link

Error in if (freq1 > 0.9 && freq2 > 0) {: missing value where TRUE/FALSE needed #36

Open ramiromagno opened 2 years ago

ramiromagno commented 2 years ago

I got that error while trying to reproduce your example in http://yulab-smu.top/ggmsa/articles/guides/Annotations.html#geom-helix.

Here's the reprex:

library(ggmsa)
#> Registered S3 methods overwritten by 'ggalt':
#>   method                  from   
#>   grid.draw.absoluteGrob  ggplot2
#>   grobHeight.absoluteGrob ggplot2
#>   grobWidth.absoluteGrob  ggplot2
#>   grobX.absoluteGrob      ggplot2
#>   grobY.absoluteGrob      ggplot2
#> Registered S3 method overwritten by 'ggtree':
#>   method      from 
#>   identify.gg ggfun
#> ggmsa v1.3.2  Document: http://yulab-smu.top/ggmsa/
#> 
#> If you use ggmsa in published research, please cite:
#> L Zhou, T Feng, S Xu, F Gao, TT Lam, Q Wang, T Wu, H Huang, L Zhan, L Li, Y Guan, Z Dai*, G Yu* ggmsa: a visual exploration tool for multiple sequence alignment and associated data. Briefings in Bioinformatics. DOI:10.1093/bib/bbac222

known_file <- system.file("extdata", "vienna.txt", package = "R4RNA")
known <- readSSfile(known_file, type = "Vienna" )
cripavirus_msa <- system.file("extdata", "Cripavirus.fasta", package = "ggmsa")

ggmsa(cripavirus_msa, font = NULL, color = "Chemistry_NT", seq_name = FALSE, show.legend = TRUE, border = "white") +
  geom_helix(helix_data = known)
#> Error in if (freq1 > 0.9 && freq2 > 0) {: missing value where TRUE/FALSE needed

sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Arch Linux
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/libopenblasp-r0.3.18.so
#> LAPACK: /usr/lib/liblapack.so.3.10.0
#> 
#> 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] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggmsa_1.3.2
#> 
#> loaded via a namespace (and not attached):
#>  [1] maps_3.4.0             tidyr_1.1.4            jsonlite_1.7.2        
#>  [4] assertthat_0.2.1       highr_0.9              stats4_4.1.2          
#>  [7] yulab.utils_0.0.4      GenomeInfoDbData_1.2.6 yaml_2.2.1            
#> [10] Rttf2pt1_1.3.10        pillar_1.6.4           lattice_0.20-45       
#> [13] glue_1.6.0             extrafontdb_1.0        digest_0.6.28         
#> [16] RColorBrewer_1.1-3     XVector_0.32.0         polyclip_1.10-0       
#> [19] colorspace_2.0-2       ggfun_0.0.6            htmltools_0.5.2       
#> [22] pkgconfig_2.0.3        zlibbioc_1.38.0        purrr_0.3.4           
#> [25] patchwork_1.1.1        tidytree_0.3.9         scales_1.1.1          
#> [28] ggplotify_0.1.0        tweenr_1.0.2           ggforce_0.3.3         
#> [31] tibble_3.1.6           generics_0.1.1         farver_2.1.0          
#> [34] IRanges_2.26.0         ggplot2_3.3.5          ellipsis_0.3.2        
#> [37] withr_2.4.2            seqmagick_0.1.5        BiocGenerics_0.40.0   
#> [40] lazyeval_0.2.2         cli_3.3.0              magrittr_2.0.1        
#> [43] crayon_1.4.2           evaluate_0.14          ash_1.0-15            
#> [46] fs_1.5.0               fansi_0.5.0            nlme_3.1-153          
#> [49] MASS_7.3-54            tools_4.1.2            lifecycle_1.0.1       
#> [52] stringr_1.4.0          aplot_0.1.4            S4Vectors_0.30.2      
#> [55] ggtree_3.0.4           munsell_0.5.0          reprex_2.0.1          
#> [58] Biostrings_2.60.2      compiler_4.1.2         ggalt_0.4.0           
#> [61] GenomeInfoDb_1.28.4    gridGraphics_0.5-1     rlang_1.0.2           
#> [64] grid_4.1.2             RCurl_1.98-1.5         rstudioapi_0.13       
#> [67] bitops_1.0-7           rmarkdown_2.11         proj4_1.0-11          
#> [70] gtable_0.3.0           DBI_1.1.1              R6_2.5.1              
#> [73] knitr_1.36             dplyr_1.0.7            fastmap_1.1.0         
#> [76] extrafont_0.18         utf8_1.2.2             treeio_1.16.2         
#> [79] KernSmooth_2.23-20     ape_5.6-2              stringi_1.7.6         
#> [82] parallel_4.1.2         Rcpp_1.0.7             vctrs_0.4.1           
#> [85] R4RNA_1.20.0           tidyselect_1.1.1       xfun_0.28

Created on 2022-05-13 by the reprex package (v2.0.1)

nyzhoulang commented 2 years ago

We updated the data for this example, so you can use the following code to repeat it.

library(ggplot2)

RF03120_msa<- system.file("extdata", "Rfam", "RF03120.fasta", package = "ggmsa")
RF03120_ss <- system.file("extdata", "Rfam", "RF03120_SS.txt", package = "ggmsa")

RF_arc <- readSSfile(RF03120_ss, type = "Vienna" )

p <- ggmsa(RF03120_msa, 
             font = NULL, 
             color = "Chemistry_NT", 
             seq_name = F, 
             show.legend = F, 
             border = NA) +
  geom_helix(helix_data = RF_arc) + 
  theme(axis.text.y = element_blank())
p

We will update the documentation shortly.