-
-
Save telatin/6594faebe6f8497f9a9365a83c9369d5 to your computer and use it in GitHub Desktop.
A minimal bash script to classify reads using Kraken2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Process a directory of paired end reads and classify | |
# it with kraken2 | |
DATABASE=/data/db/kraken2/standard-16gb/ | |
INPUTDIR=~/kraken-ws/filt/ | |
OUTDIR=${INPUTDIR/filt/kraken2} | |
THREADS=8 | |
set -euo pipefail | |
mkdir -p $OUTDIR | |
for R1 in ${INPUTDIR}/*_R1*gz; | |
do | |
R2=${R1/_R1/_R2}; | |
BASE=$(basename $R1 | cut -f1 -d_) | |
if [ ! -e "$R2" ]; then | |
echo "R2 for sample $R1 was not found" | |
exit | |
fi | |
kraken2 --db $DATABASE --threads $THREADS --paired --report $OUTDIR/$BASE.report $R1 $R2 > $OUTDIR/$BASE.tsv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment