Graphics API Version Mismatch Error with DESeq2 and ggplot2 in RStudio on Ubuntu 22.04
1
0
Entering edit mode
BioES • 0
@265a1945
Last seen 4 months ago
Greece

Hello,

I am encountering an issue with the "Graphics API version mismatch" error when using the DESeq2 package in RStudio on Ubuntu 22.04. The error occurs when attempting to save plots using ggplot2 (ggsave) within DESeq2 functions like plotPCA. I have thoroughly investigated this issue, including checking package versions, graphics drivers, and system settings, but I have not been able to find a resolution.

Environment:

R version: 4.3.1 (2023-06-16) RStudio version: 2023.09.1 Ubuntu version: 22.04 Loaded Packages:

DESeq2 (v1.42.0) apeglm DEGreport tibble stringr readxl dplyr ggplot2 (v3.4.4) SummarizedExperiment Biobase MatrixGenerics matrixStats GenomicRanges GenomeInfoDb IRanges S4Vectors BiocGenerics

Interestingly, I found a reference example (link provided) that uses the same packages and functions, but it works without any issues.

Reference Example: https://alexslemonade.github.io/refinebio-examples/03-rnaseq/dimension-reduction_rnaseq_01_pca.html

My code so far:

dds <- DESeqDataSetFromMatrix(countData = mycounts, colData = coldata, design = ~condition + timepoint + condition:timepoint) 
dds <- DESeq(dds)
vsdata <- vst(dds, blind=FALSE)
z <- plotPCA(vsdata, intgroup = "condition")
z + ggtitle("my title") +  theme(plot.title = element_text(hjust = 0.5))
ggsave(path = "mypath/", filename = "PCA", device = 'png', dpi=300)

Output: Error in f(...) : Graphics API version mismatch

Thank you for your help.

error RStudio ggplot2 DESeq2 • 1.5k views
ADD COMMENT
0
Entering edit mode

Would you mind making a minimal reproducible example and post it here? You cannot really expect people to first go through a long document to dig out the sparsely described problem you see.

ADD REPLY
0
Entering edit mode

I added the code. Hope this helps more!

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 11 hours ago
United States

What do you get if you do

library(BiocManager)
valid()

And if it tells you to create a valid installation, and you do so, does that help?

0
Entering edit mode

Thank you for your reply! It indeed told me to create a valid installation and i did. But when i rerun the code, even after restarting everything, i still get the same error message..

ADD REPLY
0
Entering edit mode

You might try

remove.packages("ragg")
library(BiocManager)
install("ragg")
ADD REPLY
0
Entering edit mode

i tried that too. But now i can't seem to be able to reinstall ragg. This is the error message:

No package 'libtiff-4' found

Package libtiff-4 was not found in the pkg-config search path.

Perhaps you should add the directory containing 'libtiff-4.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libtiff-4' found

Using PKG_CFLAGS=

Using PKG_LIBS=-lfreetype -lpng16 -ltiff -lz -ljpeg -lbz2

-----------------------------[ ANTICONF ]-------------------------------

Configuration failed to find one of freetype2 libpng libtiff-4 libjpeg. Try installing:

  • deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
  • rpm: freetype-devel libpng-devel libtiff-devel libjpeg-devel (Fedora, CentOS, RHEL)
  • csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris) If freetype2 libpng libtiff-4 libjpeg is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4 libjpeg.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'

-----------------------------[ ERROR MESSAGE ]-------------------------------

<stdin>:1:10: fatal error: ft2build.h: No such file or directory

compilation terminated.


ERROR: configuration failed for package 'ragg'

  • removing '/home/user/R/x86_64-pc-linux-gnu-library/4.3/ragg'

Warning in install.packages : installation of package 'ragg' had non-zero exit status

The downloaded source packages are in '/tmp/RtmpswaAQC/downloaded_packages'

ADD REPLY
0
Entering edit mode

Well, you got a bunch of suggestions there. Did you try any of them?

ADD REPLY

Login before adding your answer.

Traffic: 606 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