#!/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 file2=${file%%.fastq}; file2=${file2#$READDIR}; bfast match -f $GENOME -i 1,2,3,4,5,6,7,8,9,10 -r ${file} -l -n $THREADS > ${file2}.bmf; done


for file in *bmf; do bfast localalign -f $GENOME -m ${file} -n $THREADS > ${file%%.bmf}.baf; done


for file in *baf; do bfast postprocess -Y 0 -f $GENOME -i ${file} > ${file%%.baf}.sam; done

