1
$\begingroup$

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?

$\endgroup$

1 Answer 1

2
$\begingroup$

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

$\endgroup$
6
  • $\begingroup$ what does .sample file contain? $\endgroup$
    – serenaarez
    Dec 9, 2021 at 20:16
  • $\begingroup$ It's a type of file in the Oxford format that usually contains IDs, missingness, sex, and other covariates (similar to a plink's .fam file). More info here: well.ox.ac.uk/~gav/qctool/documentation/… $\endgroup$ Dec 9, 2021 at 20:27
  • $\begingroup$ so in my .sample file do i only need the ids that need to be extracted or all the ids present in the .bgen file? $\endgroup$
    – serenaarez
    Dec 10, 2021 at 11:28
  • $\begingroup$ the order of the ids must be the same as in the genotype file, how can i know the order in the genotype files? $\endgroup$
    – serenaarez
    Dec 10, 2021 at 11:35
  • $\begingroup$ You should have a .sample file together with the BGEN data already. If you don't, it might be worth checking with who provided the data in the first place, since you can technically obtain one from the BGEN file but it's a laborious process. $\endgroup$ Dec 10, 2021 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.