scRNAseq analysis with logNormCounts (scran/scuttle package) - log transformation with different log base?
1
0
Entering edit mode
2.8 years ago
joker33 ▴ 110

Hi,

I am using scran / scuttle for scRNAseq normalization.

clusters <- scran::quickCluster(sce)
sce <- scran::computeSumFactors(sce, cluster = clusters)
sce <- scuttle::logNormCounts(sce)

As far as I could find out, this code will log2 transform data. I was wondering if there is any option to specify log transformation to another log base, particularly natural log?

Or would it be possible to reverse log2 transformation after the normalization and then manually transform to natural log?

Thank you very much in advance!

PS: Cross posted on https://github.com/LTLA/scuttle/issues/12

scran log logNormCounts scuttle scRNAseq • 2.5k views
ADD COMMENT
2
Entering edit mode
2.8 years ago
ATpoint 81k

Sure, technically it is possible by using log=FALSE and then transform the normalized counts using any method you want. See ?scuttle::logNormCounts on log option.

By the way, GitHub issues are mainly for bug reports and feature requests, maybe consider to ask in a forum first, and not opening issues, at least not right away. Just a suggestion. For technical questions that require the package developers expertise the support forum at support.bioconductor.org is a good place to ask.

Edit: I quote here the answer from Aaron Lun from the GitHub issue:

Internally, if pseudo.count=1, the logNormCounts() function will use log1p. This has the advantage of preserving sparsity compared to the naive log(x + 1) method, which goes through a non-sparse intermediate x + 1. For all other settings of pseudo.count, we go through the usual log(x + pseudo.count), because we're going to lose sparsity anyway.

Now, log(x + 1) is a natural log, so we divide the result by log(2) to obtain log2-transformed values. One could just as easily undo that division outside of the function, or change the base as desired. It's just a division so it's pretty cheap.

ADD COMMENT
0
Entering edit mode

Thanks for your prompt response!

So if I set log=FALSE, the code would normalize the data but not log-transform, yet. Then I can log-transform it manually afterwards? Is that correct?

And thanks for your advice regarding GitHub!

ADD REPLY
1
Entering edit mode

Yes, that is my understanding of the function.

It uses the either the size factors from the deconvolution method (computeSumFactors) if these are present in the SingleCellExperiment or (if not present) then normalizes based on library size alone. In any case, this normalization is done first, and then the log transformation is being applied if log=TRUE.

ADD REPLY

Login before adding your answer.

Traffic: 2407 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6