Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • the header of SAM and BAM missing

    Hi

    I use the soap2sam.pl to convert the soap file file.soap to file.sam, but the header in file.sam is missing, so I have to add the header to the file.sam. When I convert this file.sam to file.bam, the header in file.bam is missing again. I don't know why.

  • #2
    Using the latest samtools (0.1.16) with samtools view -bS <in.sam> <out.bam> should write you a bam file with a header.

    Comment


    • #3
      Actually I did. I'm using the samtools (0.1.16),
      Here is my command line,

      $ samtools view -bt hg19.fa.fai unsorted.sam -o unsorted.bam
      note that the unsorted.sam has no header @SQ

      then I tried this,
      $ samtools view -hbt hg19.fa.fai unsorted.sam -o unsorted.bam
      the -h can include the header in the output

      but I failed to merge the header into unsorted.bam

      Comment


      • #4
        Perhaps you could try this approach, although it doesn't resolve the reason why you are losing your header.

        1) Get the header from your sam file by doing (although you have this header already, I believe)

        samtools view -HS <yourfile.sam> > <yourheader.sam>

        2) Then reheader your bam file:

        samtools reheader <yourheader.sam> <yourfile.bam>

        where yourfile.bam is the bam file lacking the header

        Comment


        • #5
          Thanks very much, it's solved

          Comment


          • #6
            Hi,

            I am currently facing the same problem with soap2sam.pl as well. I've actually tried this

            samtools faidx reference.fa
            samtools view -bt reference.fa.fai aln.sam >aln.bam

            The conversion from sam <-->bam went fine,somehow when when I ran the mpileup |bcftools commands I couldnt manage to get anything in my *.vcf file.

            I am trying the alternative as mentioned by krinard. When I ran

            samtools view -HS test.sam > header_test.sam

            samtools outputs this
            [samopen] no @SQ lines in the header.

            Am I missing something here? I am currently using samtools 0.1.17 (r973:277) though.

            Any help will be much appreciated!

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Current Approaches to Protein Sequencing
              by seqadmin


              Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
              04-04-2024, 04:25 PM
            • seqadmin
              Strategies for Sequencing Challenging Samples
              by seqadmin


              Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
              03-22-2024, 06:39 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            27 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 10:19 PM
            0 responses
            30 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 09:21 AM
            0 responses
            26 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-04-2024, 09:00 AM
            0 responses
            52 views
            0 likes
            Last Post seqadmin  
            Working...
            X