From 813c46e15fbd95aebcb09e25341c7db19f30c082 Mon Sep 17 00:00:00 2001 From: SciLiciumTheo <101104633+SciLiciumTheo@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:34:34 +0200 Subject: [PATCH 1/5] Add new methods to deconvBench --- pipeline/bin/computeSignaturesNF.R | 10 +++++++--- pipeline/optimal_normalizations.csv | 22 +++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/pipeline/bin/computeSignaturesNF.R b/pipeline/bin/computeSignaturesNF.R index b456aa5..948ee26 100755 --- a/pipeline/bin/computeSignaturesNF.R +++ b/pipeline/bin/computeSignaturesNF.R @@ -38,9 +38,13 @@ source(paste0(baseDir, '/bin/utils.R')) method_normalizations <- read.table(paste0(baseDir, '/optimal_normalizations.csv'), sep = ',', header = TRUE) # find method-specific normalizations for sc and bulk -sc_norm <- method_normalizations[method_normalizations$method == method, 2] -bulk_norm <- method_normalizations[method_normalizations$method == method, 3] -print(paste0('Method: ', method, '; sc-norm: ', sc_norm, '; bulk-norm: ', bulk_norm)) +if(method %in% method_normalizations$method){ + sc_norm <- method_normalizations[method_normalizations$method == method, 2] + bulk_norm <- method_normalizations[method_normalizations$method == method, 3] + print(paste0('Method: ', method, '; sc-norm: ', sc_norm, '; bulk-norm: ', bulk_norm)) +} else { + stop(paste0('Method ', method, ' is not currently supported. Exiting.')) +} # check if preprocessing has been performed if(args$run_preprocessing == 'true'){ diff --git a/pipeline/optimal_normalizations.csv b/pipeline/optimal_normalizations.csv index f17c602..349894a 100644 --- a/pipeline/optimal_normalizations.csv +++ b/pipeline/optimal_normalizations.csv @@ -1,10 +1,14 @@ -method,sc_norm,bulk_norm -autogenes,cpm,tpm -bayesprism,counts,counts -bisque,counts,counts -cibersortx,cpm,tpm -dwls,counts,tpm -music,counts,tpm -scaden,counts,tpm -scdc,counts,tpm +method,sc_norm,bulk_norm +autogenes,cpm,tpm +bayesprism,counts,counts +bisque,counts,counts +bseqsc,counts,tpm +cdseq,counts,counts +cibersortx,cpm,tpm +cpm,counts,counts +dwls,counts,tpm +momf,counts,counts +music,counts,tpm +scaden,counts,tpm +scdc,counts,tpm rectangle,counts,tpm \ No newline at end of file From d6bc7d537831b0a72662f65f8bd4aebdf45d15b4 Mon Sep 17 00:00:00 2001 From: SciLiciumTheo <101104633+SciLiciumTheo@users.noreply.github.com> Date: Thu, 3 Apr 2025 11:22:54 +0200 Subject: [PATCH 2/5] Add cpm as deconvolution method --- pipeline/bin/utils.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pipeline/bin/utils.R b/pipeline/bin/utils.R index ee007de..52b5f83 100755 --- a/pipeline/bin/utils.R +++ b/pipeline/bin/utils.R @@ -257,7 +257,7 @@ signature_workflow_general <- function(sc_matrix, annotations, annotation_catego verbose = TRUE ) - }else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'music')){ + }else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'cdseq', 'cpm', 'music')){ signature <- NULL } else { @@ -365,6 +365,15 @@ deconvolution_workflow_general <- function(sc_matrix, annotations, annotation_ca unlink(cx_input, recursive=TRUE) unlink(cx_output, recursive=TRUE) + } else if (method=="cpm"){ + + deconvolution <- omnideconv::deconvolute_cpm( + bulk_gene_expression = bulk_matrix, + single_cell_object = sc_matrix, + cell_type_annotations = annotations, + verbose = TRUE, + )$cellTypePredictions + } else if(method=="dwls") { deconvolution <- omnideconv::deconvolute_dwls( From 721b1f7549b97f9387b754f938b20b51323f6ba0 Mon Sep 17 00:00:00 2001 From: SciLiciumTheo <101104633+SciLiciumTheo@users.noreply.github.com> Date: Thu, 3 Apr 2025 15:28:50 +0200 Subject: [PATCH 3/5] Add support for CDseq By default, the CDseq call will use the reduce-recover strategy with 10 blocks of 1k genes to speed-up computations. See Kang et al. (BMC bioinformatics, 2021) publication (https://doi.org/10.1186/s12859-021-04186-5) --- pipeline/bin/utils.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pipeline/bin/utils.R b/pipeline/bin/utils.R index 52b5f83..a662a21 100755 --- a/pipeline/bin/utils.R +++ b/pipeline/bin/utils.R @@ -328,6 +328,21 @@ deconvolution_workflow_general <- function(sc_matrix, annotations, annotation_ca batch_ids = sc_batch, verbose = TRUE, )$bulk.props) + + } else if (method=="cdseq"){ + + deconvolution_cdseq <- omnideconv::deconvolute_cdseq( + bulk_gene_expression = bulk_matrix, + single_cell_object = sc_matrix, + cell_type_annotations = annotations, + batch_ids = sc_batch, + block_number=10, + gene_subset_size=1000, + verbose = TRUE, + ) + + deconvolution <- t(deconvolution_cdseq$cdseq_prop_merged) + print(deconvolution) } else if (method=="cibersortx"){ From cca7780a9058756851b750030c20eba430368637 Mon Sep 17 00:00:00 2001 From: SciLiciumTheo <101104633+SciLiciumTheo@users.noreply.github.com> Date: Thu, 3 Apr 2025 16:59:29 +0200 Subject: [PATCH 4/5] Adding momf to available tools --- pipeline/bin/utils.R | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/pipeline/bin/utils.R b/pipeline/bin/utils.R index a662a21..076f1ef 100755 --- a/pipeline/bin/utils.R +++ b/pipeline/bin/utils.R @@ -238,6 +238,14 @@ signature_workflow_general <- function(sc_matrix, annotations, annotation_catego verbose = TRUE )$basis + } else if (method == "momf") { + + signature <- omnideconv::build_model_momf( + sc_matrix, + annotations, + bulk_matrix + ) + } else if(method == "scaden"){ unlink(tmp_dir_path, recursive=TRUE) if(!dir.exists(paste0(tmp_dir_path))){ @@ -257,7 +265,7 @@ signature_workflow_general <- function(sc_matrix, annotations, annotation_catego verbose = TRUE ) - }else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'cdseq', 'cpm', 'music')){ + } else if (method %in% c('autogenes', 'bayesprism', 'bisque', 'cdseq', 'cpm', 'music')){ signature <- NULL } else { @@ -420,8 +428,18 @@ deconvolution_workflow_general <- function(sc_matrix, annotations, annotation_ca #) print(deconvolution) - } else if (method == "music"){ - deconvolution <- omnideconv::deconvolute_music( + } else if (method == "momf"){ + deconvolution_momf <- omnideconv::deconvolute_momf( + bulk_matrix, + signature, + sc_matrix, + verbose = TRUE, + ) + + deconvolution <- deconvolution_momf$cell.prop + + } else if (method == "music"){ + deconvolution <- omnideconv::deconvolute_momf( bulk_gene_expression = bulk_matrix, single_cell_object = sc_matrix, cell_type_annotations = annotations, From 872987c39ba27aa6b54aa9d57e3295bc975a0945 Mon Sep 17 00:00:00 2001 From: SciLiciumTheo <101104633+SciLiciumTheo@users.noreply.github.com> Date: Thu, 3 Apr 2025 17:27:59 +0200 Subject: [PATCH 5/5] Drop bseqsc from config file --- pipeline/optimal_normalizations.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/pipeline/optimal_normalizations.csv b/pipeline/optimal_normalizations.csv index 349894a..89da674 100644 --- a/pipeline/optimal_normalizations.csv +++ b/pipeline/optimal_normalizations.csv @@ -2,7 +2,6 @@ method,sc_norm,bulk_norm autogenes,cpm,tpm bayesprism,counts,counts bisque,counts,counts -bseqsc,counts,tpm cdseq,counts,counts cibersortx,cpm,tpm cpm,counts,counts