A deep count autoencoder network to denoise scRNA-seq data and remove the dropout effect by taking the count structure, overdispersed nature and sparsity of the data into account using a deep autoencoder with zero-inflated negative binomial (ZINB) loss function.
See our manuscript and tutorial for more details.
For a traditional Python installation of the count autoencoder and the required packages, use
$ pip install dca
Another approach for installing count autoencoder and the required packages is to use Conda (most easily obtained via the Miniconda Python distribution). Afterwards run the following commands.
$ conda install -c bioconda dca
You can run the autoencoder from the command line:
dca matrix.csv results
where matrix.csv is a CSV/TSV-formatted raw count matrix with genes in rows and cells in columns. Cell and gene labels are mandatory.
Output folder contains the main output file (representing the mean parameter of ZINB distribution) as well as some additional matrices in TSV format:
-
mean.tsvis the main output of the method which represents the mean parameter of the ZINB distribution. This file has the same dimensions as the input file (except that the zero-expression genes or cells are excluded). It is formatted as agene x cellmatrix. Additionally,mean_norm.tsvfile contains the library size-normalized expressions of each cell and gene. Seenormalize_totalfunction from Scanpy for the details about the default library size normalization method used in DCA. -
pi.tsvanddispersion.tsvfiles represent dropout probabilities and dispersion for each cell and gene. Matrix dimensions are same asmean.tsvand the input file. -
reduced.tsvfile contains the hidden representation of each cell (in a 32-dimensional space by default), which denotes the activations of bottleneck neurons.
Use -h option to see all available parameters and defaults.
You can run the autoencoder with --hyper option to perform hyperparameter search.
This is a fork of theislab/dca maintained for use as a submodule in scPRINT-2.
DCA was written for Keras 1.x / early Keras 2.x and uses several APIs that have been removed or relocated in modern versions of Keras (2.12+):
| File | Old import | New import | Reason |
|---|---|---|---|
dca/network.py |
from keras.objectives import mean_squared_error |
from keras.losses import mean_squared_error |
keras.objectives module was removed; losses moved to keras.losses |
dca/layers.py |
from keras.engine.topology import Layer |
from keras.layers import Layer |
keras.engine.topology was deprecated and removed; Layer is now directly in keras.layers |
dca/layers.py |
from keras.engine.base_layer import InputSpec |
from keras.layers import InputSpec |
Same — keras.engine.base_layer no longer exists |
These are minimal, non-breaking patches — no logic was changed, only import paths updated to match Keras 2.12 conventions.
import sys
sys.path.insert(0, "tools/dca")
from dca.api import dca
result = dca(adata, copy=True)Requires a separate Python environment with tensorflow==2.12.0 and keras==2.12.0 (incompatible with the main scPRINT-2 environment due to TF version conflicts).