saeyslab / nichenetr

NicheNet: predict active ligand-target links between interacting cells
467 stars 117 forks source link

Number of DEG for geneset_oi & extension of ligand_target matrix #128

Closed lmassenet-regad closed 11 months ago

lmassenet-regad commented 2 years ago

Hi, Thank you for this useful tool. I applied to some data and I have two independant questions:

  1. I used my DEG (between 2 experimental conditions) of the receiver cell type as geneses of interest. But the ligand_activities results differs significantly (not same ligands in the top gene lists) when I use different filters of logFC average (to filter the DEG). What would be your recommendation concerning the number of DEG to be considered as geneset_oi ? Having a bigger list of genes or less genes but with more differences in average logFC ?

  2. I would like to use my own ligand/receptor database, but some ligands I am considering are not included in the current ligand_target matrix. Is it possible to create its own ligand_target for the ligand that would be missing ? Or, an extended version of the ligand_target matrix is part of the next updates ?

Thanks you in advance for your help, Kind regards


Lucile

browaeysrobin commented 2 years ago

Hi @lmassenet-regad

Question 1 is hard to answer in general. As long as you have between 50 and 500 genes for a background of 5000-25000 genes it is fine.

Question 2: https://github.com/saeyslab/nichenetr/blob/master/vignettes/model_construction.md shows you how to make your own model wth own databases. But end of April/May, we will release an updated version of the NicheNet ligand-receptor and ligand-target matrix

lmassenet-regad commented 2 years ago

Dear browaeysrobin,

Thank you for your answer. I tried to add my own databases to build a new ligand_target_matrix. I succeeded in computing weighted_networks objects with the new database, but I have trouble to compute the ligand_target_matrix.

I ran the following command lines :

ligands = as.list(unique(new_lr_network$from))

ligand_target_matrix = construct_ligand_target_matrix(weighted_networks = weighted_networks, ligands = ligands, algorithm = "PPR", damping_factor = hyperparameter_list$damping_factor, ltf_cutoff = hyperparameter_list$ltf_cutoff)

And I came up with this error message : Erreur dans igraph::page_rank(G, algo = c("prpack"), vids = igraph::V(G), : At core/centrality/prpack.cpp:63 : The sum of the elements in the reset vector must not be zero. Invalid value

Do you have any idea how to solve this error? Thank you in advance for your help !

browaeysrobin commented 2 years ago

Hi @lmassenet-regad

Can you compare the exact output of your code ligands = as.list(unique(new_lr_network$from)) to what is done in the github vignette?

lmassenet-regad commented 2 years ago

Hello, Below is the comparison of ligands, which for me is similar to what is done in the GitHub vignette, if I understood well.

head(ligands)

[[1]] [1] "CXCL1"

[[2]] [1] "CXCL2"

[[3]] [1] "CXCL3"

[[4]] [1] "CXCL5"

[[5]] [1] "PPBP"

[[6]] [1] "CXCL6"

head(ligands_vignette) # what is done in the vignette

[[1]] [1] "TNF"

[[2]] [1] "TNF" "IL6"

By investigating a bit, it seems that the error message come from this command line (inside the function construct_ligand_tf_matrix) :

complete_matrix = lapply(ligands, PPR_wrapper, E, signaling_igraph, damping_factor, id2allgenes, ltf_cutoff)

Error in igraph::page_rank(G, algo = c("prpack"), vids = igraph::V(G), : At core/centrality/prpack.cpp:63 : The sum of the elements in the reset vector must not be zero. Invalid value

  1. igraph::page_rank(G, algo = c("prpack"), vids = igraph::V(G), directed = TRUE, damping = delta, personalized = E)
  2. igraph::page_rank(G, algo = c("prpack"), vids = igraph::V(G), directed = TRUE, damping = delta, personalized = E) %>% .$vector
  3. FUN(X[[i]], ...)
  4. lapply(ligand, single_ligand_ppr_wrapper, E, G, delta, id2allgenes)
  5. FUN(X[[i]], ...)
  6. lapply(ligands, PPR_wrapper, E, signaling_igraph, damping_factor, id2allgenes, ltf_cutoff)

I hope it can help...!

lmassenet-regad commented 2 years ago

Hi @browaeysrobin,

I finally figured out what happened. Some 'ligands' from my lists are not included in the weighted_networks$lr_sig$from, explaining the error message (most of them are pseudogene such as HLA-DPA3 or HLA-DQB3). The command below is running well:

ligands = unique(new_lr_network$from)
ligands = ligands[ligands%in%weighted_networks$lr_sig$from] %>% as.list()
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks = weighted_networks, ligands = ligands, algorithm = "PPR", damping_factor = hyperparameter_list$damping_factor, ltf_cutoff = hyperparameter_list$ltf_cutoff)

Thank you for your help! Best

lmassenet-regad commented 1 year ago

Question 2: https://github.com/saeyslab/nichenetr/blob/master/vignettes/model_construction.md shows you how to make your own model wth own databases. But end of April/May, we will release an updated version of the NicheNet ligand-receptor and ligand-target matrix

Hi again, I was wondering if you had release a updated version of the NicheNet ligand-receptor and ligand-target matrix, as mentioned a year ago. I was not able to find any related news.

Would you have advices on how I can check that a new model created with own databases has good predictions performance ?

csangara commented 1 year ago

Hi, sorry for the delay, you can find the updated matrices here: https://zenodo.org/record/7074291