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

mean.fxn Decision Not Explained #7107

Closed
DarioS opened this issue Apr 1, 2023 · 3 comments
Closed

mean.fxn Decision Not Explained #7107

DarioS opened this issue Apr 1, 2023 · 3 comments
Labels
documentation Error in documentation

Comments

@DarioS
Copy link

DarioS commented Apr 1, 2023

mean.fxn: Function to use for fold change or average difference calculation. If NULL, the appropriate function will be chose according to the slot used

Which slot relates to which automatic function choice? Be explicit, perhaps in Details section.

@DarioS DarioS added the documentation Error in documentation label Apr 1, 2023
@lepriolc
Copy link

lepriolc commented Apr 3, 2023

Hi @DarioS,

I am not part of Seurat team but you can find the mean.fxn function definition in the differential_expression.R script (https://github.com/satijalab/seurat/blob/master/R/differential_expression.R).
Basically, when using log-counts, this function is set to:

function(x) {
        return(log(x = rowMeans(x = expm1(x = x)) + pseudocount.use, base = base))
      }

Using counts, it is set to:

function(x) {
    return(log(x = rowMeans(x = x) + pseudocount.use, base = base))
  }

And, finally, when using scale.data slot, it is set to the rowMeans function.

When using an SCT assay, it appears that this function is not set correctly when using data from the counts slot. See more details in the issue #7095.

Christophe

@lucygarner
Copy link

I have found a bug in this.

If:

norm.command <- paste0("NormalizeData.", assay)
Command(seurat_all, command = norm.command, value = "normalization.method")

gives:

NormalizeData.RNA has not been run or is not a valid command.

mean.fxn is set to:

function(x) {
    return(log(x = rowMeans(x = x) + pseudocount.use, base = base))
}

even if slot = "data".

This can happen if you have run NormalizeData on a previous Seurat object, subset and renamed that Seurat object, and not re-run NormalizeData.

@saketkc
Copy link
Collaborator

saketkc commented Jul 6, 2023

Hi @DarioS and @lucygarner, I have just pushed 992c1a9 to develop branch which should fix this and related issues. Can you pull from the develop branch and re-open this issue if you are still facing issues?

devtools::install_github("satijalab/seurat", ref="develop")

@saketkc saketkc closed this as completed Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Error in documentation
Projects
None yet
Development

No branches or pull requests

4 participants