BaderLab / EnrichmentMapApp

The EnrichmentMap Cytoscape App allows you to visualize the results of gene-set enrichment as a network.
http://apps.cytoscape.org/apps/enrichmentmap
GNU Lesser General Public License v2.1
31 stars 12 forks source link

API command enrichmentmap dataset color returns error #463

Closed rosscm closed 2 years ago

rosscm commented 3 years ago

Hello,

When trying to specify data set colours via the new CyREST API command enrichmentmap dataset color, I'm returned with the error Error: no colors specified. I'm using the latest EnrichmentMap version 3.3.2.

Commands tried:

# dataset names are femap_FASN_negative and femap_FASN_positive
# attempt 1
> col_command <- "enrichmentmap dataset color colors=femap_FASN_negative=#224433,femap_FASN_positive=#887766"
> response <- commandsPOST(col_command)
Failed to execute: http://127.0.0.1:1234/v1/commands/enrichmentmap/dataset%20color
Error: no colors specified

# attempt 2 (filling space with '?')
> col_command <- "enrichmentmap dataset color?colors=femap_FASN_negative=#224433,femap_FASN_positive=#887766"
> response <- commandsPOST(col_command)
Failed to execute: http://127.0.0.1:1234/v1/commands/enrichmentmap/dataset%20color?colors=DataSet1=#224433,DataSet2=#887766
Error: no colors specified

# attempt 3
> col_command <- "enrichmentmap dataset color colors='femap_FASN_negative=#224433,femap_FASN_positive=#887766'"
> response <- commandsPOST(col_command)
Failed to execute: http://127.0.0.1:1234/v1/commands/enrichmentmap/dataset%20color
Error: Chunk ['] is not a valid entry
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

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

other attached packages:
[1] RCy3_2.12.0      ggplot2_3.3.3    tidyr_1.1.3      dplyr_1.0.6     
[5] fedup_1.0.0      BiocCheck_1.28.0 devtools_2.4.1   usethis_2.0.1   
[9] colorout_1.2-2  

loaded via a namespace (and not attached):
 [1] bitops_1.0-7        matrixStats_0.58.0  fs_1.5.0           
 [4] RColorBrewer_1.1-2  httr_1.4.2          rprojroot_2.0.2    
 [7] repr_1.1.3          tools_4.1.0         backports_1.2.1    
[10] utf8_1.2.1          R6_2.5.0            DBI_1.1.1          
[13] BiocGenerics_0.38.0 colorspace_2.0-1    withr_2.4.2        
[16] uchardet_1.1.0      tidyselect_1.1.1    prettyunits_1.1.1  
[19] processx_3.5.2      curl_4.3.1          compiler_4.1.0     
[22] graph_1.70.0        cli_2.5.0           Biobase_2.52.0     
[25] desc_1.3.0          scales_1.1.1        callr_3.7.0        
[28] RBGL_1.68.0         pbdZMQ_0.3-5        stringr_1.4.0      
[31] digest_0.6.27       R.utils_2.10.1      stringdist_0.9.6.3 
[34] base64enc_0.1-3     pkgconfig_2.0.3     htmltools_0.5.1.1  
[37] sessioninfo_1.1.1   fastmap_1.1.0       ggthemes_4.2.4     
[40] rlang_0.4.11        generics_0.1.0      jsonlite_1.7.2     
[43] zip_2.1.1           R.oo_1.24.0         RCurl_1.98-1.3     
[46] magrittr_2.0.1      Matrix_1.3-3        Rcpp_1.0.6         
[49] IRkernel_1.2        munsell_0.5.0       fansi_0.5.0        
[52] lifecycle_1.0.0     R.methodsS3_1.8.1   stringi_1.6.2      
[55] MASS_7.3-54         RJSONIO_1.3-1.4     pkgbuild_1.2.0     
[58] biocViews_1.60.0    plyr_1.8.6          grid_4.1.0         
[61] parallel_4.1.0      forcats_0.5.1       crayon_1.4.1       
[64] lattice_0.20-44     IRdisplay_1.0       knitr_1.33         
[67] ps_1.6.0            pillar_1.6.1        igraph_1.2.6       
[70] optparse_1.6.6      uuid_0.1-4          RUnit_0.4.32       
[73] base64url_1.4       codetools_0.2-18    stats4_4.1.0       
[76] pkgload_1.2.1       XML_3.99-0.6        glue_1.4.2         
[79] evaluate_0.14       data.table_1.14.0   remotes_2.3.0      
[82] BiocManager_1.30.15 png_0.1-7           vctrs_0.3.8        
[85] testthat_3.0.2      gtable_0.3.0        getopt_1.20.3      
[88] purrr_0.3.4         assertthat_0.2.1    cachem_1.0.5       
[91] openxlsx_4.2.3      xfun_0.23           signal_0.7-7       
[94] tibble_3.1.2        dplR_1.7.2          memoise_2.0.0      
[97] ellipsis_0.3.2     
mikekucera commented 3 years ago

Try surrounding the argument with double quotes, which will need to be escaped...

col_command <- "enrichmentmap dataset color colors=\"femap_FASN_negative=#224433,femap_FASN_positive=#887766\""

rosscm commented 3 years ago

Same problem

> col_command <- "enrichmentmap dataset color colors=\"femap_FASN_negative=#224433,femap_FASN_positive=#887766\""
> response <- commandsPOST(col_command)
Failed to execute: http://127.0.0.1:1234/v1/commands/enrichmentmap/dataset%20color
Error: no colors specified
mikekucera commented 3 years ago

There appears to be a bug in RCy3 where commandsPOST() doesn't correctly parse the '=' inside the colors argument.

I was able to get it to work by using commandsRun() and URL encoding all the special characters in the argument (my datasets are named enrichments_A and enrichments_B)...

commandsRun("enrichmentmap dataset color colors=\"enrichments_A%3D%23AA0000%2Cenrichments_B%3D%2300AA00\"")