<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Intermediate Phylotranscriptomics Analyses • myTAI</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet">
<link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet">
<script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Intermediate Phylotranscriptomics Analyses">
</head>
<body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">myTAI</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">2.0.0</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto">
<li class="nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="active nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles">
<li><a class="dropdown-item" href="../articles/Advanced.html">Advanced Phylotranscriptomics Analyses</a></li>
    <li><a class="dropdown-item" href="../articles/Enrichment.html">Enrichment Analyses</a></li>
    <li><a class="dropdown-item" href="../articles/Expression.html">Gene Expression Analysis with `myTAI`</a></li>
    <li><a class="dropdown-item" href="../articles/Intermediate.html">Intermediate Phylotranscriptomics Analyses</a></li>
    <li><a class="dropdown-item" href="../articles/Introduction.html">Introduction to the myTAI package</a></li>
    <li><a class="dropdown-item" href="../articles/Phylostratigraphy.html">Discussing Genomic Phylostratigraphy</a></li>
  </ul>
</li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul>
<ul class="navbar-nav">
<li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json">
</form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/drostlab/myTAI/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
      </ul>
</div>


  </div>
</nav><div class="container template-article">




<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="../logo.png" class="logo" alt=""><h1>Intermediate Phylotranscriptomics Analyses</h1>
            
            <h4 data-toc-skip class="date">2024-10-03</h4>
      
      <small class="dont-index">Source: <a href="https://github.com/drostlab/myTAI/blob/HEAD/vignettes/Intermediate.Rmd" class="external-link"><code>vignettes/Intermediate.Rmd</code></a></small>
      <div class="d-none name"><code>Intermediate.Rmd</code></div>
    </div>

    
    
