3
0
Entering edit mode
rama ▴ 10
@215babe0
Last seen 12 weeks ago
United Kingdom

Hello,

I am trying to run clusterProfiler for my RNA-seq analysis and I'm unable to generate the KEGG graph. I followed the tutorial mentioned in https://learn.gencore.bio.nyu.edu/rna-seq-analysis/gene-set-enrichment-analysis/ . The KEGGgse object has a ID vector which contains all the KEGG pathway codes such as "ath04016" "ath00460" "ath00966" "ath04626" "ath03440". I ran a for loop to extract the pathways and display the results using pathview, but I am getting the same error message for every pathway. I also tried it without the "ath" in the pathway.id, but I am still not able to extract any pathways. Am I doing something wrong or is pathview just not working?

Thanks!

kegg_gene_list <- df2$log2FoldChange kegg_organism = "ath" kk2 <- gseKEGG(geneList = kegg_gene_list, organism = kegg_organism, nPerm = 10000, minGSSize = 3, maxGSSize = 800, pvalueCutoff = 0.05, pAdjustMethod = "none", keyType = "ncbi-geneid") library(pathview) #for (i in kk2$ID)
#{
# Produce the native KEGG plot (PNG)
#png("ath04075.pathview.png")
dme <- pathview(gene.data=kegg_gene_list, pathway.id="04016", species = kegg_organism)
#dev.off()

# Produce a different plot (PDF) (not displayed here)
#png("ath040751.pathview.png")
dme <- pathview(gene.data=kegg_gene_list, pathway.id="ath04016", species = kegg_organism, kegg.native = F)
#dev.off()
#knitr::include_graphics("ath04075.pathview.png", error = FALSE)
#}

This is the output:
Info: Getting gene ID data from KEGG...
Info: Done with data retrieval!
URL 'https://rest.kegg.jp/get/ath04016/kgml': status was 'Failure when receiving data from the peer'
This pathway may not exist!
This pathway may not exist!

3
Entering edit mode
Guido Hooiveld ★ 3.4k
@guido-hooiveld-2020
Last seen 10 hours ago
Wageningen University, Wageningen, the …

I would say "pathview is just not working"!

Not able to download data through pathview has been reported on the Github of pathview, and has been attributed to the a change in the KEGG API; since June 1, 2022, the interface moved from http to https.

The user that reported the error noticed that the URLs to download files were hard-coded in pathview, and he made a PR that fixed this issue. The PR still has to be incorporated in the code of pathview, but meanwhile you can already use the corrected code. See e.g. here: https://github.com/datapplab/pathview/pull/14. You will see that I quickly tested the PR, and that it is indeed working.

UPDATE 15 August 2022: per 11 August 2022 the PR has been merged with the pathview source code.

UPDATE 1 September 2022: Luo Weijun, the author of pathview, has updated both the release (= v1.36.1) and development (=1.37.1) versions of pathview. There is no need anymore to install the above-mention PR. see answer Luo Weijun in this thread below.

0
Entering edit mode

Thanks for the update! I tried the PR as you mentioned but it's still not working. I attached the code below.

 remove.packages("pathview") Removing package from ‘AppData/Local/Programs/R/R-4.2.0/library’ (as ‘lib’ is unspecified)

devtools::install_github("javadnoorb/pathview") Downloading GitHub repo javadnoorb/pathview@HEAD Skipping 4 packages ahead of CRAN: GenomeInfoDb, BiocGenerics, AnnotationDbi, KEGGgraph ✔ checking for file 'C:\Users\s2213008\AppData\Local\Temp\RtmpekgVmX\remotes30f07ae94e0b\javadnoorb-pathview-9f5c78b/DESCRIPTION' ─ preparing 'pathview': ✔ checking DESCRIPTION meta-information ... ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories NB: this package now depends on R (>= 3.5.0) WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'pathview/data/korg.rda' ─ building 'pathview_1.31.3.tar.gz'

Warning: package ‘pathview’ is in use and will not be installed

dme <- pathview(gene.data=kegg_gene_list, pathway.id="04016", species = kegg_organism) Info: Getting gene ID data from KEGG... Info: Done with data retrieval! Info: Downloading xml files for ath04016, 1/1 pathways.. Warning in download.file(xml.url, xml.target, quiet = T) : URL 'https://rest.kegg.jp/get/ath04016/kgml': status was 'Failure when receiving data from the peer' Warning: Download of ath04016 xml file failed! This pathway may not exist! Info: Downloading png files for ath04016, 1/1 pathways.. Warning: Download of ath04016 png file failed! This pathway may not exist! Warning: Failed to download KEGG xml/png files, ath04016 skipped!

0
Entering edit mode

Did you see this message: Warning: package ‘pathview’ is in use and will not be installed? So it seems the PR was not installed.

I suggest to close all R instances and restart it. Then run devtools::install_github("javadnoorb/pathview", force=TRUE).

Also: run BiocManager::valid() and act accordingly. Based on the message Skipping 4 packages ahead of CRAN it may be that your Bioconductor installation is not 'matched' (I don't get that notification when installing the PR).

Lastly, since it is difficult to troubleshoot without having the data you are using, it is also good to check whether the example code on the help page of pathview (type: ?pathview) is working. It should!

1
Entering edit mode

Thank you so much for your help!

I noticed the warning message a little too late, but it seems to be working now. I used the following code:

 detach("package:pathview", unload = TRUE) devtools::install_github("javadnoorb/pathview") library(pathview) dme <- pathview(gene.data=kegg_gene_list, pathway.id="04016", species = kegg_organism)

0
Entering edit mode
shepherl 3.3k
@lshep
Last seen 1 day ago
United States

You could also try updating your version of KEGGREST. There was a PR in KEGGREST last week to fix similar seen error. PR. Should be active in KEGGREST versions 1.36.2 and 1.37.2 for release and devel.

0
Entering edit mode
Luo Weijun ★ 1.5k
@luo-weijun-1783
Last seen 5 weeks ago
United States

Sorry for the late response. This is a bug caused by recent change in KEGG REST API url format, i.e. from http to https.
Please update to the latest version of pathview, either the release (1.36.1) or the devel (1.37.1). with the update, Pathview also supports 8282 KEGG species or 1449 new species beyond 2020.

# install from BioConductor
if(!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("pathview")

# Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("datapplab/pathview")