-
Notifications
You must be signed in to change notification settings - Fork 1
/
trim-filter.sh
executable file
·75 lines (66 loc) · 1.51 KB
/
trim-filter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
#SBATCH --time=8:00:01
#SBATCH --mem=10g
#SBATCH --tmp=10g
# --------------------------------------------------------------------------- #
# Arguments passed to this script:
THREADS=$1
PHIX=$2
FASTQ1=$3
FASTQ2=$4
FASTQ3=$5
FASTQ4=$6
FASTQ5=$7
FASTQ6=$8
FASTQ7=$9
FASTQ8=${10}
FASTQ9=${11}
FASTQ10=${12}
CONFIG=${13}
SCRIPT_PATH=${14}
DIR_IN=${15}
DIR_OUT=${16}
# --------------------------------------------------------------------------- #
# Trim/filter FASTQ files:
printf "* Trimming and filtering reads using Trimmomatic:\n\t"
printf "$PHIX"
singularity \
exec \
-B $SCRIPT_PATH,$DIR_IN,$DIR_OUT \
$SCRIPT_PATH/singularity/staphb-trimmomatic-0.39.sif \
trimmomatic PE \
-threads $THREADS \
-phred33 \
$FASTQ1 $FASTQ2 \
$FASTQ3 $FASTQ5 $FASTQ4 $FASTQ6 \
ILLUMINACLIP:/Trimmomatic-0.39/adapters/NexteraPE-PE.fa:2:30:10 \
LEADING:20 \
TRAILING:20 \
MINLEN:50 \
AVGQUAL:30
# Filter out phiX reads using Bbtools:
printf "* Filtering reads aligned to PhiX genome using BBtools\n\t"
singularity \
exec \
-B $SCRIPT_PATH,$DIR_OUT \
$SCRIPT_PATH/singularity/staphb-bbtools-38.76.sif \
/bbmap/bbmap.sh \
threads=$THREADS \
ref=$PHIX nodisk \
in=$FASTQ3 \
in2=$FASTQ4 \
outu=$FASTQ7 \
outm=$FASTQ8
printf "\t"
# Split filtered reads into R1 and R2 files:
singularity \
exec \
-B $SCRIPT_PATH,$DIR_OUT \
$SCRIPT_PATH/singularity/staphb-bbtools-38.76.sif \
/bbmap/reformat.sh \
overwrite=true \
in=$FASTQ7 \
out1=$FASTQ9 \
out2=$FASTQ10
# Cleanup FASTQ files:
rm $FASTQ3 $FASTQ4 $FASTQ5 $FASTQ6 $FASTQ7