The main reason for having an @RG header in a SAM file is so that (a subset of) the alignment records can be associated with it via their RG:Z: tagged fields. When --sam-RG options are used, bowtie should also add an RG: field to all alignment records printed, associating them with the specified @RG header. Thus the right thing happens when several bowtie output SAM files are merged, for example.
This BTW is what bwa samse/sampe -r does: it adds both an @RG header and RG:Z: fields to all output records. (But thanks for using a more convenient command line syntax that doesn't need large amounts of quoting!)
At first glance, it appears that it suffices to print out the extra field in sam.cpp's appendAligned() and reportUnOrMax(). If it is of use, I have attached a suggested patch for your consideration.
Log in to post a comment.