<!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>Plot the significant differences between gene expression distributions of PS or DS groups — PlotGroupDiffs • 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="Plot the significant differences between gene expression distributions of PS or DS groups — PlotGroupDiffs"><meta name="description" content="This function performs a test to quantify the statistical significance between
the global expression level distributions of groups of PS or DS. It therefore, allows users to investigate
significant groups of PS or DS that significantly differ in their gene expression level distibution
within specific developmental stages or experiments."><meta property="og:description" content="This function performs a test to quantify the statistical significance between
the global expression level distributions of groups of PS or DS. It therefore, allows users to investigate
significant groups of PS or DS that significantly differ in their gene expression level distibution
within specific developmental stages or experiments."><meta property="og:image" content="https://drostlab.github.io/myTAI/logo.png"></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="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="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-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="../logo.png" class="logo" alt=""><h1>Plot the significant differences between gene expression distributions of PS or DS groups</h1>
      <small class="dont-index">Source: <a href="https://github.com/drostlab/myTAI/blob/HEAD/R/PlotGroupDiffs.R" class="external-link"><code>R/PlotGroupDiffs.R</code></a></small>
      <div class="d-none name"><code>PlotGroupDiffs.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>This function performs a test to quantify the statistical significance between
the global expression level distributions of groups of PS or DS. It therefore, allows users to investigate
significant groups of PS or DS that significantly differ in their gene expression level distibution
within specific developmental stages or experiments.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">PlotGroupDiffs</span><span class="op">(</span></span>
<span>  <span class="va">ExpressionSet</span>,</span>
<span>  Groups <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  legendName <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  stat.test <span class="op">=</span> <span class="st">"wilcox.test"</span>,</span>
<span>  col <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">"turquoise3"</span>, <span class="st">"magenta3"</span><span class="op">)</span>,</span>
<span>  plot.type <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  gene.set <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  <span class="va">...</span></span>
<span><span class="op">)</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>


<dl><dt id="arg-expressionset">ExpressionSet<a class="anchor" aria-label="anchor" href="#arg-expressionset"></a></dt>
<dd><p>a standard PhyloExpressionSet or DivergenceExpressionSet object.</p></dd>


<dt id="arg-groups">Groups<a class="anchor" aria-label="anchor" href="#arg-groups"></a></dt>
<dd><p>a list containing the phylostrata or divergence strata that correspond
to the same phylostratum class or divergence class.
For ex. evolutionary old phylostrata: PS1-3 (Class 1)
and evolutionary young phylostrata: PS4-12 (Class 2). In this case,
the list could be assigned as, <code>Groups</code> = list(c(1:3), c(4:12)).</p></dd>


<dt id="arg-legendname">legendName<a class="anchor" aria-label="anchor" href="#arg-legendname"></a></dt>
<dd><p>a character string specifying whether "PS" or "DS" are used to compute relative expression profiles.</p></dd>


<dt id="arg-stat-test">stat.test<a class="anchor" aria-label="anchor" href="#arg-stat-test"></a></dt>
<dd><p>the statistical test to quantify PS or DS group differences.</p></dd>


<dt id="arg-col">col<a class="anchor" aria-label="anchor" href="#arg-col"></a></dt>
<dd><p>colors for the two box plots representing the expression level distributions of selected PS/DS groups.</p></dd>


<dt id="arg-plot-type">plot.type<a class="anchor" aria-label="anchor" href="#arg-plot-type"></a></dt>
<dd><p>the type of plot that shall be drawn to visualized the difference in PS/DS group specific expression .</p></dd>


<dt id="arg-gene-set">gene.set<a class="anchor" aria-label="anchor" href="#arg-gene-set"></a></dt>
<dd><p>a character vector storing the gene ids for which group specific differences shall be statistically quantified.</p></dd>


<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>additional plot parameters.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>The purpose of this function is to detect groups of PS or DS that significantly differ in their gene expression
level distributions on a global (transcriptome) level. Since relative expression levels (<code><a href="PlotRE.html">PlotRE</a></code>) or
PS or DS specific mean expression levels (<code><a href="PlotMeans.html">PlotMeans</a></code>) are biased by highly expressed genes,
this function allows users to objectively test the significant difference of transcriptome expression between
groups of PS or DS in a specific developmental stage or experiment.</p>
<p>In particular, this function divides (for each developmental stage separately) the gene expression levels into two groups: Group1 = genes deriving from selected PS/DS in group 1 and
Group2 = genes deriving from selected PS/DS in group 2. Within each stage the expression level distributions between group 1 and group 2 are statistically quantified using a <code><a href="https://rdrr.io/r/stats/wilcox.test.html" class="external-link">wilcox.test</a></code>.</p>
    </div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p><code><a href="PlotMeans.html">PlotMeans</a></code>, <code><a href="PlotRE.html">PlotRE</a></code>, <code><a href="PlotBarRE.html">PlotBarRE</a></code>, <code><a href="PlotCategoryExpr.html">PlotCategoryExpr</a></code>, <code><a href="GroupDiffs.html">GroupDiffs</a></code></p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Hajk-Georg Drost</p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span></span></span>
