Skip to content

Commit

Permalink
Fix bug with transformLists and environments
Browse files Browse the repository at this point in the history
  • Loading branch information
timmocking committed Feb 7, 2024
1 parent 4bff568 commit 0031c55
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/getLogicle.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ getLogicle <- function(files, verbose = TRUE){
# Estimate linearization widths
wParams <- estimateLogicles(files)
transforms <- list()
widths <- c()
for (channel in colnames(wParams)){
w <- median(wParams[, channel])
if (verbose){
Expand All @@ -87,10 +88,11 @@ getLogicle <- function(files, verbose = TRUE){
}
transforms[[channel]] <- flowCore::logicleTransform(w = w,
transformationId = channel)
# For some reason, running the the line below is required to construct
# a proper transformList??? I cannot figure out why...
# If not called, the same width is used for all channels
summary(transforms[[channel]])
widths <- c(widths, w)
}
# Assign every w again because every transform has its own environment
for (i in seq_along(widths)) {
assign("w", widths[i], envir = environment(transforms[[colnames(wParams)[i]]]))
}
tfList <- flowCore::transformList(colnames(wParams), transforms)
return(tfList)
Expand Down

0 comments on commit 0031c55

Please sign in to comment.