How do I merge bam files with identical @RG IDs? How do I create a merged
output with a unique @RG ID for each unique @RG SM?

The manual reads:
-r Attach an RG tag to each alignment. The tag value is inferred from file
names.

I have tried adding the -r option:
samtools merge -r -R 1:100000-100200 samtools.merge.bam $bamFiles

The manual reads:
-h FILEUse the lines of FILE as Œ@¹ headers to be copied to out.bam,
replacing any header lines that would otherwise be copied from in1.bam.
(FILE is actually in SAM format, though any alignment records it may
contain are ignored.)


I have tried adding -h RG.txt:

samtools merge -r -R 1:100000-100200 -h RG.txt samtools.merge.bam $bamFiles

But I am not sure, what the contents of RG.txt should be. The example
"Attach the RG tag while merging sorted alignments" is not clear to me.

Others seem to have had the same problem:
https://www.biostars.org/p/80150/

http://seqanswers.com/forums/showthread.php?t=33260

http://sourceforge.net/p/samtools/mailman/message/30655641/


Currently my RG.txt file looks like this (tab separated fields):
grep "#1[^0-9]" RG.txt | head | rev | cut -c3- | rev
@RG     ID:1#1  PL:ILLUMINA     LB:7721122      SM:EGAN000011605
@RG     ID:1#1.1        PL:ILLUMINA     LB:7721122      SM:EGAN000011605
@RG     ID:1#1.2        PL:ILLUMINA     LB:7721122      SM:EGAN000011605
@RG     ID:1#1  PL:ILLUMINA     LB:7672393      SM:EGAN000011612
@RG     ID:1#1.1        PL:ILLUMINA     LB:7672393      SM:EGAN000011612
@RG     ID:1#1.2        PL:ILLUMINA     LB:7672393      SM:EGAN000011612
@RG     ID:1#1  PL:ILLUMINA     LB:7790252      SM:EGAN000011617
@RG     ID:1#1.1        PL:ILLUMINA     LB:7790252      SM:EGAN000011617
@RG     ID:1#1.2        PL:ILLUMINA     LB:7790252      SM:EGAN000011617
@RG     ID:1#1  PL:ILLUMINA     LB:7672199      SM:EGAN000011621


Thanks for any help on this.

Tommy



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

------------------------------------------------------------------------------
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to