DillonHammill / CytoExploreR

Interactive Cytometry Data Analysis
60 stars 13 forks source link

It is possible extract the gated value to a csv? #139

Closed ChenJiuu closed 2 years ago

ChenJiuu commented 2 years ago

I want to extract the gated population(or events) of 100 files(may be to a csv file?) but don't know how to do it.

image

I'm now copying and pasting every value but very erratic.

Is there a convenient way to do that?

DillonHammill commented 2 years ago

Are you after the statistics or the events?

DillonHammill commented 2 years ago
cyto_stats_compute(gs, 
     parent = "Live Cells",
     alias = c("T Cells","B Cells"), 
     stat = "freq",
     save_as = "stats.csv"
)
ChenJiuu commented 2 years ago

Hi Dillon, Thank you for your reply and your solution! I found the Export Statistics section and I’m still exploring it. By the way, thanks for the package, It saved me tons of time.

simonuoft commented 2 years ago

Hi, I have a follow up question on that. Is it possible to extract all the gated events as a csv file (or a data frame) with basically one line per cells and each column being a different marker ? Thanks in advance

DillonHammill commented 2 years ago

There are some better APIs coming for this, but you can use cyto_extract() with raw =TRUE to pull out the events for each sample into a list. You can then loop through the list and write the data to CSV files.

raw <- cyto_extract(
    gs, 
    parent = "T Cells", 
    raw = TRUE
)
raw
raw[[1]]
simonuoft commented 2 years ago

Perfect that's exactly what i was looking for. Thanks