#!/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 $READDIR*.1.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%%.fastq}; bwa samse $GENOME $prefix.sai ../reads/$prefix.fastq > $prefix.sam; done

