Merge bam files and get VCF file
1
1
Entering edit mode
5.2 years ago

I have 2 sorted Bam files and I want to merge them and get a VCF file from them using samtools pileup.

first i merge these 2 files with samtools merge and then I get a VCF file as output.

samtools mpileup genome.fa merged-bam.bam output.vcf

then I use

samtools mpileup genome.fa 1.bam 2.bam  output.vcf

but the output of these 2 approach had different size. where am I doing wrong?

thanks a lot

RNA-Seq SNP bam • 2.8k views
ADD COMMENT
4
Entering edit mode
5.2 years ago

my answer depends of your sam header+ read-group ( https://gatkforums.broadinstitute.org/gatk/discussion/6472/read-groups )

1) samtools merge : would produce one bam and you'll get only one virtual sample in the final vcf (see the columns after FORMAT in the '#CHROM' line)

2) the 2nd command 'samtools mpileup genome.fa 1.bam 2.bam output.vcf' will produce a vcf with two samples (this is what your want in 99% of the use cases)

ADD COMMENT
0
Entering edit mode

I have read the link you shared, I didn't understand it properly. how should my bam file header be to use the second approach?

ADD REPLY
1
Entering edit mode

i you have defined read-groups, for each sample, there should be no difference event if you merge the bam.

ADD REPLY

Login before adding your answer.

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