MarieRiisgaard/snakemake_usearch_primertrim_and_subset

None

Overview

Latest release: None, Last update: 2025-10-24

Linting: linting: failed, Formatting: formatting: failed

Deployment

Step 1: Install Snakemake and Snakedeploy

Snakemake and Snakedeploy are best installed via the Conda. It is recommended to install conda via Miniforge. Run

conda create -c conda-forge -c bioconda -c nodefaults --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

For other installation methods, refer to the Snakemake and Snakedeploy documentation.

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/MarieRiisgaard/snakemake_usearch_primertrim_and_subset . --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.

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

The configuration file config.yaml is used to set various options used throughout the workflow.

Option

Default value

Description

input_dir

"data/"

The input folder is expected to contain a subfolder for each sampleID/barcode, in which all fastq files will be concatenated, and the subfolder names used as sample IDs downstream. For nanopore this is usually the “fastq_pass” folder with demultiplexed reads.

output_dir

"output"

Folder for the results.

tmp_dir

"tmp"

Folder for temporary files, which are deleted by default after a succesful run.

log_dir

"logs"

Folder for logs for each rule.

db_sintax

"/databases/midas/MiDAS5.3_20240320/FLASVs_w_sintax.fa"

Path to the taxonomic reference database used to classify the ASVs/zOTUs in SINTAX format.

filtlong_args

"--min_length 200 --min_mean_q 90"

Arguments for the filtlong command used for pre-filtering. To skip filtering altogether set to "--min_length 1".

max_threads

32

Max number of threads to use for any individual rule.

sample_sep

"_"

Separator used for the usearch -otutab and fastx_relabel commands.

primers

AGRGTTYGATYMTGGCTCAG...GTTTGGCACCTCGATGTCG"

Primer pair used. Passed on as-is to the cutadapt command. This is required for trimming and orienting reads correctly.

derep_minsize

2

Minimum abundance of each read. This is only to speed up ASV/zOTU generation, it will not impact abundance estimation.

unoise_minsize

8

Increase this proportionally with platform error-rate to avoid false-positive de-novo ASVs/zOTUs. Never set to anything lower than 2 (or derep_minsize) to ensure that singletons are removed.

rarefy_abund_table

False

Whether to also produce a rarefied abundance table or not.

rarefy_sample_size

2000

Rarefy abundance table to an equal sample size. Both a rarefied and an unrarefied abundance table will be generated.

Have a look in the .test directory for minimal example files.

Linting and formatting

Linting results

 1Lints for snakefile /tmp/tmp57o0pks4/workflow/rules/04-denoise.smk:
 2    * Mixed rules and functions in same snakefile.:
 3      Small one-liner functions used only once should be defined as lambda
 4      expressions. Other functions should be collected in a common module, e.g.
 5      'rules/common.smk'. This makes the workflow steps more readable.
 6      Also see:
 7      https://snakemake.readthedocs.io/en/latest/snakefiles/modularization.html#includes
 8    * Path composition with '+' in line 2:
 9      This becomes quickly unreadable. Usually, it is better to endure some
10      redundancy against having a more readable workflow. Hence, just repeat
11      common prefixes. If path composition is unavoidable, use pathlib or
12      (python >= 3.6) string formatting with f"...".
13
14Lints for rule subsample_reads (line 5, /tmp/tmp57o0pks4/workflow/rules/03-subsample.smk):
15    * Shell command directly uses variable config from outside of the rule:
16      It is recommended to pass all files as input and output, and non-file
17      parameters via the params directive. Otherwise, provenance tracking is
18      less accurate.
19      Also see:
20      https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#non-file-parameters-for-rules
21
22Lints for rule merge_subsample_summaries (line 56, /tmp/tmp57o0pks4/workflow/rules/03-subsample.smk):
23    * Specify a conda environment or container for each rule.:
24      This way, the used software for each specific step is documented, and the
25      workflow can be executed on any machine without prerequisites.
26      Also see:
27      https://snakemake.readthedocs.io/en/latest/snakefiles/deployment.html#integrated-package-management
28      https://snakemake.readthedocs.io/en/latest/snakefiles/deployment.html#running-jobs-in-containers
29    * Shell command directly uses variable config from outside of the rule:
30      It is recommended to pass all files as input and output, and non-file
31      parameters via the params directive. Otherwise, provenance tracking is
32      less accurate.
33      Also see:
34      https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#non-file-parameters-for-rules
35    * Shell command directly uses variable config from outside of the rule:
36      It is recommended to pass all files as input and output, and non-file
37      parameters via the params directive. Otherwise, provenance tracking is
38      less accurate.
39      Also see:
40      https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#non-file-parameters-for-rules
41    * Shell command directly uses variable config from outside of the rule:
42      It is recommended to pass all files as input and output, and non-file
43      parameters via the params directive. Otherwise, provenance tracking is
44      less accurate.
45      Also see:
46      https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#non-file-parameters-for-rules

Formatting results

 1[DEBUG] 
 2[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/01-sample_prep.smk":  Formatted content is different from original
 3[DEBUG] 
 4[DEBUG] 
 5[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/06-append_asv_counts.smk":  Formatted content is different from original
 6[DEBUG] 
 7[DEBUG] In file "/tmp/tmp57o0pks4/workflow/Snakefile":  Formatted content is different from original
 8[DEBUG] 
 9[DEBUG] 
10[DEBUG] 
11[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/05-sintax.smk":  Formatted content is different from original
12[DEBUG] 
13[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/04-denoise.smk":  Formatted content is different from original
14[DEBUG] 
15[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/03-subsample.smk":  Formatted content is different from original
16[DEBUG] 
17[DEBUG] In file "/tmp/tmp57o0pks4/workflow/rules/02-primertrim.smk":  Formatted content is different from original
18[INFO] 7 file(s) would be changed 😬
19[INFO] 3 file(s) would be left unchanged 🎉
20
21snakefmt version: 0.11.2