<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>tidyomicsBlog</title>
<link>https://tidyomics.github.io/tidyomicsBlog/</link>
<atom:link href="https://tidyomics.github.io/tidyomicsBlog/index.xml" rel="self" type="application/rss+xml"/>
<description>The Tidyomics Blog</description>
<generator>quarto-1.9.38</generator>
<lastBuildDate>Fri, 29 May 2026 00:00:00 GMT</lastBuildDate>
<item>
  <title>EuroBioC2026 Tidyomics Hackathon</title>
  <dc:creator>Stefano Mangiola</dc:creator>
  <link>https://tidyomics.github.io/tidyomicsBlog/posts/2026-05-29-eurobioc2026-tidyomics-hackathon/</link>
  <description><![CDATA[ 





<section id="join-us-in-turku" class="level1">
<h1>Join us in Turku</h1>
<p>The Tidyomics community is organising a hackathon during the pre-conference programme of <a href="https://eurobioc2026.bioconductor.org/">EuroBioC2026</a> in Turku, Finland. The hackathon will take place on <strong>June 1-2, 2026</strong>, ahead of the main EuroBioC2026 conference on <strong>June 3-5, 2026</strong>.</p>
<p>This is a community event for people who build, use, teach, document, or are curious about tidy interfaces for omics data analysis in R. Whether you are a regular contributor or new to Tidyomics, the hackathon is a chance to meet collaborators, turn ideas into concrete issues, and make progress on packages, tutorials, and documentation together.</p>
<p>Grab your Tidyomics stickers during the conference! Thanks to Bea Campillo Minano for printing them.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2026-05-29-eurobioc2026-tidyomics-hackathon/tidyomics-sticker-giveaway.png" class="cover-image img-fluid figure-img" style="width:70.0%"></p>
<figcaption>Tidyomics stickers for hackathon participants</figcaption>
</figure>
</div>
</section>
<section id="what-we-will-work-on" class="level1">
<h1>What we will work on</h1>
<p>The hackathon will focus on practical, community-led work across the Tidyomics ecosystem. Possible projects include:</p>
<ul>
<li>fixing bugs and closing issues across Tidyomics packages</li>
<li>implementing new features and workflow improvements</li>
<li>improving documentation, tutorials, and vignettes</li>
<li>developing examples that make tidy omics workflows easier to learn and reuse</li>
</ul>
<p>The <a href="https://github.com/orgs/tidyomics/projects/1">Tidyomics open challenges board</a> will be the main source of ideas for the hackathon. Before the event, please browse the board and identify problems or projects you would like to work on.</p>
</section>
<section id="how-to-participate" class="level1">
<h1>How to participate</h1>
<p>Please start from the <a href="https://github.com/tidyomics/tidyomicsHackathonTurku2026">Tidyomics Hackathon Turku 2026 GitHub repository</a>. The repository includes event details, preparation steps, and space for participants to open or discuss hackathon issues.</p>
<p>Before the event:</p>
<ol type="1">
<li>Browse the <a href="https://github.com/orgs/tidyomics/projects/1">Tidyomics open challenges</a>.</li>
<li>Select a problem you are interested in.</li>
<li>Open an issue in the <a href="https://github.com/tidyomics/tidyomicsHackathonTurku2026">hackathon repository</a>, or comment/react if an issue already exists.</li>
<li>Join the community discussion in the <a href="https://community-bioc.zulipchat.com/#narrow/channel/595963-eurobioc2026-turku-hackathon">EuroBioC2026 Turku hackathon Zulip channel</a>.</li>
</ol>
<p>Groups and projects will be finalised during the first day, based on open issues, participant interest, and available expertise.</p>
</section>
<section id="communication" class="level1">
<h1>Communication</h1>
<p>The official discussion space for the hackathon is the <a href="https://community-bioc.zulipchat.com/#narrow/channel/595963-eurobioc2026-turku-hackathon">EuroBioC2026 Turku hackathon channel on the Bioconductor Zulip server</a>. The virtual meeting room link will also be shared through that channel and by email.</p>
<p>If you are attending EuroBioC2026 online, note that the conference provides <a href="https://eurobioc2026.bioconductor.org/">free live streaming</a> for remote participants.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2026-05-29-eurobioc2026-tidyomics-hackathon/EuroBioC2026_sticker.png" class="img-fluid figure-img" style="width:35.0%"></p>
<figcaption>EuroBioC2026 Turku conference sticker</figcaption>
</figure>
</div>
</section>
<section id="people" class="level1">
<h1>People</h1>
<p>The hackathon was proposed by <strong>Nicholas Cooley</strong>.</p>
<p>The organising committee is:</p>
<ul>
<li>Juan Henao</li>
<li>Stevie Pederson</li>
<li>Michael Love</li>
<li>Nicholas Cooley</li>
</ul>
</section>
<section id="see-you-there" class="level1">
<h1>See you there</h1>
<p>EuroBioC2026 is an opportunity to bring the Bioconductor and Tidyomics communities together around shared tools, shared challenges, and shared documentation. We hope to see you in Turku, on Zulip, and in the hackathon repository.</p>


</section>

<p>
© 2025 tidyomics. Content is published under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons CC-BY-4.0 License</a> for the text and <a href="https://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a> for any code. | <a href="https://www.r-bloggers.com">R-Bloggers</a>
</p> ]]></description>
  <guid>https://tidyomics.github.io/tidyomicsBlog/posts/2026-05-29-eurobioc2026-tidyomics-hackathon/</guid>
  <pubDate>Fri, 29 May 2026 00:00:00 GMT</pubDate>
  <media:content url="https://tidyomics.github.io/tidyomicsBlog/posts/2026-05-29-eurobioc2026-tidyomics-hackathon/tidyomics-sticker-giveaway.png" medium="image" type="image/png" height="122" width="144"/>
