Sam To Bam
1
0
Entering edit mode
10.4 years ago
freddy ▴ 40

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

sam bam bwa alignment • 4.7k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
1
Entering edit mode
10.4 years ago

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

ADD COMMENT
2
Entering edit mode

Since at least version 0.1.12a, there is a -T option, it's just the manual page on the website is out of date.

-T FILE  reference sequence file (force -S) [null]

This forces the -S flag (making it assume sam input), meaning that that the command should work.

What is the error? SAM header is present is not an error message; it's just an informational status. Maybe it's working fine?

ADD REPLY
0
Entering edit mode

Thanks for the information. Yes may be there is no error.

ADD REPLY
0
Entering edit mode

When I try to ope the Bam file in text wrangler its just symbols with no useful information

ADD REPLY
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2589 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6