I sequenced a mito genome using paired end method on the mi-seq I mapped all the reads back to reference gnome using BWA and got output of a Sam file I want to convert to BAM format but I am getting errors. This first line of my sam file is "@SQ SN:TAC111F LN:16753" all my following lines do not have the @ sign. This is the out put I get [samopen] SAM header is present: 1 sequences. Im using this comand $ samtools view -bT reference.fa test.sam > test.bam can any one help me
There might be several issues going on here. For the sam > bam step use the -bS flag. This tells samtools you are inputing a SAM file and want a BAM file.
Read the samtools manual carefully. Your command usage shows that you haven't done your homework properly before asking the question.
FIrst of all there is no "-T" (capital T) parameter that I know of. The "-t" (small t) parameter is used when your aligner hasn't generated header for sam file. But as you have used BWA, header should be present in the SAM file. All you need is: samtools view -bhS your.sam > your.bam
You can't open BAM file using a text editor. It is a binary version of SAM file. If you to view the bam file, you need samtools. Try this command : samtools view input.bam | more
There might be several issues going on here. For the sam > bam step use the -bS flag. This tells samtools you are inputing a SAM file and want a BAM file.