Error with Pathview: Bad Request (HTTP 400)
1
0
Entering edit mode
morgan.sobol ▴ 10
@f4107e6a
Last seen 20 months ago
United States

Hello,

I get the following error with Pathview:

Code:

> avn <- pathview(gene.data=pathview_genelist, pathway.id="avn01200", species = organism)
> avn <- pathview(gene.data=gene_list, pathway.id="avn01200", species = organism, kegg.native = F)

Error:

Note: Mapping via KEGG gene ID (not Entrez) is supported for this species, it looks like "Avin_39610"! Info: Getting gene ID data from KEGG... Error in .getUrl(url, .listParser, nameColumn = 1, valueColumn = 2) : Bad Request (HTTP 400).

Here is my sessioninfo():

> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

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] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] pathview_1.38.0       clusterProfiler_4.6.2 KEGGREST_1.38.0       ggplot2_3.4.2        

loaded via a namespace (and not attached):
  [1] nlme_3.1-162           bitops_1.0-7           ggtree_3.6.2           enrichplot_1.18.4     
  [5] bit64_4.0.5            HDO.db_0.99.1          RColorBrewer_1.1-3     httr_1.4.5            
  [9] GenomeInfoDb_1.34.9    Rgraphviz_2.42.0       tools_4.2.3            utf8_1.2.3            
 [13] R6_2.5.1               lazyeval_0.2.2         DBI_1.1.3              BiocGenerics_0.44.0   
 [17] colorspace_2.1-0       withr_2.5.0            tidyselect_1.2.0       gridExtra_2.3         
 [21] curl_5.0.0             bit_4.0.5              compiler_4.2.3         graph_1.76.0          
 [25] cli_3.6.1              Biobase_2.58.0         scatterpie_0.1.8       shadowtext_0.1.2      
 [29] KEGGgraph_1.58.3       scales_1.2.1           stringr_1.5.0          digest_0.6.31         
 [33] yulab.utils_0.0.6      gson_0.1.0             DOSE_3.24.2            XVector_0.38.0        
 [37] pkgconfig_2.0.3        fastmap_1.1.1          rlang_1.1.0            rstudioapi_0.14       
 [41] RSQLite_2.3.1          gridGraphics_0.5-1     farver_2.1.1           generics_0.1.3        
 [45] jsonlite_1.8.4         BiocParallel_1.32.6    GOSemSim_2.24.0        dplyr_1.1.1           
 [49] RCurl_1.98-1.12        magrittr_2.0.3         ggplotify_0.1.0        GO.db_3.16.0          
 [53] GenomeInfoDbData_1.2.9 patchwork_1.1.2        Matrix_1.5-4           Rcpp_1.0.10           
 [57] munsell_0.5.0          S4Vectors_0.36.2       fansi_1.0.4            ape_5.7-1             
 [61] viridis_0.6.2          lifecycle_1.0.3        stringi_1.7.12         ggraph_2.1.0          
 [65] MASS_7.3-58.3          zlibbioc_1.44.0        org.Hs.eg.db_3.16.0    plyr_1.8.8            
 [69] qvalue_2.30.0          grid_4.2.3             blob_1.2.4             parallel_4.2.3        
 [73] ggrepel_0.9.3          crayon_1.5.2           lattice_0.21-8         graphlayouts_0.8.4    
 [77] Biostrings_2.66.0      cowplot_1.1.1          splines_4.2.3          pillar_1.9.0          
 [81] fgsea_1.24.0           igraph_1.4.2           reshape2_1.4.4         codetools_0.2-19      
 [85] stats4_4.2.3           fastmatch_1.1-3        XML_3.99-0.14          glue_1.6.2            
 [89] ggfun_0.0.9            downloader_0.4         data.table_1.14.8      BiocManager_1.30.20   
 [93] treeio_1.22.0          png_0.1-8              vctrs_0.6.1            tweenr_2.0.2          
 [97] gtable_0.3.3           purrr_1.0.1            polyclip_1.10-4        tidyr_1.3.0           
