Skip to contents

The function calculates cross-talk between all gene-set pairs that show a link between their genes

Usage

gs_cross_talk(
  gs_list,
  gene_network_adj,
  k = 9,
  shared = F,
  hash = T,
  ct_info = F,
  mc_cores_perm = 1,
  mc_cores_ct = 1
)

Arguments

gs_list

a named list of genes grouped into gene sets, as obtained from `preparing_gs_list`, `preparing_msigdb_list()`, `preparing_DEG_list()` or `preparing_expr_list()` functions

gene_network_adj

adjacency matrix of the whole gene network considered (can be a sparseMatrix)

k

number of permutations

shared

logical, if the cross-talk calculation should consider shared genes (`TRUE`, suggested only for cell-cell communication) or not (`FALSE`, suggested for pathway cross-talk)

hash

logical, if hash map should be used to speed cross-talk calculation. Suggested only with high number of gene-sets (like in pathway cross-talk)

ct_info

logical, if the function has to return the detail of gene-gene interactions between gene sets

mc_cores_perm

number of thread to be used in permutations

mc_cores_ct

number of threads to be used for cross talk calculation

Value

The function can return two output type:

  • `ct_info = FALSE`: only the cross-talk results are returned as output

    • gs1,gs2: names of gene-set pairs considered

    • ct_score: cross-talk score

    • ngenes_gs1,ngenes_gs2: number of genes in `gs1` and `gs2`

    • nlink: number of links between `gs1` and `gs2`

    • p_value_link: p-value score calculated by using the permutation approach

    • FDR_link: empirical FDR

    • p_adj_BH: `p-value_link` adjusted using BH method (see `p.adjust()` function)

    • weight_gs1,weight_gs2: cumulative weights of the genes involved in cross-talk between `gs1` and `gs2`

    • genes_gs1,genes_gs2: genes involved in cross-talk between `gs1` and `gs2`

  • `ct_info = TRUE`: the cross-talk results and the detail of gene-gene interactions between gene-sets are returned as output

    1. ct_info: gene-gene interaction details

      • gs1,gs2: name of the gene-sets

      • gs1_gene,gs2_gene: genes involved in the cross-talk

      • score: the score of the interaction between `gs1_gene` and `gs1_gene`, calculated by multiplying their weigths

    2. ct_res: cross-talk results

      • gs1,gs2: names of gene-set pairs considered

      • ct_score: cross-talk score

      • ngenes_gs1,ngenes_gs2: number of genes in `gs1` and `gs2`

      • nlink: number of links between `gs1` and `gs2`

      • p_value_link: p-value score calculated by using the permutation approach

      • FDR_link: empirical FDR

      • p_adj_BH: `p-value_link` adjusted using BH method (see `p.adjust()` function)

      • weight_gs1,weight_gs2: cumulative weights of the genes involved in cross-talk between `gs1` and `gs2`

      • genes_gs1,genes_gs2: genes involved in cross-talk between `gs1` and `gs2`

Details

The function takes as inputs the adjacency matrix of the biological network (`gene_network_adj`) and the gene-set list, either obtained through `preparing_gs_list`, `preparing_msigdb_list()`, `preparing_DEG_list()` or `preparing_expr_list()` functions. For each gene-set pair that shows at least a link between them, the function uses the adjacency matrix to calculate cross-talk as described in the paper. Then, for each pair the function samples randomly from the `gene_network_adj` two lists of the same dimensions of the gene-sets and calculates the number of links between them. This process is repeated `k` times. The number of links obtained with the `k` permuted version of the gene-set pairs are compared to the real to calculate the p-value and FDR. We also provide a corrected p-value using BH method.

Examples

if (FALSE) {  
 ptw_list <- list(ptwA = setNames(c(1, 1, 1), c("A", "B","C")), 
 ptwB = setNames(c(1, 1, 1), c("D", "E", "F")), ptwC = setNames(c(1, 1, 1), c("A", "B", "E")))
 adj <- matrix(data = sample(c(0,1), 20*20, replace = TRUE), nrow = 6, 
 ncol = 6, dimnames = list(LETTERS[1:20], LETTERS[1:20]))
 pct <- gs_cross_talk(pathway_list = ptw_list, gene_network_adj = adj, 
                      shared = FALSE, hash = FALSE, ct_info = FALSE, 
                      mc_cores_pct = 1, mc_cores_perm = 1, k = 9)
 }