Do the sequences in SAM/BAM header have to match the number and the order of the sequences in reference FASTA file?
For example, if I have the following in my SAM header (the file only contains reads for chr11):
@HD VN:1.4 SO:coordinate
@SQ SN:chr11 LN:135006516
@RG ID:mySample SM:mySample
@PG ID:bozo PN:bozo CL:commandLine
And my reference is the standard hg19 reference with all the sequences.
Can I expect my SAM file to work with all the standard tools?
1 answer
Well depends on the tool you are using. But I think your bam file is NOT gonna work with most of the standard tools. Tools like GATK are pretty particular about the BAM header. For example, it should have the same names for the chromosomes as in reference file (chr16 vs 16). Moreover it should also has information about all the chromosomes mentioned in the reference genome. Some tools even ask that the chromosomes in bam and the reference file should follow the same order. I think any aligner will automatically include all the chromosomes from the reference genome. In your case it seems you aligned your sequences to chromosome 11 only. In your case, I would either edit my header to include SN and LN tags for all the chromosomes in hg19 OR I will use a reference fasta file that only contains chr11.
Log in to answer this question.
It's important that the chr names in BAM and reference genome match, like ashutoshmits said. That's why it's usually recommended to use the same reference which was used to generate your BAM file, whenever possible.