HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
66 stars 31 forks source link

Error in GetChannels(fsom, colsToUse) : #289

Closed Adoale closed 1 year ago

Adoale commented 2 years ago

Hello,

This is my first time posting an issue and new to coding, so if I am missing some data to explain the whole problem, please let me know.

I am following the CyTOF workflow: differential discovery in high-throughput high-dimensional cytometry datasets. https://bioconductor.org/packages/release/workflows/vignettes/cytofWorkflow/inst/doc/cytofWorkflow.html#cluster-merging-and-annotation

I have imported the FCS files into a flowset using:

fcs_raw_flow <- read.flowSet(Flow_meta_import$file_name, transformation = FALSE,
                            truncate_max_range = FALSE)

sce_flow <- prepData(fcs_raw_flow, panel_flow, Flow_met, features = panel_flow$fcs_colname, FACS = TRUE, transform=FALSE)
assayNames(sce_flow) <- "exprs"

sce_flow <- cluster(sce_flow, features = "type",
    xdim = 10, ydim = 10, maxK = 20, seed = 1234)

Output:

Error in GetChannels(fsom, colsToUse) : 
  Marker ^\QCAR-T \E$ could not be found

Is there anyway I can check why the marker cannot be found and fix it?

thank you

HelenaLC commented 2 years ago

Before digging deeper, could you try calling prepData directly on the FCS files? I.e., prepData(Flow_meta_import$file_name. ...). By default, transformation = FALSE and truncate_max_range = FALSE.

Adoale commented 2 years ago

Hello Helena,

Thank you for the response. I made the FCS file as a flow set .The SCE always gets made, the issue is when I apply the cluster.

fs<- read.flowSet("/Activation Panel-5-17-A2_Unmixed.fcs", transformation = FALSE,
                  truncate_max_range = FALSE)
sce_Flow_data <- prepData(
  x = fs,
  panel = panel_flow,
  FACS = TRUE,
  features = NULL
)

sce_Flow_data <- cluster(sce_Flow_data, features = "type",
                      xdim = 10, ydim = 10, maxK = 20, seed = 1234)

Output

o running FlowSOM clustering...
Error in GetChannels(fsom, colsToUse) : 
  Marker ^\QCAR-T \E$ could not be found
> 

thank you

HelenaLC commented 2 years ago
  1. What I had suggested in my comment above was to call prepData on the FCS file directly, i.e., not using flowSET, i.e.:
    
    # something like this: 
    fcs <- "/Activation Panel-5-17-A2_Unmixed.fcs"
    sce <- prepData(
    x = fcs,
    panel = panel_flow,
    FACS = TRUE,
    features = NULL)

not this:

fs <- ... sce <- prepData( x = fs, ...)



2. Could you post the output of `rowData(sce)` prior to calling `cluster`? From the error above, it looks like something could be off with the parsing of the channel names. Perhaps this needs manual fixing in the SCE if reading in the FCS files doesn't work as expected.
Adoale commented 2 years ago

Hi Helena, using that code makes an sce without an issue.

I tried using the clustering again and got the same error message:

"o running FlowSOM clustering...
Error in GetChannels(fsom, colsToUse) : 
  Marker ^\QCAR-T \E$ could not be found"

And for the sce:

sce <- prepData(
  x = fcs,
  panel = panel_flow,
  FACS = TRUE,
  features = NULL)

sce

Output

class: SingleCellExperiment 
dim: 48 575792 
metadata(2): experiment_info chs_by_fcs
assays(2): counts exprs
rownames(48): FSC-A  FSC-W  ... CD16  CD25 
rowData names(3): channel_name marker_name marker_class
colnames: NULL
colData names(1): sample_id
reducedDimNames(0):
mainExpName: NULL
altExpNames(0):"

and the rowdata output is

> (rowData(sce))

Output:

DataFrame with 48 rows and 3 columns
               channel_name marker_name marker_class
                <character> <character>     <factor>
FSC-A                 FSC-A      FSC-A          none
FSC-W                 FSC-W      FSC-W          none
FSC-H                 FSC-H      FSC-H          none
SSC-A                 SSC-A      SSC-A          none
SSC-W                 SSC-W      SSC-W          none
...                     ...         ...          ...
CD14   NovaFlour Blue 660-A       CD14         type 
KLRG1     SuperBright 780-A      KLRG1         state
CD39          PE-Fire-810-A       CD39         type 
CD16     NovaFluorRed 685-A       CD16         type 
CD25                RY586-A       CD25         state"

the list of the marker name has the value it states is not present:

> y[[1]]@listData[["marker_name"]]

Output:


 [1] "FSC-A "     "FSC-W "     "FSC-H "     "SSC-A "     "SSC-W "     "SSC-H "     "CD154 "     "PD-1"      
 [9] "Time "      "TIGIT "     "CAR-T "     "CD11c "     "OX-40"      "CD11b "     "CCR7 "      "CD226 "    
[17] "ICOS "      "CD69 "      "CD200 "     "CD28 "      "CD8 "       "CD127 "     "CD57 "      "CD27 "     
[25] "TCR gd "    "CD1c "      "CD123 "     "4-1bb "     "CD66b "     "CD20 "      "Tim-3 "     "SSC-B-W "  
[33] "SSC-B-H "   "SSC-B-A "   "CD4 "       "Live Dead " "CD45RA "    "HLADR "     "CD3 "       "CD56 "     
[41] "CD38 "      "CD45 "      "CD19 "      "CD14 "      "KLRG1 "     "CD39 "      "CD16 "      "CD25 "  

thank you

HelenaLC commented 2 years ago

Yeah. Can't see "QCAR-T" anywhere... can you post data.frame(rowData(sce)) so we can see the complete metadata? Thanks.

General comment: please wrap in-line code with back-tricks, and code chunks between 3x back-ticks on the top and bottom. This will display things much nicer and make things a lot easier to read.

HelenaLC commented 2 years ago

Any news on this?

Adoale commented 2 years ago

Hello Helena,

It still does not let me:

data.frame(rowData(sce))

Output: " channel_name marker_name marker_class FSC-A FSC-A FSC-A none FSC-W FSC-W FSC-W none FSC-H FSC-H FSC-H none SSC-A SSC-A SSC-A none SSC-W SSC-W SSC-W none SSC-H SSC-H SSC-H none CD154 PE-A CD154 state PD-1 PE-Cy7-A PD-1 state Time Time Time none TIGIT APC-A TIGIT state CAR-T FITC-A CAR-T type CD11c Alexa Fluor 700-A CD11c type OX-40 PE-Cy5-A OX-40 state CD11b PerCP-A CD11b type CCR7 BV421-A CCR7 type CD226 BV605-A CD226 type ICOS BV510-A ICOS state CD69 BV650-A CD69 state CD200 BV711-A CD200 state CD28 BUV737-A CD28 state CD8 BUV496-A CD8 type CD127 PE-Cy5.5-A CD127 type CD57 PerCP-Cy5.5-A CD57 state CD27 BV570-A CD27 type TCR gd PerCP-eFluor 710-A TCR gd type CD1c Super Bright 436-A CD1c type CD123 eFluor 450-A CD123 type 4-1bb APC-Fire 750-A 4-1bb state CD66b PE-Dazzle594-A CD66b type CD20 BV480-A CD20 type Tim-3 BV750-A Tim-3 state SSC-B-W SSC-B-W SSC-B-W none SSC-B-H SSC-B-H SSC-B-H none SSC-B-A SSC-B-A SSC-B-A none CD4 BUV395-A CD4 type Live Dead LIVE DEAD Blue-A Live Dead none CD45RA BUV563-A CD45RA type HLADR BUV661-A HLADR state CD3 BUV805-A CD3 type CD56 BUV615-A CD56 type CD38 APC-Fire 810-A CD38 state CD45 NovaFlour Blue 585-A CD45 type CD19 NovaFlour Blue 610-A CD19 type CD14 NovaFlour Blue 660-A CD14 type KLRG1 SuperBright 780-A KLRG1 state CD39 PE-Fire-810-A CD39 type CD16 NovaFluorRed 685-A CD16 type CD25 RY586-A CD25 state"

I resorted to using older iterations of this that didn't require an sce object but it is much harder to work with.

On Thu, Sep 29, 2022 at 8:46 AM Helena L. Crowell @.***> wrote:

Any news on this?

— Reply to this email directly, view it on GitHub https://github.com/HelenaLC/CATALYST/issues/289#issuecomment-1262226566, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ6ZNWH6E6EGH67RRRVZODDWAWFRVANCNFSM526LTNYA . You are receiving this because you authored the thread.Message ID: @.***>

HelenaLC commented 2 years ago

Again, please wrap in-line code with back-tricks, and code chunks between 3x back-ticks on the top and bottom. This will display code in a legible way and enable to me to understand it (without pain). In the above, there is an opening back-tick that breaks the formatting. You can always use edit to fix this, even after posting an issue/comment, if you notice something's off. Thanks.

Hm, this is rather curious. I don't see anything close to "QCAR-T". Would you happen to have an idea if "QCAR-T" (or similar) is a "thing" in FACS? I'm just wondering if this is a very strange and confusing R-issue messing up a string, or if "QCAR-T" actually comes from the data somewhere?

SamGG commented 2 years ago

@Adoale A clean presentation eases the reading. I would encourage you to improve the previous post. @HelenaLC I saw CAR-T, in the channels list. \Q and \E are part of the regex. GetChannels() is a function of FlowSOM not CATALYST. It is called when clustering as stated in the 1st post. I didn't investigate further.

SamGG commented 2 years ago

@Adoale Which version of FlowSOM are you running? packageVersion("FlowSOM") There are changes in GetChannels() recently, but I don't think it applies to your case. It seems that most of marker names end with a space character " ", which is nearly invisible. FlowSOM is looking for "CAR-T ". I don't know if there is some string trimming at some place.

Adoale commented 2 years ago

@HelenaLC I'm so sorry, I edited all my previous posts and thank you so much for helping with the formatting and in general! I don't know why it adds the /Q to the channel name. I don't have anything that has the /Q in the channel name. I have even edited the files and the Panel_Flow excel sheet to show be named QCAR-T and I actually get the same error message saying "/QQCAR-T" I'm not sure where the addition of that character is coming from. I do not get the error with CyTOF files.

@SamGG I am using FlowSom version ‘2.4.0’ I have tried eliminating any blank spaces in the excel files. Is there any other cleanup step that is recommended after the read.flowSet() or after the prepData() step?

thank you so much for the help guys!

HelenaLC commented 1 year ago

I'm really sorry, but it's hard to give advice when I can't understand/reproduce what might be the issue...

The only thing that seems a little "off" is that there are superfluous spaces in each marker name (according to your post from Aug. 11, '22). This would kind of fit the Marker ^\QCAR-T \E$ could not be found" error, although it's not clear why precisely that maker is at fault (perhaps it's the 1st 'type' marker in the panel)?

If you are still keen on trying, I'd be happy to have a look if you'd be willing to share the panel and 1 FCS file via email or something... Else, if the issue has been resolved or is no-longer of interest, please close it.

HelenaLC commented 1 year ago

Closing as this seems to be resolved/no longer of interest? Feel free to reopen/continue the discussion. If so, please try and provide relevant and readable output/information in the future, thanks!