Converting plink binary file to 0,1,2 genotype matrix format

1,779 views
Skip to first unread message

cvasu...@gmail.com

unread,
Feb 28, 2021, 7:07:36 PM2/28/21
to plink2-users

Dear Christopher,

I have a plink binary file (toy2.bed+toy2.bim+and toy2.fam) which have 1000 individual and 10000 SNP. I was trying to convert plink binary file to genotypic format (expecting 0,1 and 2) for preparing Genomic relationship matrix (GRM).  I have used following commands

 ./plink --bfile toy2 --recode --out toy2  ## this gives toy2.ped+toy2.map

./plink --ped toy2.ped --map toy2.map --recode12  --out plink ## this gives you genotype as 0, 1, 2 format.

Finally, when I read the output file plink.ped in R. The number of rows are 1000 (similar to individuals) but column was 20006 (there are six column (fid,iid,pid,mid,sex,phenotype+10000 value for allele 1+10000 value for allele 2). To prepare GRM matrix, should I consider all the value or I should consider only allele1 only?

Thanks in advance.

Regards

Christopher Chang

unread,
Feb 28, 2021, 11:25:25 PM2/28/21
to plink2-users
I don't know what tutorial you're following, but it's seriously out of date.  The data formats you're converting to are harder to compute the GRM off of than the one you started with (you can just use e.g. "plink --bfile toy2 --make-grm-bin", or do the same with GCTA).  Plain --recode is a mistake >95% of the time; --bfile/--make-bed is far faster and more resource-efficient.

Moksedul Momin

unread,
Mar 2, 2021, 1:39:49 AM3/2/21
to Christopher Chang, plink2-users
Dear Christopher,
Thanks for your mail. I can estimate GRM using GCTA or PLINK. 
I want to convert the plink binary file to the genotypic matrix with the values 0, 1, and 2 (nxm matrix, where n=number of individual and m= number of SNP). I will make GRM using R to understand how GRM estimated for my better understanding.
How can I convert plink binary file or ped (pedigree file to the genotypic matrix)?
I will appreciate it if you can help.
Thanks in advance for your kind help. 

Regards
Momin

--
You received this message because you are subscribed to a topic in the Google Groups "plink2-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/plink2-users/T3jPYNRegm4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to plink2-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plink2-users/db6cbd00-40a9-4e25-a101-dc5b630fe27bn%40googlegroups.com.


--

Md. Moksedul Momin

Assistant Professor (On-Leave)

Dept. of Genetics and Animal Breeding

Faculty of Veterinary Medicine

Chittagong Veterinary and Animal Sciences University

Contact no: +8801719366552

&

Ph.D. Candidate

UniSA Allied Health & Human Performance

University of South Australia

Contact no: +61480242571 
Reply all
Reply to author
Forward
0 new messages