Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotSpillmat() not plotting all channels in heatmap #204

Open
Stein-ErikG opened this issue Apr 28, 2021 · 18 comments
Open

plotSpillmat() not plotting all channels in heatmap #204

Stein-ErikG opened this issue Apr 28, 2021 · 18 comments

Comments

@Stein-ErikG
Copy link

Stein-ErikG commented Apr 28, 2021

Hi,

This is a small issue im not able to debug myself. I get a nice plot of the spillover matrix but many of the channels are missing. first time running the code, it plotted up to, and including, 157Gd (im using that channel). I then ran the code again after also including five cadmium channels. Now plotSpillmat() plotted up to and including 162. seems like ut only plots a certain number of channels counting from 141.

comp_file <- "/Users/.. compBeads1_01_1.fcs"
sce_comp <- prepData(comp_file, transform = TRUE)

Debarcode the single stained beads

bc_ms <- c(89, 111:114, 116, 141:176, 209)
sce_comp <- assignPrelim(sce_comp, bc_ms, verbose = FALSE)
sce_comp <- applyCutoffs(estCutoffs(sce_comp))

compute & extract spillover matrix

sce_comp <- computeSpillmat(sce_comp)
sm <- metadata(sce_comp)$spillover_matrix

do some sanity checks

chs <- channels(sce_comp)
ss_chs <- chs[rowData(sce_comp)$is_bc]
all(diag(sm[ss_chs, ss_chs]) == 1)
all(sm >= 0 & sm <= 1)
plotSpillmat(sce_comp)

@HelenaLC
Copy link
Owner

Could you post dimnames(sm) as well as ss_chs? Thx!

@Stein-ErikG
Copy link
Author

Stein-ErikG commented Apr 28, 2021

dimnames(sm)
[[1]]
[1] "Y89Di" "Cd111Di" "Cd112Di" "Cd113Di" "Cd114Di" "Cd116Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di"
[14] "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd157Di" "Gd158Di" "Tb159Di" "Gd160Di"
[27] "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di"
[40] "Yb174Di" "Lu175Di" "Yb176Di" "Bi209Di"

[[2]]
[1] "Y89Di" "Pd102Di" "Rh103Di" "Pd104Di" "Pd105Di" "Pd106Di" "Pd108Di" "Pd110Di" "Cd111Di" "Cd112Di" "Cd113Di" "Cd114Di" "Cd116Di"
[14] "Sn120Di" "I127Di" "Xe131Di" "Cs133Di" "Ba136Di" "Ba137Di" "Ba138Di" "La139Di" "Ce140Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di"
[27] "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd157Di"
[40] "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di"
[53] "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "Ir191Di" "Ir193Di" "Pt194Di" "Pt195Di" "Pt196Di" "Pt198Di" "Pb208Di"
[66] "Bi209Di"

ss_chs
"Y89Di" "Cd111Di" "Cd112Di" "Cd113Di" "Cd114Di" "Cd116Di" "Pr141Di" "Nd142Di" "Nd143Di"
"Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di"
"Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd157Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di"
"Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di"
"Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "Bi209Di"

Took away my channel names to keep my panel "secret" :) hehe...

@Stein-ErikG
Copy link
Author

Do you want me to send you a sample data file and the comp beads?

@HelenaLC
Copy link
Owner

HelenaLC commented May 1, 2021

I think this is not an error per se. plotSpillmat has an argument isotope_list = CATALYST::isotope_list that specifies the metal-mass pairs to consider. When using a non-standard panel (which might be the case here?), the missing pairs need to be added to isotope_list or otherwise they will not be shown. E.g.,

# get current panel
old <- CATALYST::isotope_list

# making this up
new <- list(
  Nd = c(120, 123), 
  Xy = c(111, 195)) 

# append new to old
for (i in names(new)) 
  old[[i]] <- c(old[[i]], new[[i]])
  
# visualise
plotSpillmat(..., 
  isotope_list = panel)

@Mark-Ste
Copy link

Mark-Ste commented May 5, 2021

Hi,
I have the same problem as mentioned above by @Stein-ErikG plotSpillmat plots up to channel 162. I have a custom isotope_list that includes the 190BCKG. All other isotopes used are included in the standard CATALYST isotope_list. Adding the channels like you mentioned above seems to add a replicate entry to the list that is already included but does not complete output of plotSpillmat.
Thx!

dimnames
[[1]]
[1] "Pr141Di" "Ce142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Sm149Di" "Nd150Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di"
[14] "Gd156Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Er170Di" "Yb171Di"
[27] "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Lu176Di"

[[2]]
[1] "Pd102Di" "Rh103Di" "Pd104Di" "Pd105Di" "Pd106Di" "Pd108Di" "Pd110Di" "Sn120Di" "I127Di" "Xe131Di" "Cs133Di"
[12] "Ba138Di" "Ce140Di" "Pr141Di" "Ce142Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Sm149Di"
[23] "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di"
[34] "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di"
[45] "Yb173Di" "Yb174Di" "Lu175Di" "Lu176Di" "Yb176Di" "BCKG190Di" "Ir191Di" "Ir193Di" "Pt194Di" "Pt195Di" "Pt198Di"
[56] "Pb208Di"

