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.
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!!
not due to difference in compression or difference in headers?
how to check the header information in bai or bam file?
samtools view -h file.bam | head -n 30