I have a BAM file which doesn't display when I load it into IGV. From searching, I gather the most common reason for this error is that the chromosome names in the BAM file and genome file don't match. I have checked, and they do match, but there might be an indexing problem. When I view the header for my sorted BAM file, the SQ lines appear in the order scaffold_1, scaffold_10, scaffold_11, scaffold_100, scaffold_2, ... (i.e. like Excel would sort these), not scaffold_1, scaffold_2, ... scaffold_10, scaffold_11, ..., scaffold_100 (i.e. sorted in true numerical order).
My question is: could this sort order then give rise to an indexing problem that explains why IGV can't load the BAM file properly?
I think this might be the case, because a colleague has given me another BAM file (same reference genome), where the scaffolds appear in correct numerical order, and that one displays OK in IGV.
And how do I fix this if so? There don't seem to be too many options for samtools sort. There are no extra characters (leading 00's, etc.) in the scaffold names in either of the BAM files, or the .fai file.