Question: How to extract a subset of samples from plink .bed files
0
gravatar for eyb
4 days ago by
eyb180
Russian Federation
eyb180 wrote:

Hello. I am trying to extract data from .bed file using the following command:

./plink_linux_i686_20200616/plink --bed study.bed --bim study.bim --fam study.fam --keep-fam ii.txt --make-bed --out ii

It works for affected samples, but when I try to do the same for controls it says that there are 0 samples left after filtration. Could it be because the order of control samples is different in --keep-fam txt file and fam file itself? The order of affected samples and samples in txt file matches.

ped plink bed • 44 views
ADD COMMENTlink written 4 days ago by eyb180

Order does not matter.

If you need help figuring out what happened, please post the .log file from the problematic run, along with the top lines from your .fam file and the —keep-fam file you used.

ADD REPLYlink written 4 days ago by chrchang5237.3k

Here is the plink log from problematic run.

 PLINK v1.90b6.18 32-bit (16 Jun 2020) Options in effect:   --bed
 study.bed   --bim study.bim   --fam study.fam   --keep-fam
 controls_ii.txt   --make-bed   --out controls_ii

 Hostname: aydar-XPS-13-9360 Working directory:
 /home/aydar/Documents/khrunin Start time: Wed Sep 16 17:39:18 2020

 Random number seed: 1600267158 15775 MB RAM detected; reserving 2047
 MB for main workspace. 714238 variants loaded from .bim file. 144
 people (69 males, 74 females, 1 ambiguous) loaded from .fam. Ambiguous
 sex ID written to controls_ii.nosex . 96 phenotype values loaded from
 .fam. Error: No people remaining after --keep-fam.

 End time: Wed Sep 16 17:39:19 2020

Here is the top of the fam file:

204171650105_R01C01 061-ii-1 0 0 2 2
204171650105_R01C02 075-ii-1 0 0 1 2
204171650105_R02C01 062-ii-1 0 0 1 2
204171650105_R02C02 077-ii-1 0 0 1 2
204171650105_R03C01 063-ii-1 0 0 1 2

here is --keep-fam txt:

2041171650112_R01C01
2041171650112_R02C01
2041171650112_R03C01
2041171650112_R04C01
2041171650112_R05C01
ADD REPLYlink modified 4 days ago • written 4 days ago by eyb180

Look closely at your --keep-fam file. The IDs are slightly off: "204117..." instead of "20417...".

ADD REPLYlink written 4 days ago by chrchang5237.3k

Thanks, but at the top of the fam file are IDs that I already extracted. IDs that I need are somewhere in the middle.

ADD REPLYlink written 4 days ago by eyb180

The number of digits is different. From what you have posted, there is every reason to believe you made a mistake creating this --keep-fam file, and your problem will go away when you fix that mistake.

ADD REPLYlink written 4 days ago by chrchang5237.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1931 users visited in the last hour