Create a bipartite graph connecting cancer samples and their mutations.

make_sample_gene_bipartite(s, g)

Arguments

s

vector of samples

g

vector of mutated genes

Value

a tidygraph graph object with node attributes name and type. Attribute type holds boolean values to indicate which of the two groups the node belongs to - TRUE is for samples.

Examples

make_sample_gene_bipartite( simple_dataset$sample_name, simple_dataset$mutated_gene )
#> # A tbl_graph: 22 nodes and 36 edges #> # #> # A bipartite simple graph with 1 component #> # #> # Node Data: 22 x 2 (active) #> name type #> <chr> <lgl> #> 1 1 TRUE #> 2 2 TRUE #> 3 3 TRUE #> 4 4 TRUE #> 5 5 TRUE #> 6 6 TRUE #> # … with 16 more rows #> # #> # Edge Data: 36 x 2 #> from to #> <int> <int> #> 1 1 15 #> 2 1 16 #> 3 1 17 #> # … with 33 more rows