#!/bin/bash

READDIR="/home/reads/" # Directory all reads are stored in
GENOME="/home/ref_chr_17" # reference genome 
THREADS="24" # no. of threads available


for file in ../reads/*fastq;  do prefix=${file#$READDIR}; prefix=${prefix%%.fastq}; bwa aln -t $THREADS -f $prefix.sai $GENOME $file; done

for file in ../reads/*.1.fastq; do prefix=${file#$READDIR}; prefix=${prefix%%.1.fastq}; bwa sampe $GENOME $prefix.1.sai $prefix.2.sai ../reads/$prefix.1.fastq ../reads/$prefix.2.fastq > $prefix.sam; done

