To avoid the errors what I did was to go back and call all the SNPs at once and filter one single vcf out of all the accessions that I'm working on.
Hi Everyone,
I have multiple vcf files from different plant populations, when it comes do doing a STRUCTURE analysis I need to have all the populations in one vcf file. Although the reference genome is the same for all the vcf files generated, when I merge them it leads to deletion of population specific alleles which in return causes the absence of genetic structure within each population.
Is there a standard way to merge them without the cost of losing population specific alleles?
1 answer
Have these VCF files all been obtained using the same pipeline? Because if not, you might introduce method bias into your STRUCTURE analysis. If you have the genomic VCF (gVCF) files it may be better to merge them as they have a genotype for each position.
I have used the following code for merging in a snakemake workflow:
bcftools index -f {input.vcf1}
bcftools index -f {input.vcf2}
bcftools merge --threads {threads} -0 -o {output} {input.vcf1} {input.vcf2}
This can be extended to multiple files. The -0 parameter yields the reference allele in every position without genotype for that sample.
See https://samtools.github.io/bcftools/bcftools.html
Here is the whole workflow this is from: https://github.com/mdondrup/admixture_workflow Feel free to adapt it to your needs, it is now made for yeast. It uses ADMIXTURE instead of STRUCTURE and a bunch of other tools and generates ADMIXTURE plots with improved choice of colors.
Log in to answer this question.
how did you merge ?