Different Md5Sum Id For Same Bam File And "Sort" Opertion In Samtools.
1
0
Entering edit mode
11.8 years ago
C Shao ▴ 140

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.

samtools bam sequencing • 4.5k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

not due to difference in compression or difference in headers?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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

ADD REPLY
3
Entering edit mode
11.8 years ago

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 COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1569 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6