I am trying to perform the alignment using bwasw and then using samtools to report the aligned sequences. So, essentially I am piping samtools and bwa. Here is the code:
$ for file in *.amb;
do
.././bwa bwasw -z 5 ${file:0:13} ../QUERY/updated_635_500bp.fasta>../OUTPUT_635/"file".sam| ../../../samtools-0.1.18/samtools-0.1.18/samtools view -bS -F 4 ../OUTPUT_635/"$file".sam ../OUTPUT_635/"$file".bam; rm -f "$file"sam ;
done
It tells me that
`[main_samview] fail to open "../OUTPUT_635/AC_000091.fna.amb.sam" for reading.`
So it is performing the samtools operation before bwasw?
I'd appreciate help with this! I am using cygwin on Windows 7 btw. Thank you!