This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Replace @RG group by the one of another BAM

Hi, I want to replace the @RG info from one bam file (output.bam) by the @RG info from another (input.bam) creating a new.bam I tried it as follows:

samtools view -H input.bam | grep '@RG' > RG_header

samtools addreplacerg -r RG_header -o new.bam output.bam

I get the following message:

[parse_args] The supplied RG line lacks an ID tag.

RG_header looks as follows:

@RG ID:CAUPUANXXnnn PU:170913_7001253F  PL:ILLUMINA LB:55426    SM:55426

Thanks for your help.

Best, Dagmar

samtools addreplacerg

1 answer

-r expects a string, not a file.

Log in to answer this question.