I am analyzing ukbb data and I have patient IDs for both cases and controls. Now I want the genetic data of all patients based on their IDs. I am trying to test with chromosome 5 as I have both bgen and sample file. I am using plink 2 for the conversion of bgen and sample file
plink2 --bgen ukb_chr5_v3.bgen ref-first --sample ukb22828_c5_b0_v3_s487239.sample --make-bed --out testfile

I am getting three files as output like .pgen .psam .pvar. This is how .psam looks like,

482828 482282 1

and .pvar file has five columns, chromosome, position, ID, ref allele, alt allele. I am still confused which IDs have the corresponding alleles/genotypes. Please guide me in further analysis. My goal is find genetic data of specfic IDs which I am looking for. Thanks

  • $\begingroup$ The genotypes are in the .pgen file, but encoded as a binary, so you can't query it directly. What are you going to do with the genotypes? $\endgroup$
    – user438383
    Oct 28 '21 at 10:15
  • $\begingroup$ My aim is to calculate polygenic risk scores using pre-calculated weights for each individual and for that I possibly need effect allele count (0,1, or 2) $\endgroup$
    – Muhammad
    Oct 28 '21 at 12:33

Your Answer


Browse other questions tagged or ask your own question.