I have a phased VCF file and I need to change the alleles of the SNPs so that the alleles coded as 0 represent the ancestral state while the alleles coded as 1 represent the derived state.
I got a list of ancestral and derive states for my SNPs in my VCF file and I want to change them using PLINK.
If I have a list of ancestral alleles in a file
ancestral_snps.txt , if I use the following command will I get the wanted output?
plink --vcf myvcf.vcf --a1-allele ancestral_snps.txt --recode vcf --out myvcfancestral.vcf
Or is it
I assume that this change won't affect the phasing of my data, right? As I basically only recoded the alleles.
Following Christopher Chang's comment:
ancestral_snps.txt file looks like this, specifying which allele is ancestral:
C rs1001 G rs1002 A rs1003
If I use this command in
PLINK2, will the ancestral alleles be coded as 0 in my phased VCF?
./plink2 --vcf myvcf.vcf --ref-allele force 1 2 ancestral_snps.txt --recode vcf --out myvcfancestral.vcf