Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-d-campbell committed Apr 7, 2021
1 parent e01b013 commit 4e9b7ef
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
12 changes: 6 additions & 6 deletions R/celda_C.R
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ setMethod("celda_C",

## Maximization to find best label for each cell
probs <- .countsTimesProbs(counts, phi) + theta[, s]

if (isTRUE(doSample)) {
zPrevious <- z
z <- apply(probs, 2, which.max)
Expand Down Expand Up @@ -945,11 +945,11 @@ setMethod("celda_C",
.countsTimesProbs <- function(counts, phi) {
## Maximization to find best label for each cell
if (inherits(counts, "matrix") & is.integer(counts)) {
probs <- eigenMatMultInt(phi, counts)
probs <- eigenMatMultInt(phi, counts)
} else if (inherits(counts, "matrix") & is.numeric(counts)) {
probs <- eigenMatMultNumeric(phi, counts)
probs <- eigenMatMultNumeric(phi, counts)
} else {
probs <- (t(phi) %*% counts)
}
probs <- (t(phi) %*% counts)
}
return(probs)
}
}
11 changes: 5 additions & 6 deletions R/celda_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ setMethod("compareCountMatrix",
}
celdaChecksum <- params(celdaMod)$countChecksum
counts <- .processCounts(counts)

# Checksums are generated in celdaGridSearch and model after processing
count.md5 <- .createCountChecksum(counts)
res <- isTRUE(count.md5 == celdaChecksum)
Expand Down Expand Up @@ -329,7 +329,7 @@ setMethod("compareCountMatrix",
}
celdaChecksum <- celdaMod@countChecksum
counts <- .processCounts(counts)

# Checksums are generated in celdaGridSearch and model after processing
count.md5 <- .createCountChecksum(counts)
res <- isTRUE(count.md5 == celdaChecksum)
Expand Down Expand Up @@ -442,10 +442,9 @@ distinctColors <- function(n,


.processCounts <- function(counts) {
if(!((inherits(counts, "matrix") &
if (!((inherits(counts, "matrix") &
(is.integer(counts) | is.numeric(counts))) |
inherits(counts, "dgCMatrix")))
{
inherits(counts, "dgCMatrix"))) {
stop("'counts' must be a sparse dgCMatrix ",
"from the 'Matrix' package or a matrix containing integer or numeric ",
"values.")
Expand All @@ -460,7 +459,7 @@ distinctColors <- function(n,
.validateCounts <- function(counts) {
countRowSum <- rowSums(counts)
countColSum <- colSums(counts)

if (sum(countRowSum == 0) > 0 | sum(countColSum == 0) > 0) {
stop(
"Each row and column of the count matrix must have at least",
Expand Down
2 changes: 1 addition & 1 deletion R/factorizeMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ setMethod("factorizeMatrix", signature(x = "ANY", celdaMod = "celda_C"),
beta <- params(celdaMod)$beta
sampleLabel <- sampleLabel(celdaMod)
s <- as.integer(sampleLabel)

p <- .cCDecomposeCounts(counts, s, z, K)
mCPByS <- p$mCPByS
nGByCP <- p$nGByCP
Expand Down
4 changes: 2 additions & 2 deletions R/moduleHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ setMethod("moduleHeatmap",
filteredNormCounts[filteredNormCounts > trim[2]] <- trim[2]
}

if(is.null(rowFontSize)) {
if (is.null(rowFontSize)) {
rowFontSize <- min(200 / nrow(filteredNormCounts), 20)
}

if (isTRUE(showModuleLabel)) {
plt <- ComplexHeatmap::Heatmap(matrix = filteredNormCounts,
col = col,
Expand Down
2 changes: 1 addition & 1 deletion R/recursiveSplit.R
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ setMethod("recursiveSplitModule",
verbose = FALSE
)
modelInitial@params$countChecksum <- countChecksum

currentL <- length(unique(celdaClusters(modelInitial)$y)) + 1
overallY <- celdaClusters(modelInitial)$y

Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-celda_CG.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test_that(desc = paste0("Testing simulateCells celda_CG, make sure all genes",

# Ensure logLikelihood calculates the expected values
test_that(desc = "Testing logLikelihood functions for celda_CG", {
expect_lt(logLikelihood(modelCG),0)
expect_lt(logLikelihood(modelCG), 0)

fakeZ <- celdaClusters(modelCG)
fakeZ[1] <- K + 1
Expand Down Expand Up @@ -211,5 +211,4 @@ test_that(desc = "Testing plotCeldaViolin with celda_CG", {
"facet",
"plot_env",
"labels"))
})

})

1 comment on commit 4e9b7ef

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/testthat/test-celda_CG.R:214:3: style: Missing terminal newline.

​})
  ^

Please sign in to comment.