HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
67 stars 30 forks source link

plotExprs: Visualizing missing markers for Spectral Flow cofactor setting #340

Closed DavidRach closed 6 months ago

DavidRach commented 1 year ago

Hi, I have Spectral Flow Cytometry data from a Cytek Aurora, and I am working on setting my cofactors based on the individual channels. Thanks to your answers to previous questions I found in resolved issues, and the ?prepData cofactor documentation I have figured out most of my initial questions 👍🏻

I am currently trying via plotExprs to visualize the results to check whether the individual channel cofactor values I used are appropriate. I can visualize 24/29 colors via plotExprs(sce, color_by = ...), and I am now figuring out how to see the last 5 channels. A previous resolved thread mentioned this is likely a flow channel naming recognition issue, and suggested including FACS = TRUE within prepData. When I tried this approach, it successfully visualized all the channels, but overwrote(?) the individual cofactor changes I had specified via cofactor = cf, so I wasn't able to see if the individual cofactor values I used worked.

Upstream: fcs_colname <- colnames(FS) CBMC_panel <- data.frame(fcs_colname, antigen, marker_class, stringsAsFactors = FALSE)

1) My first attempt CBMC_panel$fcs_colname Output I get is: [1] "FSC-A" "FSC-H" "FSC-W" "SSC-A" "SSC-B-A" "SSC-B-H" "SSC-B-W" [8] "SSC-H" "SSC-W" "AF-A" "APC-A" "APC-Fire 750-A" "APC-Fire 810-A" "APC-R700-A" [15] "Alexa Fluor 647-A" "BUV395-A" "BUV496-A" "BUV563-A" "BUV615-A" "BUV661-A" "BUV737-A" [22] "BUV805-A" "BV421-A" "BV480-A" "BV510-A" "BV605-A" "BV650-A" "BV711-A" [29] "BV750-A" "BV786-A" "FITC-A" "PE-A" "PE-CF594-A" "PE-Cy5-A" "PE-Vio770-A" [36] "Pacific Blue-A" "PerCP-Cy5.5-A" "Spark 550-A" "Zombie NIR-A" "Time"

cf <- c("AF-A" = 150, "APC-A" = 1500, "APC-Fire 750-A" = 3000, "APC-Fire 810-A" = 3500, "APC-R700-A" = 4000, "Alexa Fluor 647-A" = 3500, "BUV395-A" = 3500, "BUV496-A" = 3500, "BUV563-A" = 12000, "BUV615-A" = 3500, "BUV661-A" = 4000, "BUV737-A" = 9000, "BUV805-A" = 3500, "BV421-A" = 7000, "BV480-A" = 3000, "BV510-A" = 1500, "BV605-A" = 1200, "BV650-A" = 5000, "BV711-A" = 2000, "BV750-A" = 10000, "BV786-A" = 5500, "FITC-A" = 1500, "PE-A" = 1500, "PE-CF594-A" = 3500, "PE-Cy5-A" = 2000, "PE-Vio770-A" = 3500, "Pacific Blue-A" = 3000, "PerCP-Cy5.5-A" = 3000, "Spark 550-A" = 5000, "Zombie NIR-A" = 3000)

(sce <- prepData(p2_FS, CBMC_panel, CBMC_md, transform = TRUE, cofactor = cf, md_cols = list(file = "file_name", id = "sample_id", factors = c("patient_id", "exposure_status", "sex"))))

p <- plotExprs(sce, color_by = "sex") p$facet$params$ncol <- 6 p

This is what the plot looked like: IndividualCofactors

2) Setting FACS = TRUE

(sce <- prepData(p2_FS, CBMC_panel, CBMC_md, transform = TRUE, cofactor = cf, FACS = TRUE, md_cols = list(file = "file_name", id = "sample_id", factors = c("patient_id", "exposure_status", "sex"))))

p <- plotExprs(sce, color_by = "sex") p$facet$params$ncol <- 6 p

This is what the plot looked like: FACS = TRUE

Edit: Just noticed the missing visualized channels ("AF-A", "APC-A", "FITC-A", "PE-A", "Pacific Blue-A", "Zombie NIR-A") are not being visualized in the heatmaps either, so went resolved issue searching for "missing markers". prepData has internally stored them when FACS is not set to TRUE. int_colData(sce).

So my question now, is there a way to either retrieve them individually from internal? or alternately, when FACS is set to true, still adjust individual cofactors for the channels? Closest answer I have found was #151 ,

str(sce)
sce@??? <- sce@int_colData@listData$CD16

Thanks! David

HelenaLC commented 1 year ago

Sorry for the late reply... If this is still of interest:

Hm. I am really confused by this, because the transformation happens after checking for FACS = TRUE/FALSE. If you'd want, you could try the following & see if things look as they should downstream.

HelenaLC commented 6 months ago

closing due to inactivity; please comment back if the issue persists/is still of interest.