</item>
<item>
  <title>Speeding up tidySummarizedExperiment through query optimisation and the plyxp backend</title>
  <dc:creator>Stefano Mangiola</dc:creator>
  <link>https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization/</link>
  <description><![CDATA[ 





<div class="quarto-figure quarto-figure-left">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization/logo.png" class="img-fluid figure-img" width="150"></p>
<figcaption>tidySummarizedExperiment logo</figcaption>
</figure>
</div>
<p><em>Contributors: Michael Love, Justin Landis, Pierre-Paul Axisa</em></p>
<p>The generality of <a href="https://bioconductor.org/packages/tidySummarizedExperiment"><code>tidySummarizedExperiment</code></a> makes it easy to interface with several <a href="https://www.tidyverse.org/"><code>tidyverse</code></a> packages (e.g.&nbsp;<a href="https://CRAN.R-project.org/package=dplyr"><code>dplyr</code></a>, <a href="https://CRAN.R-project.org/package=tidyr"><code>tidyr</code></a>, <a href="https://CRAN.R-project.org/package=ggplot2"><code>ggplot2</code></a>, <a href="https://CRAN.R-project.org/package=purrr"><code>purrr</code></a>, <a href="https://CRAN.R-project.org/package=plotly"><code>plotly</code></a>). This is possible thanks to its approach of converting <a href="https://bioconductor.org/packages/SummarizedExperiment"><code>SummarizedExperiment</code></a> objects to tibbles, performing operations, and converting back to the original format. This conversion process introduces substantial overhead when working with large-scale datasets. Each operation requires multiple data transformations, with the conversion to tibble format creating memory copies of the entire dataset, followed by the reverse conversion back to <a href="https://bioconductor.org/packages/SummarizedExperiment"><code>SummarizedExperiment</code></a>. For datasets containing hundreds of samples and tens of thousands of genes, these repeated conversions can consume memory and add significant computational overhead to even simple operations such as filtering or grouping.</p>
<p>With the new <a href="https://bioconductor.org/packages/tidySummarizedExperiment"><code>tidySummarizedExperiment</code></a> release (<a href="https://github.com/tidyomics/tidySummarizedExperiment/releases/tag/v1.19.7">v1.19.7</a>), we have introduced new optimisations that address these performance limitations. This optimisation is powered by:</p>
<ol type="1">
<li>Check for the query domain (assay, colData, rowData), and execute specialised operation.</li>
<li>Use of <a href="https://bioconductor.org/packages/plyxp"><code>plyxp</code></a> for complex domain-specific queries.</li>
</ol>
<p><em>plyxp</em> is a tidyomics package developed by <a href="https://github.com/jtlandis">Justin Landis</a>, and first released as part of Bioconductor 3.20 in October 2024. It uses data-masking functionality from the <a href="https://rlang.r-lib.org/">rlang</a> package to perform efficient operations on <em>SummarizedExperiment</em> objects.</p>
<section id="motivation-and-design-principles" class="level3">
<h3 class="anchored" data-anchor-id="motivation-and-design-principles">Motivation and design principles</h3>
<p>This benchmark supports ongoing work to improve the performance of <a href="https://bioconductor.org/packages/tidySummarizedExperiment"><code>tidySummarizedExperiment</code></a>. In this benchmark, we show up to 30x improvement in operations such as <code>mutate()</code>.</p>
<p>The current optimisation is grounded in three principles:</p>
<ul>
<li>Decompose operation series: break <code>mutate(a=..., b=..., c=...)</code> into single operations for simpler handling and clearer routing. Reference implementation in <code>R/mutate.R</code> (decomposition step) at <a href="https://github.com/tidyomics/tidySummarizedExperiment/blob/92072d71f9d3b9a82cfc5fdced8e52477c44d80f/R/mutate.R#L146">L146</a>.</li>
<li>Analyse scope: infer whether each expression targets <code>colData</code>, <code>rowData</code>, <code>assays</code>, or a mix (noting that the current analyser is likely over-engineered and could be simplified). See <a href="https://github.com/tidyomics/tidySummarizedExperiment/blob/92072d71f9d3b9a82cfc5fdced8e52477c44d80f/R/mutate.R#L149">L149</a>.</li>
<li>Route mixed operations via plyxp: when an expression touches multiple slots, prefer the plyxp path for correctness and performance. See <a href="https://github.com/tidyomics/tidySummarizedExperiment/blob/92072d71f9d3b9a82cfc5fdced8e52477c44d80f/R/mutate.R#L155">L155</a>.</li>
</ul>
<p>These design choices aim to preserve dimnames, avoid unnecessary tibble round-trips, and provide predictable performance across simple and mixed-slot scenarios.</p>
</section>
<section id="example-of-code-optimisation" class="level3">
<h3 class="anchored" data-anchor-id="example-of-code-optimisation">Example of code optimisation</h3>
<p>This was the <code>mutate()</code> method before optimisation. The previous implementation relied on <code>as_tibble() |&gt; dplyr::mutate() |&gt; update_SE_from_tibble(.data)</code></p>
<p>The function <code>update_SE_from_tibble</code> interprets the input tibble and converts it back to a <code>SummarizedExperiment</code>. Although this step provides great generality and flexibility, it is particularly expensive because it must infer whether columns are sample-wise or feature-wise.</p>
<div class="cell">
<details class="code-fold">
<summary>Show pre-optimization source</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1">mutate.SummarizedExperiment <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(.data, ...) {</span>
<span id="cb1-2">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Legacy implementation of mutate() for SummarizedExperiment:</span></span>
<span id="cb1-3">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># - Validates requested edits against special/view-only columns</span></span>
<span id="cb1-4">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># - Performs mutate() via tibble round-trip, then reconstructs the SE</span></span>
<span id="cb1-5">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check that we are not modifying a key column</span></span>
<span id="cb1-6">    cols <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enquos</span>(...) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>()</span>
<span id="cb1-7">    </span>
<span id="cb1-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Deprecation of special column names:</span></span>
<span id="cb1-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># capture all quoted args to detect deprecated special-column usage</span></span>
<span id="cb1-10">    .cols <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">enquos</span>(..., <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.ignore_empty=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"all"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-11">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">map</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo_name</span>(.x)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">unlist</span>()</span>
<span id="cb1-12">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">is_sample_feature_deprecated_used</span>(.data, .cols)) {</span>
<span id="cb1-13">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Record deprecated usage into metadata for backward compatibility</span></span>
<span id="cb1-14">        .data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ping_old_special_column_into_metadata</span>(.data)</span>
<span id="cb1-15">    }</span>
<span id="cb1-16">    </span>
<span id="cb1-17">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Identify view-only/special columns (sample/feature keys, etc.)</span></span>
<span id="cb1-18">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use a small slice to reduce overhead while probing structure</span></span>
<span id="cb1-19">    special_columns <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">get_special_columns</span>(</span>
<span id="cb1-20">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Decrease the size of the dataset</span></span>
<span id="cb1-21">        .data[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">min</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">nrow</span>(.data)), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">min</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(.data))]</span>
<span id="cb1-22">    ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">get_needed_columns</span>(.data))</span>
<span id="cb1-23">    </span>
<span id="cb1-24">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Are any requested targets among special/view-only columns?</span></span>
<span id="cb1-25">    tst <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb1-26">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">intersect</span>(</span>
<span id="cb1-27">            cols,</span>
<span id="cb1-28">            special_columns</span>
<span id="cb1-29">        ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb1-30">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-31">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gt</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)</span>
<span id="cb1-32"></span>
<span id="cb1-33">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (tst) {</span>
<span id="cb1-34">        columns <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb1-35">            special_columns <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-36">                <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">collapse=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">", "</span>)</span>
<span id="cb1-37">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stop</span>(</span>
<span id="cb1-38">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tidySummarizedExperiment says:"</span>,</span>
<span id="cb1-39">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" you are trying to rename a column that is view only"</span>,</span>
<span id="cb1-40">            columns,</span>
<span id="cb1-41">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"(it is not present in the colData)."</span>,</span>
<span id="cb1-42">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" If you want to mutate a view-only column,"</span>,</span>
<span id="cb1-43">            <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">" make a copy and mutate that one."</span></span>
<span id="cb1-44">        )</span>
<span id="cb1-45">    }</span>
<span id="cb1-46"></span>
<span id="cb1-47">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># If Ranges column not in query, prefer faster tibble conversion</span></span>
<span id="cb1-48">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Skip expanding GRanges columns when not referenced</span></span>
<span id="cb1-49">    skip_GRanges <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb1-50">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">get_GRanges_colnames</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%in%</span> </span>
<span id="cb1-51">        cols <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-52">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">not</span>()</span>
<span id="cb1-53">    </span>
<span id="cb1-54">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Round-trip: SE -&gt; tibble -&gt; dplyr::mutate -&gt; SE</span></span>
<span id="cb1-55">    .data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-56">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as_tibble</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">skip_GRanges=</span>skip_GRanges) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-57">        dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(...) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-58">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update_SE_from_tibble</span>(.data)</span>
<span id="cb1-59">}</span></code></pre></div></div>
</details>
</div>
<p>The new implementation captures all easy cases, such as sample-only and feature-only metadata <code>mutate()</code>. If <code>mutate()</code> is a mixed operation that can be factored out to sample- and feature-wise operation it is handled by <code>plyxp</code>. Otherwise, the general solution is used.</p>
<p>Key components to compare: - The pre-optimization code always uses a tibble round-trip (<code>as_tibble() |&gt; dplyr::mutate() |&gt; update_SE_from_tibble()</code>). - The optimized code first analyzes scope (<code>colData</code>, <code>rowData</code>, <code>assay</code>, or mixed) and dispatches to specialized paths. - The fallback still exists (<code>mutate_via_tibble</code>) for complex cases, preserving generality.</p>
<div class="cell">
<details class="code-fold">
<summary>Show post-optimization source</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">mutate.SummarizedExperiment <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(.data, ...) {</span>
<span id="cb2-2"></span>
<span id="cb2-3">       <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check if query is composed (multiple expressions)</span></span>
<span id="cb2-4">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">is_composed</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span>, ...)) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">return</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">decompose_tidy_operation</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span>, ...)(.data))</span>
<span id="cb2-5"></span>
<span id="cb2-6">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check for scope and dispatch elegantly</span></span>
<span id="cb2-7">        scope_report <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">analyze_query_scope_mutate</span>(.data, ...)</span>
<span id="cb2-8">        scope <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> scope_report<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>scope</span>
<span id="cb2-9"></span>
<span id="cb2-10">        result <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span id="cb2-11">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span>(scope <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"coldata_only"</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">modify_samples</span>(.data, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span>, ...)</span>
<span id="cb2-12">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span>(scope <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"rowdata_only"</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">modify_features</span>(.data, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span>, ...)</span>
<span id="cb2-13">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span>(scope <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"assay_only"</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate_assay</span>(.data, ...)</span>
<span id="cb2-14">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span>(scope <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mixed"</span>) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">modify_se_plyxp</span>(.data, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span>, scope_report, ...)</span>
<span id="cb2-15">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate_via_tibble</span>(.data, ...)</span>
<span id="cb2-16"></span>
<span id="cb2-17">        <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Record latest mutate scope into metadata for testing/introspection</span></span>
<span id="cb2-18">        meta <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> S4Vectors<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">metadata</span>(result)</span>
<span id="cb2-19">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">is.null</span>(meta)) meta <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>()</span>
<span id="cb2-20">        meta<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>latest_mutate_scope_report <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> scope_report</span>
<span id="cb2-21">        S4Vectors<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">metadata</span>(result) <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> meta</span>
<span id="cb2-22"></span>
<span id="cb2-23">        <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">return</span>(result)</span>
<span id="cb2-24"></span>
<span id="cb2-25">}</span></code></pre></div></div>
</details>
</div>
</section>
<section id="benchmarking-overview" class="level1">
<h1>Benchmarking Overview</h1>
<p>This vignette benchmarks a set of <a href="https://tidyomics.github.io/tidySummarizedExperiment/reference/mutate.html"><code>mutate()</code></a>, <a href="https://tidyomics.github.io/tidySummarizedExperiment/reference/filter.html"><code>filter()</code></a>, <a href="https://tidyomics.github.io/tidySummarizedExperiment/reference/select.html"><code>select()</code></a>, and <a href="https://tidyomics.github.io/tidySummarizedExperiment/reference/distinct.html"><code>distinct()</code></a> scenarios (see <a href="https://bioconductor.org/packages/tidySummarizedExperiment">documentation</a>) comparing performance before and after optimisation, by explicitly checking out specific commits via git worktree, loading each commit’s code with <code>devtools::load_all()</code>, running the same scenarios multiple times, and comparing the runtimes with ggplot boxplots.</p>
<ul>
<li>Before optimisation: <a href="https://github.com/tidyomics/tidySummarizedExperiment/commit/87445757d2d0332e7d335d22cd28f73568b7db66">commit 87445757d2d0332e7d335d22cd28f73568b7db66</a></li>
<li>After optimisation: <a href="https://github.com/tidyomics/tidySummarizedExperiment/commit/9f7c26e0519c92f9682b270d566da127367bcbc0">commit 9f7c26e0519c92f9682b270d566da127367bcbc0</a></li>
</ul>
<section id="setup-helper-functions" class="level3">
<h3 class="anchored" data-anchor-id="setup-helper-functions">Setup helper functions</h3>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">suppressPackageStartupMessages</span>({</span>
<span id="cb3-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(ggplot2)</span>
<span id="cb3-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(dplyr)</span>
<span id="cb3-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(SummarizedExperiment)</span>
<span id="cb3-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(rlang)</span>
<span id="cb3-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(devtools)</span>
<span id="cb3-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(airway)</span>
<span id="cb3-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(microbenchmark)</span>
<span id="cb3-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(reactable)</span>
<span id="cb3-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(patchwork)</span>
<span id="cb3-11">})</span>
<span id="cb3-12"></span>
<span id="cb3-13">load_branch_code <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(worktree_dir) {</span>
<span id="cb3-14">  <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">requireNamespace</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"devtools"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">quietly =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stop</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Please install devtools to run this vignette."</span>)</span>
<span id="cb3-15">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Debug: print the directory we're looking for</span></span>
<span id="cb3-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Looking for worktree directory:"</span>, worktree_dir, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-17">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Directory exists:"</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dir.exists</span>(worktree_dir), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-18">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Current working directory:"</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">getwd</span>(), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">\n</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb3-19">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check if directory exists</span></span>
<span id="cb3-20">  <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dir.exists</span>(worktree_dir)) {</span>
<span id="cb3-21">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stop</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Worktree directory does not exist:"</span>, worktree_dir))</span>
<span id="cb3-22">  }</span>
<span id="cb3-23">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">suppressMessages</span>(devtools<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load_all</span>(worktree_dir, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">quiet =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>))</span>
<span id="cb3-24">}</span>
<span id="cb3-25"></span>
<span id="cb3-26">create_airway_test_se <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>() {</span>
<span id="cb3-27">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">suppressPackageStartupMessages</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(airway))</span>
<span id="cb3-28">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(airway)</span>
<span id="cb3-29">  se <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> airway</span>
<span id="cb3-30">  se[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, ]</span>
<span id="cb3-31">}</span>
<span id="cb3-32"></span>
<span id="cb3-33">benchmark_scenarios <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>() {</span>
<span id="cb3-34">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(</span>
<span id="cb3-35">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">coldata_simple_assignment =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_dex =</span> dex) }),</span>
<span id="cb3-36">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">coldata_arithmetic =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">avgLength_plus_5 =</span> avgLength <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>) }),</span>
<span id="cb3-37">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">coldata_concat =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sample_info =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(cell, dex, SampleName, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"_"</span>)) }),</span>
<span id="cb3-38">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">coldata_grouped_mean =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(dex) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">avgLength_group_mean =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(avgLength)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ungroup</span>() }),</span>
<span id="cb3-39">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">assay_simple_assignment =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">counts_copy =</span> counts) }),</span>
<span id="cb3-40">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">assay_plus_one =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">counts_plus_1 =</span> counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) }),</span>
<span id="cb3-41">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">assay_log =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">log_counts_manual =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log2</span>(counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)) }),</span>
<span id="cb3-42">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">complex_conditional_coldata =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">length_group =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>(avgLength <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(avgLength), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"longer"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"shorter"</span>)) }),</span>
<span id="cb3-43">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">complex_nested =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">complex_category =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>(dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"trt"</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> avgLength <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(avgLength), <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treated_long"</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>(dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"untrt"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"untreated"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"other"</span>))) }),</span>
<span id="cb3-44">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mixed_assay_coldata =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">new_counts =</span> counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> avgLength) }),</span>
<span id="cb3-45">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">multiple_simple_assay =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">normalized_counts =</span> counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sqrt_counts =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sqrt</span>(counts)) }),</span>
<span id="cb3-46">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">chained_mutates =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">tmp =</span> avgLength <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">flag =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ifelse</span>(tmp <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(tmp), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>)) }),</span>
<span id="cb3-47"></span>
<span id="cb3-48">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Filter benchmarks (scoped and non-rectangular)</span></span>
<span id="cb3-49">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">filter_coldata_simple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"trt"</span>) }),</span>
<span id="cb3-50">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">filter_coldata_numeric =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(avgLength <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">median</span>(avgLength)) }),</span>
<span id="cb3-51">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">filter_assay_nonrect =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>) }),</span>
<span id="cb3-52"></span>
<span id="cb3-53">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Select benchmarks (covering colData-only, rowData-only, assays-only, mixed)</span></span>
<span id="cb3-54">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">select_coldata_simple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.sample, dex) }),</span>
<span id="cb3-55">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">select_rowdata_simple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.feature) }),</span>
<span id="cb3-56">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">select_assay_only =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(counts) }),</span>
<span id="cb3-57">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">select_mixed_keys_counts =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.sample, .feature, counts) }),</span>
<span id="cb3-58">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">select_coldata_wide =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(.sample, dex, avgLength, SampleName) }),</span>
<span id="cb3-59"></span>
<span id="cb3-60">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Distinct benchmarks (covering colData-only, rowData-only, assays-only, mixed)</span></span>
<span id="cb3-61">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_coldata_simple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(dex) }),</span>
<span id="cb3-62">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_coldata_multiple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(dex, avgLength) }),</span>
<span id="cb3-63">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_rowdata_simple =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(.feature) }),</span>
<span id="cb3-64">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_assay_only =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(counts) }),</span>
<span id="cb3-65">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_mixed_keys_counts =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(.sample, .feature, counts) }),</span>
<span id="cb3-66">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_coldata_wide =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(.sample, dex, avgLength, SampleName) }),</span>
<span id="cb3-67">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_with_keep_all =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(dex, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.keep_all =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>) }),</span>
<span id="cb3-68">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">distinct_complex_expression =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">quo</span>({ se <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">distinct</span>(dex, avgLength) })</span>
<span id="cb3-69">  )</span>
<span id="cb3-70">}</span>
<span id="cb3-71"></span>
<span id="cb3-72">run_one <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(expr_quo, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>L) {</span>
<span id="cb3-73">  se_base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">create_airway_test_se</span>()</span>
<span id="cb3-74">  mb <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> microbenchmark<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">microbenchmark</span>(</span>
<span id="cb3-75">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">eval_tidy</span>(expr_quo),</span>
<span id="cb3-76">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">times =</span> reps,</span>
<span id="cb3-77">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">setup =</span> { se <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> se_base },          <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># reuse the same input, avoid recreating inside the timed expr</span></span>
<span id="cb3-78">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">control =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">warmup =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>L)</span>
<span id="cb3-79">  )</span>
<span id="cb3-80">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># microbenchmark returns nanoseconds; convert to milliseconds</span></span>
<span id="cb3-81">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(mb<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>time) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e6</span></span>
<span id="cb3-82">}</span>
<span id="cb3-83"></span>
<span id="cb3-84">run_all_scenarios <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(branch_label, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>L) {</span>
<span id="cb3-85">  scenarios <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">benchmark_scenarios</span>()</span>
<span id="cb3-86">  out <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">list</span>()</span>
<span id="cb3-87">  <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> (nm <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>(scenarios)) {</span>
<span id="cb3-88">    tms <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">run_one</span>(scenarios[[nm]], <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> reps)</span>
<span id="cb3-89">    out[[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(out) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>L]] <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb3-90">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">branch =</span> branch_label,</span>
<span id="cb3-91">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">scenario =</span> nm,</span>
<span id="cb3-92">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">replicate =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">seq_along</span>(tms),</span>
<span id="cb3-93">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">elapsed_ms =</span> tms,</span>
<span id="cb3-94">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">stringsAsFactors =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span></span>
<span id="cb3-95">    )</span>
<span id="cb3-96">  }</span>
<span id="cb3-97">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_rows</span>(out)</span>
<span id="cb3-98">}</span>
<span id="cb3-99"></span>
<span id="cb3-100"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Parallel version: run each scenario on a separate worker</span></span>
<span id="cb3-101">run_all_scenarios_parallel <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(branch_label, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>L, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">workers =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>L, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">initializer =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span>) {</span>
<span id="cb3-102">  scenarios <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">benchmark_scenarios</span>()</span>
<span id="cb3-103">  nms <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>(scenarios)</span>
<span id="cb3-104">  old_plan <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> future<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plan</span>()</span>
<span id="cb3-105">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">on.exit</span>(future<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plan</span>(old_plan), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">add =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb3-106">  future<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plan</span>(future<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span>multisession, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">workers =</span> workers)</span>
<span id="cb3-107">  res <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> future.apply<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">future_lapply</span>(nms, <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">function</span>(nm) {</span>
<span id="cb3-108">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">is.null</span>(initializer)) <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">initializer</span>()</span>
<span id="cb3-109">    tms <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">run_one</span>(scenarios[[nm]], <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> reps)</span>
<span id="cb3-110">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data.frame</span>(</span>
<span id="cb3-111">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">branch =</span> branch_label,</span>
<span id="cb3-112">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">scenario =</span> nm,</span>
<span id="cb3-113">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">replicate =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">seq_along</span>(tms),</span>
<span id="cb3-114">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">elapsed_ms =</span> tms,</span>
<span id="cb3-115">      <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">stringsAsFactors =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span></span>
<span id="cb3-116">    )</span>
<span id="cb3-117">  }, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">future.seed =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb3-118">  dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_rows</span>(res)</span>
<span id="cb3-119">}</span></code></pre></div></div>
</details>
</div>
</section>
<section id="run-benchmarks-on-both-branches" class="level3">
<h3 class="anchored" data-anchor-id="run-benchmarks-on-both-branches">Run benchmarks on both branches</h3>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Worktree directories (already exist in the post directory)</span></span>
<span id="cb4-2">wt_before <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">".__bench_before__"</span></span>
<span id="cb4-3">wt_after <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">".__bench_after__"</span></span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Verify worktrees exist</span></span>
<span id="cb4-6"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dir.exists</span>(wt_before)) {</span>
<span id="cb4-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stop</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Worktree directory does not exist: "</span>, wt_before)</span>
<span id="cb4-8">}</span>
<span id="cb4-9"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dir.exists</span>(wt_after)) {</span>
<span id="cb4-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">stop</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Worktree directory does not exist: "</span>, wt_after)</span>
<span id="cb4-11">}</span>
<span id="cb4-12"></span>
<span id="cb4-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Before optimisation (commit 87445757)</span></span>
<span id="cb4-14"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load_branch_code</span>(wt_before)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Looking for worktree directory: .__bench_before__ 
Directory exists: TRUE 
Current working directory: /Users/a1234450/Documents/GitHub/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization </code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">res_before <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">run_all_scenarios</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">branch_label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"before_optimization"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>L)</span>
<span id="cb6-2"></span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># After optimisation (commit 9f7c26e)</span></span>
<span id="cb6-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load_branch_code</span>(wt_after)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Looking for worktree directory: .__bench_after__ 
Directory exists: TRUE 
Current working directory: /Users/a1234450/Documents/GitHub/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization </code></pre>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1">res_after <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">run_all_scenarios</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">branch_label =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"after_optimization"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">reps =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>L)</span>
<span id="cb8-2"></span>
<span id="cb8-3">results <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_rows</span>(res_before, res_after) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-4">  dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">operation =</span> dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb8-5">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^filter"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"filter"</span>,</span>
<span id="cb8-6">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^select"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"select"</span>,</span>
<span id="cb8-7">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^distinct"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"distinct"</span>,</span>
<span id="cb8-8">    <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span></span>
<span id="cb8-9">  ))</span>
<span id="cb8-10"></span>
<span id="cb8-11">summary_table <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> results <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(branch, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarise</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">median_ms =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">median</span>(elapsed_ms), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">.groups =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"drop"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-14">  tidyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pivot_wider</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">names_from =</span> branch, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values_from =</span> median_ms) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb8-15">  dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">speedup =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(before_optimization <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> after_optimization, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>))</span></code></pre></div></div>
</details>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="reactable html-widget html-fill-item" id="htmlwidget-226268d0e09b28952dc5" style="width:auto;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-226268d0e09b28952dc5">{"x":{"tag":{"name":"Reactable","attribs":{"data":{"scenario":["assay_log","assay_plus_one","assay_simple_assignment","chained_mutates","coldata_arithmetic","coldata_concat","coldata_grouped_mean","coldata_simple_assignment","complex_conditional_coldata","complex_nested","distinct_assay_only","distinct_coldata_multiple","distinct_coldata_simple","distinct_coldata_wide","distinct_complex_expression","distinct_mixed_keys_counts","distinct_rowdata_simple","distinct_with_keep_all","filter_assay_nonrect","filter_coldata_numeric","filter_coldata_simple","mixed_assay_coldata","multiple_simple_assay","select_assay_only","select_coldata_simple","select_coldata_wide","select_mixed_keys_counts","select_rowdata_simple"],"after_optimization":[12.4554805,12.328708,11.681375,21.5625,11.0071665,11.0921455,93.9895835,11.321708,11.3674785,11.787646,183.6270415,104.3887705,103.090917,172.007979,108.229458,211.791104,102.567687,116.4211665,74.754,21.781209,22.755375,29.610208,25.965729,174.4993535,98.666563,102.3431045,115.9610005,97.5994795],"before_optimization":[289.085042,289.313729,288.7251875,548.727708,288.0155005,281.744729,88.8149785,291.0410415,271.0590425,274.0804585,197.556417,118.027792,116.40925,119.396937,117.7116455,199.8871875,114.4365215,118.1221665,104.8900625,25.817354,26.3123745,283.314792,299.2484995,181.386271,123.428688,113.5046455,117.837937,113.6867925],"speedup":[23.21,23.47,24.72,25.45,26.17,25.4,0.94,25.71,23.85,23.25,1.08,1.13,1.13,0.69,1.09,0.94,1.12,1.01,1.4,1.19,1.16,9.57,11.52,1.04,1.25,1.11,1.02,1.16]},"columns":[{"id":"scenario","name":"Scenario","type":"character","minWidth":220,"align":"left"},{"id":"after_optimization","name":"After (ms)","type":"numeric","minWidth":120,"align":"left","format":{"cell":{"digits":1},"aggregated":{"digits":1}}},{"id":"before_optimization","name":"Before (ms)","type":"numeric","minWidth":120,"align":"left","format":{"cell":{"digits":1},"aggregated":{"digits":1}}},{"id":"speedup","name":"Speedup (x)","type":"numeric","minWidth":120,"align":"left","format":{"cell":{"digits":2},"aggregated":{"digits":2}}}],"filterable":true,"searchable":true,"defaultPageSize":10,"highlight":true,"bordered":true,"striped":true,"compact":true,"dataKey":"5e96953b8fc47c84831c51a6f5bf258f"},"children":[]},"class":"reactR_markup"},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section>
</section>
<section id="visualize-with-combined-performance-plots" class="level1">
<h1>Visualize with combined performance plots</h1>
<div class="cell">
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1">dodge_w <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.7</span></span>
<span id="cb9-2"></span>
<span id="cb9-3">p_box <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(results, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> scenario, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> elapsed_ms, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> branch)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_boxplot</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_dodge</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> dodge_w), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.7</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">outlier.shape =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-5"></span>
<span id="cb9-6">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Add jittered points aligned with the dodged boxplots</span></span>
<span id="cb9-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>(</span>
<span id="cb9-8">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">position =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">position_jitterdodge</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">jitter.width =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">jitter.height =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dodge.width =</span> dodge_w), </span>
<span id="cb9-9">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">alpha =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>, </span>
<span id="cb9-10">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">size =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span></span>
<span id="cb9-11">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_y_log10</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb9-13">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">coord_flip</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-14">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">facet_grid</span>(operation <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ., <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">scales =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_y"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">space =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_y"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-15">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">annotation_logticks</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sides =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"b"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-16">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Performance comparison: Before vs After optimization"</span>,</span>
<span id="cb9-17">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scenario"</span>,</span>
<span id="cb9-18">       <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Elapsed (ms)"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-20">  </span>
<span id="cb9-21">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Angle x labels  </span></span>
<span id="cb9-22">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"top"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">axis.text.x =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">element_text</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">angle =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">45</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">hjust =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb9-23"></span>
<span id="cb9-24"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Speedup summary panel (median before/after ratio)</span></span>
<span id="cb9-25">speedup_plot_data <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> summary_table <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-26">  dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">operation =</span> dplyr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">case_when</span>(</span>
<span id="cb9-27">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^filter"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"filter"</span>,</span>
<span id="cb9-28">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^select"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"select"</span>,</span>
<span id="cb9-29">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grepl</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"^distinct"</span>, scenario) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"distinct"</span>,</span>
<span id="cb9-30">    <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mutate"</span></span>
<span id="cb9-31">  ))</span>
<span id="cb9-32"></span>
<span id="cb9-33">p_speedup <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(</span>
<span id="cb9-34">  speedup_plot_data,</span>
<span id="cb9-35">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> speedup, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">reorder</span>(scenario, speedup))</span>
<span id="cb9-36">) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-37">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_col</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.7</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey70"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey40"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-38">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">facet_grid</span>(operation <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> ., <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">scales =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_y"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">space =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_y"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-39">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">labs</span>(</span>
<span id="cb9-40">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">title =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Median speedup by scenario"</span>,</span>
<span id="cb9-41">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">x =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Speedup (before/after, x)"</span>,</span>
<span id="cb9-42">    <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">y =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NULL</span></span>
<span id="cb9-43">  ) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-44">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme_bw</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span id="cb9-45">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">theme</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend.position =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"none"</span>)</span>
<span id="cb9-46"></span>
<span id="cb9-47">combined_plot <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> p_box <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_speedup <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> patchwork<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot_layout</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">widths =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.3</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>))</span>
<span id="cb9-48">combined_plot</span></code></pre></div></div>
</details>
<div class="cell-output-display">
<div>
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization/index_files/figure-html/plot-1.png" class="img-fluid figure-img" width="1344"></p>
</figure>
</div>
</div>
<details class="code-fold">
<summary>Show the code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Save the combined figure</span></span>
<span id="cb10-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggsave</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"benchmark_plot.png"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">plot =</span> combined_plot, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">width =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">14</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">height =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span></code></pre></div></div>
</details>
</div>
<section id="interpreting-the-benchmark-results" class="level3">
<h3 class="anchored" data-anchor-id="interpreting-the-benchmark-results">Interpreting the benchmark results</h3>
<p>Across all scenarios, speedup ranges from <strong>0.69x</strong> to <strong>26.17x</strong>.</p>
<p>Operations with the strongest gains are: <strong>coldata_arithmetic (26.17x), coldata_simple_assignment (25.71x), chained_mutates (25.45x)</strong>.</p>
<p>Lower-gain outliers are: <strong>distinct_coldata_wide (0.69x), coldata_grouped_mean (0.94x), distinct_mixed_keys_counts (0.94x)</strong>.</p>
<p>By operation family, median speedup is: <strong>mutate (23.66x), filter (1.19x), select (1.11x), distinct (1.08x)</strong>.</p>
</section>
</section>
<section id="session-info" class="level1">
<h1>Session Info</h1>
<div class="cell">
<div class="cell-output cell-output-stdout">
<pre><code>R version 4.5.3 (2026-03-11)
Platform: x86_64-apple-darwin20
Running under: macOS Sonoma 14.6.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.5-x86_64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Adelaide
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] tidySummarizedExperiment_1.19.7 tidyr_1.3.2                    
 [3] testthat_3.3.2                  ttservice_0.5.3                
 [5] patchwork_1.3.2                 reactable_0.4.5                
 [7] rlang_1.1.7                     microbenchmark_1.5.0           
 [9] airway_1.30.0                   SummarizedExperiment_1.40.0    
[11] Biobase_2.70.0                  GenomicRanges_1.62.1           
[13] Seqinfo_1.0.0                   IRanges_2.44.0                 
[15] S4Vectors_0.48.0                BiocGenerics_0.56.0            
[17] generics_0.1.4                  MatrixGenerics_1.22.0          
[19] matrixStats_1.5.0               dplyr_1.2.0                    
[21] ggplot2_4.0.2                   devtools_2.4.6                 
[23] usethis_3.2.1                  

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1    viridisLite_0.4.3   farver_2.1.2       
 [4] S7_0.2.1            fastmap_1.2.0       lazyeval_0.2.2     
 [7] digest_0.6.39       plyxp_1.4.3         lifecycle_1.0.5    
[10] ellipsis_0.3.2      magrittr_2.0.4      compiler_4.5.3     
[13] tools_4.5.3         yaml_2.3.12         data.table_1.18.2.1
[16] knitr_1.51          S4Arrays_1.10.1     labeling_0.4.3     
[19] htmlwidgets_1.6.4   pkgbuild_1.4.8      DelayedArray_0.36.0
[22] RColorBrewer_1.1-3  pkgload_1.5.0       abind_1.4-8        
[25] withr_3.0.2         purrr_1.2.1         desc_1.4.3         
[28] grid_4.5.3          fansi_1.0.7         scales_1.4.0       
[31] cli_3.6.5           rmarkdown_2.30      ragg_1.5.1         
[34] remotes_2.5.0       otel_0.2.0          rstudioapi_0.18.0  
[37] httr_1.4.8          sessioninfo_1.2.3   cachem_1.1.0       
[40] stringr_1.6.0       XVector_0.50.0      vctrs_0.7.1        
[43] Matrix_1.7-4        jsonlite_2.0.0      systemfonts_1.3.2  
[46] crosstalk_1.2.2     plotly_4.12.0       glue_1.8.0         
[49] reactR_0.6.1        stringi_1.8.7       gtable_0.3.6       
[52] tibble_3.3.1        pillar_1.11.1       htmltools_0.5.9    
[55] brio_1.1.5          R6_2.6.1            textshaping_1.0.5  
[58] rprojroot_2.1.1     evaluate_1.0.5      lattice_0.22-9     
[61] memoise_2.0.1       SparseArray_1.10.9  xfun_0.56          
[64] fs_1.6.7            pkgconfig_2.0.3    </code></pre>
</div>
</div>