<p>In the <strong>Introduction</strong> vignette users learned how to
perform the most fundamental computations and visualizations for
phylotranscriptomics analyses using the <code>myTAI</code> package.</p>
<p>This <strong>Intermediate</strong> vignette introduces more detailed
analyses and more specialized techniques to investigate the observed
phylotranscriptomics patterns (<code>TAI</code>, <code>TDI</code>,
<code>RE</code>, etc.) and introduces the statistical framework to
quantify the significance of observed phenomena.</p>
<ul>
<li><a href="#flat-line-test">1. Details: Flat Line Test</a></li>
<li><a href="#reductive-hourglass-test">2. Details: Reductive Hourglass
Test</a></li>
<li><a href="#reductive-early-conservation-test">3. Details: Reductive
Early Conservation Test</a></li>
<li><a href="#reverse-hourglass-test">4. Details: Reverse Hourglass
Test</a></li>
<li><a href="#data-transformation">5. Data Transformation for log(TAI)
and sqrt(TAI) patterns</a></li>
</ul>
<div class="section level2">
<h2 id="investigating-the-statistical-significance-of-phylotranscriptomic-patterns">Investigating the Statistical Significance of Phylotranscriptomic
Patterns<a class="anchor" aria-label="anchor" href="#investigating-the-statistical-significance-of-phylotranscriptomic-patterns"></a>
</h2>
<p>Three methods have been proposed to quantify the statistical
significance of the observed phylotranscriptomics patterns (Quint et
al., 2012; Drost et al., 2015).</p>
<ul>
<li><strong>Flat Line Test</strong></li>
<li><strong>Reductive Hourglass Test</strong></li>
<li><strong>Reductive Early Conservation Test</strong></li>
</ul>
<p>Here, we will build the test statistic of each test step by step so
that future modifications or new test statistics can be built upon the
existing methods implemented in the <code>myTAI</code> package.</p>
<div class="section level3">
<h3 id="flat-line-test">Flat Line Test<a class="anchor" aria-label="anchor" href="#flat-line-test"></a>
</h3>
<p>The <strong>Flat Line Test</strong> is a permutation test quantifying
the statistical significance of an observed phylotranscriptomic pattern.
The goal is to detect any evolutionary signal within a developmental
time course that significantly deviates from a flat line.</p>
<p>To build the test statistic we start with a standard
PhyloExpressionSet. The <code>myTAI</code> package provides an example
PhyloExpressionSet named <code>PhyloExpressionSetExample</code>:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://drostlab.github.io/myTAI/">myTAI</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co"># load an example PhyloExpressionSet stored in the myTAI package</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span>
<span></span>
<span><span class="co"># look at the standardized data set format</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="fl">3</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Phylostratum      GeneID   Zygote Quadrant Globular     Heart  Torpedo      Bent    Mature
1            1 at1g01040.2 2173.635 1911.200 1152.555 1291.4224 1000.253  962.9772 1696.4274
2            1 at1g01050.1 1501.014 1817.309 1665.309 1564.7612 1496.321 1114.6435 1071.6555
3            1 at1g01070.1 1212.793 1233.002  939.200  929.6195  864.218  877.2060  894.8189</code></pre>
<p>Users will observe that the first column of the
<code>PhyloExpressionSetExample</code> stores the Phylostratum
assignments of the corresponding genes. The permutation test is based on
random sampling of the Phylostratum assignment of genes. The underlying
assumption is that the <code>TAI</code> profile of correctly assigned
Phylostrata is significantly deviating from <code>TAI</code> profiles
based on randomly assigned Phylostrata.</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/TAI.html">TAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334</code></pre>
<p>Visualization:</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># Visualize the TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>               p.value       <span class="op">=</span> <span class="cn">FALSE</span> <span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
3.543700 3.573999 3.554707 3.543376 3.582905 3.562813 3.523409 </code></pre>
<p>Visualization:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualize the TAI profile based on randomly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span>  <span class="va">randomPhyloExpressionSetExample</span>, </span>
<span>               p.value       <span class="op">=</span> <span class="cn">FALSE</span> <span class="op">)</span> </span></code></pre></div>
<p>Users will observe that the visual pattern of the correctly assigned
<code>TAI</code> profile and the randomly assigned <code>TAI</code>
profile differ qualitatively.</p>
<p>Now we investigate the variance of the two observed patterns.</p>
<pre><code>[1] 0.01147725</code></pre>
<pre><code>[1] 0.0004102549</code></pre>
<p>We observe that the variance of the randomly assigned TAI profile is
much smaller than the variance of the correctly assigned TAI profile.
Here we use the variance to quantify the <em>flatness</em> of a given
TAI profile. In theory the variance of a perfect flat line would be
zero. So any TAI profile that is close to zero would resemble a flat
line. But how exactly are the variances of randomly assigned TAI
profiles distributed? For this purpose the <code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
function was implemented.</p>
<p>The <code><a href="../reference/bootMatrix.html">bootMatrix()</a></code> takes an PhyloExpressionSet or
DivergenceExpressionSet as input and computes N <code>TAI</code> or
<code>TDI</code> profiles based on randomly assigned Phylostrata or
Divergence-Strata.</p>
<pre><code>    Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature
1 3.578000 3.577732 3.552230 3.556756 3.555627 3.553580 3.510978
2 3.590339 3.564544 3.589012 3.598754 3.583721 3.597553 3.633530
3 3.615284 3.616286 3.569486 3.566816 3.575761 3.554789 3.601522
4 3.501172 3.506554 3.486261 3.491282 3.531536 3.541634 3.494997
5 3.450857 3.458339 3.447274 3.463692 3.444261 3.468433 3.497926
6 3.539454 3.543827 3.595298 3.588149 3.582898 3.588062 3.565487</code></pre>
<p>Based on this <code>booMatrix</code> we can compute the variance of
each random TAI profile.</p>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># compute the variance of the random TAI profile for each row</span></span>
<span><span class="va">variance_vector</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/apply.html" class="external-link">apply</a></span><span class="op">(</span><span class="va">randomTAIs</span>, <span class="fl">1</span> , <span class="va">var</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># and visualize the distribution of variances</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/hist.html" class="external-link">hist</a></span><span class="op">(</span><span class="va">variance_vector</span>, breaks <span class="op">=</span> <span class="fl">100</span><span class="op">)</span></span></code></pre></div>
<p>Now it is interesting to see where we can find the variance of the
correctly assigned TAI.</p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># variance of the TAI profile based on correctly assigned Phylostrata</span></span>
<span><span class="va">var_real</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/cor.html" class="external-link">var</a></span><span class="op">(</span><span class="fu"><a href="../reference/TAI.html">TAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span><span class="op">)</span> </span>
<span></span>
<span><span class="co"># visualize the distribution of variances</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/hist.html" class="external-link">hist</a></span><span class="op">(</span> x      <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="va">variance_vector</span>,<span class="va">var_real</span><span class="op">)</span>, </span>
<span>      breaks <span class="op">=</span> <span class="fl">100</span>, </span>
<span>      xlab   <span class="op">=</span> <span class="st">"variance"</span>, </span>
<span>      main   <span class="op">=</span> <span class="st">"Histogram of variance_vector"</span> <span class="op">)</span></span>
<span></span>
<span><span class="co"># and plot a red line at the position where we can find the </span></span>
<span><span class="co"># real variance</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/abline.html" class="external-link">abline</a></span><span class="op">(</span>v <span class="op">=</span> <span class="va">var_real</span>, lwd <span class="op">=</span> <span class="fl">5</span>, col <span class="op">=</span> <span class="st">"red"</span><span class="op">)</span></span></code></pre></div>
<p>This plot illustrates that variances based on random <code>TAI</code>
profiles seem to have a smaller variance than the variance based on the
correct <code>TAI</code> profile. To obtain a p-value that now
quantifies this difference, we need to fit the histogram of
<code>variance_vector</code> with a specific probability
distribution.</p>
<p>Visually it would be possible to choose a gamma distribution to fit
the histogram of <code>variance_vector</code>. To validate this choice a
<a href="https://openlibrary.org/works/OL1978341W/Probabilistic_techniques_in_exposure_assessment" class="external-link">Cullen
and Frey graph</a> provided by the <strong>fitdistrplus</strong> package
can be used.</p>
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># install.packages("fitdistrplus")</span></span>
<span></span>
<span><span class="co"># plot a Cullen and Frey graph</span></span>
<span><span class="fu">fitdistrplus</span><span class="fu">::</span><span class="fu"><a href="https://lbbe-software.github.io/fitdistrplus/reference/descdist.html" class="external-link">descdist</a></span><span class="op">(</span><span class="va">variance_vector</span><span class="op">)</span></span></code></pre></div>
<p>Based on the observation that a gamma distribution is a suitable fit
for <code>variance_vector</code>, we can now estimate the parameters of
the gamma distribution that fits the data.</p>
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># estimate the parameters: shape and rate using 'moment matching estimation'</span></span>
<span><span class="va">gamma_MME</span> <span class="op">&lt;-</span> <span class="fu">fitdistrplus</span><span class="fu">::</span><span class="fu"><a href="https://lbbe-software.github.io/fitdistrplus/reference/fitdist.html" class="external-link">fitdist</a></span><span class="op">(</span><span class="va">variance_vector</span>,distr <span class="op">=</span> <span class="st">"gamma"</span>, method <span class="op">=</span> <span class="st">"mme"</span><span class="op">)</span></span>
<span><span class="co"># estimate shape:</span></span>
<span><span class="va">shape</span> <span class="op">&lt;-</span> <span class="va">gamma_MME</span><span class="op">$</span><span class="va">estimate</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span></span>
<span><span class="co"># estimate the rate:</span></span>
<span><span class="va">rate</span> <span class="op">&lt;-</span> <span class="va">gamma_MME</span><span class="op">$</span><span class="va">estimate</span><span class="op">[</span><span class="fl">2</span><span class="op">]</span></span>
<span></span>
<span><span class="co"># define an expression written as function as input for the curve() function</span></span>
<span><span class="va">gamma_distr</span> <span class="op">&lt;-</span> <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">{</span> <span class="kw"><a href="https://rdrr.io/r/base/function.html" class="external-link">return</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/GammaDist.html" class="external-link">dgamma</a></span><span class="op">(</span>x <span class="op">=</span> <span class="va">x</span>, shape <span class="op">=</span> <span class="va">shape</span>, rate <span class="op">=</span> <span class="va">rate</span><span class="op">)</span><span class="op">)</span> <span class="op">}</span></span>
<span></span>
<span><span class="co"># plot the density function and the histogram of variance_vector</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/curve.html" class="external-link">curve</a></span><span class="op">(</span> expr <span class="op">=</span> <span class="va">gamma_distr</span>,</span>
<span>       xlim <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/Extremes.html" class="external-link">min</a></span><span class="op">(</span><span class="va">variance_vector</span><span class="op">)</span>,<span class="fu"><a href="https://rdrr.io/r/base/Extremes.html" class="external-link">max</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="va">variance_vector</span>,<span class="va">var_real</span><span class="op">)</span><span class="op">)</span><span class="op">)</span>,</span>
<span>       col  <span class="op">=</span> <span class="st">"steelblue"</span>,</span>
<span>       lwd  <span class="op">=</span> <span class="fl">5</span>,</span>
<span>       xlab <span class="op">=</span> <span class="st">"Variances"</span>, </span>
<span>       ylab <span class="op">=</span> <span class="st">"Frequency"</span> <span class="op">)</span></span>
<span></span>
<span><span class="co"># plot the histogram of variance_vector</span></span>
<span><span class="va">histogram</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/graphics/hist.html" class="external-link">hist</a></span><span class="op">(</span><span class="va">variance_vector</span>,prob <span class="op">=</span> <span class="cn">TRUE</span>,add <span class="op">=</span> <span class="cn">TRUE</span>, breaks <span class="op">=</span> <span class="fl">100</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/rug.html" class="external-link">rug</a></span><span class="op">(</span><span class="va">variance_vector</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># plot a red line at the position where we can find the real variance</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/abline.html" class="external-link">abline</a></span><span class="op">(</span>v <span class="op">=</span> <span class="va">var_real</span>, lwd <span class="op">=</span> <span class="fl">5</span>, col <span class="op">=</span> <span class="st">"red"</span><span class="op">)</span></span></code></pre></div>
<p>Using the gamma distribution with estimated parameters the
corresponding p-value of <code>var_real</code> can be computed.</p>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># p-value of var_real</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/GammaDist.html" class="external-link">pgamma</a></span><span class="op">(</span><span class="va">var_real</span>, shape <span class="op">=</span> <span class="va">shape</span>,rate <span class="op">=</span> <span class="va">rate</span>, lower.tail <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<p>Hence, the variance of the correct TAI profile significantly deviates
from random TAI profiles and this allows us to assume that the
underlying TAI profile captures a real evolutionary signal.</p>
</div>
<div class="section level3">
<h3 id="using-the-flatlinetest-function">Using the <code>FlatLineTest()</code> Function<a class="anchor" aria-label="anchor" href="#using-the-flatlinetest-function"></a>
</h3>
<p>This entire procedure of computing the p-value having the variance of
TAI profiles as test statistic is done by the
<code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> function.</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Perform the FlatLineTest</span></span>
<span><span class="fu"><a href="../reference/FlatLineTest.html">FlatLineTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>              permutations  <span class="op">=</span> <span class="fl">1000</span> <span class="op">)</span></span></code></pre></div>
<p>This function returns the p-value of the test statistic.</p>
<p>Additionally the <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> function allows to
investigate the goodness of the test statistic.</p>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform the FlatLineTest and investigate the goodness of the test statistic</span></span>
<span><span class="fu"><a href="../reference/FlatLineTest.html">FlatLineTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>              permutations  <span class="op">=</span> <span class="fl">1000</span>, </span>
<span>              plotHistogram <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span></span></code></pre></div>
<p>The <code>plotHistogram</code> argument specifies whether analytics
plots shall be drawn to quantify the goodness of the test statistic
returned by the <code>FlatLineTest</code>.</p>
<p>The three resulting plots show:</p>
<ul>
<li><p>a <a href="https://openlibrary.org/works/OL1978341W/Probabilistic_techniques_in_exposure_assessment" class="external-link">Cullen
and Frey graph</a></p></li>
<li><p>a histogram of the test statistic and the corresponding <a href="https://en.wikipedia.org/wiki/Gamma_distribution" class="external-link">gamma
distribution</a> that was fitted to the test statistic</p></li>
<li><p>a plot showing the p-values (<code>p_flt</code>) for 10
individual runs. Since the underlying test statistic is generated by a
permutation test, the third plot returned by <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code>
shows the influence of different permutations to the corresponding
p-value</p></li>
</ul>
<p>In other words, to test whether or not the underlying permutation of
the permutation test is causing the significance of the p-value, you can
specify the <code>runs</code> argument within the
<code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> function to perform several independent
runs. In case there exists a permutation that causes a previous
significant p-value to become non-significant, the corresponding
phylotranscriptomic pattern shouldn’t be considered as statistically
significant.</p>
</div>
<div class="section level3">
<h3 id="reductive-hourglass-test">Reductive Hourglass Test<a class="anchor" aria-label="anchor" href="#reductive-hourglass-test"></a>
</h3>
<p>The <strong>Reductive Hourglass Test</strong> has been developed to
statistically evaluate the existence of a phylotranscriptomic hourglass
pattern based on TAI or TDI computations. The corresponding p-value
quantifies the probability that a given TAI or TDI pattern (or any
phylotranscriptomics pattern) does not follow an hourglass like shape. A
p-value &lt; 0.05 indicates that the corresponding phylotranscriptomics
pattern does indeed follow an hourglass (high-low-high) shape.</p>
<p>To build the test statistic again we start with a standard
PhyloExpressionSet.</p>
<pre><code>  Phylostratum      GeneID   Zygote Quadrant Globular     Heart  Torpedo      Bent    Mature
1            1 at1g01040.2 2173.635 1911.200 1152.555 1291.4224 1000.253  962.9772 1696.4274
2            1 at1g01050.1 1501.014 1817.309 1665.309 1564.7612 1496.321 1114.6435 1071.6555
3            1 at1g01070.1 1212.793 1233.002  939.200  929.6195  864.218  877.2060  894.8189
</code></pre>
<p>And again compute the <code><a href="../reference/TAI.html">TAI()</a></code> profile of the
<code>PhyloExpressionSetExample</code>.</p>
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/TAI.html">TAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334 
</code></pre>
<p>Visualization:</p>
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># visualize the TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>               p.value       <span class="op">=</span> <span class="cn">FALSE</span> <span class="op">)</span> </span></code></pre></div>
<p>The Reductive Hourglass Test is a permutation test based on the
following test statistic.</p>
<ol style="list-style-type: decimal">
<li><p>A set of developmental stages is partitioned into three modules -
<code>early</code>, <code>mid</code>, and <code>late</code> - based on
prior biological knowledge (see Drost et al., 2015 for
details).</p></li>
<li><p>The mean TAI or TDI value for each of the three modules
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>,
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>,
and
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
are computed.</p></li>
<li><p>The two differences D1 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>
and D2 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>
are calculated.</p></li>
<li><p>The minimum
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
of D1 and D2 is computed as final test statistic of the
<strong>Reductive Hourglass Test</strong>.</p></li>
</ol>
<p>In order to determine the statistical significance of an observed
minimum difference
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
the following permutation test was performed. Based on the
<code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is calculated from each of the permuted TAI or TDI profiles,
approximated by a Gaussian distribution with method of moments estimated
parameters returned by <code><a href="https://lbbe-software.github.io/fitdistrplus/reference/fitdist.html" class="external-link">fitdistrplus::fitdist()</a></code>, and the
corresponding p-value is computed by <code>pnorm</code> given the
estimated parameters of the Gaussian distribution. The goodness of fit
for the random vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is statistically quantified by a Lilliefors (Kolmogorov-Smirnov) test
for normality.</p>
<p>To perform the <strong>Reductive Hourglass Test</strong> you can use
the <code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function. Using this function
you need to divide the given phylotranscriptomic pattern into three
developmental modules:</p>
<ul>
<li>early module</li>
<li>mid module</li>
<li>late module</li>
</ul>
<p>This can be done using the <code>modules</code> argument:
<code>module = list(early = 1:2, mid = 3:5, late = 6:7)</code>. In this
example (<code>PhyloExpressionSetExample</code>) we divide the
corresponding developmental process into the three modules:</p>
<ul>
<li>early module: Stages 1 - 2 = Zygote and Quadrant</li>
<li>mid module: Stages 3 - 5 = Globular, Heart, and Torpedo</li>
<li>late module: Stages 6 - 7 = Bent and Mature</li>
</ul>
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Perform the Reductive Hourglass Test</span></span>
<span><span class="fu"><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                        modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                        lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<p>The corresponding output shows the p-value returned by the
<strong>Reductive Hourglass Test</strong>, the standard deviation of
randomly permuted TAI profiles returned by <code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
(<code>apply(bootMatrix(PhyloExpressionSetExample) , 2 , sd)</code>) and
in case the argument <code>lillie.test = TRUE</code>, a logical value
representing the goodness of fit statistic returned by the Lilliefors
(Kolmogorov-Smirnov) test for normality. In case
<code>lillie.test</code> is <code>TRUE</code> the corresponding
Lilliefors (Kolmogorov-Smirnov) test passed the goodness of fit
criterion. In case <code>lillie.test</code> is <code>FALSE</code> the
corresponding goodness of fit by a normal distribution is not
statistically significant.</p>
<p>Analogous to the <code>plotHistogram</code> argument that is present
in the <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> function, the
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function also takes an argument
<code>plotHistogram</code>. When <code>plotHistogram = TRUE</code>, the
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function returns a multi-plot
showing:</p>
<ul>
<li><p>A Cullen and Frey skewness-kurtosis plot. This plot illustrates
which distributions seem plausible to fit the resulting permutation
vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>.
Here a normal distribution seems most plausible.</p></li>
<li><p>A histogram of
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
combined with the density plot is visualized.
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is then fitted by a normal distribution. The corresponding parameters
are estimated by moment matching estimation.</p></li>
<li><p>A plot showing the p-values for N independent runs to verify that
a specific p-value is biased by a specific permutation order.</p></li>
<li><p>A bar plot showing the number of cases in which the underlying
goodness of fit (returned by Lilliefors (Kolmogorov-Smirnov) test for
normality) has shown to be significant (<code>TRUE</code>) or not
significant (<code>FALSE</code>). This allows to quantify the
permutation bias and their implications on the goodness of fit.</p></li>
</ul>
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform the Reductive Hourglass Test and plot the test statistic</span></span>
<span><span class="fu"><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                        modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                        plotHistogram <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>                        lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<p>The corresponding output shows the <code>summary statistics</code> of
the fitted normal distribution as well as the p-value, standard
deviation, and Lilliefors (Kolmogorov-Smirnov) test result.</p>
<p>This example output nicely illustrates that although the Lilliefors
(Kolmogorov-Smirnov) test for normality is violated for some
permutations, the Cullen and Frey graph shows that there is no better
approximation than a normal distribution (which is also supported
visually by investigating the fitted frequency distribution). The
corresponding p-value returned by <code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code>
is significant and illustrates that the observed phylotranscriptomic
pattern of PhyloExpressionSetExample does follow the Hourglass Model
assumption.</p>
</div>
<div class="section level3">
<h3 id="reductive-early-conservation-test">Reductive Early Conservation Test<a class="anchor" aria-label="anchor" href="#reductive-early-conservation-test"></a>
</h3>
<p>The Early Conservation Test has been developed to statistically
evaluate the existence of a monotonically increasing phylotranscriptomic
pattern based on TAI or TDI computations. The corresponding p-value
quantifies the probability that a given TAI or TDI pattern (or any
phylotranscriptomic pattern) does not follow an early conservation like
pattern. A p-value &lt; 0.05 indicates that the corresponding
phylotranscriptomics pattern does indeed follow an early conservation
(low-high-high) shape.</p>
<p>To build the test statistic again we start with a standard
PhyloExpressionSet.</p>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://drostlab.github.io/myTAI/">myTAI</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co"># load an example PhyloExpressionSet stored in the myTAI package</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span>
<span></span>
<span><span class="co"># look at the standardized data set format</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="fl">3</span><span class="op">)</span> </span></code></pre></div>
<p>And again compute the <code><a href="../reference/TAI.html">TAI()</a></code> profile of the
<code>PhyloExpressionSetExample</code>.</p>
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/TAI.html">TAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334</code></pre>
<p>Visualization:</p>
<div class="sourceCode" id="cb27"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualize the TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>               p.value       <span class="op">=</span> <span class="cn">FALSE</span> <span class="op">)</span> </span></code></pre></div>
<p>The reductive early conservation test is a permutation test based on
the following test statistic.</p>
<ol style="list-style-type: decimal">
<li><p>A set of developmental stages is partitioned into three modules -
<code>early</code>, <code>mid</code>, and <code>late</code> - based on
prior biological knowledge.</p></li>
<li><p>The mean TAI or TDI value for each of the three modules
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>,
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>,
and
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
are computed.</p></li>
<li><p>The two differences D1 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>
and D2 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>
are calculated.</p></li>
<li><p>The minimum
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
of D1 and D2 is computed as final test statistic of the
<strong>Reductive Early Conservation Test</strong>.</p></li>
</ol>
<p>In order to determine the statistical significance of an observed
minimum difference
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
the following permutation test was performed. Based on the
<code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is calculated from each of the permuted TAI or TDI profiles,
approximated by a Gaussian distribution with method of moments estimated
parameters returned by <code><a href="https://lbbe-software.github.io/fitdistrplus/reference/fitdist.html" class="external-link">fitdistrplus::fitdist()</a></code>, and the
corresponding p-value is computed by <code>pnorm</code> given the
estimated parameters of the Gaussian distribution. The goodness of fit
for the random vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is statistically quantified by an Lilliefors (Kolmogorov-Smirnov) test
for normality.</p>
<p>To perform the <strong>Reductive Early Conservation Test</strong> you
can use the <code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> function. Using this
function you need to divide the given phylotranscriptomics pattern into
three developmental modules:</p>
<ul>
<li>early module</li>
<li>mid module</li>
<li>late module</li>
</ul>
<p>This can be done using the <code>modules</code> argument:
<code>module = list(early = 1:2, mid = 3:5, late = 6:7)</code>. In this
example (<code>PhyloExpressionSetExample</code>) we divide the
corresponding developmental process into the three modules:</p>
<ul>
<li>early module: Stages 1 - 2 = Zygote and Quadrant</li>
<li>mid module: Stages 3 - 5 = Globular, Heart, and Torpedo</li>
<li>late module: Stages 6 - 7 = Bent and Mature</li>
</ul>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Perform the Reductive Early Conservation Test</span></span>
<span><span class="fu"><a href="../reference/EarlyConservationTest.html">EarlyConservationTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                       modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                       lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<p>Analogous to the <code>plotHistogram</code> argument that is present
in the <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> and
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function, the
<code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> function also takes an argument
<code>plotHistogram</code>. When <code>plotHistogram = TRUE</code>, the
<code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> function returns a multi-plot
showing:</p>
<ul>
<li><p>A Cullen and Frey skewness-kurtosis plot. This plot illustrates
which distributions seem plausible to fit the resulting permutation
vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>.
Again a normal distribution seems most appropriate.</p></li>
<li><p>A histogram of
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
combined with the density plot is visualized.
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is then fitted by a normal distribution. The corresponding parameters
are estimated by moment matching estimation.</p></li>
<li><p>A plot showing the p-values for N independent runs to verify that
a specific p-value is biased by a specific permutation order.</p></li>
<li><p>A bar plot showing the number of cases in which the underlying
goodness of fit (returned by Lilliefors (Kolmogorov-Smirnov) test for
normality) has shown to be significant (<code>TRUE</code>) or not
significant (<code>FALSE</code>). This allows to quantify the
permutation bias and their implications on the goodness of fit.</p></li>
</ul>
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform the Reductive Early Conservation Test and plot the test statistic</span></span>
<span><span class="fu"><a href="../reference/EarlyConservationTest.html">EarlyConservationTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                       modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                       plotHistogram <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>                       lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<p>This example output nicely illustrates that although the Lilliefors
(Kolmogorov-Smirnov) test for normality is violated, the <a href="https://openlibrary.org/works/OL1978341W/Probabilistic_techniques_in_exposure_assessment" class="external-link">Cullen
and Frey graph</a> shows that there is no better approximation than a
normal distribution (which is also supported visually by investigating
the fitted frequency distribution). The corresponding p-value returned
by the <code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> is highly non-significant
and illustrates that the observed phylotranscriptomic pattern of
<code>PhyloExpressionSetExample</code> does not follow the Early
Conservation Model assumption.</p>
<p>This example shall illustrate that finding the right test statistic
is a multi-step process of investigating different properties of the
underlying permutation test. Although single aspects might fit or fit
not corresponding criteria, the overall impression (sum of all
individual analyses) must be considered to obtain a valid p-value.</p>
</div>
<div class="section level3">
<h3 id="reverse-hourglass-test">Reverse Hourglass Test<a class="anchor" aria-label="anchor" href="#reverse-hourglass-test"></a>
</h3>
<p>The <strong>Reverse Hourglass Test</strong> has been developed to
statistically evaluate the existence of a
<code>reverse hourglass pattern</code> based on TAI or TDI computations.
The corresponding p-value quantifies the probability that a given TAI or
TDI pattern (or any phylotranscriptomics pattern) does not follow an
reverse hourglass like shape. A p-value &lt; 0.05 indicates that the
corresponding phylotranscriptomics pattern does indeed follow a reverse
hourglass (low-high-low) shape.</p>
<p>To build the test statistic again we start with a standard
PhyloExpressionSet.</p>
<pre><code>  Phylostratum      GeneID   Zygote Quadrant Globular     Heart  Torpedo      Bent    Mature
1            1 at1g01040.2 2173.635 1911.200 1152.555 1291.4224 1000.253  962.9772 1696.4274
2            1 at1g01050.1 1501.014 1817.309 1665.309 1564.7612 1496.321 1114.6435 1071.6555
3            1 at1g01070.1 1212.793 1233.002  939.200  929.6195  864.218  877.2060  894.8189
</code></pre>
<p>And again compute the <code><a href="../reference/TAI.html">TAI()</a></code> profile of the
<code>PhyloExpressionSetExample</code>.</p>
<div class="sourceCode" id="cb31"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/TAI.html">TAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334 
</code></pre>
<p>Visualization:</p>
<div class="sourceCode" id="cb33"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># visualize the TAI profile of correctly assigned Phylostrata</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>               p.value       <span class="op">=</span> <span class="cn">FALSE</span> <span class="op">)</span> </span></code></pre></div>
<p>The Reverse Hourglass Test is a permutation test based on the
following test statistic.</p>
<ol style="list-style-type: decimal">
<li><p>A set of developmental stages is partitioned into three modules -
<code>early</code>, <code>mid</code>, and <code>late</code> - based on
prior biological knowledge (see Drost et al., 2015 for
details).</p></li>
<li><p>The mean TAI or TDI value for each of the three modules
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>,
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>,
and
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
are computed.</p></li>
<li><p>The two differences D1 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>e</mi><mi>a</mi><mi>r</mi><mi>l</mi><mi>y</mi></mrow></msub><annotation encoding="application/x-tex">T_{early}</annotation></semantics></math>
and D2 =
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>m</mi><mi>i</mi><mi>d</mi></mrow></msub><annotation encoding="application/x-tex">T_{mid}</annotation></semantics></math>
-
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>T</mi><mrow><mi>l</mi><mi>a</mi><mi>t</mi><mi>e</mi></mrow></msub><annotation encoding="application/x-tex">T_{late}</annotation></semantics></math>
are calculated.</p></li>
<li><p>The minimum
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
of D1 and D2 is computed as final test statistic of the <strong>Reverse
Hourglass Test</strong>.</p></li>
</ol>
<p>In order to determine the statistical significance of an observed
minimum difference
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
the following permutation test was performed. Based on the
<code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is calculated from each of the permuted TAI or TDI profiles,
approximated by a Gaussian distribution with method of moments estimated
parameters returned by <code><a href="https://lbbe-software.github.io/fitdistrplus/reference/fitdist.html" class="external-link">fitdistrplus::fitdist()</a></code>, and the
corresponding p-value is computed by <code>pnorm</code> given the
estimated parameters of the Gaussian distribution. The goodness of fit
for the random vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is statistically quantified by a Lilliefors (Kolmogorov-Smirnov) test
for normality.</p>
<p>To perform the <strong>Reverse Hourglass Test</strong> you can use
the <code><a href="../reference/ReverseHourglassTest.html">ReverseHourglassTest()</a></code> function. Using this function
you need to divide the given phylotranscriptomic pattern into three
developmental modules:</p>
<ul>
<li>early module</li>
<li>mid module</li>
<li>late module</li>
</ul>
<p>This can be done using the <code>modules</code> argument:
<code>module = list(early = 1:2, mid = 3:5, late = 6:7)</code>. In this
example (<code>PhyloExpressionSetExample</code>) we divide the
corresponding developmental process into the three modules:</p>
<ul>
<li>early module: Stages 1 - 2 = Zygote and Quadrant</li>
<li>mid module: Stages 3 - 5 = Globular, Heart, and Torpedo</li>
<li>late module: Stages 6 - 7 = Bent and Mature</li>
</ul>
<div class="sourceCode" id="cb34"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Perform the Reverse Hourglass Test</span></span>
<span><span class="fu"><a href="../reference/ReverseHourglassTest.html">ReverseHourglassTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                        modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                        lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<pre><code>$p.value
[1] 1

