nichenetr
nichenetr copied to clipboard
Differential expression SCT
Hello,
I am performing NicheNet with SCTransformed-integrated data. I run PrepSCTFindMarkers() function before runing NicheNet for Seuratm but I keep getting error:
Error in if (any(unlist(model_median_umis) != min_median_umi)) { : missing value where TRUE/FALSE needed
Looks like that error comes from the fact that NicheNet wrapper subsets data before internally runing FindMarkers(). I silved issue by modifying nichenet_seuratobj_aggregate() function to include recorect_umi=FALSE internaly.
DE_table_receiver = FindMarkers(object = seurat_obj_receiver, ident.1 = condition_oi, ident.2 = condition_reference, min.pct = expression_pct, assay='SCT', recorrect_umi = FALSE) %>% rownames_to_column("gene")
Is this approach ok?
Hi @DzenisKoca
Sorry for the late reply.
I would guess this is correct, but I think the Seurat developers would be more qualified to answer this question. Could you ask them how they would analyze DE between two conditions on SCT-integrated data? (after subsetting the data to get only cells of one cell type)
Hi, I was able to get a response from them:
"DE analysis should be performed on SCT corrected counts (data slot). You can use PrepSCTFindMarkers() to account for different library depths across datasets as shown in the v2 vignette."
I am not expert in coding, and I appreciate the help. With their response, how should I adapt your code to have the best analysis. Just adding SCT is not working.
Thank you, Ana
Hi. Just checking to see if someone could help me with this issue, please? thanks
Hi @anaccsilva
We will solve this around the 18th of November
Thank you. I am looking forward to it. :-)
Hi @anaccsilva
To handle this issue, I suggest you use this NicheNet vignette: https://github.com/saeyslab/nichenetr/blob/master/vignettes/seurat_steps.md
It offers a step-by-step approach on how to perform the analysis on a Seurat object. In step 2, you need to perform the differential expression analysis. In case of SCT-integrated data, you need to run the following code before the chunk of code written in step 2/
seurat_obj = PrepSCTFindMarkers(seurat_obj)
Then, you will have to adapt the FindMarkers
command and add: recorrect_umi = FALSE
as argument
DE_table_receiver = FindMarkers(object = seurat_obj_receiver, ident.1 = condition_oi, ident.2 = condition_reference, min.pct = expression_pct, assay='SCT', recorrect_umi = FALSE) %>% rownames_to_column("gene")
If you want to calculate DE later on for the sender cell types, you will also have to add the recorrect_umi.
Hopefully, you can do something with this information.
Wow! That is great. You were very precise about the response time. :-) Thank you so much. I will try this code and let you know. Thank you so much again!
Hi, sorry bother again with this issue.
According to Seurat developers, we can't rerun PrepSCTFindmarkers more than once. So, if I've already run this code before, how should I proceed without running it again?
Considering that I am following this vignette (For, what should I do in this part of the code?
DE_sender = calculate_niche_de(seurat_obj = seurat_obj %>% subset(features = lr_network$ligand %>% intersect(rownames(seurat_obj))), niches = niches, type = "sender", assay_oi = assay_oi) # only ligands important for sender cell types
Thank you, Ana
Hello,@browaeysrobin
I am performing PrepSCTFindMarkers() function before runing FindMarkers()with SCTransformed-integrated data. I keep getting error: Error in if (any(unlist(model_median_umis) != min_median_umi)) { : missing value where TRUE/FALSE needed It bothered me for days. Please just checking to see if someone could help me with this issue? Thank you very much
Hello, I am wondering if anyone sorted out whether the correction suggested by @DzenisKoca for the wrapper above is legitimate? I'm new(ish) to coding in R and would prefer to use the wrapper if possible. Wanted to verify that this works. I'd really appreciate it if we could shed some light on the issue.
Also following up on this when running with the new nichentr function. I receive this error:
> DE_table_all = Idents(snRNAseq_GAS) %>%
+ levels() %>%
+ intersect(sender_celltypes) %>%
+ lapply(get_lfc_celltype, seurat_obj = snRNAseq_GAS, condition_colname = "group", condition_oi = condition_oi, condition_reference = condition_reference, expression_pct = 0.10, celltype_col = NULL) %>% reduce(full_join) # use this if cell type labels are the identities of your Seurat object -- if not: indicate the celltype_col properly
Error in FindMarkers.SCTAssay(object = data.use, slot = slot, cells.1 = cells$cells.1, :
Object contains multiple models with unequal library sizes. Run `PrepSCTFindMarkers()` before running `FindMarkers()`.
Any suggestions?
Hi @Boehmin,
Please refer to #258 for the solution.