How Do I Create An Rg.Txt File For Input Into Samtools Merge? / Picard
2
0
Entering edit mode
11.3 years ago
21286786 • 0

I have merged bam files from 6 lanes for a number of samples, and am trying to use picard MarkDuplicates. However, I get an error PicardException: Value was put into PairInfoMap more than once. Which I've learn is due to some issues with the read group information.

I'm planning to rerun samtools merge using the -r and -h options (ie samtools merge -rh rg.txt in1.bam in2.bam in3.bam in4.bam in5.bam in6.bam out.bam) but I'm not sure what file to use for the -h option, what needs to be included etc in the required file. Could anyone please let me know where to get the file or what to include?

Thanks in advance

samtools picard merge bam read error • 4.5k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
2
Entering edit mode
11.3 years ago

The file specified by -h is effectively the header of a SAM file in text format. If you did "samtools view -H in1.bam > rg.txt", you'll get a header that you can then edit in any text editor. In practice, you probably don't want to reheader the file, since the headers for the inputs should be the same (at least as far as it matters) and they should all be sorted equivalently. The -r option should take care of adding the read groups to the merged file appropriately.

Just as a point of warning, don't get too aggressive with changing the header of BAM files. If you change the chromosome order in them, then you end up changing the chromosome/contig alignment for your reads, which can really shoot you in the foot.

ADD COMMENT
0
Entering edit mode
11.3 years ago
samsara ▴ 630

I wounder if you are the one who posted same question in seqanswers.com

ADD COMMENT

Login before adding your answer.

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