epigen / enrichment_analysis

A Snakemake workflow for performing genomic region set and gene set enrichment analyses using LOLA, GREAT, GSEApy, pycisTarget and RcisTarget.
https://epigen.github.io/enrichment_analysis/
MIT License
22 stars 1 forks source link

Error in rule gene_ORA_GSEApy: jobid: 31, raise ValueError("No objects to concatenate") #6

Closed sandragold closed 1 year ago

sandragold commented 1 year ago

Hi!

Do you have an idea why your pipeline fails always on this step? :) I've tried 2 different inputs and there is always problem on that step 32 of 81.

Below is the part of the console output with the error message:

`Warning message:
package ‘svglite’ was built under R version 4.1.3 
[Fri May 26 18:19:55 2023]
Finished job 22.
32 of 81 steps (40%) done
Select jobs to execute...

[Fri May 26 18:19:55 2023]
rule gene_ORA_GSEApy:
    input: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/UP_sorted_cyto_from_10kb_bins.bed/GREAT/genes.txt, /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/background/GREAT/genes.txt, resources/Sorted_cyto_from_bins_2_run/MyDB.json
    output: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/UP_sorted_cyto_from_10kb_bins.bed/ORA_GSEApy/MyDB/UP_sorted_cyto_from_10kb_bins.bed_MyDB.csv
    log: logs/rules/gene_ORA_GSEApy_UP_sorted_cyto_from_10kb_bins.bed_MyDB.log
    jobid: 31
    reason: Missing output files: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/UP_sorted_cyto_from_10kb_bins.bed/ORA_GSEApy/MyDB/UP_sorted_cyto_from_10kb_bins.bed_MyDB.csv; Input files updated by another job: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/UP_sorted_cyto_from_10kb_bins.bed/GREAT/genes.txt, /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/background/GREAT/genes.txt
    wildcards: gene_set=UP_sorted_cyto_from_10kb_bins.bed, db=MyDB
    resources: tmpdir=/tmp, mem_mb=32000

python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))"
Activating conda environment: .snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_
python /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/scripts/tmp49w6b_kb.gene_ORA_GSEApy.py
Activating conda environment: .snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_
2023-05-26 18:19:57,009 [INFO] Input dict object named with gs_ind_0
2023-05-26 18:19:57,009 [INFO] Run: gs_ind_0 
2023-05-26 18:19:57,010 [INFO] No hits return, for gene set: Custom140555313936960
Traceback (most recent call last):
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/scripts/tmp49w6b_kb.gene_ORA_GSEApy.py", line 91, in <module>
    res = gp.enrich(gene_list=gene_list,
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_/lib/python3.9/site-packages/gseapy/__init__.py", line 607, in enrich
    enr.run()
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_/lib/python3.9/site-packages/gseapy/enrichr.py", line 534, in run
    self.results = pd.concat(self.results, ignore_index=True)
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 274, in concat
    op = _Concatenator(
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_/lib/python3.9/site-packages/pandas/core/reshape/concat.py", line 331, in __init__
    raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate
[Fri May 26 18:19:57 2023]
Error in rule gene_ORA_GSEApy:
    jobid: 31
    output: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/results/enrichment_analysis/UP_sorted_cyto_from_10kb_bins.bed/ORA_GSEApy/MyDB/UP_sorted_cyto_from_10kb_bins.bed_MyDB.csv
    log: logs/rules/gene_ORA_GSEApy_UP_sorted_cyto_from_10kb_bins.bed_MyDB.log (check log file(s) for error message)
    conda-env: /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_

RuleException:
CalledProcessErrorin line 65 of /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/workflow/rules/enrichment_analysis.smk:
Command 'source /mnt/polkanowa2/programs/bin/activate '/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/conda/db2069d06c67e34fe0d5f2324aefa1c9_'; set -eo pipefail; python /mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/.snakemake/scripts/tmp49w6b_kb.gene_ORA_GSEApy.py' returned non-zero exit status 1.
  File "/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis/workflow/rules/enrichment_analysis.smk", line 65, in __rule_gene_ORA_GSEApy
  File "/mnt/polkanowa2/programs/lib/python3.9/concurrent/futures/thread.py", line 58, in run
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2023-05-26T181430.372545.snakemake.log
(base) root@SRV602-88C9:/mnt/polkanowa2/Cytometh_Bartosz/enrichment_analysis/enrichment_analysis# `

Here is attached the log file. 2023-05-26T181430.372545.snakemake.log

Please let me know if you need anything else! Thanks Sandra

sreichl commented 1 year ago

Hi Sandra, yes, I actually know what is happening. There is a bug in GSEApy when there is literally no result of the analysis (i.e., not only nothing significant, but truly an empty result). I recently also faced this error and circumvented it in my latest commit using exception handling specifically for ValueErrors.

This should resolve the problem for you as well. In that case, please close the issue.

Cheers, Stephan

PS: If you find the workflow useful please consider Starring it, thanks!

sandragold commented 1 year ago

It worked, thank you! :)