I have a NGS data containing 95-98% of PHIX data,which i dont need. So after some reading, I used BWA to align the reads against PHIX genome,so that i could use the unaligned read for analysis. The alignment generated by BWA Align was in sam format. To save the unaligned reads,i tried using samtools ,but the command takes only bam format. I tried converting the sam to bam using samtools,but got error message saying the file is missing header.
Is there any way to generate alignment with the headers in BWA? if not,how to convert the SAM file generated by BWA to BAM format? I need unaligned reads so that i can further perform analysis by aligning it against the another genome.