Body: <p>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<br />
  <code>plink2 --bgen ukb_chr5_v3.bgen ref-first --sample ukb22828_c5_b0_v3_s487239.sample --make-bed --out testfile</code></p>
  <p>I am getting three files as output like .pgen .psam .pvar.
  This is how .psam looks like,</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">FID</th>
  <th style="text-align: center;">IID</th>
  <th style="text-align: right;">sex</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">482828</td>
  <td style="text-align: center;">482282</td>
  <td style="text-align: right;">1</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>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</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-28T10:15:50.920Z
Comments.Text: 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?
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-28T12:33:48.557Z
Comments.Text: 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)
Comments.UserDisplayName: Muhammad
Tags: <r><plink><phylogenetics><epidemiology>
Title: Linking UK biobank patient IDs with their corresponding genetic data
ThreadText: # Linking UK biobank patient IDs with their corresponding genetic data
  
  (Asked by: username_0 on 2021-10-27)
  
  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,
  
  | FID | IID | sex |
  | --- | --- | --- |
  | 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
  
  **Tags:** r, plink, phylogenetics, epidemiology
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: 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)  
  
  ---
  
  ## 0 answers
  
  