Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
use-public-rspm: true

- name: Install lintr
run: install.packages("lintr")
run: install.packages(c("lintr", "cyclocomp"))
shell: Rscript {0}

- name: Lint root directory
Expand Down
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
linters: linters_with_defaults(
line_length_linter(120),
commented_code_linter = NULL,
object_usage_linter = NULL
object_usage_linter = NULL,
cyclocomp_linter = cyclocomp_linter()
)

2 changes: 1 addition & 1 deletion R/eula.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ auto_accepted_eula <- function() {
value <- Sys.getenv(AUTO_ACCEPT_ENV_VAR, unset = "false")
value <- trimws(tolower(value))

return(value %in% c("t", "true", "y", "yes"))
value %in% c("t", "true", "y", "yes")
}
2 changes: 1 addition & 1 deletion R/hdf5.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ write_mat <- function(f, count_mat, feature_ids) {

if (is.null(feature_ids)) {
feature_ids <- lapply(seq_along(features), function(x) {
return(sprintf("feature_%d", x))
sprintf("feature_%d", x)
})
}

Expand Down
10 changes: 5 additions & 5 deletions R/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ bundled_executable_path <- function() {

executable_basename <- function() {
if (get_system_os() == "windows") {
return("louper.exe")
"louper.exe"
} else {
return("louper")
"louper"
}
}

Expand All @@ -195,10 +195,10 @@ get_artifact <- function() {
os <- get_system_os()

if (os == "windows") {
return(artifacts$windows)
artifacts$windows
} else if (os == "mac") {
return(artifacts$mac)
artifacts$mac
} else {
return(artifacts$linux)
artifacts$linux
}
}
4 changes: 2 additions & 2 deletions R/util.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ select_assay <- function(obj) {
#' @export
counts_matrix_from_assay <- function(assay) {
if (packageVersion("Seurat") >= package_version("5.0.0")) {
return(assay$counts)
assay$counts
} else {
if (is(assay, "Assay5")) {
stop("Cannot get count matrix: Please upgrade to Seurat > 5 to support dataset")
}

return(assay@counts)
assay@counts
}
}

Expand Down
10 changes: 4 additions & 6 deletions R/validate.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,19 @@ validate_clusters <- function(clusters, barcode_count) { # nolint: cyclocomp_lin
#' @export
validate_projections <- function(projections, barcode_count) { # nolint: cyclocomp_linter.
is_projection <- function(p) {
return(is.matrix(p))
is.matrix(p)
}

# should have dimensions barcodeCount x 2
projection_dims_good <- function(p) {
pdims <- dim(p)
return(pdims[[1]] == barcode_count && pdims[[2]] == 2)
pdims[[1]] == barcode_count && pdims[[2]] == 2
}

# no values should be NaN or Infinite
projection_values_good <- function(p) {
return(
!any(is.nan(p)) &&
!any(is.infinite(p))
)
!any(is.nan(p)) &&
!any(is.infinite(p))
}

proj_names <- names(projections)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ get_executable_path <- function() {
wd <- getwd()
os <- get_system_os()
if (os == "windows") {
return(file.path(wd, "mock_louper.bat"))
file.path(wd, "mock_louper.bat")
} else {
return(file.path(wd, "mock_louper"))
file.path(wd, "mock_louper")
}
}