RajLabMSSM / echoannot

echoverse module: Annotate fine-mapping results
2 stars 0 forks source link

`MOTIFBREAKR_plot`: `Error in grid.Call.graphics(C_unsetviewport, as.integer(n)) : cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)` #15

Open bschilder opened 1 year ago

bschilder commented 1 year ago

1. Bug description

Running MOTIFBREAKR_plot causes error in certain contexts. Documented here: https://github.com/Simon-Coetzee/motifBreakR/issues/31

Expected behaviour

Function should run in all contexts.

2. Reproducible example

Code

library(BSgenome) ## <-- IMPORTANT!
library(BSgenome.Hsapiens.UCSC.hg19) ## <-- IMPORTANT!
#### Example fine-mapping results ####
merged_DT <- echodata::get_Nalls2019_merged()
#### Run motif analyses ####
mb_res <- MOTIFBREAKR(rsid_list = c("rs11175620"),
                      # limit the number of datasets tested
                      # for demonstration purposes only
                      pwmList_max = 5,
                      calculate_pvals = FALSE)
plot_paths <- MOTIFBREAKR_plot(mb_res = mb_res)

Console output

When run via CRAN checks.

 dat is already a GRanges object.
   Plotting 1 unique RSID(s).
   Plotting motif disruption results: rs11175620
   Error in grid.Call.graphics(C_unsetviewport, as.integer(n)) : 
     cannot pop the top-level viewport ('grid' and 'graphics' output mixed?)
   Calls: MOTIFBREAKR_plot ... drawGD -> .local -> popViewport -> grid.Call.graphics
   Execution halted

When run in R console:

genome_build set to hg19 by default.
Loading required namespace: SNPlocs.Hsapiens.dbSNP144.GRCh37
Using genome_build hg19
+ MOTIFBREAKR:: Converting SNP list into motifbreakR input format.

3. Session info

