How to create a merged BAM file for non-programming Mac users

Here are instructions on creating a merged BAM file ending in .bam.list from a non-programming Mac Mavericks user from October 2014. The first section outlines multiple ways to create a plain text file and the second section outlines how to change the extension to .bam.list so IGV can recognize it.

Remember that the folder containing each sorted .bam file also must contain the corresponding .bai index file.

TIP: A useful feature for these merged files in IGV is to sort or color reads by sample or read group, whichever option differentiates the files. Sample or Read Group tags would have to have been designated within the SAM/BAM file header.

Creating a plain text file

Files created with Mac TextEdit may result in an IGV error “Error loading… Cannot find reader for alignment file.” In this case, the file is not a true plain text file.

  • Here are two approaches to get a plain text file within TextEdit:
  1. Under TextEdit's menu, select Format>Make Plain Text.

  1. To configure TextEdit to always use plain text over the default rich text format, go to TextEdit>Preferences>Format and select Plain text.

 

Mac file path

  1. In the example pictured, files are in the Downloads folder but the absolute file path /Users/shlee/Downloads/xyz/xyz.accepted_hits.sorted.bam was used. The folder containing each sorted .bam file also contained the corresponding .bai index file.

 

Converting the .txt extension

  1. The .txt extension is removed by right-clicking the file and selecting the Get Info option. Trying to change the extension directly within a Finder window does not work.

  1. Under Name & Extension, be sure the Hide extension option is unchecked. Delete the .txt portion of the file name such that the [name].bam.list extension is left and press enter. On the popup box, click Use .list.

          

  1. In IGV, select the corresponding genome and in the menu, select File>Load from File> and select the xyz.bam.list file.