Fix weight.by.var
for approx=FALSE
#2330
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
weight.by.var
parameter of RunPCA has different effects, depending on the value of theapprox
parameter. See also #2237 .For
approx=TRUE
,weight.by.var=TRUE
yields the desirable scaling (variance of PC == eigenvalue) while forapprox=FALSE
this output is obtained only forweight.by.var=FALSE
.This PR gradually adjusts the behavior of
approx=FALSE
to that ofapprox=TRUE
(which was implemented first and is thus preferred). The current approach does not modify the behavior of existing code but only warns about the current behavior and introduces an option to use the new one (Seurat.RunPCA.use.correct.scaling
). This should be gradually changed as described in comments to eliminate the wrong behavior without breaking things.This PR furthermore simplifies the implementation of RunPCA to facilitate further changes.
This also makes the approx=FALSE parameter functional for
rev.pca=TRUE
.weight.by.var
parameter, demonstrating the current issue.