Commit a6a3feff authored by Ludovic Telley's avatar Ludovic Telley
Browse files

deep generative network

parent 72b9ecb5
Pipeline #36624 passed with stage
in 2 minutes and 10 seconds
This diff is collapsed.
---
title: "Basic Keras example"
author: "Panagiotis Papasaikas"
date: "2020-05-29"
output:
html_document:
css: styles.css
keep_md: true
toc: true
toc_depth: 2
toc_float: false
theme: sandstone
highlight: tango
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE, class.source = "rchunk"}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, eval = TRUE)
options(width = 80)
```
# Summary
Here we will illustrate how to install `keras` and the required **R** and **Python** package dependencies.
Next we will demonstrate the implementation of a simple Multilayer Perceptron (MLP) model with
both R and Python `keras` including **model definition**, **compilation** and **training**.
Finally we will quickly contrast the **sequential** vs the **functional** `keras` APIs for model definition.
# Keras installation in R
For extensive documentation on the R `keras` installation see:
["Install Keras and the TensorFlow backend"](https://tensorflow.rstudio.com/reference/keras/install_keras/)
!!! **Do not execute the following code. This is only for demontration purposes ** !!
```{r eval=FALSE}
install.packages("keras")
install_keras(method="conda", tensorflow="2.1.1") #
#installation with GPU support:
install_keras(method="conda", tensorflow="gpu") # OR
install_keras(method="conda", tensorflow="2.1.1-gpu")
# (NOTE: only do this if you have an NVIDIA GPU + CUDA!)
```
Note:
If you wish to add additional `PyPI` packages to your *Keras* / *TensorFlow* environment you can either specify the packages in the `extra_packages` argument of `install_keras()`, or alternatively install them into an existing environment using the `reticulate::py_install()` function, eg:
!!! **Do not execute the following code. This is only for demontration purposes ** !!
```{r eval=FALSE}
reticulate::py_install(c('pandas','numpy'))
```
# Mutilayer Percetron model for MNIST digit classification using the **R** `keras`
At this point all our **R** and `keras` package requirements are in place so we are ready to build a first `keras` model!
First we need to load the `keras` library:
```{r libload}
suppressPackageStartupMessages({
## check if Python is available and has already been initialized
#reticulate::py_available()
## dicsover Python that provides "keras"
#reticulate::py_discover_config(required_module = "keras")
## For setup on a renku environment:
reticulate::use_virtualenv("/opt/conda")
reticulate::py_config()
library(keras)
})
```
## Preparing the data:
![](/work/adv_scrnaseq_2020/adv_scrnaseq_2020/DGNs/figures/MNIST.png)
```{r MLP}
#loading the keras inbuilt mnist dataset
data<-dataset_mnist()
#separating train and test file
train_x<-data$train$x
train_y<-data$train$y
test_x<-data$test$x
test_y<-data$test$y
rm(data)
# flattening the 2D featuresinto 1D for feeding into the MLP and normalizing the matrix
train_x <- array(train_x, dim = c(dim(train_x)[1], prod(dim(train_x)[-1]))) / 255
test_x <- array(test_x, dim = c(dim(test_x)[1], prod(dim(test_x)[-1]))) / 255
#converting the target variable to one hot encoded vectors using keras inbuilt function
train_y <- to_categorical(train_y,10)
test_y <- to_categorical(test_y,10)
```
## Model definition
The sequential model is a linear stack of layers.
You create a sequential model by calling the `keras_model_sequential()` function and then a series of layer functions.
Each layer also needs to know what input shape it should expect. For this reason, the first layer in a sequential model (and only the first, because following layers can do automatic shape inference) needs to receive information about its input shape.
As illustrated in the example below, this is done by passing an input_shape argument to the first layer.
```{r}
#defining a keras sequential model
model <- keras_model_sequential()
#defining the model with 1 input layer[784 neurons], 1 hidden layer[784 neurons] with dropout rate 0.4 and 1 output layer [10 neurons]
#i.e digits from 0 to 9
model %>%
layer_dense(units = 784, input_shape = 784, activation = 'relu') %>%
layer_dropout(rate=0.4) %>%
layer_dense(units = 10,activation = 'softmax')
summary(model)
```
![](/work/adv_scrnaseq_2020/adv_scrnaseq_2020/DGNs/figures/MLP_model.png)
## Compilation
We are now going to compile the specified model. There are two required arguments that need to be specified
for model compilation: The **loss function** and the **optimizer**.
Whereas the *loss function* specifies our training objective the *optimizer* specifies the specific algorithmic machinery
During compilation we can also specify other (built-in or custom) function *metrics* we wish to keep track of during training.
```{r}
#compiling the defined model with metric 'accuracy' and optimiser 'adam'
model %>% compile(
loss = 'categorical_crossentropy',
optimizer = 'adam',
metrics = c('accuracy')
)
```
## Training
Training is typically done with the fit function. Fit has a few required arguments:
The (compiled) model to be trained, the training and target data.
Other important (optional) arguments for fit is the number of training epochs, the batch size a list of validation data as well as a list of callbacks (objects that perform different actions at various steps of training ).
We will familiarize ourselves with several of these `fit` arguments in the second, more extensive, exercise.
```{r}
#fitting the model on the training dataset
history <- model %>% fit(train_x, train_y, epochs = 50, batch_size = 3000, validation_data=list(test_x,test_y))
plot(history)
```
# Mutilayer Percetron model for MNIST digit classification using the **Python** `keras`
We now demonstrate the implementation of the exact same model in **Python** `keras`.
As you will see everything from model definition to compilation and training looks extremely similar.
```{python, class.source="pythonchunk"}
#importing the required libraries for the MLP model
import keras
from keras.models import Sequential
import numpy as np
#loading the MNIST dataset from keras
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
#reshaping the x_train, y_train, x_test and y_test to conform to MLP input and output dimensions
x_train=np.reshape(x_train,(x_train.shape[0],-1))/255
x_test=np.reshape(x_test,(x_test.shape[0],-1))/255
import pandas as pd
y_train=pd.get_dummies(y_train)
y_test=pd.get_dummies(y_test)
#performing one-hot encoding on target variables for train and test
y_train=np.array(y_train)
y_test=np.array(y_test)
#defining model with one input layer[784 neurons], 1 hidden layer[784 neurons] with dropout rate 0.4 and 1 output layer [10 #neurons]
model=Sequential()
from keras.layers import Dense
model.add(Dense(784, input_dim=784, activation='relu'))
model.add(keras.layers.core.Dropout(rate=0.4))
model.add(Dense(10,input_dim=784,activation='softmax'))
#compiling the defined model with metric 'accuracy' and optimiser 'adam'
model.compile(loss='categorical_crossentropy', optimizer="adam", metrics=['accuracy'])
# fitting model and performing validation
history=model.fit(x_train,y_train,epochs=50,batch_size=1024,validation_data=(x_test,y_test), verbose=0)
import matplotlib.pyplot as plt
# summarize history for accuracy
plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
# summarize history for loss
plt.clf()
plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='upper left')
plt.show()
```
Plotting the model:
```{python, class.source="pythonchunk", eval=FALSE}
import keras
import pydotplus
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pydot
keras.utils.plot_model(
model,
#to_file="DGNs/figures/MLP_model.png",
show_shapes=True,
show_layer_names=True,
rankdir="TB",
expand_nested=False,
dpi=96 )
```
# Functional API
The `Keras` functional API is a more flexible/modular way for mode definition which makes it more appropriate for more complex models with non-linear topology such as multi-input/output models or models with shared layers.
Remember that the three key objects of the `Keras`API (but also of the underlying backends such as `Tensorflow`) are *Tensors*, *Layers* and *Models* .
The main idea that a deep learning *model* is usually a directed acyclic graph (DAG) of *layers* connected by *tensor* edges.
The functional API is a more explicit way to construct this DAG by specifying the *layers* nodes of the graph that perform operations
on the *tensors* that "flow" through the graph's edges --> *Tensor*-*flow*! 😊.
This modular specification of the DAG design is exactly what makes it so flexible.
Let's see how we would define the previous MLP model using the Functional API:
```{r}
# input layer
inputs <- layer_input(shape = c(784))
#The inputs tensor that is returned contains information about the shape and dtype of the input data that you feed to your model. Here's the shape and dtype:
inputs
# We now create new nodes in the graph of layers by calling a layer on this inputs object:
predictions <- inputs %>%
layer_dense(units = 784, activation = 'relu') %>%
layer_dropout(rate=0.4) %>%
layer_dense(units = 10, activation = 'softmax')
# Until this point we have not instantiated a model. We have just specified a graph.
# Now we instantiate the model by specifying its inputs and outputs in the graph of layers
model_f <- keras_model(inputs = inputs, outputs = predictions)
summary(model_f)
```
With the functional API, it is easy to reuse trained models: you can treat any model as if it were a subgraph that you can reuse
as a building block of another model.
Note that you aren’t just reusing the architecture of the model, you are also reusing its weights.
# Useful links
**General tutorials and collection of examples models:**
- https://towardsdatascience.com/introduction-to-deep-learning-with-keras-17c09e4f0eb2
- https://keras.rstudio.com/articles/
- https://tensorflow.rstudio.com/guide/keras/examples/
**Articles on the functional API:**
- https://keras.io/guides/functional_api/
- https://keras.rstudio.com/articles/functional_api.html
- https://www.perfectlyrandom.org/2019/06/24/a-guide-to-keras-functional-api/
......@@ -42,6 +42,12 @@ Can you modify the code to read other sets of columns? Instead of reading the f
```{r, eval = FALSE}
## Insert your own code here
system.time(brain_data_subset <- h5read(file = "../data/on-disk-data//brain100k.h5", name = "/counts_matrix", index = list(NULL, 1:5)))
system.time(brain_data_subset <- h5read(file = "../data/on-disk-data//brain100k.h5", name = "/counts_matrix", index = list(NULL, 50001:50005)))
system.time(brain_data_subset <- h5read(file = "../data/on-disk-data//brain100k.h5", name = "/counts_matrix", index = list(NULL, 1:100)))
system.time(brain_data_subset <- h5read(file = "../data/on-disk-data//brain100k.h5", name = "/counts_matrix", index = list(NULL, 1:1000)))
system.time(brain_data_subset <- h5read(file = "../data/on-disk-data//brain100k.h5", name = "/counts_matrix", index = list(NULL, 10001:20000)))
```
Hopefully you found that it takes a very similar amount of time to read five consecutive columns from anywhere in the file. You should also notice that the time taken to read larger numbers of columns scales fairly linearly with the number of columns you want.
......@@ -92,7 +98,50 @@ Try creating other datasets with different chunk sizes. You can pick whatever y
```{r timing-chunks, results = "hold"}
h5createFile(file = "../data/on-disk-data/one_third_chunk.h5")
h5createDataset(file = "../data/on-disk-data/one_third_chunk.h5",
dataset = "one_third_chunk.h5",
dims = dim(brain_10k),
storage.mode = "integer",
chunk = c(nrow(brain_10k)/3, ncol(brain_10k)/3))
h5write(brain_10k, file = "../data/on-disk-data/one_third_chunk.h5", name = "one_third_chunk.h5")
h5createFile(file = "../data/on-disk-data/100_chunk.h5")
h5createDataset(file = "../data/on-disk-data/100_chunk.h5",
dataset = "100_chunk.h5",
dims = dim(brain_10k),
storage.mode = "integer",
chunk = c(100, 100))
h5write(brain_10k, file = "../data/on-disk-data/100_chunk.h5", name = "100_chunk.h5")
h5createFile(file = "../data/on-disk-data/1col_chunk.h5")
h5createDataset(file = "../data/on-disk-data/1col_chunk.h5",
dataset = "1col_chunk.h5",
dims = dim(brain_10k),
storage.mode = "integer",
chunk = c(nrow(brain_10k), 1))
h5write(brain_10k, file = "../data/on-disk-data/1col_chunk.h5", name = "1col_chunk.h5")
h5createFile(file = "../data/on-disk-data/1row_chunk.h5")
h5createDataset(file = "../data/on-disk-data/1row_chunk.h5",
dataset = "1row_chunk.h5",
dims = dim(brain_10k),
storage.mode = "integer",
chunk = c(1, ncol(brain_10k)))
h5write(brain_10k, file = "../data/on-disk-data/1row_chunk.h5", name = "1row_chunk.h5")
system.time( h5read(file = "../data/on-disk-data/one_chunk.h5", name = "/one_chunk", index = list(NULL, 1:5)) )
system.time( h5read(file = "../data/on-disk-data/one_third_chunk.h5", name = "/one_third_chunk.h5", index = list(NULL, 1:5)) )
system.time( h5read(file = "../data/on-disk-data/100_chunk.h5", name = "/100_chunk.h5", index = list(NULL, 1:5)) )
system.time( h5read(file = "../data/on-disk-data/1col_chunk.h5", name = "/1col_chunk.h5", index = list(NULL, 1:5)) )
system.time( h5read(file = "../data/on-disk-data/1row_chunk.h5", name = "/1row_chunk.h5", index = list(NULL, 1:5)) )
```
......
......@@ -14,6 +14,7 @@
<title>Introducing HDF5 files</title>
<script src="site_libs/header-attrs-2.1/header-attrs.js"></script>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
......@@ -25,19 +26,18 @@
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css" data-origin="pandoc">
code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
......@@ -57,7 +57,7 @@ pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-le
div.sourceCode
{ background-color: #f8f8f8; }
@media screen {
code.sourceCode > span > a:first-child::before { text-decoration: underline; }
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ef2929; } /* Alert */
code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */
......@@ -375,7 +375,8 @@ $(document).ready(function () {
<div id="TOC">
<ul>
<li><a href="#using-the-rhdf5-package">Using the rhdf5 package</a><ul>
<li><a href="#using-the-rhdf5-package">Using the rhdf5 package</a>
<ul>
<li><a href="#exploring-an-hdf5-file">Exploring an HDF5 file</a></li>
<li><a href="#reading-from-hdf5-files">Reading from HDF5 files</a></li>
<li><a href="#writing-to-hdf5-files">Writing to HDF5 files</a></li>
......@@ -389,10 +390,8 @@ $(document).ready(function () {
<h1>Using the rhdf5 package</h1>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="kw">library</span>(rhdf5)</span></code></pre></div>
<div class="figure">
<img src="images/hdf5_structure.jpg" alt="Example HDF5 file structure" width="693" />
<p class="caption">
Example HDF5 file structure
</p>
<img src="images/hdf5_structure.jpg" alt="" />
<p class="caption">Example HDF5 file structure</p>
</div>
<div id="exploring-an-hdf5-file" class="section level2">
<h2>Exploring an HDF5 file</h2>
......@@ -420,7 +419,7 @@ Example HDF5 file structure
<p>This list is quite large and isn’t going to be used again in this tutorial, so I recommend removing it from your R session so you do not run out of RAM.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a><span class="kw">rm</span>(pbmc8k_list)</span></code></pre></div>
<p>Sometimes you don’t want to read the entire file, just a particular dataset. <strong>rhdf5</strong> includes the function <code>h5read()</code>, which requires a file path and the <code>name</code> argument to identify the dataset you want within the hierarchy.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a>pbmc8k_data &lt;-<span class="st"> </span><span class="kw">h5read</span>(<span class="dt">file =</span> <span class="st">&#39;../data/pbmc8k_raw_gene_bc_matrices_h5.h5&#39;</span>, <span class="dt">name =</span> <span class="st">&quot;/GRCh38/data&quot;</span>)</span></code></pre></div>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a>pbmc8k_data &lt;-<span class="st"> </span><span class="kw">h5read</span>(<span class="dt">file =</span> <span class="st">&#39;../data/on-disk-data/pbmc8k_raw_gene_bc_matrices_h5.h5&#39;</span>, <span class="dt">name =</span> <span class="st">&quot;/GRCh38/data&quot;</span>)</span></code></pre></div>
</div>
<div id="writing-to-hdf5-files" class="section level2">
<h2>Writing to HDF5 files</h2>
......@@ -444,15 +443,7 @@ Example HDF5 file structure
<span id="cb10-2"><a href="#cb10-2"></a>ex_matrix &lt;-<span class="st"> </span><span class="kw">matrix</span>(<span class="dv">1</span><span class="op">:</span><span class="dv">100</span>, <span class="dt">nrow =</span> <span class="dv">5</span>, <span class="dt">ncol =</span> <span class="dv">20</span>)</span>
<span id="cb10-3"><a href="#cb10-3"></a><span class="kw">h5write</span>(<span class="dt">obj =</span> ex_matrix, <span class="dt">file =</span> <span class="st">&quot;../data/on-disk-data/my_hdf5.h5&quot;</span>, <span class="dt">name =</span> <span class="st">&quot;example_matrix&quot;</span>)</span></code></pre></div>
<pre><code>## Error in H5Dwrite(h5dataset, obj, h5spaceMem = h5spaceMem, h5spaceFile = h5spaceFile) :
## libhdf5
## error #000: H5Dio.c in H5Dwrite(): line 336
## class: HDF5
## major: Dataset
## minor: Write failed
## error #001: H5Dio.c in H5D__write(): line 722
## class: HDF5
## major: Invalid arguments to routine
## minor: Bad value</code></pre>
## HDF5. Dataset. Write failed.</code></pre>
<p>If you need to remove a group or dataset from an HDF5 file you can use <code>h5delete()</code>. Here we verify that removing a dataset means that it no longer shows up when we list the contents, and the file size has been reduced by the removal.</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1"></a><span class="kw">file.size</span>(<span class="st">&quot;../data/on-disk-data/my_hdf5.h5&quot;</span>)</span></code></pre></div>
<pre><code>## [1] 4048</code></pre>
......@@ -466,72 +457,72 @@ Example HDF5 file structure
<div id="reading-attributes" class="section level2">
<h2>Reading attributes</h2>
<p>Sometimes important meta-data is stored in attributes associated with groups or datasets. We can use the <code>all = TRUE</code> option in <code>h5ls()</code> to list the number of attributes (along with other data), and <code>h5readAttributes()</code> to extract these in a similar fashion to before.</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1"></a><span class="kw">h5ls</span>(<span class="st">&quot;../data/adv_scrnaseq_2020/data/spermatogenesis_rnavelocity/AdultMouseRep3_alevin_GRCm38.gencode.vM21.spliced.intron.fl90.gentrome.k31_sce_nometa.h5ad&quot;</span>, <span class="dt">all =</span> <span class="ot">TRUE</span>)</span></code></pre></div>
<pre><code>## group name ltype corder_valid corder cset otype num_attrs dclass dtype
## 0 / X H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 3
## 1 /X data H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F32LE
## 2 /X indices H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 3 /X indptr H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 4 / layers H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 0
## 5 /layers logcounts H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 3
## 6 /layers/logcounts data H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 7 /layers/logcounts indices H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 8 /layers/logcounts indptr H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 9 /layers spliced H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 3
## 10 /layers/spliced data H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 11 /layers/spliced indices H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 12 /layers/spliced indptr H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 13 /layers unspliced H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 3
## 14 /layers/unspliced data H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 15 /layers/unspliced indices H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 16 /layers/unspliced indptr H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 INTEGER H5T_STD_I32LE
## 17 / obs H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 4
## 18 /obs __categories H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 0
## 19 /obs/__categories celltype H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 1 STRING H5T_STRING
## 20 /obs/__categories cluster H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 1 STRING H5T_STRING
## 21 /obs _index H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 STRING H5T_STRING
## 22 /obs celltype H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 1 INTEGER H5T_STD_I8LE
## 23 /obs cluster H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 1 INTEGER H5T_STD_I8LE
## 24 /obs sizeFactor H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 25 / obsm H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 0
## 26 /obsm X_pca H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 27 /obsm X_tsne H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 28 /obsm X_umap H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 FLOAT H5T_IEEE_F64LE
## 29 / var H5L_TYPE_HARD FALSE 0 0 H5I_GROUP 4
## 30 /var _index H5L_TYPE_HARD FALSE 0 0 H5I_DATASET 0 STRING H5T_STRING
## stype rank dim maxdim
## 0 0
## 1 SIMPLE 1 8391896 UNLIMITED
## 2 SIMPLE 1 8391896 UNLIMITED
## 3 SIMPLE 1 1848 UNLIMITED
## 4 0
## 5 0
## 6 SIMPLE 1 8391896 UNLIMITED
## 7 SIMPLE 1 8391896 UNLIMITED
## 8 SIMPLE 1 1848 UNLIMITED
## 9 0
## 10 SIMPLE 1 8237108 UNLIMITED
## 11 SIMPLE 1 8237108 UNLIMITED
## 12 SIMPLE 1 1848 UNLIMITED
## 13 0
## 14 SIMPLE 1 1825380 UNLIMITED
## 15 SIMPLE 1 1825380 UNLIMITED
## 16 SIMPLE 1 1848 UNLIMITED
## 17 0
## 18 0
## 19 SIMPLE 1 4 4
## 20 SIMPLE 1 8 8
## 21 SIMPLE 1 1847 1847
## 22 SIMPLE 1 1847 1847
## 23 SIMPLE 1 1847 1847
## 24 SIMPLE 1 1847 1847
## 25 0
## 26 SIMPLE 2 30 x 1847 30 x 1847
## 27 SIMPLE 2 2 x 1847 2 x 1847
## 28 SIMPLE 2 2 x 1847 2 x 1847
## 29 0
## 30 SIMPLE 1 54357 54357</code></pre>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1"></a><span class="kw">h5readAttributes</span>(<span class="dt">file =</span> <span class="st">&quot;../data/adv_scrnaseq_2020/data/spermatogenesis_rnavelocity/AdultMouseRep3_alevin_GRCm38.gencode.vM21.spliced.intron.fl90.gentrome.k31_sce_nometa.h5ad&quot;</span>, <span class="dt">name =</span> <span class="st">&quot;X&quot;</span>)</span></code></pre></div>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="#cb18-1"></a><span class="kw">h5ls</span>(<span class="st">&quot;../data/spermatogenesis_rnavelocity/AdultMouseRep3_alevin_GRCm38.gencode.vM21.spliced.intron.fl90.gentrome.k31_sce_nometa.h5ad&quot;</span>, <span class="dt">all =</span> <span class="ot">TRUE</span>)</span></code></pre></div>
<pre><code>## group name ltype corder_valid corder cset
## 0 / X H5L_TYPE_HARD FALSE 0 0
## 1 /X data H5L_TYPE_HARD FALSE 0 0
## 2 /X indices H5L_TYPE_HARD FALSE 0 0
## 3 /X indptr H5L_TYPE_HARD FALSE 0 0
## 4 / layers H5L_TYPE_HARD FALSE 0 0
## 5 /layers logcounts H5L_TYPE_HARD FALSE 0 0
## 6 /layers/logcounts data H5L_TYPE_HARD FALSE 0 0
## 7 /layers/logcounts indices H5L_TYPE_HARD FALSE 0 0
## 8 /layers/logcounts indptr H5L_TYPE_HARD FALSE 0 0
## 9 /layers spliced H5L_TYPE_HARD FALSE 0 0
## 10 /layers/spliced data H5L_TYPE_HARD FALSE 0 0
## 11 /layers/spliced indices H5L_TYPE_HARD FALSE 0 0
## 12 /layers/spliced indptr H5L_TYPE_HARD FALSE 0 0
## 13 /layers unspliced H5L_TYPE_HARD FALSE 0 0
## 14 /layers/unspliced data H5L_TYPE_HARD FALSE 0 0
## 15 /layers/unspliced indices H5L_TYPE_HARD FALSE 0 0
## 16 /layers/unspliced indptr H5L_TYPE_HARD FALSE 0 0
## 17 / obs H5L_TYPE_HARD FALSE 0 0
## 18 /obs __categories H5L_TYPE_HARD FALSE 0 0
## 19 /obs/__categories celltype H5L_TYPE_HARD FALSE 0 0
## 20 /obs/__categories cluster H5L_TYPE_HARD FALSE 0 0
## 21 /obs _index H5L_TYPE_HARD FALSE 0 0
## 22 /obs celltype H5L_TYPE_HARD FALSE 0 0
## 23 /obs cluster H5L_TYPE_HARD FALSE 0 0
## 24 /obs sizeFactor H5L_TYPE_HARD FALSE 0 0
## 25 / obsm H5L_TYPE_HARD FALSE 0 0
## 26 /obsm X_pca H5L_TYPE_HARD FALSE 0 0
## 27 /obsm X_tsne H5L_TYPE_HARD FALSE 0 0
## 28 /obsm X_umap H5L_TYPE_HARD FALSE 0 0
## 29 / var H5L_TYPE_HARD FALSE 0 0
## 30 /var _index H5L_TYPE_HARD FALSE 0 0