This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SNP calling with SAMtools on multiple samples

Hello.

I found similar questions here, but couldnt find exactly what I am searching for.

I have several (+180) .bam files, each from a different sample. I will proceed to SNP calling with SAMtools/bcftools. I need to obtain a single .vcf file with all my samples on it. Should I merge all my .bam files and do the SNP calling once, or should I do the SNP calling for each sample and then merge all the .vcf files?

Thanks in advance!

snp samtools vcf bam

2 answers

you call all the bams with one call of bcftools mpileup https://samtools.github.io/bcftools/bcftools.html#mpileup

 -b, --bam-list FILE
    List of input alignment files, one file per line [null]

Thanks! This will output a single .vcf file, with all the samples?

Thanks! This will output a single .vcf file, with all the samples?

yes.

Hi @Pierre Lindenbaum

how if I merged all bam files in one single bam that containll samples with their RG tag, then call varaints with samtools and bcftools

Thanks for your attention

You don't need to change anything, just feed it the merged bam. From the bcftools docs:

"Individuals are identified from the SM tags in the @RG header lines. Multiple individuals can be pooled in one alignment file, also one individual can be separated into multiple files. If sample identifiers are absent, each input file is regarded as one sample."

Log in to answer this question.