chuiqin / irGSEA

The integration of single cell rank-based gene set enrichment analysis
Other
106 stars 17 forks source link

what's the mean of direction #2

Closed haowBio closed 2 years ago

haowBio commented 2 years ago

Hi, I want to know the mean of irGSEA.integrate result, the column "direction" which have two levels, how can you define up or down? Is it compare to median of the score

haowBio commented 2 years ago

Because there are multiple cell types, I want to know how these compare

chuiqin commented 2 years ago

For example, it suggests the mean of enrichment scores of cluster B lower than the remaining clusters (except the cluster B) when the direction is down. If you are familiar with the Seurat package, you can easy to repeat it as follow:

pbmc3k.final <- SeuratObject::UpdateSeuratObject(pbmc3k.final)
# Seurat object
pbmc3k.final <- irGSEA.score(object = pbmc3k.final, assay = "RNA", slot = "data", msigdb = T, species = "Homo sapiens",
category = "H", geneid = "symbol", method = c("AUCell", "UCell", "singscore", "ssgsea"), kcdf = 'Gaussian')
# Integrated analysis
result.dge <- irGSEA.integrate(object = pbmc3k.final, group.by = "seurat_annotations", metadata = NULL, col.name = NULL,
method = c("AUCell","UCell","singscore","ssgsea"))
head(result.dge$AUCell, 1)
#                   Name         p_val    avg_diff     p_val_adj cluster direction
# 1 HALLMARK-ANGIOGENESIS 2.364593e-106 -0.05079023 1.182296e-104       B      down
#  methods
# 1  AUCell
pbmc3k.final <- SeuratObject::UpdateSeuratObject(pbmc3k.final)
# Seurat object
pbmc3k.final <- irGSEA.score(object = pbmc3k.final, assay = "RNA", slot = "data", msigdb = T, species = "Homo sapiens",
category = "H", geneid = "symbol", method = c("AUCell", "UCell", "singscore", "ssgsea"), kcdf = 'Gaussian')
result.dge2 <- Seurat::FindMarkers(object = pbmc3k.final,
                         assay = "AUCell",
                         slot = "scale.data",
                         ident.1 = "B",
                         ident.2 = NULL,
                         test.use = "wilcox",
                         min.pct = -Inf,
                         logfc.threshold = 0,
                         min.cells.group = 0,
                         min.diff.pct = -Inf,
                         verbose = F, group.by = "seurat_annotations",
                         min.cells.feature = 0)
result.dge2 <- result.dge2 %>% tibble::rownames_to_column(var = "gene") %>%
    dplyr::mutate(cluster = "B", direction = dplyr::if_else(avg_diff >0, "up", "down")) %>%
    dplyr::select(-c("pct.1", "pct.2"))
head(result.dge2 ,1)
#                   gene         p_val    avg_diff     p_val_adj cluster direction
# 1 HALLMARK-ANGIOGENESIS 2.364593e-106 -0.05079023 1.182296e-104       B      down

The column direction is related to the column avg_diff.

haowBio commented 2 years ago

Thank you for you reply The result is the same as I expected. It's a very nice tool. Can irGSEA have the same function with Seurat::FindMarkers, which can specify ident1 and ident2, so that I can compare in two groups which I wanted.

chuiqin commented 2 years ago

Sorry, this function is not supported in the current version. But the function will be added in next version.

haowBio commented 2 years ago

Thank you, Looking forward to the next version