How to use samtools addreplacerg function to replace ID of the @RG line in the header
1
0
Entering edit mode
2.8 years ago
jis215 • 0

Hi,

I am currently using the pbsv workflow to conduct some structural variants calling on some of my PabBio ccs bam files. However, there is a ccs bam file that failed the pbsv discover step and the error for this failure is that there is a mismatch between the RGID in the header and the RGID in the reads.

The RGID in the header of the file is:

@RG ID:e07811e5

And the RGID in the reads is:

RG:Z:e07811e5/6--6

So I suppose that in order to fix this RGID mismatch issue, I just need to change the RGID in the header from e07811e5 to e07811e5/6--6. I tried to use the samtools addreplacerg function to perform this replacement but I am confused about what options of the function I need to use. Please help me with this issue. Thank you very much.

PacBio CCS sequencing Samtools • 2.5k views
ADD COMMENT
1
Entering edit mode

It looks like the data was demultiplexed but the RGID wasn't updated. Could you please describe how this BAM was generated? Analysis steps, version numbers, etc. If there's an error in the demux process, it would be useful to know and report so that we could fix the problem.

ADD REPLY
0
Entering edit mode
2.8 years ago

Truth to be told the way the tool works is a bit mysterious and somewhat counterintuitive (flags -r and -R) , sometimes you need to give it a few rounds to get it right.

It depends on which way you want to perform the operation. To assign a read group that is already in the header (in this case e07811e5) you can use:

samtools addreplacerg  -R e07811e5 -o new.bam  old.bam

Note how we are not replacing the read group but applying an existing read group to all alignments.

To create add the read group called e07811e5/6--6 to the header you would need to specify the full read group explicitly based on the existing one, then apply it to all reads:

RG='@RG\tID:e07811e5/6--6\tSM:??????\tLB:??????\tPL:ILLUMINA'

samtools addreplacerg  -r $RG -o new.bam  old.bam
ADD COMMENT

Login before adding your answer.

Traffic: 1900 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