Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dongshenglulv
    Member
    • May 2011
    • 15

    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.
  • doc.ramses
    Member
    • Jan 2011
    • 26

    #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

    • dongshenglulv
      Member
      • May 2011
      • 15

      #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

      • krinard
        Junior Member
        • Jan 2011
        • 2

        #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

        • dongshenglulv
          Member
          • May 2011
          • 15

          #5
          Thanks very much, it's solved

          Comment

          • phatjoe
            Member
            • Aug 2011
            • 13

            #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

            • mylaser
              Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
              by mylaser
              Kheloyar – Everything You Need to Know About Kheloyaar Login and Kheoyar Id
              If you are looking for an online gaming platform that offers a user-friendly experience, Kheloyar has become a name that many users search for. Whether you're interested in creating a new account, accessing your dashboard through Kheloyaar Login, or learning how to obtain a Kheoyar Id, understanding the platform's features and account process is essential.
              This guide explains everything you need to know about...
              07-11-2026, 01:13 AM
            • SEQadmin2
              Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
              by SEQadmin2



              Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
              ...
              07-09-2026, 11:10 AM
            • SEQadmin2
              Cancer Drug Resistance: The Lingering Barrier to Rising Survival
              by SEQadmin2



              Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

              There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
              07-08-2026, 05:17 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 07-09-2026, 10:04 AM
            0 responses
            23 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-08-2026, 10:08 AM
            0 responses
            14 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-07-2026, 11:05 AM
            0 responses
            33 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 07-02-2026, 11:08 AM
            0 responses
            31 views
            0 reactions
            Last Post SEQadmin2  
            Working...