text: user13878: I have 2 bam files that belong to the same sample and I merged them with samtools merge. And after merging, I realized that the merged version is a bit smaller than the sum of the other two separate files' size. I also wonder if I merged "the fastq" files of this sample first and convert it to bam would the result be the same?
  
  user383: If you merge a lot of BAM files you lose the overhead of the header which depending on the size of your BAM files this can be a significant difference or not.
  With FASTQ files there should be less difference (as they don't have an overall header). However, the compression ratio can change depending on how you zip your files. [EDIT: I just tested it merging two fastq.gz that were 357MB and 562MB - the result was fastq.gz that was smaller than the sum at only 826MB]
  No, the BAM header information would be lost in the conversion from BAM -> FASTQ -> BAM.
  
original_text: 13878: <p>I have 2 bam files that belong to the same sample and I merged them with <code>samtools merge</code>. And after merging, I realized that the merged version is a bit smaller than the sum of the other two separate files' size. I also wonder if I merged &quot;the fastq&quot; files of this sample first and convert it to bam would the result be the same?</p>
   383: <p>If you merge a lot of BAM files you lose the overhead of the header which depending on the size of your BAM files this can be a significant difference or not.</p>
  <p>With FASTQ files there should be less difference (as they don't have an overall header). However, the compression ratio can change depending on how you zip your files. [EDIT: I just tested it merging two fastq.gz that were 357MB and 562MB - the result was fastq.gz that was smaller than the sum at only 826MB]</p>
  <p>No, the BAM header information would be lost in the conversion from BAM -&gt; FASTQ -&gt; BAM.</p>
  