RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
75 stars 29 forks source link

Get error message while using openCyto:::.flowClust.2d #237

Open hsiuhong1 opened 2 years ago

hsiuhong1 commented 2 years ago

I am able to use the followings:

openCyto:::.mindensity rectangleGate openCyto:::.singletGate openCyto:::.boundary

When I tried to use openCyto:::.flowClust.2d, I got the following error message: Error in as.character.default(x) : no method for coercing this S4 class to a vector

mikejiang commented 2 years ago

These are internal private APIs not meant to be used directly by the end user. Try to always stick with public exported version of these functions, that is gate _*

hsiuhong1 commented 2 years ago

Hi Mike,

I still got the same error message.

Below is the code: chn5 <- c("APC-H7-A", "SSC-A") gmonocyte <- gate_flowclust_2d(fs_Offaxis, channels = chn5, K = 1, target = c(2.5e5,5e4), quantile = 0.95)

Error message: Error in as.character.default(x) : no method for coercing this S4 class to a vector

I can provide the full script if it is needed.

Many thanks for your help.

Siu-hong

mikejiang commented 2 years ago

Please take a look at the documentation of this API ?openCyto::gate_flowclust_2d, it takes a flowframe and xChannel, yChannel as input

hsiuhong1 commented 2 years ago

Hi Mike,

Thanks.

I am able to apply the gate_flowclust_2d to a flowframe. However, if I apply it to the flowset, I got the same error message.

For the flowset I used, it is originally a cytoset. I use the function cytoset_to_flowSet to convert the cytoset to flowset.

Any insight is appreciated.

Thanks.

Siu-hong

mikejiang commented 2 years ago

Again, these gating functions only work with a single flowframe, if you want to work with flowset, you have to write a loop through the flowset, within the loop, extract flowframe from the flowset, then you can apply the function there, Actually you don't even need to convert to flowset,Just loop through cytoset directly for example

gates=lapply(sampleNames(cs), function(sn){
    cf = cs[[sn]]
    fr = cytoframe_to_flowFrame(cf)
    gate_flowclust_2d(fr,"APC-H7-A", "SSC-A",  K = 1, target = c(2.5e5,5e4), quantile = 0.95)
    })
hsiuhong1 commented 2 years ago

Thanks, I am able to get through it.