Skip to content

Commit

Permalink
Merge branch 'master' into test-prepare-experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
ogibson authored Oct 8, 2021
2 parents 7a27088 + 1c02f3c commit b7b2971
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions pipeline-runner/R/gem2s-6-construct_qc_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ construct_qc_config <- function(scdata, any_filtered) {
# classifier
config.classifier <- list(
enabled = !any_filtered,
prefiltered = any_filtered,
auto = TRUE,
filterSettings = list(FDR = 0.01))

Expand Down
4 changes: 2 additions & 2 deletions pipeline-runner/R/qc-4-filter_gene_umi_outlier.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#'
filter_gene_umi_outlier <- function(scdata, config, sample_id, task_name = "numGenesVsNumUmis", num_cells_to_downsample = 6000) {

p.level <- config$filterSettings$regressionTypeSettings[[config$filterSettings$regressionType]]$p.level

p.level <- suppressWarnings(as.numeric(config$filterSettings$regressionTypeSettings[[config$filterSettings$regressionType]]$p.level))
if(is.na(p.level)) stop("P-level couldnt be interpreted as a number.")
if (as.logical(toupper(config$enabled))) {
if (config$filterSettings$regressionType == "gam") {
# Subsetting this sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ test_that("cellsize filter is disabled by default and classifier if pre-filtered
scdata <- mock_scdata()

qc_config <- construct_qc_config(scdata, any_filtered = TRUE)
expect_false(qc_config$cellSizeDistribution$enabled)

expect_false(qc_config$classifier$enabled)
expect_true(qc_config$classifier$prefiltered)
expect_false(qc_config$cellSizeDistribution$enabled)
})


Expand Down
23 changes: 23 additions & 0 deletions pipeline-runner/tests/testthat/test-qc-4-filter_gene_umi_outlier.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,26 @@ test_that("filter_gene_umi_outlier return the appropriate plot data", {
# is numeric
expect_equal(class(pdat[[1]]), 'numeric')
})

test_that("Gene UMI filter works if input is a a float-interpretable string", {
scdata <- mock_scdata()
config <- mock_config()
nstart <- ncol(scdata)
config$auto <- FALSE
out_number <- filter_gene_umi_outlier(scdata, config, '123def')

config$filterSettings$regressionTypeSettings$gam$p.level <- "0.1"
out_string <- filter_gene_umi_outlier(scdata, config, '123def')

expect_lt(ncol(out_number$data),nstart)
expect_equal(ncol(out_number$data),ncol(out_string$data))
})

test_that("Gene UMI filter throws error if input is a non float-interpretable string", {
scdata <- mock_scdata()
config <- mock_config()
config$auto <- FALSE
config$filterSettings$regressionTypeSettings$gam$p.level <- "asd"

expect_error(filter_gene_umi_outlier(scdata, config, '123def'))
})
Binary file not shown.

0 comments on commit b7b2971

Please sign in to comment.