Question: How Do I Create An Rg.Txt File For Input Into Samtools Merge? / Picard
gravatar for 21286786
5.6 years ago by
212867860 wrote:

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

read samtools error picard merge bam • 2.7k views
ADD COMMENTlink modified 5.6 years ago by samsara580 • written 5.6 years ago by 212867860

cross posted on SE:

ADD REPLYlink written 5.6 years ago by Pierre Lindenbaum119k
gravatar for Devon Ryan
5.6 years ago by
Devon Ryan89k
Freiburg, Germany
Devon Ryan89k wrote:

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 COMMENTlink written 5.6 years ago by Devon Ryan89k
gravatar for samsara
5.6 years ago by
The Earth
samsara580 wrote:

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

ADD COMMENTlink written 5.6 years ago by samsara580
Please log in to add an answer.


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