I have 10,000 controls and 3000 cases and the .bgen file has genotype of 200,000 individuals. I would like to extract only those individuals from the .bgen file that are either cases or controls using plink for downstream analyses. How can i do that?
You can use qctool for this. If you create a list of IDs in
list.txt (one ID per line), you can filter the .bgen file(s) by running
qctool -g yourdata.bgen -s yourdata.sample -incl-samples list.txt -og yourdata_filtered.bgen