``` R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Monterey 12.4 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib locale: [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages: [1] stats4 stats graphics grDevices utils datasets [7] methods base other attached packages: [1] echoannot_0.99.10 [2] BSgenome.Hsapiens.UCSC.hg19_1.4.3 [3] BSgenome_1.65.2 [4] rtracklayer_1.57.0 [5] Biostrings_2.65.6 [6] XVector_0.37.1 [7] GenomicRanges_1.49.1 [8] GenomeInfoDb_1.33.13 [9] IRanges_2.31.2 [10] S4Vectors_0.35.4 [11] BiocGenerics_0.43.4 loaded via a namespace (and not attached): [1] utf8_1.2.2 [2] reticulate_1.26 [3] R.utils_2.12.0 [4] tidyselect_1.2.0 [5] poweRlaw_0.70.6 [6] RSQLite_2.2.18 [7] AnnotationDbi_1.59.1 [8] htmlwidgets_1.5.4 [9] grid_4.2.1 [10] BiocParallel_1.31.14 [11] XGR_1.1.8 [12] munsell_0.5.0 [13] codetools_0.2-18 [14] interp_1.1-3 [15] DT_0.26 [16] colorspace_2.0-3 [17] OrganismDbi_1.39.1 [18] Biobase_2.57.1 [19] filelock_1.0.2 [20] knitr_1.40 [21] supraHex_1.35.0 [22] rstudioapi_0.14 [23] DescTools_0.99.46 [24] motifStack_1.41.1 [25] MatrixGenerics_1.9.1 [26] GenomeInfoDbData_1.2.9 [27] bit64_4.0.5 [28] echoconda_0.99.7 [29] basilisk_1.9.11 [30] vctrs_0.4.2 [31] generics_0.1.3 [32] xfun_0.34 [33] biovizBase_1.45.0 [34] BiocFileCache_2.5.2 [35] R6_2.5.1 [36] splitstackshape_1.4.8 [37] grImport2_0.2-0 [38] AnnotationFilter_1.21.0 [39] bitops_1.0-7 [40] cachem_1.0.6 [41] reshape_0.8.9 [42] DelayedArray_0.23.2 [43] motifbreakR_2.11.2 [44] assertthat_0.2.1 [45] BiocIO_1.7.1 [46] scales_1.2.1 [47] nnet_7.3-18 [48] rootSolve_1.8.2.3 [49] gtable_0.3.1 [50] lmom_2.9 [51] ggbio_1.45.0 [52] ensembldb_2.21.5 [53] seqLogo_1.63.0 [54] rlang_1.0.6 [55] echodata_0.99.15 [56] splines_4.2.1 [57] lazyeval_0.2.2 [58] dichromat_2.0-0.1 [59] hexbin_1.28.2 [60] checkmate_2.1.0 [61] BiocManager_1.30.18 [62] yaml_2.3.6 [63] reshape2_1.4.4 [64] GenomicFeatures_1.49.7 [65] ggnetwork_0.5.10 [66] backports_1.4.1 [67] Hmisc_4.7-1 [68] RBGL_1.73.0 [69] tools_4.2.1 [70] ggplot2_3.3.6 [71] ellipsis_0.3.2 [72] RColorBrewer_1.1-3 [73] proxy_0.4-27 [74] Rcpp_1.0.9 [75] plyr_1.8.7 [76] base64enc_0.1-3 [77] progress_1.2.2 [78] zlibbioc_1.43.0 [79] purrr_0.3.5 [80] RCurl_1.98-1.9 [81] basilisk.utils_1.9.4 [82] prettyunits_1.1.1 [83] rpart_4.1.16 [84] deldir_1.0-6 [85] SummarizedExperiment_1.27.3 [86] ggrepel_0.9.1 [87] cluster_2.1.4 [88] fs_1.5.2 [89] crul_1.3 [90] magrittr_2.0.3 [91] data.table_1.14.4 [92] echotabix_0.99.8 [93] dnet_1.1.7 [94] openxlsx_4.2.5 [95] MotifDb_1.39.0 [96] mvtnorm_1.1-3 [97] ProtGenerics_1.29.1 [98] matrixStats_0.62.0 [99] pkgload_1.3.0 [100] xtable_1.8-4 [101] patchwork_1.1.2 [102] hms_1.1.2 [103] XML_3.99-0.11 [104] jpeg_0.1-9 [105] readxl_1.4.1 [106] gridExtra_2.3 [107] compiler_4.2.1 [108] biomaRt_2.53.3 [109] tibble_3.1.8 [110] crayon_1.5.2 [111] R.oo_1.25.0 [112] htmltools_0.5.3 [113] tzdb_0.3.0 [114] TFBSTools_1.35.0 [115] Formula_1.2-4 [116] tidyr_1.2.1 [117] expm_0.999-6 [118] Exact_3.2 [119] DBI_1.1.3 [120] dbplyr_2.2.1 [121] MASS_7.3-58.1 [122] rappdirs_0.3.3 [123] boot_1.3-28 [124] ade4_1.7-19 [125] Matrix_1.5-1 [126] readr_2.1.3 [127] piggyback_0.1.4 [128] cli_3.4.1 [129] R.methodsS3_1.8.2 [130] Gviz_1.41.1 [131] parallel_4.2.1 [132] igraph_1.3.5 [133] SNPlocs.Hsapiens.dbSNP144.GRCh37_0.99.20 [134] pkgconfig_2.0.3 [135] TFMPvalue_0.0.9 [136] GenomicAlignments_1.33.1 [137] dir.expiry_1.5.1 [138] RCircos_1.2.2 [139] foreign_0.8-83 [140] osfr_0.2.9 [141] xml2_1.3.3 [142] annotate_1.75.0 [143] DirichletMultinomial_1.39.0 [144] stringr_1.4.1 [145] VariantAnnotation_1.43.3 [146] digest_0.6.30 [147] pracma_2.4.2 [148] CNEr_1.33.0 [149] graph_1.75.0 [150] httpcode_0.3.0 [151] cellranger_1.1.0 [152] htmlTable_2.4.1 [153] gld_2.6.5 [154] restfulr_0.0.15 [155] curl_4.3.3 [156] gtools_3.9.3 [157] Rsamtools_2.13.4 [158] rjson_0.2.21 [159] lifecycle_1.0.3 [160] nlme_3.1-160 [161] jsonlite_1.8.3 [162] fansi_1.0.3 [163] downloadR_0.99.4 [164] pillar_1.8.1 [165] lattice_0.20-45 [166] GGally_2.1.2 [167] GO.db_3.16.0 [168] KEGGREST_1.37.3 [169] fastmap_1.1.0 [170] httr_1.4.4 [171] survival_3.4-0 [172] glue_1.6.2 [173] zip_2.2.1 [174] png_0.1-7 [175] bit_4.0.4 [176] Rgraphviz_2.41.1 [177] class_7.3-20 [178] stringi_1.7.8 [179] blob_1.2.3 [180] caTools_1.18.2 [181] latticeExtra_0.6-30 [182] memoise_2.0.1 [183] dplyr_1.0.10 [184] e1071_1.7-11 [185] ape_5.6-2 ```