This is a test version of Biostars. For the public version, visit https://www.biostars.org.
defining reference alleles in 23andMe file to create plink .ped file

I created .ped and .map pairs of each individual from 23andMe raw text format by using plink. As far as I know,

plink --bfile binary_fileset --recode 12 --out new_text_fileset

--recode 12 command creates a genomic 0,1,2 matrix (If reference allele is A and genotype is AA, it gives 2, if genotype is AT it gives 1, TT gives 0) from .bed, .bim and .fam files. However, we do not know which allele is reference for each snp. Does plink defines the reference allele instead of us or do we have to pass on external reference allele data to plink? If so, how do we integrate reference allele data to plink .ped and .map file? 23andMe txt file only contains genotype pair for each snp.

Example 23andMe raw data format:

# rsid    chromosome    position    genotype
rs4477212    1    82154    AA
rs3094315    1    752566    AA
rs3131972    1    752721    GG
ped plink snp

1 answer

When it's necessary to have correct reference alleles, you can use the --a2-allele flag, which is designed to scrape them from e.g. a VCF file.

Note that --a2-allele should be present during the final --recode 12 export step. If you use it earlier, but not during the final export, PLINK may swap your reference and alternate alleles in between. (Especially if you save to .ped/.map format in between--that doesn't track reference vs. alternate alleles at all!)

What is the usage of --a2-allele flag? What is input file and output file format? Could you post an example usage? I have .bim, .fam and .bed fileset of my 23andMe individuals now, how do input these to plink --a2-allele?

Log in to answer this question.