Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • How come bam file becomes smaller after sorting?

    I ran the three fastq I downloaded from 1000g ftp site against hg19 using gsnap. For the single read file, I obtained 1.bam.

    gsnap -A sam -B 4 -t 6 --gunzip -D /tank/gsnap/hg19 -d hg19 ../../NA12878/SRR098401.filt.fastq.gz | samtools view -bS - > 1.bam

    Then I got 2.bam from the pair ended file:

    gsnap -A sam -B 4 -t 6 --gunzip -D /tank/gsnap/hg19 -d hg19 ../../NA12878/SRR098401_1.filt.fastq.gz ../../NA12878/SRR098401_2.filt.fastq.gz | samtools view -bS - > 2.bam

    I merged the two to become 3.bam

    samtools merge 3.bam 1.bam 2.bam

    Finally, I sorted 3.bam to become SRR098401_gsnap.bam

    samtools sort 3.bam SRR098401_gsnap

    But when I looked at the sizes of the files, I noticed that the sorted bam is 7.5% smaller than the unsorted 3.bam. How come?

    -rwxrwxrwx 1 root root 61107717 Jul 17 07:34 1.bam
    -rwxrwxrwx 1 root root 19908769734 Jul 17 00:27 2.bam
    -rwxrwxrwx 1 root root 19969841372 Jul 17 08:40 3.bam
    -rwxrwxrwx 1 root root 18525917076 Jul 17 09:54 SRR098401_gsnap.bam

  • #2
    This has been asked before. It's due to compression on sorted/unsorted data.

    Comment


    • #3
      Sorry about that. Thanks for your reply

      Comment

      Latest Articles

      Collapse

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

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Yesterday, 06:37 PM
      0 responses
      10 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, Yesterday, 06:07 PM
      0 responses
      9 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-22-2024, 10:03 AM
      0 responses
      51 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 03-21-2024, 07:32 AM
      0 responses
      67 views
      0 likes
      Last Post seqadmin  
      Working...
      X