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

sequencing depth normalization #422

Closed
Fougere87 opened this issue Apr 18, 2018 · 9 comments
Closed

sequencing depth normalization #422

Fougere87 opened this issue Apr 18, 2018 · 9 comments

Comments

@Fougere87
Copy link

Hello,
I was reading your paper about cortical inhibitory interneurons https://www.nature.com/articles/nature25999 and I was wondering how you performed your normalization on sequencing depth of each cell using the theta overdispersion parameter.
Will this feature be integrated in Seurat ? I would be interested to test it on our data but I'm not sure how to get the theta parameter.
Thanks a lot !
Best regards

@leonfodoulian
Copy link
Contributor

Hi,

Please refer to issue #268.

Best,
Leon

@Fougere87
Copy link
Author

Fougere87 commented Apr 18, 2018

Hi,
Already read this thread, but the function RegressOutNBreg is masked in the package (v2.3) I don't know why... although it is accessible with three semi colon. I can find the code here but I don't know how to regress out reads number+nGene/nUMI as latent vars in input are strings and not formulas...
When I run it on my read number, I also get an error :
Error in (UMI.mean^2)/theta.estimate :

@leonfodoulian
Copy link
Contributor

Hi,

Is the data a sparse matrix? If yes, you might want to use the updated function that you can find in the develop branch of Seurat's GitHub page.

If you have the read number stored in your object@meta.data$nRead, you can do as follows:

# Calculate number of UMI per detected gene
object@meta.data$nUMI.per.gene <- object@meta.data$nUMI / object@meta.data$nGene

# Regress out technical effects using regularized Negative Binomial regression
object <- RegressOutNBreg(object = object,
                          latent.vars = c("nRead", "nUMI.per.gene"),
                          genes.regress = object@var.genes, # regress only for variable genes: speeds computing time!
                          pr.clip.range = c(-30, 30),
                          min.theta = 0.01)

Best,
Leon

@satijalab
Copy link
Collaborator

Thanks Leon. We think this is a powerful method for preprocessing but is still under development (and quite slow), so we haven't integrated it into our public workflows. Hopefully Leon's answer solves the technical question you had.

@ChristophH
Copy link
Collaborator

ChristophH commented Apr 30, 2018

To anyone using RegressOutNBreg: prior to commit 86e4c83 in the develop branch (April 30, 2018 at 12:01:59 PM GMT+2) gene.regress would also be applied to the theta estimation step. As a result it was not advisable to set genes.regress to just variable genes as that would attenuate regularization. This has been fixed and the genes used during the first step (theta estimation) are now separate from the genes used during the second step (regression).

@leonfodoulian
Copy link
Contributor

Hi Christoph,

I can't find the commit you mentioned.

Best,
Leon

@ChristophH
Copy link
Collaborator

Sorry, I did not merge the changes into the public repo. You should see the changes now.

@leonfodoulian
Copy link
Contributor

Hi Christoph,

Could you please also export the function from Seurat in the develop branch?

Thank you in advance!

Best,
Leon

@nfortelny
Copy link

Hi there,

I noticed in the version 2.0.1, FindMarkers was automatically run with latent.vars="nUMI", but this has been removed in the current version (now latent.vars = NULL).

Thus when I now use NegBinDETest, the nUMI are not considered as latent variables any more by default. But this used to be the case (e.g. in version 2.0.1) - and made sense to me - so my question: why was it changed?

Thank you!

andrewwbutler added a commit that referenced this issue Dec 22, 2020
AverageExpression - increase speed and grouping capacity
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

4 participants