SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
sam to bam conversion error, no @SQ lines in the header, missing header? efoss Bioinformatics 17 12-03-2015 04:28 AM
samtools: parse error in SAM to BAM conversion chrisW Bioinformatics 12 01-14-2013 06:16 PM
Tophat v1.1.4 potential error with sam to bam conversion? jb2 Bioinformatics 6 11-17-2011 12:52 AM
possible to bwa -> sam -> bam via pipe? Kotoro Bioinformatics 5 07-19-2011 02:34 AM
Conversion from Complete Genomics Data to SAM/BAM jflores Bioinformatics 3 04-28-2011 05:31 PM

Reply
 
Thread Tools
Old 10-30-2009, 01:44 AM   #1
maasha
Senior Member
 
Location: Denmark

Join Date: Apr 2009
Posts: 153
Default BWA sam and Samtools sam->bam conversion problem

Hello all,

I have a SAM file create with BWA, but I cannot convert it to BAM because of the following:

samtools view -S foo.sam -b -o foo.bam
[samopen] no @SQ lines in the header.
[main_samview] random alignment retrieval only works for indexed BAM files.



The SAM file looks like this:


head foo.sam
5_gECOjxwXsN1 0 contig00025 28520 37 35M = 28520 0 AACGNTACTATCGTGACATGCGTGCAGGATTACAC abb^D[a`ab^`Y`a_[___^[ON\X`_Y]`_aa\ XT:A:U NM:i:1 X0:i:1 X1:i:0 XM:i:1 XO:i:0 XG:i:0 MD:Z:4T30
3_8ICOjxwXsN1 4 * 0 0 * * 0 0 ACTCNAGGGTTCGATTCCCTTCAACCGCCCCATAA a`WYD[aaaW_^_[^^W`]`]\^`\V][[_]QV\\
3_GUCOjxwXsN1 4 * 0 0 * * 0 0 TTGCNTCCTTCTTCTGCCTTCGTTGGCTCAGATTG `aaYDRb_a[a`]^X^`]`aa`]XVT]R[^`TZVY
5_BWCOjxwXsN1 0 contig00138 59297 37 35M = 59297 0 TATATACAGGAATCCATTGTTGTTTAGATTCAGTT ab`b`baaaa`b``ZY]YW^aS[_]OLT_VRS]UZ XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:35
7_NZCOjxwXsN1 16 contig00115 1617 37 35M = 1617 0 AGGTAGCCGTATCGGAAGGTGCGGCTGGATCACCT MSKNT\V^TSWW`\`Z^Z\Q\\___a`a_`ZDY`] XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:35
3_2VCOjxwXsN1 16 contig00005 66001 37 35M = 66001 0 CTTAATGGGTGAAGATGTCTACACACCTGGAAAAG aaaaa`a``aa_aaaa`aab_b`b[aabaaaabaa XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:35
5_kVCOjxwXsN1 4 * 0 0 * * 0 0 CTACACCTAAGTTACATCGTCCATTATTTTCCAAT aaaaaaaabaa_aa_a__a^a[[``\a`a][\`[_
1_GbCOjxwXsN1 0 contig00105 1098 37 35M = 1098 0 CCAGACAACTAGGATGTTGGCTTAGAAGCAGCCAT ```_aabaaa`ba`Y`S[_`_^]a^a`_YaYSUXT XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:35
5_fTCOjxwXsN1 4 * 0 0 * * 0 0 TTAGCTTTAACCATTTTCTTTTTGTCTAAAGCAAA aabb__\_aaabU_^^[^`[\_`aWaa``_^a``_
3_VWCOjxwXsN1 16 contig00027 14175 37 35M = 14175 0 GTTTAACGCGTTCACGTTCGCCACGCGCATCATAA T\`a\\a]]V]aa_aaaaaaaaY`abab_aaabba XT:A:U NM:i:0 X0:i:1 X1:i:0 XM:i:0 XO:i:0 XG:i:0 MD:Z:35



Suggestions are welcome.



Martin
maasha is offline   Reply With Quote
Old 10-30-2009, 10:20 AM   #2
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by maasha View Post
samtools view -S foo.sam -b -o foo.bam
Try
Code:
samtools view -S -b foo.sam > foo.bam
There is no argument to the -S option.
nilshomer is offline   Reply With Quote
Old 10-30-2009, 10:48 AM   #3
lh3
Senior Member
 
Location: Boston

Join Date: Feb 2008
Posts: 693
Default

In addition, please use the latest bwa-0.5.4. 0.4.9 does not print SAM header.
lh3 is offline   Reply With Quote
Old 10-30-2009, 10:58 AM   #4
maasha
Senior Member
 
Location: Denmark

Join Date: Apr 2009
Posts: 153
Default

Yup, it was a BWA version problem. I did not realize that BWA now have its own spot on Sourceforge - with newer versions than 0.5.0. The Maq website is misleading (at least it mislead me ).

All is good now. Thanks.
maasha is offline   Reply With Quote
Old 05-29-2013, 10:17 PM   #5
saraoh
Junior Member
 
Location: Melbourne

Join Date: May 2013
Posts: 1
Default

Hi
I used your command, but seems it is not working properly
samtools view -S -b SAM.sam' > bam1.bam
Why I got the following line:
[samopen] SAM header is present: 94 sequences.

Finally I got the BAM file, but it is empty
saraoh is offline   Reply With Quote
Old 05-30-2013, 04:29 AM   #6
Chulab4121
Junior Member
 
Location: Taiwan

Join Date: May 2013
Posts: 2
Default

i use the latest SRA tool kit to convert sra to sam but also no header. (-S -b -r )
Chulab4121 is offline   Reply With Quote
Old 06-05-2013, 07:39 AM   #7
abi
Member
 
Location: Blacksburg

Join Date: May 2013
Posts: 18
Default

I am using the latest version of BWA and SAMTOOLS. I get following error when trying to convert from SAM to BAM with the following command:

samtools view -bS chunkalign.1.sam > chunkalign.1.bam

Parse warning at line 27: mapped sequence without CIGAR
Parse error at line 27: sequence and quality are inconsistent
Aborted
abi is offline   Reply With Quote
Reply

Tags
bwa samtools

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:46 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO