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

Question: Is it possible to reverse the scaling done by vst()? #122

Open
TeodoraTockovska opened this issue Jan 6, 2022 · 4 comments
Open

Comments

@TeodoraTockovska
Copy link

I understand that vst() performs normalization, transformation, and scaling as it replaces a few functions in the Seurat workflow for normalizing data. Is it possible to reverse the scaling?

@saketkc
Copy link
Contributor

saketkc commented Jan 7, 2022

Hi @TeodoraTockovska, while in principle you can reverse the regression model, there are caveats. Can you elaborate on your use case?

@TeodoraTockovska
Copy link
Author

TeodoraTockovska commented Jan 7, 2022

Hi @saketkc, thanks for getting back to me.

I am trying to compare normalization techniques using Single Cell Overview of Normalized Expression (SCONE, R package tool) in which the user provides normalization functions (without scaling) such that the SCONE algorithm can run several metrics to assess the qualities of normalization. The user-defined functions are required to only normalize expression data as SCONE performs its own scaling.

I ran into errors when I tried to create a user-defined function using vst() so I was wondering if it is possible to reverse the scaling so that I can incorporate it into the SCONE algorithm.

@saketkc
Copy link
Contributor

saketkc commented Jan 7, 2022

I see. The pearson residuals that are returned are not scaled, so you should be able to use them as it is, unless I ams misunderstanding the interpretation of scaling here.

@TeodoraTockovska
Copy link
Author

TeodoraTockovska commented Jan 7, 2022

I see. The pearson residuals that are returned are not scaled, so you should be able to use them as it is, unless I ams misunderstanding the interpretation of scaling here.

Hm, that is interesting. I will investigate this more to try to figure out the issue. Just in case you need it, below, I provided some extra information on the function and the errors.

The user-defined function is simple:

SCT_VST_FN <- function(expression_data){
  return(sctransform::vst(expression_data)$y)
}

This is the error I get when running SCONE using SCT_VST_FN(). I believe it is due to the scaling on the normalized matrix. I don't receive this error from any other method that I use. I don't receive this error when running SCT_VST_FN() on my expression data outside of SCONE.

Error: BiocParallel errors
  element index: 2, 3, 4, 5, 6
  first error: NA/Inf/NaN Expression Values.

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

No branches or pull requests

2 participants