#!/bin/sh
#The purpose of this script is to merge the demultiplexed reads from two MiSeq lanes.


#A companion file, referenced here as fastq_files.txt, must be located within the working directory to get file names that must be merged.
#It is assumed that the demultiplexed files are within Run folders in the working directory.
#Merged reads will be available in a common folder.


#Filename structure - {SampleID}_{Amplicon}_{SeqCoreID}_{R1orR2}_001.fastq.gz
#R1 references forward reads, R2 references reverse reads.


filename=fastq_files.txt
while read -r line
do entry="$line"
echo "$line"
cat Run1/Afkhami_Project_001/$line
Run2/Afkhami_Project_001/$line > merged_fastq/$line
done < $filename
