Simon-Coetzee / motifBreakR

A Package For Predicting The Disruptiveness Of Single Nucleotide Polymorphisms On Transcription Factor Binding Sites.
28 stars 12 forks source link

plotMB: Error in grid.Call.graphics(C_unsetviewport, as.integer(n)) #31

Open ellchua opened 3 years ago

ellchua commented 3 years ago

Hi,

I'm getting an error from plotMB that says:

plotMB(results = motifbreakr.results, rsid="chr1:59641318-59641317::T", effect = "strong")

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

How can I address this error?

These are what my motifbreakR results look like:

> motifbreakr.results
GRanges object with 23 ranges and 19 metadata columns:
                     seqnames    ranges strand |             SNP_id            REF            ALT     varType
                        <Rle> <IRanges>  <Rle> |        <character> <DNAStringSet> <DNAStringSet> <character>
   chr17:7674873:A:C    chr17   7674873      + |  chr17:7674873:A:C              A              C         SNV
  chr2:208248388:C:T     chr2 208248388      - | chr2:208248388:C:T              C              T         SNV
  chr2:208248388:C:T     chr2 208248388      - | chr2:208248388:C:T              C              T         SNV
  chr2:208248388:C:T     chr2 208248388      - | chr2:208248388:C:T              C              T         SNV
  chr2:208248388:C:T     chr2 208248388      - | chr2:208248388:C:T              C              T         SNV
                 ...      ...       ...    ... .                ...            ...            ...         ...
  chr3:121489063:T:C     chr3 121489063      + | chr3:121489063:T:C              T              C         SNV
  chr14:94487481:G:A    chr14  94487481      - | chr14:94487481:G:A              G              A         SNV
  chr18:78995392:C:A    chr18  78995392      - | chr18:78995392:C:A              C              A         SNV
  chr16:54932543:T:G    chr16  54932543      - | chr16:54932543:T:G              T              G         SNV
   chr19:7640567:C:T    chr19   7640567      - |  chr19:7640567:C:T              C              T         SNV
                     motifPos  geneSymbol  dataSource providerName  providerId               seqMatch
                       <list> <character> <character>  <character> <character>            <character>
   chr17:7674873:A:C    -7, 5       NR2C2    HOCOMOCO     NR2C2_f1 NR2C2_HUMAN aggcggcTcatagggcacca..
  chr2:208248388:C:T    -1,11       NR2C1    HOCOMOCO     NR2C1_si NR2C1_HUMAN  ccataagcAtgatgaccta..
  chr2:208248388:C:T      1,8       NR2F1    HOCOMOCO      COT1_si  COT1_HUMAN      aagcAtgatgaccta..
  chr2:208248388:C:T     1,11       NR2F1    HOCOMOCO      COT1_f1  COT1_HUMAN   cataagcAtgatgaccta..
  chr2:208248388:C:T    -1, 8       NR2F2    HOCOMOCO      COT2_f1  COT2_HUMAN     taagcAtgatgaccta..
                 ...      ...         ...         ...          ...         ...                    ...
  chr3:121489063:T:C    -5, 9       TEAD3    HOCOMOCO     TEAD3_si TEAD3_HUMAN ttttcttgtAgtccagaaat..
  chr14:94487481:G:A    -5, 2        PAX5    HOCOMOCO      PAX5_si  PAX5_HUMAN       cagCtcagccttgt..
  chr18:78995392:C:A    -4, 8       EPAS1    HOCOMOCO     EPAS1_si EPAS1_HUMAN  tccatgagCgcacgcacac..
  chr16:54932543:T:G  -11,  3      ZNF423    HOCOMOCO     ZN423_f1 ZN423_HUMAN gggctccttGgggtaccatc..
   chr19:7640567:C:T    -5, 6        NRF1    HOCOMOCO      NRF1_f1  NRF1_HUMAN   gtgtgtgTgcgcgtgtgc..
                        pctRef    pctAlt  scoreRef  scoreAlt Refpvalue Altpvalue    altPos alleleDiff
                     <numeric> <numeric> <numeric> <numeric> <logical> <logical> <integer>  <numeric>
   chr17:7674873:A:C  0.843539  0.720995   5.33368   4.60625      <NA>      <NA>         1  -0.727434
  chr2:208248388:C:T  0.753963  0.879816   5.01112   5.80555      <NA>      <NA>         1   0.794436
  chr2:208248388:C:T  0.814607  0.936256   4.53953   5.18992      <NA>      <NA>         1   0.650396
  chr2:208248388:C:T  0.753142  0.856400   4.56911   5.15296      <NA>      <NA>         1   0.583854
  chr2:208248388:C:T  0.792262  0.926003   4.75735   5.52738      <NA>      <NA>         1   0.770030
                 ...       ...       ...       ...       ...       ...       ...       ...        ...
  chr3:121489063:T:C  0.786477  0.880214   4.25272   4.72300      <NA>      <NA>         1   0.470280
  chr14:94487481:G:A  0.989568  0.833870   5.30602   4.47939      <NA>      <NA>         1  -0.826638
  chr18:78995392:C:A  0.838922  0.689429   4.97840   4.12633      <NA>      <NA>         1  -0.852071
  chr16:54932543:T:G  0.750703  0.675102   9.22968   8.31474      <NA>      <NA>         1  -0.914934
   chr19:7640567:C:T  0.865469  0.770710   6.04848   5.41517      <NA>      <NA>         1  -0.633307
                          effect
                     <character>
   chr17:7674873:A:C      strong
  chr2:208248388:C:T      strong
  chr2:208248388:C:T        weak
  chr2:208248388:C:T        weak
  chr2:208248388:C:T      strong
                 ...         ...
  chr3:121489063:T:C        weak
  chr14:94487481:G:A      strong
  chr18:78995392:C:A      strong
  chr16:54932543:T:G      strong
   chr19:7640567:C:T        weak
  -------
  seqinfo: 13 sequences from hg38 genome

