Calculate the number of mutually exclusive or co-mutation events in a bipartite graph

calc_mutex_events(gs, bgr, sample_is = TRUE)

calc_comut_events(gs, bgr, sample_is = TRUE)

Arguments

gs

the "gene set" is a vector of genes to consider

bgr

a bipartite graph (as a tidygraph graph object); it must have a boolean node attribute "type" that describes which group each node is in

sample_is

either TRUE or FALSE dictating which boolean value corresponds to the samples in the "type" attribute of bgr

Examples

set.seed(0) suppressPackageStartupMessages(library(tidygraph)) bgr <- make_sample_gene_bipartite( simple_dataset$sample_name, simple_dataset$mutated_gene ) plot(bgr)
calc_mutex_events(gs = c("a", "b"), bgr)
#> [1] 12
calc_comut_events(gs = c("c", "d"), bgr)
#> [1] 9