immunogenomics / harmony

Fast, sensitive and accurate integration of single-cell data with Harmony
https://portals.broadinstitute.org/harmony/
Other
510 stars 97 forks source link

"Is It Feasible to Use Harmony Directly for Batch Correction in Seurat V5 Instead of “ IntegrateLayers“?" #249

Open Tylesteven opened 4 months ago

Tylesteven commented 4 months ago

I have multiple samples from various GEO datasets that need batch correction. Currently, I've created five Seurat objects in Seurat V5 and merged them into a single object. I would like to perform the batch correction not using the built-in method in Seurat V5, which is:

============================

merged_sce <- merge(sce_GSE140393_DRE, y = list(sce_GSE148822_AD, sce_GSE157827_AD, sce_GSE160189_DRE, sce_GSE173731_DRE, sce_GSE174367_AD), add.cell.ids = c("GSE140393_DRE", "GSE148822_AD", "GSE157827_AD", "GSE160189_DRE", "GSE173731_DRE", "GSE174367_AD"), project = "Merged_All")

sce <- NormalizeData(merged_sce ) %>% FindVariableFeatures(selection.method = "vst",nfeatures = 3000)%>% ScaleData(vars.to.regress=c("percent.mt","nCount_RNA")) %>% RunPCA(npcs = 30, verbose = T)

sce_harm <- IntegrateLayers(object = sce, method = HarmonyIntegration, orig.reduction = "pca", new.reduction = "integrated.Harmony", verbose = TRUE)

Instead, I want to use Harmony directly with the following code: sce_harm <- RunHarmony(sce, group.by.vars = c("dataset", "donor", "batch_id")) The variables "dataset", "donor", "batch_id" are included in my metadata. Is this approach feasible?

ptranvan commented 3 months ago

Hi @Tylesteven , I am wondering the same thing.

Did you find any solution ?

Tylesteven commented 3 months ago

yes, it is much more useful than IntegrateLayers

王高杰

@. | ---- Replied Message ---- | From | Patrick Tran @.> | | Date | 5/27/2024 05:32 | | To | @.> | | Cc | @.>, @.***> | | Subject | Re: [immunogenomics/harmony] "Is It Feasible to Use Harmony Directly for Batch Correction in Seurat V5 Instead of “ IntegrateLayers“?" (Issue #249) |

Hi @Tylesteven , I am wondering the same thing.

Did you find any solution ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ptranvan commented 3 months ago

After merging, I have an object with multiple layers:

Active assay: RNA (33654 features, 2000 variable features)
 27 layers present: counts.1, counts.2, counts.3, counts.4, counts.5, counts.6, counts.7, counts.8, counts.9, data.1, scale.data.1, data.2, scale.data.2, data.3, scale.data.3, data.4, scale.data.4, data.5, scale.data.5, data.6, scale.data.6, data.7, scale.data.7, data.8, scale.data.8, data.9, scale.data.9

Did you have also the same object ? how have you dealt with it ?

Tylesteven commented 3 months ago

you could join layers before merging

王高杰

@. | ---- Replied Message ---- | From | Patrick Tran @.> | | Date | 5/27/2024 17:29 | | To | @.> | | Cc | @.>, @.***> | | Subject | Re: [immunogenomics/harmony] "Is It Feasible to Use Harmony Directly for Batch Correction in Seurat V5 Instead of “ IntegrateLayers“?" (Issue #249) |

After merging, I have an object with multiple layers:

Active assay: RNA (33654 features, 2000 variable features) 27 layers present: counts.1, counts.2, counts.3, counts.4, counts.5, counts.6, counts.7, counts.8, counts.9, data.1, scale.data.1, data.2, scale.data.2, data.3, scale.data.3, data.4, scale.data.4, data.5, scale.data.5, data.6, scale.data.6, data.7, scale.data.7, data.8, scale.data.8, data.9, scale.data.9

Did you have also the same object ? how have you dealt with it ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ptranvan commented 3 months ago

Before or after merging ?

Would you mind to share your code please ?

Thanks