Extract specific variants from binary plink files
1
1
Entering edit mode
5.8 years ago
OAJn8634 ▴ 60

Hi, I have plink binary file (mydata.ped, mydata.fam, and mydata.bim). Using this data I need to create a file that will contain all patients with two APOE variants. Ideally this file willl be in a text format and will contain patients identifier (IID and/or FID) and two APOE variants. However, I do not know how to do it. I will be very grateful for any advice. Many thanks. O

snp gene plink • 6.4k views
ADD COMMENT
3
Entering edit mode
5.8 years ago
kakukeshi ▴ 80

Create a file called, for example, snps.txt with the list of SNPs you want to extract and then run

plink \
 --bed mydata.bed \
 --bim mydata.bim \
 --fam mydata.fam \
 --extract snps.txt \
 --make-bed \
 --out mydata_subset
ADD COMMENT
0
Entering edit mode

Hi, Thank you so much for this. It is so helpful. I have just tried to run this and I get the following error:

Error: No variants remaining after --extract.

I am a bit puzzled by this as I have more than 20M variants. I would have thought it would be extremely unlikely if the Apoe variants are not among them. I will be grateful for any thought regarding this.

ADD REPLY
2
Entering edit mode

Check using grep in the bim file (chr19)

grep "rs7412" mydata.bim
ADD REPLY
0
Entering edit mode

Hi, Thank you so much for your help. I have checked with grep and the APOE does not appear to be among my variants (even though I have more than 20M of them (imputed)). Is it possible that there is something incorrect with my data?

ADD REPLY
0
Entering edit mode

By the way, even when I run this command for a variant that I know is present in my data, I get the same error. Perhaps there is another way of constructing the text format and will contain patients identifier (IID and/or FID) and APOE. Many thanks in advance

ADD REPLY
0
Entering edit mode

check in the log if its really reading the variants in the snps.txt file

ADD REPLY
0
Entering edit mode

It has worked! Thank you so much for your advice and patience :)

ADD REPLY

Login before adding your answer.

Traffic: 1754 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6