<!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>Introduction to the myTAI package • 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="Introduction to the myTAI package">
</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>Introduction to the myTAI package</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/Introduction.Rmd" class="external-link"><code>vignettes/Introduction.Rmd</code></a></small>
      <div class="d-none name"><code>Introduction.Rmd</code></div>
    </div>

    
    
<div class="section level2">
<h2 id="table-of-contents">Table of Contents<a class="anchor" aria-label="anchor" href="#table-of-contents"></a>
</h2>
<ol style="list-style-type: decimal">
<li><a href="#scientific-introduction-performing-evolutionary-transcriptomics-with-r">Scientific
Introduction</a></li>
<li><a href="#installation">Installation</a></li>
<li><a href="#motivation">Motivation</a></li>
<li><a href="#retrieval-of-phylogenetic-or-taxonomic-information">Retrieval of
phylogenetic or taxonomic information</a></li>
<li><a href="#defining-input-data-standards">Defining input data
standards</a></li>
<li><a href="#performing-a-standard-workflow-for-evolutionary-transcriptomics-analyses">Performing
a Standard Workflow for Evolutionary Transcriptomics Analyses</a></li>
</ol>
<div class="section level3">
<h3 id="scientific-introduction-performing-evolutionary-transcriptomics-with-r">Scientific Introduction: Performing Evolutionary Transcriptomics
with R<a class="anchor" aria-label="anchor" href="#scientific-introduction-performing-evolutionary-transcriptomics-with-r"></a>
</h3>
<p>Quantifying <code>transcriptome conservation</code> or
<code>transcriptome diversity</code> patterns within a biological
process of interest allows researchers to extend a classic transcriptome
study by addressing the question <strong>why</strong> a particular
developmental stage or environmental response timing is organized in the
observed way. This is done by retrieving evolutionary age estimates of
protein coding genes from a variety of gene age inference methods (see
below) and adding this gene age information to the classic gene
expression table. Dedicated transcriptome age quantification procedures
implemented in the <code>myTAI</code> package then allow to capture the
average transcriptome age for each developmental stage or environmental
response stage at hand. Finally, a rigorous statistical assessment of
observed transcriptome age patterns allows researchers to gain greater
confidence in the robustness of observed patterns, ultimately
facilitating the selection of promising candidate genes for further
molecular functional studies.</p>
</div>
<div class="section level3">
<h3 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
</h3>
<div class="section level4">
<h4 id="package-dependencies">Package dependencies<a class="anchor" aria-label="anchor" href="#package-dependencies"></a>
</h4>
<p>If users are interested in performing differential gene expression
analyses with <code>myTAI</code>, they may install the
<code>edgeR</code> package.</p>
<p>Users can download <code>myTAI</code> from <a href="https://cran.r-project.org/package=myTAI" class="external-link">CRAN</a> :</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># install myTAI from CRAN</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"myTAI"</span>, dependencies <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
</div>
</div>
<div class="section level3">
<h3 id="motivation">Motivation<a class="anchor" aria-label="anchor" href="#motivation"></a>
</h3>
<p>Using embryo development of the plant <em>Arabidopsis thaliana</em>
as an example, we ask the user to imagine how one would investigate the
differences of developmental transcriptomes across developmental
stages.</p>
<p><img src="Figures/Fig1.png"></p>
<p style="font-size:10px;">
Figure 1: Gene expression distributions (= developmental transcriptome)
throughout seven stages of <em>A. thaliana</em> embryo development.
Embryo development is divided into three phases: early embryogenesis
(purple), mid-embryogenesis (green), and late embryogenesis (brown).
This boxplot illustrates that the overall distributions of log2
expression levels (y-axis) hardly differ between developmental stages
(x-axis) although the difference on the global scale is statistically
significant (Kruskal-Wallis Rank Sum Test: p &lt; 2e-16). Hence, a clear
visual pattern of gene expression differences between early, mid, and
late embryogenesis on the global scale can not be inferred. Adapted from
<a href="https://digital.bibliothek.uni-halle.de/urn/urn:nbn:de:gbv:3:4-18221" class="external-link">Drost,
2016</a>.
</p>
<p>The objective of performing evolutionary transcriptomics studies is
to classify a transcriptome into different categories of genes sharing
similar evolutionary origins (detectable homologs) or genes that share
similar phylogenetic relationships (orthologous genes) and to study the
overall expression patterns of these classified genes throughout the
biological process of interest. Thus, by introducing a phylogenetic or
taxonomic variable to a transcriptome dataset, we can determine stages
or time points that are under stronger constraints than others,
indicating switches between biological programs or functions.</p>
<p><img src="Figures/Fig2.png"></p>
<p style="font-size:10px;">
Figure 2: Gene expression distributions (= developmental transcriptome)
throughout seven stages of <em>A. thaliana</em> embryo development
classified into distinctive age categories. Each box represents the
developmental stage during <em>A. thaliana</em> embryogenesis, the
y-axis denotes the log2 expression levels of genes that fall into the
corresponding age category shown on the x-axis. Hence, each boxplot
represents the gene expression distribution of genes that are classified
into the corresponding age class during a specific developmental stage.
The gene age distribution of <em>A. thaliana</em> genes range from PS1
to PS12 where PS1 represents the evolutionarily most distant age
category (cellular org.) and PS12 the evolutionary most recent age
category (<em>A. thaliana</em> specific). Yellow dots in the boxplots
denote the mean expression level of the corresponding expression
distribution. This visualization illustrates that although the global
gene expression distributions do not change visually between
developmental stages (Fig. 1), the global gene expression distributions
of age categories differ between stages of <em>A. thaliana</em> embryo
development, and thus, allow studying the effect of transcriptome
evolution and conservation on embryo development. Adapted from <a href="https://digital.bibliothek.uni-halle.de/urn/urn:nbn:de:gbv:3:4-18221" class="external-link">Drost,
2016</a>.
</p>
<p>Conceptually, the idea behind evolutionary transcriptomics studies is
to combine the phylogenetic relationship between species (usually
retrieved from comparative genomics studies in terms of gene homology
confirmed by sequence identity) with transcriptome data of a reference
species quantifying a particular biological process of interest
(e.g. mutant gene expression versus WT gene expression, stress
responses, cell differentiation, development, etc.). Usually,
transcriptome data comes from <code>Next Generation Sequencing</code>
technologies such as RNA-Seq or from Microarray experiments.</p>
<p style="text-align: center; font-size:20px;">
Phylogenetic Information + Transcriptome Data
</p>
<p>Or in other words:</p>
<p style="text-align: center; font-size:20px;">
Comparative Genomics + Transcriptomics = Evolutionary Transcriptomics
</p>
<p>In theory, any published or newly generated transcriptome dataset can
be used to capture evolutionary signatures with <code>myTAI</code>.</p>
<p><code>myTAI</code> is designed to receive phylogenetic information
obtained from comparative genomics data and transcriptome data as input
and internally combines these datasets to perform evolutionary
transcriptomics analyses.</p>
<p><img src="Figures/Fig3.png"></p>
<p style="font-size:10px;">
Figure 3: Workflow describing the input and output of the myTAI package.
The myTAI package takes phylogenetic information such as phylogenetic
trees (see <a href="https://www.academia.edu/27635691/The_Comparative_Biology_of_Gene_Expression" class="external-link">Dunn,
2013</a> ), genomic phylostratigraphy based gene age inference (see <a href="https://www.sciencedirect.com/science/article/pii/S0168952507002995" class="external-link">Domazet-Loso
et al., 2007</a>; <a href="https://www.sciencedirect.com/science/article/pii/S016895251300111X" class="external-link">Capra
et al., 2013</a>; <a href="https://academic.oup.com/gbe/article/8/6/1812/2574026" class="external-link">Liebeskind
et al., 2016</a> ), by dNdS estimation of orthologous genes (see <a href="https://www.nature.com/articles/nature11394" class="external-link">Quint, Drost et al.,
2012</a> and <a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost et
al., 2015</a>), or phylogenetic reconciliation (see <a href="https://pubmed.ncbi.nlm.nih.gov/21949266/" class="external-link">Doyon et al, 2011</a> )
and a RNA-Seq or Microarray based transcriptome dataset as input.
Internally, myTAI then combines the phylogenetic data and the
transcriptome data an provides numerous functions to perform
evolutionary transcriptomics analyses. Here, we exemplify the output of
the functions <code><a href="../reference/PlotSignature.html">PlotSignature()</a></code>, <code><a href="../reference/PlotRE.html">PlotRE()</a></code> and
<code><a href="../reference/PlotCategoryExpr.html">PlotCategoryExpr()</a></code>.
</p>
</div>
<div class="section level3">
<h3 id="retrieval-of-phylogenetic-or-taxonomic-information">Retrieval of phylogenetic or taxonomic information<a class="anchor" aria-label="anchor" href="#retrieval-of-phylogenetic-or-taxonomic-information"></a>
</h3>
<p>For the comparative genomics part there are different methods and
tools to quantify sequence homology between genes, miRNAs, lncRNAs etc
of a reference species and related species. For example, for
phylogenetic or taxonomic information retrieval such as phylogenetic
trees, genomic phylostratigraphy based gene age inference, dNdS
estimation of orthologous genes or phylogenetic reconciliation can be
used. Below users can find the most recent tools and resources for
retrieving or computing phylogenetic or taxonomic relationships for an
organism of interest.</p>
<p><strong>Generate or retrieve phylostratigraphic maps:</strong></p>
<ul>
<li>
<a href="https://github.com/josuebarrera/GenEra" class="external-link">GenEra</a>: a fast,
easy-to-use and highly customizable command-line tool that estimates
<em>gene-family founder events</em>. Please consult the paper for more
information on <em>homology detection failure</em> and other
methodological considerations compared to previous approaches (<a href="https://genomebiology.biomedcentral.com/articles/10.1186/s13059-023-02895-z" class="external-link">Barrera-Redondo
et al., 2023</a>). Users can also use GenEra for generating
phylostratigraphic maps based on <em>protein structure</em> similarity,
using <a href="https://github.com/steineggerlab/foldseek" class="external-link">Foldseek</a>.
See <a href="https://github.com/josuebarrera/GenEra/wiki/Downstream-analyses" class="external-link">here</a>
for processing the output for <code>myTAI</code>.</li>
<li>
<a href="https://github.com/kullrich/orthomap" class="external-link">orthomap</a>: a
python package to extract <em>orthologous</em> maps (in other words the
evolutionary age of a given orthologous group) from <a href="https://github.com/davidemms/OrthoFinder" class="external-link">OrthoFinder</a>/<a href="http://eggnog5.embl.de/#/app/home" class="external-link">eggNOG</a>/<a href="https://bioinformatics.psb.ugent.be/plaza/" class="external-link">PLAZA</a> results. See
also how one can <a href="https://orthomap.readthedocs.io/en/latest/tutorials/mytai.html" class="external-link">use
some myTAI function within orthomap in python</a>.</li>
<li>
<a href="http://chenzxlab.hzau.edu.cn/GenOrigin/#!/" class="external-link">GenOrigin</a>:
GenOrigin inferred gene age information of 9,102,113 genes from 565
species</li>
<li>
<a href="https://github.com/arendsee/phylostratr" class="external-link">R package:
phylostratr</a> which implements <code>Phylostratigraphy</code> as an
<code>R package</code> - Please consult the <a href="https://github.com/arendsee/phylostratr/tree/master/vignettes" class="external-link">Vignettes</a>
for examples.</li>
<li>
<a href="https://github.com/arendsee/fagin" class="external-link">R package: fagin</a>: a
synteny-based phylostratigraphy and finer classification of young genes
(see also the <a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-3023-y" class="external-link">corresponding
manuscript</a> and <a href="https://github.com/arendsee/fagin-case-studies" class="external-link">example
applications</a>)</li>
<li>
<a href="https://github.com/AlexGa/Phylostratigraphy" class="external-link">createPSmap.pl</a>:
generate a phylostratigraphic map (implemented by Alexander Gabel)</li>
<li>
<a href="https://figshare.com/articles/dataset/A_developmental_hourglass_in_fungi/1284022" class="external-link">phylostratigraphy.pl</a>:
generate a phylostratigraphic (implemented by Cheng et al. 2015)</li>
<li>
<a href="https://mynotebook.labarchives.com/share/Shuqing_Xu/NTIuMHw2NDQyMi80MC9UcmVlTm9kZS8zNDEyODM1NjE2fDEzMi4w" class="external-link">phylo_pipeline.py</a>:
a Python script to generate a phylostratigraphic map (implemented by
Shuqing Xu)</li>
<li>
<a href="https://github.com/longjunwu/Genomic-phylostratigraphy-tool" class="external-link">Genomic-phylostratigraphy-tool</a>:
a Python script to generate a phylostratigraphic map (implemented by
Longjun Wu)</li>
<li>
<a href="https://bcb.unl.edu/orfanfinder/" class="external-link">ORFanFinder</a>: generate
a phylostratigraphic map</li>
<li>
<code>Protein Historian</code>: generate a gene age map</li>
<li>download pre-computed and published <a href="https://github.com/drostlab/published_phylomaps" class="external-link">phylostratigraphic
maps</a>
</li>
<li>
<a href="https://github.com/LotharukpongJS/phylomapr" class="external-link">phylomapR</a>:
quick retrieval of precomputed gene age maps (phylomaps) in R for easy
integration with <code>myTAI</code>.</li>
<li>
<a href="https://github.com/marcottelab/Gene-Ages" class="external-link">Liebeskind et
al., 2016</a>: use a gene age consensus approach to estimating gene ages
for model organisms</li>
<li>
<a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-016-1427-5" class="external-link">orthoscape</a>:
a cytoscape application for grouping and visualization KEGG based gene
networks by taxonomy and homology principles (implemented by Mustafin et
al., 2017)</li>
<li>
<a href="http://biorxiv.org/content/early/2017/03/02/112946" class="external-link">RecBlast</a>:
Cloud-Based Large Scale Orthology Detection (by Efrat Rapoport and Moran
Neuhof)</li>
<li>
<a href="https://github.com/BIONF/protTrace" class="external-link">protTrace</a>: A
simulation based framework to estimate the evolutionary traceability of
protein</li>
</ul>
<div class="section level4">
<h4 id="dnds-estimation-of-orthologous-genes">dNdS estimation of orthologous genes<a class="anchor" aria-label="anchor" href="#dnds-estimation-of-orthologous-genes"></a>
</h4>
<p>We recently proposed to use the classical dNdS measure to quantify
the sequence conservation of protein coding genes between closely
related species. This way, we combine the information about the
selective pressure acting on a particular gene with its expression level
during a particular time point or condition. We refer to this approach
as Divergence Stratigraphy (<a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost et
al., 2015 <em>Mol. Biol. Evol.</em></a>). Analogous to gene age
inference methods, divergence stratigraphy generates a table storing the
sequence conservation estimate in the first column and the corresponding
gene id of the organism of interest in the second column. This table is
named <em>divergence stratigraphic map</em>.</p>
<p><strong>Generate or retrieve divergence stratigraphic
maps:</strong></p>
<ul>
<li>
<a href="https://github.com/drostlab/orthologr" class="external-link">orthologr</a>:
generate a <a href="https://github.com/drostlab/orthologr/blob/master/vignettes/divergence_stratigraphy.Rmd" class="external-link">divergence
stratigraphic map</a> (implemented by Hajk-Georg Drost)</li>
<li>
<a href="https://figshare.com/articles/dataset/A_developmental_hourglass_in_fungi/1284022" class="external-link">compute_dNdS.pl</a>:
generate a divergence stratigraphic map (implemented by Cheng et
al. 2015)</li>
<li>
<a href="https://orthology.phylomedb.org/" class="external-link">MetaPhOrs</a>: retrieve
phylogeny-based orthology and paralogy predictions</li>
<li>download pre-computed and published <a href="https://github.com/drostlab/published_phylomaps" class="external-link">divergence
stratigraphic maps</a>
</li>
<li>
<a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-016-1427-5" class="external-link">orthoscape</a>:
a cytoscape application for grouping and visualization KEGG based gene
networks by taxonomy and homology principles (implemented by Mustafin et
al., 2017)</li>
<li>
<a href="http://biorxiv.org/content/early/2017/03/02/112946" class="external-link">RecBlast</a>:
Cloud-Based Large Scale Orthology Detection (by Efrat Rapoport and Moran
Neuhof)</li>
</ul>
</div>
<div class="section level4">
<h4 id="generate-custom-table">Generate custom table<a class="anchor" aria-label="anchor" href="#generate-custom-table"></a>
</h4>
<p>In general, users can construct their own gene age assignment methods
and are not limited to the methods listed above. After formatting the
corresponding results to the <em>age map</em> specification (age
assignment in the first column and gene id in the second column), users
can use any function in myTAI with their custom gene age assignment
table.</p>
</div>
</div>
<div class="section level3">
<h3 id="getting-started-with-mytai">Getting Started with <code>myTAI</code><a class="anchor" aria-label="anchor" href="#getting-started-with-mytai"></a>
</h3>
<p><code>myTAI</code> takes an <em>age map</em> and an expression
dataset as input and combines both tables to the quantify transcriptome
conservation for the biological process of interest.</p>
<div class="section level4">
<h4 id="defining-input-data-standards">Defining input data standards<a class="anchor" aria-label="anchor" href="#defining-input-data-standards"></a>
</h4>
<p>The following code illustrates an example structure of an
<code>age map</code>. Here we choose genomic phylostratigraphy and dNdS
estimation as method to generate a <em>phylostratigraphic map</em> and
<em>divergence stratigraphic map</em>:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># load myTAI</span></span>
<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 example data sets (stored in myTAI)</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 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>
<span><span class="co"># show an example phylostratigraphic map of Arabidopsis thaliana</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 class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Phylostratum"</span>,<span class="st">"GeneID"</span><span class="op">)</span><span class="op">]</span><span class="op">)</span></span></code></pre></div>
<pre><code>  Phylostratum      GeneID
1            1 at1g01040.2
2            1 at1g01050.1
3            1 at1g01070.1
4            1 at1g01080.2
5            1 at1g01090.1
6            1 at1g01120.1</code></pre>
<p>In detail, a <em>phylostratigraphic map</em> stores the gene age
assignment generated with e.g. <a href="https://github.com/AlexGa/Phylostratigraphy" class="external-link">phylostratigraphy</a>
in the first columns and the corresponding gene id in the second
column.</p>
<p>Analogously, a divergence stratigraphic map stores the gene age
assignment generated with e.g. <a href="https://github.com/drostlab/orthologr/blob/master/vignettes/divergence_stratigraphy.Rmd" class="external-link">divergence
stratigraphy</a> in the first column and the corresponding gene id in
the second column:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># show an example structure of a Divergence Map</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">DivergenceExpressionSetExample</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="st">"Divergence.stratum"</span>,<span class="st">"GeneID"</span><span class="op">)</span><span class="op">]</span><span class="op">)</span></span></code></pre></div>
<pre><code>  Divergence.stratum      GeneID
1                  1 at1g01050.1
2                  1 at1g01120.1
3                  1 at1g01140.3
4                  1 at1g01170.1
5                  1 at1g01230.1
6                  1 at1g01540.2</code></pre>
<p>Hence, <code>myTAI</code> relies on pre-computed <em>age maps</em>
fulfilling the aforementioned standard for all downstream analyses. It
does not matter whether or not age maps contain categorized age values
like in <code>phylostratigraphic maps</code> or e.g. phylogenetic
distance values generated by phylogenetic inference.</p>
</div>
<div class="section level4">
<h4 id="expression-dataset-specification">Expression dataset specification<a class="anchor" aria-label="anchor" href="#expression-dataset-specification"></a>
</h4>
<p>The aim of any evolutionary transcriptomics study is to quantify
transcriptome conservation in biological processes. For this purpose,
users need to provide the transcriptome dataset of their studied
biological process.</p>
<p>In the following examples we will use a
<code>gene expression dataset</code> covering seven stages of
<em>Arabidopsis thaliana</em> embryo development. This data format is
defined as <code>ExpressionMatrix</code> in the <code>myTAI</code> data
format specification.</p>
<pre><code># gene expression set

       GeneID     Zygote   Quadrant   Globular      Heart    Torpedo       Bent    Mature
