HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
66 stars 31 forks source link

problem with preprocessing and normalization! #405

Closed yamihn closed 1 month ago

yamihn commented 2 months ago

Hi, when I run normCytof with the following command:


 res <- normCytof(sce, beads = "dvs", k = 37, dna= c(191, 193),
+                  assays = c("counts", "exprs"), overwrite = FALSE)
Identifying beads...
Computing normalization factors...
Warning messages:
1: In min(y[, dna_chs[1]]) :
  no non-missing arguments to min; returning Inf
2: In max(y[, dna_chs[1]]) :
  no non-missing arguments to max; returning -Inf

Can you help me? what does the message mean?

HelenaLC commented 2 months ago

R the specified dna_chs in ur data? Else u need to specify which are.

yamihn commented 2 months ago

In my data I see Intercalator-Ir Ir191Di Intercalator-Ir Intercalator-Ir.1 Ir193Di Intercalator-Ir

So which I have to specify? It only accepts vectors. I'm sorry I am a newbie in Cytof. moreover, is it normal my output?

plot smoothed bead intensities

Screenshot from 2024-09-26 13-46-23

HelenaLC commented 1 month ago

Hm, no, it shouldn't look like this. Could you perhaps print data.frame(rowData(sce))?

yamihn commented 1 month ago

Sure..

> data.frame(rowData(sce))
                  channel_name     marker_name marker_class use_channel
80ArAr                ArAr80Di          80ArAr         none       FALSE
88Sr                    Sr88Di            88Sr         none       FALSE
CD45                     Y89Di            CD45        state        TRUE
Barcode                Pd102Di         Barcode        state        TRUE
live_dead              Rh103Di       live_dead         none       FALSE
Barcode.1              Pd104Di         Barcode        state        TRUE
Barcode.2              Pd105Di         Barcode        state        TRUE
Barcode.3              Pd106Di         Barcode        state        TRUE
Barcode.4              Pd108Di         Barcode        state        TRUE
Barcode.5              Pd110Di         Barcode        state        TRUE
111Cd                  Cd111Di           111Cd         none       FALSE
112Cd                  Cd112Di           112Cd         none       FALSE
CD69                   Cd113Di            CD69        state        TRUE
114Cd                  Cd114Di           114Cd         none       FALSE
115In                  In115Di           115In         none       FALSE
116Cd                  Cd116Di           116Cd         none       FALSE
120Sn                  Sn120Di           120Sn         none       FALSE
127I                    I127Di            127I         none       FALSE
131Xe                  Xe131Di           131Xe         none       FALSE
134Ba                  Ba134Di           134Ba         none       FALSE
138Ba                  Ba138Di           138Ba         none       FALSE
EQ_Bead                Ce140Di         EQ_Bead         none       FALSE
CCR6                   Pr141Di            CCR6        state        TRUE
CD19                   Nd142Di            CD19        state        TRUE
CD314                  Nd143Di           CD314        state        TRUE
IL-4                   Nd144Di            IL-4        state        TRUE
CD163                  Nd145Di           CD163        state        TRUE
CD8a                   Nd146Di            CD8a        state        TRUE
b-catenin              Sm147Di       b-catenin        state        TRUE
ICOS                   Nd148Di            ICOS        state        TRUE
CTLA-4                 Sm149Di          CTLA-4        state        TRUE
CD134                  Nd150Di           CD134        state        TRUE
Notch1                 Eu151Di          Notch1        state        TRUE
152Sm                  Sm152Di           152Sm         none       FALSE
CD62L                  Eu153Di           CD62L        state        TRUE
Notch3                 Sm154Di          Notch3        state        TRUE
GITR                   Gd155Di            GITR        state        TRUE
CCR5                   Gd156Di            CCR5        state        TRUE
157Gd                  Gd157Di           157Gd         none       FALSE
IFNg                   Gd158Di            IFNg        state        TRUE
CD337                  Tb159Di           CD337        state        TRUE
CD14                   Gd160Di            CD14        state        TRUE
CXCR3                  Dy161Di           CXCR3        state        TRUE
FoxP3                  Dy162Di           FoxP3        state        TRUE
CRTH2                  Dy163Di           CRTH2        state        TRUE
IL-17A                 Dy164Di          IL-17A        state        TRUE
Notch2                 Ho165Di          Notch2        state        TRUE
IL-10                  Er166Di           IL-10        state        TRUE
Notch4                 Er167Di          Notch4        state        TRUE
CD206                  Er168Di           CD206        state        TRUE
IL-13                  Tm169Di           IL-13        state        TRUE
CD3                    Er170Di             CD3        state        TRUE
CD68                   Yb171Di            CD68        state        TRUE
PD-1                   Yb172Di            PD-1        state        TRUE
CXCR4                  Yb173Di           CXCR4        state        TRUE
CD4                    Yb174Di             CD4        state        TRUE
CD223_LAG-3            Lu175Di     CD223_LAG-3        state        TRUE
176Yb                  Yb176Di           176Yb         none       FALSE
188Os                  Os188Di           188Os         none       FALSE
189Os                  Os189Di           189Os         none       FALSE
190BCKG              BCKG190Di         190BCKG         none       FALSE
Intercalator-Ir        Ir191Di Intercalator-Ir        state        TRUE
Intercalator-Ir.1      Ir193Di Intercalator-Ir        state        TRUE
194Pt                  Pt194Di           194Pt         none       FALSE
195Pt                  Pt195Di           195Pt         none       FALSE
196Pt                  Pt196Di           196Pt         none       FALSE
198Pt                  Pt198Di           198Pt         none       FALSE
208Pb                  Pb208Di           208Pb         none       FALSE
CD16                   Bi209Di            CD16        state        TRUE

res <- normCytof(sce, beads = "dvs", k = 37,
+                  assays = c("counts", "exprs"), overwrite = FALSE)
Identifying beads...
Computing normalization factors...
Warning messages:
1: In min(y[, dna_chs[1]]) :
  no non-missing arguments to min; returning Inf
2: In max(y[, dna_chs[1]]) :
  no non-missing arguments to max; returning -Inf
> # check number & percentage of bead / removed events
> n <- ncol(sce); ns <- c(ncol(res$beads), ncol(res$removed))
> data.frame(
+   check.names = FALSE, 
+   "#" = c(ns[1], ns[2]), 
+   "%" = 100*c(ns[1]/n, ns[2]/n),
+   row.names = c("beads", "removed"))
          #            %
beads    37 0.0009861938
removed 977 0.0260408476
HelenaLC commented 1 month ago

Hm... could you (please) also do...

chs <- channels(sce)
print(chs)
CATALYST:::.get_dna_cols(chs, c(191, 193))

Alternatively, the issue could lie in failure to properly identify beads. Can you post the res$scatter plot? Curious what that looks like. It's not obvious to me yet what's going wrong.

yamihn commented 1 month ago

is it possible that beads have already been removed?

chs <- channels(sce)
> print(chs)
         80ArAr            88Sr            CD45         Barcode       live_dead         Barcode         Barcode         Barcode 
     "ArAr80Di"        "Sr88Di"         "Y89Di"       "Pd102Di"       "Rh103Di"       "Pd104Di"       "Pd105Di"       "Pd106Di" 
        Barcode         Barcode           111Cd           112Cd            CD69           114Cd           115In           116Cd 
      "Pd108Di"       "Pd110Di"       "Cd111Di"       "Cd112Di"       "Cd113Di"       "Cd114Di"       "In115Di"       "Cd116Di" 
          120Sn            127I           131Xe           134Ba           138Ba         EQ_Bead            CCR6            CD19 
      "Sn120Di"        "I127Di"       "Xe131Di"       "Ba134Di"       "Ba138Di"       "Ce140Di"       "Pr141Di"       "Nd142Di" 
          CD314            IL-4           CD163            CD8a       b-catenin            ICOS          CTLA-4           CD134 
      "Nd143Di"       "Nd144Di"       "Nd145Di"       "Nd146Di"       "Sm147Di"       "Nd148Di"       "Sm149Di"       "Nd150Di" 
         Notch1           152Sm           CD62L          Notch3            GITR            CCR5           157Gd            IFNg 
      "Eu151Di"       "Sm152Di"       "Eu153Di"       "Sm154Di"       "Gd155Di"       "Gd156Di"       "Gd157Di"       "Gd158Di" 
          CD337            CD14           CXCR3           FoxP3           CRTH2          IL-17A          Notch2           IL-10 
      "Tb159Di"       "Gd160Di"       "Dy161Di"       "Dy162Di"       "Dy163Di"       "Dy164Di"       "Ho165Di"       "Er166Di" 
         Notch4           CD206           IL-13             CD3            CD68            PD-1           CXCR4             CD4 
      "Er167Di"       "Er168Di"       "Tm169Di"       "Er170Di"       "Yb171Di"       "Yb172Di"       "Yb173Di"       "Yb174Di" 
    CD223_LAG-3           176Yb           188Os           189Os         190BCKG Intercalator-Ir Intercalator-Ir           194Pt 
      "Lu175Di"       "Yb176Di"       "Os188Di"       "Os189Di"     "BCKG190Di"       "Ir191Di"       "Ir193Di"       "Pt194Di" 
          195Pt           196Pt           198Pt           208Pb            CD16 
      "Pt195Di"       "Pt196Di"       "Pt198Di"       "Pb208Di"       "Bi209Di" 
> CATALYST:::.get_dna_cols(chs, c(191, 193))
[1] 62 63

image

HelenaLC commented 1 month ago

Yes, it looks like there are none, which would explain failure to do the normalization ... if you look at the vignette, there should be a population that is DNA- and bead+, which is missing here.

yamihn commented 1 month ago

ok, so can we say that data have been normalized? I received these data and I don't know if normalization has been applied on them. Could you please suggest me a way to check if data is/isn't already normalized?

HelenaLC commented 1 month ago

Hard to tell without beads. One would typically inspect bead signal over time; beads aren't multiplexed, so the signal time-drift is clear there. Since beads appear to be gone in your data, I would assume some preprocessing has been done already. But:

You should most definitely ask your collaborates/source - Have the data been normalized? If not, what happened to the beads? Has any other type of filtering or preprocessing been done? E.g., have the data already been normalized? It's important to know the answer to all of these Qs to assure accurate analysis and reproducibility (for any type of data you receive).

Closing the issue now as this doesn't seem to be anything software related.