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?
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.