gtonkinhill / panstripe

post processing of bacterial pangenome gene presence/absence matrices
GNU General Public License v2.0
50 stars 6 forks source link

Issues with plot_tree_pa #15

Closed Nautilus96 closed 1 month ago

Nautilus96 commented 5 months ago

Hello!

Firstly, thank you for this amazing tool!

I am having some trouble with the phylogeny and gene presence/absence plot. Specifically, the presence/absence matrix is not showing up:

> plot_tree_pa(tree = T_piranensis_tree, pa = T_piranensis_genes, label_genes = FALSE, cols = "black")

plot_genes_pa

Also, when I run the plot, I get the following warning:

Scale for y is already present. Adding another scale for y, which will replace the existing scale.

This warning seems to be related to ggplot, but I am not sure what is causing it or if it's related to the absence of the presence/absence matrix from the plot.

As input, I am using the gene_presence_absence.Rtab file produced by Panaroo, and a phylogeny built by IQTree using the core_gene_alignment_filtered.aln (also from Panaroo). Any advice would be greatly appreciated!

Best, Sebastian

gtonkinhill commented 5 months ago

Hi Sebastian,

I was not able to reproduce your issue. Would it be possible to send through a small reproducible example? I'd just need a tree and presence/absence matrix that reproduces the issue.

That warning message shouldn't be an issue. It often pops up as we force a new layout for the matrix in ggplot.

Nautilus96 commented 5 months ago

Hi Gerry,

Sure! Here are files two files for a smaller set of genomes, which were used to produce the following plot:

T_zoothamnicola.contree.txt T_zoothamnicola_gene_presence_absence.txt

T_zoothamnicola

Here is also some info about R and the packages I used:

R version 4.3.3 (2024-02-29 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: Europe/Vienna tzcode source: internal

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

other attached packages: [1] patchwork_1.2.0 ape_5.7-1 panstripe_0.2.0

loaded via a namespace (and not attached): [1] yulab.utils_0.1.4 utf8_1.2.4 generics_0.1.3 tidyr_1.3.1 ggtree_3.10.1
[6] ggplotify_0.1.2 lattice_0.22-5 hms_1.1.3 digest_0.6.35 magrittr_2.0.3
[11] grid_4.3.3 fastmap_1.1.1 jsonlite_1.8.8 purrr_1.0.2 fansi_1.0.6
[16] aplot_0.2.2 scales_1.3.0 lazyeval_0.2.2 cli_3.6.2 rlang_1.1.3
[21] crayon_1.5.2 bit64_4.0.5 munsell_0.5.0 tidytree_0.4.6 remotes_2.5.0
[26] withr_3.0.0 cachem_1.0.8 tools_4.3.3 parallel_4.3.3 tzdb_0.4.0
[31] memoise_2.0.1 dplyr_1.1.4 colorspace_2.1-0 ggplot2_3.5.0 boot_1.3-29
[36] vctrs_0.6.5 R6_2.5.1 gridGraphics_0.5-1 lifecycle_1.0.4 fs_1.6.3
[41] ggfun_0.1.4 bit_4.0.5 vroom_1.6.5 treeio_1.26.0 pkgconfig_2.0.3
[46] pillar_1.9.0 gtable_0.3.4 glue_1.7.0 Rcpp_1.0.12 tibble_3.2.1
[51] tidyselect_1.2.1 rstudioapi_0.16.0 farver_2.1.1 nlme_3.1-164 labeling_0.4.3
[56] readr_2.1.5 compiler_4.3.3

gtonkinhill commented 5 months ago

Hi,

I think I may have tracked this down to a bug in patchwork (https://github.com/thomasp85/patchwork/issues/342) which has since been fixed. Are you able to update to the latest version using install.packages("patchwork") to see if this fixes the issue?