error for barplot in enrichGO(clusterProfiler)
1
0
Entering edit mode
7.8 years ago
liuwei • 0

Hi,I have a problem about barplot,is someone can deal with the error "Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : X11 font -adobe-helvetica-%s-%s---%d-------*, face 1 at size 11 could not be loaded"? Why cause that? My script:

>library(clusterProfiler)

>library(DOSE)

>library(org.Mm.eg.db)

>a<-read.table("gene.list")

>gene<-as.character(a[,1])

>ego<-enrichGO(gene=gene,OrgDb = org.Mm.eg.db,keytype = "SYMBOL",ont = "CC",pAdjustMethod = "BH")

>write.csv(as.data.frame(ego@result),file = "SSC_updown_GO.csv",row.names = F)

> barplot(ego, drop=TRUE, showCategory=12)

>Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y,  :
  X11 font -adobe-helvetica-%s-%s-*-*-%d-*-*-*-*-*-*-*, face 1 at size 11 could not be loaded

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] org.Mm.eg.db_3.4.0     AnnotationDbi_1.36.0   IRanges_2.8.1          S4Vectors_0.12.0      
[5] Biobase_2.34.0         BiocGenerics_0.20.0    clusterProfiler_3.2.14 DOSE_3.0.10           

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10       plyr_1.8.4         tools_3.3.2        digest_0.6.12      RSQLite_1.1-2     
 [6] memoise_1.0.0      tibble_1.2         gtable_0.2.0       fastmatch_1.1-0    igraph_1.0.1      
[11] DBI_0.6            fgsea_1.0.2        gridExtra_2.2.1    stringr_1.2.0      grid_3.3.2        
[16] qvalue_2.6.0       data.table_1.10.4  BiocParallel_1.8.1 GOSemSim_2.0.4     GO.db_3.4.0       
[21] ggplot2_2.2.1      DO.db_2.9          reshape2_1.4.2     tidyr_0.6.1        magrittr_1.5      
[26] scales_0.4.1       splines_3.3.2      assertthat_0.1     colorspace_1.3-2   stringi_1.1.2     
[31] lazyeval_0.2.0     munsell_0.4.3
RNA-Seq R gene • 4.7k views
ADD COMMENT
0
Entering edit mode

If it is a bug, report to the repository, if it is a problem using the package, post it in support.bioconductor.org. If you could make a reproducible error it would help other people too.

ADD REPLY
0
Entering edit mode

I'm running into the same problem using simply ggplot2 ... did you find a solution?

ADD REPLY
0
Entering edit mode

If some one is still facing this issue, try applying this. Either you rescan the font directories with xset fp rehash or reboot the machine as per this post on ubuntu forums:

sudo apt install t1-xfree86-nonfree ttf-xfree86-nonfree ttf-xfree86-nonfree-syriac xfonts-75dpi xfonts-100dpi
ADD REPLY
0
Entering edit mode
6.3 years ago
thackl ★ 3.0k

I had the same problem. It is a general problem with the R graphics device. R's default backend for drawing graphics on X11 windows is "Xlib", and that uses the x11-font that doesn't work. From what I understand those x11 fonts are discouraged on current linux distros (not sure about other OS's).

As a fix, you can make R use the "cairo" backend instead of Xlib (https://bioinformaticsngs.wordpress.com/2016/04/18/r-x11-font-adobe-helvetica-s-s-d-face-1-at-size-12-could-not-be-loaded/).

Check with capabilities() in R if it supports cairo (cairo==TRUE), or alternatively nbcairo. If yes try putting the following hook in your ~/.Rprofile and restarting R

# default X11() setting
setHook(packageEvent("grDevices", "onLoad"),
function(…) grDevices::X11.options(type = "cairo"))

If cairo is FALSE, you can get your R to support it by reinstalling R, provided your system has libcairo installed.

Note, though, reinstalling R might mean you also need to reinstall all the packages you are using because they need to be built against the installed version of R.

On Ubuntu the following worked for me

sudo apt install libcairo2-dev
# download and unpack R from CRAN
cd R && ./configure

at the end of configure, it should say something like

  Options enabled:           shared BLAS, R profiling

  Capabilities skipped:      JPEG, TIFF    <-- no cairo mentioned here
  Options not enabled:       memory profiling

  Recommended packages:      yes

After that, the hook solution should work.

ADD COMMENT
0
Entering edit mode

could you make this bold : Note, though, reinstalling R might mean you also need to reinstall all the packages you are using because the need to be built against the installed version of R. thackl

ADD REPLY
0
Entering edit mode

Made it bold, an put it in front of the instructions ;)

ADD REPLY
0
Entering edit mode

Thanks thackl

ADD REPLY

Login before adding your answer.

Traffic: 2009 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6