In RNA-seq tuxedo pipeline I was taught to directly samtools index the bam files, obtained from the tophat alignment, without indexing. and in DNA-seq I was taught that first, we sort the bam files then only index in samtools. what's the difference? and reason to do this?
It depends on the aligner. In this case, Tophat (as far as I know) creates a sorted bam by default. As such, there is no additional sorting necessary anymore. I believe that samtools index only works on coordinate sorted bams. By the way, TopHat is no longer a recommended aligner, and you should use something like STAR (for alignment) or salmon (for rapid pseudo-alignment).