I'm trying to loop kraken2 through a directory full of .fastq.gz files
e.g.
- file1.fastq.gz
- file2.fastq.gz
- file3.fastq.gz
- ...
- fileN.fastq.gz
using
for FILE in path/to/fastq/files/directory/*
do
OUT=$(basename $FILE) kraken2 --db path/to/16S_SILVA138_k2db --threads 12 --use-names --gzip-compressed ${FILE} --output path/to/output/directory/${OUT}_kraken.txt --report path/to/output/directory/${OUT}_report.txt
done
I would like to have a kracken output file and a report file for each sample individually e.g.
- file1_kracken.txt
- file1.report.txt
- ...
- fileN.report.txt
- fileN.report.txt
However, the only results Im getting in the output folder are two files (not two for each sample, two lonely files) named
_kraken.txt
and
_report.txt
For sure Im doing something wrong when setting up the loop and with OUT=$(basename $FILE)... Any ideas?
Thanks in advance
MW