DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

cyto_extract() leads to different number of row after converting to a data.frame #160

Closed kim619 closed 1 year ago

kim619 commented 1 year ago

Hi, I want to follow up how to extract the raw data from the gated population, I tried the following codes:

`> GFP_RFP_Px<-cyto_extract(gs1, "R6 GFP+RFP Px_2",select="05-Well-A5.fcs",raw=TRUE)
> write.table(GFP_RFP_Px,file="GFP_RFP_Px.csv")
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 47055, 361045, 95485, 698, 60, 57, 146650, 16, 2415, 10, 186, 2070, 3403, 10139, 9960, 80, 26, 70, 164, 50, 7556, 133, 146, 7404, 1`

I understood that it is the different lengths of the columns leading to this error, though I don't know how to make all of them the same length. Thanks in advance!

DillonHammill commented 1 year ago

I think cyto_extract() returns a list of matrices - one per sample in the GatingSet. You need to loop through them to write each one to a CSV file. Otherwise use [[ to get the matrix from a single sample and then write that to a CSV.

Check the output of str() on your stats object.

kim619 commented 1 year ago

It works now! Thanks for the quick response as always :)