ss_chs
"Pr141Di" "Ce142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Sm149Di" "Nd150Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Lu176Di"

@Mark-Ste
Copy link

Mark-Ste commented May 5, 2021

just found out that the matrix is plotted correctly when all unnecessary channels are deleted (used premessa here) in combination with the standard isotope_list without changes (so no more 190BCKG and also some empty Ce and Lu channels. It is a workaround but it fixes the problem for now.

@Stein-ErikG
Copy link
Author

Nice workaround! But this wont resolve the issues for me, i need some channels in the data that i do not have compensation beads for. cisplatin staining for example:)

@nilseling
Copy link

Hi @HelenaLC
is there any plan to fix this issue? See #247 (comment)
Cheers,
Nils

@Stein-ErikG
Copy link
Author

Hi, I recently compensated some data using the same number of comp channels i had in my original post. This time the whole spillmat was printed out with no missing channels. Maybe this is the result of different preprocessing, but maybe an update has been published?

@JuliaHec
Copy link

JuliaHec commented May 9, 2022

Hi,
We are having a similar problem. We have single stained beads for 20 channels, we select those 20 channels and compute the spillover matrix for these channels. When we extract the spillover matrix from the SCE it looks fine but when we plot the spillover matrix with plotSpillmat some channels are missing. We looked a little bit into the function and it seems like the error occurs when "labs" inside the function is constructed.
Right now we are using pheatmap as workaround but it would be nice to use the plotSpillmat function again :)
Has there been any update to fix this issue?

@SoWalling
Copy link

Hi,
we also have the same issue, @JuliaHec described it well.
pheatmap works for us, but we would also like to use plotSpillmat again.
Are there any new ideas on how to fix this problem?

@HelenaLC
Copy link
Owner

@nilseling I got a prototype that should resolve all this and works a little different. Would you be willing and able to give it a try? Hard for me to test as I'm not working with this data in real life and have only tried to mess up the example data and see to that working...

@nilseling
Copy link

Hi @HelenaLC, for sure! I'm more than happy to test this :) which branch should I use? Thanks for working in this.

@HelenaLC
Copy link
Owner

HelenaLC commented Nov 18, 2022

Great, thanks! RELEASE_3_16 (on GH only; working on some other fixes before going Bioc). Happy to discuss... There's a bit of a design choice (hard to explain) regarding whether or not to include empt rows/columns. basically, a full matrix is easier to read (clear diagonal), but might give unnecessary white space (depending on the overall mass range)... And, I made a not-insignificant change that cuts out empty columns (empty = no spill) to reduce the overall width. Any feedback welcome!

@HelenaLC HelenaLC mentioned this issue Nov 18, 2022
@nilseling
Copy link

So it looks better. Thanks for fixing it.

image

However, I noticed that Y89, Pr141 appear in the rows but not in the columns. These channels were spotted/stained and also measured:

> colnames(sm)
 [1] "Ar80Di"  "Y89Di"   "In113Di" "In115Di" "Xe131Di" "Xe134Di" "Ba136Di" "La138Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di"
[14] "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di" "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di"
[27] "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di" "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di"
[40] "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di" "Ir191Di" "Ir193Di" "Pt196Di" "Pb206Di"
> rownames(sm)
 [1] "Y89Di"   "In113Di" "In115Di" "Pr141Di" "Nd142Di" "Nd143Di" "Nd144Di" "Nd145Di" "Nd146Di" "Sm147Di" "Nd148Di" "Sm149Di" "Nd150Di"
[14] "Eu151Di" "Sm152Di" "Eu153Di" "Sm154Di" "Gd155Di" "Gd156Di" "Gd158Di" "Tb159Di" "Gd160Di" "Dy161Di" "Dy162Di" "Dy163Di" "Dy164Di"
[27] "Ho165Di" "Er166Di" "Er167Di" "Er168Di" "Tm169Di" "Er170Di" "Yb171Di" "Yb172Di" "Yb173Di" "Yb174Di" "Lu175Di" "Yb176Di"

The previous visualization looked like this:

image

I believe the issue comes from the fact that there was no spillover detected between these and any other channels. In the best case I would say to visualize all channels that are in the spillover matrix.

@HelenaLC
Copy link
Owner

I see. Could you share the object with me? Should be an easy fix.

@nilseling
Copy link

Super sorry for the late reply. I now attach the spillover matrix.

sm.csv

@LukaTandaric
Copy link

Hi @HelenaLC, has there been any progress in enabling the plotSpillmap function to plot all channels present in the data? Currently, I am missing everything above 175Lu (I have 176Yb, all four platinums, and 209Bi).

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants