Skip to content

Commit 71294ca

Browse files
committed
Small adaptations to make the GetFlowJoLabels function more robust
1 parent 9540c62 commit 71294ca

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: FlowSOM
2-
Version: 2.7.10
2+
Version: 2.9.2
33
Date: 2023-04-21
44
Title: Using self-organizing maps for visualization and interpretation
55
of cytometry data

R/0_FlowSOM.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ GetFlowJoLabels <- function(files,
679679
...) {
680680
if (requireNamespace("CytoML", quietly = TRUE) &
681681
requireNamespace("flowWorkspace", quietly = TRUE)) {
682-
ws <- CytoML::open_flowjo_xml(wspFile)
682+
ws <- CytoML::open_flowjo_xml(wspFile, sample_names_from = "sampleNode")
683683
gates <- CytoML::flowjo_to_gatingset(ws,
684684
name = group,
685685
...)
@@ -694,7 +694,8 @@ GetFlowJoLabels <- function(files,
694694
if(length(file_id) == 0) {stop("File ", basename(file),
695695
" not found. Files available: \n",
696696
paste0(files_in_wsp, "\n"))}
697-
gate_names <- flowWorkspace::gs_get_pop_paths(gates, path = "auto")
697+
gate_names <- flowWorkspace::gs_get_pop_paths(gates[[file_id]],
698+
path = "auto")
698699

699700
gatingMatrix <- matrix(NA,
700701
nrow = counts[file_id],
@@ -707,11 +708,13 @@ GetFlowJoLabels <- function(files,
707708
}
708709

709710
if(is.null(cellTypes)){
710-
cellTypes <- flowWorkspace::gs_get_leaf_nodes(gates,
711-
path = "auto")
711+
cellTypes_tmp <- flowWorkspace::gs_get_leaf_nodes(gates[[file_id]],
712+
path = "auto")
713+
} else {
714+
cellTypes_tmp <- cellTypes
712715
}
713716

714-
manual <- ManualVector(gatingMatrix, cellTypes)
717+
manual <- ManualVector(gatingMatrix, cellTypes_tmp)
715718

716719
result[[file]] <- list("matrix" = gatingMatrix,
717720
"manual" = manual)

R/5_plotFunctions.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,8 +983,8 @@ PlotManualBars <- function(fsom, fcs = NULL,
983983
df_s$Freq[df_s$MC == mc] / sum(df_s$Freq[df_s$MC == mc])
984984
}
985985
df_s <- df_s %>%
986-
dplyr::mutate("MC" = factor(MC, levels = levels(fsom$metaclustering))) %>%
987-
dplyr::mutate("Manual" = factor(Manual, levels = manualOrder))
986+
dplyr::mutate("MC" = factor(.data$MC, levels = levels(fsom$metaclustering))) %>%
987+
dplyr::mutate("Manual" = factor(.data$Manual, levels = manualOrder))
988988

989989
p2 <- ggplot2::ggplot(data = df_s,
990990
ggplot2::aes(fill = .data$Manual,

0 commit comments

Comments
 (0)