theMILOlab / SPATA2

A Toolbox for Spatial Transcriptomics Analysis
https://themilolab.github.io/SPATA2/
91 stars 16 forks source link

Error while running the runGSEA() function #25

Closed dtonmoy closed 2 years ago

dtonmoy commented 2 years ago

Hi, I was trying the runGSEA() function mentioned here in the section 2. It seems the function should be runGSEA() instead of runGsea() mentioned in the website. Each time I run the function, I get some error. My command:

spata_obj <- runGSEA(object = spata_obj, 
                     across = "seurat_clusters",
                     methods_de = "wilcox")

Error message:

11:08:14 Using default gene set list.
11:10:58 Calculating enrichment of signatures across 'seurat_clusters' (n = 11). Based on results of method 'wilcox'.
11:10:58 Working on group: '0' (1/11)
Error in FUN(X[[i]], ...) : 
  cannot coerce type 'closure' to vector of type 'character'

Can you please check it out and let me know what might be the problem here?

kueckelj commented 2 years ago

Hi dtonmoy, unfortunately I can not reproduce the error. I am aware of it thoug as I am recieving this error message, too, from time to time. However, I haven't figured out yet what actually causes the problem because sometimes it works and sometimes it does not. I Could you try it with a different sample as well as with different de methods? And tell me what does work and what doesn't?

I'll have a deeper look into it now.

(You are right about the naming issue. Thanks for mentioning it. I've changed the function name after generating the HTML file for the tutorial. I'll upload the option to use runGsea().)

kueckelj commented 2 years ago

To accelerate the process I've created a new branch in SPATA2. Could you install this one with devtools::install_github("theMILOlab/SPATA2", "runGSEA_debug") ? Once you've done that runGSEA() should print out additional messages regarding the computational steps (Step 1, Step 2, Step 3 etc.). Could you run the function again and tell me after which step the function throws the error message?

I need your help with this one as I can not reproduce the error with my spatial transcriptomic samples.

dtonmoy commented 2 years ago

Hi Jan, It seems the problem is in the Step 1. Error message:

16:45:04 Using default gene set list.
16:47:53 Calculating enrichment of signatures across 'seurat_clusters' (n = 6). Based on results of method 'wilcox'.
16:47:53 Working on group: '0' (1/6)
Step 1
Error in FUN(X[[i]], ...) : 
  cannot coerce type 'closure' to vector of type 'character'

I have tried running the function on three of my samples as well as with different de methods. However, same error is occurring each of the time.

kueckelj commented 2 years ago

Okay. This means that the error is thrown within the function hypeR::hypeR(). I'll talk to the developers of the package what exactly the problem might be. I come back to you once I know more.

kueckelj commented 2 years ago

The function runGSEA() takes an argument called 'quiet'. Could you set it to FALSE and run the function again. Does it print any information or does it crash beforehand?

dtonmoy commented 2 years ago

Here is the output:

18:12:04 Using default gene set list.
18:14:41 Calculating enrichment of signatures across 'seurat_clusters' (n = 6). Based on results of method 'wilcox'.
18:14:41 Working on group: '0' (1/6)
Step 1
Signature size: 50
Number of genesets: 11657
Percentage of signature found across genesets: 0.98% 
Background population size: 19646 
P-Value cutoff: 1 
FDR cutoff: 1
Error in FUN(X[[i]], ...) : 
  cannot coerce type 'closure' to vector of type 'character'
In addition: Warning messages:
1: In initialize(...) :
  Describing genesets with a name will aid reproducibility
2: In initialize(...) :
  Including a version number will aid reproducibility
kueckelj commented 2 years ago

I have changed the code. Can you reinstall the debug branch and check if it works now?

dtonmoy commented 2 years ago

Wow!! It's working perfectly fine now!!

kueckelj commented 2 years ago

Great. I've merged the branch and deleted the debugging branch. It would be best if you switch back to the master branch by installing it. The function is fixed there and should work.

kueckelj commented 2 years ago

Let me know if the function works there. Then I'll close this issue.

dtonmoy commented 2 years ago

The master branch is working perfectly. Thank you so much!!!

kueckelj commented 2 years ago

Great!