This might be a trivial question, but I would rather ask then make a mistake.
What is the easiest way to merge two bam files that have different headers - the headers contain the same information regarding the chromosome names and lengths, but in one file they are sorted by char (eg. chr1 chr10), and in another file by chromosome number (chr1 chr2). I know that each read references the exact chromosome name from the header, so that the reheader command should not produce correct results. The only way that I can currently think of is to convert both bam files to sam, merge them and add the header manually.
Is there a way to do this automatically?
Best regards