|
60 | 60 | } |
61 | 61 | @media print { |
62 | 62 | pre > code.sourceCode { white-space: pre-wrap; } |
63 | | -pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } |
| 63 | +pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; } |
64 | 64 | } |
65 | 65 | pre.numberSource code |
66 | 66 | { counter-reset: source-line 0; } |
@@ -343,50 +343,96 @@ <h1 class="title toc-ignore">Calculating and Inferring Relatedness |
343 | 343 |
|
344 | 344 | <div id="introduction" class="section level1"> |
345 | 345 | <h1>Introduction</h1> |
346 | | -<p>This vignette demonstrates analytic methods for determining |
347 | | -relatedness in a pedigree. The relatedness coefficient is a measure of |
348 | | -the genetic overlap between two individuals. In the simplest terms, it |
349 | | -quantifies the genetic overlap between two individuals. The relatedness |
350 | | -coefficient ranges from 0 to 1, with 1 indicating a perfect genetic |
351 | | -match (which occurs when comparing an individual to themselves, their |
352 | | -identical twin, or their clone), whereas 0 indicates no genetic overlap. |
353 | | -We introduce two functions: <code>calculateRelatedness</code> and |
354 | | -<code>inferRelatedness</code>, which allow users to compute and infer |
355 | | -the relatedness coefficient, respectively.</p> |
356 | | -<div id="loading-required-libraries" class="section level2"> |
357 | | -<h2>Loading Required Libraries</h2> |
358 | | -<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">library</span>(BGmisc)</span></code></pre></div> |
| 346 | +<p>This vignette demonstrates how to quantify relatedness using two |
| 347 | +functions from the <code>BGmisc</code> package: - |
| 348 | +<code>calculateRelatedness</code> computes the relatedness coefficient |
| 349 | +based on known genealogical structure, and - |
| 350 | +<code>inferRelatedness</code> infers the relatedness coefficient from |
| 351 | +observed phenotypic correlations under a fixed ACE model.</p> |
| 352 | +<p>The relatedness coefficient <span class="math inline">\(r\)</span> |
| 353 | +indexes the proportion of alleles shared identically by descent (IBD) |
| 354 | +between two individuals. This value ranges from 0 (no shared alleles by |
| 355 | +descent) to 1 (a perfect genetic match, which occurs when comparing an |
| 356 | +individual to themselves, their identical twin, or their clone). Values |
| 357 | +can be interpreted in the context of standard relationships: e.g., full |
| 358 | +siblings are expected to have <span class="math inline">\(r = |
| 359 | +0.5\)</span>, half siblings <span class="math inline">\(r = |
| 360 | +0.25\)</span>, and first cousins <span class="math inline">\(r = |
| 361 | +0.125\)</span>.</p> |
359 | 362 | </div> |
360 | | -<div id="calculating-relatedness-coefficient" class="section level2"> |
361 | | -<h2>Calculating Relatedness Coefficient</h2> |
| 363 | +<div id="calculating-relatedness-coefficient" class="section level1"> |
| 364 | +<h1>Calculating Relatedness Coefficient</h1> |
362 | 365 | <p>The <code>calculateRelatedness</code> function offers a method to |
363 | | -compute the relatedness coefficient based on shared ancestry, as |
364 | | -described by Wright (1922). This function utilizes the formula:</p> |
| 366 | +compute the relatedness coefficient based on shared ancestry. The |
| 367 | +function computes <span class="math inline">\(r\)</span> based on |
| 368 | +generational distance to one or more shared ancestors, according to |
| 369 | +Wright’s (1922) formulation:</p> |
365 | 370 | <p><span class="math display">\[ |
366 | 371 | r_{bc} = \sum \left(\frac{1}{2}\right)^{n+n'+1} (1+f_a) |
367 | 372 | \]</span></p> |
368 | | -<p>Where <span class="math inline">\(n\)</span> and <span class="math inline">\(n'\)</span> represent the number of |
369 | | -generations back of common ancestors the pair share.</p> |
370 | | -<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># Example usage:</span></span> |
371 | | -<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="co"># For full siblings, the relatedness coefficient is expected to be 0.5:</span></span> |
372 | | -<span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a><span class="fu">calculateRelatedness</span>(<span class="at">generations =</span> <span class="dv">1</span>, <span class="at">full =</span> <span class="cn">TRUE</span>)</span> |
373 | | -<span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co">#> [1] 0.5</span></span></code></pre></div> |
374 | | -<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="co"># For half siblings, the relatedness coefficient is expected to be 0.25:</span></span> |
375 | | -<span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a><span class="fu">calculateRelatedness</span>(<span class="at">generations =</span> <span class="dv">1</span>, <span class="at">full =</span> <span class="cn">FALSE</span>)</span> |
376 | | -<span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a><span class="co">#> [1] 0.25</span></span></code></pre></div> |
377 | | -</div> |
| 373 | +<p>Here, <span class="math inline">\(n\)</span> and <span class="math inline">\(n'\)</span> are the number of generations from |
| 374 | +each descendant to a common ancestor <span class="math inline">\(a\)</span>, and <span class="math inline">\(f_a\)</span> is the inbreeding coefficient of |
| 375 | +<span class="math inline">\(a\)</span>, assumed to be zero unless |
| 376 | +specified otherwise.</p> |
| 377 | +<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">library</span>(BGmisc)</span> |
| 378 | +<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a><span class="co"># Example usage:</span></span> |
| 379 | +<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="co"># For full siblings, the relatedness coefficient is expected to be 0.5:</span></span> |
| 380 | +<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a><span class="fu">calculateRelatedness</span>(<span class="at">generations =</span> <span class="dv">1</span>, <span class="at">full =</span> <span class="cn">TRUE</span>)</span> |
| 381 | +<span id="cb1-5"><a href="#cb1-5" tabindex="-1"></a><span class="co">#> [1] 0.5</span></span> |
| 382 | +<span id="cb1-6"><a href="#cb1-6" tabindex="-1"></a><span class="co"># For half siblings, the relatedness coefficient is expected to be 0.25:</span></span> |
| 383 | +<span id="cb1-7"><a href="#cb1-7" tabindex="-1"></a><span class="fu">calculateRelatedness</span>(<span class="at">generations =</span> <span class="dv">1</span>, <span class="at">full =</span> <span class="cn">FALSE</span>)</span> |
| 384 | +<span id="cb1-8"><a href="#cb1-8" tabindex="-1"></a><span class="co">#> [1] 0.25</span></span></code></pre></div> |
| 385 | +<p>These examples illustrate how relatedness changes based on whether |
| 386 | +the siblings share both parents (full) or only one (half). When |
| 387 | +<code>full = TRUE</code>, each sibling is one generation from the shared |
| 388 | +pair of parents, yielding <code>r=0.5</code>. When |
| 389 | +<code>full = FALSE</code>, they share only one parent, yielding |
| 390 | +<code>r=0.25</code>.</p> |
378 | 391 | </div> |
379 | 392 | <div id="inferring-relatedness-coefficient" class="section level1"> |
380 | 393 | <h1>Inferring Relatedness Coefficient</h1> |
381 | | -<p>The <code>inferRelatedness</code> function is designed to infer the |
382 | | -relatedness coefficient between two groups based on the observed |
383 | | -correlation between their additive genetic variance and shared |
384 | | -environmental variance. This function leverages the <code>ACE</code> |
385 | | -framework.</p> |
386 | | -<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a><span class="co"># Example usage:</span></span> |
387 | | -<span id="cb4-2"><a href="#cb4-2" tabindex="-1"></a><span class="co"># Infer the relatedness coefficient:</span></span> |
388 | | -<span id="cb4-3"><a href="#cb4-3" tabindex="-1"></a><span class="fu">inferRelatedness</span>(<span class="at">obsR =</span> <span class="fl">0.5</span>, <span class="at">aceA =</span> <span class="fl">0.9</span>, <span class="at">aceC =</span> <span class="dv">0</span>, <span class="at">sharedC =</span> <span class="dv">0</span>)</span> |
389 | | -<span id="cb4-4"><a href="#cb4-4" tabindex="-1"></a><span class="co">#> [1] 0.5555556</span></span></code></pre></div> |
| 394 | +<p>The <code>inferRelatedness</code> function solves for the relatedness |
| 395 | +coefficient <span class="math inline">\(r\)</span> implied by an |
| 396 | +observed phenotypic correlation under a fixed ACE variance |
| 397 | +decomposition. Specifically, it inverts the equation:</p> |
| 398 | +<p><span class="math display">\[ |
| 399 | +\text{obsR} = r \cdot a^2 + \text{sharedC} \cdot c^2 |
| 400 | +\]</span></p> |
| 401 | +<p>to obtain:</p> |
| 402 | +<p><span class="math display">\[ |
| 403 | +r = \frac{\text{obsR} - \text{sharedC} \cdot c^2}{a^2} |
| 404 | +\]</span></p> |
| 405 | +<p>where: - <code>obsR</code> is the observed phenotypic correlation |
| 406 | +between two individuals or groups. - <code>aceA</code> and |
| 407 | +<code>aceC</code> represent the proportions of variance due to additive |
| 408 | +genetic and shared environmental influences, respectively. - |
| 409 | +<code>sharedC</code> is the shared-environment analog to the relatedness |
| 410 | +coefficient: it indicates what proportion of the shared environmental |
| 411 | +variance applies to this pair (e.g., 1 for siblings raised together, 0 |
| 412 | +for siblings raised apart).</p> |
| 413 | +<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a><span class="co"># Example usage:</span></span> |
| 414 | +<span id="cb2-2"><a href="#cb2-2" tabindex="-1"></a><span class="co"># Infer the relatedness coefficient:</span></span> |
| 415 | +<span id="cb2-3"><a href="#cb2-3" tabindex="-1"></a><span class="fu">inferRelatedness</span>(<span class="at">obsR =</span> <span class="fl">0.5</span>, <span class="at">aceA =</span> <span class="fl">0.9</span>, <span class="at">aceC =</span> <span class="dv">0</span>, <span class="at">sharedC =</span> <span class="dv">0</span>)</span> |
| 416 | +<span id="cb2-4"><a href="#cb2-4" tabindex="-1"></a><span class="co">#> [1] 0.5555556</span></span></code></pre></div> |
| 417 | +<p>In this example, the observed correlation is 0.5, and no shared |
| 418 | +environmental variance is assumed. Given that additive genetic variance |
| 419 | +accounts for 90% of trait variance, the inferred relatedness coefficient |
| 420 | +is approximately 0.556. This reflects the proportion of genetic overlap |
| 421 | +that would be required to produce the observed similarity under these |
| 422 | +assumptions.</p> |
| 423 | +<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" tabindex="-1"></a><span class="co"># Now assume shared environment is fully shared:</span></span> |
| 424 | +<span id="cb3-2"><a href="#cb3-2" tabindex="-1"></a><span class="fu">inferRelatedness</span>(<span class="at">obsR =</span> <span class="fl">0.5</span>, <span class="at">aceA =</span> <span class="fl">0.45</span>, <span class="at">aceC =</span> <span class="fl">0.45</span>, <span class="at">sharedC =</span> <span class="dv">1</span>)</span> |
| 425 | +<span id="cb3-3"><a href="#cb3-3" tabindex="-1"></a><span class="co">#> [1] 0.1111111</span></span></code></pre></div> |
| 426 | +<p>In this case, the observed phenotypic correlation is still 0.5, and |
| 427 | +both additive genetic and shared environmental components are assumed to |
| 428 | +explain 45% of the variance. Because the shared environment is fully |
| 429 | +shared between individuals (sharedC = 1), much of the observed |
| 430 | +similarity is attributed to C, leaving only a small portion attributable |
| 431 | +to genetic relatedness. The function returns an inferred relatedness |
| 432 | +coefficient of approximately 0.11 — that is, the amount of additive |
| 433 | +genetic overlap required (under this model) to produce the remaining |
| 434 | +unexplained correlation after accounting for shared environmental |
| 435 | +similarity.</p> |
390 | 436 | </div> |
391 | 437 |
|
392 | 438 |
|
|
0 commit comments