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
              Recent Innovations in Spatial Biology
              by seqadmin


              Spatial biology is an exciting field that encompasses a wide range of techniques and technologies aimed at mapping the organization and interactions of various biomolecules in their native environments. As this area of research progresses, new tools and methodologies are being introduced, accompanied by efforts to establish benchmarking standards and drive technological innovation.

              3D Genomics
              While spatial biology often involves studying proteins and RNAs in their...
              Yesterday, 07:30 PM
            • seqadmin
              Advancing Precision Medicine for Rare Diseases in Children
              by seqadmin




              Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
              12-16-2024, 07:57 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 12-30-2024, 01:35 PM
            0 responses
            21 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-17-2024, 10:28 AM
            0 responses
            41 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-13-2024, 08:24 AM
            0 responses
            55 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-12-2024, 07:41 AM
            0 responses
            40 views
            0 likes
            Last Post seqadmin  
            Working...
            X