converting bowtie2 alignment result to Bam format
1
0
Entering edit mode
6.4 years ago

hello

again me...!

i did these steps:

in command prompt i typed "bowtie2-build-s.exe example/reference/lambda_virus.fa lambda_virus

then  "bowtie2-align-s.exe -x lambda_virus -U example/reads/reads_1.fq -S eg1.sam"

and at last after trying many times!!! i got this:

10000 reads; of these:

  10000 (100.00%) were unpaired; of these:

    596 (5.96%) aligned 0 times

    9404 (94.04%) aligned exactly 1 time

    0 (0.00%) aligned >1 times

94.04% overall alignment rate

whether is the result in SAM format??? if not how i can convert it to SAM format, then how i can convert obtained SAM to BAM? (windows7-64bit)

next-gen • 5.1k views
ADD COMMENT
2
Entering edit mode
6.4 years ago
Dan D 7.2k

Hi there. Glad to see you're sticking with it and having success!

It looks like your bowtie command worked. So you should have that eg1.sam file in the directory where you executed bowtie2-align-s.exe.

SAM is a text format, so you can investigate that file in a text editor.

If indeed you do see that SAM file, then you can convert it to BAM using samtools. There's a windows port of samtools available here.

The syntax for basic SAM to BAM conversion in samtools is:

samtools view -bh -o eg1.bam eg1.sam 

That should give you a BAM conversion which includes the header.

ADD COMMENT
1
Entering edit mode
ADD REPLY
0
Entering edit mode

thank uuuuu very much

for sure without ur valuable help i couldnt get any success  easily

ADD REPLY
0
Entering edit mode

Hello

after copying eg1.sam file from C:\bowtie2-2.2.4\bowtie2-2.2.4 to c:\samtools then i typed

cd c:\samtools

samtools.exe view -Sb eg1.sam > eg1.bam

it said: [samopen] SAM header is present: 1 sequences.

but when i typed samtools view -bh -o eg1.bam eg1.sam  instead,

it said: [bam_header_read] EOF marker is absent. the input is probably truncated.

[bam_header_read]  invalid BAM binary header <this is not a BAM file

[main_samiew] fail to read the header from 'eg1.sam'.

sorry may i know please, if those two commands are different that i got different results?

in second command why i recieved error?

ADD REPLY
1
Entering edit mode

In this command:

samtools.exe view -Sb eg1.sam > eg1.bam

You didn't include the -h parameter, so the header wasn't written into the BAM file. When you subsequently tried to read the BAM file, there was no header and samtools error'ed out.

ADD REPLY
0
Entering edit mode

thank you

 

ADD REPLY

Login before adding your answer.

Traffic: 2487 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