Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using GatingSet #214

Open
EVatareck opened this issue May 11, 2021 · 3 comments
Open

Error using GatingSet #214

EVatareck opened this issue May 11, 2021 · 3 comments

Comments

@EVatareck
Copy link

Hello,

I have an issue using GatingSet with data obtained from a MACSQuant. I used the command several times before with data from other devices, but it seems that it does not work with the MACSQuant data. I get the following error:

Error in (function (cond) :
error in evaluating the argument 'x' in selecting a method for function 'GatingSet': Not compatible with requested type: [type=character; target=double].

This is my minimal example code:
################################
library(flowCore)

rawdata <- read.flowSet(path = "./Flowcore_Test/", emptyValue = F)

pData(rawdata)$sample <- "test"

trTransform <- transformList(colnames(rawdata),
truncateTransform(transformationId = "tr", a = 1),
transformationId = "tr")

lTransform <- transformList(colnames(rawdata),
logTransform(transformationId = "log10", logbase=10, r=1, d=1),
transformationId = "log10")

trData <- transform(rawdata, trTransform)
lData <- transform(trData, lTransform)
summary(lData)

Gating

rGate <- rectangleGate(filterId="GFP", "FL3-A"=c(0.5, 3))
gsData <- GatingSet(lData)

cannot proceed with the following

gs_get_pop_paths(gsData)
gs_pop_add(gsData, rGate, parent = "root")
###########################################

Here, I uploaded the small example dataset:
https://drive.google.com/drive/folders/164sMG67N6RPXwi16pnWM_VWTlYu8NCSN

What am I doing wrong?
I'd highly appreciate any help, as I would really need to gate my dataset. :(

Thank you very much in advance!
Elisabeth

@EVatareck
Copy link
Author

Hello,
could anybody help? Or do you need any further information in order to adress the issue?
Thank you so much!

@DillonHammill
Copy link
Contributor

I would seriously consider using CytoExploreR for this type of analysis. CytoExploreR will take care of all these steps for you, and you can interactively draw gates!
https://dillonhammill.github.io/CytoExploreR/

@rpahl
Copy link

rpahl commented Mar 2, 2024

In case this is still of relevance to someone. I had a similar issue with data coming from MACSQuant, which in my case was caused by an empty keyword entry set by MACSQuant, specifically "$SPILLOVER" was given a matrix <0 x 0>. So if you have something like this, check your keywords after you have read your file (you also may have to read in via flowCore::read.FCS(filename, emptyValue = FALSE).

If you have a similar issue, fwiw I just wrote a function to cleanup empty keyword entries

sanitize_keywords <- function(fr)
{
    stopifnot(fr |> methods::is("flowFrame"))

    emptyKeywords <- Filter(flowCore::keyword(fr), f = \(x) length(x) == 0)
    for (key in names(emptyKeywords)) {
        flowCore::keyword(fr)[[key]] <- NULL
    }
    fr
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants