Question: Add Information To @Rg Using Picard, Without Replacing Read Groups
1
gravatar for DonJoe
6.1 years ago by
DonJoe30
DonJoe30 wrote:

Hello!

I'm using GATK to process some BAM files using their Best Practices. However, I forgot to add platform information under the @RG tag in the BAM header when I did the alignment (using BWA).

So, I've done dedup marking, indel realignment and the next step is base score recalibration. GATK won't do this since the platform information is missing from the BAM file. My first thought was to just use AddOrReplaceReadGroups from Picard, but as I understand it, this removes all other read groups in the BAM file and replace them with the one specified when running the program.

My question is: can I just add platform information to the existing BAM file without removing the read groups in it (and replacing them with a single one)?

To clarify further, my header now looks something like this:

...    
@RG     ID:ABC0021    SM:SAMPLE123
@RG     ID:ABC0026    SM:SAMPLE123
@RG     ID:ABC0013    SM:SAMPLE123
...

And I want it to look something like this:

...    
@RG     ID:ABC0021    SM:SAMPLE123    PL:illumina    PU:1    LB:Lib1
@RG     ID:ABC0026    SM:SAMPLE123    PL:illumina    PU:1    LB:Lib1
@RG     ID:ABC0013    SM:SAMPLE123    PL:illumina    PU:1    LB:Lib1
...

Also with the platform info added to the reads.

Is this possible to achieve using Picard?

picard • 5.6k views
ADD COMMENTlink modified 9 months ago by Biostar ♦♦ 20 • written 6.1 years ago by DonJoe30

it is much like

How can i edit some rows in .bam header file?

(closing)

ADD REPLYlink written 6.1 years ago by Pierre Lindenbaum120k
1
gravatar for Ashutosh Pandey
6.1 years ago by
Philadelphia
Ashutosh Pandey11k wrote:

Ignore me if you have already figured out the solution otherwise you can try sth like this:

samtools view -H $BAM | sed "s/SM:SAMPLE123/SM:SAMPLE123\tPL:ILLUMINA/g" | samtools reheader - $BAM

No temporal files will be created.

ADD COMMENTlink written 6.1 years ago by Ashutosh Pandey11k
0
gravatar for Pierre Lindenbaum
6.1 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum120k wrote:

duplicate of

How can i edit some rows in .bam header file?

ADD COMMENTlink written 6.1 years ago by Pierre Lindenbaum120k

I don't believe I'm asking exactly the same question since my problem is not just the header. I want to modify the header and make the corresponding changes in the information for each read.

ADD REPLYlink written 6.1 years ago by DonJoe30

as far as I can see the RG-ID of the reads would not change isn't it ?

ADD REPLYlink written 6.1 years ago by Pierre Lindenbaum120k

My mistake, I thought that I also had to change something in the read information. Sorry and thank you for pointing me to the answer :)

ADD REPLYlink written 6.1 years ago by DonJoe30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1440 users visited in the last hour