Open majeex233 opened 10 months ago
Hi and sorry for the late reply,
There is currently no exported function that allows users to add GO and KEGG pathways to custom LRIs. But we can try to find ways around it by using some internal scDiffCom functions, namely https://github.com/CyrilLagger/scDiffCom/blob/dd9ed3a08c071a87edfa43c68ec0c8d331f12e41/R/utils_LRI.R#L1694 and https://github.com/CyrilLagger/scDiffCom/blob/dd9ed3a08c071a87edfa43c68ec0c8d331f12e41/R/utils_LRI.R#L1601
Could you please try the following code with your own two new LRIs and let me know if that works? This is only for the GO terms, as I noticed a bug for the KEGG pathway that I will try to fix first.
library(scDiffCom)
library(data.table)
# create a data.table with a FAKE custom LRI
new_LRI_mouse <- data.table(
LRI = "Ada:Axl", LIGAND_1 = "Ada", RECEPTOR_1 = "Axl"
)
# add custom LRIs to the mouse LRI database
custom_LRI_mouse <- scDiffCom::LRI_mouse
custom_LRI_mouse$LRI_curated <- rbind(custom_LRI_mouse$LRI_curated, new_LRI_mouse, fill = TRUE)
# get GO annotation for the new LRI
new_LRI_mouse_GO <- scDiffCom:::get_GO_interactions(
species = "mouse",
LR_db = custom_LRI_mouse$LRI_curated[LRI %in% new_LRI_mouse$LRI, ]
)
custom_LRI_mouse$LRI_curated_GO <- rbind(custom_LRI_mouse$LRI_curated_GO, new_LRI_mouse_GO[,1:2])
# test on the toy dataset
seurat_object <- scDiffCom::seurat_sample_tms_liver
scdiffcom_object_customlri <- run_interaction_analysis(
seurat_object = seurat_object,
LRI_species = "custom",
seurat_celltype_id = "cell_type",
seurat_condition_id = list(
column_name = "age_group",
cond1_name = "YOUNG",
cond2_name = "OLD"
),
custom_LRI_tables = list(LRI = custom_LRI_mouse$LRI_curated, custom_GO = custom_LRI_mouse$LRI_curated_GO),
)
Thanks for your kind answer! I successfuly get the new LRI pairs' GO annotation! But there are some problem in KEGG pathway annotation, and I am trying to fix it. When I run new_LRI_human_KEGG <- scDiffCom:::get_KEGG_PWS_interactions( species = "human", LR_db = custom_LRI_human$LRI_curated[LRI %in% new_LRI_human$LRI, ] ) I meet the error: Error in colnamesInt(x, names(on), check_dups = FALSE) : The parameter specifying a column specifies a column that does not exist: cols[1]='KEGG_ID'
Happy New Year!
I just checked and it is probably because your new LRIs have no KEGG pathways to be associated with.
To be more specific, for each LRI X:Y in LR_db
, scDiffCom:::get_KEGG_PWS_interactions
is taking the intersection between the KEGG pathways associated with X and Y. The intersection can typically be empty.
If it is empty for all LRIs in LR_db
, scDiffCom:::get_KEGG_PWS_interactions
crashes as I haven't coded that case properly yet. I will fix that.
Please note that in your case, this just means that adding your custom LRIs will not change scDiffCom::LRI_human$LRI_curated_KEGG
. So you can simply perform your analysis with the default KEGG annotation.
Happy New Year!
Thanks so much for your answer! I have tried again and found the same problem...My new LRI pairs are not in scDiffCom::LRI_human$LRI_curated_KEGG, which can not perform the analysis with the default KEGG annotation. Thanks for your hard work and I am looking for your good news~
Hi!
I am not sure if I understood your last message correctly. Did you manage to perform your analysis with your new LRI pairs?
The fact that your new pairs have no associated KEGG pathways should not be a problem to run the analysis. You should be able to run it with your updated list of LRIs (custom_LRI_human$LRI_curated
) and the default KEGG list (scDiffCom::LRI_human$LRI_curated_KEGG
). It is totally normal for some LRI pairs to not have any associated KEGG pathways.
Please let me know if I can help further.
Excuse me,I've plotted the first 20 up-regulated ligand receptor pairs using PlotORA, but how do I know which cells these LR mainly come from
Excuse me, I am trying to add 2 IRL in the LRI_curated, but I don't know how to find the matched GO and KEGG ID, which can be added in the LRI_curated_GO and LRI_curated_KEGG. Can you tell me how to resolve it, really thanks!!