<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Convert h5Seurat files to H5AD files — H5SeuratToH5AD • SeuratDisk</title>


<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />


<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>

<!-- bootstrap-toc -->
<link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script>

<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />

<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>

<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>

<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>




<meta property="og:title" content="Convert h5Seurat files to H5AD files — H5SeuratToH5AD" />
<meta property="og:description" content="Convert h5Seurat files to H5AD files" />




<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>

<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->



  </head>

  <body data-spy="scroll" data-target="#toc">
    <div class="container template-reference-topic">
      <header>
      <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">SeuratDisk</a>
        <span class="version label label-danger" data-toggle="tooltip" data-placement="bottom" title="Unreleased version">0.0.0.9011</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li>
  <a href="../index.html">
    <span class="fas fa fas fa-home fa-lg"></span>
     
  </a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
    <li>
      <a href="../articles/convert-anndata.html">Conversions: h5Seurat and AnnData</a>
    </li>
    <li>
      <a href="../articles/h5Seurat-load.html">Saving and Loading Data from an h5Seurat File</a>
    </li>
    <li>
      <a href="../articles/h5Seurat-spec.html">h5Seurat File Format Specification</a>
    </li>
  </ul>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/mojaveazure/seurat-disk/">
    <span class="fab fa fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
      
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      

      </header>

<div class="row">
  <div class="col-md-9 contents">
    <div class="page-header">
    <h1>Convert h5Seurat files to H5AD files</h1>
    <small class="dont-index">Source: <a href='https://github.com/mojaveazure/seurat-disk/blob/master/R/Convert.R'><code>R/Convert.R</code></a></small>
    <div class="hidden name"><code>H5SeuratToH5AD.Rd</code></div>
    </div>

    <div class="ref-description">
    <p>Convert h5Seurat files to H5AD files</p>
    </div>

    <pre class="usage"><span class='fu'>H5SeuratToH5AD</span>(
  <span class='no'>source</span>,
  <span class='no'>dest</span>,
  <span class='kw'>assay</span> <span class='kw'>=</span> <span class='fu'><a href='h5Seurat-bindings.html'>DefaultAssay</a></span>(<span class='kw'>object</span> <span class='kw'>=</span> <span class='no'>source</span>),
  <span class='kw'>overwrite</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>,
  <span class='kw'>verbose</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>
)</pre>

    <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
    <table class="ref-arguments">
    <colgroup><col class="name" /><col class="desc" /></colgroup>
    <tr>
      <th>source</th>
      <td><p>Source dataset</p></td>
    </tr>
    <tr>
      <th>dest</th>
      <td><p>Name of destination dataset</p></td>
    </tr>
    <tr>
      <th>assay</th>
      <td><p>Converting from <code><a href='h5Seurat-class.html'>h5Seurat</a></code>: name of assay to write
out; converting to <code><a href='h5Seurat-class.html'>h5Seurat</a></code>: name to store assay data as</p></td>
    </tr>
    <tr>
      <th>overwrite</th>
      <td><p>Overwrite existing <code>dest</code></p></td>
    </tr>
    <tr>
      <th>verbose</th>
      <td><p>Show progress updates</p></td>
    </tr>
    </table>

    <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>

    <p>Returns a handle to <code>dest</code> as an <code><a href='http://hhoeflin.github.io/hdf5r/reference/H5File-class.html'>H5File</a></code>
object</p>
    <h2 class="hasAnchor" id="h-seurat-to-anndata-h-ad"><a class="anchor" href="#h-seurat-to-anndata-h-ad"></a>h5Seurat to AnnData/H5AD</h2>

    

<p>The h5Seurat to AnnData/H5AD conversion will try to automatically fill in
datasets based on data presence. Data presense is determined by the h5Seurat
index (<code>source$index()</code>). It works in the following manner:</p><h3>Assay data</h3>
<p></p><ul>
<li><p><code>X</code> will be filled with <code>scale.data</code> if <code>scale.data</code>
  is present; otherwise, it will be filled with <code>data</code></p></li>
<li><p><code>var</code> will be filled with <code>meta.features</code> <strong>only</strong> for
  the features present in <code>X</code>; for example, if <code>X</code> is filled with
  <code>scale.data</code>, then <code>var</code> will contain only features that have
  been scaled</p></li>
<li><p><code>raw.X</code> will be filled with <code>data</code> if <code>X</code> is filled
  with <code>scale.data</code>; otherwise, it will be filled with <code>counts</code>. If
  <code>counts</code> is not present, then <code>raw</code> will not be filled</p></li>
<li><p><code>raw.var</code> will be filled with <code>meta.features</code> with the
  features present in <code>raw.X</code>; if <code>raw.X</code> is not filled, then
  <code>raw.var</code> will not be filled</p></li>
</ul>

<h3>Cell-level metadata</h3>
<p>Cell-level metadata is added to <code>obs</code></p>
<h3>Dimensional reduction information</h3>
<p>Only dimensional reductions associated with <code>assay</code> or marked as
 <a href='https://rdrr.io/pkg/Seurat/man/IsGlobal.html'>global</a> will be transfered to the H5AD file. For
 every reduction <code>reduc</code>:</p><ul>
<li><p>cell embeddings are placed in <code>obsm</code> and renamed to
  <code>X_reduc</code></p></li>
<li><p>feature loadings, if present, are placed in <code>varm</code> and renamed
  to either &#8220;PCs&#8221; if <code>reduc</code> is &#8220;pca&#8221; otherwise
  <code>reduc</code> in all caps</p></li>
</ul><p>For example, if <code>reduc</code> is &#8220;ica&#8221;, then cell embeddings will be
 &#8220;X_ica&#8221; in <code>obsm</code> and feature loaodings, if present, will be
 &#8220;ICA&#8221; in <code>varm</code></p>
<h3>Nearest-neighbor graphs</h3>
<p>If a nearest-neighbor graph is associated with <code>assay</code>, it will be
 added to <code>uns/neighbors/distances</code>; if more than one graph is present,
 then <strong>only</strong> the last graph according to the index will be added.</p>
<h3>Layers</h3>
<p>Data from other assays can be added to <code>layers</code> if they have the same
 shape as <code>X</code> (same number of cells and features). To determine this,
 the shape of each alternate assays's <code>scale.data</code> and <code>data</code> slots
 are determined. If they are the same shape as <code>X</code>, then that slot
 (<code>scale.data</code> is given priority over <code>data</code>) will be added as a
 layer named the name of the assay (eg. &#8220;SCT&#8221;). In addition, the
 features names will be added to <code>var</code> as <code>assay_features</code>
 (eg. &#8220;SCT_features&#8221;).</p>


  </div>
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <nav id="toc" data-toggle="toc" class="sticky-top">
      <h2 data-toc-skip>Contents</h2>
    </nav>
  </div>
</div>


      <footer>
      <div class="copyright">
  <p>Developed by Paul Hoffman.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p>
</div>

      </footer>
   </div>

  


  </body>
</html>