<span class="r-in"><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="r-in"><span></span></span>
<span class="r-in"><span><span class="fu">PlotGroupDiffs</span><span class="op">(</span>ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span></span>
<span class="r-in"><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>
<span class="r-in"><span>               legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span></span>
<span class="r-in"><span>               type          <span class="op">=</span> <span class="st">"b"</span>,</span></span>
<span class="r-in"><span>               lwd           <span class="op">=</span> <span class="fl">6</span>,</span></span>
<span class="r-in"><span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                               Zygote     Quadrant     Globular        Heart</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 3.362424e-34 3.017793e-42 1.987181e-71 1.546567e-66</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                              Torpedo         Bent       Mature</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 1.174961e-85 9.975191e-90 1.007102e-74</span>
<span class="r-in"><span>               </span></span>
<span class="r-in"><span>               </span></span>
<span class="r-in"><span><span class="co"># only receive the p-values without the corresponding plot               </span></span></span>
<span class="r-in"><span><span class="fu">PlotGroupDiffs</span><span class="op">(</span>ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span></span>
<span class="r-in"><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>
<span class="r-in"><span>               legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span></span>
<span class="r-in"><span>               plot.p.vals   <span class="op">=</span> <span class="cn">FALSE</span>,</span></span>
<span class="r-in"><span>               type          <span class="op">=</span> <span class="st">"b"</span>,</span></span>
<span class="r-in"><span>               lwd           <span class="op">=</span> <span class="fl">6</span>,</span></span>
<span class="r-in"><span>               xlab          <span class="op">=</span> <span class="st">"Ontogeny"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                               Zygote     Quadrant     Globular        Heart</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 3.362424e-34 3.017793e-42 1.987181e-71 1.546567e-66</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                              Torpedo         Bent       Mature</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 1.174961e-85 9.975191e-90 1.007102e-74</span>
<span class="r-in"><span>               </span></span>
<span class="r-in"><span>               </span></span>
<span class="r-in"><span><span class="co"># quantify the significant difference of a selected set of genes</span></span></span>
<span class="r-in"><span><span class="co"># only receive the p-values without the corresponding plot</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">123</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">ExampleGeneSet</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/sample.html" class="external-link">sample</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">5000</span><span class="op">)</span></span></span>
<span class="r-in"><span>                              </span></span>
<span class="r-in"><span><span class="fu">PlotGroupDiffs</span><span class="op">(</span>ExpressionSet <span class="op">=</span> <span class="va">PhyloExpressionSetExample</span>,</span></span>
<span class="r-in"><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>
<span class="r-in"><span>               legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span></span>
<span class="r-in"><span>               plot.p.vals   <span class="op">=</span> <span class="cn">FALSE</span>,</span></span>
<span class="r-in"><span>               gene.set      <span class="op">=</span> <span class="va">ExampleGeneSet</span><span class="op">)</span>                 </span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                               Zygote     Quadrant     Globular        Heart</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 7.440596e-07 5.336307e-09 7.197872e-17 2.406206e-16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                              Torpedo         Bent       Mature</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 1.638876e-17 4.562901e-17 1.684535e-15</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co"># plot differences as boxplot for each developmental stage</span></span></span>
<span class="r-in"><span><span class="fu">PlotGroupDiffs</span><span class="op">(</span>ExpressionSet <span class="op">=</span> <span class="fu"><a href="tf.html">tf</a></span><span class="op">(</span><span class="va">PhyloExpressionSetExample</span>,<span class="va">log2</span><span class="op">)</span>,</span></span>
<span class="r-in"><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>
<span class="r-in"><span>               legendName    <span class="op">=</span> <span class="st">"PS"</span>,</span></span>
<span class="r-in"><span>               plot.type     <span class="op">=</span> <span class="st">"boxplot"</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                               Zygote     Quadrant     Globular        Heart</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 3.362424e-34 3.017793e-42 1.987181e-71 1.546567e-66</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>                              Torpedo         Bent       Mature</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> p.value ( wilcox.test ) 1.174961e-85 9.975191e-90 1.007102e-74</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span></span></span>
<span class="r-plt img"><img src="PlotGroupDiffs-1.png" alt="" width="700" height="433"></span>
</code></pre></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>

