novoSpaRc - de novo Spatial Reconstruction of single-cell gene expression
This package is created and maintained by
Nikos Karaiskos and
novoSpaRc can be used to predict the locations of cells
in space by using single-cell RNA sequencing data. An existing reference
database of marker genes is not required, but enhances mappability if
novoSpaRc accompanies the following preprint
Charting tissues from single-cell transcriptomes,
M. Nitzan#, N. Karaiskos#, N. Friedman& and N. Rajewsky&
Installation and requirements
Python 3.5 installation and the following libraries are required:
Having all dependencies available,
novoSpaRc can be employed by cloning the
repository, modifying the template
and running it to perform the spatial reconstruction.
The code is partially based on adjustments of the POT (Python Optimal Transport) library (https://github.com/rflamary/POT).
environments_and_versions.txt contains environments in which we
To spatially reconstruct gene expression,
novoSpaRc performs the following
Read the gene expression matrix.
1a. Optional: select a random set of cells for the reconstruction.
1b. Optional: select a small set of genes (e.g. highly variable).
Construct the target space.
Setup the optimal transport reconstruction.
3a. Optional: use existing information of marker genes, if available.
Perform the spatial reconstruction.
4a. assigning cells a probability distribution over the target space.
4b. derive a virtual in situ hybridization (vISH) for all genes over the target space.
Write outputs to file for further use, such as the spatial gene expression matrix and the target space coordinates.
Optional: plot spatial gene expression patterns.
Optional: identify and plot spatial archetypes.
We provide scripts that spatially reconstruct two of the tissues presented in the paper: the intestinal epithelium (Moor, A.E., et al., Cell, 2018) and the stage 6 Drosophila embryo (Berkley Drosophila Transcription Network Project).
The intestinal epithelium
reconstruct_intestine_denovo.py script reconstructs the crypt-to-villus axis of the mammalian intestinal epithelium, based on data from Moor et al.
The reconstruction is performed de novo, without using any marker genes.
The script outputs plots of (a) a histogram showing the distribution of assignment values over embedded zones for each original villus zone, and (b) average spatial gene expression over the original villus zones and embedded zones of 4 gene groups.
Running time on a standard computer is under a minute.
The Drosophila embryo
reconstruct_bdtnp_with_markers.py script reconstructs the early
Drosophila embryo with only a handful of markers, based on the BDTNP dataset.
All cells are used and
a random set of 1-4 markers is selected. The script outputs plots of
gene expression for a list of genes, as well as Pearson correlations of the
reconstructed and original expression values for all genes.
Notice that the results depend on which marker genes are selected.
In the manuscript we averaged the results over many different choices of marker genes.
Running time on a standard desktop computer is around 6-7 minutes.
Running novoSpaRc on your data
A template file for running
novoSpaRc on custom datasets is
reconstruct_tissue.py). To successfully run
novoSpaRc modify the
template file accordingly.