The kraken2.nf nextflow script will take any number of paired reads in FASTQ format and classify reads using Kraken2.
- Nextflow (24.04.4)
- Java (18.0.2.1)
- Python (3.10)
- Kraken2 (2.1.3)
Create environment using conda:
conda env create -f ./nextflow-pipelines/env/kraken2.yml
Activate conda environment:
conda activate kraken2 or source activate kraken2
#!/bin/bash
# Activate conda environment
conda activate kraken2
# Variables
cpus=20
reads=/path/to/reads/directory
krakenDB=/path/to/krakenDB/
outdir=/path/to/output/directory
# Run pipeline
nextflow run ~/nextflow-pipelines/src/kraken2.nf \
--reads ${reads} \
--suffix "_{1,2}.fq.gz" \
--krakenDB ${krakenDB} \
--outdir ${outdir} \
--cpus ${cpus}
| Parameters | Description |
|---|---|
--reads |
path to input directory containing FASTQ files |
--suffix |
string denoting the suffix after a sample name and the forward (read1) and reverse (read2) designation (e.g. for read pair sampleID_1.fq.gz and sampleID_2.fq.gz set the parameter to --suffix "_{1,2}.fq.gz". The name of this output file will be called sample.kraken) |
--krakenDB |
path to Kraken2 database |
--kraken2 |
string of additional arguments passed to kraken2 (e.g. "--gzip-compressed --minimum-hit-groups 3") |
--outdir |
path to output directory |
--cpus |
integer denoting the number of cpus (default: 16) |
$ ls input/
SampleID_01_1.fq.gz SampleID_02_1.fq.gz
SampleID_01_2.fq.gz SampleID_02_2.fq.gz
$ ls output/
SampleID_01.kraken SampleID_02.kraken
SampleID_01.report SampleID_02.report