Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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.

    Comment


    • #3
      In addition, please use the latest bwa-0.5.4. 0.4.9 does not print SAM header.

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment


          • #6
            i use the latest SRA tool kit to convert sra to sam but also no header. (-S -b -r )

            Comment


            • #7
              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

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Techniques and Challenges in Conservation Genomics
                by seqadmin



                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                Avian Conservation
                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                03-08-2024, 10:41 AM
              • seqadmin
                The Impact of AI in Genomic Medicine
                by seqadmin



                Artificial intelligence (AI) has evolved from a futuristic vision to a mainstream technology, highlighted by the introduction of tools like OpenAI's ChatGPT and Google's Gemini. In recent years, AI has become increasingly integrated into the field of genomics. This integration has enabled new scientific discoveries while simultaneously raising important ethical questions1. Interviews with two researchers at the center of this intersection provide insightful perspectives into...
                02-26-2024, 02:07 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, 03-14-2024, 06:13 AM
              0 responses
              32 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-08-2024, 08:03 AM
              0 responses
              72 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-07-2024, 08:13 AM
              0 responses
              80 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-06-2024, 09:51 AM
              0 responses
              68 views
              0 likes
              Last Post seqadmin  
              Working...
              X