Skip to content

Commit 9e4f285

Browse files
committed
Small keyword length bug in CellPopExtract
1 parent 9cfcc51 commit 9e4f285

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

R/CellPopExtract.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ write.FCS(new_fcs, filename = FinalRestingPlace, delimiter="#")
8282
FlowKeywords <- function(x, keywords, addon){
8383
if (length(keywords) > 0){
8484
First <- keyword(x, keywords[1])
85+
8586
if (length(keywords) > 1) {
8687
Second <- keyword(x, keywords[2])
87-
} else {Nomenclature <- First}
88+
8889
if (length(keywords) > 2) {
8990
Third <- keyword(x, keywords[3])
90-
} else {Nomenclature <- paste(First, Second, sep="_")}
91+
9192
if (length(keywords) > 3) {
9293
stop("Please choose only three keywords, thank you!")
93-
} else {Nomenclature <- paste(First, Second, Third, sep="_")}
94-
}
94+
} else {Nomenclature <- paste(First, Second, Third, sep="_")}
95+
} else {Nomenclature <- paste(First, Second, sep="_")}
96+
} else {Nomenclature <- First}
97+
} else {stop("No keywords provided")}
9598

9699
if (!is.null(addon)){FileName <- paste(Nomenclature, addon, sep="_")
97100
} else {FileName <- Nomenclature}

R/Utility_GatingPlots.R

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ Utility_GatingPlots <- function(x, sample.name, removestrings,
7575

7676
# Pulling Gating Information
7777
if(!is.null(gtFile)){
78-
TheXYZgates <- gtFile |> pull(alias)
78+
TheXYZgates <- gtFile |> pull(alias)
7979
if ("*" %in% TheXYZgates){
8080
gtFile <- TemplateConverter(gtFile)
8181
TheXYZgates <- gtFile |> pull(alias)
82-
}
83-
84-
} else {
82+
}} else {
8583
message("No gating reference file provided, returning provided arguments")
8684
TheXYZgates <- NULL}
8785

@@ -107,6 +105,8 @@ Utility_GatingPlots <- function(x, sample.name, removestrings,
107105
TheDF <- data.frame(df, check.names = FALSE)
108106
x2 <- x
109107

108+
# x <- TheXYZgates[1]
109+
# data <- x2
110110
CompiledPlots <- map(.x = TheXYZgates, .f = GatePlot, data=x2, TheDF = TheDF,
111111
gtFile = gtFile, bins=bins, clearance=clearance, name=name)
112112
} else {
@@ -250,12 +250,13 @@ GatePlot <- function(x, data, TheDF, gtFile, bins=270, clearance = 0.2,
250250
theYmax <- theYmax + (clearance*theYmax)}
251251

252252
if (!exists("theYmax") || !exists("theXmax")){
253-
Plot <- as.ggplot(ggcyto(data, aes(x = .data[[xValue]], y = .data[[yValue]]),
253+
Plot <- ggcyto(data, aes(x = .data[[xValue]], y = .data[[yValue]]),
254254
subset = theSubset) + geom_hex(bins=bins) + geom_gate(theGate) + theme_bw() +
255255
labs(title = name) + theme(strip.background = element_blank(),
256256
strip.text.x = element_blank(), panel.grid.major = element_line(
257257
linetype = "blank"), panel.grid.minor = element_line(linetype = "blank"),
258-
axis.title = element_text(size = 10, face = "bold"), legend.position = "none"))
258+
axis.title = element_text(size = 10, face = "bold"), legend.position = "none")
259+
Plot <- Luciernaga.as.ggplot(Plot)
259260
} else {
260261
Plot <- as.ggplot(ggcyto(data, aes(x = .data[[xValue]], y = .data[[yValue]]), subset = theSubset)) +
261262
geom_hex(bins=bins) +

0 commit comments

Comments
 (0)