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
              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
            • seqadmin
              Recent Advances in Sequencing Technologies
              by seqadmin



              Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

              Long-Read Sequencing
              Long-read sequencing has seen remarkable advancements,...
              12-02-2024, 01:49 PM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, 12-17-2024, 10:28 AM
            0 responses
            39 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-13-2024, 08:24 AM
            0 responses
            52 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-12-2024, 07:41 AM
            0 responses
            38 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 12-11-2024, 07:45 AM
            0 responses
            46 views
            0 likes
            Last Post seqadmin  
            Working...
            X