HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
67 stars 30 forks source link

Filter cells based on expression #258

Closed bioguy2018 closed 2 years ago

bioguy2018 commented 2 years ago

Dear Helena, Is there a method to filter out cells with specific expression values within Catalyst? the filterSCE() did not help in this case or maybe I couldn't make it work.

Thank you so much!

HelenaLC commented 2 years ago

You can use basic SingleCellExperiment operations for this, nothing CATALYST-specific. E.g., (here, rows = features, columns = observations)

y <- exprs(sce) # get expression matrix
i <- y["CDX", ] >= 0.1 # find cells with CDX expression of at least 0.1
sub <- sce[, i] # subset the object
bioguy2018 commented 2 years ago

Dear Helena, Thanks a lot for your answer! is exprs() provided by SingleCellExperiment ? I have v1.16.0 but this function is not within the package. So I am not so sure but anyway I accessed the Matrix using another method! Thanks a lot again!

HelenaLC commented 2 years ago

if you print the sce, which assays do you see are available? You can access an assay of choice via assay(sce, assayName). (I’d recommend looking up the SCE class for such basic operations)

bioguy2018 commented 2 years ago

Dear Helena, Thanks for the info! sometimes I still think of the old structure which we had daf instead of sce! 😄 The new sce has made it much more felixble! Thank you However, I have come to a confusion! There is a differnece when I run filterSCE(sce[,assay(sce,"exprs")["marker",]>=5] and when I do not specify the exprs explicitly! I thought the default assay is anyway exprs so I am surprised! what does the filterSCE() actually filter then when I do not provide the slot??

p.s. by difference I mean the number of filtered cells!

HelenaLC commented 2 years ago

You mean there's a difference between i) assay(sce) and ii) assay(sce, "exprs")? If yes, that's of course to be expected because i) accesses the 1st available assay (here, ion counts), while ii) uses the transformed data (exprs).