</section>

<p>
© 2025 tidyomics. Content is published under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons CC-BY-4.0 License</a> for the text and <a href="https://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a> for any code. | <a href="https://www.r-bloggers.com">R-Bloggers</a>
</p> ]]></description>
  <guid>https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization/</guid>
  <pubDate>Sun, 22 Mar 2026 00:00:00 GMT</pubDate>
  <media:content url="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-25-tidySummarizedExperiment-optimization/benchmark_plot.png" medium="image" type="image/png" height="82" width="144"/>
</item>
<item>
  <title>Omicslog</title>
  <dc:creator>Juan Henao</dc:creator>
  <link>https://tidyomics.github.io/tidyomicsBlog/posts/2025-11-04-introducing-omicslog/</link>
  <description><![CDATA[ 





<section id="welcome-to-omicslog" class="level1">
<h1>Welcome to omicslog!</h1>
<p>I still remember being in front of my PI, trying to recall, or even worse, to guess the number of samples we had ignored when running a specific analysis, such as filtering low-count genes for DEG analysis or excluding biological samples collected outside a target time window when we aimed to discover biomarker candidates for early disease detection. I especially remember how that became even worse across the different projects we were working on simultaneously.</p>
<p>The solution was always the same: rerun the whole code up to the line that could answer those questions. That was even more frustrating considering that, in many cases, those questions came from pure curiosity rather than information that would be included in the final publication.</p>
<p>Inspired by the <code>lab notebook</code> from my wet lab colleagues and the <code>tidylog</code> package, we present <code>omicslog</code>, a package that provides logging capabilities for omics-oriented objects. Our goal is to establish a standard for tracking changes to these objects, acting as an automated dry lab notebook and improving the reproducibility of specific analyses.</p>
<p>We started by enabling logging for the <code>SummarizedExperiment</code> class, powered by <code>tidyomics</code> functionalities. Every function in the pipeline is evaluated, with changes traced and aggregated as metadata.</p>
<p>Let’s start with a practical example, beginning with the package installation and library loading:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> (<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">require</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"devtools"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">quietly =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>))</span>
<span id="cb1-2">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">install.packages</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"devtools"</span>)</span>
<span id="cb1-3"></span>
<span id="cb1-4">devtools<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">install_github</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tidyomics/omicslog"</span>)</span>
<span id="cb1-5"></span>
<span id="cb1-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(SummarizedExperiment)</span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidySummarizedExperiment)</span>
<span id="cb1-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(omicslog)</span></code></pre></div></div>
<p>For this example, we worked with the <code>airway</code> dataset. To extend <code>tidyomics</code> with <code>omicslog</code>, it is only necessary to add the <code>log_start()</code> function before applying the different filtering criteria:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(airway, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">package =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"airway"</span>)</span>
<span id="cb2-2"></span>
<span id="cb2-3">result <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span id="cb2-4">  airway <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log_start</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Starting the logging operations</span></span>
<span id="cb2-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"trt"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span>albut) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">dex_upper =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">toupper</span>(dex)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">extract</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col =</span> dex, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">into =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"treat"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">Run =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tolower</span>(Run)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> </span>
<span id="cb2-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(.feature <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ENSG00000000003"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-12">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)</span>
<span id="cb2-13"></span>
<span id="cb2-14">result</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; # A SummarizedExperiment-tibble abstraction: 1 × 1</span></span>
<span id="cb3-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; # Features=1 | Samples=1 | Assays=counts</span></span>
<span id="cb3-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt;   .feature      .sample counts SampleName cell  treat Run   avgLength Experiment</span></span>
<span id="cb3-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt;   &lt;chr&gt;         &lt;chr&gt;    &lt;int&gt; &lt;fct&gt;      &lt;fct&gt; &lt;chr&gt; &lt;chr&gt;     &lt;int&gt; &lt;fct&gt;     </span></span>
<span id="cb3-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; 1 ENSG00000000… SRR103…   1047 GSM1275871 N080… trt   srr1…       126 SRX384354 </span></span>
<span id="cb3-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; # ℹ 3 more variables: Sample &lt;fct&gt;, BioSample &lt;fct&gt;, dex_upper &lt;chr&gt;</span></span>
<span id="cb3-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; </span></span>
<span id="cb3-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; Operation log:</span></span>
<span id="cb3-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:30] filter: removed 4 samples (50%), 4 samples remaining</span></span>
<span id="cb3-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] select: removed 1 (11%), 8 column(s) remaining</span></span>
<span id="cb3-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] mutate: added 1 new column(s): dex_upper</span></span>
<span id="cb3-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] extract: extracted 'dex' into column: treat (original removed)</span></span>
<span id="cb3-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] mutate: modified column(s): Run</span></span>
<span id="cb3-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] filter: removed 64101 genes (100%), 1 genes remaining</span></span>
<span id="cb3-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:21:31] slice: Kept 1/4 rows (25.0%); removed 3 rows</span></span></code></pre></div></div>
</div>
<p>As a result, the <code>metadata</code> shows a short description of the different modifications the <code>SummarizedExperiment</code> underwent during each function in the pipeline, formatted as <code>[TIME] FUNCTION NAME: ONE-LINE DESCRIPTION</code>.</p>
<p>Notwithstanding, <code>omicslog</code> can also work with base R commands by simply adding the dataset name to the <code>log_start()</code> function:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">restore_SummarizedExperiment_show =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb4-2"></span>
<span id="cb4-3">result_base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">log_start</span>(airway) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Starting the logging operations</span></span>
<span id="cb4-4"></span>
<span id="cb4-5">result_base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result_base[, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result_base)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"trt"</span>]</span>
<span id="cb4-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result_base)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>dex_upper <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">toupper</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result_base)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>dex)</span>
<span id="cb4-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result_base)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Run <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tolower</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result_base)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Run)</span>
<span id="cb4-8">result_base <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result_base[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rownames</span>(result_base) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ENSG00000000003"</span>, ]</span>
<span id="cb4-9"></span>
<span id="cb4-10">result_base</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; class: SummarizedExperimentLogged </span></span>
<span id="cb5-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; dim: 1 4 </span></span>
<span id="cb5-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; metadata(1): ''</span></span>
<span id="cb5-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; assays(1): counts</span></span>
<span id="cb5-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; rownames(1): ENSG00000000003</span></span>
<span id="cb5-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; rowData names(0):</span></span>
<span id="cb5-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; colnames(4): SRR1039509 SRR1039513 SRR1039517 SRR1039521</span></span>
<span id="cb5-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; colData names(10): SampleName cell ... BioSample dex_upper</span></span>
<span id="cb5-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; </span></span>
<span id="cb5-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; Operation log:</span></span>
<span id="cb5-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:22:58] subset: removed 4 samples (50%), 4 samples remaining</span></span>
<span id="cb5-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:22:58] colData&lt;-: added 1 new column(s): dex_upper</span></span>
<span id="cb5-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:22:58] colData&lt;-: modified column 'Run'</span></span>
<span id="cb5-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2025-12-17 13:22:58] subset: removed 64101 genes (100%), 1 genes remaining</span></span></code></pre></div></div>
</div>
</section>
<section id="behind-the-scenes" class="level1">
<h1>Behind the scenes</h1>
<p>How does <code>omicslog</code> operate? In essence, for every function you apply to a <code>SummarizedExperiment</code> object, it tracks changes in rows and columns and records a message describing those changes in a dedicated logging structure stored in the object’s <code>metadata</code>.</p>
<p>Let us suppose we want to filter the <code>airway</code> dataset to retain only samples treated with dexamethasone (<code>dex == "trt"</code>):</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1">result1 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> airway <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(dex <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"untrt"</span>)</span></code></pre></div></div>
<p>How many samples did we keep? Let us find out:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1">remaining_samples <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result1)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Sample)</span>
<span id="cb7-2">remaining_samples</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [1] 4</span></span></code></pre></div></div>
</div>
<p>What about the removed data? How many samples were discarded?</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1">samples_removed <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(airway)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Sample) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result1)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Sample)</span>
<span id="cb9-2">samples_removed</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [1] 4</span></span></code></pre></div></div>
</div>
<p>It is often useful to express this change as a percentage, since we may be discarding a substantial amount of information:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1">percentage <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> samples_removed <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">length</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(airway)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Sample) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb11-2">percentage</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [1] 50</span></span></code></pre></div></div>
</div>
<p>At this point, we have a clear idea of how much the dataset has been modified. However, in practice, we often need to retrieve this kind of information repeatedly. To avoid manual bookkeeping, we would like to store it directly in the object itself, using the <code>metadata</code> slot.</p>
<p>Before doing so, we need some additional context, such as <em>when</em> the operation was executed and <em>which</em> function was used:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb13-1">time <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.time</span>()</span>
<span id="cb13-2">func <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"filter"</span></span></code></pre></div></div>
<p>The most straightforward way to persist this information is to create a concise log message:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1">result1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>metadata<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>log_history <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(time, func,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">": removed"</span>, samples_removed, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"samples"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"("</span>, percentage,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"%)"</span>, remaining_samples, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"samples remaining"</span>)</span>
<span id="cb14-2">result1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>metadata<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>log_history</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [1] "2025-12-17 13:27:34 filter : removed 4 samples ( 50 %) 4 samples remaining"</span></span></code></pre></div></div>
</div>
<p>Column-related operations follow the same logic. For example, let us remove the <code>albut</code> column, as we are not interested in samples treated with albuterol:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb16" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1">result2 <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> result1 <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb16-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">select</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span>albut)</span></code></pre></div></div>
<p>Even though we know that exactly one column was removed, it is still valuable to keep track of <em>how</em> the dataset was modified, <em>when</em> the change occurred, and <em>which</em> function was responsible:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb17-1">columns_removed <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result1)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result2))</span>
<span id="cb17-2">columns_remaining <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result2))</span>
<span id="cb17-3">percentage <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">round</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result2)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ncol</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colData</span>(result1)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb17-4">time <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Sys.time</span>()</span>
<span id="cb17-5">func <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"select"</span></span>
<span id="cb17-6"></span>
<span id="cb17-7">result1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>metadata<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>log_history <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(result1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>metadata<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>log_history,</span>
<span id="cb17-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(time, func,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">": removed"</span>, columns_removed, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"("</span>, percentage,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"%)"</span>, columns_remaining, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"column(s) remaining"</span>)</span>
<span id="cb17-9">)</span>
<span id="cb17-10">result1<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>metadata<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>log_history</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb18-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [1] "2025-12-17 13:27:34 filter : removed 4 samples ( 50 %) 4 samples remaining"</span></span>
<span id="cb18-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#&gt; [2] "2025-12-17 13:28:38 select : removed 1 ( 11.11 %) 8 column(s) remaining"</span></span></code></pre></div></div>
</div>
<p>As shown above, we extract the same type of information and append a new log entry to the <code>metadata</code> slot, just as we did for the row-based operation.</p>
<p>Too much work for a single data transformation? We agree. This is exactly where <code>omicslog</code> comes in—handling all logging operations automatically, so you can focus on the analysis.</p>
</section>
<section id="we-need-your-feedback" class="level1">
<h1>We need your feedback!</h1>
<p>Besides the messages shown above, what other operation details might you be interested in logging for an omics-oriented project?</p>
<p>Don’t hesitate to open an issue in the <a href="https://github.com/tidyomics/omicslog" title="logging capabilities for SummarizedExperiment objects">omicslog</a> GitHub repo.</p>


