Answers.Body: <p>Here is a recent example of the derivation of the genotype model from <a href="https://www.nature.com/articles/s41587-021-00861-3#Sec11" rel="nofollow noreferrer">Octopus genotype calling paper</a>:</p>
  <blockquote>
  <p>All samples have known ploidy and copy number, so the likelihood function of reads <span class="math-container">$R$</span> given genotype <span class="math-container">$g$</span> is:</p>
  <p><span class="math-container">$p(R|g) = \mathop {\prod }\limits_{n = 1}^{|R|} \frac{1}{{|g|}}\mathop {\sum }\limits_{i = 1}^{|g|} p(r_n|g_i)$</span></p>
  <p>where <span class="math-container">$|g|$</span> is the ploidy and <span class="math-container">$|R|$</span> is the number of reads. The joint genotype posterior for <span class="math-container">$S$</span> samples is therefore given by:</p>
  <p><span class="math-container">$p({\bf{g}}|{{R}},{\cal{M}}_{{g}}) \propto p({\bf{g}}|{\cal{M}}_g)\mathop {\prod }\limits_{s = 1}^S p({{R}}_s|{\bf{g}}_s)$</span></p>
  <p>where the genotype prior model, <span class="math-container">$\cal{M}$</span>, is either the uniform or HWE-coalescent prior. Unfortunately, the number of genotype combinations g grows exponentially in the number of samples S, so we cannot evaluate the full posterior distribution in general. Therefore, other than for trivial cases, we first approximate the sample marginal genotype posterior distribution under the HWE model (without mutations) <span class="math-container">$(|,\cal{M})$</span> and use these marginal probabilities to select K genotype combinations <span class="math-container">$1,…,$</span> (K is user-defined) to evaluate under the full joint genotype model. The approximate posterior marginals are computed with expectation maximization.</p>
  </blockquote>
  <p>The source code can be found <a href="https://github.com/luntergroup/octopus/blob/develop/src/core/callers/population_caller.cpp" rel="nofollow noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-24T12:38:43.137Z
Answers.LastActivityDate: 2022-12-28T12:34:05.457Z
Answers.LastEditDate: 2022-12-28T12:34:05.457Z
Answers.UserDisplayName: user438383
Answers.Body: <p>To the best of my knowledge, the first joint calling model was published by <a href="https://pubmed.ncbi.nlm.nih.gov/20980557/" rel="nofollow noreferrer">Le &amp; Durbin (2011)</a> and refined in <a href="https://pubmed.ncbi.nlm.nih.gov/21903627/" rel="nofollow noreferrer">Li (2012)</a>. They come with detailed derivation. Both samtools and older GATK are using this model. GATK now uses a different model which only works with high-coverage data but is faster to compute. There are other alternatives (e.g. in <a href="https://arxiv.org/abs/1207.3907" rel="nofollow noreferrer">freebayes</a>).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-23T23:05:34.913Z
Answers.LastActivityDate: 2022-12-23T23:05:34.913Z
Answers.UserDisplayName: user172818
Body: <p>I am searching for a good reference that explains the statistical methodology used in what is variously known as Joint Genotyping, Cohort Genotyping or Multi-sample Genotyping. One with a pseudo code implementation would also be ideal.</p>
  <p>I have found several discussing the approach in very general terms and the relative benefits of the technique but nothing with actual equations or algorithms. Failing that, if there is an open source implementation that people would consider to be a reference implementation and that has excellent code documentation that would also be great.</p>
  
Tags: <genotyping>
Title: Reference for the statistical methodology used in joint genotype calling
ThreadText: # Reference for the statistical methodology used in joint genotype calling
  
  (Asked by: username_0 on 2022-12-22)
  
  I am searching for a good reference that explains the statistical methodology used in what is variously known as Joint Genotyping, Cohort Genotyping or Multi-sample Genotyping. One with a pseudo code implementation would also be ideal.
  
  I have found several discussing the approach in very general terms and the relative benefits of the technique but nothing with actual equations or algorithms. Failing that, if there is an open source implementation that people would consider to be a reference implementation and that has excellent code documentation that would also be great.
  
  **Tags:** genotyping
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-12-24. Score: 2
  
  Here is a recent example of the derivation of the genotype model from [Octopus genotype calling paper](https://www.nature.com/articles/s41587-021-00861-3#Sec11):
  
  > All samples have known ploidy and copy number, so the likelihood function of reads $R$ given genotype $g$ is:
  >
  > $p(R|g) = \mathop {\prod }\limits\_{n = 1}^{|R|} \frac{1}{{|g|}}\mathop {\sum }\limits\_{i = 1}^{|g|} p(r\_n|g\_i)$
  >
  > where $|g|$ is the ploidy and $|R|$ is the number of reads. The joint genotype posterior for $S$ samples is therefore given by:
  >
  > $p({\bf{g}}|{{R}},{\cal{M}}\_{{g}}) \propto p({\bf{g}}|{\cal{M}}\_g)\mathop {\prod }\limits\_{s = 1}^S p({{R}}\_s|{\bf{g}}\_s)$
  >
  > where the genotype prior model, $\cal{M}$, is either the uniform or HWE-coalescent prior. Unfortunately, the number of genotype combinations g grows exponentially in the number of samples S, so we cannot evaluate the full posterior distribution in general. Therefore, other than for trivial cases, we first approximate the sample marginal genotype posterior distribution under the HWE model (without mutations) $(|,\cal{M})$ and use these marginal probabilities to select K genotype combinations $1,…,$ (K is user-defined) to evaluate under the full joint genotype model. The approximate posterior marginals are computed with expectation maximization.
  
  The source code can be found [here](https://github.com/luntergroup/octopus/blob/develop/src/core/callers/population_caller.cpp).
  
  
  ---
  
  ### Answer by username_2 on 2022-12-23. Score: 2
  
  To the best of my knowledge, the first joint calling model was published by [Le & Durbin (2011)](https://pubmed.ncbi.nlm.nih.gov/20980557/) and refined in [Li (2012)](https://pubmed.ncbi.nlm.nih.gov/21903627/). They come with detailed derivation. Both samtools and older GATK are using this model. GATK now uses a different model which only works with high-coverage data but is faster to compute. There are other alternatives (e.g. in [freebayes](https://arxiv.org/abs/1207.3907)).
  
  
  ---
  
  