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

'list' object cannot be coerced to type 'integer' when using spillover() to calculate compensation matrix #44

Open
jianwu1 opened this issue Feb 22, 2022 · 4 comments

Comments

@jianwu1
Copy link

jianwu1 commented Feb 22, 2022

Hi there,

Thank you very much for developing this package for analysing flow cytometry data! I've been trying to calculate compensation matrix with spillover() function using single stain controls, but have encountered this error that I can't resolve:
I have a flowSet object called single_stain_A, and the sampleNames and colnames are as such:
Screen Shot 2022-02-22 at 7 52 57 pm

The code I used is standard:
compA <- spillover(single_stain_A, unstained = 5, patt = "^[^FST]", fsc = "FSC.H", ssc = "SSC.H", stain_match = "regexpr")

But I get this error:

Screen Shot 2022-02-22 at 8 05 45 pm

Can I ask what the problem might be? What should I do to get the compensation matrix? The flowSet object single_stain_A is saved as a set of fcs files through write.flowSet(), and attached here.

Kind regards,

Jian
single_stain_A.zip

@jacobpwagner
Copy link
Member

jacobpwagner commented Feb 22, 2022

The reason it's failing is because a few channels are matching multiple filenames in the regex check here. Specifically, "V610" will match "UV610" and "V610" and "V670" will match "UV670" and "V670" in your sampleNames because that regex check doesn't include any anchors. In your case, you can probably just force an exact match:

compA <- spillover(single_stain_A, unstained = 5, patt = "^[^FST]", fsc = "FSC.H", ssc = "SSC.H", stain_match = "regexpr", exact_match = TRUE)

@mikejiang, it might not hurt to add a shape/dimension check on that match to get a more helpful error. I'm happy to make a PR.

@jianwu1
Copy link
Author

jianwu1 commented Feb 22, 2022

a few channels are matching multiple filenames in the regex

@jacobpwagner
I see! Thank you very much for providing me with such quick help!

@jianwu1
Copy link
Author

jianwu1 commented Feb 26, 2022

@jacobpwagner
Hi Jake,

Although I'm now able to generate a spillover matrix from single_stain_A by setting exact_match = TRUE, the spillover matrix calculated by spillover() seems a bit wrong because the diagonal values are not 1:

Screen Shot 2022-02-27 at 12 32 12 am

@jianwu1
Copy link
Author

jianwu1 commented Mar 6, 2022

I found the solution in another thread using the spillover_ng function: RGLab/flowCore#94 (comment)

It gives a spillover matrix with diagonals being 1.

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

2 participants