Skip to content

Commit

Permalink
Remove use of paste() or paste0() inside message() to resolve another…
Browse files Browse the repository at this point in the history
… BiocCheck NOTE
  • Loading branch information
lcolladotor committed Mar 27, 2024
1 parent da37fbb commit 87234fc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
18 changes: 15 additions & 3 deletions R/corner.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,25 @@
#' lis <- list(iris, mtcars, matrix(rnorm(1000), ncol = 10))
#' corner(lis)
corner <- function(mat, n = 6) {
types <- c("list", "DataFrame", "data.frame", "GRanges", "matrix", "tbl_df")
types <-
c("list",
"DataFrame",
"data.frame",
"GRanges",
"matrix",
"tbl_df")
if (!(class(mat)[1] %in% types)) {
stop(paste0("The class of your object (", class(mat), ") is not handled by this function."))
stop(
"The class of your object (",
class(mat),
") is not handled by this function.",
call. = FALSE
)
}
if (class(mat)[1] == "list") {
# return corners of first n items of list
return(lapply(mat[seq_len(min(length(mat), n))], function(x) x[seq_len(min(nrow(x), n)), seq_len(min(ncol(x), n))]))
return(lapply(mat[seq_len(min(length(mat), n))], function(x)
x[seq_len(min(nrow(x), n)), seq_len(min(ncol(x), n))]))
} else {
return(mat[seq_len(min(nrow(mat), n)), seq_len(min(ncol(mat), n))])
}
Expand Down
6 changes: 3 additions & 3 deletions R/expression_cutoff.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ expression_cutoff <- function(expr, max_cut = 1, seed = NULL, n.boot = 2000,
"samples_nonzero_cut" = cuts[round(seg2$psi[, 2])][2]
)

message(paste(
Sys.time(), "the suggested expression cutoff is",
message(
Sys.time(), " the suggested expression cutoff is ",
round(mean(suggested), 2)
))
)
return(suggested)
}
10 changes: 5 additions & 5 deletions R/junctionCount.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ junctionCount <- function(junctionFiles, sampleNames = names(junctionFiles),
stopifnot(output %in% c("Count", "Rail"))

names(junctionFiles) <- sampleNames
message(paste(Sys.time(), "reading in data"))
message(Sys.time(), " reading in data")

if (all(is.character(junctionFiles))) {
theData <- mclapply(junctionFiles, function(x) {
Expand Down Expand Up @@ -86,7 +86,7 @@ junctionCount <- function(junctionFiles, sampleNames = names(junctionFiles),
theData <- junctionFiles
stopifnot(all(sapply(theData, class) == "GRanges"))
}
message(paste(Sys.time(), "creating master table of junctions"))
message(Sys.time(), " creating master table of junctions")

## turn into GRangesList
### THIS STEP IS SLOW...
Expand All @@ -108,8 +108,8 @@ junctionCount <- function(junctionFiles, sampleNames = names(junctionFiles),
fullGR <- sort(fullGR)
fullGR$count <- NULL

message(paste(Sys.time(), "there are", length(fullGR), "total junctions"))
message(paste(Sys.time(), "populating count matrix"))
message(Sys.time(), " there are ", length(fullGR), " total junctions")
message(Sys.time(), " populating count matrix")

jNames <- paste0(
as.character(seqnames(fullGR)), ":", start(fullGR), "-",
Expand All @@ -127,7 +127,7 @@ junctionCount <- function(junctionFiles, sampleNames = names(junctionFiles),
M <- length(jNames)

## fill in matrix
message(paste(Sys.time(), "filling in the count matrix"))
message(Sys.time(), " filling in the count matrix")
for (i in seq(along = grList)) {
if (i %% 25 == 0) message(".")
cc <- rep(0, M)
Expand Down

0 comments on commit 87234fc

Please sign in to comment.