diff --git a/pipeline-runner/R/qc-4-filter_gene_umi_outlier.R b/pipeline-runner/R/qc-4-filter_gene_umi_outlier.R index 8122f036..25f49c6d 100644 --- a/pipeline-runner/R/qc-4-filter_gene_umi_outlier.R +++ b/pipeline-runner/R/qc-4-filter_gene_umi_outlier.R @@ -52,7 +52,7 @@ filter_gene_umi_outlier <- function(scdata_list, config, sample_id, cells_id, ta # get p_level and update in config # defaults from "gene.vs.molecule.cell.filter" in pagoda2 - if (safeTRUE(config$auto)) + if (safeTRUE(config$auto) || is.null(config$filterSettings$predictionInterval)) p_level <- min(0.001, 1 / ncol(sample_data)) else p_level <- 1 - as.numeric(config$filterSettings$predictionInterval) diff --git a/pipeline-runner/tests/testthat/test-qc-4-filter_gene_umi_outlier.R b/pipeline-runner/tests/testthat/test-qc-4-filter_gene_umi_outlier.R index 9db736da..e7457304 100644 --- a/pipeline-runner/tests/testthat/test-qc-4-filter_gene_umi_outlier.R +++ b/pipeline-runner/tests/testthat/test-qc-4-filter_gene_umi_outlier.R @@ -184,3 +184,25 @@ test_that("Gene UMI filter throws error if input is a non float-interpretable st expect_error(filter_gene_umi_outlier(scdata, config, sample_2_id, cells_id)) }) + +test_that("Gene UMI filter works with manual settings and default prediction interval value", { + c(scdata_list, sample_1_id, sample_2_id) %<-% mock_scdata() + config <- mock_config() + cells_id <- mock_ids() + type <- "spline" + config$filterSettings$regressionType <- type + + config$auto <- TRUE + out_auto <- filter_gene_umi_outlier(scdata_list, config, sample_1_id, cells_id) + + config$auto <- FALSE + out_manual <- filter_gene_umi_outlier(scdata_list, config, sample_1_id, cells_id) + + expect_null(config$filterSettings$predictionInterval) + expect_equal( + out_auto$config$filterSettings$regressionTypeSettings[[type]]$p.level, + out_manual$config$filterSettings$regressionTypeSettings[[type]]$p.level + ) +}) + +