$std.dev
[1] 0.05598325 0.05469016 0.05386737 0.05248817 0.05161525 0.05411684 0.05605765

$lillie.test
[1] TRUE</code></pre>
<p>The corresponding output shows the p-value returned by the
<strong>Reductive Hourglass Test</strong>, the standard deviation of
randomly permuted TAI profiles returned by <code><a href="../reference/bootMatrix.html">bootMatrix()</a></code>
(<code>apply(bootMatrix(PhyloExpressionSetExample) , 2 , sd)</code>) and
in case the argument <code>lillie.test = TRUE</code>, a logical value
representing the goodness of fit statistic returned by the Lilliefors
(Kolmogorov-Smirnov) test for normality. In case
<code>lillie.test</code> is <code>TRUE</code> the corresponding
Lilliefors (Kolmogorov-Smirnov) test passed the goodness of fit
criterion. In case <code>lillie.test</code> is <code>FALSE</code> the
corresponding goodness of fit by a normal distribution is not
statistically significant.</p>
<p>Analogous to the <code>plotHistogram</code> argument that is present
in the <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code> function, the
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function also takes an argument
<code>plotHistogram</code>. When <code>plotHistogram = TRUE</code>, the
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function returns a multi-plot
showing:</p>
<ul>
<li><p>A Cullen and Frey skewness-kurtosis plot. This plot illustrates
which distributions seem plausible to fit the resulting permutation
vector
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>.
Here a normal distribution seems most plausible.</p></li>
<li><p>A histogram of
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
combined with the density plot is visualized.
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>D</mi><mrow><mi>m</mi><mi>i</mi><mi>n</mi></mrow></msub><annotation encoding="application/x-tex">D_{min}</annotation></semantics></math>
is then fitted by a normal distribution. The corresponding parameters
are estimated by moment matching estimation.</p></li>
<li><p>A plot showing the p-values for N independent runs to verify that
a specific p-value is biased by a specific permutation order.</p></li>
<li><p>A bar plot showing the number of cases in which the underlying
goodness of fit (returned by Lilliefors (Kolmogorov-Smirnov) test for
normality) has shown to be significant (<code>TRUE</code>) or not
significant (<code>FALSE</code>). This allows to quantify the
permutation bias and their implications on the goodness of fit.</p></li>
</ul>
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform the Reverse Hourglass Test and plot the test statistic</span></span>
<span><span class="fu"><a href="../reference/ReverseHourglassTest.html">ReverseHourglassTest</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                        modules       <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>early <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, mid <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">5</span>, late <span class="op">=</span> <span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>                        plotHistogram <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>                        lillie.test   <span class="op">=</span> <span class="cn">TRUE</span> <span class="op">)</span> </span></code></pre></div>
<p>The corresponding output shows the <code>summary statistics</code> of
the fitted normal distribution as well as the p-value, standard
deviation, and Lilliefors (Kolmogorov-Smirnov) test result.</p>
<p>This example output nicely illustrates that although the Lilliefors
(Kolmogorov-Smirnov) test for normality is violated for some
permutations, the Cullen and Frey graph shows that there is no better
approximation than a normal distribution (which is also supported
visually by investigating the fitted frequency distribution). The
corresponding p-value returned by <code><a href="../reference/ReverseHourglassTest.html">ReverseHourglassTest()</a></code> is
significant and illustrates that the observed phylotranscriptomic
pattern of PhyloExpressionSetExample does follow the Hourglass Model
assumption.</p>
</div>
</div>
<div class="section level2">
<h2 id="data-transformation">Data Transformation<a class="anchor" aria-label="anchor" href="#data-transformation"></a>
</h2>
<p>Motivated by the discussion raised by Piasecka et al., 2013, the
influence of gene expression transformation on the global
phylotranscriptomic patterns does not seem negligible. Hence, different
transformations can result in qualitatively different TAI or TDI
patterns.</p>
<p>Initially, the TAI and TDI formulas were defined for absolute
expression levels. So using the initial TAI and TDI formulas with
transformed expression levels can result in qualitatively different
patterns when compared with non-transformed expression levels, but might
also belong to a different class of models, since different valid
expression level transformation functions result in different
patterns.</p>
<p>The purpose of the <code><a href="../reference/tf.html">tf()</a></code> function is to allow the user to
study the qualitative impact of different transformation functions on
the global TAI and TDI pattern, or on any subsequent phylotranscriptomic
analysis.</p>
<p>The examples using the <code>PhyloExpressionSetExample</code> data
set show that using common gene expression transformation functions:
log2 (Quackenbush, 2001 and 2002), sqrt (Yeung et al., 2001), boxcox, or
inverse hyperbolic sine transformation, each transformation results in
qualitatively different patterns. Nevertheless, for each resulting
pattern the statistical significance can be tested using either the
<code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code>, <code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code>, or
<code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> (Drost et al., 2015) to quantify
the significance of observed patterns.</p>
<p>The <code><a href="../reference/tf.html">tf()</a></code> function takes a standard
<code>PhyloExpressionSet</code> or <code>DivergenceExpressionSet</code>
and transformation function and returns the corresponding
<code>ExpressionSet</code> with transformed gene expression levels.</p>
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://drostlab.github.io/myTAI/">myTAI</a></span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># a simple example is to transform the gene expression levels of a given PhyloExpressionSet</span></span>
<span><span class="co"># using a sqrt or log2 transformation</span></span>
<span></span>
<span><span class="va">PES.sqrt</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="va">sqrt</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PES.sqrt</span><span class="op">)</span></span></code></pre></div>
<pre><code><span><span class="co">#&gt;   Phylostratum      GeneID    Zygote  Quadrant  Globular     Heart   Torpedo      Bent   Mature</span></span>
<span><span class="co">#&gt; 1            1 at1g01040.2  46.62226  43.71728  33.94930  35.93637  31.62678  31.03187 41.18771</span></span>
<span><span class="co">#&gt; 2            1 at1g01050.1  38.74292  42.62990  40.80820  39.55706  38.68230  33.38628 32.73615</span></span>
<span><span class="co">#&gt; 3            1 at1g01070.1  34.82517  35.11413  30.64637  30.48966  29.39759  29.61766 29.91352</span></span>
<span><span class="co">#&gt; 4            1 at1g01080.2  31.88919  30.60039  34.37060  36.46195  37.31813  35.88836 29.34724</span></span>
<span><span class="co">#&gt; 5            1 at1g01090.1 106.88576 129.53057 185.38244 199.43831 237.13197 258.80566 88.16213</span></span>
<span><span class="co">#&gt; 6            1 at1g01120.1  29.05239  28.06409  29.31939  30.52242  30.70579  29.50021 28.15589</span></span></code></pre>
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">PES.log2</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="va">log2</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PES.log2</span><span class="op">)</span></span></code></pre></div>
<pre><code>  Phylostratum      GeneID    Zygote  Quadrant  Globular     Heart   Torpedo      Bent    Mature
1            1 at1g01040.2 11.085894 10.900263 10.170620 10.334745  9.966149  9.911358 10.728284
2            1 at1g01050.1 10.551722 10.827588 10.701574 10.611727 10.547204 10.122367 10.065625
3            1 at1g01070.1 10.244117 10.267960  9.875289  9.860497  9.755251  9.776772  9.805452
4            1 at1g01080.2  9.989991  9.870956 10.206206 10.376639 10.443610 10.330888  9.750306
5            1 at1g01090.1 13.479852 14.034298 15.068722 15.279598 15.779093 16.031451 12.924174
6            1 at1g01120.1  9.721170  9.621306  9.747567  9.863595  9.880877  9.765307  9.630730</code></pre>
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># in case a given PhyloExpressionSet already stores gene expression levels</span></span>
<span><span class="co"># that are log2 transformed and need to be re-transformed to absolute</span></span>
<span><span class="co"># expression levels, to perform subsequent phylotranscriptomics analyses</span></span>
<span><span class="co"># (that are defined for absolute expression levels), </span></span>
<span><span class="co"># one can re-transform a PhyloExpressionSet like this:</span></span>
<span></span>
<span><span class="va">PES.absolute</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">PES.log2</span> , <span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fl">2</span><span class="op">^</span><span class="va">x</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># which should be the same as  PhyloExpressionSetExample :</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">PES.absolute</span><span class="op">)</span></span></code></pre></div>
<pre><code>&gt; head(PhyloExpressionSetExample)
  Phylostratum      GeneID     Zygote   Quadrant   Globular      Heart    Torpedo       Bent    Mature
