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
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)