HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
66 stars 30 forks source link

How to use CATALYST::plotAbundances to plot cluster's abundance at certain metaclustering? #367

Closed denvercal1234GitHub closed 11 months ago

denvercal1234GitHub commented 11 months ago

Hi,

I wanted to plot the cell number per cluster for metaclustering k="meta16" (without any separation of conditions), but the CATALYST::plotAbundances always group all 100 FlowSOM codes.

Would you mind giving me some pointers?

Thank you.

CATALYST::plotAbundances(F37_sce_backboneClustering, by = "cluster_id", group_by = "cluster_id", k = "meta16")
Screenshot 2023-08-22 at 09 14 30
> names(colData(F37_sce_backboneClustering))
[1] "sample_id"                      "cell_count_prePeacoQC"          "cell_count_postPeacoQC"        
[4] "manualInspect_strangeFCS"       "preFilter_liveCD3CD8_count"     "flowJo_prePeacoQC_gMFI_PE"     
[7] "flowCore_postPeacoQC_medMFI_PE" "cluster_id"  

> F37_sce_backboneClustering
class: SingleCellExperiment 
dim: 270 4955453 
metadata(5): experiment_info chs_by_fcs cluster_codes SOM_codes delta_area
assays(1): exprs
rownames(270): FSC.A FSC.H ... FlowSOM_cluster_backbone24 FlowSOM_metacluster_backbone24
rowData names(4): channel_name marker_name marker_class used_for_clustering
colnames: NULL
colData names(8): sample_id cell_count_prePeacoQC ... flowCore_postPeacoQC_medMFI_PE cluster_id
reducedDimNames(2): UMAP TSNE
mainExpName: NULL
altExpNames(0):
HelenaLC commented 11 months ago

cluster_id in the colData corresponds to the 100 SOM clusters, and you’re passing this to group_by; dropping/changing that should fix this.

Please check the function documentation and examples or see the package vignette before posting issues, a lot of work went into these and they provide a lot of information- thanks!

denvercal1234GitHub commented 11 months ago

Hi @HelenaLC - Thanks for the response.

I did check the documentation, examples, and the vignette; but it is not clear how to apply CATALYST::plotAbundances for plotting cells per a metaclustering after doing clustering. Specifically, shouldn't the k="meta16" already take care of specifying which SOM code to use?

And, the function CATALYST::plotAbundances requires me to set group_by to some value in names(colData(F37_sce_backboneClustering)), but I simply want to plot how many cells per a given metacluster, and setting group_by=NULL threw an error.

HelenaLC commented 11 months ago

Well, you need to group by something to compute cluster abundances, eg, sample or condition. If you just want the number/proportion of cells per metaclusters you should use base R table(cluster_ids(…)) or plotCounts()