This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract variant positions from single sample VCFs prior to merging ?

Hi y'all,

I just completed some QC filtering on about 100 single sample VCFs. As a result of filtering, each VCF no longer contains the same set of variant positions (some positions which failed QC in one, passed in another). I would like to obtain a list of of variant positions which are shared among all VCFs so that I can obtain files which are all of the same length and can be merged into a single multi-sample VCF. Any suggestions on how to do this?

Thanks in advance.

Best,
Steve

sequencing snp sequence

Just comment and thought: Right now I am doing similar thing. I also called SNP for each sample separately and merged later on using bcftools merge. Later on realized that shared position (if no SNP in one sample but may present in other against reference) will not have any information about read coverage which we already discarded during SNP calling. So later on while merging only had skewed data: only het and alternate allele to reference in positions-- no allele in sample similar to reference.

1 answer

You don't need to have vcf files with same length to merge them.

Post not found

Will the resulting file contain only shared positions? I can't have missing genotypes.

Thanks,
Steve

You can use vcftools for that. --max-missing or --max-missing-count

Great, thank you very much.

Log in to answer this question.