Skip to content

Seurat V5 FindVariableFeatures() and HarmonyIntegration() Question #8325

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

Closed
Aaron-sqw opened this issue Jan 16, 2024 · 5 comments
Closed

Seurat V5 FindVariableFeatures() and HarmonyIntegration() Question #8325

Aaron-sqw opened this issue Jan 16, 2024 · 5 comments

Comments

@Aaron-sqw
Copy link

Dear Team,
I have two questions in Seurat V5:
obj[["RNA"]] <- split(obj[["RNA"]], f = obj$tech)
obj<-NormalizeData(obj)
obj <- FindVariableFeatures(obj)
obj <- ScaleData(obj)
obj <- RunPCA(obj)

  1. When I process FindVariableFeatures(), each Layer will generate variable features, and the whole project will also get 2000 variable features. My question is if the whole object variable features are from the Layers(like the function SelectIntegrationFeatures()) or just from the merged total cells in the object.
  2. After finishing the command upon, when I hope to use harmony to do integration, object <- (object = obj, method = HarmonyIntegration, orig.reduction = "pca", new.reduction = 'harmony', verbose = FALSE) , I find this method could only adjust tech level batch effect, but I also hope to adjust sample difference at the same time, I try to use group.by.vars=c("tech","sample"), but it didn't work.

Best regards,
Qiwei

@Aaron-sqw
Copy link
Author

Aaron-sqw commented Jan 17, 2024

Hey,
I check the FindVariableFeatures() for layers and list+SelectIntegrationFeatures(), the results are same.
The method should be the same one.

Thanks!

@Gesmira
Copy link
Contributor

Gesmira commented Jan 19, 2024

HI @Aaron-sqw,
When we find variable features with an object with 2 layers for example, we identify each layer's variable features, find the common variable features, and then supplement until n variable features are present in a list using the most variable features in the two lists that are also features in the other matrices. This is the same as the method we use for identifying features for integration.

To your second question, we don't currently support grouping by multiple variables for integration. However, you can create a variable that contains both tech and sample by pasting the values together and then using this variable for integration. Something like: obj$tech_sample <- paste0(obj$tech, "_", obj$sample). Then you can supply tech_sample for integration.

@Gesmira Gesmira closed this as completed Jan 19, 2024
@Aaron-sqw
Copy link
Author

Aaron-sqw commented Jan 24, 2024

To your second question, we don't currently support grouping by multiple variables for integration. However, you can create a variable that contains both tech and sample by pasting the values together and then using this variable for integration. Something like: obj$tech_sample <- paste0(obj$tech, "_", obj$sample). Then you can supply tech_sample for integration.

Dear @Gesmira ,
Thanks a lot for your reply!
For the second question, if I set as your method, after split layers, as samples is the smallest element in my project, so paste together should be the same as samples. I tried using the old method RunHarmony(group.by.vars =c("sample","tech")), It seems work that could adjust the batch from two parts.
Whether the new version Seurat V5 could add this group.by.vars parameter in the HarmonyIntegration.

Best,
Aaron

@mtrussart
Copy link

Hi,

Following up on the previous questions, I would like to know can I specify which variables to use for Harmony when using
merge <- IntegrateLayers(
object = merge, method = HarmonyIntegration,
orig.reduction = "pca", new.reduction = "harmony",normalization.method = "SCT",
verbose = FALSE
)
You mentioned @Gesmira in the previous example : "to supply tech_sample for integration" but where do you define it in IntegrateLayers? and which one does it use by default?

Thanks a lot,
Marie

@rachadele
Copy link

Hi,

Following up on the previous questions, I would like to know can I specify which variables to use for Harmony when using merge <- IntegrateLayers( object = merge, method = HarmonyIntegration, orig.reduction = "pca", new.reduction = "harmony",normalization.method = "SCT", verbose = FALSE ) You mentioned @Gesmira in the previous example : "to supply tech_sample for integration" but where do you define it in IntegrateLayers? and which one does it use by default?

Thanks a lot, Marie

I think you will have to split by that group (e.g. split(obj[["RNA"]], f = obj$tech_sample))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants