Merge BAM files without retaining sample information
1
1
Entering edit mode
7.9 years ago
yampolsk ▴ 10

I want to merge several groups of BAM files in such a way that when I then create an mpileup from the resulting merged files, reads in each group are treated as if they are coming from the same population. Should I do

samtools merge -r 1.bam 1.1.bam 1.2.bam 1.3.bam

samtools merge -r 2.bam 2.1.bam 2.2.bam 2.3.bam

etc.

and then

samtools mpileup -R -o 123.mpileup 1.bam 2.bam etc.

OR

should I simply not use -r in samtools merge or -R in samtools mpileup?

Is there a difference?

Thank you!

samtools • 2.3k views
ADD COMMENT
1
Entering edit mode
7.9 years ago

You could use the 'AddOrReplaceReadGroups' command in Picard (https://sourceforge.net/projects/picard/) to set the read group to what you want them to be in each BAM file after merging.

ADD COMMENT

Login before adding your answer.

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