Bioconductor / GenomicDataCommons

Provide R access to the NCI Genomic Data Commons portal.
http://bioconductor.github.io/GenomicDataCommons/
83 stars 23 forks source link

Error in bind_rows, when the diagnosis dataframe is NULL #109

Closed zx8754 closed 1 year ago

zx8754 commented 1 year ago

Try this code:

library(GenomicDataCommons)
patient_data = gdc_clinical(c("7f08f522-08ff-4b30-aa5b-e69cf15041c9",
                              "ae8d1ed6-2ddf-47b0-8099-bbc9230b499e"))

# Error in FUN(X[[i]], ...) : is.data.frame(df) is not TRUE

I traced down the issue to these lines within gdc_clinical:

diagnoses <- suppressMessages({
    bind_rows(lapply(resp$results$diagnoses, readr::type_convert), 
      .id = "case_id")
  })

For those 2 case_ids, 1st one returns NULL, 2nd a dataframe, then as expected _bindrows fails.

> lapply(resp$results$diagnoses, is.null)
$`7f08f522-08ff-4b30-aa5b-e69cf15041c9`
[1] TRUE

$`ae8d1ed6-2ddf-47b0-8099-bbc9230b499e`
[1] FALSE

Session:

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

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

other attached packages:
[1] GenomicDataCommons_1.22.0 magrittr_2.0.3           

loaded via a namespace (and not attached):
 [1] rstudioapi_0.14        xml2_1.3.3            
 [3] XVector_0.38.0         hms_1.1.2             
 [5] rappdirs_0.3.3         GenomicRanges_1.50.2  
 [7] BiocGenerics_0.44.0    zlibbioc_1.44.0       
 [9] IRanges_2.32.0         tidyselect_1.2.0      
[11] R6_2.5.1               rlang_1.0.6           
[13] fansi_1.0.4            httr_1.4.4            
[15] GenomeInfoDb_1.34.4    dplyr_1.0.10          
[17] tools_4.2.2            utf8_1.2.2            
[19] DBI_1.1.3              cli_3.6.0             
[21] ellipsis_0.3.2         assertthat_0.2.1      
[23] tibble_3.1.8           lifecycle_1.0.3       
[25] GenomeInfoDbData_1.2.9 tzdb_0.3.0            
[27] readr_2.1.3            vctrs_0.5.2           
[29] S4Vectors_0.36.1       bitops_1.0-7          
[31] curl_5.0.0             RCurl_1.98-1.9        
[33] glue_1.6.2             compiler_4.2.2        
[35] pillar_1.8.1           generics_0.1.3        
[37] stats4_4.2.2           jsonlite_1.8.4        
[39] pkgconfig_2.0.3       
LiNk-NY commented 1 year ago

Thank you for reporting! It should be fixed in devel 1.23.2 and 1.22.1 in release. Best, Marcel