epigen/enrichment_analysis

A Snakemake workflow and MrBiomics module for performing genomic region set and gene set enrichment analyses using LOLA, GREAT, GSEApy, pycisTarget and RcisTarget.

Overview

Topics: bioinformatics genomic-regions enrichment-analysis atac-seq biomedical-data-science chip-seq gene-set-enrichment gene-sets rna-seq visualization pipeline snakemake workflow motif-enrichment-analysis

Latest release: v2.0.0, Last update: 2024-12-19

Linting: linting: failed, Formatting:formatting: failed

Deployment

Step 1: Install Snakemake and Snakedeploy

Snakemake and Snakedeploy are best installed via the Mamba package manager (a drop-in replacement for conda). If you have neither Conda nor Mamba, it is recommended to install Miniforge. More details regarding Mamba can be found here.

When using Mamba, run

mamba create -c conda-forge -c bioconda --name snakemake snakemake snakedeploy

to install both Snakemake and Snakedeploy in an isolated environment. For all following commands ensure that this environment is activated via

conda activate snakemake

Step 2: Deploy workflow

With Snakemake and Snakedeploy installed, the workflow can be deployed as follows. First, create an appropriate project working directory on your system and enter it:

mkdir -p path/to/project-workdir
cd path/to/project-workdir

In all following steps, we will assume that you are inside of that directory. Then run

snakedeploy deploy-workflow https://github.com/epigen/enrichment_analysis . --tag v2.0.0

Snakedeploy will create two folders, workflow and config. The former contains the deployment of the chosen workflow as a Snakemake module, the latter contains configuration files which will be modified in the next step in order to configure the workflow to your needs.

Step 3: Configure workflow

To configure the workflow, adapt config/config.yml to your needs following the instructions below.

Step 4: Run workflow

The deployment method is controlled using the --software-deployment-method (short --sdm) argument.

To run the workflow with automatic deployment of all required software via conda/mamba, use

snakemake --cores all --sdm conda

Snakemake will automatically detect the main Snakefile in the workflow subfolder and execute the workflow module that has been defined by the deployment in step 2.

For further options such as cluster and cloud execution, see the docs.

Step 5: Generate report

After finalizing your data analysis, you can automatically generate an interactive visual HTML report for inspection of results together with parameters and code inside of the browser using

snakemake --report report.zip

Configuration

The following section is imported from the workflow’s config/README.md.

You need one configuration file and one annotation file to run the complete workflow. You can use the provided example as starting point. If in doubt read the comments in the config and/or try the default values.

  • project configuration (config/config.yaml): different for every project/dataset and configures the analyses to be performed and databases to be used. The fields are described within the file.
  • annotation: CSV file consisting of 5 mandatory columns
    • name: unique(!) name of the query gene/region set
    • features_path: one of the following
      • path to a query region set as .bed file -> will be analyzed using LOLA, GREAT, pycisTarget and ORA_GSEApy, RcisTarget (using the region-gene association provided by GREAT)
      • path to a query gene set as .txt file with one gene per line -> will be analyzed using ORA_GSEApy and RcisTarget
      • path to a query (preranked) gene-score table with a header as .csv file, where the first column consists of gene-symbols/names and the second of corresponding gene-scores (e.g., from differential expression analysis results) -> will be analyzed using preranked_GSEApy
    • background_name: name of the background gene/region set (only required for region- and gene-sets, leave empty for gene-score tables)
    • background_path: path to the background/universe gene/region-set as .txt/.bed file (only required for region- and gene-sets, leave empty for gene-score tables)
    • group: enrichment results are aggregated and visualized per analysis and database based on this group variable (e.g., gene/region-sets resulting from the same analysis)

Set workflow-specific resources or command line arguments (CLI) in the workflow profile workflow/profiles/default.config.yaml, which supersedes global Snakemake profiles.

Linting and formatting

Linting results

Using workflow specific profile workflow/profiles/default for setting default command line arguments.
FileNotFoundError in file /tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/Snakefile, line 29:
[Errno 2] No such file or directory: '/path/to/enrichment_analysis_annotation.csv'
  File "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/Snakefile", line 29, in <module>
  File "/home/runner/micromamba/envs/snakemake-workflow-catalog/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
  File "/home/runner/micromamba/envs/snakemake-workflow-catalog/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 620, in _read
  File "/home/runner/micromamba/envs/snakemake-workflow-catalog/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1620, in __init__
  File "/home/runner/micromamba/envs/snakemake-workflow-catalog/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
  File "/home/runner/micromamba/envs/snakemake-workflow-catalog/lib/python3.12/site-packages/pandas/io/common.py", line 873, in get_handle

Formatting results

[DEBUG] 
[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/resources.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/enrichment_analysis.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/common.smk":  Formatted content is different from original
[DEBUG] 
[ERROR] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/aggregate.smk":  InvalidPython: Black error:

Cannot parse for target version Python 3.12: 21:10: resources:

(Note reported line number may be incorrect, as snakefmt could not determine the true line number)


[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/aggregate.smk":  
[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/Snakefile":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp4dm_gnm8/epigen-enrichment_analysis-e8a14b0/workflow/rules/envs_export.smk":  Formatted content is different from original
[INFO] 1 file(s) raised parsing errors 🤕
[INFO] 5 file(s) would be changed 😬

... (truncated)