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.
I looked the BWA manual page,and its command line options. There is no option provided to generate the results in bam format or generate the alignments with headers.
That's a good example why you need to give the exact and reproducible series of command calls. Your description is not precise enough, but I suspect you simply forgot the
bwa samse
orbwa sampe
step, the output ofbwa align
is not in SAM format. Please copy-paste your complete command sequence and output.Thank you. Yes i did not run the bwa samse or bwa sampe step. After running bwa align,i tried the conversion with output file.
Ok, that won't work. Then we have found the solution.