Question: converting bowtie2 alignment result to Bam format
0
gravatar for jivarajivaraj
5.0 years ago by
jivarajivaraj50 wrote:

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 • 4.3k views
ADD COMMENTlink modified 5.0 years ago by Dan D6.9k • written 5.0 years ago by jivarajivaraj50
2
gravatar for Dan D
5.0 years ago by
Dan D6.9k
Tennessee
Dan D6.9k wrote:

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 COMMENTlink modified 5.0 years ago • written 5.0 years ago by Dan D6.9k
1

Also being dealt with here C: please some one help me step by step i was really exhausted

ADD REPLYlink written 5.0 years ago by Adrian Pelin2.3k

thank uuuuu very much

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

ADD REPLYlink written 5.0 years ago by jivarajivaraj50

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 REPLYlink written 5.0 years ago by jivarajivaraj50
1

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 REPLYlink written 5.0 years ago by Dan D6.9k

thank you

 

ADD REPLYlink written 5.0 years ago by jivarajivaraj50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1741 users visited in the last hour