Skip to content

Commit

Permalink
Added param for prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
WackerO committed Jan 11, 2024
1 parent 5059c8c commit 5bd0e12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/accessory.R
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ cond_log2_transform_matrix <- function(matrix_data, should_log = NULL, threshold
#'
#' @param assay_data A list containing matrices as assay data.
#' @param index_string A string that can be a comma-separated list of integers or assay names.
#' @param prettify_names Boolean. Prettify element names?
#'
#' @return A vector of valid indices (either as integers or assay names).
#'
Expand All @@ -1265,13 +1266,15 @@ cond_log2_transform_matrix <- function(matrix_data, should_log = NULL, threshold
#'
#' @export

validate_indices <- function(assay_data, index_string) {
validate_indices <- function(assay_data, index_string, prettify_names = TRUE) {

if (is_valid_positive_integer_vector(index_string)) {
indices <- as.integer(simpleSplit(index_string))
} else {
indices <- simpleSplit(index_string)
indices <- unlist(lapply(indices, prettifyVariablename))
if (prettify_names) {
indices <- unlist(lapply(indices, prettifyVariablename))
}
}

invalid_indices <- indices[!indices %in% c(1:length(assay_data), names(assay_data))]
Expand Down

0 comments on commit 5bd0e12

Please sign in to comment.