Skip to content

edist calculation difference in edist and etest #28

Description

@rootze

Hello Developer,

First, thank you for providing this great resource. I greatly appreciate the effort that went into developing and maintaining this tool.

I ran into an issue that has me quite confused. Specifically, I ran the code available in testthat

Here is the part of the code I'm referring to:

expression_matrix <- Seurat::ReadMtx(
  paste0(path, "/matrix.mtx"),
  paste0(path, "/barcodes.csv"),
  paste0(path, "/genes.csv"),
  cell.column = 1,
  feature.column = 2,
  cell.sep = ",",
  feature.sep = ",",
  skip.cell = 1,
  skip.feature = 1,
latent <- read.csv(paste0(path, "seurat_pca.csv"), row.names = 1)
metadata <- read.csv(paste0(path, "seurat_metadata.csv"),
                     row.names = 1)
colnames(expression_matrix) <- rownames(metadata)
seurat_object <- Seurat::CreateSeuratObject(counts = expression_matrix,
                                             meta.data = metadata)
seurat_object[["pca"]] <- Seurat::CreateDimReducObject(embeddings = as.matrix(latent),
                                               key = "pca_",
                                               assay = Seurat::DefaultAssay(seurat_object))

df <- edist(seurat_object, groupby = "perturbation", reduction = "pca",
            sample_correction = FALSE, verbose = TRUE)
#
df
# > df
#            RUNX2_2   control
# ZAP70_1  0.1849568 0.2478410
# ZAP70_2  0.1320942 0.3173424
# LCK_1    0.1971550 0.2685310

#
et <- etest(seurat_object = seurat_object, groupby = "perturbation",
            control = "control", reduction = "pca")
#
et
# > et
#                 pval        edist
# ZAP70_1  0.000999001 2.478410e+01
# ZAP70_2  0.000999001 3.173424e+01

I noticed that the edist value calculated using the edist function differs significantly from the value obtained using the etest function for the comparison between ZAP70_1 and control.

For example:

In the edist dataframe, the value is 0.2478410.
In the output from etest, the corresponding value is 2.478410e+01.

I'm having trouble understanding why there is such a difference between these two calculations, and what might be causing this discrepancy. Could you provide some clarification or point me in the right direction?
Thank you!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions