Skip to content
naulon

No retraction, correction or concern found when last checked on Oct 22, 2026.

Interpretable factor models of single-cell RNA-seq via variational autoencoders

Valentine Svensson, Adam Gayoso, Nir Yosef and 1 more

Bioinformatics · 2020 · CC BY

doi:10.1093/bioinformatics/btaa169

Abstract

Motivation. Single-cell RNA-seq makes possible the investigation of variability in gene expression among cells, and dependence of variation on cell type. Statistical inference methods for such analyses must be scalable, and ideally interpretable.

Results. We present an approach based on a modification of a recently published highly scalable variational autoencoder framework that provides interpretability without sacrificing much accuracy. We demonstrate that our approach enables identification of gene programs in massive datasets. Our strategy, namely the learning of factor models with the auto-encoding variational Bayes framework, is not domain specific and may be useful for other applications.

Availability and implementation. The factor model is available in the scVI package hosted at https://github.com/YosefLab/scVI/.

Contact. v@nxn.se

Supplementary information. Supplementary data are available at Bioinformatics online.

Full text

From PubMed Central, U.S. National Library of Medicine, as current on Oct 22, 2026. Paragraph numbers are ours, so an answer can point at one.

1 Introduction

The study of the regulatory architecture of cells has revealed numerous examples of co-regulation of transcription of large numbers of genes, and this has been used to link the organization of cells to their distinct functions in response to developmental or external stimuli. While studies of cells in bulk have led to interesting population-level insights about the relationships between genes, the study of individual cells via single-cell RNA-seq has led to questions about the dependence of relationships between genes on cell type.

Principal component analysis (PCA) is a popular linear method for dimensionality reduction in single-cell RNA-seq. As a result of its efficiency, PCA has been used for exploratory data analysis to visualize the structure of high-dimensional data in two or three dimensions. PCA also provides a linear model of the data; a key feature of the method that can be used for prediction. In the case of single-cell RNA-seq, datapoints correspond to cells and the coordinates of each cell represent the gene expression levels for each gene in the transcriptome. Thus, PCA can be used to study structured variation between cells by revealing differences along axes of greatest variation. In PCA, linear weight parameters (loadings) are used to predict gene expression in each cell, conditional on the latent variables (coordinates) per cell. The loadings corresponding to the principal component axes can be interpreted as ‘meta-genes’: sets of genes which tend to be expressed together. Thus, PCA of gene expression provides a formal mathematical framework for studying the biological idea of ‘gene programs’ by simultaneously explaining structured variation between cells and genes.

While PCA is easy to use and is often applied to single-cell RNA-seq data, the method has some drawbacks. PCA models data as arising from a continuous multivariate Gaussian distribution, and thus optimizes a Gaussian likelihood. This model assumption is at odds with the count data measured in single-cell RNA-seq, and leads to interpretation problems. To address this issue, a number of methods define factor methods tailored to single-cell transcriptomics data. For example, ZINB-WaVE defines a linear factor model where gene weights are parameters, cell factor values are latent variables and data arise from a zero-inflated negative binomial distribution. However, as single-cell transcriptomics datasets have grown in size to hundreds of thousands of observations, efficiency and scalability considerations have become paramount and inference with parametric models can be intractable. To address scalability requirements, new methods based on variational autoencoders have been developed; these leverage the large amounts of available data to learn non-linear maps, and crucially scale well thanks to efficient algorithms for inference that leverage the structure of autoencoders.

Autoencoders consist of a pair of functions: a representation function and a reconstruction function, which are typically parameterized as neural networks. The two autoencoder functions can be seen as a non-linear generalization of the two projections associated with PCA. By optimizing the pair of neural networks, efficient low-dimensional representations of data can be identified. A variational autoencoder (VAE) uses a similar strategy but with latent variable models. Each datapoint is represented by a set of latent variables which can be decoded by neural networks to produce parameters for a probability distribution, thus defining a generative model. To infer the latent variable values (the representation), a neural network is used to find per-datapoint parameters for a probability distribution in the representation space. This defines an ‘inference model’ which attempts to approximate the posterior distribution of the latent variables given the observed data with a variational distribution.

Inference using VAEs scales to arbitrarily large data since mini-batches of data can be used to train the parameters for both the inference model and the decoder function. However despite these efficiency advantages, the representations inferred with VAEs are not directly interpretable. While efforts have been made to develop interpretable VAE’s, the difficulty in interpreting VAE representations continues to be a major drawback of VAE’s. We show that using a flexible non-linear inference model along with a linear reconstruction function makes it possible to benefit from the efficiency of VAEs, while retaining the interpretability provided by factor models. Specifically, by adapting the method of scVI, we demonstrate a scalable approach to learning a latent representation of single-cell RNA-seq data, that identifies the relationship between cell representation coordinates and gene weights via a factor model. Our approach results in a tradeoff: whereas typically autoencoder models are designed with the same network topology in the inference functions and the reconstruction functions, what we propose is a restricted reconstruction function that leads to an increase in reconstruction error. However, by virtue of being linear, our reconstruction function provides an interpretable link between gene programs and cellular molecular phenotypes (Fig. 1a).

2 Materials and methods

The generative model of scVI, when data are from a single batch and zero-inflation is deactivated, is

In this model, is a random variable for the exposure or count depth of a cell, with priors and. The random variable provides a -dimensional representation of cells. The parameter represents the overdispersion of a gene, and the Gamma is parameterized by its shape and mean. We replace the neural network with a linear function:

This way the expression level of a gene in a cell is affected by the weights depending on the coordinate of a cell, giving a direct link between cell representation and gene expression.

We also considered a variation of this model where the latent variables are distributed as a logistic normal (ln) distribution. In this case, each has positive values and sums to, making it similar to semi-non-negative matrix factorization. Such a model adds a further layer of interpretability; the cells are embedded in a simplex, where the nodes of the simplex represent archetypal cell types. In addition, we investigated the effect of applying a batch-norm transformation of the linearly decoded parameters.

3 Results

To explore the potential for interpretability in the VAE framework, we implemented a linearly decoded variational autoencoder (LDVAE) in scVI. The model was applied to two datasets of single-cell RNA-sequencing from a large number of developing mouse embryos in different stages of development. The first dataset consists of 125 775 cells from 411 mouse embryos undergoing gastrulation measured using the commercial 10× Genomics platform and sequenced relatively deeply (11% non-zero values).

A comparison of the VAE with the LDVAE methods showed that VAE indeed has a smaller reconstruction error than the LDVAE methods (Fig. 1b). Among the LDVAE method variants, using a normal latent distribution and batch norm has the smaller reconstruction error (on held-out data). Between the LDVAE models with ln distributed latent space, the comparison was inconclusive for the ) data, but batch norm performed better for the ) data (Supplementary Fig. S1). With either VAE or LDVAE, the representation can be used to learn which cells are similar to each other and can be used for clustering. For example, erythroid cells, extraembryonic endoderm cells and epiblast cells annotated by the original authors can be separated by factors and. However, the axes of representation learned by the LDVAE model can be directly related to axes of co-expressed genes (Fig. 1c). For example, variation along the axis is related to simultaneous variation in expression of Pou5f1 and Tdgf1, two genes important for epiblast development. Variation along the axis is related to co-variation in beta globin (Hbb) genes which are key components of erythroid cells. Additionally, variation between epiblast and erythroid cells along is orthogonal to variation between epiblast and extraembryonic endoderm cells along, two independent lineages in embryonic development.

While the ln latent distribution results in higher reconstruction error than the normal distribution, it has benefits for interpretation. Since a factor is restricted to non-negative values, genes with negative weights can only decrease in expression as a function of. This way cells using a particular regulatory program can more effectively be grouped to specific factors (Supplementary Fig. S2). We also found that using batch-norm transformation improved model performance.

The learned representations from the different models can be compared by investigating the covariance matrix (where is a centered and scaled version of ). This illustrates that LDVAE learns representations with fewer covarying factors (Supplementary Fig. S3). Unlike linear methods, the VAE is not constrained by covarying factors since the non-linear neural network can produce vastly different gene expressions along a linear path in the representation. Comparing the proposed alternative LDVAE models, using a normal latent distribution induces less correlation between factors. By performing eigen decomposition on a covariance matrix the proportion of variance explained by each factor can be quantified. This allows ordering of factors which can be used to identify the regulatory programs with the most variation across the dataset. It also illustrates the simplicial structure of ln distributed latent variables since one factor is always linearly dependent on the other factors (Supplementary Fig. S3).

The second dataset consists of 1 949 131 cells from 61 embryos in total using the sci-RNA-seq method at shallow sequencing (2% non-zero values). This dataset is, to our knowledge, the largest scRNA-seq study published to date. To illustrate the scalability of our model, we fit a 10-dimensional LDVAE to the data which allows identification of cells similar to each other and for the determination of covarying genes (Supplementary Fig. S4).

Cells were also subsampled to different numbers before fitting LDVAE models. We found that inference runs in linear time, with 5 s per 1000 cells to reach 10 epochs using a CPU (Intel Core i7-7800X). Using a consumer-grade GPU (NVIDIA GeForce RTX 2070), inference only requires 2 s per 1000 cells to reach 10 epochs, with a total time of less than an hour for the full dataset. The inference times did not depend on the sparsity of the data, as the neural architecture is fixed, and operations are invariant to observed values (Supplementary Fig. 5a). Investigating the reconstruction error curves per epoch, the models converged after 2–3 epochs for datasets larger than 100 000 cells (Supplementary Fig. 5b). Determining a minimal number of epochs is a difficult general problem, but our results suggest a rule of thumb of ‘1 million divided by the number of cells in the dataset’ epochs for first pass analysis.

Jupyter notebooks to produce the results are available at https://github.com/pachterlab/SGYP_2019 as well as Figshare at https://doi.org/10.6084/m9.figshare.11725920.v1. For convenience, the embryo data from ) and ) are also available in an H5AD object on the Figshare accession and on Google Cloud Storage at gs://h5ad/2019-02-Pijuan-Sala-et-al-Nature/pijuan_sala_atlas.h5ad and gs://h5ad/2019-02-Cao-et-al-Nature/cao_atlas.h5ad. A general tutorial on how to use the LDVAE model is available in the scVI Github repository at https://github.com/YosefLab/scVI/blob/master/tests/notebooks/linear_decoder.ipynb.

4 Discussion

Our results show that interpretable non-Gaussian factor models can be linked to variational autoencoders to enable interpretable, efficient and multivariate analysis of large datasets. This is useful for the investigation of gene co-expression in large scRNA-seq datasets, and the approach we have outlined should be applicable in other settings where interpretability is paramount.

