Package: TorchDecon 1.0.0

TorchDecon: Deep Learning-Based Cell Type Deconvolution Using torch

A deep neural network ensemble approach for cell type deconvolution of bulk RNA-seq data. TorchDecon uses simulated bulk samples generated from single-cell RNA-seq data to train deep neural networks that predict cell type fractions. This package is an R-native implementation based on the Scaden algorithm, built on the torch framework (LibTorch C++ backend) for GPU acceleration and cross-platform compatibility. Seamlessly integrates with Seurat objects (v4 and v5 compatible).

Authors:Zaoqu Liu [aut, cre]

TorchDecon_1.0.0.tar.gz
TorchDecon_1.0.0.zip(r-4.7)TorchDecon_1.0.0.zip(r-4.6)TorchDecon_1.0.0.zip(r-4.5)
TorchDecon_1.0.0.tgz(r-4.6-any)TorchDecon_1.0.0.tgz(r-4.5-any)
TorchDecon_1.0.0.tar.gz(r-4.7-any)TorchDecon_1.0.0.tar.gz(r-4.6-any)
TorchDecon_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION
card.svg |card.png
TorchDecon/json (API)

# Install 'TorchDecon' in R:
install.packages('TorchDecon', repos = c('https://zaoqu-liu.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/zaoqu-liu/torchdecon/issues

On CRAN:

Conda:

3.60 score 1 stars 5 scripts 28 exports 151 dependencies

Last updated from:139bac3eec (on main). Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK252
source / vignettesOK290
linux-release-x86_64OK264
macos-release-arm64OK205
macos-oldrel-arm64OK163
windows-develOK225
windows-releaseOK225
windows-oldrelOK208
wasm-releaseOK218

Exports:ApplyScalingCalculateAccuracyCalculateCorrelationCalculateMAECalculateMRECalculateRMSECreateTorchDeconCreateTorchDeconEnsembleEvaluateDeconvolutionEvaluatePredictionsExportSimulationExtractCellTypesExtractSeuratDataGenerateExampleDataGetTrainingHistoryLoadModelMergeSimulationsPlotEvaluationPlotTrainingHistoryPredictFractionsProcessPredictionDataProcessTrainingDataQuickPredictRunTorchDeconSaveModelSimulateBulkSimulationToDataFrameTrainModel

Dependencies:abindaskpassbase64encBHbitbit64bitopsbslibcachemcallrcaToolscliclustercodetoolscommonmarkcorocowplotcpp11crosstalkcurldata.tabledeldirdescdigestdotCall64dplyrdqrngevaluatefarverfastDummiesfastmapfitdistrplusFNNfontawesomefsfuturefuture.applygenericsggplot2ggrepelggridgesglobalsgluegoftestgplotsgridExtragtablegtoolsherehighrhtmltoolshtmlwidgetshttpuvhttricaigraphirlbaisobandjquerylibjsonliteKernSmoothknitrlabelinglaterlatticelazyevallifecyclelistenvlmtestmagrittrMASSMatrixmatrixStatsmemoisemimeminiUInlmeopensslotelparallellypatchworkpbapplypillarpkgconfigplotlyplyrpngpolyclipprocessxprogressrpromisespspurrrR6RANNrappdirsRColorBrewerRcppRcppAnnoyRcppArmadilloRcppEigenRcppHNSWRcppProgressRcppTOMLreshape2reticulaterlangrmarkdownROCRrprojrootRSpectraRtsneS7safetensorssassscalesscattermoresctransformSeuratSeuratObjectshinysitmosourcetoolsspspamspatstat.dataspatstat.explorespatstat.geomspatstat.randomspatstat.sparsespatstat.univarspatstat.utilsstringistringrsurvivalsystensortibbletidyrtidyselecttinytextorchutf8uwotvctrsviridisLitewithrxfunxtableyamlzoo

Advanced Usage and Best Practices
Introduction | GPU Acceleration | Checking GPU Availability | Specifying Device | Custom Model Architectures | Creating Custom Networks | Architecture Selection Guidelines | Training Optimization | Early Stopping | Learning Rate Tuning | Batch Size Considerations | Data Quality Optimization | Handling Unknown Cell Types | Optimal Sample Simulation | Gene Selection Strategies | Working with Multiple Datasets | Merging Simulations | Cross-validation Strategy | Model Persistence and Deployment | Saving Models with Metadata | Loading and Deploying | Troubleshooting | Common Issues and Solutions | Memory Management | Reproducibility | Setting Seeds | Best Practices Summary

Last update: 2026-01-26
Started: 2026-01-26

Algorithm and Mathematical Framework
Introduction | Problem Formulation | The Deconvolution Problem | Traditional Approaches vs. Deep Learning | Algorithmic Pipeline | Overview | Step 1: Bulk RNA-seq Simulation | Mathematical Formulation | Sparse Sample Generation | Step 2: Data Preprocessing | Log Transformation | Sample-wise Min-Max Normalization | Gene Filtering | Step 3: Neural Network Architecture | Fully Connected Network | Output Layer (Softmax) | Dropout Regularization | Step 4: Training | Loss Function | Adam Optimizer | Step 5: Ensemble Prediction | Architecture Specifications | Theoretical Considerations | Universal Approximation | Advantages over Linear Models | Limitations | References

Last update: 2026-01-26
Started: 2026-01-26

Visualization and Result Interpretation
Introduction | Setup | Generate Example Data and Run Deconvolution | Visualization Methods | 1. Stacked Bar Plot | 2. Heatmap Visualization | 3. Box Plot Comparison | 4. Training History Plot | 5. Correlation Plot (with Ground Truth) | 6. Per-Cell Type Accuracy | 7. Pie Chart for Individual Samples | Advanced Visualization | Ensemble Model Comparison | Summary

Last update: 2026-01-26
Started: 2026-01-26

Introduction to TorchDecon
Overview | Key Features | Installation | Quick Start | Step-by-Step Workflow | Step 1: Simulate Bulk Data | Step 2: Process Training Data | Step 3: Create and Train Model | Step 4: Predict Cell Fractions | Step 5: Save and Load Model | Model Architecture | Evaluation | Tips for Best Results | Citation | Session Info

Last update: 2026-01-25
Started: 2026-01-25

Readme and manuals

Help Manual

Help pageTopics
Apply Scaling to New DataApplyScaling
Calculate AccuracyCalculateAccuracy
Calculate CorrelationCalculateCorrelation
Calculate MAECalculateMAE
Calculate MRECalculateMRE
Calculate RMSECalculateRMSE
Create TorchDecon ModelCreateTorchDecon
Create TorchDecon EnsembleCreateTorchDeconEnsemble
Evaluate Deconvolution ResultsEvaluateDeconvolution
Evaluate PredictionsEvaluatePredictions
Export Simulation to FilesExportSimulation
Extract Cell Type Labels from Seurat ObjectExtractCellTypes
Extract Count Matrix from Seurat ObjectExtractSeuratData
Generate Example DataGenerateExampleData
Get Training HistoryGetTrainingHistory
Load TorchDecon ModelLoadModel
Merge SimulationsMergeSimulations
Plot Evaluation ResultsPlotEvaluation
Plot Training HistoryPlotTrainingHistory
Predict Cell Type FractionsPredictFractions
Print Method for TorchDeconEnsembleprint.TorchDeconEnsemble
Print Method for TorchDeconEvaluationprint.TorchDeconEvaluation
Print Method for TorchDeconModelprint.TorchDeconModel
Print Method for TorchDeconProcessedprint.TorchDeconProcessed
Print Method for TorchDeconSimulationprint.TorchDeconSimulation
Process Prediction DataProcessPredictionData
Process Training Data for TorchDeconProcessTrainingData
Quick Prediction with Pre-trained ModelQuickPredict
Run Complete TorchDecon WorkflowRunTorchDecon
Save TorchDecon ModelSaveModel
Seurat Compatibility Utilitiesseurat-utils
Simulate Bulk RNA-seq Data from Single-Cell DataSimulateBulk
Convert Simulation to Data FrameSimulationToDataFrame
Summary Method for TorchDeconEvaluationsummary.TorchDeconEvaluation
Summary Method for TorchDeconModelsummary.TorchDeconModel
Train TorchDecon ModelTrainModel