Skip to content

Commit

Permalink
Updated runBarcodeRanks() to match output from new DropletUtils update
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Campbell committed Feb 20, 2025
1 parent 974ed6b commit b4c3146
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 7 additions & 8 deletions R/dropletUtils_barcodeRank.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
fit.bounds = fit.bounds,
df = df)

knee.ix <- as.integer(output@listData$total >=
knee.ix <- as.integer(output$total >=
S4Vectors::metadata(output)$knee)
inflection.ix <- as.integer(output@listData$total >=
inflection.ix <- as.integer(output$total >=
S4Vectors::metadata(output)$inflection)

rank.ix <- as.integer(output$rank)
total.ix <- as.integer(output$total)
fitted.ix <- as.integer(output$fitted)

result <- cbind(knee.ix, inflection.ix, rank.ix, total.ix, fitted.ix)
result <- cbind(knee.ix, inflection.ix, rank.ix, total.ix)
colnames(result) <- c("dropletUtils_barcodeRank_knee",
"dropletUtils_barcodeRank_inflection",
"dropletUtils_barcodeRank_rank",
"dropletUtils_barcodeRank_total",
"dropletUtils_barcodeRank_fitted")
"dropletUtils_barcodeRank_total")

result.list <- list(result,
S4Vectors::metadata(output)$knee,
S4Vectors::metadata(output)$inflection)
Expand Down Expand Up @@ -117,8 +117,7 @@ runBarcodeRankDrops <- function(inSCE,
"dropletUtils_barcodeRank_inflection")]

metaCols <- c("dropletUtils_barcodeRank_rank",
"dropletUtils_barcodeRank_total",
"dropletUtils_barcodeRank_fitted")
"dropletUtils_barcodeRank_total")
metaOutput[, metaCols] <- result.matrix[, metaCols]
metaOutput[,"dropletUtils_barcodeRank_knee"] <- rep(result$knee,
sum(sceSampleInd))
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-dropletUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ context("Testing dropletUtils algorithms")
data(scExample, package = "singleCellTK")

test_that(desc = "Testing runBarcodeRankDrops", {
sceres <- runBarcodeRankDrops(inSCE = sce)
expect_equal(length(colData(sceres)$dropletUtils_BarcodeRank_Inflection),ncol(sce))
expect_equal(class(colData(sceres)$dropletUtils_BarcodeRank_Inflection), "integer")
sce <- runBarcodeRankDrops(inSCE = sce)
expect_equal(length(colData(sce)$dropletUtils_BarcodeRank_Inflection),ncol(sce))
expect_equal(class(colData(sce)$dropletUtils_BarcodeRank_Inflection), "integer")
gg <- plotBarcodeRankDropsResults(sce)
expect_is(gg$scatterBarcodeRank, "ggplot")
})

0 comments on commit b4c3146

Please sign in to comment.