Answers.Body: <p>gnomAD provides a global Allele Frequency as well as AF values for most subsets. gnomAD does not provide individual genotypes (as far as I know), so calculating custom AF for non-precomputed subsets might not be possible.</p>
  <p>Since you're interested in the NFE (non-Finnish European) sub-population, the <code>nfe_*_AF</code> fields might be of interest to you.</p>
  <hr />
  <p>As far as calculating the fraction of non-WT samples from <code>num_homozygous_samples</code>, <code>AC</code>, and <code>AN</code> goes, your formula seems spot on. Here's my deconstruction of the formula:</p>
  <p>Your formula is: <code>(AC - num_homozygous_samples)/(AN / 2))</code></p>
  <p><code>AN/2</code> is the number of samples (assuming all samples are diploid). <code>AC - num_homo</code> gives you <code>2 * num_hets</code>. Dividing this by number of samples gives you frequency of samples with at least one ALT allele.</p>
  <p>For example, let's take a dataset of 200 diploid samples where 100 are WT, 75 are het and 25 are hom-alt for a biallelic variant.</p>
  <p>Since there are 200 diploid samples, <code>AN</code> is 400.</p>
  <p><code>AC</code> for the ALT allele is <code>(75 * 1) + (25 * 2) = 125</code>.</p>
  <p>Since 100 are WT, it is known that fraction of samples with mutation = <code>1 - (100/200) = 0.5</code>. This number can be arrived using your formula:</p>
  <pre><code>(AC - num_homozygous_samples) / (AN/2)
   = ((125 - 25) / (400/2))
   = 100 / 200
   = 0.5
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-12T15:39:30.277Z
Answers.LastActivityDate: 2024-01-12T15:39:30.277Z
Answers.UserDisplayName: Ram RS
Body: <p>In gnomAD related article</p>
  <p><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9160216/#:%7E:text=Allele%20frequency%20is%20calculated%20by,can%20differ%20substantially%20between%20positions" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9160216/#:~:text=Allele%20frequency%20is%20calculated%20by,can%20differ%20substantially%20between%20positions</a></p>
  <p>I road this section</p>
  <blockquote>
  <p>Allele frequency is calculated by dividing allele count by allele
  number, hence, allele frequency represents the frequency of
  confidently sequenced haplotypes that carry the allele in question
  (because coverage and sequencing quality varies across the genome, the
  allele number can differ substantially between positions). Allele
  frequency is not equivalent to the percentage of individuals that
  carry the allele, but is a suitable value for expressing the frequency
  of a variant in the general population. The number of individuals
  carrying a variant will depend on the number of heterozygous and
  homozygous individuals but can be calculated from the data provided in
  the variant table.</p>
  </blockquote>
  <p>Does this mean, for getting the frequency of each allele in gnomAD, one could use <code>Allele frequency (AF)</code> column or must calculate population frequency?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-11T13:48:50.833Z
Comments.Text: What VCF fields are you comparing? I see the gnomAD has the overall `AF` field and various `AF` fields calculated by sample subset.
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-11T14:14:59.763Z
Comments.Text: How did you subset gnomAD VCF to non-finnish samples only?
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-11T15:35:44.547Z
Comments.Text: You might find gnomAD's non-cancer AF fields useful. I'll try to decipher the formula. `AN/2` is the number of samples (assuming all samples are diploid). `AC - num_homo` gives you `2*(num(hets))`. Dividing this by number of samples gives you frequency of samples with at least one ALT allele.
Comments.UserDisplayName: Ram RS
Tags: <allele-frequency><gnomad>
Title: Variant allele frequency versus population frequency
ThreadText: # Variant allele frequency versus population frequency
  
  (Asked by: username_0 on 2024-01-11)
  
  In gnomAD related article
  
  [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9160216/#:~:text=Allele%20frequency%20is%20calculated%20by,can%20differ%20substantially%20between%20positions](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9160216/#:%7E:text=Allele%20frequency%20is%20calculated%20by,can%20differ%20substantially%20between%20positions)
  
  I road this section
  
  > Allele frequency is calculated by dividing allele count by allele
  > number, hence, allele frequency represents the frequency of
  > confidently sequenced haplotypes that carry the allele in question
  > (because coverage and sequencing quality varies across the genome, the
  > allele number can differ substantially between positions). Allele
  > frequency is not equivalent to the percentage of individuals that
  > carry the allele, but is a suitable value for expressing the frequency
  > of a variant in the general population. The number of individuals
  > carrying a variant will depend on the number of heterozygous and
  > homozygous individuals but can be calculated from the data provided in
  > the variant table.
  
  Does this mean, for getting the frequency of each allele in gnomAD, one could use `Allele frequency (AF)` column or must calculate population frequency?
  
  **Tags:** allele-frequency, gnomad
  
  > **Comments:**
  > **username_1**: What VCF fields are you comparing? I see the gnomAD has the overall `AF` field and various `AF` fields calculated by sample subset.  
  > **username_1**: How did you subset gnomAD VCF to non-finnish samples only?  
  > **username_1**: You might find gnomAD's non-cancer AF fields useful. I'll try to decipher the formula. `AN/2` is the number of samples (assuming all samples are diploid). `AC - num_homo` gives you `2*(num(hets))`. Dividing this by number of samples gives you frequency of samples with at least one ALT allele.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-12. Score: 3 | Accepted answer
  
  gnomAD provides a global Allele Frequency as well as AF values for most subsets. gnomAD does not provide individual genotypes (as far as I know), so calculating custom AF for non-precomputed subsets might not be possible.
  
  Since you're interested in the NFE (non-Finnish European) sub-population, the `nfe_*_AF` fields might be of interest to you.
  
  ---
  
  As far as calculating the fraction of non-WT samples from `num_homozygous_samples`, `AC`, and `AN` goes, your formula seems spot on. Here's my deconstruction of the formula:
  
  Your formula is: `(AC - num_homozygous_samples)/(AN / 2))`
  
  `AN/2` is the number of samples (assuming all samples are diploid). `AC - num_homo` gives you `2 * num_hets`. Dividing this by number of samples gives you frequency of samples with at least one ALT allele.
  
  For example, let's take a dataset of 200 diploid samples where 100 are WT, 75 are het and 25 are hom-alt for a biallelic variant.
  
  Since there are 200 diploid samples, `AN` is 400.
  
  `AC` for the ALT allele is `(75 * 1) + (25 * 2) = 125`.
  
  Since 100 are WT, it is known that fraction of samples with mutation = `1 - (100/200) = 0.5`. This number can be arrived using your formula:
  
  ```
  (AC - num_homozygous_samples) / (AN/2)
   = ((125 - 25) / (400/2))
   = 100 / 200
   = 0.5
  
  ```
  
  
  ---
  
  