References 38

  1. 1.

    Ainsworth S. et al (2018 ) oi-VAE: Output interpretable VAEs for nonlinear group factor analysis. In: Proceedings of the 35th International Conference on Machine Learning, PLMR, Vol. 80, pp. 119–128.

    Not in our library

  2. 2.

    Andrews T.S., Hemberg M (2017 ) Identifying cell populations with scRNASeq. Mol. Aspects Med, 59, 114–122.

    Not in our library10.1016/j.mam.2017.07.002

  3. 3.

    Bianco C. et al (2002 ) Cripto-1 activates Nodal- and ALK4-dependent and -independent signaling pathways in mammary epithelial cells. Mol. Cell. Biol., 22, 2586–2597.

    Not in our library10.1128/mcb.22.8.2586-2597.2002

  4. 4.

    Brunet J.-P. et al (2004 ) Metagenes and molecular pattern discovery using matrix factorization. Proc. Natl. Acad. Sci. USA, 101, 4164–4169.

    Not in our library10.1073/pnas.0308531101

  5. 5.

    Buettner F. et al (2017 ) F-scLVM: scalable and versatile factor analysis for single-cell RNA-Seq. Genome Biol., 18, 212.

    Not in our library10.1186/s13059-017-1334-8

  6. 6.

    Cao J. et al (2019 ) The single-cell transcriptional landscape of mammalian organogenesis. Nature, 566, 496–502.

    Not in our library10.1038/s41586-019-0969-x

  7. 7.

    Durif G. et al (2019 ) Probabilistic count matrix factorization for single cell expression data analysis. Bioinformatics, 35, 4011–4019.

    Not in our library10.1093/bioinformatics/btz177

  8. 8.
  9. 9.

    Guo G. et al (2010 ) Resolution of cell fate decisions revealed by single-cell gene expression analysis from Zygote to blastocyst. Dev. Cell, 18, 675–685.

    Not in our library10.1016/j.devcel.2010.02.012

  10. 10.

    Hicks S.C. et al (2018 ) Missing data and technical variability in single-cell RNA-sequencing experiments. Biostatistics, 19, 562–578.

    Not in our library10.1093/biostatistics/kxx053

  11. 11.

    Hinton G.E., Zemel R.S. (1993 ) Autoencoders, minimum description length and Helmholtz free energy In: Proceedings of the 6th international Conference on Neural Informationa Processing Systems, pp. 3–10. Cowan J.D. et al (eds.) Advances in Neural Information Processing Systems 6. Morgan-Kaufmann, pp. 3–10.

    Not in our library

  12. 12.

    Ioffe S., Szegedy C. (2015 ) Batch normalization: accelerating deep network training by reducing internal covariate shift. In: Proceedings of the 32nd International Conference on Machine Learning, vol. 37, 448–456.

    Not in our library

  13. 13.

    Islam S. et al (2011 ) Characterization of the single-cell transcriptional landscape by highly multiplex RNA-seq. Genome Res., 21, 1160–1167.

    Not in our library10.1101/gr.110882.110

  14. 14.
  15. 15.

    Kingma D.P., Welling M. (2013 ). Auto-encoding variational bayes. arXiv [stat.ML]. arXiv.

    Not in our library

  16. 16.

    Kondo Y. et al (2018 ) Transcriptional regulation of CD 4+ T cell differentiation in experimentally induced arthritis and rheumatoid arthritis. Arthrit. Rheumatol., 70, 653–661.

    Not in our library10.1002/art.40398

  17. 17.

    Korem Y. et al (2015 ) Geometry of the gene expression space of individual cells. PLoS Comput. Biol., 11, e1004224.

    Not in our library10.1371/journal.pcbi.1004224

  18. 18.

    Levitin H.M. et al (2019 ) De Novo gene signature identification from single-cell RNA-seq with hierarchical Poisson factorization. Mol. Syst. Biol., 15, e8557.

    Not in our library10.15252/msb.20188557

  19. 19.

    Lindgren D. et al (2017 ) Cell-type-specific gene programs of the normal human nephron define kidney cancer subtypes. Cell Rep., 20, 1476–1489.

    Not in our library10.1016/j.celrep.2017.07.043

  20. 20.

    Lopez R. et al (2018 ) Deep generative modeling for single-cell transcriptomics. Nat. Methods, 15, 1053–1058.

    Not in our library10.1038/s41592-018-0229-2

  21. 21.

    Marino J. et al (2018 ) Iterative amortized inference. In: Proceedings of the 35th International Conference on Machine Learning, PLMR, vol. 80, pp. 3403–3412.

    Not in our library

  22. 22.

    Pearson K. (1901 ) Principal components analysis. London Edinburgh Dublin Philos. Mag. J., 6, 566.

    Not in our library

  23. 23.
  24. 24.

    Pijuan-Sala B. et al (2019 ) A single-cell molecular map of mouse gastrulation and early organogenesis. Nature, 566, 490–495.

    Not in our library10.1038/s41586-019-0933-9

  25. 25.

    Plaut E. (2018 ) From principal subspaces to principal components with linear autoencoders. arXiv [stat.ML]. arXiv.

    Not in our library

  26. 26.

    Raychaudhuri S. et al (2000 ) Principal components analysis to summarize microarray experiments: application to sporulation time series. In: Pacific Symposium on Biocomputing, pp. 455–466.

    Not in our library10.1142/9789814447331_0043

  27. 27.
  28. 28.

    Romero I.G. et al (2012 ) Comparative studies of gene expression and the evolution of gene regulation. Nat. Rev. Genet., 13, 505–516.

    Not in our library10.1038/nrg3229

  29. 29.

    Rostom R. et al (2017 ) Computational approaches for interpreting scRNA-Seq data. FEBS Lett., 591, 2213–2225.

    Not in our library10.1002/1873-3468.12684

  30. 30.

    Srivastava A., Sutton C. (2017 ) Autoencoding variational inference for topic models. In: International Conference on Learning Representations (ICLR).

    Not in our library

  31. 31.

    Stuart J.M. et al (2003 ) A gene-coexpression network for global discovery of conserved genetic modules. Science, 302, 249–255.

    Not in our library10.1126/science.1087447

  32. 32.

    Svensson V. (2020 ) Droplet scRNA-Seq is not zero-inflated. Nat. Biotechnol., 38, 147–150.

    Not in our library10.1038/s41587-019-0379-5

  33. 33.

    Svensson V. et al (2018 ) Exponential scaling of single-cell RNA-Seq in the past decade. Nat. Protoc., 13, 599–604.

    Not in our library10.1038/nprot.2017.149

  34. 34.

    Thompson D. et al (2015 ) Comparative analysis of gene regulatory networks: from network reconstruction to evolution. Annu. Rev. Cell Dev. Biol., 31, 399–428.

    Not in our library10.1146/annurev-cellbio-100913-012908

  35. 35.

    Tipping M.E., Bishop C.M. (1999 ) Probabilistic principal component analysis. J. R. Soc. Ser. B Statist. Methodol., 61, 611–622.

    Not in our library

  36. 36.
  37. 37.
  38. 38.

    Zhu X. et al (2017 ) Detecting heterogeneity in single-cell RNA-Seq data by non-negative matrix factorization. PeerJ, 5, e2888.

    Not in our library10.7717/peerj.2888

Cited by papers we hold 6

Reads

Read by people on this page

None yet.

Checked or read by AI through naulon

None yet.

A person counts once a day per paper. We keep no cookie and no address: a reader is a hash that changes every day. Any month under five reads shows no number.

Are you an author?

Is this your paper?

Claim it to add your note and be paid when agents cite it. Free.