Here is the session info:

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] BSgenome.Hsapiens.UCSC.hg38_1.4.3 BSgenome_1.58.0                   BiocParallel_1.24.1              
 [4] motifbreakR_2.4.0                 MotifDb_1.32.0                    ggrepel_0.9.1                    
 [7] cowplot_1.1.1                     gridExtra_2.3                     StructuralVariantAnnotation_1.6.0
[10] VariantAnnotation_1.36.0          Rsamtools_2.6.0                   Biostrings_2.58.0                
[13] XVector_0.30.0                    SummarizedExperiment_1.20.0       Biobase_2.50.0                   
[16] MatrixGenerics_1.2.1              matrixStats_0.58.0                rtracklayer_1.50.0               
[19] ShatterSeek_0.4                   graph_1.68.0                      foreach_1.5.1                    
[22] forcats_0.5.1                     scales_1.1.1                      reshape_0.8.8                    
[25] tidyr_1.1.3                       stringr_1.4.0                     GenomicRanges_1.42.0             
[28] GenomeInfoDb_1.26.4               IRanges_2.24.1                    S4Vectors_0.28.1                 
[31] BiocGenerics_0.36.0               data.table_1.14.0                 DT_0.17                          
[34] dplyr_1.0.5                       R.utils_2.10.1                    R.oo_1.24.0                      
[37] R.methodsS3_1.8.1                 maftools_2.6.05                   ggplot2_3.3.3                    
[40] kableExtra_1.3.4                  knitr_1.31                       

loaded via a namespace (and not attached):
  [1] snow_0.4-3               backports_1.2.1          Hmisc_4.5-0              BiocFileCache_1.14.0    
  [5] systemfonts_1.0.1        plyr_1.8.6               lazyeval_0.2.2           splines_4.0.5           
  [9] digest_0.6.27            ensembldb_2.14.0         htmltools_0.5.1.1        rsconnect_0.8.16        
 [13] fansi_0.4.2              magrittr_2.0.1           checkmate_2.0.0          memoise_2.0.0           
 [17] grImport2_0.2-0          cluster_2.1.1            svglite_2.0.0            askpass_1.1             
 [21] prettyunits_1.1.1        jpeg_0.1-8.1             colorspace_2.0-0         blob_1.2.1              
 [25] rvest_1.0.0              rappdirs_0.3.3           xfun_0.22                crayon_1.4.1            
 [29] RCurl_1.98-1.3           TFMPvalue_0.0.8          survival_3.2-10          iterators_1.0.13        
 [33] glue_1.4.2               gtable_0.3.0             zlibbioc_1.36.0          webshot_0.5.2           
 [37] DelayedArray_0.16.3      DBI_1.1.1                Rcpp_1.0.6               viridisLite_0.3.0       
 [41] progress_1.2.2           htmlTable_2.1.0          foreign_0.8-81           bit_4.0.4               
 [45] Formula_1.2-4            htmlwidgets_1.5.3        httr_1.4.2               RColorBrewer_1.1-2      
 [49] ellipsis_0.3.1           pkgconfig_2.0.3          XML_3.99-0.6             Gviz_1.34.1             
 [53] nnet_7.3-15              dbplyr_2.1.0             utf8_1.2.1               tidyselect_1.1.0        
 [57] rlang_0.4.10             AnnotationDbi_1.52.0     munsell_0.5.0            tools_4.0.5             
 [61] cachem_1.0.4             cli_2.4.0                generics_0.1.0           RSQLite_2.2.5           
 [65] ade4_1.7-16              evaluate_0.14            fastmap_1.1.0            yaml_2.2.1              
 [69] bit64_4.0.5              purrr_0.3.4              AnnotationFilter_1.14.0  splitstackshape_1.4.8   
 [73] xml2_1.3.2               biomaRt_2.46.3           compiler_4.0.5           rstudioapi_0.13         
 [77] curl_4.3                 png_0.1-7                tibble_3.1.0             stringi_1.5.3           
 [81] GenomicFeatures_1.42.2   lattice_0.20-41          ProtGenerics_1.22.0      Matrix_1.3-2            
 [85] vctrs_0.3.7              pillar_1.5.1             lifecycle_1.0.0          bitops_1.0-6            
 [89] R6_2.5.0                 latticeExtra_0.6-29      motifStack_1.34.0        codetools_0.2-18        
 [93] dichromat_2.0-0          MASS_7.3-53.1            assertthat_0.2.1         openssl_1.4.3           
 [97] withr_2.4.1              GenomicAlignments_1.26.0 GenomeInfoDbData_1.2.4   hms_1.0.0               
[101] rpart_4.1-15             rmarkdown_2.7            biovizBase_1.38.0        base64enc_0.1-3
bschilder commented 2 years ago

Same issue here. Any tips @Simon-Coetzee ?

bschilder commented 2 years ago

Still observing this issue, though something I noticed is that it only occurs in certain contexts. For example, I'm able to run it without error from the R console. But when I run it in the @example Roxygen notes of my R package, it throws the error. @Simon-Coetzee @scoetzee