Question: Different Md5Sum Id For Same Bam File And "Sort" Opertion In Samtools.
0
gravatar for C Shao
6.6 years ago by
C Shao130
C Shao130 wrote:

Hi guys:

I am new to sequencing and going to ask some silly questions...

I got some sequence data from the core facility and they are already mapped to human genome. It is exome sequencing.

For each BAM file, there is a bam.bai file.

For curiosity, I regenerated the bam.bai files with samtools (samtools-0.1.18) ( samtools index XXXX.bam), and compare old and new bai files use md5. I suppose they should be same since they generated from the same BAM files. But they gave me different md5 ID...

I was wondering that maybe the original BAM is not sorted, so I sorted them (samtools sort) myself., and re-index them. I got three bam.bai files, each of them have different md5 id.

I used the "samtools view -H XXX.BAM" to see if the original BAM files are sorted, I got "@HD VN:1.0 SO:coordinate", suggesting they are sorted files. The wired thing is that the original sorted files and new generated files are different in size, the new one is BIGGER!

I compared the first 10000 lines of each BAM files by "samtools view", they are identical. I have no idea while they are different in size.

In the beginning I want to use the existed BAM files because core facility are experienced in generating sequence and mapping them to genome, they probably know the best parameters in software (I guess bwa, "@PG ID:bwa PN:bwa").

Now I am a little bit confused, should I use the existed,sorted BAM files with original BAI files? or I should use the BAM with new generated BAI files? or even map the original reads myself? Or I just simply misunderstand the use of md5? How to explain the difference between the old and sorted BAM files?

Many thanks.

bam samtools sequencing • 2.2k views
ADD COMMENTlink modified 11 months ago by Biostar ♦♦ 20 • written 6.6 years ago by C Shao130

If I was you, I would map the raw files again as I am not sure what they did (which parameters are used). We had a problem with BJI, they sent us the samples after ChIP-Seq and the control was showing the same profile as the biological replicate, whereas one of the replicate was showing very low enrichment, after some tests, It was confirmed that they swapped the sample names. Since then, I am very careful about this!!

ADD REPLYlink written 6.6 years ago by Sukhdeep Singh9.6k

not due to difference in compression or difference in headers?

ADD REPLYlink written 6.6 years ago by brentp22k

how to check the header information in bai or bam file?

ADD REPLYlink written 6.6 years ago by C Shao130
1

samtools view -h file.bam | head -n 30

ADD REPLYlink written 6.6 years ago by Sukhdeep Singh9.6k
3
gravatar for Istvan Albert
6.6 years ago by
Istvan Albert ♦♦ 79k
University Park, USA
Istvan Albert ♦♦ 79k wrote:

I would not read too much into this and I don't think you have any reason to worry. It is quite possible that as samtools evolves the binary format of the index changes/evolves as well.

For example the bai file could just have a single byte reserved to indicate which version of samtools has created it. That alone would change the MD5 sum. In addition other, backward compatible optimizations could also have been added.

ADD COMMENTlink written 6.6 years ago by Istvan Albert ♦♦ 79k

I have contacted the people mapping these reads, he gave same suggestion. I think I will start with mapped data.

ADD REPLYlink written 6.6 years ago by C Shao130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 751 users visited in the last hour