[101] cachem_1.0.7           ggforce_0.4.1          tidygraph_1.2.3        tidytree_0.4.2        
[105] viridisLite_0.4.1      tibble_3.2.1           aplot_0.1.10           AnnotationDbi_1.60.2  
[109] memoise_2.0.1          IRanges_2.32.0

As you can see, my KEGGREST and PathView are up to date, which seemed to be the issue for similar error messages on other posts. So I am not sure what else is the problem...? Maybe it is my input? These geneIDs match KEGG gene IDs and FYI, this input was used with clusterprofiler's gseKEGG function and it worked.

Example gene_list input here:

Gene_Name   log2Fold
Avin_12104  7.85
Avin_20070  7.56
Avin_11830  5.97
Avin_11860  5.41
Avin_12107  5.12
Avin_12100  5.07
Avin_45290  4.91
Avin_34430  4.89
Avin_03180  4.88
Avin_45300  4.88
Avin_00190  4.80
Avin_11840  4.70
Avin_45280  4.63
Avin_00180  4.62
Avin_45270  4.48
Avin_02940  4.40

Let me know your thoughts!

TIA, Morgan

KEGGREST pathview R • 2.1k views
ADD COMMENT
1
Entering edit mode
Guido Hooiveld ★ 4.1k
@guido-hooiveld-2020
Last seen 11 hours ago
Wageningen University, Wageningen, the …

You forgot to explicitly set the argument gene.idtype to "KEGG" (thus gene.idtype="KEGG").

By default, gene.idtype="entrez", but since you do not work with entrez ids but KEGG ids you obviously have to change this argument. Please note that for many model species the kegg id is equal to the ncbi entrez id, and then the default setting works, but this isn't the case for your organism.

When using the ids you provided, note that you will get another error. This error has another cause; in the input there are apparently no genes that map to the pathway "avn01200".

> library(pathview)
> 
> pathview_genelist <- c("Avin_12104"=7.85,"Avin_20070"=7.56,"Avin_11830"=5.97,"Avin_11860"=5.41,"Avin_12107"=5.12,"Avin_12100"=5.07,
+                        "Avin_45290"=4.91,"Avin_34430"=4.89,"Avin_03180"=4.88,"Avin_45300"=4.88,"Avin_00190"=4.80,"Avin_11840"=4.70,
+                        "Avin_45280"=4.63,"Avin_00180"=4.62,"Avin_45270"=4.48,"Avin_02940"=4.40)
> 
> organism <- "avn"
> 
> avn <- pathview(gene.data=pathview_genelist, pathway.id="avn01200", gene.idtype="KEGG", species = organism)
Note: Mapping via KEGG gene ID (not Entrez) is supported for this species,
it looks like "Avin_39610"!
Warning: None of the genes or compounds mapped to the pathway!
Argument gene.idtype or cpd.idtype may be wrong.
Info: Working in directory E:/test
Info: Writing image file avn01200.pathview.png
Info: some node width is different from others, and hence adjusted!
Error in array(col.rgb[, i], dim(node.rgb)[3:1]) : 
  negative length vectors are not allowed
> 

Yet, if there are genes used as input that map to a pathway, it works! See example below for the Glycolysis / Gluconeogenesis pathway (avn00010) and 4 randomly selected genes from that pathway (https://www.genome.jp/entry/pathway+avn00010).

> test.input <- c("Avin_04130"=5,"Avin_15690"=3,"Avin_38790"=3.5,"Avin_49990"=2)
> 
> avn <- pathview(gene.data=test.input, pathway.id="avn00010", gene.idtype="KEGG", species = organism)
Note: Mapping via KEGG gene ID (not Entrez) is supported for this species,
it looks like "Avin_39610"!
Info: Working in directory E:/test
Info: Writing image file avn00010.pathview.png
>

enter image description here

ADD COMMENT

Login before adding your answer.

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