BodenmillerGroup / IMCDataAnalysis

R based workflow for multiplexed imaging data
https://bodenmillergroup.github.io/IMCDataAnalysis/
MIT License
29 stars 11 forks source link

Spillover Correction #41

Closed rahilgholami closed 1 year ago

rahilgholami commented 1 year ago

Hi,

In Spillover correction when I run the following command plotSpillmat(sce, isotope_list = isotope_list)

I get this error Error in .check_sm(sm, isotope_list) : The supplied spillover matrix seems to be invalid. All isotopes should appear in isotope_list

I checked that all the metal names from my rownames(sce) are included in isotope_list except BCKG190 and ArAr80. I manually added them: isotope_list <- c(CATALYST::isotope_list, list(BCKG=190, ArAr=80))

but still I am getting the same error.

Do you know what can cause this error or what I'm possibly doing wrong?

Best, Rahil

nilseling commented 1 year ago

Hi @rahilgholami

could you please post the full output of rowData(sce), rownames(metadata(sce)$spillover_matrix) and colnames(metadata(sce)$spillover_matrix) here? I forgot what CATALYST uses for matching the names but there should be a disagreement somewhere in these entries.

rahilgholami commented 1 year ago

rowData(sce)$channel_name is

"Ar80Di" "Y89Di" "Cd112Di" "In113Di" "In115Di" "Cd116Di" "Te120Di" "Te122Di" "Te123Di" "Te124Di" "Te125Di" "Te126Di" "I127Di" "Te128Di" "Te130Di" "Xe131Di" "Xe134Di" "Ba138Di" "La139Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "G190Di" "Ir191Di" "Ir193Di" "Pt195Di" "Pt196Di" "Pt198Di" "Pb208Di"

not all channels are used, output of rowData(sce)$channel_name[rowData(sce)$is_bc] matches rownames(metadata(sce)$spillover_matrix).

and rownames(metadata(sce)$spillover_matrix) is

"Y89Di" "In115Di" "La139Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "Pt195Di" "Pt196Di" "Pt198Di"

and colnames(metadata(sce)$spillover_matrix) is

"Ar80Di" "Y89Di" "Cd112Di" "In113Di" "In115Di" "Cd116Di" "Te120Di" "Te122Di" "Te123Di" "Te124Di" "Te125Di" "Te126Di" "I127Di" "Te128Di" "Te130Di" "Xe131Di" "Xe134Di" "Ba138Di" "La139Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "G190Di" "Ir191Di" "Ir193Di" "Pt195Di" "Pt196Di" "Pt198Di" "Pb208Di"

nilseling commented 1 year ago

Looking at CATALYST::isotope_list I don't see isotope_list$G. So this together with Ar needs to be added:

isotope_list <- c(CATALYST::isotope_list, list(G=190, Ar=80))

Does this work? Could be that there are other metals missing.

rahilgholami commented 1 year ago

I was missing G! it's working now. Thank you!

nilseling commented 1 year ago

Perfect! Closing now