0
$\begingroup$

I have a bam file that contains two @RG lines:

@RG     ID:Foo.Bar_L1.Foo   PU:Bar_L1.Foo SM:Foo        PL:Illumina     LB:Library.fa
@RG     ID:Foo.Bar_L2.Foo   PU:Bar_L2.Foo SM:Foo        PL:Illumina     LB:Library.fa

I wish to replace it with one @RG line:

@RG     ID:Foo SM:Foo        PL:Illumina     LB:Library.fa

What is the best way to do this?

samtools addreplacerg looks useful, but it looks like I can only affect one @RG per call, and I have no desire to write out the whole bam file twice

$\endgroup$

1 Answer 1

2
$\begingroup$

Not sure about samtools, but picard AddOrReplaceReadGroups can clear existing read groups and write a new one.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.