set.group.vector: Set group attribute for vertices of a mutation network

Description Usage Arguments Value Examples

Description

asdasd

Usage

1
2
3
set.group.vector(.G, .attr.name, .groups)

get.group.names(.G, .attr.name, .V = V(.G), .paste = T)

Arguments

.G

Mutation network.

.attr.name

Name of the new vertex attribute.

.groups

List with integer vector with indices of subjects for each group.

.V

Indices of vertices.

.paste

if T then return character string with concatenated group names, else return list with character vectors with group names.

Value

igraph object with new vertex attribute .attr.name with binary strings for set.group.vector. Return character vector for get.group.names.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
data(twb)
twb.shared <- shared.repertoire(twb)
G <- mutation.network(twb.shared)
G <- set.group.vector(G, "twins", list(A = c(1,2), B = c(3,4)))  # <= refactor this
get.group.names(G, "twins", 1)       # "A|B"
get.group.names(G, "twins", 300)     # "A"
get.group.names(G, "twins", 1, F)    # list(c("A", "B"))
get.group.names(G, "twins", 300, F)  # list(c("A"))
# Because we have only two groups, we can assign more readable attribute.
V(G)$twin.names <- get.group.names(G, "twins")
V(G)$twin.names[1]  # "A|B"
V(G)$twin.names[300]  # "A"

## End(Not run)

tcR documentation built on July 2, 2020, 3:18 a.m.