1 at1g01040.2  2173.6352  1911.2001  1152.5553  1291.4224  1000.2529   962.9772 1696.4274
2 at1g01050.1  1501.0141  1817.3086  1665.3089  1564.7612  1496.3207  1114.6435 1071.6555
3 at1g01070.1  1212.7927  1233.0023   939.2000   929.6195   864.2180   877.2060  894.8189
4 at1g01080.2  1016.9203   936.3837  1181.3381  1329.4734  1392.6429  1287.9746  861.2605
5 at1g01090.1 11424.5667 16778.1685 34366.6493 39775.6405 56231.5689 66980.3673 7772.5617
6 at1g01120.1   844.0414   787.5929   859.6267   931.6180   942.8453   870.2625  792.7542</code></pre>
<p>The function <code><a href="../reference/MatchMap.html">MatchMap()</a></code> allows users to join a
<em>phylostratigraphic map</em> with an <em>ExpressionMatrix</em> to
obtain a joined table referred to as <em>PhyloExpressionSet</em>. In
some cases, the GeneIDs stored in the <code>ExpressionMatrix</code> and
in the <em>phylostratigraphic map</em> do not match. This is due to
GeneID mappings between different databases and annotations. To map non
matching GeneIDs between databases and annotations, please consult the
<a href="https://github.com/ropensci/biomartr/blob/master/vignettes/Functional_Annotation.Rmd" class="external-link">Functional
Annotation Vignette</a> in the <a href="https://github.com/ropensci/biomartr" class="external-link">biomartr</a> package. The
<code>biomartr</code> package allows users to map GeneIDs between
database annotations.</p>
<p>After matching a <em>phylostratigraphic map</em> with an
<em>ExpressionMatrix</em> using the <code><a href="../reference/MatchMap.html">MatchMap()</a></code> function, a
standard <em>PhyloExpressionSet</em> is returned storing the
phylostratum assignment of a given gene in the first column, the
<em>gene id</em> of the corresponding gene in the second column, and the
entire gene expression set (time series or treatments) starting with the
third column. This format is crucial for all functions that are
implemented in the <code>myTAI</code> package.</p>
<div class="sourceCode" id="cb7"><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 the example data set</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"># construct an example Phylostratigraphic Map </span></span>
<span><span class="va">Example.PhylostratigraphicMap</span> <span class="op">&lt;-</span> <span class="va">PhyloExpressionSetExample</span><span class="op">[</span> , <span class="fl">1</span><span class="op">:</span><span class="fl">2</span><span class="op">]</span></span>
<span><span class="co"># construct an example ExpressionMatrix</span></span>
<span><span class="va">Example.ExpressionMatrix</span> <span class="op">&lt;-</span> <span class="va">PhyloExpressionSetExample</span><span class="op">[</span> , <span class="fl">2</span><span class="op">:</span><span class="fl">9</span><span class="op">]</span></span>
<span></span>
<span><span class="co"># join a PhylostratigraphicMap with an ExpressionMatrix using MatchMap()</span></span>
<span><span class="va">Example.PhyloExpressionSet</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/MatchMap.html">MatchMap</a></span><span class="op">(</span><span class="va">Example.PhylostratigraphicMap</span>, <span class="va">Example.ExpressionMatrix</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># look at a standard PhyloExpressionSet</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">Example.PhyloExpressionSet</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            4 at1g01010.1  878.2158  828.2301  776.0703 753.9589 775.3377 756.2460 999.9118
2            2 at1g01020.1 1004.9710 1106.2621 1037.5141 939.0830 961.5249 871.4684 997.5953
3            3 at1g01030.1  819.4880  771.6396  810.8717 866.7780 773.7893 747.9941 785.6105</code></pre>
<p>Analogous to a standard <em>PhyloExpressionSet</em>, a standard
<em>DivergenceExpressionSet</em> is a <code>data.frame</code> storing
the divergence stratum assignment of a given gene in the first column,
the gene id of the corresponding gene in the second column, and the
entire gene expression set (time series or treatments) starting with the
third column.</p>
<p>The following <code>DivergenceExpressionSet</code> example
illustrates the standard <code>DivergenceExpressionSet</code> data set
format.</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># head of an example standard DivergenceExpressionSet</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">DivergenceExpressionSetExample</span>, <span class="fl">3</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Divergence.stratum      GeneID    Zygote  Quadrant  Globular    Heart   Torpedo      Bent    Mature
1                  1 at1g01050.1 1501.0141 1817.3086 1665.3089 1564.761 1496.3207 1114.6435 1071.6555
2                  1 at1g01120.1  844.0414  787.5929  859.6267  931.618  942.8453  870.2625  792.7542
3                  1 at1g01140.3 1041.4291  908.3929 1068.8832  967.749 1055.1901 1109.4662  825.4633
</code></pre>
<p>A <em>DivergenceExpressionSet</em> defines the joined table between a
<em>divergence stratigraphic map</em> and a <em>Expression Set</em>. A
<em>DivergenceExpressionSet</em> can be generated analogous to a
<em>PhyloExpressionSet</em> by joining a <em>divergence stratigraphic
map</em> with an <em>ExpressionMatrix</em> using the
<code><a href="../reference/MatchMap.html">MatchMap()</a></code> function. In some cases, the GeneIDs stored in
the <em>ExpressionMatrix</em> and in the <em>divergence stratigraphic
map</em> do not match. This is due to GeneID mappings between different
databases and annotations. To map non matching GeneIDs between databases
and annotations, please consult the <a href="https://github.com/ropensci/biomartr/blob/master/vignettes/Functional_Annotation.Rmd" class="external-link">Functional
Annotation Vignette</a> in the <a href="https://github.com/ropensci/biomartr" class="external-link">biomartr</a> package.</p>
<p>Each function implemented in <code>myTAI</code> checks internally
whether or not the <em>PhyloExpressionSet</em> or
<em>DivergenceExpressionSet</em> standard is fulfilled.</p>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># used by all myTAI functions to check the validity of the PhyloExpressionSet standard</span></span>
<span><span class="fu"><a href="../reference/is.ExpressionSet.html">is.ExpressionSet</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>[1] TRUE
</code></pre>
<p>In case the PhyloExpressionSet standard is violated, the
<code><a href="../reference/is.ExpressionSet.html">is.ExpressionSet()</a></code> function will return <code>FALSE</code>
and the corresponding function within the <code>myTAI</code> package
will return an error message.</p>
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># used a non standard PhyloExpressionSet</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 class="fl">2</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span>, <span class="fl">2</span><span class="op">)</span></span></code></pre></div>
<pre><code>       GeneID   Zygote Quadrant Globular
1 at1g01040.2 2173.635 1911.200 1152.555
2 at1g01050.1 1501.014 1817.309 1665.309
</code></pre>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/is.ExpressionSet.html">is.ExpressionSet</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">[</span> , <span class="fl">2</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">)</span> </span></code></pre></div>
<pre><code>
Error in is.ExpressionSet(PhyloExpressionSetExample[, 2:5]) : 
  The present input object does not fulfill the ExpressionSet standard.
  </code></pre>
<p><strong>It might be that you work with a <code>tibble</code> object
which will not be recognized by <code>is.ExpressionSet</code>. In that
case, please convert your <code>tibble</code> object to a
<code>data.frame</code> using the function
<code><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame()</a></code>.</strong></p>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># convert any tibble to a data.frame</span></span>
<span><span class="va">PhyloExpressionSetExample</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span>
<span><span class="co"># now is.ExpressionSet() should return TRUE</span></span>
<span><span class="fu"><a href="../reference/is.ExpressionSet.html">is.ExpressionSet</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span></span></code></pre></div>
<p><strong>The PhyloExpressionSet and DivergenceExpressionSet formats
are crucial for all functions that are implemented in the
<code>myTAI</code> package</strong>.</p>
<p>Keeping these standard data formats in mind will provide users with
the most important requirements to get started with the
<code>myTAI</code> package.</p>
<p><strong>Note</strong>, that within the code of each function, the
argument <code>ExpressionSet</code> always refers to either a
PhyloExpressionSet or a DivergenceExpressionSet, whereas in specialized
functions some arguments are specified as <em>PhyloExpressionSet</em>
when they take an PhyloExpressionSet as input data set, or specified as
<em>DivergenceExpressionSet</em> when they take an
<em>DivergenceExpressionSet</em> as input data set.</p>
</div>
</div>
<div class="section level3">
<h3 id="performing-a-standard-workflow-for-evolutionary-transcriptomics-analyses">Performing a Standard Workflow for Evolutionary Transcriptomics
Analyses<a class="anchor" aria-label="anchor" href="#performing-a-standard-workflow-for-evolutionary-transcriptomics-analyses"></a>
</h3>
<p>The main goal of any evolutionary transcriptomics study is to
quantify transcriptome conservation at a particular stage or treatment.
This is achieved by computing the average age of genes that contribute
to the transcriptome at that stage or treatment. In other words, by
multiplying the gene age value with the expression level of the
corresponding gene and averaging over all genes, we obtain the mean age
of the transcriptome. Hence, we can say that at a particular stage
<code>genes that are most expressed at this stage or treatment have (on average) the evolutionary age XY</code>.</p>
<p>To obtain this mean age value, several measures were introduced:</p>
<div class="section level5">
<h5 id="transcriptome-age-index">Transcriptome Age Index<a class="anchor" aria-label="anchor" href="#transcriptome-age-index"></a>
</h5>
<p>The first measure named <em>Transcriptome Age Index</em> (TAI) was
introduced by Domazet-Loso and Tautz, 2010 and represents a weighted
arithmetic mean of the transcriptome age during a corresponding
developmental stage <em>s</em>.</p>
<p><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>T</mi><mi>A</mi><msub><mi>I</mi><mi>s</mi></msub><mo>=</mo><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></msubsup><mfrac><mrow><mi>p</mi><msub><mi>s</mi><mi>i</mi></msub><mo>*</mo><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub></mrow><mrow><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></msubsup><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub></mrow></mfrac></mrow><annotation encoding="application/x-tex">TAI_s = \sum_{i = 1}^n \frac{ps_i * e_{is}}{\sum_{i = 1}^n e_{is}}</annotation></semantics></math></p>
<p>where
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><msub><mi>s</mi><mi>i</mi></msub></mrow><annotation encoding="application/x-tex">ps_i</annotation></semantics></math>
denotes the phylostratum assignment of gene
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>i</mi><annotation encoding="application/x-tex">i</annotation></semantics></math>
and
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub><annotation encoding="application/x-tex">e_{is}</annotation></semantics></math>
denotes the gene expression level of gene
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>i</mi><annotation encoding="application/x-tex">i</annotation></semantics></math>
at developmental time point
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>s</mi><annotation encoding="application/x-tex">s</annotation></semantics></math>.
A lower value of TAI describes an older transcriptome age, whereas a
higher value of TAI denotes a younger transcriptome age.</p>
<p>The following figure shows the TAI computations for the seven stages
of <em>A. thaliana</em> embryo development.</p>
<div class="sourceCode" id="cb18"><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"># Plot the Transcriptome Age Index of a given PhyloExpressionSet </span></span>
<span><span class="co"># Test Statistic : Flat Line Test (default)</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>               measure       <span class="op">=</span> <span class="st">"TAI"</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>The x-axis shows the seven stages of <em>A. thaliana</em> embryo
development and the y-axis shows the corresponding mean transcriptome
age (TAI) value. The lower the TAI value the older the mean
transcriptome age and the higher the TAI value the younger the mean
transcriptome age.</p>
<p>The interpretation of the TAI values on the y-axis is given by the
next figure.</p>
<p><img src="Figures/Fig4.png"></p>
<p>In this example, a TAI value of 3.5 quantifies that genes that
contribute most the transcriptome at a particular stage emerged on
average between phylostratum 3 and phylostratum 4. Due to the nature of
the arithmetic mean, this value does not represent the true origin of
individual genes, and thus the TAI measure is only helpful to screen for
stages that express (on average) older or younger genes. Subsequent
analyses such as mean expression of age categories, relative expression
levels, and gene expression level distributions for each age category
will then reveal which exact genes or age categories generate the
overall TAI value.</p>
<p>To obtain a more detailed overview of which age categories contribute
how much to each developmental stage, the gene expression level
distributions for each age category and each developmental stage can be
visualized (using the <code><a href="../reference/PlotCategoryExpr.html">PlotCategoryExpr()</a></code> function).</p>
<div class="sourceCode" id="cb19"><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"># category-centered visualization of PS </span></span>
<span><span class="co"># specific expression level distributions (log-scale)</span></span>
<span><span class="fu"><a href="../reference/PlotCategoryExpr.html">PlotCategoryExpr</a></span><span class="op">(</span>ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                     legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>                     test.stat     <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>                     type          <span class="op">=</span> <span class="st">"category-centered"</span>,</span>
<span>                     distr.type    <span class="op">=</span> <span class="st">"boxplot"</span>,</span>
<span>                     log.expr      <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
<p>This figure shows that in all developmental stages, genes coming from
PS1-3 are (on average) more expressed than genes coming from PS4-12.
Interestingly, the gene expression level distributions of PS4-12 become
more equally distributed towards the Torpedo stage which has been marked
as the most conserved stage by TAI analysis. This general trend can be
visualized using the <code><a href="../reference/PlotMeans.html">PlotMeans()</a></code> function.</p>
<div class="sourceCode" id="cb20"><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"># plot evolutionary old PS (PS1-3) vs</span></span>
<span><span class="co"># evolutionary young PS (PS4-12)</span></span>
<span><span class="fu"><a href="../reference/PlotMeans.html">PlotMeans</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>,</span>
<span>          Groups <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><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</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="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span><span class="op">)</span>, </span>
<span>          legendName <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>          adjust.range <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
<p>Here, users will observe that indeed PS1-3 genes are (on average)
higher expressed than PS4-12 genes.</p>
<p>Using a linear transformation of the mean expression levels into the
interval
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="true" form="prefix">[</mo><mn>0</mn><mo>,</mo><mn>1</mn><mo stretchy="true" form="postfix">]</mo></mrow><annotation encoding="application/x-tex">[0,1]</annotation></semantics></math>
(Quint et al., 2012 and Drost et al., 2015) we can compare mean
expression patterns between Phylostrata independent from their actual
mean expression magnitude. A relative expression level of 0 denotes the
minimum mean expression level compared to all other stages and a
relative expression level of 1 denotes the maximum mean expression level
compared to all other stages.</p>
<p>The following figure illustrates the average gene expression profile
for each phylostratum.</p>
<div class="sourceCode" id="cb21"><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"># plot evolutionary old PS (PS1-3) vs</span></span>
<span><span class="co"># evolutionary young PS (PS4-12)</span></span>
<span><span class="fu"><a href="../reference/PlotRE.html">PlotRE</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>,</span>
<span>          Groups <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><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</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="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span><span class="op">)</span>, </span>
<span>          legendName <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>          adjust.range <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div>
<p>Users will observe, that PS4-12 genes are down-regulated towards the
Torpedo stage (marked as most conserved by TAI analysis) and
up-regulated after the Torpedo stage.</p>
<p>To cluster gene expression levels of PS4-12 genes we categorize
<em>A. thaliana</em> embryogenesis into three developmental modules
(early, mid, and late) and cluster young genes (PS4-12) according to
their fold-change pattern: High-Low-Low, High-Low-High, and
Low-Low-High.</p>
<p>As a result, we find that there are two distinct sets of young genes:
High-high-low and low-low-high. Almost none of the genes have a
high-low-high pattern.</p>
<p>Finally, users can perform KEGG or GO Term enrichment analyses to
obtain the annotated functions of these gene sets.</p>
</div>
<div class="section level5">
<h5 id="transcriptome-divergence-index">Transcriptome Divergence Index<a class="anchor" aria-label="anchor" href="#transcriptome-divergence-index"></a>
</h5>
<p>Analogous to the TAI measure, the <em>Transcriptome Divergence
Index</em> (TDI) was introduced by Quint et al., 2012 and Drost et al.,
2015 as a measure of average transcriptome selection pressure where
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>s</mi><annotation encoding="application/x-tex">s</annotation></semantics></math>
denotes the corresponding developmental stage.</p>
<p><math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>T</mi><mi>D</mi><msub><mi>I</mi><mi>s</mi></msub><mo>=</mo><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></msubsup><mfrac><mrow><mi>d</mi><msub><mi>s</mi><mi>i</mi></msub><mo>*</mo><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub></mrow><mrow><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></msubsup><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub></mrow></mfrac></mrow><annotation encoding="application/x-tex">TDI_s = \sum_{i = 1}^n \frac{ds_i * e_{is}}{\sum_{i = 1}^n e_{is}}</annotation></semantics></math></p>
<p>where
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>d</mi><msub><mi>s</mi><mi>i</mi></msub></mrow><annotation encoding="application/x-tex">ds_i</annotation></semantics></math>
denotes the divergence stratum assignment of gene
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>i</mi><annotation encoding="application/x-tex">i</annotation></semantics></math>
and
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><msub><mi>e</mi><mrow><mi>i</mi><mi>s</mi></mrow></msub><annotation encoding="application/x-tex">e_{is}</annotation></semantics></math>
denotes the gene expression level of gene
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>i</mi><annotation encoding="application/x-tex">i</annotation></semantics></math>
at developmental time point
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>s</mi><annotation encoding="application/x-tex">s</annotation></semantics></math>.
A lower value of TDI describes an more conserved transcriptome (in terms
of sequence dissimilarity), whereas a higher value of TDI denotes a more
variable transcriptome.</p>
<p>To assess the statistical significance of all introduced measures and
analyses, we developed several test statistics that are introduced in
the following sections.</p>
</div>
</div>
<div class="section level3">
<h3 id="transcriptome-age-index-analyses">Transcriptome Age Index Analyses<a class="anchor" aria-label="anchor" href="#transcriptome-age-index-analyses"></a>
</h3>
<p>Evolutionary signatures of transcriptomes can be captured by
computing transcriptome indices at different measured stages of
development, combining these computed values to a transcriptome index
profile across the measured stages, and comparing the resulting profile
with a flat line. A profile not significantly deviating from a flat line
indicates the absence of significant variations of the computed
transcriptome index from stage to stage. In contrast, a profile
significantly deviating from a flat line indicates the presence of
significant variations from stage to stage. We refer to any
transcriptome index profile significantly deviating from a flat line as
phylotranscriptomic pattern or evolutionary signature.</p>
<p>Previously, we introduced three statistical tests to quantify the
significance of observed TAI or TDI patterns:
<code>Flat Line Test</code>, <code>Reductive Hourglass Test</code>, and
<code>Reductive Early Conservation Test</code> (<a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost et
al., 2015</a>).</p>
<p>The <code><a href="../reference/PlotPattern.html">PlotPattern()</a></code> function introduced in the following
sections is the main analytics function of myTAI.
<code><a href="../reference/PlotPattern.html">PlotPattern()</a></code> allows users to visualize TAI or TDI patterns
and internally performs the following statistical tests to assess their
significance.</p>
<div class="section level4">
<h4 id="flat-line-test">Flat Line Test<a class="anchor" aria-label="anchor" href="#flat-line-test"></a>
</h4>
<p>The <code><a href="../reference/PlotSignature.html">PlotSignature()</a></code> function with option
<code>TestStatistic = "FlatLineTest",</code> first computes the
<code>TAI</code> (given a PhyloExpressionSet and argument specification
<code>measure = "TAI"</code>) or the <code>TDI</code> (given a
DivergenceExpressionSet and argument specification
<code>measure = "TDI"</code>) profile as well as their standard
deviation, and statistical significance.</p>
<div class="sourceCode" id="cb22"><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"># Plot the Transcriptome Age Index of a given PhyloExpressionSet </span></span>
<span><span class="co"># Test Statistic : Flat Line Test (default)</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>               measure       <span class="op">=</span> <span class="st">"TAI"</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>The p-value (<code>p_flt</code>) above the TAI curve is returned by
the <code>FlatLineTest</code>. As described in the documentation of
<code><a href="../reference/PlotSignature.html">PlotSignature()</a></code> (<code><a href="../reference/PlotSignature.html">?PlotSignature</a></code> or
<code><a href="../reference/FlatLineTest.html">?FlatLineTest</a></code>), the <code>FlatLineTest</code> is the
default statistical test to quantify the statistical significance of the
observed phylotranscriptomic pattern. In detail, the test quantifies any
statistically significant deviation of the phylotranscriptomic pattern
from a flat line. Here, we define any significant deviation of a
phylotranscriptomic pattern from a flat line as evolutionary signature
Furthermore, we define corresponding stages of deviation as evolutionary
conserved or variable (less conserved) depending on the magnitude of
<code>TAI</code> and corresponding p-values.</p>
</div>
<div class="section level4">
<h4 id="reductive-hourglass-test">Reductive Hourglass Test<a class="anchor" aria-label="anchor" href="#reductive-hourglass-test"></a>
</h4>
<p>In case the observed phylotranscriptomic pattern not only
significantly deviates from a flat line but also visually resembles an
<em>hourglass</em> shape, one can obtain a p-value quantifying the
statistical significance of a visual <em>hourglass</em> pattern based on
the <code>ReductiveHourglassTest</code>
(<code><a href="../reference/ReductiveHourglassTest.html">?ReductiveHourglassTest</a></code>).</p>
<p>Since the <code>ReductiveHourglassTest</code> has been defined for a
priori biological knowledge (<a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost et
al., 2015</a>), the <code>modules</code> argument within the
<code><a href="../reference/ReductiveHourglassTest.html">ReductiveHourglassTest()</a></code> function needs to be
specified.</p>
<p>Three modules need to be specified: an <strong>early-module</strong>,
<strong>phylotypic module</strong> (mid), and a
<strong>late-module</strong>.</p>
<p>For this example we divide <em>A. thaliana</em> embryo development
stored within the <em>PhyloExpressionSetExample</em> into the following
three modules:</p>
<ul>
<li>early = stages 1 - 2 (Zygote and Quadrant)</li>
<li>mid = stages 3 - 5 (Globular, Heart, and Torpedo)</li>
<li>late = stages 6 - 7 (Bent and Mature)</li>
</ul>
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Plot the Transcriptome Age Index of a given PhyloExpressionSet </span></span>
<span><span class="co"># Test Statistic : Reductive Hourglass Test</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>               measure       <span class="op">=</span> <span class="st">"TAI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"ReductiveHourglassTest"</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>               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>The corresponding p-value <code>p_rht</code> now denotes the p-value
returned by the <code>ReductiveHourglassTest</code> which is different
from the p-value returned by the <code>FlatLineTest</code>
(<code>p_flt</code>).</p>
<p>To make sure that correct modules have been selected to perform the
<code>ReductiveHourglassTest</code>, users can use the
<code>shaded.area</code> argument to visualize chosen modules:</p>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualize the phylotypic period used for the Reductive Hourglass Test</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>               measure       <span class="op">=</span> <span class="st">"TAI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"ReductiveHourglassTest"</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>               shaded.area   <span class="op">=</span> <span class="cn">TRUE</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><strong>Note</strong> that for defining a priori knowledge for the
<code>ReductiveHourglassTest</code> using the <code>modules</code>
argument, modules need to start at stage 1, …, N and do not correspond
to the column position in the
<em>PhyloExpressionSet/DivergenceExpressionSet</em> which in contrast
would start at position 3, … N + 2.</p>
<p>In a biological context, it is not always clear which stages could
define the early, mid, and late modules. For animal embryogenesis, it
has been suggested to choose early, mid, and late modules according to
the morphological conservation of animal embryos (e.g. mid-stage
vertebrate embryos seem to be morphologically conserved). For plants, in
contrast no morphological conservation has been reported and thus the
average expression of embryo defective genes has been used to define
modules (Drost et al. 2015).</p>
</div>
<div class="section level4">
<h4 id="reductive-early-conservation-test">Reductive Early Conservation Test<a class="anchor" aria-label="anchor" href="#reductive-early-conservation-test"></a>
</h4>
<p>The third test statistic that is implemented in the
<code>myTAI</code> package is the
<code>EarlyConservationTest</code>.</p>
<p>The <code>EarlyConservationTest</code> tests whether an observed
phylotranscriptomic pattern follows a low-high-high pattern
(monotonically increasing function) supporting the Early Conservation
Model of embryogenesis.</p>
<p>Analogous to the <code>ReductiveHourglassTest</code>, the
<code>EarlyConservationTest</code> needs a priori biological knowledge
<a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost
et al., 2015</a>. So again three <code>modules</code> have to be
specified for the <code><a href="../reference/EarlyConservationTest.html">EarlyConservationTest()</a></code> function.</p>
<p>Three modules need to be specified: an <strong>early-module</strong>,
<strong>phylotypic module</strong> (mid), and a
<strong>late-module</strong>.</p>
<p>For this example we divide <em>A. thaliana</em> embryo development
stored within the <em>PhyloExpressionSetExample</em> into the following
three modules:</p>
<ul>
<li>early = stages 1 - 2 (Zygote and Quadrant)</li>
<li>mid = stages 3 - 5 (Globular, Heart, and Torpedo)</li>
<li>late = stages 6 - 7 (Bent and Mature)</li>
</ul>
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Plot the Transcriptome Age Index of a given PhyloExpressionSet </span></span>
<span><span class="co"># Test Statistic : Reductive Early Conservation Test</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>               measure       <span class="op">=</span> <span class="st">"TAI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"EarlyConservationTest"</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>               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>The corresponding p-value <code>p_ect</code> now denotes the p-value
returned by the <code>EarlyConservationTest</code> which is different
from the p-value returned by the <code>FlatLineTest</code>
(<code>p_flt</code>) and <code>ReductiveHourglassTest</code>
(<code>p_rht</code>).</p>
<p>Since the present TAI pattern of the
<em>PhyloExpressionSetExample</em> doesn’t support the Early
Conservation Hypothesis, the p-value <code>p_ect</code> = 1.</p>
<p>Again <strong>note</strong> that for defining a priori knowledge for
the <code>EarlyConservationTest</code> using the <code>modules</code>
argument, modules need to start at stage 1, …, N and do not correspond
to the column position in the
<em>PhyloExpressionSet/DivergenceExpressionSet</em> which in contrast
would start at position 3, … N + 2.</p>
<p>To obtain the numerical <em>TAI</em> values, the <code><a href="../reference/TAI.html">TAI()</a></code>
function can be used:</p>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Compute the Transcriptome Age Index values of a given PhyloExpressionSet</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>
</div>
<div class="section level4">
<h4 id="reverse-hourglass-test">Reverse Hourglass Test<a class="anchor" aria-label="anchor" href="#reverse-hourglass-test"></a>
</h4>
<p>In case the observed phylotranscriptomic pattern not only
significantly deviates from a flat line but also visually resembles an
<em>reverse hourglass</em> shape (low-high-low pattern), one can obtain
a p-value quantifying the statistical significance of a visual
<em>reverse hourglass</em> pattern based on the
<code>ReverseHourglassTest</code>
(<code><a href="../reference/ReverseHourglassTest.html">?ReverseHourglassTest</a></code>).</p>
<p>Since the <code>ReverseHourglassTest</code> has been defined for a
priori biological knowledge (<a href="https://academic.oup.com/mbe/article/32/5/1221/1125964" class="external-link">Drost et
al., 2015</a>), the <code>modules</code> argument within the
<code><a href="../reference/ReverseHourglassTest.html">ReverseHourglassTest()</a></code> function needs to be specified.</p>
<p>Three modules need to be specified: an <strong>early-module</strong>,
<strong>phylotypic module</strong> (mid), and a
<strong>late-module</strong>.</p>
<p>For this example we divide <em>A. thaliana</em> embryo development
stored within the <em>PhyloExpressionSetExample</em> into the following
three modules:</p>
<ul>
<li>early = stages 1 - 2 (Zygote and Quadrant)</li>
<li>mid = stages 3 - 5 (Globular, Heart, and Torpedo)</li>
<li>late = 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"># Plot the Transcriptome Age Index of a given PhyloExpressionSet </span></span>
<span><span class="co"># Test Statistic : Reverse Hourglass Test</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>               measure       <span class="op">=</span> <span class="st">"TAI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"ReverseHourglassTest"</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>               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>The corresponding p-value <code>p_reverse_hourglass</code> now
denotes the p-value returned by the <code>ReverseHourglassTest</code>
which is different from the p-value returned by the
<code>FlatLineTest</code> (<code>p_flt</code>).</p>
<p>To make sure that correct modules have been selected to perform the
<code>ReverseHourglassTest</code>, users can use the
<code>shaded.area</code> argument to visualize chosen modules:</p>
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualize the phylotypic period used for the Reductive Hourglass Test</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>               measure       <span class="op">=</span> <span class="st">"TAI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"ReverseHourglassTest"</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>               shaded.area   <span class="op">=</span> <span class="cn">TRUE</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><strong>Note</strong> that for defining a priori knowledge for the
<code>ReverseHourglassTest</code> using the <code>modules</code>
argument, modules need to start at stage 1, …, N and do not correspond
to the column position in the
<em>PhyloExpressionSet/DivergenceExpressionSet</em> which in contrast
would start at position 3, … N + 2.</p>
<p>In a biological context, it is not always clear which stages could
define the early, mid, and late modules. For animal embryogenesis, it
has been suggested to choose early, mid, and late modules according to
the morphological conservation of animal embryos (e.g. mid-stage
vertebrate embryos seem to be morphologically conserved). For plants, in
contrast no morphological conservation has been reported and thus the
average expression of embryo defective genes has been used to define
modules (Drost et al. 2015).</p>
</div>
</div>
<div class="section level3">
<h3 id="transcriptome-divergence-index-analyses">Transcriptome Divergence Index Analyses<a class="anchor" aria-label="anchor" href="#transcriptome-divergence-index-analyses"></a>
</h3>
<p>Analogous to the <em>TAI</em> computations and visualization, the
<em>TDI</em> computations can be performed in a similar fashion:</p>
<div class="sourceCode" id="cb30"><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"># Plot the Transcriptome Divergence Index of a given DivergenceExpressionSet </span></span>
<span><span class="co"># Test Statistic : Flat Line Test (default)</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">DivergenceExpressionSetExample</span>,</span>
<span>               measure       <span class="op">=</span> <span class="st">"TDI"</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>Again, for the <strong>ReductiveHourglassTest</strong> we divide
<em>A. thaliana</em> embryo development into three modules:</p>
<ul>
<li>early = stages 1 - 2 (Zygote and Quadrant)</li>
<li>mid = stages 3 - 5 (Globular, Heart, and Torpedo)</li>
<li>late = stages 6 - 7 (Bent and Mature)</li>
</ul>
<div class="sourceCode" id="cb31"><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"># Plot the Transcriptome Divergence Index of a given DivergenceExpressionSet </span></span>
<span><span class="co"># Test Statistic : Reductive Hourglass Test</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">DivergenceExpressionSetExample</span>,</span>
<span>               measure       <span class="op">=</span> <span class="st">"TDI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"ReductiveHourglassTest"</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>               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>And for the <strong>EarlyConservationTest</strong> we again divide
<em>A. thaliana</em> embryo development into three modules:</p>
<ul>
<li>early = stages 1 - 2 (Zygote and Quadrant)</li>
<li>mid = stages 3 - 5 (Globular, Heart, and Torpedo)</li>
<li>late = stages 6 - 7 (Bent and Mature)</li>
</ul>
<div class="sourceCode" id="cb32"><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"># Plot the Transcriptome Divergence Index of a given DivergenceExpressionSet </span></span>
<span><span class="co"># Test Statistic : Reductive Early Conservation Test</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">DivergenceExpressionSetExample</span>,</span>
<span>               measure       <span class="op">=</span> <span class="st">"TDI"</span>,</span>
<span>               TestStatistic <span class="op">=</span> <span class="st">"EarlyConservationTest"</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>               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>To obtain the numerical TDI values for a given
DivergenceExpressionSet simply run:</p>
<div class="sourceCode" id="cb33"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Compute the Transcriptome Divergence Index values of a given DivergenceExpressionSet</span></span>
<span><span class="fu"><a href="../reference/TDI.html">TDI</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature 
4.532029 4.563200 4.485705 4.500868 4.466477 4.530704 4.690292
</code></pre>
<div class="section level4">
<h4 id="phylostratum-or-divergence-stratum-specific-contribution-to-the-global-transcriptome-index-profile">
<code>Phylostratum</code> or <code>Divergence Stratum</code>
specific contribution to the global transcriptome index profile<a class="anchor" aria-label="anchor" href="#phylostratum-or-divergence-stratum-specific-contribution-to-the-global-transcriptome-index-profile"></a>
</h4>
<p>Another way to visualize the cumulative contribution of each
<code>Phylostratum</code> or <code>Divergence Stratum</code> to the
global Transcriptome Age Index or Transcriptome Divergence Index profile
was introduced by Domazet-Loso and Tautz, 2010 (Fig. 1b). The advantage
of visualizing the cumulative contribution of each
<code>Phylostratum</code> or <code>Divergence Stratum</code> to the
global pattern is to study how the final (global) TAI or TDI profile
emerges from the cumulative TAI/TDI distribution of each
<code>Phylostratum</code> or <code>Divergence Stratum</code>. This
<code>Phylostratum</code> or <code>Divergence Stratum</code> specific
contribution on the global TAI or TDI pattern can be visualized using
<code><a href="../reference/PlotContribution.html">PlotContribution()</a></code>:</p>
<div class="section level5">
<h5 id="example-phylostrata">Example: <code>Phylostrata</code><a class="anchor" aria-label="anchor" href="#example-phylostrata"></a>
</h5>
<div class="sourceCode" id="cb35"><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 phylostrata contribution to the global TAI pattern</span></span>
<span> <span class="fu"><a href="../reference/PlotContribution.html">PlotContribution</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span>
<span>                   legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>                   xlab           <span class="op">=</span> <span class="st">"Ontogeny"</span>,</span>
<span>                   ylab           <span class="op">=</span> <span class="st">"Transcriptome Age Index"</span>,</span>
<span>                   y.ticks        <span class="op">=</span> <span class="fl">10</span><span class="op">)</span></span></code></pre></div>
<p>The <code>y.ticks</code> argument allows users to to adjust the
number of ticks that shall be visualized on the y-axis.</p>
<p>The exact values of the <code>Phylostratum</code> specific cumulative
TAI profiles can be obtained using the <code><a href="../reference/pTAI.html">pTAI()</a></code> function:</p>
<div class="sourceCode" id="cb36"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/pTAI.html">pTAI</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
1  0.3929533 0.3935308 0.4142106 0.4115399 0.4216806 0.4178302 0.3883815
2  0.9521021 0.9547833 0.9748522 0.9674842 0.9632213 0.9285336 0.8661883
3  1.0502814 1.0477016 1.0576104 1.0556300 1.0549156 1.0187303 0.9722031
4  1.3861830 1.3810595 1.3837548 1.3928030 1.3876006 1.3632945 1.3656170
5  1.5527473 1.5489829 1.5360986 1.5500708 1.5468767 1.5531699 1.5769758
6  1.8114772 1.8171167 1.7806803 1.7968463 1.8020203 1.8223456 1.9207232
7  1.8766090 1.8739449 1.8317327 1.8530276 1.8573216 1.8776292 1.9952325
8  1.9417254 1.9357499 1.8877436 1.9089144 1.9117438 1.9478303 2.0778287
9  2.0339192 2.0294517 1.9823091 1.9982678 1.9915249 2.0413791 2.1878074
10 2.4215868 2.4361137 2.3489524 2.3347670 2.3028346 2.3797112 2.5142773
11 2.4900201 2.5079107 2.4104647 2.3980760 2.3651571 2.4422093 2.5961316
12 3.2299418 3.2256139 3.1071348 3.1166934 3.0739935 3.1765113 3.3903336</code></pre>
</div>
<div class="section level5">
<h5 id="example-divergence-strata">Example: <code>Divergence Strata</code><a class="anchor" aria-label="anchor" href="#example-divergence-strata"></a>
</h5>
<p>Analogously, the <code>Divergence Stratum</code> specific influence
on the global TDI pattern can be visualized using:</p>
<div class="sourceCode" id="cb38"><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"># visualize divergence stratum contribution to global TDI</span></span>
<span> <span class="fu"><a href="../reference/PlotContribution.html">PlotContribution</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">DivergenceExpressionSetExample</span>,</span>
<span>                   legendName    <span class="op">=</span> <span class="st">"DS"</span><span class="op">)</span></span></code></pre></div>
<p>The exact values of the <code>Divergence Stratum</code> specific
cumulative TDI values can be obtained using the <code><a href="../reference/pTDI.html">pTDI()</a></code>
function:</p>
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/pTDI.html">pTDI</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span><span class="op">)</span></span></code></pre></div>
<pre><code>      Zygote  Quadrant  Globular     Heart   Torpedo      Bent    Mature
1  0.2174378 0.2207644 0.2309211 0.2214881 0.2195601 0.2047938 0.1704023
2  0.4800055 0.4762352 0.4821244 0.4752145 0.4799418 0.4695871 0.4288670
3  0.7742988 0.7597816 0.7797646 0.7826244 0.8033702 0.8034316 0.7769026
4  1.1463780 1.1285545 1.1408903 1.1528497 1.1694967 1.1784113 1.1933157
5  1.5652686 1.5489672 1.5545589 1.5698173 1.5934158 1.6003011 1.6330444
6  2.0899161 2.0609661 2.0666314 2.1015199 2.1163138 2.1306059 2.1932280
7  2.6262330 2.6035894 2.6012719 2.6453427 2.6477490 2.6664143 2.8085434
8  3.2211299 3.1990804 3.1767694 3.2319604 3.2292835 3.2693046 3.4412353
9  3.8396769 3.8299654 3.7793476 3.8353941 3.8272391 3.8971210 4.0753877
10 4.5320286 4.5632002 4.4857052 4.5008685 4.4664774 4.5307040 4.6902921</code></pre>
<p>In both cases (<code>Phylostrata</code> and
<code>Divergence Strata</code>) the <code><a href="../reference/pTAI.html">pTAI()</a></code> and
<code><a href="../reference/pTDI.html">pTDI()</a></code> functions return a numeric matrix storing the
cumulative TAI or TDI values for each <code>Phylostratum</code> and
<code>Divergence Stratum</code>. Note, that the TAI values of
<code>Phylostratum</code> 12 (in the <code><a href="../reference/pTAI.html">pTAI()</a></code> matrix) are
equivalent to <code>TAI(PhyloExpressionSetExample)</code>.</p>
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># show that the cumulative TAI value of PS 12 is</span></span>
<span><span class="co"># equivalent to the global TAI() values</span></span>
<span><span class="fu"><a href="../reference/pTAI.html">pTAI</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span><span class="op">[</span><span class="fl">12</span> , <span class="op">]</span></span>
<span></span>
<span><span class="co"># &gt;  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature </span></span>
<span><span class="co"># &gt; 3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334 </span></span>
<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>
<span></span>
<span><span class="co"># &gt;  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature </span></span>
<span><span class="co"># &gt; 3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334</span></span></code></pre></div>
<p>This can be explained by the definition of the TAI. Here the sum of
all partial TAI values over all <code>Phylostrata</code> is equals the
global TAI values:</p>
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># show that the colSum() of partial TAI values</span></span>
<span><span class="co"># over all Phylostrata equals the global TAI() values</span></span>
<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="fu"><a href="../reference/pStrata.html">pStrata</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> , <span class="fl">2</span> , <span class="va">sum</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># &gt;  Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature </span></span>
<span><span class="co"># &gt; 3.229942 3.225614 3.107135 3.116693 3.073993 3.176511 3.390334</span></span></code></pre></div>
<p>Now, the <code><a href="../reference/PlotContribution.html">PlotContribution()</a></code> only differs from
<code>apply(pStrata(PhyloExpressionSetExample) , 2 , sum)</code> by
exchanging the <code><a href="https://rdrr.io/r/base/sum.html" class="external-link">sum()</a></code> by <code><a href="https://rdrr.io/r/base/cumsum.html" class="external-link">cumsum()</a></code>.</p>
<div class="sourceCode" id="cb43"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># show that apply(pStrata(PhyloExpressionSetExample) , 2 , cumsum)</span></span>
<span><span class="co"># is equivalent to pTAI()</span></span>
<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="fu"><a href="../reference/pStrata.html">pStrata</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span> , <span class="fl">2</span> , <span class="va">cumsum</span><span class="op">)</span></span></code></pre></div>
<pre><code>      Zygote  Quadrant  Globular     Heart   Torpedo      Bent    Mature
1  0.3929533 0.3935308 0.4142106 0.4115399 0.4216806 0.4178302 0.3883815
2  0.9521021 0.9547833 0.9748522 0.9674842 0.9632213 0.9285336 0.8661883
3  1.0502814 1.0477016 1.0576104 1.0556300 1.0549156 1.0187303 0.9722031
4  1.3861830 1.3810595 1.3837548 1.3928030 1.3876006 1.3632945 1.3656170
5  1.5527473 1.5489829 1.5360986 1.5500708 1.5468767 1.5531699 1.5769758
6  1.8114772 1.8171167 1.7806803 1.7968463 1.8020203 1.8223456 1.9207232
7  1.8766090 1.8739449 1.8317327 1.8530276 1.8573216 1.8776292 1.9952325
8  1.9417254 1.9357499 1.8877436 1.9089144 1.9117438 1.9478303 2.0778287
9  2.0339192 2.0294517 1.9823091 1.9982678 1.9915249 2.0413791 2.1878074
10 2.4215868 2.4361137 2.3489524 2.3347670 2.3028346 2.3797112 2.5142773
11 2.4900201 2.5079107 2.4104647 2.3980760 2.3651571 2.4422093 2.5961316
12 3.2299418 3.2256139 3.1071348 3.1166934 3.0739935 3.1765113 3.3903336</code></pre>
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/pTAI.html">pTAI</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
1  0.3929533 0.3935308 0.4142106 0.4115399 0.4216806 0.4178302 0.3883815
2  0.9521021 0.9547833 0.9748522 0.9674842 0.9632213 0.9285336 0.8661883
3  1.0502814 1.0477016 1.0576104 1.0556300 1.0549156 1.0187303 0.9722031
4  1.3861830 1.3810595 1.3837548 1.3928030 1.3876006 1.3632945 1.3656170
5  1.5527473 1.5489829 1.5360986 1.5500708 1.5468767 1.5531699 1.5769758
6  1.8114772 1.8171167 1.7806803 1.7968463 1.8020203 1.8223456 1.9207232
7  1.8766090 1.8739449 1.8317327 1.8530276 1.8573216 1.8776292 1.9952325
8  1.9417254 1.9357499 1.8877436 1.9089144 1.9117438 1.9478303 2.0778287
9  2.0339192 2.0294517 1.9823091 1.9982678 1.9915249 2.0413791 2.1878074
10 2.4215868 2.4361137 2.3489524 2.3347670 2.3028346 2.3797112 2.5142773
11 2.4900201 2.5079107 2.4104647 2.3980760 2.3651571 2.4422093 2.5961316
12 3.2299418 3.2256139 3.1071348 3.1166934 3.0739935 3.1765113 3.3903336</code></pre>
<p>This <code><a href="../reference/pTAI.html">pTAI()</a></code> matrix is what is being visualized inside
<code><a href="../reference/PlotContribution.html">PlotContribution()</a></code>.</p>
<p><strong>Note</strong> that the <code><a href="../reference/pStrata.html">pStrata()</a></code> function
returns the partial TAI or TDI values for each <code>Phylostratum</code>
or <code>Divergence Stratum</code>, whereas <code><a href="../reference/pMatrix.html">pMatrix()</a></code>
returns the partial TAI or TDI value for each gene.</p>
<div class="sourceCode" id="cb47"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># compute partial TAI values for each Phylostratum</span></span>
<span><span class="fu"><a href="../reference/pStrata.html">pStrata</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
1  0.39295331 0.39353082 0.41421061 0.41153988 0.42168061 0.41783018 0.38838151
2  0.55914875 0.56125250 0.56064163 0.55594427 0.54154068 0.51070341 0.47780681
3  0.09817938 0.09291830 0.08275821 0.08814585 0.09169432 0.09019669 0.10601483
4  0.33590159 0.33335787 0.32614435 0.33717297 0.33268496 0.34456426 0.39341385
5  0.16656429 0.16792339 0.15234382 0.15726786 0.15927610 0.18987539 0.21135880
6  0.25872990 0.26813378 0.24458170 0.24677547 0.25514358 0.26917571 0.34374736
7  0.06513175 0.05682826 0.05105236 0.05618130 0.05530130 0.05528356 0.07450933
8  0.06511643 0.06180498 0.05601089 0.05588683 0.05442226 0.07020109 0.08259620
9  0.09219381 0.09370185 0.09456557 0.08935340 0.07978112 0.09354879 0.10997873
10 0.38766762 0.40666192 0.36664326 0.33649918 0.31130963 0.33833215 0.32646984
11 0.06843326 0.07179705 0.06151227 0.06330899 0.06232254 0.06249801 0.08185437
12 0.73992167 0.71770319 0.69667019 0.71861745 0.70883635 0.73430205 0.79420194</code></pre>
<div class="sourceCode" id="cb49"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># compute partial TAI values for each gene</span></span>
<span><span class="fu">dplyr</span><span class="fu">::</span><span class="fu"><a href="https://pillar.r-lib.org/reference/glimpse.html" class="external-link">glimpse</a></span><span class="op">(</span><span class="fu"><a href="../reference/pMatrix.html">pMatrix</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<pre><code>Observations: 25260
Variables:
$ Zygote   (dbl) 3.597950e-05, 2.484581e-05, 2.007498e-05, 1.683276e-05, 1.891073e-...
$ Quadrant (dbl) 3.203218e-05, 3.045853e-05, 2.066542e-05, 1.569402e-05, 2.812062e-...
$ Globular (dbl) 2.013329e-05, 2.909027e-05, 1.640631e-05, 2.063608e-05, 6.003300e-...
$ Heart    (dbl) 2.311604e-05, 2.800871e-05, 1.663988e-05, 2.379714e-05, 7.119708e-...
$ Torpedo  (dbl) 1.813626e-05, 2.713080e-05, 1.566972e-05, 2.525094e-05, 1.019572e-...
$ Bent     (dbl) 1.685284e-05, 1.950712e-05, 1.535178e-05, 2.254055e-05, 1.172208e-...
$ Mature   (dbl) 2.684331e-05, 1.695727e-05, 1.415911e-05, 1.362810e-05, 1.229886e-...</code></pre>
<p>You can receive all gene specific partial TAI values by typing
<code>pMatrix(PhyloExpressionSetExample)</code>.</p>
<p>Analogously, <code><a href="../reference/pStrata.html">pStrata()</a></code> and <code><a href="../reference/pMatrix.html">pMatrix()</a></code> can be
used for <code>Divergence Strata</code> by substituting
<code>PhyloExpressionSetExample</code> by
<code>DivergenceExpressionSetExample</code>.</p>
</div>
</div>
<div class="section level4">
<h4 id="mean-expression-and-relative-expression-of-single-phylostrata-or-divergence-strata">Mean Expression and Relative Expression of Single Phylostrata or
Divergence Strata<a class="anchor" aria-label="anchor" href="#mean-expression-and-relative-expression-of-single-phylostrata-or-divergence-strata"></a>
</h4>
<p><strong>TAI</strong> or <strong>TDI</strong> patterns are very useful
to gain a first insight into the mean transcriptome age or mean sequence
divergence of genes being most active during the corresponding
developmental stage or experiment.</p>
<p>To further investigate the origins of the global <strong>TAI</strong>
or <strong>TDI</strong> pattern it is useful to visualize the mean gene
expression of each Phylostratum or Divergence-Stratum class.</p>
</div>
<div class="section level4">
<h4 id="mean-expression-levels-of-a-phyloexpressionset-and-divergenceexpressionset">Mean Expression Levels of a PhyloExpressionSet and
DivergenceExpressionSet<a class="anchor" aria-label="anchor" href="#mean-expression-levels-of-a-phyloexpressionset-and-divergenceexpressionset"></a>
</h4>
<p>Visualizing the mean gene expression of genes corresponding to the
same Phylostratum or Divergence Stratum class allows users to detect
biological process specific groups of Phylostrata or Divergence Strata
that are most expressed during the underlying biological process. This
might lead to correlating specific groups of Phylostrata or Divergence
Strata sharing similar evolutionary origins with common functions or
functional contributions to a specific developmental process.</p>
<div class="sourceCode" id="cb51"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="fu"><a href="../reference/PlotMeans.html">PlotMeans</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>           legendName    <span class="op">=</span> <span class="st">"PS"</span><span class="op">)</span> </span></code></pre></div>
<p>Here we see that the mean gene expression of Phylostratum group:
PS1-3 (genes evolved before the establishment of embryogenesis in
plants) are more expressed during <em>A. thaliana</em> embryogenesis
than PS4-12 (genes evolved during or after the establishment of
embryogenesis in plants).</p>
<p>In different biological processes different Phylostratum groups or
combination of groups might resemble the majority of expressed
genes.</p>
<p>The <code><a href="../reference/PlotMeans.html">PlotMeans()</a></code> function takes an PhyloExpressionSet or
DivergenceExpressionSet and visualizes for each Phylostratum the mean
expression levels of all genes that correspond to this Phylostratum. The
<code>Groups</code> argument takes a list storing the Phylostrata
(classified into the same group) that shall be visualized on the same
plot.</p>
<p>For this example we separate groups of Phylostrata into
<strong>evolutionary old Phylostrata</strong> (PS1-3) in one plot versus
<strong>evolutionary younger Phylostrata</strong> (PS4-12) into another
plot:</p>
<div class="sourceCode" id="cb52"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="co"># in two separate plots (groups)</span></span>
<span><span class="fu"><a href="../reference/PlotMeans.html">PlotMeans</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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>group_1 <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, group_2 <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>           legendName    <span class="op">=</span> <span class="st">"PS"</span><span class="op">)</span> </span></code></pre></div>
<p>To obtain the numerical values (mean expression levels for all
Phylostrata) run:</p>
<div class="sourceCode" id="cb53"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Using the age.apply() function to compute the mean expression levels </span></span>
<span><span class="co"># of all Phylostrata</span></span>
<span><span class="fu"><a href="../reference/age.apply.html">age.apply</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           FUN           <span class="op">=</span> <span class="va">colMeans</span> <span class="op">)</span> </span></code></pre></div>
<pre><code>
     Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature
1  2607.882 2579.372 2604.856 2525.704 2554.825 2622.757 2696.331
2  2597.258 2574.745 2467.679 2388.045 2296.410 2243.716 2321.709
3  2528.272 2363.159 2019.436 2099.079 2155.642 2196.875 2855.866
4  1925.320 1887.078 1771.399 1787.175 1740.823 1867.981 2358.893
5  2378.883 2368.593 2061.729 2077.087 2076.693 2564.904 3157.761
6  1658.253 1697.242 1485.401 1462.613 1492.861 1631.741 2304.683
7  1993.321 1717.659 1480.525 1590.009 1545.078 1600.264 2385.409
8  1781.653 1670.106 1452.180 1414.052 1359.376 1816.718 2364.070
9  1758.119 1764.748 1708.815 1575.727 1388.920 1687.314 2193.930
10 2414.456 2501.390 2163.810 1938.060 1770.039 1993.032 2127.015
11 1999.163 2071.456 1702.779 1710.290 1662.099 1726.865 2501.443
12 2126.189 2036.804 1896.964 1909.578 1859.485 1995.732 2387.343
</code></pre>
<p>Here the <code><a href="../reference/age.apply.html">age.apply()</a></code> function (<code><a href="../reference/age.apply.html">?age.apply</a></code>)
takes a function as argument that itself receives a
<code>data.frame</code> as argument (e.g. <code><a href="https://rdrr.io/r/base/colSums.html" class="external-link">colMeans()</a></code>).</p>
<p>Users may also specify a shaded area corresponding to the modules
that were specified when using the <code><a href="../reference/PlotSignature.html">PlotSignature()</a></code>
function.</p>
<div class="sourceCode" id="cb55"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="co"># and draw an shaded area for the mid-module.</span></span>
<span><span class="fu"><a href="../reference/PlotMeans.html">PlotMeans</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">12</span><span class="op">)</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><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>,<span class="fl">3</span><span class="op">:</span><span class="fl">5</span>,<span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>           legendName    <span class="op">=</span> <span class="st">"PS"</span><span class="op">)</span> </span></code></pre></div>
<p>The <code><a href="../reference/PlotMedians.html">PlotMedians()</a></code> and <code><a href="../reference/PlotVars.html">PlotVars()</a></code> functions
can be used to visualize the median and variance of expression profiles
that correspond to the age categories of interest.</p>
<p>For a DivergenceExpressionSet run:</p>
<div class="sourceCode" id="cb56"><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"># Visualizing the mean gene expression of each Divergence Stratum class</span></span>
<span><span class="fu"><a href="../reference/PlotMeans.html">PlotMeans</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">DivergenceExpressionSetExample</span>, </span>
<span>           Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">10</span><span class="op">)</span>, </span>
<span>           legendName    <span class="op">=</span> <span class="st">"DS"</span>,</span>
<span>           xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span> </span></code></pre></div>
<p>To obtain the numerical values (mean expression levels for all
Divergence Strata) run:</p>
<div class="sourceCode" id="cb57"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Using the age.apply() function to compute the mean expression levels</span></span>
<span><span class="co"># of all Divergence Strata</span></span>
<span><span class="fu"><a href="../reference/age.apply.html">age.apply</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">DivergenceExpressionSetExample</span>, </span>
<span>           FUN           <span class="op">=</span> <span class="va">colMeans</span> <span class="op">)</span> </span></code></pre></div>
<pre><code>
     Zygote Quadrant Globular    Heart  Torpedo     Bent   Mature
