romanhaa/cerebroApp

getEnrichedPathways error: Data returned by Enrichr for subgroup `1` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.

Closed this issue · 6 comments

I was getting error when testing the demo data (pbmc_raw.txt):

seurat <- cerebroApp::getEnrichedPathways(
+   seurat,
+   marker_genes_input = 'cerebro_seurat',
+   adj_p_cutoff = 1,
+   max_terms = 1000
+ )

[12:23:38] Found 2 groups: cluster, cell_type_singler_blueprintencode_main
[12:23:38] Get enriched pathways for group `cluster`...
[12:23:48] Data returned by Enrichr for subgroup `1` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:23:56] Data returned by Enrichr for subgroup `2` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:04] Data returned by Enrichr for subgroup `3` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:12] Data returned by Enrichr for subgroup `4` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:20] Data returned by Enrichr for subgroup `5` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:28] Data returned by Enrichr for subgroup `6` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:37] Data returned by Enrichr for subgroup `7` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:45] Data returned by Enrichr for subgroup `8` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:24:53] Data returned by Enrichr for subgroup `9` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:02] Data returned by Enrichr for subgroup `10` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:10] Data returned by Enrichr for subgroup `11` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:18] Data returned by Enrichr for subgroup `12` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:26] Data returned by Enrichr for subgroup `13` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:34] Data returned by Enrichr for subgroup `14` of group `cluster`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:34] 0 pathways passed the threshold across all group levels and databases for group `cluster`.
[12:25:34] Get enriched pathways for group `cell_type_singler_blueprintencode_main`...
[12:25:43] Data returned by Enrichr for subgroup `Epithelial cells` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:51] Data returned by Enrichr for subgroup `Neurons` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:25:59] Data returned by Enrichr for subgroup `HSC` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:26:07] Data returned by Enrichr for subgroup `Mesangial cells` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:26:15] Data returned by Enrichr for subgroup `Fibroblasts` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:26:22] Data returned by Enrichr for subgroup `Erythrocytes` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:26:30] Data returned by Enrichr for subgroup `Adipocytes` of group `cell_type_singler_blueprintencode_main`, does not appear to be in the right format. Will proceed with next subgroup.
[12:26:30] 0 pathways passed the threshold across all group levels and databases for group `cell_type_singler_blueprintencode_main`.

then I tried .send_enrichr_query, from https://rdrr.io/github/romanhaa/cerebroApp/src/R/send_enrichr_query.r

try(
  data_from_enrichr <- .send_enrichr_query(
    marker_genes_current_group_level,
    databases = databases, URL_API = URL_API
  )
)

and got this:

> data_from_enrichr
$GO_Biological_Process_2018
               X.
1 "expired": true
2               }

$GO_Cellular_Component_2018
               X.
1 "expired": true
2               }

> !is.list(data_from_enrichr)
[1] FALSE
> databases[1] %in% names(data_from_enrichr) == FALSE
[1] FALSE
> 'Adjusted.P.value' %in% colnames(data_from_enrichr[[1]]) == FALSE
[1] TRUE

then I tried

r <- httr::GET(
+     url = 'http://amp.pharm.mssm.edu/Enrichr/export',
+     query = list(
+         file = 'API',
+         backgroundType = x
+     )
+ )

> r
Response [https://maayanlab.cloud/Enrichr/export?file=API&backgroundType=14]
  Date: 2021-02-23 02:20
  Status: 200
  Content-Type: application/json;charset=UTF-8
  Size: 20 B
{
"expired": true
}

> r$content
 [1] 7b 0a 22 65 78 70 69 72 65 64 22 3a 20 74 72 75 65 0a 7d 0a

I was able to get result via clusterProfiler, so I guess the gene list is able to generate the result. I have also compared with https://rdrr.io/github/whtns/seuratTools/src/R/enrichment.R, but I have no idea what went wrong with the format.

Hi @zoe106! Thank you for reporting this issue. I'll look into it and try to understand what's going wrong.

This should now be fixed in the develop branch. The fix will be included in the next update.

Thanks again for bringing this to my attention. Enrichr changed the API address which needed to be adjusted in the code. With the update, changing the API address in the call to getEnrichedPathways() should work properly (I forgot to use the user-provided API address in all places).

In my local tests, it now works as expected. Please let me know if the issue remains.

Hi Roman, This is a great tool to play around with scRNA-seq data analyses. Thanks! I was trying to install the develop branch without success using this;
githubinstall::gh_install_packages("cerebroApp", ref = "develop")

This lists the following options:
`Select a number or, hit 0 to cancel.

1: agaye/ceeComp A collection of R functions used by Centre for Environmental Risk Management of Bushfires, University of Wollongong
2: dkneis/rodeoApp A collection of R functions used by Centre for Environmental Risk Management of Bushfires, University of Wollongong
3: mbedward/cermbTools A collection of R functions used by Centre for Environmental Risk Management of Bushfires, University of Wollongong`

Is there another way to install the develop version? Thanks!

Can you try installing it with this command: BiocManager::install('romanhaa/cerebroApp@develop')? For me, that worked.

I installed it without a problem and ran a getEnrichmentPathways without an issue. Thanks for the prompt reply man. I really hope you incorporate more features such as, comparison analyses of integrated objects and ligand-receptor pair analyses (from cellphoneDB or NATMI). All the best!!!

Hello romanhaa, the updated develop version works perfect. Thank you very much for this amazing tool.