Learn R Programming

SpatialDDLS

The SpatialDDLS R package provides a neural network-based solution for cell type deconvolution of spatial transcriptomics data. The package takes advantage of single-cell RNA sequencing (scRNA-seq) data to simulate mixed transcriptional profiles with known cell composition and train fully-connected neural networks to predict cell type composition of spatial transcriptomics spots. The resulting trained models can be applied to new spatial transcriptomics data to predict cell type proportions, allowing for a more accurate cell type identification and characterization of spatially-resolved transcriptomic data. Overall, SpatialDDLS is a powerful tool for cell type deconvolution in spatial transcriptomics data, providing a reliable, fast and flexible solution for researchers in the field.

For more details about the algorithm and functionalities implemented in this package, see https://diegommcc.github.io/SpatialDDLS/.

Installation

SpatialDDLS is already available on CRAN:

install.packages("SpatialDDLS")

The version under development is available on GitHub and can be installed as follows:

if (!requireNamespace("devtools", quietly = TRUE))
    install.packages("devtools")
devtools::install_github("diegommcc/SpatialDDLS")

The package depends on the tensorflow and keras R packages, so a working Python interpreter with the Tensorflow Python library installed is needed. The installTFpython function provides an easy way to install a conda environment named spatialddls-env with all necessary dependencies covered. We recommend installing the TensorFlow Python library in this way, although a custom installation is possible.

library("SpatialDDLS")
installTFpython(install.conda = TRUE)

References

Copy Link

Version

Install

install.packages('SpatialDDLS')

Monthly Downloads

426

Version

1.0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Diego Ma<c3><b1>anes

Last Published

March 15th, 2024

Functions in SpatialDDLS (1.0.1)

SpatialDDLS-Rpackage

SpatialDDLS: an R package to deconvolute spatial transcriptomics data using deep neural networks
SpatialDDLS-class

The SpatialDDLS Class
barErrorPlot

Generate bar error plots
estimateZinbwaveParams

Estimate parameters of the ZINB-WaVE model to simulate new single-cell RNA-Seq expression profiles
genMixedCellProp

Generate training and test cell type composition matrices
cell.types

Get and set cell.types slot in a DeconvDLModel object
cell.names

Get and set cell.names slot in a PropCellTypes object
loadSTProfiles

Loads spatial transcriptomics data into a SpatialDDLS object
corrExpPredPlot

Generate correlation plots between predicted and expected cell type proportions of test data
DeconvDLModel-class

The DeconvDLModel Class
loadTrainedModelFromH5

Load from an HDF5 file a trained deep neural network model into a SpatialDDLS object
deconvSpatialDDLS

Deconvolute spatial transcriptomics data using trained model
project

Get and set project slot in a SpatialDDLS object
saveRDS

Save SpatialDDLS objects as RDS files
features

Get and set features slot in a DeconvDLModel object
plotSpatialGeneExpr

Plot normalized gene expression data (logCPM) in spatial coordinates
plotHeatmapGradsAgg

Plot a heatmap of gradients of classes / loss function wtih respect to the input
plotSpatialClustering

Plot results of clustering based on predicted cell proportions
distErrorPlot

Generate box or violin plots showing error distribution
PropCellTypes-class

The PropCellTypes Class
getProbMatrix

Getter function for the cell composition matrix
installTFpython

Install Python dependencies for SpatialDDLS
createSpatialDDLSobject

Create a SpatialDDLS object
deconv.spots

Get and set deconv.spots slot in a SpatialDDLS object
method

Get and set method slot in a PropCellTypes object
plotSpatialPropAll

Plot predicted proportions for all cell types using spatial coordinates of spots
mixed.profiles

Get and set mixed.profiles slot in a SpatialDDLS object
plotTrainingHistory

Plot training history of a trained SpatialDDLS deep neural network model
model

Get and set model slot in a DeconvDLModel object
plotDistances

Plot distances between intrinsic and extrinsic profiles
set

Get and set set slot in a PropCellTypes object
saveTrainedModelAsH5

Save a trained SpatialDDLS deep neural network model to disk as an HDF5 file
test.metrics

Get and set test.metrics slot in a DeconvDLModel object
test.deconv.metrics

Get and set test.deconv.metrics slot in a DeconvDLModel object
prob.cell.types

Get and set prob.cell.types slot in a SpatialDDLS object
single.cell.simul

Get and set single.cell.simul slot in a SpatialDDLS object
single.cell.real

Get and set single.cell.real slot in a SpatialDDLS object
simMixedProfiles

Simulate training and test mixed spot profiles
simSCProfiles

Simulate new single-cell RNA-Seq expression profiles using the ZINB-WaVE model parameters
zinb.params

Get and set zinb.params slot in a SpatialDDLS object
training.history

Get and set training.history slot in a DeconvDLModel object
plotSpatialProp

Plot predicted proportions for a specific cell type using spatial coordinates of spots
interGradientsDL

Calculate gradients of predicted cell types/loss function with respect to input features for interpreting trained deconvolution models
plots

Get and set plots slot in a PropCellTypes object
prob.matrix

Get and set prob.matrix slot in a PropCellTypes object
spatial.experiments

Get and set spatial.experiments slot in a SpatialDDLS object
preparingToSave

Prepare SpatialDDLS object to be saved as an RDA file
zinbwave.model

Get and set zinbwave.model slot in a ZinbParametersModel object
trainDeconvModel

Train deconvolution model for spatial transcriptomics data
trained.model

Get and set trained.model slot in a SpatialDDLS object
set.list

Get and set set.list slot in a PropCellTypes object
showProbPlot

Show distribution plots of the cell proportions generated by genMixedCellProp
spatialPropClustering

Cluster spatial data based on predicted cell proportions
test.pred

Get and set test.pred slot in a DeconvDLModel object
topGradientsCellType

Get top genes with largest/smallest gradients per cell type
barPlotCellTypes

Bar plot of deconvoluted cell type proportions
ZinbParametersModel-class

The Class ZinbParametersModel
blandAltmanLehPlot

Generate Bland-Altman agreement plots between predicted and expected cell type proportions of test data
calculateEvalMetrics

Calculate evaluation metrics on test mixed transcriptional profiles