Skip to content

Commit

Permalink
reintroduce reducedDim filter for obs
Browse files Browse the repository at this point in the history
  • Loading branch information
katosh committed May 31, 2024
1 parent 4a86394 commit af57b18
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/convert_to_anndata.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ convert_to_anndata <- function(sce, assayName = "counts", useAltExp = TRUE) {
# Process obs and var data
obs_data <- extract_data(colData, "obs/colData", sce)
var_data <- extract_data(rowData, "var/rowData", sce)

# Filter out reducedDims from obs_data
available_reductions <- names(reducedDims(sce))
reduction_prefixes <- paste0(tolower(available_reductions), "\\.")
reduction_columns <- grep("^reducedDims\\.", names(obs_data$data), value = TRUE)
if (length(reduction_columns) > 0) {
obs_data$data <- obs_data$data[, !(names(obs_data$data) %in% reduction_columns), drop = FALSE]
}

# Ensure obs and var are correctly provided
if (nrow(obs_data$data) != nrow(X) || ncol(obs_data$data) == 0) {
Expand Down

0 comments on commit af57b18

Please sign in to comment.