DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
61 stars 13 forks source link

object 'chans' not found while applying compensation #128

Closed cleanylee closed 2 years ago

cleanylee commented 2 years ago

Hi @DillonHammill , thanks for the great package.

I tried to do compensation with the package and encountered some issues I couldn't figure out why. The error message happens when I tried to run cyto_plot_compensation or cyto_compensate

I followed the code of example article and also get the same error. (shown below)

Code: image

The Console: image

williamsdrake commented 2 years ago

Just ran into this problem as well. Following the vignette and sample data

> # Apply compensation
> gs <- cyto_compensate(gs,
+                       spillover = "Spillover-Matrix.csv")
Error in colnames(z) %in% chans : object 'chans' not found
> traceback()
6: colnames(z) %in% chans
5: which(!colnames(z) %in% chans)
4: FUN(X[[i]], ...)
3: lapply(spill, function(z) {
       cols_rm <- which(!colnames(z) %in% chans)
       if (length(cols_rm) > 0) {
           z <- z[, -cols_rm]
           row_rm <- LAPPLY(cols_rm, function(w) {
               which(z[, w] == 1)
           })
           row_rm <- row_rm[!is.na(row_rm)]
           if (length(row_rm) > 0) {
               z <- z[-row_rm, ]
           }
       }
       return(z)
   })
2: cyto_compensate.GatingSet(gs, spillover = "Spillover-Matrix.csv")
1: cyto_compensate(gs, spillover = "Spillover-Matrix.csv")

It appears the problem is within the function cyto_compensate.GatingSet.

DillonHammill commented 2 years ago

Apologies for not spotting this bug sooner, I have been working on getting the new version of CytoExploreR (v2.0.0) ready for release - if all goes to plan it should be available next week.

In the meantime, I have pushed a fix to the master branch on GitHub to fix this issue in version 1.1.0 of CytoExploreR. Please pull down the latest version from GitHub and let me know how you go.

devtools::install_github("DillonHammill/CytoExploreR")
williamsdrake commented 2 years ago

No need to apologize. It is working for me now after pulling the latest version. Just saw some tweets about v2, looking forward to it!

cleanylee commented 2 years ago

Thanks @DillonHammill It works perfectly now after the update. Looking forward to the new version !