solgenomics / sgn

The code behind the Sol Genomics Network, Cassavabase and other Breedbase websites
https://solgenomics.net
MIT License
67 stars 35 forks source link

Error on extracting data using R #4980

Open chris263 opened 3 weeks ago

chris263 commented 3 weeks ago

Expected Behavior

Extract data with R package QBMS use to be very efficient, however it is not working any more. QBMS still in the same version 1.0 (However, we moved Breedbase to the new version R 4.4).

This is the error

set_qbms_config("https://cassavabase.org/brapi/v2", no_auth = TRUE, engine = "breedbase") list_crops() [1] "Cassava" set_crop("Cassava") list_programs() ## The problem happens here Error: lexical error: invalid char in json text. <?xml version="1.0" encoding="U (right here) ------^

For Bugs:

Environment

Steps to Reproduce

nmenda commented 1 week ago

@chris263 do you see this on your localhost? Or on one of the servers too?

chris263 commented 1 week ago

Hey Naama, I've tested on cassava, sweetpotato and other private bases. The example code I added before is on cassavabase. It didn't work in any of the tested bases.

dwaring87 commented 1 week ago

@chris263 It looks like QBMS will add the crop name to the BrAPI URL when you use the set_crop() function. Try the same code without the set_crop call and it should work.

chris263 commented 1 week ago

Hey @dwaring87 , I tried without set_crop, but it returns an error: Error in list_programs() : No crop has been selected yet! You have to set your crop first using the set_crop() function

The code to extract data, including set_crop(), is working on previous R version 4.2.2, but not in R4.4

dwaring87 commented 1 week ago

Strange, it works for me with R version 4.4.1 and QBMS version 1.0.0

> library(QBMS)                                                                                                                     
> set_qbms_config("https://cassavabase.org/brapi/v2", no_auth = TRUE, engine = "breedbase")                                         
> list_programs()                                                                                                                   
       programName                                                                                                                  
1              5CP                                                                                                                  
2              BTI                                                                                                                  
3             CARI                                                                                                                  
4               CH                                                                                                                  
5             CIAT                                                                                                                  
6     CIP-genebank                                                                                                                  
7             CNRA                                                                                                                  
8          Cornell                                                                                                                  
9             CSIR                                                                                                                  
10         Embrapa                                                                                                                  
11           IDIAF                                                                                                                  
12            IITA                                                                                                                  
13  INERA_IITA_DRC                                                                                                                  
14           ISABU                                                                                                                  
15             ITC                                                                                                                  
16           KALRO                                                                                                                  
17              KU                                                                                                                  
18          NaCRRI                                                                                                                  
19           NRCRI                                                                                                                  
20          Rayong
21           SLARI
22            TARI
23             UAC
24              UH
25 UNILA-Indonesia
26            ZARI
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

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

time zone: America/New_York
tzcode source: system (glibc)

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

other attached packages:
[1] QBMS_1.0.0

loaded via a namespace (and not attached):
[1] httr_1.4.7     compiler_4.4.1 R6_2.5.1       curl_5.2.1     jsonlite_1.8.8