Extract the adjacency matrix of a TRONCO model. The matrix is indexed with colnames/rownames which represent genotype keys - these can be resolved with function keysToNames. It is possible to specify a subset of events to build the matrix, a subset of models if multiple reconstruction have been performed. Also, either the prima facie matrix or the post-regularization matrix can be extracted.

as.adj.matrix(x, events = as.events(x), models = names(x$model), type = "fit")

Arguments

x

A TRONCO model.

events

A subset of events as of as.events(x), all by default.

models

A subset of reconstructed models, all by default.

type

Either the prima facie ('pf') or the post-regularization ('fit') matrix, 'fit' by default.

Value

The adjacency matrix of a TRONCO model.

Examples

data(test_model)
as.adj.matrix(test_model)
#> $capri_bic
#>          gene 4 gene 5 gene 7 gene 29 gene 30 gene 31 gene 32 gene 33 gene 34
#> gene 4        0      0      0       0       0       0       0       0       0
#> gene 5        0      0      0       0       0       0       0       0       0
#> gene 7        0      0      0       0       0       0       1       0       0
#> gene 29       0      0      0       0       0       0       0       0       0
#> gene 30       0      0      0       0       0       0       0       0       0
#> gene 31       0      0      0       0       0       0       0       0       0
#> gene 32       0      1      0       0       0       0       0       0       0
#> gene 33       1      0      0       0       0       0       0       0       0
#> gene 34       0      0      0       0       0       0       0       0       0
#> gene 36       0      0      0       0       0       0       0       0       0
#> gene 40       0      0      0       0       0       0       0       0       0
#> gene 44       0      0      0       0       0       0       0       0       0
#> gene 47       0      0      0       0       0       0       0       0       0
#> gene 49       0      0      0       0       0       0       0       0       0
#> gene 50       0      0      0       0       0       0       0       0       0
#> gene 51       0      0      0       0       0       0       0       0       0
#> gene 52       0      0      0       0       0       0       0       0       0
#> gene 53       0      0      0       0       0       0       0       0       0
#> gene 54       0      0      0       0       0       0       0       0       0
#> gene 55       0      0      0       0       0       0       0       0       0
#> gene 56       0      0      0       0       0       0       0       0       0
#> gene 66       0      0      0       0       0       0       0       0       0
#> gene 69       0      0      0       0       0       0       0       0       0
#> gene 77       0      0      0       0       0       0       0       0       0
#> gene 88       0      0      0       0       0       0       0       0       0
#> gene 89       0      0      0       0       0       0       0       0       0
#> gene 91       0      0      0       0       0       0       0       0       1
#> gene 111      0      0      0       0       0       0       0       0       0
#> XOR_EZH2      0      0      0       0       0       0       0       0       0
#> OR_CSF3R      0      0      0       0       0       0       0       0       0
#>          gene 36 gene 40 gene 44 gene 47 gene 49 gene 50 gene 51 gene 52
#> gene 4         0       0       0       0       0       0       0       0
#> gene 5         0       0       0       0       0       0       0       0
#> gene 7         0       0       0       0       0       0       0       0
#> gene 29        0       0       0       0       0       0       0       0
#> gene 30        0       0       1       0       0       0       0       0
#> gene 31        0       0       0       0       0       0       0       0
#> gene 32        0       0       0       0       0       0       0       0
#> gene 33        0       0       0       0       1       0       1       0
#> gene 34        0       0       0       0       0       0       0       0
#> gene 36        0       0       0       0       0       0       0       0
#> gene 40        0       0       0       0       0       0       0       0
#> gene 44        0       0       0       0       0       0       0       0
#> gene 47        0       0       0       0       0       0       0       0
#> gene 49        0       0       0       0       0       0       0       0
#> gene 50        0       0       0       0       0       0       0       0
#> gene 51        0       0       0       0       0       0       0       0
#> gene 52        0       0       0       0       0       0       0       0
#> gene 53        0       0       0       0       0       0       0       0
#> gene 54        0       0       0       0       0       0       0       0
#> gene 55        0       0       0       0       0       0       0       0
#> gene 56        0       0       0       0       0       0       0       0
#> gene 66        0       0       0       0       0       0       0       0
#> gene 69        0       0       0       0       0       0       0       0
#> gene 77        0       0       0       1       0       0       0       0
#> gene 88        0       0       0       0       0       0       0       0
#> gene 89        0       0       0       0       0       0       0       0
#> gene 91        0       0       0       0       0       1       0       0
#> gene 111       0       0       0       0       0       0       0       0
#> XOR_EZH2       0       0       0       0       0       0       0       0
#> OR_CSF3R       0       0       0       0       0       0       0       0
#>          gene 53 gene 54 gene 55 gene 56 gene 66 gene 69 gene 77 gene 88
#> gene 4         0       0       0       1       0       0       0       0
#> gene 5         0       0       0       0       0       0       0       0
#> gene 7         0       0       0       0       0       0       0       0
#> gene 29        0       0       0       0       0       0       0       0
#> gene 30        1       0       0       0       0       0       0       0
#> gene 31        0       0       0       0       0       0       0       0
#> gene 32        0       0       0       0       0       0       0       0
#> gene 33        0       0       0       0       0       0       0       0
#> gene 34        0       0       0       0       0       0       0       0
#> gene 36        0       0       0       0       0       0       0       0
#> gene 40        0       0       0       0       0       0       0       0
#> gene 44        0       0       0       0       0       0       0       0
#> gene 47        0       0       0       0       0       0       0       0
#> gene 49        0       0       0       0       0       0       0       0
#> gene 50        0       0       0       0       0       0       0       0
#> gene 51        0       0       0       0       0       0       0       0
#> gene 52        0       0       0       0       0       0       0       0
#> gene 53        0       0       0       0       0       0       0       0
#> gene 54        0       0       0       0       0       0       0       0
#> gene 55        0       0       0       0       0       0       0       0
#> gene 56        0       0       0       0       0       1       0       0
#> gene 66        0       0       0       0       0       0       0       0
#> gene 69        0       0       0       0       0       0       0       0
#> gene 77        0       0       0       0       1       0       0       0
#> gene 88        0       0       0       0       0       0       0       0
#> gene 89        0       0       0       0       0       0       0       0
#> gene 91        0       0       0       0       0       0       0       0
#> gene 111       0       0       0       0       0       0       0       0
#> XOR_EZH2       0       0       0       0       0       0       0       0
#> OR_CSF3R       0       0       0       0       0       0       0       0
#>          gene 89 gene 91 gene 111 XOR_EZH2 OR_CSF3R
#> gene 4         0       0        0        0        0
#> gene 5         0       0        0        0        0
#> gene 7         0       0        0        0        0
#> gene 29        0       1        0        0        0
#> gene 30        0       0        0        0        0
#> gene 31        0       0        0        0        0
#> gene 32        0       0        0        0        0
#> gene 33        0       0        0        0        0
#> gene 34        0       0        0        0        0
#> gene 36        0       0        0        0        0
#> gene 40        0       0        0        0        0
#> gene 44        0       0        0        0        0
#> gene 47        0       0        0        0        0
#> gene 49        0       0        0        0        0
#> gene 50        0       0        0        0        0
#> gene 51        0       0        0        0        0
#> gene 52        0       0        0        0        0
#> gene 53        0       0        0        0        0
#> gene 54        0       0        0        0        0
#> gene 55        0       0        0        0        0
#> gene 56        0       0        0        0        0
#> gene 66        0       0        0        0        0
#> gene 69        0       0        0        0        0
#> gene 77        0       0        0        0        0
#> gene 88        0       0        0        0        0
#> gene 89        0       0        0        0        0
#> gene 91        0       0        0        0        0
#> gene 111       0       0        0        0        0
#> XOR_EZH2       0       0        0        0        0
#> OR_CSF3R       0       0        0        0        0
#> 
#> $capri_aic
#>          gene 4 gene 5 gene 7 gene 29 gene 30 gene 31 gene 32 gene 33 gene 34
#> gene 4        0      0      0       0       0       0       0       0       1
#> gene 5        0      0      0       0       0       0       0       0       0
#> gene 7        0      0      0       0       0       1       1       0       0
#> gene 29       0      0      0       0       0       0       0       0       0
#> gene 30       0      0      0       0       0       0       0       0       0
#> gene 31       0      0      0       0       0       0       0       0       0
#> gene 32       0      1      0       0       0       0       0       0       0
#> gene 33       1      0      0       0       0       0       0       0       0
#> gene 34       0      0      0       0       0       0       0       0       0
#> gene 36       0      0      0       0       0       0       0       0       0
#> gene 40       0      0      0       0       0       0       0       0       0
#> gene 44       0      0      0       0       0       0       0       0       0
#> gene 47       0      0      0       0       0       0       0       0       0
#> gene 49       0      0      0       0       0       0       0       0       0
#> gene 50       0      0      0       0       0       0       0       0       0
#> gene 51       0      0      0       0       0       0       0       0       0
#> gene 52       0      0      0       0       0       0       0       0       0
#> gene 53       0      0      0       0       0       0       0       0       0
#> gene 54       0      0      0       0       0       0       0       0       0
#> gene 55       0      0      0       0       0       0       1       0       0
#> gene 56       0      0      0       0       0       0       0       0       0
#> gene 66       0      0      0       0       0       0       0       0       0
#> gene 69       0      0      0       0       0       0       0       0       0
#> gene 77       0      0      0       0       0       0       0       0       0
#> gene 88       0      0      0       0       0       0       0       0       0
#> gene 89       0      0      0       0       0       0       0       0       0
#> gene 91       0      0      0       0       0       0       0       0       1
#> gene 111      0      0      0       0       0       0       0       0       0
#> XOR_EZH2      0      0      0       0       0       0       0       0       0
#> OR_CSF3R      0      0      0       0       0       0       0       0       0
#>          gene 36 gene 40 gene 44 gene 47 gene 49 gene 50 gene 51 gene 52
#> gene 4         0       0       0       0       0       0       0       0
#> gene 5         0       0       0       0       0       0       0       0
#> gene 7         0       0       0       0       0       0       0       0
#> gene 29        0       0       0       0       0       0       0       0
#> gene 30        0       0       1       0       0       0       0       0
#> gene 31        0       0       0       0       0       0       0       0
#> gene 32        0       0       0       0       0       0       0       0
#> gene 33        0       0       0       0       1       0       1       0
#> gene 34        0       0       0       0       0       0       0       0
#> gene 36        0       0       0       0       0       0       0       0
#> gene 40        0       0       0       0       0       0       0       0
#> gene 44        0       0       0       0       0       0       0       0
#> gene 47        0       0       0       0       0       0       0       0
#> gene 49        0       0       0       0       0       0       0       0
#> gene 50        0       0       0       0       0       0       0       0
#> gene 51        0       0       0       0       0       0       0       0
#> gene 52        0       0       0       0       0       0       0       0
#> gene 53        0       0       0       0       0       0       0       0
#> gene 54        0       0       0       0       0       0       0       0
#> gene 55        0       0       0       0       0       0       0       0
#> gene 56        0       0       0       0       0       0       0       0
#> gene 66        0       0       0       0       0       0       0       0
#> gene 69        0       0       0       0       0       0       0       0
#> gene 77        0       0       0       1       0       0       0       0
#> gene 88        0       0       0       0       0       0       0       0
#> gene 89        0       0       0       0       0       0       0       0
#> gene 91        0       0       0       0       0       1       0       0
#> gene 111       0       0       0       0       0       0       0       0
#> XOR_EZH2       0       0       0       0       0       0       0       0
#> OR_CSF3R       0       0       0       0       0       0       0       0
#>          gene 53 gene 54 gene 55 gene 56 gene 66 gene 69 gene 77 gene 88
#> gene 4         0       0       0       1       0       0       0       0
#> gene 5         0       0       0       0       0       0       0       0
#> gene 7         0       0       0       0       0       0       0       0
#> gene 29        0       0       0       0       0       0       0       0
#> gene 30        1       0       0       0       0       0       0       0
#> gene 31        0       0       0       0       0       0       0       0
#> gene 32        0       0       0       0       0       0       1       0
#> gene 33        0       0       0       0       0       0       0       0
#> gene 34        0       0       0       0       0       0       0       0
#> gene 36        0       0       0       0       0       0       0       0
#> gene 40        0       0       0       0       0       0       0       0
#> gene 44        0       0       0       0       0       0       0       0
#> gene 47        0       0       0       0       0       0       0       0
#> gene 49        0       0       0       0       0       0       0       0
#> gene 50        0       0       0       0       0       0       0       0
#> gene 51        0       0       0       0       0       0       0       0
#> gene 52        0       0       0       0       0       0       0       0
#> gene 53        0       0       0       0       0       0       0       0
#> gene 54        0       0       0       0       0       0       0       0
#> gene 55        0       0       0       0       0       0       0       0
#> gene 56        0       0       0       0       0       1       0       0
#> gene 66        0       0       0       0       0       0       0       0
#> gene 69        0       0       0       0       0       0       0       0
#> gene 77        0       0       0       0       1       0       0       0
#> gene 88        0       0       0       0       0       0       0       0
#> gene 89        0       0       0       0       0       0       0       0
#> gene 91        0       0       0       0       0       0       0       0
#> gene 111       0       0       0       0       0       0       0       0
#> XOR_EZH2       0       0       0       0       0       0       0       0
#> OR_CSF3R       0       0       0       0       0       0       1       0
#>          gene 89 gene 91 gene 111 XOR_EZH2 OR_CSF3R
#> gene 4         0       0        0        0        0
#> gene 5         0       0        0        0        0
#> gene 7         0       0        0        0        0
#> gene 29        1       1        0        0        0
#> gene 30        0       0        0        0        0
#> gene 31        0       0        0        0        0
#> gene 32        0       0        0        0        0
#> gene 33        0       0        0        0        0
#> gene 34        0       0        0        0        0
#> gene 36        0       0        0        0        0
#> gene 40        0       0        0        0        0
#> gene 44        0       0        0        0        0
#> gene 47        0       0        0        0        0
#> gene 49        0       0        0        0        0
#> gene 50        0       0        0        0        0
#> gene 51        0       0        0        0        0
#> gene 52        0       0        0        0        0
#> gene 53        0       0        0        0        0
#> gene 54        0       0        0        0        0
#> gene 55        0       0        0        0        0
#> gene 56        0       0        0        0        0
#> gene 66        0       0        0        0        0
#> gene 69        0       0        0        0        0
#> gene 77        0       0        0        0        0
#> gene 88        0       0        0        0        0
#> gene 89        0       0        0        0        0
#> gene 91        0       0        0        0        0
#> gene 111       0       0        0        0        0
#> XOR_EZH2       0       0        0        0        0
#> OR_CSF3R       0       0        0        0        0
#> 
as.adj.matrix(test_model, events=as.events(test_model)[5:15,])
#> $capri_bic
#>         gene 30 gene 31 gene 32 gene 33 gene 34 gene 36 gene 40 gene 44 gene 47
#> gene 30       0       0       0       0       0       0       0       1       0
#> gene 31       0       0       0       0       0       0       0       0       0
#> gene 32       0       0       0       0       0       0       0       0       0
#> gene 33       0       0       0       0       0       0       0       0       0
#> gene 34       0       0       0       0       0       0       0       0       0
#> gene 36       0       0       0       0       0       0       0       0       0
#> gene 40       0       0       0       0       0       0       0       0       0
#> gene 44       0       0       0       0       0       0       0       0       0
#> gene 47       0       0       0       0       0       0       0       0       0
#> gene 49       0       0       0       0       0       0       0       0       0
#> gene 50       0       0       0       0       0       0       0       0       0
#>         gene 49 gene 50
#> gene 30       0       0
#> gene 31       0       0
#> gene 32       0       0
#> gene 33       1       0
#> gene 34       0       0
#> gene 36       0       0
#> gene 40       0       0
#> gene 44       0       0
#> gene 47       0       0
#> gene 49       0       0
#> gene 50       0       0
#> 
#> $capri_aic
#>         gene 30 gene 31 gene 32 gene 33 gene 34 gene 36 gene 40 gene 44 gene 47
#> gene 30       0       0       0       0       0       0       0       1       0
#> gene 31       0       0       0       0       0       0       0       0       0
#> gene 32       0       0       0       0       0       0       0       0       0
#> gene 33       0       0       0       0       0       0       0       0       0
#> gene 34       0       0       0       0       0       0       0       0       0
#> gene 36       0       0       0       0       0       0       0       0       0
#> gene 40       0       0       0       0       0       0       0       0       0
#> gene 44       0       0       0       0       0       0       0       0       0
#> gene 47       0       0       0       0       0       0       0       0       0
#> gene 49       0       0       0       0       0       0       0       0       0
#> gene 50       0       0       0       0       0       0       0       0       0
#>         gene 49 gene 50
#> gene 30       0       0
#> gene 31       0       0
#> gene 32       0       0
#> gene 33       1       0
#> gene 34       0       0
#> gene 36       0       0
#> gene 40       0       0
#> gene 44       0       0
#> gene 47       0       0
#> gene 49       0       0
#> gene 50       0       0
#> 
as.adj.matrix(test_model, events=as.events(test_model)[5:15,], type='pf')
#> $capri_bic
#>         gene 30 gene 31 gene 32 gene 33 gene 34 gene 36 gene 40 gene 44 gene 47
#> gene 30       0       0       0       0       0       0       0       1       0
#> gene 31       0       0       0       0       0       0       0       0       0
#> gene 32       0       0       0       0       0       0       0       0       0
#> gene 33       1       0       0       0       1       0       0       0       0
#> gene 34       0       0       0       0       0       0       0       0       0
#> gene 36       0       0       0       0       0       0       0       0       0
#> gene 40       0       0       0       0       0       0       0       0       0
#> gene 44       0       0       0       0       0       0       0       0       0
#> gene 47       0       0       0       0       0       0       0       0       0
#> gene 49       0       0       0       0       0       0       0       0       0
#> gene 50       0       0       0       0       0       0       0       0       0
#>         gene 49 gene 50
#> gene 30       0       0
#> gene 31       0       0
#> gene 32       0       0
#> gene 33       1       0
#> gene 34       0       0
#> gene 36       0       0
#> gene 40       0       0
#> gene 44       0       0
#> gene 47       0       0
#> gene 49       0       0
#> gene 50       0       0
#> 
#> $capri_aic
#>         gene 30 gene 31 gene 32 gene 33 gene 34 gene 36 gene 40 gene 44 gene 47
#> gene 30       0       0       0       0       0       0       0       1       0
#> gene 31       0       0       0       0       0       0       0       0       0
#> gene 32       0       0       0       0       0       0       0       0       0
#> gene 33       1       0       0       0       1       0       0       0       0
#> gene 34       0       0       0       0       0       0       0       0       0
#> gene 36       0       0       0       0       0       0       0       0       0
#> gene 40       0       0       0       0       0       0       0       0       0
#> gene 44       0       0       0       0       0       0       0       0       0
#> gene 47       0       0       0       0       0       0       0       0       0
#> gene 49       0       0       0       0       0       0       0       0       0
#> gene 50       0       0       0       0       0       0       0       0       0
#>         gene 49 gene 50
#> gene 30       0       0
#> gene 31       0       0
#> gene 32       0       0
#> gene 33       1       0
#> gene 34       0       0
#> gene 36       0       0
#> gene 40       0       0
#> gene 44       0       0
#> gene 47       0       0
#> gene 49       0       0
#> gene 50       0       0
#>