richardstoeckl/basecallNanopore
Snakemake Pipeline to automatically basecall Nanopore sequencing data with hybrid approach of simplex and duplex basecalling
Overview
Topics:
Latest release: v1.0.2, Last update: 2024-05-27
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/richardstoeckl/basecallNanopore . --tag v1.0.2
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
.
To configure this workflow, modify config/config.yaml
according to your needs, following the explanations provided in the file.
Here you should provide the paths to your intermediary/results/logs directories. The interim
directory will contain larger intermediary files. The results
directory will contain the final output of the pipeline. The log
directory will be used to store the log files for each step.
Here you should also write the name of your run file (see relevant section below).
Here you should give the paths to your guppy and/or dorado installation. Additionally you should change the given parameters to suit your compute setup.
The setup of the basecall runs is specified via comma-separated values files (.csv
).
Missing values can be specified by empty columns.
Depending on what you enter here, the pipeline will automatically adjust what will be done (e.g. which basecaller will be used and how many barcodes will be used).
You can use the config/runs_test.csv
file as a template.
Linting and formatting
Linting results
Lints for snakefile /tmp/tmpmxvhfajh/richardstoeckl-basecallNanopore-8d272b1/workflow/rules/basecall.smk:
* Absolute path "/{barcode}_readIDs.txt" in line 320:
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
* Mixed rules and functions in same snakefile.:
Small one-liner functions used only once should be defined as lambda
expressions. Other functions should be collected in a common module, e.g.
'rules/common.smk'. This makes the workflow steps more readable.
Also see:
https://snakemake.readthedocs.io/en/latest/snakefiles/modularization.html#includes
Lints for rule guppy_simplex (line 34, /tmp/tmpmxvhfajh/richardstoeckl-basecallNanopore-8d272b1/workflow/rules/basecall.smk):
* Specify a conda environment or container for each rule.:
This way, the used software for each specific step is documented, and the
workflow can be executed on any machine without prerequisites.
Also see:
... (truncated)
Formatting results
[DEBUG]
[DEBUG]
[DEBUG] In file "/tmp/tmpmxvhfajh/richardstoeckl-basecallNanopore-8d272b1/workflow/rules/basecall.smk": Formatted content is different from original
[DEBUG]
[INFO] 1 file(s) would be changed 😬
[INFO] 2 file(s) would be left unchanged 🎉
snakefmt version: 0.10.2