Should I re-index a bam after editing the read groups in the bam header?
1
0
Entering edit mode
11 months ago
dolevrahat ▴ 40

I have an indexed bam file. I wish to update the sample ID (SM) field in the read groups (RG) entries in the bam header, which I do using samtools reheader. I was wondering if it is recommended to re-generate the bam index (.bai) file after editing the header. The bam index specifications do not mention read groups so I do not know if read groups metadata is included in the index.

Any insights will be appreciated

bam • 700 views
ADD COMMENT
3
Entering edit mode
11 months ago

yes, the bytes have changed, the size of the file has changed: the indexes for random-access have changed, you must re-index.

ADD COMMENT
0
Entering edit mode

Thank you! Does this also apply to cram files? I reckon the answer is yes for the same reason but I note that unlike bams, with crams it is possible to change the header in-place, so I wanted to be sure.

ADD REPLY

Login before adding your answer.

Traffic: 1666 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6