It is desireable to be able to sort a bed file in the same order as the chromosomes appear in a .fai file. bedtools sort seems to do this, if you give it the -faidx option with the .fai file as an argument. This is not documented on the main bedtools web site page for "sort". I can't remember how I found out about it.
It is desireable to be able to sort a bed file in the same order as the chromosomes appear in a .fai file. bedtools sort seems to do this, if you give it the -faidx option with the .fai file as an argument. This is not documented on the main bedtools web site page for "sort". I can't remember how I found out about it.