</section>

<p>
© 2025 tidyomics. Content is published under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons CC-BY-4.0 License</a> for the text and <a href="https://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a> for any code. | <a href="https://www.r-bloggers.com">R-Bloggers</a>
</p> ]]></description>
  <guid>https://tidyomics.github.io/tidyomicsBlog/posts/2025-11-04-introducing-omicslog/</guid>
  <pubDate>Tue, 04 Nov 2025 00:00:00 GMT</pubDate>
  <media:content url="https://tidyomics.github.io/tidyomicsBlog/posts/2025-11-04-introducing-omicslog/omicslog_blog_logo.png" medium="image" type="image/png" height="139" width="144"/>
</item>
<item>
  <title>The Tidyomics Ecosystem</title>
  <dc:creator>Stefano Mangiola, tidyomics community</dc:creator>
  <link>https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-10-introducing-tidyomics-ecosystem/</link>
  <description><![CDATA[ 





<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-10-introducing-tidyomics-ecosystem/tidyomics_book_cover.png" class="cover-image img-fluid figure-img" style="width:100.0%"></p>
<figcaption>The Tidyomics Book Cover - A comprehensive guide to the tidyomics ecosystem for omics data analysis</figcaption>
</figure>
</div>
<section id="introduction" class="level1">
<h1>Introduction</h1>
<p>The tidyomics ecosystem was born from a common challenge faced by life-scientists: omics technologies and frameworks in R often require specialised data structures and syntax. Switching from bulk RNA-seq to single-cell, or from expression data to genomic ranges, often felt climbing a different mountain. Tidyomics keeps the <strong>underlying objects exactly the same</strong> while giving them a single, tidyverse-flavoured grammar and data display making moving from bulk RNA-seq to single-cell or spatial data seamless. Its design principles take inspiration from the tidyverse philosophy of clear, human-readable code as articulated by Wickham <em>et al.</em> (2019) (<a href="https://joss.theoj.org/papers/10.21105/joss.01686">JOSS 10.21105/joss.01686</a>).</p>
<p>This initiative snowballed into an international collaboration—and ultimately into <code>tidyomics</code> (<a href="https://www.nature.com/articles/s41592-024-02299-2">Nat. Methods 2024</a>). Thanks to support from the <a href="https://chanzuckerberg.com/eoss/proposals/?cycle=6">Chan Zuckerberg Initiative’s Essential Open Source Software for Science (EOSS) Cycle 6 program</a>, we are actively improving tidyomics through performance optimization, enhanced documentation, and ecosystem expansion to better serve the biomedical research community.</p>
</section>
<section id="what-is-tidyomics" class="level1">
<h1>What is Tidyomics?</h1>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-10-introducing-tidyomics-ecosystem/logo.png" class="img-fluid figure-img" width="120"></p>
<figcaption>Tidyomics Logo - The official logo of the tidyomics ecosystem</figcaption>
</figure>
</div>
<p><code>tidyomics</code> is an open project to develop and integrate software and documentation to enable a tidy data analysis framework for omics data objects (<a href="https://doi.org/10.1038/s41592-024-02299-2">Hutchison <em>et al.</em> 2024</a>). The development of packages and tutorials is organized around <a href="https://github.com/orgs/tidyomics/projects/1">tidyomics open challenges</a>. Tidyomics enables the use of familiar tidyverse verbs (<code>select</code>, <code>filter</code>, <code>mutate</code>, etc.) to manipulate rich data objects in the Bioconductor ecosystem. Importantly, while the data objects are not modified, <code>tidyomics</code> provides a tidy <em>interface</em> to work on the native objects, leveraging existing Bioconductor classes and algorithms.</p>
<p><code>tidyomics</code> is a set of R packages by an international group of developers. The ecosystem allows for code such as:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1">single_cell_data <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Phase <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"G1"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb1-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(UMAP_1, UMAP_2, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span>score)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb1-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>()</span></code></pre></div></div>
<p>(filter single cells in G1 phase and plot UMAP coordinates)</p>
<p>or</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1">chip_seq_peaks <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-2">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(FDR <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.01</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-3">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">join_overlap_inner</span>(promoters) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-4">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(promoter_type) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb2-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarize</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ave_score =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(score))</span></code></pre></div></div>
<p>(compute average score by the type of promoter overlap for significant peaks)</p>
<p>At the same time, data containers can be abstracted as flat <code>tibbles</code>, closing the loop, and allowing the user extended visibility and operability of data.</p>
<p>For example, the <a href="https://bioconductor.org/packages/release/data/experiment/html/airway.html">airway</a> dataset.</p>
<p>From the standard summarised representation</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(airway)</span>
<span id="cb3-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(airway)</span>
<span id="cb3-3">airway</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb4-1">class<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> RangedSummarizedExperiment </span>
<span id="cb4-2">dim<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">63677</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span> </span>
<span id="cb4-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">metadata</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">''</span></span>
<span id="cb4-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">assays</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> counts</span>
<span id="cb4-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rownames</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">63677</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> ENSG00000000003 ENSG00000000005 ... ENSG00000273492</span>
<span id="cb4-6">  ENSG00000273493</span>
<span id="cb4-7">rowData <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> gene_id gene_name ... seq_coord_system symbol</span>
<span id="cb4-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">colnames</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> SRR1039508 SRR1039509 ... SRR1039520 SRR1039521</span>
<span id="cb4-9">colData <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">names</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span> SampleName cell ... Sample BioSample</span></code></pre></div></div>
</div>
<p>Loading <code>tidyprint</code> (available from the 3.22 Bioconductor release), the <code>SummarizedExperimenrt</code> is abstracted to a richer flat representation, without altering its internal properties or structure.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyprint)</span>
<span id="cb5-2">airway</span></code></pre></div></div>
<div class="smaller">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># A SummarizedExperiment-tibble abstraction: Features=63677 | Samples=8 | Assays=counts</span></span>
<span id="cb6-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#                                  |----------------- COVARIATES ---------------|</span></span>
<span id="cb6-3">        .feature  .sample <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> counts <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> SampleName cell  dex   albut Run   avgLength</span>
<span id="cb6-4">        <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span>chr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>     <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>chr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>   <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">|</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>chr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>  <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">|</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>fct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>      <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>fct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>fct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>fct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>fct<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">&lt;</span>chr<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>    </span>
<span id="cb6-5"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>      ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">679</span>     <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275862 N613… untrt untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">126</span>      </span>
<span id="cb6-6"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>      ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275862 N613… untrt untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">126</span>      </span>
<span id="cb6-7"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>      ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">467</span>     <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275862 N613… untrt untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">126</span>      </span>
<span id="cb6-8"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>      ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>     <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275862 N613… untrt untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">126</span>      </span>
<span id="cb6-9"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>      ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">60</span>      <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275862 N613… untrt untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">126</span>      </span>
<span id="cb6-10">        <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">--------</span>  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-------</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">------</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">----------</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">----</span>  <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">---</span>   <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-----</span> <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">---</span>   <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">---------</span></span>
<span id="cb6-11"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">509412</span> ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275875 N061… trt   untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>       </span>
<span id="cb6-12"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">509413</span> ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275875 N061… trt   untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>       </span>
<span id="cb6-13"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">509414</span> ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275875 N061… trt   untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>       </span>
<span id="cb6-14"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">509415</span> ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275875 N061… trt   untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>       </span>
<span id="cb6-15"><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">509416</span> ENSG0000… SRR103… <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>       <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> GSM1275875 N061… trt   untrt SRR1… <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>       </span>
<span id="cb6-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ℹ 14 more variables: Experiment &lt;fct&gt;, Sample &lt;fct&gt;, BioSample &lt;fct&gt;,</span></span>
<span id="cb6-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   `|` &lt;|&gt;, gene_id &lt;chr&gt;, gene_name &lt;chr&gt;, entrezid &lt;chr&gt;,</span></span>
<span id="cb6-18"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   gene_biotype &lt;chr&gt;, gene_seq_start &lt;chr&gt;, gene_seq_end &lt;chr&gt;,</span></span>
<span id="cb6-19"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#   seq_name &lt;chr&gt;, seq_strand &lt;chr&gt;, seq_coord_system &lt;chr&gt;, symbol &lt;chr&gt;</span></span></code></pre></div></div>
</div>
<section id="core-principles" class="level2">
<h2 class="anchored" data-anchor-id="core-principles">Core Principles</h2>
<p>The tidyomics ecosystem is built on several fundamental principles:</p>
<ul>
<li><strong>Tidy interface to native objects</strong>: Provides tidy verbs while preserving Bioconductor object structure</li>
<li><strong>Verbose, jargon-free vocabulary</strong>: Function and variable names are designed to be self-explanatory</li>
<li><strong>Minimal temporary variables</strong>: Reduce the need for intermediate variables through chaining operations</li>
<li><strong>Consistent interfaces</strong>: Provide uniform interfaces across different data containers</li>
<li><strong>Compatibility</strong>: Work seamlessly with existing Bioconductor and tidyverse workflows</li>
</ul>
</section>
<section id="omics-integration-under-a-unique-consistent-interface" class="level2">
<h2 class="anchored" data-anchor-id="omics-integration-under-a-unique-consistent-interface">Omics Integration Under a Unique Consistent Interface</h2>
<p>The tidyomics ecosystem provides a unified approach to omics data analysis, enabling seamless integration across different omics domains through a consistent tidy interface.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-10-introducing-tidyomics-ecosystem/tidyomics_net.png" class="center-image img-fluid figure-img" style="width:80.0%"></p>
<figcaption>Tidyomics Network Integration - A diagram showing how the tidyomics ecosystem integrates different omics domains through a consistent tidy interface</figcaption>
</figure>
</div>
<p>This integration allows researchers to work with transcriptomics, genomics, and other omics data using the same familiar tidyverse verbs, regardless of the underlying data structure.</p>
</section>
</section>
<section id="core-packages" class="level1">
<h1>Core Packages</h1>
<p>Before diving into the individual packages you can simply load the <strong>meta-package</strong> and immediately gain access to all tidyomics functionality:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># BiocManager::install("tidyomics")  </span></span>
<span id="cb7-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyomics)  </span></code></pre></div></div>
</div>
<p>With a single call you have a tidy interface ready for spatial, single-cell, bulk, and genomic range data.</p>
<section id="utility-packages" class="level2">
<h2 class="anchored" data-anchor-id="utility-packages">Utility packages</h2>
<section id="tidyprint" class="level3">
<h3 class="anchored" data-anchor-id="tidyprint">tidyprint</h3>
<p><code>tidyprint</code> (available from the 3.22 Bioconductor release) offers a consistent, user-friendly print method for Bioconductor objects such as <code>SummarizedExperiment</code>. It flattens the display of complex S4 objects into tidy tibbles for straightforward inspection, summarization, and reporting—without modifying the underlying data. This approach makes it easy to explore and understand your data at a glance using familiar tidyverse conventions.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/tidyprint.html">Bioconductor</a></strong> | <strong><a href="https://github.com/tidyomics/tidyprint">GitHub</a></strong></p>
</section>
</section>
<section id="transcriptomics-packages" class="level2">
<h2 class="anchored" data-anchor-id="transcriptomics-packages">Transcriptomics Packages</h2>
<p>Bulk RNA-seq analyses, for example, are traditionally scattered across disjoint data frames, objects and helper lists. <code>tidySummarizedExperiment</code> re-imagines a <code>SummarizedExperiment</code> through a tibble-like interface: you can <code>filter()</code>, <code>mutate()</code> and <code>group_by()</code> genes or samples exactly as you do with any tidyverse data frame. For single-cell data the same philosophy inspired <code>tidySingleCellExperiment</code>, while for users of the Seurat workflow we created <code>tidyseurat</code>, a drop-in tidy wrapper that makes transitioning between Bioconductor and Seurat frameworks seamless.</p>
<section id="tidysummarizedexperiment" class="level3">
<h3 class="anchored" data-anchor-id="tidysummarizedexperiment">tidySummarizedExperiment</h3>
<p>The tidy interface for <code>SummarizedExperiment</code> objects, enabling tidyverse operations on bulk RNA-seq data.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/tidySummarizedExperiment.html">Bioconductor</a></strong> | <strong><a href="https://github.com/tidyomics/tidySummarizedExperiment">GitHub</a></strong></p>
</section>
<section id="tidysinglecellexperiment" class="level3">
<h3 class="anchored" data-anchor-id="tidysinglecellexperiment">tidySingleCellExperiment</h3>
<p>Single-cell experiments are highly dimensional. <code>tidySingleCellExperiment</code> flattens this complexity so you can focus on the biology instead of the bookkeeping.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/tidySingleCellExperiment.html">Bioconductor</a></strong> | <strong><a href="https://github.com/tidyomics/tidySingleCellExperiment">GitHub</a></strong></p>
</section>
<section id="tidyseurat" class="level3">
<h3 class="anchored" data-anchor-id="tidyseurat">tidyseurat</h3>
<p>For Seurat users, <code>tidyseurat</code> adds the missing tidyverse layer without forcing you to abandon familiar Seurat functions.</p>
<p><strong><a href="https://cran.r-project.org/web/packages/tidyseurat/index.html">CRAN</a></strong> | <strong><a href="https://github.com/stemangiola/tidyseurat">GitHub</a></strong></p>
</section>
<section id="tidyspatialexperiment" class="level3">
<h3 class="anchored" data-anchor-id="tidyspatialexperiment">tidySpatialExperiment</h3>
<p>Spatial transcriptomics combines gene expression with tissue spatial coordinates. <code>tidySpatialExperiment</code> brings the tidy philosophy to <code>SpatialExperiment</code> objects so you can transform, visualise and gate spatial spots with the same verbs you already use for bulk and single-cell data.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/tidySpatialExperiment.html">Bioconductor</a></strong> | <strong><a href="https://github.com/william-hutchison/tidySpatialExperiment">GitHub</a></strong></p>
</section>
</section>
<section id="genomics-packages" class="level2">
<h2 class="anchored" data-anchor-id="genomics-packages">Genomics Packages</h2>
<p>Genomic ranges represent locations along chromosomes—think of them as the geographical coordinates of the genome. With traditional Bioconductor tools, even simple tasks such as “take promoters and find overlaps with ATAC-seq peaks” require specialised syntax. The tidy answer is <strong><code>plyranges</code></strong>, a grammar that lets you manipulate <code>GRanges</code> with the fluency of dplyr verbs. And because biology is three-dimensional, the sister package <strong><code>plyinteractions</code></strong> brings the same elegance to chromatin-interaction data.</p>
<section id="plyranges" class="level3">
<h3 class="anchored" data-anchor-id="plyranges">plyranges</h3>
<p>A tidy interface for genomic ranges data, providing a grammar of genomic data manipulation.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/plyranges.html">Bioconductor</a></strong> | <strong><a href="https://github.com/tidyomics/plyranges">GitHub</a></strong></p>
</section>
<section id="plyinteractions" class="level3">
<h3 class="anchored" data-anchor-id="plyinteractions">plyinteractions</h3>
<p>A tidy interface for genomic interaction data, enabling analysis of chromatin interactions.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/plyinteractions.html">Bioconductor</a></strong> | <strong><a href="https://github.com/tidyomics/plyinteractions">GitHub</a></strong></p>
</section>
</section>
</section>
<section id="analysis-packages-non-core-packages" class="level1">
<h1>Analysis Packages (non-core packages)</h1>
<p>The core adapters above focus on <strong>data representation</strong>; the packages below provide high-level analysis grammars that build on those tidy foundations.</p>
<section id="tidybulk" class="level3">
<h3 class="anchored" data-anchor-id="tidybulk">tidybulk</h3>
<p>A tidy framework for modular transcriptomic data analysis, <code>tidybulk</code> streamlines bulk RNA-seq workflows by integrating differential expression, batch correction, and gene set enrichment into a consistent, pipe-friendly grammar. It enables users to perform complex analyses with simple, readable code, leveraging tidyverse principles for reproducibility and clarity.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/tidybulk.html">Bioconductor</a></strong> | <strong><a href="https://github.com/stemangiola/tidybulk">GitHub</a></strong></p>
</section>
<section id="nullranges" class="level3">
<h3 class="anchored" data-anchor-id="nullranges">nullranges</h3>
<p>A tidy interface for statistical null range generation and overlap analysis in genomics. <code>nullranges</code> enables users to create matched sets of genomic ranges for robust enrichment testing, supporting reproducible and flexible workflows for tasks such as permutation-based significance assessment and background modeling.</p>
<p><strong><a href="https://www.bioconductor.org/packages/release/bioc/html/nullranges.html">Bioconductor</a></strong> | <strong><a href="https://github.com/nullranges">GitHub</a></strong></p>
</section>
</section>
<section id="publications" class="level1">
<h1>Publications</h1>
<p><em>Hutchison W.J.</em>, <em>Keyes T.J.</em>, <em>et al.</em> (2024). <strong>“The tidyomics ecosystem: enhancing omic data analyses.”</strong> <em>Nature Methods</em> 21, 1166–1170. DOI <a href="https://doi.org/10.1038/s41592-024-02299-2">10.1038/s41592-024-02299-2</a></p>
<p>This community paper introduces tidyomics and demonstrates its scalability on 7.5 million PBMCs from the Human Cell Atlas.</p>
<section id="transcriptomics" class="level2">
<h2 class="anchored" data-anchor-id="transcriptomics">Transcriptomics</h2>
<ul>
<li><em>Mangiola S.</em>, Molania R., Dong R., Doyle M.A.&nbsp;&amp; Papenfuss A.T. (2021). <strong>“tidybulk: a tidy framework for modular transcriptomic data analysis.”</strong> <em>Genome Biology</em> 22, 42. DOI <a href="https://doi.org/10.1186/s13059-020-02233-7">10.1186/s13059-020-02233-7</a></li>
<li><em>Mangiola S.</em>, Doyle M.A.&nbsp;&amp; Papenfuss A.T. (2021). <strong>“Interfacing Seurat with the R tidy universe.”</strong> <em>Bioinformatics</em> 37(22), 4100–4103. DOI <a href="https://doi.org/10.1093/bioinformatics/btab404">10.1093/bioinformatics/btab404</a></li>
</ul>
</section>
<section id="genomics" class="level2">
<h2 class="anchored" data-anchor-id="genomics">Genomics</h2>
<ul>
<li><em>Lee S.</em>, Cook D. &amp; Lawrence M. (2019). <strong>“plyranges: a grammar of genomic data transformation.”</strong> <em>Genome Biology</em> 20, 4. DOI <a href="https://doi.org/10.1186/s13059-018-1597-8">10.1186/s13059-018-1597-8</a></li>
<li><em>Davis E.S.</em>, Mu W., Lee S., Dozmorov M.G., Love M.I. &amp; Phanstiel D.H. (2023). <strong>“matchRanges: Generating null hypothesis genomic ranges via covariate-matched sampling.”</strong> <em>Bioinformatics</em>. DOI <a href="https://doi.org/10.1093/bioinformatics/btad197">10.1093/bioinformatics/btad197</a></li>
</ul>
</section>
</section>
<section id="community" class="level1">
<h1>Community</h1>
<p>Tidyomics is more than code — it is a <strong>lively community of developers, users and code-curators</strong> who collaborate across academic labs, core facilities and industry groups on five continents. Developers extend the toolbox, users pressure-test new ideas on real datasets, and curators keep documentation and tutorials clear and current. No matter whether you write R every day or are about to analyse your first sequencing experiment, you’ll find mentors ready to help — and eager to learn from your perspective.</p>
<section id="getting-involved" class="level2">
<h2 class="anchored" data-anchor-id="getting-involved">Getting Involved</h2>
<section id="contributing" class="level3">
<h3 class="anchored" data-anchor-id="contributing">Contributing</h3>
<p>The tidyomics ecosystem welcomes contributions from the community. You can contribute by:</p>
<ol type="1">
<li><strong>Reporting Issues</strong>: Use the GitHub issue trackers for each package. Open or search issues in the relevant repository: <a href="https://github.com/tidyomics" class="uri">https://github.com/tidyomics</a></li>
<li><strong>Submitting ideas</strong>: Contribute code improvements or new features <a href="https://github.com/orgs/tidyomics/projects/1" class="uri">https://github.com/orgs/tidyomics/projects/1</a></li>
<li><strong>Improving Documentation</strong>: Help make the ecosystem more accessible</li>
<li><strong>Creating Tutorials</strong>: Share your knowledge with the community!</li>
</ol>
</section>
<section id="communication-channels" class="level3">
<h3 class="anchored" data-anchor-id="communication-channels">Communication Channels</h3>
<ul>
<li><strong>tidyomics open challenges</strong> – start or join a thread in any tidyomics repository: <a href="https://github.com/orgs/tidyomics/projects/1" class="uri">https://github.com/orgs/tidyomics/projects/1</a></li>
<li><strong>Bioconductor Support Forum</strong> – tag your post with <em>tidyomics</em>: <a href="https://support.bioconductor.org" class="uri">https://support.bioconductor.org</a></li>
<li><strong>Zulip Chat</strong> – drop by the <code>#tidiness_in_bioc</code> stream for real-time discussion: <a href="https://community-bioc.zulipchat.com/#narrow/channel/507542-tidiness_in_bioc" class="uri">https://community-bioc.zulipchat.com/#narrow/channel/507542-tidiness_in_bioc</a></li>
</ul>
</section>
<section id="transcriptomics-example" class="level3">
<h3 class="anchored" data-anchor-id="transcriptomics-example">Transcriptomics Example</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb8-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidybulk)</span>
<span id="cb8-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidySummarizedExperiment)</span>
<span id="cb8-4"></span>
<span id="cb8-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">data</span>(airway, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">package =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"airway"</span>)</span>
<span id="cb8-6">airway <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">keep_abundant</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">factor_of_interest =</span> dex) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_abundance</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">test_differential_abundance</span>(<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> dex) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-10">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(abundant) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb8-11">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">desc</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">abs</span>(logFC)))</span></code></pre></div></div>
</div>
</section>
<section id="genomics-example" class="level3">
<h3 class="anchored" data-anchor-id="genomics-example">Genomics Example</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(plyranges)</span>
<span id="cb9-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb9-3"></span>
<span id="cb9-4">Example <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">workflow</span> (requires genomic data)</span>
<span id="cb9-5">granges <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(score <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">join_overlap_inner</span>(promoters) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-8">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">group_by</span>(gene_id) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb9-9">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summarize</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">mean_score =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mean</span>(score))</span></code></pre></div></div>
</div>
</section>
<section id="single-cell-example" class="level3">
<h3 class="anchored" data-anchor-id="single-cell-example">Single-Cell Example</h3>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidySingleCellExperiment)</span>
<span id="cb10-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">library</span>(tidyverse)</span>
<span id="cb10-3"></span>
<span id="cb10-4">sce <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb10-5">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">filter</span>(Phase <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"G1"</span>) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|&gt;</span></span>
<span id="cb10-6">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ggplot</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">aes</span>(UMAP_1, UMAP_2, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">color=</span>score)) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span id="cb10-7">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">geom_point</span>()</span></code></pre></div></div>
</div>
</section>
</section>
</section>
<section id="future-directions" class="level1">
<h1>Future Directions</h1>
<section id="planned-developments" class="level2">
<h2 class="anchored" data-anchor-id="planned-developments">Planned Developments</h2>
<ol type="1">
<li><strong>Enhanced Single-Cell Support</strong>: Expanded analysis capabilities for single-cell data</li>
<li><strong>Proteomics Integration</strong>: Support for proteomic data analysis</li>
<li><strong>Education</strong>: More comprehensive educational materials</li>
<li><strong>Reproducibility</strong>: Allow to track object manipulation history with <code>tidyomicslog</code></li>
</ol>
</section>
<section id="community-goals" class="level2">
<h2 class="anchored" data-anchor-id="community-goals">Community Goals</h2>
<ol type="1">
<li><strong>Increased Adoption</strong>: Broader adoption in the bioinformatics community</li>
<li><strong>Educational Integration</strong>: Integration into more university curricula</li>
<li><strong>Industry Applications</strong>: Adoption in pharmaceutical and biotech industries</li>
<li><strong>International Collaboration</strong>: Expansion of the global community</li>
</ol>
</section>
</section>
<section id="to-conclude.." class="level1">
<h1>To conclude..</h1>
<p>The tidyomics ecosystem represents a significant advancement in omics data analysis, providing a consistent, intuitive, and powerful framework for biological data analysis across multiple domains including transcriptomics and genomics. By bringing the principles of tidy data to omics, the ecosystem makes complex biological analyses more accessible, reproducible, and enjoyable.</p>
<p>Whether you’re a seasoned bioinformatician working with transcriptomics or genomics data, or just starting your journey in omics analysis, the tidyomics ecosystem provides the tools and resources you need to analyze your data effectively and efficiently.</p>
<p>The ecosystem continues to grow with new packages and capabilities being developed through the <a href="https://github.com/orgs/tidyomics/projects/1">tidyomics open challenges</a>, ensuring that the community drives the development of tools that meet real-world needs.</p>
<p>Join the community, contribute to the ecosystem, and help shape the future of tidy omics!</p>
<hr>
<p><em>For more information, visit the <a href="https://github.com/tidyomics">tidyomics GitHub organization</a> or follow us on <a href="https://community-bioc.zulipchat.com/#narrow/channel/507542-tidiness_in_bioc">Zulip</a>.</em></p>


</section>

<p>
© 2025 tidyomics. Content is published under <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons CC-BY-4.0 License</a> for the text and <a href="https://opensource.org/licenses/BSD-3-Clause">BSD 3-Clause License</a> for any code. | <a href="https://www.r-bloggers.com">R-Bloggers</a>
</p> ]]></description>
  <guid>https://tidyomics.github.io/tidyomicsBlog/posts/2025-10-10-introducing-tidyomics-ecosystem/</guid>
  <pubDate>Fri, 10 Oct 2025 00:00:00 GMT</pubDate>
</item>
</channel>
</rss>
