From 3090fd6ac9d54dcf227aa362fea8400858d23b42 Mon Sep 17 00:00:00 2001 From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu> Date: Fri, 27 Oct 2017 13:09:13 -0500 Subject: [PATCH] options trimgalore --- preproc_fastq/trimgalore.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/preproc_fastq/trimgalore.sh b/preproc_fastq/trimgalore.sh index 0bd2f54..f53cfeb 100644 --- a/preproc_fastq/trimgalore.sh +++ b/preproc_fastq/trimgalore.sh @@ -1,20 +1,43 @@ #!/bin/bash #trimgalore.sh -pair_id=$1 -read1=$2 -read2=$3 +usage() { + echo "-h Help documentation for hisat.sh" + echo "-a --FastQ R1" + echo "-b --FastQ R2" + echo "-p --Prefix for output file name" + echo "Example: bash trimgalore.sh -p prefix -a SRR1551047_1.fastq.gz -b SRR1551047_2.fastq.gz" + exit 1 +} +OPTIND=1 # Reset OPTIND +while getopts :a:b:p:h opt +do + case $opt in + a) fq1=$OPTARG;; + b) fq2=$OPTARG;; + p) pair_id=$OPTARG;; + h) usage;; + esac +done + +shift $(($OPTIND -1)) + +# Check for mandatory options +if [[ -z $pair_id ]] || [[ -z $fq1 ]]; then + usage +fi + r1base="${r1%.fastq*}" r2base="${r2%.fastq*}" module load trimgalore/0.4.1 cutadapt/1.9.1 if [ $R1 == $R2 ] then - trim_galore -q 25 --illumina --gzip --length 35 ${read1} + trim_galore -q 25 --illumina --gzip --length 35 ${fq1} mv ${r1base}_trimmed.fq.gz ${pair_id}.trim.R1.fastq.gz cp ${pair_id}.trim.R1.fastq.gz ${pair_id}.trim.R2.fastq.gz else - trim_galore --paired -q 25 --illumina --gzip --length 35 ${read1} ${read2} + trim_galore --paired -q 25 --illumina --gzip --length 35 ${fq1} ${fq2} mv ${r1base}_val_1.fq.gz ${pair_id}.trim.R1.fastq.gz mv ${r2base}_val_2.fq.gz ${pair_id}.trim.R2.fastq.gz fi -- GitLab