Skip to main content
added a relevant tag
Link
conchoecia
  • 3.2k
  • 2
  • 17
  • 41
Source Link
Scott Gigante
  • 2.2k
  • 2
  • 14
  • 33

Merge hundreds of small BAM files into a single BAM file

I am working with over a million (long) reads, and aligning them to a large genome. I am considering running my alignment jobs in parallel, distributing horizontally across hundreds of nodes rather than trying to run a single job with dozens of cores.

I would like to merge the sorted BAM files together for further downstream analysis. What is the most efficient way to do so while maintaining a valid file header and taking advantage of the fact that the input bam files are already sorted?