1            1 at1g01040.2  2173.6352  1911.2001  1152.5553  1291.4224  1000.2529   962.9772 1696.4274
2            1 at1g01050.1  1501.0141  1817.3086  1665.3089  1564.7612  1496.3207  1114.6435 1071.6555
3            1 at1g01070.1  1212.7927  1233.0023   939.2000   929.6195   864.2180   877.2060  894.8189
4            1 at1g01080.2  1016.9203   936.3837  1181.3381  1329.4734  1392.6429  1287.9746  861.2605
5            1 at1g01090.1 11424.5667 16778.1685 34366.6493 39775.6405 56231.5689 66980.3673 7772.5617
6            1 at1g01120.1   844.0414   787.5929   859.6267   931.6180   942.8453   870.2625  792.7542
&gt; head(PES.absolute)
  Phylostratum      GeneID     Zygote   Quadrant   Globular      Heart    Torpedo       Bent    Mature
1            1 at1g01040.2  2173.6352  1911.2001  1152.5553  1291.4224  1000.2529   962.9772 1696.4274
2            1 at1g01050.1  1501.0141  1817.3086  1665.3089  1564.7612  1496.3207  1114.6435 1071.6555
3            1 at1g01070.1  1212.7927  1233.0023   939.2000   929.6195   864.2180   877.2060  894.8189
4            1 at1g01080.2  1016.9203   936.3837  1181.3381  1329.4734  1392.6429  1287.9746  861.2605
5            1 at1g01090.1 11424.5667 16778.1685 34366.6493 39775.6405 56231.5689 66980.3673 7772.5617
6            1 at1g01120.1   844.0414   787.5929   859.6267   931.6180   942.8453   870.2625  792.7542</code></pre>
<p>When transforming the <code>ExpressionMatrix</code> of the
<code>PhyloExpressionSetExample</code> using different transformation
functions, the resulting phylotranscriptomic patterns qualitatively
differ:</p>
<div class="section level3">
<h3 id="log2-transformation-tai">log2 transformation (TAI)<a class="anchor" aria-label="anchor" href="#log2-transformation-tai"></a>
</h3>
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># plotting the TAI using log2 transformed expression levels</span></span>
<span><span class="co"># and performing the Flat Line Test to obtain the p-value</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="va">log2</span><span class="op">)</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"FlatLineTest"</span>,</span>
<span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>               ylab          <span class="op">=</span> <span class="st">"TAI"</span> <span class="op">)</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="sqrt-transformation-tai">sqrt transformation (TAI)<a class="anchor" aria-label="anchor" href="#sqrt-transformation-tai"></a>
</h3>
<div class="sourceCode" id="cb44"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># plotting the TAI using sqrt transformed expression levels</span></span>
<span><span class="co"># and performing the Flat Line Test to obtain the p-value</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>, <span class="va">sqrt</span><span class="op">)</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"FlatLineTest"</span>,</span>
<span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>               ylab          <span class="op">=</span> <span class="st">"TAI"</span> <span class="op">)</span></span></code></pre></div>
<p>For the <code>PhyloExpressionSetExample</code> all transformations
result in a significant phylotranscriptomics pattern deviating from a
flat line.</p>
<p>Nevertheless, it is not clear which transformation is the most
appropriate one since the original TAI and TDI measure were defined for
absolute expression levels.</p>
<p>The same accounts for <code>TDI</code> profiles:</p>
</div>
<div class="section level3">
<h3 id="log2-transformation-tdi">log2 transformation (TDI)<a class="anchor" aria-label="anchor" href="#log2-transformation-tdi"></a>
</h3>
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># plotting the TDI using log2 transformed expression levels</span></span>
<span><span class="co"># and performing the Flat Line Test to obtain the p-value</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span>, <span class="va">log2</span><span class="op">)</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"FlatLineTest"</span>,</span>
<span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>               ylab          <span class="op">=</span> <span class="st">"TDI"</span> <span class="op">)</span></span></code></pre></div>
</div>
<div class="section level3">
<h3 id="sqrt-transformation-tdi">sqrt transformation (TDI)<a class="anchor" aria-label="anchor" href="#sqrt-transformation-tdi"></a>
</h3>
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># plotting the TDI using sqrt transformed expression levels</span></span>
<span><span class="co"># and performing the Flat Line Test to obtain the p-value</span></span>
<span><span class="fu"><a href="../reference/PlotSignature.html">PlotSignature</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="fu"><a href="../reference/tf.html">tf</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span>, <span class="va">sqrt</span><span class="op">)</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"FlatLineTest"</span>,</span>
<span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>               ylab          <span class="op">=</span> <span class="st">"TDI"</span> <span class="op">)</span></span></code></pre></div>
<p>As a result, observed patterns should always be quantified using
statistical tests (for ex. <code><a href="../reference/FlatLineTest.html">FlatLineTest()</a></code>,
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code>, and
<code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code>). In case the observed pattern is
significant, qualitative differences of the observed patterns based on
different data transformations must be investigated in more detail,
since most data transformations are known to cause different effects on
a measure that isn’t robust against data transformations.</p>
</div>
</div>
<div class="section level2">
<h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a>
</h2>
<p>Domazet-Loso, T. &amp; Tautz, D. <strong>A phylogenetically based
transcriptome age index mirrors ontogenetic divergence
patterns</strong>. <em>Nature</em> <strong>468</strong>, 815-8
(2010).</p>
<p>Quint, M. <em>et al</em>. <strong>A transcriptomic hourglass in plant
embryogenesis</strong>. <em>Nature</em> <strong>490</strong>, 98-101
(2012).</p>
<p>Drost, H.G. <em>et al</em>. <strong>Evidence for Active Maintenance
of Phylotranscriptomic Hourglass Patterns in Animal and Plant
Embryogenesis</strong>. <em>Mol. Biol. Evol.</em> <strong>32</strong>
(5), 1221-1231 (2015).</p>
<p>Piasecka, B. <em>et al</em>. <strong>The hourglass and the early
conservation models - co-existing patterns of developmental constraints
in vertebrates</strong>. <em>PLoS Genet</em>.
<strong>9</strong>:e1003476 (2013).</p>
<p>Quackenbush, J. Computational Analysis of Microarray Data. <em>Nature
Reviews</em>. <strong>2</strong>, 418-427 (2001).</p>
<p>Quackenbush, J. Microarray data normalization and transformation.
<em>Nature Genetics</em>. <strong>32</strong>, 496-501 (2002).</p>
<p>Yeung, K.Y. <em>et al</em>. Model-based clustering and data
transformations for gene expression data. <em>Bioinformatics</em>.
<strong>17</strong>, 977-987 (2001).</p>
<p>Yeung, K.Y. <em>et al</em>. Supplement to <em>Model-based clustering
and data transformations for gene expression data - Data Transformations
and the Gaussian mixture assumption</em>. <em>Bioinformatics</em>.
<strong>17</strong>, 977-987 (2001).</p>
</div>
  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside>
</div>



    <footer><div class="pkgdown-footer-left">
  <p>Developed by Hajk-Georg Drost, Jaruwatana Sodai Lotharukpong, Nikola Kalábová, Kristian K Ullrich.</p>
</div>

<div class="pkgdown-footer-right">
  <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.</p>
</div>

    </footer>
</div>





  </body>
</html>