1  5222.189 5230.547 5254.464 4911.494 4807.936 4654.683 4277.490
2  3146.510 3020.156 2852.072 2807.367 2845.025 3002.967 3237.315
3  2356.008 2239.344 2257.539 2272.270 2360.816 2529.276 2912.164
4  2230.350 2180.706 2050.895 2049.035 2001.043 2127.165 2608.903
5  2014.600 1994.640 1884.899 1851.554 1858.913 1920.185 2210.391
6  2096.593 2018.440 1938.765 1961.828 1905.246 2005.523 2339.767
7  1836.290 1832.815 1734.319 1719.186 1659.044 1736.141 2201.981
8  1784.470 1762.151 1635.529 1624.682 1590.489 1711.439 1983.607
9  1649.254 1659.455 1522.214 1485.560 1453.689 1584.176 1767.276
10 1660.750 1735.086 1605.275 1473.854 1398.067 1438.258 1541.633
</code></pre>
<p>The <code><a href="../reference/PlotMedians.html">PlotMedians()</a></code> and <code><a href="../reference/PlotVars.html">PlotVars()</a></code> functions
can be used to visualize the median and variance of expression profiles
that correspond to the age categories of interest. Values can be
retrieved via
<code>age.apply(PhyloExpressionSetExample, function(x) apply(x, 2, median))</code>
and
<code>age.apply(PhyloExpressionSetExample, function(x) apply(x, 2, var))</code>.</p>
</div>
<div class="section level4">
<h4 id="relative-expression-levels-of-a-phyloexpressionset-and-divergenceexpressionset">Relative Expression Levels of a PhyloExpressionSet and
DivergenceExpressionSet<a class="anchor" aria-label="anchor" href="#relative-expression-levels-of-a-phyloexpressionset-and-divergenceexpressionset"></a>
</h4>
<p>Introduced by Domazet-Loso and Tautz, (2010), relative expression
levels are defined as a linear transformation of the mean expression
levels (of each Phylostratum or Divergence-Stratum) into the interval
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="true" form="prefix">[</mo><mn>0</mn><mo>,</mo><mn>1</mn><mo stretchy="true" form="postfix">]</mo></mrow><annotation encoding="application/x-tex">[0,1]</annotation></semantics></math>
(Quint et al., 2012 and Drost et al., 2015). This procedure allows users
to compare mean expression patterns between Phylostrata or Divergence
Strata independent from their actual magnitude. Hence, relative
expression profiles aim to correlate the mean expression profiles of
groups of Phylostrata or Divergence Strata due to the assumption that
genes or groups of genes sharing a similar expression profile might be
regulated by similar gene regulatory mechanisms or contribute to similar
biological processes.</p>
<p>The <code><a href="../reference/PlotRE.html">PlotRE()</a></code> function can be used (analogous to the
<code><a href="../reference/PlotMeans.html">PlotMeans()</a></code> function) to visualize the relative expression
levels of a given PhyloExpressionSet and DivergenceExpressionSet:</p>
<div class="sourceCode" id="cb59"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="fu"><a href="../reference/PlotRE.html">PlotRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>        Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>        legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>        xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span> </span></code></pre></div>
<div class="sourceCode" id="cb60"><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"># Visualizing the mean gene expression of each Divergence Stratum class</span></span>
<span><span class="fu"><a href="../reference/PlotRE.html">PlotRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">DivergenceExpressionSetExample</span>, </span>
<span>        Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">10</span><span class="op">)</span>, </span>
<span>        legendName    <span class="op">=</span> <span class="st">"DS"</span>,</span>
<span>        xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span> </span></code></pre></div>
<p>or again by assigning Phylostratum or Divergence Stratum groups that
shall be visualized in different plots:</p>
<div class="sourceCode" id="cb61"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="fu"><a href="../reference/PlotRE.html">PlotRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>        Groups        <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>group_1 <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, group_2 <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>        legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>        xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span> </span></code></pre></div>
<p>Users may also specify a shaded area corresponding to the modules
that were specified when using the <code><a href="../reference/PlotSignature.html">PlotSignature()</a></code>
function.</p>
<div class="sourceCode" id="cb62"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean gene expression of each Phylostratum class</span></span>
<span><span class="fu"><a href="../reference/PlotRE.html">PlotRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>        Groups        <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><span class="fl">1</span><span class="op">:</span><span class="fl">12</span><span class="op">)</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><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>,<span class="fl">3</span><span class="op">:</span><span class="fl">5</span>,<span class="fl">6</span><span class="op">:</span><span class="fl">7</span><span class="op">)</span>,</span>
<span>        legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span>
<span>        xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span> </span></code></pre></div>
<p>The relative expression levels can be obtained using the
<code><a href="../reference/REMatrix.html">REMatrix()</a></code> function:</p>
<div class="sourceCode" id="cb63"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Getting the relative expression levels for all Phylostrata</span></span>
<span><span class="fu"><a href="../reference/REMatrix.html">REMatrix</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
1  0.4816246 0.3145330 0.46389184 0.00000000 0.17067495 0.56880234 1.0000000
2  1.0000000 0.9363209 0.63348381 0.40823711 0.14904726 0.00000000 0.2206063
3  0.6083424 0.4109402 0.00000000 0.09521758 0.16284114 0.21213845 1.0000000
4  0.2985050 0.2366309 0.04946941 0.07499453 0.00000000 0.20573325 1.0000000
5  0.2893657 0.2799777 0.00000000 0.01401191 0.01365328 0.45908792 1.0000000
6  0.2323316 0.2786335 0.02706119 0.00000000 0.03592044 0.20084761 1.0000000
7  0.5666979 0.2620602 0.00000000 0.12099252 0.07133814 0.13232551 1.0000000
8  0.4203039 0.3092784 0.09237036 0.05442042 0.00000000 0.45520558 1.0000000
9  0.4586261 0.4668613 0.39738003 0.23205534 0.00000000 0.37067096 1.0000000
10 0.8811321 1.0000000 0.53841500 0.22974016 0.00000000 0.30490542 0.4881046
11 0.4015809 0.4877111 0.04846721 0.05741594 0.00000000 0.07716367 1.0000000
12 0.5052572 0.3359211 0.07100055 0.09489782 0.00000000 0.25811214 1.0000000
</code></pre>
<div class="sourceCode" id="cb65"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Getting the relative expression levels for all Divergence-Strata</span></span>
<span><span class="fu"><a href="../reference/REMatrix.html">REMatrix</a></span><span class="op">(</span><span class="va">DivergenceExpressionSetExample</span><span class="op">)</span> </span></code></pre></div>
<pre><code>      Zygote  Quadrant   Globular      Heart    Torpedo      Bent    Mature
1  0.9669643 0.9755188 1.00000000 0.64894653 0.54294759 0.3860827 0.0000000
2  0.7888009 0.4949178 0.10397567 0.00000000 0.08758660 0.4549387 1.0000000
3  0.1733953 0.0000000 0.02704324 0.04893726 0.18054185 0.4309208 1.0000000
4  0.3772372 0.2955661 0.08201140 0.07895260 0.00000000 0.2074848 1.0000000
5  0.4543752 0.3987496 0.09292474 0.00000000 0.02050713 0.1912595 1.0000000
6  0.4403615 0.2605017 0.07713944 0.13021586 0.00000000 0.2307754 1.0000000
7  0.3264585 0.3200581 0.13864386 0.11077270 0.00000000 0.1420009 1.0000000
8  0.4934416 0.4366671 0.11457069 0.08697865 0.00000000 0.3076689 1.0000000
9  0.6236387 0.6561674 0.21851855 0.10163374 0.00000000 0.4161087 1.0000000
10 0.7794318 1.0000000 0.61482564 0.22487531 0.00000000 0.1192539 0.4259882
</code></pre>
<p>The same result could also be obtained by using the
<code><a href="../reference/age.apply.html">age.apply()</a></code> function in combination with the
<code><a href="../reference/RE.html">RE()</a></code> function:</p>
<div class="sourceCode" id="cb67"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Getting the relative expression levels for all Phylostrata</span></span>
<span><span class="fu"><a href="../reference/age.apply.html">age.apply</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           FUN           <span class="op">=</span> <span class="va">RE</span> <span class="op">)</span> </span></code></pre></div>
<pre><code>      Zygote  Quadrant   Globular      Heart    Torpedo       Bent    Mature
1  0.4816246 0.3145330 0.46389184 0.00000000 0.17067495 0.56880234 1.0000000
2  1.0000000 0.9363209 0.63348381 0.40823711 0.14904726 0.00000000 0.2206063
3  0.6083424 0.4109402 0.00000000 0.09521758 0.16284114 0.21213845 1.0000000
4  0.2985050 0.2366309 0.04946941 0.07499453 0.00000000 0.20573325 1.0000000
5  0.2893657 0.2799777 0.00000000 0.01401191 0.01365328 0.45908792 1.0000000
6  0.2323316 0.2786335 0.02706119 0.00000000 0.03592044 0.20084761 1.0000000
7  0.5666979 0.2620602 0.00000000 0.12099252 0.07133814 0.13232551 1.0000000
8  0.4203039 0.3092784 0.09237036 0.05442042 0.00000000 0.45520558 1.0000000
9  0.4586261 0.4668613 0.39738003 0.23205534 0.00000000 0.37067096 1.0000000
10 0.8811321 1.0000000 0.53841500 0.22974016 0.00000000 0.30490542 0.4881046
11 0.4015809 0.4877111 0.04846721 0.05741594 0.00000000 0.07716367 1.0000000
12 0.5052572 0.3359211 0.07100055 0.09489782 0.00000000 0.25811214 1.0000000
</code></pre>
<p>Quint et al. (2012) introduced an additional way of visualizing the
difference of relative expression levels between groups of
Phylostrata/Divergence-Strata.</p>
<p>This bar plot comparing the mean relative expression levels of one
Phylostratum/Divergence-Stratum group with all other groups can be
plotted analogous to the <code><a href="../reference/PlotMeans.html">PlotMeans()</a></code> and
<code><a href="../reference/PlotRE.html">PlotRE()</a></code> functions:</p>
<div class="sourceCode" id="cb69"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean relative expression of two Phylostratum groups</span></span>
<span><span class="fu"><a href="../reference/PlotBarRE.html">PlotBarRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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>group_1 <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, group_2 <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>           xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>           ylab          <span class="op">=</span> <span class="st">"Mean Relative Expression"</span>, </span>
<span>           cex           <span class="op">=</span> <span class="fl">1.5</span><span class="op">)</span> </span></code></pre></div>
<p>Here the argument <code>Groups = list(1:3, 4:12)</code> corresponds
to dividing Phylostrata 1-12 into Phylostratum groups defined as
<em>origin before embryogenesis</em> (group one: PS1-3) and <em>origin
during or after embryogenesis</em> (group two: PS4-12). A <a href="http://stat.ethz.ch/R-manual/R-patched/library/stats/html/kruskal.test.html" class="external-link">Kruskal-Wallis
Rank Sum Test</a> is then performed to test the statistical significance
of the different bars that are compared. The ’*’ corresponds to a
statistically significant difference.</p>
<p>Additionally the ratio between both values represented by the bars to
be compared can be visualized as function within the bar plot using the
<code>ratio = TRUE</code> argument:</p>
<div class="sourceCode" id="cb70"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean relative expression of two Phylostratum groups</span></span>
<span><span class="fu"><a href="../reference/PlotBarRE.html">PlotBarRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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>group_1 <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, group_2 <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>           ratio         <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>           xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>           ylab          <span class="op">=</span> <span class="st">"Mean Relative Expression"</span>, </span>
<span>           cex           <span class="op">=</span> <span class="fl">1.5</span> <span class="op">)</span> </span></code></pre></div>
<p>It is also possible to compare more than two groups:</p>
<div class="sourceCode" id="cb71"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Visualizing the mean relative expression of three Phylostratum groups</span></span>
<span><span class="fu"><a href="../reference/PlotBarRE.html">PlotBarRE</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>           Groups        <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>group_1 <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fl">3</span>, group_2 <span class="op">=</span> <span class="fl">4</span><span class="op">:</span><span class="fl">6</span>, group_3 <span class="op">=</span> <span class="fl">7</span><span class="op">:</span><span class="fl">12</span><span class="op">)</span>, </span>
<span>           wLength       <span class="op">=</span> <span class="fl">0.05</span>,</span>
<span>           xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span>, </span>
<span>           ylab          <span class="op">=</span> <span class="st">"Mean Relative Expression"</span>, </span>
<span>           cex           <span class="op">=</span> <span class="fl">1.5</span> <span class="op">)</span> </span></code></pre></div>
<p>For the corresponding statistically significant stages, a
<em>Posthoc</em> test can be performed to detect the combinations of
differing bars that cause the global statistical significance.</p>
</div>
</div>
<div class="section level3">
<h3 id="visualize-age-distributions">Visualize age distributions<a class="anchor" aria-label="anchor" href="#visualize-age-distributions"></a>
</h3>
<p>Users can visualize the age distributions using the
<code><a href="../reference/PlotDistribution.html">PlotDistribution()</a></code> function.</p>
<p>For this purpose, the <code><a href="../reference/PlotDistribution.html">PlotDistribution()</a></code> function was
implemented:</p>
<div class="sourceCode" id="cb72"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Display the phylostratum distribution (gene frequency distribution) </span></span>
<span><span class="co"># of a PhyloExpressionSet as absolute frequency distribution</span></span>
<span><span class="fu"><a href="../reference/PlotDistribution.html">PlotDistribution</a></span><span class="op">(</span> PhyloExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>                  xlab               <span class="op">=</span> <span class="st">"Phylostratum"</span> <span class="op">)</span></span></code></pre></div>
<p>or display it as relative frequencies:</p>
<div class="sourceCode" id="cb73"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Plot phylostrata as relative frequency distribution</span></span>
<span><span class="fu"><a href="../reference/PlotDistribution.html">PlotDistribution</a></span><span class="op">(</span> PhyloExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>                  as.ratio           <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>                  xlab               <span class="op">=</span> <span class="st">"Phylostratum"</span><span class="op">)</span></span></code></pre></div>
<div class="section level4">
<h4 id="saving-plots-on-local-machine">Saving Plots on Local Machine<a class="anchor" aria-label="anchor" href="#saving-plots-on-local-machine"></a>
</h4>
<p>To save plots generated with <code>myTAI</code> on a local machine
users can use the following functions implemented in the R language:
<code>png</code>, <code>pdf</code>, <code>svg</code>.</p>
<div class="sourceCode" id="cb74"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># save the TAI profile to a local machine with png()</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/grDevices/png.html" class="external-link">png</a></span><span class="op">(</span><span class="st">"ExampleTAIProfile.png"</span>, width <span class="op">=</span> <span class="fl">800</span>, height <span class="op">=</span> <span class="fl">600</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="../reference/PlotPattern.html">PlotPattern</a></span><span class="op">(</span> ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>, </span>
<span>             type          <span class="op">=</span> <span class="st">"l"</span>, </span>
<span>             lwd           <span class="op">=</span> <span class="fl">6</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>
<span>             cex           <span class="op">=</span> <span class="fl">1</span>, </span>
<span>             cex.lab       <span class="op">=</span> <span class="fl">1</span>, </span>
<span>             cex.axis      <span class="op">=</span> <span class="fl">1.2</span> <span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/grDevices/dev.html" class="external-link">dev.off</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>When using ggplot2 based functions such as
<code><a href="../reference/PlotSignature.html">PlotSignature()</a></code>, <code><a href="../reference/PlotMeans.html">PlotMeans()</a></code>,
<code><a href="../reference/PlotRE.html">PlotRE()</a></code>, etc. users can rely on the <a href="https://github.com/wilkelab/cowplot" class="external-link">cowplot package</a>.</p>
<div class="sourceCode" id="cb75"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># store ggplot2 graphic in variable p</span></span>
<span><span class="va">p</span> <span class="op">&lt;-</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>                   ylab          <span class="op">=</span> <span class="st">"Transcriptome Age Index"</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># save ggplot2 based TAI profile to a local machine with save_plot()</span></span>
<span><span class="fu">cowplot</span><span class="fu">::</span><span class="fu"><a href="https://wilkelab.org/cowplot/reference/save_plot.html" class="external-link">save_plot</a></span><span class="op">(</span><span class="st">"ExampleTAIProfile.pdf"</span>,</span>
<span>                   <span class="va">p</span>,</span>
<span>                   base_height <span class="op">=</span> <span class="fl">8</span>,</span>
<span>                   base_width <span class="op">=</span> <span class="fl">12</span> <span class="op">)</span></span></code></pre></div>
</div>
</div>
<div class="section level3">
<h3 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a>
</h3>
<p>Domazet-Loso T. and Tautz D. <strong>A phylogenetically based
transcriptome age index mirrors ontogenetic divergence
patterns</strong>. <em>Nature</em> (2010) 468: 815-8.</p>
<p>Quint M. et al. <strong>A transcriptomic hourglass in plant
embryogenesis</strong>. <em>Nature</em> (2012) 490: 98-101.</p>
<p>Drost HG, Gabel A, Grosse I, Quint M. <strong>Evidence for Active
Maintenance of Phylotranscriptomic Hourglass Patterns in Animal and
Plant Embryogenesis</strong>. <em>Mol. Biol. Evol.</em> (2015) 32 (5):
1221-1231.</p>
</div>
</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>
