I got six fastq files (three forward and three reverse) for every sample in 96-well plate via NGS. As the first step of SNP calling, I need convert these six files into two files (forward and reverse fastq file) for each sample. Now I am trying to write a shell scripts to automatically merge every three forward (reverse) files into one for multiple samples. Below is the scripts I wrote to automatically convert one fastq file to one bwa file for many samples, but I am asking the scripts to convert three files into one. Thank you.
for fq in ~/NGS/*.fastq
do
echo "working with file $fq"
base=$(basename $fq .fastq)
echo "base name is $base"
bwa=~/results/bwa/${base}.bwa
bwa aln -t 4 GMbwaidx $fq > $bwa
done
My six files for one sample look like this:
142_P001_WB01_S1751_L008_R1_001.fastq
143_P001_WB01_S13_L001_R1_001.fastq
143_P001_WB01_S13_L002_R1_001.fastq
142_P001_WB01_S1751_L008_R2_001.fastq
143_P001_WB01_S13_L001_R2_001.fastq
143_P001_WB01_S13_L002_R2_001.fastq
Hello zhou_1228,
and how do you know that these files belong to the same sample? Which part of the filename give that information?
fin swimmer
P001_WB01 represent plate 1, well No. B1
There is no bwa file (format), bwa outputs alignments in the SAM format. For this reason, I would write: