ETH-NEXUS/gExcite_pipeline

single-cell Gene and AnTibody Expression pipeline

Overview

Topics:

Latest release: None, Last update: 2023-05-24

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/ETH-NEXUS/gExcite_pipeline . --tag None

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.

Configuration

Before using the pipeline the following files need to be provided/adapted:

  1. config.yaml
  2. samplemap
  3. HashingFile
  4. featureReferenceFile

config.yaml

Before running the pipeline the config.yaml file needs to be adapted to contain the input and output paths for the intended analysis.

Adaptation necessary for a default run:

  • In section [inputOutput] the input directories input_fastqs_gex, input_fastqs_adt need to point to the location of the respective FASTQ files. This location needs to be specified relative to the gExcite working directory (usually gExcite_pipeline/).
  • In section [resources], reference_transcriptome needs to point to the location of the genomic reference used for the cellranger mapping
  • In sections [tools][cellranger_count_gex] and [tools][cellranger_count_adt], call needs to point to the the path to the cellranger installation
  • Section [computingResources] needs to list the resources that can be assigned to the analysis steps your data and batch system. The example resources specify memory per job, not thread.
  • Section [scampi][resources] needs to be filled with the cell type information, selected genes to show in expression plots, and gene sets for the GSVA analysis.

The default example config file is pointing to the example data input files.

samplemap

Further, a "samplemap" must be provided specifying sample-specific parameters in a tab-delimited text file. A pre-configured samplemap ready to run on the test data that can be adapted is provided in this directory.

Example samplemap:

sample    HashingFile     SeqRunName      nTargetCells    featureReferenceFile
sampleA   HashingFileA    SeqRunNameA     10000           featureReferenceFileA
sampleB   HashingFileB    SeqRunNameB     15000           featureReferenceFileB

With one line per set of samples

  • sample contains the sample identifier that is used throughout the pipeline
  • HashingFile contains the full path to the comma separated text file containing the hashtag barcodes and their assignment to individual sample names (see HashingFile).
  • SeqRunName corresponds to the sequencing sample name of the ADT sample; this parameter is only required for the Cellranger run of ADT data. It can be retrieved from the FASTQ file names as follows:
[SeqRunName]_S[Number]_L00[Lane Number]_[Read Type]_001.fastq.gz

Where Read Type is one of: I1, R1, R2.

  • nTargetCells corresponds to the number of targeted cells for the sample.
  • featureReferenceFile corresponds to the ADT feature reference file for the sample set. For further information please consult the Cellranger tool documentation.
    NOTE: the path to the FeatureReferenceFile must be relative to the gExcite working directory (usually gExcite_pipeline/).

HashingFile

In case of hashed samples, the hashtag barcodes, the hashtag names, and the corresponding sample names must be associated with the sample set. To do so, we need a comma-separated file with the following structure:

Barcode1,TagName1,sampleA
Barcode2,TagName2,sampleB

 featureReferenceFile

The "featureReferenceFile" is a comma-separated text file describing all ADT antibodies used in the experiment at hand. For further information please consult the Cellranger tool documentation.
An example feature_reference.txt ready to run on the test data is available in the testdata directory.

Linting and formatting

Linting results

/home/runner/micromamba-root/envs/snakemake-workflow-catalog/lib/python3.11/site-packages/google/protobuf/internal/api_implementation.py:110: UserWarning: Selected implementation cpp is not available.
  warnings.warn(
Lints for snakefile /tmp/tmp7di3duuu/workflow/rules/misc_snake.smk:
    * Absolute path "/" + samples[" in line 111:
      Do not define absolute paths inside of the workflow, since this renders
      your workflow irreproducible on other machines. Use path relative to the
      working directory instead, or make the path configurable via a config
      file.
      Also see:
      https://snakemake.readthedocs.io/en/latest/snakefiles/configuration.html#configuration
    * Path composition with '+' in line 59:
      This becomes quickly unreadable. Usually, it is better to endure some
      redundancy against having a more readable workflow. Hence, just repeat
      common prefixes. If path composition is unavoidable, use pathlib or
      (python >= 3.6) string formatting with f"...".
      Also see:

    * Path composition with '+' in line 8:
      This becomes quickly unreadable. Usually, it is better to endure some
      redundancy against having a more readable workflow. Hence, just repeat

... (truncated)

Formatting results

[DEBUG] 
[DEBUG] 
[DEBUG] 
[DEBUG] 
[ERROR] In file "/tmp/tmp7di3duuu/workflow/rules/cohort_adt_analysis.smk":  NameError: name 'gatherCellrangerADTFolder' is not defined
[DEBUG] In file "/tmp/tmp7di3duuu/workflow/rules/cohort_adt_analysis.smk":  
[DEBUG] 
[DEBUG] In file "/tmp/tmp7di3duuu/workflow/rules/gex_cellranger.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp7di3duuu/workflow/rules/misc_snake.smk":  Formatted content is different from original
[DEBUG] 
[INFO] 1 file(s) raised parsing errors 🤕
[INFO] 2 file(s) would be changed 😬
[INFO] 5 file(s) would be left unchanged 🎉

snakefmt version: 0.8.4